]> git.datanom.net - qtadmin.git/blob - index.php
Add title tag to links
[qtadmin.git] / index.php
1 <?php
2 /* vim: set ts=4 tw=0 sw=4 noet: */
3 require_once 'config.php';
4 require_once $CFG->root . 'lib/db_factory.php';
5 require_once $CFG->root . 'lib/utils.inc.php';
6
7 $util = Utils::getInstance();
8 unset($_SESSION['mailInfo']);
9
10 if ($util->isLoggedIn()) {
11 if (isset($_GET['rowsperpage'])) {
12 $rowsPerPage = $_GET['rowsperpage'];
13 } else {
14 $rowsPerPage = 20;
15 }
16
17 $pageNum = 1;
18 if (isset($_GET['page'])) {
19 $pageNum = $_GET['page'];
20 }
21
22 $offset = ($pageNum - 1) * $rowsPerPage;
23
24 $util->setHeading('Quarantine Administration');
25 echo $util->getHeader();
26 echo $util->getHeading();
27
28 echo "<span class=\"user\">{$util->getUser()}
29 <a title=\"Logout\" href=\"auth.php?op=logout\">Logout</a></span>";
30 $which = ($util->isAdmin() == true) ? 'all' : $util->getUser();
31 $rows = $DB->getQMails($offset, $rowsPerPage, $which);
32 $numrows = $DB->numRows();
33 echo "<span class=\"total-rows\">$numrows quarantined mail(s)</span>";
34 echo "<table><tr>";
35 echo "<table><tr><th>Received</th><th>Cause</th>";
36 echo "<th>Sender</th><th>Recipient</th><th>Subject</th><th>Action</th>";
37 echo "</tr>";
38
39 $mailInfo = array();
40 $i = 0;
41 foreach ($rows as $row) {
42 if ($i % 2)
43 echo '<tr class="bg_odd">';
44 else
45 echo '<tr class="bg_even">';
46 $id = $row->mail_id;
47 $mailInfo[$id] = serialize($row);
48 $url = urlencode($id);
49 $recipient = "<a title=\"Show Report\" href=\"mail_report.php?id=$url\">{$row->recipient}</a>";
50 $action = "<a title=\"Release Mail\" href=\"quarantine.php?id=$url&op=release\">";
51 $action .= "<img class=\"nav-img\" src=\"pics/release.png\" alt=\"Release\" /></a>";
52 $action .= "&nbsp;<a title=\"Delete Mail\" href=\"quarantine.php?id=$url&op=delete\">";
53 $action .= "<img class=\"nav-img\" src=\"pics/delete.png\" alt=\"Delete\" /></a>";
54 $sender = $row->sender;
55 $received = strftime("%c", $row->time_iso);
56 $quaratinefor = $util->convertContent($row->quaratinefor);
57 $subject = $row->subject;
58 echo "<td>$received</td><td class=\"nav-action\">".
59 "$quaratinefor</td><td>$sender</td><td>$recipient</td>".
60 "<td>$subject</td><td class=\"nav-action\">$action</td></tr>";
61 $i++;
62 }
63 $_SESSION['mailInfo'] = $mailInfo;
64 echo "</table>";
65
66 $maxPage = ceil($numrows/$rowsPerPage);
67 $self = $_SERVER['PHP_SELF'];
68
69 if ($pageNum > 1) {
70 $page = $pageNum - 1;
71 $prev = " <a title=\"Prev Page\" href=\"$self?page=$page&rowsperpage=$rowsPerPage\"
72 class='whitefooter'>[Prev]</a>";
73 $first = " <a title=\"First Page\" href=\"$self?page=1&rowsperpage=$rowsPerPage\"
74 class='whitefooter'>[First Page]</a> ";
75 } else {
76 $prev = '&nbsp;'; // we're on page one, don't print previous link
77 $first = '&nbsp;'; // nor the first page link
78 }
79
80 if ($pageNum < $maxPage) {
81 $page = $pageNum + 1;
82 $next = " <a title=\"Next Page\" href=\"$self?page=$page&rowsperpage=$rowsPerPage\"
83 class='whitefooter'>[Next]</a>";
84 $last = "<a title=\"Last Page\" href=\"$self?page=$maxPage&rowsperpage=$rowsPerPage\"
85 class='whitefooter'>[Last Page]</a> ";
86 } else {
87 $next = '&nbsp;'; // we're on the last page, don't print next link
88 $last = '&nbsp;'; // nor the last page link
89 }
90 $marked = $DB->getMarked($which);
91 $_SESSION['marked'] = serialize($marked);
92 echo '<input class="mail-purge" type="button" value="Purge Mails ('.
93 count($marked).')" onclick="javascript: location.href=\'quarantine.php?op=purge\'"/>';
94 echo "<p class=\"page-nav\">$first$prev Showing page $pageNum of
95 $maxPage pages $next$last</p>";
96
97 echo $util->getFooter();
98 } else {
99 header('Location: auth.php');
100 }
101 ?>
This page took 0.078363 seconds and 6 git commands to generate.