Author: cyb
Date: Wed Apr 25 14:58:19 2007
New Revision: 367

URL: http://svn.gna.org/viewcvs/phplinker?rev=367&view=rev
Log:
#202: case insensitive search

Modified:
    trunk/www/admin/url_search.php

Modified: trunk/www/admin/url_search.php
URL: 
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/url_search.php?rev=367&r1=366&r2=367&view=diff
==============================================================================
--- trunk/www/admin/url_search.php (original)
+++ trunk/www/admin/url_search.php Wed Apr 25 14:58:19 2007
@@ -29,12 +29,11 @@
   $state ="";
   $_GET["state"]="";
  }
-if(isset($_GET["key"])){
-  $key = $_GET["key"];
- }else{
-  $key ="";
-  $_GET["key"]="";
- }
+
+if(isset($_GET["key"]))
+  $_GET['key']=strtolower($_GET['key']);
+else
+  $_GET['key']='';
 
 if(!isset($_GET["categorized"]))
   $_GET["categorized"]=0;
@@ -120,9 +119,6 @@
    if (isset($_GET['state']))
      $state = $_GET['state'];
 
-   if (isset($_GET['key']))
-     $key = $_GET['key'];
-
    if (isset($_GET['cat']))
      $cat = $_GET['cat'];
  if($state==""){
@@ -132,10 +128,10 @@
   }else{
      $state_request ="  AND state != \"moderated\"";
 }
- if($key ==""){
+ if($_GET['key'] ==""){
    $key_request = "";
  }else{
-   $key_request = " AND (url LIKE '%".$_GET['key']."%' OR `description` LIKE 
'%".$_GET['key']."%')";
+   $key_request = " AND (LOWER(url) LIKE '%".$_GET['key']."%' OR 
LOWER(`description`) LIKE '%".$_GET['key']."%')";
  }
   if($_GET['categorized']=="none"){
     $categorized_request = " AND 2=2";
@@ -220,8 +216,8 @@
             $category_name = "------";
           }
           if(isset($_GET['key'])){
-            $description1 = str_replace($_GET['key'], "<b><span 
style='font-size:12px;'>".$_GET['key']."</span></b>", $description1);
-            $url = str_replace($_GET['key'], "<b><span 
style='font-size:12px;'>".$_GET['key']."</span></b>", $url);
+            $description1 = str_ireplace($_GET['key'], "<b><span 
style='font-size:12px;'>".$_GET['key']."</span></b>", $description1);
+            $url = str_ireplace($_GET['key'], "<b><span 
style='font-size:12px;'>".$_GET['key']."</span></b>", $url);
           }
 
           $court = linker_cut_char($description1,"150");
@@ -296,7 +292,7 @@
    linker_tpl("selectBox" , $selectBox);
    linker_tpl("result_for_all" , $result_for_all);
    linker_tpl("state" , $state);
-   linker_tpl("key" , $key);
+   linker_tpl("key" , $_GET['key']);
    linker_tpl("categorized" , $_GET['categorized']);
    linker_tpl("cat" , $cat);
    linker_tpl("img_url" , $img_url);


_______________________________________________
PHPLinker-commits mailing list
[email protected]
https://mail.gna.org/listinfo/phplinker-commits

Reply via email to