$objAlbum->getFromRequest(); $objAlbum->load(); if (!$objAlbum->canEdit($objUser)) { throw new exception('exception_accessdenied'); } $objAlbum->delete(); $objAlbum->save(); header('Location: index.php?action=albums'); } if ($strSubAction == 'move') { if (!$objAlbum->canEdit($objUser)) { throw new Exception('exception_accessdenied'); } /* Set the breadcrumbs and title. */ $objBreadcrumbs->add('Albums', 'index.php?action=albums'); $objAlbum->addBreadcrumbs($objBreadcrumbs, false); $objBreadcrumbs->add('Move', 'index.php?action=albums&subaction=move'); $objTemplate->setText('PAGETITLE', "Moving an Album"); print "<form action='index.php' method='get'>"; print "<input type='hidden' name='action' value='albums'>"; print "<input type='hidden' name='subaction' value='move2'>"; print $objAlbum->getHiddenField('id'); print "Move the album to: " . $objAlbum->getCombo('album_id', clsDB::getOptionsFromList($objAlbum->getPotentialParents($objUser), 'name', 'id', "[no parent]")) . "<br>"; print $objAlbum->getSubmit('Move'); print "</form>"; } if ($strSubAction == 'move2') { if (!$objAlbum->canEdit($objUser)) { throw new Exception('exception_accessdenied'); } $objAlbum->getFromRequest();
require_once 'cls/clsPicture.php'; $objComment = new clsComment(); $objComment->getFromRequest(); $objComment->load(); $objPicture = new clsPicture(); $objPicture->getFromRequest(); $objPicture->load(); $objAlbum = new clsAlbum($objPicture->get('album_id')); if ($strSubAction == 'edit') { if ($objComment->isNew() && !$objAlbum->canPostComment($objUser)) { throw new Exception('exception_accessdenied'); } if (!$objComment->canEdit($objUser)) { throw new Exception('exception_accessdenied'); } $objAlbum->addBreadcrumbs($objBreadcrumbs); $objBreadcrumbs->add($objPicture->get('name'), 'index.php?action=picture&' . $objPicture->getIDPair()); $objBreadcrumbs->add('Post comment', 'comment.php?action=edit&' . $objPicture->getIDPair() . '&' . $objComment->getIDPair()); $objCommentTemplate = new clsTemplate('editcomment'); $objCommentTemplate->setText('HIDDEN', $objComment->getHiddenField('id')); $objCommentTemplate->setText('HIDDEN', $objPicture->getHiddenField('id')); $objCommentTemplate->setText('HIDDEN', "<input type='hidden' name='action' value='comment'>"); $objCommentTemplate->setText('HIDDEN', "<input type='hidden' name='subaction' value='save'>"); if ($objUser) { $objCommentTemplate->setText('NAME', '<strong>' . $objUser->get('username') . '</strong>'); } else { $objCommentTemplate->setText('NAME', $objComment->getTextField('username')); } /* Set a default title if it's not present. */ if (!$objComment->exists('title')) { $objComment->set('title', 'Re: ' . $objPicture->get('title'), false);