| 1 | <?php
|
|---|
| 2 | /**
|
|---|
| 3 | * Show Comments on an individual post
|
|---|
| 4 | *
|
|---|
| 5 | * PHP version 5
|
|---|
| 6 | *
|
|---|
| 7 | * LICENSE: Hotaru CMS is free software: you can redistribute it and/or
|
|---|
| 8 | * modify it under the terms of the GNU General Public License as
|
|---|
| 9 | * published by the Free Software Foundation, either version 3 of
|
|---|
| 10 | * the License, or (at your option) any later version.
|
|---|
| 11 | *
|
|---|
| 12 | * Hotaru CMS is distributed in the hope that it will be useful, but WITHOUT
|
|---|
| 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|---|
| 14 | * FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 15 | *
|
|---|
| 16 | * You should have received a copy of the GNU General Public License along
|
|---|
| 17 | * with Hotaru CMS. If not, see http://www.gnu.org/licenses/.
|
|---|
| 18 | *
|
|---|
| 19 | * @category Content Management System
|
|---|
| 20 | * @package HotaruCMS
|
|---|
| 21 | * @author Nick Ramsay <admin@hotarucms.org>
|
|---|
| 22 | * @copyright Copyright (c) 2009, Hotaru CMS
|
|---|
| 23 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
|---|
| 24 | * @link http://www.hotarucms.org/
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | $display = ($h->comment->votes_down >= $h->vars['comment_hide']) ? 'display: none;' : ''; // comments are shown unless they have X negative votes
|
|---|
| 28 | ?>
|
|---|
| 29 | <a id="c<?php echo $h->comment->id; ?>"></a>
|
|---|
| 30 |
|
|---|
| 31 | <?php if ($h->comment->avatarSize < 16) {$comment_header_size=16;} else { $comment_header_size= $h->comment->avatarSize; } ?>
|
|---|
| 32 | <div class="comment" style="margin-left: <?php echo $h->comment->depth * 2.0; ?>em;">
|
|---|
| 33 |
|
|---|
| 34 | <div class="comment_header" style="height:<?php echo $comment_header_size; ?>px;">
|
|---|
| 35 | <div class="comment_header_left">
|
|---|
| 36 | <?php // Show avatars if enabled (requires an avatars plugin)
|
|---|
| 37 | if ($h->comment->avatars == 'checked') {
|
|---|
| 38 | if($h->isActive('avatar')) {
|
|---|
| 39 | $h->setAvatar($h->comment->author, $h->comment->avatarSize);
|
|---|
| 40 | echo $h->wrapAvatar();
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 | ?>
|
|---|
| 44 | <div class="comment_author">
|
|---|
| 45 | <?php
|
|---|
| 46 | $username = $h->getUserNameFromId($h->comment->author);
|
|---|
| 47 | echo $h->lang['comments_written_by'] . " ";
|
|---|
| 48 | echo "<a href='" . $h->url(array('user' => $username)) . "'>" . $username . "</a>, ";
|
|---|
| 49 | echo time_difference(unixtimestamp($h->comment->date), $h->lang) . " ";
|
|---|
| 50 | echo $h->lang['comments_time_ago'] . ".";
|
|---|
| 51 | if ($display) { echo "<a href='#' class='comment_show_hide'>" . $h->lang['comments_show_hide'] . "</a>"; }
|
|---|
| 52 | ?>
|
|---|
| 53 | </div>
|
|---|
| 54 | </div>
|
|---|
| 55 |
|
|---|
| 56 | <?php // Show votes if enabled (requires a comment voting plugin)
|
|---|
| 57 | if ($h->comment->voting == 'checked') {
|
|---|
| 58 | $h->pluginHook('show_comments_votes');
|
|---|
| 59 | }
|
|---|
| 60 | ?>
|
|---|
| 61 | </div>
|
|---|
| 62 |
|
|---|
| 63 | <div class="clear"></div>
|
|---|
| 64 |
|
|---|
| 65 | <div class="comment_main" style="<?php echo $display; ?>">
|
|---|
| 66 | <div class="comment_content">
|
|---|
| 67 | <?php
|
|---|
| 68 | $result = $h->pluginHook('show_comments_content');
|
|---|
| 69 | if (!isset($result) || !is_array($result)) {
|
|---|
| 70 | echo nl2br($h->comment->content);
|
|---|
| 71 | }
|
|---|
| 72 | ?>
|
|---|
| 73 | </div>
|
|---|
| 74 |
|
|---|
| 75 | <div class="comment_reply_wrapper">
|
|---|
| 76 |
|
|---|
| 77 | <?php // REPLY LINK - (if logged in) AND (can comment) AND (form is turned on)...
|
|---|
| 78 | if ($h->currentUser->loggedIn
|
|---|
| 79 | && ($h->currentUser->getPermission('can_comment') != 'no')
|
|---|
| 80 | && ($h->comment->thisForm == 'open')) { ?>
|
|---|
| 81 |
|
|---|
| 82 | <?php if ($h->comment->depth < $h->comment->levels-1) { // No nesting after X levels (minus 1 because nestings tarts at 0) ?>
|
|---|
| 83 | <a href='#' class='comment_reply_link' onclick="reply_comment(
|
|---|
| 84 | '<?php echo BASEURL; ?>',
|
|---|
| 85 | '<?php echo $h->comment->id; ?>',
|
|---|
| 86 | '<?php echo $h->lang['comments_form_submit']; ?>');
|
|---|
| 87 | return false;" ><?php echo $h->lang['comments_reply_link']; ?></a>
|
|---|
| 88 | <?php } ?>
|
|---|
| 89 | <?php } ?>
|
|---|
| 90 |
|
|---|
| 91 | <?php // EDIT LINK - (if comment owner AND permission to edit own comments) OR (permission to edit ALL comments)...
|
|---|
| 92 | if (($h->currentUser->id == $h->comment->author && ($h->currentUser->getPermission('can_edit_comments') == 'own'))
|
|---|
| 93 | || ($h->currentUser->getPermission('can_edit_comments') == 'yes')) { ?>
|
|---|
| 94 | <a href='#' class='comment_edit_link' onclick="edit_comment(
|
|---|
| 95 | '<?php echo BASEURL; ?>',
|
|---|
| 96 | '<?php echo $h->comment->id; ?>',
|
|---|
| 97 | '<?php echo urlencode($h->comment->content); ?>',
|
|---|
| 98 | '<?php echo $h->lang['comments_form_edit']; ?>');
|
|---|
| 99 | return false;" ><?php echo $h->lang['comments_edit_link']; ?></a>
|
|---|
| 100 | <?php } ?>
|
|---|
| 101 | </div>
|
|---|
| 102 | </div>
|
|---|
| 103 |
|
|---|
| 104 | <div class="clear"></div>
|
|---|
| 105 |
|
|---|
| 106 | </div>
|
|---|
| 107 |
|
|---|
| 108 | <div class="clear"></div>
|
|---|
| 109 |
|
|---|