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 of |
||
4 | supporting developers from this source code or any supporting source code |
||
5 | which is considered copyrighted (c) material of the original comment or credit |
||
6 | authors. |
||
7 | |||
8 | This program is distributed in the hope that it will be useful, but |
||
9 | 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 | * @package XoopsModules\Pedigree |
||
17 | * @author XOOPS Module Development Team |
||
18 | * @copyright Copyright (c) 2001-2019 {@link https://xoops.org XOOPS Project} |
||
19 | * @license https://www.gnu.org/licenses/gpl-2.0.html GNU Public License |
||
20 | */ |
||
21 | |||
22 | use Xmf\Request; |
||
23 | use XoopsModules\Pedigree\{ |
||
24 | Helper |
||
25 | }; |
||
26 | |||
27 | //require_once \dirname(__DIR__, 2) . '/mainfile.php'; |
||
28 | require_once __DIR__ . '/header.php'; |
||
29 | $moduleDirName = basename(__DIR__); |
||
30 | xoops_loadLanguage('main', $moduleDirName); |
||
31 | // Include any common code for this module. |
||
32 | require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php'; |
||
33 | |||
34 | $GLOBALS['xoopsOption']['template_main'] = 'pedigree_update.tpl'; |
||
35 | require XOOPS_ROOT_PATH . '/header.php'; |
||
36 | |||
37 | $xoopsTpl->assign('page_title', 'Pedigree database - Update details'); |
||
38 | |||
39 | //check for access |
||
40 | $xoopsModule = XoopsModule::getByDirname($moduleDirName); |
||
41 | if (empty($GLOBALS['xoopsUser']) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser)) { |
||
42 | redirect_header('javascript:history.go(-1)', 3, _NOPERM . '<br>' . _MA_PEDIGREE_REGIST); |
||
43 | } |
||
44 | // ( $xoopsUser->isAdmin($xoopsModule->mid() ) ) |
||
45 | |||
46 | global $xoopsTpl; |
||
47 | global $xoopsDB; |
||
48 | global $xoopsModuleConfig; |
||
49 | |||
50 | //get module configuration |
||
51 | /* |
||
52 | $moduleHandler = xoops_getHandler('module'); |
||
53 | $module = $moduleHandler->getByDirname($moduleDirName); |
||
54 | $configHandler = xoops_getHandler('config'); |
||
55 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
||
56 | */ |
||
57 | $helper = Helper::getInstance(false); |
||
58 | $moduleConfig = $helper->getConfig(); |
||
59 | |||
60 | $myts = \MyTextSanitizer::getInstance(); |
||
61 | |||
62 | $fld = Request::getString('fld', '', 'GET'); |
||
63 | $id = Request::getInt('id', 0, 'GET'); |
||
64 | /* |
||
65 | $fld = $_GET['fld']; |
||
66 | $id = $_GET['id']; |
||
67 | */ |
||
68 | |||
69 | //query (find values for this dog (and format them)) |
||
70 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE id=' . $id; |
||
71 | $result = $GLOBALS['xoopsDB']->query($sql); |
||
72 | |||
73 | while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
74 | //ID |
||
75 | $id = $row['id']; |
||
76 | //name |
||
77 | $pname = htmlentities(stripslashes($row['pname']), ENT_QUOTES); |
||
78 | $namelink = '<a href="dog.php?id=' . $row['id'] . '">' . stripslashes($row['pname']) . '</a>'; |
||
79 | //owner |
||
80 | $queryeig = 'SELECT id, lastname, firstname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' WHERE id=' . $row['id_owner']; |
||
81 | $reseig = $GLOBALS['xoopsDB']->query($queryeig); |
||
82 | while (false !== ($roweig = $GLOBALS['xoopsDB']->fetchArray($reseig))) { |
||
83 | $eig = '<a href="owner.php?ownid=' . $roweig['id'] . '">' . $roweig['firstname'] . ' ' . $roweig['lastname'] . '</a>'; |
||
84 | } |
||
85 | $curvaleig = $row['id_owner']; |
||
86 | //breeder |
||
87 | $queryfok = 'SELECT id, lastname, firstname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' WHERE id=' . $row['id_breeder']; |
||
88 | $resfok = $GLOBALS['xoopsDB']->query($queryfok); |
||
89 | while (false !== ($rowfok = $GLOBALS['xoopsDB']->fetchArray($resfok))) { |
||
90 | $fok = '<a href="owner.php?ownid=' . $rowfok['id'] . '">' . $rowfok['firstname'] . ' ' . $rowfok['lastname'] . '</a>'; |
||
91 | } |
||
92 | $curvalfok = $row['id_breeder']; |
||
93 | //gender |
||
94 | if ('0' == $row['roft']) { |
||
95 | $gender = '<img src="assets/images/male.gif"> ' . _MA_PEDIGREE_FLD_MALE; |
||
96 | } else { |
||
97 | $gender = '<img src="assets/images/female.gif"> ' . _MA_PEDIGREE_FLD_FEMA; |
||
98 | } |
||
99 | $curvalroft = $row['roft']; |
||
100 | //Sire |
||
101 | if (0 != $row['father']) { |
||
102 | $querysire = 'SELECT pname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE id=' . $row['father']; |
||
103 | $ressire = $GLOBALS['xoopsDB']->query($querysire); |
||
104 | while (false !== ($rowsire = $GLOBALS['xoopsDB']->fetchArray($ressire))) { |
||
105 | $sire = '<img src="assets/images/male.gif"><a href="dog.php?id=' . $row['father'] . '">' . stripslashes($rowsire['pname']) . '</a>'; |
||
106 | } |
||
107 | } |
||
108 | //Dam |
||
109 | if (0 != $row['mother']) { |
||
110 | $querydam = 'SELECT pname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' WHERE id=' . $row['mother']; |
||
111 | $resdam = $GLOBALS['xoopsDB']->query($querydam); |
||
112 | while (false !== ($rowdam = $GLOBALS['xoopsDB']->fetchArray($resdam))) { |
||
113 | $dam = '<img src="assets/images/female.gif"><a href="dog.php?id=' . $row['mother'] . '">' . stripslashes($rowdam['pname']) . '</a>'; |
||
114 | } |
||
115 | } |
||
116 | //picture |
||
117 | $picture = ''; |
||
118 | if ('' != $row['foto']) { |
||
119 | $picture = '<img src=' . PEDIGREE_UPLOAD_URL . '/images/thumbnails/' . $row['foto'] . '_400.jpeg>'; |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
120 | $foto = $row['foto']; |
||
121 | } else { |
||
122 | $foto = ''; |
||
123 | } |
||
124 | //user who entered the info |
||
125 | $dbuser = $row['user']; |
||
126 | } |
||
127 | |||
128 | //create form |
||
129 | require XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
130 | $form = new \XoopsThemeForm($pname, 'updatedata', 'updatepage.php', 'post', true); |
||
131 | $form->setExtra("enctype='multipart/form-data'"); |
||
132 | //hidden value current record owner |
||
133 | $form->addElement(new \XoopsFormHidden('dbuser', $dbuser)); |
||
134 | //hidden value dog ID |
||
135 | $form->addElement(new \XoopsFormHidden('dogid', $id)); |
||
136 | $form->addElement(new \XoopsFormHidden('curname', $pname)); |
||
137 | $form->addElement(new \XoopsFormHiddenToken($name = 'XOOPS_TOKEN_REQUEST', $timeout = 360)); |
||
138 | //name |
||
139 | if ('nm' === $fld || 'all' === $fld) { |
||
140 | $form->addElement(new \XoopsFormText('<b>' . _MA_PEDIGREE_FLD_NAME . '</b>', 'pname', $size = 50, $maxsize = 255, $value = $pname)); |
||
141 | $form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_EXPLAIN, _MA_PEDIGREE_FLD_NAME_EX)); |
||
142 | $form->addElement(new \XoopsFormHidden('dbtable', 'pedigree_tree')); |
||
143 | $form->addElement(new \XoopsFormHidden('dbfield', 'pname')); |
||
144 | $form->addElement(new \XoopsFormHidden('curvalname', $pname)); |
||
145 | } else { |
||
146 | //owner |
||
147 | if ('ow' === $fld || 'all' === $fld) { |
||
148 | $owner_select = new \XoopsFormSelect('<b>' . _MA_PEDIGREE_FLD_OWNE . '</b>', $name = 'id_owner', $value = null, $size = 1, $multiple = false); |
||
149 | $queryeig = 'SELECT id, lastname, firstname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' ORDER BY `lastname`'; |
||
150 | $reseig = $GLOBALS['xoopsDB']->query($queryeig); |
||
151 | $owner_select->addOption(0, $name = _MA_PEDIGREE_UNKNOWN); |
||
152 | while (false !== ($roweig = $GLOBALS['xoopsDB']->fetchArray($reseig))) { |
||
153 | $owner_select->addOption($roweig['id'], $name = $roweig['lastname'] . ', ' . $roweig['firstname']); |
||
154 | } |
||
155 | $form->addElement($owner_select); |
||
156 | $form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_EXPLAIN, _MA_PEDIGREE_FLD_OWNE_EX)); |
||
157 | $form->addElement(new \XoopsFormHidden('dbtable', 'pedigree_tree')); |
||
158 | $form->addElement(new \XoopsFormHidden('dbfield', 'id_owner')); |
||
159 | $form->addElement(new \XoopsFormHidden('curvaleig', $curvaleig)); |
||
160 | } |
||
161 | } |
||
162 | |||
163 | //breeder |
||
164 | if ('br' === $fld || 'all' === $fld) { |
||
165 | $breeder_select = new \XoopsFormSelect('<b>' . _MA_PEDIGREE_FLD_BREE . '</b>', $name = 'id_breeder', $value = null, $size = 1, $multiple = false); |
||
166 | $queryfok = 'SELECT id, lastname, firstname FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' ORDER BY `lastname`'; |
||
167 | $resfok = $GLOBALS['xoopsDB']->query($queryfok); |
||
168 | $breeder_select->addOption(0, $name = _MA_PEDIGREE_UNKNOWN); |
||
169 | while (false !== ($rowfok = $GLOBALS['xoopsDB']->fetchArray($resfok))) { |
||
170 | $breeder_select->addOption($rowfok['id'], $name = $rowfok['lastname'] . ', ' . $rowfok['firstname']); |
||
171 | } |
||
172 | $form->addElement($breeder_select); |
||
173 | $form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_EXPLAIN, _MA_PEDIGREE_FLD_BREE_EX)); |
||
174 | $form->addElement(new \XoopsFormHidden('dbtable', 'pedigree_tree')); |
||
175 | $form->addElement(new \XoopsFormHidden('dbfield', 'id_breeder')); |
||
176 | $form->addElement(new \XoopsFormHidden('curvalfok', $curvalfok)); |
||
177 | } |
||
178 | |||
179 | //gender |
||
180 | if ('sx' === $fld || 'all' === $fld) { |
||
181 | $gender_radio = new \XoopsFormRadio('<b>' . _MA_PEDIGREE_FLD_GEND . '</b>', 'roft', $value = null); |
||
182 | $gender_radio->addOptionArray(['0' => _MA_PEDIGREE_FLD_MALE, '1' => _MA_PEDIGREE_FLD_FEMA]); |
||
183 | $form->addElement($gender_radio); |
||
184 | $form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_EXPLAIN, _MA_PEDIGREE_FLD_GEND_EX)); |
||
185 | $form->addElement(new \XoopsFormHidden('dbtable', 'pedigree_tree')); |
||
186 | $form->addElement(new \XoopsFormHidden('dbfield', 'roft')); |
||
187 | $form->addElement(new \XoopsFormHidden('curvalroft', $curvalroft)); |
||
188 | } |
||
189 | |||
190 | //picture |
||
191 | if ('pc' === $fld || 'all' === $fld) { |
||
192 | $form->addElement(new \XoopsFormLabel('Picture', $picture)); |
||
193 | $form->setExtra("enctype='multipart/form-data'"); |
||
194 | $img_box = new \XoopsFormFile('Image', 'photo', 1024000); |
||
195 | $img_box->setExtra("size ='50'"); |
||
196 | $form->addElement($img_box); |
||
197 | $form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_EXPLAIN, strtr(_MA_PEDIGREE_FLD_PICT_EX, ['[animalType]' => $moduleConfig['animalType']]))); |
||
198 | $form->addElement(new \XoopsFormHidden('dbtable', 'pedigree_tree')); |
||
199 | $form->addElement(new \XoopsFormHidden('dbfield', 'foto')); |
||
200 | $form->addElement(new \XoopsFormHidden('curvalpic', $foto)); |
||
201 | } |
||
202 | |||
203 | //create animal object |
||
204 | |||
205 | $a = (!isset($_GET['id']) ? $a = 1 : $a = $_GET['id']); |
||
206 | $animal = new Pedigree\Animal($a); |
||
0 ignored issues
–
show
The type
Pedigree\Animal 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 ![]() |
|||
207 | |||
208 | //test to find out how many user fields there are.. |
||
209 | $fields = $animal->getNumOfFields(); |
||
210 | |||
211 | foreach ($fields as $i => $iValue) { |
||
212 | if ($_GET['fld'] == $iValue) { |
||
213 | $userField = new Pedigree\Field($fields[$i], $animal->getConfig()); |
||
0 ignored issues
–
show
The type
Pedigree\Field 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 ![]() |
|||
214 | if ($userField->isActive()) { |
||
215 | $fieldType = $userField->getSetting('FieldType'); |
||
216 | $fieldObject = new $fieldType($userField, $animal); |
||
217 | $edditable = $fieldObject->editField(); |
||
218 | $form->addElement($edditable); |
||
219 | $explain = $userField->getSetting('FieldExplanation'); |
||
220 | $form->addElement(new \XoopsFormLabel(_MA_PEDIGREE_EXPLAIN, $explain)); |
||
221 | $form->addElement(new \XoopsFormHidden('dbtable', 'pedigree_tree')); |
||
222 | $form->addElement(new \XoopsFormHidden('dbfield', 'user' . $iValue)); |
||
223 | } |
||
224 | } |
||
225 | } |
||
226 | |||
227 | //submit button |
||
228 | if ($fld) { |
||
229 | $form->addElement(new \XoopsFormButton('', 'button_id', _MA_PEDIGREE_BUT_SUB, 'submit')); |
||
230 | } |
||
231 | //add data (form) to smarty template |
||
232 | $xoopsTpl->assign('form', $form->render()); |
||
233 | |||
234 | //footer |
||
235 | require XOOPS_ROOT_PATH . '/footer.php'; |
||
236 |