Example #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);
    }
}
Example #2
0
/**
 * Resets the token of a specific album, and tokens of all the assets within
 * @param type $album 
 * @return bool error status
 */
function ezmam_album_token_reset($album)
{
    // Sanity checks
    $repository_path = ezmam_repository_path();
    if ($repository_path == false) {
        ezmam_last_error("Please call ezmam_repository_path() before anything else");
        return false;
    }
    if (!ezmam_album_exists($album)) {
        ezmam_last_error("ezmam_album_token_reset: Album {$album} does not exist");
        return false;
    }
    $old_token = ezmam_album_token_get($album);
    // Resetting the album token
    $res = ezmam_album_token_create($album);
    if (!$res) {
        ezmam_last_error('ezmam_album_token_reset: Unable to change token');
        return false;
    }
    $assets = ezmam_asset_list($album);
    foreach ($assets as $asset) {
        ezmam_asset_token_reset($album, $asset, false);
    }
    // Resetting the RSS feed
    ezmam_rss_generate($album, "high");
    ezmam_rss_generate($album, "low");
    // Logging the operation
    log_append('album_token_reset', 'album ' . $album . ', old token: ' . $old_token . ', new token: ' . $res);
    return true;
}
Example #3
0
/**
 * DIsplays the popup with the embed code to copypaste
 * @global type $input
 * @global type $repository_path
 * @global type $url 
 */
function popup_embed_code()
{
    global $input;
    global $repository_path;
    global $ezmanager_url;
    global $distribute_url;
    ezmam_repository_path($repository_path);
    template_load_dictionnary('translations.xml');
    //
    // Sanity checks
    //
    if (!isset($input['album']) || !isset($input['asset']) || !isset($input['media'])) {
        echo 'Usage: index.php?action=show_popup&popup=embed_code&album=ALBUM&asset=ASSET&media=MEDIA';
        die;
    }
    if (!ezmam_album_exists($input['album']) || !ezmam_asset_exists($input['album'], $input['asset'])) {
        error_print_message(ezmam_last_error());
        die;
    }
    // Retrieving the info needed for the embed code and target link
    $metadata = ezmam_media_metadata_get($input['album'], $input['asset'], $input['media']);
    $token = ezmam_asset_token_get($input['album'], $input['asset']);
    if (!$token) {
        $token = ezmam_album_token_get($input['album']);
    }
    $media_infos = explode('_', $input['media']);
    $type = $media_infos[1];
    $quality = $media_infos[0];
    //compute iframe size according to media size
    $iframe_height = $metadata['height'] + 40;
    $iframe_width = $metadata['width'] + 30;
    // Embed code
    $link_target = $distribute_url . '?action=embed&album=' . $input['album'] . '&asset=' . $input['asset'] . '&type=' . $type . '&quality=' . $quality . '&token=' . $token;
    $embed_code_web = '<iframe width="' . $iframe_width . '" height="' . $iframe_height . '" style="padding: 0;" frameborder="0" scrolling="no" src="' . $distribute_url . '?action=embed_link&album=' . $input['album'] . '&asset=' . $input['asset'] . '&type=' . $type . '&quality=' . $quality . '&token=' . $token . '&width=' . $metadata['width'] . '&height=' . $metadata['height'] . '&lang=' . get_lang() . '"><a href="' . $link_target . '">' . template_get_message('view_video', get_lang()) . '</a></iframe>';
    $embed_code = htmlentities($embed_code_web, ENT_COMPAT, 'UTF-8');
    // Displaying the popup
    require_once template_getpath('popup_embed_code.php');
}
Example #4
0
/**
 * Returns a special code that contains information about the media
 * @global type $url
 * @param string $album
 * @param string $asset
 * @param string $media
 * @return string Media
 */
function get_code_to_media($album, $asset, $media)
{
    global $ezplayer_url;
    global $distribute_url;
    global $repository_path;
    ezmam_repository_path($repository_path);
    //
    // Usual sanity checks
    //
    if (!ezmam_album_exists($album)) {
        error_print_message('get_link_to_media: Album ' . $album . ' does not exist');
        return false;
    }
    if (!ezmam_asset_exists($album, $asset)) {
        error_print_message('get_link_to_media: Asset ' . $asset . ' does not exist');
        return false;
    }
    // We take the asset's token if it exists.
    // If not, then we use the album's token instead.
    $token = ezmam_asset_token_get($album, $asset);
    if (!$token) {
        $token = ezmam_album_token_get($album);
    }
    if (!$token) {
        error_print_message('get_link_to_media: ' . ezmam_last_error());
        return false;
    }
    $media_infos = explode('_', $media);
    // 'media' is like high_cam, so we want to extract the "high" part (quality) and the "cam" part (type)
    $quality = $media_infos[0];
    $type = $media_infos[1];
    return $album . '/' . $asset . '/' . $type . '/' . $quality . '/' . $token;
}