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