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.

listing.php (60 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__ . '/header.php';
25
26
$moduleDirName = basename(__DIR__);
27
$main_lang     = '_MA_' . strtoupper($moduleDirName);
0 ignored issues
show
$main_lang 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...
28
$myts          = MyTextSanitizer::getInstance();
29
$xoops         = Xoops::getInstance();
30
$module_id     = $xoopsModule->getVar('mid');
0 ignored issues
show
$module_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...
31
32
$groups = '3';
33
if (is_object($xoopsUser)) {
34
    $groups = $xoopsUser->getGroups();
35
}
36
//$gperm_handler = $xoops->getHandler('groupperm');
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
37
$perm_itemid = 0;
0 ignored issues
show
$perm_itemid 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...
38
if (isset($_POST['item_id'])) {
39
    $perm_itemid = (int)$_POST['item_id'];
0 ignored issues
show
$perm_itemid 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...
40
}
41
//If no access
42 View Code Duplication
if (!$gpermHandler->checkRight('' . $moduleDirName . '_view', $perm_itemid, $groups, $module_id)) {
0 ignored issues
show
$perm_itemid 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...
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...
43
    $xoops->redirect(XOOPS_URL . '/index.php', 3, XoopsLocale::E_NO_ACCESS_PERMISSION);
44
    exit();
45
}
46
$prem_perm = '1';
0 ignored issues
show
$prem_perm 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...
47
if (!$gpermHandler->checkRight('' . $moduleDirName . '_premium', $perm_itemid, $groups, $module_id)) {
0 ignored issues
show
$perm_itemid 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...
48
    $prem_perm = '0';
0 ignored issues
show
$prem_perm 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...
49
}
50
$lid = Request::getInt('lid', 0);
51
$xoops->header('module:alumni/alumni_item.tpl');
52
Xoops::getInstance()->header();
53
54
$op = Request::getCmd('op', 'list');
55
56
switch ($op) {
57
    case 'list':
58
    default:
59
        $listingHandler = $xoops->getModuleHandler('listing', 'alumni');
60
61
        $alumni     = Alumni::getInstance();
62
        $helper     = Xoops::getModuleHelper('alumni');
63
        $module_id  = $helper->getModule()->getVar('mid');
0 ignored issues
show
$module_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...
64
        $listingObj = $listingHandler->get($lid);
65
66
        $categoriesHandler = $xoops->getModuleHandler('category', 'alumni');
67
        $catObj            = $categoriesHandler->get($listingObj->getVar('cid'));
68
69
        $homePath         = "<a href='" . ALUMNI_URL . "/index.php'>" . XoopsLocale::MAIN . '</a>&nbsp;:&nbsp;';
70
        $itemPath         = "<a href='" . ALUMNI_URL . '/categories.php?cid=' . $catObj->getVar('cid') . "'>" . $catObj->getVar('title') . '</a>';
71
        $path             = '';
72
        $myParent         = $catObj->getVar('pid');
73
        $catpath_criteria = new CriteriaCompo();
0 ignored issues
show
$catpath_criteria 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...
74
        $catpath_criteria->add(new Criteria('cid', $myParent, '='));
0 ignored issues
show
$catpath_criteria 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...
75
        $catpath_arr = $categoriesHandler->getAll($catpath_criteria);
0 ignored issues
show
$catpath_arr 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...
76
        foreach (array_keys($catpath_arr) as $i) {
0 ignored issues
show
$catpath_arr 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...
77
            $mytitle = $catpath_arr[$i]->getVar('title');
0 ignored issues
show
$catpath_arr 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...
78
        }
79
80 View Code Duplication
        if (0 != $myParent) {
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...
81
            $path = "<a href='" . ALUMNI_URL . '/categories.php?cid=' . $catpath_arr[$i]->getVar('cid') . "'>" . $catpath_arr[$i]->getVar('title') . "</a>&nbsp;:&nbsp;{$path}";
0 ignored issues
show
$catpath_arr 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...
82
        }
83
84
        $path = "{$homePath}{$path}{$itemPath}";
85
        $path = str_replace('&nbsp;:&nbsp;', " <img src='" . XOOPS_URL . '/modules/alumni/images/arrow.gif' . "' style='border-width: 0px;' alt=''> ", $path);
86
87
        $xoops->tpl()->assign('category_path', $path);
88
89
        $groups     = $xoops->isUser() ? $xoops->user->getGroups() : '3';
90
        $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id);
0 ignored issues
show
$alumni_ids 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...
91
        $criteria   = new CriteriaCompo();
92
        $criteria->add(new Criteria('lid', $lid, '='));
93
        $criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN'));
0 ignored issues
show
$alumni_ids 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...
94
        $numrows      = $listingHandler->getCount();
95
        $listingArray = $listingHandler->getAll($criteria);
96
97
        foreach (array_keys($listingArray) as $i) {
98
            $lid        = $listingArray[$i]->getVar('lid');
99
            $cid        = $listingArray[$i]->getVar('cid');
100
            $name       = $listingArray[$i]->getVar('name');
101
            $mname      = $listingArray[$i]->getVar('mname');
102
            $lname      = $listingArray[$i]->getVar('lname');
103
            $school     = $listingArray[$i]->getVar('school');
104
            $year       = $listingArray[$i]->getVar('year');
105
            $studies    = $listingArray[$i]->getVar('studies');
106
            $activities = $listingArray[$i]->getVar('activities');
107
            $extrainfo  = $listingArray[$i]->getVar('extrainfo');
108
            $occ        = $listingArray[$i]->getVar('occ');
109
            $date       = $listingArray[$i]->getVar('date');
110
            $date       = XoopsLocale::formatTimestamp($date, 's');
111
            $email      = $listingArray[$i]->getVar('email');
112
            $submitter  = $listingArray[$i]->getVar('submitter');
113
            $usid       = $listingArray[$i]->getVar('usid');
114
            $town       = $listingArray[$i]->getVar('town');
115
            $valid      = $listingArray[$i]->getVar('valid');
116
            $photo      = $listingArray[$i]->getVar('photo');
117
            $photo2     = $listingArray[$i]->getVar('photo2');
118
            $view       = $listingArray[$i]->getVar('view');
119
120
            $recordexist = false;
121
122
            if (0 != $lid) {
123
                $recordexist = true;
124
                $listingHandler->updateCounter($lid);
125
            }
126
127
            $xoops->tpl()->assign('add_from', AlumniLocale::ALUMNI_LISTINGS . ' ' . $xoopsConfig['sitename']);
128
            $xoops->tpl()->assign('add_from_title', AlumniLocale::ALUMNI_LISTINGS);
129
            $xoops->tpl()->assign('add_from_sitename', $xoopsConfig['sitename']);
130
            $xoops->tpl()->assign('class_of', AlumniLocale::CLASSOF);
131
            $xoops->tpl()->assign('listing_exists', $recordexist);
132
            $count = 0;
133
            $x     = 0;
134
            $i     = 0;
135
136
            $printA = '<a href="print.php?lid=' . addslashes($lid) . '" target="_blank"><img src="images/print.gif" border=0 alt="' . AlumniLocale::THIS_PRINT . '" width=15 height=11></a>&nbsp;';
137
            $mailA  = "<a href=\"sendfriend.php?op=SendFriend&amp;lid=$lid\"><img src=\"../{$moduleDirName}/images/friend.gif\" border=\"0\" alt=\"" . AlumniLocale::FRIENDSEND . '" width="15" height="11"></a>';
138 View Code Duplication
            if ($usid > 0) {
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...
139
                $xoops->tpl()->assign('submitter', AlumniLocale::SUBMITTED_BY . "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . addslashes($usid) . "'>$submitter</a>");
140
            } else {
141
                $xoops->tpl()->assign('submitter', AlumniLocale::SUBMITTED_BY . "$submitter");
142
            }
143
144
            $xoops->tpl()->assign('print', $printA);
145
            $xoops->tpl()->assign('sfriend', $mailA);
146
            $xoops->tpl()->assign('read', $view);
147
148
            if ($xoops->isUser()) {
149
                $calusern = $xoops->user->getVar('uid', 'E');
150
                if ($usid == $calusern) {
151
                    $xoops->tpl()->assign(
152
                        'modify',
153
                                          '<a href="listing.php?op=edit_listing&amp;lid=' . addslashes($lid) . '&amp;cid=' . addslashes($cid) . '">' . AlumniLocale::MODIFY . '</a>  |  <a href="listing.php?op=delete_listing&amp;lid=' . addslashes($lid) . '">' . XoopsLocale::A_DELETE . '</a>'
154
                    );
155
                }
156
                if ($xoops->user->isAdmin()) {
157
                    $xoops->tpl()->assign('admin', '<a href="admin/alumni.php?op=edit_listing&amp;lid=' . addslashes($lid) . '&amp;cid=' . addslashes($cid) . '"><img src="images/modif.gif" border=0 alt="' . AlumniLocale::MODADMIN . '"></a>');
158
                }
159
            }
160
161
            $activities1 = $myts->displayTarea($activities, 1, 0, 1, 1, 0);
162
163
            $xoops->tpl()->assign('name', $name);
164
            $xoops->tpl()->assign('mname', $mname);
165
            $xoops->tpl()->assign('lname', $lname);
166
            $xoops->tpl()->assign('school', $school);
167
            $xoops->tpl()->assign('year', $year);
168
            $xoops->tpl()->assign('studies', $studies);
169
            $xoops->tpl()->assign('name_head', AlumniLocale::NAME_2);
170
            $xoops->tpl()->assign('class_of', AlumniLocale::CLASSOF);
171
            $xoops->tpl()->assign('mname_head', AlumniLocale::MNAME_2);
172
            $xoops->tpl()->assign('lname_head', AlumniLocale::LNAME_2);
173
            $xoops->tpl()->assign('school_head', AlumniLocale::SCHOOL);
174
            $xoops->tpl()->assign('year_head', AlumniLocale::YEAR);
175
            $xoops->tpl()->assign('studies_head', AlumniLocale::STUDIES_2);
176
            $xoops->tpl()->assign('local_town', $town);
177
            $xoops->tpl()->assign('local_head', AlumniLocale::TOWN_2);
178
            $xoops->tpl()->assign('alumni_mustlogin', AlumniLocale::MUSTLOGIN);
179
            $xoops->tpl()->assign('photo_head', AlumniLocale::GRAD_PHOTO);
180
            $xoops->tpl()->assign('photo2_head', AlumniLocale::NOW_PHOTO);
181
            $xoops->tpl()->assign('activities', $activities1);
182
            $xoops->tpl()->assign('extrainfo', $myts->displayTarea($extrainfo, 1));
183
            $xoops->tpl()->assign('activities_head', AlumniLocale::ACTIVITIES_2);
184
            $xoops->tpl()->assign('extrainfo_head', AlumniLocale::EXTRAINFO_2);
185
186
            if ($email) {
187
                $xoops->tpl()->assign('contact_head', AlumniLocale::CONTACT_2);
188
                $xoops->tpl()->assign('contact_email', "<a href=\"contact.php?lid=$lid\">" . AlumniLocale::EMAIL . '</a>');
189
            }
190
            $xoops->tpl()->assign('contact_occ_head', AlumniLocale::OCC_2);
191
            $xoops->tpl()->assign('contact_occ', $occ);
192
193
            $xoops->tpl()->assign('photo', '');
194
            $xoops->tpl()->assign('photo2', '');
195
196
            if ($photo) {
197
                $xoops->tpl()->assign('photo', "<img src=\"photos/grad_photo/$photo\" alt=\"\" width=\"125\"/>");
198
            }
199
            if ($photo2) {
200
                $xoops->tpl()->assign('photo2', "<img src=\"photos/now_photo/$photo2\" alt=\"\" width=\"125\">");
201
            }
202
            $xoops->tpl()->assign('date', AlumniLocale::LISTING_ADDED . " $date ");
203
204
            $xoops->tpl()->assign('link_main', "<a href=\"../{$moduleDirName}/\">" . XoopsLocale::MAIN . '</a>');
205
        }
206
        $xoops->tpl()->assign('no_listing', 'no listing');
207
208
        break;
209
210
    case 'new_listing':
211
        $xoops->header();
212
        $module_id = $xoopsModule->getVar('mid');
0 ignored issues
show
$module_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...
213
        $groups = '3';
214
        if (is_object($xoopsUser)) {
215
            $groups = $xoopsUser->getGroups();
216
        }
217
        //      $gperm_handler = $xoops->getHandler('groupperm');
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
218
        $perm_itemid = 0;
0 ignored issues
show
$perm_itemid 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...
219
        if (isset($_POST['item_id'])) {
220
            $perm_itemid = (int)$_POST['item_id'];
0 ignored issues
show
$perm_itemid 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...
221
        }
222
        //If no access
223 View Code Duplication
        if (!$gpermHandler->checkRight('' . $moduleDirName . '_view', $perm_itemid, $groups, $module_id)) {
0 ignored issues
show
$perm_itemid 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...
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...
224
            $xoops->redirect(XOOPS_URL . '/index.php', 3, _NOPERM);
225
            exit();
226
        }
227
        $obj    = $listingHandler->create();
228
        $new_id = $listingHandler->get_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...
229
        $form   = $xoops->getModuleForm($obj, 'listing');
230
        $form->display();
231
        break;
232
233
    case 'save_listing':
234
        if (!$xoops->security()->check()) {
235
            $xoops->redirect('index.php', 3, implode(',', $xoops->security()->getErrors()));
236
        }
237 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...
238
            $xoopsCaptcha = XoopsCaptcha::getInstance();
239
            if (!$xoopsCaptcha->verify()) {
240
                $xoops->redirect('javascript:history.go(-1)', 4, $xoopsCaptcha->getMessage());
241
                exit(0);
242
            }
243
        }
244
        $lid = Request::getInt('lid', 0);
245
        if (isset($lid)) {
246
            $obj = $listingHandler->get($lid);
247
            $obj->setVar('date', Request::getInt('date'));
248
        } else {
249
            $obj = $listingHandler->create();
250
            $obj->setVar('date', time());
251
            $lid = '0';
252
        }
253
254
        $photo_old   = Request::getString('photo_old', '');
0 ignored issues
show
$photo_old 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...
255
        $destination = XOOPS_ROOT_PATH . "/uploads/{$moduleDirName}/photos/grad_photo";
256
        $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...
257 View Code Duplication
        if (isset($del_photo)) {
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...
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...
258
            if ('1' == $del_photo) {
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...
259
                if (@file_exists('' . $destination . '/' . $photo_old . '')) {
0 ignored issues
show
$photo_old 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...
260
                    unlink('' . $destination . '/' . $photo_old . '');
0 ignored issues
show
$photo_old 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...
261
                }
262
                $obj->setVar('photo', '');
263
            }
264
        }
265
266
        $photo2_old   = Request::getString('photo2_old', '');
0 ignored issues
show
$photo2_old 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...
267
        $destination2 = XOOPS_ROOT_PATH . "/uploads/{$moduleDirName}/photos/now_photo";
268
        $del_photo2   = Request::getInt('del_photo2', 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...
269 View Code Duplication
        if (isset($del_photo2)) {
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...
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
            if ('1' == $del_photo2) {
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...
271
                if (@file_exists('' . $destination2 . '/' . $photo2_old . '')) {
0 ignored issues
show
$photo2_old 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...
272
                    unlink('' . $destination2 . '/' . $photo2_old . '');
0 ignored issues
show
$photo2_old 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...
273
                }
274
                $obj->setVar('photo2', '');
275
            }
276
        }
277
278
        $cid = Request::getInt('cid', 0);
279 View Code Duplication
        if (isset($cid)) {
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...
280
            $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...
281
            $categoriesHandler = $xoops->getModuleHandler('category', 'alumni');
282
            $catObj            = $categoriesHandler->get($cid);
283
            $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...
284
        }
285
286
        if (isset($lid)) {
287
            $obj->setVar('lid', $lid);
288
        }
289
290
        $obj->setVar('cid', Request::getInt('cid', 0));
291
        $obj->setVar('name', Request::getString('name'));
292
        $obj->setVar('mname', Request::getString('mname'));
293
        $obj->setVar('lname', Request::getString('lname'));
294
        $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...
295
        $obj->setVar('year', Request::getInt('year'));
296
        $obj->setVar('studies', Request::getString('studies'));
297
        $obj->setVar('activities', Request::getString('activities'));
298
        $obj->setVar('extrainfo', Request::getString('extrainfo'));
299
        $obj->setVar('occ', Request::getString('occ'));
300
        $obj->setVar('email', Request::getString('email'));
301
        $obj->setVar('submitter', Request::getString('submitter'));
302
        $obj->setVar('usid', Request::getInt('usid'));
303
        $obj->setVar('town', Request::getString('town'));
304
305
        if ('1' == $xoops->getModuleConfig('alumni_moderated')) {
306
            $obj->setVar('valid', '0');
307
        } else {
308
            $obj->setVar('valid', '1');
309
        }
310
        $date = time();
311 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...
312
            include_once XOOPS_ROOT_PATH . '/class/uploader.php';
313
            $uploaddir         = XOOPS_ROOT_PATH . '/modules/alumni/photos/grad_photo';
314
            $photomax          = $xoops->getModuleConfig('alumni_photomax');
315
            $maxwide           = $xoops->getModuleConfig('alumni_maxwide');
316
            $maxhigh           = $xoops->getModuleConfig('alumni_maxhigh');
317
            $allowed_mimetypes = ['image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png'];
0 ignored issues
show
$allowed_mimetypes 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...
318
            $uploader          = new XoopsMediaUploader($uploaddir, $allowed_mimetypes, $photomax, $maxwide, $maxhigh);
0 ignored issues
show
$allowed_mimetypes 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...
319
            if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
320
                $uploader->setTargetFileName($date . '_' . $_FILES['photo']['name']);
321
                $uploader->fetchMedia($_POST['xoops_upload_file'][0]);
322
                if (!$uploader->upload()) {
323
                    $errors = $uploader->getErrors();
324
                    $xoops->redirect('javascript:history.go(-1)', 3, $errors);
325
                } else {
326
                    $obj->setVar('photo', $uploader->getSavedFileName());
327
                }
328
            } else {
329
                $obj->setVar('photo', Request::getString('photo'));
330
            }
331
        }
332
333 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...
334
            include_once XOOPS_ROOT_PATH . '/class/uploader.php';
335
            $uploaddir2        = XOOPS_ROOT_PATH . '/modules/alumni/photos/now_photo';
336
            $photomax          = $xoops->getModuleConfig('alumni_photomax');
337
            $maxwide           = $xoops->getModuleConfig('alumni_maxwide');
338
            $maxhigh           = $xoops->getModuleConfig('alumni_maxhigh');
339
            $allowed_mimetypes = ['image/gif', 'image/jpg', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png'];
0 ignored issues
show
$allowed_mimetypes 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...
340
            $uploader2         = new XoopsMediaUploader($uploaddir2, $allowed_mimetypes, $photomax, $maxwide, $maxhigh);
0 ignored issues
show
$allowed_mimetypes 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...
341
            if ($uploader2->fetchMedia($_POST['xoops_upload_file'][1])) {
342
                $uploader2->setTargetFileName($date . '_' . $_FILES['photo2']['name']);
343
                $uploader2->fetchMedia($_POST['xoops_upload_file'][1]);
344
                if (!$uploader2->upload()) {
345
                    $errors = $uploader2->getErrors();
346
                    $xoops->redirect('javascript:history.go(-1)', 3, $errors);
347
                } else {
348
                    $obj->setVar('photo2', $uploader2->getSavedFileName());
349
                }
350
            } else {
351
                $obj->setVar('photo2', Request::getString('photo2'));
352
            }
353
        }
354
355
        if ($new_id = $listingHandler->insert($obj)) {
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...
356
            if ('1' == $xoops->getModuleConfig('alumni_moderated')) {
357
                $xoops->redirect('index.php', 3, AlumniLocale::MODERATE);
358
            } else {
359
                $xoops->redirect('listing.php?lid=' . $new_id . '', 3, XoopsLocale::S_DATABASE_UPDATED);
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...
360
            }
361
            //notifications
362 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...
363
                $notification_handler = Notifications::getInstance()->getHandlerNotification();
0 ignored issues
show
$notification_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...
364
                $tags                 = [];
365
                $tags['MODULE_NAME']  = 'alumni';
366
                $tags['ITEM_NAME']    = Request::getInt('lname', '');
367
                $tags['ITEM_URL']     = XOOPS_URL . '/modules/alumni/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...
368
                $notification_handler->triggerEvent('global', 0, 'new_listing', $tags);
0 ignored issues
show
$notification_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...
369
                $notification_handler->triggerEvent('category', $new_id, 'new_listing', $tags);
0 ignored issues
show
$notification_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...
370
            }
371
        }
372
373
        echo $obj->getHtmlErrors();
374
        $form = $xoops->getModuleForm($obj, 'listing');
375
        $form->display();
376
        break;
377
378
    case 'edit_listing':
379
        $lid            = Request::getInt('lid', 0);
380
        $listingHandler = $xoops->getModuleHandler('listing', 'alumni');
381
        $obj            = $listingHandler->get($lid);
382
        $form           = $xoops->getModuleForm($obj, 'listing');
383
        $form->display();
384
        break;
385
386
    case 'delete_listing':
387
        $listingHandler = $xoops->getModuleHandler('listing', 'alumni');
388
        $lid            = Request::getInt('lid', 0);
389
        $ok             = Request::getInt('ok', 0);
390
391
        $obj = $listingHandler->get($lid);
392
        if (1 == $ok) {
393
            if (!$xoops->security()->check()) {
394
                $xoops->redirect('index.php', 3, implode(',', $xoops->security()->getErrors()));
395
            }
396
            if ($listingHandler->delete($obj)) {
397
                $xoops->redirect('index.php', 3, XoopsLocale::S_DATABASE_UPDATED);
398
            } else {
399
                echo $xoops->alert('error', $obj->getHtmlErrors());
400
            }
401
        } else {
402
            echo $xoops->confirm(['ok' => 1, 'lid' => $lid, 'op' => 'delete_listing'], 'listing.php', XoopsLocale::Q_ARE_YOU_SURE_YOU_WANT_TO_DELETE_THIS_ITEM . '<br><span class="red">' . $obj->getVar('lname') . '<span>');
403
        }
404
        break;
405
}
406
407
Xoops::getInstance()->footer();
408