Forum   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 23
c 1
b 0
f 0
dl 0
loc 35
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 1
A dispForumModerators() 0 11 2
1
<?php
2
3
namespace XoopsModules\Newbb;
4
5
/**
6
 * Newbb module
7
 *
8
 * You may not change or alter any portion of this comment or credits
9
 * of supporting developers from this source code or any supporting source code
10
 * which is considered copyrighted (c) material of the original comment or credit authors.
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 *
15
 * @copyright       XOOPS Project (https://xoops.org)
16
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
17
 * @package         newbb
18
 * @since           4.0
19
 * @author          Taiwen Jiang <[email protected]>
20
 */
21
22
23
class Forum extends \XoopsObject
24
{
25
    public function __construct()
26
    {
27
        parent::__construct();
28
        $this->initVar('forum_id', \XOBJ_DTYPE_INT);
29
        $this->initVar('forum_name', \XOBJ_DTYPE_TXTBOX);
30
        $this->initVar('forum_desc', \XOBJ_DTYPE_TXTAREA);
31
        $this->initVar('forum_moderator', \XOBJ_DTYPE_ARRAY, \serialize([]));
32
        $this->initVar('forum_topics', \XOBJ_DTYPE_INT);
33
        $this->initVar('forum_posts', \XOBJ_DTYPE_INT);
34
        $this->initVar('forum_last_post_id', \XOBJ_DTYPE_INT);
35
        $this->initVar('cat_id', \XOBJ_DTYPE_INT);
36
        $this->initVar('parent_forum', \XOBJ_DTYPE_INT);
37
        $this->initVar('hot_threshold', \XOBJ_DTYPE_INT, 20);
38
        $this->initVar('attach_maxkb', \XOBJ_DTYPE_INT, 500);
39
        $this->initVar('attach_ext', \XOBJ_DTYPE_SOURCE, 'zip|jpg|gif|png');
40
        $this->initVar('forum_order', \XOBJ_DTYPE_INT, 99);
41
        $this->initVar('dohtml', \XOBJ_DTYPE_INT, 1);
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function dispForumModerators()
48
    {
49
        $ret = '';
50
        if (!$valid_moderators = $this->getVar('forum_moderator')) {
51
            return $ret;
52
        }
53
        require_once $GLOBALS['xoops']->path('modules/newbb/include/functions.user.php');
54
        $moderators = \newbbGetUnameFromIds($valid_moderators, !empty($GLOBALS['xoopsModuleConfig']['show_realname']), true);
0 ignored issues
show
Bug introduced by
! empty($GLOBALS['xoopsM...fig']['show_realname']) of type boolean is incompatible with the type integer expected by parameter $usereal of newbbGetUnameFromIds(). ( Ignorable by Annotation )

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

54
        $moderators = \newbbGetUnameFromIds($valid_moderators, /** @scrutinizer ignore-type */ !empty($GLOBALS['xoopsModuleConfig']['show_realname']), true);
Loading history...
55
        $ret        = \implode(', ', $moderators);
56
57
        return $ret;
58
    }
59
}
60