[slbackup-commit] CVS update: slbackup-php/src index.php
finnarne-guest at alioth.debian.org
finnarne-guest at alioth.debian.org
Mon Apr 16 11:45:33 UTC 2007
User: finnarne-guest
Date: 07/04/16 11:45:33
Modified: src index.php
Log:
Added status view
Revision Changes Path
1.14 +48 -38 slbackup-php/src/index.php
Index: index.php
===================================================================
RCS file: /cvsroot/slbackup/slbackup-php/src/index.php,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- index.php 14 Apr 2007 05:19:34 -0000 1.13
+++ index.php 16 Apr 2007 11:45:33 -0000 1.14
@@ -195,22 +195,22 @@
fclose ($pipes[0]) ;
while ($line = fgets ($pipes[1], 1024)) {
list ($timestamp, $info) = explode (" - ", trim($line)) ;
- if ($info == "Starting slbackup:")
- $log["start"] = $timestamp ;
+ if ($info == "Starting slbackup:")
+ $log["start"] = strtotime($timestamp) ;
elseif ($info == "Finished slbackup.")
- $log["end"] = $timestamp ;
+ $log["end"] = strtotime($timestamp) ;
elseif (strpos ($line, "Starting backup of client") !== false) {
sscanf ($info, "Starting backup of client %s", $client) ;
if (!empty ($client))
- $log["clients"][$client]["start"] = $timestamp ;
+ $log["clients"][$client]["start"] = strtotime($timestamp) ;
} elseif (strpos ($line, "Failed backing up client") !== false) {
sscanf ($info, "Failed backing up client %s", $client) ;
if (!empty ($client))
- $log["clients"][$client]["failed"] = $timestamp ;
+ $log["clients"][$client]["failed"] = strtotime($timestamp) ;
} elseif (strpos ($line, "Successfully finished backing up client") !== false) {
sscanf ($info, "Successfully finished backing up client %s", $client) ;
if (!empty ($client))
- $log["clients"][$client]["ok"] = $timestamp ;
+ $log["clients"][$client]["ok"] = strtotime($timestamp) ;
}
}
fclose ($pipes[1]) ;
@@ -241,6 +241,7 @@
switch ($key) {
case "Passwd":
$passwd = $value ;
+ $submit = "status" ;
break ;
case "xorstring":
$xorstring = $value ;
@@ -255,8 +256,8 @@
case "delloc":
case "addloc":
case "scheduler":
- case "status":
case "logout":
+ case "status":
$submit=$key ;
break ;
case "client":
@@ -311,7 +312,7 @@
foreach ($config["clients"] as $key => $value)
$log["clients"][$key] =
array ('start' => '', 'failed' => '', 'ok' => '') ;
- debug (readlog ($passwd, $log)) ;
+ $log = readlog ($passwd, $log) ;
break ;
case "scheduler":
$newsched = "" ;
@@ -418,34 +419,43 @@
writeconf ($passwd, $config) ;
break ;
}
- if ($config["active"])
- $smarty->assign ('active', "checked") ;
- for ($i = 0 ; $i < 60 ; $i += 5)
- $amin[] = sprintf ("%02d", $i) ;
- $smarty->assign ('a_minutes', $amin);
- $smarty->assign ('minutes', $config["minutes"]) ;
- for ($i = 0 ; $i < 24 ; $i++)
- $ahour[] = sprintf ("%02d", $i) ;
- $smarty->assign ('a_hours', $ahour);
- $smarty->assign ('hours', $config["hours"]) ;
- $smarty->assign ('server_address', $config["server_address"]) ;
- $smarty->assign ('server_destdir', $config["server_destdir"]) ;
- $smarty->assign ('server_type', $config["server_type"]) ;
- $smarty->assign ('server_user', $config["server_user"]) ;
- $smarty->assign ('types', array ('local', 'remote')) ;
- $clients = array_keys($config["clients"]) ;
- $smarty->assign ('clients', $clients) ;
- if (empty($client))
- $client = $clients[0] ;
- $smarty->assign ('client', $client) ;
- $smarty->assign ('clientaddress', $config["clients"][$client]["address"]) ;
- $smarty->assign ('clientkeep', $config["clients"][$client]["keep"]) ;
- $smarty->assign ('client_type', $config["clients"][$client]["type"]) ;
- $smarty->assign ('clientuser', $config["clients"][$client]["user"]) ;
- if ($submit == "addclient")
- $smarty->assign ('clientsubmit', _("Add")) ;
- else
- $smarty->assign ('clientsubmit', _("Update")) ;
- $smarty->assign ('locations', $config["clients"][$client]["location"]) ;
- $smarty->display ('config.tpl') ;
+
+switch ($submit) {
+ case "status":
+ $smarty->assign ('log', $log) ;
+ $smarty->display ('status.tpl') ;
+ break ;
+ default:
+ if ($config["active"])
+ $smarty->assign ('active', "checked") ;
+ for ($i = 0 ; $i < 60 ; $i += 5)
+ $amin[] = sprintf ("%02d", $i) ;
+ $smarty->assign ('a_minutes', $amin);
+ $smarty->assign ('minutes', $config["minutes"]) ;
+ for ($i = 0 ; $i < 24 ; $i++)
+ $ahour[] = sprintf ("%02d", $i) ;
+ $smarty->assign ('a_hours', $ahour);
+ $smarty->assign ('hours', $config["hours"]) ;
+ $smarty->assign ('server_address', $config["server_address"]) ;
+ $smarty->assign ('server_destdir', $config["server_destdir"]) ;
+ $smarty->assign ('server_type', $config["server_type"]) ;
+ $smarty->assign ('server_user', $config["server_user"]) ;
+ $smarty->assign ('types', array ('local', 'remote')) ;
+ $clients = array_keys($config["clients"]) ;
+ $smarty->assign ('clients', $clients) ;
+ if (empty($client))
+ $client = $clients[0] ;
+ $smarty->assign ('client', $client) ;
+ $smarty->assign ('clientaddress', $config["clients"][$client]["address"]) ;
+ $smarty->assign ('clientkeep', $config["clients"][$client]["keep"]) ;
+ $smarty->assign ('client_type', $config["clients"][$client]["type"]) ;
+ $smarty->assign ('clientuser', $config["clients"][$client]["user"]) ;
+ if ($submit == "addclient")
+ $smarty->assign ('clientsubmit', _("Add")) ;
+ else
+ $smarty->assign ('clientsubmit', _("Update")) ;
+ $smarty->assign ('locations', $config["clients"][$client]["location"]) ;
+ $smarty->display ('config.tpl') ;
+ break ;
+}
?>
More information about the slbackup-commit
mailing list