aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/functions_category.inc.php20
-rw-r--r--include/functions_user.inc.php12
2 files changed, 10 insertions, 22 deletions
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 0214656bc..2bc455775 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -104,26 +104,6 @@ SELECT name,id,date_last,nb_images,global_rank
}
/**
- * returns the total number of elements viewable in the gallery by the
- * connected user
- *
- * @return int
- */
-function count_user_total_images()
-{
- global $user;
-
- $query = '
-SELECT COUNT(DISTINCT(image_id)) as total
- FROM '.IMAGE_CATEGORY_TABLE.'
- WHERE category_id NOT IN ('.$user['forbidden_categories'].')
-;';
- list($total) = mysql_fetch_array(pwg_query($query));
-
- return $total;
-}
-
-/**
* Retrieve informations about a category in the database
*
* Returns an array with following keys :
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index ea2cfbfbe..44f1a1cf7 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -188,6 +188,13 @@ SELECT ui.*, uc.*
$userdata['forbidden_categories'] =
calculate_permissions($userdata['id'], $userdata['status']);
+ $query = '
+SELECT COUNT(DISTINCT(image_id)) as total
+ FROM '.IMAGE_CATEGORY_TABLE.'
+ WHERE category_id NOT IN ('.$userdata['forbidden_categories'].')
+;';
+ list($userdata['nb_total_images']) = mysql_fetch_array(pwg_query($query));
+
// update user cache
$query = '
DELETE FROM '.USER_CACHE_TABLE.'
@@ -197,9 +204,10 @@ DELETE FROM '.USER_CACHE_TABLE.'
$query = '
INSERT INTO '.USER_CACHE_TABLE.'
- (user_id,need_update,forbidden_categories)
+ (user_id,need_update,forbidden_categories,nb_total_images)
VALUES
- ('.$userdata['id'].',\'false\',\''.$userdata['forbidden_categories'].'\')
+ ('.$userdata['id'].',\'false\',\''
+ .$userdata['forbidden_categories'].'\','.$userdata['nb_total_images'].')
;';
pwg_query($query);
}