Changeset 9583 for extensions/community/include/functions_community.inc.php
- Timestamp:
- Mar 9, 2011, 2:06:10 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- 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 ?>
Note: See TracChangeset
for help on using the changeset viewer.