Beispiel #1
0
 $objPictureTemplate->setText('PICTURE', $objPicture->getHtml());
 $objPictureTemplate->setText('CAPTION', "<span id='more' style='display: none;'>" . bbcode_format($objPicture->get('caption')) . "<br><a href='#' onClick='\$(\"more\").style.display=\"none\"; \$(\"less\").style.display=\"block\"'>Less</a></span>");
 $objPictureTemplate->setText('CAPTION', "<span id='less' style='display: inline;'>" . cut_text(bbcode_format($objPicture->get('caption')), MAX_CAPTION, "<br><a href='#' onClick='\$(\"less\").style.display=\"none\"; \$(\"more\").style.display=\"block\"'>More</a></span>"));
 $strCaption = cut_text(bbcode_format($objPicture->get('caption')), MAX_CAPTION, " (<a href='index.php?action=picture&all=1&" . $objPicture->getIDPair() . "'>more</a>)");
 /* Voting code. */
 if (clsVote::canVote($objPicture, $objUser, $_SERVER['REMOTE_ADDR'])) {
     $objPictureTemplate->setText('RATING', clsVote::getVoteField($objPicture));
 } else {
     if (clsVote::getVoteCount($objPicture)) {
         $objPictureTemplate->setText('RATING', "Ranked <span class='rating'>" . clsVote::getRating($objPicture) . "</span> / " . clsVote::getMaxRating() . " (" . clsVote::getVoteCount($objPicture) . " votes)");
     }
 }
 /* Commenting code. */
 $arrComments = $objPicture->getComments();
 foreach ($arrComments as $objComment) {
     $objComment = new clsComment($objComment->get('id'));
     $objCommentTemplate = new clsTemplate('comment');
     $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')));
     if ($objComment->canEdit($objUser)) {
         $objCommentTemplate->setText('TITLE', "<span class='editdelete'> [<a href='index.php?action=comment&subaction=edit&" . $objPicture->getIDPair() . "&" . $objComment->getIDPair() . "'>edit</a>]</span>");
     }
     if ($objComment->canDelete($objUser)) {
         $objCommentTemplate->setText('TITLE', "<span class='editdelete'> [<a href='index.php?action=comment&subaction=delete&" . $objPicture->getIDPair() . "&" . $objComment->getIDPair() . "'>delete</a>]</span>");
     }
     $objPictureTemplate->setText('COMMENTS', $objCommentTemplate->get());
     /* Mark the comment as viewed */
     $objComment->setViewed($objUser);
 }
Beispiel #2
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);
                }
            }
        }
    }
}
Beispiel #3
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>";
}