]> git.datanom.net - qtadmin.git/blobdiff - show_headers.php
First upload of wblist page
[qtadmin.git] / show_headers.php
index 0c0197ca21732867782bceb6a7d52df520279b8a..34ca0657dfdc4858d0d7e4d065333ad4bad23f98 100644 (file)
@@ -1,59 +1,64 @@
 <?php
 /* vim: set ts=4 tw=0 sw=4 noet: */
-       require_once 'Mail/mimeDecode.php';
-       require_once 'config.php';
-       require_once $CFG->root . 'lib/db_factory.php';
-       require_once $CFG->root . 'lib/utils.inc.php';
+    require_once 'Mail/mimeDecode.php';
+    require_once 'config.php';
+    require_once $CFG->root . 'lib/db_factory.php';
+    require_once $CFG->root . 'lib/utils.inc.php';
 
-       $util = Utils::getInstance();
-       $loggedIn = $util->isLoggedIn();
-       if ($loggedIn && isset($_GET['id'])) {
-               $util->setHeading('Full Headers Report');
-               echo $util->getHeader();
-               echo $util->getHeading();
+    $util = new Utils;
+    $loggedIn = $util->isLoggedIn();
+    if ($loggedIn && isset($_GET['id'])) {
+        $id = $_GET['id'];
+        $mail = unserialize($_SESSION['mailInfo'][$id]);
 
-               $id = $_GET['id'];
-               $mail = unserialize($_SESSION['mailInfo'][$id]);
+        if (! is_object($mail) || false == $util->authorized($mail->recipient)) {
+            header('Location: qtadmin.php');
+            exit;
+        }
 
-               $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;
-               $output = '<table><tr><th>Header</th><th>Value</th></tr>';
-               foreach ($headers as $header => $value) {
-                       if (is_array($value)) {
-                               $text = '';
-                               foreach ($value as $val) {
-                                       if ($text == '') {
-                                               $text = $val;
-                                       } else {
-                                               $text .= "<br/><br/>$val";
-                                       }
-                               }
-                       } else {
-                               $text = $value;
-                       }
-                       $output .= "<tr><td class=\"label\">$header</td><td class=\"value\">$text</td></tr>";
-               }
-               $output .= '</table>';
-               echo '<table class="button-menu">';
+        $util->setHeading('Full Headers Report');
+        echo $util->getHeader();
+        echo $util->getHeading();
+
+        $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;
+        $output = '<table><tr><th>Header</th><th>Value</th></tr>';
+        foreach ($headers as $header => $value) {
+            if (is_array($value)) {
+                $text = '';
+                foreach ($value as $val) {
+                    if ($text == '') {
+                        $text = $val;
+                    } else {
+                        $text .= "<br/><br/>$val";
+                    }
+                }
+            } else {
+                $text = $value;
+            }
+            $output .= "<tr><td class=\"label\">$header</td><td class=\"value\">$text</td></tr>";
+        }
+        $output .= '</table>';
+        echo '<table class="button-menu">';
         echo '<tr class="button-row">';
-        echo '<td class="button"><input class="btn-input" type="button" value="Return" 
+        echo '<td class="button"><input class="btn-input" type="button" value="Return"
               onclick="javascript: history.back();"/></td>';
-               echo '</tr></table>';
-               echo $output;
-               echo $util->getFooter();
-       } else if ($loggedIn) {
-               header('Location: index.php');
-       } else {
-               header('Location: auth.php');
-       }
+        echo '</tr></table>';
+        echo $output;
+        echo $util->getFooter();
+    } else if ($loggedIn) {
+        header('Location: qtadmin.php');
+    } else {
+        header('Location: auth.php');
+    }
 
 ?>
This page took 0.059986 seconds and 5 git commands to generate.