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 {
return Mail_Parse::parsePriority($this->getHeader());
}
function parsePriority($header=null){
$priority=0;
if($header && ($begin=strpos($header,'X-Priority:'))!==false){
$begin+=strlen('X-Priority:');
$xpriority=preg_replace("/[^0-9]/", "",substr($header, $begin, strpos($header,"\n",$begin) - $begin));
if(!is_numeric($xpriority))
$priority=0;
elseif($xpriority>4)
$priority=1;
elseif($xpriority>=3)
$priority=2;
elseif($xpriority>0)
$priority=3;
}
return $priority;
static function parsePriority($header=null){
if (! $header)
return 0;
// Test for normal "X-Priority: INT" style header & stringy version.
// Allows for Importance possibility.
$matching_char = '';
if (preg_match ( '/priority: (\d|\w)/i', $header, $matching_char )
|| preg_match ( '/importance: (\d|\w)/i', $header, $matching_char )) {
switch ($matching_char[1]) {
case 'h' :
case 'H' :// high
case 'u':
case 'U': //Urgent
case 6 :
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){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment