@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | * @package PSFS\controller |
| 16 | 16 | * @domain ROOT |
| 17 | 17 | */ |
| 18 | -class Admin extends AuthAdminController{ |
|
| 18 | +class Admin extends AuthAdminController { |
|
| 19 | 19 | |
| 20 | 20 | const DOMAIN = 'ROOT'; |
| 21 | 21 | |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | * @throws \PSFS\base\exception\FormException |
| 46 | 46 | */ |
| 47 | 47 | public static function staticAdminLogon($route = null) { |
| 48 | - if(file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json')) { |
|
| 49 | - if('login' !== Config::getInstance()->get('admin_login')) { |
|
| 48 | + if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json')) { |
|
| 49 | + if ('login' !== Config::getInstance()->get('admin_login')) { |
|
| 50 | 50 | return AdminServices::getInstance()->setAdminHeaders(); |
| 51 | - } else { |
|
| 51 | + }else { |
|
| 52 | 52 | $form = new LoginForm(); |
| 53 | 53 | $form->setData(array("route" => $route)); |
| 54 | 54 | $form->build(); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'form' => $form, |
| 59 | 59 | )); |
| 60 | 60 | } |
| 61 | - } else { |
|
| 61 | + }else { |
|
| 62 | 62 | return UserController::showAdminManager(); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | 24 | public static function showAdminManager() { |
| 25 | - if(Request::getInstance()->getMethod() != 'GET') { |
|
| 25 | + if (Request::getInstance()->getMethod() != 'GET') { |
|
| 26 | 26 | return self::updateAdminUsers(); |
| 27 | 27 | } |
| 28 | 28 | $admins = AdminServices::getInstance()->getAdmins(); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | Logger::log('Configuration saved successful'); |
| 61 | 61 | Security::getInstance()->setFlash("callback_message", _("Usuario agregado correctamente")); |
| 62 | 62 | Security::getInstance()->setFlash("callback_route", Router::getInstance()->getRoute("admin", true)); |
| 63 | - } else { |
|
| 63 | + }else { |
|
| 64 | 64 | throw new ConfigException(_('Error al guardar los administradores, prueba a cambiar los permisos')); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function adminLogin($route = null) |
| 96 | 96 | { |
| 97 | - if($this->isAdmin()) { |
|
| 97 | + if ($this->isAdmin()) { |
|
| 98 | 98 | return $this->redirect('admin'); |
| 99 | - } else { |
|
| 99 | + }else { |
|
| 100 | 100 | return Admin::staticAdminLogon($route); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $cookies = array( |
| 129 | 129 | array( |
| 130 | 130 | "name" => Security::getInstance()->getHash(), |
| 131 | - "value" => base64_encode($form->getFieldValue("user") . ":" . $form->getFieldValue("pass")), |
|
| 131 | + "value" => base64_encode($form->getFieldValue("user").":".$form->getFieldValue("pass")), |
|
| 132 | 132 | "expire" => time() + 3600, |
| 133 | 133 | "http" => true, |
| 134 | 134 | ) |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | 'status_message' => _("Acceso permitido... redirigiendo!!"), |
| 140 | 140 | 'delay' => 1, |
| 141 | 141 | ); |
| 142 | - } else { |
|
| 142 | + }else { |
|
| 143 | 143 | $form->setError("user", _("El usuario no tiene acceso a la web")); |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | { |
| 217 | 217 | if (null === $url) $url = $this->getServer('HTTP_ORIGIN'); |
| 218 | 218 | ob_start(); |
| 219 | - header('Location: ' . $url); |
|
| 219 | + header('Location: '.$url); |
|
| 220 | 220 | ob_end_clean(); |
| 221 | 221 | Security::getInstance()->updateSession(); |
| 222 | 222 | exit(_("Redireccionando...")); |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | $host = $this->getServerName(); |
| 262 | 262 | $protocol = $protocol ? $this->getProtocol() : ''; |
| 263 | 263 | $url = ''; |
| 264 | - if (!empty($host) && !empty($protocol)) $url = $protocol . $host; |
|
| 265 | - if(!in_array($this->getServer('SERVER_PORT'), [80, 443])) { |
|
| 266 | - $url .= ':' . $this->getServer('SERVER_PORT'); |
|
| 264 | + if (!empty($host) && !empty($protocol)) $url = $protocol.$host; |
|
| 265 | + if (!in_array($this->getServer('SERVER_PORT'), [80, 443])) { |
|
| 266 | + $url .= ':'.$this->getServer('SERVER_PORT'); |
|
| 267 | 267 | } |
| 268 | 268 | return $url; |
| 269 | 269 | } |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | public function render($template, array $vars = array(), $cookies = array(), $domain = null) |
| 36 | 36 | { |
| 37 | 37 | $vars['__menu__'] = $this->getMenu(); |
| 38 | - $domain = (null ===$domain) ? $this->getDomain() : $domain; |
|
| 39 | - return $this->tpl->render($domain . $template, $vars, $cookies); |
|
| 38 | + $domain = (null === $domain) ? $this->getDomain() : $domain; |
|
| 39 | + return $this->tpl->render($domain.$template, $vars, $cookies); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $vars['__menu__'] = $this->getMenu(); |
| 69 | 69 | $domain = $domain ?: $this->getDomain(); |
| 70 | - return $this->tpl->dump($domain . $template, $vars); |
|
| 70 | + return $this->tpl->dump($domain.$template, $vars); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | ///////////////////////////////////////////////////////////// |
| 97 | 97 | // Date in the past sets the value to already have been expired. |
| 98 | 98 | header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); |
| 99 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 99 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 100 | 100 | header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 |
| 101 | 101 | header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 |
| 102 | 102 | header("Pragma: no-cache"); |
| 103 | 103 | header("Expires: 0"); |
| 104 | 104 | header('Content-Transfer-Encoding: none'); |
| 105 | - header("Content-type: " . $content); |
|
| 106 | - header("Content-length: " . strlen($data)); |
|
| 107 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
| 105 | + header("Content-type: ".$content); |
|
| 106 | + header("Content-length: ".strlen($data)); |
|
| 107 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
| 108 | 108 | echo $data; |
| 109 | 109 | ob_flush(); |
| 110 | 110 | ob_end_clean(); |