Completed
Push — master ( 913952...f8c7e1 )
by Alexey
06:23
created
system/modules/Ecommerce/models/Delivery.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -13,65 +13,65 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Delivery extends \Model {
15 15
 
16
-  public static $objectName = 'Доставка';
17
-  public static $cols = [
18
-      //Основные параметры
19
-      'name' => ['type' => 'text'],
20
-      'price' => ['type' => 'decimal'],
21
-      'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'],
22
-      'price_text' => ['type' => 'textarea'],
23
-      'max_cart_price' => ['type' => 'decimal'],
24
-      'icon_file_id' => ['type' => 'image'],
25
-      'info' => ['type' => 'html'],
26
-      'disabled' => ['type' => 'bool'],
27
-      //Системные
28
-      'weight' => ['type' => 'number'],
29
-      'date_create' => ['type' => 'dateTime'],
30
-      //Менеджеры
31
-      'field' => ['type' => 'dataManager', 'relation' => 'fields'],
32
-      'priceChanger' => ['type' => 'dataManager', 'relation' => 'prices']
33
-  ];
34
-  public static $labels = [
35
-      'name' => 'Название',
36
-      'price' => 'Стоимость',
37
-      'price_text' => 'Текстовое описание стоимости (отображается вместо цены)',
38
-      'max_cart_price' => 'Басплатно при',
39
-      'icon_file_id' => 'Иконка',
40
-      'currency_id' => 'Валюта',
41
-      'info' => 'Дополнительная информация',
42
-      'priceChanger' => 'Градация стоимости',
43
-      'field' => 'Поля',
44
-      'disabled' => 'Отключено',
45
-  ];
46
-  public static $dataManagers = [
47
-      'manager' => [
48
-          'name' => 'Варианты доставки',
49
-          'cols' => [
50
-              'name',
51
-              'price',
52
-              'currency_id',
53
-              'max_cart_price',
54
-              'disabled',
55
-              'field',
56
-              'priceChanger',
57
-          ],
58
-          'sortMode' => true
59
-      ],
60
-  ];
61
-  public static $forms = [
62
-      'manager' => [
63
-          'map' => [
64
-              ['name', 'disabled'],
65
-              ['max_cart_price', 'icon_file_id'],
66
-              ['price', 'currency_id'],
67
-              ['price_text'],
68
-              ['info'],
69
-              ['priceChanger'],
70
-              ['field']
71
-          ]
72
-  ]];
16
+    public static $objectName = 'Доставка';
17
+    public static $cols = [
18
+        //Основные параметры
19
+        'name' => ['type' => 'text'],
20
+        'price' => ['type' => 'decimal'],
21
+        'currency_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'currency'],
22
+        'price_text' => ['type' => 'textarea'],
23
+        'max_cart_price' => ['type' => 'decimal'],
24
+        'icon_file_id' => ['type' => 'image'],
25
+        'info' => ['type' => 'html'],
26
+        'disabled' => ['type' => 'bool'],
27
+        //Системные
28
+        'weight' => ['type' => 'number'],
29
+        'date_create' => ['type' => 'dateTime'],
30
+        //Менеджеры
31
+        'field' => ['type' => 'dataManager', 'relation' => 'fields'],
32
+        'priceChanger' => ['type' => 'dataManager', 'relation' => 'prices']
33
+    ];
34
+    public static $labels = [
35
+        'name' => 'Название',
36
+        'price' => 'Стоимость',
37
+        'price_text' => 'Текстовое описание стоимости (отображается вместо цены)',
38
+        'max_cart_price' => 'Басплатно при',
39
+        'icon_file_id' => 'Иконка',
40
+        'currency_id' => 'Валюта',
41
+        'info' => 'Дополнительная информация',
42
+        'priceChanger' => 'Градация стоимости',
43
+        'field' => 'Поля',
44
+        'disabled' => 'Отключено',
45
+    ];
46
+    public static $dataManagers = [
47
+        'manager' => [
48
+            'name' => 'Варианты доставки',
49
+            'cols' => [
50
+                'name',
51
+                'price',
52
+                'currency_id',
53
+                'max_cart_price',
54
+                'disabled',
55
+                'field',
56
+                'priceChanger',
57
+            ],
58
+            'sortMode' => true
59
+        ],
60
+    ];
61
+    public static $forms = [
62
+        'manager' => [
63
+            'map' => [
64
+                ['name', 'disabled'],
65
+                ['max_cart_price', 'icon_file_id'],
66
+                ['price', 'currency_id'],
67
+                ['price_text'],
68
+                ['info'],
69
+                ['priceChanger'],
70
+                ['field']
71
+            ]
72
+    ]];
73 73
 
74
-  public static function relations() {
74
+    public static function relations() {
75 75
     return [
76 76
         'icon' => [
77 77
             'model' => 'Files\File',
@@ -92,6 +92,6 @@  discard block
 block discarded – undo
92 92
             'col' => 'delivery_id'
93 93
         ]
94 94
     ];
95
-  }
95
+    }
96 96
 
97 97
 }
Please login to merge, or discard this patch.
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/Migrations/objects/Walker.php 2 patches
Indentation   +50 added lines, -50 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,30 +76,30 @@  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 87
         if (!empty(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])) {
88
-          $where[] = ['id', implode(',', array_keys(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])), 'IN'];
88
+            $where[] = ['id', implode(',', array_keys(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model])), 'IN'];
89
+        }
89 90
         }
90
-      }
91
-      $modelName = $objectParser->object->model;
92
-      $objects = $modelName::getList(['where' => $where]);
93
-      foreach ($objects as $object) {
91
+        $modelName = $objectParser->object->model;
92
+        $objects = $modelName::getList(['where' => $where]);
93
+        foreach ($objects as $object) {
94 94
         $objectId = \App::$cur->migrations->findParse($object->id, $objectParser->object->model);
95 95
         if ($objectId) {
96
-          $objectId->delete();
97
-          unset(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model][$object->id]);
98
-          unset(\App::$cur->migrations->ids['parseIds'][$objectParser->object->model][$objectId->parse_id]);
96
+            $objectId->delete();
97
+            unset(\App::$cur->migrations->ids['objectIds'][$objectParser->object->model][$object->id]);
98
+            unset(\App::$cur->migrations->ids['parseIds'][$objectParser->object->model][$objectId->parse_id]);
99 99
         }
100 100
         $object->delete();
101
-      }
101
+        }
102
+    }
102 103
     }
103
-  }
104 104
 
105 105
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
           $walker->migration = $this->migration;
33 33
           $walker->map = $this->map;
34 34
           $walker->data = &$this->data[$path->item];
35
-          $walker->curPath = $this->curPath . $path->item . '/';
35
+          $walker->curPath = $this->curPath.$path->item.'/';
36 36
           $walker->mapPath = $path;
37 37
           $walker->mapPathParent = $this->mapPath;
38 38
           $walker->migtarionLog = $this->migtarionLog;
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 3 patches
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.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  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_';   // префикс названий таблиц
16
+  public $config = []; // настройки подключения выбраной базы
17
+  public $connect = FALSE; // ярлык соединения с MySQL
18
+  public $encoding = 'utf-8'; // установленная кодировка
19
+  public $db_name = 'test'; // выбраная в данный момент база
20
+  public $table_prefix = 'inji_'; // префикс названий таблиц
21 21
   public $pdo = NULL;
22 22
   public $lastQuery = '';
23 23
   public $last_error = '';
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     $this->table_prefix = '';
72 72
 
73 73
     $query->where('TABLE_SCHEMA', $old_db);
74
-    $query->where('TABLE_NAME', $old_prefix . $table_name);
74
+    $query->where('TABLE_NAME', $old_prefix.$table_name);
75 75
     $result = $query->select('COLUMNS');
76 76
     $this->db_name = $old_db;
77 77
     $this->table_prefix = $old_prefix;
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,14 +29,18 @@
 block discarded – undo
29 29
    */
30 30
   public function init($connect_options) {
31 31
     extract($connect_options);
32
-    if (isset($db_name))
33
-      $this->db_name = $db_name;
34
-    if (isset($encoding))
35
-      $this->encoding = $encoding;
36
-    if (isset($table_prefix))
37
-      $this->table_prefix = $table_prefix;
38
-    if (isset($noConnectAbort))
39
-      $this->noConnectAbort = $noConnectAbort;
32
+    if (isset($db_name)) {
33
+          $this->db_name = $db_name;
34
+    }
35
+    if (isset($encoding)) {
36
+          $this->encoding = $encoding;
37
+    }
38
+    if (isset($table_prefix)) {
39
+          $this->table_prefix = $table_prefix;
40
+    }
41
+    if (isset($noConnectAbort)) {
42
+          $this->noConnectAbort = $noConnectAbort;
43
+    }
40 44
 
41 45
     $dsn = "mysql:host=$host;port=$port;dbname=$db_name;charset=$encoding";
42 46
     $dt = new \DateTime();
Please login to merge, or discard this patch.