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 | * @package XoopsModules\Pedigree |
||||
14 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||
15 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||
16 | * @author XOOPS Module Dev Team |
||||
17 | */ |
||||
18 | |||||
19 | use Xmf\Request; |
||||
20 | use XoopsModules\Pedigree\{ |
||||
21 | Constants, |
||||
22 | Helper |
||||
23 | }; |
||||
24 | |||||
25 | require_once __DIR__ . '/admin_header.php'; |
||||
26 | |||||
27 | xoops_cp_header(); |
||||
28 | |||||
29 | /** |
||||
30 | * @var Xmf\Module\Admin $adminObject |
||||
31 | * @var XoopsModules\Pedigree\Helper $helper |
||||
32 | * @var XoopsModules\Pedigree\OwnerHandler $ownerHandler |
||||
33 | */ |
||||
34 | $ownerHandler = $helper->getHandler('Owner'); |
||||
35 | |||||
36 | $op = Request::getCmd('op', 'list'); |
||||
37 | switch ($op) { |
||||
38 | case 'list': |
||||
39 | default: |
||||
40 | $adminObject->displayNavigation(basename(__FILE__)); |
||||
41 | $adminObject->addItemButton(_AM_PEDIGREE_NEWOWNER, 'owner.php?op=new_owner', 'add'); |
||||
42 | $adminObject->displayButton('left'); |
||||
43 | $criteria = new \CriteriaCompo(); |
||||
44 | $criteria->setSort('id'); |
||||
45 | $criteria->order = 'ASC'; |
||||
46 | $ownerCount = $ownerHandler->getCount(); |
||||
47 | $ownerObjArray = $ownerHandler->getAll($criteria); |
||||
48 | |||||
49 | //Table view |
||||
50 | if ($ownerCount > 0) { |
||||
51 | echo "<table class=\"outer width100\" cellspacing=\"1\">\n" |
||||
52 | . "<tr>\n" |
||||
53 | . " <th class=\"center\">" |
||||
54 | . _AM_PEDIGREE_OWNER_FIRSTNAME |
||||
55 | . "</th>\n" |
||||
56 | . " <th class=\"center\">" |
||||
57 | . _AM_PEDIGREE_OWNER_LASTNAME |
||||
58 | . "</th>\n" |
||||
59 | . " <th class=\"center\">" |
||||
60 | . _AM_PEDIGREE_OWNER_POSTCODE |
||||
61 | . "</th>\n" |
||||
62 | . " <th class=\"center\">" |
||||
63 | . _AM_PEDIGREE_OWNER_CITY |
||||
64 | . "</th>\n" |
||||
65 | . " <th class=\"center\">" |
||||
66 | . _AM_PEDIGREE_OWNER_STREETNAME |
||||
67 | . "</th>\n" |
||||
68 | . " <th class=\"center\">" |
||||
69 | . _AM_PEDIGREE_OWNER_HOUSENUMBER |
||||
70 | . "</th>\n" |
||||
71 | . " <th class=\"center\">" |
||||
72 | . _AM_PEDIGREE_OWNER_PHONENUMBER |
||||
73 | . "</th>\n" |
||||
74 | . " <th class=\"center\">" |
||||
75 | . _AM_PEDIGREE_OWNER_EMAILADRES |
||||
76 | . "</th>\n" |
||||
77 | . " <th class=\"center\">" |
||||
78 | . _AM_PEDIGREE_OWNER_WEBSITE |
||||
79 | . "</th>\n" |
||||
80 | . " <th class=\"center\">" |
||||
81 | . _AM_PEDIGREE_OWNER_USER |
||||
82 | . "</th>\n" |
||||
83 | . " <th class=\"center width10\">" |
||||
84 | . _AM_PEDIGREE_FORMACTION |
||||
85 | . "</th>\n" |
||||
86 | . "</tr>\n"; |
||||
87 | |||||
88 | $class = 'odd'; |
||||
89 | |||||
90 | foreach ($ownerObjArray as $ownerObj) { |
||||
91 | //@todo figure out what the following statement is "suppose" to do, owner_pid isn't defined |
||||
92 | //if (0 == $ownerObj->getVar('owner_pid')) { |
||||
93 | $ownerVals = $ownerObj->getValues(); |
||||
94 | echo "<tr class=\"{$class}\">\n" |
||||
95 | . " <td class=\"center\">" |
||||
96 | . $ownerObj['firstname'] |
||||
97 | . "</td>\n" |
||||
98 | . " <td class=\"center\">" |
||||
99 | . $ownerObj['lastname'] |
||||
100 | . "</td>\n" |
||||
101 | . " <td class=\"center\">" |
||||
102 | . $ownerObj['postcode'] |
||||
103 | . "</td>\n" |
||||
104 | . " <td class=\"center\">" |
||||
105 | . $ownerObj['city'] |
||||
106 | . "</td>\n" |
||||
107 | . " <td class=\"center\">" |
||||
108 | . $ownerObj['streetname'] |
||||
109 | . "</td>\n" |
||||
110 | . " <td class=\"center\">" |
||||
111 | . $ownerObj['housenumber'] |
||||
112 | . "</td>\n" |
||||
113 | . " <td class=\"center\">" |
||||
114 | . $ownerObj['phonenumber'] |
||||
115 | . "</td>\n" |
||||
116 | . " <td class=\"center\">" |
||||
117 | . $ownerObj['emailadres'] |
||||
118 | . "</td>\n" |
||||
119 | . " <td class=\"center\">" |
||||
120 | . $ownerObj['website'] |
||||
121 | . "</td>\n" |
||||
122 | . " <td class=\"center\">" |
||||
123 | . $ownerObj['user'] |
||||
124 | . "</td>\n" |
||||
125 | . " <td class=\"center width10\">\n" |
||||
126 | . " <a href=\"" |
||||
127 | . $helper->url("admin/owner.php?op=edit_owner&id=" . $ownerObj['id']) |
||||
128 | . "\">{$icons['edit']}</a>\n" |
||||
129 | . " <a href=\"" |
||||
130 | . $helper->url("admin/owner.php?op=delete_owner&id=" . $ownerObj['id']) |
||||
131 | . "\">{$icons['delete']}</a>\n" |
||||
132 | . " </td>\n" |
||||
133 | . "</tr>\n"; |
||||
134 | $class = ('even' === $class) ? 'odd' : 'even'; |
||||
135 | //} |
||||
136 | } |
||||
137 | echo "</table><br><br>"; |
||||
138 | } |
||||
139 | break; |
||||
140 | |||||
141 | case 'edit_owner': |
||||
142 | case 'new_owner': |
||||
143 | $id = Request::getInt('id', null, 'GET'); |
||||
144 | $adminObject->displayNavigation(basename(__FILE__)); |
||||
145 | if (0 !== (int)$id) { |
||||
146 | $adminObject->addItemButton(_AM_PEDIGREE_NEWOWNER, 'owner.php?op=new_owner', 'add'); |
||||
147 | } |
||||
148 | $adminObject->addItemButton(_AM_PEDIGREE_OWNERLIST, 'owner.php?op=list', 'list'); |
||||
149 | $adminObject->displayButton('left'); |
||||
150 | |||||
151 | // if $id is invalid then it will create $obj, else will edit existing $obj |
||||
152 | $obj = $ownerHandler->get($id); |
||||
153 | $form = $obj->getForm(); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
154 | $form->display(); |
||||
155 | break; |
||||
156 | |||||
157 | case 'save_owner': |
||||
158 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
159 | $helper->redirect('admin/owner.php', Constants::REDIRECT_DELAY_MEDIUM, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||
160 | } |
||||
161 | $id = Request::getInt('id', null, 'POST'); |
||||
162 | // get object if it exists, create it if not |
||||
163 | $obj = $ownerHandler->get($id); |
||||
164 | |||||
165 | //@todo shouldn't firstname and/or lastname be required? |
||||
166 | $obj->setVars([ |
||||
167 | 'firstname' => Request::getWord('firstname', '', 'POST'), //Form firstname |
||||
168 | 'lastname' => Request::getWord('lastname', '', 'POST'), //Form lastname |
||||
169 | 'postcode' => Request::getString('postcode', null, 'POST'), //Form postcode |
||||
170 | 'city' => Request::getString('city', '', 'POST'), //Form city |
||||
171 | 'streetname' => Request::getString('streetname', '', 'POST'), //Form streetname |
||||
172 | 'housenumber' => Request::getString('housenumber', null, 'POST'), //Form housenumber |
||||
173 | 'phonenumber' => Request::getString('phonenumber', null, 'POST'), //Form phonenumber |
||||
174 | 'emailadres' => Request::getEmail('emailadres', '', 'POST'), //Form emailadres |
||||
175 | 'website' => Request::getUrl('website', '', 'POST'), //Form website |
||||
176 | 'user' => Request::getString('user', '', 'POST') //Form user |
||||
177 | ]); |
||||
178 | /* |
||||
179 | //Form firstname |
||||
180 | $obj->setVar('firstname', $_REQUEST['firstname']); |
||||
181 | //Form lastname |
||||
182 | $obj->setVar('lastname', $_REQUEST['lastname']); |
||||
183 | //Form postcode |
||||
184 | $obj->setVar('postcode', $_REQUEST['postcode']); |
||||
185 | //Form city |
||||
186 | $obj->setVar('city', $_REQUEST['city']); |
||||
187 | //Form streetname |
||||
188 | $obj->setVar('streetname', $_REQUEST['streetname']); |
||||
189 | //Form housenumber |
||||
190 | $obj->setVar('housenumber', $_REQUEST['housenumber']); |
||||
191 | //Form phonenumber |
||||
192 | $obj->setVar('phonenumber', $_REQUEST['phonenumber']); |
||||
193 | //Form emailadres |
||||
194 | $obj->setVar('emailadres', $_REQUEST['emailadres']); |
||||
195 | //Form website |
||||
196 | $obj->setVar('website', $_REQUEST['website']); |
||||
197 | //Form user |
||||
198 | $obj->setVar('user', $_REQUEST['user']); |
||||
199 | */ |
||||
200 | if ($ownerHandler->insert($obj)) { |
||||
201 | $helper->redirect('admin/owner.php?op=list', 2, _AM_PEDIGREE_FORMOK); |
||||
202 | } |
||||
203 | |||||
204 | echo $obj->getHtmlErrors(); |
||||
205 | $form = $obj->getForm(); |
||||
206 | $form->display(); |
||||
207 | break; |
||||
208 | |||||
209 | case 'delete_owner': |
||||
210 | $id = Request::getInt('id'); |
||||
211 | $ok = Request::getInt('ok', Constants::CONFIRM_NOT_OK, 'POST'); |
||||
212 | $obj = $ownerHandler->get($id); |
||||
213 | if (Constants::CONFIRM_OK === $ok) { |
||||
214 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
215 | $helper->redirect('admin/owner.php', Constants::REDIRECT_DELAY_MEDIUM, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||
216 | } |
||||
217 | if ($ownerHandler->delete($obj)) { |
||||
218 | $helper->redirect('admin/owner.php', Constants::REDIRECT_DELAY_MEDIUM, _AM_PEDIGREE_FORMDELOK); |
||||
219 | } else { |
||||
220 | echo $obj->getHtmlErrors(); |
||||
221 | } |
||||
222 | } else { |
||||
223 | xoops_confirm(['ok' => Constants::CONFIRM_OK, 'id' => $id, 'op' => 'delete_owner'], $_SERVER['REQUEST_URI'], sprintf(_AM_PEDIGREE_FORMSUREDEL, $obj->getVar('owner'))); |
||||
0 ignored issues
–
show
It seems like
$obj->getVar('owner') 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
![]() |
|||||
224 | } |
||||
225 | break; |
||||
226 | } |
||||
227 | require_once __DIR__ . '/admin_footer.php'; |
||||
228 |