@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | private function setLocale() |
78 | 78 | { |
79 | 79 | $this->locale = $this->config->get("default_language"); |
80 | - Logger::log('Set locale to project [' . $this->locale . ']'); |
|
80 | + Logger::log('Set locale to project ['.$this->locale.']'); |
|
81 | 81 | // Load translations |
82 | - putenv("LC_ALL=" . $this->locale); |
|
82 | + putenv("LC_ALL=".$this->locale); |
|
83 | 83 | setlocale(LC_ALL, $this->locale); |
84 | 84 | // Load the locale path |
85 | - $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
86 | - Logger::log('Set locale dir ' . $locale_path); |
|
85 | + $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
86 | + Logger::log('Set locale dir '.$locale_path); |
|
87 | 87 | GeneratorHelper::createDir($locale_path); |
88 | 88 | bindtextdomain('translations', $locale_path); |
89 | 89 | textdomain('translations'); |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | if (!$this->parser->isFile()) { |
105 | 105 | return $this->router->execute($this->actualUri); |
106 | 106 | } |
107 | - } else { |
|
107 | + }else { |
|
108 | 108 | return ConfigController::getInstance()->config(); |
109 | 109 | } |
110 | - } catch (AdminCredentialsException $a) { |
|
110 | + }catch (AdminCredentialsException $a) { |
|
111 | 111 | return UserController::showAdminManager(); |
112 | - } catch (ConfigException $c) { |
|
112 | + }catch (ConfigException $c) { |
|
113 | 113 | return $this->dumpException($c); |
114 | - } catch (SecurityException $s) { |
|
114 | + }catch (SecurityException $s) { |
|
115 | 115 | return $this->security->notAuthorized($this->actualUri); |
116 | - } catch (UserAuthException $u) { |
|
116 | + }catch (UserAuthException $u) { |
|
117 | 117 | $this->redirectToHome(); |
118 | - } catch (RouterException $r) { |
|
118 | + }catch (RouterException $r) { |
|
119 | 119 | return $this->router->httpNotFound($r); |
120 | - } catch (\Exception $e) { |
|
120 | + }catch (\Exception $e) { |
|
121 | 121 | return $this->dumpException($e); |
122 | 122 | } |
123 | 123 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $use /= 1024; |
165 | 165 | break; |
166 | 166 | case "MBytes": |
167 | - $use /= (1024 * 1024); |
|
167 | + $use /= (1024*1024); |
|
168 | 168 | break; |
169 | 169 | case "Bytes": |
170 | 170 | default: |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | if ($this->config->getDebugMode() && $this->config->get('errors.strict', false)) { |
191 | 191 | Logger::log('Added handlers for errors'); |
192 | 192 | //Warning & Notice handler |
193 | - set_error_handler(function ($errno, $errstr, $errfile, $errline) { |
|
193 | + set_error_handler(function($errno, $errstr, $errfile, $errline) { |
|
194 | 194 | Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline]); |
195 | 195 | throw new \Exception($errstr, 500); |
196 | 196 | }); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | Logger::log('Initializing stats (mem + ts)'); |
206 | 206 | if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) { |
207 | 207 | $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT']; |
208 | - } else { |
|
208 | + }else { |
|
209 | 209 | $this->ts = $this->parser->getTs(); |
210 | 210 | } |
211 | 211 | $this->mem = memory_get_usage(); |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace PSFS\base\types; |
4 | 4 | |
5 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
5 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
6 | 6 | /** |
7 | 7 | * Class SingletonTrait |
8 | 8 | * @package PSFS\base\types |
@@ -5,17 +5,17 @@ |
||
5 | 5 | |
6 | 6 | if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
7 | 7 | if (preg_match('/vendor/', SOURCE_DIR)) { |
8 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
9 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
10 | -} else { |
|
11 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
12 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
8 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
9 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
10 | +}else { |
|
11 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
12 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
13 | 13 | } |
14 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
15 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
16 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
17 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
18 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
14 | +if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor'); |
|
15 | +if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
16 | +if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
17 | +if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
18 | +if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
19 | 19 | |
20 | 20 | defined('PSFS_BOOTSTRAP_LOADED') or define('PSFS_BOOTSTRAP_LOADED', true); |
21 | 21 |
@@ -1,21 +1,43 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace PSFS; |
3 | 3 | |
4 | -if (defined('PSFS_BOOTSTRAP_LOADED')) return; |
|
4 | +if (defined('PSFS_BOOTSTRAP_LOADED')) { |
|
5 | + return; |
|
6 | +} |
|
5 | 7 | |
6 | -if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
|
8 | +if (!defined('SOURCE_DIR')) { |
|
9 | + define('SOURCE_DIR', __DIR__); |
|
10 | +} |
|
7 | 11 | if (preg_match('/vendor/', SOURCE_DIR)) { |
8 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
9 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
10 | -} else { |
|
11 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
12 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
13 | -} |
|
14 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
15 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
16 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
17 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
18 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
12 | + if (!defined('BASE_DIR')) { |
|
13 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
14 | + } |
|
15 | + if (!defined('CORE_DIR')) { |
|
16 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
17 | + } |
|
18 | + } else { |
|
19 | + if (!defined('BASE_DIR')) { |
|
20 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
21 | + } |
|
22 | + if (!defined('CORE_DIR')) { |
|
23 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
24 | + } |
|
25 | + } |
|
26 | +if (!defined('VENDOR_DIR')) { |
|
27 | + define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
28 | +} |
|
29 | +if (!defined('LOG_DIR')) { |
|
30 | + define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
31 | +} |
|
32 | +if (!defined('CACHE_DIR')) { |
|
33 | + define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
34 | +} |
|
35 | +if (!defined('CONFIG_DIR')) { |
|
36 | + define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
37 | +} |
|
38 | +if (!defined('WEB_DIR')) { |
|
39 | + define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
40 | +} |
|
19 | 41 | |
20 | 42 | defined('PSFS_BOOTSTRAP_LOADED') or define('PSFS_BOOTSTRAP_LOADED', true); |
21 | 43 |