echo ahref('u/photo/show/' . $im->id, 'Details'); echo '<br/><br/>'; } $lb = new YuiLightbox(); echo $lb->render(); break; case 'delete': $session->requireLoggedIn(); if ($this->child && confirmed('Are you sure you want to delete this photo album?')) { // verify that the owner of the album is current session id $album = PhotoAlbum::get($this->child); if (!$album->owner || $album->owner != $session->id) { dp('HACK: tried to delete photo album ' . $this->child . ' which is not owned by user ' . $session->id); return; } PhotoAlbum::delete($this->child); js_redirect('u/album/overview'); } break; case 'upload': // child = album id $session->requireLoggedIn(); function handleUpload($p) { $session = SessionHandler::getInstance(); //XXX SECURITY: verify that destination album is owned by current user $fileId = File::importImage(USER, $p['img'], $p['album']); if ($fileId) { js_redirect('u/album/show/' . $session->id . '/' . $p['album']); } return false;
/** * Deletes the photoalbum in database and their thumbnails associated. * Used in /photoalbum/actions/executeRefreshPhotoAlbumCollection * * @param PhotoAlbum $photoalbum_object */ public static function deletePhotoAlbum($photoalbum_object, $user) { $photoalbum_object->delete(); Util::deleteThumbnail($photoalbum_object, $user); }