Passed
Push — master ( 6499a1...73e8f6 )
by Michael
36s queued 12s
created

loadAdminConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * Module: XoopsTube
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 *
9
 * PHP version 5
10
 *
11
 * @category        Module
12
 * @package         Xoopstube
13
 * @author          XOOPS Development Team
14
 * @copyright       2001-2016 XOOPS Project (https://xoops.org)
15
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
16
 * @link            https://xoops.org/
17
 * @since           1.0.6
18
 */
19
20
use Xmf\Module\Admin;
21
use Xmf\Request;
22
use Xmf\Yaml;
23
use XoopsModules\Xoopstube\{
24
    Common\Configurator,
25
    Common\DirectoryChecker,
26
    Common\TestdataButtons,
27
    Helper,
28
    Utility
29
};
30
31
/** @var Admin $adminObject */
32
/** @var Helper $helper */
33
/** @var Utility $utility */
34
35
require_once __DIR__ . '/admin_header.php';
36
xoops_cp_header();
37
38
$adminObject = Admin::getInstance();
39
40
$start     = Request::getInt('start', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start', 0);
41
$start1    = Request::getInt('start1', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start1', 0);
42
$start2    = Request::getInt('start2', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start2', 0);
43
$start3    = Request::getInt('start3', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start3', 0);
44
$start4    = Request::getInt('start4', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start4', 0);
45
$start5    = Request::getInt('start5', 0, 'POST'); // cleanRequestVars($_REQUEST, 'start5', 0);
46
$totalcats = Utility::getTotalCategoryCount();
47
48
$result = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_broken'));
49
[$totalbrokenvideos] = $GLOBALS['xoopsDB']->fetchRow($result);
50
$result2 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_mod'));
51
[$totalmodrequests] = $GLOBALS['xoopsDB']->fetchRow($result2);
52
$result3 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published = 0');
53
[$totalnewvideos] = $GLOBALS['xoopsDB']->fetchRow($result3);
54
$result4 = $GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published > 0');
55
[$totalvideos] = $GLOBALS['xoopsDB']->fetchRow($result4);
56
57
//$xxx='<a href="brokenvideo.php">' . _AM_XOOPSTUBE_SBROKENSUBMIT . '</a><b>';
58
59
$adminObject->addInfoBox(_AM_XOOPSTUBE_MINDEX_VIDEOSUMMARY);
60
if ($totalcats > 0) {
61
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="category.php">' . _AM_XOOPSTUBE_SCATEGORY . '</a><b>' . '</infolabel>', $totalcats), '', 'Green');
62
} else {
63
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SCATEGORY . '</infolabel>', $totalcats), '', 'Green');
64
}
65
66
if ($totalvideos > 0) {
67
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="main.php">' . _AM_XOOPSTUBE_SFILES . '</a><b>' . '</infolabel>', $totalvideos), '', 'Green');
68
} else {
69
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SFILES . '</infolabel>', $totalvideos), '', 'Green');
70
}
71
72
if ($totalnewvideos > 0) {
73
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="newvideos.php">' . _AM_XOOPSTUBE_SNEWFILESVAL . '</a><b>' . '</infolabel>', $totalnewvideos), '', 'Red');
74
} else {
75
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SNEWFILESVAL . '</infolabel>', $totalnewvideos), '', 'Red');
76
}
77
if ($totalmodrequests > 0) {
78
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="modifications.php">' . _AM_XOOPSTUBE_SMODREQUEST . '</a><b>' . '</infolabel>', $totalmodrequests), '', 'Red');
79
} else {
80
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SMODREQUEST . '</infolabel>', $totalmodrequests), '', 'Red');
81
}
82
83
if ($totalbrokenvideos > 0) {
84
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . '<a href="brokenvideo.php">' . _AM_XOOPSTUBE_SBROKENSUBMIT . '</a><b>' . '</infolabel><infotext>', $totalbrokenvideos . '</infotext>'), '', 'Red');
85
} else {
86
    $adminObject->addInfoBoxLine(sprintf('<infolabel>' . _AM_XOOPSTUBE_SBROKENSUBMIT . '</infolabel><infotext>', $totalbrokenvideos . '</infotext>'), '', 'Red');
87
}
88
89
//------ create directories ---------------
90
/*
91
$folderMode = $GLOBALS['xoopsModuleConfig']['dirmode'];
92
// require_once  dirname(__DIR__) . '/class/Utility.php';
93
foreach (array_keys($uploadFolders) as $i) {
94
    Utility::prepareFolder($uploadFolders[$i], $folderMode);
95
    $adminObject->addConfigBoxLine($uploadFolders[$i], 'folder');
96
    //    $adminObject->addConfigBoxLine(array($uploadFolders[$i], $folderMode), 'chmod');
97
}
98
*/
99
100
$adminObject->addConfigBoxLine('');
101
$redirectFile = $_SERVER['SCRIPT_NAME'];
102
103
$configurator  = new Configurator();
104
$uploadFolders = $configurator->uploadFolders;
105
106
foreach (array_keys($uploadFolders) as $i) {
107
    $adminObject->addConfigBoxLine(DirectoryChecker::getDirectoryStatus($uploadFolders[$i], 0777, $redirectFile));
108
}
109
110
111
//require_once  dirname(__DIR__) . '/testdata/index.php';
112
//$adminObject->addItemButton(_AM_XOOPSTUBE_LOAD_SAMPLEDATA, './../testdata/index.php?op=load', 'add');
113
114
$adminObject->displayNavigation(basename(__FILE__));
115
116
//check for latest release
117
//$newRelease = $utility::checkVerModule($helper);
118
//if (!empty($newRelease)) {
119
//    $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"');
120
//}
121
122
//------------- Test Data Buttons ----------------------------
123
if ($helper->getConfig('displaySampleButton')) {
124
    TestdataButtons::loadButtonConfig($adminObject);
125
    $adminObject->displayButton('left', '');
126
}
127
$op = Request::getString('op', 0, 'GET');
128
switch ($op) {
129
    case 'hide_buttons':
130
        TestdataButtons::hideButtons();
131
        break;
132
    case 'show_buttons':
133
        TestdataButtons::showButtons();
134
        break;
135
}
136
//------------- End Test Data Buttons ----------------------------
137
138
139
$adminObject->displayIndex();
140
echo $utility::getServerStats();
141
142
//codeDump(__FILE__);
143
require_once __DIR__ . '/admin_footer.php';
144