1
|
|
|
<?php declare(strict_types=1);
|
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
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project}
|
14
|
|
|
* @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
|
15
|
|
|
* @author XOOPS Development Team
|
16
|
|
|
*/
|
17
|
|
|
|
18
|
|
|
use Xmf\Module\Admin;
|
19
|
|
|
use Xmf\Request;
|
20
|
|
|
use XoopsModules\Songlist\Common\TestdataButtons;
|
21
|
|
|
use XoopsModules\Songlist\Helper;
|
22
|
|
|
use XoopsModules\Songlist\Utility;
|
23
|
|
|
use XoopsModules\Songlist\Common\Configurator;
|
24
|
|
|
|
25
|
|
|
/** @var Admin $adminObject */
|
26
|
|
|
/** @var Helper $helper */
|
27
|
|
|
/** @var Utility $utility */
|
28
|
|
|
|
29
|
|
|
require __DIR__ . '/header.php';
|
30
|
|
|
xoops_loadLanguage('admin', 'songlist');
|
31
|
|
|
|
32
|
|
|
xoops_cp_header();
|
33
|
|
|
|
34
|
|
|
//check for upload folders, create if needed
|
35
|
|
|
$configurator = new Configurator();
|
36
|
|
|
foreach (array_keys($configurator->uploadFolders) as $i) {
|
37
|
|
|
$utility::createFolder($configurator->uploadFolders[$i]);
|
38
|
|
|
$adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder');
|
39
|
|
|
}
|
40
|
|
|
|
41
|
|
|
$op = (!empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : 'default'));
|
42
|
|
|
|
43
|
|
|
switch ($op) {
|
44
|
|
|
case 'default':
|
45
|
|
|
default:
|
46
|
|
|
$adminObject = Admin::getInstance();
|
47
|
|
|
$adminObject->displayNavigation(basename(__FILE__));
|
48
|
|
|
|
49
|
|
|
$adminObject = Admin::getInstance();
|
50
|
|
|
|
51
|
|
|
$categoryHandler = Helper::getInstance()->getHandler('Category');
|
52
|
|
|
$artistsHandler = Helper::getInstance()->getHandler('Artists');
|
53
|
|
|
$albumsHandler = Helper::getInstance()->getHandler('Albums');
|
54
|
|
|
$genreHandler = Helper::getInstance()->getHandler('Genre');
|
55
|
|
|
$voiceHandler = Helper::getInstance()->getHandler('Voice');
|
56
|
|
|
$songsHandler = Helper::getInstance()->getHandler('Songs');
|
57
|
|
|
$requestsHandler = Helper::getInstance()->getHandler('Requests');
|
58
|
|
|
$votesHandler = Helper::getInstance()->getHandler('Votes');
|
59
|
|
|
|
60
|
|
|
$adminObject->addInfoBox(_AM_SONGLIST_COUNT);
|
61
|
|
|
$adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_CATEGORY . '</label>', $categoryHandler->getCount(null, true)), '', 'green');
|
|
|
|
|
62
|
|
|
$adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ARTISTS . '</label>', $artistsHandler->getCount(null, true)), '', 'green');
|
63
|
|
|
$adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_ALBUMS . '</label>', $albumsHandler->getCount(null, true)), '', 'green');
|
64
|
|
|
$adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_GENRE . '</label>', $genreHandler->getCount(null, true)), '', 'green');
|
65
|
|
|
$adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOICE . '</label>', $voiceHandler->getCount(null, true)), '', 'green');
|
66
|
|
|
$adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_SONGS . '</label>', $songsHandler->getCount(null, true)), '', 'green');
|
67
|
|
|
$adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_REQUESTS . '</label>', $requestsHandler->getCount(null, true)), '', 'green');
|
68
|
|
|
$adminObject->addInfoBoxLine(sprintf('<label>' . _AM_SONGLIST_NUMBER_OF_VOTES . '</label>', $votesHandler->getCount(null, true)), '', 'green');
|
69
|
|
|
|
70
|
|
|
//------------- Test Data Buttons ----------------------------
|
71
|
|
|
if ($helper->getConfig('displaySampleButton')) {
|
72
|
|
|
TestdataButtons::loadButtonConfig($adminObject);
|
73
|
|
|
$adminObject->displayButton('left', '');
|
74
|
|
|
}
|
75
|
|
|
$op = Request::getString('op', 0, 'GET');
|
76
|
|
|
switch ($op) {
|
77
|
|
|
case 'hide_buttons':
|
78
|
|
|
TestdataButtons::hideButtons();
|
79
|
|
|
break;
|
80
|
|
|
case 'show_buttons':
|
81
|
|
|
TestdataButtons::showButtons();
|
82
|
|
|
break;
|
83
|
|
|
}
|
84
|
|
|
//------------- End Test Data Buttons ----------------------------
|
85
|
|
|
|
86
|
|
|
$adminObject->displayIndex();
|
87
|
|
|
|
88
|
|
|
xoops_cp_footer();
|
89
|
|
|
break;
|
90
|
|
|
}
|
91
|
|
|
|
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.