]> git.datanom.net - qtadmin.git/blame - qtadmin.php
First upload of wblist page
[qtadmin.git] / qtadmin.php
CommitLineData
6df4b805 1<?php
6b3d5ba9 2/* vim: set ts=4 tw=0 sw=4 noet: */
b95d1cdb
MR
3 require_once 'config.php';
4 require_once $CFG->root . 'lib/db_factory.php';
5 require_once $CFG->root . 'lib/utils.inc.php';
6df4b805 6
3056d117 7 $util = new Utils;
b95d1cdb 8 unset($_SESSION['mailInfo']);
6df4b805 9
b95d1cdb
MR
10 if ($util->isLoggedIn()) {
11 if (isset($_GET['rowsperpage'])) {
12 $rowsPerPage = $_GET['rowsperpage'];
13 } else {
14 $rowsPerPage = 20;
15 }
6df4b805 16
b95d1cdb
MR
17 $pageNum = 1;
18 if (isset($_GET['page'])) {
19 $pageNum = $_GET['page'];
20 }
6df4b805 21
b95d1cdb 22 $offset = ($pageNum - 1) * $rowsPerPage;
6df4b805 23
b95d1cdb
MR
24 $util->setHeading('Quarantine Administration');
25 echo $util->getHeader();
26 echo $util->getHeading();
27
376ac007 28 echo "Rows per page <input type=\"text\" value=\"$rowsPerPage\" id=\"rows\"
b4a9e00e
MR
29 size=\"2\"/><input type=\"button\" onclick=\"javascript: updateRowsPerPage()\"
30 value=\"Change\"/><span class=\"user\">{$util->getUser()}
e9bc08fc 31 <!--<a title=\"Logout\" href=\"auth.php?op=logout\">Logout</a>--></span>";
b95d1cdb
MR
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>";
36 echo "<table><tr>";
60aad80e 37 echo "<th>Received</th><th>Cause</th>";
219d049c 38 echo "<th>Sender</th><th>Recipient</th><th>Subject</th><th>Action</th>";
60348de6
MR
39 echo "<th><input name=\"multiselect\" type=\"checkbox\" ";
40 echo "onchange=\"javascript: updateAction(this)\" /></th>";
b95d1cdb 41 echo "</tr>";
6df4b805 42
b95d1cdb
MR
43 $mailInfo = array();
44 $i = 0;
45 foreach ($rows as $row) {
46 if ($i % 2)
47 echo '<tr class="bg_odd">';
48 else
49 echo '<tr class="bg_even">';
50 $id = $row->mail_id;
51 $mailInfo[$id] = serialize($row);
52 $url = urlencode($id);
5c7b972e 53 $checkbox = "<input name=\"action\" type=\"checkbox\" value=\"$url\" />";
bb06f172 54 $recipient = "<a title=\"Show Report\" href=\"mail_report.php?id=$url\">{$row->recipient}</a>";
60aad80e 55 $action = "<a title=\"Release Mail\" href=\"quarantine.php?id=$url&amp;op=release\">";
b95d1cdb 56 $action .= "<img class=\"nav-img\" src=\"pics/release.png\" alt=\"Release\" /></a>";
60aad80e 57 $action .= "&nbsp;<a title=\"Delete Mail\" href=\"quarantine.php?id=$url&amp;op=delete\">";
b95d1cdb 58 $action .= "<img class=\"nav-img\" src=\"pics/delete.png\" alt=\"Delete\" /></a>";
0da9e6e7 59 $action .= "&nbsp;<a title=\"Block Sender\" href=\"quarantine.php?id=$url&amp;op=block\">";
55e904ab 60 $action .= "<img class=\"nav-img\" src=\"pics/spam.png\" alt=\"Block Sender\" /></a>";
b95d1cdb
MR
61 $sender = $row->sender;
62 $received = strftime("%c", $row->time_iso);
63 $quaratinefor = $util->convertContent($row->quaratinefor);
64 $subject = $row->subject;
6df4b805
MR
65 echo "<td>$received</td><td class=\"nav-action\">".
66 "$quaratinefor</td><td>$sender</td><td>$recipient</td>".
f60d3406 67 "<td>$subject</td><td class=\"nav-action\">$action</td><td class=\"nav-action\">$checkbox</td></tr>";
b95d1cdb
MR
68 $i++;
69 }
70 $_SESSION['mailInfo'] = $mailInfo;
71 echo "</table>";
72
73 $maxPage = ceil($numrows/$rowsPerPage);
74 $self = $_SERVER['PHP_SELF'];
75
76 if ($pageNum > 1) {
77 $page = $pageNum - 1;
60aad80e 78 $prev = " <a title=\"Prev Page\" href=\"$self?page=$page&amp;rowsperpage=$rowsPerPage\"
44aa932e 79 class='whitefooter'><img class=\"nav-img\" src=\"pics/go-previous-symbolic.svg\" alt=\"Previous\" /></a> ";
60aad80e 80 $first = " <a title=\"First Page\" href=\"$self?page=1&amp;rowsperpage=$rowsPerPage\"
61fd79d7 81 class='whitefooter'><img class=\"nav-img\" src=\"pics/go-first-symbolic.svg\" alt=\"First\" /></a> ";
b95d1cdb
MR
82 } else {
83 $prev = '&nbsp;'; // we're on page one, don't print previous link
84 $first = '&nbsp;'; // nor the first page link
85 }
6df4b805 86
b95d1cdb
MR
87 if ($pageNum < $maxPage) {
88 $page = $pageNum + 1;
60aad80e 89 $next = " <a title=\"Next Page\" href=\"$self?page=$page&amp;rowsperpage=$rowsPerPage\"
44aa932e 90 class='whitefooter'><img class=\"nav-img\" src=\"pics/go-next-symbolic.svg\" alt=\"Next\" /></a> ";
60aad80e 91 $last = " <a title=\"Last Page\" href=\"$self?page=$maxPage&amp;rowsperpage=$rowsPerPage\"
61fd79d7 92 class='whitefooter'><img class=\"nav-img\" src=\"pics/go-last-symbolic.svg\" alt=\"Last\" /></a> ";
b95d1cdb
MR
93 } else {
94 $next = '&nbsp;'; // we're on the last page, don't print next link
95 $last = '&nbsp;'; // nor the last page link
96 }
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\'"/>';
ebed9332
MR
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\');"/>';
0da9e6e7
MR
105 echo '<input class="mail-purge" type="button" value="Block checked"
106 onclick="javascript: checkAction(\'block\');"/>';
b95d1cdb
MR
107 echo "<p class=\"page-nav\">$first$prev Showing page $pageNum of
108 $maxPage pages $next$last</p>";
6df4b805 109
b95d1cdb
MR
110 echo $util->getFooter();
111 } else {
112 header('Location: auth.php');
113 }
6df4b805 114?>
This page took 0.09651 seconds and 5 git commands to generate.