/** * Moves an album token from a position to an other position in the list * @param type $user the user * @param type $index the index of the token to move * @param type $new_index the new index for the token to move * @return the new list; false if an error occurs */ function user_prefs_token_swap($user, $index, $new_index) { // Sanity check if (!isset($user) || $user == '') { return false; } if (!isset($index) || $index < 0) { return false; } if (!isset($new_index) || $new_index < 0) { return false; } // 1) set the repository path $user_files_path = user_prefs_repository_path(); if ($user_files_path === false) { return false; } $token_list = acl_album_tokens_get(); $max_index = count($token_list); if ($index >= $max_index || $new_index >= $max_index) { return false; } $token = $token_list[$index]; $token_list[$index] = $token_list[$new_index]; $token_list[$new_index] = $token; $user_path = $user_files_path . '/' . $user; return assoc_array2xml_file($token_list, $user_path . "/_album_tokens.xml", "album_tokens", "album_token"); }
function acl_update_watched_assets() { global $repository_path; global $user_files_path; ezmam_repository_path($repository_path); user_prefs_repository_path($user_files_path); $watched_assets = array(); if (acl_user_is_logged()) { $album_tokens_list = acl_album_tokens_get(); foreach ($album_tokens_list as $album_token) { $global_count[$album_token['album']] = ezmam_asset_count($album_token['album']); } $watched_assets = user_prefs_watchedlist_get($_SESSION['user_login'], false); $_SESSION['acl_global_count'] = $global_count; } $_SESSION['acl_watched_assets'] = $watched_assets; }