[Fusionforge-commits] FusionForge branch master updated. 153169d511a8185705a722b2ae86006622d49f7d

Marc-Etienne VARGENAU vargenau at fusionforge.org
Wed Jul 16 19:00:56 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  153169d511a8185705a722b2ae86006622d49f7d (commit)
      from  5cefae945b06eb137080ba13bef3f8f40c46fb3d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 153169d511a8185705a722b2ae86006622d49f7d
Author: Marc-Etienne Vargenau <Marc-Etienne.Vargenau at alcatel-lucent.com>
Date:   Wed Jul 16 19:00:28 2014 +0200

    wiki: update search functions

diff --git a/src/plugins/wiki/www/lib/TextSearchQuery.php b/src/plugins/wiki/www/lib/TextSearchQuery.php
index c9c3ee8..a59346d 100644
--- a/src/plugins/wiki/www/lib/TextSearchQuery.php
+++ b/src/plugins/wiki/www/lib/TextSearchQuery.php
@@ -96,10 +96,11 @@ class TextSearchQuery
      */
     function TextSearchQuery($search_query, $case_exact = false, $regex = 'auto')
     {
-        if ($regex == 'none' or !$regex)
+        if ($regex == 'none' or !$regex) {
             $this->_regex = 0;
-        elseif (defined("TSQ_REGEX_" . strtoupper($regex)))
-            $this->_regex = constant("TSQ_REGEX_" . strtoupper($regex)); else {
+        } elseif (defined("TSQ_REGEX_" . strtoupper($regex))) {
+            $this->_regex = constant("TSQ_REGEX_" . strtoupper($regex));
+        } else {
             trigger_error(fmt("Unsupported argument: %s=%s", 'regex', $regex));
             $this->_regex = 0;
         }
diff --git a/src/plugins/wiki/www/lib/WikiDB/backend.php b/src/plugins/wiki/www/lib/WikiDB/backend.php
index 58c2225..62d966e 100644
--- a/src/plugins/wiki/www/lib/WikiDB/backend.php
+++ b/src/plugins/wiki/www/lib/WikiDB/backend.php
@@ -864,15 +864,17 @@ class WikiDB_backend_search_sql extends WikiDB_backend_search
     function _fulltext_match_clause($node)
     {
         // force word-style %word% for fulltext search
-        $word = '%' . $node->sql_quote($node->word) . '%';
+        $dbh = &$this->_dbh;
+        $word = '%' . $dbh->escapeSimple($word) . '%';
         // eliminate stoplist words
-        if ($this->isStoplisted($node))
+        if ($this->isStoplisted($node)) {
             return "1=1"; // and (pagename or 1) => and 1
-        else
+        } else {
             return $this->_pagename_match_clause($node)
                 // probably convert this MATCH AGAINST or SUBSTR/POSITION without wildcards
                 . ($this->_case_exact ? " OR content LIKE '$word'"
                     : " OR LOWER(content) LIKE '$word'");
+        }
     }
 }
 
diff --git a/src/plugins/wiki/www/lib/WikiDB/backend/PearDB_mysql.php b/src/plugins/wiki/www/lib/WikiDB/backend/PearDB_mysql.php
index 5cb7ab5..64bd1d8 100644
--- a/src/plugins/wiki/www/lib/WikiDB/backend/PearDB_mysql.php
+++ b/src/plugins/wiki/www/lib/WikiDB/backend/PearDB_mysql.php
@@ -215,6 +215,8 @@ class WikiDB_backend_PearDB_mysql_search
     function _pagename_match_clause($node)
     {
         $word = $node->sql();
+        $dbh = &$this->_dbh;
+        $word = $dbh->escapeSimple($word);
         if ($node->op == 'REGEX') { // posix regex extensions
             return "pagename REGEXP '$word'";
         } else {
diff --git a/src/plugins/wiki/www/lib/plugin/FullTextSearch.php b/src/plugins/wiki/www/lib/plugin/FullTextSearch.php
index 4c4177e..22730ed 100644
--- a/src/plugins/wiki/www/lib/plugin/FullTextSearch.php
+++ b/src/plugins/wiki/www/lib/plugin/FullTextSearch.php
@@ -49,8 +49,8 @@ class WikiPlugin_FullTextSearch
 
     function getDefaultArguments()
     {
-        return array_merge
-        (
+        // All PageList::supportedArgs, except 'pagename'
+        $args = array_merge(
             PageList::supportedArgs(), // paging and more.
             array('s' => false,
                 'hilight' => true,
@@ -60,6 +60,8 @@ class WikiPlugin_FullTextSearch
                 'noheader' => false,
                 'exclude' => false, // comma-separated list of glob
                 'quiet' => true)); // be less verbose
+         unset($args['pagename']);
+         return $args;
     }
 
     function run($dbi, $argstr, &$request, $basepage)
diff --git a/src/plugins/wiki/www/lib/plugin/TitleSearch.php b/src/plugins/wiki/www/lib/plugin/TitleSearch.php
index e9e3d16..da8cf1e 100644
--- a/src/plugins/wiki/www/lib/plugin/TitleSearch.php
+++ b/src/plugins/wiki/www/lib/plugin/TitleSearch.php
@@ -47,8 +47,8 @@ class WikiPlugin_TitleSearch
 
     function getDefaultArguments()
     {
-        return array_merge
-        (
+        // All PageList::supportedArgs, except 'pagename'
+        $args = array_merge(
             PageList::supportedArgs(), // paging and more.
             array('s' => false,
                 'auto_redirect' => false,
@@ -59,6 +59,8 @@ class WikiPlugin_TitleSearch
                 'regex' => 'auto',
                 'format' => false,
             ));
+         unset($args['pagename']);
+         return $args;
     }
 
     // info arg allows multiple columns
@@ -72,6 +74,10 @@ class WikiPlugin_TitleSearch
             return HTML();
         }
 
+        if (empty($args['sortby'])) {
+            $args['sortby'] = '';
+        }
+
         // ^S != S*   ^  matches only beginning of phrase, not of word.
         //            x* matches any word beginning with x
         $query = new TextSearchQuery($args['s'], $args['case_exact'], $args['regex']);
diff --git a/src/plugins/wiki/www/pgsrc/Help%2FFullTextSearchPlugin b/src/plugins/wiki/www/pgsrc/Help%2FFullTextSearchPlugin
index 9453c36..b9e54fa 100644
--- a/src/plugins/wiki/www/pgsrc/Help%2FFullTextSearchPlugin
+++ b/src/plugins/wiki/www/pgsrc/Help%2FFullTextSearchPlugin
@@ -1,4 +1,4 @@
-Date: Fri, 11 Jan 2013 11:16:51 +0000
+Date: Wed, 16 Jul 2014 15:48:13 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0)
 Content-Type: application/x-phpwiki;
   pagename=Help%2FFullTextSearchPlugin;
@@ -15,7 +15,8 @@ The **~FullTextSearch** [[Help:WikiPlugin|plugin]] searches the content of all p
 
 == Arguments ==
 
-All [[Help:PageList|PageList]] arguments, plus the following ones:
+All [[Help:PageList|PageList]] arguments (except //paganame//),
+plus the following ones:
 
 {| class="bordered"
 |-
diff --git a/src/plugins/wiki/www/pgsrc/Help%2FTitleSearchPlugin b/src/plugins/wiki/www/pgsrc/Help%2FTitleSearchPlugin
index 8dd444b..79b1380 100644
--- a/src/plugins/wiki/www/pgsrc/Help%2FTitleSearchPlugin
+++ b/src/plugins/wiki/www/pgsrc/Help%2FTitleSearchPlugin
@@ -1,4 +1,4 @@
-Date: Fri,  7 Dec 2012 14:58:45 +0000
+Date: Wed, 16 Jul 2014 15:48:13 +0000
 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0)
 Content-Type: application/x-phpwiki;
   pagename=Help%2FTitleSearchPlugin;
@@ -18,7 +18,8 @@ otherwise the found page list is displayed.
 
 == Arguments ==
 
-All [[Help:PageList|PageList]] arguments, plus the following ones:
+All [[Help:PageList|PageList]] arguments (except //paganame//),
+plus the following ones:
 
 {| class="bordered"
 |-

-----------------------------------------------------------------------

Summary of changes:
 src/plugins/wiki/www/lib/TextSearchQuery.php             |    7 ++++---
 src/plugins/wiki/www/lib/WikiDB/backend.php              |    8 +++++---
 src/plugins/wiki/www/lib/WikiDB/backend/PearDB_mysql.php |    2 ++
 src/plugins/wiki/www/lib/plugin/FullTextSearch.php       |    6 ++++--
 src/plugins/wiki/www/lib/plugin/TitleSearch.php          |   10 ++++++++--
 src/plugins/wiki/www/pgsrc/Help%2FFullTextSearchPlugin   |    5 +++--
 src/plugins/wiki/www/pgsrc/Help%2FTitleSearchPlugin      |    5 +++--
 7 files changed, 29 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list