mylinks.php ➔ b_waiting_mylinks()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 43

Duplication

Lines 11
Ratio 25.58 %

Importance

Changes 0
Metric Value
cc 4
nc 8
nop 0
dl 11
loc 43
rs 9.232
c 0
b 0
f 0
1
<?php
2
/**
3
 * @return array
4
 */
5
function b_waiting_mylinks()
6
{
7
    $xoopsDB = XoopsDatabaseFactory::getDatabaseConnection();
8
    $ret     = array();
9
10
    // mylinks links
11
    $block  = array();
12
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('mylinks_links') . ' WHERE status=0');
13 View Code Duplication
    if ($result) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
        $block['adminlink'] = XOOPS_URL . '/modules/mylinks/admin/main.php?op=listNewLinks';
15
        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
16
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
17
    }
18
    $ret[] = $block;
19
20
    // mylinks broken
21
    $block       = array();
22
    $bknHandler = xoops_getModuleHandler('broken', 'mylinks');
23
    $result      = $bknHandler->getCount();
24
    //    $result = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mylinks_broken"));
25
    if ($result) {
26
        $block['adminlink'] = $xoops->url('modules/mylinks/admin/main.php?op=listBrokenLinks');
0 ignored issues
show
Bug introduced by
The variable $xoops does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
27
        //        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
28
        $block['pendingnum']    = $result;
29
        $block['lang_linkname'] = _PI_WAITING_BROKENS;
30
    }
31
    $ret[] = $block;
32
33
    // mylinks modreq
34
    $block          = array();
35
    $modreqHandler = xoops_getModuleHandler('modification', 'mylinks');
36
    $result         = $modreqHandler->getCount();
37
    //    $result = $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("mylinks_mod"));
38 View Code Duplication
    if ($result) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
39
        $block['adminlink'] = XOOPS_URL . '/modules/mylinks/admin/main.php?op=listModReq';
40
        //        list($block['pendingnum']) = $xoopsDB->fetchRow($result);
41
        $block['pendingnum']    = $result;
42
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
43
    }
44
    $ret[] = $block;
45
46
    return $ret;
47
}
48