don't autocomplete searches with ==0 or >32 characters
This commit is contained in:
parent
c2834aad96
commit
629f155187
@ -13,11 +13,13 @@ class AutoComplete extends Extension {
|
|||||||
|
|
||||||
if($event->page_matches("api/internal/autocomplete")) {
|
if($event->page_matches("api/internal/autocomplete")) {
|
||||||
if(!isset($_GET["s"])) return;
|
if(!isset($_GET["s"])) return;
|
||||||
|
$s = strtolower($_GET["s"]);
|
||||||
|
if(strlen($s) == 0 || strlen($s) > 32) return;
|
||||||
|
|
||||||
//$limit = 0;
|
//$limit = 0;
|
||||||
$cache_key = "autocomplete-" . strtolower($_GET["s"]);
|
$cache_key = "autocomplete-$s";
|
||||||
$limitSQL = "";
|
$limitSQL = "";
|
||||||
$SQLarr = array("search"=>$_GET["s"]."%");
|
$SQLarr = array("search"=>"$s%");
|
||||||
if(isset($_GET["limit"]) && $_GET["limit"] !== 0){
|
if(isset($_GET["limit"]) && $_GET["limit"] !== 0){
|
||||||
$limitSQL = "LIMIT :limit";
|
$limitSQL = "LIMIT :limit";
|
||||||
$SQLarr['limit'] = $_GET["limit"];
|
$SQLarr['limit'] = $_GET["limit"];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user