1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | /* |
||
5 | You may not change or alter any portion of this comment or credits |
||
6 | of supporting developers from this source code or any supporting source code |
||
7 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
8 | |||
9 | This program is distributed in the hope that it will be useful, |
||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
12 | */ |
||
13 | |||
14 | /** |
||
15 | * @category Module |
||
16 | * @package suico |
||
17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
18 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
19 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
20 | */ |
||
21 | |||
22 | use Xmf\Request; |
||
23 | use XoopsModules\Suico\{ |
||
24 | SuspensionsHandler |
||
25 | }; |
||
26 | |||
27 | require __DIR__ . '/header.php'; |
||
28 | //require_once __DIR__ . '/class/Suspensions.php'; |
||
29 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||
30 | redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 5, _MD_SUICO_TOKENEXPIRED); |
||
31 | } |
||
32 | $uid = Request::getInt('uid', 0, 'POST'); |
||
33 | /** |
||
34 | * Creating the factory loading the picture changing its caption |
||
35 | */ |
||
36 | $suspensionsFactory = new SuspensionsHandler( |
||
37 | $xoopsDB |
||
38 | ); |
||
39 | $suspension = $suspensionsFactory->create(false); |
||
40 | $suspension->load($uid); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
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((string)time())); |
||
52 | $thisUser->setVar('pass', md5((string)time())); |
||
53 | $thisUser->setVar('user_sig', sprintf(_MD_SUICO_SUSPENDED, formatTimestamp(time() + Request::getInt('time', 0, 'POST'), 'm'))); |
||
54 | $memberHandler->insertUser($thisUser); |
||
55 | redirect_header('index.php?uid=' . $uid, 300, _MD_SUICO_USER_SUSPENDED); |
||
56 | } |
||
57 | require dirname(__DIR__, 2) . '/footer.php'; |
||
58 |