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 | /* |
||
4 | You may not change or alter any portion of this comment or credits |
||
5 | of supporting developers from this source code or any supporting source code |
||
6 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
7 | |||
8 | This program is distributed in the hope that it will be useful, |
||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
11 | */ |
||
12 | |||
13 | /** |
||
14 | * wgEvents module for xoops |
||
15 | * |
||
16 | * @copyright 2021 XOOPS Project (https://xoops.org) |
||
17 | * @license GPL 2.0 or later |
||
18 | * @package wgevents |
||
19 | * @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com |
||
20 | */ |
||
21 | |||
22 | use Xmf\Request; |
||
0 ignored issues
–
show
|
|||
23 | use XoopsModules\Wgevents; |
||
24 | use XoopsModules\Wgevents\Constants; |
||
25 | use XoopsModules\Wgevents\Common; |
||
26 | |||
27 | require __DIR__ . '/header.php'; |
||
28 | // Get all request values |
||
29 | $op = Request::getCmd('op', 'list'); |
||
30 | $tbId = Request::getInt('id'); |
||
31 | $start = Request::getInt('start'); |
||
32 | $limit = Request::getInt('limit', $helper->getConfig('adminpager')); |
||
33 | $GLOBALS['xoopsTpl']->assign('start', $start); |
||
34 | $GLOBALS['xoopsTpl']->assign('limit', $limit); |
||
35 | |||
36 | $moduleDirName = \basename(\dirname(__DIR__)); |
||
37 | |||
38 | $GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); |
||
39 | |||
40 | switch ($op) { |
||
41 | case 'list': |
||
42 | default: |
||
43 | $GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js'); |
||
44 | $GLOBALS['xoTheme']->addScript(\WGEVENTS_URL . '/assets/js/jquery-ui.min.js'); |
||
45 | $GLOBALS['xoTheme']->addScript(\WGEVENTS_URL . '/assets/js/sortables.js'); |
||
46 | // Define Stylesheet |
||
47 | $GLOBALS['xoTheme']->addStylesheet($style, null); |
||
48 | $templateMain = 'wgevents_admin_textblock.tpl'; |
||
49 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('textblock.php')); |
||
50 | $adminObject->addItemButton(\_AM_WGEVENTS_ADD_TEXTBLOCK, 'textblock.php?op=new'); |
||
51 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||
52 | $textblockCount = $textblockHandler->getCountTextblocks(); |
||
53 | $GLOBALS['xoopsTpl']->assign('textblockCount', $textblockCount); |
||
54 | $GLOBALS['xoopsTpl']->assign('wgevents_url', \WGEVENTS_URL); |
||
55 | $GLOBALS['xoopsTpl']->assign('wgevents_upload_url', \WGEVENTS_UPLOAD_URL); |
||
56 | $GLOBALS['xoopsTpl']->assign('wgevents_icons_url_16', \WGEVENTS_ICONS_URL_16); |
||
57 | // Table view textblocks |
||
58 | if ($textblockCount > 0) { |
||
59 | $textblockAll = $textblockHandler->getAllTextblocks(); |
||
60 | foreach (\array_keys($textblockAll) as $i) { |
||
61 | $textblock = $textblockAll[$i]->getValuesTextblocks(); |
||
62 | $GLOBALS['xoopsTpl']->append('textblocks_list', $textblock); |
||
63 | unset($textblock); |
||
64 | } |
||
65 | } else { |
||
66 | $GLOBALS['xoopsTpl']->assign('error', \_AM_WGEVENTS_THEREARENT_TEXTBLOCKS); |
||
67 | } |
||
68 | break; |
||
69 | case 'new': |
||
70 | $templateMain = 'wgevents_admin_textblock.tpl'; |
||
71 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('textblock.php')); |
||
72 | $adminObject->addItemButton(\_AM_WGEVENTS_LIST_TEXTBLOCKS, 'textblock.php', 'list'); |
||
73 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||
74 | // Form Create |
||
75 | $textblockObj = $textblockHandler->create(); |
||
76 | $form = $textblockObj->getForm(); |
||
77 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
78 | break; |
||
79 | case 'clone': |
||
80 | $templateMain = 'wgevents_admin_textblock.tpl'; |
||
81 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('textblock.php')); |
||
82 | $adminObject->addItemButton(\_AM_WGEVENTS_LIST_TEXTBLOCKS, 'textblock.php', 'list'); |
||
83 | $adminObject->addItemButton(\_AM_WGEVENTS_ADD_TEXTBLOCK, 'textblock.php?op=new'); |
||
84 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||
85 | // Request source |
||
86 | $tbIdSource = Request::getInt('id_source'); |
||
87 | // Get Form |
||
88 | $textblockObjSource = $textblockHandler->get($tbIdSource); |
||
89 | $textblockObj = $textblockObjSource->xoopsClone(); |
||
90 | $form = $textblockObj->getForm(); |
||
91 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
92 | break; |
||
93 | case 'save': |
||
94 | // Security Check |
||
95 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
96 | \redirect_header('textblock.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||
97 | } |
||
98 | if ($tbId > 0) { |
||
99 | $textblockObj = $textblockHandler->get($tbId); |
||
100 | } else { |
||
101 | $textblockObj = $textblockHandler->create(); |
||
102 | } |
||
103 | // Set Vars |
||
104 | $textblockObj->setVar('name', Request::getString('name')); |
||
105 | $textblockObj->setVar('text', Request::getText('text')); |
||
106 | $textblockObj->setVar('weight', Request::getInt('weight')); |
||
107 | $textblockObj->setVar('catid', Request::getInt('catid')); |
||
108 | $textblockObj->setVar('class', Request::getInt('class')); |
||
109 | $textblockDatecreatedObj = \DateTime::createFromFormat(\_SHORTDATESTRING, Request::getString('datecreated')); |
||
110 | $textblockObj->setVar('datecreated', $textblockDatecreatedObj->getTimestamp()); |
||
111 | $textblockObj->setVar('submitter', Request::getInt('submitter')); |
||
112 | // Insert Data |
||
113 | if ($textblockHandler->insert($textblockObj)) { |
||
114 | \redirect_header('textblock.php?op=list&start=' . $start . '&limit=' . $limit, 2, \_MA_WGEVENTS_FORM_OK); |
||
115 | } |
||
116 | // Get Form |
||
117 | $GLOBALS['xoopsTpl']->assign('error', $textblockObj->getHtmlErrors()); |
||
118 | $form = $textblockObj->getForm(); |
||
119 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
120 | break; |
||
121 | case 'edit': |
||
122 | $templateMain = 'wgevents_admin_textblock.tpl'; |
||
123 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('textblock.php')); |
||
124 | $adminObject->addItemButton(\_AM_WGEVENTS_ADD_TEXTBLOCK, 'textblock.php?op=new'); |
||
125 | $adminObject->addItemButton(\_AM_WGEVENTS_LIST_TEXTBLOCKS, 'textblock.php', 'list'); |
||
126 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||
127 | // Get Form |
||
128 | $textblockObj = $textblockHandler->get($tbId); |
||
129 | $textblockObj->start = $start; |
||
130 | $textblockObj->limit = $limit; |
||
131 | $form = $textblockObj->getForm(); |
||
132 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
133 | break; |
||
134 | case 'delete': |
||
135 | $templateMain = 'wgevents_admin_textblock.tpl'; |
||
136 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('textblock.php')); |
||
137 | $textblockObj = $textblockHandler->get($tbId); |
||
138 | $tbName = $textblockObj->getVar('name'); |
||
139 | if (isset($_REQUEST['ok']) && 1 === (int)$_REQUEST['ok']) { |
||
140 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
141 | \redirect_header('textblock.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||
142 | } |
||
143 | if ($textblockHandler->delete($textblockObj)) { |
||
144 | \redirect_header('textblock.php', 3, \_MA_WGEVENTS_FORM_DELETE_OK); |
||
145 | } else { |
||
146 | $GLOBALS['xoopsTpl']->assign('error', $textblockObj->getHtmlErrors()); |
||
147 | } |
||
148 | } else { |
||
149 | $customConfirm = new Common\Confirm( |
||
150 | ['ok' => 1, 'id' => $tbId, 'start' => $start, 'limit' => $limit, 'op' => 'delete'], |
||
151 | $_SERVER['REQUEST_URI'], |
||
152 | \sprintf(\_MA_WGEVENTS_FORM_SURE_DELETE, $textblockObj->getVar('name'))); |
||
153 | $form = $customConfirm->getFormConfirm(); |
||
154 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||
155 | } |
||
156 | break; |
||
157 | case 'order': |
||
158 | $order = $_POST['order']; |
||
159 | for ($i = 0, $iMax = \count($order); $i < $iMax; $i++) { |
||
160 | $textblockObj = $textblockHandler->get($order[$i]); |
||
161 | $textblockObj->setVar('weight', $i + 1); |
||
162 | $textblockHandler->insert($textblockObj); |
||
163 | } |
||
164 | break; |
||
165 | } |
||
166 | require __DIR__ . '/footer.php'; |
||
167 |
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: