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 | $xoops = Xoops::getInstance(); |
||
26 | $myts = MyTextSanitizer::getInstance(); |
||
27 | $moduleDirName = basename(__DIR__); |
||
28 | |||
29 | //if (!empty($_POST['submit'])) { |
||
0 ignored issues
–
show
|
|||
30 | if (Request::getString('submit', '', 'POST')) { |
||
31 | 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. ![]() |
|||
32 | $xoopsCaptcha = XoopsCaptcha::getInstance(); |
||
33 | if (!$xoopsCaptcha->verify()) { |
||
34 | $xoops->redirect(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php', 4, $xoopsCaptcha->getMessage()); |
||
35 | exit(0); |
||
36 | } |
||
37 | } |
||
38 | // if (!$xoops->security()->check()) { |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
71% 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. ![]() |
|||
39 | // $xoops->redirect('javascript:history.go(-1)', 3, implode(',', $xoops->security()->getErrors())); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
72% 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. ![]() |
|||
40 | // } |
||
41 | |||
42 | $yname = Request::getString('yname', '', 'POST'); //$_POST['yname']; |
||
43 | $ymail = Request::getString('ymail', '', 'POST'); //$_POST['ymail']; |
||
44 | $fname = Request::getString('fname', '', 'POST'); //$_POST['fname']; |
||
45 | $fmail = Request::getString('fmail', '', 'POST'); //$_POST['fmail']; |
||
46 | |||
47 | $lid = Request::getInt('lid', 0); |
||
48 | |||
49 | $alumni = Alumni::getInstance(); |
||
50 | $helper = Xoops::getModuleHelper('alumni'); |
||
51 | $moduleId = $helper->getModule()->getVar('mid'); |
||
52 | |||
53 | $groups = $xoops->isUser() ? $xoops->user->getGroups() : '3'; |
||
54 | $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $moduleId); |
||
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. ![]() |
|||
55 | $listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
||
56 | $listing_criteria = new CriteriaCompo(); |
||
0 ignored issues
–
show
$listing_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. ![]() |
|||
57 | $listing_criteria->add(new Criteria('lid', $lid, '=')); |
||
0 ignored issues
–
show
$listing_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. ![]() |
|||
58 | $listing_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
0 ignored issues
–
show
$listing_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. ![]() |
|||
59 | $numrows = $listingHandler->getCount($listing_criteria); |
||
0 ignored issues
–
show
$listing_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. ![]() |
|||
60 | |||
61 | $listingArray = $listingHandler->getAll($listing_criteria); |
||
0 ignored issues
–
show
$listing_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. ![]() |
|||
62 | unset($listing_criteria); |
||
0 ignored issues
–
show
$listing_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. ![]() |
|||
63 | foreach (array_keys($listingArray) as $i) { |
||
64 | $lid = $listingArray[$i]->getVar('lid'); |
||
65 | $cid = $listingArray[$i]->getVar('cid'); |
||
66 | $name = $listingArray[$i]->getVar('name'); |
||
67 | $mname = $listingArray[$i]->getVar('mname'); |
||
68 | $lname = $listingArray[$i]->getVar('lname'); |
||
69 | $school = $listingArray[$i]->getVar('school'); |
||
70 | $year = $listingArray[$i]->getVar('year'); |
||
71 | $studies = $listingArray[$i]->getVar('studies'); |
||
72 | $activities = $listingArray[$i]->getVar('activities'); |
||
73 | $extrainfo = $listingArray[$i]->getVar('extrainfo'); |
||
74 | $occ = $listingArray[$i]->getVar('occ'); |
||
75 | $date = $listingArray[$i]->getVar('date'); |
||
76 | $email = $listingArray[$i]->getVar('email'); |
||
77 | $submitter = $listingArray[$i]->getVar('submitter'); |
||
78 | $usid = $listingArray[$i]->getVar('usid'); |
||
79 | $town = $listingArray[$i]->getVar('town'); |
||
80 | $valid = $listingArray[$i]->getVar('valid'); |
||
81 | $photo = $listingArray[$i]->getVar('photo'); |
||
82 | $photo2 = $listingArray[$i]->getVar('photo2'); |
||
83 | $view = $listingArray[$i]->getVar('view'); |
||
84 | |||
85 | $useroffset = ''; |
||
86 | View Code Duplication | if ($xoopsUser) { |
|
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. ![]() |
|||
87 | $timezone = $xoopsUser->timezone(); |
||
88 | if (isset($timezone)) { |
||
89 | $useroffset = $xoopsUser->timezone(); |
||
90 | } else { |
||
91 | $useroffset = $xoopsConfig['default_TZ']; |
||
92 | } |
||
93 | } |
||
94 | $date = ($useroffset * 3600) + $date; |
||
95 | $date = XoopsLocale::formatTimestamp($date, 's'); |
||
96 | $name = $myts->htmlSpecialChars($name); |
||
97 | $mname = $myts->htmlSpecialChars($mname); |
||
98 | $lname = $myts->htmlSpecialChars($lname); |
||
99 | $school = $myts->htmlSpecialChars($school); |
||
100 | $year = $myts->htmlSpecialChars($year); |
||
101 | $studies = $myts->htmlSpecialChars($studies); |
||
102 | $activities = $myts->displayTarea($activities, 1, 0, 1, 1, 1); |
||
103 | $occ = $myts->htmlSpecialChars($occ); |
||
104 | $submitter = $myts->htmlSpecialChars($submitter); |
||
105 | $town = $myts->htmlSpecialChars($town); |
||
106 | |||
107 | $tags = []; |
||
108 | $tags['YNAME'] = $yname; |
||
109 | $tags['YMAIL'] = $ymail; |
||
110 | $tags['FNAME'] = $fname; |
||
111 | $tags['FMAIL'] = $fmail; |
||
112 | $tags['HELLO'] = AlumniLocale::HELLO; |
||
113 | $tags['LID'] = $lid; |
||
114 | $tags['CLASSOF'] = AlumniLocale::CLASSOF; |
||
115 | $tags['NAME'] = $name; |
||
116 | $tags['MNAME'] = $mname; |
||
117 | $tags['LNAME'] = $lname; |
||
118 | $tags['SCHOOL'] = $school; |
||
119 | $tags['STUDIES'] = $studies; |
||
120 | $tags['TOWN'] = $town; |
||
121 | $tags['YEAR'] = $year; |
||
122 | $tags['OTHER'] = '' . AlumniLocale::INTERESTED . ' ' . $xoopsConfig['sitename'] . ''; |
||
123 | $tags['LISTINGS'] = '' . XOOPS_URL . "/modules/{$moduleDirName}/"; |
||
124 | $tags['LINK_URL'] = '' . XOOPS_URL . "/modules/{$moduleDirName}/listing.php?lid=" . addslashes($lid) . ''; |
||
125 | $tags['THINKS_INTERESTING'] = '' . AlumniLocale::MESSAGE . ''; |
||
126 | $tags['YOU_CAN_VIEW_BELOW'] = '' . AlumniLocale::YOU_CAN_VIEW_BELOW . ''; |
||
127 | $tags['WEBMASTER'] = AlumniLocale::WEBMASTER; |
||
128 | $tags['NO_REPLY'] = AlumniLocale::NO_REPLY; |
||
129 | $subject = '' . AlumniLocale::SUBJECT . ' ' . $xoopsConfig['sitename'] . ''; |
||
130 | |||
131 | $xoopsMailer = $xoops->getMailer(); |
||
132 | $xoopsMailer->useMail(); |
||
133 | $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . "/modules/{$moduleDirName}/language/english/mail_template/"); |
||
134 | $xoopsMailer->setTemplate('listing_send_friend.tpl'); |
||
135 | $xoopsMailer->setFromEmail($ymail); |
||
136 | $xoopsMailer->setToEmails($fmail); |
||
137 | $xoopsMailer->setSubject($subject); |
||
138 | // $xoopsMailer->$xoops->multimailer; |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
72% 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. ![]() |
|||
139 | $xoopsMailer->assign($tags); |
||
140 | $xoopsMailer->send(); |
||
141 | echo $xoopsMailer->getErrors(); |
||
142 | |||
143 | $xoops->redirect('index.php', 3, AlumniLocale::ALUM_SEND); |
||
144 | exit(); |
||
145 | } |
||
146 | } else { |
||
147 | global $xoops; |
||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||
148 | |||
149 | $lid = Request::getInt('lid', 0); |
||
150 | $xoops->header('alumni_sendfriend.tpl'); |
||
151 | |||
152 | include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
153 | |||
154 | $listingHandler = $xoops->getModuleHandler('listing', $moduleDirName); |
||
155 | $listing_2_send = $listingHandler->get($lid); |
||
0 ignored issues
–
show
$listing_2_send 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. ![]() |
|||
156 | |||
157 | $listing_2_send->getVar('name'); |
||
0 ignored issues
–
show
$listing_2_send 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. ![]() |
|||
158 | $listing_2_send->getVar('mname'); |
||
0 ignored issues
–
show
$listing_2_send 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. ![]() |
|||
159 | $listing_2_send->getVar('lname'); |
||
0 ignored issues
–
show
$listing_2_send 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. ![]() |
|||
160 | |||
161 | ob_start(); |
||
162 | $form = new Xoops\Form\ThemeForm(AlumniLocale::SENDTO, 'sendfriend_form', 'sendfriend.php'); |
||
163 | $form->setExtra('enctype="multipart/form-data"'); |
||
164 | // $GLOBALS['xoopsGTicket']->addTicketXoopsFormElement($form, __LINE__, 1800, 'token'); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
75% 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. ![]() |
|||
165 | $form->addElement(new Xoops\Form\Label(AlumniLocale::LISTING_SEND, $listing_2_send->getVar('name') . ' ' . $listing_2_send->getVar('mname') . ' ' . $listing_2_send->getVar('lname') . '')); |
||
0 ignored issues
–
show
$listing_2_send 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. ![]() |
|||
166 | if ($xoopsUser) { |
||
167 | $idd = $xoopsUser->getVar('name', 'E'); |
||
168 | $idde = $xoopsUser->getVar('email', 'E'); |
||
169 | } |
||
170 | |||
171 | $form->addElement(new Xoops\Form\Text(XoopsLocale::C_YOUR_NAME, 'yname', 30, 50, $idd), true); |
||
172 | $form->addElement(new Xoops\Form\Text(XoopsLocale::C_YOUR_EMAIL, 'ymail', 30, 60, $idde), true); |
||
173 | $form->addElement(new Xoops\Form\Text(AlumniLocale::NAMEFR, 'fname', 30, 60, ''), true); |
||
174 | $form->addElement(new Xoops\Form\Text(AlumniLocale::MAILFR, 'fmail', 30, 60, ''), true); |
||
175 | |||
176 | if ('1' == $xoops->getModuleConfig('alumni_use_captcha') && !$xoops->user->isAdmin()) { |
||
177 | $form->addElement(new XoopsFormCaptcha()); |
||
178 | } |
||
179 | // $form->addElement(new Xoops\Form\Hidden('security', $xoops->security()->createToken())); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
71% 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. ![]() |
|||
180 | $form->addElement(new Xoops\Form\Hidden('lid', $lid), false); |
||
181 | $form->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); |
||
182 | $form->display(); |
||
183 | $xoopsTpl->assign('sendfriend_form', ob_get_contents()); |
||
184 | |||
185 | ob_end_clean(); |
||
186 | } |
||
187 | Xoops::getInstance()->footer(); |
||
188 |
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.