cvs: php-bugs-web / bugstats.php
| From: | Philip Olson | Date: | Fri, 23 Feb 2007 03:28:49 +0000 |
| Subject: | cvs: php-bugs-web / bugstats.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-34438@lists.php.net to get a copy of this message | ||
philip Fri Feb 23 03:28:49 2007 UTC
Modified files:
/php-bugs-web bugstats.php
Log:
!register_globals, input validation, linked to PECL/PEAR stats, added PHP 6 option
http://cvs.php.net/viewvc.cgi/php-bugs-web/bugstats.php?r1=1.26&r2=1.27&diff_format=u
Index: php-bugs-web/bugstats.php
diff -u php-bugs-web/bugstats.php:1.26 php-bugs-web/bugstats.php:1.27
--- php-bugs-web/bugstats.php:1.26 Sun Feb 11 07:23:28 2007
+++ php-bugs-web/bugstats.php Fri Feb 23 03:28:48 2007
@@ -9,9 +9,11 @@
@mysql_select_db("phpbugdb")
or die("unable to select database");
-$query = "SELECT status,bug_type,email,php_version,php_os FROM bugdb";
+$sort_by = isset($_GET['sort_by']) ? htmlspecialchars($_GET['sort_by'],
ENT_QUOTES) : 'open';
+$rev = isset($_GET['rev']) ? (int) $_GET['rev'] : 1;
+$phpver = isset($_GET['phpver']) ? (int) $_GET['phpver'] : 0;
-$phpver = (int)$phpver;
+$query = "SELECT status,bug_type,email,php_version,php_os FROM bugdb";
if ($phpver > 0) {
$query .= " WHERE SUBSTRING(php_version,1,1) = '$phpver'";
@@ -21,7 +23,7 @@
$result = mysql_unbuffered_query($query);
-while ($row = mysql_fetch_array($result)) {
+while ($row = mysql_fetch_assoc($result)) {
$bug_type['all'][$row['bug_type']]++;
$status_str = strtolower($row['status']);
$bug_type[$status_str][$row['bug_type']]++;
@@ -41,11 +43,14 @@
}
if ($phpver > 0) {
- echo "<p>Currently displaying PHP {$phpver} bugs only.";
+ echo "<p>Currently displaying <strong>PHP {$phpver}</strong> bugs
only.";
} else {
- echo "<p>Currently displaying all bugs.";
+ echo "<p>Currently displaying <strong>all</strong> bugs.";
}
-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";
+echo '<p>Display either <a href="bugstats.php?phpver=0">all</a>
bugs or optionally choose a specific PHP Version: ';
+echo '<a href="bugstats.php?phpver=4">4</a> or <a
href="bugstats.php?phpver=5">5</a> or <a
href="bugstats.php?phpver=6">6</a></p>';
+
+echo '<p>See also bug statistics for <a href="http://pecl.php.net/bugs/stats.php">PECL</a>
or <a href="http://pear.php.net/bugs/stats.php">PEAR</a></p>';
function bugstats ($status, $type)
{
@@ -56,7 +61,7 @@
}
}
-mysql_freeresult($result);
+mysql_free_result($result);
echo "<table>\n";
/* prepare for sorting by bug report count */
@@ -74,8 +79,9 @@
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($bug_type[$sort_by])) {
+ $sort_by = 'open';
+}
if ($rev == 1) {
arsort($bug_type[$sort_by]);
@@ -174,7 +180,7 @@
$res = mysql_query($query);
$row = mysql_fetch_assoc($res);
-$half = $row['count']/2;
+$half = (int) $row['count']/2;
$query = "SELECT UNIX_TIMESTAMP(ts2)-UNIX_TIMESTAMP(ts1) AS half FROM bugdb WHERE ts2 >
ts1";
if ($phpver > 0) {
$query .= " AND SUBSTRING(php_version,1,1) = '$phpver'";