[geeklog-hg] geeklog: Fixed a bug where the word "search" was searched (bug #...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Thu Jan 17 07:46:53 EST 2013


changeset 8917:01b2438d98c9
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/01b2438d98c9
user: Kenji ITO <mystralkk at gmail.com>
date: Thu Jan 17 15:44:50 2013 +0900
description:
Fixed a bug where the word "search" was searched (bug #0001518)

diffstat:

 public_html/layout/modern_curve/javascript/search.js |  7 +++++++
 system/classes/search.class.php                      |  4 +++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r bb29276bbb31 -r 01b2438d98c9 public_html/layout/modern_curve/javascript/search.js
--- a/public_html/layout/modern_curve/javascript/search.js	Wed Jan 16 22:05:42 2013 +0900
+++ b/public_html/layout/modern_curve/javascript/search.js	Thu Jan 17 15:44:50 2013 +0900
@@ -16,3 +16,10 @@
         $(this).val(this.defaultValue);
     }
 });
+
+// Removes the text if there has been no input
+$("#searchform input:submit").click(function () {
+    if ($("#searchform input[name='query']").val() === this.title) {
+        $("#searchform input[name='query']").val('');
+    }
+});
diff -r bb29276bbb31 -r 01b2438d98c9 system/classes/search.class.php
--- a/system/classes/search.class.php	Wed Jan 16 22:05:42 2013 +0900
+++ b/system/classes/search.class.php	Thu Jan 17 15:44:50 2013 +0900
@@ -432,7 +432,9 @@
 
         // Make sure there is a query string
         // Full text searches have a minimum word length of 3 by default
-        if ((empty($this->_query) && empty($this->_author) && empty($this->_topic)) || ($_CONF['search_use_fulltext'] && strlen($this->_query) < 3))
+        if ((trim($this->_query) === '') ||
+                (empty($this->_query) && empty($this->_author) && empty($this->_topic)) ||
+                ($_CONF['search_use_fulltext'] && strlen($this->_query) < 3))
         {
             $retval = '<p>' . $LANG09[41] . '</p>' . LB;
             $retval .= $this->showForm();



More information about the geeklog-cvs mailing list