plugins/SpecialPageFuncs.php
changeset 699 c7d737202d59
parent 685 17ebe24cdf85
child 701 dd80cde96a6c
equal deleted inserted replaced
696:bd5069e1f19a 699:c7d737202d59
   873               'name' => $row['username'],
   873               'name' => $row['username'],
   874               'name_highlight' => highlight_term($_GET['userinput'], $row['username'], '<b>', '</b>')
   874               'name_highlight' => highlight_term($_GET['userinput'], $row['username'], '<b>', '</b>')
   875             );
   875             );
   876             $key = array_merge($key, $session->get_user_rank($row['username']));
   876             $key = array_merge($key, $session->get_user_rank($row['username']));
   877             $key['rank_title'] = $lang->get($key['rank_title']);
   877             $key['rank_title'] = $lang->get($key['rank_title']);
       
   878             $key[0] = $row['username'];
   878             $dataset[] = $key;
   879             $dataset[] = $key;
       
   880             // $dataset[] = array($row['username'], $row['username']);
       
   881             // echo "{$row['username']}|{$row['username']}\n";
   879           }
   882           }
   880         }
   883         }
       
   884         // return;
   881         break;
   885         break;
   882       case 'page':
   886       case 'page':
   883         if ( isset($_GET['userinput']) && strlen($_GET['userinput']) >= 3 )
   887         if ( isset($_GET['userinput']) && strlen($_GET['userinput']) >= 3 )
   884         {
   888         {
   885           $search = '%' . escape_string_like($_GET['userinput']) . '%';
   889           $search = '%' . escape_string_like($_GET['userinput']) . '%';
   886           $q = $db->sql_query('SELECT urlname, namespace, name FROM ' . table_prefix . "users\n"
   890           $q = $db->sql_query('SELECT urlname, namespace, name FROM ' . table_prefix . "pages\n"
   887                             . "  WHERE (\n"
   891                             . "  WHERE (\n"
   888                             . "       " . ENANO_SQLFUNC_LOWERCASE . "(urlname) LIKE '$search'\n"
   892                             . "       " . ENANO_SQLFUNC_LOWERCASE . "(urlname) LIKE '$search'\n"
   889                             . "    OR " . ENANO_SQLFUNC_LOWERCASE . "(name)    LIKE '$search'\n"
   893                             . "    OR " . ENANO_SQLFUNC_LOWERCASE . "(name)    LIKE '$search'\n"
   890                             . "  ) AND user_id > 1");
   894                             . "  );");
   891           if ( !$q )
   895           if ( !$q )
   892             $db->die_json();
   896             $db->die_json();
   893           
   897           
   894           while ( $row = $db->fetchrow() )
   898           while ( $row = $db->fetchrow() )
   895           {
   899           {
   896             $pathskey = ( isset($paths->nslist[$row['namespace']]) ? $paths->nslist[$row['namespace']] : $row['namespace'] . substr($paths->nslist['Special'], -1) ) . $row['urlname'];
   900             $pathskey = ( isset($paths->nslist[$row['namespace']]) ? $paths->nslist[$row['namespace']] : $row['namespace'] . substr($paths->nslist['Special'], -1) ) . $row['urlname'];
   897             $key = array(
   901             $key = array(
   898               'page_id' => $pathskey,
   902               0 => $pathskey,
   899               'pid_highlight'  => highlight_term($_GET['userinput'], dirtify_page_id($pathskey), '<b>', '</b>'),
   903               'pid_highlight'  => highlight_term($_GET['userinput'], dirtify_page_id($pathskey), '<b>', '</b>'),
   900               'name_highlight' => highlight_term($_GET['userinput'], $row['name'], '<b>', '</b>')
   904               'name_highlight' => highlight_term($_GET['userinput'], $row['name'], '<b>', '</b>')
   901             );
   905             );
   902             $dataset[] = $key;
   906             $dataset[] = $key;
   903           }
   907           }