]>
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 if (! is_object($raw[0])) {
20 return "<p>{$raw[0]}</p>";
22 $headers = createHeader($raw[0]);
23 $r = "<table><tr>$headers</tr>";
25 foreach ($raw as $obj) {
26 $r .= "<tr><td>$i</td>";
27 foreach ($obj as $value) {
28 $r .= "<td>$value</td>";
40 if ($util->isLoggedIn()) {
41 $function = isset($_GET['p']) ?
$_GET['p'] : null;
42 $subfunction = isset($_GET['s']) ?
$_GET['s'] : null;
43 if (($function && $function == 'show' && !$subfunction) ||
44 ($function && $function == 'add' && $subfunction) ||
45 ($function && $function == 'del' && $subfunction)) {
46 header('Location: index.php');
47 } else if($function == 'show') {
48 if ($subfunction == 'all') {
49 if ($util->isAdmin()) {
52 $method = '/show/' . $util->getUser();
54 $list = $util->makeRestCall($method);
56 $out = parseResponse($list);
58 $out = '<p>Connection to REST service failed</p>';
60 } else if ($subfunction == 'blacklist') {
61 if ($util->isAdmin()) {
62 $method = '/show/blacklist';
64 $method = '/show/blacklist' . $util->getUser();
66 $list = $util->makeRestCall($method);
68 $out = parseResponse($list);
70 $out = '<p>Connection to REST service failed</p>';
72 } else if ($subfunction == 'whitelist') {
73 if ($util->isAdmin()) {
74 $method = '/show/whitelist';
76 $method = '/show/whitelist' . $util->getUser();
78 $list = $util->makeRestCall($method);
80 $out = parseResponse($list);
82 $out = '<p>Connection to REST service failed</p>';
85 header('Location: index.php');
87 } else if($function == 'add') {
88 } else if($function == 'del') {
90 header('Location: index.php');
92 $util->setHeading('WB List and Quarantine Administration');
93 echo $util->getHeader();
94 echo $util->getHeading();
96 echo $util->getFooter();
98 header('Location: auth.php');
This page took 0.125573 seconds and 6 git commands to generate.