|
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
|
|
|
* @category Module |
|
14
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
|
15
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
|
16
|
|
|
* @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
use Xmf\Module\Admin; |
|
20
|
|
|
use Xmf\Request; |
|
|
|
|
|
|
21
|
|
|
use XoopsModules\Suico\{ |
|
22
|
|
|
Common, |
|
23
|
|
|
Common\TestdataButtons, |
|
24
|
|
|
Helper, |
|
25
|
|
|
Utility |
|
26
|
|
|
}; |
|
27
|
|
|
/** @var Admin $adminObject */ |
|
28
|
|
|
/** @var Helper $helper */ |
|
29
|
|
|
/** @var Utility $utility */ |
|
30
|
|
|
require_once __DIR__ . '/admin_header.php'; |
|
31
|
|
|
// Display Admin header |
|
32
|
|
|
xoops_cp_header(); |
|
33
|
|
|
$adminObject = Admin::getInstance(); |
|
34
|
|
|
//check or upload folders |
|
35
|
|
|
$configurator = new Common\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
|
|
|
/* |
|
42
|
|
|
//count "total quotes" |
|
43
|
|
|
$quotesCount = $quotesHandler->getCount(); |
|
44
|
|
|
// InfoBox quotes |
|
45
|
|
|
$adminObject->addInfoBox(_AM_SUICO_STATISTICS); |
|
46
|
|
|
// InfoBox quotes |
|
47
|
|
|
$adminObject->addInfoBoxLine(sprintf(_AM_SUICO_THEREARE_QUOTES, $quotesCount)); |
|
48
|
|
|
*/ |
|
49
|
|
|
//count "total Images" |
|
50
|
|
|
/** @var XoopsPersistableObjectHandler $imageHandler */ |
|
51
|
|
|
$totalImages = $imageHandler->getCount(); |
|
52
|
|
|
//count "total Friendship" |
|
53
|
|
|
$totalFriendship = $friendshipHandler->getCount(); |
|
54
|
|
|
//count "total Visitors" |
|
55
|
|
|
$totalVisitors = $visitorsHandler->getCount(); |
|
56
|
|
|
//count "total Video" |
|
57
|
|
|
$totalVideo = $videoHandler->getCount(); |
|
58
|
|
|
//count "total Friendrequest" |
|
59
|
|
|
$totalFriendrequest = $friendrequestHandler->getCount(); |
|
60
|
|
|
//count "total Groups" |
|
61
|
|
|
$totalGroups = $groupsHandler->getCount(); |
|
62
|
|
|
//count "total Relgroupuser" |
|
63
|
|
|
$totalRelgroupuser = $relgroupuserHandler->getCount(); |
|
64
|
|
|
//count "total Notes" |
|
65
|
|
|
$totalNotes = $notesHandler->getCount(); |
|
66
|
|
|
//count "total Configs" |
|
67
|
|
|
$totalConfigs = $configsHandler->getCount(); |
|
68
|
|
|
//count "total Suspensions" |
|
69
|
|
|
$totalSuspensions = $suspensionsHandler->getCount(); |
|
70
|
|
|
//count "total Audio" |
|
71
|
|
|
$totalAudio = $audioHandler->getCount(); |
|
72
|
|
|
//count "total Privacy" |
|
73
|
|
|
$totalPrivacy = $privacyHandler->getCount(); |
|
74
|
|
|
// InfoBox Statistics |
|
75
|
|
|
$adminObject->addInfoBox(AM_SUICO_STATISTICS); |
|
76
|
|
|
// InfoBox images |
|
77
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_IMAGES, $totalImages)); |
|
78
|
|
|
// InfoBox friendship |
|
79
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_FRIENDS, $totalFriendship)); |
|
80
|
|
|
// InfoBox friendrequest |
|
81
|
|
|
$adminObject->addInfoBoxLine( |
|
82
|
|
|
sprintf(AM_SUICO_THEREARE_FRIENDREQUEST, $totalFriendrequest) |
|
83
|
|
|
); |
|
84
|
|
|
// InfoBox visitors |
|
85
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_VISITORS, $totalVisitors)); |
|
86
|
|
|
// InfoBox video |
|
87
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_VIDEO, $totalVideo)); |
|
88
|
|
|
// InfoBox friendrequest |
|
89
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_FRIENDREQUEST, $totalFriendrequest)); |
|
90
|
|
|
// InfoBox groups |
|
91
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_GROUPS, $totalGroups)); |
|
92
|
|
|
// InfoBox relgroupuser |
|
93
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_MEMBERS, $totalRelgroupuser)); |
|
94
|
|
|
// InfoBox notes |
|
95
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_NOTES, $totalNotes)); |
|
96
|
|
|
// InfoBox configs |
|
97
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_CONFIGS, $totalConfigs)); |
|
98
|
|
|
// InfoBox suspensions |
|
99
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_SUSPENSIONS, $totalSuspensions)); |
|
100
|
|
|
// InfoBox audio |
|
101
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_AUDIO, $totalAudio)); |
|
102
|
|
|
// InfoBox privacy |
|
103
|
|
|
$adminObject->addInfoBoxLine(sprintf(AM_SUICO_THEREARE_PRIVACY, $totalPrivacy)); |
|
104
|
|
|
// Render Index |
|
105
|
|
|
$adminObject->displayNavigation(basename(__FILE__)); |
|
106
|
|
|
//check for latest release |
|
107
|
|
|
//$newRelease = $utility->checkVerModule($helper); |
|
108
|
|
|
//if (null !== $newRelease) { |
|
109
|
|
|
// $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"'); |
|
110
|
|
|
//} |
|
111
|
|
|
|
|
112
|
|
|
//------------- Test Data Buttons ---------------------------- |
|
113
|
|
|
if ($helper->getConfig('displaySampleButton')) { |
|
114
|
|
|
TestdataButtons::loadButtonConfig($adminObject); |
|
115
|
|
|
$adminObject->displayButton('left', ''); |
|
116
|
|
|
} |
|
117
|
|
|
$op = Request::getString('op', 0, 'GET'); |
|
118
|
|
|
switch ($op) { |
|
119
|
|
|
case 'hide_buttons': |
|
120
|
|
|
TestdataButtons::hideButtons(); |
|
121
|
|
|
break; |
|
122
|
|
|
case 'show_buttons': |
|
123
|
|
|
TestdataButtons::showButtons(); |
|
124
|
|
|
break; |
|
125
|
|
|
} |
|
126
|
|
|
//------------- End Test Data Buttons ---------------------------- |
|
127
|
|
|
|
|
128
|
|
|
$adminObject->displayIndex(); |
|
129
|
|
|
|
|
130
|
|
|
echo $utility::getServerStats(); |
|
131
|
|
|
require_once __DIR__ . '/admin_footer.php'; |
|
132
|
|
|
|
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: