b_waiting_tdmdownloads()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 34
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 25
nc 8
nop 0
dl 0
loc 34
rs 9.52
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
/*************************************************************************/
5
# Waiting Contents Extensible                                            #
6
# Plugin for module TDMDownloads                                         #
7
#                                                                        #
8
# Author                                                                 #
9
# Danordesign     -   [email protected]                               #
10
#                                                                        #
11
# Last modified on 19.10.2009                                            #
12
/*************************************************************************/
13
/**
14
 * @return array
15
 */
16
function b_waiting_tdmdownloads()
17
{
18
    /** @var \XoopsMySQLDatabase $xoopsDB */
19
    $xoopsDB       = \XoopsDatabaseFactory::getDatabaseConnection();
20
    $moduleDirName = basename(dirname(__DIR__, 2));
21
    $ret           = [];
22
    // TDMdownloads waiting
23
    $block  = [];
24
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tdmdownloads_downloads') . ' WHERE status=0');
25
    if ($result) {
26
        $block['adminlink'] = XOOPS_URL . "/modules/$moduleDirName/admin/downloads.php?op=liste&statut_display=0";
27
        [$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

27
        [$block['pendingnum']] = $xoopsDB->fetchRow(/** @scrutinizer ignore-type */ $result);
Loading history...
28
        $block['lang_linkname'] = _PI_WAITING_WAITINGS;
0 ignored issues
show
Bug introduced by
The constant _PI_WAITING_WAITINGS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
29
    }
30
    $ret[] = $block;
31
    // TDMDownloads broken
32
    $block  = [];
33
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tdmdownloads_broken'));
34
    if ($result) {
35
        $block['adminlink'] = XOOPS_URL . "/modules/$moduleDirName/admin/broken.php";
36
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
37
        $block['lang_linkname'] = _PI_WAITING_BROKENS;
0 ignored issues
show
Bug introduced by
The constant _PI_WAITING_BROKENS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
38
    }
39
    $ret[] = $block;
40
    // TDMDownloads modreq
41
    $block  = [];
42
    $result = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('tdmdownloads_mod'));
43
    if ($result) {
44
        $block['adminlink'] = XOOPS_URL . "/modules/$moduleDirName/admin/modified.php";
45
        [$block['pendingnum']] = $xoopsDB->fetchRow($result);
46
        $block['lang_linkname'] = _PI_WAITING_MODREQS;
0 ignored issues
show
Bug introduced by
The constant _PI_WAITING_MODREQS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
47
    }
48
    $ret[] = $block;
49
    return $ret;
50
}
51