From: Banana Date: Sun, 31 Jan 2021 20:27:44 +0000 (+0100) Subject: adding sort X-Git-Tag: 1.1~16 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=a4455d2ee07be94e8399e9c9c8aa54439dcbd7cd;p=bibliotheca-php.git adding sort --- diff --git a/CHANGELOG b/CHANGELOG index 7b38ab0..98d1d28 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,8 +3,10 @@ * Missing changelog file * api has its own log file now. * User profile for editing own settings. - * Collection management has the option to update entry rights with the collection ones. - * Entry rights can now be managed. More info about user and rights can be found in documentation. + * Collection management has the option to update entry rights with the + collection ones. + * Entry rights can now be managed. More info about user and rights can + be found in documentation. * User management: Honor rights from current logged in user * Group management now available. But no relation check yet. * User management: Additional groups @@ -14,8 +16,11 @@ * Documentation for tools * Documentation for tool imdbweb grabber. Default config added. * Fixed bug #3 - * Added feature #2. There is now a new definition which defines the default targets of the imdb grabber values. - See the config-imdbweb.php.default for more details + * Added feature #2. There is now a new definition which defines the default + targets of the imdb grabber values. See the config-imdbweb.php.default + for more details + * Added sort filter. Collection has a default sort field config now. + Sort fields are the simple fields. See fields documentation. 1.0 - Castle 20210106 * First usable version diff --git a/TODO b/TODO index ec8b20d..517e11c 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -* sort by filter for collection display * Mass edit of entries * User and groupmanagement: Check where a user or group is used! * Better error handling and display while adding / update and delete diff --git a/documentation/fields.txt b/documentation/fields.txt index 3302111..d3279a0 100644 --- a/documentation/fields.txt +++ b/documentation/fields.txt @@ -9,7 +9,7 @@ Each collection can have there own set of fields. But at least the title field s Fields can be managed after a collection has been created. -# If you want to create new ones here is a explanation how they work +# If you want to create new ones here is an explanation how they work A field is defined in the sys_fields table. It needs a _saveField and optinal _loadFieldValue method in manageentry.class and the _loadFieldValue also in mancubus.class HTML definitions are needed in view/UI_THEME/entry and view/UI_THEME/manageentry @@ -32,6 +32,7 @@ A _saveField_TYPE method in manageentry.class for data saving. Modification on advancedsearch.php if search needs some special treatment for this field searchtype +Every field with entry* is a simple search field and can be used in global search. - tag = releation to lookup2entry table - entryText = text col in entry table - entrySingleText = entry col in entry table. Single value diff --git a/upgrade/from-version-1.0.txt b/upgrade/from-version-1.0.txt index 22b14f5..86c6e13 100644 --- a/upgrade/from-version-1.0.txt +++ b/upgrade/from-version-1.0.txt @@ -9,6 +9,11 @@ The definition of USER_DEFAULT_RIGHTS_STRING can be removed from config file. Copy config/config-imdbweb.php.default to config/config-imdbweb.php See too-imdbweb.txt documentation for more information. +# following files can be removed +view/default/system/pagination.html +view/default/system/pagination_after.php +view/default/system/pagination_before.php + # DB changes. Run each line against your bibliotheca DB. # Replace #REPLACEME# with your table prefix. Default is bib UPDATE `#REPLACEME#_menu` SET `rights` = 'rw-rw----' WHERE `#REPLACEME#_menu`.`id` = 10; @@ -18,3 +23,4 @@ DELETE FROM `#REPLACEME#_menu` WHERE `#REPLACEME#_menu`.`id` = 13; INSERT INTO `#REPLACEME#_menu` (`id`, `text`, `action`, `icon`, `owner`, `group`, `rights`, `position`, `category`) VALUES (NULL, 'Groups', 'managegroups', 'users', '1', '1', 'rw-------', '5', 'manage'); UPDATE `#REPLACEME#_menu` SET `position` = '6' WHERE `#REPLACEME#_menu`.`id` = 16; UPDATE `#REPLACEME#_menu` SET `group` = '2', `rights` = 'rw-rw----' WHERE `#REPLACEME#_menu`.`id` = 14; +ALTER TABLE `#REPLACEME#_collection` ADD `defaultSortField` VARCHAR(16) NOT NULL AFTER `defaultSearchField`; diff --git a/webclient/index.php b/webclient/index.php index acfe2f6..beae986 100644 --- a/webclient/index.php +++ b/webclient/index.php @@ -68,8 +68,6 @@ $ViewScript = Summoner::themefile('dashboard/dashboard.php', UI_THEME); $ViewMessage = Summoner::themefile('system/message.php',UI_THEME); # the menu $ViewMenu = Summoner::themefile('system/menu.php',UI_THEME); -# the pagination -$ViewPagination = Summoner::themefile('system/pagination.html',UI_THEME); ## DB connection $DB = new mysqli(DB_HOST, DB_USERNAME,DB_PASSWORD, DB_NAME); diff --git a/webclient/lib/managecollectionfields.class.php b/webclient/lib/managecollectionfields.class.php index 640078c..510a419 100644 --- a/webclient/lib/managecollectionfields.class.php +++ b/webclient/lib/managecollectionfields.class.php @@ -255,8 +255,10 @@ class ManageCollectionFields { return $this->_cacheExistingSysFields; } + $this->_cacheExistingSysFields = array(); + $queryStr = "SELECT `cf`.`fk_field_id` AS id, `sf`.`type`, `sf`.`displayname`, `sf`.`identifier`, - `sf`.`createstring` + `sf`.`createstring`, `sf`.`searchtype` FROM `".DB_PREFIX."_collection_fields_".$this->_collectionId."` AS cf LEFT JOIN `".DB_PREFIX."_sys_fields` AS sf ON `cf`.`fk_field_id` = `sf`.`id`"; if($sortAZ === true) { @@ -281,6 +283,28 @@ class ManageCollectionFields { return $this->_cacheExistingSysFields; } + /** + * return the simple search fields for loaded collection + * Every field witch has a column in the entry table is a simple search field. + * Name starts with entry + * + * @return array + */ + public function getSimpleSearchFields(): array { + $ret = array(); + + $fields = $this->getExistingFields(); + if(!empty($fields)) { + foreach($fields as $k=>$v) { + if(isset($v['searchtype']) && strpos($v['searchtype'],'entry') !== false) { + $ret[$k] = $v; + } + } + } + + return $ret; + } + /** * Get the column names from current collection entry table * diff --git a/webclient/lib/managecollections.class.php b/webclient/lib/managecollections.class.php index 11d737f..69e0267 100644 --- a/webclient/lib/managecollections.class.php +++ b/webclient/lib/managecollections.class.php @@ -197,7 +197,7 @@ class ManageCollections { * @param array $data * @return bool */ - public function createCollection($data) { + public function createCollection(array $data): bool { $ret = false; if(!empty($data['name']) === true @@ -213,7 +213,8 @@ class ManageCollections { `owner` = '".$this->_DB->real_escape_string($data['owner'])."', `group` = '".$this->_DB->real_escape_string($data['group'])."', `rights` = '".$this->_DB->real_escape_string($data['rights'])."', - `defaultSearchField` = '".$this->_DB->real_escape_string($data['defaultSearchField'])."'"; + `defaultSearchField` = '".$this->_DB->real_escape_string($data['defaultSearchField'])."', + `defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."'"; if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true)); $this->_DB->query($queryStr); $newId = $this->_DB->insert_id; @@ -274,12 +275,13 @@ class ManageCollections { * @param string $id Number * @return array */ - public function getEditData($id) { + public function getEditData(string $id): array { $ret = array(); if (Summoner::validate($id, 'digit')) { $queryStr = "SELECT `c`.`id`, `c`.`name`, `c`.`description`, `c`.`created`, `c`.`owner`, `c`.`group`, `c`.`rights`, `c`.`defaultSearchField`, + `c`.`defaultSortField`, `u`.`name` AS username, `g`.`name` AS groupname FROM `".DB_PREFIX."_collection` AS c LEFT JOIN `".DB_PREFIX."_user` AS u ON `c`.`owner` = `u`.`id` @@ -310,7 +312,7 @@ class ManageCollections { * @param array $data * @return bool */ - public function updateCollection($data) { + public function updateCollection(array $data): bool { $ret = false; if(DEBUG) error_log("[DEBUG] ".__METHOD__." data: ".var_export($data,true)); @@ -325,7 +327,8 @@ class ManageCollections { `owner` = '".$this->_DB->real_escape_string($data['owner'])."', `group` = '".$this->_DB->real_escape_string($data['group'])."', `rights` = '".$this->_DB->real_escape_string($data['rights'])."', - `defaultSearchField` = '".$this->_DB->real_escape_string($data['defaultSearchField'])."' + `defaultSearchField` = '".$this->_DB->real_escape_string($data['defaultSearchField'])."', + `defaultSortField` = '".$this->_DB->real_escape_string($data['defaultSortField'])."' WHERE `id` = '".$this->_DB->real_escape_string($data['id'])."'"; if(QUERY_DEBUG) error_log("[QUERY] ".__METHOD__." query: ".var_export($queryStr,true)); try { diff --git a/webclient/lib/mancubus.class.php b/webclient/lib/mancubus.class.php index 696779b..db754df 100644 --- a/webclient/lib/mancubus.class.php +++ b/webclient/lib/mancubus.class.php @@ -241,13 +241,13 @@ class Mancubus { if(!$_isFulltext) { // fulltext do not order. Which results in ordering be relevance of the match $queryOrder = " ORDER BY"; if (!empty($this->_queryOptions['sort'])) { - $queryOrder .= ' t.' . $this->_queryOptions['sort']; + $queryOrder .= ' t.'.$this->_queryOptions['sort']; } else { $queryOrder .= " t.created"; } if (!empty($this->_queryOptions['sortDirection'])) { - $queryOrder .= ' ' . $this->_queryOptions['sortDirection']; + $queryOrder .= ' '.$this->_queryOptions['sortDirection']; } else { $queryOrder .= " DESC"; diff --git a/webclient/lib/summoner.class.php b/webclient/lib/summoner.class.php index 5a285d0..70b8489 100644 --- a/webclient/lib/summoner.class.php +++ b/webclient/lib/summoner.class.php @@ -2,7 +2,7 @@ /** * Bibliotheca * - * Copyright 2018-2020 Johannes Keßler + * Copyright 2018-2021 Johannes Keßler * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -659,7 +659,7 @@ class Summoner { * @param array $modify * @return string */ - static function createFromParameterLinkQuery($array,$modify=array()) { + static function createFromParameterLinkQuery(array $array, $modify=array()): string { $ret = ''; if(!empty($modify)) { diff --git a/webclient/lib/trite.class.php b/webclient/lib/trite.class.php index b323a36..3d1c988 100644 --- a/webclient/lib/trite.class.php +++ b/webclient/lib/trite.class.php @@ -2,7 +2,7 @@ /** * Bibliotheca * - * Copyright 2018-2020 Johannes Keßler + * Copyright 2018-2021 Johannes Keßler * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,6 +63,13 @@ class Trite { */ private $_queryOptions; + /** + * Cache for already loaded collection fields + * + * @var array + */ + private $_cacheExistingCollectionFields = array(); + /** * Trite constructor. * @@ -100,17 +107,18 @@ class Trite { * Get information to display for current collection * based on current user and given rights * - * @param int $id The collection ID to load + * @param string $id The collection ID to load * @param string $right The rights mode. read, write or delete * @return array */ - public function load($id,$right="read") { + public function load(string $id,$right="read"): array { $this->_collectionData = array(); if(!empty($id) && Summoner::validate($id, 'digit')) { $queryStr = "SELECT `c`.`id`, `c`.`name`, `c`.`description`, `c`.`created`, `c`.`owner`, `c`.`group`, `c`.`rights`, `c`.`defaultSearchField`, + `c`.`defaultSortField`, `u`.`name` AS username, `g`.`name` AS groupname FROM `".DB_PREFIX."_collection` AS c LEFT JOIN `".DB_PREFIX."_user` AS u ON `c`.`owner` = `u`.`id` @@ -189,8 +197,11 @@ class Trite { * * @return array */ - public function getCollectionFields() { - $ret = array(); + public function getCollectionFields(): array { + if(!empty($this->_cacheExistingCollectionFields)) { + return $this->_cacheExistingCollectionFields; + } + $this->_cacheExistingCollectionFields = array(); $queryStr = "SELECT `cf`.`fk_field_id` AS id, `sf`.`type`, `sf`.`displayname`, `sf`.`identifier`, `sf`.`searchtype` @@ -202,13 +213,35 @@ class Trite { try { if($query !== false && $query->num_rows > 0) { while(($result = $query->fetch_assoc()) != false) { - $ret[$result['identifier']] = $result; + $this->_cacheExistingCollectionFields[$result['identifier']] = $result; } } } catch (Exception $e) { error_log("[ERROR] ".__METHOD__." mysql catch: ".$e->getMessage()); } + return $this->_cacheExistingCollectionFields; + } + + /** + * return the simple search fields for loaded collection + * Every field witch has a column in the entry table is a simple search field. + * Name starts with entry + * + * @return array + */ + public function getSimpleSearchFields(): array { + $ret = array(); + + $fields = $this->getCollectionFields(); + if(!empty($fields)) { + foreach($fields as $k=>$v) { + if(isset($v['searchtype']) && strpos($v['searchtype'],'entry') !== false) { + $ret[$k] = $v; + } + } + } + return $ret; } diff --git a/webclient/view/default/collections/collections.html b/webclient/view/default/collections/collections.html index 23a16bc..1f4d5a6 100644 --- a/webclient/view/default/collections/collections.html +++ b/webclient/view/default/collections/collections.html @@ -1,3 +1,72 @@ + 1) { ?> +
+
+
    + 1) { + echo '
  • +
  • '; + } + + $ellipsisShown = 0; + for($i=1;$i<=$TemplateData['pagination']['pages'];$i++) { + $active = ''; + if($i == $TemplateData['pagination']['curPage']) $active = 'uk-active'; + + if(in_array($i,$TemplateData['pagination']['visibleRange'])) { + echo '
  • '.$i.'
  • '; + } + else { + if($i < $TemplateData['pagination']['currentRangeStart'] && $ellipsisShown == 0) { + echo '
  • '; + $ellipsisShown = 1; + } + if($i > $TemplateData['pagination']['currentRangeEnd'] && ($ellipsisShown == 0 || $ellipsisShown == 1)) { + echo '
  • '; + $ellipsisShown = 2; + } + } + } + + if($TemplateData['pagination']['curPage'] < $TemplateData['pagination']['pages']) { + echo '
  • +
  • '; + } + ?> +
+
+
+
+ +
+ +
+
+
+
+ +

diff --git a/webclient/view/default/collections/collections.php b/webclient/view/default/collections/collections.php index 3253069..2b2082a 100644 --- a/webclient/view/default/collections/collections.php +++ b/webclient/view/default/collections/collections.php @@ -2,7 +2,7 @@ /** * Bibliotheca * - * Copyright 2018-2020 Johannes Keßler + * Copyright 2018-2021 Johannes Keßler * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,34 @@ if(isset($_POST['navSearch'])) { $_search = Summoner::validate($_search) ? $_search : false; } -require_once(Summoner::themefile('system/pagination_before.php',UI_THEME)); +## pagination +$TemplateData['pagination'] = array('pages' => 0); + +$_curPage = 1; +if(isset($_GET['page']) && !empty($_GET['page'])) { + $_curPage = trim($_GET['page']); + $_curPage = Summoner::validate($_curPage,'digit') ? $_curPage : 1; +} + +$_sort = false; +if(isset($_GET['s']) && !empty($_GET['s'])) { + $_sort = trim($_GET['s']); + $_sort = Summoner::validate($_sort,'nospace') ? $_sort : false; +} + +$_sortDirection = false; +if(isset($_GET['sd']) && !empty($_GET['sd'])) { + $_sortDirection = trim($_GET['sd']); + $_sortDirection = Summoner::validate($_sortDirection,'nospace') ? $_sortDirection : false; +} + +$_queryOptions = array( + 'limit' => RESULTS_PER_PAGE, + 'offset' => (RESULTS_PER_PAGE * ($_curPage-1)), + 'sort' => $_sort, + 'sortDirection' => $_sortDirection +); +## pagination end $TemplateData['pageTitle'] = "Collection overview"; $TemplateData['loadedCollection'] = array(); @@ -63,7 +90,17 @@ if(!empty($_collection)) { $TemplateData['loadedCollection'] = $Trite->load($_collection); if(!empty($TemplateData['loadedCollection'])) { $Mancubus->setCollection($Trite->param('id')); - $Mancubus->setQueryOptions($_queryOptions); // this comes from pagination_before! + + $TemplateData['defaultSortField'] = $defaultSortField = $Trite->param('defaultSortField'); + $TemplateData['simpleSearchFields'] = $Trite->getSimpleSearchFields(); + if(!empty($TemplateData['defaultSortField'])) { + unset($TemplateData['simpleSearchFields'][$TemplateData['defaultSortField']]); + if(empty($_queryOptions['sort'])) { + $_queryOptions['sort'] = $TemplateData['defaultSortField']; + } + } + $Mancubus->setQueryOptions($_queryOptions); + $TemplateData['storagePath'] = PATH_WEB_STORAGE . '/' . $Trite->param('id'); $TemplateData['entryLinkPrefix'] = "index.php?p=entry&collection=".$Trite->param('id'); $TemplateData['searchAction'] = 'index.php?p=collections&collection='.$Trite->param('id'); @@ -107,4 +144,32 @@ else { $TemplateData['collections'] = $Trite->getCollections(); } -require_once(Summoner::themefile('system/pagination_after.php',UI_THEME)); +# pagination +if(!empty($TemplateData['entries']['amount'])) { + $TemplateData['pagination']['pages'] = ceil($TemplateData['entries']['amount'] / RESULTS_PER_PAGE); + $TemplateData['pagination']['curPage'] = $_curPage; + + $TemplateData['pagination']['currentGetParameters']['page'] = $_curPage; + $TemplateData['pagination']['currentGetParameters']['s'] = $_sort; + $TemplateData['pagination']['currentGetParameters']['sd'] = $_sortDirection; +} + +if($TemplateData['pagination']['pages'] > 11) { + # first pages + $TemplateData['pagination']['visibleRange'] = range(1,3); + # last pages + foreach(range($TemplateData['pagination']['pages']-2, $TemplateData['pagination']['pages']) as $e) { + array_push($TemplateData['pagination']['visibleRange'], $e); + } + # pages before and after current page + $cRange = range($TemplateData['pagination']['curPage']-1, $TemplateData['pagination']['curPage']+1); + foreach($cRange as $e) { + array_push($TemplateData['pagination']['visibleRange'], $e); + } + $TemplateData['pagination']['currentRangeStart'] = array_shift($cRange); + $TemplateData['pagination']['currentRangeEnd'] = array_pop($cRange); +} +else { + $TemplateData['pagination']['visibleRange'] = range(1,$TemplateData['pagination']['pages']); +} +# pagination end diff --git a/webclient/view/default/main.php b/webclient/view/default/main.php index 203f0d4..7ecfb9b 100644 --- a/webclient/view/default/main.php +++ b/webclient/view/default/main.php @@ -20,7 +20,6 @@
-
diff --git a/webclient/view/default/managecolletions/managecolletions.html b/webclient/view/default/managecolletions/managecolletions.html index 197095e..a0eeee1 100644 --- a/webclient/view/default/managecolletions/managecolletions.html +++ b/webclient/view/default/managecolletions/managecolletions.html @@ -24,7 +24,7 @@
+ + $v) { ?> + + + +
+
diff --git a/webclient/view/default/managecolletions/managecolletions.php b/webclient/view/default/managecolletions/managecolletions.php index 2111163..d9c1344 100644 --- a/webclient/view/default/managecolletions/managecolletions.php +++ b/webclient/view/default/managecolletions/managecolletions.php @@ -2,7 +2,7 @@ /** * Bibliotheca * - * Copyright 2018-2020 Johannes Keßler + * Copyright 2018-2021 Johannes Keßler * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ $TemplateData['editData']['rights'] = Summoner::prepareRightsArray('rwxr--r--'); // tool needs to be preset $TemplateData['editData']['tool'] = array(); $TemplateData['existingFields'] = array(); +$TemplateData['simpleSearchFields'] = array(); $TemplateData['pageTitle'] = 'Manage collection'; @@ -51,6 +52,7 @@ if($_editMode === true && !empty($_id)) { $TemplateData['editData'] = $ManangeCollections->getEditData($_id); $ManangeCollectionFields->setCollection($_id); $TemplateData['existingFields'] = $ManangeCollectionFields->getExistingFields(); + $TemplateData['simpleSearchFields'] = $ManangeCollectionFields->getSimpleSearchFields(); if(!isset($TemplateData['editData']['name'])) { $TemplateData['refresh'] = 'index.php?p=managecolletions'; } @@ -66,6 +68,7 @@ if(isset($_POST['submitForm'])) { $_saveData['group'] = trim($fdata['group']); $_saveData['rights'] = Summoner::prepareRightsString($fdata['rights']); $_saveData['defaultSearchField'] = trim($fdata['defaultSearchField']); + $_saveData['defaultSortField'] = trim($fdata['defaultSortField']); $_saveData['id'] = $_id; $_saveData['tool'] = array(); diff --git a/webclient/view/default/system/pagination.html b/webclient/view/default/system/pagination.html deleted file mode 100644 index 08f49ba..0000000 --- a/webclient/view/default/system/pagination.html +++ /dev/null @@ -1,36 +0,0 @@ - 1) { ?> -
    - 1) { - echo '
  • -
  • '; - } - - $ellipsisShown = 0; - for($i=1;$i<=$TemplateData['pagination']['pages'];$i++) { - $active = ''; - if($i == $TemplateData['pagination']['curPage']) $active = 'uk-active'; - - if(in_array($i,$TemplateData['pagination']['visibleRange'])) { - echo '
  • '.$i.'
  • '; - } - else { - if($i < $TemplateData['pagination']['currentRangeStart'] && $ellipsisShown == 0) { - echo '
  • '; - $ellipsisShown = 1; - } - if($i > $TemplateData['pagination']['currentRangeEnd'] && ($ellipsisShown == 0 || $ellipsisShown == 1)) { - echo '
  • '; - $ellipsisShown = 2; - } - } - } - - if($TemplateData['pagination']['curPage'] < $TemplateData['pagination']['pages']) { - echo '
  • -
  • '; - } - ?> -
- diff --git a/webclient/view/default/system/pagination_after.php b/webclient/view/default/system/pagination_after.php deleted file mode 100644 index fd5b0bf..0000000 --- a/webclient/view/default/system/pagination_after.php +++ /dev/null @@ -1,54 +0,0 @@ - 11) { - # first pages - $TemplateData['pagination']['visibleRange'] = range(1,3); - # last pages - foreach(range($TemplateData['pagination']['pages']-2, $TemplateData['pagination']['pages']) as $e) { - array_push($TemplateData['pagination']['visibleRange'], $e); - } - # pages before and after current page - $cRange = range($TemplateData['pagination']['curPage']-1, $TemplateData['pagination']['curPage']+1); - foreach($cRange as $e) { - array_push($TemplateData['pagination']['visibleRange'], $e); - } - $TemplateData['pagination']['currentRangeStart'] = array_shift($cRange); - $TemplateData['pagination']['currentRangeEnd'] = array_pop($cRange); -} -else { - $TemplateData['pagination']['visibleRange'] = range(1,$TemplateData['pagination']['pages']); -} diff --git a/webclient/view/default/system/pagination_before.php b/webclient/view/default/system/pagination_before.php deleted file mode 100644 index 27cdc3c..0000000 --- a/webclient/view/default/system/pagination_before.php +++ /dev/null @@ -1,51 +0,0 @@ - 0); - -$_curPage = 1; -if(isset($_GET['page']) && !empty($_GET['page'])) { - $_curPage = trim($_GET['page']); - $_curPage = Summoner::validate($_curPage,'digit') ? $_curPage : 1; -} -$_sort = false; -if(isset($_GET['s']) && !empty($_GET['s'])) { - $_sort = trim($_GET['s']); - $_sort = Summoner::validate($_sort,'nospace') ? $_sort : false; -} - -$_sortDirection = false; -if(isset($_GET['sd']) && !empty($_GET['sd'])) { - $_sortDirection = trim($_GET['sd']); - $_sortDirection = Summoner::validate($_sortDirection,'nospace') ? $_sortDirection : false; -} - -$_queryOptions = array( - 'limit' => RESULTS_PER_PAGE, - 'offset' => (RESULTS_PER_PAGE * ($_curPage-1)), - 'orderby' => $_sort, - 'sortDirection' => $_sortDirection -);