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 | // |
||
25 | |||
26 | if (!empty($_POST['submit'])) { |
||
27 | include __DIR__ . '/header.php'; |
||
28 | |||
29 | global $xoopsConfig, $xoopsDB, $myts, $meta; |
||
0 ignored issues
–
show
|
|||
30 | |||
31 | View Code Duplication | if ('1' == $xoops->getModuleConfig('alumni_use_captcha') && !$xoops->user->isAdmin()) { |
|
32 | $xoopsCaptcha = XoopsCaptcha::getInstance(); |
||
33 | if (!$xoopsCaptcha->verify()) { |
||
34 | $xoops->redirect('javascript:history.go(-1)', 3, $xoopsCaptcha->getMessage()); |
||
35 | exit(0); |
||
36 | } |
||
37 | } |
||
38 | |||
39 | // if (!$xoops->security()->check()) { |
||
40 | // $xoops->redirect('javascript:history.go(-1)', 3, implode(',', $xoops->security()->getErrors())); |
||
41 | // } |
||
42 | |||
43 | $lid = Request::getInt('lid', 0); |
||
44 | $lid = $lid; |
||
45 | |||
46 | $body = Request::getString('body', ''); |
||
47 | $sname = Request::getString('sname', ''); |
||
48 | $semail = Request::getString('semail', ''); |
||
49 | $listing = Request::getString('listing', ''); |
||
50 | |||
51 | $subject = AlumniLocale::CONTACTALUMNI; |
||
52 | $admin_subject = AlumniLocale::CONTACTADMIN; |
||
53 | |||
54 | $helper = Xoops::getModuleHelper('alumni'); |
||
55 | $module_id = $helper->getModule()->getVar('mid'); |
||
56 | $groups = $xoops->isUser() ? $xoops->user->getGroups() : '3'; |
||
57 | $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id); |
||
58 | $listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
||
59 | $listing_criteria = new CriteriaCompo(); |
||
60 | $listing_criteria->add(new Criteria('lid', $lid, '=')); |
||
61 | $listing_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
62 | $numrows = $listingHandler->getCount($listing_criteria); |
||
63 | $listingArray = $listingHandler->getAll($listing_criteria); |
||
64 | View Code Duplication | foreach (array_keys($listingArray) as $i) { |
|
65 | $name = $listingArray[$i]->getVar('name'); |
||
66 | $mname = $listingArray[$i]->getVar('mname'); |
||
67 | $lname = $listingArray[$i]->getVar('lname'); |
||
68 | $submitter = $listingArray[$i]->getVar('submitter'); |
||
69 | $email = $listingArray[$i]->getVar('email'); |
||
70 | } |
||
71 | unset($listingArray); |
||
72 | |||
73 | $ipaddress = $_SERVER['REMOTE_ADDR']; |
||
74 | |||
75 | $xoopsMailer = $xoops->getMailer(); |
||
76 | $xoopsMailer->reset(); |
||
77 | $xoopsMailer->useMail(); |
||
78 | $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/alumni/language/' . $xoops->getConfig('language') . '/mail_template/'); |
||
79 | $xoopsMailer->setTemplate('listing_user_contact.tpl'); |
||
80 | $xoopsMailer->assign('SNAME', $sname); //assign some vars for mail template |
||
81 | $xoopsMailer->assign('SEMAIL', $semail); |
||
82 | $xoopsMailer->assign('SUBJECT', $subject); |
||
83 | $xoopsMailer->assign('BODY', $body); |
||
84 | $xoopsMailer->assign('FROM', AlumniLocale::SUBMITTED_BY); |
||
85 | $xoopsMailer->assign('SUBMITTER', $submitter); |
||
86 | $xoopsMailer->assign('HELLO', AlumniLocale::HELLO); |
||
87 | $xoopsMailer->assign('LISTING', $listing); |
||
88 | $xoopsMailer->assign('REPLY_TO', AlumniLocale::CAN_REPLY); |
||
89 | $xoopsMailer->assign('HAVE_REPLY', AlumniLocale::REPLY_TO); |
||
90 | $xoopsMailer->assign('FROMSITE', AlumniLocale::FROMSITE); |
||
91 | $xoopsMailer->assign('AT', AlumniLocale::AT); |
||
92 | $xoopsMailer->assign('WEBMASTER', AlumniLocale::WEBMASTER); |
||
93 | $xoopsMailer->assign('NO_REPLY', AlumniLocale::NO_REPLY); |
||
94 | $xoopsMailer->setToEmails($email); |
||
95 | $xoopsMailer->setFromEmail($xoops->getConfig('adminmail')); |
||
96 | $xoopsMailer->setFromName($xoops->getConfig('sitename')); |
||
97 | $xoopsMailer->setSubject($subject); |
||
98 | $xoopsMailer->setBody($body); |
||
99 | $xoopsMailer->send(); |
||
100 | $xoopsMailer->getErrors(); |
||
101 | |||
102 | $xoopsMailer2 = $xoops->getMailer(); |
||
103 | $xoopsMailer->reset(); |
||
104 | $xoopsMailer2->useMail(); |
||
105 | $xoopsMailer2->setTemplateDir(XOOPS_ROOT_PATH . '/modules/alumni/language/' . $xoops->getConfig('language') . '/mail_template/'); |
||
106 | $xoopsMailer2->setTemplate('listing_admin_contact.tpl'); |
||
107 | $xoopsMailer2->assign('SNAME', $sname); //assign some vars for mail template |
||
108 | $xoopsMailer2->assign('SEMAIL', $semail); |
||
109 | $xoopsMailer2->assign('SUBJECT', $subject); |
||
110 | $xoopsMailer2->assign('BODY', $body); |
||
111 | $xoopsMailer2->assign('IPADDRESS', $ipaddress); |
||
112 | $xoopsMailer2->assign('FROM', AlumniLocale::SUBMITTED_BY); |
||
113 | $xoopsMailer2->assign('SUBMITTER', $submitter); |
||
114 | $xoopsMailer2->assign('HELLO', AlumniLocale::HELLO); |
||
115 | $xoopsMailer2->assign('LISTING', $listing); |
||
116 | $xoopsMailer2->assign('ADMIN_COPY', AlumniLocale::ADMIN_COPY); |
||
117 | $xoopsMailer2->assign('REPLY_TO', AlumniLocale::CAN_REPLY); |
||
118 | $xoopsMailer2->assign('HAVE_REPLY', AlumniLocale::REPLY_TO); |
||
119 | $xoopsMailer2->assign('FROMSITE', AlumniLocale::FROMSITE); |
||
120 | $xoopsMailer2->assign('AT', AlumniLocale::AT); |
||
121 | $xoopsMailer2->assign('WEBMASTER', AlumniLocale::WEBMASTER); |
||
122 | $xoopsMailer2->assign('NO_REPLY', AlumniLocale::NO_REPLY); |
||
123 | $xoopsMailer2->setToEmails($xoops->getConfig('adminmail')); |
||
124 | $xoopsMailer2->setFromEmail($xoops->getConfig('adminmail')); |
||
125 | $xoopsMailer2->setFromName($xoops->getConfig('sitename')); |
||
126 | $xoopsMailer2->setSubject($admin_subject); |
||
127 | $xoopsMailer2->setBody($body); |
||
128 | $xoopsMailer2->send(); |
||
129 | $xoopsMailer2->getErrors(); |
||
130 | |||
131 | $xoops->redirect('index.php', 3, AlumniLocale::MESSAGE_SENT); |
||
132 | } else { |
||
133 | $lid = isset($_REQUEST['lid']) ? $_REQUEST['lid'] : ''; |
||
134 | include __DIR__ . '/header.php'; |
||
135 | $xoops = Xoops::getInstance(); |
||
136 | Xoops::getInstance()->header(); |
||
137 | $helper = Xoops::getModuleHelper('alumni'); |
||
138 | $module_id = $helper->getModule()->getVar('mid'); |
||
139 | $groups = $xoops->isUser() ? $xoops->user->getGroups() : '3'; |
||
140 | $alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id); |
||
141 | $listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
||
142 | $listing_criteria = new CriteriaCompo(); |
||
143 | $listing_criteria->add(new Criteria('lid', $lid, '=')); |
||
144 | $listing_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
||
145 | $numrows = $listingHandler->getCount($listing_criteria); |
||
146 | $listingArray = $listingHandler->getAll($listing_criteria); |
||
147 | unset($listing_criteria); |
||
148 | View Code Duplication | foreach (array_keys($listingArray) as $i) { |
|
149 | $name = $listingArray[$i]->getVar('name'); |
||
150 | $mname = $listingArray[$i]->getVar('mname'); |
||
151 | $lname = $listingArray[$i]->getVar('lname'); |
||
152 | $submitter = $listingArray[$i]->getVar('submitter'); |
||
153 | $email = $listingArray[$i]->getVar('email'); |
||
154 | } |
||
155 | $listing = $name . ' ' . $mname . ' ' . $lname; |
||
156 | |||
157 | if ($xoops->user) { |
||
158 | $sname = $xoops->user->getVar('uname'); |
||
159 | $sname = ('' == $sname) ? $xoops->user->getVar('name') : $sname; |
||
160 | |||
161 | $semail = $xoops->user->getVar('email'); |
||
162 | } |
||
163 | $sendform = new XoopsThemeForm(AlumniLocale::CONTACTAUTOR . ' ' . $listing, 'sendform', $_SERVER['PHP_SELF'] . '?lid=$lid', 'POST'); |
||
164 | $sendform->addElement(new XoopsFormLabel(AlumniLocale::SUBJECT, $listing)); |
||
165 | $sendform->addElement(new XoopsFormText(XoopsLocale::C_YOUR_NAME, 'sname', 50, 100, $sname), true); |
||
166 | $sendform->addElement(new XoopsFormText(XoopsLocale::C_YOUR_EMAIL, 'semail', 50, 50, $semail), true); |
||
167 | $sendform->addElement(new XoopsFormTextArea(AlumniLocale::YOURMESSAGE, 'body', '', 5, 50, '')); |
||
168 | if ('1' == $xoops->getModuleConfig('alumni_use_captcha') && !$xoops->user->isAdmin()) { |
||
169 | $sendform->addElement(new XoopsFormCaptcha()); |
||
170 | } |
||
171 | $sendform->addElement(new XoopsFormLabel(AlumniLocale::YOUR_IP, '<img src="' . XOOPS_URL . '/modules/alumni/ip_image.php" alt=""><br>' . AlumniLocale::IP_LOGGED . '')); |
||
172 | // $sendform->addElement(new Xoops\Form\Hidden('security', $xoops->security()->createToken())); |
||
173 | $sendform->addElement(new XoopsFormHidden('listing', $listing), false); |
||
174 | $sendform->addElement(new XoopsFormHidden('email', $email), false); |
||
175 | $sendform->addElement(new XoopsFormHidden('lid', $lid), false); |
||
176 | $sendform->addElement(new XoopsFormButton('', 'submit', XoopsLocale::A_SUBMIT, 'submit')); |
||
177 | $sendform->display(); |
||
178 | |||
179 | Xoops::getInstance()->footer(); |
||
180 | } |
||
181 |
Instead of relying on
global
state, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state