From 902ec3ccc2179bd69f6679aeca73cd8b050773e9 Mon Sep 17 00:00:00 2001 From: diml Date: Sat, 30 May 2009 22:13:16 +0000 Subject: [PATCH] MDL-19342 - small fixes from Tatsuva Shirai + UTF-8 global straighten up --- search/query.php | 14 +++++--------- search/querylib.php | 5 ++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/search/query.php b/search/query.php index efe6a15c83d..caa5a6b6912 100644 --- a/search/query.php +++ b/search/query.php @@ -119,9 +119,9 @@ } // add module restriction - $doctypestr = get_string('doctype', 'search'); - $titlestr = get_string('title', 'search'); - $authorstr = get_string('author', 'search'); + $doctypestr = 'doctype'; + $titlestr = 'title'; + $authorstr = 'author'; if ($adv->module != 'all') { $query_string .= " +{$doctypestr}:".$adv->module; } @@ -340,9 +340,8 @@ foreach ($hits as $listing) { - if ($listing->doctype == 'user'){ // A special handle for users - - $icon = print_user_picture ($listing->author, 0, true, 0, true, false) ; + if ($listing->doctype == 'user'){ // A special handle for users + $icon = print_user_picture ($listing->userid, 0, true, 0, true, false) ; } else { $iconpath = $CFG->modpixpath.'/'.$listing->doctype.'/icon.gif'; $icon = "\"\"/"; @@ -351,9 +350,6 @@ $courseword = mb_convert_case(get_string('course', 'moodle'), MB_CASE_LOWER, 'UTF-8'); $course = ($listing->doctype != 'user') ? ' ('.$courseword.': \''.$coursename.'\')' : '' ; - //if ($CFG->unicodedb) { - //$listing->title = mb_convert_encoding($listing->title, 'auto', 'UTF8'); - //} $title_post_processing_function = $listing->doctype.'_link_post_processing'; $searchable_instance = $searchables[$listing->doctype]; if ($searchable_instance->location == 'internal'){ diff --git a/search/querylib.php b/search/querylib.php index 84a3eaa43d7..237d7fd2f7b 100644 --- a/search/querylib.php +++ b/search/querylib.php @@ -276,6 +276,7 @@ class SearchQuery { $resultdoc->doctype = $hit->doctype; $resultdoc->author = $hit->author; $resultdoc->courseid = $hit->course_id; + $resultdoc->userid = $hit->user_id; //and store it $resultdocs[] = clone($resultdoc); @@ -324,7 +325,9 @@ class SearchQuery { */ public function page_numbers() { $pages = $this->total_pages(); - $query = htmlentities($this->term); + // $query = htmlentities($this->term); + // http://moodle.org/mod/forum/discuss.php?d=115788 + $query = htmlentities($this->term,ENT_NOQUOTES,'utf-8'); $page = $this->pagenumber; $next = get_string('next', 'search'); $back = get_string('back', 'search');