X-Git-Url: http://git.datanom.net/qtadmin.git/blobdiff_plain/156ce57fecaeb865e94c8fff7af334104e4a4288..3a5824c19df3af1f5bc4459a85276ebc84d03adf:/wblist.php diff --git a/wblist.php b/wblist.php index 1e643a2..51cc681 100644 --- a/wblist.php +++ b/wblist.php @@ -3,66 +3,95 @@ require_once 'config.php'; require_once $CFG->root . 'lib/utils.inc.php'; - function createHeader($data) { - $out = ''; - foreach ($data as $head => $value) { - $out .= "
$value | "; - } - $r .= '
$i | "; + foreach ($obj as $value) { + $r .= "$value | "; + } + $r .= '
Connection to REST service failed
'; - } - } else if ($subfunction == 'blacklist') { - } else if ($subfunction == 'whitelist') { - } else { - header('Location: index.php'); - } - } else if($function == 'add') { - } else if($function == 'del') { - } else { - header('Location: index.php'); - } + $function = isset($_GET['p']) ? $_GET['p'] : null; + $subfunction = isset($_GET['s']) ? $_GET['s'] : null; + if (($function && $function == 'show' && !$subfunction) || + ($function && $function == 'add' && $subfunction) || + ($function && $function == 'del' && $subfunction)) { + header('Location: index.php'); + } else if($function == 'show') { + if ($subfunction == 'all') { + if ($util->isAdmin()) { + $method = '/show'; + } else { + $method = '/show/' . $util->getUser(); + } + $list = $util->makeRestCall($method); + if ($list) { + $out = parseResponse($list); + } else { + $out = 'Connection to REST service failed
'; + } + } else if ($subfunction == 'blacklist') { + if ($util->isAdmin()) { + $method = '/show/blacklist'; + } else { + $method = '/show/blacklist' . $util->getUser(); + } + $list = $util->makeRestCall($method); + if ($list) { + $out = parseResponse($list); + } else { + $out = 'Connection to REST service failed
'; + } + } else if ($subfunction == 'whitelist') { + if ($util->isAdmin()) { + $method = '/show/whitelist'; + } else { + $method = '/show/whitelist' . $util->getUser(); + } + $list = $util->makeRestCall($method); + if ($list) { + $out = parseResponse($list); + } else { + $out = 'Connection to REST service failed
'; + } + } else { + header('Location: index.php'); + } + } else if($function == 'add') { + } else if($function == 'del') { + } else { + header('Location: index.php'); + } $util->setHeading('WB List and Quarantine Administration'); echo $util->getHeader(); echo $util->getHeading(); - echo $out; + echo $out; echo $util->getFooter(); } else { header('Location: auth.php'); } -?> \ No newline at end of file +?>