1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Request removal page. |
5
|
|
|
* |
6
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public License, |
7
|
|
|
* v. 2.0. If a copy of the MPL was not distributed with this file, You can |
8
|
|
|
* obtain one at http://mozilla.org/MPL/2.0/. |
9
|
|
|
* |
10
|
|
|
* @package phpMyFAQ |
11
|
|
|
* @author Thorsten Rinne <[email protected]> |
12
|
|
|
* @copyright 2018-2019 phpMyFAQ Team |
13
|
|
|
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
14
|
|
|
* @link https://www.phpmyfaq.de |
15
|
|
|
* @since 2018-02-03 |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
use phpMyFAQ\Captcha; |
19
|
|
|
use phpMyFAQ\Exception; |
|
|
|
|
20
|
|
|
use phpMyFAQ\Helper\CaptchaHelper; |
21
|
|
|
use phpMyFAQ\User\CurrentUser; |
22
|
|
|
|
23
|
|
View Code Duplication |
if (!defined('IS_VALID_PHPMYFAQ')) { |
24
|
|
|
$protocol = 'http'; |
25
|
|
|
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON') { |
26
|
|
|
$protocol = 'https'; |
27
|
|
|
} |
28
|
|
|
header('Location: '.$protocol.'://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])); |
29
|
|
|
exit(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
try { |
33
|
|
|
$faqSession->userTracking('request_removal', 0); |
34
|
|
|
} catch (Exception $e) { |
35
|
|
|
// @todo handle the exception |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
$captcha = new Captcha($faqConfig); |
39
|
|
|
$captcha->setSessionId($sids); |
40
|
|
|
|
41
|
|
|
if (!is_null($showCaptcha)) { |
42
|
|
|
$captcha->showCaptchaImg(); |
43
|
|
|
exit; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
$captchaHelper = new CaptchaHelper($faqConfig); |
47
|
|
|
|
48
|
|
|
$template->parse( |
49
|
|
|
'writeContent', |
50
|
|
|
array( |
51
|
|
|
'msgContact' => $PMF_LANG['msgContact'], |
52
|
|
|
'msgUserRemovalText' => $PMF_LANG['msgUserRemovalText'], |
53
|
|
|
'msgContactRemove' => $PMF_LANG['msgContactRemove'], |
54
|
|
|
'msgContactPrivacyNote' => $PMF_LANG['msgContactPrivacyNote'], |
55
|
|
|
'msgPrivacyNote' => $PMF_LANG['msgPrivacyNote'], |
56
|
|
|
'privacyURL' => $faqConfig->get('main.privacyURL'), |
57
|
|
|
'msgNewContentName' => $PMF_LANG['msgNewContentName'], |
58
|
|
|
'msgNewContentMail' => $PMF_LANG['msgNewContentMail'], |
59
|
|
|
'ad_user_loginname' => $PMF_LANG['ad_user_loginname'], |
60
|
|
|
'lang' => $Language->getLanguage(), |
61
|
|
|
'defaultContentMail' => ($user instanceof CurrentUser) ? $user->getUserData('email') : '', |
62
|
|
|
'defaultContentName' => ($user instanceof CurrentUser) ? $user->getUserData('display_name') : '', |
63
|
|
|
'defaultLoginName' => ($user instanceof CurrentUser) ? $user->getLogin() : '', |
64
|
|
|
'msgMessage' => $PMF_LANG['msgMessage'], |
65
|
|
|
'msgS2FButton' => $PMF_LANG['msgS2FButton'], |
66
|
|
|
'version' => $faqConfig->get('main.currentVersion'), |
67
|
|
|
'captchaFieldset' => $captchaHelper->renderCaptcha($captcha, 'contact', $PMF_LANG['msgCaptcha'], $auth), |
68
|
|
|
) |
69
|
|
|
); |
70
|
|
|
|
71
|
|
|
$template->parseBlock( |
72
|
|
|
'index', |
73
|
|
|
'breadcrumb', |
74
|
|
|
[ |
75
|
|
|
'breadcrumbHeadline' => $PMF_LANG['msgUserRemoval'] |
76
|
|
|
] |
77
|
|
|
); |
78
|
|
|
|
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: