- $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') {
- $list = $util->makeRestCall('/show');
- if ($list) {
- $out = var_export($list, true);
- } else {
- $out = '<p>Connection to REST service failed</p>';
- }
- } 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 = '<p>Connection to REST service failed</p>';
+ }
+ } 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 = '<p>Connection to REST service failed</p>';
+ }
+ } 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 = '<p>Connection to REST service failed</p>';
+ }
+ } else {
+ header('Location: index.php');
+ }
+ } else if($function == 'add') {
+ } else if($function == 'del') {
+ } else {
+ header('Location: index.php');
+ }