cvs: php-bugs-web / bugstats.php
| From: | Jani Taskinen | Date: | Thu, 14 Aug 2003 09:46:03 +0000 |
| Subject: | cvs: php-bugs-web / bugstats.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-20265@lists.php.net to get a copy of this message | ||
sniper Thu Aug 14 05:46:03 2003 EDT
Modified files:
/php-bugs-web bugstats.php
Log:
cleanup
Index: php-bugs-web/bugstats.php diff -u php-bugs-web/bugstats.php:1.16 php-bugs-web/bugstats.php:1.17 --- php-bugs-web/bugstats.php:1.16 Mon Jul 14 21:26:02 2003 +++ php-bugs-web/bugstats.php Thu Aug 14 05:46:03 2003 @@ -1,4 +1,5 @@ <?php /* vim: set noet ts=4 sw=4: : */ + require_once 'prepend.inc'; commonHeader("Statistics"); @@ -6,7 +7,7 @@ @mysql_pconnect("localhost","nobody","") or die("unable to connect to database"); @mysql_select_db("php3") - or die("unable to select database"); + or die("unable to select database"); $query = "SELECT status,bug_type,email,php_version,php_os FROM bugdb"; @@ -18,7 +19,7 @@ $result = mysql_unbuffered_query($query); -while($row=mysql_fetch_array($result)) { +while ($row = mysql_fetch_array($result)) { $bug_type['all'][$row[bug_type]]++; $status_str = strtolower($row['status']); $bug_type[$status_str][$row[bug_type]]++; @@ -32,9 +33,9 @@ // Exit if there are no bugs for this version if ($total == 0) { - echo '<p>No bugs found for this PHP version</p>'; - commonFooter(); - exit; + echo '<p>No bugs found for this PHP version</p>'; + commonFooter(); + exit; } if ($phpver > 0) { @@ -44,8 +45,10 @@ } echo "Display <a href=\"bugstats.php?phpver=4\">PHP 4 bugs only</a> or <a href=\"bugstats.php?phpver=5\">PHP 5 bugs only</a>.</p>\n"; -function bugstats($status, $type) { +function bugstats ($status, $type) +{ global $bug_type, $phpver; + if ($bug_type[$status][$type] > 0) { return '<a href="index.php?cmd=display&status=' . ucfirst($status) . "&phpver=" . $phpver . ($type == 'all' ? '' : '&bug_type[]=' . urlencode($type)) . '&by=Any">' . $bug_type[$status][$type] . "</a>\n"; } @@ -56,52 +59,54 @@ /* prepare for sorting by bug report count */ foreach($bug_type['all'] as $type => $value) { - if(!isset($bug_type['closed'][$type])) $bug_type['closed'][$type] = 0; - if(!isset($bug_type['bogus'][$type])) $bug_type['bogus'][$type] = 0; - if(!isset($bug_type['open'][$type])) $bug_type['open'][$type] = 0; - if(!isset($bug_type['critical'][$type])) $bug_type['critical'][$type] = 0; - if(!isset($bug_type['analyzed'][$type])) $bug_type['analyzed'][$type] = 0; - if(!isset($bug_type['verified'][$type])) $bug_type['verified'][$type] = 0; - if(!isset($bug_type['suspended'][$type])) $bug_type['suspended'][$type] = 0; - if(!isset($bug_type['duplicate'][$type])) $bug_type['duplicate'][$type] = 0; - if(!isset($bug_type['assigned'][$type])) $bug_type['assigned'][$type] = 0; - if(!isset($bug_type['no feedback'][$type])) $bug_type['no feedback'][$type] = 0; - if(!isset($bug_type['feedback'][$type])) $bug_type['feedback'][$type] = 0; + if (!isset($bug_type['closed'][$type])) $bug_type['closed'][$type] = 0; + if (!isset($bug_type['bogus'][$type])) $bug_type['bogus'][$type] = 0; + if (!isset($bug_type['open'][$type])) $bug_type['open'][$type] = 0; + if (!isset($bug_type['critical'][$type])) $bug_type['critical'][$type] = 0; + if (!isset($bug_type['analyzed'][$type])) $bug_type['analyzed'][$type] = 0; + if (!isset($bug_type['verified'][$type])) $bug_type['verified'][$type] = 0; + if (!isset($bug_type['suspended'][$type])) $bug_type['suspended'][$type] = 0; + if (!isset($bug_type['duplicate'][$type])) $bug_type['duplicate'][$type] = 0; + if (!isset($bug_type['assigned'][$type])) $bug_type['assigned'][$type] = 0; + if (!isset($bug_type['no feedback'][$type])) $bug_type['no feedback'][$type] = 0; + if (!isset($bug_type['feedback'][$type])) $bug_type['feedback'][$type] = 0; } -if(!isset($sort_by)) $sort_by = 'open'; -if(!isset($rev)) $rev = 1; +if (!isset($sort_by)) $sort_by = 'open'; +if (!isset($rev)) $rev = 1; -if($rev == 1) { +if ($rev == 1) { arsort($bug_type[$sort_by]); } else { asort($bug_type[$sort_by]); } reset($bug_type); -function sort_url($type) { +function sort_url ($type) +{ global $sort_by,$rev,$phpver; - if($type == $sort_by) { + + if ($type == $sort_by) { $reve = ($rev == 1) ? 0 : 1; } else { $reve = 1; } $ver = ($phpver != 0) ? "phpver=$phpver&" : ''; - return '<A href="./bugstats.php?'.$ver.'sort_by='.$type.'&rev='.$reve.'">'.ucfirst($type).'</a>'; + return '<A href="./bugstats.php?'.$ver.'sort_by='.urlencode($type).'&rev='.$reve.'">'.ucfirst($type).'</a>'; } echo "<tr bgcolor=#aabbcc><th align=right>Total bug entries in system:</th><td>$total</td>"; -echo "<th>".sort_url('closed')."</th>"; -echo "<th>".sort_url('open')."</th>"; -echo "<th>".sort_url('critical')."</th>"; -echo "<th>".sort_url('analyzed')."</th>"; -echo "<th>".sort_url('verified')."</th>"; -echo "<th>".sort_url('suspended')."</th>"; -echo "<th>".sort_url('duplicate')."</th>"; -echo "<th>".sort_url('assigned')."</th>"; -echo "<th>".sort_url('feedback')."</th>"; -echo "<th>".sort_url('no feedback')."</th>"; -echo "<th>".sort_url('bogus')."</th>"; +echo "<th>",sort_url('closed'),"</th>"; +echo "<th>",sort_url('open'),"</th>"; +echo "<th>",sort_url('critical'),"</th>"; +echo "<th>",sort_url('verified'),"</th>"; +echo "<th>",sort_url('analyzed'),"</th>"; +echo "<th>",sort_url('assigned'),"</th>"; +echo "<th>",sort_url('suspended'),"</th>"; +echo "<th>",sort_url('duplicate'),"</th>"; +echo "<th>",sort_url('feedback'),"</th>"; +echo "<th nowrap>",sort_url('no feedback'),"</th>"; +echo "<th>",sort_url('bogus'),"</th>"; echo "</tr>\n"; echo "<tr><th align=right bgcolor=#aabbcc>All:</th>", @@ -109,13 +114,13 @@ "<td align=center bgcolor=#ddeeff>".bugstats('closed','all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('open', 'all')." </td>", "<td align=center bgcolor=#ddeeff>".bugstats('critical', 'all')." </td>", - "<td align=center bgcolor=#ccddee>".bugstats('analyzed', 'all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('verified', 'all')." </td>", + "<td align=center bgcolor=#ccddee>".bugstats('analyzed', 'all')." </td>", + "<td align=center bgcolor=#ddeeff>".bugstats('assigned','all')." </td>", "<td align=center bgcolor=#ddeeff>".bugstats('suspended','all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('duplicate', 'all')." </td>", - "<td align=center bgcolor=#ddeeff>".bugstats('assigned','all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('feedback','all')." </td>", - "<td align=center bgcolor=#ddeeff>".bugstats('no feedback','all')." </td>", + "<td align=center bgcolor=#ddeeff>".bugstats('no feedback','all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('bogus', 'all')." </td>", "</tr>\n"; @@ -123,7 +128,7 @@ if(($bug_type['open'][$type] > 0 || $bug_type['critical'][$type] > 0 || $bug_type['analyzed'][$type] > 0 || - $bug_type['verified'][$type] > 0 || + $bug_type['verified'][$type] > 0 || $bug_type['suspended'][$type] > 0 || $bug_type['duplicate'][$type] > 0 || $bug_type['assigned'][$type] > 0 || @@ -134,13 +139,13 @@ "<td align=center bgcolor=#ddeeff>".bugstats('closed', $type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('open', $type)." </td>", "<td align=center bgcolor=#ddeeff>".bugstats('critical',$type)." </td>", + "<td align=center bgcolor=#ccddee>".bugstats('verified', $type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('analyzed', $type)." </td>", - "<td align=center bgcolor=#ccddee>".bugstats('verified', $type)." </td>", + "<td align=center bgcolor=#ddeeff>".bugstats('assigned',$type)." </td>", "<td align=center bgcolor=#ddeeff>".bugstats('suspended',$type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('duplicate', $type)." </td>", - "<td align=center bgcolor=#ddeeff>".bugstats('assigned',$type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('feedback',$type)." </td>", - "<td align=center bgcolor=#ddeeff>".bugstats('no feedback',$type)." </td>", + "<td align=center bgcolor=#ddeeff>".bugstats('no feedback',$type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('bogus', $type)." </td>", "</tr>\n"; } @@ -166,28 +171,29 @@ echo "<p><b>Bug Report Time to Close Stats</b>\n"; echo "<table>\n"; -echo "<tr bgcolor=#aabbcc><th align=right>Average life of a report:</th><td bgcolor=#ccddee>".ShowTime((int)$row[average])."</td></tr>\n"; -echo "<tr bgcolor=#aabbcc><th align=right>Median life of a report:</th><td bgcolor=#ccddee>".ShowTime($median)."</td></tr>\n"; -echo "<tr bgcolor=#aabbcc><th align=right>Slowest report closure:</th><td bgcolor=#ccddee>".ShowTime($row[slowest])."</td></tr>\n"; -echo "<tr bgcolor=#aabbcc><th align=right>Quickest report closure:</th><td bgcolor=#ccddee>".ShowTime($row[quickest])."</td></tr>\n"; +echo "<tr bgcolor=#aabbcc><th align=right>Average life of a report:</th><td bgcolor=#ccddee>",ShowTime((int)$row[average]),"</td></tr>\n"; +echo "<tr bgcolor=#aabbcc><th align=right>Median life of a report:</th><td bgcolor=#ccddee>",ShowTime($median),"</td></tr>\n"; +echo "<tr bgcolor=#aabbcc><th align=right>Slowest report closure:</th><td bgcolor=#ccddee>",ShowTime($row[slowest]),"</td></tr>\n"; +echo "<tr bgcolor=#aabbcc><th align=right>Quickest report closure:</th><td bgcolor=#ccddee>",ShowTime($row[quickest]),"</td></tr>\n"; echo "</table>\n"; commonFooter(); -function ShowTime($sec) { - if($sec<60) { +function ShowTime($sec) +{ + if ($sec < 60) { return "$sec seconds"; - } else if($sec<120) { - return (int)($sec/60)." minute ".($sec%60)." seconds"; - } else if($sec<3600) { - return (int)($sec/60)." minutes ".($sec%60)." seconds"; - } else if($sec<7200) { - return (int)($sec/3600)." hour ".(int)(($sec%3600)/60)." minutes ".(($sec%3600)%60)." seconds"; - } else if($sec<86400) { + } else if ($sec < 120) { + return (int)($sec / 60)." minute ".($sec%60)." seconds"; + } else if ($sec < 3600) { + return (int)($sec / 60)." minutes ".($sec%60)." seconds"; + } else if ($sec < 7200) { + return (int)($sec / 3600)." hour ".(int)(($sec%3600)/60)." minutes ".(($sec%3600)%60)." seconds"; + } else if ($sec < 86400) { return (int)($sec/3600)." hours ".(int)(($sec%3600)/60)." minutes ".(($sec%3600)%60)." seconds"; - } else if($sec<172800) { - return (int)($sec/86400)." day ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; + } else if ($sec < 172800) { + return (int)($sec / 86400)." day ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; } else { - return (int)($sec/86400)." days ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; + return (int)($sec / 86400)." days ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; } }
Index: php-bugs-web/bugstats.php diff -u php-bugs-web/bugstats.php:1.16 php-bugs-web/bugstats.php:1.17 --- php-bugs-web/bugstats.php:1.16 Mon Jul 14 21:26:02 2003 +++ php-bugs-web/bugstats.php Thu Aug 14 05:46:03 2003 @@ -1,4 +1,5 @@ <?php /* vim: set noet ts=4 sw=4: : */ + require_once 'prepend.inc'; commonHeader("Statistics"); @@ -6,7 +7,7 @@ @mysql_pconnect("localhost","nobody","") or die("unable to connect to database"); @mysql_select_db("php3") - or die("unable to select database"); + or die("unable to select database"); $query = "SELECT status,bug_type,email,php_version,php_os FROM bugdb"; @@ -18,7 +19,7 @@ $result = mysql_unbuffered_query($query); -while($row=mysql_fetch_array($result)) { +while ($row = mysql_fetch_array($result)) { $bug_type['all'][$row[bug_type]]++; $status_str = strtolower($row['status']); $bug_type[$status_str][$row[bug_type]]++; @@ -32,9 +33,9 @@ // Exit if there are no bugs for this version if ($total == 0) { - echo '<p>No bugs found for this PHP version</p>'; - commonFooter(); - exit; + echo '<p>No bugs found for this PHP version</p>'; + commonFooter(); + exit; } if ($phpver > 0) { @@ -44,8 +45,10 @@ } echo "Display <a href=\"bugstats.php?phpver=4\">PHP 4 bugs only</a> or <a href=\"bugstats.php?phpver=5\">PHP 5 bugs only</a>.</p>\n"; -function bugstats($status, $type) { +function bugstats ($status, $type) +{ global $bug_type, $phpver; + if ($bug_type[$status][$type] > 0) { return '<a href="index.php?cmd=display&status=' . ucfirst($status) . "&phpver=" . $phpver . ($type == 'all' ? '' : '&bug_type[]=' . urlencode($type)) . '&by=Any">' . $bug_type[$status][$type] . "</a>\n"; } @@ -56,52 +59,54 @@ /* prepare for sorting by bug report count */ foreach($bug_type['all'] as $type => $value) { - if(!isset($bug_type['closed'][$type])) $bug_type['closed'][$type] = 0; - if(!isset($bug_type['bogus'][$type])) $bug_type['bogus'][$type] = 0; - if(!isset($bug_type['open'][$type])) $bug_type['open'][$type] = 0; - if(!isset($bug_type['critical'][$type])) $bug_type['critical'][$type] = 0; - if(!isset($bug_type['analyzed'][$type])) $bug_type['analyzed'][$type] = 0; - if(!isset($bug_type['verified'][$type])) $bug_type['verified'][$type] = 0; - if(!isset($bug_type['suspended'][$type])) $bug_type['suspended'][$type] = 0; - if(!isset($bug_type['duplicate'][$type])) $bug_type['duplicate'][$type] = 0; - if(!isset($bug_type['assigned'][$type])) $bug_type['assigned'][$type] = 0; - if(!isset($bug_type['no feedback'][$type])) $bug_type['no feedback'][$type] = 0; - if(!isset($bug_type['feedback'][$type])) $bug_type['feedback'][$type] = 0; + if (!isset($bug_type['closed'][$type])) $bug_type['closed'][$type] = 0; + if (!isset($bug_type['bogus'][$type])) $bug_type['bogus'][$type] = 0; + if (!isset($bug_type['open'][$type])) $bug_type['open'][$type] = 0; + if (!isset($bug_type['critical'][$type])) $bug_type['critical'][$type] = 0; + if (!isset($bug_type['analyzed'][$type])) $bug_type['analyzed'][$type] = 0; + if (!isset($bug_type['verified'][$type])) $bug_type['verified'][$type] = 0; + if (!isset($bug_type['suspended'][$type])) $bug_type['suspended'][$type] = 0; + if (!isset($bug_type['duplicate'][$type])) $bug_type['duplicate'][$type] = 0; + if (!isset($bug_type['assigned'][$type])) $bug_type['assigned'][$type] = 0; + if (!isset($bug_type['no feedback'][$type])) $bug_type['no feedback'][$type] = 0; + if (!isset($bug_type['feedback'][$type])) $bug_type['feedback'][$type] = 0; } -if(!isset($sort_by)) $sort_by = 'open'; -if(!isset($rev)) $rev = 1; +if (!isset($sort_by)) $sort_by = 'open'; +if (!isset($rev)) $rev = 1; -if($rev == 1) { +if ($rev == 1) { arsort($bug_type[$sort_by]); } else { asort($bug_type[$sort_by]); } reset($bug_type); -function sort_url($type) { +function sort_url ($type) +{ global $sort_by,$rev,$phpver; - if($type == $sort_by) { + + if ($type == $sort_by) { $reve = ($rev == 1) ? 0 : 1; } else { $reve = 1; } $ver = ($phpver != 0) ? "phpver=$phpver&" : ''; - return '<A href="./bugstats.php?'.$ver.'sort_by='.$type.'&rev='.$reve.'">'.ucfirst($type).'</a>'; + return '<A href="./bugstats.php?'.$ver.'sort_by='.urlencode($type).'&rev='.$reve.'">'.ucfirst($type).'</a>'; } echo "<tr bgcolor=#aabbcc><th align=right>Total bug entries in system:</th><td>$total</td>"; -echo "<th>".sort_url('closed')."</th>"; -echo "<th>".sort_url('open')."</th>"; -echo "<th>".sort_url('critical')."</th>"; -echo "<th>".sort_url('analyzed')."</th>"; -echo "<th>".sort_url('verified')."</th>"; -echo "<th>".sort_url('suspended')."</th>"; -echo "<th>".sort_url('duplicate')."</th>"; -echo "<th>".sort_url('assigned')."</th>"; -echo "<th>".sort_url('feedback')."</th>"; -echo "<th>".sort_url('no feedback')."</th>"; -echo "<th>".sort_url('bogus')."</th>"; +echo "<th>",sort_url('closed'),"</th>"; +echo "<th>",sort_url('open'),"</th>"; +echo "<th>",sort_url('critical'),"</th>"; +echo "<th>",sort_url('verified'),"</th>"; +echo "<th>",sort_url('analyzed'),"</th>"; +echo "<th>",sort_url('assigned'),"</th>"; +echo "<th>",sort_url('suspended'),"</th>"; +echo "<th>",sort_url('duplicate'),"</th>"; +echo "<th>",sort_url('feedback'),"</th>"; +echo "<th nowrap>",sort_url('no feedback'),"</th>"; +echo "<th>",sort_url('bogus'),"</th>"; echo "</tr>\n"; echo "<tr><th align=right bgcolor=#aabbcc>All:</th>", @@ -109,13 +114,13 @@ "<td align=center bgcolor=#ddeeff>".bugstats('closed','all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('open', 'all')." </td>", "<td align=center bgcolor=#ddeeff>".bugstats('critical', 'all')." </td>", - "<td align=center bgcolor=#ccddee>".bugstats('analyzed', 'all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('verified', 'all')." </td>", + "<td align=center bgcolor=#ccddee>".bugstats('analyzed', 'all')." </td>", + "<td align=center bgcolor=#ddeeff>".bugstats('assigned','all')." </td>", "<td align=center bgcolor=#ddeeff>".bugstats('suspended','all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('duplicate', 'all')." </td>", - "<td align=center bgcolor=#ddeeff>".bugstats('assigned','all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('feedback','all')." </td>", - "<td align=center bgcolor=#ddeeff>".bugstats('no feedback','all')." </td>", + "<td align=center bgcolor=#ddeeff>".bugstats('no feedback','all')." </td>", "<td align=center bgcolor=#ccddee>".bugstats('bogus', 'all')." </td>", "</tr>\n"; @@ -123,7 +128,7 @@ if(($bug_type['open'][$type] > 0 || $bug_type['critical'][$type] > 0 || $bug_type['analyzed'][$type] > 0 || - $bug_type['verified'][$type] > 0 || + $bug_type['verified'][$type] > 0 || $bug_type['suspended'][$type] > 0 || $bug_type['duplicate'][$type] > 0 || $bug_type['assigned'][$type] > 0 || @@ -134,13 +139,13 @@ "<td align=center bgcolor=#ddeeff>".bugstats('closed', $type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('open', $type)." </td>", "<td align=center bgcolor=#ddeeff>".bugstats('critical',$type)." </td>", + "<td align=center bgcolor=#ccddee>".bugstats('verified', $type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('analyzed', $type)." </td>", - "<td align=center bgcolor=#ccddee>".bugstats('verified', $type)." </td>", + "<td align=center bgcolor=#ddeeff>".bugstats('assigned',$type)." </td>", "<td align=center bgcolor=#ddeeff>".bugstats('suspended',$type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('duplicate', $type)." </td>", - "<td align=center bgcolor=#ddeeff>".bugstats('assigned',$type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('feedback',$type)." </td>", - "<td align=center bgcolor=#ddeeff>".bugstats('no feedback',$type)." </td>", + "<td align=center bgcolor=#ddeeff>".bugstats('no feedback',$type)." </td>", "<td align=center bgcolor=#ccddee>".bugstats('bogus', $type)." </td>", "</tr>\n"; } @@ -166,28 +171,29 @@ echo "<p><b>Bug Report Time to Close Stats</b>\n"; echo "<table>\n"; -echo "<tr bgcolor=#aabbcc><th align=right>Average life of a report:</th><td bgcolor=#ccddee>".ShowTime((int)$row[average])."</td></tr>\n"; -echo "<tr bgcolor=#aabbcc><th align=right>Median life of a report:</th><td bgcolor=#ccddee>".ShowTime($median)."</td></tr>\n"; -echo "<tr bgcolor=#aabbcc><th align=right>Slowest report closure:</th><td bgcolor=#ccddee>".ShowTime($row[slowest])."</td></tr>\n"; -echo "<tr bgcolor=#aabbcc><th align=right>Quickest report closure:</th><td bgcolor=#ccddee>".ShowTime($row[quickest])."</td></tr>\n"; +echo "<tr bgcolor=#aabbcc><th align=right>Average life of a report:</th><td bgcolor=#ccddee>",ShowTime((int)$row[average]),"</td></tr>\n"; +echo "<tr bgcolor=#aabbcc><th align=right>Median life of a report:</th><td bgcolor=#ccddee>",ShowTime($median),"</td></tr>\n"; +echo "<tr bgcolor=#aabbcc><th align=right>Slowest report closure:</th><td bgcolor=#ccddee>",ShowTime($row[slowest]),"</td></tr>\n"; +echo "<tr bgcolor=#aabbcc><th align=right>Quickest report closure:</th><td bgcolor=#ccddee>",ShowTime($row[quickest]),"</td></tr>\n"; echo "</table>\n"; commonFooter(); -function ShowTime($sec) { - if($sec<60) { +function ShowTime($sec) +{ + if ($sec < 60) { return "$sec seconds"; - } else if($sec<120) { - return (int)($sec/60)." minute ".($sec%60)." seconds"; - } else if($sec<3600) { - return (int)($sec/60)." minutes ".($sec%60)." seconds"; - } else if($sec<7200) { - return (int)($sec/3600)." hour ".(int)(($sec%3600)/60)." minutes ".(($sec%3600)%60)." seconds"; - } else if($sec<86400) { + } else if ($sec < 120) { + return (int)($sec / 60)." minute ".($sec%60)." seconds"; + } else if ($sec < 3600) { + return (int)($sec / 60)." minutes ".($sec%60)." seconds"; + } else if ($sec < 7200) { + return (int)($sec / 3600)." hour ".(int)(($sec%3600)/60)." minutes ".(($sec%3600)%60)." seconds"; + } else if ($sec < 86400) { return (int)($sec/3600)." hours ".(int)(($sec%3600)/60)." minutes ".(($sec%3600)%60)." seconds"; - } else if($sec<172800) { - return (int)($sec/86400)." day ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; + } else if ($sec < 172800) { + return (int)($sec / 86400)." day ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; } else { - return (int)($sec/86400)." days ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; + return (int)($sec / 86400)." days ".(int)(($sec%86400)/3600)." hours ".(int)((($sec%86400)%3600)/60)." minutes ".((($sec%86400)%3600)%60)." seconds"; } }