|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace XoopsModules\Newbb; |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* You may not change or alter any portion of this comment or credits |
|
7
|
|
|
* of supporting developers from this source code or any supporting source code |
|
8
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
9
|
|
|
* |
|
10
|
|
|
* This program is distributed in the hope that it will be useful, |
|
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
17
|
|
|
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
|
18
|
|
|
* @package |
|
19
|
|
|
* @since |
|
20
|
|
|
* @author XOOPS Development Team, phppp (D.J., [email protected]) |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
use XoopsModules\Newbb; |
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
\defined('NEWBB_FUNCTIONS_INI') || require XOOPS_ROOT_PATH . '/modules/newbb/include/functions.ini.php'; |
|
28
|
|
|
newbb_load_object(); |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Class Post |
|
32
|
|
|
*/ |
|
33
|
|
|
class Post extends \XoopsObject |
|
34
|
|
|
{ |
|
35
|
|
|
//class Post extends \XoopsObject { |
|
36
|
|
|
public $attachment_array = []; |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Post constructor. |
|
40
|
|
|
*/ |
|
41
|
|
|
public function __construct() |
|
42
|
|
|
{ |
|
43
|
|
|
parent::__construct('bb_posts'); |
|
|
|
|
|
|
44
|
|
|
$this->initVar('post_id', \XOBJ_DTYPE_INT); |
|
45
|
|
|
$this->initVar('topic_id', \XOBJ_DTYPE_INT, 0, true); |
|
46
|
|
|
$this->initVar('forum_id', \XOBJ_DTYPE_INT, 0, true); |
|
47
|
|
|
$this->initVar('post_time', \XOBJ_DTYPE_INT, 0, true); |
|
48
|
|
|
$this->initVar('poster_ip', \XOBJ_DTYPE_INT, 0); |
|
49
|
|
|
$this->initVar('poster_name', \XOBJ_DTYPE_TXTBOX, ''); |
|
50
|
|
|
$this->initVar('subject', \XOBJ_DTYPE_TXTBOX, '', true); |
|
51
|
|
|
$this->initVar('pid', \XOBJ_DTYPE_INT, 0); |
|
52
|
|
|
$this->initVar('dohtml', \XOBJ_DTYPE_INT, 0); |
|
53
|
|
|
$this->initVar('dosmiley', \XOBJ_DTYPE_INT, 1); |
|
54
|
|
|
$this->initVar('doxcode', \XOBJ_DTYPE_INT, 1); |
|
55
|
|
|
$this->initVar('doimage', \XOBJ_DTYPE_INT, 1); |
|
56
|
|
|
$this->initVar('dobr', \XOBJ_DTYPE_INT, 1); |
|
57
|
|
|
$this->initVar('uid', \XOBJ_DTYPE_INT, 1); |
|
58
|
|
|
$this->initVar('icon', \XOBJ_DTYPE_TXTBOX, ''); |
|
59
|
|
|
$this->initVar('attachsig', \XOBJ_DTYPE_INT, 0); |
|
60
|
|
|
$this->initVar('approved', \XOBJ_DTYPE_INT, 1); |
|
61
|
|
|
$this->initVar('post_karma', \XOBJ_DTYPE_INT, 0); |
|
62
|
|
|
$this->initVar('require_reply', \XOBJ_DTYPE_INT, 0); |
|
63
|
|
|
$this->initVar('attachment', \XOBJ_DTYPE_TXTAREA, ''); |
|
64
|
|
|
$this->initVar('post_text', \XOBJ_DTYPE_TXTAREA, ''); |
|
65
|
|
|
$this->initVar('post_edit', \XOBJ_DTYPE_TXTAREA, ''); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
// //////////////////////////////////////////////////////////////////////////////////// |
|
69
|
|
|
// attachment functions TODO: there should be a file/attachment management class |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @return array|mixed|null |
|
73
|
|
|
*/ |
|
74
|
|
|
public function getAttachment() |
|
75
|
|
|
{ |
|
76
|
|
|
if (\count($this->attachment_array)) { |
|
77
|
|
|
return $this->attachment_array; |
|
78
|
|
|
} |
|
79
|
|
|
$attachment = $this->getVar('attachment'); |
|
80
|
|
|
if (empty($attachment)) { |
|
81
|
|
|
$this->attachment_array = null; |
|
82
|
|
|
} else { |
|
83
|
|
|
$this->attachment_array = @\unserialize(\base64_decode($attachment, true)); |
|
|
|
|
|
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
return $this->attachment_array; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param $attach_key |
|
91
|
|
|
* @return bool |
|
92
|
|
|
*/ |
|
93
|
|
|
public function incrementDownload($attach_key) |
|
94
|
|
|
{ |
|
95
|
|
|
if (!$attach_key) { |
|
96
|
|
|
return false; |
|
97
|
|
|
} |
|
98
|
|
|
$this->attachment_array[(string)$attach_key]['num_download']++; |
|
99
|
|
|
|
|
100
|
|
|
return $this->attachment_array[(string)$attach_key]['num_download']; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* @return bool |
|
105
|
|
|
*/ |
|
106
|
|
|
public function saveAttachment() |
|
107
|
|
|
{ |
|
108
|
|
|
$attachment_save = ''; |
|
109
|
|
|
if ($this->attachment_array && \is_array($this->attachment_array)) { |
|
|
|
|
|
|
110
|
|
|
$attachment_save = \base64_encode(\serialize($this->attachment_array)); |
|
111
|
|
|
} |
|
112
|
|
|
$this->setVar('attachment', $attachment_save); |
|
113
|
|
|
$sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('bb_posts') . ' SET attachment=' . $GLOBALS['xoopsDB']->quoteString($attachment_save) . ' WHERE post_id = ' . $this->getVar('post_id'); |
|
114
|
|
|
if (!$result = $GLOBALS['xoopsDB']->queryF($sql)) { |
|
|
|
|
|
|
115
|
|
|
//xoops_error($GLOBALS["xoopsDB"]->error()); |
|
116
|
|
|
return false; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
return true; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @param null $attach_array |
|
|
|
|
|
|
124
|
|
|
* @return bool |
|
125
|
|
|
*/ |
|
126
|
|
|
public function deleteAttachment($attach_array = null) |
|
127
|
|
|
{ |
|
128
|
|
|
$attach_old = $this->getAttachment(); |
|
129
|
|
|
if (!\is_array($attach_old) || \count($attach_old) < 1) { |
|
130
|
|
|
return true; |
|
131
|
|
|
} |
|
132
|
|
|
$this->attachment_array = []; |
|
133
|
|
|
|
|
134
|
|
|
if (null === $attach_array) { |
|
|
|
|
|
|
135
|
|
|
$attach_array = \array_keys($attach_old); |
|
136
|
|
|
} // to delete all! |
|
137
|
|
|
if (!\is_array($attach_array)) { |
|
|
|
|
|
|
138
|
|
|
$attach_array = [$attach_array]; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
foreach ($attach_old as $key => $attach) { |
|
142
|
|
|
if (\in_array($key, $attach_array)) { |
|
143
|
|
|
@\unlink(XOOPS_ROOT_PATH . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $attach['name_saved']); |
|
|
|
|
|
|
144
|
|
|
@\unlink(XOOPS_ROOT_PATH . '/' . $GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/thumbs/' . $attach['name_saved']); // delete thumbnails |
|
145
|
|
|
continue; |
|
146
|
|
|
} |
|
147
|
|
|
$this->attachment_array[$key] = $attach; |
|
148
|
|
|
} |
|
149
|
|
|
$attachment_save = ''; |
|
150
|
|
|
if ($this->attachment_array && \is_array($this->attachment_array)) { |
|
151
|
|
|
$attachment_save = \base64_encode(\serialize($this->attachment_array)); |
|
152
|
|
|
} |
|
153
|
|
|
$this->setVar('attachment', $attachment_save); |
|
154
|
|
|
|
|
155
|
|
|
return true; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* @param string $name_saved |
|
160
|
|
|
* @param string $name_display |
|
161
|
|
|
* @param string $mimetype |
|
162
|
|
|
* @param int $num_download |
|
163
|
|
|
* @return bool |
|
164
|
|
|
*/ |
|
165
|
|
|
public function setAttachment($name_saved = '', $name_display = '', $mimetype = '', $num_download = 0) |
|
166
|
|
|
{ |
|
167
|
|
|
static $counter = 0; |
|
168
|
|
|
$this->attachment_array = $this->getAttachment(); |
|
169
|
|
|
if ($name_saved) { |
|
170
|
|
|
$key = (string)(\time() + $counter++); |
|
171
|
|
|
$this->attachment_array[$key] = [ |
|
172
|
|
|
'name_saved' => $name_saved, |
|
173
|
|
|
'name_display' => isset($name_display) ? $name_display : $name_saved, |
|
174
|
|
|
'mimetype' => $mimetype, |
|
175
|
|
|
'num_download' => isset($num_download) ? (int)$num_download : 0, |
|
176
|
|
|
]; |
|
177
|
|
|
} |
|
178
|
|
|
$attachment_save = null; |
|
179
|
|
|
if (\is_array($this->attachment_array)) { |
|
180
|
|
|
$attachment_save = \base64_encode(\serialize($this->attachment_array)); |
|
181
|
|
|
} |
|
182
|
|
|
$this->setVar('attachment', $attachment_save); |
|
183
|
|
|
|
|
184
|
|
|
return true; |
|
185
|
|
|
} |
|
186
|
|
|
|
|
187
|
|
|
/** |
|
188
|
|
|
* TODO: refactor |
|
189
|
|
|
* @param bool $asSource |
|
190
|
|
|
* @return string |
|
191
|
|
|
*/ |
|
192
|
|
|
public function displayAttachment($asSource = false) |
|
|
|
|
|
|
193
|
|
|
{ |
|
194
|
|
|
$post_attachment = ''; |
|
195
|
|
|
$attachments = $this->getAttachment(); |
|
196
|
|
|
if ($attachments && \is_array($attachments)) { |
|
197
|
|
|
$iconHandler = newbb_getIconHandler(); |
|
|
|
|
|
|
198
|
|
|
$mime_path = $iconHandler->getPath('mime'); |
|
199
|
|
|
require_once $GLOBALS['xoops']->path('modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . '/include/functions.image.php'); |
|
200
|
|
|
$image_extensions = ['jpg', 'jpeg', 'gif', 'png', 'bmp']; // need improve !!! |
|
201
|
|
|
$post_attachment .= '<br><strong>' . _MD_ATTACHMENT . '</strong>:'; |
|
202
|
|
|
$post_attachment .= "<div style='margin: 1em 0; border-top: 1px solid;'></div>\n"; |
|
203
|
|
|
// $post_attachment .= '<br><hr style="height: 1px;" noshade="noshade"><br>'; |
|
204
|
|
|
foreach ($attachments as $key => $att) { |
|
205
|
|
|
$file_extension = \ltrim(mb_strrchr($att['name_saved'], '.'), '.'); |
|
206
|
|
|
$filetype = $file_extension; |
|
207
|
|
|
if (\file_exists($GLOBALS['xoops']->path("{$mime_path}/{$filetype}.gif"))) { |
|
208
|
|
|
$icon_filetype = $GLOBALS['xoops']->url("{$mime_path}/{$filetype}.gif"); |
|
209
|
|
|
} else { |
|
210
|
|
|
$icon_filetype = $GLOBALS['xoops']->url("{$mime_path}/unknown.gif"); |
|
211
|
|
|
} |
|
212
|
|
|
$file_size = @\filesize($GLOBALS['xoops']->path($GLOBALS['xoopsModuleConfig']['dir_attachments'] . '/' . $att['name_saved'])); |
|
213
|
|
|
$file_size = \number_format($file_size / 1024, 2) . ' KB'; |
|
214
|
|
|
if ($GLOBALS['xoopsModuleConfig']['media_allowed'] |
|
215
|
|
|
&& \in_array(mb_strtolower($file_extension), $image_extensions)) { |
|
216
|
|
|
$post_attachment .= '<br><img src="' . $icon_filetype . '" alt="' . $filetype . '"><strong> ' . $att['name_display'] . '</strong> <small>(' . $file_size . ')</small>'; |
|
217
|
|
|
$post_attachment .= '<br>' . newbb_attachmentImage($att['name_saved']); |
|
|
|
|
|
|
218
|
|
|
$isDisplayed = true; |
|
|
|
|
|
|
219
|
|
|
} else { |
|
220
|
|
|
if (empty($GLOBALS['xoopsModuleConfig']['show_userattach'])) { |
|
221
|
|
|
$post_attachment .= "<a href='" |
|
222
|
|
|
. $GLOBALS['xoops']->url('/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . "/dl_attachment.php?attachid={$key}&post_id=" . $this->getVar('post_id')) |
|
223
|
|
|
. "'> <img src='{$icon_filetype}' alt='{$filetype}'> {$att['name_display']}</a> " |
|
224
|
|
|
. _MD_FILESIZE |
|
225
|
|
|
. ": {$file_size}; " |
|
226
|
|
|
. _MD_HITS |
|
227
|
|
|
. ": {$att['num_download']}"; |
|
228
|
|
|
} elseif (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->uid() > 0 |
|
229
|
|
|
&& $GLOBALS['xoopsUser']->isActive()) { |
|
230
|
|
|
$post_attachment .= "<a href='" |
|
231
|
|
|
. $GLOBALS['xoops']->url('/modules/' . $GLOBALS['xoopsModule']->getVar('dirname', 'n') . "/dl_attachment.php?attachid={$key}&post_id=" . $this->getVar('post_id')) |
|
232
|
|
|
. "'> <img src='" |
|
233
|
|
|
. $icon_filetype |
|
234
|
|
|
. "' alt='{$filetype}'> {$att['name_display']}</a> " |
|
235
|
|
|
. _MD_FILESIZE |
|
236
|
|
|
. ": {$file_size}; " |
|
237
|
|
|
. _MD_HITS |
|
238
|
|
|
. ": {$att['num_download']}"; |
|
239
|
|
|
} else { |
|
240
|
|
|
$post_attachment .= _MD_NEWBB_SEENOTGUEST; |
|
241
|
|
|
} |
|
242
|
|
|
} |
|
243
|
|
|
$post_attachment .= '<br>'; |
|
244
|
|
|
} |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
return $post_attachment; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
// attachment functions |
|
251
|
|
|
// //////////////////////////////////////////////////////////////////////////////////// |
|
252
|
|
|
|
|
253
|
|
|
/** |
|
254
|
|
|
* @param string $poster_name |
|
255
|
|
|
* @param string $post_editmsg |
|
256
|
|
|
* @return bool |
|
257
|
|
|
*/ |
|
258
|
|
|
public function setPostEdit($poster_name = '', $post_editmsg = '') |
|
|
|
|
|
|
259
|
|
|
{ |
|
260
|
|
|
if ($this->getVar('approved') < 1 |
|
261
|
|
|
|| empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit']) |
|
262
|
|
|
|| (\time() - $this->getVar('post_time')) < $GLOBALS['xoopsModuleConfig']['recordedit_timelimit'] * 60) { |
|
263
|
|
|
return true; |
|
264
|
|
|
} |
|
265
|
|
|
if (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->isActive()) { |
|
266
|
|
|
if ($GLOBALS['xoopsModuleConfig']['show_realname'] && $GLOBALS['xoopsUser']->getVar('name')) { |
|
267
|
|
|
$edit_user = $GLOBALS['xoopsUser']->getVar('name'); |
|
268
|
|
|
} else { |
|
269
|
|
|
$edit_user = $GLOBALS['xoopsUser']->getVar('uname'); |
|
270
|
|
|
} |
|
271
|
|
|
} |
|
272
|
|
|
$post_edit = []; |
|
273
|
|
|
$post_edit['edit_user'] = $edit_user; // The proper way is to store uid instead of name. However, to save queries when displaying, the current way is ok. |
|
|
|
|
|
|
274
|
|
|
$post_edit['edit_time'] = \time(); |
|
275
|
|
|
$post_edit['edit_msg'] = $post_editmsg; |
|
276
|
|
|
|
|
277
|
|
|
$post_edits = $this->getVar('post_edit'); |
|
278
|
|
|
if (!empty($post_edits)) { |
|
279
|
|
|
$post_edits = \unserialize(\base64_decode($post_edits, true)); |
|
|
|
|
|
|
280
|
|
|
} |
|
281
|
|
|
if (!\is_array($post_edits)) { |
|
282
|
|
|
$post_edits = []; |
|
283
|
|
|
} |
|
284
|
|
|
$post_edits[] = $post_edit; |
|
285
|
|
|
$post_edit = \base64_encode(\serialize($post_edits)); |
|
286
|
|
|
unset($post_edits); |
|
287
|
|
|
$this->setVar('post_edit', $post_edit); |
|
288
|
|
|
|
|
289
|
|
|
return true; |
|
290
|
|
|
} |
|
291
|
|
|
|
|
292
|
|
|
/** |
|
293
|
|
|
* @return bool|string |
|
294
|
|
|
*/ |
|
295
|
|
|
public function displayPostEdit() |
|
296
|
|
|
{ |
|
297
|
|
|
global $myts; |
|
298
|
|
|
|
|
299
|
|
|
if (empty($GLOBALS['xoopsModuleConfig']['recordedit_timelimit'])) { |
|
300
|
|
|
return false; |
|
301
|
|
|
} |
|
302
|
|
|
|
|
303
|
|
|
$post_edit = ''; |
|
304
|
|
|
$post_edits = $this->getVar('post_edit'); |
|
305
|
|
|
if (!empty($post_edits)) { |
|
306
|
|
|
$post_edits = \unserialize(\base64_decode($post_edits, true)); |
|
|
|
|
|
|
307
|
|
|
} |
|
308
|
|
|
if (!isset($post_edits) || !\is_array($post_edits)) { |
|
309
|
|
|
$post_edits = []; |
|
310
|
|
|
} |
|
311
|
|
|
if ($post_edits && \is_array($post_edits)) { |
|
312
|
|
|
foreach ($post_edits as $postedit) { |
|
313
|
|
|
$edit_time = (int)$postedit['edit_time']; |
|
314
|
|
|
$edit_user = $myts->stripSlashesGPC($postedit['edit_user']); |
|
315
|
|
|
$edit_msg = !empty($postedit['edit_msg']) ? $myts->stripSlashesGPC($postedit['edit_msg']) : ''; |
|
316
|
|
|
// Start irmtfan add option to do only the latest edit when do_latestedit=0 (Alfred) |
|
317
|
|
|
if (empty($GLOBALS['xoopsModuleConfig']['do_latestedit'])) { |
|
318
|
|
|
$post_edit = ''; |
|
319
|
|
|
} |
|
320
|
|
|
// End irmtfan add option to do only the latest edit when do_latestedit=0 (Alfred) |
|
321
|
|
|
// START hacked by irmtfan |
|
322
|
|
|
// display/save all edit records. |
|
323
|
|
|
$post_edit .= _MD_EDITEDBY . ' ' . $edit_user . ' ' . _MD_ON . ' ' . newbb_formatTimestamp($edit_time) . '<br>'; |
|
|
|
|
|
|
324
|
|
|
// if reason is not empty |
|
325
|
|
|
if ('' !== $edit_msg) { |
|
326
|
|
|
$post_edit .= \_MD_EDITEDMSG . ' ' . $edit_msg . '<br>'; |
|
327
|
|
|
} |
|
328
|
|
|
// START hacked by irmtfan |
|
329
|
|
|
} |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
return $post_edit; |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
/** |
|
336
|
|
|
* @return array |
|
337
|
|
|
*/ |
|
338
|
|
|
public function &getPostBody() |
|
339
|
|
|
{ |
|
340
|
|
|
global $myts; |
|
341
|
|
|
$GLOBALS['xoopsModuleConfig'] = newbb_load_config(); // irmtfan load all newbb configs - newbb config in blocks activated in some modules like profile |
|
|
|
|
|
|
342
|
|
|
// mod_loadFunctions('user', 'newbb'); |
|
343
|
|
|
// mod_loadFunctions('render', 'newbb'); |
|
344
|
|
|
require_once \dirname(__DIR__) . '/include/functions.user.php'; |
|
345
|
|
|
require_once \dirname(__DIR__) . '/include/functions.render.php'; |
|
346
|
|
|
|
|
347
|
|
|
$uid = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
|
348
|
|
|
$karmaHandler = Newbb\Helper::getInstance()->getHandler('Karma'); |
|
|
|
|
|
|
349
|
|
|
$user_karma = $karmaHandler->getUserKarma(); |
|
350
|
|
|
|
|
351
|
|
|
$post = []; |
|
352
|
|
|
$post['attachment'] = false; |
|
353
|
|
|
$post_text = &newbb_displayTarea($this->vars['post_text']['value'], $this->getVar('dohtml'), $this->getVar('dosmiley'), $this->getVar('doxcode'), $this->getVar('doimage'), $this->getVar('dobr')); |
|
|
|
|
|
|
354
|
|
|
if (newbb_isAdmin($this->getVar('forum_id')) || $this->checkIdentity()) { |
|
|
|
|
|
|
355
|
|
|
$post['text'] = $post_text . '<br>' . $this->displayAttachment(); |
|
356
|
|
|
} elseif ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $this->getVar('post_karma') > $user_karma) { |
|
357
|
|
|
$post['text'] = \sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')); |
|
|
|
|
|
|
358
|
|
|
} elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $this->getVar('require_reply') |
|
359
|
|
|
&& (!$uid || !isset($viewtopic_users[$uid]))) { |
|
|
|
|
|
|
360
|
|
|
$post['text'] = _MD_REPLY_REQUIREMENT; |
|
361
|
|
|
} else { |
|
362
|
|
|
$post['text'] = $post_text . '<br>' . $this->displayAttachment(); |
|
363
|
|
|
} |
|
364
|
|
|
$memberHandler = \xoops_getHandler('member'); |
|
365
|
|
|
$eachposter = $memberHandler->getUser($this->getVar('uid')); |
|
|
|
|
|
|
366
|
|
|
if (\is_object($eachposter) && $eachposter->isActive()) { |
|
367
|
|
|
if ($GLOBALS['xoopsModuleConfig']['show_realname'] && $eachposter->getVar('name')) { |
|
368
|
|
|
$post['author'] = $eachposter->getVar('name'); |
|
369
|
|
|
} else { |
|
370
|
|
|
$post['author'] = $eachposter->getVar('uname'); |
|
371
|
|
|
} |
|
372
|
|
|
unset($eachposter); |
|
373
|
|
|
} else { |
|
374
|
|
|
$post['author'] = $this->getVar('poster_name') ?: $GLOBALS['xoopsConfig']['anonymous']; |
|
375
|
|
|
} |
|
376
|
|
|
|
|
377
|
|
|
$post['subject'] = newbb_htmlspecialchars($this->vars['subject']['value']); |
|
|
|
|
|
|
378
|
|
|
$post['date'] = $this->getVar('post_time'); |
|
379
|
|
|
|
|
380
|
|
|
return $post; |
|
381
|
|
|
} |
|
382
|
|
|
|
|
383
|
|
|
/** |
|
384
|
|
|
* @return bool |
|
385
|
|
|
*/ |
|
386
|
|
|
public function isTopic() |
|
387
|
|
|
{ |
|
388
|
|
|
return !$this->getVar('pid'); |
|
389
|
|
|
} |
|
390
|
|
|
|
|
391
|
|
|
/** |
|
392
|
|
|
* @param string $action_tag |
|
393
|
|
|
* @return bool |
|
394
|
|
|
*/ |
|
395
|
|
|
public function checkTimelimit($action_tag = 'edit_timelimit') |
|
396
|
|
|
{ |
|
397
|
|
|
$newbb_config = newbb_load_config(); |
|
|
|
|
|
|
398
|
|
|
if (empty($newbb_config['edit_timelimit'])) { |
|
399
|
|
|
return true; |
|
400
|
|
|
} |
|
401
|
|
|
|
|
402
|
|
|
return ($this->getVar('post_time') > \time() - $newbb_config[$action_tag] * 60); |
|
403
|
|
|
} |
|
404
|
|
|
|
|
405
|
|
|
/** |
|
406
|
|
|
* @param int $uid |
|
407
|
|
|
* @return bool |
|
408
|
|
|
*/ |
|
409
|
|
|
public function checkIdentity($uid = -1) |
|
410
|
|
|
{ |
|
411
|
|
|
// $uid = ($uid > -1) ? $uid : (($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getVar('uid') : 0); |
|
412
|
|
|
if ($uid < 0 && $GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
|
413
|
|
|
$uid = $GLOBALS['xoopsUser']->getVar('uid'); |
|
414
|
|
|
} else { |
|
415
|
|
|
$uid = 0; |
|
416
|
|
|
} |
|
417
|
|
|
if ($this->getVar('uid') > 0) { |
|
418
|
|
|
$user_ok = $uid === $this->getVar('uid'); |
|
419
|
|
|
} else { |
|
420
|
|
|
static $user_ip; |
|
421
|
|
|
if (!isset($user_ip)) { |
|
422
|
|
|
$user_ip = \XoopsUserUtility::getIP(); |
|
423
|
|
|
} |
|
424
|
|
|
$user_ok = $user_ip === $this->getVar('poster_ip'); |
|
425
|
|
|
} |
|
426
|
|
|
|
|
427
|
|
|
return $user_ok; |
|
428
|
|
|
} |
|
429
|
|
|
|
|
430
|
|
|
// TODO: cleaning up and merge with post hanldings in viewpost.php |
|
431
|
|
|
|
|
432
|
|
|
/** |
|
433
|
|
|
* @param $isadmin |
|
434
|
|
|
* @return array |
|
435
|
|
|
*/ |
|
436
|
|
|
public function showPost($isadmin) |
|
437
|
|
|
{ |
|
438
|
|
|
global $myts; |
|
439
|
|
|
global $forumUrl, $forumImage; |
|
440
|
|
|
global $viewtopic_users, $viewtopic_posters, $forum_obj, $topic_obj, $online, $user_karma, $viewmode, $order, $start, $total_posts, $topic_status; |
|
441
|
|
|
static $post_NO = 0; |
|
442
|
|
|
static $name_anonymous; |
|
443
|
|
|
|
|
444
|
|
|
if (!isset($name_anonymous)) { |
|
445
|
|
|
$name_anonymous = $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
|
446
|
|
|
} |
|
447
|
|
|
|
|
448
|
|
|
// mod_loadFunctions('time', 'newbb'); |
|
449
|
|
|
// mod_loadFunctions('render', 'newbb'); |
|
450
|
|
|
// mod_loadFunctions('text', 'newbb'); // irmtfan add text functions |
|
451
|
|
|
require_once \dirname(__DIR__) . '/include/functions.time.php'; |
|
452
|
|
|
require_once \dirname(__DIR__) . '/include/functions.render.php'; |
|
453
|
|
|
require_once \dirname(__DIR__) . '/include/functions.text.php'; |
|
454
|
|
|
|
|
455
|
|
|
$post_id = $this->getVar('post_id'); |
|
456
|
|
|
$topic_id = $this->getVar('topic_id'); |
|
457
|
|
|
$forum_id = $this->getVar('forum_id'); |
|
458
|
|
|
|
|
459
|
|
|
$query_vars = ['status', 'order', 'start', 'mode', 'viewmode']; |
|
460
|
|
|
$query_array = []; |
|
461
|
|
|
$query_array['topic_id'] = "topic_id={$topic_id}"; |
|
462
|
|
|
foreach ($query_vars as $var) { |
|
463
|
|
|
if (!empty($_GET[$var])) { |
|
464
|
|
|
$query_array[$var] = "{$var}={$_GET[$var]}"; |
|
465
|
|
|
} |
|
466
|
|
|
} |
|
467
|
|
|
$page_query = \htmlspecialchars(\implode('&', \array_values($query_array)), \ENT_QUOTES | \ENT_HTML5); |
|
468
|
|
|
|
|
469
|
|
|
$uid = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
|
470
|
|
|
|
|
471
|
|
|
++$post_NO; |
|
472
|
|
|
if ('desc' === mb_strtolower($order)) { |
|
473
|
|
|
$post_no = $total_posts - ($start + $post_NO) + 1; |
|
474
|
|
|
} else { |
|
475
|
|
|
$post_no = $start + $post_NO; |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
|
|
if ($isadmin || $this->checkIdentity()) { |
|
479
|
|
|
$post_text = $this->getVar('post_text'); |
|
480
|
|
|
$post_attachment = $this->displayAttachment(); |
|
481
|
|
|
} elseif ($GLOBALS['xoopsModuleConfig']['enable_karma'] && $this->getVar('post_karma') > $user_karma) { |
|
482
|
|
|
$post_text = "<div class='karma'>" . \sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . '</div>'; |
|
|
|
|
|
|
483
|
|
|
$post_attachment = ''; |
|
484
|
|
|
} elseif ($GLOBALS['xoopsModuleConfig']['allow_require_reply'] && $this->getVar('require_reply') |
|
485
|
|
|
&& (!$uid |
|
486
|
|
|
|| !\in_array($uid, $viewtopic_posters))) { |
|
487
|
|
|
$post_text = "<div class='karma'>" . _MD_REPLY_REQUIREMENT . "</div>\n"; |
|
488
|
|
|
$post_attachment = ''; |
|
489
|
|
|
} else { |
|
490
|
|
|
$post_text = $this->getVar('post_text'); |
|
491
|
|
|
$post_attachment = $this->displayAttachment(); |
|
492
|
|
|
} |
|
493
|
|
|
// START irmtfan add highlight feature |
|
494
|
|
|
// Hightlighting searched words |
|
495
|
|
|
$post_title = $this->getVar('subject'); |
|
496
|
|
|
if (!empty($_GET['keywords']) && \Xmf\Request::hasVar('keywords', 'GET')) { |
|
497
|
|
|
$keywords = $myts->htmlSpecialChars(\trim(\urldecode($_GET['keywords']))); |
|
498
|
|
|
$post_text = \newbb_highlightText($post_text, $keywords); |
|
|
|
|
|
|
499
|
|
|
$post_title = \newbb_highlightText($post_title, $keywords); |
|
500
|
|
|
} |
|
501
|
|
|
// END irmtfan add highlight feature |
|
502
|
|
|
if (isset($viewtopic_users[$this->getVar('uid')])) { |
|
503
|
|
|
$poster = $viewtopic_users[$this->getVar('uid')]; |
|
504
|
|
|
} else { |
|
505
|
|
|
$name = ($post_name = $this->getVar('poster_name')) ? $post_name : $name_anonymous; |
|
506
|
|
|
$poster = [ |
|
507
|
|
|
'poster_uid' => 0, |
|
508
|
|
|
'name' => $name, |
|
509
|
|
|
'link' => $name, |
|
510
|
|
|
]; |
|
511
|
|
|
} |
|
512
|
|
|
|
|
513
|
|
|
$posticon = $this->getVar('icon'); |
|
514
|
|
|
if ($posticon) { |
|
515
|
|
|
$post_image = "<a name='{$post_id}'><img src='" . $GLOBALS['xoops']->url("images/subject/{$posticon}") . "' alt=''></a>"; |
|
516
|
|
|
} else { |
|
517
|
|
|
$post_image = "<a name='{$post_id}'><img src='" . $GLOBALS['xoops']->url('images/icons/posticon.gif') . "' alt=''></a>"; |
|
518
|
|
|
} |
|
519
|
|
|
|
|
520
|
|
|
$thread_buttons = []; |
|
521
|
|
|
$mod_buttons = []; |
|
522
|
|
|
|
|
523
|
|
|
if (($this->getVar('uid') > 0) |
|
524
|
|
|
&& $isadmin |
|
525
|
|
|
&& (($GLOBALS['xoopsUser'] instanceof \XoopsUser) |
|
526
|
|
|
&& $GLOBALS['xoopsUser']->getVar('uid') !== $this->getVar('uid'))) { |
|
527
|
|
|
$mod_buttons['bann']['image'] = newbb_displayImage('p_bann', _MD_SUSPEND_MANAGEMENT); |
|
|
|
|
|
|
528
|
|
|
$mod_buttons['bann']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/moderate.php?forum={$forum_id}&fuid=" . $this->getVar('uid')); |
|
529
|
|
|
$mod_buttons['bann']['name'] = _MD_SUSPEND_MANAGEMENT; |
|
530
|
|
|
$thread_buttons['bann']['image'] = newbb_displayImage('p_bann', _MD_SUSPEND_MANAGEMENT); |
|
531
|
|
|
$thread_buttons['bann']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/moderate.php?forum={$forum_id}&fuid=" . $this->getVar('uid')); |
|
532
|
|
|
$thread_buttons['bann']['name'] = _MD_SUSPEND_MANAGEMENT; |
|
533
|
|
|
} |
|
534
|
|
|
|
|
535
|
|
|
if ($GLOBALS['xoopsModuleConfig']['enable_permcheck']) { |
|
536
|
|
|
/** @var Newbb\TopicHandler $topicHandler */ |
|
537
|
|
|
$topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
538
|
|
|
$topic_status = $topic_obj->getVar('topic_status'); |
|
539
|
|
|
if ($topicHandler->getPermission($forum_id, $topic_status, 'edit')) { |
|
540
|
|
|
$edit_ok = ($isadmin || ($this->checkIdentity() && $this->checkTimelimit('edit_timelimit'))); |
|
541
|
|
|
if ($edit_ok) { |
|
542
|
|
|
$thread_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); |
|
543
|
|
|
$thread_buttons['edit']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/edit.php?{$page_query}"); |
|
544
|
|
|
$thread_buttons['edit']['name'] = _EDIT; |
|
545
|
|
|
$mod_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); |
|
546
|
|
|
$mod_buttons['edit']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/edit.php?{$page_query}"); |
|
547
|
|
|
$mod_buttons['edit']['name'] = _EDIT; |
|
548
|
|
|
} |
|
549
|
|
|
} |
|
550
|
|
|
|
|
551
|
|
|
if ($topicHandler->getPermission($forum_id, $topic_status, 'delete')) { |
|
552
|
|
|
$delete_ok = ($isadmin || ($this->checkIdentity() && $this->checkTimelimit('delete_timelimit'))); |
|
553
|
|
|
|
|
554
|
|
|
if ($delete_ok) { |
|
555
|
|
|
$thread_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); |
|
556
|
|
|
$thread_buttons['delete']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/delete.php?{$page_query}"); |
|
557
|
|
|
$thread_buttons['delete']['name'] = _DELETE; |
|
558
|
|
|
$mod_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); |
|
559
|
|
|
$mod_buttons['delete']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/delete.php?{$page_query}"); |
|
560
|
|
|
$mod_buttons['delete']['name'] = _DELETE; |
|
561
|
|
|
} |
|
562
|
|
|
} |
|
563
|
|
|
if ($topicHandler->getPermission($forum_id, $topic_status, 'reply')) { |
|
564
|
|
|
$thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY); |
|
565
|
|
|
$thread_buttons['reply']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/reply.php?{$page_query}"); |
|
566
|
|
|
$thread_buttons['reply']['name'] = _MD_REPLY; |
|
567
|
|
|
|
|
568
|
|
|
$thread_buttons['quote']['image'] = newbb_displayImage('p_quote', _MD_QUOTE); |
|
569
|
|
|
$thread_buttons['quote']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/reply.php?{$page_query}&quotedac=1"); |
|
570
|
|
|
$thread_buttons['quote']['name'] = _MD_QUOTE; |
|
571
|
|
|
} |
|
572
|
|
|
} else { |
|
573
|
|
|
$mod_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); |
|
574
|
|
|
$mod_buttons['edit']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/edit.php?{$page_query}"); |
|
575
|
|
|
$mod_buttons['edit']['name'] = _EDIT; |
|
576
|
|
|
|
|
577
|
|
|
$mod_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); |
|
578
|
|
|
$mod_buttons['delete']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/delete.php?{$page_query}"); |
|
579
|
|
|
$mod_buttons['delete']['name'] = _DELETE; |
|
580
|
|
|
|
|
581
|
|
|
$thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY); |
|
582
|
|
|
$thread_buttons['reply']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/reply.php?{$page_query}"); |
|
583
|
|
|
$thread_buttons['reply']['name'] = _MD_REPLY; |
|
584
|
|
|
} |
|
585
|
|
|
|
|
586
|
|
|
if (!$isadmin && $GLOBALS['xoopsModuleConfig']['reportmod_enabled']) { |
|
587
|
|
|
$thread_buttons['report']['image'] = newbb_displayImage('p_report', _MD_REPORT); |
|
588
|
|
|
$thread_buttons['report']['link'] = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/report.php?{$page_query}"); |
|
589
|
|
|
$thread_buttons['report']['name'] = _MD_REPORT; |
|
590
|
|
|
} |
|
591
|
|
|
|
|
592
|
|
|
$thread_action = []; |
|
593
|
|
|
// irmtfan add pdf permission |
|
594
|
|
|
if ($topicHandler->getPermission($forum_id, $topic_status, 'pdf') |
|
|
|
|
|
|
595
|
|
|
&& \file_exists($GLOBALS['xoops']->path('Frameworks/tcpdf/tcpdf.php'))) { |
|
596
|
|
|
$thread_action['pdf']['image'] = newbb_displayImage('pdf', _MD_PDF); |
|
597
|
|
|
$thread_action['pdf']['link'] = $GLOBALS['xoops']->url('modules/newbb/makepdf.php?type=post&pageid=0'); |
|
598
|
|
|
$thread_action['pdf']['name'] = _MD_PDF; |
|
599
|
|
|
$thread_action['pdf']['target'] = '_blank'; |
|
600
|
|
|
} |
|
601
|
|
|
// irmtfan add print permission |
|
602
|
|
|
if ($topicHandler->getPermission($forum_id, $topic_status, 'print')) { |
|
603
|
|
|
$thread_action['print']['image'] = newbb_displayImage('printer', _MD_PRINT); |
|
604
|
|
|
$thread_action['print']['link'] = $GLOBALS['xoops']->url("modules/newbb/print.php?form=2&forum={$forum_id}&topic_id={$topic_id}"); |
|
605
|
|
|
$thread_action['print']['name'] = _MD_PRINT; |
|
606
|
|
|
$thread_action['print']['target'] = '_blank'; |
|
607
|
|
|
} |
|
608
|
|
|
|
|
609
|
|
|
if ($GLOBALS['xoopsModuleConfig']['show_sociallinks']) { |
|
610
|
|
|
$full_title = $this->getVar('subject'); |
|
611
|
|
|
$clean_title = \preg_replace('/[^A-Za-z0-9-]+/', '+', $this->getVar('subject')); |
|
612
|
|
|
$full_link = $GLOBALS['xoops']->url("modules/newbb/viewtopic.php?post_id={$post_id}"); |
|
613
|
|
|
|
|
614
|
|
|
$thread_action['social_twitter']['image'] = newbb_displayImage('twitter', \_MD_SHARE_TWITTER); |
|
615
|
|
|
$thread_action['social_twitter']['link'] = "http://twitter.com/share?text={$clean_title}&url={$full_link}"; |
|
616
|
|
|
$thread_action['social_twitter']['name'] = \_MD_SHARE_TWITTER; |
|
617
|
|
|
$thread_action['social_twitter']['target'] = '_blank'; |
|
618
|
|
|
|
|
619
|
|
|
$thread_action['social_facebook']['image'] = newbb_displayImage('facebook', \_MD_SHARE_FACEBOOK); |
|
620
|
|
|
$thread_action['social_facebook']['link'] = "http://www.facebook.com/sharer.php?u={$full_link}"; |
|
621
|
|
|
$thread_action['social_facebook']['name'] = \_MD_SHARE_FACEBOOK; |
|
622
|
|
|
$thread_action['social_facebook']['target'] = '_blank'; |
|
623
|
|
|
|
|
624
|
|
|
$thread_action['social_gplus']['image'] = newbb_displayImage('googleplus', \_MD_SHARE_GOOGLEPLUS); |
|
625
|
|
|
$thread_action['social_gplus']['link'] = "https://plusone.google.com/_/+1/confirm?hl=en&url={$full_link}"; |
|
626
|
|
|
$thread_action['social_gplus']['name'] = \_MD_SHARE_GOOGLEPLUS; |
|
627
|
|
|
$thread_action['social_gplus']['target'] = '_blank'; |
|
628
|
|
|
|
|
629
|
|
|
$thread_action['social_linkedin']['image'] = newbb_displayImage('linkedin', \_MD_SHARE_LINKEDIN); |
|
630
|
|
|
$thread_action['social_linkedin']['link'] = "http://www.linkedin.com/shareArticle?mini=true&title={$full_title}&url={$full_link}"; |
|
631
|
|
|
$thread_action['social_linkedin']['name'] = \_MD_SHARE_LINKEDIN; |
|
632
|
|
|
$thread_action['social_linkedin']['target'] = '_blank'; |
|
633
|
|
|
|
|
634
|
|
|
$thread_action['social_delicious']['image'] = newbb_displayImage('delicious', \_MD_SHARE_DELICIOUS); |
|
635
|
|
|
$thread_action['social_delicious']['link'] = "http://del.icio.us/post?title={$full_title}&url={$full_link}"; |
|
636
|
|
|
$thread_action['social_delicious']['name'] = \_MD_SHARE_DELICIOUS; |
|
637
|
|
|
$thread_action['social_delicious']['target'] = '_blank'; |
|
638
|
|
|
|
|
639
|
|
|
$thread_action['social_digg']['image'] = newbb_displayImage('digg', \_MD_SHARE_DIGG); |
|
640
|
|
|
$thread_action['social_digg']['link'] = "http://digg.com/submit?phase=2&title={$full_title}&url={$full_link}"; |
|
641
|
|
|
$thread_action['social_digg']['name'] = \_MD_SHARE_DIGG; |
|
642
|
|
|
$thread_action['social_digg']['target'] = '_blank'; |
|
643
|
|
|
|
|
644
|
|
|
$thread_action['social_reddit']['image'] = newbb_displayImage('reddit', \_MD_SHARE_REDDIT); |
|
645
|
|
|
$thread_action['social_reddit']['link'] = "http://reddit.com/submit?title={$full_title}&url={$full_link}"; |
|
646
|
|
|
$thread_action['social_reddit']['name'] = \_MD_SHARE_REDDIT; |
|
647
|
|
|
$thread_action['social_reddit']['target'] = '_blank'; |
|
648
|
|
|
|
|
649
|
|
|
$thread_action['social_wong']['image'] = newbb_displayImage('wong', \_MD_SHARE_MRWONG); |
|
650
|
|
|
$thread_action['social_wong']['link'] = "http://www.mister-wong.de/index.php?action=addurl&bm_url=$full_link}"; |
|
651
|
|
|
$thread_action['social_wong']['name'] = \_MD_SHARE_MRWONG; |
|
652
|
|
|
$thread_action['social_wong']['target'] = '_blank'; |
|
653
|
|
|
} |
|
654
|
|
|
|
|
655
|
|
|
$post = [ |
|
656
|
|
|
'post_id' => $post_id, |
|
657
|
|
|
'post_parent_id' => $this->getVar('pid'), |
|
658
|
|
|
'post_date' => newbb_formatTimestamp($this->getVar('post_time')), |
|
|
|
|
|
|
659
|
|
|
'post_image' => $post_image, |
|
660
|
|
|
'post_title' => $post_title, // irmtfan $post_title to add highlight keywords |
|
661
|
|
|
'post_text' => $post_text, |
|
662
|
|
|
'post_attachment' => $post_attachment, |
|
663
|
|
|
'post_edit' => $this->displayPostEdit(), |
|
664
|
|
|
'post_no' => $post_no, |
|
665
|
|
|
'post_signature' => $this->getVar('attachsig') ? @$poster['signature'] : '', |
|
666
|
|
|
'poster_ip' => ($isadmin |
|
667
|
|
|
&& $GLOBALS['xoopsModuleConfig']['show_ip']) ? \long2ip($this->getVar('poster_ip')) : '', |
|
|
|
|
|
|
668
|
|
|
'thread_action' => $thread_action, |
|
669
|
|
|
'thread_buttons' => $thread_buttons, |
|
670
|
|
|
'mod_buttons' => $mod_buttons, |
|
671
|
|
|
'poster' => $poster, |
|
672
|
|
|
'post_permalink' => "<a href='" . $GLOBALS['xoops']->url('/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/viewtopic.php?post_id={$post_id}") . "'></a>", |
|
673
|
|
|
]; |
|
674
|
|
|
|
|
675
|
|
|
unset($thread_buttons, $mod_buttons, $eachposter); |
|
|
|
|
|
|
676
|
|
|
|
|
677
|
|
|
return $post; |
|
678
|
|
|
} |
|
679
|
|
|
} |
|
680
|
|
|
|