예제 #1
0
$album_file_path = getAlbumFilePath($album_info['id'], $album_info['created_date']);
if (isset($_GET['size']) && $_GET['size'] == 'o') {
    //if original
    $album_file_path .= DIRECTORY_SEPARATOR;
} else {
    //if thumbnail
    $album_file_path .= '_tn' . DIRECTORY_SEPARATOR;
}
$photo_file_path = getPhotoFilePath($photo_info['id'], $photo_info['name'], $photo_info['created_date']);
$photo_file_hash = getPhotoFilePath($photo_info['id'], '', $photo_info['created_date']);
$file = AT_PA_CONTENT_DIR . $album_file_path . $photo_file_path;
//if file does not exist, quit.
if (!file_exists($file)) {
    //TODO: Clean files silently, cleaned but garbaged link remains on page.
    //Remove node from the DOM tree?
    $pa->deletePhoto($pid);
    header('HTTP/1.1 404 Not Found', TRUE);
    exit;
}
//if hash doesn't match, then don't load the picture.
//to prevent trial and error on URL for photos
if ($ph !== $photo_file_hash) {
    header('HTTP/1.1 404 Not Found', TRUE);
    exit;
}
$pathinfo = pathinfo($file);
$ext = $pathinfo['extension'];
if ($ext == '') {
    $ext = 'application/octet-stream';
} else {
    $ext = $mime[$ext][0];
예제 #2
0
$_pages[AT_PA_BASENAME.'edit_photos.php']['parent'] = AT_PA_BASENAME.'albums.php?id='.$aid;
if ($isadmin) {
	$_pages[AT_PA_BASENAME.'albums.php?id='.$aid]['parent']   = AT_PA_BASENAME.'index_admin.php';

}
*/
//handle Edit.
if (isset($_POST['submit'])) {
    //update photo description
    foreach ($photos as $index => $photo_array) {
        $alt_text = $_POST['alt_text_' . $photo_array['id']];
        $description = $_POST['description_' . $photo_array['id']];
        $deletion = $_POST['delete_' . $photo_array['id']];
        //don't have to update description if it's deleted
        if (isset($deletion)) {
            $pa->deletePhoto($photo_array['id']);
        } elseif (isset($description)) {
            $result = $pa->editPhoto($photo_array['id'], $description, $alt_text);
            if (!$result) {
                //TODO: sql error
                $msg->addError('PA_EDIT_PHOTO_FAILED');
            }
        }
    }
    //update photo album.
    if (isset($_POST['album_cover'])) {
        $result = $pa->editAlbumCover($_POST['album_cover']);
        if (!$result) {
            //albumcover error.
            $msg->addError('PA_EDIT_PHOTO_FAILED');
        }