ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/latest/latest.php
(Generate patch)

Comparing projects/cms/source/reports/php/latest/latest.php (file contents):
Revision 1.46 by tdb, Fri Feb 11 14:05:31 2005 UTC vs.
Revision 1.49 by tdb, Wed May 4 14:14:25 2005 UTC

# Line 20 | Line 20
20   # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21   #
22  
23 # Navigation for the i-scream reports.
24 # pjm2@ukc.ac.uk
25 #
23   # CONFIGURABLE CONSTANTS: -
24  
25   include("latest_config.inc.php");
# Line 33 | Line 30 | include("latest_config.inc.php");
30   include("iutils.inc.php");
31  
32   if ($formMethod == "GET") {
33 <    $machine = $_GET['machine'];
33 >    $machine = isset($_GET['machine']) ? $_GET['machine'] : "";
34   }
35  
36  
# Line 113 | Line 110 | function b2Mb($bytes) {
110   function uptime($until) {
111      $day = date('z', $until);
112      $hour = date('G', $until);
113 <    $hour = $hour - 1; # one too many
113 >    if ($hour == 0) { # everything's an hour ahead, so roll back
114 >        $hour = 23;
115 >        $day = $day - 1;
116 >    } else {
117 >        $hour = $hour - 1;
118 >    }
119      $minute = date('i', $until);
120      $return = "";
121      if ($day) {
122 <        $return = "$return$day Days ";
122 >        $return = "$return$day";
123 >        if ($day == 1) {
124 >            $return = "$return Day ";
125 >        } else {
126 >            $return = "$return Days ";
127 >        }
128      }
129      if ($hour) {
130 <        $return = "$return$hour Hours ";
130 >        $return = "$return$hour";
131 >        if ($hour == 1) {
132 >            $return = "$return Hour ";
133 >        } else {
134 >            $return = "$return Hours ";
135 >        }
136      }
137 <    return "$return$minute Mins";
137 >    $return = "$return$minute";
138 >    if ($minute == 1) {
139 >        $return = "$return Min";
140 >    } else {
141 >        $return = "$return Mins";
142 >    }
143 >    return $return;
144   }
145  
146  
# Line 178 | Line 196 | function showDiskIO($diskRoot, $input) {
196   # show all network information.
197   function showNet($netRoot, $input) {
198      include("latest_config.inc.php");
199 <                                                                                
199 >
200      $i = 0;
201      while(1) {
202          $name = getPregMatch("$netRoot.p$i.attributes.name", $input);
# Line 195 | Line 213 | function showNet($netRoot, $input) {
213      }
214   }
215  
216 +
217   # show all mail queue information
218   function showMailQ($mailqRoot, $input) {
219      include("latest_config.inc.php");
# Line 215 | Line 234 | function showMailQ($mailqRoot, $input) {
234      }
235   }
236  
237 +
238   # Return a preg_match result.
239   function getPregMatch($value, $input) {
240      preg_match("/$value=([^\,\}]*)[\,\}]/", $input, $matches);
241 +    if(!isset($matches[1])) {
242 +        return;
243 +    }
244      return $matches[1];
245   }
246  
# Line 319 | Line 342 | function showBar($title, $value, $max, $units, $input,
342                 </b></font>
343                     This realtime report is too old to be considered recent
344   EOT;
345 +       }
346 +       else {
347 +           $warning = "";
348         }
349  
350   echo <<<EOT

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines