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.
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\Helper\Permission; |
||
20 | use Xmf\Request; |
||
0 ignored issues
–
show
|
|||
21 | |||
22 | require_once __DIR__ . '/admin_header.php'; |
||
23 | xoops_cp_header(); |
||
24 | //It recovered the value of argument op in URL$ |
||
25 | $op = Request::getString('op', 'list'); |
||
26 | $order = Request::getString('order', 'desc'); |
||
27 | $sort = Request::getString('sort', ''); |
||
28 | $adminObject->displayNavigation(basename(__FILE__)); |
||
29 | $permHelper = new Permission(); |
||
30 | //$uploadDir = XOOPS_UPLOAD_PATH . '/suico/images/'; |
||
31 | //$uploadUrl = XOOPS_UPLOAD_URL . '/suico/images/'; |
||
32 | switch ($op) { |
||
33 | case 'new': |
||
34 | $adminObject->addItemButton(AM_SUICO_CONFIGS_LIST, 'configs.php', 'list'); |
||
35 | $adminObject->displayButton('left'); |
||
36 | $configsObject = $configsHandler->create(); |
||
37 | $form = $configsObject->getForm(); |
||
38 | $form->display(); |
||
39 | break; |
||
40 | case 'save': |
||
41 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
42 | redirect_header('configs.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
43 | } |
||
44 | if (0 !== Request::getInt('config_id', 0)) { |
||
45 | $configsObject = $configsHandler->get(Request::getInt('config_id', 0)); |
||
46 | } else { |
||
47 | $configsObject = $configsHandler->create(); |
||
48 | } |
||
49 | // Form save fields |
||
50 | $configsObject->setVar('config_uid', Request::getVar('config_uid', '')); |
||
51 | $configsObject->setVar('pictures', Request::getVar('pictures', '')); |
||
52 | $configsObject->setVar('audio', Request::getVar('audio', '')); |
||
53 | $configsObject->setVar('videos', Request::getVar('videos', '')); |
||
54 | $configsObject->setVar('groups', Request::getVar('groups', '')); |
||
55 | $configsObject->setVar('notes', Request::getVar('notes', '')); |
||
56 | $configsObject->setVar('friends', Request::getVar('friends', '')); |
||
57 | $configsObject->setVar('profile_contact', Request::getVar('profile_contact', '')); |
||
58 | $configsObject->setVar('profile_general', Request::getVar('profile_general', '')); |
||
59 | $configsObject->setVar('profile_stats', Request::getVar('profile_stats', '')); |
||
60 | $configsObject->setVar('suspension', ((1 == Request::getInt('suspension', 0)) ? '1' : '0')); |
||
61 | $configsObject->setVar('backup_password', Request::getVar('backup_password', '')); |
||
62 | $configsObject->setVar('backup_email', Request::getVar('backup_email', '')); |
||
63 | // $configsObject->setVar('end_suspension', date('Y-m-d H:i:s', strtotime($_REQUEST['end_suspension']['date']) + $_REQUEST['end_suspension']['time'])); |
||
64 | $dateTimeObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('end_suspension', '', 'POST')); |
||
65 | $configsObject->setVar('end_suspension', $dateTimeObj->getTimestamp()); |
||
66 | if ($configsHandler->insert($configsObject)) { |
||
67 | redirect_header('configs.php?op=list', 2, AM_SUICO_FORMOK); |
||
68 | } |
||
69 | echo $configsObject->getHtmlErrors(); |
||
70 | $form = $configsObject->getForm(); |
||
71 | $form->display(); |
||
72 | break; |
||
73 | case 'edit': |
||
74 | $adminObject->addItemButton(AM_SUICO_ADD_CONFIGS, 'configs.php?op=new', 'add'); |
||
75 | $adminObject->addItemButton(AM_SUICO_CONFIGS_LIST, 'configs.php', 'list'); |
||
76 | $adminObject->displayButton('left'); |
||
77 | $configsObject = $configsHandler->get(Request::getString('config_id', '')); |
||
78 | $form = $configsObject->getForm(); |
||
79 | $form->display(); |
||
80 | break; |
||
81 | case 'delete': |
||
82 | $configsObject = $configsHandler->get(Request::getString('config_id', '')); |
||
83 | if (1 === Request::getInt('ok', 0)) { |
||
84 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
85 | redirect_header('configs.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||
86 | } |
||
87 | if ($configsHandler->delete($configsObject)) { |
||
88 | redirect_header('configs.php', 3, AM_SUICO_FORMDELOK); |
||
89 | } else { |
||
90 | echo $configsObject->getHtmlErrors(); |
||
91 | } |
||
92 | } else { |
||
93 | xoops_confirm(['ok' => 1, 'config_id' => Request::getString('config_id', ''), 'op' => 'delete'], Request::getUrl('REQUEST_URI', '', 'SERVER'), sprintf(AM_SUICO_FORMSUREDEL, $configsObject->getVar('config_uid'))); |
||
94 | } |
||
95 | break; |
||
96 | case 'clone': |
||
97 | $id_field = Request::getString('config_id', ''); |
||
98 | if ($utility::cloneRecord('suico_configs', 'config_id', $id_field)) { |
||
99 | redirect_header('configs.php', 3, AM_SUICO_CLONED_OK); |
||
100 | } else { |
||
101 | redirect_header('configs.php', 3, AM_SUICO_CLONED_FAILED); |
||
102 | } |
||
103 | break; |
||
104 | case 'list': |
||
105 | default: |
||
106 | $adminObject->addItemButton(AM_SUICO_ADD_CONFIGS, 'configs.php?op=new', 'add'); |
||
107 | $adminObject->displayButton('left'); |
||
108 | $start = Request::getInt('start', 0); |
||
109 | $configsPaginationLimit = $helper->getConfig('userpager'); |
||
110 | $criteria = new CriteriaCompo(); |
||
111 | $criteria->setSort('config_id ASC, config_id'); |
||
112 | $criteria->setOrder('ASC'); |
||
113 | $criteria->setLimit($configsPaginationLimit); |
||
114 | $criteria->setStart($start); |
||
115 | $configsTempRows = $configsHandler->getCount(); |
||
116 | $configsTempArray = $configsHandler->getAll($criteria); |
||
117 | /* |
||
118 | // |
||
119 | // |
||
120 | <th class='center width5'>".AM_SUICO_FORM_ACTION."</th> |
||
121 | // </tr>"; |
||
122 | // $class = "odd"; |
||
123 | */ |
||
124 | // Display Page Navigation |
||
125 | if ($configsTempRows > $configsPaginationLimit) { |
||
126 | xoops_load('XoopsPageNav'); |
||
127 | $pagenav = new \XoopsPageNav( |
||
128 | $configsTempRows, |
||
129 | $configsPaginationLimit, |
||
130 | $start, |
||
131 | 'start', |
||
132 | 'op=list' . '&sort=' . $sort . '&order=' . $order . '' |
||
133 | ); |
||
134 | $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : ''); |
||
135 | } |
||
136 | $GLOBALS['xoopsTpl']->assign('configsRows', $configsTempRows); |
||
137 | $configsArray = []; |
||
138 | $criteria = new CriteriaCompo(); |
||
139 | //$criteria->setOrder('DESC'); |
||
140 | $criteria->setSort($sort); |
||
141 | $criteria->setOrder($order); |
||
142 | $criteria->setLimit($configsPaginationLimit); |
||
143 | $criteria->setStart($start); |
||
144 | $configsCount = $configsHandler->getCount($criteria); |
||
145 | $configsTempArray = $configsHandler->getAll($criteria); |
||
146 | // for ($i = 0; $i < $fieldsCount; ++$i) { |
||
147 | if ($configsCount > 0) { |
||
148 | foreach (array_keys($configsTempArray) as $i) { |
||
149 | $GLOBALS['xoopsTpl']->assign('selectorconfig_id', AM_SUICO_CONFIGS_CONFIG_ID); |
||
150 | $configsArray['config_id'] = $configsTempArray[$i]->getVar('config_id'); |
||
151 | $GLOBALS['xoopsTpl']->assign('selectorconfig_uid', AM_SUICO_CONFIGS_CONFIG_UID); |
||
152 | $configsArray['config_uid'] = strip_tags(\XoopsUser::getUnameFromId($configsTempArray[$i]->getVar('config_uid'))); |
||
153 | $GLOBALS['xoopsTpl']->assign('selectorpictures', AM_SUICO_CONFIGS_PICTURES); |
||
154 | $configsArray['pictures'] = $privacyHandler->get($configsTempArray[$i]->getVar('pictures'))->getVar('name'); |
||
155 | $GLOBALS['xoopsTpl']->assign('selectoraudio', AM_SUICO_CONFIGS_AUDIO); |
||
156 | $configsArray['audio'] = $privacyHandler->get($configsTempArray[$i]->getVar('audio'))->getVar('name'); |
||
157 | $GLOBALS['xoopsTpl']->assign('selectorvideos', AM_SUICO_CONFIGS_VIDEOS); |
||
158 | $configsArray['videos'] = $privacyHandler->get($configsTempArray[$i]->getVar('videos'))->getVar('name'); |
||
159 | $GLOBALS['xoopsTpl']->assign('selectorgroups', AM_SUICO_CONFIGS_GROUPS); |
||
160 | $configsArray['groups'] = $privacyHandler->get($configsTempArray[$i]->getVar('groups'))->getVar('name'); |
||
161 | $GLOBALS['xoopsTpl']->assign('selectornotes', AM_SUICO_CONFIGS_NOTES); |
||
162 | $configsArray['notes'] = $privacyHandler->get($configsTempArray[$i]->getVar('notes'))->getVar('name'); |
||
163 | $GLOBALS['xoopsTpl']->assign('selectorfriends', AM_SUICO_CONFIGS_FRIENDS); |
||
164 | $configsArray['friends'] = $privacyHandler->get($configsTempArray[$i]->getVar('friends'))->getVar('name'); |
||
165 | $GLOBALS['xoopsTpl']->assign('selectorprofile_contact', AM_SUICO_CONFIGS_PROFILE_CONTACT); |
||
166 | $configsArray['profile_contact'] = $privacyHandler->get($configsTempArray[$i]->getVar('profile_contact'))->getVar('name'); |
||
167 | $GLOBALS['xoopsTpl']->assign('selectorprofile_general', AM_SUICO_CONFIGS_PROFILE_GENERAL); |
||
168 | $configsArray['profile_general'] = $privacyHandler->get($configsTempArray[$i]->getVar('profile_general'))->getVar('name'); |
||
169 | $GLOBALS['xoopsTpl']->assign('selectorprofile_stats', AM_SUICO_CONFIGS_PROFILE_STATS); |
||
170 | $configsArray['profile_stats'] = $privacyHandler->get($configsTempArray[$i]->getVar('profile_stats'))->getVar('name'); |
||
171 | $GLOBALS['xoopsTpl']->assign('selectorsuspension', AM_SUICO_CONFIGS_SUSPENSION); |
||
172 | $configsArray['suspension'] = $configsTempArray[$i]->getVar('suspension'); |
||
173 | $GLOBALS['xoopsTpl']->assign('selectorbackup_password', AM_SUICO_CONFIGS_BACKUP_PASSWORD); |
||
174 | $configsArray['backup_password'] = $configsTempArray[$i]->getVar('backup_password'); |
||
175 | $GLOBALS['xoopsTpl']->assign('selectorbackup_email', AM_SUICO_CONFIGS_BACKUP_EMAIL); |
||
176 | $configsArray['backup_email'] = $configsTempArray[$i]->getVar('backup_email'); |
||
177 | $GLOBALS['xoopsTpl']->assign('selectorend_suspension', AM_SUICO_CONFIGS_END_SUSPENSION); |
||
178 | $configsArray['end_suspension'] = formatTimestamp($configsTempArray[$i]->getVar('end_suspension'), 's'); |
||
179 | $configsArray['edit_delete'] = "<a href='configs.php?op=edit&config_id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a> |
||
180 | <a href='configs.php?op=delete&config_id=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a> |
||
181 | <a href='configs.php?op=clone&config_id=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>"; |
||
182 | $GLOBALS['xoopsTpl']->append_by_ref('configsArrays', $configsArray); |
||
183 | unset($configsArray); |
||
184 | } |
||
185 | unset($configsTempArray); |
||
186 | // Display Navigation |
||
187 | if ($configsCount > $configsPaginationLimit) { |
||
188 | xoops_load('XoopsPageNav'); |
||
189 | $pagenav = new \XoopsPageNav( |
||
190 | $configsCount, |
||
191 | $configsPaginationLimit, |
||
192 | $start, |
||
193 | 'start', |
||
194 | 'op=list' . '&sort=' . $sort . '&order=' . $order . '' |
||
195 | ); |
||
196 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||
197 | } |
||
198 | echo $GLOBALS['xoopsTpl']->fetch( |
||
199 | XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar( |
||
200 | 'dirname' |
||
201 | ) . '/templates/admin/suico_admin_configs.tpl' |
||
202 | ); |
||
203 | } |
||
204 | break; |
||
205 | } |
||
206 | require_once __DIR__ . '/admin_footer.php'; |
||
207 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are 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.php
However, as
OtherDir/Foo.php
does 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: