function GetDiscussion(&$Context, $Discussion, $FirstRow = "0")
{
    // Prefix the discussion name with the whispered-to username if this is a whisper
    if ($Discussion->WhisperUserID > 0) {
        $Discussion->Name = @$Discussion->WhisperUsername . ": " . $Discussion->Name;
    }
    $UnreadQS = $Context->Session->User->Settings['comments_order'] == 'asc' ? GetUnreadQuerystring($Discussion) : '';
    $LastQS = $Context->Session->User->Settings['comments_order'] == 'asc' ? GetLastCommentQuerystring($Discussion) : '';
    $sReturn = "<dl class=\"Discussion" . $Discussion->Status . ($FirstRow ? " FirstDiscussion" : "") . ($Discussion->CountComments == 1 ? " NoReplies" : "") . (agUSE_CATEGORIES ? " Category_" . $Discussion->CategoryID : "") . "\">\r\n\t\t<dt class=\"DataItemLabel DiscussionTopicLabel\">" . $Context->GetDefinition("DiscussionTopic") . "</dt>\r\n\t\t<dd class=\"DataItem DiscussionTopic\">" . DiscussionPrefix($Discussion) . "<a href=\"comments.php?DiscussionID=" . $Discussion->DiscussionID . ($Context->Session->User->Setting("JumpToLastReadComment", 1) ? $UnreadQS : "") . "\">" . $Discussion->Name . "</a></dd>";
    if (agUSE_CATEGORIES) {
        $sReturn .= "\r\n\t\t\t<dt class=\"MetaItemLabel DiscussionInformationLabel DiscussionCategoryLabel\">" . $Context->GetDefinition("Category") . "</dt>\r\n\t\t\t<dd class=\"MetaItem DiscussionInformation DiscussionCategory\"><a href=\"./?CategoryID=" . $Discussion->CategoryID . "\">" . $Discussion->Category . "</a></dd>\r\n\t\t\t";
    }
    $sReturn .= "<dt class=\"MetaItemLabel DiscussionInformationLabel StarterLabel\"><a href=\"./comments.php?DiscussionID=" . $Discussion->DiscussionID . "#Item_1\">" . $Context->GetDefinition("StartedBy") . "</a></dt>\r\n\t\t<dd class=\"MetaItem DiscussionInformation Starter\"><a href=\"./account.php?u=" . $Discussion->AuthUserID . "\">" . $Discussion->AuthUsername . "</a></dd>\r\n\t\t<dt class=\"MetaItemLabel DiscussionInformationLabel CommentCountLabel\">" . $Context->GetDefinition("Comments") . "</dt>\r\n\t\t<dd class=\"MetaItem DiscussionInformation CommentCount\">" . $Discussion->CountComments . "</dd>\r\n\t\t<dt class=\"MetaItemLabel DiscussionInformationLabel LastReplierLabel\"><a href=\"./comments.php?DiscussionID=" . $Discussion->DiscussionID . $LastQS . "\">" . $Context->GetDefinition("LastCommentBy") . "</a></dt>\r\n\t\t<dd class=\"MetaItem DiscussionInformation LastReplier\"><a href=\"./account.php?u=" . $Discussion->LastUserID . "\">" . $Discussion->LastUsername . "</a></dd>\r\n\t\t<dt class=\"MetaItemLabel DiscussionInformationLabel LastActiveLabel\"><a href=\"./comments.php?DiscussionID=" . $Discussion->DiscussionID . $LastQS . "\">" . $Context->GetDefinition("LastActive") . "</a></dt>\r\n\t\t<dd class=\"MetaItem DiscussionInformation LastActive\">" . TimeDiff($Discussion->DateLastActive, mktime()) . "</dd>";
    if ($Context->Session->UserID > 0) {
        $sReturn .= "<dt class=\"MetaItemLabel DiscussionInformationLabel NewCommentCountLabel" . ($Discussion->NewComments > 0 ? " NewCommentsPresentLabel" : "") . "\"><a href=\"comments.php?DiscussionID=" . $Discussion->DiscussionID . $UnreadQS . "\">" . $Context->GetDefinition("New") . "</a></dt>\r\n\t\t\t<dd class=\"MetaItem DiscussionInformation NewCommentCount" . ($Discussion->NewComments > 0 ? " NewCommentsPresent" : "") . "\"><a href=\"comments.php?DiscussionID=" . $Discussion->DiscussionID . $UnreadQS . "\">" . $Discussion->NewComments . "</a></dd>";
    }
    $sReturn .= "</dl>\n";
    return $sReturn;
}
<?php

// Note: This file is included from the library/Vanilla/Vanilla.Control.SearchForm.php
// class and also from the library/Vanilla/Vanilla.Control.DiscussionForm.php's
// themes/discussions.php include template.
$UnreadUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref);
$NewUrl = GetUnreadQuerystring($Discussion, $this->Context->Configuration, 1);
$LastUrl = GetLastCommentQuerystring($Discussion, $this->Context->Configuration, $CurrentUserJumpToLastCommentPref);
$this->DelegateParameters['Discussion'] =& $Discussion;
$this->DelegateParameters['DiscussionList'] =& $DiscussionList;
$DiscussionList .= '
<li id="Discussion_' . $Discussion->DiscussionID . '" class="Discussion' . $Discussion->Status . ($Discussion->CountComments == 1 ? ' NoReplies' : '') . ($this->Context->Configuration['USE_CATEGORIES'] ? ' Category_' . $Discussion->CategoryID : '') . ($Alternate ? ' Alternate' : '') . '">';
$this->CallDelegate('PreDiscussionOptionsRender');
$DiscussionList .= '<ul>
		<li class="DiscussionType">
			<span>' . $this->Context->GetDefinition('DiscussionType') . '</span>' . DiscussionPrefix($this->Context, $Discussion) . '
		</li>
		<li class="DiscussionTopic">
			<span>' . $this->Context->GetDefinition('DiscussionTopic') . '</span><a href="' . $UnreadUrl . '">' . $Discussion->Name . '</a>
		</li>
		';
if ($this->Context->Configuration['USE_CATEGORIES']) {
    $DiscussionList .= '
			<li class="DiscussionCategory">
				<span>' . $this->Context->GetDefinition('Category') . ' </span><a href="' . GetUrl($this->Context->Configuration, 'index.php', '', 'CategoryID', $Discussion->CategoryID) . '">' . $Discussion->Category . '</a>
			</li>
			';
}
$DiscussionList .= '<li class="DiscussionStarted">
			<span><a href="' . GetUrl($this->Context->Configuration, 'comments.php', '', 'DiscussionID', $Discussion->DiscussionID, '', '#Item_1', CleanupString($Discussion->Name) . '/') . '">' . $this->Context->GetDefinition('StartedBy') . '</a> </span><a href="' . GetUrl($this->Context->Configuration, 'account.php', '', 'u', $Discussion->AuthUserID) . '">' . $Discussion->AuthUsername . '</a>
		</li>
 function Prefix()
 {
     if ($this->Context->WarningCollector->Count() > 0) {
         $sReturn = "<div class=\"ErrorContainer\">\r\n\t\t\t\t<div class=\"ErrorTitle\">" . $this->Context->GetDefinition("ErrorTitle") . "</div>" . $this->Context->WarningCollector->GetMessages() . "</div>";
     } else {
         $PageDetails = $this->pl->GetPageDetails($this->Context);
         $PageList = $this->pl->GetNumericList();
         // Format the discussion information
         $this->Discussion->ForceNameSpaces();
         $sReturn = "<a class=\"PageJump Bottom\" href=\"#pgbottom\">" . $this->Context->GetDefinition("BottomOfPage") . "</a>" . "<div class=\"Title\">";
         if (agUSE_CATEGORIES) {
             $sReturn .= "<a href=\"./?CategoryID=" . $this->Discussion->CategoryID . "\">" . $this->Discussion->Category . "</a>:<br/> ";
         }
         $sReturn .= DiscussionPrefix($this->Discussion) . " ";
         if ($this->Discussion->WhisperUserID > 0) {
             $sReturn .= $this->Discussion->WhisperUsername . ": ";
         }
         $sReturn .= $this->Discussion->Name . "</div>" . $PageList . "<div class=\"PageDetails\">" . $PageDetails . "</div>";
         $Comment = $this->Context->ObjectFactory->NewObject($Context, "Comment");
         $RowNumber = 0;
         $CommentID = 0;
         if ($this->Context->Session->User->Settings['comments_order'] == 'desc') {
             $LastViewCountComments = $this->CommentDataCount - $this->Discussion->LastViewCountComments;
         } else {
             $LastViewCountComments = $this->Discussion->LastViewCountComments;
         }
         echo '<!-- $LastViewCountComments is: ' . $LastViewCountComments . ',' . $this->Context->Session->User->Settings['comments_order'] . '-->';
         $sReturn .= "<div class=\"CommentGrid\" id=\"CommentGrid\">\n";
         while ($Row = $this->Context->Database->GetRow($this->CommentData)) {
             $RowNumber++;
             $Comment->Clear();
             $Comment->GetPropertiesFromDataSet($Row, $this->Context->Session->UserID);
             $ShowHtml = $Comment->FormatPropertiesForDisplay($this->Context);
             $sReturn .= "<a name=\"Comment_" . $Comment->CommentID . "\"></a>\r\n\t\t\t\t\t\t<a name=\"Item_" . $RowNumber . "\"></a>\r\n\t\t\t\t\t\t<div class=\"Comment " . $Comment->Status . ($RowNumber == 1 ? " FirstComment" : "") . "\">";
             $sReturn .= "<div class=\"CommentHeader\">\n";
             if ($Comment->Deleted) {
                 $sReturn .= "<div class=\"ErrorContainer CommentHidden\">\r\n\t\t\t\t\t\t\t\t<div class=\"Error\">" . $this->Context->GetDefinition("CommentHiddenOn") . " " . date("F jS Y \\a\\t g:ia", $Comment->DateDeleted) . " " . $this->Context->GetDefinition("By") . " " . $Comment->DeleteUsername . ".</div>\r\n\t\t\t\t\t\t\t</div>";
             }
             $ShowIcon = 0;
             if ($this->Context->Session->User->Setting("HtmlOn", 1)) {
                 $ShowIcon = 1;
             }
             $sReturn .= "<div onclick=\"toggleCommentBody('" . $Comment->CommentID . "')\" class=\"ShowHide\" id=\"CommBodySwitcher_" . $Comment->CommentID . "\">";
             if ($this->Context->Session->User->Settings['comments_order'] == 'asc') {
                 $sReturn .= ($RowNumber >= $LastViewCountComments ? "Hide" : "Show") . "</div>\n";
             } else {
                 $sReturn .= ($RowNumber <= $LastViewCountComments ? "Hide" : "Show") . "</div>\n";
             }
             $sReturn .= "<div class=\"CommentAuthor" . ($ShowIcon ? " CommentAuthorWithIcon" : "") . "\">";
             if ($ShowIcon) {
                 $sReturn .= "<span class=\"CommentIcon\" style=\"background-image:url('" . ($Comment->AuthIcon !== "" ? $Comment->AuthIcon : "images/def_icon.png") . "')\"></span>";
             }
             // 						echo "<!-- icon is: [".$Comment->AuthIcon."]-->";
             $sReturn .= "<a href=\"account.php?u=" . $Comment->AuthUserID . "\">" . $Comment->AuthFullName . "</a></div>";
             if ($Comment->WhisperUserID > 0) {
                 $sReturn .= "<div class=\"CommentWhisper\">" . $this->Context->GetDefinition("To") . " ";
                 if ($Comment->WhisperUserID == $this->Context->Session->UserID && $Comment->AuthUserID == $this->Context->Session->UserID) {
                     $sReturn .= $this->Context->GetDefinition("Yourself");
                 } elseif ($Comment->WhisperUserID == $this->Context->Session->UserID) {
                     $sReturn .= $this->Context->GetDefinition("You");
                 } else {
                     $this->Context->UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, "UserManager");
                     $WhisperUser = $this->Context->UserManager->GetUserById($Comment->WhisperUserID);
                     $sReturn .= $WhisperUser->FullName;
                 }
                 $sReturn .= "</div>\n";
             }
             $sReturn .= "<div class=\"CommentTime\">#" . $Comment->CommentID . " " . TimeDiff($Comment->DateCreated);
             if ($Comment->DateEdited != "") {
                 $sReturn .= " <em>" . $this->Context->GetDefinition("Edited") . "</em>\n";
             }
             $sReturn .= "</div>\r\n\t\t\t\t\t<div class=\"CommentOptions\">";
             if ($this->Context->Session->UserID > 0) {
                 if ($this->Context->Session->User->CanViewIps) {
                     $sReturn .= "<div class=\"CommentIp\">" . $this->Context->GetDefinition("CommentPostedFrom") . " " . $Comment->RemoteIp . "</div>\n";
                 }
                 if ($Comment->AuthUserID == $this->Context->Session->UserID || $this->Context->Session->User->AdminCategories) {
                     if (!$this->Discussion->Closed && $this->Discussion->Active || $this->Context->Session->User->AdminCategories) {
                         $sReturn .= "<div class=\"CommentEdit\"><a href=\"post.php?CommentID=" . $Comment->CommentID . "\">" . $this->Context->GetDefinition("Edit") . "</a></div>\n";
                     }
                     if ($this->Context->Session->User->AdminCategories) {
                         $sReturn .= "<div class=\"CommentHide\"><a href=\"javascript:ManageComment('" . ($Comment->Deleted ? "0" : "1") . "', '" . $this->Discussion->DiscussionID . "', '" . $Comment->CommentID . "', '" . $this->Context->GetDefinition("ShowConfirm") . "', '" . $this->Context->GetDefinition("HideConfirm") . "');\">" . $this->Context->GetDefinition($Comment->Deleted ? "Show" : "Hide") . "</a></div>\n";
                     }
                 }
             }
             $sReturn .= "</div>";
             if ($Comment->AuthRoleDesc != "") {
                 $sReturn .= "<div class=\"CommentNotice\">" . $Comment->AuthRoleDesc . "</div>";
             }
             $sReturn .= "</div><div class=\"";
             if ($this->Context->Session->User->Settings['comments_order'] == 'asc') {
                 $sReturn .= ($RowNumber >= $LastViewCountComments ? "CommentBody" : "CommentBodyHidden") . "\" id=\"CommentBody_" . $Comment->CommentID . "\">";
             } else {
                 $sReturn .= ($RowNumber <= $LastViewCountComments ? "CommentBody" : "CommentBodyHidden") . "\" id=\"CommentBody_" . $Comment->CommentID . "\">";
             }
             if ($this->Context->Session->User->Settings['comments_order'] == 'asc') {
                 $sReturn .= $RowNumber >= $LastViewCountComments ? $Comment->Body . "<p><input type=\"button\"  onclick=\"addQuoteToCommentBody(" . $Comment->CommentID . ")\" class=\"Button QuoteButton\" id=\"CommentQuote_" . $Comment->CommentID . "\" value=\"" . $this->Context->GetDefinition("Quote") . "\" /></p>" : "";
             } else {
                 $sReturn .= $RowNumber <= $LastViewCountComments ? $Comment->Body . "<p><input type=\"button\"  onclick=\"addQuoteToCommentBody(" . $Comment->CommentID . ")\" class=\"Button QuoteButton\" id=\"CommentQuote_" . $Comment->CommentID . "\" value=\"" . $this->Context->GetDefinition("Quote") . "\" /></p>" : "";
             }
             $sReturn .= "</div>";
             //id=\"Comment_".$Comment->CommentID."\">".$Comment->Body."</div>";
             if ($Comment->WhisperUserID > 0 && $Comment->WhisperUserID == $this->Context->Session->UserID) {
                 $sReturn .= "<div class=\"WhisperBack\"><a href=\"Javascript:WhisperBack('" . $Comment->DiscussionID . "', '" . str_replace("'", "\\'", $Comment->AuthUsername) . "');\">" . $this->Context->GetDefinition("WhisperBack") . "</a></div>";
             }
             $sReturn .= "</div>";
         }
         $sReturn .= "</div>\n" . $PageList . "<div class=\"PageDetails\">" . $PageDetails . "</div>";
         if ($this->ShowForm) {
             $sReturn .= "<a name=\"addcomments\"></a>\r\n\t\t\t\t\t<div class=\"Title AddCommentsTitle\">" . $this->Context->GetDefinition("AddYourComments") . "</div>";
         }
     }
     return $sReturn;
 }
Beispiel #4
0
// Note: This file is included from the library/Vanilla/Vanilla.Control.CommentGrid.php class.
$CommentList = '';
if ($this->Context->WarningCollector->Count() > 0) {
    $CommentList .= '<div class="ErrorContainer">
		<div class="ErrorTitle">' . $this->Context->GetDefinition('ErrorTitle') . '</div>' . $this->Context->WarningCollector->GetMessages() . '</div>';
} else {
    $PageDetails = $this->pl->GetPageDetails($this->Context);
    $PageList = $this->pl->GetNumericList();
    $SessionPostBackKey = $this->Context->Session->GetCsrfValidationKey();
    $CommentList .= '<div class="ContentInfo Top">
		<h1>';
    if ($this->Context->Configuration['USE_CATEGORIES']) {
        $CommentList .= '<a href="' . GetUrl($this->Context->Configuration, 'index.php', '', 'CategoryID', $this->Discussion->CategoryID) . '">' . $this->Discussion->Category . '</a>: ';
    }
    $CommentList .= DiscussionPrefix($this->Context, $this->Discussion) . ' ';
    if ($this->Discussion->WhisperUserID > 0) {
        $CommentList .= $this->Discussion->WhisperUsername . ': ';
    }
    $CommentList .= $this->Discussion->Name . '</h1>
		<a href="#pgbottom">' . $this->Context->GetDefinition('BottomOfPage') . '</a>
		<div class="PageInfo">
			<p>' . $PageDetails . '</p>
			' . $PageList . '
		</div>
	</div>
	<div id="ContentBody">
		<ol id="Comments">';
    $Comment = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Comment');
    $RowNumber = 0;
    $CommentID = 0;