plugins/SpecialSearch.php
changeset 169 01bf6b1b8222
parent 116 77c75179bb95
child 192 9237767a23ae
equal deleted inserted replaced
168:bee40e39321b 169:01bf6b1b8222
    98   
    98   
    99   $template->header();
    99   $template->header();
   100   if(!empty($q))
   100   if(!empty($q))
   101   {
   101   {
   102     // See if any pages directly match the title
   102     // See if any pages directly match the title
   103           
   103     
   104     for ( $i = 0; $i < count ( $paths->pages ) / 2; $i++ )
   104     if ( strlen($q) >= 4 )
   105     {
   105     {
   106       $pg =& $paths->pages[$i];
   106       for ( $i = 0; $i < count ( $paths->pages ) / 2; $i++ )
   107       $q_lc = strtolower( str_replace(' ', '_', $q) );
       
   108       $q_tl = strtolower( str_replace('_', ' ', $q) );
       
   109       $p_lc = strtolower($pg['urlname']);
       
   110       $p_tl = strtolower($pg['name']);
       
   111       if ( strstr($p_tl, $q_tl) || strstr($p_lc, $q_lc) && $pg['visible'] == 1 )
       
   112       {
   107       {
   113         echo '<div class="usermessage">Perhaps you were looking for <b><a href="' . makeUrl($pg['urlname'], false, true) . '">' . htmlspecialchars($pg['name']) . '</a></b>?</div>';
   108         $pg =& $paths->pages[$i];
   114         break;
   109         $q_lc = strtolower( str_replace(' ', '_', $q) );
       
   110         $q_tl = strtolower( str_replace('_', ' ', $q) );
       
   111         $p_lc = strtolower($pg['urlname']);
       
   112         $p_tl = strtolower($pg['name']);
       
   113         if ( strstr($p_tl, $q_tl) || strstr($p_lc, $q_lc) && $pg['visible'] == 1 )
       
   114         {
       
   115           echo '<div class="usermessage">Perhaps you were looking for <b><a href="' . makeUrl($pg['urlname'], false, true) . '">' . htmlspecialchars($pg['name']) . '</a></b>?</div>';
       
   116           break;
       
   117         }
   115       }
   118       }
   116     }
   119     }
   117           
   120           
   118     switch(SEARCH_MODE)
   121     switch(SEARCH_MODE)
   119     {
   122     {