XoopsModules25x /
suico
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_SUSPENSIONS_LIST, 'suspensions.php', 'list'); |
||
| 35 | $adminObject->displayButton('left'); |
||
| 36 | $suspensionsObject = $suspensionsHandler->create(); |
||
| 37 | $form = $suspensionsObject->getForm(); |
||
| 38 | $form->display(); |
||
| 39 | break; |
||
| 40 | case 'save': |
||
| 41 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 42 | redirect_header('suspensions.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 43 | } |
||
| 44 | if (0 !== Request::getInt('uid', 0)) { |
||
| 45 | $suspensionsObject = $suspensionsHandler->get(Request::getInt('uid', 0)); |
||
| 46 | } else { |
||
| 47 | $suspensionsObject = $suspensionsHandler->create(); |
||
| 48 | } |
||
| 49 | // Form save fields |
||
| 50 | $suspensionsObject->setVar('old_pass', Request::getVar('old_pass', '')); |
||
| 51 | $suspensionsObject->setVar('old_email', Request::getVar('old_email', '')); |
||
| 52 | $suspensionsObject->setVar('old_signature', Request::getVar('old_signature', '')); |
||
| 53 | $suspensionsObject->setVar('suspension_time', Request::getVar('suspension_time', '')); |
||
| 54 | $suspensionsObject->setVar('old_enc_type', Request::getVar('old_enc_type', '')); |
||
| 55 | $suspensionsObject->setVar('old_pass_expired', Request::getVar('old_pass_expired', '')); |
||
| 56 | if ($suspensionsHandler->insert($suspensionsObject)) { |
||
| 57 | redirect_header('suspensions.php?op=list', 2, AM_SUICO_FORMOK); |
||
| 58 | } |
||
| 59 | echo $suspensionsObject->getHtmlErrors(); |
||
| 60 | $form = $suspensionsObject->getForm(); |
||
| 61 | $form->display(); |
||
| 62 | break; |
||
| 63 | case 'edit': |
||
| 64 | $adminObject->addItemButton(AM_SUICO_ADD_SUSPENSIONS, 'suspensions.php?op=new', 'add'); |
||
| 65 | $adminObject->addItemButton(AM_SUICO_SUSPENSIONS_LIST, 'suspensions.php', 'list'); |
||
| 66 | $adminObject->displayButton('left'); |
||
| 67 | $suspensionsObject = $suspensionsHandler->get(Request::getString('uid', '')); |
||
| 68 | $form = $suspensionsObject->getForm(); |
||
| 69 | $form->display(); |
||
| 70 | break; |
||
| 71 | case 'delete': |
||
| 72 | $suspensionsObject = $suspensionsHandler->get(Request::getString('uid', '')); |
||
| 73 | if (1 === Request::getInt('ok', 0)) { |
||
| 74 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 75 | redirect_header('suspensions.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 76 | } |
||
| 77 | if ($suspensionsHandler->delete($suspensionsObject)) { |
||
| 78 | redirect_header('suspensions.php', 3, AM_SUICO_FORMDELOK); |
||
| 79 | } else { |
||
| 80 | echo $suspensionsObject->getHtmlErrors(); |
||
| 81 | } |
||
| 82 | } else { |
||
| 83 | xoops_confirm( |
||
| 84 | [ |
||
| 85 | 'ok' => 1, |
||
| 86 | 'uid' => Request::getString('uid', ''), |
||
| 87 | 'op' => 'delete', |
||
| 88 | ], |
||
| 89 | Request::getUrl('REQUEST_URI', '', 'SERVER'), |
||
| 90 | sprintf( |
||
| 91 | AM_SUICO_FORMSUREDEL, |
||
| 92 | $suspensionsObject->getVar('uid') |
||
| 93 | ) |
||
| 94 | ); |
||
| 95 | } |
||
| 96 | break; |
||
| 97 | case 'clone': |
||
| 98 | $id_field = Request::getString('uid', ''); |
||
| 99 | if ($utility::cloneRecord('suico_suspensions', 'uid', $id_field)) { |
||
| 100 | redirect_header('suspensions.php', 3, AM_SUICO_CLONED_OK); |
||
| 101 | } else { |
||
| 102 | redirect_header('suspensions.php', 3, AM_SUICO_CLONED_FAILED); |
||
| 103 | } |
||
| 104 | break; |
||
| 105 | case 'list': |
||
| 106 | default: |
||
| 107 | $adminObject->addItemButton(AM_SUICO_ADD_SUSPENSIONS, 'suspensions.php?op=new', 'add'); |
||
| 108 | $adminObject->displayButton('left'); |
||
| 109 | $start = Request::getInt('start', 0); |
||
| 110 | $suspensionsPaginationLimit = $helper->getConfig('userpager'); |
||
| 111 | $criteria = new CriteriaCompo(); |
||
| 112 | $criteria->setSort('uid ASC, uid'); |
||
| 113 | $criteria->setOrder('ASC'); |
||
| 114 | $criteria->setLimit($suspensionsPaginationLimit); |
||
| 115 | $criteria->setStart($start); |
||
| 116 | $suspensionsTempRows = $suspensionsHandler->getCount(); |
||
| 117 | $suspensionsTempArray = $suspensionsHandler->getAll($criteria); |
||
| 118 | /* |
||
| 119 | // |
||
| 120 | // |
||
| 121 | <th class='center width5'>".AM_SUICO_FORM_ACTION."</th> |
||
| 122 | // </tr>"; |
||
| 123 | // $class = "odd"; |
||
| 124 | */ |
||
| 125 | // Display Page Navigation |
||
| 126 | if ($suspensionsTempRows > $suspensionsPaginationLimit) { |
||
| 127 | xoops_load('XoopsPageNav'); |
||
| 128 | $pagenav = new \XoopsPageNav( |
||
| 129 | $suspensionsTempRows, |
||
| 130 | $suspensionsPaginationLimit, |
||
| 131 | $start, |
||
| 132 | 'start', |
||
| 133 | 'op=list' . '&sort=' . $sort . '&order=' . $order . '' |
||
| 134 | ); |
||
| 135 | $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : ''); |
||
| 136 | } |
||
| 137 | $GLOBALS['xoopsTpl']->assign('suspensionsRows', $suspensionsTempRows); |
||
| 138 | $suspensionsArray = []; |
||
| 139 | // $fields = explode('|', uid:int:11::NOT NULL::primary:uid|old_pass:varchar:255::NOT NULL:::old_pass|old_email:varchar:100::NOT NULL:::old_email|old_signature:text:0::NOT NULL:::old_signature|suspension_time:int:11::NOT NULL:::suspension_time|old_enc_type:int:2::NOT NULL:::old_enc_type|old_pass_expired:int:1::NOT NULL:::old_pass_expired); |
||
| 140 | // $fieldsCount = count($fields); |
||
| 141 | $criteria = new CriteriaCompo(); |
||
| 142 | //$criteria->setOrder('DESC'); |
||
| 143 | $criteria->setSort($sort); |
||
| 144 | $criteria->setOrder($order); |
||
| 145 | $criteria->setLimit($suspensionsPaginationLimit); |
||
| 146 | $criteria->setStart($start); |
||
| 147 | $suspensionsCount = $suspensionsHandler->getCount($criteria); |
||
| 148 | $suspensionsTempArray = $suspensionsHandler->getAll($criteria); |
||
| 149 | // for ($i = 0; $i < $fieldsCount; ++$i) { |
||
| 150 | if ($suspensionsCount > 0) { |
||
| 151 | foreach (array_keys($suspensionsTempArray) as $i) { |
||
| 152 | // $field = explode(':', $fields[$i]); |
||
| 153 | $GLOBALS['xoopsTpl']->assign( |
||
| 154 | 'selectoruid', |
||
| 155 | AM_SUICO_SUSPENSIONS_UID |
||
| 156 | ); |
||
| 157 | $suspensionsArray['uid'] = $suspensionsTempArray[$i]->getVar('uid'); |
||
| 158 | $GLOBALS['xoopsTpl']->assign('selectorold_pass', AM_SUICO_SUSPENSIONS_OLD_PASS); |
||
| 159 | $suspensionsArray['old_pass'] = $suspensionsTempArray[$i]->getVar('old_pass'); |
||
| 160 | $GLOBALS['xoopsTpl']->assign('selectorold_email', AM_SUICO_SUSPENSIONS_OLD_EMAIL); |
||
| 161 | $suspensionsArray['old_email'] = $suspensionsTempArray[$i]->getVar('old_email'); |
||
| 162 | $GLOBALS['xoopsTpl']->assign('selectorold_signature', AM_SUICO_SUSPENSIONS_OLD_SIGNATURE); |
||
| 163 | $suspensionsArray['old_signature'] = strip_tags($suspensionsTempArray[$i]->getVar('old_signature')); |
||
| 164 | $GLOBALS['xoopsTpl']->assign('selectorsuspension_time', AM_SUICO_SUSPENSIONS_SUSPENSION_TIME); |
||
| 165 | $suspensionsArray['suspension_time'] = $suspensionsTempArray[$i]->getVar('suspension_time'); |
||
| 166 | $GLOBALS['xoopsTpl']->assign('selectorold_enc_type', AM_SUICO_SUSPENSIONS_OLD_ENC_TYPE); |
||
| 167 | $suspensionsArray['old_enc_type'] = $suspensionsTempArray[$i]->getVar('old_enc_type'); |
||
| 168 | $GLOBALS['xoopsTpl']->assign('selectorold_pass_expired', AM_SUICO_SUSPENSIONS_OLD_PASS_EXPIRED); |
||
| 169 | $suspensionsArray['old_pass_expired'] = $suspensionsTempArray[$i]->getVar('old_pass_expired'); |
||
| 170 | $suspensionsArray['edit_delete'] = "<a href='suspensions.php?op=edit&uid=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a> |
||
| 171 | <a href='suspensions.php?op=delete&uid=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a> |
||
| 172 | <a href='suspensions.php?op=clone&uid=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>"; |
||
| 173 | $GLOBALS['xoopsTpl']->append_by_ref('suspensionsArrays', $suspensionsArray); |
||
| 174 | unset($suspensionsArray); |
||
| 175 | } |
||
| 176 | unset($suspensionsTempArray); |
||
| 177 | // Display Navigation |
||
| 178 | if ($suspensionsCount > $suspensionsPaginationLimit) { |
||
| 179 | xoops_load('XoopsPageNav'); |
||
| 180 | $pagenav = new \XoopsPageNav( |
||
| 181 | $suspensionsCount, |
||
| 182 | $suspensionsPaginationLimit, |
||
| 183 | $start, |
||
| 184 | 'start', |
||
| 185 | 'op=list' . '&sort=' . $sort . '&order=' . $order . '' |
||
| 186 | ); |
||
| 187 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||
| 188 | } |
||
| 189 | echo $GLOBALS['xoopsTpl']->fetch( |
||
| 190 | XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar( |
||
| 191 | 'dirname' |
||
| 192 | ) . '/templates/admin/suico_admin_suspensions.tpl' |
||
| 193 | ); |
||
| 194 | } |
||
| 195 | break; |
||
| 196 | } |
||
| 197 | require_once __DIR__ . '/admin_footer.php'; |
||
| 198 |
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: