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 | * |
||
14 | * Tell a friend form generator / send email |
||
15 | * |
||
16 | * @copyright :: {@link http://xoops.org/ XOOPS Project} |
||
17 | * @license :: {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License} |
||
18 | * @package :: mylinks |
||
19 | */ |
||
20 | include_once __DIR__ . '/header.php'; |
||
21 | include_once $GLOBALS['xoops']->path('header.php'); |
||
22 | include_once __DIR__ . '/class/utility.php'; |
||
23 | include_once $GLOBALS['xoops']->path('class' . DIRECTORY_SEPARATOR . 'xoopsformloader.php'); |
||
24 | |||
25 | xoops_loadLanguage('main', $GLOBALS['xoopsModule']->getVar('dirname')); |
||
26 | $myts = MyTextSanitizer::getInstance(); |
||
27 | |||
28 | if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) && !$GLOBALS['xoopsModuleConfig']['anontellafriend']) { |
||
0 ignored issues
–
show
|
|||
29 | redirect_header('index.php', 3, _NOPERM); |
||
30 | exit(); |
||
31 | } |
||
32 | |||
33 | if (!isset($_POST['submit'])) { |
||
34 | if (!empty($_GET['contents'])) { |
||
35 | // coming back from failed attempt at filling out form |
||
36 | $form_contents = unserialize($myts->stripSlashesGPC($_GET['contents'])); |
||
37 | $lid = !empty($form_contents['lid']) ? (int)$form_contents['lid'] : 0; |
||
38 | $comments = !empty($form_contents['comments']) ? strip_tags(html_entity_decode($form_contents['comments'])) : ''; |
||
39 | $frname = !empty($form_contents['frname']) ? $myts->htmlSpecialChars($form_contents['frname']) : ''; |
||
40 | $fremail = !empty($form_contents['fremail']) ? $myts->htmlSpecialChars($form_contents['fremail']) : ''; |
||
41 | $sname = !empty($form_contents['sname']) ? $myts->htmlSpecialChars($form_contents['sname']) : ''; |
||
42 | $semail = !empty($form_contents['semail']) ? $myts->htmlSpecialChars($form_contents['semail']) : ''; |
||
43 | } else { |
||
44 | $lid = MylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min' => 0)); |
||
0 ignored issues
–
show
'lid' is of type string , but the function expects a object<unknown_type> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
45 | $comments = $frname = $fremail = $sname = $semail = ''; |
||
46 | } |
||
47 | |||
48 | // make sure that the link the user is sharing is valid & active |
||
49 | $result = $GLOBALS['xoopsDB']->query("SELECT title FROM {$GLOBALS['xoopsDB']->prefix('mylinks_links')} WHERE `lid` = '{$lid}' AND status>0 LIMIT 0,1"); |
||
50 | View Code Duplication | if ($result) { |
|
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. ![]() |
|||
51 | list($linktitle) = $GLOBALS['xoopsDB']->fetchRow($result); |
||
52 | $linktitle = $myts->stripSlashesGPC($linktitle); |
||
53 | } else { |
||
54 | // invalid (or inactive) link, can't send this to a friend |
||
55 | redirect_header('index.php', 3, _MD_MYLINKS_INVALIDORINACTIVELNK); |
||
56 | exit(); |
||
57 | } |
||
58 | |||
59 | $tfform = new XoopsThemeForm(_MD_MYLINKS_TELLAFRIEND, 'tfform', $_SERVER['PHP_SELF'], 'post', true); |
||
60 | $tfform->addElement(new XoopsFormText(_MD_MYLINKS_FRIEND . ' ' . _MD_MYLINKS_NAME, 'frname', 50, 50, trim($frname)), true); |
||
61 | $tfform->addElement(new XoopsFormText(_MD_MYLINKS_FRIEND . ' ' . _MD_MYLINKS_EMAIL, 'fremail', 50, 50, trim($fremail)), true); |
||
62 | if (!$GLOBALS['xoopsUser'] instanceof XoopsUser) { |
||
0 ignored issues
–
show
The class
XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
63 | $tfform->addElement(new XoopsFormText(_MD_MYLINKS_SENDER . ' ' . _MD_MYLINKS_NAME, 'sname', 50, 50, trim($sname)), true); |
||
64 | $tfform->addElement(new XoopsFormText(_MD_MYLINKS_SENDER . ' ' . _MD_MYLINKS_EMAIL, 'semail', 50, 50, trim($semail)), true); |
||
65 | } |
||
66 | $tfform->addElement(new XoopsFormLabel(_MD_MYLINKS_TITLE, $linktitle)); |
||
67 | $tfform->addElement(new XoopsFormTextArea(_COMMENTS, 'comments', trim($comments))); |
||
68 | $tfform->addElement(new XoopsFormHidden('lid', $lid)); |
||
69 | $tfform->addElement(new XoopsFormCaptcha()); |
||
70 | // $tfform->addElement(new XoopsFormCaptcha(null, null, false, array('maxattempts'=>4))); |
||
71 | $tfform->addElement(new XoopsFormButtonTray('submit', _SUBMIT)); |
||
72 | $tfform->display(); |
||
73 | include_once $GLOBALS['xoops']->path('footer.php'); |
||
74 | } else { |
||
75 | if ($GLOBALS['xoopsSecurity'] instanceof XoopsSecurity) { |
||
0 ignored issues
–
show
The class
XoopsSecurity does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
76 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
77 | // failed xoops security check |
||
78 | redirect_header('index.php', 3, $GLOBALS['xoopsSecurity']->getErrors(true)); |
||
79 | exit(); |
||
80 | } |
||
81 | } else { |
||
82 | redirect_header('index.php', 3, _MD_MYLINKS_INVALID_SECURITY_TOKEN); |
||
83 | } |
||
84 | |||
85 | $lid = MylinksUtility::mylinks_cleanVars($_POST, 'lid', 0, 'int', array('min' => 0)); |
||
0 ignored issues
–
show
'lid' is of type string , but the function expects a object<unknown_type> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
86 | $comments = strip_tags(html_entity_decode($myts->stripSlashesGPC($_POST['comments']))); |
||
87 | $frname = MylinksUtility::mylinks_cleanVars($_POST, 'frname', '', 'string'); |
||
0 ignored issues
–
show
'frname' is of type string , but the function expects a object<unknown_type> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
88 | $fremail = MylinksUtility::mylinks_cleanVars($_POST, 'fremail', '', 'email'); |
||
0 ignored issues
–
show
'fremail' is of type string , but the function expects a object<unknown_type> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
89 | $sname = MylinksUtility::mylinks_cleanVars($_POST, 'sname', '', 'string'); |
||
0 ignored issues
–
show
'sname' is of type string , but the function expects a object<unknown_type> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
90 | $semail = MylinksUtility::mylinks_cleanVars($_POST, 'semail', '', 'email'); |
||
0 ignored issues
–
show
'semail' is of type string , but the function expects a object<unknown_type> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
![]() |
|||
91 | |||
92 | //Check captcha |
||
93 | xoops_load('XoopsCaptcha'); |
||
94 | $xoopsCaptcha = XoopsCaptcha::getInstance(); |
||
95 | if (!$xoopsCaptcha->verify()) { |
||
96 | if ($_SESSION['xoopscaptcha_attempt'] < $_SESSION['_maxattempts']) { |
||
97 | $form_contents = array( |
||
98 | 'lid' => $lid, |
||
99 | 'frname' => $frname, |
||
100 | 'fremail' => $fremail, |
||
101 | 'sname' => $sname, |
||
102 | 'semail' => $semail, |
||
103 | 'comments' => $comments |
||
104 | ); |
||
105 | $contents = serialize($form_contents); |
||
106 | redirect_header($_SERVER['PHP_SELF'] . "?contents={$contents}", 2, $xoopsCaptcha->getMessage()); |
||
107 | exit(); |
||
108 | } else { |
||
109 | redirect_header('index.php', 2, $xoopsCaptcha->getMessage()); |
||
110 | exit(); |
||
111 | } |
||
112 | } |
||
113 | |||
114 | $xadminmail = $GLOBALS['xoopsConfig']['adminmail']; //setting from to server in case of SPF=>will admin config this as well |
||
115 | $xsitename = $GLOBALS['xoopsConfig']['sitename']; //adding site title as sender (mod config this?) |
||
116 | |||
117 | // set from name / email for registered user |
||
118 | if ($GLOBALS['xoopsUser'] instanceof XoopsUser) { |
||
0 ignored issues
–
show
The class
XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
119 | $semail = $GLOBALS['xoopsUser']->getVar('email'); |
||
120 | $sname = ucfirst($GLOBALS['xoopsUser']->getVar('uname')); |
||
121 | $sname = ('' == $sname) ? $GLOBALS['xoopsUser']->getVar('name') : $sname; |
||
122 | } |
||
123 | // check to see if email for recipient and sender are 'sane' |
||
124 | if (!filter_var($fremail, FILTER_VALIDATE_EMAIL) || !filter_var($semail, FILTER_VALIDATE_EMAIL)) { |
||
125 | redirect_header('index.php', 2, _MD_MYLINKS_INVALIDEMAIL); |
||
126 | } |
||
127 | // set the url to the link |
||
128 | if ($lid > 0) { |
||
129 | $linkurl = $GLOBALS['xoops']->url('modules/' . $GLOBALS['xoopsModule']->getVar('dirname') . "/singlelink.php?lid={$lid}"); |
||
130 | // now check to make sure that the link the user is sharing is valid |
||
131 | $result = $GLOBALS['xoopsDB']->query("SELECT title FROM {$GLOBALS['xoopsDB']->prefix('mylinks_links')} WHERE `lid` = '{$lid}' AND status>0 LIMIT 0,1"); |
||
132 | View Code Duplication | if ($result) { |
|
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. ![]() |
|||
133 | list($linktitle) = $GLOBALS['xoopsDB']->fetchRow($result); |
||
134 | $linktitle = $myts->stripSlashesGPC($linktitle); |
||
135 | } else { |
||
136 | // invalid (or inactive) link, can't send this to a friend |
||
137 | redirect_header('index.php', 3, _MD_MYLINKS_INVALIDORINACTIVELNK); |
||
138 | exit(); |
||
139 | } |
||
140 | } else { |
||
141 | redirect_header('index.php', 3, _MD_MYLINKS_INVALIDORINACTIVELNK); |
||
142 | exit(); |
||
143 | } |
||
144 | |||
145 | $subject = sprintf(_MD_MYLINKS_EMAIL_SUBJECT, $xsitename, $sname); |
||
146 | |||
147 | //now send mail to friend |
||
148 | $xMailer =& xoops_getMailer(); |
||
149 | $xMailer->useMail(); // Set it to use email (as opposed to PM) |
||
150 | $xMailer->setTemplateDir($GLOBALS['xoops']->path('modules' . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR . $GLOBALS['xoopsModule']->getVar('dirname') . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR . $GLOBALS['xoopsConfig']['language'] . DIRECTORY_SEPARATOR . 'mail_template' |
||
151 | . DIRECTORY_SEPARATOR)); |
||
152 | $xMailer->setTemplate('tellafriend_mail.tpl'); |
||
153 | |||
154 | // set common mail template variables |
||
155 | $xMailer->assign(array( |
||
156 | 'SNAME' => $sname, |
||
157 | 'SEMAIL' => $semail, |
||
158 | 'X_ADMINMAIL' => $xadminmail, |
||
159 | 'X_SITENAME' => $xsitename, |
||
160 | 'X_SITEURL' => $GLOBALS['xoops']->url('/'), |
||
161 | 'X_LINK_TITLE' => strip_tags(html_entity_decode($linktitle)), |
||
162 | 'X_LINK' => $linkurl, |
||
163 | 'FRNAME' => $frname, |
||
164 | 'COMMENTS' => strip_tags(html_entity_decode($comments)) |
||
165 | )); |
||
166 | |||
167 | $xMailer->setToEmails($fremail); |
||
168 | $xMailer->setFromEmail($xadminmail); |
||
169 | $xMailer->setFromName($xsitename); |
||
170 | $xMailer->setSubject($subject); |
||
171 | |||
172 | if ($xMailer->send()) { |
||
173 | //send was successful |
||
174 | redirect_header('index.php', 2, _MD_MYLINKS_MESSEND); |
||
175 | exit(); |
||
176 | } else { |
||
177 | redirect_header('index.php', 2, $xMailer->getErrors(true)); |
||
178 | exit(); |
||
179 | } |
||
180 | } |
||
181 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.