2) { if($SQLWhere!='') { $SQLWhere.=" AND "; } if (substr($SearchVal,0,1)=='-') { $SQLWhere.="MATCH (".$Field.") AGAINST ('".db_string($SearchVal)."' IN BOOLEAN MODE)"; } else { $SQLWhere.="MATCH (".$Field.") AGAINST ('".db_string($SearchVal)."')"; } } else { if($SQLWhere!='') { $SQLWhere.=" AND "; } if (substr($SearchVal,0,1)=="-") { $SQLWhere.=$Field." NOT LIKE '%".db_string(substr($SearchVal,1))."%'"; } else { $SQLWhere.=$Field." LIKE '%".db_string($SearchVal)."%'"; } } $FilterString.="(".$SearchVal.")(.+?)"; } } } else { if($SQLWhere!='') { $SQLWhere.=" AND "; } $SQLWhere.=$Field." LIKE '".db_string($SearchStr)."'"; $FilterString.="(.+?)(".$SearchStr.")(.+?)"; } $Search = 1; $FilterString="/".$FilterString."/si"; if($SQLWhere!='' && $AddWhere) { $SQLWhere="WHERE ".$SQLWhere; } return $SQLWhere; } function quotes($Str) { $Str = str_replace(' ','{{SPACE}}',trim($Str[1])); return ' '.$Str.' '; } // The "order by x" links on columns headers function header_link($SortKey,$DefaultWay="DESC") { global $OrderBy,$OrderWay; if($SortKey==$OrderBy) { if($OrderWay=="DESC") { $NewWay="ASC"; } else { $NewWay="DESC"; } } else { $NewWay=$DefaultWay; } return "torrents.php?order_way=".$NewWay."&order_by=".$SortKey."&".Format::get_url(array('order_way','order_by')); } // Setting default search options if($_GET['setdefault']) { $UnsetList[]='/(&?page\=.+?&?)/i'; $UnsetList[]='/(&?setdefault\=.+?&?)/i'; $DB->query("SELECT SiteOptions FROM users_info WHERE UserID='".db_string($LoggedUser['ID'])."'"); list($SiteOptions)=$DB->next_record(MYSQLI_NUM, true); $SiteOptions=unserialize($SiteOptions); $SiteOptions['DefaultSearch']=preg_replace($UnsetList,'',$_SERVER['QUERY_STRING']); $DB->query("UPDATE users_info SET SiteOptions='".db_string(serialize($SiteOptions))."' WHERE UserID='".db_string($LoggedUser['ID'])."'"); $Cache->begin_transaction('user_info_heavy_'.$UserID); $Cache->update_row(false, array('DefaultSearch'=>preg_replace($UnsetList,'',$_SERVER['QUERY_STRING']))); $Cache->commit_transaction(0); // Clearing default search options } elseif($_GET['cleardefault']) { $DB->query("SELECT SiteOptions FROM users_info WHERE UserID='".db_string($LoggedUser['ID'])."'"); list($SiteOptions)=$DB->next_record(MYSQLI_NUM, true); $SiteOptions=unserialize($SiteOptions); $SiteOptions['DefaultSearch']=''; $DB->query("UPDATE users_info SET SiteOptions='".db_string(serialize($SiteOptions))."' WHERE UserID='".db_string($LoggedUser['ID'])."'"); $Cache->begin_transaction('user_info_heavy_'.$UserID); $Cache->update_row(false, array('DefaultSearch'=>'')); $Cache->commit_transaction(0); // Use default search options } elseif(!$_SERVER['QUERY_STRING'] && $LoggedUser['DefaultSearch']) { parse_str($LoggedUser['DefaultSearch'],$_GET); } // If a user is hammering the search page (either via a