Removed "@" from all call_user_func() calls to make debugging special pages and such possible
authorDan
Mon, 04 May 2009 23:02:53 -0400
changeset 945 c19242d13a49
parent 944 073a42e4177f
child 946 ff58e1732482
Removed "@" from all call_user_func() calls to make debugging special pages and such possible
cron.php
includes/common.php
includes/common_cli.php
includes/lang.php
includes/search.php
install/includes/libenanoinstall.php
install/includes/libenanoinstallcli.php
--- a/cron.php	Sun Apr 26 08:03:42 2009 -0400
+++ b/cron.php	Mon May 04 23:02:53 2009 -0400
@@ -36,7 +36,7 @@
   {
     foreach ( $tasks as $task )
     {
-      @call_user_func($task);
+      call_user_func($task);
     }
     setConfig("cron_lastrun_ivl_$interval", strval(time()));
   }
--- a/includes/common.php	Sun Apr 26 08:03:42 2009 -0400
+++ b/includes/common.php	Mon May 04 23:02:53 2009 -0400
@@ -402,7 +402,7 @@
   $p = RenderMan::strToPageId($paths->get_pageid_from_url());
   if( ( $p[1] == 'Admin' || $p[1] == 'Special' ) && function_exists('page_'.$p[1].'_'.$p[0].'_preloader'))
   {
-    @call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
+    call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
   }
   
   profiler_log('Checked for preloader');
@@ -416,13 +416,6 @@
   // All checks passed! Start the main components up.  
   $session->start();
   
-  // Grab language strings from the database
-  if ( is_object(@$lang) )
-  {
-    $lang->fetch();
-    profiler_log('Fetched language strings');
-  }
-  
   // Add all of our built in special pages
   foreach ( array('SpecialUserFuncs', 'SpecialPageFuncs', 'SpecialAdmin', 'SpecialCSS', 'SpecialUpDownload', 'SpecialSearch', 'PrivateMessages', 'SpecialGroups', 'SpecialLog') as $plugin )
   {
--- a/includes/common_cli.php	Sun Apr 26 08:03:42 2009 -0400
+++ b/includes/common_cli.php	Mon May 04 23:02:53 2009 -0400
@@ -186,7 +186,7 @@
   $p = RenderMan::strToPageId($paths->get_pageid_from_url());
   if( ( $p[1] == 'Admin' || $p[1] == 'Special' ) && function_exists('page_'.$p[1].'_'.$p[0].'_preloader'))
   {
-    @call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
+    call_user_func('page_'.$p[1].'_'.$p[0].'_preloader');
   }
   
   profiler_log('Checked for preloader');
--- a/includes/lang.php	Sun Apr 26 08:03:42 2009 -0400
+++ b/includes/lang.php	Mon May 04 23:02:53 2009 -0400
@@ -770,7 +770,7 @@
       {
         if ( isset($this->filters[$filter]) )
         {
-          $result = @call_user_func($this->filters[$filter], $string);
+          $result = call_user_func($this->filters[$filter], $string);
           if ( is_string($result) )
           {
             $string = $result;
--- a/includes/search.php	Sun Apr 26 08:03:42 2009 -0400
+++ b/includes/search.php	Mon May 04 23:02:53 2009 -0400
@@ -187,18 +187,15 @@
     }
 
     $col_word = ( $case_sensitive ) ? 'word' : 'word_lcase';
-    $where_any = ( count($where_any) > 0 ) ? '( ' . $col_word . ' = \'' . implode('\' OR ' . $col_word . ' = \'', $where_any) . '\' )' : '';
+    $where_any = ( count($where_any) > 0 ) ? '( ' . $col_word . ' LIKE \'%' . implode('%\' OR ' . $col_word . ' LIKE \'%', $where_any) . '%\' )' : '';
 
     // generate query
-    // using a GROUP BY here ensures that the same word with a different case isn't counted as 2 words - it's all melted back
-    // into one later in the processing stages
-    // $group_by = ( $case_sensitive ) ? '' : ' GROUP BY lcase(word);';
     $sql = "SELECT word, page_names FROM " . table_prefix . "search_index WHERE {$where_any}";
-    if ( !($q = $db->sql_unbuffered_query($sql)) )
+    if ( !($q = $db->sql_query($sql)) )
       $db->_die('Error is in perform_search(), includes/search.php, query 1');
 
     $word_tracking = array();
-    if ( $row = $db->fetchrow() )
+    if ( $row = $db->fetchrow($q) )
     {
       do
       {
@@ -278,6 +275,7 @@
         {
           // the term only occurs in one page
           $word_cs = (( $case_sensitive ) ? $row['word'] : strtolower($row['word']));
+          
           if ( isset($word_tracking[$pages]) && in_array($word_cs, $word_tracking[$pages]) )
           {
             continue;
@@ -297,15 +295,14 @@
 
           // Is this search term present in the page's title? If so, give extra points
           preg_match("/^ns=$ns_list;pid=(.+)$/", $pages, $piecesparts);
-          $pathskey = $paths->nslist[ $piecesparts[1] ] . sanitize_page_id($piecesparts[2]);
-          if ( isPage($pathskey) )
+          $title = get_page_title_ns($piecesparts[2], $piecesparts[1]);
+          
+          $test_func = ( $case_sensitive ) ? 'strstr' : 'stristr';
+          if ( $test_func($title, $row['word']) || $test_func($piecesparts[2], $row['word']) )
           {
-            $test_func = ( $case_sensitive ) ? 'strstr' : 'stristr';
-            if ( $test_func($paths->pages[$pathskey]['name'], $row['word']) || $test_func($paths->pages[$pathskey]['urlname_nons'], $row['word']) )
-            {
-              $inc = 1.5;
-            }
+            $inc = 1.5;
           }
+          
           if ( isset($scores[$pages]) )
           {
             $scores[$pages] = $scores[$pages] + $inc;
@@ -316,9 +313,9 @@
           }
         }
       }
-      while ( $row = $db->fetchrow() );
+      while ( $row = $db->fetchrow($q) );
     }
-    $db->free_result();
+    $db->free_result($q);
 
     //
     // STAGE 2: FIRST ELIMINATION ROUND
@@ -336,7 +333,7 @@
       }
     }
   }
-
+  
   //
   // STAGE 3: PHRASE SEARCHING
   // Use LIKE to find pages with specified phrases. We can do a super-picky single query without another elimination round because
@@ -1055,7 +1052,7 @@
         {
           if ( is_callable($options['formatcallback']) )
           {
-            $text = @call_user_func($options['formatcallback'], $row, $word_list);
+            $text = call_user_func($options['formatcallback'], $row, $word_list);
           }
           else
           {
--- a/install/includes/libenanoinstall.php	Sun Apr 26 08:03:42 2009 -0400
+++ b/install/includes/libenanoinstall.php	Mon May 04 23:02:53 2009 -0400
@@ -48,7 +48,7 @@
   }
   if ( !function_exists($function) )
     die('libenanoinstall: CRITICAL: function "' . $function . '" for ' . $stage_id . ' doesn\'t exist');
-  $result = @call_user_func($function, false, $already_run);
+  $result = call_user_func($function, false, $already_run);
   if ( $result )
   {
     echo_stage_success($stage_id, $stage_name);
--- a/install/includes/libenanoinstallcli.php	Sun Apr 26 08:03:42 2009 -0400
+++ b/install/includes/libenanoinstallcli.php	Mon May 04 23:02:53 2009 -0400
@@ -21,7 +21,7 @@
   if ( !$silent )
     echo parse_shellcolor_string($lang->get("cli_msg_$stage_name"));
   
-  $result = @call_user_func($function);
+  $result = call_user_func($function);
   
   if ( !$result )
   {