@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | Logger::log('Configuration saved successful'); |
| 66 | 66 | Security::getInstance()->setFlash("callback_message", t("Usuario agregado correctamente")); |
| 67 | 67 | Security::getInstance()->setFlash("callback_route", Router::getInstance()->getRoute("admin", true)); |
| 68 | - } else { |
|
| 68 | + }else { |
|
| 69 | 69 | throw new ConfigException(t('Error al guardar los administradores, prueba a cambiar los permisos')); |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | if ($this->isAdmin()) { |
| 101 | 101 | $this->redirect('admin'); |
| 102 | - } else { |
|
| 102 | + }else { |
|
| 103 | 103 | return Admin::staticAdminLogon(); |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | { |
| 51 | 51 | $this->generateSlugs(); |
| 52 | 52 | GeneratorHelper::createDir(CONFIG_DIR); |
| 53 | - Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', [$this->routing, $this->getSlugs()], Cache::JSON, TRUE); |
|
| 53 | + Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', [$this->routing, $this->getSlugs()], Cache::JSON, TRUE); |
|
| 54 | 54 | |
| 55 | 55 | return $this; |
| 56 | 56 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | 'attachments' => [ |
| 31 | 31 | [ |
| 32 | 32 | "author_name" => $request->getRootUrl(true), |
| 33 | - "text" => $file . ($line !== '' ? ' [' . $line . ']' : ''), |
|
| 33 | + "text" => $file.($line !== '' ? ' ['.$line.']' : ''), |
|
| 34 | 34 | "color" => Config::getParam('debug', true) ? 'warning' : "danger", |
| 35 | 35 | "title" => $message, |
| 36 | 36 | 'fallback' => 'PSFS Error notifier', |
@@ -34,20 +34,20 @@ |
||
| 34 | 34 | $scripts = $this->getNode("scripts"); |
| 35 | 35 | |
| 36 | 36 | //Creamos el parser |
| 37 | - $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')') |
|
| 37 | + $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\''.$this->type.'\')') |
|
| 38 | 38 | ->raw(";\n"); |
| 39 | 39 | |
| 40 | 40 | //Asociamos el hash |
| 41 | - $compiler->write('$parser->setHash(\'' . $this->hash . '\')') |
|
| 41 | + $compiler->write('$parser->setHash(\''.$this->hash.'\')') |
|
| 42 | 42 | ->raw(";\n"); |
| 43 | 43 | |
| 44 | 44 | //Inicializamos SRI |
| 45 | - $compiler->write('$parser->init(\'' . $this->type . '\')') |
|
| 45 | + $compiler->write('$parser->init(\''.$this->type.'\')') |
|
| 46 | 46 | ->raw(";\n"); |
| 47 | 47 | |
| 48 | 48 | //Asociamos los ficheros |
| 49 | 49 | foreach ($scripts->getAttribute("value") as $value) { |
| 50 | - $compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n"); |
|
| 50 | + $compiler->write('$parser->addFile(\''.$value.'\')')->raw(";\n"); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | //Procesamos los ficheros |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $platform = trim(Config::getInstance()->get('platform.name', 'PSFS')); |
| 36 | 36 | header('HTTP/1.1 401 Unauthorized'); |
| 37 | - header('WWW-Authenticate: Basic Realm="' . $platform . '"'); |
|
| 37 | + header('WWW-Authenticate: Basic Realm="'.$platform.'"'); |
|
| 38 | 38 | echo t('Zona restringida'); |
| 39 | 39 | exit(); |
| 40 | 40 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $admin['class'] = 'primary'; |
| 77 | 77 | break; |
| 78 | 78 | } |
| 79 | - } else { |
|
| 79 | + }else { |
|
| 80 | 80 | $admin['class'] = 'primary'; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $headers = []; |
| 90 | 90 | foreach ($this->getHeaders() as $key => $value) { |
| 91 | - $headers[] = $key . ': ' . $value; |
|
| 91 | + $headers[] = $key.': '.$value; |
|
| 92 | 92 | } |
| 93 | 93 | $headers[self::PSFS_TRACK_HEADER] = Logger::getUid(); |
| 94 | 94 | if (count($headers)) { |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | case Request::VERB_GET: |
| 119 | 119 | if (!empty($this->params)) { |
| 120 | 120 | $sep = !str_contains($this->getUrl(), '?') ? '?' : ''; |
| 121 | - $this->setUrl($this->getUrl() . $sep . http_build_query($this->getParams()), false); |
|
| 121 | + $this->setUrl($this->getUrl().$sep.http_build_query($this->getParams()), false); |
|
| 122 | 122 | } |
| 123 | 123 | break; |
| 124 | 124 | case Request::VERB_POST: |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | if ($this->isDebug() && is_resource($verbose)) { |
| 150 | 150 | $this->dumpVerboseLogs($verbose); |
| 151 | 151 | } |
| 152 | - Logger::log($this->getUrl() . ' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
| 152 | + Logger::log($this->getUrl().' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]); |
|
| 153 | 153 | $this->info = array_merge($this->info, curl_getinfo($this->con)); |
| 154 | 154 | } |
| 155 | 155 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param true $isArray |
| 30 | 30 | * @return array |
| 31 | 31 | */ |
| 32 | - public function processPayload(array|string $namespace, bool $isArray): array |
|
| 32 | + public function processPayload(array | string $namespace, bool $isArray): array |
|
| 33 | 33 | { |
| 34 | 34 | if (false !== strpos($namespace, '[') && false !== strpos($namespace, ']')) { |
| 35 | 35 | $namespace = str_replace(']', '', str_replace('[', '', $namespace)); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | list($isArray, $payload) = $this->processPayload($namespace, $isArray); |
| 103 | 103 | $reflector = new ReflectionClass($namespace); |
| 104 | 104 | $shortName = $reflector->getShortName(); |
| 105 | - } else { |
|
| 105 | + }else { |
|
| 106 | 106 | $namespace = $model; |
| 107 | 107 | $shortName = $model; |
| 108 | 108 | } |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | if ($module === $requestModule && !preg_match('/^ROOT/i', $module)) { |
| 178 | 178 | $modules = [ |
| 179 | 179 | 'name' => $module, |
| 180 | - 'path' => realpath(dirname($info['base'] . DIRECTORY_SEPARATOR . '..')), |
|
| 180 | + 'path' => realpath(dirname($info['base'].DIRECTORY_SEPARATOR.'..')), |
|
| 181 | 181 | ]; |
| 182 | 182 | } |
| 183 | - } catch (Exception $e) { |
|
| 183 | + }catch (Exception $e) { |
|
| 184 | 184 | $modules[] = $e->getMessage(); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) { |
| 224 | 224 | $payload = $this->extractDtoProperties($namespace); |
| 225 | 225 | } |
| 226 | - } catch (Exception $e) { |
|
| 226 | + }catch (Exception $e) { |
|
| 227 | 227 | Logger::log($e->getMessage(), LOG_ERR); |
| 228 | 228 | } |
| 229 | 229 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | foreach ($domains as $domain => $routes) { |
| 38 | 38 | $pDomain = str_replace('@', '', $domain); |
| 39 | 39 | $pDomain = str_replace('/', '', $pDomain); |
| 40 | - $response[] = strtolower($pDomain) . '.api.secret'; |
|
| 40 | + $response[] = strtolower($pDomain).'.api.secret'; |
|
| 41 | 41 | } |
| 42 | 42 | return $this->json($response); |
| 43 | 43 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function config() |
| 55 | 55 | { |
| 56 | - Logger::log("Config loaded executed by " . $this->getRequest()->getRequestUri()); |
|
| 56 | + Logger::log("Config loaded executed by ".$this->getRequest()->getRequestUri()); |
|
| 57 | 57 | if (defined('PSFS_UNIT_TESTING_EXECUTION')) { |
| 58 | 58 | throw new ConfigException('CONFIG'); |
| 59 | 59 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | Security::getInstance()->setFlash("callback_message", t("Configuración actualizada correctamente")); |
| 94 | 94 | Security::getInstance()->setFlash("callback_route", $this->getRoute("admin-config", true)); |
| 95 | - } else { |
|
| 95 | + }else { |
|
| 96 | 96 | throw new HttpException(t('Error al guardar la configuración, prueba a cambiar los permisos'), 403); |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | GeneratorHelper::createDir(dirname($path)); |
| 58 | 58 | if (false === FileHelper::writeFile($path, $data)) { |
| 59 | - throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ') . $path); |
|
| 59 | + throw new ConfigException(t('No se tienen los permisos suficientes para escribir en el fichero ').$path); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | { |
| 71 | 71 | Inspector::stats('[Cache] Gathering data from cache', Inspector::SCOPE_DEBUG); |
| 72 | 72 | $data = null; |
| 73 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 73 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 74 | 74 | if (file_exists($absolutePath)) { |
| 75 | 75 | $data = FileHelper::readFile($absolutePath); |
| 76 | 76 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | private function hasExpiredCache($path, $expires = 300, $absolute = false) |
| 87 | 87 | { |
| 88 | 88 | Inspector::stats('[Cache] Checking expiration', Inspector::SCOPE_DEBUG); |
| 89 | - $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 89 | + $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 90 | 90 | $lasModificationDate = filemtime($absolutePath); |
| 91 | 91 | return ($lasModificationDate + $expires <= time()); |
| 92 | 92 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | { |
| 154 | 154 | Inspector::stats('[Cache] Store data in cache', Inspector::SCOPE_DEBUG); |
| 155 | 155 | $data = self::transformData($data, $transform); |
| 156 | - $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path; |
|
| 156 | + $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path; |
|
| 157 | 157 | $this->saveTextToFile($data, $absolutePath); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | public function readFromCache($path, $expires = 300, $function = null, $transform = Cache::TEXT, $ignoreExpiration = false) |
| 171 | 171 | { |
| 172 | 172 | $data = null; |
| 173 | - Inspector::stats('[Cache] Reading data from cache: ' . json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
| 174 | - if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) { |
|
| 173 | + Inspector::stats('[Cache] Reading data from cache: '.json_encode(['path' => $path]), Inspector::SCOPE_DEBUG); |
|
| 174 | + if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) { |
|
| 175 | 175 | if (is_callable($function) && $this->hasExpiredCache($path, $expires) && !$ignoreExpiration) { |
| 176 | 176 | $data = $function(); |
| 177 | 177 | $this->storeData($path, $data, $transform); |
| 178 | - } else { |
|
| 178 | + }else { |
|
| 179 | 179 | $data = $this->getDataFromFile($path, $transform); |
| 180 | 180 | } |
| 181 | 181 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $query[Api::HEADER_API_LANG] = Request::header(Api::HEADER_API_LANG, 'es'); |
| 222 | 222 | $filename = FileHelper::generateHashFilename($action['http'], $action['slug'], $query); |
| 223 | 223 | $hashPath = FileHelper::generateCachePath($action, $query); |
| 224 | - Inspector::stats('[Cache] Cache file calculated: ' . json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
| 224 | + Inspector::stats('[Cache] Cache file calculated: '.json_encode(['file' => $filename, 'hash' => $hashPath]), Inspector::SCOPE_DEBUG); |
|
| 225 | 225 | Logger::log('Cache file calculated', LOG_DEBUG, ['file' => $filename, 'hash' => $hashPath]); |
| 226 | 226 | } |
| 227 | 227 | return [$hashPath, $filename]; |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | Inspector::stats('[Cache] Flushing cache', Inspector::SCOPE_DEBUG); |
| 234 | 234 | $action = Security::getInstance()->getSessionKey(self::CACHE_SESSION_VAR); |
| 235 | 235 | if (is_array($action)) { |
| 236 | - $hashPath = FileHelper::generateCachePath($action, $action['params']) . '..' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR; |
|
| 236 | + $hashPath = FileHelper::generateCachePath($action, $action['params']).'..'.DIRECTORY_SEPARATOR.' .. '.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR; |
|
| 237 | 237 | if (!file_exists($hashPath)) { |
| 238 | - $hashPath = CACHE_DIR . DIRECTORY_SEPARATOR . $hashPath; |
|
| 238 | + $hashPath = CACHE_DIR.DIRECTORY_SEPARATOR.$hashPath; |
|
| 239 | 239 | } |
| 240 | 240 | FileHelper::deleteDir($hashPath); |
| 241 | 241 | } |