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