Ejemplo n.º 1
0
function view_rss()
{
    global $input;
    // 0) Sanity checks
    if (!ezmam_album_exists($input['album'])) {
        error_print_http(404);
        log_append('warning', 'view_rss: tried to access non-existant album ' . $input['album']);
        exit;
    }
    if (!ezmam_album_token_check($input['album'], $input['token'])) {
        error_print_http(403);
        log_append('warning', 'view_rss: tried to acces album ' . $input['album'] . ' with invalid token ' . $input['token']);
        die;
    }
    if (!accepted_quality($input['quality'])) {
        error_print_http(403);
        log_append('warning', 'view_rss: tried to access album ' . $input['album'] . 'in forbidden quality "' . $input['quality'] . '"');
        die;
    }
    // 1) Retrieving the feed path
    $feed_handle = ezmam_rss_getpath($input['album'], $input['quality'], false);
    if (!file_exists($feed_handle)) {
        $album = $input['album'];
        ezmam_rss_generate($album, "high");
        ezmam_rss_generate($album, "low");
        ezmam_rss_generate($album, "ezplayer");
    }
    // 2) Providing feed content to client
    header('Content-Type: text/xml');
    readfile($feed_handle);
}
Ejemplo n.º 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;
}