aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2011-12-17 23:05:19 +0000
committerplegall <plg@piwigo.org>2011-12-17 23:05:19 +0000
commitf5004995306cb603d63724c98af2d657c3c4a64b (patch)
treec5668e7da765702b4a945e785b858d4753775e51 /admin/include
parentb581ba81b7f92ce7ce1b9ade1d004f200a828e4e (diff)
merge r12762 from branch 2.3 to trunk
bug 2536 fixed: a new virtual album is now added on top of the list of other albums in the parent album (instead of bottom). git-svn-id: http://piwigo.org/svn/trunk@12763 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php11
1 files changed, 3 insertions, 8 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index dfc596235..6acc7ab98 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1219,16 +1219,9 @@ function create_virtual_category($category_name, $parent_id=null)
$parent_id = !empty($parent_id) ? $parent_id : 'NULL';
- $query = '
-SELECT MAX(rank)
- FROM '.CATEGORIES_TABLE.'
- WHERE id_uppercat '.(is_numeric($parent_id) ? '= '.$parent_id : 'IS NULL').'
-;';
- list($current_rank) = pwg_db_fetch_row(pwg_query($query));
-
$insert = array(
'name' => $category_name,
- 'rank' => ++$current_rank,
+ 'rank' => 0,
'commentable' => boolean_to_string($conf['newcat_default_commentable']),
);
@@ -1298,6 +1291,8 @@ UPDATE
;';
pwg_query($query);
+ update_global_rank();
+
if ('private' == $insert['status'])
{
add_permission_on_category($inserted_id, array_unique(array_merge(get_admins(), array($user['id']))));