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 |
||||||||
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 | * Module: Pedigree |
||||||||
15 | * |
||||||||
16 | * @category Module |
||||||||
17 | * @package pedigree |
||||||||
18 | * @author XOOPS Development Team <https://xoops.org> |
||||||||
19 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||||||
20 | * @license GPL 2.0 or later |
||||||||
21 | * @link https://xoops.org/ |
||||||||
22 | * @since 1.0.0 |
||||||||
23 | */ |
||||||||
24 | |||||||||
25 | use Xmf\Module\Helper\Permission; |
||||||||
26 | use Xmf\Request; |
||||||||
0 ignored issues
–
show
|
|||||||||
27 | use XoopsModules\Pedigree\{ |
||||||||
28 | Helper |
||||||||
29 | }; |
||||||||
30 | /** @var Helper $helper */ |
||||||||
31 | |||||||||
32 | require_once __DIR__ . '/admin_header.php'; |
||||||||
33 | xoops_cp_header(); |
||||||||
34 | //It recovered the value of argument op in URL$ |
||||||||
35 | $op = Request::getString('op', 'list'); |
||||||||
36 | $order = Request::getString('order', 'desc'); |
||||||||
37 | $sort = Request::getString('sort', ''); |
||||||||
38 | |||||||||
39 | $adminObject->displayNavigation(basename(__FILE__)); |
||||||||
40 | /** @var \Xmf\Module\Helper\Permission $permHelper */ |
||||||||
41 | $permHelper = new Permission(); |
||||||||
42 | $registryHandler = $helper->getHandler('Registry'); |
||||||||
43 | $uploadDir = XOOPS_UPLOAD_PATH . '/pedigree/images/'; |
||||||||
44 | $uploadUrl = XOOPS_UPLOAD_URL . '/pedigree/images/'; |
||||||||
45 | |||||||||
46 | switch ($op) { |
||||||||
47 | case 'new': |
||||||||
48 | $adminObject->addItemButton(AM_PEDIGREE_REGISTRY_LIST, 'registry.php', 'list'); |
||||||||
49 | $adminObject->displayButton('left'); |
||||||||
50 | |||||||||
51 | $registryObject = $registryHandler->create(); |
||||||||
52 | $form = $registryObject->getForm(); |
||||||||
53 | $form->display(); |
||||||||
54 | break; |
||||||||
55 | case 'save': |
||||||||
56 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||||||
57 | redirect_header('registry.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||||||
58 | } |
||||||||
59 | if (0 != Request::getInt('id', 0)) { |
||||||||
60 | $registryObject = $registryHandler->get(Request::getInt('id', 0)); |
||||||||
61 | } else { |
||||||||
62 | $registryObject = $registryHandler->create(); |
||||||||
63 | } |
||||||||
64 | // Form save fields |
||||||||
65 | $registryObject->setVar('pname', Request::getVar('pname', '')); |
||||||||
66 | $registryObject->setVar('id_owner', Request::getVar('id_owner', '')); |
||||||||
67 | $registryObject->setVar('id_breeder', Request::getVar('id_breeder', '')); |
||||||||
68 | $registryObject->setVar('user', Request::getVar('user', '')); |
||||||||
69 | $registryObject->setVar('roft', Request::getVar('roft', '')); |
||||||||
70 | $registryObject->setVar('mother', Request::getVar('mother', '')); |
||||||||
71 | $registryObject->setVar('father', Request::getVar('father', '')); |
||||||||
72 | |||||||||
73 | require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||||||||
74 | $uploadDir = XOOPS_UPLOAD_PATH . '/pedigree/images/'; |
||||||||
75 | $uploader = new \XoopsMediaUploader($uploadDir, xoops_getModuleOption('mimetypes', 'pedigree'), xoops_getModuleOption('maxsize', 'pedigree'), null, null); |
||||||||
0 ignored issues
–
show
The function
xoops_getModuleOption() has been deprecated.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() xoops_getModuleOption('mimetypes', 'pedigree') of type boolean is incompatible with the type array expected by parameter $allowedMimeTypes of XoopsMediaUploader::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() xoops_getModuleOption('maxsize', 'pedigree') of type boolean is incompatible with the type integer expected by parameter $maxFileSize of XoopsMediaUploader::__construct() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||||
76 | if ($uploader->fetchMedia(Request::getArray('xoops_upload_file', '', 'POST')[0])) { |
||||||||
77 | //$extension = preg_replace( '/^.+\.([^.]+)$/sU' , '' , $_FILES['attachedfile']['name']); |
||||||||
78 | //$imgName = str_replace(' ', '', $_POST['']).'.'.$extension; |
||||||||
79 | |||||||||
80 | $uploader->setPrefix('foto_'); |
||||||||
81 | $uploader->fetchMedia(Request::getArray('xoops_upload_file', '', 'POST')[0]); |
||||||||
82 | if (!$uploader->upload()) { |
||||||||
83 | $errors = $uploader->getErrors(); |
||||||||
84 | redirect_header('<script>javascript:history.go(-1)</script>', 3, $errors); |
||||||||
85 | } else { |
||||||||
86 | $registryObject->setVar('foto', $uploader->getSavedFileName()); |
||||||||
87 | } |
||||||||
88 | } else { |
||||||||
89 | $registryObject->setVar('foto', Request::getVar('foto', '')); |
||||||||
90 | } |
||||||||
91 | |||||||||
92 | $registryObject->setVar('coi', Request::getVar('coi', '')); |
||||||||
93 | if ($registryHandler->insert($registryObject)) { |
||||||||
94 | redirect_header('registry.php?op=list', 2, AM_PEDIGREE_FORMOK); |
||||||||
0 ignored issues
–
show
|
|||||||||
95 | } |
||||||||
96 | |||||||||
97 | echo $registryObject->getHtmlErrors(); |
||||||||
98 | $form = $registryObject->getForm(); |
||||||||
99 | $form->display(); |
||||||||
100 | break; |
||||||||
101 | case 'edit': |
||||||||
102 | $adminObject->addItemButton(AM_PEDIGREE_ADD_REGISTRY, 'registry.php?op=new', 'add'); |
||||||||
103 | $adminObject->addItemButton(AM_PEDIGREE_REGISTRY_LIST, 'registry.php', 'list'); |
||||||||
104 | $adminObject->displayButton('left'); |
||||||||
105 | $registryObject = $registryHandler->get(Request::getString('id', '')); |
||||||||
106 | $form = $registryObject->getForm(); |
||||||||
107 | $form->display(); |
||||||||
108 | break; |
||||||||
109 | case 'delete': |
||||||||
110 | $registryObject = $registryHandler->get(Request::getString('id', '')); |
||||||||
111 | if (1 == Request::getInt('ok', 0)) { |
||||||||
112 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||||||
113 | redirect_header('registry.php', 3, implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||||||||
114 | } |
||||||||
115 | if ($registryHandler->delete($registryObject)) { |
||||||||
116 | redirect_header('registry.php', 3, AM_PEDIGREE_FORMDELOK); |
||||||||
0 ignored issues
–
show
|
|||||||||
117 | } else { |
||||||||
118 | echo $registryObject->getHtmlErrors(); |
||||||||
119 | } |
||||||||
120 | } else { |
||||||||
121 | xoops_confirm(['ok' => 1, 'id' => Request::getString('id', ''), 'op' => 'delete'], Request::getUrl('REQUEST_URI', '', 'SERVER'), sprintf(AM_PEDIGREE_FORMSUREDEL, $registryObject->getVar('pname'))); |
||||||||
0 ignored issues
–
show
|
|||||||||
122 | } |
||||||||
123 | break; |
||||||||
124 | case 'clone': |
||||||||
125 | |||||||||
126 | $id_field = Request::getString('id', ''); |
||||||||
127 | |||||||||
128 | if ($utility::cloneRecord('pedigree_registry', 'id', $id_field)) { |
||||||||
129 | redirect_header('registry.php', 3, AM_PEDIGREE_CLONED_OK); |
||||||||
0 ignored issues
–
show
|
|||||||||
130 | } else { |
||||||||
131 | redirect_header('registry.php', 3, AM_PEDIGREE_CLONED_FAILED); |
||||||||
0 ignored issues
–
show
|
|||||||||
132 | } |
||||||||
133 | |||||||||
134 | break; |
||||||||
135 | case 'list': |
||||||||
136 | default: |
||||||||
137 | $adminObject->addItemButton(AM_PEDIGREE_ADD_REGISTRY, 'registry.php?op=new', 'add'); |
||||||||
138 | $adminObject->displayButton('left'); |
||||||||
139 | $start = Request::getInt('start', 0); |
||||||||
140 | $registryPaginationLimit = $helper->getConfig('userpager'); |
||||||||
141 | |||||||||
142 | $criteria = new \CriteriaCompo(); |
||||||||
143 | $criteria->setSort('id ASC, pname'); |
||||||||
144 | $criteria->setOrder('ASC'); |
||||||||
145 | $criteria->setLimit($registryPaginationLimit); |
||||||||
146 | $criteria->setStart($start); |
||||||||
0 ignored issues
–
show
The method
setStart() does not exist on CriteriaCompo .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||||||||
147 | $registryTempRows = $registryHandler->getCount(); |
||||||||
148 | $registryTempArray = $registryHandler->getAll($criteria); |
||||||||
149 | /* |
||||||||
150 | // |
||||||||
151 | // |
||||||||
152 | <th class='center width5'>".AM_PEDIGREE_FORM_ACTION."</th> |
||||||||
153 | // </tr>"; |
||||||||
154 | // $class = "odd"; |
||||||||
155 | */ |
||||||||
156 | |||||||||
157 | // Display Page Navigation |
||||||||
158 | if ($registryTempRows > $registryPaginationLimit) { |
||||||||
159 | xoops_load('XoopsPageNav'); |
||||||||
160 | |||||||||
161 | $pagenav = new \XoopsPageNav($registryTempRows, $registryPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . ''); |
||||||||
162 | $GLOBALS['xoopsTpl']->assign('pagenav', null === $pagenav ? $pagenav->renderNav() : ''); |
||||||||
163 | } |
||||||||
164 | |||||||||
165 | $GLOBALS['xoopsTpl']->assign('registryRows', $registryTempRows); |
||||||||
166 | $registryArray = []; |
||||||||
167 | |||||||||
168 | // $fields = explode('|', id:mediumint:7:unsigned:NOT NULL::primary:ID|pname:text:0::NOT NULL:::Name|id_owner:smallint:5::NOT NULL:0::Owner|id_breeder:smallint:5::NOT NULL:0::Breeder|user:varchar:25::NOT NULL:::User|roft:enum:0::NOT NULL:0::ROFT|mother:int:5::NOT NULL:0::Mother|father:int:5::NOT NULL:0::Father|foto:varchar:255::NOT NULL:::Foto|coi:varchar:10::NOT NULL:::COI); |
||||||||
169 | // $fieldsCount = count($fields); |
||||||||
170 | |||||||||
171 | $criteria = new \CriteriaCompo(); |
||||||||
172 | |||||||||
173 | //$criteria->setOrder('DESC'); |
||||||||
174 | $criteria->setSort($sort); |
||||||||
175 | $criteria->setOrder($order); |
||||||||
176 | $criteria->setLimit($registryPaginationLimit); |
||||||||
177 | $criteria->setStart($start); |
||||||||
178 | |||||||||
179 | $registryCount = $registryHandler->getCount($criteria); |
||||||||
180 | $registryTempArray = $registryHandler->getAll($criteria); |
||||||||
181 | |||||||||
182 | // for ($i = 0; $i < $fieldsCount; ++$i) { |
||||||||
183 | if ($registryCount > 0) { |
||||||||
184 | foreach (array_keys($registryTempArray) as $i) { |
||||||||
185 | // $field = explode(':', $fields[$i]); |
||||||||
186 | |||||||||
187 | //$selectorid = $utility::selectSorting(AM_PEDIGREE_REGISTRY_ID, 'id'); |
||||||||
188 | //$GLOBALS['xoopsTpl']->assign('selectorid', $selectorid); |
||||||||
189 | $registryArray['id'] = $registryTempArray[$i]->getVar('id'); |
||||||||
190 | |||||||||
191 | //$selectorpname = $utility::selectSorting(AM_PEDIGREE_REGISTRY_PNAME, 'pname'); |
||||||||
192 | //$GLOBALS['xoopsTpl']->assign('selectorpname', $selectorpname); |
||||||||
193 | $registryArray['pname'] = strip_tags($registryTempArray[$i]->getVar('pname')); |
||||||||
194 | |||||||||
195 | //$selectorid_owner = $utility::selectSorting(AM_PEDIGREE_REGISTRY_ID_OWNER, 'id_owner'); |
||||||||
196 | //$GLOBALS['xoopsTpl']->assign('selectorid_owner', $selectorid_owner); |
||||||||
197 | $registryArray['id_owner'] = $registryTempArray[$i]->getVar('id_owner'); |
||||||||
198 | |||||||||
199 | //$selectorid_breeder = $utility::selectSorting(AM_PEDIGREE_REGISTRY_ID_BREEDER, 'id_breeder'); |
||||||||
200 | //$GLOBALS['xoopsTpl']->assign('selectorid_breeder', $selectorid_breeder); |
||||||||
201 | $registryArray['id_breeder'] = $registryTempArray[$i]->getVar('id_breeder'); |
||||||||
202 | |||||||||
203 | //$selectoruser = $utility::selectSorting(AM_PEDIGREE_REGISTRY_USER, 'user'); |
||||||||
204 | //$GLOBALS['xoopsTpl']->assign('selectoruser', $selectoruser); |
||||||||
205 | $registryArray['user'] = $registryTempArray[$i]->getVar('user'); |
||||||||
206 | |||||||||
207 | //$selectorroft = $utility::selectSorting(AM_PEDIGREE_REGISTRY_ROFT, 'roft'); |
||||||||
208 | //$GLOBALS['xoopsTpl']->assign('selectorroft', $selectorroft); |
||||||||
209 | $registryArray['roft'] = $registryTempArray[$i]->getVar('roft'); |
||||||||
210 | |||||||||
211 | //$selectormother = $utility::selectSorting(AM_PEDIGREE_REGISTRY_MOTHER, 'mother'); |
||||||||
212 | //$GLOBALS['xoopsTpl']->assign('selectormother', $selectormother); |
||||||||
213 | $registryArray['mother'] = $registryTempArray[$i]->getVar('mother'); |
||||||||
214 | |||||||||
215 | //$selectorfather = $utility::selectSorting(AM_PEDIGREE_REGISTRY_FATHER, 'father'); |
||||||||
216 | //$GLOBALS['xoopsTpl']->assign('selectorfather', $selectorfather); |
||||||||
217 | $registryArray['father'] = $registryTempArray[$i]->getVar('father'); |
||||||||
218 | |||||||||
219 | //$selectorfoto = $utility::selectSorting(AM_PEDIGREE_REGISTRY_FOTO, 'foto'); |
||||||||
220 | //$GLOBALS['xoopsTpl']->assign('selectorfoto', $selectorfoto); |
||||||||
221 | $registryArray['foto'] = "<img src='" . $uploadUrl . $registryTempArray[$i]->getVar('foto') . "' name='" . 'name' . "' id=" . 'id' . " alt='' style='max-width:100px'>"; |
||||||||
222 | |||||||||
223 | //$selectorcoi = $utility::selectSorting(AM_PEDIGREE_REGISTRY_COI, 'coi'); |
||||||||
224 | //$GLOBALS['xoopsTpl']->assign('selectorcoi', $selectorcoi); |
||||||||
225 | $registryArray['coi'] = $registryTempArray[$i]->getVar('coi'); |
||||||||
226 | $registryArray['edit_delete'] = "<a href='registry.php?op=edit&id=" . $i . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _EDIT . "' title='" . _EDIT . "'></a> |
||||||||
227 | <a href='registry.php?op=delete&id=" . $i . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _DELETE . "' title='" . _DELETE . "'></a> |
||||||||
228 | <a href='registry.php?op=clone&id=" . $i . "'><img src=" . $pathIcon16 . "/editcopy.png alt='" . _CLONE . "' title='" . _CLONE . "'></a>"; |
||||||||
229 | |||||||||
230 | $GLOBALS['xoopsTpl']->append_by_ref('registryArrays', $registryArray); |
||||||||
231 | unset($registryArray); |
||||||||
232 | } |
||||||||
233 | unset($registryTempArray); |
||||||||
234 | // Display Navigation |
||||||||
235 | if ($registryCount > $registryPaginationLimit) { |
||||||||
236 | xoops_load('XoopsPageNav'); |
||||||||
237 | $pagenav = new \XoopsPageNav($registryCount, $registryPaginationLimit, $start, 'start', 'op=list' . '&sort=' . $sort . '&order=' . $order . ''); |
||||||||
238 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||||||||
239 | } |
||||||||
240 | |||||||||
241 | // echo "<td class='center width5'> |
||||||||
242 | |||||||||
243 | // <a href='registry.php?op=edit&id=".$i."'><img src=".$pathIcon16."/edit.png alt='"._EDIT."' title='"._EDIT."'></a> |
||||||||
244 | // <a href='registry.php?op=delete&id=".$i."'><img src=".$pathIcon16."/delete.png alt='"._DELETE."' title='"._DELETE."'></a> |
||||||||
245 | // </td>"; |
||||||||
246 | |||||||||
247 | // echo "</tr>"; |
||||||||
248 | |||||||||
249 | // } |
||||||||
250 | |||||||||
251 | // echo "</table><br><br>"; |
||||||||
252 | |||||||||
253 | // } else { |
||||||||
254 | |||||||||
255 | // echo "<table width='100%' cellspacing='1' class='outer'> |
||||||||
256 | |||||||||
257 | // <tr> |
||||||||
258 | |||||||||
259 | // <th class='center width5'>".AM_PEDIGREE_FORM_ACTION."XXX</th> |
||||||||
260 | // </tr><tr><td class='errorMsg' colspan='11'>There are noXXX registry</td></tr>"; |
||||||||
261 | // echo "</table><br><br>"; |
||||||||
262 | |||||||||
263 | //------------------------------------------- |
||||||||
264 | |||||||||
265 | echo $GLOBALS['xoopsTpl']->fetch(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . '/templates/admin/pedigree_admin_registry.tpl'); |
||||||||
266 | } |
||||||||
267 | |||||||||
268 | break; |
||||||||
269 | } |
||||||||
270 | require_once __DIR__ . '/admin_footer.php'; |
||||||||
271 |
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: