From 97ea09ad3a79da5c5dadd60d8137bef612fd95a0 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Fri, 10 Oct 2014 14:15:19 +0800 Subject: [PATCH] MDL-47613 wiki: allow searching several words Thanks to Sandeep B for suggested solution --- mod/wiki/pagelib.php | 2 +- mod/wiki/renderer.php | 2 +- mod/wiki/search.php | 2 +- mod/wiki/tests/behat/wiki_search.feature | 4 ++++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mod/wiki/pagelib.php b/mod/wiki/pagelib.php index 57932195e84..758b5679558 100644 --- a/mod/wiki/pagelib.php +++ b/mod/wiki/pagelib.php @@ -111,7 +111,7 @@ abstract class page_wiki { $PAGE->set_activity_record($wiki); // the search box if (!empty($subwiki->id)) { - $search = optional_param('searchstring', null, PARAM_ALPHANUMEXT); + $search = optional_param('searchstring', null, PARAM_TEXT); $PAGE->set_button(wiki_search_form($cm, $search, $subwiki)); } } diff --git a/mod/wiki/renderer.php b/mod/wiki/renderer.php index 28201b9b6c9..526469444f8 100644 --- a/mod/wiki/renderer.php +++ b/mod/wiki/renderer.php @@ -310,7 +310,7 @@ class mod_wiki_renderer extends plugin_renderer_base { array('wid' => $wiki->id, 'title' => $page->title, 'pageid' => $page->id)); break; case 'search': - $search = optional_param('searchstring', null, PARAM_ALPHANUMEXT); + $search = optional_param('searchstring', null, PARAM_TEXT); $searchcontent = optional_param('searchwikicontent', 0, PARAM_INT); $baseurl = new moodle_url('/mod/wiki/search.php', array('cmid' => $cm->id, 'courseid' => $cm->course, diff --git a/mod/wiki/search.php b/mod/wiki/search.php index 819a4f6c666..1f0cb4e6740 100644 --- a/mod/wiki/search.php +++ b/mod/wiki/search.php @@ -26,7 +26,7 @@ require_once($CFG->dirroot . '/mod/wiki/lib.php'); require_once($CFG->dirroot . '/mod/wiki/locallib.php'); require_once($CFG->dirroot . '/mod/wiki/pagelib.php'); -$search = optional_param('searchstring', null, PARAM_ALPHANUMEXT); +$search = optional_param('searchstring', null, PARAM_TEXT); $courseid = optional_param('courseid', 0, PARAM_INT); $searchcontent = optional_param('searchwikicontent', 0, PARAM_INT); $cmid = optional_param('cmid', 0, PARAM_INT); diff --git a/mod/wiki/tests/behat/wiki_search.feature b/mod/wiki/tests/behat/wiki_search.feature index ee0a687038b..3f564c99c2c 100644 --- a/mod/wiki/tests/behat/wiki_search.feature +++ b/mod/wiki/tests/behat/wiki_search.feature @@ -52,6 +52,10 @@ Feature: Users can search wikis And I press "Search wikis" And I should not see "New page created by student1" And I should see "Collaborative teacher1 page" + And I set the field "searchstring" to "teacher1 page" + And I press "Search wikis" + And I should not see "New page created by student1" + And I should see "Collaborative teacher1 page" And I log out