X-Git-Url: http://git.datanom.net/qtadmin.git/blobdiff_plain/ccbb5c4bdaa7335eedd4386d7f9d748b4b011d9c..156ce57fecaeb865e94c8fff7af334104e4a4288:/wblist.php
diff --git a/wblist.php b/wblist.php
index 197217d..1e643a2 100644
--- a/wblist.php
+++ b/wblist.php
@@ -3,6 +3,33 @@
require_once 'config.php';
require_once $CFG->root . 'lib/utils.inc.php';
+ function createHeader($data) {
+ $out = '';
+ foreach ($data as $head => $value) {
+ $out .= "
$head | ";
+ }
+
+ return $out;
+ }
+
+ function parseResponse($raw) {
+ if (count($raw) < 1) {
+ return '';
+ }
+ $headers = createHeader($raw[0]);
+ $r = "$headers
";
+ foreach ($raw as $obj) {
+ $r .= '';
+ foreach ($obj as $value) {
+ $r .= "$value | ";
+ }
+ $r .= '
';
+ }
+ $r .= '
';
+
+ return $r;
+ }
+
$util = new Utils;
if ($util->isLoggedIn()) {
@@ -10,13 +37,13 @@
$subfunction = isset($_GET['s']) ? $_GET['s'] : null;
if (($function && $function == 'show' && !$subfunction) ||
($function && $function == 'add' && $subfunction) ||
- ($function && $function == 'del' && $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);
+ $out = parseResponse($list);
} else {
$out = 'Connection to REST service failed
';
}