Fixed default sort style was set to ascending

This commit is contained in:
Marcin Kurczewski 2014-03-03 19:35:32 +01:00
parent 806aa0f197
commit b13c221a96
2 changed files with 4 additions and 4 deletions

View file

@ -59,7 +59,7 @@ abstract class AbstractSearchParser
{ {
$arr = preg_split('/[;,]/', $orderToken); $arr = preg_split('/[;,]/', $orderToken);
if (count($arr) == 1) if (count($arr) == 1)
$arr []= 'asc'; $arr []= 'desc';
if (count($arr) != 2) if (count($arr) != 2)
throw new SimpleException('Invalid search order token: ' . $orderToken); throw new SimpleException('Invalid search order token: ' . $orderToken);

View file

@ -226,15 +226,15 @@ class PostSearchParser extends AbstractSearchParser
elseif (in_array($orderByString, ['date'])) elseif (in_array($orderByString, ['date']))
$orderColumn = 'upload_date'; $orderColumn = 'upload_date';
elseif (in_array($orderByString, ['score']))
$orderColumn = 'score';
elseif (in_array($orderByString, ['comment', 'comments', 'commentcount', 'comment_count'])) elseif (in_array($orderByString, ['comment', 'comments', 'commentcount', 'comment_count']))
$orderColumn = 'comment_count'; $orderColumn = 'comment_count';
elseif (in_array($orderByString, ['fav', 'favs', 'favcount', 'fav_count'])) elseif (in_array($orderByString, ['fav', 'favs', 'favcount', 'fav_count']))
$orderColumn = 'fav_count'; $orderColumn = 'fav_count';
elseif (in_array($orderByString, ['score']))
$orderColumn = 'score';
elseif (in_array($orderByString, ['tag', 'tags', 'tagcount', 'tag_count'])) elseif (in_array($orderByString, ['tag', 'tags', 'tagcount', 'tag_count']))
$orderColumn = 'tag_count'; $orderColumn = 'tag_count';