Changeset 1081
- Timestamp:
- Mar 15, 2006, 3:26:25 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/category.php
r1072 r1081 213 213 $template->assign_vars( 214 214 array( 215 'NB_PICTURE' => count_user_total_images(),215 'NB_PICTURE' => $user['nb_total_images'], 216 216 'TITLE' => $template_title, 217 217 'USERNAME' => $user['username'], -
trunk/include/functions_category.inc.php
r1061 r1081 105 105 106 106 /** 107 * returns the total number of elements viewable in the gallery by the108 * connected user109 *110 * @return int111 */112 function count_user_total_images()113 {114 global $user;115 116 $query = '117 SELECT COUNT(DISTINCT(image_id)) as total118 FROM '.IMAGE_CATEGORY_TABLE.'119 WHERE category_id NOT IN ('.$user['forbidden_categories'].')120 ;';121 list($total) = mysql_fetch_array(pwg_query($query));122 123 return $total;124 }125 126 /**127 107 * Retrieve informations about a category in the database 128 108 * -
trunk/include/functions_user.inc.php
r1079 r1081 189 189 calculate_permissions($userdata['id'], $userdata['status']); 190 190 191 $query = ' 192 SELECT COUNT(DISTINCT(image_id)) as total 193 FROM '.IMAGE_CATEGORY_TABLE.' 194 WHERE category_id NOT IN ('.$userdata['forbidden_categories'].') 195 ;'; 196 list($userdata['nb_total_images']) = mysql_fetch_array(pwg_query($query)); 197 191 198 // update user cache 192 199 $query = ' … … 198 205 $query = ' 199 206 INSERT INTO '.USER_CACHE_TABLE.' 200 (user_id,need_update,forbidden_categories )207 (user_id,need_update,forbidden_categories,nb_total_images) 201 208 VALUES 202 ('.$userdata['id'].',\'false\',\''.$userdata['forbidden_categories'].'\') 209 ('.$userdata['id'].',\'false\',\'' 210 .$userdata['forbidden_categories'].'\','.$userdata['nb_total_images'].') 203 211 ;'; 204 212 pwg_query($query); -
trunk/install/phpwebgallery_structure.sql
r1078 r1081 261 261 `need_update` enum('true','false') NOT NULL default 'true', 262 262 `forbidden_categories` text, 263 `nb_total_images` mediumint(8), 263 264 PRIMARY KEY (`user_id`) 264 265 ) TYPE=MyISAM;
Note: See TracChangeset
for help on using the changeset viewer.