diff options
author | mistic100 <mistic@piwigo.org> | 2013-07-06 18:31:14 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2013-07-06 18:31:14 +0000 |
commit | 29e2ed6b91fd619a4007d11c4889827362a63cf5 (patch) | |
tree | aa8ae31bada058cecb9533230c7c4ecc41b0e114 /admin | |
parent | 754af8dddef9a8baa7dcff1295cc9cc75b959101 (diff) |
bug 2931: revert r23675 & r23721, make element_set_ranks.php uses ASC keyword (+ migration task)
git-svn-id: http://piwigo.org/svn/trunk@23813 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin')
-rw-r--r-- | admin/configuration.php | 36 | ||||
-rw-r--r-- | admin/element_set_ranks.php | 18 |
2 files changed, 23 insertions, 31 deletions
diff --git a/admin/configuration.php b/admin/configuration.php index 99c0b9666..63bc29f3c 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -112,21 +112,21 @@ $display_info_checkboxes = array( // image order management $sort_fields = array( '' => '', - 'file' => l10n('File name, A → Z'), + 'file ASC' => l10n('File name, A → Z'), 'file DESC' => l10n('File name, Z → A'), - 'name' => l10n('Photo title, A → Z'), + 'name ASC' => l10n('Photo title, A → Z'), 'name DESC' => l10n('Photo title, Z → A'), 'date_creation DESC' => l10n('Date created, new → old'), - 'date_creation' => l10n('Date created, old → new'), + 'date_creation ASC' => l10n('Date created, old → new'), 'date_available DESC' => l10n('Date posted, new → old'), - 'date_available' => l10n('Date posted, old → new'), + 'date_available ASC' => l10n('Date posted, old → new'), 'rating_score DESC' => l10n('Rating score, high → low'), - 'rating_score' => l10n('Rating score, low → high'), + 'rating_score ASC' => l10n('Rating score, low → high'), 'hit DESC' => l10n('Visits, high → low'), - 'hit' => l10n('Visits, low → high'), - 'id' => l10n('Numeric identifier, 1 → 9'), + 'hit ASC' => l10n('Visits, low → high'), + 'id ASC' => l10n('Numeric identifier, 1 → 9'), 'id DESC' => l10n('Numeric identifier, 9 → 1'), - 'rank' => l10n('Manual sort order'), + 'rank ASC' => 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', $order_by)) !== false) + if ( ($i = array_search('rank ASC', $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'); + $order_by = array('id ASC'); } - $_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,18 +334,10 @@ 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); - foreach($order_by as &$order) - { - $order = trim($order); - if (substr_compare($order, ' ASC', -4)==0) - { - $order = substr($order, 0, -4); - } - } - unset($order); + $order_by = explode(', ', $order_by); } $template->assign( diff --git a/admin/element_set_ranks.php b/admin/element_set_ranks.php index d9a917136..98f22a8cd 100644 --- a/admin/element_set_ranks.php +++ b/admin/element_set_ranks.php @@ -124,7 +124,7 @@ if (isset($_POST['submit'])) } elseif ($image_order_choice=='rank') { - $image_order = 'rank'; + $image_order = 'rank ASC'; } $query = ' UPDATE '.CATEGORIES_TABLE.' @@ -237,21 +237,21 @@ if (pwg_db_num_rows($result) > 0) // image order management $sort_fields = array( '' => '', - 'file' => l10n('File name, A → Z'), + 'file ASC' => l10n('File name, A → Z'), 'file DESC' => l10n('File name, Z → A'), - 'name' => l10n('Photo title, A → Z'), + 'name ASC' => l10n('Photo title, A → Z'), 'name DESC' => l10n('Photo title, Z → A'), 'date_creation DESC' => l10n('Date created, new → old'), - 'date_creation' => l10n('Date created, old → new'), + 'date_creation ASC' => l10n('Date created, old → new'), 'date_available DESC' => l10n('Date posted, new → old'), - 'date_available' => l10n('Date posted, old → new'), + 'date_available ASC' => l10n('Date posted, old → new'), 'rating_score DESC' => l10n('Rating score, high → low'), - 'rating_score' => l10n('Rating score, low → high'), + 'rating_score ASC' => l10n('Rating score, low → high'), 'hit DESC' => l10n('Visits, high → low'), - 'hit' => l10n('Visits, low → high'), - 'id' => l10n('Numeric identifier, 1 → 9'), + 'hit ASC' => l10n('Visits, low → high'), + 'id ASC' => l10n('Numeric identifier, 1 → 9'), 'id DESC' => l10n('Numeric identifier, 9 → 1'), - 'rank' => l10n('Manual sort order'), + 'rank ASC' => l10n('Manual sort order'), ); $template->assign('image_order_options', $sort_fields); |