]> git.mjollnir.org Git - moodle.git/commitdiff
finish resolution on merge
authordiml <diml>
Tue, 15 Apr 2008 21:46:55 +0000 (21:46 +0000)
committerdiml <diml>
Tue, 15 Apr 2008 21:46:55 +0000 (21:46 +0000)
15 files changed:
search/add.php
search/documents/chat_document.php
search/documents/data_document.php
search/documents/forum_document.php
search/documents/glossary_document.php
search/documents/lesson_document.php
search/documents/physical_pdf.php
search/documents/resource_document.php
search/documents/techproject_document.php
search/documents/wiki_document.php
search/indexer.php
search/indexersplash.php
search/query.php
search/stats.php
search/update.php

index 1f99bd200b373f9baf363816cd054aed9f8d1d3e..cfdb5fb255c817387d6e7b7c068043158fa50d31 100644 (file)
@@ -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
+?>
index 4361d32d73c11b56359fe00716bcaba65eba4322..acc4ffb479b234468bec8f3c3aa6708eb4dd12f8 100644 (file)
@@ -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
index aaeeea3928cafd3a105029e203042420fe238832..4b301ffaa82c18b49666a67cec139b7d442bc564 100644 (file)
@@ -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
index ae3b3b219067778afef0746e72a30ee2c3ad10b3..3cbe2e108a3476dc4375fd6864ee9dac7041a416 100644 (file)
@@ -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
index 8d48e112b2ce2e110615e4f40824eba8645d6aff..2ec59ef8fd6b8adab350f919adc0a816171e8c64 100644 (file)
@@ -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
index 42615b8927fe12cb5dcdbe4c18f78350341d25ad..674dc0b63ca57f37cb72f6747ed6ee0e216d28ac 100644 (file)
@@ -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
index 703f68bf1e07277122bb9308a0cacdfa27486655..291e0f4a05c684224b1f4e9c03a83a679afcd950 100644 (file)
@@ -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 '';
             }
         }
index 0e60706b2bb78018bc0c17136f42fa0ec7ba941d..844da54bc7abb5cbb530d22c3b507d4e2bbd409e 100644 (file)
@@ -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
index 52976d1928307db2f7f37b167444f4b5244b8ce4..53f5a4a81aea81f038bd2e88cdb1b52f776846d8 100644 (file)
@@ -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
index 23ed2f8a366198539f8dd7feca70ce5f4310c828..d23ca9e8a4b005f7f3e7912e5efe7a1507c44bd2 100644 (file)
@@ -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
index 379af25fdc526ea1ba39326e6d2c1a379a51ab24..a7396aefd3cb0fe3cb1ee173225ad80e320c7192 100644 (file)
@@ -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.");
     } 
     
index 7198d58eddade106d9dd69b439341baaabb6c4e6..8efdab6140bde9acab0d11047437b6dd3bd18a54 100644 (file)
@@ -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
index 47b4e78f04fcedee9c4babee544467be92511394..cd62c2cbefb040a080ccbbbee9ef734474bdb011 100644 (file)
@@ -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');
     $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
index 9e64c04cb60b54c1e28cede6552b80308853b938..8412241ef2787618006159ce98fffd27efb47a95 100644 (file)
@@ -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, "&nbsp;", navmenu($site));
+    }
     
 /// keep things pretty, even if php5 isn't available
 
index 610735dcc648094a09adc8799afa518316d143a1..c83e2f859510e1f17a04669ced745a1999c3b5a5 100644 (file)
@@ -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");