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 | |||||
25 | /** @var \XoopsModules\Pedigree\Helper $helper */ |
||||
26 | require_once __DIR__ . '/header.php'; |
||||
27 | $helper->loadLanguage('main'); |
||||
28 | |||||
29 | // Get all HTTP post or get parameters into global variables that are prefixed with "param_" |
||||
30 | //import_request_variables("gp", "param_"); |
||||
31 | extract($_GET, EXTR_PREFIX_ALL, 'param'); |
||||
32 | extract($_POST, EXTR_PREFIX_ALL, 'param'); |
||||
33 | |||||
34 | $GLOBALS['xoopsOption']['template_main'] = 'pedigree_breeder.tpl'; |
||||
35 | require XOOPS_ROOT_PATH . '/header.php'; |
||||
36 | |||||
37 | // Include common modlue code |
||||
38 | require_once $helper->path('include/common.php'); |
||||
39 | //require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php'; |
||||
40 | |||||
41 | //@todo move hard coded language string to language file(s) |
||||
42 | $GLOBALS['xoopsTpl']->assign('page_title', 'Pedigree database - View owner/breeder'); |
||||
43 | |||||
44 | // Breadcrumb |
||||
45 | $breadcrumb = new Pedigree\Breadcrumb(); |
||||
46 | $breadcrumb->addLink($helper->getModule()->getVar('name'), $helper->url()); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
47 | $GLOBALS['xoopsTpl']->assign('module_home', $helper->getDirname()); // this definition is not removed for backward compatibility issues |
||||
48 | $GLOBALS['xoopsTpl']->assign('pedigree_breadcrumb', $breadcrumb->render()); |
||||
49 | |||||
50 | //get module configuration |
||||
51 | /** @var \XoopsModuleHandler $moduleHandler */ |
||||
52 | $moduleHandler = xoops_getHandler('module'); |
||||
53 | $module = $moduleHandler->getByDirname($moduleDirName); |
||||
54 | $configHandler = xoops_getHandler('config'); |
||||
55 | $moduleConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid')); |
||||
0 ignored issues
–
show
The method
getConfigsByCat() does not exist on XoopsObjectHandler . It seems like you code against a sub-type of XoopsObjectHandler such as XoopsPersistableObjectHandler .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
56 | |||||
57 | /** @internal Code below replaced in v1.32 Alpha 1 (Oct 20, 2019)- code didn't take into account |
||||
58 | * that 'extract' command above adds 'param' prefix to 'incoming' variables. |
||||
59 | */ |
||||
60 | /* |
||||
61 | if (!isset($f)) { |
||||
62 | $f = 'lastname'; |
||||
63 | } |
||||
64 | //find letter on which to start else set to 'a' |
||||
65 | if (isset($_GET['l'])) { |
||||
66 | $l = $_GET['l']; |
||||
67 | } else { |
||||
68 | $l = 'a'; |
||||
69 | } |
||||
70 | $w = $l . '%'; |
||||
71 | if (1 == $l) { |
||||
72 | $l = 'LIKE'; |
||||
73 | } |
||||
74 | if (!isset($o)) { |
||||
75 | $o = 'lastname'; |
||||
76 | } |
||||
77 | if (!isset($d)) { |
||||
78 | $d = 'ASC'; |
||||
79 | } |
||||
80 | if (!isset($st)) { |
||||
81 | $st = 0; |
||||
82 | } |
||||
83 | */ |
||||
84 | $f = Request::getString('f', 'lastname'); |
||||
85 | //find letter on which to start else set to 'a' |
||||
86 | $l = Request::getString('l', 'a', 'get'); |
||||
87 | $w = $l . '%'; |
||||
88 | if ('1' === $l) { |
||||
89 | $l = 'LIKE'; |
||||
90 | } |
||||
91 | $o = Request::getString('o', 'lastname'); |
||||
92 | $d = Request::getString('d', 'ASC'); |
||||
93 | $st = Request::getInt('st', 0); |
||||
94 | /** @internal end of code replacement from v1.32 Alpha 1 */ |
||||
95 | $perPage = $helper->getConfig('perpage'); |
||||
96 | //$perPage = $moduleConfig['perpage']; |
||||
97 | |||||
98 | //iscurrent user a module admin ? |
||||
99 | $modAdmin = $helper->isUserAdmin(); |
||||
100 | /* |
||||
101 | $modAdmin = false; |
||||
102 | $xoopsModule = \XoopsModule::getByDirname($moduleDirName); |
||||
103 | if (!empty($GLOBALS['xoopsUser'])) { |
||||
104 | if ($GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { |
||||
105 | $modAdmin = true; |
||||
106 | } |
||||
107 | } |
||||
108 | */ |
||||
109 | //count total number of owners |
||||
110 | $numowner = 'SELECT count(id) FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' WHERE ' . $f . " LIKE '" . $w . "'"; |
||||
111 | $numRes = $GLOBALS['xoopsDB']->query($numowner); |
||||
112 | //total number of owners the query will find |
||||
113 | [$numResults] = $GLOBALS['xoopsDB']->fetchRow($numRes); |
||||
114 | //total number of pages |
||||
115 | $numPages = floor($numResults / $perPage) + 1; |
||||
116 | if (($numPages * $perPage) == ($numResults + $perPage)) { |
||||
117 | ++$numPages; |
||||
118 | } |
||||
119 | //find current page |
||||
120 | $currentPage = floor($st / $perPage) + 1; |
||||
121 | //create alphabet |
||||
122 | $pages = ''; |
||||
123 | /* |
||||
124 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=a\">A</a> "; |
||||
125 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=b\">B</a> "; |
||||
126 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=c\">C</a> "; |
||||
127 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=d\">D</a> "; |
||||
128 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=e\">E</a> "; |
||||
129 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=f\">F</a> "; |
||||
130 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=g\">G</a> "; |
||||
131 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=h\">H</a> "; |
||||
132 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=i\">I</a> "; |
||||
133 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=j\">J</a> "; |
||||
134 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=k\">K</a> "; |
||||
135 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=l\">L</a> "; |
||||
136 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=m\">M</a> "; |
||||
137 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=n\">N</a> "; |
||||
138 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=o\">O</a> "; |
||||
139 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=p\">P</a> "; |
||||
140 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=q\">Q</a> "; |
||||
141 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=r\">R</a> "; |
||||
142 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=s\">S</a> "; |
||||
143 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=t\">T</a> "; |
||||
144 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=u\">U</a> "; |
||||
145 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=v\">V</a> "; |
||||
146 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=w\">W</a> "; |
||||
147 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=x\">X</a> "; |
||||
148 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=y\">Y</a> "; |
||||
149 | $pages .= "<a href=\"breeder.php?f=" . $f . '&o=' . $o . '&d=' . $d . "&st=0&l=z\">Z</a> "; |
||||
150 | //create linebreak |
||||
151 | $pages .= '<br>'; |
||||
152 | */ |
||||
153 | //create previous button |
||||
154 | if ($numPages > 1) { |
||||
155 | if ($currentPage > 1) { |
||||
156 | $pages .= '<a href="' . $helper->url("breeder.php?f={$f}&o={$o}&d={$d}&l={$l}&st=" . ($st - $perPage)) . '">' . _MA_PEDIGREE_PREVIOUS . '</a> '; |
||||
157 | } |
||||
158 | |||||
159 | // create numbers |
||||
160 | for ($x = 1; $x < ($numPages + 1); ++$x) { |
||||
161 | //create line break after 20 number |
||||
162 | if (0 == ($x % 20)) { |
||||
163 | $pages .= '<br>'; |
||||
164 | } |
||||
165 | if ($x != $currentPage) { |
||||
166 | $pages .= '<a href="' . $helper->url("breeder.php?f={$f}&o={$o}&d={$d}&l={$l}&st=" . ($perPage * ($x - 1))) . "\">{$x}</a> "; |
||||
167 | } else { |
||||
168 | $pages .= $x . '  '; |
||||
169 | } |
||||
170 | } |
||||
171 | } |
||||
172 | |||||
173 | //create next button |
||||
174 | if ($numPages > 1) { |
||||
175 | if ($currentPage < $numPages) { |
||||
176 | $pages .= '<a href="' . $helper->url("breeder.php?f={$f}&o={$o}&d={$d}&l={$l}&st=" . ($st + $perPage)) . '">' . _MA_PEDIGREE_NEXT . '</a> '; |
||||
177 | } |
||||
178 | } |
||||
179 | |||||
180 | //query |
||||
181 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_owner') . ' WHERE ' . $f . " LIKE '" . $w . "' ORDER BY " . $o . ' ' . $d . ' LIMIT ' . $st . ', ' . $perPage; |
||||
182 | $result = $GLOBALS['xoopsDB']->query($sql); |
||||
183 | |||||
184 | while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||||
185 | //check for access |
||||
186 | $access = ''; |
||||
187 | if (!empty($xoopsUser)) { |
||||
188 | if (true === $modAdmin || $row['user'] == $xoopsUser->getVar('uid')) { |
||||
189 | //$access = "<a href=\"dog.php?id=".$row['id']."\"><img src=\"assets/images/edit.png\" alt="._EDIT."></a>"; |
||||
190 | $access .= '<a href="' . $helper->url("deletebreeder.php?id={$row['id']}") . '"><img src="' . $pathIcon16 . '/delete.png" title="' . _DELETE . '" alt="' . _DELETE . '"</a>'; |
||||
191 | } else { |
||||
192 | $access = ''; |
||||
193 | } |
||||
194 | } |
||||
195 | //make names |
||||
196 | $name = $access . '<a href="' . $helper->url("owner.php?ownid={$row['id']}") . '">' . stripslashes($row['lastname']) . ', ' . stripslashes($row['firstname']) . '</a>'; |
||||
197 | //create array for owners |
||||
198 | $dogs[] = [ |
||||
199 | 'id' => $row['id'], |
||||
200 | 'name' => $name, |
||||
201 | 'city' => $row['city'], |
||||
202 | ]; |
||||
203 | } |
||||
204 | |||||
205 | //add data to smarty template |
||||
206 | //assign dog |
||||
207 | if (isset($dogs)) { |
||||
208 | $GLOBALS['xoopsTpl']->assign('dogs', $dogs); |
||||
209 | } |
||||
210 | //assign links |
||||
211 | if ('ASC' === $d) { |
||||
212 | $nl = '<a href="' . $helper->url("breeder.php?f={$f}&o=lastname&d=DESC") . '">' . _MA_PEDIGREE_OWN_NAME . '</a>'; |
||||
213 | $cl = '<a href="' . $helper->url("breeder.php?f={$f}&o=city&d=DESC") . '">' . _MA_PEDIGREE_OWN_CITY . '</a>'; |
||||
214 | } else { |
||||
215 | $nl = '<a href="' . $helper->url("breeder.php?f={$f}&o=lastname&d=ASC") . '">' . _MA_PEDIGREE_OWN_NAME . '</a>'; |
||||
216 | $cl = '<a href="' . $helper->url("breeder.php?f={$f}&o=city&d=ASC") . '">' . _MA_PEDIGREE_OWN_CITY . '</a>'; |
||||
217 | } |
||||
218 | $GLOBALS['xoopsTpl']->assign('namelink', $nl); |
||||
219 | $GLOBALS['xoopsTpl']->assign('colourlink', $cl); |
||||
220 | |||||
221 | //find last shown number |
||||
222 | $lastshown = ($st + $perPage) > $numResults ? $numResults : $st + $perPage; |
||||
223 | |||||
224 | //create string |
||||
225 | $matches = _MA_PEDIGREE_MATCHESB; |
||||
226 | $nummatchstr = $numResults . $matches . ($st + 1) . '-' . $lastshown . ' (' . $numPages . ' pages)'; |
||||
227 | $GLOBALS['xoopsTpl']->assign('nummatch', $nummatchstr); |
||||
228 | $GLOBALS['xoopsTpl']->assign('pages', $pages); |
||||
229 | |||||
230 | $criteria = $helper->getHandler('Tree')->getActiveCriteria(); |
||||
231 | $activeObject = 'owner'; |
||||
232 | $name = 'lastname'; |
||||
233 | $link = $helper->url("breeder.php?f={$name}&o={$name}&d=ASC&st=0&l="); |
||||
234 | $link2 = ''; |
||||
235 | |||||
236 | $breederArray['letters'] = Pedigree\Utility::lettersChoice($helper, $activeObject, $criteria, $name, $link, $link2); |
||||
237 | //$catarray['toolbar'] = pedigree_toolbar(); |
||||
238 | |||||
239 | $GLOBALS['xoopsTpl']->assign('breederArray', $breederArray); |
||||
240 | $GLOBALS['xoopsTpl']->assign('pageTitle', _MA_PEDIGREE_BREEDER_PAGETITLE); |
||||
241 | |||||
242 | //comments and footer |
||||
243 | require XOOPS_ROOT_PATH . '/footer.php'; |
||||
244 |