Exemplo n.º 1
0
     $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());
                 $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);
             }
         }
     }
Exemplo n.º 2
0
<?php

require_once 'cls/clsComment.php';
require_once 'cls/clsGroup.php';
require_once 'cls/clsPicture.php';
if ($objUser) {
    print "Welcome back, <a href='index.php?action=members&subaction=view&" . $objUser->getIDPair() . "'>" . $objUser->get('username') . "</a>! <br>";
    print "You have <a href='index.php?action=comment&subaction=viewnew'><strong>" . sizeof(clsComment::getNewComments($objUser)) . "</strong> unread comments</a> on your pictures.<br>";
    print "There are <a href='index.php?action=albums&subaction=newpictures'><strong>" . sizeof(clsPicture::getNewPictures($objUser)) . "</strong> new pictures</a>.<br>";
    if ($objUser) {
        $intNum = sizeof(clsGroup::getInvitations($objUser));
        if ($intNum > 0) {
            print "You have invitations to <a href='index.php?action=groups&subaction=invitations'><strong>{$intNum} groups</strong></a>.<br>";
        }
    }
} else {
    print "Welcome, guest! You can <a href='index.php?action=login'>log in</a> or <a href='index.php?action=members&subaction=view'>register</a>.<br><br>";
}