Passed
Push — master ( dbde9b...3f3727 )
by Goffy
03:56
created

admin/index.php (2 issues)

Labels
Severity
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 * wgGitHub module for xoops
14
 *
15
 * @copyright      2020 XOOPS Project (https://xooops.org)
16
 * @license        GPL 2.0 or later
17
 * @package        wggithub
18
 * @since          1.0
19
 * @min_xoops      2.5.10
20
 * @author         Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com>
21
 */
22
23
use Xmf\Request;
0 ignored issues
show
The type Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
use XoopsModules\Wggithub\Common;
25
26
include_once \dirname(__DIR__) . '/preloads/autoloader.php';
27
require __DIR__ . '/header.php';
28
29
// Template Index
30
$templateMain = 'wggithub_admin_index.tpl';
31
32
$op = Request::getCmd('op', 'list');
33
if ('api_error' == $op) {
34
    $GLOBALS['xoopsTpl']->assign('error', Request::getString('message'));
35
}
36
37
// Count elements
38
$countSettings = $settingsHandler->getCount();
39
$countDirectories = $directoriesHandler->getCount();
40
$countLogs = $logsHandler->getCount();
41
$countRepositories = $repositoriesHandler->getCount();
42
$countReadmes = $readmesHandler->getCount();
43
$countReleases = $releasesHandler->getCount();
44
45
// InfoBox Statistics
46
$adminObject->addInfoBox(\_AM_WGGITHUB_STATISTICS);
47
// Info elements
48
$adminObject->addInfoBoxLine(\sprintf( '<label>' . \_AM_WGGITHUB_THEREARE_SETTINGS . '</label>', $countSettings));
49
$adminObject->addInfoBoxLine(\sprintf( '<label>' . \_AM_WGGITHUB_THEREARE_DIRECTORIES . '</label>', $countDirectories));
50
$adminObject->addInfoBoxLine(\sprintf( '<label>' . \_AM_WGGITHUB_THEREARE_LOGS . '</label>', $countLogs));
51
$adminObject->addInfoBoxLine(\sprintf( '<label>' . \_AM_WGGITHUB_THEREARE_REPOSITORIES . '</label>', $countRepositories));
52
$adminObject->addInfoBoxLine(\sprintf( '<label>' . \_AM_WGGITHUB_THEREARE_READMES . '</label>', $countReadmes));
53
$adminObject->addInfoBoxLine(\sprintf( '<label>' . \_AM_WGGITHUB_THEREARE_RELEASES . '</label>', $countReleases));
54
55
// Upload Folders
56
$configurator = new Common\Configurator();
57
if ($configurator->uploadFolders && \is_array($configurator->uploadFolders)) {
58
    foreach (\array_keys($configurator->uploadFolders) as $i) {
59
        $folder[] = $configurator->uploadFolders[$i];
60
    }
61
}
62
// Uploads Folders Created
63
foreach (\array_keys($folder) as $i) {
64
    $adminObject->addConfigBoxLine($folder[$i], 'folder');
65
    $adminObject->addConfigBoxLine([$folder[$i], '777'], 'chmod');
66
}
67
68
// Render Index
69
$GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('index.php'));
70
// Test Data
71
if ($helper->getConfig('displaySampleButton')) {
72
    \xoops_loadLanguage('admin/modulesadmin', 'system');
0 ignored issues
show
The function xoops_loadLanguage was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

72
    /** @scrutinizer ignore-call */ \xoops_loadLanguage('admin/modulesadmin', 'system');
Loading history...
73
    include_once \dirname(__DIR__) . '/testdata/index.php';
74
    $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_ADD_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=load', 'add');
75
    $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_SAVE_SAMPLEDATA'), '__DIR__ . /../../testdata/index.php?op=save', 'add');
76
//    $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_EXPORT_SCHEMA'), '__DIR__ . /../../testdata/index.php?op=exportschema', 'add');
77
    $adminObject->displayButton('left');
78
}
79
$GLOBALS['xoopsTpl']->assign('index', $adminObject->displayIndex());
80
// End Test Data
81
require __DIR__ . '/footer.php';
82