Completed
Push — master ( f8c7e1...7855c2 )
by Alexey
06:00
created
system/modules/Dashboard/appAdminControllers/DashboardController.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,38 +10,38 @@
 block discarded – undo
10 10
  */
11 11
 class DashboardController extends adminController {
12 12
 
13
-  public function indexAction() {
13
+    public function indexAction() {
14 14
     $sections = $this->module->getSnippets('adminDashboardWidget');
15 15
     $this->view->setTitle('Панель управления');
16 16
     $this->view->page(['data' => compact('sections')]);
17
-  }
17
+    }
18 18
 
19
-  public function siteConfigAction() {
19
+    public function siteConfigAction() {
20 20
     if (isset($_POST['site_name'])) {
21
-      $config = \App::$primary->config;
22
-      $config['site']['name'] = $_POST['site_name'];
23
-      $config['site']['company_name'] = $_POST['company_name'];
24
-      $config['site']['email'] = $_POST['site_email'];
25
-      $config['site']['keywords'] = $_POST['site_keywords'];
26
-      $config['site']['description'] = $_POST['site_description'];
27
-      $config['site']['domain'] = $_POST['site_domain'];
28
-      if (isset($_POST['metatags'])) {
21
+        $config = \App::$primary->config;
22
+        $config['site']['name'] = $_POST['site_name'];
23
+        $config['site']['company_name'] = $_POST['company_name'];
24
+        $config['site']['email'] = $_POST['site_email'];
25
+        $config['site']['keywords'] = $_POST['site_keywords'];
26
+        $config['site']['description'] = $_POST['site_description'];
27
+        $config['site']['domain'] = $_POST['site_domain'];
28
+        if (isset($_POST['metatags'])) {
29 29
         $config['site']['metatags'] = $_POST['metatags'];
30
-      }
31
-      if (!empty($_FILES['site_logo']['tmp_name'])) {
30
+        }
31
+        if (!empty($_FILES['site_logo']['tmp_name'])) {
32 32
         $fileId = $this->Files->upload($_FILES['site_logo'], array('file_code' => 'site_logo'));
33 33
         $config['site']['site_logo'] = Files\File::get($fileId)->path;
34
-      }
35
-      Config::save('app', $config);
36
-      Tools::redirect('/admin/dashboard/siteConfig', 'Изменения сохранены', 'success');
34
+        }
35
+        Config::save('app', $config);
36
+        Tools::redirect('/admin/dashboard/siteConfig', 'Изменения сохранены', 'success');
37 37
     }
38 38
 
39 39
     $this->view->setTitle('Общие настройки сайта');
40 40
     $this->view->page();
41
-  }
41
+    }
42 42
 
43
-  public function phpInfoAction() {
43
+    public function phpInfoAction() {
44 44
     $this->view->page();
45
-  }
45
+    }
46 46
 
47 47
 }
Please login to merge, or discard this patch.
system/modules/Exchange1c/objects/Parser/Item/Options.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -13,75 +13,75 @@
 block discarded – undo
13 13
 
14 14
 class Options extends \Migrations\Parser {
15 15
 
16
-  static $options;
16
+    static $options;
17 17
 
18
-  public function parse() {
18
+    public function parse() {
19 19
     if (!Options::$options) {
20
-      Options::$options = \Ecommerce\Item\Option::getList();
20
+        Options::$options = \Ecommerce\Item\Option::getList();
21 21
     }
22 22
     $options = [];
23 23
     $modelName = 'Ecommerce\Item\Option';
24 24
     foreach ($this->data['ЗначенияСвойства'] as $opt) {
25
-      $optionId = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option'][$opt['Ид']]->object_id;
26
-      if ($optionId && !isset(Options::$options[$optionId])) {
25
+        $optionId = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option'][$opt['Ид']]->object_id;
26
+        if ($optionId && !isset(Options::$options[$optionId])) {
27 27
         Options::$options = \Ecommerce\Item\Option::getList();
28
-      }
29
-      if (isset(Options::$options[$optionId]) && Options::$options[$optionId]->type == 'select') {
28
+        }
29
+        if (isset(Options::$options[$optionId]) && Options::$options[$optionId]->type == 'select') {
30 30
         if (empty($options[$optionId])) {
31
-          $options[$optionId] = [];
31
+            $options[$optionId] = [];
32 32
         } else {
33
-          if (!Options::$options[$optionId]->advance) {
33
+            if (!Options::$options[$optionId]->advance) {
34 34
             Options::$options[$optionId]->advance = ['multi' => true];
35 35
             Options::$options[$optionId]->save();
36
-          }
36
+            }
37 37
         }
38 38
         if ($opt['Значение'] && isset(\App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option\Item'][$opt['Значение']])) {
39
-          $options[$optionId][] = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option\Item'][$opt['Значение']]->object_id;
39
+            $options[$optionId][] = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option\Item'][$opt['Значение']]->object_id;
40 40
         }
41
-      } else {
41
+        } else {
42 42
         $options[$optionId] = $opt['Значение'];
43
-      }
43
+        }
44 44
     }
45 45
     $itemParams = \Ecommerce\Item\Param::getList(['where' => ['item_id', $this->model->id]]);
46 46
     foreach ($itemParams as $itemParam) {
47
-      if ($itemParam->item_option_id && !isset(Options::$options[$itemParam->item_option_id])) {
47
+        if ($itemParam->item_option_id && !isset(Options::$options[$itemParam->item_option_id])) {
48 48
         Options::$options = \Ecommerce\Item\Option::getList();
49
-      }
50
-      if (isset(Options::$options[$itemParam->item_option_id]) && Options::$options[$itemParam->item_option_id]->type == 'select') {
49
+        }
50
+        if (isset(Options::$options[$itemParam->item_option_id]) && Options::$options[$itemParam->item_option_id]->type == 'select') {
51 51
         if (empty($options[$itemParam->item_option_id]) || !in_array($itemParam->value, $options[$itemParam->item_option_id])) {
52
-          $itemParam->delete();
52
+            $itemParam->delete();
53 53
         } else {
54
-          unset($options[$itemParam->item_option_id][array_search($itemParam->value, $options[$itemParam->item_option_id])]);
54
+            unset($options[$itemParam->item_option_id][array_search($itemParam->value, $options[$itemParam->item_option_id])]);
55 55
         }
56
-      } else {
56
+        } else {
57 57
         if (empty($options[$itemParam->item_option_id])) {
58
-          $itemParam->delete();
58
+            $itemParam->delete();
59 59
         } else {
60
-          $itemParam->value = $options[$itemParam->item_option_id];
61
-          $itemParam->save();
62
-          unset($options[$itemParam->item_option_id]);
60
+            $itemParam->value = $options[$itemParam->item_option_id];
61
+            $itemParam->save();
62
+            unset($options[$itemParam->item_option_id]);
63
+        }
63 64
         }
64
-      }
65 65
     }
66 66
     foreach ($options as $optionId => $values) {
67
-      if (is_array($values)) {
67
+        if (is_array($values)) {
68 68
         foreach ($values as $value) {
69
-          $itemParam = new \Ecommerce\Item\Param([
70
-              'item_option_id' => $optionId,
71
-              'item_id' => $this->model->id,
72
-              'value' => $value
73
-          ]);
74
-          $itemParam->save();
69
+            $itemParam = new \Ecommerce\Item\Param([
70
+                'item_option_id' => $optionId,
71
+                'item_id' => $this->model->id,
72
+                'value' => $value
73
+            ]);
74
+            $itemParam->save();
75 75
         }
76
-      } else {
76
+        } else {
77 77
         $itemParam = new \Ecommerce\Item\Param([
78 78
             'item_option_id' => $optionId,
79 79
             'item_id' => $this->model->id,
80 80
             'value' => $values
81 81
         ]);
82 82
         $itemParam->save();
83
-      }
83
+        }
84
+    }
84 85
     }
85
-  }
86 86
 
87 87
 }
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Mysql.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Mysql extends \Object {
15 15
 
16
-  public $config = [];       // настройки подключения выбраной базы
17
-  public $connect = FALSE;        // ярлык соединения с MySQL
18
-  public $encoding = 'utf-8';        // установленная кодировка
19
-  public $db_name = 'test';         // выбраная в данный момент база
20
-  public $table_prefix = 'inji_';   // префикс названий таблиц
21
-  public $pdo = NULL;
22
-  public $lastQuery = '';
23
-  public $last_error = '';
24
-  public $noConnectAbort = false;
25
-  public $dbInstance = null;
16
+    public $config = [];       // настройки подключения выбраной базы
17
+    public $connect = FALSE;        // ярлык соединения с MySQL
18
+    public $encoding = 'utf-8';        // установленная кодировка
19
+    public $db_name = 'test';         // выбраная в данный момент база
20
+    public $table_prefix = 'inji_';   // префикс названий таблиц
21
+    public $pdo = NULL;
22
+    public $lastQuery = '';
23
+    public $last_error = '';
24
+    public $noConnectAbort = false;
25
+    public $dbInstance = null;
26 26
 
27
-  /**
28
-   * Подключение к MySQL
29
-   */
30
-  public function init($connect_options) {
27
+    /**
28
+     * Подключение к MySQL
29
+     */
30
+    public function init($connect_options) {
31 31
     extract($connect_options);
32 32
     if (isset($db_name))
33
-      $this->db_name = $db_name;
33
+        $this->db_name = $db_name;
34 34
     if (isset($encoding))
35
-      $this->encoding = $encoding;
35
+        $this->encoding = $encoding;
36 36
     if (isset($table_prefix))
37
-      $this->table_prefix = $table_prefix;
37
+        $this->table_prefix = $table_prefix;
38 38
     if (isset($noConnectAbort))
39
-      $this->noConnectAbort = $noConnectAbort;
39
+        $this->noConnectAbort = $noConnectAbort;
40 40
 
41 41
     $dsn = "mysql:host=$host;port=$port;dbname=$db_name;charset=$encoding";
42 42
     $dt = new \DateTime();
@@ -50,20 +50,20 @@  discard block
 block discarded – undo
50 50
     $this->pdo = new \PDO($dsn, $user, $pass, $opt);
51 51
     $error = $this->pdo->errorInfo();
52 52
     if ((int) $error[0]) {
53
-      if ($this->noConnectAbort) {
53
+        if ($this->noConnectAbort) {
54 54
         return false;
55
-      } else {
55
+        } else {
56 56
         INJI_SYSTEM_ERROR($error[2], true);
57
-      }
57
+        }
58 58
     } else {
59
-      $this->connect = true;
60
-      $query = new Mysql\Query($this);
61
-      $query->query("SET SQL_BIG_SELECTS=1");
62
-      return true;
59
+        $this->connect = true;
60
+        $query = new Mysql\Query($this);
61
+        $query->query("SET SQL_BIG_SELECTS=1");
62
+        return true;
63
+    }
63 64
     }
64
-  }
65 65
 
66
-  public function getTableCols($table_name) {
66
+    public function getTableCols($table_name) {
67 67
     $query = new Mysql\Query($this);
68 68
     $old_db = $this->db_name;
69 69
     $old_prefix = $this->table_prefix;
@@ -76,35 +76,35 @@  discard block
 block discarded – undo
76 76
     $this->db_name = $old_db;
77 77
     $this->table_prefix = $old_prefix;
78 78
     return $result->getArray('COLUMN_NAME');
79
-  }
79
+    }
80 80
 
81
-  public function tableExist($tableName) {
81
+    public function tableExist($tableName) {
82 82
     $query = new Mysql\Query($this);
83 83
     return (bool) $query->query("SHOW TABLES FROM `{$this->db_name}` LIKE '{$this->table_prefix}{$tableName}'")->getArray();
84
-  }
84
+    }
85 85
 
86
-  public function addCol($table = false, $name = false, $param = 'TEXT NOT NULL') {
86
+    public function addCol($table = false, $name = false, $param = 'TEXT NOT NULL') {
87 87
     if (!$table || !$name) {
88
-      return false;
88
+        return false;
89 89
     }
90 90
     if ($param == 'pk') {
91
-      $param = "int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`{$name}`)";
91
+        $param = "int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`{$name}`)";
92 92
     }
93 93
     $query = new Mysql\Query($this);
94 94
     return $query->query("ALTER TABLE `{$this->db_name}`.`{$this->table_prefix}{$table}` ADD `{$name}` {$param}");
95
-  }
95
+    }
96 96
 
97
-  public function delCol($table = false, $name = false) {
97
+    public function delCol($table = false, $name = false) {
98 98
     if (!$table || !$name) {
99
-      return false;
99
+        return false;
100 100
     }
101 101
     $query = new Mysql\Query($this);
102 102
     return $query->query("ALTER TABLE `{$this->db_name}`.`{$this->table_prefix}{$table}` DROP `{$name}`");
103
-  }
103
+    }
104 104
 
105
-  public function getTables() {
105
+    public function getTables() {
106 106
     $query = new Mysql\Query($this);
107 107
     return $query->query("SHOW TABLES")->getArray();
108
-  }
108
+    }
109 109
 
110 110
 }
Please login to merge, or discard this patch.
system/modules/Migrations/Migrations.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class Migrations extends \Module {
14 14
 
15
-  public $ids = [];
16
-  public $migrationObjects = [];
15
+    public $ids = [];
16
+    public $migrationObjects = [];
17 17
 
18
-  public function startMigration($migrationId, $mapId, $filePath) {
18
+    public function startMigration($migrationId, $mapId, $filePath) {
19 19
     $log = new \Migrations\Log();
20 20
     $log->migration_id = $migrationId;
21 21
     $log->migration_map_id = $mapId;
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 
25 25
     $reader = new Migrations\Reader\Xml();
26 26
     if (!$reader->loadData($filePath)) {
27
-      $event = new Migrations\Log\Event();
28
-      $event->log_id = $log->id;
29
-      $event->type = 'load_data_error';
30
-      $event->save();
31
-      return false;
27
+        $event = new Migrations\Log\Event();
28
+        $event->log_id = $log->id;
29
+        $event->type = 'load_data_error';
30
+        $event->save();
31
+        return false;
32 32
     }
33 33
     $walker = new \Migrations\Walker();
34 34
     $walker->migration = Migrations\Migration::get($migrationId);
@@ -38,43 +38,43 @@  discard block
 block discarded – undo
38 38
     $walker->walk();
39 39
     $log->result = 'success';
40 40
     $log->save();
41
-  }
41
+    }
42 42
 
43
-  public function loadParseIds($type) {
43
+    public function loadParseIds($type) {
44 44
     $this->ids['parseIds'][$type] = \Migrations\Id::getList(['where' => ['type', $type], 'key' => 'parse_id']);
45
-  }
45
+    }
46 46
 
47
-  public function loadObjectIds($type) {
47
+    public function loadObjectIds($type) {
48 48
     $this->ids['objectIds'][$type] = \Migrations\Id::getList(['where' => ['type', $type], 'key' => 'object_id']);
49
-  }
49
+    }
50 50
 
51
-  public function findObject($parseId, $type) {
51
+    public function findObject($parseId, $type) {
52 52
     if (empty($this->ids['parseIds'][$type])) {
53
-      $this->loadParseIds($type);
54
-      ksort($this->ids['parseIds'][$type]);
53
+        $this->loadParseIds($type);
54
+        ksort($this->ids['parseIds'][$type]);
55 55
     }
56 56
     if (!empty($this->ids['parseIds'][$type][$parseId])) {
57
-      return $this->ids['parseIds'][$type][$parseId];
57
+        return $this->ids['parseIds'][$type][$parseId];
58
+    }
58 59
     }
59
-  }
60 60
 
61
-  public function findParse($objectId, $type) {
61
+    public function findParse($objectId, $type) {
62 62
     if (empty($this->ids['objectIds'][$type])) {
63
-      $this->loadObjectIds($type);
64
-      ksort($this->ids['objectIds'][$type]);
63
+        $this->loadObjectIds($type);
64
+        ksort($this->ids['objectIds'][$type]);
65 65
     }
66 66
     if (!empty($this->ids['objectIds'][$type][$objectId])) {
67
-      return $this->ids['objectIds'][$type][$objectId];
67
+        return $this->ids['objectIds'][$type][$objectId];
68
+    }
68 69
     }
69
-  }
70 70
 
71
-  public function getMigrationObject($objectId) {
71
+    public function getMigrationObject($objectId) {
72 72
     if (empty($this->migrationObjects)) {
73
-      $this->migrationObjects = \Migrations\Migration\Object::getList();
73
+        $this->migrationObjects = \Migrations\Migration\Object::getList();
74 74
     }
75 75
     if (!empty($this->migrationObjects[$objectId])) {
76
-      return $this->migrationObjects[$objectId];
76
+        return $this->migrationObjects[$objectId];
77
+    }
77 78
     }
78
-  }
79 79
 
80 80
 }
Please login to merge, or discard this patch.
system/modules/Migrations/objects/Walker.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -13,61 +13,61 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Walker {
15 15
 
16
-  public $migration = null;
17
-  public $map = null;
18
-  public $data = null;
19
-  public $mapPath = null;
20
-  public $mapPathParent = null;
21
-  public $curPath = '/';
22
-  public $migtarionLog = null;
16
+    public $migration = null;
17
+    public $map = null;
18
+    public $data = null;
19
+    public $mapPath = null;
20
+    public $mapPathParent = null;
21
+    public $curPath = '/';
22
+    public $migtarionLog = null;
23 23
 
24
-  //walk map pathes on cur path
25
-  public function walk() {
24
+    //walk map pathes on cur path
25
+    public function walk() {
26 26
     $walked = [];
27 27
     //walk know pathes
28 28
     foreach ($this->map->paths(['where' => ['path', $this->curPath]]) as $path) {
29
-      if (isset($this->data[$path->item])) {
29
+        if (isset($this->data[$path->item])) {
30 30
         if ($path->type == 'container') { //create walker for container
31
-          $walker = new Walker();
32
-          $walker->migration = $this->migration;
33
-          $walker->map = $this->map;
34
-          $walker->data = &$this->data[$path->item];
35
-          $walker->curPath = $this->curPath . $path->item . '/';
36
-          $walker->mapPath = $path;
37
-          $walker->mapPathParent = $this->mapPath;
38
-          $walker->migtarionLog = $this->migtarionLog;
39
-          $walker->walk();
31
+            $walker = new Walker();
32
+            $walker->migration = $this->migration;
33
+            $walker->map = $this->map;
34
+            $walker->data = &$this->data[$path->item];
35
+            $walker->curPath = $this->curPath . $path->item . '/';
36
+            $walker->mapPath = $path;
37
+            $walker->mapPathParent = $this->mapPath;
38
+            $walker->migtarionLog = $this->migtarionLog;
39
+            $walker->walk();
40 40
         } elseif ($path->type == 'object') { //start parse path data
41
-          $this->startObjectParse($path->object_id, $this->data[$path->item]);
41
+            $this->startObjectParse($path->object_id, $this->data[$path->item]);
42 42
         }
43
-      }
44
-      $walked[$path->item] = true;
43
+        }
44
+        $walked[$path->item] = true;
45 45
     }
46 46
     //check unparsed paths
47 47
     foreach ($this->data as $key => &$data) {
48
-      //skip parsed and attribtes
49
-      if ($key == '@attributes' || !empty($walked[$key])) {
48
+        //skip parsed and attribtes
49
+        if ($key == '@attributes' || !empty($walked[$key])) {
50 50
         continue;
51
-      }
52
-      //search object for parse
53
-      $object = Migration\Object::get([
54
-                  ['code', $key],
55
-                  ['migration_id', $this->migration->id]
56
-      ]);
57
-      if ($object) { //parse as object
51
+        }
52
+        //search object for parse
53
+        $object = Migration\Object::get([
54
+                    ['code', $key],
55
+                    ['migration_id', $this->migration->id]
56
+        ]);
57
+        if ($object) { //parse as object
58 58
         $this->startObjectParse($object, $data);
59
-      } else { //create new map path for configure unknown path
59
+        } else { //create new map path for configure unknown path
60 60
         $this->mapPath = new Migration\Map\Path();
61 61
         $this->mapPath->parent_id = $this->mapPathParent ? $this->mapPathParent->id : 0;
62 62
         $this->mapPath->path = $this->curPath;
63 63
         $this->mapPath->item = $key;
64 64
         $this->mapPath->migration_map_id = $this->map->id;
65 65
         $this->mapPath->save();
66
-      }
66
+        }
67
+    }
67 68
     }
68
-  }
69 69
 
70
-  private function startObjectParse($object_id, &$data) {
70
+    private function startObjectParse($object_id, &$data) {
71 71
     $objectParser = new Parser\Object();
72 72
     $objectParser->object = is_object($object_id) ? $object_id : \App::$cur->migrations->getMigrationObject($object_id);
73 73
     $objectParser->data = $data;
@@ -76,33 +76,33 @@  discard block
 block discarded – undo
76 76
 
77 77
     if ($objectParser->object->clear && json_decode($objectParser->object->clear, true)) {
78 78
 
79
-      $where = json_decode($objectParser->object->clear, true);
80
-      if (!$where) {
79
+        $where = json_decode($objectParser->object->clear, true);
80
+        if (!$where) {
81 81
         $where = [];
82
-      } else {
82
+        } else {
83 83
         $where = [[$where]];
84
-      }
85
-      if ($ids) {
84
+        }
85
+        if ($ids) {
86 86
         $where[] = ['id', implode(',', $ids), 'NOT IN'];
87
-      }
88
-      if (empty(\App::$cur->migrations->ids['objectIds'])) {
87
+        }
88
+        if (empty(\App::$cur->migrations->ids['objectIds'])) {
89 89
         \App::$cur->migrations->loadObjectIds($objectParser->object->model);
90
-      }
91
-      if (!empty(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])) {
90
+        }
91
+        if (!empty(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])) {
92 92
         $where[] = ['id', implode(',', array_keys(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])), 'IN'];
93
-      }
94
-      $modelName = $objectParser->object->model;
95
-      $objects = $modelName::getList(['where' => $where]);
96
-      foreach ($objects as $object) {
93
+        }
94
+        $modelName = $objectParser->object->model;
95
+        $objects = $modelName::getList(['where' => $where]);
96
+        foreach ($objects as $object) {
97 97
         $objectId = \App::$cur->migrations->findParse($object->id, $objectParser->object->model);
98 98
         if ($objectId) {
99
-          $objectId->delete();
100
-          unset(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model][$object->id]);
101
-          unset(\App::$cur->migrations->ids['parseIds'][$objectParser->object->model][$objectId->parse_id]);
99
+            $objectId->delete();
100
+            unset(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model][$object->id]);
101
+            unset(\App::$cur->migrations->ids['parseIds'][$objectParser->object->model][$objectId->parse_id]);
102 102
         }
103 103
         $object->delete();
104
-      }
104
+        }
105
+    }
105 106
     }
106
-  }
107 107
 
108 108
 }
Please login to merge, or discard this patch.