[PATCH] for xmlfunc.php for the http kannel monitor

"Bill Brigden" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,
 
I noticed that in the latest cvs, the kannel-monitor scripts in the contrib
dir seems to be shifting the uptimes down one - this is because code has
been shifted around and its calling things in the wrong order.
 
I have attached a patch to fix this (not sure if in right format though -
feel free to say how it should be done :)
 
Cheers,
Bill.
xmlfunc.php.diff (application/octet-stream, 1.1 KB)
--- old/xmlfunc.php     2004-02-04 13:58:05.000000000 +0000
+++ xmlfunc.php 2004-02-04 13:59:52.000000000 +0000
@@ -128,7 +128,10 @@
         switch ($a[0]) {
             case "online":
                 echo "<span class=green>online</span> <br />";
-                echo " (".$z."s)";
+                if (ereg("online (.*)s", XPathValue("status", $y), $regs)) {
+                    $z = $regs[1];
+                    echo " (".$z."s)";
+                }
                 break;
             case "disconnected":
                 echo "<span class=red>disconnected</span>";
@@ -149,10 +152,10 @@
         }

         echo "</td><td valign=top class=text nowrap>\n";
-        if (ereg("online (.*)s", XPathValue("status", $y), $regs)) {
-            $z = $regs[1];
+        if (isset($z)) {
             echo date("Y-m-d H:i:s", mktime()-$z)."<br />";
-                               echo "uptime ".display_uptime($z);
+            echo "uptime ".display_uptime($z);
+            unset($z);
         }
         echo "</td><td valign=top align=right class=text nowrap>\n";
         echo nf(XPathValue("received", $y));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.