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_RELGROUPUSER_LIST, 'relgroupuser.php', 'list'); |
||
| 35 | $adminObject->displayButton('left'); |
||
| 36 | $relgroupuserObject = $relgroupuserHandler->create(); |
||
| 37 | $form = $relgroupuserObject->getForm(); |
||
| 38 | $form->display(); |
||
| 39 | break; |
||
| 40 | case 'save': |
||
| 41 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 42 | redirect_header('relgroupuser.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 43 | } |
||
| 44 | if (0 !== Request::getInt('rel_id', 0)) { |
||
| 45 | $relgroupuserObject = $relgroupuserHandler->get(Request::getInt('rel_id', 0)); |
||
| 46 | } else { |
||
| 47 | $relgroupuserObject = $relgroupuserHandler->create(); |
||
| 48 | } |
||
| 49 | // Form save fields |
||
| 50 | $relgroupuserObject->setVar('rel_group_id', Request::getVar('rel_group_id', '')); |
||
| 51 | $relgroupuserObject->setVar('rel_user_uid', Request::getVar('rel_user_uid', '')); |
||
| 52 | if ($relgroupuserHandler->insert($relgroupuserObject)) { |
||
| 53 | redirect_header('relgroupuser.php?op=list', 2, AM_SUICO_FORMOK); |
||
| 54 | } |
||
| 55 | echo $relgroupuserObject->getHtmlErrors(); |
||
| 56 | $form = $relgroupuserObject->getForm(); |
||
| 57 | $form->display(); |
||
| 58 | break; |
||
| 59 | case 'edit': |
||
| 60 | $adminObject->addItemButton(AM_SUICO_ADD_RELGROUPUSER, 'relgroupuser.php?op=new', 'add'); |
||
| 61 | $adminObject->addItemButton(AM_SUICO_RELGROUPUSER_LIST, 'relgroupuser.php', 'list'); |
||
| 62 | $adminObject->displayButton('left'); |
||
| 63 | $relgroupuserObject = $relgroupuserHandler->get(Request::getString('rel_id', '')); |
||
| 64 | $form = $relgroupuserObject->getForm(); |
||
| 65 | $form->display(); |
||
| 66 | break; |
||
| 67 | case 'delete': |
||
| 68 | $relgroupuserObject = $relgroupuserHandler->get(Request::getString('rel_id', '')); |
||
| 69 | if (1 === Request::getInt('ok', 0)) { |
||
| 70 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 71 | redirect_header('relgroupuser.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 72 | } |
||
| 73 | if ($relgroupuserHandler->delete($relgroupuserObject)) { |
||
| 74 | redirect_header('relgroupuser.php', 3, AM_SUICO_FORMDELOK); |
||
| 75 | } else { |
||
| 76 | echo $relgroupuserObject->getHtmlErrors(); |
||
| 77 | } |
||
| 78 | } else { |
||
| 79 | xoops_confirm( |
||
| 80 | [ |
||
| 81 | 'ok' => 1, |
||
| 82 | 'rel_id' => Request::getString('rel_id', ''), |
||
| 83 | 'op' => 'delete', |
||
| 84 | ], |
||
| 85 | Request::getUrl('REQUEST_URI', '', 'SERVER'), |
||
| 86 | sprintf( |
||
| 87 | AM_SUICO_FORMSUREDEL, |
||
| 88 | $relgroupuserObject->getVar('rel_id') |
||
| 89 | ) |
||
| 90 | ); |
||
| 91 | } |
||
| 92 | break; |
||
| 93 | case 'clone': |
||
| 94 | $id_field = Request::getString('rel_id', ''); |
||
| 95 | if ($utility::cloneRecord('suico_relgroupuser', 'rel_id', $id_field)) { |
||
| 96 | redirect_header('relgroupuser.php', 3, AM_SUICO_CLONED_OK); |
||
| 97 | } else { |
||
| 98 | redirect_header('relgroupuser.php', 3, AM_SUICO_CLONED_FAILED); |
||
| 99 | } |
||
| 100 | break; |
||
| 101 | case 'list': |
||
| 102 | default: |
||
| 103 | $adminObject->addItemButton(AM_SUICO_ADD_RELGROUPUSER, 'relgroupuser.php?op=new', 'add'); |
||
| 104 | $adminObject->displayButton('left'); |
||
| 105 | $start = Request::getInt('start', 0); |
||
| 106 | $relgroupuserPaginationLimit = $helper->getConfig('userpager'); |
||
| 107 | $criteria = new CriteriaCompo(); |
||
| 108 | $criteria->setSort('rel_id ASC, rel_id'); |
||
| 109 | $criteria->setOrder('ASC'); |
||
| 110 | $criteria->setLimit($relgroupuserPaginationLimit); |
||
| 111 | $criteria->setStart($start); |
||
| 112 | $relgroupuserTempRows = $relgroupuserHandler->getCount(); |
||
| 113 | $relgroupuserTempArray = $relgroupuserHandler->getAll($criteria); |
||
| 114 | /* |
||
| 115 | // |
||
| 116 | // |
||
| 117 | <th class='center width5'>".AM_SUICO_FORM_ACTION."</th> |
||
| 118 | // </tr>"; |
||
| 119 | // $class = "odd"; |
||
| 120 | */ |
||
| 121 | // Display Page Navigation |
||
| 122 | if ($relgroupuserTempRows > $relgroupuserPaginationLimit) { |
||
| 123 | xoops_load('XoopsPageNav'); |
||
| 124 | $pagenav = new \XoopsPageNav( |
||
| 125 | $relgroupuserTempRows, |
||
| 126 | $relgroupuserPaginationLimit, |
||
| 127 | $start, |
||
| 128 | 'start', |
||
| 129 | 'op=list' . '&sort=' . $sort . '&order=' . $order . '' |
||
| 130 | ); |
||
| 131 | $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : ''); |
||
| 132 | } |
||
| 133 | $GLOBALS['xoopsTpl']->assign('relgroupuserRows', $relgroupuserTempRows); |
||
| 134 | $relgroupuserArray = []; |
||
| 135 | // $fields = explode('|', rel_id:int:11::NOT NULL::primary:rel_id|rel_group_id:int:11::NOT NULL:::rel_group_id|rel_user_uid:int:11::NOT NULL:::rel_user_uid); |
||
| 136 | // $fieldsCount = count($fields); |
||
| 137 | $criteria = new CriteriaCompo(); |
||
| 138 | //$criteria->setOrder('DESC'); |
||
| 139 | $criteria->setSort($sort); |
||
| 140 | $criteria->setOrder($order); |
||
| 141 | $criteria->setLimit($relgroupuserPaginationLimit); |
||
| 142 | $criteria->setStart($start); |
||
| 143 | $relgroupuserCount = $relgroupuserHandler->getCount($criteria); |
||
| 144 | $relgroupuserTempArray = $relgroupuserHandler->getAll($criteria); |
||
| 145 | // for ($i = 0; $i < $fieldsCount; ++$i) { |
||
| 146 | if ($relgroupuserCount > 0) { |
||
| 147 | foreach (array_keys($relgroupuserTempArray) as $i) { |
||
| 148 | // $field = explode(':', $fields[$i]); |
||
| 149 | $GLOBALS['xoopsTpl']->assign('selectorrel_id', AM_SUICO_RELGROUPUSER_REL_ID); |
||
| 150 | $relgroupuserArray['rel_id'] = $relgroupuserTempArray[$i]->getVar('rel_id'); |
||
| 151 | $GLOBALS['xoopsTpl']->assign('selectorrel_group_id', AM_SUICO_RELGROUPUSER_REL_GROUP_ID); |
||
| 152 | // $relgroupuserArray['rel_group_id'] = ($groupsHandler->get($relgroupuserTempArray[$i]->getVar('rel_group_id')))->getVar('group_title'); |
||
| 153 | $relgroupuserArray['rel_group_id'] = $relgroupuserTempArray[$i]->getVar('rel_group_id'); |
||
| 154 | $GLOBALS['xoopsTpl']->assign('selectorrel_user_uid', AM_SUICO_RELGROUPUSER_REL_USER_UID); |
||
| 155 | $relgroupuserArray['rel_user_uid'] = strip_tags(XoopsUser::getUnameFromId($relgroupuserTempArray[$i]->getVar('rel_user_uid'))); |
||
| 156 | $selectorrel_user_uid = $utility::selectSorting(AM_SUICO_RELGROUPUSER_REL_USER_UID, 'rel_user_uid'); |
||
| 157 | $GLOBALS['xoopsTpl']->assign('selectorrel_user_uid', $selectorrel_user_uid); |
||
| 158 | $relgroupuserArray['rel_user_uid'] = strip_tags(\XoopsUser::getUnameFromId($relgroupuserTempArray[$i]->getVar('rel_user_uid'))); |
||
| 159 | $relgroupuserArray['edit_delete'] = "<a href='relgroupuser.php?op=edit&rel_id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a> |
||
| 160 | <a href='relgroupuser.php?op=delete&rel_id=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a> |
||
| 161 | <a href='relgroupuser.php?op=clone&rel_id=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>"; |
||
| 162 | $GLOBALS['xoopsTpl']->append_by_ref('relgroupuserArrays', $relgroupuserArray); |
||
| 163 | unset($relgroupuserArray); |
||
| 164 | } |
||
| 165 | unset($relgroupuserTempArray); |
||
| 166 | // Display Navigation |
||
| 167 | if ($relgroupuserCount > $relgroupuserPaginationLimit) { |
||
| 168 | xoops_load('XoopsPageNav'); |
||
| 169 | $pagenav = new \XoopsPageNav( |
||
| 170 | $relgroupuserCount, |
||
| 171 | $relgroupuserPaginationLimit, |
||
| 172 | $start, |
||
| 173 | 'start', |
||
| 174 | 'op=list' . '&sort=' . $sort . '&order=' . $order . '' |
||
| 175 | ); |
||
| 176 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||
| 177 | } |
||
| 178 | echo $GLOBALS['xoopsTpl']->fetch( |
||
| 179 | XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar( |
||
| 180 | 'dirname' |
||
| 181 | ) . '/templates/admin/suico_admin_relgroupuser.tpl' |
||
| 182 | ); |
||
| 183 | } |
||
| 184 | break; |
||
| 185 | } |
||
| 186 | require_once __DIR__ . '/admin_footer.php'; |
||
| 187 |
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: