Passed
Pull Request — master (#81)
by Michael
02:31
created

suspend.php (1 issue)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
13
/**
14
 * @copyright    XOOPS Project https://xoops.org/
15
 * @license      GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
16
 * @author       Marcello Brandão aka  Suico
17
 * @author       XOOPS Development Team
18
 * @since
19
 */
20
21
use Xmf\Request;
22
use XoopsModules\Yogurt;
23
24
require __DIR__ . '/header.php';
25
//require_once __DIR__ . '/class/Suspensions.php';
26
27
if (!$GLOBALS['xoopsSecurity']->check()) {
28
    redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 5, _MD_YOGURT_TOKENEXPIRED);
29
}
30
31
$uid = Request::getInt('uid', 0, 'POST');
32
/**
33
 * Creating the factory  loading the picture changing its caption
34
 */
35
$suspensionsFactory = new Yogurt\SuspensionsHandler(
36
    $xoopsDB
37
);
38
$suspension         = $suspensionsFactory->create(false);
39
$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

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