@@ -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 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use PSFS\base\exception\SecurityException; |
13 | 13 | use PSFS\base\Singleton; |
14 | 14 | |
15 | - require_once __DIR__ . DIRECTORY_SEPARATOR . "bootstrap.php"; |
|
15 | + require_once __DIR__.DIRECTORY_SEPARATOR."bootstrap.php"; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Class Dispatcher |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | { |
83 | 83 | $this->locale = $this->config->get("default_language"); |
84 | 84 | // Load translations |
85 | - putenv("LC_ALL=" . $this->locale); |
|
85 | + putenv("LC_ALL=".$this->locale); |
|
86 | 86 | setlocale(LC_ALL, $this->locale); |
87 | 87 | // Load the locale path |
88 | - $locale_path = BASE_DIR . DIRECTORY_SEPARATOR . 'locale'; |
|
88 | + $locale_path = BASE_DIR.DIRECTORY_SEPARATOR.'locale'; |
|
89 | 89 | Config::createDir($locale_path); |
90 | 90 | bindtextdomain('translations', $locale_path); |
91 | 91 | textdomain('translations'); |
@@ -99,23 +99,23 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function run() |
101 | 101 | { |
102 | - $this->log->infoLog("Begin request " . $this->parser->getRequestUri()); |
|
102 | + $this->log->infoLog("Begin request ".$this->parser->getRequestUri()); |
|
103 | 103 | // |
104 | 104 | try { |
105 | 105 | if ($this->config->isConfigured()) { |
106 | 106 | if (!$this->parser->isFile()) { |
107 | 107 | return $this->router->execute($this->actualUri); |
108 | 108 | } |
109 | - } else { |
|
109 | + }else { |
|
110 | 110 | return $this->router->getAdmin()->config(); |
111 | 111 | } |
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 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $use /= 1024; |
157 | 157 | break; |
158 | 158 | case "MBytes": |
159 | - $use /= (1024 * 1024); |
|
159 | + $use /= (1024*1024); |
|
160 | 160 | break; |
161 | 161 | case "Bytes": |
162 | 162 | default: |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | { |
182 | 182 | if ($this->config->getDebugMode()) { |
183 | 183 | //Warning & Notice handler |
184 | - set_error_handler(function ($errno, $errstr, $errfile, $errline) { |
|
184 | + set_error_handler(function($errno, $errstr, $errfile, $errline) { |
|
185 | 185 | throw new \ErrorException($errstr, 500, $errno, $errfile, $errline); |
186 | 186 | }); |
187 | 187 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @package PSFS\controller |
21 | 21 | * @domain ROOT |
22 | 22 | */ |
23 | -class Admin extends AuthAdminController{ |
|
23 | +class Admin extends AuthAdminController { |
|
24 | 24 | |
25 | 25 | const DOMAIN = 'ROOT'; |
26 | 26 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | Logger::getInstance()->infoLog("Configuración guardada correctamente"); |
85 | 85 | $this->security->setFlash("callback_message", _("Usuario agregado correctamente")); |
86 | 86 | $this->security->setFlash("callback_route", $this->getRoute("admin"), true); |
87 | - } else { |
|
87 | + }else { |
|
88 | 88 | throw new \HttpException('Error al guardar los administradores, prueba a cambiar los permisos', 403); |
89 | 89 | } |
90 | 90 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $cookies = array( |
151 | 151 | array( |
152 | 152 | "name" => Security::getInstance()->getHash(), |
153 | - "value" => base64_encode($form->getFieldValue("user") . ":" . $form->getFieldValue("pass")), |
|
153 | + "value" => base64_encode($form->getFieldValue("user").":".$form->getFieldValue("pass")), |
|
154 | 154 | "expire" => time() + 3600, |
155 | 155 | "http" => true, |
156 | 156 | ) |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | 'status_message' => _("Acceso permitido... redirigiendo!!"), |
162 | 162 | 'delay' => 1, |
163 | 163 | ); |
164 | - } else { |
|
164 | + }else { |
|
165 | 165 | $form->setError("user", _("El usuario no tiene acceso a la web")); |
166 | 166 | } |
167 | 167 | } |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function getTranslations($locale = '') { |
179 | 179 | //Idioma por defecto |
180 | - if(empty($locale)) $locale = $this->config->get("default_language"); |
|
180 | + if (empty($locale)) $locale = $this->config->get("default_language"); |
|
181 | 181 | |
182 | 182 | //Generamos las traducciones de las plantillas |
183 | 183 | $translations = $this->tpl->regenerateTemplates(); |
184 | 184 | |
185 | - $locale_path = realpath(BASE_DIR . DIRECTORY_SEPARATOR . 'locale'); |
|
186 | - $locale_path .= DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR; |
|
185 | + $locale_path = realpath(BASE_DIR.DIRECTORY_SEPARATOR.'locale'); |
|
186 | + $locale_path .= DIRECTORY_SEPARATOR.$locale.DIRECTORY_SEPARATOR.'LC_MESSAGES'.DIRECTORY_SEPARATOR; |
|
187 | 187 | |
188 | 188 | //Localizamos xgettext |
189 | 189 | $translations = array_merge($translations, GeneratorService::findTranslations(SOURCE_DIR, $locale)); |
@@ -230,18 +230,18 @@ discard block |
||
230 | 230 | $form = new ConfigForm(); |
231 | 231 | $form->build(); |
232 | 232 | $form->hydrate(); |
233 | - if($form->isValid()) { |
|
233 | + if ($form->isValid()) { |
|
234 | 234 | $debug = Config::getInstance()->getDebugMode(); |
235 | 235 | $newDebug = $form->getFieldValue("debug"); |
236 | - if(Config::save($form->getData(), $form->getExtraData())) { |
|
236 | + if (Config::save($form->getData(), $form->getExtraData())) { |
|
237 | 237 | Logger::getInstance()->infoLog(_('Configuración guardada correctamente')); |
238 | 238 | //Verificamos si tenemos que limpiar la cache del DocumentRoot |
239 | - if(boolval($debug) !== boolval($newDebug)) { |
|
239 | + if (boolval($debug) !== boolval($newDebug)) { |
|
240 | 240 | Config::clearDocumentRoot(); |
241 | 241 | } |
242 | 242 | $this->security->setFlash("callback_message", _("Configuración actualizada correctamente")); |
243 | 243 | $this->security->setFlash("callback_route", $this->getRoute("admin-config", true)); |
244 | - } else { |
|
244 | + }else { |
|
245 | 245 | throw new \HttpException(_('Error al guardar la configuración, prueba a cambiar los permisos'), 403); |
246 | 246 | } |
247 | 247 | } |
@@ -300,10 +300,10 @@ discard block |
||
300 | 300 | $type = $form->getFieldValue("controllerType"); |
301 | 301 | try { |
302 | 302 | $this->gen->createStructureModule($module, $force, $type); |
303 | - $this->security->setFlash("callback_message", str_replace("%s",$module, _("Módulo %s generado correctamente"))); |
|
303 | + $this->security->setFlash("callback_message", str_replace("%s", $module, _("Módulo %s generado correctamente"))); |
|
304 | 304 | $this->security->setFlash("callback_route", $this->getRoute("admin-module", true)); |
305 | - } catch(\Exception $e) { |
|
306 | - Logger::getInstance()->infoLog($e->getMessage() . " [" . $e->getFile() . ":" . $e->getLine() . "]"); |
|
305 | + }catch (\Exception $e) { |
|
306 | + Logger::getInstance()->infoLog($e->getMessage()." [".$e->getFile().":".$e->getLine()."]"); |
|
307 | 307 | throw new ConfigException('Error al generar el módulo, prueba a cambiar los permisos', 403); |
308 | 308 | } |
309 | 309 | } |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | public function getConfigParams() { |
326 | 326 | $response = array_merge(Config::$required, Config::$optional); |
327 | 327 | $domains = Router::getInstance()->getDomains(); |
328 | - foreach($domains as $domain => $routes) { |
|
328 | + foreach ($domains as $domain => $routes) { |
|
329 | 329 | $pDomain = str_replace('@', '', $domain); |
330 | 330 | $pDomain = str_replace('/', '', $pDomain); |
331 | - $response[] = strtolower($pDomain) . '.api.secret'; |
|
331 | + $response[] = strtolower($pDomain).'.api.secret'; |
|
332 | 332 | } |
333 | 333 | return $this->json($response); |
334 | 334 | } |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | |
371 | 371 | $selected = ''; |
372 | 372 | $monthOpen = null; |
373 | - if($this->getRequest()->getMethod() == 'POST') |
|
373 | + if ($this->getRequest()->getMethod() == 'POST') |
|
374 | 374 | { |
375 | 375 | $selected = $this->getRequest()->get("log"); |
376 | 376 | list($log, $monthOpen) = $this->srv->formatLogFile($selected); |