]>
git.datanom.net - qtadmin.git/blob - wblist.php
2 /* vim: set ts=4 tw=0 sw=4 noet: */
3 require_once 'config.php';
4 require_once $CFG->root
. 'lib/utils.inc.php';
6 function createHeader($data) {
8 foreach ($data as $head => $value) {
9 $out .= "<th>$head</th>";
15 function parseResponse($raw) {
16 if (count($raw) < 1) {
19 $headers = createHeader($raw[0]);
20 $r = "<table><tr>$headers</tr>";
22 foreach ($raw as $obj) {
23 $r .= "<tr><td>$i</td>";
24 foreach ($obj as $value) {
25 $r .= "<td>$value</td>";
37 if ($util->isLoggedIn()) {
38 $function = isset($_GET['p']) ?
$_GET['p'] : null;
39 $subfunction = isset($_GET['s']) ?
$_GET['s'] : null;
40 if (($function && $function == 'show' && !$subfunction) ||
41 ($function && $function == 'add' && $subfunction) ||
42 ($function && $function == 'del' && $subfunction)) {
43 header('Location: index.php');
44 } else if($function == 'show') {
45 if ($subfunction == 'all') {
46 if ($util->isAdmin()) {
49 $method = '/show/' . $util->getUser();
51 $list = $util->makeRestCall($method);
53 $out = parseResponse($list);
55 $out = '<p>Connection to REST service failed</p>';
57 } else if ($subfunction == 'blacklist') {
58 if ($util->isAdmin()) {
59 $method = '/show/blacklist';
61 $method = '/show/blacklist' . $util->getUser();
63 $list = $util->makeRestCall($method);
65 $out = parseResponse($list);
67 $out = '<p>Connection to REST service failed</p>';
69 } else if ($subfunction == 'whitelist') {
70 if ($util->isAdmin()) {
71 $method = '/show/whitelist';
73 $method = '/show/whitelist' . $util->getUser();
75 $list = $util->makeRestCall($method);
77 $out = parseResponse($list);
79 $out = '<p>Connection to REST service failed</p>';
82 header('Location: index.php');
84 } else if($function == 'add') {
85 } else if($function == 'del') {
87 header('Location: index.php');
89 $util->setHeading('WB List and Quarantine Administration');
90 echo $util->getHeader();
91 echo $util->getHeading();
93 echo $util->getFooter();
95 header('Location: auth.php');
This page took 0.123569 seconds and 6 git commands to generate.