XoopsComments   F
last analyzed

Complexity

Total Complexity 73

Size/Duplication

Total Lines 416
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 223
dl 0
loc 416
rs 2.56
c 0
b 0
f 0
wmc 73

13 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 25 3
A load() 0 14 2
A showTreeFoot() 0 3 1
A showThreadHead() 0 3 1
A showTreeItem() 0 13 3
F showThreadPost() 0 88 23
B delete() 0 27 7
A showTreeHead() 0 3 1
C printNavBar() 0 31 12
A showThreadFoot() 0 3 1
B store() 0 31 8
B getAllComments() 0 41 9
A getCommentTree() 0 10 2

How to fix   Complexity   

Complex Class

Complex classes like XoopsComments often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use XoopsComments, and based on these observations, apply Extract Interface, too.

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
defined('XOOPS_ROOT_PATH') || exit('Restricted access');
20
21
include_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
22
require_once XOOPS_ROOT_PATH . '/kernel/object.php';
23
include_once XOOPS_ROOT_PATH . '/language/' . $GLOBALS['xoopsConfig']['language'] . '/comment.php';
24
25
$GLOBALS['xoopsLogger']->addDeprecated("'/class/xoopscommments.php' is deprecated since XOOPS 2.5.4, please use '/kernel/comment.php' instead.");
26
27
/**
28
 * Xoops Comments Object Class
29
 *
30
 * @author              Kazumi Ono <[email protected]>
31
 * @author              John Neill <[email protected]>
32
 * @copyright       (c) 2000-2025 XOOPS Project (https://xoops.org)
33
 * @package             kernel
34
 * @subpackage          comments
35
 * @access              public
36
 */
37
class XoopsComments extends XoopsObject
38
{
39
    public $ctable;
40
    /**
41
     * @var \XoopsMySQLDatabase
42
     */
43
    public $db;
44
    //PHP 8.2 Dynamic properties deprecated
45
    public $comment_id;
46
    public $item_id;
47
    public $order;
48
    public $mode;
49
    public $subject;
50
    public $comment;
51
    public $ip;
52
    public $pid;
53
    public $date;
54
    public $nohtml;
55
    public $nosmiley;
56
    public $noxcode;
57
    public $user_id;
58
    public $icon;
59
    public $prefix;
60
61
    /**
62
     * @param      $ctable
63
     * @param null|array $id
64
     */
65
    public function __construct($ctable, $id = null)
66
    {
67
        $this->ctable = $ctable;
68
        $this->db     = XoopsDatabaseFactory::getDatabaseConnection();
69
        parent::__construct();
70
        $this->initVar('comment_id', XOBJ_DTYPE_INT, null, false);
71
        $this->initVar('item_id', XOBJ_DTYPE_INT, null, false);
72
        $this->initVar('order', XOBJ_DTYPE_INT, null, false);
73
        $this->initVar('mode', XOBJ_DTYPE_OTHER, null, false);
74
        $this->initVar('subject', XOBJ_DTYPE_TXTBOX, null, false, 255);
75
        $this->initVar('comment', XOBJ_DTYPE_TXTAREA, null, false, null);
76
        $this->initVar('ip', XOBJ_DTYPE_OTHER, null, false);
77
        $this->initVar('pid', XOBJ_DTYPE_INT, 0, false);
78
        $this->initVar('date', XOBJ_DTYPE_INT, null, false);
79
        $this->initVar('nohtml', XOBJ_DTYPE_INT, 1, false);
80
        $this->initVar('nosmiley', XOBJ_DTYPE_INT, 0, false);
81
        $this->initVar('noxcode', XOBJ_DTYPE_INT, 0, false);
82
        $this->initVar('user_id', XOBJ_DTYPE_INT, null, false);
83
        $this->initVar('icon', XOBJ_DTYPE_OTHER, null, false);
84
        $this->initVar('prefix', XOBJ_DTYPE_OTHER, null, false);
85
        if (!empty($id)) {
86
            if (is_array($id)) {
0 ignored issues
show
introduced by
The condition is_array($id) is always true.
Loading history...
87
                $this->assignVars($id);
88
            } else {
89
                $this->load((int) $id);
90
            }
91
        }
92
    }
93
94
    /**
95
     * Load Comment by ID
96
     *
97
     * @param int $id
98
     */
99
    public function load($id)
100
    {
101
        $id  = (int) $id;
102
        $sql = 'SELECT * FROM ' . $this->ctable . ' WHERE comment_id=' . $id;
103
        $result = $this->db->query($sql);
104
        if (!$this->db->isResultSet($result)) {
105
            throw new \RuntimeException(
106
                \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error(),
107
                E_USER_ERROR,
108
            );
109
        }
110
111
        $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

111
        $arr = $this->db->fetchArray(/** @scrutinizer ignore-type */ $result);
Loading history...
112
        $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

112
        $this->assignVars(/** @scrutinizer ignore-type */ $arr);
Loading history...
113
    }
114
115
    /**
116
     * Save Comment
117
     *
118
     * @return int|false
119
     */
120
    public function store()
121
    {
122
        if (!$this->cleanVars()) {
123
            return false;
124
        }
125
        foreach ($this->cleanVars as $k => $v) {
126
            ${$k} = $v;
127
        }
128
        $isnew = false;
129
        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...
130
            $isnew      = true;
131
            $comment_id = $this->db->genId($this->ctable . '_comment_id_seq');
132
            $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 $nohtml 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 $item_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 $pid 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...
Comprehensibility Best Practice introduced by
The variable $user_id 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 $ip seems to be never defined.
Loading history...
Comprehensibility Best Practice introduced by
The variable $subject seems to be never defined.
Loading history...
133
        } else {
134
            $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);
135
        }
136
        if (!$result = $this->db->query($sql)) {
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
137
            //echo $sql;
138
            return false;
139
        }
140
        if (empty($comment_id)) {
141
            $comment_id = $this->db->getInsertId();
142
        }
143
        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...
144
            $sql = sprintf('UPDATE %s SET posts = posts+1 WHERE uid = %u', $this->db->prefix('users'), $user_id);
145
            if (!$result = $this->db->query($sql)) {
146
                echo 'Could not update user posts.';
147
            }
148
        }
149
150
        return $comment_id;
151
    }
152
153
    /**
154
     * Enter description here...
155
     *
156
     * @return int
157
     */
158
    public function delete()
159
    {
160
        $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

160
        $sql = sprintf('DELETE FROM %s WHERE comment_id = %u', $this->ctable, /** @scrutinizer ignore-type */ $this->getVar('comment_id'));
Loading history...
161
        if (!$result = $this->db->query($sql)) {
0 ignored issues
show
Unused Code introduced by
The assignment to $result is dead and can be removed.
Loading history...
162
            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...
163
        }
164
        $sql = sprintf('UPDATE %s SET posts = posts-1 WHERE uid = %u', $this->db->prefix('users'), $this->getVar('user_id'));
165
        if (!$result = $this->db->query($sql)) {
166
            echo 'Could not update user posts.';
167
        }
168
        $mytree = new XoopsTree($this->ctable, 'comment_id', 'pid');
169
        $arr    = $mytree->getAllChild($this->getVar('comment_id'), 'comment_id');
170
        $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

170
        $size   = count(/** @scrutinizer ignore-type */ $arr);
Loading history...
171
        if ($size > 0) {
172
            for ($i = 0; $i < $size; ++$i) {
173
                $sql = sprintf('DELETE FROM %s WHERE comment_bid = %u', $this->ctable, $arr[$i]['comment_id']);
174
                if (!$result = $this->db->query($sql)) {
175
                    echo 'Could not delete comment.';
176
                }
177
                $sql = sprintf('UPDATE %s SET posts = posts-1 WHERE uid = %u', $this->db->prefix('users'), $arr[$i]['user_id']);
178
                if (!$result = $this->db->query($sql)) {
179
                    echo 'Could not update user posts.';
180
                }
181
            }
182
        }
183
184
        return ($size + 1);
185
    }
186
187
    /**
188
     * Get Comments Tree
189
     *
190
     * @return mixed
191
     */
192
    public function getCommentTree()
193
    {
194
        $mytree = new XoopsTree($this->ctable, 'comment_id', 'pid');
195
        $ret    = [];
196
        $tarray = $mytree->getChildTreeArray($this->getVar('comment_id'), 'comment_id');
197
        foreach ($tarray as $ele) {
198
            $ret[] = new XoopsComments($this->ctable, $ele);
199
        }
200
201
        return $ret;
202
    }
203
204
    /**
205
     * Get All Comments using criteria match
206
     *
207
     * @param  array  $criteria
208
     * @param  bool   $asobject
209
     * @param  string $orderby
210
     * @param  int    $limit
211
     * @param  int    $start
212
     * @return array
213
     */
214
    public function getAllComments($criteria = [], $asobject = true, $orderby = 'comment_id ASC', $limit = 0, $start = 0)
215
    {
216
        $ret         = [];
217
        $where_query = '';
218
        if (!empty($criteria) && \is_array($criteria)) {
219
            $where_query = ' WHERE';
220
            foreach ($criteria as $c) {
221
                $where_query .= " $c AND";
222
            }
223
            $where_query = substr($where_query, 0, -4);
224
        }
225
        if (!$asobject) {
226
            $sql    = 'SELECT comment_id FROM ' . $this->ctable . "$where_query ORDER BY $orderby";
227
            $result = $this->db->query($sql, $limit, $start);
228
            if (!$this->db->isResultSet($result)) {
229
                throw new \RuntimeException(
230
                    \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error(),
231
                    E_USER_ERROR,
232
                );
233
            }
234
            /** @var array $myrow */
235
            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

235
            while (false !== ($myrow = $this->db->fetchArray(/** @scrutinizer ignore-type */ $result))) {
Loading history...
236
                $ret[] = $myrow['comment_id'];
237
            }
238
        } else {
239
            $sql    = 'SELECT * FROM ' . $this->ctable . '' . $where_query . " ORDER BY $orderby";
240
            $result = $this->db->query($sql, $limit, $start);
241
            if (!$this->db->isResultSet($result)) {
242
                throw new \RuntimeException(
243
                    \sprintf(_DB_QUERY_ERROR, $sql) . $this->db->error(),
244
                    E_USER_ERROR,
245
                );
246
            }
247
            /** @var array $myrow */
248
            while (false !== ($myrow = $this->db->fetchArray($result))) {
249
                $ret[] = new XoopsComments($this->ctable, $myrow);
250
            }
251
        }
252
253
        //echo $sql;
254
        return $ret;
255
    }
256
257
    /**
258
     * Enter printNavBar
259
     *
260
     * @param int    $item_id
261
     * @param string $mode
262
     * @param int    $order
263
     */
264
    public function printNavBar($item_id, $mode = 'flat', $order = 1)
265
    {
266
        global $xoopsConfig, $xoopsUser;
267
        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'";
268
        if ($mode === 'nocomments') {
269
            echo " selected";
270
        }
271
        echo '>' . _NOCOMMENTS . "</option><option value='flat'";
272
        if ($mode === 'flat') {
273
            echo " selected";
274
        }
275
        echo '>' . _FLAT . "</option><option value='thread'";
276
        if ($mode === 'thread' || $mode == '') {
277
            echo " selected";
278
        }
279
        echo '>' . _THREADED . "</option></select><select name='order'><option value='0'";
280
        if ($order != 1) {
281
            echo " selected";
282
        }
283
        echo '>' . _OLDESTFIRST . "</option><option value='1'";
284
        if ($order == 1) {
285
            echo " selected";
286
        }
287
        echo '>' . _NEWESTFIRST . "</option></select><input type='hidden' name='item_id' value='" . (int) $item_id . "' /><input type='submit' value='" . _CM_REFRESH . "' />";
288
        if ($xoopsConfig['anonpost'] == 1 || $xoopsUser) {
289
            if ($mode !== 'flat' || $mode !== 'nocomments' || $mode !== 'thread') {
290
                $mode = 'flat';
291
            }
292
            echo "&nbsp;<input type='button' onclick='location=\"newcomment.php?item_id=" . (int) $item_id . '&amp;order=' . (int) $order . '&amp;mode=' . $mode . "\"' value='" . _CM_POSTCOMMENT . "' />";
293
        }
294
        echo '</td></tr></table></form>';
295
    }
296
297
    /**
298
     * Show Thread
299
     *
300
     */
301
    public function showThreadHead()
302
    {
303
        openThread();
304
    }
305
306
    /**
307
     * Enter description here...
308
     *
309
     * @param string $order
310
     * @param string $mode
311
     * @param int    $adminview
312
     * @param int    $color_num
313
     */
314
    public function showThreadPost($order, $mode, $adminview = 0, $color_num = 1)
315
    {
316
        global $xoopsConfig, $xoopsUser;
317
        $edit_image   = '';
318
        $reply_image  = '';
319
        $delete_image = '';
320
        $post_date    = formatTimestamp($this->getVar('date'), 'm');
321
        if ($this->getVar('user_id') != 0) {
322
            $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

322
            $poster = new XoopsUser(/** @scrutinizer ignore-type */ $this->getVar('user_id'));
Loading history...
323
            if (!$poster->isActive()) {
324
                $poster = 0;
325
            }
326
        } else {
327
            $poster = 0;
328
        }
329
        if ($this->getVar('icon') != null && $this->getVar('icon') != '') {
330
            $subject_image = "<a name='" . $this->getVar('comment_id') . "' id='" . $this->getVar('comment_id') . "'></a><img src='" . XOOPS_URL . '/images/subject/' . $this->getVar('icon') . "' alt='' />";
331
        } else {
332
            $subject_image = "<a name='" . $this->getVar('comment_id') . "' id='" . $this->getVar('comment_id') . "'></a><img src='" . XOOPS_URL . "/images/icons/no_posticon.gif' alt='' />";
333
        }
334
        if ($adminview) {
335
            $ip_image = "<img src='" . XOOPS_URL . "/images/icons/ip.gif' alt='" . $this->getVar('ip') . "' />";
336
        } else {
337
            $ip_image = "<img src='" . XOOPS_URL . "/images/icons/ip.gif' alt='' />";
338
        }
339
        if ($adminview || ($xoopsUser && $this->getVar('user_id') == $xoopsUser->getVar('uid'))) {
340
            $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>";
341
        }
342
        if ($xoopsConfig['anonpost'] || $xoopsUser) {
343
            $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>";
344
        }
345
        if ($adminview) {
346
            $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>";
347
        }
348
349
        if ($poster) {
350
            $text = $this->getVar('comment');
351
            if ($poster->getVar('attachsig')) {
352
                $text .= '<p><br>_________________<br>' . $poster->user_sig() . '</p>';
353
            }
354
            $reg_date = _CM_JOINED;
355
            $reg_date .= formatTimestamp($poster->getVar('user_regdate'), 's');
356
            $posts = _CM_POSTS;
357
            $posts .= $poster->getVar('posts');
358
            $user_from = _CM_FROM;
359
            $user_from .= $poster->getVar('user_from');
360
            $rank = $poster->rank();
361
            if ($rank['image'] != '') {
362
                $rank['image'] = "<img src='" . XOOPS_UPLOAD_URL . '/' . $rank['image'] . "' alt='' />";
363
            }
364
            $avatar_image = "<img src='" . XOOPS_UPLOAD_URL . '/' . $poster->getVar('user_avatar') . "' alt='' />";
365
            $online_image = '';
366
            if ($poster->isOnline()) {
367
                $online_image = "<span style='color:#ee0000;font-weight:bold;'>" . _CM_ONLINE . '</span>';
368
            }
369
            $profile_image = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $poster->getVar('uid') . "'><img src='" . XOOPS_URL . "/images/icons/profile.gif' alt='" . _PROFILE . "' /></a>";
370
            $pm_image      = '';
371
            if ($xoopsUser) {
372
                $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

372
                $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...
373
            }
374
            $email_image = '';
375
            if ($poster->getVar('user_viewemail')) {
376
                $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>";
377
            }
378
            $posterurl = $poster->getVar('url');
379
            $www_image = '';
380
            if ($posterurl != '') {
381
                $www_image = "<a href='$posterurl' rel='external'><img src='" . XOOPS_URL . "/images/icons/www.gif' alt='" . _VISITWEBSITE . "' /></a>";
382
            }
383
            $icq_image = '';
384
            if ($poster->getVar('user_icq') != '') {
385
                $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>";
386
            }
387
            $aim_image = '';
388
            if ($poster->getVar('user_aim') != '') {
389
                $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>";
390
            }
391
            $yim_image = '';
392
            if ($poster->getVar('user_yim') != '') {
393
                $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>";
394
            }
395
            $msnm_image = '';
396
            if ($poster->getVar('user_msnm') != '') {
397
                $msnm_image = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $poster->getVar('uid') . "'><img src='" . XOOPS_URL . "/images/icons/msnm.gif' alt='msnm' /></a>";
398
            }
399
            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

399
            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

399
            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...
400
        } else {
401
            showThread($color_num, $subject_image, $this->getVar('subject'), $this->getVar('comment'), $post_date, $ip_image, $reply_image, $edit_image, $delete_image, $xoopsConfig['anonymous']);
402
        }
403
    }
404
405
    /**
406
     * Show Thread Footer
407
     *
408
     */
409
    public function showThreadFoot()
410
    {
411
        closeThread();
412
    }
413
414
    /**
415
     * Show Thread Head
416
     *
417
     * @param int|string $width
418
     */
419
    public function showTreeHead($width = '100%')
420
    {
421
        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>';
422
    }
423
424
    /**
425
     * Show Tree Items
426
     *
427
     * @param string $order
428
     * @param string $mode
429
     * @param int    $color_num
430
     */
431
    public function showTreeItem($order, $mode, $color_num)
432
    {
433
        $bg = 'odd';
434
        if ($color_num == 1) {
435
            $bg = 'even';
436
        }
437
        $prefix = str_replace('.', '&nbsp;&nbsp;&nbsp;&nbsp;', $this->getVar('prefix'));
438
        $date   = formatTimestamp($this->getVar('date'), 'm');
439
        $icon   = 'icons/no_posticon.gif';
440
        if ($this->getVar('icon') != '') {
441
            $icon = 'subject/' . $this->getVar('icon', 'E');
442
        }
443
        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>';
444
    }
445
446
    /**
447
     * Show Thread Foot
448
     *
449
     */
450
    public function showTreeFoot()
451
    {
452
        echo '</table><br>';
453
    }
454
}
455