@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json")) |
| 47 | 47 | { |
| 48 | 48 | $this->loadConfigData(); |
| 49 | - } else { |
|
| 49 | + }else { |
|
| 50 | 50 | $this->debug = true; |
| 51 | 51 | } |
| 52 | 52 | return $this; |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | if (file_exists(WEB_DIR.DIRECTORY_SEPARATOR.$dir)) { |
| 198 | 198 | try { |
| 199 | 199 | @shell_exec("rm -rf ".WEB_DIR.DIRECTORY_SEPARATOR.$dir); |
| 200 | - } catch(\Exception $e) { |
|
| 200 | + }catch (\Exception $e) { |
|
| 201 | 201 | Logger::getInstance()->errorLog($e->getMessage()); |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function loadConfigData() |
| 211 | 211 | { |
| 212 | - $this->config = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "config.json", Cache::JSON, TRUE) ?: array(); |
|
| 212 | + $this->config = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."config.json", Cache::JSON, TRUE) ?: array(); |
|
| 213 | 213 | $this->debug = (array_key_exists('debug', $this->config)) ? (bool)$this->config['debug'] : FALSE; |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -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); |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | $router->simpatize(); |
| 399 | 399 | $this->security->setFlash("callback_message", _("Rutas generadas correctamente")); |
| 400 | 400 | $this->security->setFlash("callback_route", $this->getRoute("admin", true)); |
| 401 | - } catch(\Exception $e) { |
|
| 401 | + }catch (\Exception $e) { |
|
| 402 | 402 | Logger::getInstance()->errorLog($e->getMessage()); |
| 403 | 403 | $this->security->setFlash("callback_message", _("Algo no ha salido bien, revisa los logs")); |
| 404 | 404 | $this->security->setFlash("callback_route", $this->getRoute("admin", true)); |