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