Completed
Push — master ( 4a84db...747d09 )
by Alexey
05:23
created
system/modules/StaticLoader/StaticLoader.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
         }
27 27
         $app = substr($path, 0, strpos($path, '/'));
28 28
        
29
-        if ($app && file_exists(INJI_SYSTEM_DIR . '/program/' . $app)) {
29
+        if ($app && file_exists(INJI_SYSTEM_DIR.'/program/'.$app)) {
30 30
             $path = substr($path, strpos($path, '/') + 1);
31 31
             if (\App::$cur->name != $app) {
32 32
                 $scriptApp = new App();
33 33
                 $scriptApp->name = $app;
34 34
                 $scriptApp->system = true;
35
-                $scriptApp->staticPath = "/" . $scriptApp->name . "/static";
36
-                $scriptApp->templatesPath = "/" . $scriptApp->name . "/static/templates";
37
-                $scriptApp->path = INJI_SYSTEM_DIR . '/program/' . $scriptApp->name;
38
-                $scriptApp->type = 'app' . ucfirst(strtolower($scriptApp->name));
35
+                $scriptApp->staticPath = "/".$scriptApp->name."/static";
36
+                $scriptApp->templatesPath = "/".$scriptApp->name."/static/templates";
37
+                $scriptApp->path = INJI_SYSTEM_DIR.'/program/'.$scriptApp->name;
38
+                $scriptApp->type = 'app'.ucfirst(strtolower($scriptApp->name));
39 39
                 $scriptApp->installed = true;
40 40
                 $scriptApp->params = [];
41 41
                 $scriptApp->config = Config::app($scriptApp);
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
         $type = substr($path, 0, strpos($path, '/'));
54 54
         switch ($type) {
55 55
             case 'libs':
56
-                return App::$cur->Libs->getPath(array_slice(explode('/', $path),2));
56
+                return App::$cur->Libs->getPath(array_slice(explode('/', $path), 2));
57 57
             case 'templates':
58 58
                 $path = substr($path, strpos($path, '/') + 1);
59
-                return $scriptApp->view->templatesPath . '/' . $path;
59
+                return $scriptApp->view->templatesPath.'/'.$path;
60 60
             case 'system':
61 61
                 $path = substr($path, strpos($path, '/') + 1);
62
-                return INJI_SYSTEM_DIR . '/static/' . $path;
62
+                return INJI_SYSTEM_DIR.'/static/'.$path;
63 63
             case 'moduleAsset':
64 64
                 $path = substr($path, strpos($path, '/') + 1);
65 65
                 if (!strpos($path, '/')) {
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
                 }
73 73
                 $path = substr($path, strpos($path, '/') + 1);
74 74
                 if (is_callable([$module, 'staticCalled'])) {
75
-                    return $scriptApp->$module->staticCalled($path, $scriptApp->$module->path . '/static/');
75
+                    return $scriptApp->$module->staticCalled($path, $scriptApp->$module->path.'/static/');
76 76
                 }
77
-                return $scriptApp->$module->path . '/static/' . $path;
77
+                return $scriptApp->$module->path.'/static/'.$path;
78 78
             default:
79
-                return $scriptApp->path . '/static/' . $path;
79
+                return $scriptApp->path.'/static/'.$path;
80 80
         }
81 81
     }
82 82
 
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
                         $pos = $_GET['resize_pos'];
140 140
                     }
141 141
                     $dirnoslash = str_replace('/', '', substr($fileinfo['dirname'], strpos($fileinfo['dirname'], '/static')));
142
-                    $path = $dir . '/static/cache/' . $dirnoslash . $fileinfo['filename'] . '.' . $sizes[0] . 'x' . $sizes[1] . $crop . $pos . '.' . $fileinfo['extension'];
142
+                    $path = $dir.'/static/cache/'.$dirnoslash.$fileinfo['filename'].'.'.$sizes[0].'x'.$sizes[1].$crop.$pos.'.'.$fileinfo['extension'];
143 143
                     if (!file_exists($path)) {
144
-                        Tools::createDir($dir . '/static/cache/');
144
+                        Tools::createDir($dir.'/static/cache/');
145 145
                         copy($file, $path);
146 146
                         Tools::resizeImage($path, $sizes[0], $sizes[1], $crop, $pos);
147 147
                     }
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
         header("Cache-control: public");
167 167
         header("Accept-Ranges: bytes");
168 168
         header("Pragma: public");
169
-        header("Content-Length: " . filesize($file));
170
-        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($file)) . ' GMT');
171
-        header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 60 * 60 * 24 * 256) . ' GMT');
169
+        header("Content-Length: ".filesize($file));
170
+        header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($file)).' GMT');
171
+        header('Expires: '.gmdate('D, d M Y H:i:s', time() + 60 * 60 * 24 * 256).' GMT');
172 172
         if (filemtime($file) <= $modifiedSince && (!isset($_SERVER['HTTP_CACHE_CONTROL']) || $_SERVER['HTTP_CACHE_CONTROL'] != 'no-cache')) {
173 173
             // Разгружаем канал передачи данных!
174 174
             header('HTTP/1.1 304 Not Modified');
@@ -179,19 +179,19 @@  discard block
 block discarded – undo
179 179
         header('Content-Description: File Transfer');
180 180
         //}
181 181
         if (isset($this->mimes[strtolower($fileinfo['extension'])])) {
182
-            header("Content-Type: " . $this->mimes[strtolower($fileinfo['extension'])]);
182
+            header("Content-Type: ".$this->mimes[strtolower($fileinfo['extension'])]);
183 183
         }
184 184
 
185 185
         if (isset($_GET['frustrate_dl']) || in_array($fileinfo['extension'], array('doc', 'docx', 'xls', 'xlsx'))) {
186 186
 
187
-            $fileName = $fileinfo['filename'] . '.' . $fileinfo['extension'];
187
+            $fileName = $fileinfo['filename'].'.'.$fileinfo['extension'];
188 188
             if (App::$cur->db->connect) {
189
-                $fileObj = Files\File::get([ 'path', '%/' . $fileinfo['filename'] . '.' . $fileinfo['extension'], 'LIKE']);
189
+                $fileObj = Files\File::get(['path', '%/'.$fileinfo['filename'].'.'.$fileinfo['extension'], 'LIKE']);
190 190
                 if ($fileObj) {
191 191
                     $fileName = $fileObj->original_name;
192 192
                 }
193 193
             }
194
-            header('Content-Disposition: attachment; filename="' . $fileName . '"');
194
+            header('Content-Disposition: attachment; filename="'.$fileName.'"');
195 195
         }
196 196
 
197 197
         header('Content-Transfer-Encoding: binary');
Please login to merge, or discard this patch.