<?php require_once 'cls/clsAlbum.php'; require_once 'cls/clsComment.php'; 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'));