@@ -2,13 +2,13 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | function imapFolder($cf, $username) { |
| 4 | 4 | $open='{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}'; |
| 5 | - $m_mail = imap_open($open, $username, $cf['authpassword'], OP_READONLY) |
|
| 6 | - or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error()); |
|
| 7 | - if ( !$m_mail ) exit(254); |
|
| 5 | + $m_mail = imap_open($open, $username, $cf['authpassword'], OP_READONLY) |
|
| 6 | + or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error()); |
|
| 7 | + if ( !$m_mail ) exit(254); |
|
| 8 | 8 | |
| 9 | 9 | |
| 10 | - syslog (LOG_INFO,$cf['user'].': Successfully connected to <'.$cf['mailhost'].'>; Listing folders of account <'.$username.'>...'); |
|
| 11 | - //get all folder |
|
| 10 | + syslog (LOG_INFO,$cf['user'].': Successfully connected to <'.$cf['mailhost'].'>; Listing folders of account <'.$username.'>...'); |
|
| 11 | + //get all folder |
|
| 12 | 12 | $list = imap_list($m_mail, $open, "*"); |
| 13 | 13 | imap_close($m_mail); |
| 14 | 14 | if (is_array($list)) |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | function imapFind ($cf, $username, $folder) { |
| 23 | 23 | $head=array(); |
| 24 | 24 | $m_mail = imap_open('{'.$cf['mailhost'].':143/imap/novalidate-cert/authuser='.$cf['authuser'].'}'.$folder, $username,$cf['authpassword'], OP_READONLY) |
| 25 | - or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error()); |
|
| 25 | + or syslog (LOG_EMERG, $cf['user'].': Error in IMAP connection to <'.$cf['mailhost'].'>: ' . imap_last_error()); |
|
| 26 | 26 | if ( !$m_mail ) exit(254); |
| 27 | 27 | |
| 28 | 28 | |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | // Order results starting from newest message |
| 36 | 36 | if ( empty($m_search) ) { |
| 37 | 37 | syslog (LOG_INFO,$cf['user'].": No suitable mail found in <$folder> folder."); |
| 38 | - if ( $ierr = imap_errors() ) |
|
| 39 | - foreach ( $ierr as $thiserr ) |
|
| 40 | - syslog (LOG_ERR, $cf['user'].": IMAP Error: $thiserr"); |
|
| 41 | - if ( $ierr = imap_alerts() ) |
|
| 42 | - foreach ( $ierr as $thiserr ) |
|
| 43 | - syslog (LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr"); |
|
| 38 | + if ( $ierr = imap_errors() ) |
|
| 39 | + foreach ( $ierr as $thiserr ) |
|
| 40 | + syslog (LOG_ERR, $cf['user'].": IMAP Error: $thiserr"); |
|
| 41 | + if ( $ierr = imap_alerts() ) |
|
| 42 | + foreach ( $ierr as $thiserr ) |
|
| 43 | + syslog (LOG_ALERT, $cf['user'].": IMAP Alert: $thiserr"); |
|
| 44 | 44 | imap_close( $m_mail ); |
| 45 | 45 | return FALSE; |
| 46 | 46 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | syslog (LOG_INFO,$cf['user'].": Found $nmes mail in <$folder> folder."); |
| 49 | 49 | if ($nmes>0) rsort($m_search); |
| 50 | 50 | |
| 51 | - // loop for each message |
|
| 51 | + // loop for each message |
|
| 52 | 52 | foreach ($m_search as $onem) |
| 53 | 53 | $head[] = imap_fetchheader($m_mail, $onem ); |
| 54 | 54 | imap_close($m_mail); |
@@ -66,55 +66,55 @@ discard block |
||
| 66 | 66 | /* Get relevant Info from header's mail */ |
| 67 | 67 | /* Each line must end with /r/n */ |
| 68 | 68 | |
| 69 | - $dateC = NULL; |
|
| 69 | + $dateC = NULL; |
|
| 70 | 70 | $mid = NULL; |
| 71 | 71 | $result = array( |
| 72 | - 'date' => NULL, |
|
| 73 | - 'from' => NULL, |
|
| 74 | - 'messageid' => NULL, |
|
| 72 | + 'date' => NULL, |
|
| 73 | + 'from' => NULL, |
|
| 74 | + 'messageid' => NULL, |
|
| 75 | 75 | 'dmarc' => array( |
| 76 | 76 | 'result' => NULL, |
| 77 | 77 | 'dom' => NULL |
| 78 | 78 | ), |
| 79 | 79 | 'spf' => array( |
| 80 | - 'result' => NULL, |
|
| 81 | - 'dom' => NULL |
|
| 82 | - ), |
|
| 80 | + 'result' => NULL, |
|
| 81 | + 'dom' => NULL |
|
| 82 | + ), |
|
| 83 | 83 | 'dkim' => array( |
| 84 | - 'result' => NULL, |
|
| 85 | - 'dom' => NULL |
|
| 86 | - ), |
|
| 87 | - 'spam' => array( |
|
| 88 | - 'status' => NULL, |
|
| 89 | - 'score' => NULL, |
|
| 90 | - 'th' => NULL, |
|
| 91 | - ), |
|
| 92 | - 'dspam' => array( |
|
| 93 | - 'type' => NULL, |
|
| 94 | - 'level' => NULL, |
|
| 84 | + 'result' => NULL, |
|
| 85 | + 'dom' => NULL |
|
| 86 | + ), |
|
| 87 | + 'spam' => array( |
|
| 88 | + 'status' => NULL, |
|
| 89 | + 'score' => NULL, |
|
| 90 | + 'th' => NULL, |
|
| 91 | + ), |
|
| 92 | + 'dspam' => array( |
|
| 93 | + 'type' => NULL, |
|
| 94 | + 'level' => NULL, |
|
| 95 | 95 | 'learn' => NULL |
| 96 | - ), |
|
| 96 | + ), |
|
| 97 | 97 | 'warn' => NULL |
| 98 | - ); |
|
| 98 | + ); |
|
| 99 | 99 | |
| 100 | 100 | |
| 101 | - if ( preg_match_all ('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)dmarc=(?<dmarc>\w+)\s+\(p=\w+\s+dis=\w+\)\s+header\.from=(?<DMARCfrom>[\w\.]+)/m',$header,$received) ) { |
|
| 101 | + if ( preg_match_all ('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)dmarc=(?<dmarc>\w+)\s+\(p=\w+\s+dis=\w+\)\s+header\.from=(?<DMARCfrom>[\w\.]+)/m',$header,$received) ) { |
|
| 102 | 102 | $k=0; |
| 103 | - for ($i = count($received[0])-1;$i>=0;$i--) { |
|
| 104 | - foreach ($ARhosts as $mx) { |
|
| 103 | + for ($i = count($received[0])-1;$i>=0;$i--) { |
|
| 104 | + foreach ($ARhosts as $mx) { |
|
| 105 | 105 | if ($mx == $received['host'][$i]) { |
| 106 | 106 | /* This is a trusted AR result */ |
| 107 | 107 | $result['dmarc']['result']=$received['dmarc'][$i]; |
| 108 | 108 | $result['dmarc']['dom'] = $received['DMARCfrom'][$i]; |
| 109 | 109 | $k++; |
| 110 | 110 | } |
| 111 | - } |
|
| 111 | + } |
|
| 112 | + } |
|
| 112 | 113 | } |
| 113 | - } |
|
| 114 | 114 | $received=NULL; |
| 115 | 115 | if ($k>1) $result['warn'][] = 'The trusted DMARC AR Headers are present more than once. Something wrong.'; |
| 116 | 116 | |
| 117 | - if ( preg_match_all('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)spf=(?<spf>\w+)\s+smtp\.(?:mailfrom|helo)=(?<SPFfrom>[\w\.]+)/m',$header,$received) ) { |
|
| 117 | + if ( preg_match_all('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)spf=(?<spf>\w+)\s+smtp\.(?:mailfrom|helo)=(?<SPFfrom>[\w\.]+)/m',$header,$received) ) { |
|
| 118 | 118 | $k=0; |
| 119 | 119 | for ($i = count($received[0])-1;$i>=0;$i--) { |
| 120 | 120 | foreach ($ARhosts as $mx) { |
@@ -123,25 +123,25 @@ discard block |
||
| 123 | 123 | $result['spf']['result']=$received['spf'][$i]; |
| 124 | 124 | $result['spf']['dom'] = $received['SPFfrom'][$i]; |
| 125 | 125 | $k++; |
| 126 | - } |
|
| 127 | - } |
|
| 128 | - } |
|
| 126 | + } |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | 129 | } |
| 130 | 130 | $received=NULL; |
| 131 | 131 | if ($k>1) $result['warn'][] = 'The trusted SPF AR Headers are present more than once. Something wrong.'; |
| 132 | 132 | |
| 133 | - if ( preg_match_all('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)dkim=(?<dkim>\w+)\s+[\w\s\(\)\-]+header\.d=(?<DKIMdom>[\w\.]+)/m',$header,$received) ) { |
|
| 133 | + if ( preg_match_all('/^Authentication\-Results:\s+(?<host>[\w\.]+);(?:\s+|\r\n\s+)dkim=(?<dkim>\w+)\s+[\w\s\(\)\-]+header\.d=(?<DKIMdom>[\w\.]+)/m',$header,$received) ) { |
|
| 134 | 134 | $k=0; |
| 135 | 135 | for ($i = count($received[0])-1;$i>=0;$i--) { |
| 136 | - foreach ($ARhosts as $mx) { |
|
| 137 | - if ($mx == $received['host'][$i]) { |
|
| 138 | - /* This is a trusted AR result */ |
|
| 139 | - $result['dkim']['result']=$received['dkim'][$i]; |
|
| 140 | - $result['dkim']['dom'] = $received['DKIMdom'][$i]; |
|
| 136 | + foreach ($ARhosts as $mx) { |
|
| 137 | + if ($mx == $received['host'][$i]) { |
|
| 138 | + /* This is a trusted AR result */ |
|
| 139 | + $result['dkim']['result']=$received['dkim'][$i]; |
|
| 140 | + $result['dkim']['dom'] = $received['DKIMdom'][$i]; |
|
| 141 | 141 | $k++; |
| 142 | - } |
|
| 143 | - } |
|
| 144 | - } |
|
| 142 | + } |
|
| 143 | + } |
|
| 144 | + } |
|
| 145 | 145 | } |
| 146 | 146 | $received=NULL; |
| 147 | 147 | if ($k>1) $result['warn'][] = 'The trusted DKIM AR Headers are present more than once. Something wrong.'; |
@@ -149,59 +149,59 @@ discard block |
||
| 149 | 149 | if ($dpl) { /* Use Spamassassin Plugin */ |
| 150 | 150 | if ( preg_match_all('/^X\-Spam\-Status:\s(?P<spamstatus>\w+)\,(?:\s+|\r\n\s+)score=(?P<score>[\-\.\d]+)(?:\s+|\r\n\s+)tagged_above=\-{0,1}\d+(?:\s+|\r\n\s+)required=(?P<th>[\-\.\d]+)(?:\s+|\r\n\s+)tests=\[(?:.|\r\n\s+)*DSPAM_(?P<dtype>SPAM|HAM)_(?P<dlevel>\d\d)(?:.|\r\n\s+)*\]/m',$header,$received) ) { |
| 151 | 151 | $result['spam']['status']=$received['spamstatus'][0]; |
| 152 | - $result['spam']['score'] = $received['score'][0]; |
|
| 152 | + $result['spam']['score'] = $received['score'][0]; |
|
| 153 | 153 | $result['spam']['th'] = $received['th'][0]; |
| 154 | 154 | $result['dspam']['type'] = $received['dtype'][0]; |
| 155 | 155 | $result['dspam']['level'] =$received['dlevel'][0]; |
| 156 | - } |
|
| 157 | - if (count($received[0])>1) $result['warn'][] = 'The Spamassassin Headers are present more than once. I consider only the last one.'; |
|
| 156 | + } |
|
| 157 | + if (count($received[0])>1) $result['warn'][] = 'The Spamassassin Headers are present more than once. I consider only the last one.'; |
|
| 158 | 158 | } |
| 159 | 159 | else { /* Parse apart all DSPAM Header and calculate a level */ |
| 160 | 160 | if ( preg_match_all('/^X\-Spam\-Status:\s(?P<spamstatus>\w+)\,(?:\s+|\r\n\s+)score=(?P<score>[\-\.\d]+)(?:\s+|\r\n\s+)tagged_above=\-{0,1}\d+(?:\s+|\r\n\s+)required=(?P<th>[\-\.\d]+)(?:\s+|\r\n\s+)tests=\[(?:.|\r\n\s+)*\]/m',$header,$received) ) { |
| 161 | - $result['spam']['status']=$received['spamstatus'][0]; |
|
| 162 | - $result['spam']['score'] = $received['score'][0]; |
|
| 163 | - $result['spam']['th'] = $received['th'][0]; |
|
| 161 | + $result['spam']['status']=$received['spamstatus'][0]; |
|
| 162 | + $result['spam']['score'] = $received['score'][0]; |
|
| 163 | + $result['spam']['th'] = $received['th'][0]; |
|
| 164 | 164 | if (count($received[0])>1) |
| 165 | 165 | $result['warn'][]= 'The Spamassassin Headers are present more than once. I consider only the last one.'; |
| 166 | 166 | } |
| 167 | 167 | if ( preg_match ('/\r\nX\-DSPAM\-Result:\s(?P<result>.*)\r\n/',$header,$received) != 1) |
| 168 | - $result['warn'] = 'DSPAM Result invalid, not present or present more than once.'; |
|
| 169 | - else |
|
| 170 | - $result['dspam']['type']=$received['result']; |
|
| 168 | + $result['warn'] = 'DSPAM Result invalid, not present or present more than once.'; |
|
| 169 | + else |
|
| 170 | + $result['dspam']['type']=$received['result']; |
|
| 171 | 171 | $prob = NULL; |
| 172 | 172 | $conf = NULL; |
| 173 | - if ( preg_match ('/\r\nX\-DSPAM\-Probability:\s(?P<prob>.*)\r\n/',$header,$received) != 1) |
|
| 174 | - $result['warn'][] = 'DSPAM Probability invalid, not present or present more than once.'; |
|
| 173 | + if ( preg_match ('/\r\nX\-DSPAM\-Probability:\s(?P<prob>.*)\r\n/',$header,$received) != 1) |
|
| 174 | + $result['warn'][] = 'DSPAM Probability invalid, not present or present more than once.'; |
|
| 175 | 175 | else |
| 176 | 176 | $prob = $received['prob']; |
| 177 | 177 | if ( preg_match ('/\r\nX\-DSPAM\-Confidence:\s(?P<conf>.*)\r\n/',$header,$received) != 1) |
| 178 | - $result['warn'][] = 'DSPAM Confidence invalid, not present or present more than once.'; |
|
| 178 | + $result['warn'][] = 'DSPAM Confidence invalid, not present or present more than once.'; |
|
| 179 | 179 | else |
| 180 | 180 | $conf = $received['conf']; |
| 181 | 181 | $result['dspam']['level'] = dspamLevel($prob,$conf); |
| 182 | 182 | } |
| 183 | 183 | $received=NULL; |
| 184 | 184 | if ( preg_match ('/\r\nFrom:\s(?P<from>.*)\r\n/',$header,$received) != 1) |
| 185 | - $result['warn'][] = 'From header invalid or not present'; |
|
| 186 | - else |
|
| 187 | - $result['from'] = $received['from']; |
|
| 185 | + $result['warn'][] = 'From header invalid or not present'; |
|
| 186 | + else |
|
| 187 | + $result['from'] = $received['from']; |
|
| 188 | 188 | |
| 189 | - if ( preg_match ('/\r\nDate:\s(?P<date>.*)\r\n/',$header,$received) != 1) |
|
| 190 | - $result['warn'][] = 'Date header invalid or not present'; |
|
| 189 | + if ( preg_match ('/\r\nDate:\s(?P<date>.*)\r\n/',$header,$received) != 1) |
|
| 190 | + $result['warn'][] = 'Date header invalid or not present'; |
|
| 191 | 191 | else |
| 192 | 192 | $result['date'] = $received['date']; |
| 193 | 193 | |
| 194 | 194 | $received=NULL; |
| 195 | - if ( preg_match ('/\r\nMessage\-I(?:D|d):\s(?P<mid>.*)\r\n/',$header,$received) != 1) |
|
| 196 | - $result['warn'][] = 'Message-ID invalid, not present or present more than once.'; |
|
| 195 | + if ( preg_match ('/\r\nMessage\-I(?:D|d):\s(?P<mid>.*)\r\n/',$header,$received) != 1) |
|
| 196 | + $result['warn'][] = 'Message-ID invalid, not present or present more than once.'; |
|
| 197 | 197 | else |
| 198 | 198 | $result['messageid']=$received['mid']; |
| 199 | 199 | |
| 200 | - $received=NULL; |
|
| 200 | + $received=NULL; |
|
| 201 | 201 | |
| 202 | - switch ($learn) { |
|
| 202 | + switch ($learn) { |
|
| 203 | 203 | case 'dspamc': |
| 204 | - if ( preg_match ('/\r\nX\-DSPAM\-Signature:\s(?P<sig>.*)\r\n/',$header,$received) != 1) |
|
| 204 | + if ( preg_match ('/\r\nX\-DSPAM\-Signature:\s(?P<sig>.*)\r\n/',$header,$received) != 1) |
|
| 205 | 205 | $result['warn'] = 'DSPAM Signature invalid, not present or present more than once.'; |
| 206 | 206 | else |
| 207 | 207 | $result['dspam']['learn']=$received['sig']; |
@@ -212,23 +212,23 @@ discard block |
||
| 212 | 212 | syslog (LOG_INFO,$user.': Error in "learn" imap configuration value. Please, set "dspamc" or "false".'); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - return $result; |
|
| 215 | + return $result; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | function printTableHeader($title,$content,$footer=FALSE,$fcontent) { |
| 222 | - print <<<END |
|
| 222 | + print <<<END |
|
| 223 | 223 | <caption>$title</caption> |
| 224 | 224 | <thead> |
| 225 | 225 | <tr> |
| 226 | 226 | END; |
| 227 | 227 | $kcontent = array_keys($content); |
| 228 | - $cols = count($kcontent); |
|
| 229 | - for ($i=0; $i<$cols; $i++) { |
|
| 228 | + $cols = count($kcontent); |
|
| 229 | + for ($i=0; $i<$cols; $i++) { |
|
| 230 | 230 | $key = $kcontent[$i]; |
| 231 | - printf ('<th colspan="%d" rowspan="%d">%s</th>', |
|
| 231 | + printf ('<th colspan="%d" rowspan="%d">%s</th>', |
|
| 232 | 232 | !is_array($content[$key]) ?: |
| 233 | 233 | count(array_keys($content[$key])) ?: '1', |
| 234 | 234 | !is_array($content[$key]) ?: |
@@ -244,13 +244,13 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - print '</tr></thead>'; |
|
| 248 | - if ($footer) { |
|
| 249 | - print '<tfoot><tr>'; |
|
| 250 | - print "<th colspan=\"$cols\">".$fcontent.'</th>'; |
|
| 251 | - print '</tr></tfoot>'; |
|
| 252 | - } |
|
| 253 | - return TRUE; |
|
| 247 | + print '</tr></thead>'; |
|
| 248 | + if ($footer) { |
|
| 249 | + print '<tfoot><tr>'; |
|
| 250 | + print "<th colspan=\"$cols\">".$fcontent.'</th>'; |
|
| 251 | + print '</tr></tfoot>'; |
|
| 252 | + } |
|
| 253 | + return TRUE; |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | /* Spamassassin format */ |
| 329 | 329 | if (isset($row['status'])) |
| 330 | - switch($row['status']) { |
|
| 330 | + switch($row['status']) { |
|
| 331 | 331 | case 'No': |
| 332 | 332 | $color = 'rgba(0,255,0, %.1f)'; |
| 333 | 333 | break; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | $folders=imapFolder($conf['imap'], $_POST['username']); |
| 15 | 15 | print '<option value="" selected disabled>Choose a folder</option>'; |
| 16 | 16 | foreach ( $folders as $folder ) |
| 17 | - printf('<option value="%s">%s</option>', |
|
| 17 | + printf('<option value="%s">%s</option>', |
|
| 18 | 18 | $folder, |
| 19 | 19 | htmlspecialchars(mb_convert_encoding($folder, "UTF-8", "UTF7-IMAP"))); |
| 20 | 20 | closelog(); |
@@ -27,32 +27,32 @@ |
||
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | $data = array( |
| 30 | - 'date' => NULL, |
|
| 31 | - 'from' => NULL, |
|
| 32 | - 'messageid' => NULL, |
|
| 33 | - 'dmarc' => array( |
|
| 34 | - 'result' => NULL, |
|
| 35 | - 'dom' => NULL |
|
| 36 | - ), |
|
| 37 | - 'spf' => array( |
|
| 38 | - 'result' => NULL, |
|
| 39 | - 'dom' => NULL |
|
| 40 | - ), |
|
| 41 | - 'dkim' => array( |
|
| 42 | - 'result' => NULL, |
|
| 43 | - 'dom' => NULL |
|
| 44 | - ), |
|
| 45 | - 'spam' => array( |
|
| 46 | - 'status' => NULL, |
|
| 47 | - 'score' => NULL, |
|
| 48 | - 'th' => NULL, |
|
| 49 | - ), |
|
| 50 | - 'dspam' => array( |
|
| 51 | - 'type' => NULL, |
|
| 52 | - 'level' => NULL, |
|
| 53 | - 'learn' => NULL |
|
| 54 | - ), |
|
| 55 | - 'warn' => NULL |
|
| 30 | + 'date' => NULL, |
|
| 31 | + 'from' => NULL, |
|
| 32 | + 'messageid' => NULL, |
|
| 33 | + 'dmarc' => array( |
|
| 34 | + 'result' => NULL, |
|
| 35 | + 'dom' => NULL |
|
| 36 | + ), |
|
| 37 | + 'spf' => array( |
|
| 38 | + 'result' => NULL, |
|
| 39 | + 'dom' => NULL |
|
| 40 | + ), |
|
| 41 | + 'dkim' => array( |
|
| 42 | + 'result' => NULL, |
|
| 43 | + 'dom' => NULL |
|
| 44 | + ), |
|
| 45 | + 'spam' => array( |
|
| 46 | + 'status' => NULL, |
|
| 47 | + 'score' => NULL, |
|
| 48 | + 'th' => NULL, |
|
| 49 | + ), |
|
| 50 | + 'dspam' => array( |
|
| 51 | + 'type' => NULL, |
|
| 52 | + 'level' => NULL, |
|
| 53 | + 'learn' => NULL |
|
| 54 | + ), |
|
| 55 | + 'warn' => NULL |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | 58 | if (empty($folder)) exit ('<p>No folder found.</p>'); /* This should not occur */ |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | require_once('function.php'); |
| 17 | 17 | |
| 18 | 18 | if ( !isset($version) ) { |
| 19 | - openlog('mailClassifierEmergency', LOG_PID, LOG_LOCAL0); |
|
| 20 | - syslog (LOG_EMERG, sprintf('unknown: I can\'t read the config files. Do you have configured the $path in %s?', __FILE__)); |
|
| 21 | - closelog(); |
|
| 22 | - exit(255); |
|
| 19 | + openlog('mailClassifierEmergency', LOG_PID, LOG_LOCAL0); |
|
| 20 | + syslog (LOG_EMERG, sprintf('unknown: I can\'t read the config files. Do you have configured the $path in %s?', __FILE__)); |
|
| 21 | + closelog(); |
|
| 22 | + exit(255); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | checkSSL(); |
@@ -26,12 +26,12 @@ |
||
| 26 | 26 | if ( preg_match ('/^X-DSPAM-Result:\s+(?P<user>[\w\.\@]+);\s+result="(?P<result>\w+)";\s+class="(?P<class>\w+)";\s+probability=(?P<prob>[\d\.]+);\s+confidence=(?P<conf>[\d\.]+);\s+signature=(?P<sig>[\w\,]+)$/',$out[0],$received) != 1) { |
| 27 | 27 | $err = 'DSPAM Client returned an unparseable result.'; |
| 28 | 28 | syslog(LOG_ERR, $username.': Learn Error: '.$err); |
| 29 | - exit (sprintf('<p>%s</p>',htmlentities($err))); |
|
| 29 | + exit (sprintf('<p>%s</p>',htmlentities($err))); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | printf('<p>Message learned successfully with following result:</p><ul><li>Owner: <b>%s</b></li><li>Result: <b>%s</b></li><li>Class: <b>%s</b></li></ul>', |
| 33 | 33 | htmlentities($received['user']), |
| 34 | - $received['result'], $received['class']); |
|
| 34 | + $received['result'], $received['class']); |
|
| 35 | 35 | ?> |
| 36 | 36 | closelog(); |
| 37 | 37 | </div> |