mambax7 /
adslight
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.
| 1 | <?php declare(strict_types=1); |
||
| 2 | |||
| 3 | /* |
||
| 4 | * You may not change or alter any portion of this comment or credits |
||
| 5 | * of supporting developers from this source code or any supporting source code |
||
| 6 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 7 | * |
||
| 8 | * This program is distributed in the hope that it will be useful, |
||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 11 | */ |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @copyright XOOPS Project (https://xoops.org) |
||
| 15 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 16 | * @author XOOPS Development Team |
||
| 17 | * @author Pascal Le Boustouller: original author ([email protected]) |
||
| 18 | * @author Luc Bizet (www.frxoops.org) |
||
| 19 | * @author jlm69 (www.jlmzone.com) |
||
| 20 | * @author mamba (www.xoops.org) |
||
| 21 | */ |
||
| 22 | |||
| 23 | use Xmf\Request; |
||
| 24 | use XoopsModules\Adslight\{ |
||
| 25 | Helper, |
||
| 26 | Utility |
||
| 27 | }; |
||
| 28 | |||
| 29 | /** @var Helper $helper */ |
||
| 30 | |||
| 31 | require __DIR__ . '/header.php'; |
||
| 32 | /** |
||
| 33 | * @param $lid |
||
| 34 | */ |
||
| 35 | function sendFriend($lid): void |
||
| 36 | { |
||
| 37 | global $xoopsDB, $xoopsTheme, $xoopsLogger; |
||
| 38 | $helper = Helper::getInstance(); |
||
| 39 | $idd = $idde = $iddee = ''; |
||
|
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
| 40 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
| 41 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 42 | $GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow'); |
||
| 43 | |||
| 44 | $sql = 'SELECT lid, title, type FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid={$lid}"; |
||
| 45 | $result = $xoopsDB->query($sql); |
||
| 46 | if (!$xoopsDB->isResultSet($result)) { |
||
| 47 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 48 | } |
||
| 49 | [$lid, $title, $type] = $xoopsDB->fetchRow($result); |
||
| 50 | |||
| 51 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'> |
||
| 52 | <strong>" . _ADSLIGHT_SENDTO . " {$lid} \"<strong>{$type} : {$title}</strong>\" " . _ADSLIGHT_FRIEND . "<br><br> |
||
| 53 | <form action=\"sendfriend.php\" method=post> |
||
| 54 | <input type=\"hidden\" name=\"lid\" value=\"{$lid}\" >"; |
||
| 55 | |||
| 56 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||
| 57 | $idd = $GLOBALS['xoopsUser']->getVar('uname', 'E'); |
||
| 58 | $idde = $GLOBALS['xoopsUser']->getVar('email', 'E'); |
||
| 59 | } |
||
| 60 | |||
| 61 | echo " |
||
| 62 | <table width='99%' class='outer' cellspacing='1'> |
||
| 63 | <tr> |
||
| 64 | <td class='head' width='30%'>" . _ADSLIGHT_NAME . " </td> |
||
| 65 | <td class='even'><input class='textbox' type='text' name='yname' value='{$idd}' ></td> |
||
| 66 | </tr> |
||
| 67 | <tr> |
||
| 68 | <td class='head'>" . _ADSLIGHT_MAIL . " </td> |
||
| 69 | <td class='even'><input class='textbox' type='text' name='ymail' value='{$idde}' ></td> |
||
| 70 | </tr> |
||
| 71 | <tr> |
||
| 72 | <td class='head'>" . _ADSLIGHT_NAMEFR . " </td> |
||
| 73 | <td class='even'><input class='textbox' type='text' name='fname' ></td> |
||
| 74 | </tr> |
||
| 75 | <tr> |
||
| 76 | <td class='head'>" . _ADSLIGHT_MAILFR . " </td> |
||
| 77 | <td class='even'><input class='textbox' type='text' name='fmail' ></td> |
||
| 78 | </tr>"; |
||
| 79 | |||
| 80 | if ('1' === $helper->getConfig('adslight_use_captcha')) { |
||
| 81 | echo "<tr><td class='head'>" . _ADSLIGHT_CAPTCHA . " </td><td class='even'>"; |
||
| 82 | $jlm_captcha = new \XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, 'xoopscaptcha', false); |
||
| 83 | echo $jlm_captcha->render(); |
||
| 84 | echo '</td></tr>'; |
||
| 85 | } |
||
| 86 | |||
| 87 | echo '</table><br> |
||
| 88 | <input type=hidden name=op value=MailAd> |
||
| 89 | <input type=submit value=' . _ADSLIGHT_SENDFR . '> |
||
| 90 | </form></td></tr></table>'; |
||
| 91 | } |
||
| 92 | |||
| 93 | /** |
||
| 94 | * @param $lid |
||
| 95 | * @param $yname |
||
| 96 | * @param $ymail |
||
| 97 | * @param $fname |
||
| 98 | * @param $fmail |
||
| 99 | */ |
||
| 100 | function mailAd($lid, $yname, $ymail, $fname, $fmail): void |
||
| 101 | { |
||
| 102 | global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts; |
||
| 103 | $helper = Helper::getInstance(); |
||
| 104 | |||
| 105 | if ('1' === $helper->getConfig('adslight_use_captcha')) { |
||
| 106 | xoops_load('xoopscaptcha'); |
||
| 107 | $xoopsCaptcha = XoopsCaptcha::getInstance(); |
||
| 108 | $helper = Helper::getInstance(); |
||
| 109 | if (!$xoopsCaptcha->verify()) { |
||
| 110 | $helper->redirect('index.php', 2, $xoopsCaptcha->getMessage()); |
||
| 111 | } |
||
| 112 | } |
||
| 113 | |||
| 114 | $sql = 'SELECT lid, title, expire, type, desctext, tel, price, typeprice, date_created, email, submitter, town, country, photo FROM ' . $xoopsDB->prefix('adslight_listing') . ' WHERE lid=' . $xoopsDB->escape($lid); |
||
| 115 | $result = $xoopsDB->query($sql); |
||
| 116 | if (!$xoopsDB->isResultSet($result)) { |
||
| 117 | \trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
||
| 118 | } |
||
| 119 | [$lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date_created, $email, $submitter, $town, $country, $photo] = $xoopsDB->fetchRow($result); |
||
| 120 | |||
| 121 | $title = $GLOBALS['xoopsDB']->escape($title); |
||
| 122 | $expire = $GLOBALS['xoopsDB']->escape($expire); |
||
|
0 ignored issues
–
show
|
|||
| 123 | $type = $GLOBALS['xoopsDB']->escape($type); |
||
| 124 | $desctext = $myts->displayTarea($desctext, 1, 1, 1, 1, 1); |
||
| 125 | $tel = $GLOBALS['xoopsDB']->escape($tel); |
||
| 126 | $price = $GLOBALS['xoopsDB']->escape($price); |
||
| 127 | $typeprice = $GLOBALS['xoopsDB']->escape($typeprice); |
||
| 128 | $submitter = $GLOBALS['xoopsDB']->escape($submitter); |
||
|
0 ignored issues
–
show
|
|||
| 129 | $town = $GLOBALS['xoopsDB']->escape($town); |
||
| 130 | $country = $GLOBALS['xoopsDB']->escape($country); |
||
| 131 | |||
| 132 | $tags = []; |
||
| 133 | $tags['YNAME'] = stripslashes($yname); |
||
| 134 | $tags['YMAIL'] = $ymail; |
||
| 135 | $tags['FNAME'] = stripslashes($fname); |
||
| 136 | $tags['FMAIL'] = $fmail; |
||
| 137 | $tags['HELLO'] = _ADSLIGHT_HELLO; |
||
| 138 | $tags['LID'] = $lid; |
||
| 139 | $tags['LISTING_NUMBER'] = _ADSLIGHT_LISTING_NUMBER; |
||
| 140 | $tags['TITLE'] = $title; |
||
| 141 | $tags['TYPE'] = Utility::getNameType($type); |
||
| 142 | $tags['DESCTEXT'] = $desctext; |
||
| 143 | $tags['PRICE'] = $price; |
||
| 144 | $tags['TYPEPRICE'] = $typeprice; |
||
| 145 | $tags['TEL'] = $tel; |
||
| 146 | $tags['TOWN'] = $town; |
||
| 147 | $tags['COUNTRY'] = $country; |
||
| 148 | $tags['OTHER'] = _ADSLIGHT_INTERESS . $xoopsConfig['sitename']; |
||
| 149 | $tags['LISTINGS'] = XOOPS_URL . '/modules/adslight/'; |
||
| 150 | $tags['LINK_URL'] = XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid; |
||
| 151 | $tags['THINKS_INTERESTING'] = _ADSLIGHT_MESSAGE; |
||
| 152 | $tags['NO_MAIL'] = _ADSLIGHT_NOMAIL; |
||
| 153 | $tags['YOU_CAN_VIEW_BELOW'] = _ADSLIGHT_YOU_CAN_VIEW_BELOW; |
||
| 154 | $tags['WEBMASTER'] = _ADSLIGHT_WEBMASTER; |
||
| 155 | $tags['NO_REPLY'] = _ADSLIGHT_NOREPLY; |
||
| 156 | $subject = _ADSLIGHT_SUBJET . ' ' . $xoopsConfig['sitename']; |
||
| 157 | $xoopsMailer = xoops_getMailer(); |
||
| 158 | $xoopsMailer->multimailer->isHTML(true); |
||
| 159 | $xoopsMailer->useMail(); |
||
| 160 | $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/'); |
||
| 161 | $xoopsMailer->setTemplate('listing_send_friend.tpl'); |
||
| 162 | $xoopsMailer->setFromEmail($ymail); |
||
| 163 | $xoopsMailer->setToEmails($fmail); |
||
| 164 | $xoopsMailer->setSubject($subject); |
||
| 165 | $xoopsMailer->assign($tags); |
||
| 166 | $xoopsMailer->send(); |
||
| 167 | echo $xoopsMailer->getErrors(); |
||
| 168 | $helper->redirect('index.php', 3, _ADSLIGHT_ANNSEND); |
||
| 169 | } |
||
| 170 | |||
| 171 | ############################################################## |
||
| 172 | $yname = Request::getString('yname', '', 'POST'); |
||
| 173 | $ymail = Request::getString('ymail', '', 'POST'); |
||
| 174 | $fname = Request::getString('fname', '', 'POST'); |
||
| 175 | $fmail = Request::getString('fmail', '', 'POST'); |
||
| 176 | |||
| 177 | $lid = Request::getInt('lid', 0); |
||
| 178 | $op = Request::getString('op', ''); |
||
| 179 | |||
| 180 | switch ($op) { |
||
| 181 | case 'SendFriend': |
||
| 182 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
| 183 | sendFriend($lid); |
||
| 184 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
| 185 | break; |
||
| 186 | case 'MailAd': |
||
| 187 | mailAd($lid, $yname, $ymail, $fname, $fmail); |
||
| 188 | break; |
||
| 189 | default: |
||
| 190 | $helper->redirect('index.php', 1, ' ' . _RETURNANN . ' '); |
||
| 191 | break; |
||
| 192 | } |
||
| 193 |