1 | <?php |
||||||
0 ignored issues
–
show
|
|||||||
2 | /* |
||||||
3 | ------------------------------------------------------------------------- |
||||||
4 | ADSLIGHT 2 : Module for Xoops |
||||||
5 | |||||||
6 | Redesigned and ameliorate By Luc Bizet user at www.frxoops.org |
||||||
7 | Started with the Classifieds module and made MANY changes |
||||||
8 | Website : http://www.luc-bizet.fr |
||||||
9 | Contact : [email protected] |
||||||
10 | ------------------------------------------------------------------------- |
||||||
11 | Original credits below Version History |
||||||
12 | ########################################################################## |
||||||
13 | # Classified Module for Xoops # |
||||||
14 | # By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com # |
||||||
15 | # Started with the MyAds module and made MANY changes # |
||||||
16 | ########################################################################## |
||||||
17 | Original Author: Pascal Le Boustouller |
||||||
18 | Author Website : [email protected] |
||||||
19 | Licence Type : GPL |
||||||
20 | ------------------------------------------------------------------------- |
||||||
21 | */ |
||||||
22 | |||||||
23 | use Xmf\Request; |
||||||
0 ignored issues
–
show
The type
Xmf\Request was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
24 | use XoopsModules\Adslight; |
||||||
25 | |||||||
26 | require_once __DIR__ . '/header.php'; |
||||||
27 | //require XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||||||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
36% 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. ![]() |
|||||||
28 | //include XOOPS_ROOT_PATH . '/modules/adslight/class/Utility.php'; |
||||||
29 | |||||||
30 | /** |
||||||
31 | * @param $lid |
||||||
32 | */ |
||||||
33 | function SendFriend($lid) |
||||||
34 | { |
||||||
35 | global $xoopsConfig, $xoopsDB, $xoopsTheme, $xoopsLogger, $moduleDirName, $main_lang; |
||||||
36 | $idd = $idde = $iddee = ''; |
||||||
37 | include XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||||
0 ignored issues
–
show
|
|||||||
38 | include XOOPS_ROOT_PATH . '/header.php'; |
||||||
39 | $GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow'); |
||||||
40 | |||||||
41 | $result = $xoopsDB->query('SELECT lid, title, type FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid={$lid}"); |
||||||
42 | list($lid, $title, $type) = $xoopsDB->fetchRow($result); |
||||||
43 | |||||||
44 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'> |
||||||
45 | <strong>" . _ADSLIGHT_SENDTO . " $lid \"<strong>$type : $title</strong>\" " . _ADSLIGHT_FRIEND . "<br><br> |
||||||
46 | <form action=\"sendfriend.php\" method=post> |
||||||
47 | <input type=\"hidden\" name=\"lid\" value=\"$lid\" >"; |
||||||
48 | |||||||
49 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||||||
0 ignored issues
–
show
The type
XoopsUser was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
50 | $idd = $GLOBALS['xoopsUser']->getVar('uname', 'E'); |
||||||
51 | $idde = $GLOBALS['xoopsUser']->getVar('email', 'E'); |
||||||
52 | } |
||||||
53 | |||||||
54 | echo " |
||||||
55 | <table width='99%' class='outer' cellspacing='1'> |
||||||
56 | <tr> |
||||||
57 | <td class='head' width='30%'>" . _ADSLIGHT_NAME . " </td> |
||||||
58 | <td class='even'><input class='textbox' type='text' name='yname' value='$idd' ></td> |
||||||
59 | </tr> |
||||||
60 | <tr> |
||||||
61 | <td class='head'>" . _ADSLIGHT_MAIL . " </td> |
||||||
62 | <td class='even'><input class='textbox' type='text' name='ymail' value='$idde' ></td> |
||||||
63 | </tr> |
||||||
64 | <tr> |
||||||
65 | <td class='head'>" . _ADSLIGHT_NAMEFR . " </td> |
||||||
66 | <td class='even'><input class='textbox' type='text' name='fname' ></td> |
||||||
67 | </tr> |
||||||
68 | <tr> |
||||||
69 | <td class='head'>" . _ADSLIGHT_MAILFR . " </td> |
||||||
70 | <td class='even'><input class='textbox' type='text' name='fmail' ></td> |
||||||
71 | </tr>"; |
||||||
72 | |||||||
73 | if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_use_captcha']) { |
||||||
74 | echo "<tr><td class='head'>" . _ADSLIGHT_CAPTCHA . " </td><td class='even'>"; |
||||||
75 | $jlm_captcha = ''; |
||||||
76 | $jlm_captcha = new \XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, 'xoopscaptcha', false); |
||||||
0 ignored issues
–
show
The type
XoopsFormCaptcha was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
77 | echo $jlm_captcha->render(); |
||||||
78 | echo '</td></tr>'; |
||||||
79 | } |
||||||
80 | |||||||
81 | echo '</table><br> |
||||||
82 | <input type=hidden name=op value=MailAd> |
||||||
83 | <input type=submit value=' . _ADSLIGHT_SENDFR . '> |
||||||
84 | </form></td></tr></table>'; |
||||||
85 | } |
||||||
86 | |||||||
87 | /** |
||||||
88 | * @param $lid |
||||||
89 | * @param $yname |
||||||
90 | * @param $ymail |
||||||
91 | * @param $fname |
||||||
92 | * @param $fmail |
||||||
93 | */ |
||||||
94 | function MailAd($lid, $yname, $ymail, $fname, $fmail) |
||||||
95 | { |
||||||
96 | global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts, $xoopsLogger, $moduleDirName, $main_lang; |
||||||
97 | |||||||
98 | if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_use_captcha']) { |
||||||
99 | xoops_load('xoopscaptcha'); |
||||||
0 ignored issues
–
show
The function
xoops_load was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
100 | $xoopsCaptcha = XoopsCaptcha::getInstance(); |
||||||
0 ignored issues
–
show
The type
XoopsCaptcha was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||||
101 | if (!$xoopsCaptcha->verify()) { |
||||||
102 | redirect_header(XOOPS_URL . '/modules/adslight/index.php', 2, $xoopsCaptcha->getMessage()); |
||||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
103 | } |
||||||
104 | } |
||||||
105 | |||||||
106 | $result = $xoopsDB->query('SELECT lid, title, expire, type, desctext, tel, price, typeprice, date, email, submitter, town, country, photo FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid)); |
||||||
107 | list($lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date, $email, $submitter, $town, $country, $photo) = $xoopsDB->fetchRow($result); |
||||||
108 | |||||||
109 | $title = $myts->addSlashes($title); |
||||||
110 | $expire = $myts->addSlashes($expire); |
||||||
111 | $type = $myts->addSlashes($type); |
||||||
112 | $desctext = $myts->displayTarea($desctext, 1, 1, 1, 1, 1); |
||||||
113 | $tel = $myts->addSlashes($tel); |
||||||
114 | $price = $myts->addSlashes($price); |
||||||
115 | $typeprice = $myts->addSlashes($typeprice); |
||||||
116 | $submitter = $myts->addSlashes($submitter); |
||||||
117 | $town = $myts->addSlashes($town); |
||||||
118 | $country = $myts->addSlashes($country); |
||||||
119 | |||||||
120 | $tags = []; |
||||||
121 | $tags['YNAME'] = stripslashes($yname); |
||||||
122 | $tags['YMAIL'] = $ymail; |
||||||
123 | $tags['FNAME'] = stripslashes($fname); |
||||||
124 | $tags['FMAIL'] = $fmail; |
||||||
125 | $tags['HELLO'] = _ADSLIGHT_HELLO; |
||||||
126 | $tags['LID'] = $lid; |
||||||
127 | $tags['LISTING_NUMBER'] = _ADSLIGHT_LISTING_NUMBER; |
||||||
128 | $tags['TITLE'] = $title; |
||||||
129 | $tags['TYPE'] = Adslight\Utility::getNameType($type); |
||||||
130 | $tags['DESCTEXT'] = $desctext; |
||||||
131 | $tags['PRICE'] = $price; |
||||||
132 | $tags['TYPEPRICE'] = $typeprice; |
||||||
133 | $tags['TEL'] = $tel; |
||||||
134 | $tags['TOWN'] = $town; |
||||||
135 | $tags['COUNTRY'] = $country; |
||||||
136 | $tags['OTHER'] = '' . _ADSLIGHT_INTERESS . '' . $xoopsConfig['sitename'] . ''; |
||||||
137 | $tags['LISTINGS'] = XOOPS_URL . '/modules/adslight/'; |
||||||
138 | $tags['LINK_URL'] = XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid; |
||||||
139 | $tags['THINKS_INTERESTING'] = _ADSLIGHT_MESSAGE; |
||||||
140 | $tags['NO_MAIL'] = _ADSLIGHT_NOMAIL; |
||||||
141 | $tags['YOU_CAN_VIEW_BELOW'] = _ADSLIGHT_YOU_CAN_VIEW_BELOW; |
||||||
142 | $tags['WEBMASTER'] = _ADSLIGHT_WEBMASTER; |
||||||
143 | $tags['NO_REPLY'] = _ADSLIGHT_NOREPLY; |
||||||
144 | $subject = '' . _ADSLIGHT_SUBJET . ' ' . $xoopsConfig['sitename'] . ''; |
||||||
145 | $xoopsMailer = xoops_getMailer(); |
||||||
0 ignored issues
–
show
The function
xoops_getMailer was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
146 | $xoopsMailer->multimailer->isHTML(true); |
||||||
147 | $xoopsMailer->useMail(); |
||||||
148 | $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/'); |
||||||
0 ignored issues
–
show
|
|||||||
149 | $xoopsMailer->setTemplate('listing_send_friend.tpl'); |
||||||
150 | $xoopsMailer->setFromEmail($ymail); |
||||||
151 | $xoopsMailer->setToEmails($fmail); |
||||||
152 | $xoopsMailer->setSubject($subject); |
||||||
153 | $xoopsMailer->assign($tags); |
||||||
154 | $xoopsMailer->send(); |
||||||
155 | echo $xoopsMailer->getErrors(); |
||||||
156 | |||||||
157 | redirect_header('index.php', 3, _ADSLIGHT_ANNSEND); |
||||||
158 | } |
||||||
159 | |||||||
160 | ############################################################## |
||||||
161 | $yname = Request::getString('yname', '', 'POST'); |
||||||
162 | $ymail = Request::getString('ymail', '', 'POST'); |
||||||
163 | $fname = Request::getString('fname', '', 'POST'); |
||||||
164 | $fmail = Request::getString('fmail', '', 'POST'); |
||||||
165 | |||||||
166 | $lid = Request::getInt('lid', 0); |
||||||
167 | $op = Request::getString('op', ''); |
||||||
168 | |||||||
169 | switch ($op) { |
||||||
170 | |||||||
171 | case 'SendFriend': |
||||||
172 | include XOOPS_ROOT_PATH . '/header.php'; |
||||||
0 ignored issues
–
show
|
|||||||
173 | SendFriend($lid); |
||||||
174 | include XOOPS_ROOT_PATH . '/footer.php'; |
||||||
175 | break; |
||||||
176 | |||||||
177 | case 'MailAd': |
||||||
178 | MailAd($lid, $yname, $ymail, $fname, $fmail); |
||||||
179 | break; |
||||||
180 | |||||||
181 | default: |
||||||
182 | redirect_header('index.php', 1, ' ' . _RETURNANN . ' '); |
||||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
183 | break; |
||||||
184 | |||||||
185 | } |
||||||
186 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.