1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @category Module |
14
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
15
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
16
|
|
|
* @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
use Xmf\Request; |
|
|
|
|
20
|
|
|
use XoopsModules\Suico\{ |
21
|
|
|
SuspensionsHandler |
22
|
|
|
}; |
23
|
|
|
|
24
|
|
|
require __DIR__ . '/header.php'; |
25
|
|
|
//require_once __DIR__ . '/class/Suspensions.php'; |
26
|
|
|
if (!$GLOBALS['xoopsSecurity']->check()) { |
27
|
|
|
redirect_header(Request::getString('HTTP_REFERER', '', 'SERVER'), 5, _MD_SUICO_TOKENEXPIRED); |
28
|
|
|
} |
29
|
|
|
$uid = Request::getInt('uid', 0, 'POST'); |
30
|
|
|
/** |
31
|
|
|
* Creating the factory loading the picture changing its caption |
32
|
|
|
*/ |
33
|
|
|
$suspensionsFactory = new SuspensionsHandler( |
34
|
|
|
$xoopsDB |
35
|
|
|
); |
36
|
|
|
$suspension = $suspensionsFactory->create(false); |
37
|
|
|
$suspension->load($uid); |
|
|
|
|
38
|
|
|
if ($xoopsUser->isAdmin(1)) { |
39
|
|
|
/** @var \XoopsMemberHandler $memberHandler */ |
40
|
|
|
$memberHandler = xoops_getHandler('member'); |
41
|
|
|
$thisUser = $memberHandler->getUser($uid); |
42
|
|
|
$suspension->setVar('uid', $uid); |
43
|
|
|
$suspension->setVar('old_email', $thisUser->getVar('email')); |
44
|
|
|
$suspension->setVar('old_pass', $thisUser->getVar('pass')); |
45
|
|
|
$suspension->setVar('old_signature', $thisUser->getVar('user_sig')); |
46
|
|
|
$suspension->setVar('suspension_time', time() + Request::getInt('time', 0, 'POST')); |
47
|
|
|
$suspensionsFactory->insert2($suspension); |
48
|
|
|
$thisUser->setVar('email', md5((string)time())); |
49
|
|
|
$thisUser->setVar('pass', md5((string)time())); |
50
|
|
|
$thisUser->setVar('user_sig', sprintf(_MD_SUICO_SUSPENDED, formatTimestamp(time() + Request::getInt('time', 0, 'POST'), 'm'))); |
51
|
|
|
$memberHandler->insertUser($thisUser); |
52
|
|
|
redirect_header('index.php?uid=' . $uid, 300, _MD_SUICO_USER_SUSPENDED); |
53
|
|
|
} |
54
|
|
|
require \dirname(__DIR__, 2) . '/footer.php'; |
55
|
|
|
|
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: