b_waiting_wfdownloads()   A
last analyzed

Complexity

Conditions 5
Paths 16

Size

Total Lines 47
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 31
nc 16
nop 0
dl 0
loc 47
rs 9.1128
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
# Waiting Contents Extensible                                            #
4
# Plugin for module WF-Downloads                                         #
5
#                                                                        #
6
# Author                                                                 #
7
# coldfire                                                               #
8
#                                                                        #
9
# Modified by                                                            #
10
# flying.tux     -   [email protected]                                #
11
#                                                                        #
12
# Last modified on 21.04.2005                                            #
13
14
/**
15
 * @return array
16
 */
17
function b_waiting_wfdownloads()
18
{
19
    /** @var \XoopsMySQLDatabase $xoopsDB */
20
    $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
21
    $ret     = [];
22
23
    // wfdownloads pending
24
    $block  = [];
25
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status=0');
26
    if ($result) {
27
        $block['adminlink'] = XOOPS_URL . '/modules/wfdownloads/admin/newdownloads.php';
28
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
0 ignored issues
show
Bug introduced by
It seems like $result can also be of type true; however, parameter $result of XoopsMySQLDatabase::fetchRow() 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

28
        [$block['pendingnum']] = $xoopsDB->fetchRow(/** @scrutinizer ignore-type */ $result);
Loading history...
29
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
30
    }
31
    $ret[] = $block;
32
33
    // wfdownloads broken
34
    $block  = [];
35
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfdownloads_broken'));
36
    if ($result) {
37
        $block['adminlink'] = XOOPS_URL . '/modules/wfdownloads/admin/brokendown.php';
38
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
39
        $block['lang_linkname'] = _PI_WAITING_BROKENS;
40
    }
41
    $ret[] = $block;
42
43
    // wfdownloads modreq
44
    $block  = [];
45
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfdownloads_mod'));
46
    if ($result) {
47
        $block['adminlink'] = XOOPS_URL . '/modules/wfdownloads/admin/modifications.php';
48
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
49
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
50
    }
51
    $ret[] = $block;
52
53
    // wfdownloads reviews
54
    $block  = [];
55
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('wfdownloads_reviews') . ' WHERE submit=0');
56
    if ($result) {
57
        $block['adminlink'] = XOOPS_URL . '/modules/wfdownloads/admin/index.php?op=reviews';
58
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
59
        $block['lang_linkname'] = _PI_WAITING_REVIEWS;
60
    }
61
    $ret[] = $block;
62
63
    return $ret;
64
}
65