@@ -11,13 +11,13 @@ |
||
| 11 | 11 | // ------------------------------------------------------------------------ |
| 12 | 12 | |
| 13 | 13 | $uri = urldecode( |
| 14 | - parse_url( $_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH ) |
|
| 14 | + parse_url($_SERVER[ 'REQUEST_URI' ], PHP_URL_PATH) |
|
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | 17 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the |
| 18 | 18 | // built-in PHP web server. This provides a convenient way to test a Laravel |
| 19 | 19 | // application without having installed a "real" web server software here. |
| 20 | -if ( $uri !== '/' && file_exists( __DIR__ . '/public' . $uri ) ) { |
|
| 20 | +if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) { |
|
| 21 | 21 | return false; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | ] |
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | - if($token = input()->webToken()) { |
|
| 68 | + if ($token = input()->webToken()) { |
|
| 69 | 69 | /** |
| 70 | 70 | * Let's verify it with Web Token Authentication service callback. |
| 71 | 71 | */ |
@@ -73,13 +73,13 @@ discard block |
||
| 73 | 73 | return array_key_exists($token, $users); |
| 74 | 74 | }); |
| 75 | 75 | |
| 76 | - if($validate) { |
|
| 76 | + if ($validate) { |
|
| 77 | 77 | $payload = $users[ $token ]; // this is an example payload |
| 78 | 78 | globals()->store('payload', $payload); |
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if(empty($payload)) { |
|
| 82 | + if (empty($payload)) { |
|
| 83 | 83 | output()->sendError(403, [ |
| 84 | 84 | 'message' => language()->getLine('403_INVALID_WEBTOKEN') |
| 85 | 85 | ]); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | * |
| 42 | 42 | * eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOjcsInVzZXJuYW1lIjoic3RlZXZlbnoifQ.D29MZcJa2svH5kNt4bFcUtIXvJ4ohYJ-0vNxsgMWAvc |
| 43 | 43 | */ |
| 44 | - if(false !== ($token = input()->bearerToken())) { |
|
| 44 | + if (false !== ($token = input()->bearerToken())) { |
|
| 45 | 45 | $payload = services('jsonWebTokenAuthentication')->decode($token); |
| 46 | 46 | globals()->store('payload', $payload); |
| 47 | 47 | } else { |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | 'attempts' => 5, |
| 40 | 40 | ]); |
| 41 | 41 | |
| 42 | - if( ! services()->throttle->verify()) { |
|
| 42 | + if ( ! services()->throttle->verify()) { |
|
| 43 | 43 | output()->sendError(429); |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | parent::__construct(); |
| 30 | 30 | |
| 31 | - $this->register( new Middleware\WebToken(), 'webToken' ); |
|
| 32 | - $this->register( new Middleware\JsonWebToken(), 'jsonWebToken' ); |
|
| 31 | + $this->register(new Middleware\WebToken(), 'webToken'); |
|
| 32 | + $this->register(new Middleware\JsonWebToken(), 'jsonWebToken'); |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | \ No newline at end of file |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | // Example Route To Default Controller |
| 24 | 24 | $addresses->get( |
| 25 | 25 | '/', |
| 26 | - function () { |
|
| 26 | + function() { |
|
| 27 | 27 | return new \App\Controllers\Service(); |
| 28 | 28 | } |
| 29 | 29 | ); |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | $services = [ |
| 30 | - 'webTokenAuthentication' => '\O2System\Security\Authentication\WebToken', |
|
| 31 | - //'jsonWebTokenAuthentication' => '\O2System\Security\Authentication\Jwt\Token' |
|
| 30 | + 'webTokenAuthentication' => '\O2System\Security\Authentication\WebToken', |
|
| 31 | + //'jsonWebTokenAuthentication' => '\O2System\Security\Authentication\Jwt\Token' |
|
| 32 | 32 | ]; |
| 33 | 33 | \ No newline at end of file |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | // ------------------------------------------------------------------------ |
| 22 | 22 | |
| 23 | -define( 'STARTUP_TIME', microtime( true ) ); |
|
| 24 | -define( 'STARTUP_MEMORY', memory_get_usage( true ) ); |
|
| 23 | +define('STARTUP_TIME', microtime(true)); |
|
| 24 | +define('STARTUP_MEMORY', memory_get_usage(true)); |
|
| 25 | 25 | |
| 26 | 26 | /* |
| 27 | 27 | *--------------------------------------------------------------- |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | * NOTE: If you change these, also change the error_reporting() code below |
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | -if ( ! defined( 'ENVIRONMENT' ) ) { |
|
| 44 | +if ( ! defined('ENVIRONMENT')) { |
|
| 45 | 45 | /** |
| 46 | 46 | * Environment Stage |
| 47 | 47 | * |
| 48 | 48 | * @value DEVELOPMENT|TESTING|PRODUCTION |
| 49 | 49 | */ |
| 50 | - define( 'ENVIRONMENT', 'DEVELOPMENT' ); |
|
| 50 | + define('ENVIRONMENT', 'DEVELOPMENT'); |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Environment Debug Stage |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * NO TRAILING SLASH! |
| 68 | 68 | */ |
| 69 | -if ( ! defined( 'DIR_APP' ) ) { |
|
| 70 | - define( 'DIR_APP', 'app' ); |
|
| 69 | +if ( ! defined('DIR_APP')) { |
|
| 70 | + define('DIR_APP', 'app'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /* |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * NO TRAILING SLASH! |
| 81 | 81 | */ |
| 82 | -if ( ! defined( 'DIR_CACHE' ) ) { |
|
| 83 | - define( 'DIR_CACHE', 'cache' ); |
|
| 82 | +if ( ! defined('DIR_CACHE')) { |
|
| 83 | + define('DIR_CACHE', 'cache'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /* |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * NO TRAILING SLASH! |
| 94 | 94 | */ |
| 95 | -if ( ! defined( 'DIR_STORAGE' ) ) { |
|
| 96 | - define( 'DIR_STORAGE', 'storage' ); |
|
| 95 | +if ( ! defined('DIR_STORAGE')) { |
|
| 96 | + define('DIR_STORAGE', 'storage'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /* |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * NO TRAILING SLASH! |
| 107 | 107 | */ |
| 108 | -if ( ! defined( 'DIR_RESOURCES' ) ) { |
|
| 109 | - define( 'DIR_RESOURCES', 'resources' ); |
|
| 108 | +if ( ! defined('DIR_RESOURCES')) { |
|
| 109 | + define('DIR_RESOURCES', 'resources'); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /* |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * NO TRAILING SLASH! |
| 120 | 120 | */ |
| 121 | -if ( ! defined( 'DIR_DATABASE' ) ) { |
|
| 122 | - define( 'DIR_DATABASE', 'database' ); |
|
| 121 | +if ( ! defined('DIR_DATABASE')) { |
|
| 122 | + define('DIR_DATABASE', 'database'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /* |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * NO TRAILING SLASH! |
| 133 | 133 | */ |
| 134 | -if ( ! defined( 'DIR_PUBLIC' ) ) { |
|
| 134 | +if ( ! defined('DIR_PUBLIC')) { |
|
| 135 | 135 | // cpanel based hosting |
| 136 | - if(is_dir('../public_html')) { |
|
| 137 | - define( 'DIR_PUBLIC', 'public' ); |
|
| 136 | + if (is_dir('../public_html')) { |
|
| 137 | + define('DIR_PUBLIC', 'public'); |
|
| 138 | 138 | } else { |
| 139 | - define( 'DIR_PUBLIC', 'public' ); |
|
| 139 | + define('DIR_PUBLIC', 'public'); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * DEFINE ROOT PATH |
| 146 | 146 | *--------------------------------------------------------------- |
| 147 | 147 | */ |
| 148 | -define( 'PATH_ROOT', dirname( __FILE__ ) . DIRECTORY_SEPARATOR ); |
|
| 148 | +define('PATH_ROOT', dirname(__FILE__) . DIRECTORY_SEPARATOR); |
|
| 149 | 149 | |
| 150 | 150 | /* |
| 151 | 151 | *--------------------------------------------------------------- |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * Ensure the current directory is pointing to the front controller's directory |
| 156 | 156 | */ |
| 157 | -chdir( __DIR__ . DIRECTORY_SEPARATOR ); |
|
| 157 | +chdir(__DIR__ . DIRECTORY_SEPARATOR); |
|
| 158 | 158 | |
| 159 | 159 | /* |
| 160 | 160 | |-------------------------------------------------------------------------- |
@@ -174,6 +174,6 @@ discard block |
||
| 174 | 174 | * STARTUP O2SYSTEM |
| 175 | 175 | * ------------------------------------------------------ |
| 176 | 176 | */ |
| 177 | -if ( class_exists( 'O2System\Framework', false ) ) { |
|
| 177 | +if (class_exists('O2System\Framework', false)) { |
|
| 178 | 178 | O2System\Framework::getInstance(); |
| 179 | 179 | } |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | // ------------------------------------------------------------------------ |
| 22 | 22 | |
| 23 | -define( 'STARTUP_TIME', $_SERVER['REQUEST_TIME'] ); |
|
| 24 | -define( 'STARTUP_MEMORY', memory_get_usage( true ) ); |
|
| 23 | +define('STARTUP_TIME', $_SERVER[ 'REQUEST_TIME' ]);
|
|
| 24 | +define('STARTUP_MEMORY', memory_get_usage(true));
|
|
| 25 | 25 | |
| 26 | 26 | /* |
| 27 | 27 | *--------------------------------------------------------------- |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | * NOTE: If you change these, also change the error_reporting() code below |
| 42 | 42 | * |
| 43 | 43 | */ |
| 44 | -if ( ! defined( 'ENVIRONMENT' ) ) {
|
|
| 44 | +if ( ! defined('ENVIRONMENT')) {
|
|
| 45 | 45 | /** |
| 46 | 46 | * Environment Stage |
| 47 | 47 | * |
| 48 | 48 | * @value DEVELOPMENT|TESTING|PRODUCTION |
| 49 | 49 | */ |
| 50 | - define( 'ENVIRONMENT', 'DEVELOPMENT' ); |
|
| 50 | + define('ENVIRONMENT', 'DEVELOPMENT');
|
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Environment Debug Stage |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * NO TRAILING SLASH! |
| 68 | 68 | */ |
| 69 | -if ( ! defined( 'DIR_APP' ) ) {
|
|
| 70 | - define( 'DIR_APP', 'app' ); |
|
| 69 | +if ( ! defined('DIR_APP')) {
|
|
| 70 | + define('DIR_APP', 'app');
|
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /* |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * NO TRAILING SLASH! |
| 81 | 81 | */ |
| 82 | -if ( ! defined( 'DIR_CACHE' ) ) {
|
|
| 83 | - define( 'DIR_CACHE', 'cache' ); |
|
| 82 | +if ( ! defined('DIR_CACHE')) {
|
|
| 83 | + define('DIR_CACHE', 'cache');
|
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /* |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * NO TRAILING SLASH! |
| 94 | 94 | */ |
| 95 | -if ( ! defined( 'DIR_STORAGE' ) ) {
|
|
| 96 | - define( 'DIR_STORAGE', 'storage' ); |
|
| 95 | +if ( ! defined('DIR_STORAGE')) {
|
|
| 96 | + define('DIR_STORAGE', 'storage');
|
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /* |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * NO TRAILING SLASH! |
| 107 | 107 | */ |
| 108 | -if ( ! defined( 'DIR_RESOURCES' ) ) {
|
|
| 109 | - define( 'DIR_RESOURCES', 'resources' ); |
|
| 108 | +if ( ! defined('DIR_RESOURCES')) {
|
|
| 109 | + define('DIR_RESOURCES', 'resources');
|
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | /* |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * NO TRAILING SLASH! |
| 120 | 120 | */ |
| 121 | -if ( ! defined( 'DIR_DATABASE' ) ) {
|
|
| 122 | - define( 'DIR_DATABASE', 'database' ); |
|
| 121 | +if ( ! defined('DIR_DATABASE')) {
|
|
| 122 | + define('DIR_DATABASE', 'database');
|
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /* |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * NO TRAILING SLASH! |
| 133 | 133 | */ |
| 134 | -if ( ! defined( 'DIR_PUBLIC' ) ) {
|
|
| 134 | +if ( ! defined('DIR_PUBLIC')) {
|
|
| 135 | 135 | // cpanel based hosting |
| 136 | - if(is_dir('../public_html')) {
|
|
| 137 | - define( 'DIR_PUBLIC', 'public' ); |
|
| 136 | + if (is_dir('../public_html')) {
|
|
| 137 | + define('DIR_PUBLIC', 'public');
|
|
| 138 | 138 | } else {
|
| 139 | - define( 'DIR_PUBLIC', 'public' ); |
|
| 139 | + define('DIR_PUBLIC', 'public');
|
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * DEFINE ROOT PATH |
| 146 | 146 | *--------------------------------------------------------------- |
| 147 | 147 | */ |
| 148 | -define( 'PATH_ROOT', dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR ); |
|
| 148 | +define('PATH_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
|
|
| 149 | 149 | |
| 150 | 150 | /* |
| 151 | 151 | *--------------------------------------------------------------- |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * Ensure the current directory is pointing to the front controller's directory |
| 156 | 156 | */ |
| 157 | -chdir( __DIR__ . DIRECTORY_SEPARATOR ); |
|
| 157 | +chdir(__DIR__ . DIRECTORY_SEPARATOR); |
|
| 158 | 158 | |
| 159 | 159 | /* |
| 160 | 160 | |-------------------------------------------------------------------------- |
@@ -174,6 +174,6 @@ discard block |
||
| 174 | 174 | * STARTUP O2SYSTEM |
| 175 | 175 | * ------------------------------------------------------ |
| 176 | 176 | */ |
| 177 | -if ( class_exists( 'O2System\Reactor', false ) ) {
|
|
| 177 | +if (class_exists('O2System\Reactor', false)) {
|
|
| 178 | 178 | O2System\Reactor::getInstance(); |
| 179 | 179 | } |