-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.php
More file actions
65 lines (55 loc) · 1.92 KB
/
init.php
File metadata and controls
65 lines (55 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Initialize the common extension.
*
* @copyright Copyright (c) 2012, Tux Solbakk
* @license http://opensource.org/licenses/bsd-license.php BSD 2-Clause License
* @link http://gimlé.org/extensions/common/
* @package common
*/
namespace gimle\common;
if (isset($config['stateless'])) {
if ($config['stateless'] === false) {
session_start();
} elseif (defined('BASE_PATH_KEY')) {
if (is_array($config['stateless'])) {
if (!in_array(BASE_PATH_KEY, $config['stateless'])) {
session_start();
}
} elseif (is_string($config['stateless'])) {
if ($config['stateless'] !== BASE_PATH_KEY) {
session_start();
}
}
}
} else {
session_start();
}
require __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, __NAMESPACE__) . DIRECTORY_SEPARATOR . 'system.php';
spl_autoload_register(__NAMESPACE__ . '\System::autoload');
if (isset($config['extensions'])) {
if (!empty($config['extensions'])) {
foreach ($config['extensions'] as $extensionPath) {
if ((is_string($extensionPath)) && (file_exists($extensionPath . 'lib' . DIRECTORY_SEPARATOR))) {
System::$autoloadPrependPaths[] = $extensionPath;
}
}
unset($extensionPath);
}
}
System::$config = $config;
unset($config);
if (!file_exists(TEMP_DIR)) {
mkdir(TEMP_DIR, 0777, true);
}
if ((!is_writable(TEMP_DIR)) || (!is_readable(TEMP_DIR))) {
trigger_error('Access to temp dir "' . TEMP_DIR . '" fail.', E_USER_WARNING);
}
require __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'functions.php';
require __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, __NAMESPACE__) . DIRECTORY_SEPARATOR . 'functions.php';
if (in_array(\gimle\core\page(0), array('css', 'js'))) {
include __DIR__ . DIRECTORY_SEPARATOR . 'specialurls.php';
}
if (ENV_LEVEL | ENV_LIVE) {
include __DIR__ . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'dev.php';
}