Completed
Push — master ( 308a3c...ebb499 )
by Alexey
08:08
created
system/modules/View/appAdminControllers/content/index.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,12 +11,13 @@
 block discarded – undo
11 11
     '',
12 12
     ''
13 13
 ]);
14
-if (!empty($templates['app']['installed']))
14
+if (!empty($templates['app']['installed'])) {
15 15
     foreach ($templates['app']['installed'] as $template => $name) {
16 16
         $table->addRow([
17 17
             $name,
18 18
             (empty($templates['app']['current']) || $templates['app']['current'] != $template) ? '<a href = "/admin/view/setDefault/' . $template . '">Установить по умолчанию</a>' : 'Тема по умолчанию',
19 19
             '<a href = "/admin/view/template/editFile/' . $template . '">Файлы</a> <a href = "/admin/view/editTemplate/' . $template . '">Редактировать</a>'
20 20
         ]);
21
+}
21 22
     }
22 23
 $table->draw();
Please login to merge, or discard this patch.
system/modules/View/objects/Template.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,8 @@
 block discarded – undo
165 165
     public function setModule($module = null) {
166 166
         if (!$module && !$this->module) {
167 167
             $this->module = \Module::$cur;
168
-        } else {
168
+        }
169
+        else {
169 170
             $this->module = $module;
170 171
         }
171 172
         if (is_string($this->module)) {
Please login to merge, or discard this patch.
system/modules/View/View.php 1 patch
Braces   +86 added lines, -51 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@  discard block
 block discarded – undo
59 59
                 $source = str_replace('</body>', '{BODYEND}</body>', $source);
60 60
             }
61 61
             $this->parseSource($source);
62
-        } else {
62
+        }
63
+        else {
63 64
             $this->content();
64 65
         }
65 66
     }
@@ -80,7 +81,8 @@  discard block
 block discarded – undo
80 81
         //set content
81 82
         if (!empty($params['content'])) {
82 83
             $this->template->setContent($params['content']);
83
-        } elseif (!$this->template->contentPath) {
84
+        }
85
+        elseif (!$this->template->contentPath) {
84 86
             $this->template->setContent();
85 87
         }
86 88
         //set data
@@ -98,7 +100,8 @@  discard block
 block discarded – undo
98 100
         }
99 101
         if (!file_exists($this->template->contentPath)) {
100 102
             echo 'Content not found';
101
-        } else {
103
+        }
104
+        else {
102 105
             extract($this->contentData);
103 106
             include $this->template->contentPath;
104 107
         }
@@ -126,15 +129,17 @@  discard block
 block discarded – undo
126 129
         }
127 130
         if (!$data) {
128 131
             echo 'Content not found';
129
-        } else {
132
+        }
133
+        else {
130 134
             extract($this->contentData);
131 135
             include $data['contentPath'];
132 136
         }
133 137
     }
134 138
 
135 139
     private function parseRaw($source) {
136
-        if (!$source)
137
-            return [];
140
+        if (!$source) {
141
+                    return [];
142
+        }
138 143
 
139 144
         preg_match_all("|{([^}]+)}|", $source, $result);
140 145
         return $result[1];
@@ -185,9 +190,11 @@  discard block
 block discarded – undo
185 190
         $href = '';
186 191
         if (is_string($params)) {
187 192
             $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params;
188
-        } elseif (empty($params['template']) && !empty($params['file'])) {
193
+        }
194
+        elseif (empty($params['template']) && !empty($params['file'])) {
189 195
             $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $params['file'];
190
-        } elseif (!empty($params['template']) && !empty($params['file'])) {
196
+        }
197
+        elseif (!empty($params['template']) && !empty($params['file'])) {
191 198
             $href = $this->app->templatesPath . "/{$this->template->name}/{$type}/{$params['file']}";
192 199
         }
193 200
         return $href;
@@ -225,9 +232,11 @@  discard block
 block discarded – undo
225 232
 
226 233
         if (!empty($this->template->config['favicon']) && file_exists($this->template->path . "/{$this->template->config['favicon']}")) {
227 234
             echo "        <link rel='shortcut icon' href='/templates/{$this->template->name}/{$this->template->config['favicon']}' />";
228
-        } elseif (!empty($this->template->config['favicon']) && file_exists($this->app->path . "/static/images/{$this->template->config['favicon']}")) {
235
+        }
236
+        elseif (!empty($this->template->config['favicon']) && file_exists($this->app->path . "/static/images/{$this->template->config['favicon']}")) {
229 237
             echo "        <link rel='shortcut icon' href='/static/images/{$this->template->config['favicon']}' />";
230
-        } elseif (file_exists($this->app->path . '/static/images/favicon.ico')) {
238
+        }
239
+        elseif (file_exists($this->app->path . '/static/images/favicon.ico')) {
231 240
             echo "        <link rel='shortcut icon' href='/static/images/favicon.ico' />";
232 241
         }
233 242
 
@@ -267,7 +276,8 @@  discard block
 block discarded – undo
267 276
                 $this->loadedCss[$href] = $href;
268 277
                 $urls[$href] = $path;
269 278
                 $timeStr.=filemtime($path);
270
-            } else {
279
+            }
280
+            else {
271 281
                 echo "\n        <link href='{$href}' rel='stylesheet' type='text/css' />";
272 282
             }
273 283
         }
@@ -311,10 +321,12 @@  discard block
 block discarded – undo
311 321
                         $this->ResolveCssHref($css, $type, $hrefs);
312 322
                         continue;
313 323
                     }
314
-                    if (strpos($css, '//') !== false)
315
-                        $href = $css;
316
-                    else
317
-                        $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
324
+                    if (strpos($css, '//') !== false) {
325
+                                            $href = $css;
326
+                    }
327
+                    else {
328
+                                            $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
329
+                    }
318 330
                     $hrefs[$href] = $href;
319 331
                 }
320 332
                 break;
@@ -324,10 +336,12 @@  discard block
 block discarded – undo
324 336
                         $this->ResolveCssHref($css, $type, $hrefs);
325 337
                         continue;
326 338
                     }
327
-                    if (strpos($css, '://') !== false)
328
-                        $href = $css;
329
-                    else
330
-                        $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}";
339
+                    if (strpos($css, '://') !== false) {
340
+                                            $href = $css;
341
+                    }
342
+                    else {
343
+                                            $href = $this->app->templatesPath . "/{$this->template->name}/css/{$css}";
344
+                    }
331 345
                     $hrefs[$href] = $href;
332 346
                 }
333 347
                 break;
@@ -337,10 +351,12 @@  discard block
 block discarded – undo
337 351
                         $this->ResolveCssHref($css, $type, $hrefs);
338 352
                         continue;
339 353
                     }
340
-                    if (strpos($css, '//') !== false)
341
-                        $href = $css;
342
-                    else
343
-                        $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
354
+                    if (strpos($css, '//') !== false) {
355
+                                            $href = $css;
356
+                    }
357
+                    else {
358
+                                            $href = ($this->app->type != 'app' ? '/' . $this->app->name : '' ) . $css;
359
+                    }
344 360
                     $hrefs[$href] = $href;
345 361
                 }
346 362
                 break;
@@ -360,7 +376,8 @@  discard block
 block discarded – undo
360 376
             foreach ($this->app->config['site']['metatags'] as $meta) {
361 377
                 if (!empty($meta['name'])) {
362 378
                     $metas['metaName:' . $meta['name']] = $meta;
363
-                } elseif (!empty($meta['property'])) {
379
+                }
380
+                elseif (!empty($meta['property'])) {
364 381
                     $metas['metaProperty:' . $meta['property']] = $meta;
365 382
                 }
366 383
             }
@@ -374,7 +391,8 @@  discard block
 block discarded – undo
374 391
     public function addMetaTag($meta) {
375 392
         if (!empty($meta['name'])) {
376 393
             $this->dynMetas['metaName:' . $meta['name']] = $meta;
377
-        } elseif (!empty($meta['property'])) {
394
+        }
395
+        elseif (!empty($meta['property'])) {
378 396
             $this->dynMetas['metaProperty:' . $meta['property']] = $meta;
379 397
         }
380 398
     }
@@ -391,20 +409,24 @@  discard block
 block discarded – undo
391 409
         $noParsedScripts = [];
392 410
         foreach ($scripts as $script) {
393 411
             if (is_string($script)) {
394
-                if (!empty($urls[$script]))
395
-                    continue;
412
+                if (!empty($urls[$script])) {
413
+                                    continue;
414
+                }
396 415
 
397 416
                 $path = $this->app->staticLoader->parsePath($script);
398 417
                 if (file_exists($path)) {
399 418
                     $nativeUrl[$script] = $script;
400 419
                     $urls[$script] = $path;
401 420
                     $timeStr.=filemtime($path);
402
-                } else {
421
+                }
422
+                else {
403 423
                     $noParsedScripts[$script] = $script;
404 424
                 }
405
-            } elseif (!empty($script['file'])) {
406
-                if (!empty($urls[$script['file']]))
407
-                    continue;
425
+            }
426
+            elseif (!empty($script['file'])) {
427
+                if (!empty($urls[$script['file']])) {
428
+                                    continue;
429
+                }
408 430
 
409 431
                 $path = $this->app->staticLoader->parsePath($script['file']);
410 432
                 if (file_exists($path)) {
@@ -414,7 +436,8 @@  discard block
 block discarded – undo
414 436
                         $onLoadModules[$script['name']] = $script['name'];
415 437
                     }
416 438
                     $timeStr.=filemtime($path);
417
-                } else {
439
+                }
440
+                else {
418 441
                     $noParsedScripts[$script] = $script;
419 442
                 }
420 443
             }
@@ -461,12 +484,15 @@  discard block
 block discarded – undo
461 484
                         $this->genScriptArray($js, $type, $resultArray);
462 485
                         continue;
463 486
                     }
464
-                    if (strpos($js, '//') !== false)
465
-                        $href = $js;
466
-                    else
467
-                        $href = $this->getHref('js', $js);
468
-                    if (!$href)
469
-                        continue;
487
+                    if (strpos($js, '//') !== false) {
488
+                                            $href = $js;
489
+                    }
490
+                    else {
491
+                                            $href = $this->getHref('js', $js);
492
+                    }
493
+                    if (!$href) {
494
+                                            continue;
495
+                    }
470 496
 
471 497
                     $resultArray[] = $href;
472 498
                 }
@@ -477,10 +503,12 @@  discard block
 block discarded – undo
477 503
                         $this->genScriptArray($js, $type, $resultArray);
478 504
                         continue;
479 505
                     }
480
-                    if (strpos($js, '//') !== false)
481
-                        $href = $js;
482
-                    else
483
-                        $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}";
506
+                    if (strpos($js, '//') !== false) {
507
+                                            $href = $js;
508
+                    }
509
+                    else {
510
+                                            $href = $this->app->templatesPath . "/{$this->template->name}/js/{$js}";
511
+                    }
484 512
                     $resultArray[] = $href;
485 513
                 }
486 514
                 break;
@@ -492,12 +520,14 @@  discard block
 block discarded – undo
492 520
                             continue;
493 521
                         }
494 522
                         $asset = $js;
495
-                    } else {
523
+                    }
524
+                    else {
496 525
                         $asset = [];
497 526
                     }
498 527
                     $asset['file'] = $this->getHref('js', $js);
499
-                    if (!$asset['file'])
500
-                        continue;
528
+                    if (!$asset['file']) {
529
+                                            continue;
530
+                    }
501 531
                     $resultArray[] = $asset;
502 532
                 }
503 533
                 break;
@@ -507,7 +537,8 @@  discard block
 block discarded – undo
507 537
     public function customAsset($type, $asset, $lib = false) {
508 538
         if (!$lib) {
509 539
             $this->dynAssets[$type][] = $asset;
510
-        } else {
540
+        }
541
+        else {
511 542
             $this->libAssets[$type][$lib][] = $asset;
512 543
         }
513 544
     }
@@ -516,10 +547,12 @@  discard block
 block discarded – undo
516 547
         if ($add && !empty($this->app->config['site']['name'])) {
517 548
             if ($title) {
518 549
                 $this->title = $title . ' - ' . $this->app->config['site']['name'];
519
-            } else {
550
+            }
551
+            else {
520 552
                 $this->title = $this->app->config['site']['name'];
521 553
             }
522
-        } else {
554
+        }
555
+        else {
523 556
             $this->title = $title;
524 557
         }
525 558
     }
@@ -542,8 +575,9 @@  discard block
 block discarded – undo
542 575
                         $paramArray = true;
543 576
                     }
544 577
                 }
545
-                if (!$paramArray)
546
-                    $lineParams = ':' . implode(':', $_params);
578
+                if (!$paramArray) {
579
+                                    $lineParams = ':' . implode(':', $_params);
580
+                }
547 581
             }
548 582
         }
549 583
         echo "<!--start:{WIDGET:{$_widgetName}{$lineParams}}-->\n";
@@ -570,7 +604,8 @@  discard block
 block discarded – undo
570 604
                 $paths[$pathName] = $path . '/widgets/' . $widgetName[1] . '.php';
571 605
             }
572 606
             return $paths;
573
-        } else {
607
+        }
608
+        else {
574 609
             $paths['templatePath_widgetDir'] = $this->templatesPath . '/' . $this->template->name . '/widgets/' . $widgetName . '/' . $widgetName . '.php';
575 610
             $paths['templatePath'] = $this->templatesPath . '/' . $this->template->name . '/widgets/' . $widgetName . '.php';
576 611
 
Please login to merge, or discard this patch.
system/modules/View/appControllers/ViewController.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,8 @@
 block discarded – undo
13 13
     public function editorcssAction() {
14 14
         if (file_exists($this->view->template->path . '/css/editor.css')) {
15 15
             Tools::redirect('/static/templates/' . $this->view->template['name'] . '/css/editor.css');
16
-        } else {
16
+        }
17
+        else {
17 18
             header("Content-type: text/css");
18 19
             exit();
19 20
         }
Please login to merge, or discard this patch.
system/modules/StaticLoader/StaticLoader.php 1 patch
Braces   +28 added lines, -17 removed lines patch added patch discarded remove patch
@@ -37,10 +37,12 @@  discard block
 block discarded – undo
37 37
                 $scriptApp->installed = true;
38 38
                 $scriptApp->params = [];
39 39
                 $scriptApp->config = Config::app($scriptApp);
40
-            } else {
40
+            }
41
+            else {
41 42
                 $scriptApp = \App::$cur;
42 43
             }
43
-        } else {
44
+        }
45
+        else {
44 46
             $scriptApp = \App::$cur->system ? \App::$primary : \App::$cur;
45 47
         }
46 48
 
@@ -107,30 +109,38 @@  discard block
 block discarded – undo
107 109
 
108 110
                 $sizes = explode('x', $_GET['resize']);
109 111
                 $sizes[0] = intval($sizes[0]);
110
-                if (isset($sizes[1]))
111
-                    $sizes[1] = intval($sizes[1]);
112
-                else
113
-                    $sizes[1] = 0;
112
+                if (isset($sizes[1])) {
113
+                                    $sizes[1] = intval($sizes[1]);
114
+                }
115
+                else {
116
+                                    $sizes[1] = 0;
117
+                }
114 118
 
115 119
                 if (!$sizes[0] || !$sizes[1]) {
116 120
                     header('HTTP/1.1 404 Not Found');
117 121
                     exit();
118
-                } elseif ($sizes[0] > 2000 || $sizes[1] > 2000) {
122
+                }
123
+                elseif ($sizes[0] > 2000 || $sizes[1] > 2000) {
119 124
                     header('HTTP/1.1 404 Not Found');
120 125
                     exit();
121
-                } else {
126
+                }
127
+                else {
122 128
                     $dir = App::$primary->path;
123 129
 
124 130
                     if (!empty($_GET['resize_crop'])) {
125
-                        if (in_array($_GET['resize_crop'], array('q', 'c')))
126
-                            $crop = $_GET['resize_crop'];
127
-                        else
128
-                            $crop = 'c';
131
+                        if (in_array($_GET['resize_crop'], array('q', 'c'))) {
132
+                                                    $crop = $_GET['resize_crop'];
133
+                        }
134
+                        else {
135
+                                                    $crop = 'c';
136
+                        }
137
+                    }
138
+                    elseif (!empty($_GET['resize_quadro'])) {
139
+                                            $crop = 'q';
140
+                    }
141
+                    else {
142
+                                            $crop = '';
129 143
                     }
130
-                    elseif (!empty($_GET['resize_quadro']))
131
-                        $crop = 'q';
132
-                    else
133
-                        $crop = '';
134 144
                     $pos = 'center';
135 145
                     if (!empty($_GET['resize_pos']) && in_array($_GET['resize_pos'], array('top', 'center'))) {
136 146
                         $pos = $_GET['resize_pos'];
@@ -155,7 +165,8 @@  discard block
 block discarded – undo
155 165
 
156 166
             // Преобразуем запрос клиента If-Modified-Since в таймштамп
157 167
             $modifiedSince = strtotime($modifiedSince[0]);
158
-        } else {
168
+        }
169
+        else {
159 170
             // Устанавливаем время модификации в ноль
160 171
             $modifiedSince = 0;
161 172
         }
Please login to merge, or discard this patch.
system/modules/StaticLoader/Controllers/StaticLoaderController.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,8 @@
 block discarded – undo
17 17
         }
18 18
         if (!file_exists($path)) {
19 19
             Tools::header(404, true);
20
-        } else {
20
+        }
21
+        else {
21 22
             $this->module->giveFile($path);
22 23
         }
23 24
     }
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Mysql.php 1 patch
Braces   +16 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,14 +29,18 @@  discard block
 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();
@@ -52,10 +56,12 @@  discard block
 block discarded – undo
52 56
         if ((int) $error[0]) {
53 57
             if ($this->noConnectAbort) {
54 58
                 return false;
55
-            } else {
59
+            }
60
+            else {
56 61
                 INJI_SYSTEM_ERROR($error[2], true);
57 62
             }
58
-        } else {
63
+        }
64
+        else {
59 65
             $this->connect = true;
60 66
             $query = new Mysql\Query($this);
61 67
             $query->query("SET SQL_BIG_SELECTS=1");
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Query.php 1 patch
Braces   +100 added lines, -59 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
     public function __construct($instance = null) {
35 35
         if (!$instance) {
36 36
             $this->curInstance = \App::$cur->db->connection;
37
-        } else {
37
+        }
38
+        else {
38 39
             $this->curInstance = $instance;
39 40
         }
40 41
     }
@@ -79,7 +80,8 @@  discard block
 block discarded – undo
79 80
     public function cols($cols) {
80 81
         if (is_array($cols)) {
81 82
             $this->cols = array_merge($this->cols, array_values($cols));
82
-        } else {
83
+        }
84
+        else {
83 85
             $this->cols[] = $cols;
84 86
         }
85 87
     }
@@ -90,11 +92,13 @@  discard block
 block discarded – undo
90 92
                 if (!is_array($item)) {
91 93
                     call_user_func_array(array($this, 'join'), $table);
92 94
                     break;
93
-                } else {
95
+                }
96
+                else {
94 97
                     $this->join($item);
95 98
                 }
96 99
             }
97
-        } else {
100
+        }
101
+        else {
98 102
             $this->join[] = [$table, $where, $type, $alias];
99 103
         }
100 104
     }
@@ -102,7 +106,8 @@  discard block
 block discarded – undo
102 106
     public function where($where = '', $value = '', $operation = false, $concatenation = 'AND') {
103 107
         if (!is_array($where)) {
104 108
             $this->where[] = [$where, $value, $operation, $concatenation];
105
-        } else {
109
+        }
110
+        else {
106 111
             $this->where[] = $where;
107 112
         }
108 113
     }
@@ -110,7 +115,8 @@  discard block
 block discarded – undo
110 115
     public function having($where = '', $value = '', $operation = false, $concatenation = 'AND') {
111 116
         if (!is_array($where)) {
112 117
             $this->having[] = [$where, $value, $operation, $concatenation];
113
-        } else {
118
+        }
119
+        else {
114 120
             $this->having[] = $where;
115 121
         }
116 122
     }
@@ -124,13 +130,17 @@  discard block
 block discarded – undo
124 130
 
125 131
         if (!is_array($order)) {
126 132
             $this->order[] = "{$order} {$type}";
127
-        } else {
128
-            foreach ($order as $item)
129
-                if (!is_array($item)) {
133
+        }
134
+        else {
135
+            foreach ($order as $item) {
136
+                            if (!is_array($item)) {
130 137
                     call_user_func_array(array($this, 'order'), $order);
138
+            }
131 139
                     break;
132
-                } else
133
-                    $this->order($item);
140
+                }
141
+                else {
142
+                                    $this->order($item);
143
+                }
134 144
         }
135 145
     }
136 146
 
@@ -138,8 +148,9 @@  discard block
 block discarded – undo
138 148
         $start = intval($start);
139 149
         $len = intval($len);
140 150
         $this->limit = "LIMIT {$start}";
141
-        if ($len !== 0)
142
-            $this->limit .= ",{$len}";
151
+        if ($len !== 0) {
152
+                    $this->limit .= ",{$len}";
153
+        }
143 154
     }
144 155
 
145 156
     public function buildJoin($table, $where = false, $type = 'LEFT', $alias = '') {
@@ -149,12 +160,15 @@  discard block
 block discarded – undo
149 160
             foreach ($joins as $joinAr) {
150 161
                 $join .= call_user_func_array([$this, 'buildJoin'], $joinAr);
151 162
             }
152
-        } else {
163
+        }
164
+        else {
153 165
             $join .= " {$type} JOIN {$this->curInstance->table_prefix}{$table}";
154
-            if ($alias)
155
-                $join .= " AS `{$alias}`";
156
-            if ($where)
157
-                $join .= " ON {$where}";
166
+            if ($alias) {
167
+                            $join .= " AS `{$alias}`";
168
+            }
169
+            if ($where) {
170
+                            $join .= " ON {$where}";
171
+            }
158 172
         }
159 173
         return $join;
160 174
     }
@@ -173,13 +187,16 @@  discard block
 block discarded – undo
173 187
                 $operation = '=';
174 188
             }
175 189
 
176
-            if ($concatenation === false)
177
-                $concatenation = 'AND';
178
-            elseif ($concatenation === true)
179
-                $concatenation = '';
190
+            if ($concatenation === false) {
191
+                            $concatenation = 'AND';
192
+            }
193
+            elseif ($concatenation === true) {
194
+                            $concatenation = '';
195
+            }
180 196
 
181
-            if ($this->whereString == NULL)
182
-                $this->whereString = ' WHERE ';
197
+            if ($this->whereString == NULL) {
198
+                            $this->whereString = ' WHERE ';
199
+            }
183 200
 
184 201
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
185 202
                 if (is_array($value)) {
@@ -190,25 +207,31 @@  discard block
 block discarded – undo
190 207
                         }
191 208
                         if (is_string($item)) {
192 209
                             $newValue .='"' . $item . '"';
193
-                        } else {
210
+                        }
211
+                        else {
194 212
                             $newValue .=$item;
195 213
                         }
196 214
                     }
197 215
                     $value = '(' . $newValue . ')';
198
-                } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
216
+                }
217
+                elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
199 218
                     $value = "({$value})";
200
-                } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
219
+                }
220
+                elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
201 221
                     $value = "\"{$value}\"";
202 222
                 }
203
-            } elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
223
+            }
224
+            elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
204 225
                 $this->params[] = $value;
205 226
                 $value = "?";
206 227
             }
207 228
 
208
-            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ')
209
-                $this->whereString .= " {$where} {$operation} {$value} ";
210
-            else
211
-                $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
229
+            if (substr($this->whereString, -1, 1) == '(' || substr($this->whereString, -2, 2) == 'E ') {
230
+                            $this->whereString .= " {$where} {$operation} {$value} ";
231
+            }
232
+            else {
233
+                            $this->whereString .= "{$concatenation} {$where} {$operation} {$value} ";
234
+            }
212 235
         }
213 236
         else {
214 237
             $i = -1;
@@ -218,23 +241,27 @@  discard block
 block discarded – undo
218 241
                     if ($this->whereString != NULL && substr($this->whereString, -1, 1) != '(' && $this->whereString != 'WHERE ') {
219 242
                         if (!isset($item[3])) {
220 243
                             $concatenation = 'AND';
221
-                        } else {
244
+                        }
245
+                        else {
222 246
                             $concatenation = $item[3];
223 247
                         }
224 248
 
225 249
                         $this->whereString .= "{$concatenation} ";
226 250
                     }
227 251
 
228
-                    if ($this->whereString != NULL)
229
-                        $this->whereString .= '(';
230
-                    else
231
-                        $this->whereString = 'WHERE (';
252
+                    if ($this->whereString != NULL) {
253
+                                            $this->whereString .= '(';
254
+                    }
255
+                    else {
256
+                                            $this->whereString = 'WHERE (';
257
+                    }
232 258
                 }
233 259
 
234 260
                 if (!is_array($item)) {
235 261
                     call_user_func_array(array($this, 'buildWhere'), $where);
236 262
                     break;
237
-                } else {
263
+                }
264
+                else {
238 265
                     $this->buildWhere($item);
239 266
                 }
240 267
                 if (!isset($where[$i + 1]) && isset($where[$i - 1])) {
@@ -257,13 +284,16 @@  discard block
 block discarded – undo
257 284
             if (empty($operation)) {
258 285
                 $operation = '=';
259 286
             }
260
-            if ($concatenation === false)
261
-                $concatenation = 'AND';
262
-            elseif ($concatenation === true)
263
-                $concatenation = '';
287
+            if ($concatenation === false) {
288
+                            $concatenation = 'AND';
289
+            }
290
+            elseif ($concatenation === true) {
291
+                            $concatenation = '';
292
+            }
264 293
 
265
-            if ($this->havingString == NULL)
266
-                $this->havingString = ' HAVING ';
294
+            if ($this->havingString == NULL) {
295
+                            $this->havingString = ' HAVING ';
296
+            }
267 297
 
268 298
             if (stristr($operation, 'IN') || stristr($operation, 'NOT IN')) {
269 299
                 if (is_array($value)) {
@@ -274,25 +304,31 @@  discard block
 block discarded – undo
274 304
                         }
275 305
                         if (is_string($item)) {
276 306
                             $newValue .='"' . $item . '"';
277
-                        } else {
307
+                        }
308
+                        else {
278 309
                             $newValue .=$item;
279 310
                         }
280 311
                     }
281 312
                     $value = '(' . $newValue . ')';
282
-                } elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
313
+                }
314
+                elseif (!preg_match('!\(!', $value) && !preg_match('![^0-9,\.\(\) ]!', $value)) {
283 315
                     $value = "({$value})";
284
-                } elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
316
+                }
317
+                elseif (preg_match('!\(!', $value) && preg_match('![^0-9,\.\(\) ]!', $value)) {
285 318
                     $value = "\"{$value}\"";
286 319
                 }
287
-            } elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
320
+            }
321
+            elseif (!in_array($value, array('CURRENT_TIMESTAMP'))) {
288 322
                 $this->params[] = $value;
289 323
                 $value = "?";
290 324
             }
291 325
 
292
-            if (substr($this->havingString, -1, 1) == '(' || substr($this->havingString, -2, 2) == 'E ')
293
-                $this->havingString .= " {$where} {$operation} {$value} ";
294
-            else
295
-                $this->havingString .= "{$concatenation} {$where} {$operation} {$value} ";
326
+            if (substr($this->havingString, -1, 1) == '(' || substr($this->havingString, -2, 2) == 'E ') {
327
+                            $this->havingString .= " {$where} {$operation} {$value} ";
328
+            }
329
+            else {
330
+                            $this->havingString .= "{$concatenation} {$where} {$operation} {$value} ";
331
+            }
296 332
         }
297 333
         else {
298 334
             $i = -1;
@@ -302,23 +338,27 @@  discard block
 block discarded – undo
302 338
                     if ($this->havingString != NULL && substr($this->havingString, -1, 1) != '(' && $this->havingString != 'HAVING ') {
303 339
                         if (!isset($item[3])) {
304 340
                             $concatenation = 'AND';
305
-                        } else {
341
+                        }
342
+                        else {
306 343
                             $concatenation = $item[3];
307 344
                         }
308 345
 
309 346
                         $this->havingString .= "{$concatenation} ";
310 347
                     }
311 348
 
312
-                    if ($this->havingString != NULL)
313
-                        $this->havingString .= '(';
314
-                    else
315
-                        $this->havingString = 'HAVING (';
349
+                    if ($this->havingString != NULL) {
350
+                                            $this->havingString .= '(';
351
+                    }
352
+                    else {
353
+                                            $this->havingString = 'HAVING (';
354
+                    }
316 355
                 }
317 356
 
318 357
                 if (!is_array($item)) {
319 358
                     call_user_func_array(array($this, 'buildHaving'), $where);
320 359
                     break;
321
-                } else {
360
+                }
361
+                else {
322 362
                     $this->buildHaving($item);
323 363
                 }
324 364
                 if (!isset($where[$i + 1]) && isset($where[$i - 1])) {
@@ -376,7 +416,8 @@  discard block
 block discarded – undo
376 416
                     if (!in_array($item, array('CURRENT_TIMESTAMP'))) {
377 417
                         $this->params[] = $item;
378 418
                         $updates[] = "`{$key}` = ?";
379
-                    } else {
419
+                    }
420
+                    else {
380 421
                         $updates[] = "`{$key}` = {$item}";
381 422
                     }
382 423
                 }
Please login to merge, or discard this patch.
system/modules/Db/objects/Mysql/Result.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,8 @@  discard block
 block discarded – undo
18 18
     public function getArray($keyCol = '') {
19 19
         if (!$keyCol) {
20 20
             return $this->pdoResult->fetchAll(\PDO::FETCH_ASSOC);
21
-        } else {
21
+        }
22
+        else {
22 23
             $array = [];
23 24
             while ($row = $this->pdoResult->fetch(\PDO::FETCH_ASSOC)) {
24 25
                 $array[$row[$keyCol]] = $row;
@@ -33,7 +34,8 @@  discard block
 block discarded – undo
33 34
         while ($object = $this->pdoResult->fetchObject($class)) {
34 35
             if ($keyCol) {
35 36
                 $array[$object->$keyCol] = $object;
36
-            } else {
37
+            }
38
+            else {
37 39
                 $array[] = $object;
38 40
             }
39 41
         }
@@ -44,7 +46,8 @@  discard block
 block discarded – undo
44 46
     public function fetch($className = '') {
45 47
         if ($className) {
46 48
             return $this->pdoResult->fetchObject($className);
47
-        } else {
49
+        }
50
+        else {
48 51
             return $this->pdoResult->fetch(\PDO::FETCH_ASSOC);
49 52
         }
50 53
     }
Please login to merge, or discard this patch.