-
Notifications
You must be signed in to change notification settings - Fork 5
/
delete_message_ajax.php
45 lines (38 loc) · 1.68 KB
/
delete_message_ajax.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
<?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
*
* @package \XoopsModules\Smallworld
* @license GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/)
* @copyright The XOOPS Project (https://xoops.org)
* @copyright 2011 Culex
* @author Michael Albertsen (http://culex.dk) <[email protected]>
* @link https://github.com/XoopsModules25x/smallworld
* @since 1.0
*/
use Xmf\Request;
use XoopsModules\Smallworld;
require_once __DIR__ . '/header.php';
/** @var \XoopsModules\Smallworld\Helper $helper */
require_once $helper->path('include/functions.php');
$prevLogger = $GLOBALS['xoopsLogger']->activated;
$GLOBALS['xoopsLogger']->activated = false; // disable logger
$id = ($GLOBALS['xoopsUser'] && ($GLOBALS['xoopsUser'] instanceof \XoopsUser)) ? $GLOBALS['xoopsUser']->getVar('uid') : 0;
$msgowner = Request::getInt('msgowner', 0, 'POST');
if ($helper->isUserAdmin() || ($id == $msgowner && 0 !== $msgowner)) {
$swDB = new Smallworld\SwDatabase();
if (Request::hasVar('smallworld_msg_id', 'POST')) {
$smallworld_msg_id = Request::getInt('smallworld_msg_id', 0, 'POST');
$data = $swDB->deleteWallMsg($id, $smallworld_msg_id);
}
}
$GLOBALS['xoopsLogger']->activated = $prevLogger; // restore logger to previous state