sb_com_update()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 10
nc 4
nop 2
dl 0
loc 15
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Module: Soapbox
5
 * Version: v 1.5
6
 * Release Date: 25 April 2004
7
 * Author: hsalazar
8
 * Licence: GNU
9
 * @param $art_id
10
 * @param $total_num
11
 */
12
// defined('XOOPS_ROOT_PATH') || die('Restricted access');
13
function sb_com_update($art_id, $total_num)
14
{
15
    //HACK
16
    //get soapbox moduleConfig
17
    global $xoopsModule;
18
    $hModConfig            = xoops_getHandler('config');
19
    $soapModuleConfig      = $hModConfig->getConfigList((int)$xoopsModule->getVar('mid'));
0 ignored issues
show
Bug introduced by
The method getConfigList() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

19
    /** @scrutinizer ignore-call */ 
20
    $soapModuleConfig      = $hModConfig->getConfigList((int)$xoopsModule->getVar('mid'));
Loading history...
20
    $globaldisplaycomments = 0;
21
    if (isset($soapModuleConfig['globaldisplaycomments'])) {
22
        $globaldisplaycomments = $soapModuleConfig['globaldisplaycomments'];
23
    }
24
    if (0 === $globaldisplaycomments) {
25
        $db  = \XoopsDatabaseFactory::getDatabaseConnection();
26
        $sql = 'UPDATE ' . $db->prefix('sbarticles') . ' SET commentable = ' . (int)$total_num . ' WHERE articleID = ' . (int)$art_id;
27
        $db->query($sql);
28
    }
29
}
30
31
/**
32
 * @param $comment
33
 */
34
function sb_com_approve($comment)
0 ignored issues
show
Unused Code introduced by
The parameter $comment is not used and could be removed. ( Ignorable by Annotation )

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

34
function sb_com_approve(/** @scrutinizer ignore-unused */ $comment)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
{
36
    // notification mail here
37
}
38