svn: /pear/packages/Bugtracker/trunk/site/ search.php
| From: | Philip Olson | Date: | Tue, 02 Mar 2010 02:54:16 +0000 |
| Subject: | svn: /pear/packages/Bugtracker/trunk/site/ search.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-9236@lists.php.net to get a copy of this message | ||
philip Tue, 02 Mar 2010 02:54:16 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=295715
Log:
Added &count_only feature, via bugsweb. Patch by Kalle Sommer Nielsen
Changed paths:
U pear/packages/Bugtracker/trunk/site/search.php
Modified: pear/packages/Bugtracker/trunk/site/search.php
===================================================================
--- pear/packages/Bugtracker/trunk/site/search.php 2010-03-02 01:57:00 UTC (rev 295714)
+++ pear/packages/Bugtracker/trunk/site/search.php 2010-03-02 02:54:16 UTC (rev 295715)
@@ -9,6 +9,9 @@
redirect("bug.php?id={$search_for_id}");
}
+// For bug count only, used in places like doc.php.net
+$count_only = isset($_REQUEST['count_only']) &&
$_REQUEST['count_only'];
+
// Authenticate (Disabled for now, searching does not require knowledge of user level)
//bugs_authenticate($user, $pw, $logged_in, $is_trusted_developer);
@@ -16,12 +19,15 @@
if (isset($newrequest['PHPSESSID'])) {
unset($newrequest['PHPSESSID']);
}
-response_header(
- 'Bugs :: Search',
- " <link rel='alternate'
- type='application/rdf+xml'
- title='RSS feed' href='rss/search.php?" . http_build_query($newrequest) .
"' />");
+if (!$count_only) {
+ response_header(
+ 'Bugs :: Search',
+ " <link rel='alternate'
+ type='application/rdf+xml'
+ title='RSS feed' href='rss/search.php?" . http_build_query($newrequest) .
"' />");
+}
+
// Include common query handler (used also by rss/search.php)
require "{$ROOT_DIR}/include/query.php";
@@ -30,6 +36,12 @@
if (!$res) {
$errors[] = 'Invalid query';
} else {
+ // For count only, simply print the count and exit
+ if ($count_only) {
+ echo (int) $rows;
+ exit;
+ }
+
// Selected packages to search in
$package_name_string = '';
if (count($package_name) > 0) {