コード例 #1
0
ファイル: web_index.php プロジェクト: jingyexu/ezcast
/**
 * Deletes a token from 'div_main_center.php'
 * @global type $input
 * @global type $repository_path
 * @global type $user_files_path
 */
function album_token_delete()
{
    global $input;
    global $repository_path;
    global $user_files_path;
    $album = $input['album'];
    ezmam_repository_path($repository_path);
    user_prefs_repository_path($user_files_path);
    user_prefs_token_remove($_SESSION['user_login'], $album);
    user_prefs_album_bookmarks_delete_all($_SESSION['user_login'], $album);
    acl_update_permissions_list();
    log_append('delete_album_token', 'album token removed : album -' . $album);
    // lvl, action, album
    trace_append(array('1', 'album_token_delete', $album));
    view_main(false);
}
コード例 #2
0
ファイル: lib_user_prefs.php プロジェクト: jingyexu/ezcast
/**
 * Removes all bookmarks of a specific asset from the bookmarks file
 * @param type $user the user
 * @param type $album the album
 * @param type $asset the asset we want to remove bookmarks from
 * @return boolean true if the bookmarks have been deleted; false otherwise
 */
function user_prefs_asset_bookmarks_delete($user, $album, $asset)
{
    // 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;
    }
    // set user's file path
    $user_path = $user_files_path . '/' . $user;
    $bookmarks_list = user_prefs_album_bookmarks_list_get($user, $album);
    foreach ($bookmarks_list as $index => $bookmark) {
        if ($bookmark['asset'] == $asset) {
            unset($bookmarks_list[$index]);
        }
    }
    // if there is no bookmark anymore, the file is deleted
    if (count($bookmarks_list) == 0) {
        return user_prefs_album_bookmarks_delete_all($user, $album);
    }
    return assoc_array2xml_file($bookmarks_list, $user_path . "/bookmarks_{$album}.xml", "bookmarks", "bookmark");
}