Skip to content
Snippets Groups Projects
Commit 4526e543 authored by clonemeagain's avatar clonemeagain
Browse files

Update class.mailparse.php

Best version of https://github.com/osTicket/osTicket-1.8/pull/348

static keyword added to enable strict test mode.
parent 169324e3
No related branches found
No related tags found
No related merge requests found
...@@ -302,22 +302,36 @@ class Mail_Parse { ...@@ -302,22 +302,36 @@ class Mail_Parse {
return Mail_Parse::parsePriority($this->getHeader()); return Mail_Parse::parsePriority($this->getHeader());
} }
function parsePriority($header=null){ static function parsePriority($header=null){
$priority=0; if (! $header)
if($header && ($begin=strpos($header,'X-Priority:'))!==false){ return 0;
$begin+=strlen('X-Priority:'); // Test for normal "X-Priority: INT" style header & stringy version.
$xpriority=preg_replace("/[^0-9]/", "",substr($header, $begin, strpos($header,"\n",$begin) - $begin)); // Allows for Importance possibility.
if(!is_numeric($xpriority)) $matching_char = '';
$priority=0; if (preg_match ( '/priority: (\d|\w)/i', $header, $matching_char )
elseif($xpriority>4) || preg_match ( '/importance: (\d|\w)/i', $header, $matching_char )) {
$priority=1; switch ($matching_char[1]) {
elseif($xpriority>=3) case 'h' :
$priority=2; case 'H' :// high
elseif($xpriority>0) case 'u':
$priority=3; case 'U': //Urgent
} case 6 :
return $priority; case 5 :
return 1;
case 'n' : // normal
case 'N' :
case 4 :
case 3 :
return 2;
case 'l' : // low
case 'L' :
case 2 :
case 1 :
return 3;
}
}
return 0;
} }
function parseAddressList($address){ function parseAddressList($address){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment