示例#1
0
     }
     $objComment->getFromRequest(array('id', 'username', 'title', 'text'));
     $objComment->set('picture_id', $objPicture->get('id'));
     $objComment->set('date', date('Y-m-d H:i:s'));
     if ($objUser) {
         $objComment->set('user_id', $objUser->get('id'));
         $objComment->set('username', $objUser->get('username'));
     }
     $objComment->save();
     header("Location: index.php?action=picture&" . $objPicture->getIDPair());
 } else {
     if ($strSubAction == 'delete') {
         if (!$objComment->canDelete($objUser)) {
             throw new Exception('exception_accessdenied');
         }
         $objComment->delete();
         $objComment->save();
         header("Location: index.php?action=picture&" . $objPicture->getIDPair());
     } else {
         if ($strSubAction = 'viewnew') {
             if (!$objUser) {
                 throw new Exception('exception_accessdenied');
             }
             $arrComments = clsComment::getNewComments($objUser);
             foreach ($arrComments as $objComment) {
                 $objComment = new clsComment($objComment->get('id'));
                 $objPicture = new clsPicture($objComment->get('picture_id'));
                 $objCommentTemplate = new clsTemplate('newcomment');
                 $objCommentTemplate->setText('IMAGE', "<a href='index.php?action=picture&" . $objPicture->getIDPair() . "'>" . $objPicture->getHtmlThumbnail(128, 128) . "</a>");
                 $objCommentTemplate->setText('TITLE', $objComment->get('title') . ' ' . $objComment->getNewIcon($objUser));
                 $objCommentTemplate->setText('USERNAME', $objComment->getUsername());