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