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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 | * Alumni module for Xoops |
||
14 | * |
||
15 | * @copyright XOOPS Project https://xoops.org/ |
||
16 | * @license GPL 2.0 or later |
||
17 | * @package alumni |
||
18 | * @since 2.6.x |
||
19 | * @author John Mordo (jlm69) |
||
20 | */ |
||
21 | |||
22 | use Xoops\Core\Request; |
||
23 | |||
24 | include __DIR__ . '/header.php'; |
||
25 | |||
26 | $moduleDirName = basename(__DIR__); |
||
27 | $main_lang = '_MA_' . strtoupper($moduleDirName); |
||
28 | $myts = MyTextSanitizer::getInstance(); |
||
29 | $xoops = Xoops::getInstance(); |
||
30 | $module_id = $xoops->module->getVar('mid'); |
||
31 | |||
32 | $groups = '3'; |
||
33 | if (is_object($xoops->user)) { |
||
34 | $groups = $xoops->user->getGroups(); |
||
35 | } |
||
36 | //$gperm_handler = $xoops->getHandler('groupperm'); |
||
0 ignored issues
–
show
|
|||
37 | $perm_itemid = 0; |
||
38 | if (isset($_POST['item_id'])) { |
||
39 | $perm_itemid = (int)$_POST['item_id']; |
||
40 | } |
||
41 | //If no access |
||
42 | View Code Duplication | if (!$gpermHandler->checkRight('' . $moduleDirName . '_view', $perm_itemid, $groups, $module_id)) { |
|
43 | $xoops->redirect(XOOPS_URL . '/index.php', 3, XoopsLocale::E_NO_ACCESS_PERMISSION); |
||
44 | exit(); |
||
45 | } |
||
46 | $prem_perm = '1'; |
||
47 | if (!$gpermHandler->checkRight('' . $moduleDirName . '_premium', $perm_itemid, $groups, $module_id)) { |
||
48 | $prem_perm = '0'; |
||
49 | } |
||
50 | |||
51 | $alumni = Alumni::getInstance(); |
||
52 | |||
53 | $gpermHandler = $xoops->getHandlerGroupPermission(); |
||
54 | |||
55 | // $alumni_user = $gperm_handler->getItemIds('alumni_view', $xoops->user->getGroups(), $module_id); |
||
56 | // $alumni_premium = $gperm_handler->getItemIds('alumni_submit', $xoops->user->getGroups(), $module_id); |
||
57 | |||
58 | // if (!$alumni_user) { |
||
59 | // $xoops->redirect(XOOPS_URL . "/user.php", 3, _NOPERM); |
||
60 | // } |
||
61 | $totalCategories = $alumni->getCategoryHandler()->getCategoriesCount(0); |
||
62 | |||
63 | // if there ain't no category to display, let's get out of here |
||
64 | if (0 == $totalCategories) { |
||
65 | $xoops->redirect(\XoopsBaseConfig::get('url'), 12, _NOPERM); |
||
66 | } |
||
67 | |||
68 | $xoops->header('module:alumni/alumni_index.tpl'); |
||
69 | Xoops::getInstance()->header(); |
||
70 | $xoops->tpl()->assign('xmid', $xoopsModule->getVar('mid')); |
||
71 | $xoops->tpl()->assign('add_from', AlumniLocale::ALUMNI_LISTINGS . ' ' . $xoopsConfig['sitename']); |
||
72 | $xoops->tpl()->assign('add_from_sitename', $xoopsConfig['sitename']); |
||
73 | $xoops->tpl()->assign('add_from_title', AlumniLocale::ALUMNI_LISTINGS); |
||
74 | $xoops->tpl()->assign('class_of', AlumniLocale::CLASSOF); |
||
75 | $xoops->tpl()->assign('front_intro', AlumniLocale::FINTRO); |
||
76 | |||
77 | if ('1' == $xoops->getModuleConfig('' . $moduleDirName . '_offer_search')) { |
||
78 | $xoops->tpl()->assign('offer_search', true); |
||
79 | $xoops->tpl()->assign('search_listings', AlumniLocale::SEARCH_LISTINGS); |
||
80 | $xoops->tpl()->assign('match', AlumniLocale::MATCH); |
||
81 | $xoops->tpl()->assign('all_words', AlumniLocale::ALL_WORDS); |
||
82 | $xoops->tpl()->assign('any_words', AlumniLocale::ANY_WORDS); |
||
83 | $xoops->tpl()->assign('exact_match', AlumniLocale::EXACT_MATCH); |
||
84 | $xoops->tpl()->assign('byyear', AlumniLocale::BYYEAR); |
||
85 | $xoops->tpl()->assign('bycategory', AlumniLocale::BYCATEGORY); |
||
86 | $xoops->tpl()->assign('keywords', XoopsLocale::KEYWORDS); |
||
87 | $xoops->tpl()->assign('search', XoopsLocale::SEARCH); |
||
88 | |||
89 | $categoriesHandler = $xoops->getModuleHandler('category', 'alumni'); |
||
90 | |||
91 | $alumni = Alumni::getInstance(); |
||
92 | $helper = Xoops::getModuleHelper('alumni'); |
||
93 | $module_id = $helper->getModule()->getVar('mid'); |
||
94 | $groups = $xoops->isUser() ? $xoops->user->getGroups() : '3'; |
||
95 | $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id); |
||
96 | $cat_criteria = new CriteriaCompo(); |
||
97 | $cat_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
98 | $cat_criteria->setOrder('' . $xoops->getModuleConfig('' . $moduleDirName . '_csortorder') . ''); |
||
99 | $numcat = $categoriesHandler->getCount($cat_criteria); |
||
100 | $category_arr = $categoriesHandler->getAll($cat_criteria); |
||
101 | |||
102 | foreach (array_keys($category_arr) as $i) { |
||
103 | $cid = $category_arr[$i]->getVar('cid'); |
||
104 | $pid = $category_arr[$i]->getVar('pid'); |
||
105 | $title = $category_arr[$i]->getVar('title', 'e'); |
||
106 | $img = $category_arr[$i]->getVar('img'); |
||
107 | $order = $category_arr[$i]->getVar('ordre'); |
||
108 | $affprice = $category_arr[$i]->getVar('affprice'); |
||
109 | $title = $myts->htmlSpecialChars($title); |
||
110 | $xoops->tpl()->assign('title', $title); |
||
111 | } |
||
112 | |||
113 | include_once XOOPS_ROOT_PATH . "/modules/{$moduleDirName}/class/alumni_tree.php"; |
||
114 | $cattree = new AlumniObjectTree($category_arr, 'cid', 'pid'); |
||
115 | |||
116 | $categories = $alumni->getCategoryHandler()->getCategoriesForSearch(); |
||
117 | $by_cat = Request::getInt('by_cat'); |
||
118 | $select_category = '<select name="by_cat">'; |
||
119 | $select_category .= '<option value="all"'; |
||
120 | if (empty($by_cat) || 0 == count($by_cat)) { |
||
121 | $select_category .= 'selected="selected"'; |
||
122 | } |
||
123 | $select_category .= '>' . XoopsLocale::ALL . '</option>'; |
||
124 | foreach ($categories as $cid => $title) { |
||
125 | $select_category .= '<option value="' . $cid . '"'; |
||
126 | if ($cid = $by_cat) { |
||
127 | $select_category .= 'selected="selected"'; |
||
128 | } |
||
129 | $select_category .= '>' . $title . '</option>'; |
||
130 | } |
||
131 | $select_category .= '</select>'; |
||
132 | $xoops->tpl()->assign('category_select', $select_category); |
||
133 | } |
||
134 | |||
135 | $index_banner = $xoops->getBanner(); |
||
136 | $xoops->tpl()->assign('index_banner', $index_banner); |
||
137 | $index_code_place = $xoops->getModuleConfig('' . $moduleDirName . '_code_place'); |
||
138 | $use_extra_code = $xoops->getModuleConfig('' . $moduleDirName . '_use_code'); |
||
139 | $use_banner = $xoops->getModuleConfig('' . $moduleDirName . '_use_banner'); |
||
140 | $index_extra_code = $xoops->getModuleConfig('' . $moduleDirName . '_index_code'); |
||
141 | $xoops->tpl()->assign('use_extra_code', $use_extra_code); |
||
142 | $xoops->tpl()->assign('use_banner', $use_banner); |
||
143 | $xoops->tpl()->assign('index_extra_code', '<html>' . $index_extra_code . '</html>'); |
||
144 | $xoops->tpl()->assign('index_code_place', $index_code_place); |
||
145 | |||
146 | $xoops->tpl()->assign('moduleDirName', $moduleDirName); |
||
147 | |||
148 | $cats = $cattree->alumni_getFirstChild(0, $alumni_ids); |
||
149 | $count = 0; |
||
150 | |||
151 | foreach (array_keys($cats) as $i) { |
||
152 | if (in_array($cats[$i]->getVar('cid'), $alumni_ids)) { |
||
153 | $cat_img = $cats[$i]->getVar('img'); |
||
154 | if ('http://' !== $cat_img) { |
||
155 | $cat_img = XOOPS_URL . "/modules/{$moduleDirName}/assets/images/cat/$cat_img"; |
||
156 | } else { |
||
157 | $cat_img = ''; |
||
158 | } |
||
159 | |||
160 | $listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
||
161 | $count_criteria = new CriteriaCompo(); |
||
162 | $count_criteria->add(new Criteria('cid', $cats[$i]->getVar('cid'), '=')); |
||
163 | $count_criteria->add(new Criteria('valid', 1, '=')); |
||
164 | $count_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
165 | $listings = $listingHandler->getCount($count_criteria); |
||
166 | |||
167 | $publishdate = isset($listings['date'][$cats[$i]->getVar('cid')]) ? $listings['date'][$cats[$i]->getVar('cid')] : 0; |
||
168 | $all_subcats = $cattree->alumni_getAllChild($cats[$i]->getVar('cid')); |
||
169 | if (count($all_subcats) > 0) { |
||
170 | foreach (array_keys($all_subcats) as $k) { |
||
171 | if (in_array($all_subcats[$k]->getVar('cid'), $alumni_ids)) { |
||
172 | $publishdate = (isset($listings['date'][$all_subcats[$k]->getVar('cid')]) and $listings['date'][$all_subcats[$k]->getVar('cid')] > $publishdate) ? $listings['date'][$all_subcats[$k]->getVar('cid')] : $publishdate; |
||
173 | } |
||
174 | } |
||
175 | } |
||
176 | } |
||
177 | $subcategories = []; |
||
178 | |||
179 | $count++; |
||
180 | |||
181 | $listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
||
182 | $listing_criteria = new CriteriaCompo(); |
||
183 | $listing_criteria->add(new Criteria('cid', $cats[$i]->getVar('cid'), '=')); |
||
184 | $listing_criteria->add(new Criteria('valid', 1, '=')); |
||
185 | $listing_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
186 | $alumni_count = $listingHandler->getCount($listing_criteria); |
||
187 | |||
188 | if (count($all_subcats) > 0) { |
||
189 | foreach (array_keys($all_subcats) as $k) { |
||
190 | if (in_array($all_subcats[$k]->getVar('cid'), $alumni_ids)) { |
||
191 | $listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
||
192 | $sub_count_criteria = new CriteriaCompo(); |
||
193 | $sub_count_criteria->add(new Criteria('cid', $all_subcats[$k]->getVar('cid'), '=')); |
||
194 | $sub_count_criteria->add(new Criteria('valid', 1, '=')); |
||
195 | $sub_count_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
196 | $alumni_subcount = $listingHandler->getCount($sub_count_criteria); |
||
197 | |||
198 | if (1 == $xoops->getModuleConfig('alumni_showsubcat') and $all_subcats[$k]->getVar('pid') == $cats[$i]->getVar('cid')) { // if we are collecting subcat info for displaying, and this subcat is a first level child... |
||
199 | $subcategories[] = ['id' => $all_subcats[$k]->getVar('cid'), 'title' => $all_subcats[$k]->getVar('title'), 'count' => $alumni_subcount]; |
||
200 | } |
||
201 | } |
||
202 | } |
||
203 | } |
||
204 | |||
205 | if (1 != $xoops->getModuleConfig('alumni_showsubcat')) { |
||
206 | unset($subcategories); |
||
207 | |||
208 | $xoops->tpl()->append('categories', [ |
||
209 | 'image' => $cat_img, |
||
210 | 'id' => (int)$cats[$i]->getVar('cid'), |
||
211 | 'title' => $cats[$i]->getVar('title'), |
||
212 | 'totalcats' => $alumni_count, |
||
213 | 'count' => $count |
||
214 | ]); |
||
215 | } else { |
||
216 | $xoops->tpl()->append('categories', [ |
||
217 | 'image' => $cat_img, |
||
218 | 'id' => (int)$cats[$i]->getVar('cid'), |
||
219 | 'title' => $cats[$i]->getVar('title'), |
||
220 | 'subcategories' => $subcategories, |
||
221 | 'totalcats' => $alumni_count, |
||
222 | 'count' => $count |
||
223 | ]); |
||
224 | } |
||
225 | } |
||
226 | $xoops->tpl()->assign('total_confirm', ''); |
||
227 | |||
228 | $listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
||
229 | |||
230 | $xoops->tpl()->assign('moderated', false); |
||
231 | if ('1' == $xoops->getModuleConfig('' . $moduleDirName . '_moderated')) { |
||
232 | $xoops->tpl()->assign('moderated', true); |
||
233 | $moderate_criteria = new CriteriaCompo(); |
||
234 | $moderate_criteria->add(new Criteria('valid', 0, '=')); |
||
235 | $moderate_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
236 | $moderate_rows = $listingHandler->getCount($moderate_criteria); |
||
237 | $moderate_arr = $listingHandler->getAll($moderate_criteria); |
||
238 | |||
239 | if ($xoops->isUser()) { |
||
240 | if ($xoops->user->isAdmin()) { |
||
241 | $xoops->tpl()->assign('user_admin', true); |
||
242 | |||
243 | $xoops->tpl()->assign('admin_block', AlumniLocale::ADMIN_PANEL); |
||
244 | View Code Duplication | if (0 == $moderate_rows) { |
|
245 | $xoops->tpl()->assign('confirm_alumni', AlumniLocale::NO_LISTING_TO_APPROVE); |
||
246 | } else { |
||
247 | $xoops->tpl()->assign('confirm_alumni', AlumniLocale::THERE_ARE . " $moderate_rows " . AlumniLocale::WAITING . '<br><a href="admin/alumni.php?op=list_moderated">' . constant($main_lang . '_SEEIT') . '</a>'); |
||
248 | } |
||
249 | $xoops->tpl()->assign('total_confirm', AlumniLocale::THIS_AND . " $moderate_rows " . AlumniLocale::WAITING); |
||
250 | } |
||
251 | } |
||
252 | } |
||
253 | |||
254 | $criteria = new CriteriaCompo(); |
||
255 | $criteria->add(new Criteria('valid', 1, '=')); |
||
256 | $criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
257 | $criteria->setLimit($xoops->getModuleConfig('' . $moduleDirName . '_per_page')); |
||
258 | $numrows = $listingHandler->getCount($criteria); |
||
259 | |||
260 | $xoops->tpl()->assign('total_listings', AlumniLocale::THERE_ARE . ' ' . $numrows . ' ' . AlumniLocale::ALUMNI_LISTINGS . ' ' . AlumniLocale::IN . ' ' . $numcat . ' ' . AlumniLocale::CATEGORIES); |
||
261 | $xoops->tpl()->assign('last_head', AlumniLocale::THE . ' ' . $xoops->getModuleConfig('' . $moduleDirName . '_newalumni') . ' ' . AlumniLocale::LASTADD); |
||
262 | $xoops->tpl()->assign('last_head_name', AlumniLocale::NAME_2); |
||
263 | $xoops->tpl()->assign('last_head_school', AlumniLocale::SCHOOL_2); |
||
264 | $xoops->tpl()->assign('last_head_studies', AlumniLocale::STUDIES_2); |
||
265 | $xoops->tpl()->assign('last_head_year', AlumniLocale::YEAR_2); |
||
266 | $xoops->tpl()->assign('last_head_date', XoopsLocale::DATE); |
||
267 | $xoops->tpl()->assign('last_head_local', AlumniLocale::TOWN_2); |
||
268 | $xoops->tpl()->assign('last_head_views', AlumniLocale::HITS); |
||
269 | $xoops->tpl()->assign('last_head_photo', AlumniLocale::PHOTO); |
||
270 | |||
271 | $listingArray = $listingHandler->getAll($criteria); |
||
272 | |||
273 | foreach (array_keys($listingArray) as $i) { |
||
274 | $lid = $listingArray[$i]->getVar('lid'); |
||
275 | $cid = $listingArray[$i]->getVar('cid'); |
||
276 | $name = $listingArray[$i]->getVar('name'); |
||
277 | $mname = $listingArray[$i]->getVar('mname'); |
||
278 | $lname = $listingArray[$i]->getVar('lname'); |
||
279 | $school = $listingArray[$i]->getVar('school'); |
||
280 | $year = $listingArray[$i]->getVar('year'); |
||
281 | $studies = $listingArray[$i]->getVar('studies'); |
||
282 | $activities = $listingArray[$i]->getVar('activities'); |
||
283 | $extrainfo = $listingArray[$i]->getVar('extrainfo'); |
||
284 | $occ = $listingArray[$i]->getVar('occ'); |
||
285 | $date = $listingArray[$i]->getVar('date'); |
||
286 | $email = $listingArray[$i]->getVar('email'); |
||
287 | $submitter = $listingArray[$i]->getVar('submitter'); |
||
288 | $usid = $listingArray[$i]->getVar('usid'); |
||
289 | $town = $listingArray[$i]->getVar('town'); |
||
290 | $valid = $listingArray[$i]->getVar('valid'); |
||
291 | $photo = $listingArray[$i]->getVar('photo'); |
||
292 | $photo2 = $listingArray[$i]->getVar('photo2'); |
||
293 | $view = $listingArray[$i]->getVar('view'); |
||
294 | |||
295 | $a_item = []; |
||
296 | $a_item['new'] = ''; |
||
297 | |||
298 | $newcount = $xoops->getModuleConfig('' . $moduleDirName . '_countday'); |
||
299 | $startdate = (time() - (86400 * $newcount)); |
||
300 | View Code Duplication | if ($startdate < $date) { |
|
301 | $newitem = '<img src="' . XOOPS_URL . "/modules/{$moduleDirName}/assets/images/newred.gif\">"; |
||
302 | $a_item['new'] = $newitem; |
||
303 | } |
||
304 | |||
305 | $useroffset = ''; |
||
306 | View Code Duplication | if ($xoops->user) { |
|
307 | $timezone = $xoops->user->timezone(); |
||
308 | if (isset($timezone)) { |
||
309 | $useroffset = $xoops->user->timezone(); |
||
310 | } else { |
||
311 | $useroffset = $xoopsConfig['default_TZ']; |
||
312 | } |
||
313 | } |
||
314 | $date = ($useroffset * 3600) + $date; |
||
315 | |||
316 | $date = XoopsLocale::formatTimestamp($date, 's'); |
||
317 | |||
318 | View Code Duplication | if ($xoops->user) { |
|
319 | if ($xoops->user->isAdmin()) { |
||
320 | $a_item['admin'] = "<a href='admin/alumni.php?op=edit_listing&lid=$lid&cid=$cid'><img src='images/modif.gif' border=0 alt=\"" . AlumniLocale::MODADMIN . '"></a>'; |
||
321 | } |
||
322 | } |
||
323 | |||
324 | $a_item['name'] = "<a href='listing.php?lid=$lid'><b>$name $mname $lname</b></a>"; |
||
325 | $a_item['school'] = $school; |
||
326 | $a_item['year'] = $year; |
||
327 | $a_item['studies'] = $studies; |
||
328 | $a_item['date'] = $date; |
||
329 | $a_item['local'] = ''; |
||
330 | if ($town) { |
||
331 | $a_item['local'] .= $town; |
||
332 | } |
||
333 | |||
334 | if ($photo) { |
||
335 | $a_item['photo'] = "<a href=\"javascript:CLA('display-image.php?lid=$lid')\"><img src=\"" . XOOPS_URL . "/modules/{$moduleDirName}/assets/images/photo.gif\" border=\"0\" width=\"15\" height=\"11\" alt='" . AlumniLocale::PHOTO_AVAILABLE . "'></a>"; |
||
336 | } else { |
||
337 | $a_item['photo'] = ''; |
||
338 | } |
||
339 | |||
340 | $a_item['views'] = $view; |
||
341 | |||
342 | $xoops->tpl()->append('items', $a_item); |
||
343 | } |
||
344 | |||
345 | Xoops::getInstance()->footer(); |
||
346 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.