@@ -31,14 +31,18 @@ |
||
| 31 | 31 | //Hidratamos con los comandos de PSFS |
| 32 | 32 | $commands = new Finder(); |
| 33 | 33 | $commands->in(__DIR__)->notName("PSFSConsole.php"); |
| 34 | - foreach ($commands as $com) include_once($com->getRealPath()); |
|
| 34 | + foreach ($commands as $com) { |
|
| 35 | + include_once($com->getRealPath()); |
|
| 36 | + } |
|
| 35 | 37 | |
| 36 | 38 | //Hidratamos con los comandos de los módulos |
| 37 | 39 | if (file_exists(CORE_DIR)) |
| 38 | 40 | { |
| 39 | 41 | $commands = new Finder(); |
| 40 | 42 | $commands->in(CORE_DIR)->path("Command")->name("*.php"); |
| 41 | - foreach ($commands as $com) include_once($com->getRealPath()); |
|
| 43 | + foreach ($commands as $com) { |
|
| 44 | + include_once($com->getRealPath()); |
|
| 45 | + } |
|
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | $console->run(); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $array = array(); |
| 23 | 23 | $array['fields'] = array(); |
| 24 | - foreach($this->fields as $field) { |
|
| 24 | + foreach ($this->fields as $field) { |
|
| 25 | 25 | $array['fields'][] = $field->__toArray(); |
| 26 | 26 | } |
| 27 | 27 | return $array; |
@@ -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']; |
@@ -7,7 +7,19 @@ |
||
| 7 | 7 | * @package PSFS\base\types\interfaces |
| 8 | 8 | */ |
| 9 | 9 | interface AuthInterface { |
| 10 | + |
|
| 11 | + /** |
|
| 12 | + * @return boolean |
|
| 13 | + */ |
|
| 10 | 14 | function isLogged(); |
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * @return boolean |
|
| 18 | + */ |
|
| 11 | 19 | function isAdmin(); |
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * @return boolean |
|
| 23 | + */ |
|
| 12 | 24 | function canDo($action); |
| 13 | 25 | } |
@@ -7,6 +7,14 @@ |
||
| 7 | 7 | * @package PSFS\base\types\interfaces |
| 8 | 8 | */ |
| 9 | 9 | interface ControllerInterface { |
| 10 | + |
|
| 11 | + /** |
|
| 12 | + * @return string|null |
|
| 13 | + */ |
|
| 10 | 14 | public function render($template, Array $vars = null); |
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * @return void |
|
| 18 | + */ |
|
| 11 | 19 | public function response($response, $type = 'text/html'); |
| 12 | 20 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | use PSFS\base\config\Config; |
| 6 | 6 | use PSFS\base\Service; |
| 7 | 7 | |
| 8 | - class GeneratorService extends Service{ |
|
| 8 | + class GeneratorService extends Service { |
|
| 9 | 9 | /** |
| 10 | 10 | * @Inyectable |
| 11 | 11 | * @var \PSFS\base\config\Config Servicio de configuración |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public static function findTranslations($path, $locale) |
| 32 | 32 | { |
| 33 | - $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
| 34 | - $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
| 33 | + $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
| 34 | + $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
| 35 | 35 | |
| 36 | 36 | $translations = array(); |
| 37 | - if(file_exists($path)) |
|
| 37 | + if (file_exists($path)) |
|
| 38 | 38 | { |
| 39 | 39 | $d = dir($path); |
| 40 | - while(false !== ($dir = $d->read())) |
|
| 40 | + while (false !== ($dir = $d->read())) |
|
| 41 | 41 | { |
| 42 | 42 | Config::createDir($locale_path); |
| 43 | - if(!file_exists($locale_path . 'translations.po')) { |
|
| 44 | - file_put_contents($locale_path . 'translations.po', ''); |
|
| 43 | + if (!file_exists($locale_path.'translations.po')) { |
|
| 44 | + file_put_contents($locale_path.'translations.po', ''); |
|
| 45 | 45 | } |
| 46 | 46 | $inspect_path = realpath($path.DIRECTORY_SEPARATOR.$dir); |
| 47 | - $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ". $inspect_path . DIRECTORY_SEPARATOR ."*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po"; |
|
| 48 | - if(is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./',$dir) == 0) |
|
| 47 | + $cmd_php = "export PATH=\$PATH:/opt/local/bin; xgettext ".$inspect_path.DIRECTORY_SEPARATOR."*.php --from-code=UTF-8 -j -L PHP --debug --force-po -o {$locale_path}translations.po"; |
|
| 48 | + if (is_dir($path.DIRECTORY_SEPARATOR.$dir) && preg_match('/^\./', $dir) == 0) |
|
| 49 | 49 | { |
| 50 | - $res = _('Revisando directorio: ') . $inspect_path; |
|
| 51 | - $res .= _('Comando ejecutado: '). $cmd_php; |
|
| 50 | + $res = _('Revisando directorio: ').$inspect_path; |
|
| 51 | + $res .= _('Comando ejecutado: ').$cmd_php; |
|
| 52 | 52 | $res .= shell_exec($cmd_php); |
| 53 | 53 | usleep(10); |
| 54 | 54 | $translations[] = $res; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function createStructureModule($module, $force = false, $type = "") |
| 70 | 70 | { |
| 71 | - $mod_path = CORE_DIR . DIRECTORY_SEPARATOR; |
|
| 71 | + $mod_path = CORE_DIR.DIRECTORY_SEPARATOR; |
|
| 72 | 72 | $module = ucfirst($module); |
| 73 | 73 | $this->createModulePath($module, $mod_path); |
| 74 | 74 | $this->createModulePathTree($module, $mod_path); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | //Creamos el directorio base de los módulos |
| 90 | 90 | Config::createDir($mod_path); |
| 91 | 91 | //Creamos la carpeta del módulo |
| 92 | - Config::createDir($mod_path . $module); |
|
| 92 | + Config::createDir($mod_path.$module); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -102,13 +102,13 @@ discard block |
||
| 102 | 102 | //Creamos las carpetas CORE del módulo |
| 103 | 103 | $this->log->infoLog("Generamos la estructura"); |
| 104 | 104 | $paths = array("Api", "Api/base", "Config", "Controller", "Form", "Models", "Public", "Templates", "Services", "Test"); |
| 105 | - foreach($paths as $path) { |
|
| 106 | - Config::createDir($mod_path . $module . DIRECTORY_SEPARATOR . $path); |
|
| 105 | + foreach ($paths as $path) { |
|
| 106 | + Config::createDir($mod_path.$module.DIRECTORY_SEPARATOR.$path); |
|
| 107 | 107 | } |
| 108 | 108 | //Creamos las carpetas de los assets |
| 109 | 109 | $htmlPaths = array("css", "js", "img", "media", "font"); |
| 110 | - foreach($htmlPaths as $path) { |
|
| 111 | - Config::createDir($mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . $path); |
|
| 110 | + foreach ($htmlPaths as $path) { |
|
| 111 | + Config::createDir($mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR.$path); |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
@@ -138,15 +138,15 @@ discard block |
||
| 138 | 138 | private function createModuleModels($module) |
| 139 | 139 | { |
| 140 | 140 | //Generamos las clases de propel y la configuración |
| 141 | - $exec = "export PATH=\$PATH:/opt/local/bin; " . BASE_DIR . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "propel "; |
|
| 142 | - $schemaOpt = " --schema-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config"; |
|
| 143 | - $opt = " --config-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config --output-dir=" . CORE_DIR . " --verbose"; |
|
| 144 | - $ret = shell_exec($exec . "build" . $opt . $schemaOpt); |
|
| 141 | + $exec = "export PATH=\$PATH:/opt/local/bin; ".BASE_DIR.DIRECTORY_SEPARATOR."vendor".DIRECTORY_SEPARATOR."bin".DIRECTORY_SEPARATOR."propel "; |
|
| 142 | + $schemaOpt = " --schema-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config"; |
|
| 143 | + $opt = " --config-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config --output-dir=".CORE_DIR." --verbose"; |
|
| 144 | + $ret = shell_exec($exec."build".$opt.$schemaOpt); |
|
| 145 | 145 | |
| 146 | 146 | $this->log->infoLog("Generamos clases invocando a propel:\n $ret"); |
| 147 | - $ret = shell_exec($exec . "sql:build" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config" . $schemaOpt); |
|
| 147 | + $ret = shell_exec($exec."sql:build".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config".$schemaOpt); |
|
| 148 | 148 | $this->log->infoLog("Generamos sql invocando a propel:\n $ret"); |
| 149 | - $ret = shell_exec($exec . "config:convert" . $opt . " --output-dir=" . CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Config"); |
|
| 149 | + $ret = shell_exec($exec."config:convert".$opt." --output-dir=".CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Config"); |
|
| 150 | 150 | $this->log->infoLog("Generamos configuración invocando a propel:\n $ret"); |
| 151 | 151 | } |
| 152 | 152 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | "module" => $module, |
| 166 | 166 | "controllerType" => $controllerType, |
| 167 | 167 | )); |
| 168 | - return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Controller" . DIRECTORY_SEPARATOR . "{$module}Controller.php", $force); |
|
| 168 | + return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Controller".DIRECTORY_SEPARATOR."{$module}Controller.php", $force); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | private function generateBaseApiTemplate($module, $mod_path, $force = false, $controllerType = "") |
| 179 | 179 | { |
| 180 | 180 | $created = true; |
| 181 | - $modelPath = $mod_path . $module . DIRECTORY_SEPARATOR . 'Models'; |
|
| 182 | - if(file_exists($modelPath)) { |
|
| 181 | + $modelPath = $mod_path.$module.DIRECTORY_SEPARATOR.'Models'; |
|
| 182 | + if (file_exists($modelPath)) { |
|
| 183 | 183 | $dir = dir($modelPath); |
| 184 | - while($file = $dir->read()) { |
|
| 185 | - if(!in_array($file, array('.', '..')) && !preg_match('/Query\.php$/i', $file) && preg_match('/\.php$/i', $file)) { |
|
| 184 | + while ($file = $dir->read()) { |
|
| 185 | + if (!in_array($file, array('.', '..')) && !preg_match('/Query\.php$/i', $file) && preg_match('/\.php$/i', $file)) { |
|
| 186 | 186 | $filename = str_replace(".php", "", $file); |
| 187 | 187 | $this->log->infoLog("Generamos Api BASES para {$filename}"); |
| 188 | 188 | $this->createApiBaseFile($module, $mod_path, $filename); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | //Generamos el fichero de configuración |
| 205 | 205 | $this->log->infoLog("Generamos fichero vacío de configuración"); |
| 206 | - return $this->writeTemplateToFile("<?php\n\t", $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "config.php", $force); |
|
| 206 | + return $this->writeTemplateToFile("<?php\n\t", $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."config.php", $force); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /** |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | //Generamos el fichero de configuración |
| 218 | 218 | $this->log->infoLog("Generamos ficheros para assets base"); |
| 219 | - $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", $mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "css" . DIRECTORY_SEPARATOR . "styles.css", false); |
|
| 220 | - $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", $mod_path . $module . DIRECTORY_SEPARATOR . "Public" . DIRECTORY_SEPARATOR . "js" . DIRECTORY_SEPARATOR . "app.js", false); |
|
| 219 | + $css = $this->writeTemplateToFile("/* CSS3 STYLES */\n\n", $mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."css".DIRECTORY_SEPARATOR."styles.css", false); |
|
| 220 | + $js = $this->writeTemplateToFile("/* APP MODULE JS */\n\n(function() {\n\t'use strict';\n})();", $mod_path.$module.DIRECTORY_SEPARATOR."Public".DIRECTORY_SEPARATOR."js".DIRECTORY_SEPARATOR."app.js", false); |
|
| 221 | 221 | return ($css && $js); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $controller = $this->tpl->dump("generator/service.template.twig", array( |
| 235 | 235 | "module" => $module, |
| 236 | 236 | )); |
| 237 | - return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Services" . DIRECTORY_SEPARATOR . "{$module}Service.php", $force); |
|
| 237 | + return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Services".DIRECTORY_SEPARATOR."{$module}Service.php", $force); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $autoloader = $this->tpl->dump("generator/autoloader.template.twig", array( |
| 251 | 251 | "module" => $module, |
| 252 | 252 | )); |
| 253 | - return $this->writeTemplateToFile($autoloader, $mod_path . $module . DIRECTORY_SEPARATOR . "autoload.php", $force); |
|
| 253 | + return $this->writeTemplateToFile($autoloader, $mod_path.$module.DIRECTORY_SEPARATOR."autoload.php", $force); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | "module" => $module, |
| 268 | 268 | "db" => $this->config->get("db_name"), |
| 269 | 269 | )); |
| 270 | - return $this->writeTemplateToFile($schema, $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "schema.xml", $force); |
|
| 270 | + return $this->writeTemplateToFile($schema, $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."schema.xml", $force); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | "pass" => $this->config->get("db_password"), |
| 288 | 288 | "db" => $this->config->get("db_name"), |
| 289 | 289 | )); |
| 290 | - return $this->writeTemplateToFile($build_properties, $mod_path . $module . DIRECTORY_SEPARATOR . "Config" . DIRECTORY_SEPARATOR . "propel.yml", $force); |
|
| 290 | + return $this->writeTemplateToFile($build_properties, $mod_path.$module.DIRECTORY_SEPARATOR."Config".DIRECTORY_SEPARATOR."propel.yml", $force); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $index = $this->tpl->dump("generator/index.template.twig", array( |
| 304 | 304 | "module" => $module, |
| 305 | 305 | )); |
| 306 | - return $this->writeTemplateToFile($index, $mod_path . $module . DIRECTORY_SEPARATOR . "Templates" . DIRECTORY_SEPARATOR . "index.html.twig", $force); |
|
| 306 | + return $this->writeTemplateToFile($index, $mod_path.$module.DIRECTORY_SEPARATOR."Templates".DIRECTORY_SEPARATOR."index.html.twig", $force); |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -317,13 +317,13 @@ discard block |
||
| 317 | 317 | $created = false; |
| 318 | 318 | if ($force || !file_exists($filename)) { |
| 319 | 319 | try { |
| 320 | - $this->cache->storeData($filename, $fileContent, Cache::TEXT,true); |
|
| 320 | + $this->cache->storeData($filename, $fileContent, Cache::TEXT, true); |
|
| 321 | 321 | $created = true; |
| 322 | - } catch(\Exception $e) { |
|
| 322 | + }catch (\Exception $e) { |
|
| 323 | 323 | $this->log->errorLog($e->getMessage()); |
| 324 | 324 | } |
| 325 | - } else{ |
|
| 326 | - $this->log->errorLog($filename . _(' not exists or cant write')); |
|
| 325 | + }else { |
|
| 326 | + $this->log->errorLog($filename._(' not exists or cant write')); |
|
| 327 | 327 | } |
| 328 | 328 | return $created; |
| 329 | 329 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | "api" => $api |
| 344 | 344 | )); |
| 345 | 345 | |
| 346 | - return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . 'base' . DIRECTORY_SEPARATOR . "{$api}BaseApi.php", true); |
|
| 346 | + return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Api".DIRECTORY_SEPARATOR.'base'.DIRECTORY_SEPARATOR."{$api}BaseApi.php", true); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -362,6 +362,6 @@ discard block |
||
| 362 | 362 | "api" => $api |
| 363 | 363 | )); |
| 364 | 364 | |
| 365 | - return $this->writeTemplateToFile($controller, $mod_path . $module . DIRECTORY_SEPARATOR . "Api" . DIRECTORY_SEPARATOR . "{$api}.php", $force); |
|
| 365 | + return $this->writeTemplateToFile($controller, $mod_path.$module.DIRECTORY_SEPARATOR."Api".DIRECTORY_SEPARATOR."{$api}.php", $force); |
|
| 366 | 366 | } |
| 367 | 367 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Método que revisa las traducciones directorio a directorio |
| 28 | - * @param $path |
|
| 28 | + * @param string $path |
|
| 29 | 29 | * @param $locale |
| 30 | 30 | * @return array |
| 31 | 31 | */ |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Servicio que genera la estructura base |
| 98 | - * @param $module |
|
| 99 | - * @param $mod_path |
|
| 98 | + * @param string $module |
|
| 99 | + * @param string $mod_path |
|
| 100 | 100 | */ |
| 101 | 101 | private function createModulePathTree($module, $mod_path) |
| 102 | 102 | { |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | * Method that copy resources recursively |
| 371 | 371 | * @param string $dest |
| 372 | 372 | * @param boolean $force |
| 373 | - * @param $filename_path |
|
| 373 | + * @param string $filename_path |
|
| 374 | 374 | * @param boolean $debug |
| 375 | 375 | */ |
| 376 | 376 | public static function copyResources($dest, $force, $filename_path, $debug) |
@@ -380,7 +380,7 @@ |
||
| 380 | 380 | if (!file_exists(WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) || $debug || $force) { |
| 381 | 381 | if (is_dir($filename_path)) { |
| 382 | 382 | self::copyr($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
| 383 | - }else { |
|
| 383 | + } else { |
|
| 384 | 384 | if (@copy($filename_path, WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder) === FALSE) { |
| 385 | 385 | throw new ConfigException("Can't copy ".$filename_path." to ".WEB_DIR.$dest.DIRECTORY_SEPARATOR.$destfolder); |
| 386 | 386 | } |
@@ -371,7 +371,7 @@ |
||
| 371 | 371 | * @param array $parts |
| 372 | 372 | * @param int $partLength |
| 373 | 373 | * |
| 374 | - * @return array |
|
| 374 | + * @return string[] |
|
| 375 | 375 | */ |
| 376 | 376 | private static function extractTsAndMod(array &$parts, $partLength) |
| 377 | 377 | { |
@@ -422,7 +422,7 @@ |
||
| 422 | 422 | "type" => $type, |
| 423 | 423 | ]; |
| 424 | 424 | if (strlen($format)) { |
| 425 | - $dto['properties'][$field]['format'] = $format; |
|
| 425 | + $dto['properties'][$field]['format'] = $format; |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | if (!preg_match('/^\@ROOT/i', $domain)) { |
| 34 | 34 | $modules[] = str_replace('/', '', str_replace('@', '', $domain)); |
| 35 | 35 | } |
| 36 | - } catch (\Exception $e) { |
|
| 36 | + }catch (\Exception $e) { |
|
| 37 | 37 | $modules[] = $e->getMessage(); |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function extractApiEndpoints($module) |
| 53 | 53 | { |
| 54 | - $module_path = CORE_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . "Api"; |
|
| 54 | + $module_path = CORE_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR."Api"; |
|
| 55 | 55 | $endpoints = []; |
| 56 | 56 | if (file_exists($module_path)) { |
| 57 | 57 | $finder = new Finder(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if (count($finder)) { |
| 60 | 60 | /** @var \SplFileInfo $file */ |
| 61 | 61 | foreach ($finder as $file) { |
| 62 | - $namespace = "\\{$module}\\Api\\" . str_replace('.php', '', $file->getFilename()); |
|
| 62 | + $namespace = "\\{$module}\\Api\\".str_replace('.php', '', $file->getFilename()); |
|
| 63 | 63 | $endpoints[$namespace] = $this->extractApiInfo($namespace); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | if (NULL !== $mInfo) { |
| 89 | 89 | $info[] = $mInfo; |
| 90 | 90 | } |
| 91 | - } catch (\Exception $e) { |
|
| 91 | + }catch (\Exception $e) { |
|
| 92 | 92 | Logger::getInstance()->errorLog($e->getMessage()); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -221,9 +221,9 @@ discard block |
||
| 221 | 221 | if ($reflector->isSubclassOf(self::DTO_INTERFACE)) { |
| 222 | 222 | foreach ($reflector->getProperties(\ReflectionMethod::IS_PUBLIC) as $property) { |
| 223 | 223 | $type = $this->extractVarType($property->getDocComment()); |
| 224 | - if(class_exists($type)) { |
|
| 224 | + if (class_exists($type)) { |
|
| 225 | 225 | $properties[$property->getName()] = $this->extractModelFields($type); |
| 226 | - } else { |
|
| 226 | + }else { |
|
| 227 | 227 | $properties[$property->getName()] = $type; |
| 228 | 228 | } |
| 229 | 229 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | protected function extractReturn($model, $comments = '') |
| 244 | 244 | { |
| 245 | - $modelDto = []; |
|
| 245 | + $modelDto = []; |
|
| 246 | 246 | preg_match('/\@return\ (.*)\((.*)\)\n/i', $comments, $returnTypes); |
| 247 | 247 | if (count($returnTypes)) { |
| 248 | 248 | // Extract principal DTO information |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | } elseif (null !== $reflector && $reflector->isSubclassOf(self::DTO_INTERFACE)) { |
| 296 | 296 | $payload = $this->extractDtoProperties($namespace); |
| 297 | 297 | } |
| 298 | - } catch (\Exception $e) { |
|
| 298 | + }catch (\Exception $e) { |
|
| 299 | 299 | Logger::getInstance()->errorLog($e->getMessage()); |
| 300 | 300 | } |
| 301 | 301 | |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | if (in_array($methodInfo['method'], ['POST', 'PUT'])) { |
| 332 | 332 | $methodInfo['payload'] = $this->extractPayload($modelNamespace, $docComments); |
| 333 | 333 | } |
| 334 | - } catch (\Exception $e) { |
|
| 334 | + }catch (\Exception $e) { |
|
| 335 | 335 | jpre($e->getMessage()); |
| 336 | 336 | Logger::getInstance()->errorLog($e->getMessage()); |
| 337 | 337 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | public static function translateSwaggerFormats($format) |
| 351 | 351 | { |
| 352 | - switch(strtolower($format)) { |
|
| 352 | + switch (strtolower($format)) { |
|
| 353 | 353 | case 'bool': |
| 354 | 354 | case 'boolean': |
| 355 | 355 | $swaggerType = 'boolean'; |
@@ -410,13 +410,13 @@ discard block |
||
| 410 | 410 | ]]); |
| 411 | 411 | if (array_key_exists($subDtoName, $subDto)) { |
| 412 | 412 | $definitions = $subDto; |
| 413 | - } else { |
|
| 413 | + }else { |
|
| 414 | 414 | $definitions[$subDtoName] = $subDto; |
| 415 | 415 | } |
| 416 | 416 | $dto['properties'][$field] = [ |
| 417 | - '$ref' => "#/definitions/" . $subDtoName, |
|
| 417 | + '$ref' => "#/definitions/".$subDtoName, |
|
| 418 | 418 | ]; |
| 419 | - } else { |
|
| 419 | + }else { |
|
| 420 | 420 | list($type, $format) = self::translateSwaggerFormats($format); |
| 421 | 421 | $dto['properties'][$field] = [ |
| 422 | 422 | "type" => $type, |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | "url" => Router::getInstance()->getRoute(''), |
| 454 | 454 | ] |
| 455 | 455 | ]; |
| 456 | - foreach($endpoints as $model) { |
|
| 456 | + foreach ($endpoints as $model) { |
|
| 457 | 457 | foreach ($model as $endpoint) { |
| 458 | 458 | $dtos += self::extractSwaggerDefinition($endpoint); |
| 459 | 459 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | protected function extractDtoName($dto, $isArray = false) |
| 473 | 473 | { |
| 474 | 474 | $dto = explode('\\', $dto); |
| 475 | - $modelDto = array_pop($dto) . "Dto"; |
|
| 475 | + $modelDto = array_pop($dto)."Dto"; |
|
| 476 | 476 | if ($isArray) { |
| 477 | 477 | $modelDto .= "List"; |
| 478 | 478 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @param ModelCriteria $query |
| 182 | 182 | */ |
| 183 | - private function addOrders(ModelCriteria &$query) |
|
| 183 | + private function addOrders(ModelCriteria & $query) |
|
| 184 | 184 | { |
| 185 | 185 | $orderAdded = FALSE; |
| 186 | 186 | foreach ($this->order->getOrders() as $field => $direction) { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $orderAdded = TRUE; |
| 189 | 189 | if ($direction === Order::ASC) { |
| 190 | 190 | $query->addAscendingOrderByColumn($field); |
| 191 | - } else { |
|
| 191 | + }else { |
|
| 192 | 192 | $query->addDescendingOrderByColumn($field); |
| 193 | 193 | } |
| 194 | 194 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | * |
| 204 | 204 | * @param ModelCriteria $query |
| 205 | 205 | */ |
| 206 | - private function addExtraColumns(ModelCriteria &$query) |
|
| 206 | + private function addExtraColumns(ModelCriteria & $query) |
|
| 207 | 207 | { |
| 208 | 208 | if (!empty($this->extraColumns)) { |
| 209 | 209 | foreach ($this->extraColumns as $expression => $columnName) { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @param ModelCriteria $query |
| 219 | 219 | */ |
| 220 | - protected function joinTables(ModelCriteria &$query) |
|
| 220 | + protected function joinTables(ModelCriteria & $query) |
|
| 221 | 221 | { |
| 222 | 222 | //TODO for specific implementations |
| 223 | 223 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * |
| 228 | 228 | * @param ModelCriteria $query |
| 229 | 229 | */ |
| 230 | - private function addFilters(ModelCriteria &$query) |
|
| 230 | + private function addFilters(ModelCriteria & $query) |
|
| 231 | 231 | { |
| 232 | 232 | if (count($this->query) > 0) { |
| 233 | 233 | foreach ($this->query as $field => $value) { |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $text = preg_replace('/(\'|\")/', '', $value); |
| 246 | 246 | $text = preg_replace('/\ /', '%', $text); |
| 247 | 247 | $query->filterBy($tableField, '%'.$text.'%', Criteria::LIKE); |
| 248 | - } else { |
|
| 248 | + }else { |
|
| 249 | 249 | $query->filterBy($tableField, $value, Criteria::EQUAL); |
| 250 | 250 | } |
| 251 | 251 | } |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | list($page, $limit) = $this->extractPagination(); |
| 269 | 269 | if ($limit == -1) { |
| 270 | 270 | $this->list = $query->find($this->con); |
| 271 | - } else { |
|
| 271 | + }else { |
|
| 272 | 272 | $this->list = $query->paginate($page, $limit, $this->con); |
| 273 | 273 | } |
| 274 | - } catch (\Exception $e) { |
|
| 274 | + }catch (\Exception $e) { |
|
| 275 | 275 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | $this->joinTables($query); |
| 289 | 289 | $this->addExtraColumns($query); |
| 290 | 290 | $this->model = $query->findPk($pk); |
| 291 | - } catch (\Exception $e) { |
|
| 291 | + }catch (\Exception $e) { |
|
| 292 | 292 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 293 | 293 | } |
| 294 | 294 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $saved = TRUE; |
| 377 | 377 | $model = $this->model->toArray(); |
| 378 | 378 | } |
| 379 | - } catch (\Exception $e) { |
|
| 379 | + }catch (\Exception $e) { |
|
| 380 | 380 | jpre($e->getMessage(), TRUE); |
| 381 | 381 | Logger::getInstance()->errorLog($e->getMessage()); |
| 382 | 382 | } |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | $this->model->delete($this->con); |
| 406 | 406 | $deleted = TRUE; |
| 407 | 407 | } |
| 408 | - } catch (\Exception $e) { |
|
| 408 | + }catch (\Exception $e) { |
|
| 409 | 409 | Logger::getInstance(get_class($this->model))->errorLog($e->getMessage()); |
| 410 | 410 | } |
| 411 | 411 | } |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | private function extractQuery() |
| 451 | 451 | { |
| 452 | - $queryReflector = new \ReflectionClass($this->getModelNamespace() . "Query"); |
|
| 452 | + $queryReflector = new \ReflectionClass($this->getModelNamespace()."Query"); |
|
| 453 | 453 | /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */ |
| 454 | 454 | $query = $queryReflector->getMethod('create')->invoke(NULL); |
| 455 | 455 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | if ($this->con->inTransaction()) { |
| 494 | 494 | if ($status === 200) { |
| 495 | 495 | $this->con->commit(); |
| 496 | - } else { |
|
| 496 | + }else { |
|
| 497 | 497 | $this->con->rollBack(); |
| 498 | 498 | } |
| 499 | 499 | } |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | return $this->render('api.admin.html.twig', array( |
| 538 | 538 | "api" => $this->getApi(), |
| 539 | 539 | "domain" => $this->domain, |
| 540 | - "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('api-' . $this->getApi() . "-pk"), TRUE)), |
|
| 540 | + "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('api-'.$this->getApi()."-pk"), TRUE)), |
|
| 541 | 541 | )); |
| 542 | 542 | } |
| 543 | 543 | |
@@ -559,16 +559,16 @@ discard block |
||
| 559 | 559 | /** @var TableMap $map */ |
| 560 | 560 | $map = $this->getModelTableMap(); |
| 561 | 561 | $fields = $map::getTableMap(); |
| 562 | - foreach($fields->getFieldNames() as $field) { |
|
| 562 | + foreach ($fields->getFieldNames() as $field) { |
|
| 563 | 563 | $fDto = new Field($field, _($field)); |
| 564 | 564 | /** @var ColumnMap $mappedColumn */ |
| 565 | 565 | $mappedColumn = $fields->getColumn($field); |
| 566 | - if($mappedColumn->isForeignKey()) { |
|
| 566 | + if ($mappedColumn->isForeignKey()) { |
|
| 567 | 567 | $fDto->type = Field::COMBO_TYPE; |
| 568 | 568 | $fDto->required = $mappedColumn->isNotNull(); |
| 569 | 569 | $relatedModel = strtolower($mappedColumn->getRelation()->getForeignTable()->getPhpName()); |
| 570 | 570 | $fDto->entity = $relatedModel; |
| 571 | - $fDto->url = Router::getInstance()->getRoute('api-' . $relatedModel . '-pk'); |
|
| 571 | + $fDto->url = Router::getInstance()->getRoute('api-'.$relatedModel.'-pk'); |
|
| 572 | 572 | } elseif ($mappedColumn->isPrimaryKey()) { |
| 573 | 573 | $fDto->type = Field::HIDDEN_TYPE; |
| 574 | 574 | $fDto->required = false; |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | $return = $this->list->toArray(); |
| 596 | 596 | $total = $this->list->getNbResults(); |
| 597 | 597 | $pages = $this->list->getLastPage(); |
| 598 | - } catch (\Exception $e) { |
|
| 598 | + }catch (\Exception $e) { |
|
| 599 | 599 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 600 | 600 | } |
| 601 | 601 | |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | $return = array(); |
| 616 | 616 | if (NULL === $model) { |
| 617 | 617 | $code = 404; |
| 618 | - } else { |
|
| 618 | + }else { |
|
| 619 | 619 | $return = $model->toArray(); |
| 620 | 620 | } |
| 621 | 621 | |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | use PSFS\controller\Admin; |
| 7 | 7 | use Symfony\Component\Finder\Finder; |
| 8 | 8 | |
| 9 | - class AdminServices extends Service{ |
|
| 9 | + class AdminServices extends Service { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @Inyectable |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | public function setAdminHeaders() |
| 32 | 32 | { |
| 33 | - if("login" === $this->config->get("admin_login")) return Admin::getInstance()->adminLogin("admin-setup"); |
|
| 33 | + if ("login" === $this->config->get("admin_login")) return Admin::getInstance()->adminLogin("admin-setup"); |
|
| 34 | 34 | $platform = trim(Config::getInstance()->get("platform_name")); |
| 35 | 35 | header('HTTP/1.1 401 Unauthorized'); |
| 36 | - header('WWW-Authenticate: Basic Realm="' . $platform. '"'); |
|
| 36 | + header('WWW-Authenticate: Basic Realm="'.$platform.'"'); |
|
| 37 | 37 | echo _("Zona restringida"); |
| 38 | 38 | exit(); |
| 39 | 39 | } |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | public function getAdmins() |
| 46 | 46 | { |
| 47 | 47 | $admins = $this->security->getAdmins(); |
| 48 | - if(!empty($admins)) |
|
| 48 | + if (!empty($admins)) |
|
| 49 | 49 | { |
| 50 | - if(!$this->security->checkAdmin()) |
|
| 50 | + if (!$this->security->checkAdmin()) |
|
| 51 | 51 | { |
| 52 | 52 | $this->setAdminHeaders(); |
| 53 | 53 | } |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | private function parseAdmins(&$admins) |
| 64 | 64 | { |
| 65 | - if(!empty($admins)) foreach($admins as &$admin) |
|
| 65 | + if (!empty($admins)) foreach ($admins as &$admin) |
|
| 66 | 66 | { |
| 67 | - if(isset($admin["profile"])) |
|
| 67 | + if (isset($admin["profile"])) |
|
| 68 | 68 | { |
| 69 | - switch($admin["profile"]) { |
|
| 69 | + switch ($admin["profile"]) { |
|
| 70 | 70 | case sha1('admin'): $admin['class'] = 'warning'; break; |
| 71 | 71 | case sha1('superadmin'): $admin['class'] = 'info'; break; |
| 72 | 72 | default: |
| 73 | 73 | case sha1('user'): $admin['class'] = 'primary'; break; |
| 74 | 74 | } |
| 75 | - }else{ |
|
| 75 | + }else { |
|
| 76 | 76 | $admin["class"] = "primary"; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | $files->files()->in(LOG_DIR)->name("*.log")->sortByModifiedTime(); |
| 89 | 89 | $logs = array(); |
| 90 | 90 | /** @var \SplFileInfo $file */ |
| 91 | - foreach($files as $file) |
|
| 91 | + foreach ($files as $file) |
|
| 92 | 92 | { |
| 93 | - $size = $file->getSize() / 8 / 1024; |
|
| 93 | + $size = $file->getSize()/8/1024; |
|
| 94 | 94 | $time = date("c", $file->getMTime()); |
| 95 | 95 | $dateTime = new \DateTime($time); |
| 96 | - if(!isset($logs[$dateTime->format("Y")])) $logs[$dateTime->format("Y")] = array(); |
|
| 96 | + if (!isset($logs[$dateTime->format("Y")])) $logs[$dateTime->format("Y")] = array(); |
|
| 97 | 97 | $logs[$dateTime->format("Y")][$dateTime->format("m")][$time] = array( |
| 98 | 98 | "filename" => $file->getFilename(), |
| 99 | 99 | "size" => round($size, 3) |
@@ -117,27 +117,27 @@ discard block |
||
| 117 | 117 | $files->files()->in(LOG_DIR)->name($selectedLog); |
| 118 | 118 | $file = null; |
| 119 | 119 | $log = array(); |
| 120 | - foreach($files as $match) |
|
| 120 | + foreach ($files as $match) |
|
| 121 | 121 | { |
| 122 | 122 | $file = $match; |
| 123 | 123 | break; |
| 124 | 124 | } |
| 125 | 125 | /** @var \SplFileInfo $file */ |
| 126 | - if(!empty($file)) |
|
| 126 | + if (!empty($file)) |
|
| 127 | 127 | { |
| 128 | 128 | $time = date("c", $file->getMTime()); |
| 129 | 129 | $dateTime = new \DateTime($time); |
| 130 | 130 | $monthOpen = $dateTime->format("m"); |
| 131 | - $content = file($file->getPath() . DIRECTORY_SEPARATOR . $file->getFilename()); |
|
| 131 | + $content = file($file->getPath().DIRECTORY_SEPARATOR.$file->getFilename()); |
|
| 132 | 132 | krsort($content); |
| 133 | 133 | $detailLog = array(); |
| 134 | - foreach($content as &$line) |
|
| 134 | + foreach ($content as &$line) |
|
| 135 | 135 | { |
| 136 | 136 | list($line, $detail) = $this->parseLogLine($line, $match); |
| 137 | 137 | $detailLog[] = array_merge(array( |
| 138 | 138 | "log" => $line, |
| 139 | 139 | ), $detail); |
| 140 | - if(count($detailLog) >= 1000) break; |
|
| 140 | + if (count($detailLog) >= 1000) break; |
|
| 141 | 141 | } |
| 142 | 142 | $log = $detailLog; |
| 143 | 143 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $type = (isset($match[1][0])) ? $match[1][0] : ''; |
| 168 | 168 | $type = explode(".", $type); |
| 169 | - $type = count($type)>1 ? $type[1] : $type[0]; |
|
| 169 | + $type = count($type) > 1 ? $type[1] : $type[0]; |
|
| 170 | 170 | switch ($type) { |
| 171 | 171 | case 'INFO': |
| 172 | 172 | $detail["type"] = "success"; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | break; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - } catch (\Exception $e) { |
|
| 185 | + }catch (\Exception $e) { |
|
| 186 | 186 | $detail = array( |
| 187 | 187 | "type" => "danger", |
| 188 | 188 | ); |
@@ -31,7 +31,9 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function setAdminHeaders() |
| 33 | 33 | { |
| 34 | - if("login" === $this->config->get("admin_login")) return Admin::getInstance()->adminLogin("admin-setup"); |
|
| 34 | + if("login" === $this->config->get("admin_login")) { |
|
| 35 | + return Admin::getInstance()->adminLogin("admin-setup"); |
|
| 36 | + } |
|
| 35 | 37 | $platform = trim(Config::getInstance()->get("platform_name")); |
| 36 | 38 | header('HTTP/1.1 401 Unauthorized'); |
| 37 | 39 | header('WWW-Authenticate: Basic Realm="' . $platform. '"'); |
@@ -63,17 +65,20 @@ discard block |
||
| 63 | 65 | */ |
| 64 | 66 | private function parseAdmins(&$admins) |
| 65 | 67 | { |
| 66 | - if(!empty($admins)) foreach($admins as &$admin) |
|
| 68 | + if(!empty($admins)) { |
|
| 69 | + foreach($admins as &$admin) |
|
| 67 | 70 | { |
| 68 | 71 | if(isset($admin["profile"])) |
| 69 | 72 | { |
| 70 | 73 | switch($admin["profile"]) { |
| 71 | - case Security::MANAGER_ID_TOKEN: $admin['class'] = 'warning'; break; |
|
| 74 | + case Security::MANAGER_ID_TOKEN: $admin['class'] = 'warning'; |
|
| 75 | + } |
|
| 76 | + break; |
|
| 72 | 77 | case Security::ADMIN_ID_TOKEN: $admin['class'] = 'info'; break; |
| 73 | 78 | default: |
| 74 | 79 | case Security::USER_ID_TOKEN: $admin['class'] = 'primary'; break; |
| 75 | 80 | } |
| 76 | - }else{ |
|
| 81 | + } else{ |
|
| 77 | 82 | $admin["class"] = "primary"; |
| 78 | 83 | } |
| 79 | 84 | } |
@@ -94,7 +99,9 @@ discard block |
||
| 94 | 99 | $size = $file->getSize() / 8 / 1024; |
| 95 | 100 | $time = date("c", $file->getMTime()); |
| 96 | 101 | $dateTime = new \DateTime($time); |
| 97 | - if(!isset($logs[$dateTime->format("Y")])) $logs[$dateTime->format("Y")] = array(); |
|
| 102 | + if(!isset($logs[$dateTime->format("Y")])) { |
|
| 103 | + $logs[$dateTime->format("Y")] = array(); |
|
| 104 | + } |
|
| 98 | 105 | $logs[$dateTime->format("Y")][$dateTime->format("m")][$time] = array( |
| 99 | 106 | "filename" => $file->getFilename(), |
| 100 | 107 | "size" => round($size, 3) |
@@ -138,7 +145,9 @@ discard block |
||
| 138 | 145 | $detailLog[] = array_merge(array( |
| 139 | 146 | "log" => $line, |
| 140 | 147 | ), $detail); |
| 141 | - if(count($detailLog) >= 1000) break; |
|
| 148 | + if(count($detailLog) >= 1000) { |
|
| 149 | + break; |
|
| 150 | + } |
|
| 142 | 151 | } |
| 143 | 152 | $log = $detailLog; |
| 144 | 153 | } |
@@ -162,7 +171,9 @@ discard block |
||
| 162 | 171 | |
| 163 | 172 | $detail = json_decode($match[0][0], TRUE); |
| 164 | 173 | } |
| 165 | - if (empty($detail)) $detail = array(); |
|
| 174 | + if (empty($detail)) { |
|
| 175 | + $detail = array(); |
|
| 176 | + } |
|
| 166 | 177 | preg_match_all('/\>\ (.*):/i', $line, $match); |
| 167 | 178 | |
| 168 | 179 | $type = (isset($match[1][0])) ? $match[1][0] : ''; |