@@ -21,11 +21,11 @@ |
||
21 | 21 | $path = str_replace("\\", DIRECTORY_SEPARATOR, $class); |
22 | 22 | |
23 | 23 | // filepath |
24 | - $abs_path = SOURCE_DIR . DIRECTORY_SEPARATOR . $path . ".php"; |
|
24 | + $abs_path = SOURCE_DIR.DIRECTORY_SEPARATOR.$path.".php"; |
|
25 | 25 | if (!file_exists($abs_path)) { |
26 | - pre('→ ' . $class); |
|
27 | - pre('→ ' . $path); |
|
28 | - pre('→ ' . $abs_path); |
|
26 | + pre('→ '.$class); |
|
27 | + pre('→ '.$path); |
|
28 | + pre('→ '.$abs_path); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | // require the file |
@@ -26,13 +26,13 @@ |
||
26 | 26 | { |
27 | 27 | $namespace = explode('\\', $this->getModelTableMap()); |
28 | 28 | $module = strtolower($namespace[0]); |
29 | - $secret = Config::getInstance()->get($module . '.api.secret'); |
|
29 | + $secret = Config::getInstance()->get($module.'.api.secret'); |
|
30 | 30 | if (NULL === $secret) { |
31 | 31 | $secret = Config::getInstance()->get("api.secret"); |
32 | 32 | } |
33 | 33 | if (NULL === $secret) { |
34 | 34 | $auth = TRUE; |
35 | - } else { |
|
35 | + }else { |
|
36 | 36 | $token = Request::getInstance()->getHeader('X-API-SEC-TOKEN'); |
37 | 37 | if (array_key_exists('API_TOKEN', $this->query)) { |
38 | 38 | $token = $this->query['API_TOKEN']; |
@@ -30,16 +30,16 @@ |
||
30 | 30 | $scripts = $this->getNode("scripts"); |
31 | 31 | |
32 | 32 | //Creamos el parser |
33 | - $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')') |
|
33 | + $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\''.$this->type.'\')') |
|
34 | 34 | ->raw(";\n"); |
35 | 35 | |
36 | 36 | //Asociamos el hash |
37 | - $compiler->write('$parser->setHash(\'' . $this->hash . '\')') |
|
37 | + $compiler->write('$parser->setHash(\''.$this->hash.'\')') |
|
38 | 38 | ->raw(";\n"); |
39 | 39 | |
40 | 40 | //Asociamos los ficheros |
41 | 41 | foreach ($scripts->getAttribute("value") as $value) { |
42 | - $compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n"); |
|
42 | + $compiler->write('$parser->addFile(\''.$value.'\')')->raw(";\n"); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | //Procesamos los ficheros |
@@ -7,4 +7,4 @@ |
||
7 | 7 | */ |
8 | 8 | Trait BoostrapTrait {} |
9 | 9 | |
10 | -require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
11 | 10 | \ No newline at end of file |
11 | +require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
12 | 12 | \ No newline at end of file |
@@ -39,8 +39,8 @@ |
||
39 | 39 | "domain" => $this->getDomain(), |
40 | 40 | "listLabel" => Api::API_LIST_NAME_FIELD, |
41 | 41 | 'modelId' => Api::API_MODEL_KEY_FIELD, |
42 | - 'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-' . $this->getDomain() . '-' . $this->getApi()), TRUE)), |
|
43 | - "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain() . '-' . 'api-' . $this->getApi() . "-pk"), TRUE)), |
|
42 | + 'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-'.$this->getDomain().'-'.$this->getApi()), TRUE)), |
|
43 | + "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain().'-'.'api-'.$this->getApi()."-pk"), TRUE)), |
|
44 | 44 | ), [], ''); |
45 | 45 | } |
46 | 46 |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | public function render($template, array $vars = array(), $cookies = array(), $domain = null) |
42 | 42 | { |
43 | 43 | $vars['__menu__'] = $this->getMenu(); |
44 | - if(Config::getParam('profiling.enable')) { |
|
44 | + if (Config::getParam('profiling.enable')) { |
|
45 | 45 | $vars['__profiling__'] = Inspector::getStats(); |
46 | 46 | } |
47 | 47 | $domain = (null === $domain) ? $this->getDomain() : $domain; |
48 | - return $this->tpl->render($domain . $template, $vars, $cookies); |
|
48 | + return $this->tpl->render($domain.$template, $vars, $cookies); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $vars['__menu__'] = $this->getMenu(); |
78 | 78 | $domain = $domain ?: $this->getDomain(); |
79 | - return $this->tpl->dump($domain . $template, $vars); |
|
79 | + return $this->tpl->dump($domain.$template, $vars); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public static function readFile($path) { |
25 | 25 | $data = false; |
26 | - if(file_exists($path)) { |
|
26 | + if (file_exists($path)) { |
|
27 | 27 | $data = @file_get_contents($path); |
28 | 28 | } |
29 | 29 | return $data; |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @return string |
37 | 37 | */ |
38 | 38 | public static function generateHashFilename($verb, $slug, array $query = []) { |
39 | - return sha1(strtolower($verb) . ' ' . $slug . ' ' . strtolower(http_build_query($query))); |
|
39 | + return sha1(strtolower($verb).' '.$slug.' '.strtolower(http_build_query($query))); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | public static function generateCachePath(array $action, array $query = []) { |
48 | 48 | $class = GeneratorHelper::extractClassFromNamespace($action['class']); |
49 | 49 | $filename = self::generateHashFilename($action['http'], $action['slug'], $query); |
50 | - $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2); |
|
51 | - return $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR; |
|
50 | + $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2); |
|
51 | + return $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | session_start(); |
74 | 74 | } |
75 | 75 | // Fix for phpunits |
76 | - if(!isset($_SESSION)) { |
|
76 | + if (!isset($_SESSION)) { |
|
77 | 77 | $_SESSION = []; |
78 | 78 | } |
79 | 79 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | public static function save($user) |
128 | 128 | { |
129 | 129 | $saved = true; |
130 | - $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true) ?: []; |
|
131 | - $admins[$user['username']]['hash'] = sha1($user['username'] . $user['password']); |
|
130 | + $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true) ?: []; |
|
131 | + $admins[$user['username']]['hash'] = sha1($user['username'].$user['password']); |
|
132 | 132 | $admins[$user['username']]['profile'] = $user['profile']; |
133 | 133 | |
134 | - Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', $admins, Cache::JSONGZ, true); |
|
134 | + Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', $admins, Cache::JSONGZ, true); |
|
135 | 135 | return $saved; |
136 | 136 | } |
137 | 137 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function getAdmins() |
176 | 176 | { |
177 | - return Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true); |
|
177 | + return Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | } |
200 | 200 | if (!empty($user) && !empty($admins[$user])) { |
201 | 201 | $auth = $admins[$user]['hash']; |
202 | - $this->authorized = ($auth === sha1($user . $pass)); |
|
202 | + $this->authorized = ($auth === sha1($user.$pass)); |
|
203 | 203 | if ($this->authorized) { |
204 | - $this->updateAdmin($user , $admins[$user]['profile']); |
|
204 | + $this->updateAdmin($user, $admins[$user]['profile']); |
|
205 | 205 | ResponseHelper::setCookieHeaders([ |
206 | 206 | [ |
207 | 207 | 'name' => $this->getHash(), |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | ]); |
213 | 213 | $this->setSessionKey(self::LOGGED_USER_TOKEN, base64_encode("{$user}:{$pass}")); |
214 | 214 | } |
215 | - } else { |
|
215 | + }else { |
|
216 | 216 | $this->admin = null; |
217 | 217 | $this->setSessionKey(self::ADMIN_ID_TOKEN, null); |
218 | 218 | } |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | public static function checkApiActions($namespace, $domain, $api) { |
18 | 18 | $actions = []; |
19 | 19 | $reflector = new \ReflectionClass($namespace); |
20 | - if(null !== $reflector) { |
|
21 | - foreach($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $apiAction) { |
|
20 | + if (null !== $reflector) { |
|
21 | + foreach ($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $apiAction) { |
|
22 | 22 | $docComments = $apiAction->getDocComment(); |
23 | 23 | $action = self::extractAction($docComments); |
24 | - if(null !== $action) { |
|
24 | + if (null !== $action) { |
|
25 | 25 | list($route, $info) = RouterHelper::extractRouteInfo($apiAction, $api, $domain); |
26 | 26 | list($method, $cleanRoute) = RouterHelper::extractHttpRoute($route); |
27 | 27 | $formAction = new FormAction(); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $action = null; |
46 | 46 | if (false !== preg_match('/@action\s+([^\s]+)/', $doc, $matches)) { |
47 | - if(count($matches) > 1) { |
|
47 | + if (count($matches) > 1) { |
|
48 | 48 | list(, $action) = $matches; |
49 | 49 | } |
50 | 50 | } |