/** * Updates the (locally stored) list of consulted albums and moderated albums */ function acl_update_permissions_list() { global $repository_path; ezmam_repository_path($repository_path); $courses_list_for_author = array(); $consulted_albums = array(); if (acl_user_is_logged()) { $courses_list_for_author = courses_list($_SESSION['user_login']); foreach ($courses_list_for_author as $key => $title) { if (!ezmam_album_exists("{$key}-pub")) { unset($courses_list_for_author[$key]); } } $album_tokens_list = user_prefs_tokens_get($_SESSION['user_login']); foreach ($album_tokens_list as $album_token) { $consulted_albums[] = $album_token['album']; } $_SESSION['acl_album_tokens'] = $album_tokens_list; } else { // anonymous user : every consulted album is directly stored in $_SESSION['acl_album_tokens'] // tokens stored during action "view_album_assets" in web_index.php foreach ($_SESSION['acl_album_tokens'] as $album_token) { $consulted_albums[] = $album_token['album']; } } if (acl_show_notifications()) { acl_update_watched_assets(); } $_SESSION['acl_consulted_albums'] = $consulted_albums; $_SESSION['acl_moderated_albums'] = $courses_list_for_author; }
/** * Updates the 'new assets' count * @param type $user the user * @param type $album the album to update * @return boolean */ function user_prefs_token_update_count($user, $album) { // Sanity check if (!isset($user) || $user == '') { return false; } if (!ezmam_album_exists($album)) { return false; } // 1) set the repository path $user_files_path = user_prefs_repository_path(); if ($user_files_path === false) { return false; } $index = user_prefs_token_index($user, $album); if ($index >= 0) { // set user's file path $user_path = $user_files_path . '/' . $user; $token_list = user_prefs_tokens_get($user); // updates the count $count = count(ezmam_asset_list($album)); $token_list[$index]['count'] = $count; return assoc_array2xml_file($token_list, $user_path . "/_album_tokens.xml", "album_tokens", "album_token"); } return false; }