@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function hasSessionKey($key) { |
33 | 33 | $exists = false; |
34 | - if(array_key_exists($key, $this->session)) { |
|
34 | + if (array_key_exists($key, $this->session)) { |
|
35 | 35 | $exists = true; |
36 | 36 | } |
37 | 37 | return $exists; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | session_start(); |
57 | 57 | } |
58 | 58 | // Fix for phpunits |
59 | - if(!isset($_SESSION)) { |
|
59 | + if (!isset($_SESSION)) { |
|
60 | 60 | $_SESSION = []; |
61 | 61 | } |
62 | 62 | $this->session = null === $_SESSION ? [] : $_SESSION; |
@@ -86,11 +86,11 @@ |
||
86 | 86 | public static function save($user) |
87 | 87 | { |
88 | 88 | $saved = true; |
89 | - $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true) ?: []; |
|
90 | - $admins[$user['username']]['hash'] = sha1($user['username'] . $user['password']); |
|
89 | + $admins = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true) ?: []; |
|
90 | + $admins[$user['username']]['hash'] = sha1($user['username'].$user['password']); |
|
91 | 91 | $admins[$user['username']]['profile'] = $user['profile']; |
92 | 92 | |
93 | - Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', $admins, Cache::JSONGZ, true); |
|
93 | + Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', $admins, Cache::JSONGZ, true); |
|
94 | 94 | return $saved; |
95 | 95 | } |
96 | 96 |
@@ -69,21 +69,21 @@ discard block |
||
69 | 69 | { |
70 | 70 | $path = explode("/", $string); |
71 | 71 | $originalFilename = end($path); |
72 | - $base = WEB_DIR . DIRECTORY_SEPARATOR; |
|
72 | + $base = WEB_DIR.DIRECTORY_SEPARATOR; |
|
73 | 73 | $debug = Config::getParam('debug'); |
74 | 74 | $cache = Config::getParam('cache.var'); |
75 | - $cache = $cache ? '.' . $cache : ''; |
|
75 | + $cache = $cache ? '.'.$cache : ''; |
|
76 | 76 | $finfo = finfo_open(FILEINFO_MIME_TYPE); // devuelve el tipo mime de su extensión |
77 | 77 | $mime = finfo_file($finfo, $filenamePath); |
78 | 78 | $extension = explode(".", $string); |
79 | 79 | $extension = end($extension); |
80 | - $file = "/" . substr(md5($string), 0, 8) . "." . $extension; |
|
80 | + $file = "/".substr(md5($string), 0, 8).".".$extension; |
|
81 | 81 | finfo_close($finfo); |
82 | 82 | if (preg_match('/\.css$/i', $string)) { |
83 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.css"; |
|
83 | + $file = "/".substr(md5($string), 0, 8)."$cache.css"; |
|
84 | 84 | $htmlBase = "css"; |
85 | 85 | } elseif (preg_match('/\.js$/i', $string)) { |
86 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.js"; |
|
86 | + $file = "/".substr(md5($string), 0, 8)."$cache.js"; |
|
87 | 87 | $htmlBase = "js"; |
88 | 88 | } elseif (preg_match("/image/i", $mime)) { |
89 | 89 | $htmlBase = "img"; |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | $file = $name; |
99 | 99 | } |
100 | 100 | if ($debug) { |
101 | - $file = str_replace("." . $extension, "_" . $originalFilename, $file); |
|
101 | + $file = str_replace(".".$extension, "_".$originalFilename, $file); |
|
102 | 102 | } |
103 | - $filePath = $htmlBase . $file; |
|
103 | + $filePath = $htmlBase.$file; |
|
104 | 104 | |
105 | 105 | return array($base, $htmlBase, $filePath); |
106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | GeneratorHelper::createDir(dirname($path)); |
117 | 117 | if ("" !== $content && false === file_put_contents($path, $content)) { |
118 | - throw new ConfigException(t('No se tienen permisos para escribir en ' . $path)); |
|
118 | + throw new ConfigException(t('No se tienen permisos para escribir en '.$path)); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |