Esempio n. 1
0
/**
 * Creates a zip file of the album
 *
 * @param string $albumname album folder
 */
function createAlbumZip($albumname)
{
    global $_zp_zip_list, $zip_gallery;
    $zip_gallery = new Gallery();
    $album = new Album($zip_gallery, $albumname);
    if (!$album->isMyItem(LIST_RIGHTS) && !checkAlbumPassword($albumname)) {
        pageError(403, gettext("Forbidden"));
        exit;
    }
    if (!$album->exists) {
        pageError(404, gettext('Album not found'));
        exit;
    }
    $persist = $zip_gallery->getPersistentArchive();
    $dest = $album->localpath . '.zip';
    if (!$persist || !file_exists($dest)) {
        include_once 'archive.php';
        $curdir = getcwd();
        chdir($album->localpath);
        $_zp_zip_list = array();
        $z = new zip_file($dest);
        $z->set_options(array('basedir' => realpath($album->localpath . '/'), 'inmemory' => 0, 'recurse' => 0, 'storepaths' => 1));
        zipAddAlbum($album, strlen($albumname), $z);
        $z->add_files($_zp_zip_list);
        $z->create_archive();
        unset($_zp_zip_list);
        chdir($curdir);
    }
    header('Content-Type: application/zip');
    header('Content-Disposition: attachment; filename="' . pathurlencode($albumname) . '.zip"');
    header("Content-Length: " . filesize($dest));
    printLargeFileContents($dest);
    if (!$persist) {
        unlink($dest);
    }
    unset($zip_gallery);
    unset($album);
    unset($persist);
    unset($dest);
}
Esempio n. 2
0
							<label>
								<input type="checkbox" name="thumb_select_images" id="thumb_select_images"
										value="1" <?php 
    echo checked('1', $gallery->getThumbSelectImages());
    ?>
 />
								<?php 
    echo gettext("visual thumb selection");
    ?>
							</label>
						</p>
						<p>
							<label>
								<input type="checkbox" name="persistent_archive" id="persistent_archive"
										value="1" <?php 
    echo checked('1', $gallery->getPersistentArchive());
    ?>
 />
								<?php 
    echo gettext("enable persistent archives");
    ?>
							</label>
						</p>
						<p>
							<label>
								<input type="checkbox" name="album_session" id="album_session"
										value="1" <?php 
    echo checked('1', GALLERY_SESSION);
    ?>
 />
								<?php