mtrace('Index size before: '.$CFG->search_index_size."\n");
/// get all modules
+
if ($mods = get_records_select('modules')) {
/// append virtual modules onto array
mtrace("Added $addition_count documents.");
mtrace('Index size after: '.$index->count());
-?>
\ No newline at end of file
+?>
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
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
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
* @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
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
// 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);
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 '';
}
}
* @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
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
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
/// 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);
}
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.");
}
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);
}
$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);
else {
header('Location: indexer.php?areyousure=yes');
}
-?>
+?>
\ No newline at end of file
}
if (empty($CFG->enableglobalsearch)) {
- print_error('globalsearchdisabled', 'search');
+ error(get_string('globalsearchdisabled', 'search'));
}
$adv = new Object();
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');
$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",
"<a href=\"index.php\">$strsearch</a> -> $strquery");
} else {
<a href="query.php?a=1"><?php print_string('advancedsearch', 'search') ?></a> |
<a href="stats.php"><?php print_string('statistics', 'search') ?></a>
<?php
- }
- else {
+ } else {
print_box_start();
?>
<input type="hidden" name="a" value="<?php print $advanced; ?>"/>
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";
}
}
print_box_end();
print_footer();
-?>
+?>
\ No newline at end of file
$strsearch = get_string('search', 'search');
$strquery = get_string('statistics', 'search');
- print_header("$site->shortname: $strsearch: $strquery", "$site->fullname",
- "<a href=\"index.php\">$strsearch</a> -> $strquery");
+ if (!function_exists('build_navigation')){
+ print_header("$site->shortname: $strsearch: $strquery", "$site->fullname",
+ "<a href=\"index.php\">$strsearch</a> -> $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
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");