- $row = $DB->getMail($id);
- $string = $row->mail_text;
- $sa_tests = null;
- $params['include_bodies'] = false;
- $params['decode_bodies'] = true;
- $params['decode_headers'] = true;
- $params['input'] = $string;
- $params['crlf'] = "\r\n";
-
- $structure = Mail_mimeDecode::decode($params);
- $headers = $structure->headers;
- $rows = array();
- foreach ($headers as $header => $value) {
- if ($header == 'x-spam-status') {
- if (preg_match('/^(.*),\s*score=([\d\.]+).*tests=\[(.*)\].*/',
- $value, $matches)) {
- $sa_tests = array('x-spam-status' => $matches[1],
- 'score' => $matches[2], 'tests' => $matches[3]);
- }
- } else if ($header == 'x-spam-flag') {
+ $row = $DB->getMail($id);
+ $string = $row->mail_text;
+ $sa_tests = null;
+ $params['include_bodies'] = false;
+ $params['decode_bodies'] = true;
+ $params['decode_headers'] = true;
+ $params['input'] = $string;
+ $params['crlf'] = "\r\n";
+
+ $structure = Mail_mimeDecode::decode($params);
+ $headers = $structure->headers;
+ $rows = array();
+ foreach ($headers as $header => $value) {
+ if ($header == 'x-spam-status') {
+ if (preg_match('/^(.*),\s*score=([\d\.]+).*tests=\[(.*)\].*/',
+ $value, $matches)) {
+ $sa_tests = array('x-spam-status' => $matches[1],
+ 'score' => $matches[2], 'tests' => $matches[3]);
+ }
+ } else if ($header == 'x-spam-flag') {
- }
- }
- $bayes = array();
- if ($sa_tests) {
- $sa_tests['tests'] = str_replace(" ","",$sa_tests['tests']);
- $sa_rules = explode(",",$sa_tests['tests']);
- $sa_count = count($sa_rules);
- for ($i = 0; $i < $sa_count; $i++) {
- $sa_rule = explode("=", $sa_rules[$i]);
- $bayes[$i] = "<tr><td class=\"label\">$sa_rule[0]</td><td class=\"value\">$sa_rule[1]</td></tr>";
- }
- $bayes['total'] = "<tr><td class=\"label\">TOTAL</td><td class=\"value\">".$sa_tests['score']."</td></tr>";
- } else {
- $bayes['total'] = "<tr><td class=\"label\">TOTAL</td><td class=\"value\">-</td></tr>";
- }
- $plain = "?id=$id&format=plain";
- $html = "?id=$id&format=html";
- echo '<p class="ruler">Message ID : ' . $mail->mail_id . '</p>';
- echo '<table class="button-menu">';
- echo '<tr class="button-row">';
- echo '<td class="button"><input class="btn-input" type="button" value="Return"
- onclick="javascript: history.back();"/></td>';
- echo '<td class="button"><input class="btn-input" type="button" value="View HTML"
- onclick="javascript: window.location.href=\'message_view.php'.$html.'\'"/></td>';
- echo '<td class="button"><input class="btn-input" type="button" value="View Plain Text"
- onclick="javascript: window.location.href=\'message_view.php'.$plain.'\'"/></td>';
- echo '<td class="button"><input class="btn-input" type="button" value="View Full Headers"
- onclick="javascript: window.location.href=\'show_headers.php?id='.$id.'\'"/></td>';
- echo '</tr></table>';
- echo '<table>';
- if (isset($rows['spam']))
- echo $rows['spam'];
- if (isset($rows['score']))
- echo $rows['score'];
- if (isset($rows['level']))
- echo $rows['level'];
- if (isset($rows['headers']))
- echo $rows['headers'];
- if (isset($rows['date']))
- echo $rows['date'];
- if (isset($rows['from']))
- echo $rows['from'];
- if (isset($rows['reply-to']))
- echo $rows['reply-to'];
- if (isset($rows['to']))
- echo $rows['to'];
- if (isset($rows['subject']))
- echo $rows['subject'];
- echo '</table>';
- echo '<p class="ruler">Spamassassin Report</p>';
- echo '<table><tr><th>Rule</th><th>Score</th></tr>';
- foreach ($bayes as $key => $row) {
- if ($key != 'total') {
- echo $row;
- }
- }
- echo $bayes['total'];
- echo '</table>';
- echo $util->getFooter();
- } else if ($loggedIn) {
- header('Location: index.php');
- } else {
- header('Location: auth.php');
- }
+ }
+ }
+ $bayes = array();
+ if ($sa_tests) {
+ $sa_tests['tests'] = str_replace(" ","",$sa_tests['tests']);
+ $sa_rules = explode(",",$sa_tests['tests']);
+ $sa_count = count($sa_rules);
+ for ($i = 0; $i < $sa_count; $i++) {
+ $sa_rule = explode("=", $sa_rules[$i]);
+ $bayes[$i] = "<tr><td class=\"label\">$sa_rule[0]</td><td class=\"value\">$sa_rule[1]</td></tr>";
+ }
+ $bayes['total'] = "<tr><td class=\"label\">TOTAL</td><td class=\"value\">".$sa_tests['score']."</td></tr>";
+ } else {
+ $bayes['total'] = "<tr><td class=\"label\">TOTAL</td><td class=\"value\">-</td></tr>";
+ }
+ $plain = "?id=$id&format=plain";
+ $html = "?id=$id&format=html";
+ echo '<p class="ruler">Message ID : ' . $mail->mail_id . '</p>';
+ echo '<table class="button-menu">';
+ echo '<tr class="button-row">';
+ echo '<td class="button"><input class="btn-input" type="button" value="Return"
+ onclick="javascript: history.back();"/></td>';
+ echo '<td class="button"><input class="btn-input" type="button" value="View HTML"
+ onclick="javascript: window.location.href=\'message_view.php'.$html.'\'"/></td>';
+ echo '<td class="button"><input class="btn-input" type="button" value="View Plain Text"
+ onclick="javascript: window.location.href=\'message_view.php'.$plain.'\'"/></td>';
+ echo '<td class="button"><input class="btn-input" type="button" value="View Full Headers"
+ onclick="javascript: window.location.href=\'show_headers.php?id='.$id.'\'"/></td>';
+ echo '</tr></table>';
+ echo '<table>';
+ if (isset($rows['spam']))
+ echo $rows['spam'];
+ if (isset($rows['score']))
+ echo $rows['score'];
+ if (isset($rows['level']))
+ echo $rows['level'];
+ if (isset($rows['headers']))
+ echo $rows['headers'];
+ if (isset($rows['date']))
+ echo $rows['date'];
+ if (isset($rows['from']))
+ echo $rows['from'];
+ if (isset($rows['reply-to']))
+ echo $rows['reply-to'];
+ if (isset($rows['to']))
+ echo $rows['to'];
+ if (isset($rows['subject']))
+ echo $rows['subject'];
+ echo '</table>';
+ echo '<p class="ruler">Spamassassin Report</p>';
+ echo '<table><tr><th>Rule</th><th>Score</th></tr>';
+ foreach ($bayes as $key => $row) {
+ if ($key != 'total') {
+ echo $row;
+ }
+ }
+ echo $bayes['total'];
+ echo '</table>';
+ echo $util->getFooter();
+ } else if ($loggedIn) {
+ header('Location: index.php');
+ } else {
+ header('Location: auth.php');
+ }