This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 | * SmallWorld |
||
14 | * |
||
15 | * @package \XoopsModules\SmallWorld |
||
16 | * @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/) |
||
17 | * @copyright The XOOPS Project (https://xoops.org) |
||
18 | * @copyright 2011 Culex |
||
19 | * @author Michael Albertsen (http://culex.dk) <[email protected]> |
||
20 | * @link https://github.com/XoopsModules25x/smallworld |
||
21 | * @since 1.0 |
||
22 | */ |
||
23 | |||
24 | use XoopsModules\Smallworld; |
||
25 | use XoopsModules\Smallworld\Constants; |
||
26 | use XoopsModules\Smallworld\Utility; |
||
27 | |||
28 | require_once __DIR__ . '/admin_header.php'; |
||
29 | /** |
||
30 | * Vars defined by inclusion of ./admin_header.php |
||
31 | * |
||
32 | * @var \XoopsModules\Smallworld\Admin $admin |
||
33 | * @var \XoopsModules\Smallworld\SwUserHandler $swUserHandler |
||
34 | * @var \XoopsModules\Smallworld\DoSync $d |
||
35 | * @var \XoopsModules\Smallworld\User $check |
||
36 | * @var \XoopsModules\Smallworld\SwDatabase $swDB |
||
37 | * @var \XoopsModules\Smallworld\WallUpdates $wall |
||
38 | * @var \Xmf\Module\Admin $adminObject |
||
39 | * @var \XoopsModules\Smallworld\Helper $helper |
||
40 | * @var string $moduleDirName |
||
41 | * @var string $moduleDirNameUpper |
||
42 | */ |
||
43 | require_once $helper->path('include/functions.php'); |
||
44 | |||
45 | xoops_cp_header(); |
||
46 | $GLOBALS['xoTheme']->addStylesheet($helper->url('assets/css/SmallworldAdmin.css')); |
||
47 | $GLOBALS['xoTheme']->addScript($helper->url('assets/js/adminsmallworld.js')); |
||
48 | |||
49 | $configurator = include dirname(__DIR__) . '/include/config.php'; |
||
50 | foreach (array_keys($configurator->uploadFolders) as $i) { |
||
51 | Utility::createFolder($configurator->uploadFolders[$i]); |
||
52 | $adminObject->addConfigBoxLine($configurator->uploadFolders[$i], 'folder'); |
||
53 | } |
||
54 | |||
55 | // Sync check for orphans |
||
56 | $d->checkOrphans(); |
||
57 | |||
58 | // Find oldest message and apply to template |
||
59 | $dfm = $admin->oldestMsg(); |
||
60 | $dateoffirstmessage = (Constants::NO_DATE == $dfm) ? _AM_SMALLWORLD_NONEYET : date(_SHORTDATESTRING, $dfm); |
||
61 | |||
62 | // Get days number |
||
63 | $totaldays = $admin->countDays(); |
||
64 | // get average messages per day |
||
65 | $avgperday = $admin->AvgMsgDay($totaldays); |
||
66 | // Smallworld version number |
||
67 | $installversion = $admin->ModuleInstallVersion(); |
||
68 | // Smallworld install date |
||
69 | $installdate = $admin->ModuleInstallDate(); |
||
70 | //check current version of Smallworld, return desc,link,version if new available |
||
71 | $installCheck = $admin->doCheckUpdate(); |
||
72 | // Count members using Smallworld |
||
73 | $sumallusers = $swUserHandler->getCount(); |
||
74 | //$sumallusers = $admin->TotalUsers(); |
||
75 | // Find list of most active users (total) |
||
76 | $maAllround = $admin->mostactiveusers_allround(); |
||
77 | $ma_cnt = 0; |
||
78 | $count = !empty($maAllround) ? count($maAllround['cnt']) : 0; |
||
79 | $mat_cnt = 0; |
||
80 | if (0 !== $count) { |
||
81 | $ma_cnt = 1; |
||
82 | $ma = "<table class='smallworldadmin'><tr>"; |
||
83 | $ma .= '<td><b>' . _AM_SMALLWORLD_STATS_POS . '</b></td><td><b>' . _AM_SMALLWORLD_STATS_IMG . '</b></td><td><b>' . _AM_SMALLWORLD_STATS_AMOUNT . '</b></td><td><b>' . _AM_SMALLWORLD_STATS_NAME . '</b></td></tr>'; |
||
84 | $i = 1; |
||
85 | while ($i <= count($maAllround['cnt'])) { |
||
86 | $ma .= vsprintf('<tr><td>%s</td>', [$maAllround['counter'][$i]]); |
||
87 | $ma .= vsprintf('<td>%s</td>', [$maAllround['img'][$i]]); |
||
88 | $ma .= vsprintf('<td>%s</td>', [$maAllround['cnt'][$i]]); |
||
89 | $ma .= vsprintf('<td>%s</td></tr>', [$maAllround['from'][$i]]); |
||
90 | ++$i; |
||
91 | } |
||
92 | $ma .= '</tr></table>'; |
||
93 | } else { |
||
94 | $maAllround = 0; |
||
95 | } |
||
96 | // Find list of most active users (24 hours) |
||
97 | $maToday = $admin->mostactiveusers_today(); |
||
98 | $count = !empty($maToday) ? count($maToday['cnt']) : 0; |
||
99 | $mat_cnt = 0; |
||
100 | View Code Duplication | if (0 !== $count) { |
|
0 ignored issues
–
show
|
|||
101 | $mat_cnt = 1; |
||
102 | $mat = "<table class='smallworldadmin'><tr>\n" |
||
103 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_POS . "</td>\n" |
||
104 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_IMG . "</td>\n" |
||
105 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_AMOUNT . "</td>\n" |
||
106 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_NAME . "</td></tr>\n"; |
||
107 | $i = 1; |
||
108 | while ($i <= $count) { |
||
109 | $mat .= vsprintf('<tr><td>%s</td>', [$maToday['counter'][$i]]); |
||
110 | $mat .= vsprintf('<td>%s</td>', [$maToday['img'][$i]]); |
||
111 | $mat .= vsprintf('<td>%s</td>', [$maToday['cnt'][$i]]); |
||
112 | $mat .= vsprintf('<td>%s</td></tr>', [$maToday['from'][$i]]); |
||
113 | ++$i; |
||
114 | } |
||
115 | $mat .= "</tr></table>\n"; |
||
116 | } else { |
||
117 | $mat = 0; |
||
118 | } |
||
119 | // FInd list of best rated users overall |
||
120 | $topusers = $admin->topratedusers('up'); |
||
121 | $count = !empty($topusers) ? count($topusers['cnt']) : 0; |
||
122 | $top_cnt = 0; |
||
123 | View Code Duplication | if (0 !== $count) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
124 | $top_cnt = 1; |
||
125 | $top = "<table class='smallworldadmin'><tr>\n" |
||
126 | . " <td class='bold'>" . _AM_SMALLWORLD_STATS_POS . "</td>\n" |
||
127 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_IMG . "</td>\n" |
||
128 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_AMOUNT . "</td>\n" |
||
129 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_NAME . "</td></tr>\n"; |
||
130 | $i = 1; |
||
131 | while ($i <= $count) { |
||
132 | $top .= vsprintf('<tr><td>%s</td>', [$topusers['counter'][$i]]); |
||
133 | $top .= vsprintf('<td>%s</td>', [$topusers['img'][$i]]); |
||
134 | $top .= vsprintf('<td>%s</td>', [$topusers['cnt'][$i]]); |
||
135 | $top .= vsprintf('<td>%s</td></tr>', [$topusers['user'][$i]]); |
||
136 | ++$i; |
||
137 | } |
||
138 | $top .= "</tr></table>\n"; |
||
139 | } else { |
||
140 | $top = 0; |
||
141 | } |
||
142 | |||
143 | // FInd list of worst rated users overall |
||
144 | $lowusers = $admin->topratedusers('down'); |
||
145 | $low_cnt = 0; |
||
146 | $count = !empty($lowusers) ? count($lowusers['cnt']) : 0; |
||
147 | View Code Duplication | if (0 !== $count) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
|
|||
148 | $low_cnt = 1; |
||
149 | $low = "<table class='smallworldadmin'><tr>\n" |
||
150 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_POS . "</td>\n" |
||
151 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_IMG . "</td>\n" |
||
152 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_AMOUNT . "</td>\n" |
||
153 | . "<td class='bold'>" . _AM_SMALLWORLD_STATS_NAME . "</td></tr>\n"; |
||
154 | $i = 1; |
||
155 | while ($i <= $count) { |
||
156 | $low .= vsprintf('<tr><td>%s</td>', [$lowusers['counter'][$i]]); |
||
157 | $low .= vsprintf('<td>%s</td>', [$lowusers['img'][$i]]); |
||
158 | $low .= vsprintf('<td>%s</td>', [$lowusers['cnt'][$i]]); |
||
159 | $low .= vsprintf('<td>%s</td></tr>', [$lowusers['user'][$i]]); |
||
160 | ++$i; |
||
161 | } |
||
162 | $low .= "</tr></table>\n"; |
||
163 | } else { |
||
164 | $low = 0; |
||
165 | } |
||
166 | |||
167 | //----------------------- |
||
168 | |||
169 | // template assignments |
||
170 | $GLOBALS['xoopsTpl']->assign([ |
||
171 | 'lang_moduleinfo' => _AM_SMALLWORLD_MODULEINFO, |
||
172 | 'lang_installversion' => _AM_SMALLWORLD_MODULEINSTALL, |
||
173 | 'lang_installversion_status' => _AM_SMALLWORLD_UPDATE_STATUS, |
||
174 | 'lang_installdate' => _AM_SMALLWORLD_INSTALLDATE |
||
175 | ]); |
||
176 | |||
177 | //$GLOBALS['xoopsTpl']->assign('installversion', $installversion); |
||
178 | //$GLOBALS['xoopsTpl']->assign('installdate', $installdate); |
||
179 | //$GLOBALS['xoopsTpl']->assign('installversion_status',$installCheck); |
||
180 | //$GLOBALS['xoopsTpl']->display($helper->path('templates/admin_moduleinfo.tpl')); |
||
181 | |||
182 | //----------------------- |
||
183 | |||
184 | $adminObject->addInfoBox(_AM_SMALLWORLD_MODULEINFO); |
||
185 | $adminObject->addInfoBoxLine(sprintf("<class='smallworldadmin'>" . _AM_SMALLWORLD_MODULEINSTALL . ' : %s</br>', $installversion), '', 'Green', 'default'); |
||
186 | $adminObject->addInfoBoxLine(sprintf("<class='smallworldadmin'>" . _AM_SMALLWORLD_INSTALLDATE . ': %s', $installdate), '', 'Green', 'default'); |
||
187 | $adminObject->addInfoBoxLine(sprintf("<class='smallworldadmin'>" . '%s', $installCheck), '', 'Green', 'default'); |
||
188 | |||
189 | $adminObject->addInfoBox(_AM_SMALLWORLD_USERSTATS); |
||
190 | $adminObject->addInfoBoxLine(sprintf("<class='smallworldadmin'>" . _AM_SMALLWORLD_DATEOFFIRSTMESSAGE . ' : %s</br>', $dateoffirstmessage), '', 'Green', 'default'); |
||
191 | $adminObject->addInfoBoxLine(sprintf("<class='smallworldadmin'>" . _AM_SMALLWORLD_TOTALUSERS . ' : %s</br>', $sumallusers), '', 'Red', 'default'); |
||
192 | |||
193 | if ($avgperday > 0) { |
||
194 | $adminObject->addInfoBoxLine(sprintf("<class='smallworldadmin'>" . _AM_SMALLWORLD_AVERAGEMSGPERDAY . ' : %s</br>', $avgperday), '', 'Red', 'default'); |
||
195 | } |
||
196 | |||
197 | if (0 != $mat_cnt) { |
||
198 | $adminObject->addInfoBoxLine(sprintf("<p class='smallworldadmin'>" . _AM_SMALLWORLD_TOPCHATTERS_TODAY . ' : %s</p>', $mat), '', 'Red', 'default'); |
||
199 | } |
||
200 | if (0 != $ma_cnt) { |
||
201 | $adminObject->addInfoBoxLine(sprintf("<p class='smallworldadmin'>" . _AM_SMALLWORLD_TOPCHATTERS . ' : %s</p>', $ma), '', 'Red', 'default'); |
||
202 | } |
||
203 | if (0 != $top_cnt) { |
||
204 | $adminObject->addInfoBoxLine(sprintf("<p class='smallworldadmin'>" . _AM_SMALLWORLD_TOPRATEDUSERS . ' : %s</p>', $top), '', 'Red', 'default'); |
||
205 | } |
||
206 | if (0 != $low_cnt) { |
||
207 | $adminObject->addInfoBoxLine(sprintf("<p class='smallworldadmin'>" . _AM_SMALLWORLD_BOTTOMRATEDUSERS . ' : %s</p>', $low), '', 'Red', 'default'); |
||
208 | } |
||
209 | |||
210 | echo $adminObject->displayNavigation('index.php'); |
||
211 | echo $adminObject->displayIndex(); |
||
212 | |||
213 | echo Utility::getServerStats(); |
||
214 | |||
215 | require_once __DIR__ . '/admin_footer.php'; |
||
216 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.