Exemple #1
0
/**
 * All the business logic related to the album creation: this function effectively creates the album and displays a confirmation message to the user
 * @global type $input
 * @global type $ezmanager_url
 * @global type $repository_path
 * @global type $dir_date_format
 * @global type $default_intro 
 */
function album_create()
{
    global $input;
    global $ezmanager_url;
    global $repository_path;
    global $dir_date_format;
    global $default_intro;
    global $default_add_title;
    global $default_downloadable;
    //
    // Sanity checks
    //
    if (!isset($input['album']) || !acl_has_album_permissions($input['album'])) {
        error_print_message(template_get_message('Unauthorized', get_lang()));
        log_append('warning', 'create_album: tried to access album ' . $input['album'] . ' without permission');
        die;
    }
    //
    // First of all, we have to set up the metada for the albums we're going to create
    //
    $not_created_albums = acl_authorized_albums_list_not_created(true);
    $description = $not_created_albums[$input['album']];
    $anac = get_anac(date('Y'), date('m'));
    $metadata = array('name' => $input['album'], 'description' => $description, 'date' => date($dir_date_format), 'anac' => $anac, 'intro' => $default_intro, 'add_title' => $default_add_title, 'downloadable' => $default_downloadable);
    //
    // All we have to do now is call ezmam twice to create both the private and public album
    // (remember that $input['album'] only contains the album's base name, /not/ the suffix
    //
    ezmam_repository_path($repository_path);
    $res = ezmam_album_new($input['album'] . '-priv', $metadata);
    if (!$res) {
        error_print_message(ezmam_last_error());
        die;
    }
    $res = ezmam_album_new($input['album'] . '-pub', $metadata);
    if (!$res) {
        error_print_message(ezmam_last_error());
        die;
    }
    //
    // Don't forget to update the session variables!
    //
    acl_update_permissions_list();
    //
    // Finally, we show a confirmation popup to the user
    //
    $public_album_url = $distribute_url . '?action=rss&album=' . $input['album'] . '-pub' . '&quality=high&token=' . ezmam_album_token_get($input['album'] . '-pub');
    require_once template_getpath('popup_album_successfully_created.php');
}
Exemple #2
0
if ($step_by_step) {
    exec('read');
}
if ($step_by_step) {
    echo 'adding asset in COURSE-MNEMO-priv';
}
$metadata = array('author' => 'X', 'title' => 'Test numéro 3', 'description' => 'Ce test est slides-only', 'record_date' => '2011_07_26_16h15', 'record_type' => 'slide', 'language' => 'français');
ezmam_asset_new("COURSE-MNEMO-priv", "2011-07-27-16h09", $metadata);
if ($step_by_step) {
    exec('read');
}
if ($step_by_step) {
    echo 'adding album COURSE-MNEMO-pub';
}
$metadata = array('name' => 'COURSE-MNEMO-pub', 'description' => 'Test de flux RSS: réréré', 'date' => '2011-07-26', 'anac' => '2011-2012');
ezmam_album_new("COURSE-MNEMO-pub", $metadata);
if ($step_by_step) {
    exec('read');
}
if ($step_by_step) {
    echo 'adding asset in COURSE-MNEMO-pub';
}
$metadata = array('author' => 'X', 'title' => 'Test d\'accentuation UTF-8: tètètè', 'description' => 'Ceci est un accent: à', 'record_date' => '2011_07_26_16h00', 'record_type' => 'camslide', 'language' => 'français');
ezmam_asset_new("COURSE-MNEMO-pub", "2011-07-27-14h32", $metadata);
if ($step_by_step) {
    exec('read');
}
/*
echo 'deleting album COURSE-MNEMO-pub';
ezmam_album_delete('COURSE-MNEMO-pub');