Пример #1
0
function album_edit()
{
    global $input;
    global $repository_path;
    //
    // Usual sanity checks
    //
    if (!isset($input['album']) || !isset($input['moderation'])) {
        echo "Usage: index.php?action=edit_album&session=SESSION_ID&intro=INTRO&addTitle=ADD_TITLE";
        die;
    }
    if ($input['moderation'] == true) {
        $album = $input['album'] . '-priv';
    } else {
        $album = $input['album'] . '-pub';
    }
    ezmam_repository_path($repository_path);
    if (!ezmam_album_exists($album)) {
        error_print_message(ezmam_last_error());
        die;
    }
    //
    // Then we update the metadata
    //
    $album_meta = ezmam_album_metadata_get($album);
    $album_meta['intro'] = $input['intro'];
    $album_meta['add_title'] = $input['add_title'];
    $album_meta['downloadable'] = $input['downloadable'];
    $res = ezmam_album_metadata_set($album, $album_meta);
    if (!$res) {
        error_print_message(ezmam_last_error());
        die;
    }
    //  view_main();
    require_once template_getpath('popup_album_successfully_edited.php');
}
Пример #2
0
/**
 *
 * @param string $album_name  name of the album
 * @param assoc_array $metadata
 * @param string $description description for metadata
 * @return false|error_string
 */
function ezmam_album_new($album_name, $metadata)
{
    $repository_path = ezmam_repository_path();
    if ($repository_path === false) {
        return false;
    }
    //create directory
    $album_path = $repository_path . "/" . $album_name;
    if (ezmam_album_exists($album_name)) {
        return "album already exists";
    }
    $res = mkdir($album_path);
    if (!$res) {
        return "could not create {$album_path}";
    }
    // Create a token
    $res = ezmam_album_token_create($album_name);
    if (!$res) {
        return "could not create token for {$album_path}";
    }
    //create the metadata
    $res = ezmam_album_metadata_set($album_name, $metadata);
    if (!$res) {
        return "could not create metadata for {$album_path}";
    }
    //log the operation
    log_append('album_new', $album_name);
    return $res;
}