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 | /** |
||
29 | * @param $lid |
||
30 | */ |
||
31 | function SendFriend($lid) |
||
32 | { |
||
33 | global $xoopsDB, $xoopsTheme, $xoopsLogger; |
||
34 | $idd = $idde = $iddee = ''; |
||
0 ignored issues
–
show
Unused Code
introduced
by
Loading history...
|
|||
35 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
36 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
37 | $GLOBALS['xoTheme']->addMeta('meta', 'robots', 'noindex, nofollow'); |
||
38 | |||
39 | $result = $xoopsDB->query('SELECT lid, title, type FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE lid={$lid}"); |
||
40 | list($lid, $title, $type) = $xoopsDB->fetchRow($result); |
||
41 | |||
42 | echo "<table width='100%' border='0' cellspacing='1' cellpadding='8'><tr class='bg4'><td valign='top'> |
||
43 | <strong>" . _ADSLIGHT_SENDTO . " $lid \"<strong>$type : $title</strong>\" " . _ADSLIGHT_FRIEND . "<br><br> |
||
44 | <form action=\"sendfriend.php\" method=post> |
||
45 | <input type=\"hidden\" name=\"lid\" value=\"$lid\" >"; |
||
46 | |||
47 | if ($GLOBALS['xoopsUser'] instanceof \XoopsUser) { |
||
48 | $idd = $GLOBALS['xoopsUser']->getVar('uname', 'E'); |
||
49 | $idde = $GLOBALS['xoopsUser']->getVar('email', 'E'); |
||
50 | } |
||
51 | |||
52 | echo " |
||
53 | <table width='99%' class='outer' cellspacing='1'> |
||
54 | <tr> |
||
55 | <td class='head' width='30%'>" . _ADSLIGHT_NAME . " </td> |
||
56 | <td class='even'><input class='textbox' type='text' name='yname' value='$idd' ></td> |
||
57 | </tr> |
||
58 | <tr> |
||
59 | <td class='head'>" . _ADSLIGHT_MAIL . " </td> |
||
60 | <td class='even'><input class='textbox' type='text' name='ymail' value='$idde' ></td> |
||
61 | </tr> |
||
62 | <tr> |
||
63 | <td class='head'>" . _ADSLIGHT_NAMEFR . " </td> |
||
64 | <td class='even'><input class='textbox' type='text' name='fname' ></td> |
||
65 | </tr> |
||
66 | <tr> |
||
67 | <td class='head'>" . _ADSLIGHT_MAILFR . " </td> |
||
68 | <td class='even'><input class='textbox' type='text' name='fmail' ></td> |
||
69 | </tr>"; |
||
70 | |||
71 | if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_use_captcha']) { |
||
72 | echo "<tr><td class='head'>" . _ADSLIGHT_CAPTCHA . " </td><td class='even'>"; |
||
73 | $jlm_captcha = ''; |
||
74 | $jlm_captcha = new \XoopsFormCaptcha(_ADSLIGHT_CAPTCHA, 'xoopscaptcha', false); |
||
75 | echo $jlm_captcha->render(); |
||
76 | echo '</td></tr>'; |
||
77 | } |
||
78 | |||
79 | echo '</table><br> |
||
80 | <input type=hidden name=op value=MailAd> |
||
81 | <input type=submit value=' . _ADSLIGHT_SENDFR . '> |
||
82 | </form></td></tr></table>'; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @param $lid |
||
87 | * @param $yname |
||
88 | * @param $ymail |
||
89 | * @param $fname |
||
90 | * @param $fmail |
||
91 | */ |
||
92 | function MailAd($lid, $yname, $ymail, $fname, $fmail) |
||
93 | { |
||
94 | global $xoopsConfig, $xoopsTpl, $xoopsDB, $xoopsModule, $myts; |
||
95 | |||
96 | if ('1' == $GLOBALS['xoopsModuleConfig']['adslight_use_captcha']) { |
||
97 | xoops_load('xoopscaptcha'); |
||
98 | $xoopsCaptcha = XoopsCaptcha::getInstance(); |
||
99 | if (!$xoopsCaptcha->verify()) { |
||
100 | redirect_header(XOOPS_URL . '/modules/adslight/index.php', 2, $xoopsCaptcha->getMessage()); |
||
101 | } |
||
102 | } |
||
103 | |||
104 | $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)); |
||
105 | list($lid, $title, $expire, $type, $desctext, $tel, $price, $typeprice, $date, $email, $submitter, $town, $country, $photo) = $xoopsDB->fetchRow($result); |
||
106 | |||
107 | $title = $myts->addSlashes($title); |
||
108 | $expire = $myts->addSlashes($expire); |
||
109 | $type = $myts->addSlashes($type); |
||
110 | $desctext = $myts->displayTarea($desctext, 1, 1, 1, 1, 1); |
||
111 | $tel = $myts->addSlashes($tel); |
||
112 | $price = $myts->addSlashes($price); |
||
113 | $typeprice = $myts->addSlashes($typeprice); |
||
114 | $submitter = $myts->addSlashes($submitter); |
||
115 | $town = $myts->addSlashes($town); |
||
116 | $country = $myts->addSlashes($country); |
||
117 | |||
118 | $tags = []; |
||
119 | $tags['YNAME'] = stripslashes($yname); |
||
120 | $tags['YMAIL'] = $ymail; |
||
121 | $tags['FNAME'] = stripslashes($fname); |
||
122 | $tags['FMAIL'] = $fmail; |
||
123 | $tags['HELLO'] = _ADSLIGHT_HELLO; |
||
124 | $tags['LID'] = $lid; |
||
125 | $tags['LISTING_NUMBER'] = _ADSLIGHT_LISTING_NUMBER; |
||
126 | $tags['TITLE'] = $title; |
||
127 | $tags['TYPE'] = Adslight\Utility::getNameType($type); |
||
128 | $tags['DESCTEXT'] = $desctext; |
||
129 | $tags['PRICE'] = $price; |
||
130 | $tags['TYPEPRICE'] = $typeprice; |
||
131 | $tags['TEL'] = $tel; |
||
132 | $tags['TOWN'] = $town; |
||
133 | $tags['COUNTRY'] = $country; |
||
134 | $tags['OTHER'] = '' . _ADSLIGHT_INTERESS . '' . $xoopsConfig['sitename'] . ''; |
||
135 | $tags['LISTINGS'] = XOOPS_URL . '/modules/adslight/'; |
||
136 | $tags['LINK_URL'] = XOOPS_URL . '/modules/adslight/viewads.php?lid=' . $lid; |
||
137 | $tags['THINKS_INTERESTING'] = _ADSLIGHT_MESSAGE; |
||
138 | $tags['NO_MAIL'] = _ADSLIGHT_NOMAIL; |
||
139 | $tags['YOU_CAN_VIEW_BELOW'] = _ADSLIGHT_YOU_CAN_VIEW_BELOW; |
||
140 | $tags['WEBMASTER'] = _ADSLIGHT_WEBMASTER; |
||
141 | $tags['NO_REPLY'] = _ADSLIGHT_NOREPLY; |
||
142 | $subject = '' . _ADSLIGHT_SUBJET . ' ' . $xoopsConfig['sitename'] . ''; |
||
143 | $xoopsMailer = xoops_getMailer(); |
||
144 | $xoopsMailer->multimailer->isHTML(true); |
||
145 | $xoopsMailer->useMail(); |
||
146 | $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/mail_template/'); |
||
147 | $xoopsMailer->setTemplate('listing_send_friend.tpl'); |
||
148 | $xoopsMailer->setFromEmail($ymail); |
||
149 | $xoopsMailer->setToEmails($fmail); |
||
150 | $xoopsMailer->setSubject($subject); |
||
151 | $xoopsMailer->assign($tags); |
||
152 | $xoopsMailer->send(); |
||
153 | echo $xoopsMailer->getErrors(); |
||
154 | |||
155 | redirect_header('index.php', 3, _ADSLIGHT_ANNSEND); |
||
156 | } |
||
157 | |||
158 | ############################################################## |
||
159 | $yname = Request::getString('yname', '', 'POST'); |
||
160 | $ymail = Request::getString('ymail', '', 'POST'); |
||
161 | $fname = Request::getString('fname', '', 'POST'); |
||
162 | $fmail = Request::getString('fmail', '', 'POST'); |
||
163 | |||
164 | $lid = Request::getInt('lid', 0); |
||
165 | $op = Request::getString('op', ''); |
||
166 | |||
167 | switch ($op) { |
||
168 | case 'SendFriend': |
||
169 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
170 | SendFriend($lid); |
||
171 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
172 | break; |
||
173 | case 'MailAd': |
||
174 | MailAd($lid, $yname, $ymail, $fname, $fmail); |
||
175 | break; |
||
176 | default: |
||
177 | redirect_header('index.php', 1, ' ' . _RETURNANN . ' '); |
||
178 | break; |
||
179 | } |
||
180 |