aboutsummaryrefslogtreecommitdiffstats
path: root/admin/cat_list.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2004-12-18 22:05:30 +0000
committerplegall <plg@piwigo.org>2004-12-18 22:05:30 +0000
commitf0e9cd804af6512529982e66f73a27fa7658c46c (patch)
treed7a2be782e859b9b4e9bdc06069122cc38c95729 /admin/cat_list.php
parent775e9ee74cf910f858f08b24d4b4820ea42bac85 (diff)
- bug fixed : in admin/cat_list, next_rank cant' be calculted and query to
count sub-categories per sub-categories became false if no sub-categories - virtual association come back in admin/infos_images (not only in admin/picture_modify) - check_favorites function in admin section becomes check_user_favorites in public section : favorites are checked when user tries to display his favorites. Function was optimized. - in function update_category, wrap of long queries due to many categories to update at the same time - typo fixed in description of paginate_pages_around configuration parameter - bug fixed in new navigation bar : no separation pipe was displayed between next and last when the page displayed was the last - sessions.expiration changed of type from int to datetime (a lot easier to read) - sessions.ip removed : IP address is no longer used to verify session - $lang['cat_options'] was missing in en_UK.iso-8859-1 - typo fixed in language/en_UK.iso-8859-1/admin.lang.php on editcat_lock_info language item git-svn-id: http://piwigo.org/svn/trunk@647 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/cat_list.php32
1 files changed, 23 insertions, 9 deletions
diff --git a/admin/cat_list.php b/admin/cat_list.php
index d92575fe8..2f7834730 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -327,9 +327,18 @@ if (isset($_GET['parent_id']))
$form_action.= '&amp;parent_id='.$_GET['parent_id'];
}
+if (count($categories) > 0)
+{
+ $next_rank = max(array_keys($categories)) + 1;
+}
+else
+{
+ $next_rank = 1;
+}
+
$template->assign_vars(array(
'CATEGORIES_NAV'=>$navigation,
- 'NEXT_RANK'=>max(array_keys($categories))+1,
+ 'NEXT_RANK'=>$next_rank,
'F_ACTION'=>$form_action,
'L_ADD_VIRTUAL'=>$lang['cat_add'],
@@ -367,21 +376,26 @@ if (count($infos) != 0)
// | Categories display |
// +-----------------------------------------------------------------------+
$ranks = array();
-foreach ($categories as $category)
+
+if (count($categories) > 0)
{
- $ranks[$category['id']] = $category['rank'];
-}
+ foreach ($categories as $category)
+ {
+ $ranks[$category['id']] = $category['rank'];
+ }
-$query = '
+ $query = '
SELECT id_uppercat, COUNT(*) AS nb_subcats
FROM '. CATEGORIES_TABLE.'
WHERE id_uppercat IN ('.implode(',', array_keys($ranks)).')
GROUP BY id_uppercat
;';
-$result = pwg_query($query);
-while ($row = mysql_fetch_array($result))
-{
- $categories[$ranks[$row['id_uppercat']]]['nb_subcats'] = $row['nb_subcats'];
+ $result = pwg_query($query);
+ while ($row = mysql_fetch_array($result))
+ {
+ $categories[$ranks[$row['id_uppercat']]]['nb_subcats']
+ = $row['nb_subcats'];
+ }
}
foreach ($categories as $category)