diff options
-rw-r--r-- | admin/configuration.php | 36 | ||||
-rw-r--r-- | install/config.sql | 4 |
2 files changed, 24 insertions, 16 deletions
diff --git a/admin/configuration.php b/admin/configuration.php index 63bc29f3c..99c0b9666 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -112,21 +112,21 @@ $display_info_checkboxes = array( // image order management $sort_fields = array( '' => '', - 'file ASC' => l10n('File name, A → Z'), + 'file' => l10n('File name, A → Z'), 'file DESC' => l10n('File name, Z → A'), - 'name ASC' => l10n('Photo title, A → Z'), + 'name' => l10n('Photo title, A → Z'), 'name DESC' => l10n('Photo title, Z → A'), 'date_creation DESC' => l10n('Date created, new → old'), - 'date_creation ASC' => l10n('Date created, old → new'), + 'date_creation' => l10n('Date created, old → new'), 'date_available DESC' => l10n('Date posted, new → old'), - 'date_available ASC' => l10n('Date posted, old → new'), + 'date_available' => l10n('Date posted, old → new'), 'rating_score DESC' => l10n('Rating score, high → low'), - 'rating_score ASC' => l10n('Rating score, low → high'), + 'rating_score' => l10n('Rating score, low → high'), 'hit DESC' => l10n('Visits, high → low'), - 'hit ASC' => l10n('Visits, low → high'), - 'id ASC' => l10n('Numeric identifier, 1 → 9'), + 'hit' => l10n('Visits, low → high'), + 'id' => l10n('Numeric identifier, 1 → 9'), 'id DESC' => l10n('Numeric identifier, 9 → 1'), - 'rank ASC' => l10n('Manual sort order'), + 'rank' => l10n('Manual sort order'), ); $comments_order = array( @@ -162,7 +162,7 @@ if (isset($_POST['submit'])) $order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2)); // there is no rank outside categories - if ( ($i = array_search('rank ASC', $order_by)) !== false) + if ( ($i = array_search('rank', $order_by)) !== false) { unset($order_by[$i]); } @@ -170,11 +170,11 @@ if (isset($_POST['submit'])) // must define a default order_by if user want to order by rank only if ( count($order_by) == 0 ) { - $order_by = array('id ASC'); + $order_by = array('id'); } - $_POST['order_by'] = 'ORDER BY '.implode(', ', $order_by); - $_POST['order_by_inside_category'] = 'ORDER BY '.implode(', ', $order_by_inside_category); + $_POST['order_by'] = 'ORDER BY '.implode(',', $order_by); + $_POST['order_by_inside_category'] = 'ORDER BY '.implode(',', $order_by_inside_category); } } else @@ -334,10 +334,18 @@ switch ($page['section']) } else { - $out = array(); $order_by = trim($conf['order_by_inside_category']); $order_by = str_replace('ORDER BY ', null, $order_by); - $order_by = explode(', ', $order_by); + $order_by = explode(',', $order_by); + foreach($order_by as &$order) + { + $order = trim($order); + if (substr_compare($order, ' ASC', -4)==0) + { + $order = substr($order, 0, -4); + } + } + unset($order); } $template->assign( diff --git a/install/config.sql b/install/config.sql index eba9c60ff..ff045fc07 100644 --- a/install/config.sql +++ b/install/config.sql @@ -56,8 +56,8 @@ INSERT INTO piwigo_config (param,value,comment) ); INSERT INTO piwigo_config (param,value,comment) VALUES ('week_starts_on','monday','Monday may not be the first day of the week'); INSERT INTO piwigo_config (param,value,comment) VALUES ('updates_ignored','a:3:{s:7:"plugins";a:0:{}s:6:"themes";a:0:{}s:9:"languages";a:0:{}}','Extensions ignored for update'); -INSERT INTO piwigo_config (param,value,comment) VALUES ('order_by','ORDER BY date_available DESC, file ASC, id ASC','default photo order'); -INSERT INTO piwigo_config (param,value,comment) VALUES ('order_by_inside_category','ORDER BY date_available DESC, file ASC, id ASC','default photo order inside category'); +INSERT INTO piwigo_config (param,value,comment) VALUES ('order_by','ORDER BY date_available DESC,file,id','default photo order'); +INSERT INTO piwigo_config (param,value,comment) VALUES ('order_by_inside_category','ORDER BY date_available DESC,file,id','default photo order inside category'); INSERT INTO piwigo_config (param,value) VALUES ('original_resize','false'); INSERT INTO piwigo_config (param,value) VALUES ('original_resize_maxwidth','2016'); INSERT INTO piwigo_config (param,value) VALUES ('original_resize_maxheight','2016'); |