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 | 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 | * @copyright Copyright (c) 2001-2019 {@link https://xoops.org XOOPS Project} |
||||
| 18 | * @license https://www.gnu.org/licenses/gpl-2.0.html GNU Public License |
||||
| 19 | * @author XOOPS Module Development Team |
||||
| 20 | */ |
||||
| 21 | |||||
| 22 | use XoopsModules\Pedigree; |
||||
| 23 | use XoopsModules\Pedigree\Constants; |
||||
| 24 | |||||
| 25 | require_once __DIR__ . '/header.php'; |
||||
| 26 | |||||
| 27 | /** @var \XoopsModules\Pedigree\Helper $helper */ |
||||
| 28 | $helper->loadLanguage('main'); |
||||
| 29 | |||||
| 30 | //needed for generation of pie charts |
||||
| 31 | //ob_start(); |
||||
| 32 | |||||
| 33 | $GLOBALS['xoopsOption']['template_main'] = 'pedigree_advanced.tpl'; |
||||
| 34 | require XOOPS_ROOT_PATH . '/header.php'; |
||||
| 35 | |||||
| 36 | // Include any common code for this module. |
||||
| 37 | require_once $helper->path('include/common.php'); |
||||
| 38 | $xoTheme->addScript(XOOPS_URL . '/browse.php?Frameworks/jquery/jquery.js'); |
||||
| 39 | $xoTheme->addScript($helper->url('assets/js/jquery.canvasjs.min.js')); |
||||
| 40 | |||||
| 41 | $totpl = []; |
||||
| 42 | $books = []; |
||||
| 43 | |||||
| 44 | //get colour variables |
||||
| 45 | [$actlink, $even, $odd, $text, $hovlink, $head, $body, $title] = Pedigree\Utility::getColourScheme(); |
||||
| 46 | /* |
||||
| 47 | $actlink = $colors[0]; |
||||
| 48 | $even = $colors[1]; |
||||
| 49 | $odd = $colors[2]; |
||||
| 50 | $text = $colors[3]; |
||||
| 51 | $hovlink = $colors[4]; |
||||
| 52 | $head = $colors[5]; |
||||
| 53 | $body = $colors[6]; |
||||
| 54 | $title = $colors[7]; |
||||
| 55 | */ |
||||
| 56 | //@todo TEST conversion to use Object CRUD using \Criteria instead of SQL call |
||||
| 57 | //query to count male dogs |
||||
| 58 | $treeHandler = $helper->getHandler('Tree'); |
||||
| 59 | $criteria = new \Criteria(); |
||||
|
0 ignored issues
–
show
|
|||||
| 60 | $criteria->setGroupBy('roft'); |
||||
| 61 | $criteria->order = 'ASC'; //hack to work around bug in XOOPS core |
||||
| 62 | $roftCountArray = $treeHandler->getCounts($criteria); |
||||
| 63 | $countMales = $roftCountArray[Constants::MALE]; |
||||
| 64 | $countFemales = $roftCountArray[Constants::FEMALE]; |
||||
| 65 | $totalAnimals = $countMales + $countFemales; |
||||
| 66 | $pctMales = $totalAnimals > 0 ? round($countMales / $totalAnimals, Constants::PCT_PRECISION) : 0; |
||||
| 67 | // to eliminate rounding errors |
||||
| 68 | $pctFemales = 1 - $pctMales; |
||||
| 69 | |||||
| 70 | /* |
||||
| 71 | $totalAnimals = $countMales + $countFemales; |
||||
| 72 | $pctMales = (($totalAminals > 0) && ($countMales > 0)) ? round(100 / $totalAnimals * $countMales, 1) : 0; |
||||
| 73 | $pctFemales = round(100 / $totalAnimals * $countFemales, 1); |
||||
| 74 | |||||
| 75 | //query to count male aminals |
||||
| 76 | $result = $GLOBALS['xoopsDB']->query('SELECT count(id) FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . " WHERE roft='0'"); |
||||
| 77 | list($countmales) = $GLOBALS['xoopsDB']->fetchRow($result); |
||||
| 78 | |||||
| 79 | //query to count female animals |
||||
| 80 | $result = $GLOBALS['xoopsDB']->query('SELECT count(id) FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . " WHERE roft='1'"); |
||||
| 81 | list($countfemales) = $GLOBALS['xoopsDB']->fetchRow($result); |
||||
| 82 | */ |
||||
| 83 | /* |
||||
| 84 | //create pie for number of males/females |
||||
| 85 | //construct new pie |
||||
| 86 | $numbers_pie = new eq_pie; |
||||
| 87 | $data[0][0] = strtr(_MA_PEDIGREE_FLD_MALE, array('[male]' => $configs['male'])); |
||||
| 88 | $data[0][1] = $countMales; |
||||
| 89 | $data[0][2] = '#C8C8FF'; |
||||
| 90 | $data[1][0] = strtr(_MA_PEDIGREE_FLD_FEMA, array('[female]' => $configs['female'])); |
||||
| 91 | $data[1][1] = $countFemales; |
||||
| 92 | $data[1][2] = '#FFC8C8'; |
||||
| 93 | |||||
| 94 | $numbers_pie->MakePie('assets/images/numbers.png', '200', '200', '10', $odd, $data, '1'); |
||||
| 95 | |||||
| 96 | //create animal object |
||||
| 97 | |||||
| 98 | $animal = new Pedigree\Animal(); |
||||
| 99 | //test to find out how many user fields there are... |
||||
| 100 | $fields = $animal->getNumOfFields(); |
||||
| 101 | |||||
| 102 | for ($i = 0, $iMax = count($fields); $i < $iMax; ++$i) { |
||||
| 103 | $userField = new Pedigree\Field($fields[$i], $animal->getConfig()); |
||||
| 104 | $fieldType = $userField->getSetting('fieldtype'); |
||||
| 105 | $fieldObject = new $fieldType($userField, $animal); |
||||
| 106 | if ($userField->isActive() && $userField->inAdvanced()) { |
||||
| 107 | $sql = |
||||
| 108 | 'SELECT count(p.user' . $fields[$i] . ') as X, p.user' . $fields[$i] . ' as p_user' . $fields[$i] . ', b.ID as b_id, b.value as b_value FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' p LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_lookup' . $fields[$i]) . ' b ON p.user' |
||||
| 109 | . $fields[$i] . ' = b.ID GROUP BY p.user' . $fields[$i] . ' ORDER BY X DESC'; |
||||
| 110 | $result = $GLOBALS['xoopsDB']->query($sql); |
||||
| 111 | $piecount = 0; |
||||
| 112 | unset($data, $books); |
||||
| 113 | |||||
| 114 | while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||||
| 115 | $data[$piecount][0] = $row['b_value']; |
||||
| 116 | $data[$piecount][1] = $row['X']; |
||||
| 117 | $data[$piecount][2] = '#' . hexdec(mt_rand(255, 1)) . hexdec(mt_rand(255, 1)) . hexdec(mt_rand(255, 1)); |
||||
| 118 | if ($row['p_user' . $fields[$i]] == '0') { |
||||
| 119 | $whe = 'zero'; |
||||
| 120 | } else { |
||||
| 121 | $whe = $row['p_user' . $fields[$i]]; |
||||
| 122 | } |
||||
| 123 | $books[] = array( |
||||
| 124 | 'book' => "<a href=\"result.php?f=user" . $fields[$i] . '&w=' . $whe . "&o=pname\">" . $row['X'] . '</a>', |
||||
| 125 | 'country' => $row['b_value'] |
||||
| 126 | ); |
||||
| 127 | ++$piecount; |
||||
| 128 | } |
||||
| 129 | if ($userField->inPie()) { |
||||
| 130 | $pie = new eq_pie; |
||||
| 131 | if ($piecount % 2 == 0) { |
||||
| 132 | $back = $even; |
||||
| 133 | } else { |
||||
| 134 | $back = $odd; |
||||
| 135 | } |
||||
| 136 | $pie->MakePie('assets/images/user' . $fields[$i] . '.png', '200', '200', '10', $back, $data, '1'); |
||||
| 137 | unset($pie); |
||||
| 138 | $books[] = array('book' => 'Chart', 'country' => '<img src="assets/images/user' . $fields[$i] . '.png">'); |
||||
| 139 | } |
||||
| 140 | $totpl[] = array('title' => $userField->getSetting('FieldName'), 'content' => $books); |
||||
| 141 | } |
||||
| 142 | } |
||||
| 143 | */ |
||||
| 144 | |||||
| 145 | $configs = $helper->getConfigs(); |
||||
|
0 ignored issues
–
show
The method
getConfigs() does not exist on XoopsModules\Pedigree\Helper. Did you maybe mean getConfig()?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. Loading history...
|
|||||
| 146 | //strtr(_MA_PEDIGREE_FLD_MALE, array( '[male]' => $configs['male'] )) |
||||
| 147 | //strtr(_MA_PEDIGREE_ADV_ORPMUM, array( '[mother]' => $configs['mother'], '[animalTypes]' => $configs['animalTypes'] )) |
||||
| 148 | if ('1' == $configs['proversion']) { |
||||
| 149 | $GLOBALS['xoopsTpl']->assign('pro', true); |
||||
| 150 | } |
||||
| 151 | //get module preferences (configs) |
||||
| 152 | $GLOBALS['xoopsTpl']->assign([ |
||||
| 153 | 'title' => strtr(_MA_PEDIGREE_ADV_VTMF, ['[male]' => $configs['male'], '[female]' => $configs['female']]), |
||||
| 154 | 'topmales' => '<a href="topstud.php?com=father">' . strtr(_MA_PEDIGREE_ADV_STUD, [ |
||||
| 155 | '[male]' => $configs['male'], |
||||
| 156 | '[children]' => $configs['children'], |
||||
| 157 | ]) . '</a>', |
||||
| 158 | 'topfemales' => '<a href="topstud.php?com=mother">' . strtr(_MA_PEDIGREE_ADV_BITC, [ |
||||
| 159 | '[female]' => $configs['female'], |
||||
| 160 | '[children]' => $configs['children'], |
||||
| 161 | ]) . '</a>', |
||||
| 162 | 'tnmftitle' => strtr(_MA_PEDIGREE_ADV_TNMFTIT, ['[male]' => $configs['male'], '[female]' => $configs['female']]), |
||||
| 163 | 'countmales' => "<img src=\"" . PEDIGREE_IMAGE_URL . "/male.gif\"> " . strtr(_MA_PEDIGREE_ADV_TCMA, [ |
||||
|
0 ignored issues
–
show
|
|||||
| 164 | '[male]' => $configs['male'], |
||||
| 165 | '[female]' => $configs['female'], |
||||
| 166 | ]) . ' : <a href="result.php?f=roft&w=zero&o=pname">' . $countMales . '</a>', |
||||
| 167 | 'countfemales' => "<img src=\"" . PEDIGREE_IMAGE_URL . "/female.gif\"> " . strtr(_MA_PEDIGREE_ADV_TCFE, [ |
||||
| 168 | '[male]' => $configs['male'], |
||||
| 169 | '[female]' => $configs['female'], |
||||
| 170 | ]) . ' : <a href="result.php?f=roft&w=1&o=pname">' . $countFemales . '</a>', |
||||
| 171 | 'pienumber' => "<img src=\"" . PEDIGREE_IMAGE_URL . "/numbers.png\">", |
||||
| 172 | 'totpl' => $totpl, |
||||
| 173 | 'books' => $books, |
||||
| 174 | 'orptitle' => _MA_PEDIGREE_ADV_ORPTIT, |
||||
| 175 | 'orpall' => '<a href="result.php?f=father=0 and mother&w=zero&o=pname">' . strtr(_MA_PEDIGREE_ADV_ORPALL, ['[animalTypes]' => $configs['animalTypes']]) . '</a>', |
||||
| 176 | 'orpdad' => '<a href="result.php?f=mother!=0 and father&w=zero&o=pname">' . strtr(_MA_PEDIGREE_ADV_ORPDAD, [ |
||||
| 177 | '[father]' => $configs['father'], |
||||
| 178 | '[animalTypes]' => $configs['animalTypes'], |
||||
| 179 | ]) . '</a>', |
||||
| 180 | 'orpmum' => '<a href="result.php?f=father!=0 and mother&w=zero&o=pname">' . strtr(_MA_PEDIGREE_ADV_ORPMUM, [ |
||||
| 181 | '[mother]' => $configs['mother'], |
||||
| 182 | '[animalTypes]' => $configs['animalTypes'], |
||||
| 183 | ]) . '</a>', |
||||
| 184 | 'position' => _MA_PEDIGREE_M50_POS, |
||||
| 185 | 'numdogs' => _MA_PEDIGREE_M50_NUMD, |
||||
| 186 | 'maledogs' => $pctMales, |
||||
| 187 | 'femaledogs' => $pctFemales, |
||||
| 188 | ]); |
||||
| 189 | //comments and footer |
||||
| 190 | require XOOPS_ROOT_PATH . '/footer.php'; |
||||
| 191 |
This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.