XoopsComments::showThreadPost()   F
last analyzed

Complexity

Conditions 23
Paths > 20000

Size

Total Lines 88
Code Lines 68

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 68
dl 0
loc 88
rs 0
c 0
b 0
f 0
cc 23
nc 98400
nop 4

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * XOOPS comments
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * @copyright       (c) 2000-2025 XOOPS Project (https://xoops.org)
13
 * @license             GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html)
14
 * @package             kernel
15
 * @since               2.0.0
16
 * @author              Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, http://jp.xoops.org/
17
 */
18
19
if (!defined('XOOPS_ROOT_PATH')) {
20
    throw new \RuntimeException('Restricted access');
21
}
22
23
include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
24
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
25
include_once XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/comment.php';
26
27
$GLOBALS['xoopsLogger']->addDeprecated("'/class/xoopscommments.php' is deprecated since XOOPS 2.5.4, please use '/kernel/comment.php' instead.");
28
29
/**
30
 * Xoops Comments Object Class
31
 *
32
 * @author              Kazumi Ono <[email protected]>
33
 * @author              John Neill <[email protected]>
34
 * @copyright       (c) 2000-2025 XOOPS Project (https://xoops.org)
35
 * @package             kernel
36
 * @subpackage          comments
37
 * @access              public
38
 * @deprecated since 2.5.4 Use \XoopsComment in /kernel/comment.php instead.
39
 */
40
class XoopsComments extends XoopsObject
41
{
42
    public $ctable;
43
    /**
44
     * @var \XoopsMySQLDatabase
45
     */
46
    public $db;
47
    //PHP 8.2 Dynamic properties deprecated
48
    public $comment_id;
49
    public $item_id;
50
    public $order;
51
    public $mode;
52
    public $subject;
53
    public $comment;
54
    public $ip;
55
    public $pid;
56
    public $date;
57
    public $nohtml;
58
    public $nosmiley;
59
    public $noxcode;
60
    public $user_id;
61
    public $icon;
62
    public $prefix;
63
64
    /**
65
     * @param string|null $ctable
66
     * @param array|int|string|null $id
67
     */
68
    public function __construct($ctable, $id = null)
69
    {
70
        $this->ctable = $ctable;
71
        $this->db     = XoopsDatabaseFactory::getDatabaseConnection();
72
        parent::__construct();
73
        $this->initVar('comment_id', XOBJ_DTYPE_INT, null, false);
74
        $this->initVar('item_id', XOBJ_DTYPE_INT, null, false);
75
        $this->initVar('order', XOBJ_DTYPE_INT, null, false);
76
        $this->initVar('mode', XOBJ_DTYPE_OTHER, null, false);
77
        $this->initVar('subject', XOBJ_DTYPE_TXTBOX, null, false, 255);
78
        $this->initVar('comment', XOBJ_DTYPE_TXTAREA, null, false, null);
79
        $this->initVar('ip', XOBJ_DTYPE_OTHER, null, false);
80
        $this->initVar('pid', XOBJ_DTYPE_INT, 0, false);
81
        $this->initVar('date', XOBJ_DTYPE_INT, null, false);
82
        $this->initVar('nohtml', XOBJ_DTYPE_INT, 1, false);
83
        $this->initVar('nosmiley', XOBJ_DTYPE_INT, 0, false);
84
        $this->initVar('noxcode', XOBJ_DTYPE_INT, 0, false);
85
        $this->initVar('user_id', XOBJ_DTYPE_INT, null, false);
86
        $this->initVar('icon', XOBJ_DTYPE_OTHER, null, false);
87
        $this->initVar('prefix', XOBJ_DTYPE_OTHER, null, false);
88
        if (!empty($id)) {
89
            if (is_array($id)) {
90
                $this->assignVars($id);
91
            } else {
92
                $this->load((int) $id);
93
            }
94
        }
95
    }
96
97
    /**
98
     * Load Comment by ID
99
     *
100
     * @param int $id
101
     */
102
    public function load($id)
103
    {
104
        $id  = (int) $id;
105
        $sql = 'SELECT * FROM ' . $this->ctable . ' WHERE comment_id=' . $id;
106
        $result = $this->db->query($sql);
107
        if (!$this->db->isResultSet($result)) {
108
            throw new \RuntimeException(
109
                \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error(),
110
                E_USER_ERROR,
111
            );
112
        }
113
114
        $arr = $this->db->fetchArray($result);
0 ignored issues
show
Bug introduced by
It seems like $result can also be of type boolean; however, parameter $result of XoopsMySQLDatabase::fetchArray() does only seem to accept mysqli_result, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

114
        $arr = $this->db->fetchArray(/** @scrutinizer ignore-type */ $result);
Loading history...
115
        $this->assignVars($arr);
0 ignored issues
show
Bug introduced by
It seems like $arr can also be of type false; however, parameter $var_arr of XoopsObject::assignVars() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

115
        $this->assignVars(/** @scrutinizer ignore-type */ $arr);
Loading history...
116
    }
117
118
    /**
119
     * Save Comment
120
     *
121
     * @return int|false
122
     */
123
    public function store()
124
    {
125
        if (!$this->cleanVars()) {
126
            return false;
127
        }
128
        foreach ($this->cleanVars as $k => $v) {
129
            ${$k} = $v;
130
        }
131
        $isnew = false;
132
        if (empty($comment_id)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $comment_id seems to never exist and therefore empty should always be true.
Loading history...
133
            $isnew      = true;
134
            $comment_id = $this->db->genId($this->ctable . '_comment_id_seq');
135
            $sql        = sprintf("INSERT INTO %s (comment_id, pid, item_id, date, user_id, ip, subject, comment, nohtml, nosmiley, noxcode, icon) VALUES (%u, %u, %u, %u, %u, '%s', '%s', '%s', %u, %u, %u, '%s')", $this->ctable, $comment_id, $pid, $item_id, time(), $user_id, $ip, $subject, $comment, $nohtml, $nosmiley, $noxcode, $icon);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $pid seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $noxcode seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $nohtml seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $subject seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $nosmiley seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $item_id seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $user_id seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $icon seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $ip seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $comment does not exist. Did you maybe mean $comment_id?
Loading history...
136
        } else {
137
            $sql = sprintf("UPDATE %s SET subject = '%s', comment = '%s', nohtml = %u, nosmiley = %u, noxcode = %u, icon = '%s'  WHERE comment_id = %u", $this->ctable, $subject, $comment, $nohtml, $nosmiley, $noxcode, $icon, $comment_id);
138
        }
139
        if (!$result = $this->db->exec($sql)) {
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
140
            //echo $sql;
141
            return false;
142
        }
143
        if (empty($comment_id)) {
144
            $comment_id = $this->db->getInsertId();
145
        }
146
        if ($isnew != false) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison !== instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
147
            $sql = sprintf('UPDATE %s SET posts = posts+1 WHERE uid = %u', $this->db->prefix('users'), $user_id);
148
            if (!$result = $this->db->exec($sql)) {
149
                echo 'Could not update user posts.';
150
            }
151
        }
152
153
        return $comment_id;
154
    }
155
156
    /**
157
     * Enter description here...
158
     *
159
     * @return int
160
     */
161
    public function delete()
162
    {
163
        $sql = sprintf('DELETE FROM %s WHERE comment_id = %u', $this->ctable, $this->getVar('comment_id'));
0 ignored issues
show
Bug introduced by
It seems like $this->getVar('comment_id') can also be of type array and array; however, parameter $values of sprintf() does only seem to accept double|integer|string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

163
        $sql = sprintf('DELETE FROM %s WHERE comment_id = %u', $this->ctable, /** @scrutinizer ignore-type */ $this->getVar('comment_id'));
Loading history...
164
        if (!$result = $this->db->exec($sql)) {
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
165
            return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the documented return type integer.
Loading history...
166
        }
167
        $sql = sprintf('UPDATE %s SET posts = posts-1 WHERE uid = %u', $this->db->prefix('users'), $this->getVar('user_id'));
168
        if (!$result = $this->db->exec($sql)) {
169
            echo 'Could not update user posts.';
170
        }
171
        $mytree = new XoopsTree($this->ctable, 'comment_id', 'pid');
172
        $arr    = $mytree->getAllChild($this->getVar('comment_id'), 'comment_id');
173
        $size   = count($arr);
0 ignored issues
show
Bug introduced by
It seems like $arr can also be of type mixed; however, parameter $value of count() does only seem to accept Countable|array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

173
        $size   = count(/** @scrutinizer ignore-type */ $arr);
Loading history...
174
        if ($size > 0) {
175
            for ($i = 0; $i < $size; ++$i) {
176
                $sql = sprintf('DELETE FROM %s WHERE comment_bid = %u', $this->ctable, $arr[$i]['comment_id']);
177
                if (!$result = $this->db->exec($sql)) {
178
                    echo 'Could not delete comment.';
179
                }
180
                $sql = sprintf('UPDATE %s SET posts = posts-1 WHERE uid = %u', $this->db->prefix('users'), $arr[$i]['user_id']);
181
                if (!$result = $this->db->exec($sql)) {
182
                    echo 'Could not update user posts.';
183
                }
184
            }
185
        }
186
187
        return ($size + 1);
188
    }
189
190
    /**
191
     * Get Comments Tree
192
     *
193
     * @return mixed
194
     */
195
    public function getCommentTree()
196
    {
197
        $mytree = new XoopsTree($this->ctable, 'comment_id', 'pid');
198
        $ret    = [];
199
        $tarray = $mytree->getChildTreeArray($this->getVar('comment_id'), 'comment_id');
200
        foreach ($tarray as $ele) {
201
            $ret[] = new XoopsComments($this->ctable, $ele);
0 ignored issues
show
Deprecated Code introduced by
The class XoopsComments has been deprecated: since 2.5.4 Use \XoopsComment in /kernel/comment.php instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

201
            $ret[] = /** @scrutinizer ignore-deprecated */ new XoopsComments($this->ctable, $ele);
Loading history...
202
        }
203
204
        return $ret;
205
    }
206
207
    /**
208
     * Get All Comments using criteria match
209
     *
210
     * @param  array  $criteria
211
     * @param  bool   $asobject
212
     * @param  string $orderby
213
     * @param  int    $limit
214
     * @param  int    $start
215
     * @return array
216
     */
217
    public function getAllComments($criteria = [], $asobject = true, $orderby = 'comment_id ASC', $limit = 0, $start = 0)
218
    {
219
        $ret         = [];
220
        $where_query = '';
221
        if (!empty($criteria) && \is_array($criteria)) {
222
            $where_query = ' WHERE';
223
            foreach ($criteria as $c) {
224
                $where_query .= " $c AND";
225
            }
226
            $where_query = substr($where_query, 0, -4);
227
        }
228
        if (!$asobject) {
229
            $sql    = 'SELECT comment_id FROM ' . $this->ctable . "$where_query ORDER BY $orderby";
230
            $result = $this->db->query($sql, $limit, $start);
231
            if (!$this->db->isResultSet($result)) {
232
                throw new \RuntimeException(
233
                    \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error(),
234
                    E_USER_ERROR,
235
                );
236
            }
237
            /** @var array $myrow */
238
            while (false !== ($myrow = $this->db->fetchArray($result))) {
0 ignored issues
show
Bug introduced by
It seems like $result can also be of type boolean; however, parameter $result of XoopsMySQLDatabase::fetchArray() does only seem to accept mysqli_result, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

238
            while (false !== ($myrow = $this->db->fetchArray(/** @scrutinizer ignore-type */ $result))) {
Loading history...
239
                $ret[] = $myrow['comment_id'];
240
            }
241
        } else {
242
            $sql    = 'SELECT * FROM ' . $this->ctable . '' . $where_query . " ORDER BY $orderby";
243
            $result = $this->db->query($sql, $limit, $start);
244
            if (!$this->db->isResultSet($result)) {
245
                throw new \RuntimeException(
246
                    \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error(),
247
                    E_USER_ERROR,
248
                );
249
            }
250
            /** @var array $myrow */
251
            while (false !== ($myrow = $this->db->fetchArray($result))) {
252
                $ret[] = new XoopsComments($this->ctable, $myrow);
0 ignored issues
show
Deprecated Code introduced by
The class XoopsComments has been deprecated: since 2.5.4 Use \XoopsComment in /kernel/comment.php instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

252
                $ret[] = /** @scrutinizer ignore-deprecated */ new XoopsComments($this->ctable, $myrow);
Loading history...
253
            }
254
        }
255
256
        //echo $sql;
257
        return $ret;
258
    }
259
260
    /**
261
     * Enter printNavBar
262
     *
263
     * @param int    $item_id
264
     * @param string $mode
265
     * @param int    $order
266
     */
267
    public function printNavBar($item_id, $mode = 'flat', $order = 1)
268
    {
269
        global $xoopsConfig, $xoopsUser;
270
        echo "<form method='get' action='" . $_SERVER['PHP_SELF'] . "'><table width='100%' border='0' cellspacing='1' cellpadding='2'><tr><td class='bg1' align='center'><select name='mode'><option value='nocomments'";
271
        if ($mode === 'nocomments') {
272
            echo " selected";
273
        }
274
        echo '>' . _NOCOMMENTS . "</option><option value='flat'";
275
        if ($mode === 'flat') {
276
            echo " selected";
277
        }
278
        echo '>' . _FLAT . "</option><option value='thread'";
279
        if ($mode === 'thread' || $mode == '') {
280
            echo " selected";
281
        }
282
        echo '>' . _THREADED . "</option></select><select name='order'><option value='0'";
283
        if ($order != 1) {
284
            echo " selected";
285
        }
286
        echo '>' . _OLDESTFIRST . "</option><option value='1'";
287
        if ($order == 1) {
288
            echo " selected";
289
        }
290
        echo '>' . _NEWESTFIRST . "</option></select><input type='hidden' name='item_id' value='" . (int) $item_id . "' /><input type='submit' value='" . _CM_REFRESH . "' />";
291
        if ($xoopsConfig['anonpost'] == 1 || $xoopsUser) {
292
            if ($mode !== 'flat' || $mode !== 'nocomments' || $mode !== 'thread') {
293
                $mode = 'flat';
294
            }
295
            echo "&nbsp;<input type='button' onclick='location=\"newcomment.php?item_id=" . (int) $item_id . '&amp;order=' . (int) $order . '&amp;mode=' . $mode . "\"' value='" . _CM_POSTCOMMENT . "' />";
296
        }
297
        echo '</td></tr></table></form>';
298
    }
299
300
    /**
301
     * Show Thread
302
     *
303
     */
304
    public function showThreadHead()
305
    {
306
        openThread();
307
    }
308
309
    /**
310
     * Enter description here...
311
     *
312
     * @param string $order
313
     * @param string $mode
314
     * @param int    $adminview
315
     * @param int    $color_num
316
     */
317
    public function showThreadPost($order, $mode, $adminview = 0, $color_num = 1)
318
    {
319
        global $xoopsConfig, $xoopsUser;
320
        $edit_image   = '';
321
        $reply_image  = '';
322
        $delete_image = '';
323
        $post_date    = formatTimestamp($this->getVar('date'), 'm');
324
        if ($this->getVar('user_id') != 0) {
325
            $poster = new XoopsUser($this->getVar('user_id'));
0 ignored issues
show
Bug introduced by
It seems like $this->getVar('user_id') can also be of type boolean and string; however, parameter $id of XoopsUser::__construct() does only seem to accept array|null, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

325
            $poster = new XoopsUser(/** @scrutinizer ignore-type */ $this->getVar('user_id'));
Loading history...
326
            if (!$poster->isActive()) {
327
                $poster = 0;
328
            }
329
        } else {
330
            $poster = 0;
331
        }
332
        if ($this->getVar('icon') != null && $this->getVar('icon') != '') {
333
            $subject_image = "<a name='" . $this->getVar('comment_id') . "' id='" . $this->getVar('comment_id') . "'></a><img src='" . XOOPS_URL . '/images/subject/' . $this->getVar('icon') . "' alt='' />";
334
        } else {
335
            $subject_image = "<a name='" . $this->getVar('comment_id') . "' id='" . $this->getVar('comment_id') . "'></a><img src='" . XOOPS_URL . "/images/icons/no_posticon.gif' alt='' />";
336
        }
337
        if ($adminview) {
338
            $ip_image = "<img src='" . XOOPS_URL . "/images/icons/ip.gif' alt='" . $this->getVar('ip') . "' />";
339
        } else {
340
            $ip_image = "<img src='" . XOOPS_URL . "/images/icons/ip.gif' alt='' />";
341
        }
342
        if ($adminview || ($xoopsUser && $this->getVar('user_id') == $xoopsUser->getVar('uid'))) {
343
            $edit_image = "<a href='editcomment.php?comment_id=" . $this->getVar('comment_id') . '&amp;mode=' . $mode . '&amp;order=' . (int) $order . "'><img src='" . XOOPS_URL . "/images/icons/edit.gif' alt='" . _EDIT . "' /></a>";
344
        }
345
        if ($xoopsConfig['anonpost'] || $xoopsUser) {
346
            $reply_image = "<a href='replycomment.php?comment_id=" . $this->getVar('comment_id') . '&amp;mode=' . $mode . '&amp;order=' . (int) $order . "'><img src='" . XOOPS_URL . "/images/icons/reply.gif' alt='" . _REPLY . "' /></a>";
347
        }
348
        if ($adminview) {
349
            $delete_image = "<a href='deletecomment.php?comment_id=" . $this->getVar('comment_id') . '&amp;mode=' . $mode . '&amp;order=' . (int) $order . "'><img src='" . XOOPS_URL . "/images/icons/delete.gif' alt='" . _DELETE . "' /></a>";
350
        }
351
352
        if ($poster) {
353
            $text = $this->getVar('comment');
354
            if ($poster->getVar('attachsig')) {
355
                $text .= '<p><br>_________________<br>' . $poster->user_sig() . '</p>';
356
            }
357
            $reg_date = _CM_JOINED;
358
            $reg_date .= formatTimestamp($poster->getVar('user_regdate'), 's');
359
            $posts = _CM_POSTS;
360
            $posts .= $poster->getVar('posts');
361
            $user_from = _CM_FROM;
362
            $user_from .= $poster->getVar('user_from');
363
            $rank = $poster->rank();
364
            if ($rank['image'] != '') {
365
                $rank['image'] = "<img src='" . XOOPS_UPLOAD_URL . '/' . $rank['image'] . "' alt='' />";
366
            }
367
            $avatar_image = "<img src='" . XOOPS_UPLOAD_URL . '/' . $poster->getVar('user_avatar') . "' alt='' />";
368
            $online_image = '';
369
            if ($poster->isOnline()) {
370
                $online_image = "<span style='color:#ee0000;font-weight:bold;'>" . _CM_ONLINE . '</span>';
371
            }
372
            $profile_image = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $poster->getVar('uid') . "'><img src='" . XOOPS_URL . "/images/icons/profile.gif' alt='" . _PROFILE . "' /></a>";
373
            $pm_image      = '';
374
            if ($xoopsUser) {
375
                $pm_image = "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . '/pmlite.php?send2=1&amp;to_userid=' . $poster->getVar('uid') . "\",\"pmlite\",565,500);'><img src='" . XOOPS_URL . "/images/icons/pm.gif' alt='" . sprintf(_SENDPMTO, $poster->getVar('uname', 'E')) . "' /></a>";
0 ignored issues
show
Bug introduced by
It seems like $poster->getVar('uname', 'E') can also be of type array and array; however, parameter $values of sprintf() does only seem to accept double|integer|string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

375
                $pm_image = "<a href='javascript:openWithSelfMain(\"" . XOOPS_URL . '/pmlite.php?send2=1&amp;to_userid=' . $poster->getVar('uid') . "\",\"pmlite\",565,500);'><img src='" . XOOPS_URL . "/images/icons/pm.gif' alt='" . sprintf(_SENDPMTO, /** @scrutinizer ignore-type */ $poster->getVar('uname', 'E')) . "' /></a>";
Loading history...
376
            }
377
            $email_image = '';
378
            if ($poster->getVar('user_viewemail')) {
379
                $email_image = "<a href='mailto:" . $poster->getVar('email', 'E') . "'><img src='" . XOOPS_URL . "/images/icons/email.gif' alt='" . sprintf(_SENDEMAILTO, $poster->getVar('uname', 'E')) . "' /></a>";
380
            }
381
            $posterurl = $poster->getVar('url');
382
            $www_image = '';
383
            if ($posterurl != '') {
384
                $www_image = "<a href='$posterurl' rel='external'><img src='" . XOOPS_URL . "/images/icons/www.gif' alt='" . _VISITWEBSITE . "' /></a>";
385
            }
386
            $icq_image = '';
387
            if ($poster->getVar('user_icq') != '') {
388
                $icq_image = "<a href='http://wwp.icq.com/scripts/search.dll?to=" . $poster->getVar('user_icq', 'E') . "'><img src='" . XOOPS_URL . "/images/icons/icq_add.gif' alt='" . _ADD . "' /></a>";
389
            }
390
            $aim_image = '';
391
            if ($poster->getVar('user_aim') != '') {
392
                $aim_image = "<a href='aim:goim?screenname=" . $poster->getVar('user_aim', 'E') . '&message=Hi+' . $poster->getVar('user_aim') . "+Are+you+there?'><img src='" . XOOPS_URL . "/images/icons/aim.gif' alt='aim' /></a>";
393
            }
394
            $yim_image = '';
395
            if ($poster->getVar('user_yim') != '') {
396
                $yim_image = "<a href='http://edit.yahoo.com/config/send_webmesg?.target=" . $poster->getVar('user_yim', 'E') . "&.src=pg'><img src='" . XOOPS_URL . "/images/icons/yim.gif' alt='yim' /></a>";
397
            }
398
            $msnm_image = '';
399
            if ($poster->getVar('user_msnm') != '') {
400
                $msnm_image = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $poster->getVar('uid') . "'><img src='" . XOOPS_URL . "/images/icons/msnm.gif' alt='msnm' /></a>";
401
            }
402
            showThread($color_num, $subject_image, $this->getVar('subject'), $text, $post_date, $ip_image, $reply_image, $edit_image, $delete_image, $poster->getVar('uname'), $rank['title'], $rank['image'], $avatar_image, $reg_date, $posts, $user_from, $online_image, $profile_image, $pm_image, $email_image, $www_image, $icq_image, $aim_image, $yim_image, $msnm_image);
0 ignored issues
show
Bug introduced by
$subject_image of type string is incompatible with the type unknown_type expected by parameter $subject_image of showThread(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

402
            showThread($color_num, /** @scrutinizer ignore-type */ $subject_image, $this->getVar('subject'), $text, $post_date, $ip_image, $reply_image, $edit_image, $delete_image, $poster->getVar('uname'), $rank['title'], $rank['image'], $avatar_image, $reg_date, $posts, $user_from, $online_image, $profile_image, $pm_image, $email_image, $www_image, $icq_image, $aim_image, $yim_image, $msnm_image);
Loading history...
Bug introduced by
$color_num of type integer is incompatible with the type unknown_type expected by parameter $color_number of showThread(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

402
            showThread(/** @scrutinizer ignore-type */ $color_num, $subject_image, $this->getVar('subject'), $text, $post_date, $ip_image, $reply_image, $edit_image, $delete_image, $poster->getVar('uname'), $rank['title'], $rank['image'], $avatar_image, $reg_date, $posts, $user_from, $online_image, $profile_image, $pm_image, $email_image, $www_image, $icq_image, $aim_image, $yim_image, $msnm_image);
Loading history...
403
        } else {
404
            showThread($color_num, $subject_image, $this->getVar('subject'), $this->getVar('comment'), $post_date, $ip_image, $reply_image, $edit_image, $delete_image, $xoopsConfig['anonymous']);
405
        }
406
    }
407
408
    /**
409
     * Show Thread Footer
410
     *
411
     */
412
    public function showThreadFoot()
413
    {
414
        closeThread();
415
    }
416
417
    /**
418
     * Show Thread Head
419
     *
420
     * @param int|string $width
421
     */
422
    public function showTreeHead($width = '100%')
423
    {
424
        echo "<table border='0' class='outer' cellpadding='0' cellspacing='0' align='center' width='$width'><tr class='bg3' align='center'><td colspan='3'>" . _CM_REPLIES . "</td></tr><tr class='bg3' align='left'><td width='60%' class='fg2'>" . _CM_TITLE . "</td><td width='20%' class='fg2'>" . _CM_POSTER . "</td><td class='fg2'>" . _CM_POSTED . '</td></tr>';
425
    }
426
427
    /**
428
     * Show Tree Items
429
     *
430
     * @param string $order
431
     * @param string $mode
432
     * @param int    $color_num
433
     */
434
    public function showTreeItem($order, $mode, $color_num)
435
    {
436
        $bg = 'odd';
437
        if ($color_num == 1) {
438
            $bg = 'even';
439
        }
440
        $prefix = str_replace('.', '&nbsp;&nbsp;&nbsp;&nbsp;', $this->getVar('prefix'));
441
        $date   = formatTimestamp($this->getVar('date'), 'm');
442
        $icon   = 'icons/no_posticon.gif';
443
        if ($this->getVar('icon') != '') {
444
            $icon = 'subject/' . $this->getVar('icon', 'E');
445
        }
446
        echo "<tr class='$bg' align='left'><td>" . $prefix . "<img src='" . XOOPS_URL . '/images/' . $icon . "'>&nbsp;<a href='" . $_SERVER['PHP_SELF'] . '?item_id=' . $this->getVar('item_id') . '&amp;comment_id=' . $this->getVar('comment_id') . '&amp;mode=' . $mode . '&amp;order=' . $order . '#' . $this->getVar('comment_id') . "'>" . $this->getVar('subject') . "</a></td><td><a href='" . XOOPS_URL . '/userinfo.php?uid=' . $this->getVar('user_id') . "'>" . XoopsUser::getUnameFromId($this->getVar('user_id')) . '</a></td><td>' . $date . '</td></tr>';
447
    }
448
449
    /**
450
     * Show Thread Foot
451
     *
452
     */
453
    public function showTreeFoot()
454
    {
455
        echo '</table><br>';
456
    }
457
}
458