1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * @package boot |
||||
5 | */ |
||||
6 | |||||
7 | // Set appropriate error reporting: |
||||
8 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT); |
||||
9 | |||||
10 | // Turn off old-style magic: |
||||
11 | ini_set('magic_quotes_runtime', false); |
||||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||||
12 | |||||
13 | // Redirect to installer if it exists |
||||
14 | if (!file_exists(CONFIG)) { |
||||
0 ignored issues
–
show
|
|||||
15 | $bInsideInstaller = (bool)preg_match('%(/|\\\\)install(/|\\\\)index.php$%', server_safe('SCRIPT_FILENAME')); |
||||
16 | |||||
17 | if (!$bInsideInstaller && Symphony::isInstallerAvailable()) { |
||||
18 | header(sprintf('Location: %s/install/', URL)); |
||||
0 ignored issues
–
show
|
|||||
19 | exit; |
||||
20 | } elseif (!$bInsideInstaller) { |
||||
21 | die('<h2>Error</h2><p>Could not locate Symphony configuration file. Please check <code>manifest/config.php</code> exists.</p>'); |
||||
22 | } |
||||
23 | } else { |
||||
24 | // Load configuration file: |
||||
25 | include CONFIG; |
||||
26 | Symphony::initialiseConfiguration($settings); |
||||
27 | Symphony::initialiseErrorHandler(); |
||||
28 | Symphony::initialiseDatabase(); |
||||
29 | Symphony::initialiseExtensionManager(); |
||||
30 | |||||
31 | // Report all errors |
||||
32 | if (Symphony::Configuration()->get('error_reporting_all', 'symphony') === 'yes') { |
||||
33 | error_reporting(E_ALL); |
||||
34 | } |
||||
35 | |||||
36 | // Handle custom admin paths, #702 |
||||
37 | $adminPath = Symphony::Configuration()->get('admin-path', 'symphony'); |
||||
38 | $adminPath = (is_null($adminPath)) ? 'symphony' : $adminPath; |
||||
0 ignored issues
–
show
|
|||||
39 | // getCurrentPage() always starts with / #2522 |
||||
40 | $adminRegExp = '%^\/' . preg_quote($adminPath) . '\/%'; |
||||
0 ignored issues
–
show
It seems like
$adminPath can also be of type array ; however, parameter $str of preg_quote() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
41 | |||||
42 | if (preg_match($adminRegExp, getCurrentPage()) === 1) { |
||||
43 | $_GET['symphony-page'] = preg_replace($adminRegExp, '', getCurrentPage(), 1); |
||||
44 | |||||
45 | if ($_GET['symphony-page'] == '') { |
||||
46 | unset($_GET['symphony-page']); |
||||
47 | } |
||||
48 | |||||
49 | $_GET['mode'] = $_REQUEST['mode'] = 'administration'; |
||||
50 | } |
||||
51 | |||||
52 | /** |
||||
53 | * Returns the URL + /symphony. This should be used whenever the a developer |
||||
54 | * wants to link to the Symphony root |
||||
55 | * @since Symphony 2.2 |
||||
56 | * @var string |
||||
57 | */ |
||||
58 | define_safe('SYMPHONY_URL', URL . '/' . $adminPath); |
||||
59 | |||||
60 | /** |
||||
61 | * Overload the default Symphony launcher logic. |
||||
62 | * @delegate ModifySymphonyLauncher |
||||
63 | * @since Symphony 2.5.0 |
||||
64 | * @param string $context |
||||
65 | * '/all/' |
||||
66 | */ |
||||
67 | Symphony::ExtensionManager()->notifyMembers( |
||||
68 | 'ModifySymphonyLauncher', '/all/' |
||||
69 | ); |
||||
70 | |||||
71 | // Use default launcher: |
||||
72 | if (defined('SYMPHONY_LAUNCHER') === false) { |
||||
73 | define('SYMPHONY_LAUNCHER', 'symphony_launcher'); |
||||
74 | } |
||||
75 | } |
||||
76 |