Passed
Branch master (410c7b)
by Michael
03:30
created

suspend.php (1 issue)

Labels
Severity
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
 * @category        Module
17
 * @package         yogurt
18
 * @copyright       {@link https://xoops.org/ XOOPS Project}
19
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
20
 * @author          Marcello Brandão aka  Suico, Mamba, LioMJ  <https://xoops.org>
21
 */
22
23
use Xmf\Request;
24
use XoopsModules\Yogurt;
25
26
require __DIR__ . '/header.php';
27
//require_once __DIR__ . '/class/Suspensions.php';
28
29
if (!$GLOBALS['xoopsSecurity']->check()) {
30
    redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 5, _MD_YOGURT_TOKENEXPIRED);
31
}
32
33
$uid = Request::getInt('uid', 0, 'POST');
34
/**
35
 * Creating the factory  loading the picture changing its caption
36
 */
37
$suspensionsFactory = new Yogurt\SuspensionsHandler(
38
    $xoopsDB
39
);
40
$suspension         = $suspensionsFactory->create(false);
41
$suspension->load($uid);
0 ignored issues
show
The method load() does not exist on XoopsObject. It seems like you code against a sub-type of XoopsObject such as XoopsModules\Yogurt\Groups or XoopsModules\Yogurt\Ishot or XoopsModules\Yogurt\Friendrequest or XoopsModules\Yogurt\Relgroupuser or XoopsModules\Yogurt\Visitors or XoopsComments or XoopsModules\Yogurt\Audio or XoopsModules\Yogurt\Video or XoopsModules\Yogurt\Notes or XoopsModules\Yogurt\Friendship or XoopsModules\Yogurt\Image or XoopsModules\Yogurt\Configs or XoopsModules\Yogurt\Suspensions. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

41
$suspension->/** @scrutinizer ignore-call */ 
42
             load($uid);
Loading history...
42
43
if ($xoopsUser->isAdmin(1)) {
44
    /** @var \XoopsMemberHandler $memberHandler */
45
46
    $memberHandler = xoops_getHandler('member');
47
48
    $thisUser = $memberHandler->getUser($uid);
49
50
    $suspension->setVar('uid', $uid);
51
52
    $suspension->setVar('old_email', $thisUser->getVar('email'));
53
54
    $suspension->setVar('old_pass', $thisUser->getVar('pass'));
55
56
    $suspension->setVar('old_signature', $thisUser->getVar('user_sig'));
57
58
    $suspension->setVar('suspension_time', time() + Request::getInt('time', 0, 'POST'));
59
60
    $suspensionsFactory->insert2($suspension);
61
62
    $thisUser->setVar('email', md5(time()));
63
64
    $thisUser->setVar('pass', md5(time()));
65
66
    $thisUser->setVar('user_sig', sprintf(_MD_YOGURT_SUSPENDED, formatTimestamp(time() + Request::getInt('time', 0, 'POST'), 'm')));
67
68
    $memberHandler->insertUser($thisUser);
69
70
    redirect_header('index.php?uid=' . $uid, 300, _MD_YOGURT_USER_SUSPENDED);
71
}
72
73
require dirname(__DIR__, 2) . '/footer.php';
74