/** * Removes all bookmarks of a given asset * @param type $album the album containing bookmarks * @param type $asset the asset we want to remove bookmarks from * @return an array of bookmarks if the bookmarks have been deleted; false otherwise */ function toc_asset_bookmarks_delete_all($album, $asset) { // Sanity check if (!ezmam_album_exists($album)) { return false; } // 1) set the repository path $toc_path = ezmam_repository_path(); if ($toc_path === false) { return false; } // set user's file path $toc_path = $toc_path . '/' . $album; $bookmarks_list = toc_album_bookmarks_list_get($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 toc_album_bookmarks_delete_all($album); } return assoc_array2xml_file($bookmarks_list, $toc_path . "/_bookmarks.xml", "bookmarks", "bookmark"); }
function album_delete() { global $input; global $repository_path; // // Sanity checks // if (!isset($input['album']) || !acl_has_album_permissions($input['album'])) { error_print_message(template_get_message('Unauthorized', get_lang())); log_append('warning', 'view_asset_details: tried to access album ' . $input['album'] . ' without permission'); die; } // // The only important thing to do right now is delete both the public and private albums, // by calling ezmam // ezmam_repository_path($repository_path); // Deletes the table of contents (EZcast Player) toc_album_bookmarks_delete_all($input['album'] . '-priv'); $res = ezmam_album_delete($input['album'] . '-priv'); if (!$res) { error_print_message(ezmam_last_error()); die; } toc_album_bookmarks_delete_all($input['album'] . '-pub'); $res = ezmam_album_delete($input['album'] . '-pub'); if (!$res) { error_print_message(ezmam_last_error()); die; } // // Don't forget to update the albums list // acl_update_permissions_list(); unset($_SESSION['podman_album']); // // Finally, we display a nice confirmation message to the user // require_once template_getpath('popup_album_successfully_deleted.php'); }