Completed
Push — master ( 135fa8...4a5eb0 )
by Alexey
09:51 queued 04:36
created
system/modules/Files/Files.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
             }
47 47
         }
48 48
         $fileObject->name = $fileinfo['filename'];
49
-        $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension'];
50
-        if ($fileObject->id && file_exists($sitePath . $fileObject->path))
51
-            unlink($sitePath . $fileObject->path);
49
+        $fileObject->path = $type->type_dir.date('Y-m-d').'/'.microtime(true).'.'.$fileinfo['extension'];
50
+        if ($fileObject->id && file_exists($sitePath.$fileObject->path))
51
+            unlink($sitePath.$fileObject->path);
52 52
 
53
-        Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/');
53
+        Tools::createDir($sitePath.$type->type_dir.date('Y-m-d').'/');
54 54
 
55
-        if (!move_uploaded_file($file['tmp_name'], $sitePath . $fileObject->path))
55
+        if (!move_uploaded_file($file['tmp_name'], $sitePath.$fileObject->path))
56 56
             return false;
57 57
 
58 58
         $fileObject->type_id = $type->pk();
@@ -96,17 +96,17 @@  discard block
 block discarded – undo
96 96
             }
97 97
         }
98 98
         $fileObject->name = $fileinfo['filename'];
99
-        $fileObject->path = $type->type_dir . date('Y-m-d') . '/' . microtime(true) . '.' . $fileinfo['extension'];
100
-        if ($fileObject->id && file_exists($sitePath . $fileObject->path))
101
-            unlink($sitePath . $fileObject->path);
99
+        $fileObject->path = $type->type_dir.date('Y-m-d').'/'.microtime(true).'.'.$fileinfo['extension'];
100
+        if ($fileObject->id && file_exists($sitePath.$fileObject->path))
101
+            unlink($sitePath.$fileObject->path);
102 102
 
103
-        Tools::createDir($sitePath . $type->type_dir . date('Y-m-d') . '/');
103
+        Tools::createDir($sitePath.$type->type_dir.date('Y-m-d').'/');
104 104
 
105 105
         $file = @file_get_contents($url);
106 106
         if ($file === false) {
107 107
             return 0;
108 108
         }
109
-        file_put_contents($sitePath . $fileObject->path, $file);
109
+        file_put_contents($sitePath.$fileObject->path, $file);
110 110
 
111 111
         $fileObject->type_id = $type->pk();
112 112
         $fileObject->original_name = $fileinfo['basename'];
Please login to merge, or discard this patch.
system/modules/Modules/appAdminControllers/content/editor.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,22 +12,22 @@  discard block
 block discarded – undo
12 12
     'Операции'
13 13
 ]);
14 14
 $modulePath = Module::getModulePath($module);
15
-$path = $modulePath . '/models';
16
-$config = Config::custom(App::$primary->path . '/modules/' . $module . '/generatorHash.php');
15
+$path = $modulePath.'/models';
16
+$config = Config::custom(App::$primary->path.'/modules/'.$module.'/generatorHash.php');
17 17
 if (file_exists($path)) {
18 18
     $files = array_slice(scandir($path), 2);
19 19
     foreach ($files as $file) {
20
-        if (is_dir($path . '/' . $file)) {
20
+        if (is_dir($path.'/'.$file)) {
21 21
             continue;
22 22
         }
23 23
         $modelName = pathinfo($file, PATHINFO_FILENAME);
24 24
         $table->addRow([
25 25
             $modelName,
26
-            (!empty($config['models/' . $file]) && $config['models/' . $file] == md5(file_get_contents($path . '/' . $file))) ? '<b class="text-success">Нету</b>' : '<b class="text-danger">Есть</b>',
26
+            (!empty($config['models/'.$file]) && $config['models/'.$file] == md5(file_get_contents($path.'/'.$file))) ? '<b class="text-success">Нету</b>' : '<b class="text-danger">Есть</b>',
27 27
             [
28 28
                 'class' => 'actionTd',
29
-                'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editModel/' . $module . '/' . $modelName . '"><i class="glyphicon glyphicon-edit"></i></a>'
30
-                . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delModel/' . $module . '/' . $modelName . '"><i class="glyphicon glyphicon-remove"></i></a>'
29
+                'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editModel/'.$module.'/'.$modelName.'"><i class="glyphicon glyphicon-edit"></i></a>'
30
+                . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delModel/'.$module.'/'.$modelName.'"><i class="glyphicon glyphicon-remove"></i></a>'
31 31
             ]
32 32
         ]);
33 33
     }
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
     'Controllers'
51 51
 ];
52 52
 foreach ($types as $type) {
53
-    if (file_exists($modulePath . '/' . $type)) {
54
-        $files = array_slice(scandir($modulePath . '/' . $type), 2);
53
+    if (file_exists($modulePath.'/'.$type)) {
54
+        $files = array_slice(scandir($modulePath.'/'.$type), 2);
55 55
         foreach ($files as $file) {
56 56
             $table->addRow([
57 57
                 pathinfo($file, PATHINFO_FILENAME),
58 58
                 $type,
59 59
                 [
60 60
                     'class' => 'actionTd',
61
-                    'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/controllerEditor/' . $module . '/' . $type . '/' . pathinfo($file, PATHINFO_FILENAME) . '"><i class="glyphicon glyphicon-edit"></i></a>'
62
-                    . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delController/' . $module . '/' . $type . '/' . pathinfo($file, PATHINFO_FILENAME) . '"><i class="glyphicon glyphicon-remove"></i></a>'
61
+                    'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/controllerEditor/'.$module.'/'.$type.'/'.pathinfo($file, PATHINFO_FILENAME).'"><i class="glyphicon glyphicon-edit"></i></a>'
62
+                    . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delController/'.$module.'/'.$type.'/'.pathinfo($file, PATHINFO_FILENAME).'"><i class="glyphicon glyphicon-remove"></i></a>'
63 63
                 ]
64 64
             ]);
65 65
         }
Please login to merge, or discard this patch.
system/modules/Modules/appAdminControllers/content/install.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
     <?php
4 4
     $config = Config::app(App::$primary ? App::$primary : App::$cur);
5 5
     $modules = array_flip(Module::getInstalled(App::$cur));
6
-    $systemModules = array_slice(scandir(INJI_SYSTEM_DIR . '/modules'), 2);
6
+    $systemModules = array_slice(scandir(INJI_SYSTEM_DIR.'/modules'), 2);
7 7
     foreach ($systemModules as $module) {
8 8
         $info = Module::getInfo($module);
9 9
         if (!$info || isset($modules[$module]))
Please login to merge, or discard this patch.
system/modules/Modules/appAdminControllers/content/modelEditor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 $form = new Ui\Form();
3
-$form->begin((!empty($modelFullName) ? 'Изменение' : 'Создание') . ' модели');
3
+$form->begin((!empty($modelFullName) ? 'Изменение' : 'Создание').' модели');
4 4
 $cols = [
5 5
     'label' => ['type' => 'text', 'label' => 'Название'],
6 6
     'code' => ['type' => 'text', 'label' => 'Код'],
Please login to merge, or discard this patch.
system/modules/Modules/appAdminControllers/content/controllerEditor.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,15 +10,15 @@
 block discarded – undo
10 10
     'href' => "/admin/modules/createControllerMethod/{$module}/{$type}/{$controller}",
11 11
     'text' => 'Создать'
12 12
 ]);
13
-$class = CodeGenerator::parseClass(Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php');
13
+$class = CodeGenerator::parseClass(Modules::getModulePath($module).'/'.$type.'/'.$controller.'.php');
14 14
 foreach ($class->methods as $method) {
15 15
     $name = str_replace('Action', '', $method->name);
16 16
     $table->addRow([
17 17
         $name,
18 18
         [
19 19
             'class' => 'actionTd',
20
-            'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-edit"></i></a>'
21
-            . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delControllerMethod/' . $module . '/' . $type . '/' . $controller . '/' . $name . '"><i class="glyphicon glyphicon-remove"></i></a>'
20
+            'html' => '<a class="btn btn-xs btn-success" href="/admin/modules/editControllerMethod/'.$module.'/'.$type.'/'.$controller.'/'.$name.'"><i class="glyphicon glyphicon-edit"></i></a>'
21
+            . ' <a class="btn btn-xs btn-danger" href="/admin/modules/delControllerMethod/'.$module.'/'.$type.'/'.$controller.'/'.$name.'"><i class="glyphicon glyphicon-remove"></i></a>'
22 22
         ]
23 23
     ]);
24 24
 }
Please login to merge, or discard this patch.
system/modules/Modules/appAdminControllers/ModulesController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
         $config = App::$primary->config;
22 22
         $config['defaultModule'] = $module;
23 23
         Config::save('app', $config);
24
-        Tools::redirect('/admin/modules', 'Модулем по умолчанию установлен: ' . $module, 'success');
24
+        Tools::redirect('/admin/modules', 'Модулем по умолчанию установлен: '.$module, 'success');
25 25
     }
26 26
 
27 27
     public function installAction()
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             foreach ($_GET['modules'] as $module) {
31 31
                 $this->modules->install($module);
32 32
             }
33
-            Tools::redirect('/admin/modules', 'Моудли ' . implode(',', $_GET['modules']) . ' установлены');
33
+            Tools::redirect('/admin/modules', 'Моудли '.implode(',', $_GET['modules']).' установлены');
34 34
         }
35 35
         $this->view->page();
36 36
     }
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
         $codeName = filter_input(INPUT_POST, 'codeName');
41 41
         if ($codeName && filter_input(INPUT_POST, 'name')) {
42 42
             $codeName = ucfirst($codeName);
43
-            if (file_exists(App::$primary->path . '/modules/' . $codeName . '.php')) {
43
+            if (file_exists(App::$primary->path.'/modules/'.$codeName.'.php')) {
44 44
                 Msg::add('Модуль с таким именем уже существует');
45 45
             } else {
46 46
                 $this->modules->createBlankModule(filter_input(INPUT_POST, 'name'), $codeName);
47 47
                 $config = App::$primary->config;
48 48
                 $config['modules'][] = $codeName;
49 49
                 Config::save('app', $config);
50
-                Tools::redirect('/admin/modules', 'Моудль ' . $codeName . ' создан и установлен');
50
+                Tools::redirect('/admin/modules', 'Моудль '.$codeName.' создан и установлен');
51 51
             }
52 52
         }
53 53
         $this->view->page();
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function editorAction($module)
57 57
     {
58
-        if (!file_exists(Module::getModulePath($module) . '/generatorHash.php')) {
58
+        if (!file_exists(Module::getModulePath($module).'/generatorHash.php')) {
59 59
             Msg::add('Этот модуль был создан без помощи генератора. Возможности его изменения ограничены и могут привести к порче модуля', 'danger');
60 60
         }
61 61
         $this->view->page(['data' => compact('module')]);
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
 
64 64
     public function editModelAction($module, $modelName)
65 65
     {
66
-        $path = Modules::getModulePath($module) . '/models/' . $modelName . '.php';
66
+        $path = Modules::getModulePath($module).'/models/'.$modelName.'.php';
67 67
         if (!file_exists($path)) {
68
-            Tools::redirect('/admin/modules/edit/' . $module, 'Модель ' . $modelName . ' не найдена', 'danger');
68
+            Tools::redirect('/admin/modules/edit/'.$module, 'Модель '.$modelName.' не найдена', 'danger');
69 69
         }
70
-        include_once Modules::getModulePath($module) . '/models/' . $modelName . '.php';
71
-        $modelFullName = $module . '\\' . $modelName;
70
+        include_once Modules::getModulePath($module).'/models/'.$modelName.'.php';
71
+        $modelFullName = $module.'\\'.$modelName;
72 72
         $model = new $modelFullName;
73 73
         if (filter_input(INPUT_POST, 'codeName') && filter_input(INPUT_POST, 'name')) {
74 74
             $this->modules->generateModel($module, filter_input(INPUT_POST, 'name'), filter_input(INPUT_POST, 'codeName'), [
75 75
                 'cols' => $_POST['cols']
76 76
             ]);
77
-            Tools::redirect('/admin/modules/editor/' . $module, 'Модель ' . filter_input(INPUT_POST, 'codeName') . ' была сохранена');
77
+            Tools::redirect('/admin/modules/editor/'.$module, 'Модель '.filter_input(INPUT_POST, 'codeName').' была сохранена');
78 78
         }
79 79
         $this->view->page(['content' => 'modelEditor', 'data' => compact('module', 'modelName', 'modelFullName', 'model')]);
80 80
     }
@@ -85,20 +85,20 @@  discard block
 block discarded – undo
85 85
             $this->modules->generateModel($module, filter_input(INPUT_POST, 'name'), filter_input(INPUT_POST, 'codeName'), [
86 86
                 'cols' => $_POST['cols']
87 87
             ]);
88
-            Tools::redirect('/admin/modules/editor/' . $module, 'Модель ' . filter_input(INPUT_POST, 'codeName') . ' была создана');
88
+            Tools::redirect('/admin/modules/editor/'.$module, 'Модель '.filter_input(INPUT_POST, 'codeName').' была создана');
89 89
         }
90 90
         $this->view->page(['content' => 'modelEditor', 'data' => compact('module')]);
91 91
     }
92 92
 
93 93
     public function delModelAction($module, $modelName)
94 94
     {
95
-        unlink(App::$primary->path . '/modules/' . $module . '/models/' . $modelName . '.php');
96
-        $config = Config::custom(App::$primary->path . '/modules/' . $module . '/generatorHash.php');
97
-        if (isset($config['models/' . $modelName . '.php'])) {
98
-            unset($config['models/' . $modelName . '.php']);
99
-            Config::save(App::$primary->path . '/modules/' . $module . '/generatorHash.php', $config);
95
+        unlink(App::$primary->path.'/modules/'.$module.'/models/'.$modelName.'.php');
96
+        $config = Config::custom(App::$primary->path.'/modules/'.$module.'/generatorHash.php');
97
+        if (isset($config['models/'.$modelName.'.php'])) {
98
+            unset($config['models/'.$modelName.'.php']);
99
+            Config::save(App::$primary->path.'/modules/'.$module.'/generatorHash.php', $config);
100 100
         }
101
-        Tools::redirect('/admin/modules/editor/' . $module, 'Модель ' . $modelName . ' была удалена');
101
+        Tools::redirect('/admin/modules/editor/'.$module, 'Модель '.$modelName.' была удалена');
102 102
     }
103 103
 
104 104
     public function createControllerAction($module)
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $controllerType = filter_input(INPUT_POST, 'type');
107 107
         if ($controllerType) {
108 108
             $this->modules->createController($module, $controllerType);
109
-            Tools::redirect('/admin/modules/editor/' . $module, 'Контроллер был создан');
109
+            Tools::redirect('/admin/modules/editor/'.$module, 'Контроллер был создан');
110 110
         }
111 111
         $this->view->page();
112 112
     }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         $url = filter_input(INPUT_POST, 'url');
122 122
         if ($url) {
123 123
             $this->modules->addActionToController($module, $type, $controller, $url);
124
-            Tools::redirect('/admin/modules/editor/' . $module, 'Контроллер был изменен');
124
+            Tools::redirect('/admin/modules/editor/'.$module, 'Контроллер был изменен');
125 125
         }
126 126
         $this->view->page(['data' => compact('module', 'type', 'controller')]);
127 127
     }
Please login to merge, or discard this patch.
system/modules/Modules/Modules.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,19 +13,19 @@  discard block
 block discarded – undo
13 13
     public function createBlankModule($name, $codeName)
14 14
     {
15 15
         $codeName = ucfirst($codeName);
16
-        Tools::createDir(App::$primary->path . '/modules/' . $codeName);
16
+        Tools::createDir(App::$primary->path.'/modules/'.$codeName);
17 17
         ob_start();
18
-        include $this->path . '/tpls/BlankModule.php';
18
+        include $this->path.'/tpls/BlankModule.php';
19 19
         $moduleCode = ob_get_contents();
20 20
         ob_end_clean();
21
-        file_put_contents(App::$primary->path . '/modules/' . $codeName . '/' . $codeName . '.php', $moduleCode);
22
-        file_put_contents(App::$primary->path . '/modules/' . $codeName . '/info.php', "<?php\nreturn " . CodeGenerator::genArray(['name' => $name]));
23
-        file_put_contents(App::$primary->path . '/modules/' . $codeName . '/generatorHash.php', "<?php\nreturn " . CodeGenerator::genArray([$codeName . '.php' => md5($moduleCode)]));
21
+        file_put_contents(App::$primary->path.'/modules/'.$codeName.'/'.$codeName.'.php', $moduleCode);
22
+        file_put_contents(App::$primary->path.'/modules/'.$codeName.'/info.php', "<?php\nreturn ".CodeGenerator::genArray(['name' => $name]));
23
+        file_put_contents(App::$primary->path.'/modules/'.$codeName.'/generatorHash.php', "<?php\nreturn ".CodeGenerator::genArray([$codeName.'.php' => md5($moduleCode)]));
24 24
     }
25 25
 
26 26
     public function parseColsForModel($cols = [])
27 27
     {
28
-        $modelCols = [ 'labels' => [], 'cols' => [], 'relations' => []];
28
+        $modelCols = ['labels' => [], 'cols' => [], 'relations' => []];
29 29
         foreach ($cols as $col) {
30 30
             $modelCols['labels'][$col['code']] = $col['label'];
31 31
             $colType = !empty($col['type']['primary']) ? $col['type']['primary'] : $col['type'];
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
         $colsExist = App::$cur->db->getTableCols($tableName);
52 52
         $tableCols = [];
53
-        if (empty($colsExist[$colPrefix . 'id'])) {
54
-            $tableCols[$colPrefix . 'id'] = 'pk';
53
+        if (empty($colsExist[$colPrefix.'id'])) {
54
+            $tableCols[$colPrefix.'id'] = 'pk';
55 55
         }
56 56
         foreach ($cols as $col) {
57
-            if (!empty($colsExist[$colPrefix . $col['code']])) {
57
+            if (!empty($colsExist[$colPrefix.$col['code']])) {
58 58
                 continue;
59 59
             }
60 60
             $colType = !empty($col['type']['primary']) ? $col['type']['primary'] : $col['type'];
@@ -62,23 +62,23 @@  discard block
 block discarded – undo
62 62
                 case 'image':
63 63
                 case 'number':
64 64
                 case 'relation':
65
-                    $tableCols[$colPrefix . $col['code']] = 'int(11) NOT NULL';
65
+                    $tableCols[$colPrefix.$col['code']] = 'int(11) NOT NULL';
66 66
                     break;
67 67
                 case 'decimal':
68
-                    $tableCols[$colPrefix . $col['code']] = 'decimal(11,2) NOT NULL';
68
+                    $tableCols[$colPrefix.$col['code']] = 'decimal(11,2) NOT NULL';
69 69
                     break;
70 70
                 case 'dateTime':
71
-                    $tableCols[$colPrefix . $col['code']] = 'timestamp NOT NULL';
71
+                    $tableCols[$colPrefix.$col['code']] = 'timestamp NOT NULL';
72 72
                     break;
73 73
                 case 'currentDateTime':
74
-                    $tableCols[$colPrefix . $col['code']] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
74
+                    $tableCols[$colPrefix.$col['code']] = 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP';
75 75
                     break;
76 76
                 case 'text':
77
-                    $tableCols[$colPrefix . $col['code']] = 'varchar(255) NOT NULL';
77
+                    $tableCols[$colPrefix.$col['code']] = 'varchar(255) NOT NULL';
78 78
                     break;
79 79
                 case 'textarea':
80 80
                 default:
81
-                    $tableCols[$colPrefix . $col['code']] = 'text NOT NULL';
81
+                    $tableCols[$colPrefix.$col['code']] = 'text NOT NULL';
82 82
                     break;
83 83
             }
84 84
         }
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
         $modelCols = $this->parseColsForModel();
95 95
         if (!empty($options['cols'])) {
96 96
             $modelCols = $this->parseColsForModel($options['cols']);
97
-            $tableName = strtolower($module) . '_' . strtolower($codeName);
98
-            $tableCols = $this->parseColsForTable($options['cols'], strtolower($codeName) . '_', $tableName);
97
+            $tableName = strtolower($module).'_'.strtolower($codeName);
98
+            $tableCols = $this->parseColsForTable($options['cols'], strtolower($codeName).'_', $tableName);
99 99
             if (App::$cur->db->tableExist($tableName)) {
100 100
                 foreach ($tableCols as $colKey => $params) {
101 101
                     App::$cur->db->add_col($tableName, $colKey, $params);
@@ -107,15 +107,15 @@  discard block
 block discarded – undo
107 107
         $class->addProperty('objectName', $name, true);
108 108
         $class->addProperty('cols', $modelCols['cols'], true);
109 109
         $class->addProperty('labels', $modelCols['labels'], true);
110
-        $class->addMethod('relations', 'return ' . CodeGenerator::genArray($modelCols['relations']), [], true);
111
-        $modelCode = "<?php \n\nnamespace {$module};\n\n" . $class->generate();
110
+        $class->addMethod('relations', 'return '.CodeGenerator::genArray($modelCols['relations']), [], true);
111
+        $modelCode = "<?php \n\nnamespace {$module};\n\n".$class->generate();
112 112
 
113 113
         $modulePath = Module::getModulePath($module);
114
-        Tools::createDir($modulePath . '/models');
115
-        file_put_contents($modulePath . '/models/' . $codeName . '.php', $modelCode);
116
-        $config = Config::custom($modulePath . '/generatorHash.php');
117
-        $config['models/' . $codeName . '.php'] = md5($modelCode);
118
-        Config::save($modulePath . '/generatorHash.php', $config);
114
+        Tools::createDir($modulePath.'/models');
115
+        file_put_contents($modulePath.'/models/'.$codeName.'.php', $modelCode);
116
+        $config = Config::custom($modulePath.'/generatorHash.php');
117
+        $config['models/'.$codeName.'.php'] = md5($modelCode);
118
+        Config::save($modulePath.'/generatorHash.php', $config);
119 119
     }
120 120
 
121 121
     public function install($module, $params = [])
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         $type = 'modules';
137 137
 
138
-        $path = INJI_SYSTEM_DIR . '/modules/';
138
+        $path = INJI_SYSTEM_DIR.'/modules/';
139 139
         $location = 'modules';
140 140
 
141 141
         $config[$location][] = $module;
@@ -148,8 +148,8 @@  discard block
 block discarded – undo
148 148
             }
149 149
         }
150 150
         Config::save('app', $config, null, App::$primary);
151
-        if (file_exists($path . $module . '/install_script.php')) {
152
-            $installFunction = include $path . $module . '/install_script.php';
151
+        if (file_exists($path.$module.'/install_script.php')) {
152
+            $installFunction = include $path.$module.'/install_script.php';
153 153
             $installFunction(1, $params);
154 154
         }
155 155
     }
@@ -178,8 +178,8 @@  discard block
 block discarded – undo
178 178
             $info = Modules::getInfo($module);
179 179
             $moduleName = !empty($info['name']) ? $info['name'] : $module;
180 180
             foreach ($modelsNames as $modelName) {
181
-                $fullModelName = $module . '\\' . $modelName;
182
-                $models[$fullModelName] = $moduleName . ' - ' . ($fullModelName::$objectName ? $fullModelName::$objectName : $modelName);
181
+                $fullModelName = $module.'\\'.$modelName;
182
+                $models[$fullModelName] = $moduleName.' - '.($fullModelName::$objectName ? $fullModelName::$objectName : $modelName);
183 183
             }
184 184
         }
185 185
         foreach (App::$primary->config['modules'] as $configModule) {
@@ -190,9 +190,9 @@  discard block
 block discarded – undo
190 190
             $info = Modules::getInfo($configModule);
191 191
             $moduleName = !empty($info['name']) ? $info['name'] : $configModule;
192 192
             foreach ($modelsNames as $modelName) {
193
-                $fullModelName = $configModule . '\\' . $modelName;
193
+                $fullModelName = $configModule.'\\'.$modelName;
194 194
                 Router::loadClass($fullModelName);
195
-                $models[$fullModelName] = $moduleName . ' - ' . ($fullModelName::$objectName ? $fullModelName::$objectName : $modelName);
195
+                $models[$fullModelName] = $moduleName.' - '.($fullModelName::$objectName ? $fullModelName::$objectName : $modelName);
196 196
             }
197 197
         }
198 198
         return $models;
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
     public function getModelsList($module, $dir = '')
202 202
     {
203 203
         $modulePath = Module::getModulePath($module);
204
-        $path = rtrim($modulePath . '/models/' . $dir, '/');
204
+        $path = rtrim($modulePath.'/models/'.$dir, '/');
205 205
         $models = [];
206 206
         if (file_exists($path)) {
207 207
             foreach (array_slice(scandir($path), 2) as $file) {
208 208
                 $modelLastName = pathinfo($file, PATHINFO_FILENAME);
209
-                if (is_dir($path . '/' . $file)) {
210
-                    $models = array_merge($models, $this->getModelsList($module, $dir . '/' . $modelLastName));
209
+                if (is_dir($path.'/'.$file)) {
210
+                    $models = array_merge($models, $this->getModelsList($module, $dir.'/'.$modelLastName));
211 211
                 }
212
-                $nameSpace = trim(preg_replace('!/' . $modelLastName . '$!', '', $dir), '/');
213
-                $models[] = trim(str_replace('/', '\\', $nameSpace) . '\\' . $modelLastName, '\\');
212
+                $nameSpace = trim(preg_replace('!/'.$modelLastName.'$!', '', $dir), '/');
213
+                $models[] = trim(str_replace('/', '\\', $nameSpace).'\\'.$modelLastName, '\\');
214 214
             }
215 215
         }
216 216
         return $models;
@@ -219,30 +219,30 @@  discard block
 block discarded – undo
219 219
     public function createController($module, $controllerType)
220 220
     {
221 221
         $modulePath = Module::getModulePath($module);
222
-        $path = $modulePath . '/' . $controllerType . '/' . $module . 'Controller.php';
222
+        $path = $modulePath.'/'.$controllerType.'/'.$module.'Controller.php';
223 223
         $class = new CodeGenerator\ClassGenerator();
224
-        $class->name = $module . 'Controller';
224
+        $class->name = $module.'Controller';
225 225
         $class->extends = 'Controller';
226
-        $controllerCode = "<?php\n\n" . $class->generate();
226
+        $controllerCode = "<?php\n\n".$class->generate();
227 227
         Tools::createDir(pathinfo($path, PATHINFO_DIRNAME));
228 228
         file_put_contents($path, $controllerCode);
229
-        $config = Config::custom($modulePath . '/generatorHash.php');
230
-        $config[$controllerType . '/' . $module . 'Controller.php'] = md5($controllerCode);
231
-        Config::save($modulePath . '/generatorHash.php', $config);
229
+        $config = Config::custom($modulePath.'/generatorHash.php');
230
+        $config[$controllerType.'/'.$module.'Controller.php'] = md5($controllerCode);
231
+        Config::save($modulePath.'/generatorHash.php', $config);
232 232
     }
233 233
 
234 234
     public function addActionToController($module, $type, $controller, $url)
235 235
     {
236 236
         $modulePath = Module::getModulePath($module);
237
-        $path = Modules::getModulePath($module) . '/' . $type . '/' . $controller . '.php';
237
+        $path = Modules::getModulePath($module).'/'.$type.'/'.$controller.'.php';
238 238
         $class = CodeGenerator::parseClass($path);
239
-        $class->addMethod($url . 'Action');
240
-        $controllerCode = "<?php\n\n" . $class->generate();
239
+        $class->addMethod($url.'Action');
240
+        $controllerCode = "<?php\n\n".$class->generate();
241 241
         Tools::createDir(pathinfo($path, PATHINFO_DIRNAME));
242 242
         file_put_contents($path, $controllerCode);
243
-        $config = Config::custom($modulePath . '/generatorHash.php');
244
-        $config[$type . '/' . $module . 'Controller.php'] = md5($controllerCode);
245
-        Config::save($modulePath . '/generatorHash.php', $config);
243
+        $config = Config::custom($modulePath.'/generatorHash.php');
244
+        $config[$type.'/'.$module.'Controller.php'] = md5($controllerCode);
245
+        Config::save($modulePath.'/generatorHash.php', $config);
246 246
     }
247 247
 
248 248
 }
Please login to merge, or discard this patch.
system/modules/Modules/tpls/Model.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@
 block discarded – undo
5 5
 class <?= $codeName; ?> extends \Model {
6 6
 //modelParams<?php
7 7
 if (!empty($name)) {
8
-    echo "\n    static " . '$objectName = \'' . $name . "';";
8
+    echo "\n    static ".'$objectName = \''.$name."';";
9 9
 }
10 10
 if (!empty($labels)) {
11
-    echo "\n    static " . '$labels = [' . CodeGenerator::genArray($labels, 1) . "\n    ];";
11
+    echo "\n    static ".'$labels = ['.CodeGenerator::genArray($labels, 1)."\n    ];";
12 12
 }
13 13
 if (!empty($cols)) {
14
-    echo "\n    static " . '$cols = [' . CodeGenerator::genArray($cols, 1) . "\n    ];";
14
+    echo "\n    static ".'$cols = ['.CodeGenerator::genArray($cols, 1)."\n    ];";
15 15
 }
16 16
 ?>
17 17
 //!modelParams
Please login to merge, or discard this patch.
system/modules/Money/models/Reward.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     public function checkBlocked()
64 64
     {
65 65
         $blocked = Wallet\Block::getList(['where' => [
66
-                        ['data', 'reward:' . $this->id],
66
+                        ['data', 'reward:'.$this->id],
67 67
                         [
68 68
                             ['date_expired', '0000-00-00 00:00:00'],
69 69
                             ['date_expired', date('Y-m-d H:i:s'), '>', 'OR']
Please login to merge, or discard this patch.