mambax7 /
adslight
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 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; |
||
| 24 | |||
| 25 | if ('' != Request::getString('submit', '', 'POST')) { |
||
| 26 | // Define Variables for register_globals Off. contribution by Peekay |
||
| 27 | $id = Request::getString('id', null); |
||
| 28 | $date = Request::getString('date', null); |
||
| 29 | $namep = Request::getString('namep', null); |
||
| 30 | $ipnumber = Request::getString('ipnumber', null); |
||
| 31 | $messtext = Request::getString('messtext', null); |
||
| 32 | $typeprice = Request::getString('typeprice', null); |
||
| 33 | $price = Request::getString('price', null); |
||
| 34 | $tele = Request::getString('tele', null); |
||
| 35 | // end define vars |
||
| 36 | |||
| 37 | include_once __DIR__ . '/header.php'; |
||
| 38 | |||
| 39 | $module_id = $xoopsModule->getVar('mid'); |
||
| 40 | |||
| 41 | View Code Duplication | if (is_object($GLOBALS['xoopsUser'])) { |
|
| 42 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||
| 43 | } else { |
||
| 44 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
| 45 | } |
||
| 46 | /** @var XoopsGroupPermHandler $gpermHandler */ |
||
| 47 | $gpermHandler = xoops_getHandler('groupperm'); |
||
| 48 | |||
| 49 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||
| 50 | |||
| 51 | //If no access |
||
| 52 | View Code Duplication | if (!$gpermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
|
| 53 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
| 54 | } |
||
| 55 | global $xoopsConfig, $xoopsDB, $myts, $meta; |
||
| 56 | require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||
| 57 | |||
| 58 | if (!$xoopsGTicket->check(true, 'token')) { |
||
| 59 | redirect_header(XOOPS_URL . '/modules/adslight/viewads.php?lid=' . addslashes($id) . '', 3, $xoopsGTicket->getErrors()); |
||
| 60 | } |
||
| 61 | View Code Duplication | if ($GLOBALS['xoopsModuleConfig']['adslight_use_captcha'] == '1') { |
|
| 62 | xoops_load('xoopscaptcha'); |
||
| 63 | $xoopsCaptcha = XoopsCaptcha::getInstance(); |
||
| 64 | if (!$xoopsCaptcha->verify()) { |
||
| 65 | redirect_header(XOOPS_URL . '/modules/adslight/contact.php?lid=' . addslashes($id) . '', 2, $xoopsCaptcha->getMessage()); |
||
| 66 | } |
||
| 67 | } |
||
| 68 | $lid = Request::getInt('id', 0, 'POST'); |
||
| 69 | $result = $xoopsDB->query('SELECT email, submitter, title, type, desctext, price, typeprice FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid = ' . $xoopsDB->escape($id)); |
||
| 70 | |||
| 71 | while (list($email, $submitter, $title, $type, $desctext, $price, $typeprice) = $xoopsDB->fetchRow($result)) { |
||
| 72 | $teles = Request::getString('tele', '', 'POST'); |
||
| 73 | |||
| 74 | View Code Duplication | if ($price) { |
|
| 75 | $price = '' . _ADSLIGHT_PRICE . ' ' . $GLOBALS['xoopsModuleConfig']['adslight_money'] . " $price"; |
||
| 76 | } else { |
||
| 77 | $price = ''; |
||
| 78 | } |
||
| 79 | |||
| 80 | $date = time(); |
||
| 81 | $r_usid = $GLOBALS['xoopsUser']->getVar('uid', 'E'); |
||
| 82 | |||
| 83 | $tags = array(); |
||
| 84 | $tags['TITLE'] = $title; |
||
| 85 | $tags['TYPE'] = AdslightUtilities::getNameType($type); |
||
| 86 | $tags['PRICE'] = $price; |
||
| 87 | $tags['DESCTEXT'] = stripslashes($desctext); |
||
| 88 | $tags['MY_SITENAME'] = $xoopsConfig['sitename']; |
||
| 89 | $tags['REPLY_ON'] = _ADSLIGHT_REMINDANN; |
||
| 90 | $tags['DESCRIPT'] = _ADSLIGHT_DESC; |
||
| 91 | $tags['STARTMESS'] = _ADSLIGHT_STARTMESS; |
||
| 92 | $tags['MESSFROM'] = _ADSLIGHT_MESSFROM; |
||
| 93 | $tags['CANJOINT'] = _ADSLIGHT_CANJOINT; |
||
| 94 | $tags['NAMEP'] = Request::getString('namep', '', 'POST'); |
||
| 95 | $tags['TO'] = _ADSLIGHT_TO; |
||
| 96 | $tags['POST'] = "<a href=\"mailto:" . Request::getString('post', '', 'POST') . "\">" . Request::getString('post', '', 'POST') . '</a>'; |
||
| 97 | $tags['TELE'] = $teles; |
||
| 98 | $tags['MESSAGE_END'] = _ADSLIGHT_MESSAGE_END; |
||
| 99 | $tags['ENDMESS'] = _ADSLIGHT_ENDMESS; |
||
| 100 | $tags['SECURE_SEND'] = _ADSLIGHT_SECURE_SEND; |
||
| 101 | $tags['SUBMITTER'] = $submitter; |
||
| 102 | $tags['MESSTEXT'] = stripslashes($messtext); |
||
| 103 | $tags['EMAIL'] = _ADSLIGHT_EMAIL; |
||
| 104 | $tags['TEL'] = _ADSLIGHT_TEL; |
||
| 105 | $tags['HELLO'] = _ADSLIGHT_HELLO; |
||
| 106 | $tags['REPLIED_BY'] = _ADSLIGHT_REPLIED_BY; |
||
| 107 | $tags['YOUR_AD'] = _ADSLIGHT_YOUR_AD; |
||
| 108 | $tags['THANKS'] = _ADSLIGHT_THANKS; |
||
| 109 | $tags['WEBMASTER'] = _ADSLIGHT_WEBMASTER; |
||
| 110 | $tags['SITE_URL'] = "<a href=\"" . XOOPS_URL . "\">" . XOOPS_URL . '</a>'; |
||
| 111 | $tags['AT'] = _ADSLIGHT_AT; |
||
| 112 | $tags['LINK_URL'] = "<a href=\"" |
||
| 113 | . XOOPS_URL |
||
| 114 | . '/modules/' |
||
| 115 | . $xoopsModule->getVar('dirname') |
||
| 116 | . '/viewads.php?lid=' |
||
| 117 | . addslashes($id) |
||
| 118 | . "\">" |
||
| 119 | . XOOPS_URL |
||
| 120 | . '/modules/' |
||
| 121 | . $xoopsModule->getVar('dirname') |
||
| 122 | . '/viewads.php?lid=' |
||
| 123 | . addslashes($id) |
||
| 124 | . '</a>'; |
||
| 125 | $tags['VIEW_AD'] = _ADSLIGHT_VIEW_AD; |
||
| 126 | |||
| 127 | $subject = '' . _ADSLIGHT_CONTACTAFTERANN . ''; |
||
| 128 | $mail =& xoops_getMailer(); |
||
| 129 | |||
| 130 | $mail->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/'); |
||
| 131 | $mail->setTemplate('listing_contact.tpl'); |
||
| 132 | |||
| 133 | $mail->useMail(); |
||
| 134 | $mail->setFromEmail(Request::getString('post', '', 'POST')); |
||
| 135 | $mail->setToEmails($email); |
||
| 136 | $mail->setSubject($subject); |
||
| 137 | $mail->multimailer->isHTML(true); |
||
| 138 | $mail->assign($tags); |
||
| 139 | // $mail->setBody(stripslashes("$message")); |
||
|
0 ignored issues
–
show
|
|||
| 140 | $mail->send(); |
||
| 141 | echo $mail->getErrors(); |
||
| 142 | |||
| 143 | $xoopsDB->query('INSERT INTO ' . $xoopsDB->prefix('adslight_ip_log') . " values ( '', '$lid', '$date', '$namep', '$ipnumber', '" . Request::getString('post', '', 'POST') . "')"); |
||
| 144 | |||
| 145 | $xoopsDB->query('INSERT INTO ' . $xoopsDB->prefix('adslight_replies') . " values ('','$id', '$title', '$date', '$namep', '$messtext', '$tele', '" . Request::getString('post', '', 'POST') . "', '$r_usid')"); |
||
| 146 | |||
| 147 | redirect_header('index.php', 3, _ADSLIGHT_MESSEND); |
||
| 148 | } |
||
| 149 | } else { |
||
| 150 | $lid = Request::getInt('lid', 0, 'GET'); |
||
| 151 | $idd = $idde = $iddee = ''; |
||
| 152 | include_once __DIR__ . '/header.php'; |
||
| 153 | |||
| 154 | global $xoopsConfig, $xoopsDB, $myts, $meta; |
||
| 155 | |||
| 156 | $module_id = $xoopsModule->getVar('mid'); |
||
| 157 | View Code Duplication | if (is_object($GLOBALS['xoopsUser'])) { |
|
| 158 | $groups = $GLOBALS['xoopsUser']->getGroups(); |
||
| 159 | } else { |
||
| 160 | $groups = XOOPS_GROUP_ANONYMOUS; |
||
| 161 | } |
||
| 162 | /** @var XoopsGroupPermHandler $gpermHandler */ |
||
| 163 | $gpermHandler = xoops_getHandler('groupperm'); |
||
| 164 | $perm_itemid = Request::getInt('item_id', 0, 'POST'); |
||
| 165 | //If no access |
||
| 166 | View Code Duplication | if (!$gpermHandler->checkRight('adslight_view', $perm_itemid, $groups, $module_id)) { |
|
| 167 | redirect_header(XOOPS_URL . '/index.php', 3, _NOPERM); |
||
| 168 | } |
||
| 169 | |||
| 170 | require_once XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php'; |
||
| 171 | include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 172 | |||
| 173 | include XOOPS_ROOT_PATH . '/header.php'; |
||
| 174 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'>\n"; |
||
| 175 | $time = time(); |
||
| 176 | $ipnumber = "$_SERVER[REMOTE_ADDR]"; |
||
| 177 | echo "<script type=\"text/javascript\"> |
||
| 178 | function verify() |
||
| 179 | { |
||
| 180 | var msg = \"" . _ADSLIGHT_VALIDERORMSG . "\\n__________________________________________________\\n\\n\"; |
||
| 181 | var errors = \"FALSE\"; |
||
| 182 | if (window.document.cont.namep.value == \"\") { |
||
| 183 | errors = \"TRUE\"; |
||
| 184 | msg += \"" . _ADSLIGHT_VALIDSUBMITTER . "\\n\"; |
||
| 185 | } |
||
| 186 | if (window.document.cont.post.value == \"\") { |
||
| 187 | errors = \"TRUE\"; |
||
| 188 | msg += \"" . _ADSLIGHT_VALIDEMAIL . "\\n\"; |
||
| 189 | } |
||
| 190 | if (window.document.cont.messtext.value == \"\") { |
||
| 191 | errors = \"TRUE\"; |
||
| 192 | msg += \"" . _ADSLIGHT_VALIDMESS . "\\n\"; |
||
| 193 | } |
||
| 194 | if (errors == \"TRUE\") { |
||
| 195 | msg += \"__________________________________________________\\n\\n" . _ADSLIGHT_VALIDMSG . "\\n\"; |
||
| 196 | alert(msg); |
||
| 197 | |||
| 198 | return false; |
||
| 199 | } |
||
| 200 | } |
||
| 201 | </script>"; |
||
| 202 | |||
| 203 | echo '<b>' . _ADSLIGHT_CONTACTAUTOR . '</b><br><br>'; |
||
| 204 | echo '' . _ADSLIGHT_TEXTAUTO . '<br>'; |
||
| 205 | echo "<form onSubmit=\"return verify();\" method=\"post\" action=\"contact.php\" name=\"cont\">"; |
||
| 206 | echo "<input type=\"hidden\" name=\"id\" value=\"$lid\" />"; |
||
| 207 | echo "<input type=\"hidden\" name=\"submit\" value=\"1\" />"; |
||
| 208 | echo "<table width='100%' class='outer' cellspacing='1'> |
||
| 209 | <tr> |
||
| 210 | <td class='head'>" . _ADSLIGHT_YOURNAME . '</td>'; |
||
| 211 | if ($GLOBALS['xoopsUser']) { |
||
| 212 | $idd = $GLOBALS['xoopsUser']->getVar('uname', 'E'); |
||
| 213 | $idde = $GLOBALS['xoopsUser']->getVar('email', 'E'); |
||
| 214 | |||
| 215 | echo "<td class='even'><input type=\"text\" name=\"namep\" size=\"42\" value=\"$idd\" />"; |
||
| 216 | } else { |
||
| 217 | echo "<td class='even'><input type=\"text\" name=\"namep\" size=\"42\" /></td>"; |
||
| 218 | } |
||
| 219 | echo "</tr> |
||
| 220 | <tr> |
||
| 221 | <td class='head'>" . _ADSLIGHT_YOUREMAIL . "</td> |
||
| 222 | <td class='even'><input type=\"text\" name=\"post\" size=\"42\" value=\"$idde\" /></font></td> |
||
| 223 | </tr> |
||
| 224 | <tr> |
||
| 225 | <td class='head'>" . _ADSLIGHT_YOURPHONE . "</td> |
||
| 226 | <td class='even'><input type=\"text\" name=\"tele\" size=\"42\" /></font></td> |
||
| 227 | </tr> |
||
| 228 | <tr> |
||
| 229 | <td class='head'>" . _ADSLIGHT_YOURMESSAGE . "</td> |
||
| 230 | <td class='even'><textarea rows=\"5\" name=\"messtext\" cols=\"40\" /></textarea></td> |
||
| 231 | </tr>"; |
||
| 232 | if ($GLOBALS['xoopsModuleConfig']['adslight_use_captcha'] == '1') { |
||
| 233 | echo "<tr><td class='head'>" . _ADSLIGHT_CAPTCHA . " </td><td class='even'>"; |
||
| 234 | $jlm_captcha = ''; |
||
| 235 | $jlm_captcha = new XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, 'xoopscaptcha', false); |
||
| 236 | echo $jlm_captcha->render(); |
||
| 237 | } |
||
| 238 | |||
| 239 | echo '</td></tr></table>'; |
||
| 240 | echo "<table class='outer'><tr><td>" . _ADSLIGHT_YOUR_IP . " |
||
| 241 | <img src=\"" . XOOPS_URL . "/modules/adslight/ip_image.php\" alt=\"\" /><br>" . _ADSLIGHT_IP_LOGGED . ' |
||
| 242 | </td></tr></table> |
||
| 243 | <br>'; |
||
| 244 | echo "<input type=\"hidden\" name=\"ip_id\" value=\"\" />"; |
||
| 245 | echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\" />"; |
||
| 246 | echo "<input type=\"hidden\" name=\"ipnumber\" value=\"$ipnumber\" />"; |
||
| 247 | echo "<input type=\"hidden\" name=\"date\" value=\"$time\" />"; |
||
| 248 | echo "<p><input type=\"submit\" name=\"submit\" value=\"" . _ADSLIGHT_SENDFR . "\" /></p> |
||
| 249 | " . $GLOBALS['xoopsGTicket']->getTicketHtml(__LINE__, 1800, 'token') . ' |
||
| 250 | </form>'; |
||
| 251 | } |
||
| 252 | echo '</td></tr></table>'; |
||
| 253 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
| 254 |
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.