mambax7 /
pedigree
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 | //require_once \dirname(__DIR__, 2) . '/mainfile.php'; |
||||
| 5 | use Xmf\Request; |
||||
|
0 ignored issues
–
show
|
|||||
| 6 | |||||
| 7 | require_once __DIR__ . '/header.php'; |
||||
| 8 | |||||
| 9 | $moduleDirName = basename(__DIR__); |
||||
| 10 | xoops_loadLanguage('main', $moduleDirName); |
||||
| 11 | |||||
| 12 | // Include any common code for this module. |
||||
| 13 | require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php'; |
||||
| 14 | |||||
| 15 | // Get all HTTP post or get parameters into global variables that are prefixed with "param_" |
||||
| 16 | //import_request_variables("gp", "param_"); |
||||
| 17 | extract($_GET, EXTR_PREFIX_ALL, 'param'); |
||||
| 18 | extract($_POST, EXTR_PREFIX_ALL, 'param'); |
||||
| 19 | |||||
| 20 | // This page uses smarty templates. Set "$xoopsOption['template_main']" before including header |
||||
| 21 | $GLOBALS['xoopsOption']['template_main'] = 'pedigree_pedigree.tpl'; |
||||
| 22 | |||||
| 23 | require_once $GLOBALS['xoops']->path('/header.php'); |
||||
| 24 | |||||
| 25 | //always start with Anika |
||||
| 26 | if (!$pedid) { |
||||
| 27 | $pedid = '3'; |
||||
| 28 | } |
||||
| 29 | //draw pedigree |
||||
| 30 | pedigree_main($pedid); |
||||
| 31 | |||||
| 32 | //comments and footer |
||||
| 33 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 34 | |||||
| 35 | // |
||||
| 36 | // Displays the "Main" tab of the module |
||||
| 37 | // |
||||
| 38 | /** |
||||
| 39 | * @param $ID |
||||
| 40 | */ |
||||
| 41 | function pedigree_main($ID) |
||||
| 42 | { |
||||
| 43 | global $xoopsTpl; |
||||
| 44 | global $xoopsModuleConfig; |
||||
| 45 | |||||
| 46 | if (Request::hasVar('detail', 'POST')) { |
||||
| 47 | $detail = trim($_POST['detail']); |
||||
|
0 ignored issues
–
show
|
|||||
| 48 | } |
||||
| 49 | |||||
| 50 | $sql = ' |
||||
| 51 | SELECT d.id as d_id, |
||||
| 52 | d.pname as d_pname, |
||||
| 53 | d.id_owner as d_id_owner, |
||||
| 54 | d.id_breeder as d_id_breeder, |
||||
| 55 | d.roft as d_roft, |
||||
| 56 | d.kleur as d_kleur, |
||||
| 57 | d.mother as d_mother, |
||||
| 58 | d.father as d_father, |
||||
| 59 | d.geboortedatum as d_geboortedatum, |
||||
| 60 | d.overleden as d_overleden, |
||||
| 61 | d.boek as d_boek, |
||||
| 62 | d.nhsb as d_nhsb, |
||||
| 63 | d.foto as d_foto, |
||||
| 64 | d.overig as d_overig, |
||||
| 65 | d.hd as d_hd, |
||||
| 66 | f.id as f_id, |
||||
| 67 | f.pname as f_pname, |
||||
| 68 | f.mother as f_mother, |
||||
| 69 | f.father as f_father, |
||||
| 70 | f.foto as f_foto, |
||||
| 71 | f.hd as f_hd, |
||||
| 72 | m.id as m_id, |
||||
| 73 | m.pname as m_pname, |
||||
| 74 | m.mother as m_mother, |
||||
| 75 | m.father as m_father, |
||||
| 76 | m.foto as m_foto, |
||||
| 77 | m.hd as m_hd, |
||||
| 78 | ff.id as ff_id, |
||||
| 79 | ff.pname as ff_pname, |
||||
| 80 | ff.roft as ff_roft, |
||||
| 81 | ff.mother as ff_mother, |
||||
| 82 | ff.father as ff_father, |
||||
| 83 | ff.foto as ff_foto, |
||||
| 84 | ff.hd as ff_hd, |
||||
| 85 | mf.id as mf_id, |
||||
| 86 | mf.pname as mf_pname, |
||||
| 87 | mf.mother as mf_mother, |
||||
| 88 | mf.father as mf_father, |
||||
| 89 | mf.nhsb as mf_nhsb, |
||||
| 90 | mf.foto as mf_foto, |
||||
| 91 | mf.hd as mf_hd, |
||||
| 92 | fm.id as fm_id, |
||||
| 93 | fm.pname as fm_pname, |
||||
| 94 | fm.mother as fm_mother, |
||||
| 95 | fm.father as fm_father, |
||||
| 96 | fm.nhsb as fm_nhsb, |
||||
| 97 | fm.foto as fm_foto, |
||||
| 98 | fm.hd as fm_hd, |
||||
| 99 | mm.id as mm_id, |
||||
| 100 | mm.pname as mm_pname, |
||||
| 101 | mm.kleur as mm_kleur, |
||||
| 102 | mm.mother as mm_mother, |
||||
| 103 | mm.father as mm_father, |
||||
| 104 | mm.nhsb as mm_nhsb, |
||||
| 105 | mm.foto as mm_foto, |
||||
| 106 | mm.hd as mm_hd, |
||||
| 107 | fff.id as fff_id, |
||||
| 108 | fff.pname as fff_pname, |
||||
| 109 | fff.kleur as fff_kleur, |
||||
| 110 | fff.nhsb as fff_nhsb, |
||||
| 111 | fff.foto as fff_foto, |
||||
| 112 | fff.hd as fff_hd, |
||||
| 113 | ffm.id as ffm_id, |
||||
| 114 | ffm.pname as ffm_pname, |
||||
| 115 | ffm.kleur as ffm_kleur, |
||||
| 116 | ffm.nhsb as ffm_nhsb, |
||||
| 117 | ffm.foto as ffm_foto, |
||||
| 118 | ffm.hd as ffm_hd, |
||||
| 119 | fmf.id as fmf_id, |
||||
| 120 | fmf.pname as fmf_pname, |
||||
| 121 | fmf.kleur as fmf_kleur, |
||||
| 122 | fmf.nhsb as fmf_nhsb, |
||||
| 123 | fmf.foto as fmf_foto, |
||||
| 124 | fmf.hd as fmf_hd, |
||||
| 125 | fmm.id as fmm_id, |
||||
| 126 | fmm.pname as fmm_pname, |
||||
| 127 | fmm.kleur as fmm_kleur, |
||||
| 128 | fmm.nhsb as fmm_nhsb, |
||||
| 129 | fmm.foto as fmm_foto, |
||||
| 130 | fmm.hd as fmm_hd, |
||||
| 131 | mmf.id as mmf_id, |
||||
| 132 | mmf.pname as mmf_pname, |
||||
| 133 | mmf.kleur as mmf_kleur, |
||||
| 134 | mmf.nhsb as mmf_nhsb, |
||||
| 135 | mmf.foto as mmf_foto, |
||||
| 136 | mmf.hd as mmf_hd, |
||||
| 137 | mff.id as mff_id, |
||||
| 138 | mff.pname as mff_pname, |
||||
| 139 | mff.kleur as mff_kleur, |
||||
| 140 | mff.nhsb as mff_nhsb, |
||||
| 141 | mff.foto as mff_foto, |
||||
| 142 | mff.hd as mff_hd, |
||||
| 143 | mfm.id as mfm_id, |
||||
| 144 | mfm.pname as mfm_pname, |
||||
| 145 | mfm.kleur as mfm_kleur, |
||||
| 146 | mfm.nhsb as mfm_nhsb, |
||||
| 147 | mfm.foto as mfm_foto, |
||||
| 148 | mfm.hd as mfm_hd, |
||||
| 149 | mmm.id as mmm_id, |
||||
| 150 | mmm.pname as mmm_pname, |
||||
| 151 | mmm.kleur as mmm_kleur, |
||||
| 152 | mmm.nhsb as mmm_nhsb, |
||||
| 153 | mmm.foto as mmm_foto, |
||||
| 154 | mmm.hd as mmm_hd |
||||
| 155 | FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . " d |
||||
| 156 | LEFT JOIN xoops_pedigree f ON d.father = f.id |
||||
| 157 | LEFT JOIN xoops_pedigree m ON d.mother = m.id |
||||
| 158 | LEFT JOIN xoops_pedigree ff ON f.father = ff.id |
||||
| 159 | LEFT JOIN xoops_pedigree fff ON ff.father = fff.id |
||||
| 160 | LEFT JOIN xoops_pedigree ffm ON ff.mother = ffm.id |
||||
| 161 | LEFT JOIN xoops_pedigree mf ON m.father = mf.id |
||||
| 162 | LEFT JOIN xoops_pedigree mff ON mf.father = mff.id |
||||
| 163 | LEFT JOIN xoops_pedigree mfm ON mf.mother = mfm.id |
||||
| 164 | LEFT JOIN xoops_pedigree fm ON f.mother = fm.id |
||||
| 165 | LEFT JOIN xoops_pedigree fmf ON fm.father = fmf.id |
||||
| 166 | LEFT JOIN xoops_pedigree fmm ON fm.mother = fmm.id |
||||
| 167 | LEFT JOIN xoops_pedigree mm ON m.mother = mm.id |
||||
| 168 | LEFT JOIN xoops_pedigree mmf ON mm.father = mmf.id |
||||
| 169 | LEFT JOIN xoops_pedigree mmm ON mm.mother = mmm.id |
||||
| 170 | where d.id=$ID"; |
||||
| 171 | |||||
| 172 | $result = $GLOBALS['xoopsDB']->query($sql); |
||||
| 173 | |||||
| 174 | //get module configuration |
||||
| 175 | /** @var \XoopsModuleHandler $moduleHandler */ |
||||
| 176 | $moduleHandler = xoops_getHandler('module'); |
||||
| 177 | $module = $moduleHandler->getByDirname($moduleDirName); |
||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
| 178 | /** @var \XoopsConfigHandler $configHandler */ |
||||
| 179 | $configHandler = xoops_getHandler('config'); |
||||
| 180 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
||||
| 181 | |||||
| 182 | $pic = $moduleConfig['pics']; |
||||
| 183 | $hd = $moduleConfig['hd']; |
||||
| 184 | while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||||
| 185 | //create array for dog (and all parents) |
||||
| 186 | //selected dog |
||||
| 187 | $d['d']['name'] = stripslashes($row['d_pname']); |
||||
| 188 | $d['d']['id'] = $row['d_id']; |
||||
| 189 | $d['d']['roft'] = $row['d_roft']; |
||||
| 190 | $d['d']['nhsb'] = $row['d_nhsb']; |
||||
| 191 | $d['d']['colour'] = $row['d_kleur']; |
||||
| 192 | if (1 == $pic) { |
||||
| 193 | $d['d']['photo'] = $row['d_foto']; |
||||
| 194 | } |
||||
| 195 | if (1 == $hd) { |
||||
| 196 | $d['d']['hd'] = hd($row['d_hd']); |
||||
|
0 ignored issues
–
show
The function
hd 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
Loading history...
|
|||||
| 197 | } |
||||
| 198 | //father |
||||
| 199 | $d['f']['name'] = stripslashes($row['f_pname']); |
||||
| 200 | $d['f']['id'] = $row['f_id']; |
||||
| 201 | if (1 == $pic) { |
||||
| 202 | $d['f']['photo'] = $row['f_foto']; |
||||
| 203 | } |
||||
| 204 | if (1 == $hd) { |
||||
| 205 | $d['f']['hd'] = hd($row['f_hd']); |
||||
| 206 | } |
||||
| 207 | //mother |
||||
| 208 | $d['m']['name'] = stripslashes($row['m_pname']); |
||||
| 209 | $d['m']['id'] = $row['m_id']; |
||||
| 210 | if (1 == $pic) { |
||||
| 211 | $d['m']['photo'] = $row['m_foto']; |
||||
| 212 | } |
||||
| 213 | if (1 == $hd) { |
||||
| 214 | $d['m']['hd'] = hd($row['m_hd']); |
||||
| 215 | } |
||||
| 216 | //grandparents |
||||
| 217 | //father father |
||||
| 218 | $d['ff']['name'] = stripslashes($row['ff_pname']); |
||||
| 219 | $d['ff']['id'] = $row['ff_id']; |
||||
| 220 | if (1 == $pic) { |
||||
| 221 | $d['ff']['photo'] = $row['ff_foto']; |
||||
| 222 | } |
||||
| 223 | if (1 == $hd) { |
||||
| 224 | $d['ff']['hd'] = hd($row['ff_hd']); |
||||
| 225 | } |
||||
| 226 | //father mother |
||||
| 227 | $d['fm']['name'] = stripslashes($row['fm_pname']); |
||||
| 228 | $d['fm']['id'] = $row['fm_id']; |
||||
| 229 | if (1 == $pic) { |
||||
| 230 | $d['fm']['photo'] = $row['fm_foto']; |
||||
| 231 | } |
||||
| 232 | if (1 == $hd) { |
||||
| 233 | $d['fm']['hd'] = hd($row['fm_hd']); |
||||
| 234 | } |
||||
| 235 | //mother father |
||||
| 236 | $d['mf']['name'] = stripslashes($row['mf_pname']); |
||||
| 237 | $d['mf']['id'] = $row['mf_id']; |
||||
| 238 | if (1 == $pic) { |
||||
| 239 | $d['mf']['photo'] = $row['mf_foto']; |
||||
| 240 | } |
||||
| 241 | if (1 == $hd) { |
||||
| 242 | $d['mf']['hd'] = hd($row['mf_hd']); |
||||
| 243 | } |
||||
| 244 | //mother mother |
||||
| 245 | $d['mm']['name'] = stripslashes($row['mm_pname']); |
||||
| 246 | $d['mm']['id'] = $row['mm_id']; |
||||
| 247 | if (1 == $pic) { |
||||
| 248 | $d['mm']['photo'] = $row['mm_foto']; |
||||
| 249 | } |
||||
| 250 | if (1 == $hd) { |
||||
| 251 | $d['mm']['hd'] = hd($row['mm_hd']); |
||||
| 252 | } |
||||
| 253 | //great-grandparents |
||||
| 254 | //father father father |
||||
| 255 | $d['fff']['name'] = stripslashes($row['fff_pname']); |
||||
| 256 | $d['fff']['id'] = $row['fff_id']; |
||||
| 257 | if (1 == $pic) { |
||||
| 258 | $d['fff']['photo'] = $row['fff_foto']; |
||||
| 259 | } |
||||
| 260 | if (1 == $hd) { |
||||
| 261 | $d['fff']['hd'] = hd($row['fff_hd']); |
||||
| 262 | } |
||||
| 263 | //father father mother |
||||
| 264 | $d['ffm']['name'] = stripslashes($row['ffm_pname']); |
||||
| 265 | $d['ffm']['id'] = $row['ffm_id']; |
||||
| 266 | if (1 == $pic) { |
||||
| 267 | $d['ffm']['photo'] = $row['ffm_foto']; |
||||
| 268 | } |
||||
| 269 | if (1 == $hd) { |
||||
| 270 | $d['ffm']['hd'] = hd($row['ffm_hd']); |
||||
| 271 | } |
||||
| 272 | //father mother father |
||||
| 273 | $d['fmf']['name'] = stripslashes($row['fmf_pname']); |
||||
| 274 | $d['fmf']['id'] = $row['fmf_id']; |
||||
| 275 | if (1 == $pic) { |
||||
| 276 | $d['fmf']['photo'] = $row['fmf_foto']; |
||||
| 277 | } |
||||
| 278 | if (1 == $hd) { |
||||
| 279 | $d['fmf']['hd'] = hd($row['fmf_hd']); |
||||
| 280 | } |
||||
| 281 | //father mother mother |
||||
| 282 | $d['fmm']['name'] = stripslashes($row['fmm_pname']); |
||||
| 283 | $d['fmm']['id'] = $row['fmm_id']; |
||||
| 284 | if (1 == $pic) { |
||||
| 285 | $d['fmm']['photo'] = $row['fmm_foto']; |
||||
| 286 | } |
||||
| 287 | if (1 == $hd) { |
||||
| 288 | $d['fmm']['hd'] = hd($row['fmm_hd']); |
||||
| 289 | } |
||||
| 290 | //mother father father |
||||
| 291 | $d['mff']['name'] = stripslashes($row['mff_pname']); |
||||
| 292 | $d['mff']['id'] = $row['mff_id']; |
||||
| 293 | if (1 == $pic) { |
||||
| 294 | $d['mff']['photo'] = $row['mff_foto']; |
||||
| 295 | } |
||||
| 296 | if (1 == $hd) { |
||||
| 297 | $d['mff']['hd'] = hd($row['mff_hd']); |
||||
| 298 | } |
||||
| 299 | //mother father mother |
||||
| 300 | $d['mfm']['name'] = stripslashes($row['mfm_pname']); |
||||
| 301 | $d['mfm']['id'] = $row['mfm_id']; |
||||
| 302 | if (1 == $pic) { |
||||
| 303 | $d['mfm']['photo'] = $row['mfm_foto']; |
||||
| 304 | } |
||||
| 305 | if (1 == $hd) { |
||||
| 306 | $d['mfm']['hd'] = hd($row['mfm_hd']); |
||||
| 307 | } |
||||
| 308 | //mother mother father |
||||
| 309 | $d['mmf']['name'] = stripslashes($row['mmf_pname']); |
||||
| 310 | $d['mmf']['id'] = $row['mmf_id']; |
||||
| 311 | if (1 == $pic) { |
||||
| 312 | $d['mmf']['photo'] = $row['mmf_foto']; |
||||
| 313 | } |
||||
| 314 | if (1 == $hd) { |
||||
| 315 | $d['mmf']['hd'] = hd($row['mmf_hd']); |
||||
| 316 | } |
||||
| 317 | //mother mother mother |
||||
| 318 | $d['mmm']['name'] = stripslashes($row['mmm_pname']); |
||||
| 319 | $d['mmm']['id'] = $row['mmm_id']; |
||||
| 320 | if (1 == $pic) { |
||||
| 321 | $d['mmm']['photo'] = $row['mmm_foto']; |
||||
| 322 | } |
||||
| 323 | if (1 == $hd) { |
||||
| 324 | $d['mmm']['hd'] = hd($row['mmm_hd']); |
||||
| 325 | } |
||||
| 326 | } |
||||
| 327 | |||||
| 328 | //add data to smarty template |
||||
| 329 | $xoopsTpl->assign('page_title', stripslashes($row['d_pname'])); |
||||
| 330 | //assign dog |
||||
| 331 | $xoopsTpl->assign('d', $d); |
||||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||||
| 332 | //assign config options |
||||
| 333 | $ov = $moduleConfig['overview']; |
||||
| 334 | $xoopsTpl->assign('overview', $ov); |
||||
| 335 | $sign = $moduleConfig['gender']; |
||||
| 336 | if (1 == $sign) { |
||||
| 337 | $xoopsTpl->assign('male', "<img src=\"" . PEDIGREE_IMAGE_URL . "/male.gif\">"); |
||||
|
0 ignored issues
–
show
|
|||||
| 338 | $xoopsTpl->assign('female', "<img src=\"" . PEDIGREE_IMAGE_URL . "/female.gif\">"); |
||||
| 339 | } |
||||
| 340 | $addit = $moduleConfig['adinfo']; |
||||
| 341 | if (1 == $addit) { |
||||
| 342 | $xoopsTpl->assign('addinfo', '1'); |
||||
| 343 | } |
||||
| 344 | $xoopsTpl->assign('pics', $pic); |
||||
| 345 | //assign extra display options |
||||
| 346 | $xoopsTpl->assign('unknown', 'Unknown'); |
||||
| 347 | $xoopsTpl->assign('SD', _MA_PEDIGREE_SD); |
||||
| 348 | $xoopsTpl->assign('PA', _MA_PEDIGREE_PA); |
||||
| 349 | $xoopsTpl->assign('GP', _MA_PEDIGREE_GP); |
||||
| 350 | $xoopsTpl->assign('GGP', _MA_PEDIGREE_GGP); |
||||
| 351 | } |
||||
| 352 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare 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.phpHowever, as
OtherDir/Foo.phpdoes 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: