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 = \Xmf\Request::getString('op', 'list'); |
||
| 26 | $order = \Xmf\Request::getString('order', 'desc'); |
||
| 27 | $sort = \Xmf\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_PRIVACY_LIST, 'privacy.php', 'list'); |
||
| 35 | $adminObject->displayButton('left'); |
||
| 36 | $privacyObject = $privacyHandler->create(); |
||
| 37 | $form = $privacyObject->getForm(); |
||
| 38 | $form->display(); |
||
| 39 | break; |
||
| 40 | case 'save': |
||
| 41 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 42 | redirect_header('privacy.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 43 | } |
||
| 44 | if (0 !== \Xmf\Request::getInt('id', 0)) { |
||
| 45 | $privacyObject = $privacyHandler->get(Request::getInt('id', 0)); |
||
| 46 | } else { |
||
| 47 | $privacyObject = $privacyHandler->create(); |
||
| 48 | } |
||
| 49 | // Form save fields |
||
| 50 | $privacyObject->setVar('level', Request::getVar('level', '')); |
||
| 51 | $privacyObject->setVar('name', Request::getVar('name', '')); |
||
| 52 | $privacyObject->setVar('description', Request::getText('description', '')); |
||
| 53 | if ($privacyHandler->insert($privacyObject)) { |
||
| 54 | redirect_header('privacy.php?op=list', 2, AM_SUICO_FORMOK); |
||
| 55 | } |
||
| 56 | echo $privacyObject->getHtmlErrors(); |
||
| 57 | $form = $privacyObject->getForm(); |
||
| 58 | $form->display(); |
||
| 59 | break; |
||
| 60 | case 'edit': |
||
| 61 | $adminObject->addItemButton(AM_SUICO_ADD_PRIVACY, 'privacy.php?op=new', 'add'); |
||
| 62 | $adminObject->addItemButton(AM_SUICO_PRIVACY_LIST, 'privacy.php', 'list'); |
||
| 63 | $adminObject->displayButton('left'); |
||
| 64 | $privacyObject = $privacyHandler->get(Request::getString('id', '')); |
||
| 65 | $form = $privacyObject->getForm(); |
||
| 66 | $form->display(); |
||
| 67 | break; |
||
| 68 | case 'delete': |
||
| 69 | $privacyObject = $privacyHandler->get(Request::getString('id', '')); |
||
| 70 | if (1 == \Xmf\Request::getInt('ok', 0)) { |
||
| 71 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
| 72 | redirect_header('privacy.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||
| 73 | } |
||
| 74 | if ($privacyHandler->delete($privacyObject)) { |
||
| 75 | redirect_header('privacy.php', 3, AM_SUICO_FORMDELOK); |
||
| 76 | } else { |
||
| 77 | echo $privacyObject->getHtmlErrors(); |
||
| 78 | } |
||
| 79 | } else { |
||
| 80 | xoops_confirm(['ok' => 1, 'id' => Request::getString('id', ''), 'op' => 'delete'], Request::getUrl('REQUEST_URI', '', 'SERVER'), sprintf(AM_SUICO_FORMSUREDEL, $privacyObject->getVar('name'))); |
||
| 81 | } |
||
| 82 | break; |
||
| 83 | case 'clone': |
||
| 84 | $id_field = \Xmf\Request::getString('id', ''); |
||
| 85 | if ($utility::cloneRecord('suico_privacy', 'id', $id_field)) { |
||
| 86 | redirect_header('privacy.php', 3, AM_SUICO_CLONED_OK); |
||
| 87 | } else { |
||
| 88 | redirect_header('privacy.php', 3, AM_SUICO_CLONED_FAILED); |
||
| 89 | } |
||
| 90 | break; |
||
| 91 | case 'list': |
||
| 92 | default: |
||
| 93 | $adminObject->addItemButton(AM_SUICO_ADD_PRIVACY, 'privacy.php?op=new', 'add'); |
||
| 94 | $adminObject->displayButton('left'); |
||
| 95 | $start = \Xmf\Request::getInt('start', 0); |
||
| 96 | $privacyPaginationLimit = $helper->getConfig('userpager'); |
||
| 97 | $criteria = new \CriteriaCompo(); |
||
| 98 | $criteria->setSort('id ASC, name'); |
||
| 99 | $criteria->setOrder('ASC'); |
||
| 100 | $criteria->setLimit($privacyPaginationLimit); |
||
| 101 | $criteria->setStart($start); |
||
| 102 | $privacyTempRows = $privacyHandler->getCount(); |
||
| 103 | $privacyTempArray = $privacyHandler->getAll($criteria); |
||
| 104 | /* |
||
| 105 | // |
||
| 106 | // |
||
| 107 | <th class='center width5'>".AM_SUICO_FORM_ACTION."</th> |
||
| 108 | // </tr>"; |
||
| 109 | // $class = "odd"; |
||
| 110 | */ |
||
| 111 | // Display Page Navigation |
||
| 112 | if ($privacyTempRows > $privacyPaginationLimit) { |
||
| 113 | xoops_load('XoopsPageNav'); |
||
| 114 | $pagenav = new \XoopsPageNav( |
||
| 115 | $privacyTempRows, |
||
| 116 | $privacyPaginationLimit, |
||
| 117 | $start, |
||
| 118 | 'start', |
||
| 119 | 'op=list' . '&sort=' . $sort . '&order=' . $order . '' |
||
| 120 | ); |
||
| 121 | $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : ''); |
||
| 122 | } |
||
| 123 | $GLOBALS['xoopsTpl']->assign('privacyRows', $privacyTempRows); |
||
| 124 | $privacyArray = []; |
||
| 125 | // $fields = explode('|', id:int:8::NOT NULL:::ID:0|level:int:8::NOT NULL:::Level:1|name:varchar:20::NOT NULL:::Name:2|description:text:::NOT NULL:::Description:3); |
||
| 126 | // $fieldsCount = count($fields); |
||
| 127 | $criteria = new \CriteriaCompo(); |
||
| 128 | //$criteria->setOrder('DESC'); |
||
| 129 | $criteria->setSort($sort); |
||
| 130 | $criteria->setOrder($order); |
||
| 131 | $criteria->setLimit($privacyPaginationLimit); |
||
| 132 | $criteria->setStart($start); |
||
| 133 | $privacyCount = $privacyHandler->getCount($criteria); |
||
| 134 | $privacyTempArray = $privacyHandler->getAll($criteria); |
||
| 135 | // for ($i = 0; $i < $fieldsCount; ++$i) { |
||
| 136 | if ($privacyCount > 0) { |
||
| 137 | foreach (array_keys($privacyTempArray) as $i) { |
||
| 138 | // $field = explode(':', $fields[$i]); |
||
| 139 | $GLOBALS['xoopsTpl']->assign('selectorid', AM_SUICO_PRIVACY_ID); |
||
| 140 | $privacyArray['id'] = $privacyTempArray[$i]->getVar('id'); |
||
| 141 | $selectorlevel = $utility::selectSorting(AM_SUICO_PRIVACY_LEVEL, 'level'); |
||
| 142 | $GLOBALS['xoopsTpl']->assign('selectorlevel', $selectorlevel); |
||
| 143 | $privacyArray['level'] = $privacyTempArray[$i]->getVar('level'); |
||
| 144 | $GLOBALS['xoopsTpl']->assign('selectorname', AM_SUICO_PRIVACY_NAME); |
||
| 145 | $privacyArray['name'] = $privacyTempArray[$i]->getVar('name'); |
||
| 146 | $GLOBALS['xoopsTpl']->assign('selectordescription', AM_SUICO_PRIVACY_DESCRIPTION); |
||
| 147 | $privacyArray['description'] = $privacyTempArray[$i]->getVar('description'); |
||
| 148 | $privacyArray['description'] = $utility::truncateHtml($privacyArray['description'], $helper->getConfig('truncatelength')); |
||
| 149 | $privacyArray['edit_delete'] = "<a href='privacy.php?op=edit&id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a> |
||
| 150 | <a href='privacy.php?op=delete&id=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a> |
||
| 151 | <a href='privacy.php?op=clone&id=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>"; |
||
| 152 | $GLOBALS['xoopsTpl']->append_by_ref('privacyArrays', $privacyArray); |
||
| 153 | unset($privacyArray); |
||
| 154 | } |
||
| 155 | unset($privacyTempArray); |
||
| 156 | // Display Navigation |
||
| 157 | if ($privacyCount > $privacyPaginationLimit) { |
||
| 158 | xoops_load('XoopsPageNav'); |
||
| 159 | $pagenav = new \XoopsPageNav( |
||
| 160 | $privacyCount, |
||
| 161 | $privacyPaginationLimit, |
||
| 162 | $start, |
||
| 163 | 'start', |
||
| 164 | 'op=list' . '&sort=' . $sort . '&order=' . $order . '' |
||
| 165 | ); |
||
| 166 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||
| 167 | } |
||
| 168 | echo $GLOBALS['xoopsTpl']->fetch( |
||
| 169 | XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/suico_admin_privacy.tpl' |
||
| 170 | ); |
||
| 171 | } |
||
| 172 | break; |
||
| 173 | } |
||
| 174 | require_once __DIR__ . '/admin_footer.php'; |
||
| 175 |
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: