X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fsearch_engines.php;h=7f1684a3e756b0a2cd7ea3b4ba79970bb4486915;hb=7220b3ddd4a32b947e851c946cb6ad6146bebf7d;hp=19703e03fd81aa983aa710cc7af20242aa32b7a7;hpb=749367e12f9742d7fd5ee028230fefa627599125;p=quix0rs-gnu-social.git diff --git a/lib/search_engines.php b/lib/search_engines.php index 19703e03fd..7f1684a3e7 100644 --- a/lib/search_engines.php +++ b/lib/search_engines.php @@ -41,8 +41,35 @@ class SearchEngine function set_sort_mode($mode) { - if ('chron' === $mode) - return $this->target->orderBy('created desc'); + switch ($mode) { + case 'chron': + return $this->target->orderBy('created DESC'); + break; + case 'reverse_chron': + return $this->target->orderBy('created ASC'); + break; + case 'nickname_desc': + if ($this->table != 'profile') { + throw new Exception( + 'nickname_desc sort mode can only be use when searching profile.' + ); + } else { + return $this->target->orderBy('nickname DESC'); + } + break; + case 'nickname_asc': + if ($this->table != 'profile') { + throw new Exception( + 'nickname_desc sort mode can only be use when searching profile.' + ); + } else { + return $this->target->orderBy('nickname ASC'); + } + break; + default: + return $this->target->orderBy('created DESC'); + break; + } } }