Completed
Push — master ( 97b00d...004fa5 )
by Alexey
07:14
created
system/Inji/ComposerCmd.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -58,6 +58,10 @@
 block discarded – undo
58 58
         self::command('install', false, $path);
59 59
     }
60 60
 
61
+    /**
62
+     * @param string $command
63
+     * @param string $path
64
+     */
61 65
     static function command($command, $needOutput = true, $path = null)
62 66
     {
63 67
         include_once 'composer/vendor/autoload.php';
Please login to merge, or discard this patch.
system/Inji/Tools.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -216,6 +216,7 @@
 block discarded – undo
216 216
      * @param  $number Integer Число на основе которого нужно сформировать окончание
217 217
      * @param  $endingsArray  Array Массив слов или окончаний для чисел (1, 4, 5),
218 218
      *         например array('яблоко', 'яблока', 'яблок')
219
+     * @param string[] $endingArray
219 220
      * @return String
220 221
      */
221 222
     static function getNumEnding($number, $endingArray)
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     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 != '') {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     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 {
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,8 +58,9 @@  discard block
 block discarded – undo
58 58
      */
59 59
     static function createDir($path)
60 60
     {
61
-        if (file_exists($path))
62
-            return true;
61
+        if (file_exists($path)) {
62
+                    return true;
63
+        }
63 64
 
64 65
         $path = explode('/', $path);
65 66
         $cur = '';
@@ -101,10 +102,11 @@  discard block
 block discarded – undo
101 102
         $imagecreatefromX = "imagecreatefrom{$img_type}";
102 103
         $src_res = $imagecreatefromX($img_path);
103 104
 
104
-        if ($img_width / $max_width > $img_height / $max_height)
105
-            $separator = $img_width / $max_width;
106
-        else
107
-            $separator = $img_height / $max_height;
105
+        if ($img_width / $max_width > $img_height / $max_height) {
106
+                    $separator = $img_width / $max_width;
107
+        } else {
108
+                    $separator = $img_height / $max_height;
109
+        }
108 110
 
109 111
         if ($crop === true || $crop == 'q') {
110 112
             if ($img_width > $img_height) {
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Query.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -29,6 +29,9 @@  discard block
 block discarded – undo
29 29
     public $params = [];
30 30
     public $distinct = false;
31 31
 
32
+    /**
33
+     * @param  $instance
34
+     */
32 35
     function __construct($instance = null)
33 36
     {
34 37
         if (!$instance) {
@@ -47,6 +50,9 @@  discard block
 block discarded – undo
47 50
         return $this->curInstance->pdo->lastInsertId();
48 51
     }
49 52
 
53
+    /**
54
+     * @param string $table
55
+     */
50 56
     public function select($table)
51 57
     {
52 58
         $this->operation = 'SELECT';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -288,7 +288,7 @@
 block discarded – undo
288 288
                     }
289 289
                 }
290 290
                 $update = implode(',', $updates);
291
-                $query .=" SET {$update}";
291
+                $query .= " SET {$update}";
292 292
             case 'SELECT':
293 293
             case 'DELETE':
294 294
                 $this->buildWhere($this->where);
Please login to merge, or discard this patch.
Braces   +59 added lines, -46 removed lines patch added patch discarded remove patch
@@ -126,12 +126,14 @@  discard block
 block discarded – undo
126 126
         if (!is_array($order)) {
127 127
             $this->order[] = "{$order} {$type}";
128 128
         } else {
129
-            foreach ($order as $item)
130
-                if (!is_array($item)) {
129
+            foreach ($order as $item) {
130
+                            if (!is_array($item)) {
131 131
                     call_user_func_array(array($this, 'order'), $order);
132
+            }
132 133
                     break;
133
-                } else
134
-                    $this->order($item);
134
+                } else {
135
+                                    $this->order($item);
136
+                }
135 137
         }
136 138
     }
137 139
 
@@ -140,8 +142,9 @@  discard block
 block discarded – undo
140 142
         $start = intval($start);
141 143
         $len = intval($len);
142 144
         $this->limit = "LIMIT {$start}";
143
-        if ($len !== 0)
144
-            $this->limit .= ",{$len}";
145
+        if ($len !== 0) {
146
+                    $this->limit .= ",{$len}";
147
+        }
145 148
     }
146 149
 
147 150
     function buildJoin($table, $where = false, $type = 'LEFT', $alias = '')
@@ -154,10 +157,12 @@  discard block
 block discarded – undo
154 157
             }
155 158
         } else {
156 159
             $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}";
157
-            if ($alias)
158
-                $join .= " AS `{$alias}`";
159
-            if ($where)
160
-                $join .= " ON {$where}";
160
+            if ($alias) {
161
+                            $join .= " AS `{$alias}`";
162
+            }
163
+            if ($where) {
164
+                            $join .= " ON {$where}";
165
+            }
161 166
         }
162 167
         return $join;
163 168
     }
@@ -166,69 +171,77 @@  discard block
 block discarded – undo
166 171
     {
167 172
         $params = [];
168 173
         if (!is_array($where)) {
169
-            if (!$operation)
170
-                $operation = '=';
174
+            if (!$operation) {
175
+                            $operation = '=';
176
+            }
171 177
 
172
-            if ($concatenation === false)
173
-                $concatenation = 'AND';
174
-            elseif ($concatenation === true)
175
-                $concatenation = '';
178
+            if ($concatenation === false) {
179
+                            $concatenation = 'AND';
180
+            } elseif ($concatenation === true) {
181
+                            $concatenation = '';
182
+            }
176 183
 
177
-            if ($this->whereString == NULL)
178
-                $this->whereString = ' WHERE ';
184
+            if ($this->whereString == NULL) {
185
+                            $this->whereString = ' WHERE ';
186
+            }
179 187
 
180 188
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
181
-                if (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value))
182
-                    $value = "({$value})";
183
-                elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value))
184
-                    $value = "\"{$value}\"";
185
-            }
186
-            elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
189
+                if (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
190
+                                    $value = "({$value})";
191
+                } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
192
+                                    $value = "\"{$value}\"";
193
+                }
194
+            } elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
187 195
                 $this->params[] = $value;
188 196
                 $value = "?";
189 197
             }
190 198
 
191
-            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ')
192
-                $this->whereString .= " {$where} {$operation} {$value} ";
193
-            else
194
-                $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
195
-        }
196
-        else {
199
+            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') {
200
+                            $this->whereString .= " {$where} {$operation} {$value} ";
201
+            } else {
202
+                            $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
203
+            }
204
+        } else {
197 205
             $i = -1;
198 206
             while (isset($where[++$i])) {
199 207
                 $item = $where[$i];
200 208
                 if (isset($where[$i + 1]) && !isset($where[$i - 1]) && is_array($where[$i])) {
201 209
                     if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(' && $this->whereString != 'WHERE ') {
202
-                        if (!isset($item[3]))
203
-                            $concatenation = 'AND';
204
-                        else
205
-                            $concatenation = $item[3];
210
+                        if (!isset($item[3])) {
211
+                                                    $concatenation = 'AND';
212
+                        } else {
213
+                                                    $concatenation = $item[3];
214
+                        }
206 215
 
207 216
                         $this->whereString .= "{$concatenation} ";
208 217
                     }
209 218
 
210
-                    if ($this->whereString != NULL)
211
-                        $this->whereString .= '(';
212
-                    else
213
-                        $this->whereString = 'WHERE (';
219
+                    if ($this->whereString != NULL) {
220
+                                            $this->whereString .= '(';
221
+                    } else {
222
+                                            $this->whereString = 'WHERE (';
223
+                    }
214 224
                 }
215 225
 
216 226
                 if (!is_array($item)) {
217 227
                     call_user_func_array(array($this, 'buildWhere'), $where);
218 228
                     break;
219 229
                 } else {
220
-                    if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(')
221
-                        if (!isset($item[3]))
230
+                    if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(') {
231
+                                            if (!isset($item[3]))
222 232
                             $concatenation = 'AND';
223
-                        else
224
-                            $concatenation = $item[3];
225
-                    elseif (substr($this->whereString, -1, 1) != '(')
226
-                        $this->whereString = 'WHERE ';
233
+                    } else {
234
+                                                    $concatenation = $item[3];
235
+                        }
236
+                    elseif (substr($this->whereString, -1, 1) != '(') {
237
+                                            $this->whereString = 'WHERE ';
238
+                    }
227 239
 
228 240
                     $this->buildWhere($item);
229 241
                 }
230
-                if (!isset($where[$i + 1]) && isset($where[$i - 1]))
231
-                    $this->whereString .= ') ';
242
+                if (!isset($where[$i + 1]) && isset($where[$i - 1])) {
243
+                                    $this->whereString .= ') ';
244
+                }
232 245
             }
233 246
         }
234 247
     }
Please login to merge, or discard this patch.
system/modules/Modules/Modules.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -45,6 +45,10 @@
 block discarded – undo
45 45
         return $modelCols;
46 46
     }
47 47
 
48
+    /**
49
+     * @param string $colPrefix
50
+     * @param string $tableName
51
+     */
48 52
     function parseColsForTable($cols, $colPrefix, $tableName)
49 53
     {
50 54
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     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'];
Please login to merge, or discard this patch.
system/modules/Ui/objects/ActiveForm.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@
 block discarded – undo
280 280
     /**
281 281
      * Draw error message
282 282
      * 
283
-     * @param text $errorText
283
+     * @param string $errorText
284 284
      */
285 285
     function drawError($errorText)
286 286
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
                             $this->model->_params[$modelName::index()] = 0;
74 74
                         }
75 75
                         $relOptions['model']::fixPrefix($relOptions['col']);
76
-                        $inputs[$col] = new ActiveForm(new $relOptions['model']([ $relOptions['col'] => &$this->model->_params[$modelName::index()]]), $colPath[2]);
76
+                        $inputs[$col] = new ActiveForm(new $relOptions['model']([$relOptions['col'] => &$this->model->_params[$modelName::index()]]), $colPath[2]);
77 77
                     }
78 78
                     $inputs[$col]->parent = $this;
79 79
                 } elseif (!empty($modelName::$cols[$col])) {
Please login to merge, or discard this patch.
system/modules/Ui/objects/DataManager.php 4 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -319,6 +319,9 @@  discard block
 block discarded – undo
319 319
         return $rows;
320 320
     }
321 321
 
322
+    /**
323
+     * @param DataManager $dataManager
324
+     */
322 325
     static function drawCol($item, $colName, $params = [], $dataManager = null, $originalCol = '', $originalItem = null)
323 326
     {
324 327
         $modelName = get_class($item);
@@ -668,7 +671,7 @@  discard block
 block discarded – undo
668 671
     /**
669 672
      * Draw error message
670 673
      * 
671
-     * @param text $errorText
674
+     * @param string $errorText
672 675
      */
673 676
     function drawError($errorText)
674 677
     {
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -608,22 +608,22 @@
 block discarded – undo
608 608
         ?>
609 609
         <ul class="nav nav-list-categorys" data-col='tree_path'>
610 610
           <?php
611
-          $categoryModel = $this->managerOptions['categorys']['model'];
612
-          $order = [];
613
-          if (!empty($this->managerOptions['sortMode'])) {
614
-              $order[] = ['weight', 'asc'];
615
-          }
616
-          $categorys = $categoryModel::getList(['order' => $order]);
617
-          echo "<li>
611
+            $categoryModel = $this->managerOptions['categorys']['model'];
612
+            $order = [];
613
+            if (!empty($this->managerOptions['sortMode'])) {
614
+                $order[] = ['weight', 'asc'];
615
+            }
616
+            $categorys = $categoryModel::getList(['order' => $order]);
617
+            echo "<li>
618 618
                         <label class='nav-header'>
619 619
                             <a href='#' onclick='inji.Ui.dataManagers.get(this).switchCategory(this);return false;' data-path ='/'>/</a> 
620 620
                         </label>
621 621
                     </li>";
622
-          foreach ($categorys as $category) {
623
-              if ($category->parent_id == 0)
624
-                  $this->showCategory($categorys, $category);
625
-          }
626
-          ?>
622
+            foreach ($categorys as $category) {
623
+                if ($category->parent_id == 0)
624
+                    $this->showCategory($categorys, $category);
625
+            }
626
+            ?>
627 627
         </ul>
628 628
         <?php
629 629
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -397,7 +397,7 @@
 block discarded – undo
397 397
                         return $item->$colName;
398 398
                 }
399 399
             } elseif (!empty($modelName::$cols[$colName]['type'])) {
400
-                if (\App::$cur->name == 'admin' && $originalCol == 'name' || ( $dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) {
400
+                if (\App::$cur->name == 'admin' && $originalCol == 'name' || ($dataManager && !empty($dataManager->managerOptions['colToView']) && $dataManager->managerOptions['colToView'] == $originalCol)) {
401 401
                     $formName = $dataManager && !empty($dataManager->managerOptions['editForm']) ? $dataManager->managerOptions['editForm'] : 'manager';
402 402
                     $redirectUrl = !empty($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/admin/' . str_replace('\\', '/', get_class($originalItem));
403 403
                     return "<a href ='/admin/" . str_replace('\\', '/view/', get_class($originalItem)) . "/{$originalItem->id}?formName={$formName}&redirectUrl={$redirectUrl}'>{$item->$colName}</a>";
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -620,8 +620,9 @@
 block discarded – undo
620 620
                         </label>
621 621
                     </li>";
622 622
           foreach ($categorys as $category) {
623
-              if ($category->parent_id == 0)
624
-                  $this->showCategory($categorys, $category);
623
+              if ($category->parent_id == 0) {
624
+                                $this->showCategory($categorys, $category);
625
+              }
625 626
           }
626 627
           ?>
627 628
         </ul>
Please login to merge, or discard this patch.
system/modules/Ui/objects/Form.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -45,6 +45,10 @@
 block discarded – undo
45 45
         \App::$cur->view->widget('Ui\\' . $this->options['widgetsDir'] . '/begin', $params);
46 46
     }
47 47
 
48
+    /**
49
+     * @param string $type
50
+     * @param string $name
51
+     */
48 52
     function input($type, $name, $label = '', $options = [])
49 53
     {
50 54
         switch ($type) {
Please login to merge, or discard this patch.
system/modules/Ui/objects/Table.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -23,6 +23,9 @@
 block discarded – undo
23 23
     public $attributes = [];
24 24
     public $indexCol = null;
25 25
 
26
+    /**
27
+     * @param string[] $cols
28
+     */
26 29
     function setCols($cols)
27 30
     {
28 31
         $this->cols = $cols;
Please login to merge, or discard this patch.
system/modules/Users/Users.php 3 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -92,6 +92,9 @@  discard block
 block discarded – undo
92 92
         }
93 93
     }
94 94
 
95
+    /**
96
+     * @param string $user_mail
97
+     */
95 98
     function passre($user_mail)
96 99
     {
97 100
         $user = $this->get($user_mail, 'mail');
@@ -312,6 +315,9 @@  discard block
 block discarded – undo
312 315
         return $user->id;
313 316
     }
314 317
 
318
+    /**
319
+     * @param string $pass
320
+     */
315 321
     function hashpass($pass)
316 322
     {
317 323
         return password_hash($pass, PASSWORD_DEFAULT);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -296,7 +296,7 @@
 block discarded – undo
296 296
             $to = $user_mail;
297 297
             $subject = 'Регистрация на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME);
298 298
             $text = 'Вы были зарегистрированы на сайте ' . idn_to_utf8(INJI_DOMAIN_NAME) . '<br />для входа используйте ваш почтовый ящик в качестве логина и пароль: ' . $pass;
299
-            $text .='<br />';
299
+            $text .= '<br />';
300 300
             $text .= '<br />';
301 301
             $text .= 'Для активации вашего аккаунта перейдите по ссылке <a href = "http://' . INJI_DOMAIN_NAME . '/users/activation/' . $user->id . '/' . $user->activation . '">http://' . idn_to_utf8(INJI_DOMAIN_NAME) . '/users/activation/' . $user->id . '/' . $user->activation . '</a>';
302 302
             Tools::sendMail($from, $to, $subject, $text);
Please login to merge, or discard this patch.
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -189,17 +189,20 @@
 block discarded – undo
189 189
 
190 190
     public function get($idn = false, $ltype = 'id')
191 191
     {
192
-        if (!$idn)
193
-            return false;
192
+        if (!$idn) {
193
+                    return false;
194
+        }
194 195
 
195
-        if (is_numeric($idn) && $ltype != 'login')
196
-            $user = Users\User::get($idn, 'id');
197
-        elseif ($ltype == 'login')
198
-            $user = Users\User::get($idn, 'login');
199
-        else
200
-            $user = Users\User::get($idn, 'mail');
201
-        if (!$user)
202
-            return [];
196
+        if (is_numeric($idn) && $ltype != 'login') {
197
+                    $user = Users\User::get($idn, 'id');
198
+        } elseif ($ltype == 'login') {
199
+                    $user = Users\User::get($idn, 'login');
200
+        } else {
201
+                    $user = Users\User::get($idn, 'mail');
202
+        }
203
+        if (!$user) {
204
+                    return [];
205
+        }
203 206
 
204 207
         return $user;
205 208
     }
Please login to merge, or discard this patch.