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 | * animal module for XOOPS |
||||||
14 | * |
||||||
15 | * @copyright {@link http://sourceforge.net/projects/thmod/ The TXMod XOOPS Project} |
||||||
16 | * @copyright {@link http://sourceforge.net/projects/xoops/ The XOOPS Project} |
||||||
17 | * @license GPL 2.0 or later |
||||||
18 | * @package pedigree |
||||||
19 | * @author XOOPS Mod Development Team |
||||||
20 | * @version $Id: $ |
||||||
21 | * |
||||||
22 | * @todo : move hard coded language strings to language files |
||||||
23 | */ |
||||||
24 | |||||||
25 | use Xmf\Request; |
||||||
0 ignored issues
–
show
|
|||||||
26 | use XoopsModules\Pedigree; |
||||||
27 | |||||||
28 | //require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
||||||
29 | require_once __DIR__ . '/header.php'; |
||||||
30 | |||||||
31 | $moduleDirName = basename(__DIR__); |
||||||
32 | xoops_loadLanguage('main', $moduleDirName); |
||||||
0 ignored issues
–
show
The function
xoops_loadLanguage was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
33 | |||||||
34 | //check for access |
||||||
35 | //$xoopsModule = XoopsModule::getByDirname($moduleDirName); |
||||||
36 | if (empty($GLOBALS['xoopsUser']) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)) { |
||||||
0 ignored issues
–
show
The type
XoopsUser was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
37 | redirect_header('javascript:history.go(-1)', 3, _NOPERM . '<br>' . _MA_PEDIGREE_REGIST); |
||||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
38 | } |
||||||
39 | |||||||
40 | |||||||
41 | // Include any common code for this module. |
||||||
42 | require_once $GLOBALS['xoops']->path("modules/{$moduleDirName}/include/common.php"); |
||||||
43 | |||||||
44 | /* |
||||||
45 | $GLOBALS['xoopsOption']['template_main'] = "pedigree_update.tpl"; |
||||||
46 | |||||||
47 | include $GLOBALS['xoops']->path('/header.php'); |
||||||
48 | $GLOBALS['xoopsTpl']->assign('page_title', "Pedigree database - Update details"); |
||||||
49 | */ |
||||||
50 | |||||||
51 | //@todo need to check XOOPS security token here... |
||||||
52 | |||||||
53 | //possible variables (specific variables are found in the specified IF statement |
||||||
54 | $dogid = Request::getInt('dogid', 0, 'POST'); |
||||||
55 | $ownerId = Request::getInt('ownerid', 0, 'POST'); |
||||||
56 | |||||||
57 | /* |
||||||
58 | $table = $_POST['dbtable']; |
||||||
59 | $field = $_POST['dbfield']; |
||||||
60 | $dogname = $_POST['curname']; |
||||||
61 | $name = $_POST['naam']; |
||||||
62 | $gender = $_POST['roft']; |
||||||
63 | */ |
||||||
64 | $table = Request::getString('dbtable', '', 'POST'); |
||||||
65 | $field = Request::getString('dbfield', '', 'POST'); |
||||||
66 | $field = $GLOBALS['xoopsDB']->escape('`' . $field . '`'); |
||||||
67 | $dogname = Request::getString('curname', '', 'POST'); |
||||||
68 | $name = Request::getString('naam', '', 'POST'); |
||||||
69 | //$gender = Request::getInt('roft', 0, 'POST'); |
||||||
70 | $gender = Request::getString('roft', '', 'POST'); //Richard |
||||||
71 | $id_owner = Request::getInt('id_owner', 0, 'POST'); |
||||||
72 | |||||||
73 | //$id = (!isset($_POST['dogid']) ? $id = '' : $id = $_POST['dogid']); |
||||||
74 | $animal = new Pedigree\Animal($dogid); |
||||||
75 | $fields = $animal->getNumOfFields(); |
||||||
76 | |||||||
77 | for ($i = 0, $iMax = count($fields); $i < $iMax; ++$i) { |
||||||
78 | if ('user' . $fields[$i] === $_POST['dbfield']) { |
||||||
79 | $userField = new Pedigree\Field($fields[$i], $animal->getConfig()); |
||||||
80 | if ($userField->isActive()) { |
||||||
81 | $currentfield = 'user' . $fields[$i]; |
||||||
82 | $pictureField = $_FILES[$currentfield]['name']; |
||||||
83 | if (empty($pictureField)) { |
||||||
84 | $newvalue = $_POST['user' . $fields[$i]]; |
||||||
85 | } else { |
||||||
86 | $newvalue = Pedigree\Utility::uploadPicture(0); |
||||||
87 | } |
||||||
88 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . " SET {$field}='{$newvalue}' WHERE id='{$dogid}'"; |
||||||
89 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
90 | |||||||
91 | $ch = 1; |
||||||
92 | } |
||||||
93 | } |
||||||
94 | } |
||||||
95 | |||||||
96 | //name |
||||||
97 | if (!empty($name)) { |
||||||
98 | $curval = Request::getString('curvalname', '', 'POST'); |
||||||
99 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . " SET {$field}='{$name}' WHERE id='{$dogid}'"; |
||||||
100 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $GLOBALS['xoopsDB']->escape($name) . "' WHERE id='" . $dogid . "'"; |
||||||
101 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
102 | |||||||
103 | $ch = 1; |
||||||
104 | } |
||||||
105 | //owner |
||||||
106 | if (isset($_POST['id_owner'])) { |
||||||
107 | $curval = Request::getInt('curvaleig', 0, 'POST'); |
||||||
108 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . " SET {$field}='" . $_POST['id_owner'] . "' WHERE id='{$dogid}'"; |
||||||
109 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['id_owner'] . "' WHERE id='" . $dogid . "'"; |
||||||
110 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
111 | |||||||
112 | $ch = 1; |
||||||
113 | } |
||||||
114 | //breeder |
||||||
115 | if (isset($_POST['id_breeder'])) { |
||||||
116 | $curval = Request::getInt('curvalfok', 0, 'POST'); |
||||||
117 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . " SET {$field}='" . $_POST['id_breeder'] . "' WHERE id='{$dogid}'"; |
||||||
118 | $id_breeder = Request::getInt('id_breeder', 0, 'post'); |
||||||
119 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $id_breeder . "' WHERE id='" . $dogid . "'"; |
||||||
120 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
121 | |||||||
122 | $ch = 1; |
||||||
123 | } |
||||||
124 | //gender |
||||||
125 | if (!empty($_POST['roft']) || '0' == $_POST['roft']) { |
||||||
126 | $curval = $_POST['curvalroft']; |
||||||
127 | $curval = Request::getInt('curvalroft', 0, 'POST'); |
||||||
128 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . " SET {$field}='" . $_POST['roft'] . "' WHERE id='{$dogid}'"; |
||||||
129 | $roft = Request::getInt('roft', 0, 'post'); |
||||||
130 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $roft . "' WHERE id='" . $dogid . "'"; |
||||||
131 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
132 | |||||||
133 | $ch = 1; |
||||||
134 | } |
||||||
135 | //sire - dam |
||||||
136 | if (isset($_GET['gend'])) { |
||||||
137 | $curval = Request::getInt('curval', 0, 'GET'); |
||||||
138 | $thisid = Request::getInt('thisid', 0, 'GET'); |
||||||
139 | //$curname = Pedigree\Utility::getName($curval); |
||||||
140 | $table = 'pedigree_tree'; |
||||||
141 | if (0 == Request::getInt('gend', '', 'GET')) { |
||||||
142 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . " SET father='" . $thisid . "' WHERE id='{$curval}'"; |
||||||
143 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
144 | } else { |
||||||
145 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . " SET mother='" . $thisid . "' WHERE id='{$curval}'"; |
||||||
146 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
147 | } |
||||||
148 | |||||||
149 | $ch = 1; |
||||||
150 | $dogid = $curval; |
||||||
151 | } |
||||||
152 | //picture |
||||||
153 | if ('foto' === $_POST['dbfield']) { |
||||||
154 | $curval = Request::getString('curvalpic', '', 'POST'); |
||||||
155 | $foto = Pedigree\Utility::uploadPicture(0); |
||||||
156 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . " SET foto='" . $GLOBALS['xoopsDB']->escape($foto) . "' WHERE id='{$dogid}'"; |
||||||
157 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
158 | |||||||
159 | $ch = 1; |
||||||
160 | } |
||||||
161 | |||||||
162 | //owner |
||||||
163 | //lastname |
||||||
164 | if (isset($_POST['naaml'])) { |
||||||
165 | // $curval = $_POST['curvalnamel']; |
||||||
166 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['naaml'] . "' WHERE id='" . $dogid . "'"; |
||||||
167 | $curval = Request::getString('curvalnamel', '', 'POST'); |
||||||
168 | $naaml = Request::getString('naaml', '', 'POST'); |
||||||
169 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $GLOBALS['xoopsDB']->escape($naaml) . "' WHERE id='" . $dogid . "'"; |
||||||
170 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
171 | $chow = 1; |
||||||
172 | } |
||||||
173 | //firstname |
||||||
174 | if (isset($_POST['naamf'])) { |
||||||
175 | // $curval = $_POST['curvalnamef']; |
||||||
176 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['naamf'] . "' WHERE id='" . $dogid . "'"; |
||||||
177 | $curval = Request::getString('curvalnamef', '', 'POST'); |
||||||
178 | $naaml = Request::getString('naamf', '', 'POST'); |
||||||
179 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $GLOBALS['xoopsDB']->escape($naamf) . "' WHERE id='" . $dogid . "'"; |
||||||
180 | $GLOBALS['xoopsDB']->query($sql); |
||||||
181 | $chow = 1; |
||||||
182 | } |
||||||
183 | //streetname |
||||||
184 | if (isset($_POST['street'])) { |
||||||
185 | // $curval = $_POST['curvalstreet']; |
||||||
186 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['street'] . "' WHERE id='" . $dogid . "'"; |
||||||
187 | $curval = Request::getString('curvalstreet', '', 'POST'); |
||||||
188 | $street = $GLOBALS['xoopsDB']->escape(Request::getString('street', '', 'POST')); |
||||||
189 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $street . "' WHERE id='" . $dogid . "'"; |
||||||
190 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
191 | $chow = 1; |
||||||
192 | } |
||||||
193 | //housenumber |
||||||
194 | if (isset($_POST['housenumber'])) { |
||||||
195 | // $curval = $_POST['curvalhousenumber']; |
||||||
196 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['housenumber'] . "' WHERE id='" . $dogid . "'"; |
||||||
197 | $curval = Request::getString('curvalhousenumber', '', 'POST'); |
||||||
198 | $housenumber = $GLOBALS['xoopsDB']->escape(Request::getString('housenumber', '', 'POST')); |
||||||
199 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $housenumber . "' WHERE id='" . $dogid . "'"; |
||||||
200 | $GLOBALS['xoopsDB']->queryF($sql); |
||||||
201 | $chow = 1; |
||||||
202 | } |
||||||
203 | //postcode |
||||||
204 | if (isset($_POST['postcode'])) { |
||||||
205 | // $curval = $_POST['curvalpostcode']; |
||||||
206 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['postcode'] . "' WHERE id='" . $dogid . "'"; |
||||||
207 | $curval = Request::getString('curvalpostcode', '', 'POST'); |
||||||
208 | $postcode = $GLOBALS['xoopsDB']->escape(Request::getString('postcode', '', 'POST')); |
||||||
209 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $postcode . "' WHERE id='" . $dogid . "'"; |
||||||
210 | $GLOBALS['xoopsDB']->query($sql); |
||||||
211 | $chow = 1; |
||||||
212 | } |
||||||
213 | //city |
||||||
214 | if (isset($_POST['city'])) { |
||||||
215 | // $curval = $_POST['curvalcity']; |
||||||
216 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['city'] . "' WHERE id='" . $dogid . "'"; |
||||||
217 | $curval = Request::getString('curvalcity', '', 'POST'); |
||||||
218 | $city = $GLOBALS['xoopsDB']->escape(Request::getString('city', '', 'POST')); |
||||||
219 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $city . "' WHERE id='" . $dogid . "'"; |
||||||
220 | $GLOBALS['xoopsDB']->query($sql); |
||||||
221 | $chow = 1; |
||||||
222 | } |
||||||
223 | //phonenumber |
||||||
224 | if (isset($_POST['phonenumber'])) { |
||||||
225 | // $curval = $_POST['curvalphonenumber']; |
||||||
226 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['phonenumber'] . "' WHERE id='" . $dogid . "'"; |
||||||
227 | $curval = Request::getString('curvalphonenumber', '', 'POST'); |
||||||
228 | $phonenumber = $GLOBALS['xoopsDB']->escape(Request::getString('phonenumber', '', 'POST')); |
||||||
229 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $phonenumber . "' WHERE id='" . $dogid . "'"; |
||||||
230 | $GLOBALS['xoopsDB']->query($sql); |
||||||
231 | $chow = 1; |
||||||
232 | } |
||||||
233 | |||||||
234 | if (isset($_POST['email'])) { |
||||||
235 | // $curval = $_POST['curvalemail']; |
||||||
236 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['email'] . "' WHERE id='" . $dogid . "'"; |
||||||
237 | $curval = Request::getString('curvalemail', '', 'POST'); |
||||||
238 | $email = $GLOBALS['xoopsDB']->escape(Request::getEmail('email', '', 'POST')); |
||||||
239 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $email . "' WHERE id='" . $dogid . "'"; |
||||||
240 | $GLOBALS['xoopsDB']->query($sql); |
||||||
241 | $chow = 1; |
||||||
242 | } |
||||||
243 | //website |
||||||
244 | if (isset($_POST['web'])) { |
||||||
245 | // $curval = $_POST['curvalweb']; |
||||||
246 | // $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $_POST['web'] . "' WHERE id='" . $dogid . "'"; |
||||||
247 | $curval = Request::getString('curvalweb', '', 'POST'); |
||||||
248 | $web = $GLOBALS['xoopsDB']->escape(Request::getUrl('web', '', 'POST')); |
||||||
249 | $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($table) . ' SET ' . $field . "='" . $web . "' WHERE id='" . $dogid . "'"; |
||||||
250 | $GLOBALS['xoopsDB']->query($sql); |
||||||
251 | $chow = 1; |
||||||
252 | } |
||||||
253 | |||||||
254 | //check for access and completion |
||||||
255 | if ($ch) { |
||||||
256 | redirect_header('dog.php?id=' . $dogid, 1, _MD_DATACHANGED); |
||||||
257 | } elseif ($chow) { |
||||||
258 | redirect_header('owner.php?ownid=' . $dogid, 1, _MD_DATACHANGED); |
||||||
259 | } else { |
||||||
260 | foreach ($_POST as $key => $values) { |
||||||
261 | $filesval .= $key . ' : ' . Request::getString($values) . '<br>'; |
||||||
262 | } |
||||||
263 | |||||||
264 | redirect_header('dog.php?id=' . $dogid, 15, 'ERROR!!<br>' . $filesval); |
||||||
265 | } |
||||||
266 | //footer |
||||||
267 | include XOOPS_ROOT_PATH . '/footer.php'; |
||||||
0 ignored issues
–
show
|
|||||||
268 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths