]>
git.datanom.net - qtadmin.git/blob - qtadmin.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';
8 unset($_SESSION['mailInfo']);
10 if ($util->isLoggedIn()) {
11 if (isset($_GET['rowsperpage'])) {
12 $rowsPerPage = $_GET['rowsperpage'];
18 if (isset($_GET['page'])) {
19 $pageNum = $_GET['page'];
22 $offset = ($pageNum - 1) * $rowsPerPage;
24 $util->setHeading('Quarantine Administration');
25 echo $util->getHeader();
26 echo $util->getHeading();
28 echo "Rows per page <input type=\"text\" value=\"$rowsPerPage\" id=\"rows\"
29 size=\"2\"/><input type=\"button\" onclick=\"javascript: updateRowsPerPage()\"
30 value=\"Change\"/><span class=\"user\">{$util->getUser()}
31 <!--<a title=\"Logout\" href=\"auth.php?op=logout\">Logout</a>--></span>";
32 $which = ($util->isAdmin() == true) ?
'all' : $util->getUser();
33 $rows = $DB->getQMails($offset, $rowsPerPage, $which);
34 $numrows = $DB->numRows();
35 echo "<span class=\"total-rows\">$numrows quarantined mail(s)</span>";
37 echo "<th>Received</th><th>Cause</th>";
38 echo "<th>Sender</th><th>Recipient</th><th>Subject</th><th>Action</th>";
39 echo "<th><input name=\"multiselect\" type=\"checkbox\" ";
40 echo "onchange=\"javascript: updateAction(this)\" /></th>";
45 foreach ($rows as $row) {
47 echo '<tr class="bg_odd">';
49 echo '<tr class="bg_even">';
51 $mailInfo[$id] = serialize($row);
52 $url = urlencode($id);
53 $checkbox = "<input name=\"action\" type=\"checkbox\" value=\"$url\" />";
54 $recipient = "<a title=\"Show Report\" href=\"mail_report.php?id=$url\">{$row->recipient}</a>";
55 $action = "<a title=\"Release Mail\" href=\"quarantine.php?id=$url&op=release\">";
56 $action .= "<img class=\"nav-img\" src=\"pics/release.png\" alt=\"Release\" /></a>";
57 $action .= " <a title=\"Delete Mail\" href=\"quarantine.php?id=$url&op=delete\">";
58 $action .= "<img class=\"nav-img\" src=\"pics/delete.png\" alt=\"Delete\" /></a>";
59 $action .= " <a title=\"Block Sender\" href=\"quarantine.php?id=$url&op=block\">";
60 $action .= "<img class=\"nav-img\" src=\"pics/spam.png\" alt=\"Block Sender\" /></a>";
61 $sender = $row->sender
;
62 $received = strftime("%c", $row->time_iso
);
63 $quaratinefor = $util->convertContent($row->quaratinefor
);
64 $subject = $row->subject
;
65 echo "<td>$received</td><td class=\"nav-action\">".
66 "$quaratinefor</td><td>$sender</td><td>$recipient</td>".
67 "<td>$subject</td><td class=\"nav-action\">$action</td><td class=\"nav-action\">$checkbox</td></tr>";
70 $_SESSION['mailInfo'] = $mailInfo;
73 $maxPage = ceil($numrows/$rowsPerPage);
74 $self = $_SERVER['PHP_SELF'];
78 $prev = " <a title=\"Prev Page\" href=\"$self?page=$page&rowsperpage=$rowsPerPage\"
79 class='whitefooter'><img class=\"nav-img\" src=\"pics/go-previous-symbolic.svg\" alt=\"Previous\" /></a> ";
80 $first = " <a title=\"First Page\" href=\"$self?page=1&rowsperpage=$rowsPerPage\"
81 class='whitefooter'><img class=\"nav-img\" src=\"pics/go-first-symbolic.svg\" alt=\"First\" /></a> ";
83 $prev = ' '; // we're on page one, don't print previous link
84 $first = ' '; // nor the first page link
87 if ($pageNum < $maxPage) {
89 $next = " <a title=\"Next Page\" href=\"$self?page=$page&rowsperpage=$rowsPerPage\"
90 class='whitefooter'><img class=\"nav-img\" src=\"pics/go-next-symbolic.svg\" alt=\"Next\" /></a> ";
91 $last = " <a title=\"Last Page\" href=\"$self?page=$maxPage&rowsperpage=$rowsPerPage\"
92 class='whitefooter'><img class=\"nav-img\" src=\"pics/go-last-symbolic.svg\" alt=\"Last\" /></a> ";
94 $next = ' '; // we're on the last page, don't print next link
95 $last = ' '; // nor the last page link
97 $marked = $DB->getMarked($which);
98 $_SESSION['marked'] = serialize($marked);
99 echo '<input class="mail-purge" type="button" value="Purge Mails ('.
100 count($marked).')" onclick="javascript: location.href=\'quarantine.php?op=purge\'"/>';
101 echo '<input class="mail-purge" type="button" value="Release checked"
102 onclick="javascript: checkAction(\'release\');"/>';
103 echo '<input class="mail-purge" type="button" value="Delete checked"
104 onclick="javascript: checkAction(\'delete\');"/>';
105 echo '<input class="mail-purge" type="button" value="Block checked"
106 onclick="javascript: checkAction(\'block\');"/>';
107 echo "<p class=\"page-nav\">$first$prev Showing page $pageNum of
108 $maxPage pages $next$last</p>";
110 echo $util->getFooter();
112 header('Location: auth.php');
This page took 0.094066 seconds and 6 git commands to generate.