-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcomplaint.php
61 lines (52 loc) · 2.19 KB
/
complaint.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
<?php
/**
* 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.
*/
/**
* SmallWorld
*
* @copyright The XOOPS Project (https://xoops.org)
* @copyright 2011 Culex
* @license GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/)
* @package |XoopsModules\SmallWorld
* @since 1.0
* @author Michael Albertsen (http://culex.dk) <culex@culex.dk>
*/
use Xmf\Request;
use XoopsModules\Smallworld;
require_once __DIR__ . '/header.php';
/** @var \XoopsModules\Smallworld\Helper $helper */
require_once XOOPS_ROOT_PATH . '/class/template.php';
require_once $helper->path('include/functions.php');
require_once $helper->path('include/arrays.php');
$GLOBALS['xoopsLogger']->activated = false;
$swDB = new Smallworld\SwDatabase();
if ($GLOBALS['xoopsUser']) {
if (Request::hasVar('byuser', 'POST')) {
$by_userid = $GLOBALS['xoopsUser']->getVar('uid');
$a_user = addslashes(Request::getString('a_user', '', 'POST'));
$auserid = Request::getInt('auserid', 0, 'POST');
$byuser = Request::getInt('byuser', 0, 'POST');
$id = Request::getInt('id', 0, 'POST');
$name = addslashes(Request::getString('name', '', 'POST'));
$time = time();
$data = ['time' => $time, 'a_user' => $a_user, 'byuser' => $byuser, 'link' => $id, 'a_userid' => $auserid];
$already = $swDB->alreadycomplaint($id, $by_userid, $auserid);
if (1 != $already) {
$mail = new Smallworld\Mail();
if (0 !== $helper->getConfig('smallworldusemailnotis')) {
$mail->sendMails($by_userid, '', 'complaint', $link = null, $data);
}
$swDB->updateComplaint($auserid);
echo _SMALLWORLD_JS_COMPLAINTSENT;
} else {
echo _SMALLWORLD_JS_COMPLAINT_ALREADY_SENT;
}
}
}