/
default.php
176 lines (164 loc) · 6.91 KB
/
default.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<?php
/**
* Kunena Component
* @package Kunena.Template.Crypsis
* @subpackage Layout.Message
*
* @copyright Copyright (C) 2008 - 2019 Kunena Team. All rights reserved.
* @license https://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link https://www.kunena.org
**/
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
$message = $this->message;
$topic = $message->getTopic();
$category = $message->getCategory();
$isReply = $this->message->id != $this->topic->first_post_id;
$signature = $this->profile->getSignature();
$attachments = $message->getAttachments();
$attachs = $message->getNbAttachments();
$avatarname = $this->profile->getname();
$config = KunenaConfig::getInstance();
$subjectlengthmessage = $this->ktemplate->params->get('SubjectLengthMessage', 20);
if ($config->ordering_system == 'mesid')
{
$this->numLink = $this->location;
}
else
{
$this->numLink = $message->replynum;
}
$list = array();
?>
<small class="text-muted pull-right">
<?php if ($this->ipLink && !empty($this->message->ip)) : ?>
<?php echo KunenaIcons::ip(); ?>
<span class="ip"> <?php echo $this->ipLink; ?> </span>
<?php endif; ?>
<?php echo KunenaIcons::clock(); ?>
<?php echo $message->getTime()->toSpan('config_post_dateformat', 'config_post_dateformat_hover'); ?>
<?php if ($message->modified_time) : ?> - <?php echo KunenaIcons::edit() . ' ' . $message->getModifiedTime()->toSpan('config_post_dateformat', 'config_post_dateformat_hover'); endif; ?>
<a href="#<?php echo $this->message->id; ?>" id="<?php echo $this->message->id; ?>"
rel="canonical">#<?php echo $this->numLink; ?></a>
<span class="visible-phone"><?php echo Text::_('COM_KUNENA_BY') . ' ' . $message->getAuthor()->getLink(); ?></span>
</small>
<div class="badger-left badger-info <?php if ($message->getAuthor()->isModerator()) : ?> badger-moderator <?php endif; ?> message-<?php echo $this->message->getState(); ?>">
<div class="kmessage">
<div class="mykmsg-header">
<?php
$title = KunenaForumMessage::getInstance()->getsubstr($this->escape($message->subject), 0, $subjectlengthmessage);
$langstr = $isReply ? 'COM_KUNENA_MESSAGE_REPLIED_NEW' : 'COM_KUNENA_MESSAGE_CREATED_NEW';
echo Text::sprintf($langstr, $message->getAuthor()->getLink(), $this->getTopicLink($topic, 'first', null, null, KunenaTemplate::getInstance()->tooltips() . ' topictitle', $category, true, false)); ?>
</div>
<div class="kmsg">
<?php if (!$this->me->userid && !$isReply) :
echo $message->displayField('message');
else:
echo (!$this->me->userid && $this->config->teaser) ? Text::_('COM_KUNENA_TEASER_TEXT') : $this->message->displayField('message');
endif; ?>
</div>
<?php if ($signature) : ?>
<div class="ksig">
<hr>
<span class="ksignature"><?php echo $signature; ?></span>
</div>
<?php endif ?>
</div>
</div>
<?php if ($this->config->reportmsg && $this->me->exists()) :
echo KunenaLayout::factory('Widget/Button')
->setProperties(array('url' => '#report' . $message->id . '', 'name' => 'report', 'scope' => 'message',
'type' => 'user', 'id' => 'btn_report', 'normal' => '', 'icon' => KunenaIcons::reportname(),
'modal' => 'modal', 'pullright' => 'pullright', ));
if ($this->me->isModerator($this->topic->getCategory()) || $this->config->user_report || !$this->config->user_report && $this->me->userid != $this->message->userid) : ?>
<div id="report<?php echo $this->message->id; ?>" class="modal hide fade" tabindex="-1" role="dialog"
aria-hidden="true" data-backdrop="false" style="display: none;">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<?php echo $this->subRequest('Topic/Report')->set('id', $this->topic->id); ?>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (!empty($attachments)) : ?>
<div class="kattach">
<h5 style="display: none;"> <?php echo Text::_('COM_KUNENA_ATTACHMENTS'); ?> </h5>
<ul class="thumbnails">
<?php foreach ($attachments as $attachment) :
if (!$attachment->inline) : ?>
<?php if ($attachment->isAudio()) :
echo $attachment->getLayout()->render('audio'); ?>
<?php elseif ($attachment->isVideo()) :
echo $attachment->getLayout()->render('video'); ?>
<?php else : ?>
<li class="span3 center">
<div
class="thumbnail"> <?php echo $attachment->getLayout()->render('thumbnail'); ?><?php echo $attachment->getLayout()->render('textlink'); ?> </div>
</li>
<?php endif; ?>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
<?php elseif ($attachs->total > 0 && !$this->me->exists()) :
if ($attachs->image > 0 && !$this->config->showimgforguest)
{
if ($attachs->image > 1)
{
echo KunenaLayout::factory('BBCode/Image')->set('title', Text::_('COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG_MULTIPLES'))->setLayout('unauthorised');
}
else
{
echo KunenaLayout::factory('BBCode/Image')->set('title', Text::_('COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG_SIMPLE'))->setLayout('unauthorised');
}
}
if ($attachs->file > 0 && !$this->config->showfileforguest)
{
if ($attachs->file > 1)
{
echo KunenaLayout::factory('BBCode/Image')->set('title', Text::_('COM_KUNENA_SHOWIMGFORGUEST_HIDEFILE_MULTIPLES'))->setLayout('unauthorised');
}
else
{
echo KunenaLayout::factory('BBCode/Image')->set('title', Text::_('COM_KUNENA_SHOWIMGFORGUEST_HIDEFILE_SIMPLE'))->setLayout('unauthorised');
}
}
endif; ?>
<?php if ($message->modified_by && $this->config->editmarkup) :
$dateshown = $datehover = '';
if ($message->modified_time)
{
$datehover = 'title="' . KunenaDate::getInstance($message->modified_time)->toKunena('config_post_dateformat_hover') . '"';
$dateshown = KunenaDate::getInstance($message->modified_time)->toKunena('config_post_dateformat') . ' ';
} ?>
<div class="alert alert-info hidden-phone" <?php echo $datehover ?>>
<?php echo Text::sprintf('COM_KUNENA_EDITING_LASTEDIT_ON_BY', $dateshown, $message->getModifier()->getLink(null, null, '', '', null, $this->category->id)); ?>
<?php if ($message->modified_reason)
{
echo Text::_('COM_KUNENA_REASON') . ': ' . $this->escape($message->modified_reason);
} ?>
</div>
<?php endif; ?>
<?php if (!empty($this->thankyou)) : ?>
<div class="kmessage-thankyou">
<?php
foreach ($this->thankyou as $userid => $thank)
{
if (!empty($this->thankyou_delete[$userid]))
{
$list[] = $thank . ' <a title="' . Text::_('COM_KUNENA_BUTTON_THANKYOU_REMOVE_LONG') . '" href="'
. $this->thankyou_delete[$userid] . '">' . KunenaIcons::delete() . '</a>';
}
else
{
$list[] = $thank;
}
}
echo Text::_('COM_KUNENA_THANKYOU') . ': ' . implode(', ', $list) . ' ';
if ($this->more_thankyou)
{
echo Text::sprintf('COM_KUNENA_THANKYOU_MORE_USERS', $this->more_thankyou);
}
?>
</div>
<?php endif;