File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public function __construct($parent) {
1616 }
1717
1818 public static function getSearchPhrase () {
19- return Request::getRequest ()->getParam ('search ' );
19+ return trim ( Request::getRequest ()->getParam ('search ' ) );
2020 }
2121
2222 public static function getFilters () {
Original file line number Diff line number Diff line change @@ -85,8 +85,11 @@ public function getSearchClause($s) {
8585 if (!\TgUtils \Utils::isEmpty ($ s )) {
8686 $ where = '' ;
8787 foreach (explode (' ' , $ s ) AS $ part ) {
88- $ value = $ this ->database ->escape (strtolower ($ part ));
89- $ where .= ' OR (LOWER(`name`) LIKE \'% ' .$ value .'% \') OR (LOWER(`email`) LIKE \'% ' .$ value .'% \') ' ;
88+ $ value = trim ($ part );
89+ if (strlen ($ value ) > 0 ) {
90+ $ value = $ this ->database ->escape (strtolower ($ value ));
91+ $ where .= ' OR (LOWER(`name`) LIKE \'% ' .$ value .'% \') OR (LOWER(`email`) LIKE \'% ' .$ value .'% \') ' ;
92+ }
9093 }
9194 $ rc [] = substr ($ where , 4 );
9295 }
You can’t perform that action at this time.
0 commit comments