diff --git a/search/add.php b/search/add.php
index 1f99bd200b3..cfdb5fb255c 100644
--- a/search/add.php
+++ b/search/add.php
@@ -54,6 +54,7 @@ require_once("$CFG->dirroot/search/lib.php");
mtrace('Index size before: '.$CFG->search_index_size."\n");
/// get all modules
+
if ($mods = get_records_select('modules')) {
/// append virtual modules onto array
@@ -155,4 +156,4 @@ require_once("$CFG->dirroot/search/lib.php");
mtrace("Added $addition_count documents.");
mtrace('Index size after: '.$index->count());
-?>
\ No newline at end of file
+?>
diff --git a/search/documents/chat_document.php b/search/documents/chat_document.php
index 4361d32d73c..acc4ffb479b 100644
--- a/search/documents/chat_document.php
+++ b/search/documents/chat_document.php
@@ -296,6 +296,6 @@ function chat_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
function chat_link_post_processing($title){
setLocale(LC_TIME, substr(current_language(), 0, 2));
$title = preg_replace('/TT_(.*)_TT/e', "userdate(\\1)", $title);
- return $title;
+ return mb_convert_encoding($title, 'UTF-8', 'auto');
}
?>
\ No newline at end of file
diff --git a/search/documents/data_document.php b/search/documents/data_document.php
index aaeeea3928c..4b301ffaa82 100644
--- a/search/documents/data_document.php
+++ b/search/documents/data_document.php
@@ -399,4 +399,13 @@ function data_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
return true;
}
+
+/**
+* post processes the url for cleaner output.
+* @param string $title
+*/
+function data_link_post_processing($title){
+ return mb_convert_encoding($title, 'UTF-8', 'auto');
+}
+
?>
\ No newline at end of file
diff --git a/search/documents/forum_document.php b/search/documents/forum_document.php
index ae3b3b21906..3cbe2e108a3 100644
--- a/search/documents/forum_document.php
+++ b/search/documents/forum_document.php
@@ -297,4 +297,12 @@ function forum_check_text_access($path, $itemtype, $this_id, $user, $group_id, $
return true;
}
+/**
+* post processes the url for cleaner output.
+* @param string $title
+*/
+function forum_link_post_processing($title){
+ return mb_convert_encoding($title, 'UTF-8', 'auto');
+}
+
?>
\ No newline at end of file
diff --git a/search/documents/glossary_document.php b/search/documents/glossary_document.php
index 8d48e112b2c..2ec59ef8fd6 100644
--- a/search/documents/glossary_document.php
+++ b/search/documents/glossary_document.php
@@ -251,7 +251,7 @@ function glossary_check_text_access($path, $itemtype, $this_id, $user, $group_id
* @param string $title
*/
function glossary_link_post_processing($title){
- return mb_convert_encoding($title, 'auto', 'UTF-8');
+ return mb_convert_encoding($title, 'UTF-8', 'auto');
}
?>
\ No newline at end of file
diff --git a/search/documents/lesson_document.php b/search/documents/lesson_document.php
index 42615b8927f..674dc0b63ca 100644
--- a/search/documents/lesson_document.php
+++ b/search/documents/lesson_document.php
@@ -204,4 +204,13 @@ function lesson_check_text_access($path, $itemtype, $this_id, $user, $group_id,
return true;
}
+
+/**
+* this call back is called when displaying the link for some last post processing
+*
+*/
+function lesson_link_post_processing($title){
+ return mb_convert_encoding($title, 'UTF-8', 'auto');
+}
+
?>
\ No newline at end of file
diff --git a/search/documents/physical_pdf.php b/search/documents/physical_pdf.php
index 703f68bf1e0..291e0f4a05c 100644
--- a/search/documents/physical_pdf.php
+++ b/search/documents/physical_pdf.php
@@ -22,14 +22,19 @@ function get_text_for_indexing_pdf(&$resource){
// SECURITY : do not allow non admin execute anything on system !!
if (!isadmin($USER->id)) return;
+
+ // adds moodle root switch if none was defined
+ if (!isset($CFG->block_search_usemoodleroot)){
+ set_config('block_search_usemoodleroot', 1);
+ }
- $moodleroot = (@$CFG->block_search_usemoodleroot) ? "{$CFG->dirroot}/" : '' ;
+ $moodleroot = ($CFG->block_search_usemoodleroot) ? "{$CFG->dirroot}/" : '' ;
// just call pdftotext over stdout and capture the output
if (!empty($CFG->block_search_pdf_to_text_cmd)){
preg_match("/^\S+/", $CFG->block_search_pdf_to_text_cmd, $matches);
if (!file_exists("{$moodleroot}{$matches[0]}")){
- mtrace('Error with pdf to text converter command : exectuable not found.');
+ mtrace('Error with pdf to text converter command : exectuable not found at '.$moodleroot.$matches[0]);
}
else{
$file = escapeshellarg($CFG->dataroot.'/'.$resource->course.'/'.$resource->reference);
@@ -40,7 +45,7 @@ function get_text_for_indexing_pdf(&$resource){
return $result;
}
else{
- mtrace('Error with pdf to text converter command : execution failed.');
+ mtrace('Error with pdf to text converter command : execution failed for '.$text_converter_cmd.'. Check for execution permission on pdf converter executable.');
return '';
}
}
diff --git a/search/documents/resource_document.php b/search/documents/resource_document.php
index 0e60706b2bb..844da54bc7a 100644
--- a/search/documents/resource_document.php
+++ b/search/documents/resource_document.php
@@ -323,6 +323,6 @@ function resource_check_text_access($path, $itemtype, $this_id, $user, $group_id
* @param string $title
*/
function resource_link_post_processing($title){
- return mb_convert_encoding($title, 'auto', 'UTF-8');
+ return mb_convert_encoding($title, 'UTF-8', 'auto');
}
?>
\ No newline at end of file
diff --git a/search/documents/techproject_document.php b/search/documents/techproject_document.php
index 52976d19283..53f5a4a81ae 100644
--- a/search/documents/techproject_document.php
+++ b/search/documents/techproject_document.php
@@ -290,4 +290,12 @@ function techproject_check_text_access($path, $entry_type, $this_id, $user, $gro
return true;
} //techproject_check_text_access
+/**
+* this call back is called when displaying the link for some last post processing
+*
+*/
+function techproject_link_post_processing($title){
+ return mb_convert_encoding($title, 'UTF-8', 'auto');
+}
+
?>
\ No newline at end of file
diff --git a/search/documents/wiki_document.php b/search/documents/wiki_document.php
index 23ed2f8a366..d23ca9e8a4b 100644
--- a/search/documents/wiki_document.php
+++ b/search/documents/wiki_document.php
@@ -262,4 +262,13 @@ function wiki_check_text_access($path, $itemtype, $this_id, $user, $group_id, $c
return true;
}
+
+/**
+* this call back is called when displaying the link for some last post processing
+*
+*/
+function wiki_link_post_processing($title){
+ return mb_convert_encoding($title, 'UTF-8', 'auto');
+}
+
?>
\ No newline at end of file
diff --git a/search/indexer.php b/search/indexer.php
index 379af25fdc5..a7396aefd3c 100644
--- a/search/indexer.php
+++ b/search/indexer.php
@@ -62,7 +62,6 @@ require_once("$CFG->dirroot/search/lib.php");
/// check for php5 (lib.php)
if (!search_check_php5()) {
- $phpversion = phpversion();
mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version ".phpversion().")");
exit(0);
}
@@ -94,12 +93,10 @@ require_once("$CFG->dirroot/search/lib.php");
mtrace("Data directory ($index_path) does not exist, attempting to create.");
if (!mkdir($index_path)) {
search_pexit("Error creating data directory at: $index_path. Please correct.");
- }
- else {
+ } else {
mtrace("Directory successfully created.");
}
- }
- else {
+ } else {
mtrace("Using $index_path as data directory.");
}
diff --git a/search/indexersplash.php b/search/indexersplash.php
index 7198d58edda..8efdab6140b 100644
--- a/search/indexersplash.php
+++ b/search/indexersplash.php
@@ -25,17 +25,16 @@ require_once("$CFG->dirroot/search/lib.php");
require_login();
if (empty($CFG->enableglobalsearch)) {
- print_error('globalsearchdisabled', 'search');
+ error(get_string('globalsearchdisabled', 'search'));
}
if (!isadmin()) {
- print_error('beadmin', 'search', "$CFG->wwwroot/login/index.php");
+ error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
}
/// check for php5 (lib.php)
if (!search_check_php5()) {
- $phpversion = phpversion();
mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version ".phpversion().")");
exit(0);
}
@@ -50,7 +49,8 @@ require_once("$CFG->dirroot/search/lib.php");
$navlinks[] = array('name' => $strsearch, 'link' => "index.php", 'type' => 'misc');
$navlinks[] = array('name' => $strquery, 'link' => "stats.php", 'type' => 'misc');
$navlinks[] = array('name' => get_string('runindexer','search'), 'link' => null, 'type' => 'misc');
- if ($CFG->version <= 2007021541){ // 1.8 branch stable timestamp
+ // if ($CFG->version <= 2007021541){ // 1.8 branch stable timestamp NOT RELIABLE
+ if (!function_exists('build_navigation')){ // 1.8 branch stable timestamp
$navigation = '';
} else {
$navigation = build_navigation($navlinks);
@@ -77,4 +77,4 @@ require_once("$CFG->dirroot/search/lib.php");
else {
header('Location: indexer.php?areyousure=yes');
}
-?>
+?>
\ No newline at end of file
diff --git a/search/query.php b/search/query.php
index 47b4e78f04f..cd62c2cbefb 100644
--- a/search/query.php
+++ b/search/query.php
@@ -43,7 +43,7 @@
}
if (empty($CFG->enableglobalsearch)) {
- print_error('globalsearchdisabled', 'search');
+ error(get_string('globalsearchdisabled', 'search'));
}
$adv = new Object();
@@ -61,8 +61,7 @@
if ($pages && isset($_SESSION['search_advanced_query'])) {
// if both are set, then we are busy browsing through the result pages of an advanced query
$adv = unserialize($_SESSION['search_advanced_query']);
- }
- else if ($advanced) {
+ } else if ($advanced) {
// otherwise we are dealing with a new advanced query
unset($_SESSION['search_advanced_query']);
session_unregister('search_advanced_query');
@@ -144,7 +143,8 @@
$strsearch = get_string('search', 'search');
$strquery = get_string('enteryoursearchquery', 'search');
- if ($CFG->version < 2007032200){
+// if ($CFG->version < 2007032200){ NOT RELIABLE
+ if (!function_exists('build_navigation')){
print_header("$site->shortname: $strsearch: $strquery", "$site->fullname",
"$strsearch -> $strquery");
} else {
@@ -187,8 +187,7 @@
|
@@ -277,8 +276,7 @@
if ($sq->is_valid_index()) {
//use cached variable to show up-to-date index size (takes deletions into account)
print $CFG->search_index_size;
- }
- else {
+ } else {
print "0";
}
@@ -358,4 +356,4 @@
}
print_box_end();
print_footer();
-?>
+?>
\ No newline at end of file
diff --git a/search/stats.php b/search/stats.php
index 9e64c04cb60..8412241ef27 100644
--- a/search/stats.php
+++ b/search/stats.php
@@ -45,8 +45,16 @@ require_once("{$CFG->dirroot}/search/lib.php");
$strsearch = get_string('search', 'search');
$strquery = get_string('statistics', 'search');
- print_header("$site->shortname: $strsearch: $strquery", "$site->fullname",
- "$strsearch -> $strquery");
+ if (!function_exists('build_navigation')){
+ print_header("$site->shortname: $strsearch: $strquery", "$site->fullname",
+ "$strsearch -> $strquery");
+ } else {
+ $navlinks[] = array('name' => $strsearch, 'link' => "index.php", 'type' => 'misc');
+ $navlinks[] = array('name' => $strquery, 'link' => null, 'type' => 'misc');
+ $navigation = build_navigation($navlinks);
+ $site = get_site();
+ print_header("$strsearch", "$site->fullname" , $navigation, "", "", true, " ", navmenu($site));
+ }
/// keep things pretty, even if php5 isn't available
diff --git a/search/update.php b/search/update.php
index 610735dcc64..c83e2f85951 100644
--- a/search/update.php
+++ b/search/update.php
@@ -134,8 +134,7 @@ require_once("$CFG->dirroot/search/lib.php");
mtrace(" Add: $add->title (database id = $add->dbid, moodle instance id = $add->docid)");
$index->addDocument($add);
}
- }
- else{
+ } else {
mtrace("No types to update.\n");
}
mtrace("Finished $mod->name.\n");