finish resolution on merge
This commit is contained in:
+2
-1
@@ -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());
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
?>
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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 '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
?>
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
?>
|
||||
+2
-5
@@ -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.");
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
?>
|
||||
?>
|
||||
+7
-9
@@ -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",
|
||||
"<a href=\"index.php\">$strsearch</a> -> $strquery");
|
||||
} else {
|
||||
@@ -187,8 +187,7 @@
|
||||
<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; ?>"/>
|
||||
@@ -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();
|
||||
?>
|
||||
?>
|
||||
+10
-2
@@ -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",
|
||||
"<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
|
||||
|
||||
|
||||
+1
-2
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user