cvs: php-bugs-web / search.php /include functions.inc
| From: | Jani Taskinen | Date: | Fri, 25 Apr 2003 18:25:30 +0000 |
| Subject: | cvs: php-bugs-web / search.php /include functions.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-17068@lists.php.net to get a copy of this message | ||
sniper Fri Apr 25 14:25:30 2003 EDT
Modified files:
/php-bugs-web search.php
/php-bugs-web/include functions.inc
Log:
- Added possibility to exclude categories in searches..
Index: php-bugs-web/search.php
diff -u php-bugs-web/search.php:1.36 php-bugs-web/search.php:1.37
--- php-bugs-web/search.php:1.36 Sun Mar 2 06:23:13 2003
+++ php-bugs-web/search.php Fri Apr 25 14:25:29 2003
@@ -24,6 +24,7 @@
$mysql4 = version_compare(mysql_get_server_info(), "4.0.0", "ge");
if (!$bug_type) $bug_type = "Any";
+ if (!$bug_ntype) $bug_ntype = array();
if ($mysql4)
$query = "SELECT SQL_CALC_FOUND_ROWS ";
@@ -32,12 +33,16 @@
$query .= "*, TO_DAYS(NOW())-TO_DAYS(ts2) AS unchanged FROM bugdb ";
- if($bug_type=="Any") {
+ if ($bug_type == "Any") {
$where_clause = "WHERE bug_type != 'Feature/Change Request'";
} else {
$where_clause = "WHERE bug_type = '$bug_type'";
}
+ if (count($bug_ntype) > 0) {
+ $where_clause.= " AND bug_type NOT IN ('" . join("','",
$bug_ntype) . "')";
+ }
+
/* Treat assigned, analyzed, critical and verified bugs as open */
if ($status == "Open") {
$where_clause .= " AND (status='Open' OR status='Assigned' OR
status='Analyzed' OR status='Critical' OR status='Verified')";
@@ -128,7 +133,22 @@
$errors[] = "No bugs with the specified criteria were found.";
}
else {
- $link = "$PHP_SELF?cmd=display&bug_type=" . urlencode ($bug_type) .
"&status=".urlencode(stripslashes($status))."&search_for=".urlencode(stripslashes($search_for))."&php_os=".urlencode(stripslashes($php_os))."&bug_age=$bug_age&by=$by&order_by=$order_by&direction=$direction&phpver=$phpver&limit=$limit&assign=$assign";
+
+ $bug_ntype_string = '';
+
+ if (count($bug_ntype) > 0) {
+ foreach ($bug_ntype as $type_str) {
+ $bug_ntype_string.= '&bug_ntype[]=' . urlencode($type_str);
+ }
+ }
+
+ $link = "$PHP_SELF?cmd=display" .
+ $bug_ntype_string .
+ "&bug_type=" . urlencode($bug_type) .
+ "&status=" . urlencode(stripslashes($status)) .
+ "&search_for=" . urlencode(stripslashes($search_for)) .
+ "&php_os=" . urlencode(stripslashes($php_os)) .
+ "&bug_age=$bug_age&by=$by&order_by=$order_by&direction=$direction&phpver=$phpver&limit=$limit&assign=$assign";
?>
<table align="center" border="0" cellspacing="2"
width="95%">
<?php show_prev_next($begin,$rows,$total_rows,$link,$limit);?>
@@ -214,6 +234,11 @@
<th>Category</th>
<td nowrap="nowrap">Return only bugs in <b>category</b></td>
<td><select name="bug_type"><?php
show_types($bug_type,1);?></select></td>
+ </tr>
+ <tr>
+ <th> </th>
+ <td nowrap="nowrap">Return only bugs <b>NOT</b> in
<b>categories</b></td>
+ <td><select name="bug_ntype[]" multiple size=5><?php
show_types($bug_ntype,0);?></select></td>
</tr>
<tr>
<th>OS</th>
Index: php-bugs-web/include/functions.inc
diff -u php-bugs-web/include/functions.inc:1.66 php-bugs-web/include/functions.inc:1.67
--- php-bugs-web/include/functions.inc:1.66 Wed Mar 12 17:57:57 2003
+++ php-bugs-web/include/functions.inc Fri Apr 25 14:25:29 2003
@@ -168,7 +168,7 @@
if (!$current && !$default && !$show_any) {
echo "<option value=\"none\">--Please Select--</option>\n";
}
- elseif (!$current && $show_any) {
+ elseif (!$current && $show_any == 1) {
$current = "Any";
}
elseif (!$current) {
@@ -176,10 +176,10 @@
}
while (list($key,$value) = each($items)) {
- if ($show_any || $key != "Any") {
+ if ($show_any == 1 || $key != "Any") {
echo "<option value=\"$key\"",
- ($key == $current? " selected" : ""),
- ">$value</option>\n";
+ ((is_array($current) && in_array($key, $current)) || ($key == $current ? "
selected" : "")),
+ ">$value</option>\n";
if ($key == $current) $use++;
}
}