function WriteComment($Comment, $Sender, $Session, $CurrentOffset) { static $UserPhotoFirst = NULL; if ($UserPhotoFirst === NULL) { $UserPhotoFirst = C('Vanilla.Comment.UserPhotoFirst', TRUE); } $Author = Gdn::UserModel()->GetID($Comment->InsertUserID); //UserBuilder($Comment, 'Insert'); $Permalink = GetValue('Url', $Comment, '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID); // Set CanEditComments (whether to show checkboxes) if (!property_exists($Sender, 'CanEditComments')) { $Sender->CanEditComments = $Session->CheckPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && C('Vanilla.AdminCheckboxes.Use'); } // Prep event args $CssClass = CssClass($Comment, $CurrentOffset); $Sender->EventArguments['Comment'] =& $Comment; $Sender->EventArguments['Author'] =& $Author; $Sender->EventArguments['CssClass'] =& $CssClass; // DEPRECATED ARGUMENTS (as of 2.1) $Sender->EventArguments['Object'] =& $Comment; $Sender->EventArguments['Type'] = 'Comment'; // First comment template event $Sender->FireEvent('BeforeCommentDisplay'); ?> <li class="<?php echo $CssClass; ?> " id="<?php echo 'Comment_' . $Comment->CommentID; ?> "> <div class="Comment"> <?php // Write a stub for the latest comment so it's easy to link to it from outside. if ($CurrentOffset == Gdn::Controller()->Data('_LatestItem')) { echo '<span id="latest"></span>'; } ?> <div class="Options"> <?php WriteCommentOptions($Comment); ?> </div> <?php $Sender->FireEvent('BeforeCommentMeta'); ?> <div class="Item-Header CommentHeader"> <div class="AuthorWrap"> <span class="Author"> <?php if ($UserPhotoFirst) { echo UserPhoto($Author); echo UserAnchor($Author, 'Username'); } else { echo UserAnchor($Author, 'Username'); echo UserPhoto($Author); } echo FormatMeAction($Comment); ?> </span> <span class="AuthorInfo"> <?php echo ' ' . WrapIf(htmlspecialchars(GetValue('Title', $Author)), 'span', array('class' => 'MItem AuthorTitle')); $Sender->FireEvent('AuthorInfo'); ?> </span> </div> <div class="Meta CommentMeta CommentInfo"> <span class="MItem DateCreated"> <?php echo Anchor(Gdn_Format::Date($Comment->DateInserted, 'html'), $Permalink, 'Permalink', array('name' => 'Item_' . $CurrentOffset, 'rel' => 'nofollow')); ?> </span> <?php // Include source if one was set if ($Source = GetValue('Source', $Comment)) { echo Wrap(sprintf(T('via %s'), T($Source . ' Source', $Source)), 'span', array('class' => 'MItem Source')); } $Sender->FireEvent('CommentInfo'); $Sender->FireEvent('InsideCommentMeta'); // DEPRECATED $Sender->FireEvent('AfterCommentMeta'); // DEPRECATED // Include IP Address if we have permission if ($Session->CheckPermission('Garden.Moderation.Manage')) { echo Wrap(IPAnchor($Comment->InsertIPAddress), 'span', array('class' => 'MItem IPAddress')); } ?> </div> </div> <div class="Item-BodyWrap"> <div class="Item-Body"> <div class="Message"> <?php echo FormatBody($Comment); ?> </div> <?php $Sender->FireEvent('AfterCommentBody'); WriteReactions($Comment); ?> </div> </div> </div> </li> <?php $Sender->FireEvent('AfterComment'); }
?> <dt class="IP"><?php echo T('Register IP'); ?> </dt> <dd class="IP"><?php $IP = IPAnchor($this->User->InsertIPAddress); echo $IP ? $IP : T('n/a'); ?> </dd> <dt class="IP"><?php echo T('Last IP'); ?> </dt> <dd class="IP"><?php $IP = IPAnchor($this->User->LastIPAddress); echo $IP ? $IP : T('n/a'); ?> </dd> <?php } if ($this->User->InviteUserID > 0) { $Inviter = new stdClass(); $Inviter->UserID = $this->User->InviteUserID; $Inviter->Name = $this->User->InviteName; echo '<dt class="Invited">' . T('Invited by') . '</dt> <dd class="Invited">' . UserAnchor($Inviter) . '</dd>'; } $this->FireEvent('OnBasicInfo'); ?> </dl>
/** * $Object is either a Comment or the original Discussion. */ function WriteComment($Object, $Sender, $Session, $CurrentOffset) { $Alt = $CurrentOffset % 2 != 0; $Author = UserBuilder($Object, 'Insert'); $Type = property_exists($Object, 'CommentID') ? 'Comment' : 'Discussion'; $Sender->EventArguments['Object'] = $Object; $Sender->EventArguments['Type'] = $Type; $Sender->EventArguments['Author'] = $Author; $CssClass = 'Item Comment'; $Permalink = GetValue('Url', $Object, FALSE); if (!property_exists($Sender, 'CanEditComments')) { $Sender->CanEditComments = $Session->CheckPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && C('Vanilla.AdminCheckboxes.Use'); } if ($Type == 'Comment') { $Sender->EventArguments['Comment'] = $Object; $Id = 'Comment_' . $Object->CommentID; if ($Permalink === FALSE) { $Permalink = '/discussion/comment/' . $Object->CommentID . '/#Comment_' . $Object->CommentID; } } else { $Sender->EventArguments['Discussion'] = $Object; $CssClass .= ' FirstComment'; $Id = 'Discussion_' . $Object->DiscussionID; if ($Permalink === FALSE) { $Permalink = '/discussion/' . $Object->DiscussionID . '/' . Gdn_Format::Url($Object->Name) . '/p1'; } } $Sender->EventArguments['CssClass'] =& $CssClass; $Sender->Options = ''; $CssClass .= $Object->InsertUserID == $Session->UserID ? ' Mine' : ''; if ($Alt) { $CssClass .= ' Alt'; } $Alt = !$Alt; $Sender->FireEvent('BeforeCommentDisplay'); ?> <li class="<?php echo $CssClass; ?> " id="<?php echo $Id; ?> "> <div class="Comment"> <div class="Meta"> <?php $Sender->FireEvent('BeforeCommentMeta'); ?> <span class="Author"> <?php echo UserPhoto($Author); echo UserAnchor($Author); ?> </span> <span class="MItem DateCreated"> <?php echo Anchor(Gdn_Format::Date($Object->DateInserted), $Permalink, 'Permalink', array('name' => 'Item_' . ($CurrentOffset + 1), 'rel' => 'nofollow')); ?> </span> <?php if ($Source = GetValue('Source', $Object)) { echo sprintf(T('via %s'), T($Source . ' Source', $Source)); } WriteOptionList($Object, $Sender, $Session); ?> <div class="CommentInfo"> <?php $Sender->FireEvent('CommentInfo'); if ($Session->CheckPermission('Garden.Moderation.Manage')) { echo ' <span>' . IPAnchor($Object->InsertIPAddress) . '<span class="MItem"> '; } ?> </div> <?php $Sender->FireEvent('AfterCommentMeta'); ?> </div> <div class="Message"> <?php $Sender->FireEvent('BeforeCommentBody'); $Object->FormatBody = Gdn_Format::To($Object->Body, $Object->Format); $Sender->FireEvent('AfterCommentFormat'); $Object = $Sender->EventArguments['Object']; echo $Object->FormatBody; ?> </div> <?php $Sender->FireEvent('AfterCommentBody'); ?> </div> </li> <?php $Sender->FireEvent('AfterComment'); }
$Url = "/discussion/{$Row['RecordID']}/x/p1"; break; case 'comment': $Url = "/discussion/comment/{$Row['RecordID']}#Comment_{$Row['RecordID']}"; } } echo '<div"><span class="Expander">', $this->FormatContent($Row), '</span></div>'; // Write the other record counts. echo OtherRecordsMeta($Row['Data']); echo '<div class="Meta-Container">'; echo '<span class="Tags">'; echo '<span class="Tag Tag-' . $Row['Operation'] . '">' . T($Row['Operation']) . '</span> '; echo '<span class="Tag Tag-' . $RecordLabel . '">' . Anchor(T($RecordLabel), $Url) . '</span> '; echo '</span>'; if ($Row['RecordIPAddress']) { echo ' <span class="Meta">', '<span class="Meta-Label">IP</span> ', IPAnchor($Row['RecordIPAddress'], 'Meta-Value'), '</span> '; } if ($Row['CountGroup'] > 1) { echo ' <span class="Meta">', '<span class="Meta-Label">' . T('Reported') . '</span> ', Wrap(Plural($Row['CountGroup'], '%s time', '%s times'), 'span', 'Meta-Value'), '</span> '; // echo ' ', sprintf(T('%s times'), $Row['CountGroup']); } $RecordUser = Gdn::UserModel()->GetID($Row['RecordUserID'], DATASET_TYPE_ARRAY); if ($Row['RecordName']) { echo ' <span class="Meta">', '<span class="Meta-Label">' . sprintf('%s by', T($RecordLabel)) . '</span> ', UserAnchor($Row, 'Meta-Value', 'Record'); if ($RecordUser['Banned']) { echo ' <span class="Tag Tag-Ban">' . T('Banned') . '</span>'; } echo ' <span class="Count">' . Plural($RecordUser['CountDiscussions'] + $RecordUser['CountComments'], '%s post', '%s posts') . '</span>'; echo '</span> '; } // Write custom meta information.
?> <?php // Include source if one was set if ($Source = val('Source', $Discussion)) { echo ' ' . Wrap(sprintf(t('via %s'), t($Source . ' Source', $Source)), 'span', array('class' => 'MItem MItem-Source')) . ' '; } // Category if (c('Vanilla.Categories.Use')) { echo ' <span class="MItem Category">'; echo ' ' . t('in') . ' '; echo anchor(htmlspecialchars($this->data('Discussion.Category')), CategoryUrl($this->data('Discussion.CategoryUrlCode'))); echo '</span> '; } // Include IP Address if we have permission if ($Session->checkPermission('Garden.PersonalInfo.View')) { echo wrap(IPAnchor($Discussion->InsertIPAddress), 'span', array('class' => 'MItem IPAddress')); } $this->fireEvent('DiscussionInfo'); $this->fireEvent('AfterDiscussionMeta'); // DEPRECATED ?> </div> </div> <?php $this->fireEvent('BeforeDiscussionBody'); ?> <div class="Item-BodyWrap"> <div class="Item-Body"> <div class="Message"> <?php echo FormatBody($Discussion);