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 | 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 | * Pedigree module for XOOPS |
||||
14 | * |
||||
15 | * @package \XoopsModules\Pedigree |
||||
16 | * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} |
||||
17 | * @license https://www.gnu.org/licenses/gpl-2.0.html GNU Public License |
||||
18 | * @author XOOPS Module Dev Team (https://xoops.org) |
||||
19 | */ |
||||
20 | |||||
21 | use Xmf\Request; |
||||
22 | use XoopsModules\Pedigree\{ |
||||
23 | Helper |
||||
24 | }; |
||||
25 | |||||
26 | |||||
27 | require_once __DIR__ . '/admin_header.php'; |
||||
28 | |||||
29 | xoops_cp_header(); |
||||
30 | /** |
||||
31 | * @var Xmf\Module\Admin $adminObject |
||||
32 | * @var XoopsModules\Pedigree\Helper $helper |
||||
33 | * @var XoopsModules\Pedigree\TreeHandler $treeHandler |
||||
34 | */ |
||||
35 | $helper = Helper::getInstance(); |
||||
36 | $treeHandler = $helper->getHandler('Tree'); |
||||
37 | |||||
38 | //It recovered the value of argument op in URL$ |
||||
39 | $op = Request::getCmd('op', 'list'); |
||||
40 | switch ($op) { |
||||
41 | case 'list': |
||||
42 | default: |
||||
43 | $adminObject->displayNavigation(basename(__FILE__)); |
||||
44 | $adminObject->addItemButton(_AM_PEDIGREE_NEWPEDIGREE, $helper->url('admin/pedigree.php?op=new_pedigree'), 'add'); |
||||
45 | $adminObject->displayButton('left'); |
||||
46 | $criteria = new \CriteriaCompo(); |
||||
47 | $criteria->setSort('id'); |
||||
48 | $criteria->setOrder('ASC'); |
||||
49 | $numrows = $treeHandler->getCount(); |
||||
50 | $pedigree_arr = $treeHandler->getAll($criteria); |
||||
51 | |||||
52 | //Table view |
||||
53 | if ($numrows > 0) { |
||||
54 | echo "<table class=\"width100 outer\" cellspacing=\"1\">\n" |
||||
55 | . " <tr>\n" |
||||
56 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_PNAME . "</th>\n" |
||||
57 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_ID_OWNER . "</th>\n" |
||||
58 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_ID_BREEDER . "</th>\n" |
||||
59 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_USER . "</th>\n" |
||||
60 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_ROFT . "</th>\n" |
||||
61 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_MOTHER . "</th>\n" |
||||
62 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_FATHER . "</th>\n" |
||||
63 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_FOTO . "</th>\n" |
||||
64 | . ' <th class="center">' . _AM_PEDIGREE_PEDIGREE_COI . "</th>\n" |
||||
65 | . ' <th class="center width10">' . _AM_PEDIGREE_FORMACTION . "</th>\n" |
||||
66 | . " </tr>\n"; |
||||
67 | |||||
68 | $class = 'even'; |
||||
69 | |||||
70 | /** @var XoopsModules\Pedigree\Tree $treeObj */ |
||||
71 | foreach ($pedigree_arr as $i => $treeObj) { |
||||
72 | if (0 == $treeObj->getVar('pedigree_pid')) { |
||||
73 | $class = ('even' === $class) ? 'odd' : 'even'; |
||||
74 | echo " <tr class=\"{$class}\">\n" |
||||
75 | . ' <td class="center">' . $treeObj->getVar('pname') . "</td>\n" |
||||
76 | . ' <td class="center">' . $treeObj->getVar('id_owner') . "</td>\n" |
||||
77 | . ' <td class="center">' . $treeObj->getVar('id_breeder') . "</td>\n" |
||||
78 | . ' <td class="center">' . $treeObj->getVar('user') . "</td>\n" |
||||
79 | . ' <td class="center">' . $treeObj->getVar('roft') . "</td>\n" |
||||
80 | . ' <td class="center">' . $treeObj->getVar('mother') . "</td>\n" |
||||
81 | . ' <td class="center">' . $treeObj->getVar('father') . "</td>\n" |
||||
82 | . ' <td class="center">' . $treeObj->getVar('foto') . "</td>\n" |
||||
83 | . ' <td class="center">' . $treeObj->getVar('coi') . "</td>\n" |
||||
84 | . " <td class=\"center width10\">\n" |
||||
85 | . ' <a href="' . $_SERVER['SCRIPT_NAME'] . '?op=edit_pedigree&id=' . $treeObj->getVar('id') . "\"><img src=\"{$pathIcon16}/edit.png\" alt=\"" . _EDIT . '" title="' . _EDIT . "\"></a>\n" |
||||
86 | . ' <a href=' . $helper->url('delete.php?id=' . $treeObj->getVar('id')) . "><img src=\"{$pathIcon16}/delete.png\" alt=\"" . _DELETE . '" title="' . _DELETE . "\"></a>\n" |
||||
87 | . " </td>\n" |
||||
88 | . " </tr>\n"; |
||||
89 | } |
||||
90 | } |
||||
91 | echo "</table><br><br>\n"; |
||||
92 | } //@todo should add 'else' here to display "nothing here" message |
||||
93 | |||||
94 | break; |
||||
95 | case 'new_pedigree': |
||||
96 | $adminObject->displayNavigation(basename(__FILE__)); |
||||
97 | $adminObject->addItemButton(_AM_PEDIGREE_PEDIGREELIST, $helper->url('pedigree.php?op=list'), 'list'); |
||||
98 | $adminObject->displayButton('left'); |
||||
99 | |||||
100 | /** |
||||
101 | * @var XoopsModules\Pedigree\Tree $treeObj |
||||
102 | * @var \XoopsThemeForm $form |
||||
103 | */ |
||||
104 | $treeObj = $treeHandler->create(); |
||||
105 | $form = $treeObj->getForm(); |
||||
106 | $form->display(); |
||||
107 | break; |
||||
108 | case 'save_pedigree': |
||||
109 | /** @var \XoopsSecurity $GLOBALS ['xoopsSecurity'] */ |
||||
110 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
111 | $helper->redirect('admin/pedigree.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||
112 | } |
||||
113 | |||||
114 | /** @var XoopsModules\Pedigree\Tree $treeObj */ |
||||
115 | $id = Request::getInt('id', null, 'post'); |
||||
116 | $treeObj = $treeHandler->get($id); |
||||
117 | |||||
118 | $varArray = [ |
||||
119 | 'pname' => Request::getString('pname', '', 'post'), |
||||
120 | 'id_owner' => Request::getInt('id_owner', 0, 'post'), |
||||
121 | 'id_breeder' => Request::getInt('id_breeder', 0, 'post'), |
||||
122 | 'user' => Request::getString('user', '', 'post'), |
||||
123 | 'roft' => Request::getInt('roft', 0, 'post'), |
||||
124 | 'mother' => Request::getInt('mother', 0, 'post'), |
||||
125 | 'father' => Request::getInt('father', 0, 'post'), |
||||
126 | 'foto' => Request::getString('foto', '', 'post'), |
||||
127 | 'coi' => Request::getString('coi', '', 'post'), |
||||
128 | ]; |
||||
129 | |||||
130 | $treeObj->setVars($varArray); |
||||
131 | if ($treeHandler->insert($treeObj)) { |
||||
132 | $helper->redirect('admin/pedigree.php?op=list', 2, _AM_PEDIGREE_FORMOK); |
||||
133 | } |
||||
134 | |||||
135 | echo $treeObj->getHtmlErrors(); |
||||
136 | /** @var \XoopsThemeForm $form */ |
||||
137 | $form = $treeObj->getForm(); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
138 | $form->display(); |
||||
139 | break; |
||||
140 | case 'edit_pedigree': |
||||
141 | $adminObject->displayNavigation(basename(__FILE__)); |
||||
142 | $adminObject->addItemButton(_AM_PEDIGREE_NEWPEDIGREE, $helper->url('admin/pedigree.php?op=new_pedigree'), 'add'); |
||||
143 | $adminObject->addItemButton(_AM_PEDIGREE_PEDIGREELIST, $helper->url('admin/pedigree.php?op=list'), 'list'); |
||||
144 | $adminObject->displayButton('left'); |
||||
145 | |||||
146 | /** |
||||
147 | * @var XoopsModules\Pedigree\Tree $treeObj |
||||
148 | * @var XoopsThemeForm $form |
||||
149 | */ |
||||
150 | $id = Request::getInt('id', 0); |
||||
151 | $treeObj = $treeHandler->get($id); |
||||
152 | $form = $treeObj->getForm(); |
||||
153 | $form->display(); |
||||
154 | break; |
||||
155 | case 'delete_pedigree': |
||||
156 | /** @var XoopsModules\Pedigree\Tree $treeObj */ |
||||
157 | $id = Request::getInt('id', 0); |
||||
158 | $treeObj = $treeHandler->get($id); |
||||
159 | if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
||||
160 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
161 | $helper->redirect('admin/pedigree.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||
162 | } |
||||
163 | if ($treeHandler->delete($obj)) { |
||||
164 | $helper->redirect('admin/pedigree.php', 3, _AM_PEDIGREE_FORMDELOK); |
||||
165 | } else { |
||||
166 | echo $treeObj->getHtmlErrors(); |
||||
167 | } |
||||
168 | } else { |
||||
169 | xoops_confirm(['ok' => 1, 'id' => $id, 'op' => 'delete_pedigree'], $_SERVER['REQUEST_URI'], sprintf(_AM_PEDIGREE_FORMSUREDEL, $treeObj->getVar('pedigree'))); |
||||
0 ignored issues
–
show
It seems like
$treeObj->getVar('pedigree') can also be of type array and array ; however, parameter $values of sprintf() does only seem to accept double|integer|string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
170 | } |
||||
171 | break; |
||||
172 | } |
||||
173 | require_once __DIR__ . '/admin_footer.php'; |
||||
174 |