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 | * wgEvents module for xoops |
||
15 | * |
||
16 | * @copyright 2021 XOOPS Project (https://xoops.org) |
||
17 | * @license GPL 2.0 or later |
||
18 | * @package wgevents |
||
19 | * @author Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com |
||
20 | */ |
||
21 | |||
22 | use Xmf\Request; |
||
0 ignored issues
–
show
|
|||
23 | use XoopsModules\Wgevents; |
||
24 | use XoopsModules\Wgevents\Constants; |
||
25 | |||
26 | require __DIR__ . '/header.php'; |
||
27 | $GLOBALS['xoopsOption']['template_main'] = 'wgevents_verification.tpl'; |
||
28 | require_once \XOOPS_ROOT_PATH . '/header.php'; |
||
29 | |||
30 | // Permission |
||
31 | if (!$permissionsHandler->getPermEventsView()) { |
||
32 | $GLOBALS['xoopsTpl']->assign('errorPerm', _NOPERM); |
||
33 | require __DIR__ . '/footer.php'; |
||
34 | exit; |
||
35 | } |
||
36 | |||
37 | $op = Request::getCmd('op', 'verif'); |
||
38 | $verifKey = Request::getString('verifkey'); |
||
39 | |||
40 | // Define Stylesheet |
||
41 | $GLOBALS['xoTheme']->addStylesheet($style, null); |
||
42 | |||
43 | // Breadcrumbs |
||
44 | $xoBreadcrumbs[] = ['title' => \_MA_WGEVENTS_MAIL_REG_VERIF_INFO]; |
||
45 | |||
46 | $verifKeyArray = explode('||', base64_decode($verifKey, true)); |
||
47 | $regId = $verifKeyArray[0]; |
||
48 | $registrationObj = $registrationHandler->get($regId); |
||
49 | $eventName = $eventHandler->get($registrationObj->getVar('evid'))->getVar('name'); |
||
50 | if ($regId > 0 && \is_object($registrationObj) && WGEVENTS_URL === (string)$verifKeyArray[1] && |
||
51 | (int)$registrationObj->getVar('evid') == (int)$verifKeyArray[2] && |
||
52 | (string)$registrationObj->getVar('email') == (string)$verifKeyArray[3] && |
||
53 | (string)$registrationObj->getVar('verifkey') == (string)$verifKeyArray[4]) { |
||
54 | $registrationhistHandler->createHistory($registrationObj, 'update'); |
||
55 | $registrationObj->setVar('status', Constants::STATUS_VERIFIED); |
||
56 | $registrationObj->setVar('datecreated', \time()); |
||
57 | if ($registrationHandler->insert($registrationObj)) { |
||
58 | $GLOBALS['xoopsTpl']->assign('verif_success', \sprintf(\_MA_WGEVENTS_MAIL_REG_VERIF_SUCCESS, $eventName)); |
||
59 | } else { |
||
60 | $GLOBALS['xoopsTpl']->assign('verif_error', \sprintf(\_MA_WGEVENTS_MAIL_REG_VERIF_ERROR, $eventName)); |
||
61 | } |
||
62 | } else { |
||
63 | $GLOBALS['xoopsTpl']->assign('verif_error', \sprintf(\_MA_WGEVENTS_MAIL_REG_VERIF_ERROR, $eventName)); |
||
64 | } |
||
65 | |||
66 | // Description |
||
67 | wgeventsMetaDescription(\_MA_WGEVENTS_INDEX_DESC); |
||
68 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', \WGEVENTS_URL.'/index.php'); |
||
69 | $GLOBALS['xoopsTpl']->assign('xoops_icons32_url', \XOOPS_ICONS32_URL); |
||
70 | $GLOBALS['xoopsTpl']->assign('wgevents_upload_url', \WGEVENTS_UPLOAD_URL); |
||
71 | require __DIR__ . '/footer.php'; |
||
72 |
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: