Changeset 9583 for extensions
- Timestamp:
- Mar 9, 2011, 2:06:10 PM (14 years ago)
- Location:
- extensions/community
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/community/add_photos.php
r9563 r9583 270 270 271 271 $create_subcategories = false; 272 273 if ($user_permissions['create_whole_gallery']) 272 if ($user_permissions['create_whole_gallery'] or count($user_permissions['create_categories']) > 0) 274 273 { 275 274 $create_subcategories = true; 276 275 } 277 276 278 if (count($user_permissions['create_categories']) > 0) 279 { 280 $create_subcategories = true; 281 $category_ids = null; 282 283 $query = ' 277 $create_categories = $user_permissions['create_categories']; 278 if (count($user_permissions['create_categories']) == 0) 279 { 280 $create_categories = array(-1); 281 } 282 283 $query = ' 284 284 SELECT id,name,uppercats,global_rank 285 285 FROM '.CATEGORIES_TABLE.' 286 WHERE id IN ('.implode(',', $user_permissions['create_categories']).') 287 ;'; 288 289 display_select_cat_wrapper( 290 $query, 291 $selected_category, 292 'category_parent_options' 293 ); 294 } 286 WHERE id IN ('.implode(',', $create_categories).') 287 ;'; 288 289 display_select_cat_wrapper( 290 $query, 291 $selected_category, 292 'category_parent_options' 293 ); 295 294 296 295 $template->assign( -
extensions/community/admin_permissions.php
r9536 r9583 157 157 } 158 158 159 co nf_update_param('community_update', time());159 community_update_cache_key(); 160 160 } 161 161 … … 175 175 pwg_query($query); 176 176 177 co nf_update_param('community_update', time());177 community_update_cache_key(); 178 178 179 179 $_SESSION['page_infos'] = array(l10n('Permission removed')); -
extensions/community/include/functions_community.inc.php
r9501 r9583 26 26 global $conf, $user; 27 27 28 if (!isset($conf['community_update'])) 29 { 30 conf_update_param('community_update', time()); 31 } 32 33 if (isset($_SESSION['community_user_permissions'])) 34 { 35 if ($_SESSION['community_update'] > $conf['community_update']) 36 { 37 return $_SESSION['community_user_permissions']; 38 } 28 $cache_key = community_get_cache_key(); 29 if (!isset($cache_key)) 30 { 31 $cache_key = community_update_cache_key(); 32 } 33 34 // I (plg) don't understand why, but when you connect, you keep the 35 // permissions calculated for the "guest" : the session is "inheritated" 36 // from guest to the connected user, so I add a 37 // $_SESSION['community_user_id'] to force refresh if the permissions were 38 // not calculated for the right user 39 if ( 40 isset($_SESSION['community_user_id']) 41 and $_SESSION['community_user_id'] == $user_id 42 and $_SESSION['community_cache_key'] == $cache_key 43 ) 44 { 45 return $_SESSION['community_user_permissions']; 39 46 } 40 47 … … 199 206 200 207 $_SESSION['community_user_permissions'] = $return; 201 $_SESSION['community_update'] = time(); 208 $_SESSION['community_cache_key'] = $cache_key; 209 $_SESSION['community_user_id'] = $user_id; 202 210 203 211 return $_SESSION['community_user_permissions']; … … 242 250 } 243 251 252 function community_update_cache_key() 253 { 254 $cache_key = generate_key(20); 255 conf_update_param('community_cache_key', $cache_key); 256 return $cache_key; 257 } 258 259 function community_get_cache_key() 260 { 261 global $conf; 262 263 if (isset($conf['community_cache_key'])) 264 { 265 return $conf['community_cache_key']; 266 } 267 else 268 { 269 return null; 270 } 271 } 244 272 ?> -
extensions/community/main.inc.php
r9563 r9583 127 127 // photos" link in the gallery menu 128 128 $user_permissions = community_get_user_permissions($user['id']); 129 129 130 130 if (count($user_permissions['upload_categories']) == 0 and !$user_permissions ['create_whole_gallery']) 131 131 { … … 213 213 community_reject_user_pendings($user_id); 214 214 } 215 216 add_event_handler('invalidate_user_cache', 'community_refresh_cache_update_time'); 217 function community_refresh_cache_update_time() 218 { 219 community_update_cache_key(); 220 } 215 221 ?> -
extensions/community/maintain.inc.php
r9566 r9583 328 328 mass_inserts($prefixeTable.'community_permissions', array_keys($insert), array($insert)); 329 329 330 conf_update_param('community_update', time()); 330 include_once(dirname(__FILE__).'/include/functions_community.inc.php'); 331 community_update_cache_key(); 331 332 } 332 333 ?>
Note: See TracChangeset
for help on using the changeset viewer.