示例#1
0
/**
 * Defines user's preferences on how bookmarks should be ordered in the web interface
 * @global type $input
 * @global type $repository_path
 * @global type $user_files_path
 */
function bookmarks_sort()
{
    global $input;
    global $repository_path;
    global $user_files_path;
    $album = $_SESSION["album"];
    $panel = $input['panel'];
    $new_order = $input["order"];
    // init paths
    ezmam_repository_path($repository_path);
    user_prefs_repository_path($user_files_path);
    if (acl_value_get("{$panel}_order") != $new_order) {
        if (acl_user_is_logged()) {
            user_prefs_settings_edit($_SESSION['user_login'], "{$panel}_order", $new_order);
            acl_update_settings();
        } else {
            $_SESSION["acl_user_settings"]["{$panel}_order"] = $new_order;
        }
    }
    // lvl, action, album, panel (official|personal), new_order (chron|reverse_chron)
    trace_append(array($input['source'] == 'assets' ? '2' : '3', 'bookmarks_sort', $album, $panel, $new_order));
    // determines the page to display
    if ($input['source'] == 'assets') {
        // the token is needed to display the album assets
        $input['token'] = ezmam_album_token_get($album);
        view_album_assets(false);
    } else {
        view_asset_details(false);
    }
}
示例#2
0
/**
 * Edits asset data and re-draws the asset details
 * @global type $input 
 */
function asset_edit()
{
    global $input;
    global $repository_path;
    global $title_max_length;
    //
    // Usual sanity checks
    //
    if (!isset($input['album']) || !isset($input['asset']) || !isset($input['title'])) {
        echo "Usage: index.php?action=edit_asset&album=ALBUM&asset=ASSET&title=NEW_TITLE";
        die;
    }
    ezmam_repository_path($repository_path);
    if (!ezmam_album_exists($input['album']) || !ezmam_asset_exists($input['album'], $input['asset'])) {
        error_print_message(ezmam_last_error());
        die;
    }
    if (strlen($input['title']) > $title_max_length) {
        error_print_message(template_get_message('title_too_long', get_lang()));
        die;
    }
    //
    // Then we update the metadata
    //
    $metadata = ezmam_asset_metadata_get($input['album'], $input['asset']);
    $metadata['title'] = $input['title'];
    $metadata['description'] = $input['description'];
    $res = ezmam_asset_metadata_set($input['album'], $input['asset'], $metadata);
    if (!$res) {
        error_print_message(ezmam_last_error());
        die;
    }
    //
    // And we display the (new) asset details
    //
    view_asset_details();
}