Ignore:
Timestamp:
Mar 19, 2010, 6:24:35 PM (14 years ago)
Author:
maron
Message:

Oprava zobrazování chyby u vyhledávání jmen ve formuláři překládání pokud je hledáno jediné slovo s menším počtem písmen než 5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/global_function.php

    r393 r399  
    496496    if ($mode == 2) $where .= ' AND NOT EXISTS(SELECT 1 FROM `'.$Table.'` AS `Sub` WHERE (`Sub`.`Language` <> 0) AND (`Sub`.`Entry` = `O`.`Entry`))';
    497497    $where .= ' AND (';
    498  
    499     for($i = 0; $i < count($ArrStr); $i++)
    500     {
    501       if (strpos($ArrStr[$i],"'s") > 0)
     498   
     499    $SqlOK = false;
     500    if (count($ArrStr) > 0) {
     501      for($i = 0; $i < count($ArrStr); $i++)
     502      {
     503        if (strpos($ArrStr[$i],"'s") > 0)
    502504                   $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-2);
    503       if (strpos($ArrStr[$i],',') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
    504       if (strpos($ArrStr[$i],'.') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
    505       if (strpos($ArrStr[$i],'!') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
    506       if (strpos($ArrStr[$i],'?') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
    507 
    508       if (strlen($ArrStr[$i]) > 5)
    509         $where .= '(`O`.`'.$Column.'` LIKE "%'.addslashes($ArrStr[$i]).'%") OR ';
    510     }
    511     $where = substr($where,0,strlen($where)-4);
    512     $where .= ')';
    513 
    514     $ID = $Database->SQLCommand($sql.$where.$groupby);
    515     //echo ($sql.$where.$groupby);
    516     while($Line = mysql_fetch_assoc($ID))
    517     {
    518    //   if (($mode != 0) or (($mode == 0) and (strpos(strtolower($Text), strtolower($Line[2])) > 0) ) )
    519           $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
     505        if (strpos($ArrStr[$i],',') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
     506        if (strpos($ArrStr[$i],'.') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
     507        if (strpos($ArrStr[$i],'!') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
     508        if (strpos($ArrStr[$i],'?') > 0) $ArrStr[$i] = substr($ArrStr[$i],0,strlen($ArrStr[$i])-1);
     509
     510        if (strlen($ArrStr[$i]) > 4) {
     511          $where .= '(`O`.`'.$Column.'` LIKE "%'.addslashes($ArrStr[$i]).'%") OR ';
     512          $SqlOK = true;
     513            }
     514      }
     515      $where = substr($where,0,strlen($where)-4);
     516      $where .= ')';
     517      if ($SqlOK) {
     518        $ID = $Database->SQLCommand($sql.$where.$groupby);
     519    //  echo ($sql.'|'.$where.'|'.$groupby);
     520        while($Line = mysql_fetch_assoc($ID)) {
     521              $buff[] = array($Line['ID'],GetIDbyName($Table),$Line[$Column],$Line['Tran']);
     522        }
     523          }
    520524    }
    521525  }
Note: See TracChangeset for help on using the changeset viewer.