Exemplo n.º 1
0
    } 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());
                    $objCommentTemplate->setText('DATE', time_to_text(strtotime($objComment->get('date'))));
                    $objCommentTemplate->setText('TEXT', bbcode_format($objComment->get('text')));
                    print $objCommentTemplate->get();
                    /* Mark the comment as viewed */
                    $objComment->setViewed($objUser);
                }
            }
        }
    }
}