Issues (884)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

admin/alumni.php (22 issues)

Upgrade to new PHP Analysis Engine

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__ . '/admin_header.php';
25
$moduleDirName = basename(dirname(__DIR__));
26
include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
27
$myts  = MyTextSanitizer::getInstance();
28
$xoops = Xoops::getInstance();
29
30
$op = Request::getCmd('op', 'list');
31
32
switch ($op) {
33
    case 'list':
34
    default:
35
        $xoops->header('admin:alumni/alumni_admin_listing.tpl');
36
        $adminObject = new \Xoops\Module\Admin();
37
        $adminObject->displayNavigation('alumni.php');
38
39
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/jquery-1.8.3.min.js');
40
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/tablesorter-master/js/jquery.tablesorter.js');
41
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/tablesorter-master/addons/pager/jquery.tablesorter.pager.js');
42
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/tablesorter-master/js/jquery.tablesorter.widgets.js');
43
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/pager-custom-controls.js');
44
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/myAdminjs.js');
45
        $xoTheme->addStylesheet(ALUMNI_URL . '/media/jquery/css/theme.blue.css');
46
        $xoTheme->addStylesheet(ALUMNI_URL . '/media/jquery/tablesorter-master/addons/pager/jquery.tablesorter.pager.css');
47
48
        $adminObject->addItemButton(AlumniLocale::ADD_LISTING, 'alumni.php?op=new_listing', 'add');
49
50
        if ('1' == $xoops->getModuleConfig('alumni_moderated')) {
51
            $adminObject->addItemButton(AlumniLocale::MODERATE_LISTING, 'alumni.php?op=list_moderated', 'add');
52
        }
53
54
        $adminObject->renderButton('left', '');
55
56
        $listing_count = $listingHandler->countAlumni();
0 ignored issues
show
$listing_count does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
57
        $listingArray = $listingHandler->getAll();
58
59
        // Assign Template variables
60
        $xoops->tpl()->assign('listing_count', $listing_count);
0 ignored issues
show
$listing_count does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
61
        if ($listing_count > 0) {
0 ignored issues
show
$listing_count does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
62
            foreach (array_keys($listingArray) as $i) {
63
                $lid        = $listingArray[$i]->getVar('lid');
64
                $cid        = $listingArray[$i]->getVar('cid');
65
                $name       = $listingArray[$i]->getVar('name');
66
                $mname      = $listingArray[$i]->getVar('mname');
67
                $lname      = $listingArray[$i]->getVar('lname');
68
                $school     = $listingArray[$i]->getVar('school');
69
                $year       = $listingArray[$i]->getVar('year');
70
                $studies    = $listingArray[$i]->getVar('studies');
71
                $activities = $listingArray[$i]->getVar('activities');
72
                $extrainfo  = $listingArray[$i]->getVar('extrainfo');
73
                $occ        = $listingArray[$i]->getVar('occ');
74
                $date       = $listingArray[$i]->getVar('date');
75
                $email      = $listingArray[$i]->getVar('email');
76
                $submitter  = $listingArray[$i]->getVar('submitter');
77
                $usid       = $listingArray[$i]->getVar('usid');
78
                $town       = $listingArray[$i]->getVar('town');
79
                $valid      = $listingArray[$i]->getVar('valid');
80
                $photo      = $listingArray[$i]->getVar('photo');
81
                $photo2     = $listingArray[$i]->getVar('photo2');
82
                $view       = $listingArray[$i]->getVar('view');
83
84
                $xoops->tpl()->assign('cat', $cid);
85
86
                $listing = [];
87
                $name    = $myts->undoHtmlSpecialChars($name);
88
                $mname   = $myts->undoHtmlSpecialChars($mname);
89
                $lname   = $myts->undoHtmlSpecialChars($lname);
90
                $school  = $myts->undoHtmlSpecialChars($school);
91
                $year    = $myts->htmlSpecialChars($year);
92
93
                $useroffset = '';
94
                $newcount   = $xoops->getModuleConfig('' . $moduleDirName . '_countday');
95
                $startdate  = (time() - (86400 * $newcount));
96
                if ($startdate < $date) {
97
                    $newitem        = '<img src="' . XOOPS_URL . "/modules/{$moduleDirName}/assets/images/newred.gif\">";
98
                    $listing['new'] = $newitem;
99
                }
100 View Code Duplication
                if ($xoops->user) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
101
                    $timezone = $xoops->user->timezone();
102
                    if (null !== $timezone) {
103
                        $useroffset = $xoops->user->timezone();
104
                    } else {
105
                        $useroffset = $xoopsConfig['default_TZ'];
106
                    }
107
                }
108
                $date = ($useroffset * 3600) + $date;
109
                $date = XoopsLocale::formatTimestamp($date, 's');
110
111
                $listing['lid']       = $lid;
112
                $listing['cid']       = $cid;
113
                $listing['name']      = "<a href='../listing.php?lid=$lid'><b>$name&nbsp;$mname&nbsp;$lname</b></a>";
114
                $listing['school']    = $school;
115
                $listing['year']      = $year;
116
                $listing['submitter'] = $submitter;
117
                $listing['date']      = $date;
118
                $listing['valid']     = $valid;
119
                $listing['view']      = $view;
120
121
                $cat = addslashes($cid);
122
123
                $listing['views'] = $view;
124
                $xoops->tpl()->append('listing', $listing);
125
                $xoops->tpl()->assign('valid', AlumniLocale::APPROVE);
126
                $xoops->tpl()->assign('school', AlumniLocale::SCHOOL);
127
                $xoops->tpl()->assign('class_of', AlumniLocale::CLASS_OF);
128
            }
129
            unset($listing);
130
            $xoops->tpl()->assign('error_message', '');
131
        } else {
132
            $xoops->tpl()->assign('error_message', AlumniLocale::E_NO_LISTING);
133
        }
134
        break;
135
136 View Code Duplication
    case 'new_listing':
137
        $listingHandler = $xoops->getModuleHandler('listing', 'alumni');
138
        $xoops->header();
139
        $adminObject = new Xoops\Module\Admin();
140
        $adminObject->displayNavigation('alumni.php');
141
        $adminObject->addItemButton(AlumniLocale::LIST_CATS, 'alumni.php');
142
        echo $adminObject->renderButton('left', '');
143
        $obj  = $listingHandler->create();
144
        $form = $xoops->getModuleForm($obj, 'listing');
145
        $form->display();
146
        break;
147
148
    case 'save_listing':
149
        if (!$xoops->security()->check()) {
150
            $xoops->redirect('alumni.php', 3, implode(',', $xoops->security()->getErrors()));
151
        }
152
153 View Code Duplication
        if ('1' == $xoops->getModuleConfig('alumni_use_captcha') && !$xoops->user->isAdmin()) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
154
            $xoopsCaptcha = XoopsCaptcha::getInstance();
155
            if (!$xoopsCaptcha->verify()) {
156
                $xoops->redirect(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/addlisting.php', 6, $xoopsCaptcha->getMessage());
157
                exit(0);
158
            }
159
        }
160
161
        $date = time();
162
        $lid  = Request::getInt('lid', 0);
163
        if (isset($lid)) {
164
            $obj = $listingHandler->get($lid);
165
            $obj->setVar('lid', $lid);
166
        } else {
167
            $obj = $listingHandler->create();
168
        }
169
170
        $destination = XOOPS_ROOT_PATH . "/uploads/{$moduleDirName}/photos/grad_photo";
171
        $del_photo   = Request::getInt('del_photo', 0);
0 ignored issues
show
$del_photo does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
172 View Code Duplication
        if (isset($del_photo)) {
173
            if ('1' == $del_photo) {
174
                if (@file_exists('' . $destination . '/' . Request::getString('photo_old') . '')) {
175
                    unlink('' . $destination . '/' . Request::getString('photo_old') . '');
176
                }
177
                $obj->setVar('photo', '');
178
            }
179
        }
180
        $destination2 = XOOPS_ROOT_PATH . "/uploads/{$moduleDirName}/photos/now_photo";
181
        $del_photo2   = Request::getInt('del_photo', 0);
0 ignored issues
show
$del_photo2 does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
182 View Code Duplication
        if (isset($del_photo2)) {
183
            if ('1' == $del_photo2) {
184
                if (@file_exists('' . $destination2 . '/' . Request::getString('photo2_old') . '')) {
185
                    unlink('' . $destination2 . '/' . Request::getString('photo2_old') . '');
186
                }
187
188
                $obj->setVar('photo2', '');
189
            }
190
        }
191
        $cid = Request::getInt('cid', 0);
192 View Code Duplication
        if (isset($cid)) {
193
            $cat_name          = '';
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
194
            $categoriesHandler = $xoops->getModuleHandler('category', 'alumni');
195
            $catObj            = $categoriesHandler->get($cid);
196
            $cat_name          = $catObj->getVar('title');
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
197
        }
198
199
        $obj->setVar('cid', Request::getInt('cid', 0));
200
        $obj->setVar('name', Request::getString('name'));
201
        $obj->setVar('mname', Request::getString('mname'));
202
        $obj->setVar('lname', Request::getString('lname'));
203
        $obj->setVar('school', $cat_name);
0 ignored issues
show
$cat_name does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
204
        $obj->setVar('year', Request::getInt('year', 0));
205
        $obj->setVar('studies', Request::getString('studies'));
206
        $obj->setVar('activities', Request::getString('activities'));
207
        $obj->setVar('extrainfo', Request::getString('extrainfo'));
208
        $obj->setVar('occ', Request::getString('occ'));
209
        $obj->setVar('date', Request::getInt('date', 0));
210
        $obj->setVar('email', Request::getString('email'));
211
        $obj->setVar('submitter', Request::getString('submitter', ''));
212
        $obj->setVar('usid', Request::getInt('usid', 0));
213
        $obj->setVar('town', Request::getString('town'));
214
215
        if ('1' == $xoops->getModuleConfig('alumni_moderate')) {
216
            $obj->setVar('valid', '0');
217
        } else {
218
            $obj->setVar('valid', '1');
219
        }
220
221 View Code Duplication
        if (!empty($_FILES['photo']['name'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
222
            include_once XOOPS_ROOT_PATH . '/class/uploader.php';
223
            $uploaddir        = XOOPS_ROOT_PATH . "/uploads/{$moduleDirName}/photos/grad_photo";
224
            $photomax         = $xoops->getModuleConfig('alumni_photomax');
225
            $maxwide          = $xoops->getModuleConfig('alumni_maxwide');
226
            $maxhigh          = $xoops->getModuleConfig('alumni_maxhigh');
227
            $allowedMimetypes = ['image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png'];
228
            $uploader         = new XoopsMediaUploader($uploaddir, $allowedMimetypes, $photomax, $maxwide, $maxhigh);
229
            if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
230
                $uploader->setTargetFileName($date . '_' . $_FILES['photo']['name']);
231
                $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
232
                if (!$uploader->upload()) {
233
                    $errors = $uploader->getErrors();
234
                    $xoops->redirect('javascript:history.go(-1)', 3, $errors);
235
                } else {
236
                    $obj->setVar('photo', $uploader->getSavedFileName());
237
                }
238
            } else {
239
                $obj->setVar('photo', Request::getString('photo'));
240
            }
241
        }
242
243 View Code Duplication
        if (!empty($_FILES['photo2']['name'])) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
244
            include_once XOOPS_ROOT_PATH . '/class/uploader.php';
245
            $uploaddir2       = XOOPS_ROOT_PATH . "/uploads/{$moduleDirName}/photos/now_photo";
246
            $photomax         = $xoops->getModuleConfig('alumni_photomax');
247
            $maxwide          = $xoops->getModuleConfig('alumni_maxwide');
248
            $maxhigh          = $xoops->getModuleConfig('alumni_maxhigh');
249
            $allowedMimetypes = ['image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png'];
250
            $uploader2        = new XoopsMediaUploader($uploaddir2, $allowedMimetypes, $photomax, $maxwide, $maxhigh);
251
            if ($uploader2->fetchMedia($_POST['xoops_upload_file'][1])) {
252
                $uploader2->setTargetFileName($date . '_' . $_FILES['photo2']['name']);
253
                $uploader2->fetchMedia($_POST['xoops_upload_file'][1]);
254
                if (!$uploader2->upload()) {
255
                    $errors = $uploader2->getErrors();
256
                    $xoops->redirect('javascript:history.go(-1)', 3, $errors);
257
                } else {
258
                    $obj->setVar('photo2', $uploader2->getSavedFileName());
259
                }
260
            } else {
261
                $obj->setVar('photo2', Request::getString('photo2'));
262
            }
263
        }
264
265
        if ($listingHandler->insert($obj)) {
266
            $xoops->redirect('alumni.php', 3, XoopsLocale::S_DATABASE_UPDATED);
267
268
            //notifications
269 View Code Duplication
            if (0 == $lid && $xoops->isActiveModule('notifications')) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
270
                $notification_handler = Notifications::getInstance()->getHandlerNotification();
271
                $tags                 = [];
272
                $tags['MODULE_NAME']  = 'alumni';
273
                $tags['ITEM_NAME']    = Request::getString('lname', '');
274
                $tags['ITEM_URL']     = XOOPS_URL . "/modules/{$moduleDirName}/listing.php?lid=" . $new_id;
0 ignored issues
show
$new_id does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
275
                $notification_handler->triggerEvent('global', 0, 'newlisting', $tags);
276
                $notification_handler->triggerEvent('item', $new_id, 'newlisting', $tags);
277
            }
278
        }
279
280
        echo $obj->getHtmlErrors();
281
        $form = $xoops->getModuleForm($obj, 'listing');
282
        $form->display();
283
        break;
284
285 View Code Duplication
    case 'edit_listing':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
286
        $xoops->header();
287
        $lid        = Request::getInt('lid', 0);
288
        $adminObject = new Xoops\Module\Admin();
289
        $adminObject->addItemButton(AlumniLocale::ADD_LISTING, 'alumni.php?op=new_listing', 'add');
290
        $adminObject->addItemButton(AlumniLocale::LISTINGLIST, 'alumni.php', 'list');
291
        echo $adminObject->renderButton('left', '');
292
        $obj  = $listingHandler->get($lid);
293
        $form = $xoops->getModuleForm($obj, 'listing');
294
        $form->display();
295
        break;
296
297 View Code Duplication
    case 'delete_listing':
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
298
        $xoops->header();
299
        $lid = Request::getInt('lid', 0);
300
        $ok  = Request::getInt('ok', 0);
301
        $obj = $listingHandler->get($lid);
302
        if (isset($ok) && 1 == $ok) {
303
            if (!$xoops->security()->check()) {
304
                $xoops->redirect('alumni.php', 3, implode(',', $xoops->security()->getErrors()));
305
            }
306
            if ($listingHandler->delete($obj)) {
307
                $xoops->redirect('alumni.php', 3, AlumniLocale::FORMDELOK);
308
            } else {
309
                echo $obj->getHtmlErrors();
310
            }
311
        } else {
312
            echo $xoops->confirm(['ok' => 1, 'lid' => $lid, 'op' => 'delete_listing'], 'alumni.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br><span class="red">' . $obj->getVar('lname') . '<span>');
313
        }
314
        break;
315
316
    case 'update_status':
317
        $lid = Request::getInt('lid', 0);
318
        if ($lid > 0) {
319
            $obj = $listingHandler->get($lid);
320
            $obj->setVar('valid', 1);
321
            if ($listingHandler->insert($obj)) {
322
                $xoops->redirect('alumni.php?op=list_moderated', 3, AlumniLocale::LISTING_VALIDATED);
323
            }
324
            echo $obj->getHtmlErrors();
325
        }
326
        break;
327
328
    case 'list_moderated':
329
        $xoops->header('alumni_admin_moderated.tpl');
330
        $adminObject = new Xoops\Module\Admin();
331
        $adminObject->renderNavigation('alumni.php');
332
333
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/jquery-1.8.3.min.js');
334
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/tablesorter-master/js/jquery.tablesorter.js');
335
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/tablesorter-master/addons/pager/jquery.tablesorter.pager.js');
336
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/tablesorter-master/js/jquery.tablesorter.widgets.js');
337
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/pager-custom-controls.js');
338
        $xoTheme->addScript(ALUMNI_URL . '/media/jquery/myAdminjs.js');
339
        $xoTheme->addStylesheet(ALUMNI_URL . '/media/jquery/css/theme.blue.css');
340
        $xoTheme->addStylesheet(ALUMNI_URL . '/media/jquery/tablesorter-master/addons/pager/jquery.tablesorter.pager.css');
341
342
        $listing_Handler  = $xoops->getModuleHandler('listing', 'alumni');
0 ignored issues
show
$listing_Handler does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
343
        $alumni           = Alumni::getInstance();
344
        $moduleId         = $xoops->module->getVar('mid');
345
        $groups           = $xoops->isUser() ? $xoops->user->getGroups() : '3';
346
        $alumniIds        = $alumni->getGrouppermHandler()->getItemIds('alumni_view', $groups, $moduleId);
347
        $moderateCriteria = new CriteriaCompo();
348
        $moderateCriteria->add(new Criteria('valid', 0, '='));
349
        $moderateCriteria->add(new Criteria('cid', '(' . implode(', ', $alumniIds) . ')', 'IN'));
350
        $listing_count = $listingHandler->getCount($moderateCriteria);
0 ignored issues
show
$listing_count does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
351
        $listingArray = $listingHandler->getAll($moderateCriteria);
352
353
        // Assign Template variables
354
        $xoops->tpl()->assign('listing_count', $listing_count);
0 ignored issues
show
$listing_count does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
355
        if ($listing_count > 0) {
0 ignored issues
show
$listing_count does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
356
            foreach (array_keys($listingArray) as $i) {
357
                $lid        = $listingArray[$i]->getVar('lid');
358
                $cid        = $listingArray[$i]->getVar('cid');
359
                $name       = $listingArray[$i]->getVar('name');
360
                $mname      = $listingArray[$i]->getVar('mname');
361
                $lname      = $listingArray[$i]->getVar('lname');
362
                $school     = $listingArray[$i]->getVar('school');
363
                $year       = $listingArray[$i]->getVar('year');
364
                $studies    = $listingArray[$i]->getVar('studies');
365
                $activities = $listingArray[$i]->getVar('activities');
366
                $extrainfo  = $listingArray[$i]->getVar('extrainfo');
367
                $occ        = $listingArray[$i]->getVar('occ');
368
                $date       = $listingArray[$i]->getVar('date');
369
                $email      = $listingArray[$i]->getVar('email');
370
                $submitter  = $listingArray[$i]->getVar('submitter');
371
                $usid       = $listingArray[$i]->getVar('usid');
372
                $town       = $listingArray[$i]->getVar('town');
373
                $valid      = $listingArray[$i]->getVar('valid');
374
                $photo      = $listingArray[$i]->getVar('photo');
375
                $photo2     = $listingArray[$i]->getVar('photo2');
376
                $view       = $listingArray[$i]->getVar('view');
377
378
                $xoops->tpl()->assign('cat', $cid);
379
380
                $listing = [];
381
                $name    = $myts->undoHtmlSpecialChars($name);
382
                $mname   = $myts->undoHtmlSpecialChars($mname);
383
                $lname   = $myts->undoHtmlSpecialChars($lname);
384
                $school  = $myts->undoHtmlSpecialChars($school);
385
                $year    = $myts->htmlSpecialChars($year);
386
387
                $useroffset = '';
388
389
                $newcount  = $xoops->getModuleConfig('' . $moduleDirName . '_countday');
390
                $startdate = (time() - (86400 * $newcount));
391 View Code Duplication
                if ($startdate < $date) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
392
                    $newitem        = '<img src="' . XOOPS_URL . "/modules/{$moduleDirName}/assets/images/newred.gif\">";
393
                    $listing['new'] = $newitem;
394
                }
395 View Code Duplication
                if ($xoops->user) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
396
                    $timezone = $xoops->user->timezone();
397
                    if (null !== $timezone) {
398
                        $useroffset = $xoops->user->timezone();
399
                    } else {
400
                        $useroffset = $xoopsConfig['default_TZ'];
401
                    }
402
                }
403
                $date = ($useroffset * 3600) + $date;
404
                $date = XoopsLocale::formatTimestamp($date, 's');
405
406
                $listing['lid']        = $lid;
407
                $listing['cid']        = $cid;
408
                $listing['name']       = "<a href='alumni.php?op=moderated_listing&amp;lid=$lid'><b>$name&nbsp;$mname&nbsp;$lname</b></a>";
409
                $listing['school']     = $school;
410
                $listing['year']       = $year;
411
                $listing['studies']    = $studies;
412
                $listing['activities'] = $activities;
413
                $listing['extrainfo']  = $extrainfo;
414
                $listing['occ']        = $occ;
415
                $listing['submitter']  = $submitter;
416
                $listing['date']       = $date;
417
                $listing['valid']      = $valid;
418
                $listing['view']       = $view;
419
420
                $cat = addslashes($cid);
421
422
                $listing['views'] = $view;
423
                $xoops->tpl()->append('listing', $listing);
424
                $xoops->tpl()->assign('valid', AlumniLocale::APPROVE);
425
                $xoops->tpl()->assign('school', AlumniLocale::SCHOOL);
426
                $xoops->tpl()->assign('class_of', AlumniLocale::CLASS_OF);
427
                $xoops->tpl()->assign('moderated_lang', AlumniLocale::MODERATED);
428
                $xoops->tpl()->assign('moderated_lang', XoopsLocale::A_EDIT);
429
                $xoops->tpl()->assign('studies_lang', AlumniLocale::STUDIES);
430
                $xoops->tpl()->assign('activities_lang', AlumniLocale::ACTIVITIES);
431
                $xoops->tpl()->assign('extrainfo_lang', AlumniLocale::EXTRAINFO);
432
                $xoops->tpl()->assign('occ_lang', AlumniLocale::OCC);
433
            }
434
            unset($listing);
435
        } else {
436
            $xoops->tpl()->assign('error_message', AlumniLocale::NO_LISTING_TO_APPROVE);
437
        }
438
439
        break;
440
441
}
442
$xoops->footer();
443