From b7814808b116f5bcb8ae1d9d099886fa76c84b3a Mon Sep 17 00:00:00 2001 From: paulr Date: Wed, 10 Aug 2011 02:49:42 +1000 Subject: [PATCH] moved admin to repo admin --- libglcas/web.php | 1 + plugins/admin.php | 28 ++++++++++++++-------------- plugins/hosts.php | 23 ++++++----------------- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/libglcas/web.php b/libglcas/web.php index e2f7627..157d293 100644 --- a/libglcas/web.php +++ b/libglcas/web.php @@ -23,6 +23,7 @@ class GLCASWeb { // add a stat $ipaddr = $_SERVER["REMOTE_ADDR"]; + $this->config->delData("lastseen", "$ipaddr"); $this->config->addData("lastseen", "$ipaddr", time(), ""); // create a url parser diff --git a/plugins/admin.php b/plugins/admin.php index e7dcd14..e3dc5ce 100644 --- a/plugins/admin.php +++ b/plugins/admin.php @@ -3,19 +3,19 @@ error_log("admin loaded"); global $BASE_URL, $MENU_ITEMS; -$MENU_ITEMS["10admin"]["name"] = "Admin"; -$MENU_ITEMS["10admin"]["link"] = "$BASE_URL/admin"; +$MENU_ITEMS["30admin"]["name"] = "Repo Admin"; +$MENU_ITEMS["30admin"]["link"] = "$BASE_URL/repoadmin"; global $URL_HANDLERS; -$URL_HANDLERS["admin.*"] = "GLCASAdmin"; +$URL_HANDLERS["repoadmin.*"] = "GLCASRepoAdmin"; global $CRON_CLASSES; -$CRON_CLASSES["GLCASAdmin"] = "GLCASAdmin"; +$CRON_CLASSES["GLCASAdmin"] = "GLCASRepoAdmin"; -class GLCASAdmin { +class GLCASRepoAdmin { function __construct($config) { $this->config = $config; - error_log("constructor for GLCASAdmin"); + error_log("constructor for GLCASRepoAdmin"); } @@ -61,14 +61,14 @@ class GLCASAdmin { function cron() { - echo "ADMIN CRON: nothing to see here
"; + echo "REPOADMIN CRON: nothing to see here
"; // TODO: touch cronstamp file here // make a backup of the config.. but.. errr. how to tell if theres an old backup? // backups will occur... weekly and be called $configpath.DDMMYYYY $configpath = glcas_getWebConfigPath(); $basepath = dirname($configpath); - echo "ADMIN CRON: backing up config, $configpath, $basepath
"; + echo "REPOADMIN CRON: backing up config, $configpath, $basepath
"; $nowtime = time(); $oneday = 3600 * 24; // 1 hour in seconds, by 24 hours for($i = 0; $i < 7; $i ++) { @@ -84,7 +84,7 @@ class GLCASAdmin { $nowdatestr = strftime("%d-%h-%Y"); $backupfile = "$configpath.$nowdatestr"; copy($configpath, $backupfile); - echo "ADMIN CRON: createing backup of config as $backupfile
"; + echo "REPOADMIN CRON: createing backup of config as $backupfile
"; } function body($url) @@ -113,7 +113,7 @@ class GLCASAdmin { $myRep->freezeRepo($repo); global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL; - header("Location: $BASE_URL/admin/"); + header("Location: $BASE_URL/repoadmin/"); } @@ -127,7 +127,7 @@ class GLCASAdmin { $myRep->deleteRepo($repo); global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL; - header("Location: $BASE_URL/admin/"); + header("Location: $BASE_URL/repoadmin/"); } @@ -285,7 +285,7 @@ class GLCASAdmin { // next we need to deal with that "blocked" bit global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL; - header("Location: $BASE_URL/admin/"); + header("Location: $BASE_URL/repoadmin/"); } function doAddRepoYum($url) @@ -309,7 +309,7 @@ class GLCASAdmin { $repo->addRepo($desc, $OS, $version, $arch, $other, $shorturl, $prefix, $repurl, "YUM", $init, $expiretime); global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL; - header("Location: $BASE_URL/admin/"); + header("Location: $BASE_URL/repoadmin/"); } function doUpdateRepo($url) @@ -322,7 +322,7 @@ class GLCASAdmin { $repo->updateRepo($rkey); global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL; - header("Location: $BASE_URL/admin/"); + header("Location: $BASE_URL/repoadmin/"); } function mainBody($url) diff --git a/plugins/hosts.php b/plugins/hosts.php index fecbed4..ef63bbb 100644 --- a/plugins/hosts.php +++ b/plugins/hosts.php @@ -5,8 +5,8 @@ error_log("hosts loaded"); global $URL_HANDLERS; $URL_HANDLERS["hosts.*"] = "GLCASHosts"; global $BASE_URL, $MENU_ITEMS; -$MENU_ITEMS["30hosts"]["name"] = "Known Machines"; -$MENU_ITEMS["30hosts"]["link"] = "$BASE_URL/hosts"; +$MENU_ITEMS["10hosts"]["name"] = "Known Machines"; +$MENU_ITEMS["10hosts"]["link"] = "$BASE_URL/hosts"; class GLCASHosts { function __construct($config) @@ -28,10 +28,6 @@ class GLCASHosts { error_log("in add group"); GLCASpageBuilder($this, "addGroup"); return; - case "deletehost": - error_log("in add group"); - GLCASpageBuilder($this, "deleteHost"); - return; case "scanrange": GLCASpageBuilder($this, "scanIPRange"); return; @@ -39,6 +35,7 @@ class GLCASHosts { GLCASpageBuilder($this, "deleteGroup"); return; case "dooperation": + error_log("in do operation"); GLCASpageBuilder($this, "doOperation"); return; } @@ -88,7 +85,7 @@ class GLCASHosts { $hip = $val["name"]; $hg = $val["val"]; - echo "
Checking $hname, $hip, $hg
"; + //echo "
Checking $hname, $hip, $hg
"; // check if no group is on if($nogroup && $hg == "") { @@ -196,14 +193,6 @@ class GLCASHosts { } - function deleteHost($url) - { - $hostname = $_REQUEST["hostname"]; - $this->config->delData("hosts", "$hostname"); - global $WEB_ROOT_FS, $URL_HANDLERS, $BASE_URL; - header("Location: $BASE_URL/hosts"); - } - function addHost($url) { $hg = $_REQUEST["hostgroup"]; @@ -289,7 +278,7 @@ class GLCASHosts { echo ""; echo ""; echo "

Ungrouped Hosts


"; - echo ""; + echo "
HostIPLast SeenLast PingControl
"; foreach($hosts as $key => $val) { $hname = $val["category"]; $hip = $val["name"]; @@ -322,7 +311,7 @@ class GLCASHosts { echo "
HostIPLast SeenLast Ping
"; $grpname = $val["category"]; echo "

Host Group: $grpname Delete


"; - echo ""; + echo "
HostIPLast SeenLast PingControl
"; if($hosts != false) foreach($hosts as $key => $val) { $hname = $val["category"]; $hip = $val["name"]; -- 1.7.0.4
HostIPLast SeenLast Ping