Completed
Push — master ( bb267d...fbe197 )
by Alexey
05:29
created
system/Inji/Controller.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,17 +64,17 @@
 block discarded – undo
64 64
      */
65 65
     public function run()
66 66
     {
67
-        if (!empty($this->params[0]) && method_exists($this, $this->params[0] . 'Action')) {
67
+        if (!empty($this->params[0]) && method_exists($this, $this->params[0].'Action')) {
68 68
             $this->method = $this->params[0];
69 69
             $this->params = array_slice($this->params, 1);
70
-        } elseif (!method_exists($this, $this->method . 'Action')) {
70
+        } elseif (!method_exists($this, $this->method.'Action')) {
71 71
             INJI_SYSTEM_ERROR('method not found', true);
72 72
         }
73 73
         if (!$this->checkAccess()) {
74 74
             Tools::redirect($this->access->getDeniedRedirect(), 'У вас нет прав доступа');
75 75
         }
76 76
         $this->run = true;
77
-        call_user_func_array([$this, $this->method . 'Action'], $this->params);
77
+        call_user_func_array([$this, $this->method.'Action'], $this->params);
78 78
     }
79 79
 
80 80
     /**
Please login to merge, or discard this patch.
system/Inji/Module.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $this->info = $this->getInfo();
73 73
         $this->config = Config::module($this->moduleName, !empty($this->info['systemConfig']));
74 74
         $that = $this;
75
-        Inji::$inst->listen('Config-change-module-' . $this->app->name . '-' . $this->moduleName, $this->app->name . '-' . $this->moduleName . 'config', function($event) use ($that) {
75
+        Inji::$inst->listen('Config-change-module-'.$this->app->name.'-'.$this->moduleName, $this->app->name.'-'.$this->moduleName.'config', function($event) use ($that) {
76 76
             $that->config = $event['eventObject'];
77 77
         });
78 78
     }
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
         $moduleName = ucfirst($moduleName);
89 89
         $paths = [];
90 90
         if (App::$cur !== App::$primary) {
91
-            $paths['primaryAppPath'] = App::$primary->path . '/modules/' . $moduleName;
91
+            $paths['primaryAppPath'] = App::$primary->path.'/modules/'.$moduleName;
92 92
         }
93
-        $paths['curAppPath'] = App::$cur->path . '/modules/' . $moduleName;
94
-        $paths['systemPath'] = INJI_SYSTEM_DIR . '/modules/' . $moduleName;
93
+        $paths['curAppPath'] = App::$cur->path.'/modules/'.$moduleName;
94
+        $paths['systemPath'] = INJI_SYSTEM_DIR.'/modules/'.$moduleName;
95 95
         return $paths;
96 96
     }
97 97
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $moduleName = ucfirst($moduleName);
107 107
         $paths = Module::getModulePaths($moduleName);
108 108
         foreach ($paths as $path) {
109
-            if (file_exists($path . '/' . $moduleName . '.php')) {
109
+            if (file_exists($path.'/'.$moduleName.'.php')) {
110 110
                 return $path;
111 111
             }
112 112
         }
@@ -183,31 +183,31 @@  discard block
 block discarded – undo
183 183
         $paths = [];
184 184
         if (App::$cur != App::$primary) {
185 185
             if (!empty($this->params[0]) && strtolower($this->params[0]) != strtolower($this->moduleName)) {
186
-                $paths['primaryAppAppTypePath_slice'] = App::$primary->path . '/modules/' . $this->moduleName . '/' . $this->app->type . 'Controllers/' . ucfirst($this->params[0]) . 'Controller.php';
186
+                $paths['primaryAppAppTypePath_slice'] = App::$primary->path.'/modules/'.$this->moduleName.'/'.$this->app->type.'Controllers/'.ucfirst($this->params[0]).'Controller.php';
187 187
                 if (App::$primary->{$this->moduleName}) {
188
-                    $paths['primaryAppAppTypePath_slice'] = App::$primary->{$this->moduleName}->path . '/' . $this->app->type . 'Controllers/' . ucfirst($this->params[0]) . 'Controller.php';
188
+                    $paths['primaryAppAppTypePath_slice'] = App::$primary->{$this->moduleName}->path.'/'.$this->app->type.'Controllers/'.ucfirst($this->params[0]).'Controller.php';
189 189
                 }
190 190
             }
191
-            $paths['primaryAppAppAppTypePath'] = App::$primary->path . '/modules/' . $this->moduleName . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php';
191
+            $paths['primaryAppAppAppTypePath'] = App::$primary->path.'/modules/'.$this->moduleName.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php';
192 192
             if (App::$primary->{$this->moduleName}) {
193
-                $paths['primaryAppAppTypePath'] = App::$primary->{$this->moduleName}->path . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php';
193
+                $paths['primaryAppAppTypePath'] = App::$primary->{$this->moduleName}->path.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php';
194 194
             }
195
-            $paths['curAppAppTypePath'] = $this->app->{$this->moduleName}->path . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php';
195
+            $paths['curAppAppTypePath'] = $this->app->{$this->moduleName}->path.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php';
196 196
         }
197 197
 
198 198
         if (!empty($this->params[0]) && strtolower($this->params[0]) != strtolower($this->moduleName)) {
199
-            $paths['appAppTypePath_slice'] = $this->app->path . '/modules/' . $this->moduleName . '/' . $this->app->type . 'Controllers/' . ucfirst($this->params[0]) . 'Controller.php';
200
-            $paths['appTypePath_slice'] = $this->path . '/' . $this->app->type . 'Controllers/' . ucfirst($this->params[0]) . 'Controller.php';
199
+            $paths['appAppTypePath_slice'] = $this->app->path.'/modules/'.$this->moduleName.'/'.$this->app->type.'Controllers/'.ucfirst($this->params[0]).'Controller.php';
200
+            $paths['appTypePath_slice'] = $this->path.'/'.$this->app->type.'Controllers/'.ucfirst($this->params[0]).'Controller.php';
201 201
         }
202
-        $paths['appAppTypePath'] = $this->app->path . '/modules/' . $this->moduleName . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php';
203
-        $paths['appTypePath'] = $this->path . '/' . $this->app->type . 'Controllers/' . $this->moduleName . 'Controller.php';
202
+        $paths['appAppTypePath'] = $this->app->path.'/modules/'.$this->moduleName.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php';
203
+        $paths['appTypePath'] = $this->path.'/'.$this->app->type.'Controllers/'.$this->moduleName.'Controller.php';
204 204
 
205 205
         if (!empty($this->params[0]) && strtolower($this->params[0]) != strtolower($this->moduleName)) {
206
-            $paths['appUniversalPath_slice'] = $this->app->path . '/modules/' . $this->moduleName . '/Controllers/' . ucfirst($this->params[0]) . 'Controller.php';
207
-            $paths['universalPath_slice'] = $this->path . '/Controllers/' . ucfirst($this->params[0]) . 'Controller.php';
206
+            $paths['appUniversalPath_slice'] = $this->app->path.'/modules/'.$this->moduleName.'/Controllers/'.ucfirst($this->params[0]).'Controller.php';
207
+            $paths['universalPath_slice'] = $this->path.'/Controllers/'.ucfirst($this->params[0]).'Controller.php';
208 208
         }
209
-        $paths['appUniversalPath'] = $this->app->path . '/modules/' . $this->moduleName . '/Controllers/' . $this->moduleName . 'Controller.php';
210
-        $paths['universalPath'] = $this->path . '/Controllers/' . $this->moduleName . 'Controller.php';
209
+        $paths['appUniversalPath'] = $this->app->path.'/modules/'.$this->moduleName.'/Controllers/'.$this->moduleName.'Controller.php';
210
+        $paths['universalPath'] = $this->path.'/Controllers/'.$this->moduleName.'Controller.php';
211 211
 
212 212
         return $paths;
213 213
     }
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                     $controllerName = $this->moduleName;
231 231
                     $params = $this->params;
232 232
                 }
233
-                $fullControllerName = $controllerName . 'Controller';
233
+                $fullControllerName = $controllerName.'Controller';
234 234
                 $controller = new $fullControllerName();
235 235
                 $controller->params = $params;
236 236
                 $controller->module = $this;
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
         }
257 257
         $paths = Module::getModulePaths($moduleName);
258 258
         foreach ($paths as $path) {
259
-            if (file_exists($path . '/info.php')) {
260
-                return include $path . '/info.php';
259
+            if (file_exists($path.'/info.php')) {
260
+                return include $path.'/info.php';
261 261
             }
262 262
         }
263 263
         return [];
@@ -276,16 +276,16 @@  discard block
 block discarded – undo
276 276
     {
277 277
         $moduleName = $moduleName ? $moduleName : $this->moduleName;
278 278
         $modulePaths = Module::getModulePaths($moduleName);
279
-        $modulePaths['templatePath'] = App::$cur->view->template->path . '/modules/' . ucfirst($moduleName);
279
+        $modulePaths['templatePath'] = App::$cur->view->template->path.'/modules/'.ucfirst($moduleName);
280 280
         $snippets = [];
281 281
         foreach ($modulePaths as $path) {
282
-            if (file_exists($path . $dir . '/' . $snippetsPath)) {
283
-                $snippetsPaths = array_slice(scandir($path . $dir . '/' . $snippetsPath), 2);
282
+            if (file_exists($path.$dir.'/'.$snippetsPath)) {
283
+                $snippetsPaths = array_slice(scandir($path.$dir.'/'.$snippetsPath), 2);
284 284
                 foreach ($snippetsPaths as $snippetPath) {
285
-                    if (is_dir($path . $dir . '/' . $snippetsPath . '/' . $snippetPath)) {
286
-                        $snippets[$snippetPath] = include $path . $dir . '/' . $snippetsPath . '/' . $snippetPath . '/info.php';
285
+                    if (is_dir($path.$dir.'/'.$snippetsPath.'/'.$snippetPath)) {
286
+                        $snippets[$snippetPath] = include $path.$dir.'/'.$snippetsPath.'/'.$snippetPath.'/info.php';
287 287
                     } else {
288
-                        $snippets[pathinfo($snippetPath, PATHINFO_FILENAME)] = include $path . $dir . '/' . $snippetsPath . '/' . $snippetPath;
288
+                        $snippets[pathinfo($snippetPath, PATHINFO_FILENAME)] = include $path.$dir.'/'.$snippetsPath.'/'.$snippetPath;
289 289
                     }
290 290
                 }
291 291
             }
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
     {
308 308
         $extensions = [];
309 309
         $modules = Module::getInstalled(App::$cur);
310
-        $method = 'get' . ucfirst($extensionType);
310
+        $method = 'get'.ucfirst($extensionType);
311 311
         foreach ($modules as $module) {
312
-            $extensions = array_merge($extensions, $this->{$method}($request, false, "/extensions/{$this->moduleName}/" . $extensionType, $module));
312
+            $extensions = array_merge($extensions, $this->{$method}($request, false, "/extensions/{$this->moduleName}/".$extensionType, $module));
313 313
         }
314 314
         return $extensions;
315 315
     }
Please login to merge, or discard this patch.
system/Inji/Log.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,22 +83,22 @@
 block discarded – undo
83 83
                     $log['end'] = microtime(true);
84 84
                 if (empty($log['start']))
85 85
                     $log['start'] = microtime(true);
86
-                echo "<tr><td>{$log['name']}</td><td" . (round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '') . ">" . round(($log['end'] - $log['start']), 5) . "</td></tr>";
86
+                echo "<tr><td>{$log['name']}</td><td".(round(($log['end'] - $log['start']), 5) > 0.1 ? ' class ="danger"' : '').">".round(($log['end'] - $log['start']), 5)."</td></tr>";
87 87
             }
88 88
         }
89
-        echo '<tr><th>Summary</th><th>' . round(( microtime(true) - $this->startTime), 5) . '</th></tr>';
90
-        echo '<tr><th>Memory</th><th>' . $this->convertSize(memory_get_peak_usage()) . ' of ' . ini_get('memory_limit') . '</th></tr></table></div>';
89
+        echo '<tr><th>Summary</th><th>'.round((microtime(true) - $this->startTime), 5).'</th></tr>';
90
+        echo '<tr><th>Memory</th><th>'.$this->convertSize(memory_get_peak_usage()).' of '.ini_get('memory_limit').'</th></tr></table></div>';
91 91
     }
92 92
 
93 93
     public function convertSize($size)
94 94
     {
95 95
 
96 96
         if ($size < 1024)
97
-            return $size . "B";
97
+            return $size."B";
98 98
         elseif ($size < 1048576)
99
-            return round($size / 1024, 2) . "KB";
99
+            return round($size / 1024, 2)."KB";
100 100
         else
101
-            return round($size / 1048576, 2) . "MB";
101
+            return round($size / 1048576, 2)."MB";
102 102
     }
103 103
 
104 104
     public function __destruct()
Please login to merge, or discard this patch.
system/Inji/Cache.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             }
65 65
             return false;
66 66
         }
67
-        $val = @self::$server->get($name . serialize($params));
67
+        $val = @self::$server->get($name.serialize($params));
68 68
         if ($val !== false) {
69 69
             return $val;
70 70
         } else {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             self::connect();
93 93
         }
94 94
         if (self::$connected) {
95
-            return @self::$server->set($name . serialize($params), $val, false, $lifeTime);
95
+            return @self::$server->set($name.serialize($params), $val, false, $lifeTime);
96 96
         }
97 97
         return false;
98 98
     }
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
         $crop = !empty($options['crop']) ? $options['crop'] : '';
113 113
         $pos = !empty($options['pos']) ? $options['pos'] : 'center';
114 114
         $fileinfo = pathinfo($file);
115
-        $fileCheckSum = md5($fileinfo['dirname'] . filemtime($file));
116
-        $path = static::getDir('static') . '/' . $fileCheckSum . '_' . $fileinfo['filename'];
115
+        $fileCheckSum = md5($fileinfo['dirname'].filemtime($file));
116
+        $path = static::getDir('static').'/'.$fileCheckSum.'_'.$fileinfo['filename'];
117 117
         if ($sizes) {
118
-            $path .= '.' . $sizes['x'] . 'x' . $sizes['y'] . $crop . $pos;
118
+            $path .= '.'.$sizes['x'].'x'.$sizes['y'].$crop.$pos;
119 119
         }
120
-        $path .= '.' . $fileinfo['extension'];
120
+        $path .= '.'.$fileinfo['extension'];
121 121
         if (!file_exists($path)) {
122 122
             copy($file, $path);
123 123
             if ($sizes) {
Please login to merge, or discard this patch.
system/Inji/App.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@
 block discarded – undo
71 71
     {
72 72
         $paths = Module::getModulePaths($moduleName);
73 73
         foreach ($paths as $path) {
74
-            if (file_exists($path . '/' . $moduleName . '.php')) {
75
-                include_once $path . '/' . $moduleName . '.php';
74
+            if (file_exists($path.'/'.$moduleName.'.php')) {
75
+                include_once $path.'/'.$moduleName.'.php';
76 76
                 return $moduleName;
77 77
             }
78 78
         }
Please login to merge, or discard this patch.
system/Inji/Model.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                         $relModel = $relations[$colInfo['colParams']['relation']]['model'];
212 212
                         $relModel = strpos($relModel, '\\') === 0 ? substr($relModel, 1) : $relModel;
213 213
                         if ($manageHref) {
214
-                            $value = $relValue ? "<a href='/admin/" . str_replace('\\', '/view/', $relModel) . "/" . $relValue->pk() . "'>" . $relValue->name() . "</a>" : 'Не задано';
214
+                            $value = $relValue ? "<a href='/admin/".str_replace('\\', '/view/', $relModel)."/".$relValue->pk()."'>".$relValue->name()."</a>" : 'Не задано';
215 215
                         } else {
216 216
                             $value = $relValue ? $relValue->name() : 'Не задано';
217 217
                         }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             case 'image':
222 222
                 $file = Files\File::get($item->$colName);
223 223
                 if ($file) {
224
-                    $value = '<img src="' . $file->path . '?resize=60x120" />';
224
+                    $value = '<img src="'.$file->path.'?resize=60x120" />';
225 225
                 } else {
226 226
                     $value = '<img src="/static/system/images/no-image.png?resize=60x120" />';
227 227
                 }
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
             return;
260 260
         }
261 261
         if (!is_array($array)) {
262
-            if (!isset($cols[static::colPrefix() . $array]) && isset(static::$cols[$array])) {
262
+            if (!isset($cols[static::colPrefix().$array]) && isset(static::$cols[$array])) {
263 263
                 static::createCol($array);
264 264
                 $cols = static::cols(true);
265 265
             }
266
-            if (!isset($cols[$array]) && isset($cols[static::colPrefix() . $array])) {
267
-                $array = static::colPrefix() . $array;
266
+            if (!isset($cols[$array]) && isset($cols[static::colPrefix().$array])) {
267
+                $array = static::colPrefix().$array;
268 268
             } else {
269 269
                 static::checkForJoin($array, $rootModel);
270 270
             }
@@ -273,14 +273,14 @@  discard block
 block discarded – undo
273 273
         switch ($searchtype) {
274 274
             case 'key':
275 275
                 foreach ($array as $key => $item) {
276
-                    if (!isset($cols[static::colPrefix() . $key]) && isset(static::$cols[$key])) {
276
+                    if (!isset($cols[static::colPrefix().$key]) && isset(static::$cols[$key])) {
277 277
                         static::createCol($key);
278 278
                         $cols = static::cols(true);
279 279
                     }
280
-                    if (!isset($cols[$key]) && isset($cols[static::colPrefix() . $key])) {
281
-                        $array[static::colPrefix() . $key] = $item;
280
+                    if (!isset($cols[$key]) && isset($cols[static::colPrefix().$key])) {
281
+                        $array[static::colPrefix().$key] = $item;
282 282
                         unset($array[$key]);
283
-                        $key = static::colPrefix() . $key;
283
+                        $key = static::colPrefix().$key;
284 284
                     }
285 285
                     if (is_array($array[$key])) {
286 286
                         static::fixPrefix($array[$key], 'key', $rootModel);
@@ -291,12 +291,12 @@  discard block
 block discarded – undo
291 291
                 break;
292 292
             case 'first':
293 293
                 if (isset($array[0]) && is_string($array[0])) {
294
-                    if (!isset($cols[static::colPrefix() . $array[0]]) && isset(static::$cols[$array[0]])) {
294
+                    if (!isset($cols[static::colPrefix().$array[0]]) && isset(static::$cols[$array[0]])) {
295 295
                         static::createCol($array[0]);
296 296
                         $cols = static::cols(true);
297 297
                     }
298
-                    if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix() . $array[0]])) {
299
-                        $array[0] = static::colPrefix() . $array[0];
298
+                    if (!isset($cols[$array[0]]) && isset($cols[static::colPrefix().$array[0]])) {
299
+                        $array[0] = static::colPrefix().$array[0];
300 300
                     } else {
301 301
                         static::checkForJoin($array[0], $rootModel);
302 302
                     }
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
                     case 'to':
330 330
                         $relCol = $relations[$rel]['col'];
331 331
                         static::fixPrefix($relCol);
332
-                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
332
+                        $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol];
333 333
                         break;
334 334
                     case 'one':
335 335
                     case 'many':
336 336
                         $relCol = $relations[$rel]['col'];
337 337
                         $relations[$rel]['model']::fixPrefix($relCol);
338
-                        $rootModel::$relJoins[$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
338
+                        $rootModel::$relJoins[$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol];
339 339
                         break;
340 340
                 }
341 341
                 $relations[$rel]['model']::fixPrefix($col, 'key', $rootModel);
@@ -376,13 +376,13 @@  discard block
 block discarded – undo
376 376
                         $relCol = $relations[$rel]['col'];
377 377
                         static::fixPrefix($relCol);
378 378
                         //$info['modelName'] = $relations[$rel]['model'];
379
-                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol];
379
+                        $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol];
380 380
                         break;
381 381
                     case 'one':
382 382
                         $relCol = $relations[$rel]['col'];
383 383
                         $relations[$rel]['model']::fixPrefix($relCol);
384 384
                         //$info['modelName'] = $relations[$rel]['model'];
385
-                        $info['joins'][$relations[$rel]['model'] . '_' . $rel] = [$relations[$rel]['model']::table(), static::index() . ' = ' . $relCol];
385
+                        $info['joins'][$relations[$rel]['model'].'_'.$rel] = [$relations[$rel]['model']::table(), static::index().' = '.$relCol];
386 386
                         break;
387 387
                 }
388 388
                 $info = $relations[$rel]['model']::parseColRecursion($info);
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
             } else {
401 401
                 $info['colParams'] = [];
402 402
             }
403
-            if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix() . $info['col']])) {
404
-                $info['col'] = static::colPrefix() . $info['col'];
403
+            if (!isset($cols[$info['col']]) && isset($cols[static::colPrefix().$info['col']])) {
404
+                $info['col'] = static::colPrefix().$info['col'];
405 405
             }
406 406
             $info['modelName'] = get_called_class();
407 407
         }
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
         if ($params === false) {
508 508
             return false;
509 509
         }
510
-        return App::$cur->db->addCol(static::table(), static::colPrefix() . $colName, $params);
510
+        return App::$cur->db->addCol(static::table(), static::colPrefix().$colName, $params);
511 511
     }
512 512
 
513 513
     public static function createTable()
@@ -537,28 +537,28 @@  discard block
 block discarded – undo
537 537
             return true;
538 538
         }
539 539
         $cols = [
540
-            $colPrefix . 'id' => 'pk'
540
+            $colPrefix.'id' => 'pk'
541 541
         ];
542 542
         $className = get_called_class();
543 543
         if (!empty($className::$cols)) {
544 544
             foreach ($className::$cols as $colName => $colParams) {
545 545
                 if ($colName == 'date_create') {
546
-                    $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
546
+                    $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
547 547
                     continue;
548 548
                 }
549 549
                 $params = $className::genColParams($colName);
550 550
                 if ($params) {
551
-                    $cols[$colPrefix . $colName] = $params;
551
+                    $cols[$colPrefix.$colName] = $params;
552 552
                 }
553 553
             }
554 554
         }
555
-        if (empty($cols[$colPrefix . 'date_create'])) {
556
-            $cols[$colPrefix . 'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
555
+        if (empty($cols[$colPrefix.'date_create'])) {
556
+            $cols[$colPrefix.'date_create'] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
557 557
         }
558 558
         $tableIndexes = [];
559 559
         if ($indexes) {
560 560
             foreach ($indexes as $indexName => $index) {
561
-                $tableIndexes[] = $index['type'] . ' ' . App::$cur->db->table_prefix . $indexName . ' (' . implode(',', $index['cols']) . ')';
561
+                $tableIndexes[] = $index['type'].' '.App::$cur->db->table_prefix.$indexName.' ('.implode(',', $index['cols']).')';
562 562
             }
563 563
         }
564 564
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
     public static function index()
585 585
     {
586 586
 
587
-        return static::colPrefix() . 'id';
587
+        return static::colPrefix().'id';
588 588
     }
589 589
 
590 590
     /**
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
     {
597 597
         $classPath = explode('\\', get_called_class());
598 598
         $classPath = array_slice($classPath, 1);
599
-        return strtolower(implode('_', $classPath)) . '_';
599
+        return strtolower(implode('_', $classPath)).'_';
600 600
     }
601 601
 
602 602
     /**
@@ -661,12 +661,12 @@  discard block
 block discarded – undo
661 661
                     case 'to':
662 662
                         $relCol = $relations[$rel]['col'];
663 663
                         static::fixPrefix($relCol);
664
-                        App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
664
+                        App::$cur->db->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
665 665
                         break;
666 666
                     case 'one':
667 667
                         $col = $relations[$rel]['col'];
668 668
                         $relations[$rel]['model']::fixPrefix($col);
669
-                        App::$cur->db->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
669
+                        App::$cur->db->join($relations[$rel]['model']::table(), static::index().' = '.$col);
670 670
                         break;
671 671
                 }
672 672
             }
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
             }
682 682
             if ($param !== null) {
683 683
                 $cols = static::cols();
684
-                if (!isset($cols[$col]) && isset($cols[static::colPrefix() . $col])) {
685
-                    $col = static::colPrefix() . $col;
684
+                if (!isset($cols[$col]) && isset($cols[static::colPrefix().$col])) {
685
+                    $col = static::colPrefix().$col;
686 686
                 }
687 687
                 App::$cur->db->where($col, $param);
688 688
             } else {
@@ -742,12 +742,12 @@  discard block
 block discarded – undo
742 742
                     case 'to':
743 743
                         $relCol = $relations[$rel]['col'];
744 744
                         static::fixPrefix($relCol);
745
-                        $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
745
+                        $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
746 746
                         break;
747 747
                     case 'one':
748 748
                         $col = $relations[$rel]['col'];
749 749
                         $relations[$rel]['model']::fixPrefix($col);
750
-                        $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
750
+                        $query->join($relations[$rel]['model']::table(), static::index().' = '.$col);
751 751
                         break;
752 752
                 }
753 753
             }
@@ -1063,12 +1063,12 @@  discard block
 block discarded – undo
1063 1063
                     case 'to':
1064 1064
                         $relCol = $relations[$rel]['col'];
1065 1065
                         static::fixPrefix($relCol);
1066
-                        $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index() . ' = ' . $relCol);
1066
+                        $query->join($relations[$rel]['model']::table(), $relations[$rel]['model']::index().' = '.$relCol);
1067 1067
                         break;
1068 1068
                     case 'one':
1069 1069
                         $col = $relations[$rel]['col'];
1070 1070
                         $relations[$rel]['model']::fixPrefix($col);
1071
-                        $query->join($relations[$rel]['model']::table(), static::index() . ' = ' . $col);
1071
+                        $query->join($relations[$rel]['model']::table(), static::index().' = '.$col);
1072 1072
                         break;
1073 1073
                 }
1074 1074
             }
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
         } else {
1086 1086
             $cols .= '*';
1087 1087
         }
1088
-        $cols .=') as `count`' . (!empty($options['cols']) ? ',' . $options['cols'] : '');
1088
+        $cols .= ') as `count`'.(!empty($options['cols']) ? ','.$options['cols'] : '');
1089 1089
         $query->cols = $cols;
1090 1090
         if (!empty($options['group'])) {
1091 1091
             $query->group($options['group']);
@@ -1223,25 +1223,25 @@  discard block
 block discarded – undo
1223 1223
         $itemModel = $class::$treeCategory;
1224 1224
         $oldPath = $this->tree_path;
1225 1225
         $this->tree_path = $this->getCatalogTree($this);
1226
-        $itemsTable = \App::$cur->db->table_prefix . $itemModel::table();
1227
-        $itemTreeCol = $itemModel::colPrefix() . 'tree_path';
1226
+        $itemsTable = \App::$cur->db->table_prefix.$itemModel::table();
1227
+        $itemTreeCol = $itemModel::colPrefix().'tree_path';
1228 1228
 
1229
-        $categoryTreeCol = $this->colPrefix() . 'tree_path';
1230
-        $categoryTable = \App::$cur->db->table_prefix . $this->table();
1229
+        $categoryTreeCol = $this->colPrefix().'tree_path';
1230
+        $categoryTable = \App::$cur->db->table_prefix.$this->table();
1231 1231
         if ($oldPath) {
1232 1232
             \App::$cur->db->query('UPDATE
1233
-                ' . $categoryTable . ' 
1233
+                ' . $categoryTable.' 
1234 1234
                     SET 
1235
-                        ' . $categoryTreeCol . ' = REPLACE(' . $categoryTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") 
1236
-                    WHERE ' . $categoryTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"');
1235
+                        ' . $categoryTreeCol.' = REPLACE('.$categoryTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") 
1236
+                    WHERE ' . $categoryTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"');
1237 1237
 
1238 1238
             \App::$cur->db->query('UPDATE
1239
-                ' . $itemsTable . '
1239
+                ' . $itemsTable.'
1240 1240
                     SET 
1241
-                        ' . $itemTreeCol . ' = REPLACE(' . $itemTreeCol . ', "' . $oldPath . $this->id . '/' . '", "' . $this->tree_path . $this->id . '/' . '") 
1242
-                    WHERE ' . $itemTreeCol . ' LIKE "' . $oldPath . $this->id . '/' . '%"');
1241
+                        ' . $itemTreeCol.' = REPLACE('.$itemTreeCol.', "'.$oldPath.$this->id.'/'.'", "'.$this->tree_path.$this->id.'/'.'") 
1242
+                    WHERE ' . $itemTreeCol.' LIKE "'.$oldPath.$this->id.'/'.'%"');
1243 1243
         }
1244
-        $itemModel::update([$itemTreeCol => $this->tree_path . $this->id . '/'], [$itemModel::colPrefix() . $this->index(), $this->id]);
1244
+        $itemModel::update([$itemTreeCol => $this->tree_path.$this->id.'/'], [$itemModel::colPrefix().$this->index(), $this->id]);
1245 1245
     }
1246 1246
 
1247 1247
     /**
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
         $catalogParent = $catalogClass::get($catalog->parent_id);
1257 1257
         if ($catalog && $catalogParent) {
1258 1258
             if ($catalogParent->tree_path) {
1259
-                return $catalogParent->tree_path . $catalogParent->id . '/';
1259
+                return $catalogParent->tree_path.$catalogParent->id.'/';
1260 1260
             } else {
1261
-                return $this->getCatalogTree($catalogParent) . $catalogParent->id . '/';
1261
+                return $this->getCatalogTree($catalogParent).$catalogParent->id.'/';
1262 1262
             }
1263 1263
         }
1264 1264
         return '/';
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
         $categoryModel = $class::$categoryModel;
1274 1274
         $category = $categoryModel::get($this->{$categoryModel::index()});
1275 1275
         if ($category) {
1276
-            $this->tree_path = $category->tree_path . $category->pk() . '/';
1276
+            $this->tree_path = $category->tree_path.$category->pk().'/';
1277 1277
         } else {
1278 1278
             $this->tree_path = '/';
1279 1279
         }
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
             $this->changeCategoryTree();
1300 1300
         }
1301 1301
         if (!empty($this->_changedParams) && $this->pk()) {
1302
-            Inji::$inst->event('modelItemParamsChanged-' . get_called_class(), $this);
1302
+            Inji::$inst->event('modelItemParamsChanged-'.get_called_class(), $this);
1303 1303
         }
1304 1304
         $this->beforeSave();
1305 1305
 
@@ -1337,7 +1337,7 @@  discard block
 block discarded – undo
1337 1337
         }
1338 1338
         $this->_params = $result->fetch();
1339 1339
         if ($new) {
1340
-            Inji::$inst->event('modelCreatedItem-' . get_called_class(), $this);
1340
+            Inji::$inst->event('modelCreatedItem-'.get_called_class(), $this);
1341 1341
         }
1342 1342
         $this->afterSave();
1343 1343
         return $this->{$this->index()};
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
         static::fixPrefix($params);
1484 1484
         $className = get_called_class();
1485 1485
         foreach ($params as $paramName => $value) {
1486
-            $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $paramName);
1486
+            $shortName = preg_replace('!'.$this->colPrefix().'!', '', $paramName);
1487 1487
             if (!empty($className::$cols[$shortName])) {
1488 1488
                 switch ($className::$cols[$shortName]['type']) {
1489 1489
                     case 'decimal':
@@ -1763,7 +1763,7 @@  discard block
 block discarded – undo
1763 1763
     {
1764 1764
         static::fixPrefix($name);
1765 1765
         $className = get_called_class();
1766
-        $shortName = preg_replace('!' . $this->colPrefix() . '!', '', $name);
1766
+        $shortName = preg_replace('!'.$this->colPrefix().'!', '', $name);
1767 1767
         if (!empty($className::$cols[$shortName])) {
1768 1768
             switch ($className::$cols[$shortName]['type']) {
1769 1769
                 case 'decimal':
Please login to merge, or discard this patch.
system/Inji/Tools.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     public static function uriParse($uri)
39 39
     {
40 40
         $answerPos = strpos($uri, '?');
41
-        $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri) )), 1);
41
+        $params = array_slice(explode('/', substr($uri, 0, $answerPos ? $answerPos : strlen($uri))), 1);
42 42
 
43 43
         foreach ($params as $key => $param) {
44 44
             if ($param != '') {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
         $path = explode('/', $path);
65 65
         $cur = '';
66 66
         foreach ($path as $item) {
67
-            $cur .= $item . '/';
67
+            $cur .= $item.'/';
68 68
             if (!file_exists($cur)) {
69 69
                 mkdir($cur);
70 70
             }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     public static function resizeImage($img_path, $max_width = 1000, $max_height = 1000, $crop = false, $pos = 'center')
86 86
     {
87 87
         ini_set("gd.jpeg_ignore_warning", 1);
88
-        list( $img_width, $img_height, $img_type, $img_tag ) = getimagesize($img_path);
88
+        list($img_width, $img_height, $img_type, $img_tag) = getimagesize($img_path);
89 89
         switch ($img_type) {
90 90
             case 1:
91 91
                 $img_type = 'gif';
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 
109 109
         if ($crop === true || $crop == 'q') {
110 110
             if ($img_width > $img_height) {
111
-                $imgX = floor(( $img_width - $img_height ) / 2);
111
+                $imgX = floor(($img_width - $img_height) / 2);
112 112
                 $imgY = 0;
113 113
                 $img_width = $img_height;
114 114
                 $new_width = $max_width;
115 115
                 $new_height = $max_height;
116 116
             } else {
117 117
                 $imgX = 0;
118
-                $imgY = floor(( $img_height - $img_width ) / 2);
118
+                $imgY = floor(($img_height - $img_width) / 2);
119 119
                 $img_height = $img_width;
120 120
                 $new_width = $max_width;
121 121
                 $new_height = $max_height;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             $new_width = $max_width;
137 137
             $new_height = $max_height;
138 138
 //Находим начальные координаты (центрируем новое изображение)
139
-            $imgX = (int) (($ow / 2) - ($img_width / 2) );
139
+            $imgX = (int) (($ow / 2) - ($img_width / 2));
140 140
             if ($pos == 'center') {
141 141
                 $imgY = (int) (($oh / 2) - ($img_height / 2));
142 142
             } else {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         if (!headers_sent()) {
207 207
             header("Location: {$href}");
208 208
         } else {
209
-            echo '\'"><script>window.location="' . $href . '";</script>';
209
+            echo '\'"><script>window.location="'.$href.'";</script>';
210 210
         }
211 211
         exit("Перенаправление на: <a href = '{$href}'>{$href}</a>");
212 212
     }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             $pathArray = $cleanPathArray;
267 267
             $cleanPathArray = [];
268 268
         } while ($changes);
269
-        return (strpos($path, '/') === 0 ? '/' : '') . implode('/', $pathArray);
269
+        return (strpos($path, '/') === 0 ? '/' : '').implode('/', $pathArray);
270 270
     }
271 271
 
272 272
     /**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         if (empty($month[$mm - 1])) {
288 288
             return 'Не указано';
289 289
         }
290
-        return ($dd > 0 ? $dd . " " : '') . $month[$mm - 1] . " " . $yy . " " . $hours;
290
+        return ($dd > 0 ? $dd." " : '').$month[$mm - 1]." ".$yy." ".$hours;
291 291
     }
292 292
 
293 293
     /**
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
             if (in_array($file, ['.', '..'])) {
370 370
                 continue;
371 371
             }
372
-            if (is_dir($from . '/' . $file)) {
373
-                self::copyFiles($from . '/' . $file, $to . '/' . $file);
372
+            if (is_dir($from.'/'.$file)) {
373
+                self::copyFiles($from.'/'.$file, $to.'/'.$file);
374 374
             } else {
375
-                copy($from . '/' . $file, $to . '/' . $file);
375
+                copy($from.'/'.$file, $to.'/'.$file);
376 376
             }
377 377
         }
378 378
     }
Please login to merge, or discard this patch.
system/Inji/Config.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
             return self::$_configs['system'];
29 29
         }
30 30
 
31
-        if (!file_exists(INJI_SYSTEM_DIR . '/config/config.php')) {
31
+        if (!file_exists(INJI_SYSTEM_DIR.'/config/config.php')) {
32 32
             return [];
33 33
         }
34 34
 
35
-        return self::$_configs['system'] = include INJI_SYSTEM_DIR . '/config/config.php';
35
+        return self::$_configs['system'] = include INJI_SYSTEM_DIR.'/config/config.php';
36 36
     }
37 37
 
38 38
     /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             return self::$_configs['app'][$app->name];
69 69
         }
70 70
 
71
-        $path = $app->path . "/config/config.php";
71
+        $path = $app->path."/config/config.php";
72 72
         if (!file_exists($path)) {
73 73
             return [];
74 74
         }
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
             if (isset(self::$_configs['shareModules'][$module])) {
89 89
                 return self::$_configs['shareModules'][$module];
90 90
             }
91
-            $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php";
91
+            $path = INJI_PROGRAM_DIR."/config/modules/{$module}.php";
92 92
         } else {
93 93
             if (isset(self::$_configs['share'])) {
94 94
                 return self::$_configs['share'];
95 95
             }
96
-            $path = INJI_PROGRAM_DIR . "/config/config.php";
96
+            $path = INJI_PROGRAM_DIR."/config/config.php";
97 97
         }
98 98
         if (!file_exists($path)) {
99
-            if (file_exists(INJI_SYSTEM_DIR . "/modules/{$module}/defaultConfig.php")) {
100
-                $path = INJI_SYSTEM_DIR . "/modules/{$module}/defaultConfig.php";
99
+            if (file_exists(INJI_SYSTEM_DIR."/modules/{$module}/defaultConfig.php")) {
100
+                $path = INJI_SYSTEM_DIR."/modules/{$module}/defaultConfig.php";
101 101
             } else {
102 102
                 return [];
103 103
             }
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
             return self::$_configs['module'][$appName][$module_name];
137 137
         }
138 138
 
139
-        $path = $appPath . "/config/modules/{$module_name}.php";
139
+        $path = $appPath."/config/modules/{$module_name}.php";
140 140
         if (!file_exists($path)) {
141
-            $path = INJI_SYSTEM_DIR . "/modules/{$module_name}/defaultConfig.php";
141
+            $path = INJI_SYSTEM_DIR."/modules/{$module_name}/defaultConfig.php";
142 142
         }
143 143
 
144 144
 
@@ -163,27 +163,27 @@  discard block
 block discarded – undo
163 163
         }
164 164
         switch ($type) {
165 165
             case 'system':
166
-                $path = INJI_SYSTEM_DIR . '/config/config.php';
166
+                $path = INJI_SYSTEM_DIR.'/config/config.php';
167 167
                 self::$_configs['system'] = $data;
168 168
                 Inji::$inst->event('Config-change-system', $data);
169 169
                 break;
170 170
             case 'app':
171
-                $path = $app->path . "/config/config.php";
171
+                $path = $app->path."/config/config.php";
172 172
                 self::$_configs['app'][$app->name] = $data;
173
-                Inji::$inst->event('Config-change-app-' . $app->name, $data);
173
+                Inji::$inst->event('Config-change-app-'.$app->name, $data);
174 174
                 break;
175 175
             case 'module':
176
-                $path = $app->path . "/config/modules/{$module}.php";
176
+                $path = $app->path."/config/modules/{$module}.php";
177 177
                 self::$_configs['module'][$app->name][$module] = $data;
178
-                Inji::$inst->event('Config-change-module-' . $app->name . '-' . $module, $data);
178
+                Inji::$inst->event('Config-change-module-'.$app->name.'-'.$module, $data);
179 179
                 break;
180 180
             case 'share':
181 181
                 if ($module) {
182
-                    $path = INJI_PROGRAM_DIR . "/config/modules/{$module}.php";
182
+                    $path = INJI_PROGRAM_DIR."/config/modules/{$module}.php";
183 183
                     self::$_configs['shareModules'][$module] = $data;
184
-                    Inji::$inst->event('Config-change-shareModules-' . $module, $data);
184
+                    Inji::$inst->event('Config-change-shareModules-'.$module, $data);
185 185
                 } else {
186
-                    $path = INJI_PROGRAM_DIR . "/config/config.php";
186
+                    $path = INJI_PROGRAM_DIR."/config/config.php";
187 187
                     self::$_configs['share'] = $data;
188 188
                     Inji::$inst->event('Config-change-share', $data);
189 189
                 }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
                 self::$_configs['custom'][$path] = $data;
194 194
                 break;
195 195
         }
196
-        $text = "<?php\nreturn " . CodeGenerator::genArray($data);
196
+        $text = "<?php\nreturn ".CodeGenerator::genArray($data);
197 197
         Tools::createDir(substr($path, 0, strripos($path, '/')));
198 198
         file_put_contents($path, $text);
199 199
     }
Please login to merge, or discard this patch.
system/Inji/UserRequest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         if ($type == 'array') {
19 19
             return !is_array($_GET[$key]) ? [] : $_GET[$key];
20 20
         }
21
-        return eval('return (' . $type . ') $_GET[$key];');
21
+        return eval('return ('.$type.') $_GET[$key];');
22 22
     }
23 23
 
24 24
 }
Please login to merge, or discard this patch.