@@ -10,7 +10,6 @@ |
||
| 10 | 10 | use PSFS\base\exception\ConfigException; |
| 11 | 11 | use PSFS\base\exception\RouterException; |
| 12 | 12 | use PSFS\base\exception\SecurityException; |
| 13 | -use PSFS\base\exception\UserAuthException; |
|
| 14 | 13 | use PSFS\base\Logger; |
| 15 | 14 | use PSFS\base\Request; |
| 16 | 15 | use PSFS\base\Singleton; |
@@ -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,18 +104,18 @@ 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 (RouterException $r) { |
|
| 116 | + }catch (RouterException $r) { |
|
| 117 | 117 | return $this->router->httpNotFound($r); |
| 118 | - } catch (\Exception $e) { |
|
| 118 | + }catch (\Exception $e) { |
|
| 119 | 119 | return $this->dumpException($e); |
| 120 | 120 | } |
| 121 | 121 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $use /= 1024; |
| 163 | 163 | break; |
| 164 | 164 | case "MBytes": |
| 165 | - $use /= (1024 * 1024); |
|
| 165 | + $use /= (1024*1024); |
|
| 166 | 166 | break; |
| 167 | 167 | case "Bytes": |
| 168 | 168 | default: |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | if ($this->config->getDebugMode() && $this->config->get('errors.strict', false)) { |
| 189 | 189 | Logger::log('Added handlers for errors'); |
| 190 | 190 | //Warning & Notice handler |
| 191 | - set_error_handler(function ($errno, $errstr, $errfile, $errline) { |
|
| 191 | + set_error_handler(function($errno, $errstr, $errfile, $errline) { |
|
| 192 | 192 | Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline]); |
| 193 | 193 | throw new \Exception($errstr, 500); |
| 194 | 194 | }); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | Logger::log('Initializing stats (mem + ts)'); |
| 204 | 204 | if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) { |
| 205 | 205 | $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT']; |
| 206 | - } else { |
|
| 206 | + }else { |
|
| 207 | 207 | $this->ts = $this->parser->getTs(); |
| 208 | 208 | } |
| 209 | 209 | $this->mem = memory_get_usage(); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | { |
| 32 | 32 | $routes = []; |
| 33 | 33 | foreach ($systemRoutes as $route => $params) { |
| 34 | - if('GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) { |
|
| 34 | + if ('GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) { |
|
| 35 | 35 | $module = strtoupper($params['module']); |
| 36 | 36 | $mode = $params["visible"] ? 'visible' : 'hidden'; |
| 37 | 37 | $routes[$module][$mode][] = [ |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | ]; |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | - foreach($routes as $module => &$route) { |
|
| 45 | - if(array_key_exists('visible', $route)) { |
|
| 44 | + foreach ($routes as $module => &$route) { |
|
| 45 | + if (array_key_exists('visible', $route)) { |
|
| 46 | 46 | uasort($route["visible"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel'); |
| 47 | 47 | } |
| 48 | - if(array_key_exists('hidden', $route)) { |
|
| 48 | + if (array_key_exists('hidden', $route)) { |
|
| 49 | 49 | uasort($route["hidden"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel'); |
| 50 | 50 | } |
| 51 | 51 | } |