Completed
Pull Request — develop (#716)
by Agel_Nash
12:28 queued 06:14
created
manager/includes/extenders/dbapi.mysql.class.inc.php 1 patch
Doc Comments   +12 added lines patch added patch discarded remove patch
@@ -268,6 +268,7 @@  discard block
 block discarded – undo
268 268
     /**
269 269
      * @name:  delete
270 270
      *
271
+     * @param string $from
271 272
      */
272 273
     public function delete($from, $where = '', $orderby = '', $limit = '')
273 274
     {
@@ -414,6 +415,9 @@  discard block
 block discarded – undo
414 415
         }
415 416
     }
416 417
 
418
+    /**
419
+     * @param string $table
420
+     */
417 421
     public function save($fields, $table, $where = '')
418 422
     {
419 423
 
@@ -444,6 +448,7 @@  discard block
 block discarded – undo
444 448
     /**
445 449
      * @name:  freeResult
446 450
      *
451
+     * @param mysqli_result $rs
447 452
      */
448 453
     public function freeResult($rs)
449 454
     {
@@ -554,6 +559,7 @@  discard block
 block discarded – undo
554 559
      * @name:  getColumn
555 560
      * @desc:  returns an array of the values found on colun $name
556 561
      * @param: $dsq - dataset or query string
562
+     * @param string $name
557 563
      */
558 564
     public function getColumn($name, $dsq)
559 565
     {
@@ -720,6 +726,9 @@  discard block
 block discarded – undo
720 726
         return $result;
721 727
     }
722 728
 
729
+    /**
730
+     * @param string $table_name
731
+     */
723 732
     public function optimize($table_name)
724 733
     {
725 734
         $rs = $this->query("OPTIMIZE TABLE {$table_name}");
@@ -730,6 +739,9 @@  discard block
 block discarded – undo
730 739
         return $rs;
731 740
     }
732 741
 
742
+    /**
743
+     * @param string $table_name
744
+     */
733 745
     public function truncate($table_name)
734 746
     {
735 747
         $rs = $this->query("TRUNCATE {$table_name}");
Please login to merge, or discard this patch.
manager/includes/functions/tv.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      *
173 173
      * @param string $param
174 174
      * @param array $tvsArray
175
-     * @return mixed
175
+     * @return string
176 176
      */
177 177
     function parseTvValues($param, $tvsArray)
178 178
     {
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
     /**
567 567
      * returns an array if a delimiter is present. returns array is a recordset is present
568 568
      *
569
-     * @param $src
569
+     * @param string $src
570 570
      * @param string $delim
571 571
      * @param string $type
572 572
      * @param bool $columns
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
 if (! function_exists('ParseIntputOptions')) {
1024 1024
     /**
1025
-     * @param string|array|mysqli_result $v
1025
+     * @param string $v
1026 1026
      * @return array
1027 1027
      */
1028 1028
     function ParseIntputOptions($v)
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (! function_exists('ProcessTVCommand')) {
3
+if (!function_exists('ProcessTVCommand')) {
4 4
     /**
5 5
      * @param string $value
6 6
      * @param string $name
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     function ProcessTVCommand($value, $name = '', $docid = '', $src = 'docform', $tvsArray = array())
13 13
     {
14 14
         $modx = evolutionCMS();
15
-        $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
15
+        $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
16 16
         $nvalue = trim($value);
17 17
         if (substr($nvalue, 0, 1) != '@') {
18 18
             return $value;
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
                         // if an inherited value is found and if there is content following the @INHERIT binding
78 78
                         // remove @INHERIT and output that following content. This content could contain other
79 79
                         // @ bindings, that are processed in the next step
80
-                        if ((string)$tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) {
81
-                            $output = trim(str_replace('@INHERIT', '', (string)$tv['value']));
80
+                        if ((string) $tv['value'] !== '' && !preg_match('%^@INHERIT[\s\n\r]*$%im', $tv['value'])) {
81
+                            $output = trim(str_replace('@INHERIT', '', (string) $tv['value']));
82 82
                             break 2;
83 83
                         }
84 84
                     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
                 case 'DIRECTORY' :
88 88
                     $files = array();
89
-                    $path = $modx->config['base_path'] . $param;
89
+                    $path = $modx->config['base_path'].$param;
90 90
                     if (substr($path, -1, 1) != '/') {
91 91
                         $path .= '/';
92 92
                     }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     }
118 118
 }
119 119
 
120
-if (! function_exists('ProcessFile')) {
120
+if (!function_exists('ProcessFile')) {
121 121
     /**
122 122
      * @param $file
123 123
      * @return string
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     }
135 135
 }
136 136
 
137
-if (! function_exists('ParseCommand')) {
137
+if (!function_exists('ParseCommand')) {
138 138
     /**
139 139
      * ParseCommand - separate @ cmd from params
140 140
      *
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
         $binding_array = array();
157 157
         foreach ($BINDINGS as $cmd) {
158
-            if (strpos($binding_string, '@' . $cmd) === 0) {
158
+            if (strpos($binding_string, '@'.$cmd) === 0) {
159 159
                 $code = substr($binding_string, strlen($cmd) + 1);
160 160
                 $binding_array = array($cmd, trim($code));
161 161
                 break;
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     }
167 167
 }
168 168
 
169
-if (! function_exists('parseTvValues')) {
169
+if (!function_exists('parseTvValues')) {
170 170
     /**
171 171
      * Parse MODX Template-Variables
172 172
      *
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     }
198 198
 }
199 199
 
200
-if (! function_exists('getTVDisplayFormat')) {
200
+if (!function_exists('getTVDisplayFormat')) {
201 201
     /**
202 202
      * @param string $name
203 203
      * @param string $value
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $o = '';
216 216
 
217 217
         // process any TV commands in value
218
-        $docid = (int)$docid > 0 ? (int)$docid : $modx->documentIdentifier;
218
+        $docid = (int) $docid > 0 ? (int) $docid : $modx->documentIdentifier;
219 219
         $value = ProcessTVCommand($value, $name, $docid);
220 220
 
221 221
         $params = array();
@@ -254,12 +254,12 @@  discard block
 block discarded – undo
254 254
                             $attr['align'] = $params['align'];
255 255
                         }
256 256
                         foreach ($attr as $k => $v) {
257
-                            $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
257
+                            $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
258 258
                         }
259
-                        $attributes .= ' ' . $params['attrib'];
259
+                        $attributes .= ' '.$params['attrib'];
260 260
 
261 261
                         // Output the image with attributes
262
-                        $o .= '<img' . rtrim($attributes) . ' />';
262
+                        $o .= '<img'.rtrim($attributes).' />';
263 263
                     }
264 264
                 }
265 265
                 break;
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
                             'target' => $params['target'],
332 332
                         );
333 333
                         foreach ($attr as $k => $v) {
334
-                            $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
334
+                            $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
335 335
                         }
336
-                        $attributes .= ' ' . $params['attrib']; // add extra
336
+                        $attributes .= ' '.$params['attrib']; // add extra
337 337
 
338 338
                         // Output the link
339
-                        $o .= '<a' . rtrim($attributes) . '>' . ($params['text'] ? $modx->htmlspecialchars($params['text']) : $name) . '</a>';
339
+                        $o .= '<a'.rtrim($attributes).'>'.($params['text'] ? $modx->htmlspecialchars($params['text']) : $name).'</a>';
340 340
                     }
341 341
                 }
342 342
                 break;
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
                         'style' => $params['style'],
363 363
                     );
364 364
                     foreach ($attr as $k => $v) {
365
-                        $attributes .= ($v ? ' ' . $k . '="' . $v . '"' : '');
365
+                        $attributes .= ($v ? ' '.$k.'="'.$v.'"' : '');
366 366
                     }
367
-                    $attributes .= ' ' . $params['attrib']; // add extra
367
+                    $attributes .= ' '.$params['attrib']; // add extra
368 368
 
369 369
                     // Output the HTML Tag
370
-                    $o .= '<' . $tagname . rtrim($attributes) . '>' . $tagvalue . '</' . $tagname . '>';
370
+                    $o .= '<'.$tagname.rtrim($attributes).'>'.$tagvalue.'</'.$tagname.'>';
371 371
                 }
372 372
                 break;
373 373
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 $w = $params['w'] ? $params['w'] : '100%';
377 377
                 $h = $params['h'] ? $params['h'] : '400px';
378 378
                 $richtexteditor = $params['edt'] ? $params['edt'] : "";
379
-                $o = '<div class="MODX_RichTextWidget"><textarea id="' . $id . '" name="' . $id . '" style="width:' . $w . '; height:' . $h . ';">';
379
+                $o = '<div class="MODX_RichTextWidget"><textarea id="'.$id.'" name="'.$id.'" style="width:'.$w.'; height:'.$h.';">';
380 380
                 $o .= $modx->htmlspecialchars($value);
381 381
                 $o .= '</textarea></div>';
382 382
                 $replace_richtext = array($id);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
             case "viewport":
405 405
                 $value = parseInput($value);
406
-                $id = '_' . time();
406
+                $id = '_'.time();
407 407
                 if (!$params['vpid']) {
408 408
                     $params['vpid'] = $id;
409 409
                 }
@@ -417,41 +417,41 @@  discard block
 block discarded – undo
417 417
                     $h = "100%";
418 418
                 }
419 419
                 if ($params['asize'] == 'Yes' || ($params['awidth'] == 'Yes' && $params['aheight'] == 'Yes')) {
420
-                    $autoMode = "3";  //both
420
+                    $autoMode = "3"; //both
421 421
                 } else {
422 422
                     if ($params['awidth'] == 'Yes') {
423 423
                         $autoMode = "1"; //width only
424 424
                     } else {
425 425
                         if ($params['aheight'] == 'Yes') {
426
-                            $autoMode = "2";    //height only
426
+                            $autoMode = "2"; //height only
427 427
                         }
428 428
                     }
429 429
                 }
430 430
 
431
-                $modx->regClientStartupScript(MODX_MANAGER_URL . "media/script/bin/viewport.js", array(
431
+                $modx->regClientStartupScript(MODX_MANAGER_URL."media/script/bin/viewport.js", array(
432 432
                     'name'      => 'viewport',
433 433
                     'version'   => '0',
434 434
                     'plaintext' => false
435 435
                 ));
436
-                $o = $sTag . " id='" . $params['vpid'] . "' name='" . $params['vpid'] . "' ";
436
+                $o = $sTag." id='".$params['vpid']."' name='".$params['vpid']."' ";
437 437
                 if ($params['class']) {
438
-                    $o .= " class='" . $params['class'] . "' ";
438
+                    $o .= " class='".$params['class']."' ";
439 439
                 }
440 440
                 if ($params['style']) {
441
-                    $o .= " style='" . $params['style'] . "' ";
441
+                    $o .= " style='".$params['style']."' ";
442 442
                 }
443 443
                 if ($params['attrib']) {
444
-                    $o .= $params['attrib'] . " ";
444
+                    $o .= $params['attrib']." ";
445 445
                 }
446
-                $o .= "scrolling='" . ($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto")) . "' ";
447
-                $o .= "src='" . $value . "' frameborder='" . $params['borsize'] . "' ";
448
-                $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'" . $params['vpid'] . "\\'," . $autoMode . ")',100);\" width='" . $w . "' height='" . $h . "' ";
446
+                $o .= "scrolling='".($params['sbar'] == 'No' ? "no" : ($params['sbar'] == 'Yes' ? "yes" : "auto"))."' ";
447
+                $o .= "src='".$value."' frameborder='".$params['borsize']."' ";
448
+                $o .= "onload=\"window.setTimeout('ResizeViewPort(\\'".$params['vpid']."\\',".$autoMode.")',100);\" width='".$w."' height='".$h."' ";
449 449
                 $o .= ">";
450 450
                 $o .= $eTag;
451 451
                 break;
452 452
 
453 453
             case "datagrid":
454
-                include_once MODX_MANAGER_PATH . "includes/controls/datagrid.class.php";
454
+                include_once MODX_MANAGER_PATH."includes/controls/datagrid.class.php";
455 455
                 $grd = new DataGrid('', $value);
456 456
 
457 457
                 $grd->noRecordMsg = $params['egmsg'];
@@ -498,16 +498,16 @@  discard block
 block discarded – undo
498 498
                 $o = '';
499 499
                 /* If we are loading a file */
500 500
                 if (substr($params['output'], 0, 5) == "@FILE") {
501
-                    $file_name = MODX_BASE_PATH . trim(substr($params['output'], 6));
501
+                    $file_name = MODX_BASE_PATH.trim(substr($params['output'], 6));
502 502
                     if (!file_exists($file_name)) {
503
-                        $widget_output = $file_name . ' does not exist';
503
+                        $widget_output = $file_name.' does not exist';
504 504
                     } else {
505 505
                         $widget_output = file_get_contents($file_name);
506 506
                     }
507 507
                 } elseif (substr($params['output'], 0, 8) == '@INCLUDE') {
508
-                    $file_name = MODX_BASE_PATH . trim(substr($params['output'], 9));
508
+                    $file_name = MODX_BASE_PATH.trim(substr($params['output'], 9));
509 509
                     if (!file_exists($file_name)) {
510
-                        $widget_output = $file_name . ' does not exist';
510
+                        $widget_output = $file_name.' does not exist';
511 511
                     } else {
512 512
                         /* The included file needs to set $widget_output. Can be string, array, object */
513 513
                         include $file_name;
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
     }
550 550
 }
551 551
 
552
-if (! function_exists('decodeParamValue')) {
552
+if (!function_exists('decodeParamValue')) {
553 553
     /**
554 554
      * @param string $s
555 555
      * @return string
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     }
563 563
 }
564 564
 
565
-if (! function_exists('parseInput')) {
565
+if (!function_exists('parseInput')) {
566 566
     /**
567 567
      * returns an array if a delimiter is present. returns array is a recordset is present
568 568
      *
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     }
595 595
 }
596 596
 
597
-if (! function_exists('getUnixtimeFromDateString')) {
597
+if (!function_exists('getUnixtimeFromDateString')) {
598 598
     /**
599 599
      * @param string $value
600 600
      * @return bool|false|int
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
     }
623 623
 }
624 624
 
625
-if (! function_exists('renderFormElement')) {
625
+if (!function_exists('renderFormElement')) {
626 626
     /**
627 627
      * DISPLAY FORM ELEMENTS
628 628
      *
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
         $field_style = '',
646 646
         $row = array(),
647 647
         $tvsArray = array()
648
-    ) {
648
+    ){
649 649
         $modx = evolutionCMS();
650 650
         global $_style;
651 651
         global $_lang;
@@ -665,22 +665,22 @@  discard block
 block discarded – undo
665 665
 
666 666
                 case "text": // handler for regular text boxes
667 667
                 case "rawtext"; // non-htmlentity converted text boxes
668
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" />';
668
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" />';
669 669
                     break;
670 670
                 case "email": // handles email input fields
671
-                    $field_html .= '<input type="email" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%"/>';
671
+                    $field_html .= '<input type="email" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%"/>';
672 672
                     break;
673 673
                 case "number": // handles the input of numbers
674
-                    $field_html .= '<input type="number" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' tvtype="' . $field_type . '" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
674
+                    $field_html .= '<input type="number" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' tvtype="'.$field_type.'" onchange="documentDirty=true;" style="width:100%" onkeyup="this.value=this.value.replace(/[^\d-,.+]/,\'\')"/>';
675 675
                     break;
676 676
                 case "textareamini": // handler for textarea mini boxes
677
-                    $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
677
+                    $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="5" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>';
678 678
                     break;
679 679
                 case "textarea": // handler for textarea boxes
680 680
                 case "rawtextarea": // non-htmlentity convertex textarea boxes
681 681
                 case "htmlarea": // handler for textarea boxes (deprecated)
682 682
                 case "richtext": // handler for textarea boxes
683
-                    $field_html .= '<textarea id="tv' . $field_id . '" name="tv' . $field_id . '" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">' . $modx->htmlspecialchars($field_value) . '</textarea>';
683
+                    $field_html .= '<textarea id="tv'.$field_id.'" name="tv'.$field_id.'" cols="40" rows="15" onchange="documentDirty=true;" style="width:100%">'.$modx->htmlspecialchars($field_value).'</textarea>';
684 684
                     break;
685 685
                 case "date":
686 686
                     $field_id = str_replace(array(
@@ -690,12 +690,12 @@  discard block
 block discarded – undo
690 690
                     if ($field_value == '') {
691 691
                         $field_value = 0;
692 692
                     }
693
-                    $field_html .= '<input id="tv' . $field_id . '" name="tv' . $field_id . '" class="DatePicker" type="text" value="' . ($field_value == 0 || !isset($field_value) ? "" : $field_value) . '" onblur="documentDirty=true;" />';
694
-                    $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].value=\'\';document.forms[\'mutate\'].elements[\'tv' . $field_id . '\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="' . $_style["actions_calendar_delete"] . '"></i></a>';
693
+                    $field_html .= '<input id="tv'.$field_id.'" name="tv'.$field_id.'" class="DatePicker" type="text" value="'.($field_value == 0 || !isset($field_value) ? "" : $field_value).'" onblur="documentDirty=true;" />';
694
+                    $field_html .= ' <a onclick="document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].value=\'\';document.forms[\'mutate\'].elements[\'tv'.$field_id.'\'].onblur(); return true;" onmouseover="window.status=\'clear the date\'; return true;" onmouseout="window.status=\'\'; return true;" style="cursor:pointer; cursor:hand"><i class="'.$_style["actions_calendar_delete"].'"></i></a>';
695 695
 
696 696
                     break;
697 697
                 case "dropdown": // handler for select boxes
698
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" size="1" onchange="documentDirty=true;">';
698
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" size="1" onchange="documentDirty=true;">';
699 699
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
700 700
                         $tvsArray));
701 701
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -703,12 +703,12 @@  discard block
 block discarded – undo
703 703
                         if (strlen($itemvalue) == 0) {
704 704
                             $itemvalue = $item;
705 705
                         }
706
-                        $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
706
+                        $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
707 707
                     }
708 708
                     $field_html .= "</select>";
709 709
                     break;
710 710
                 case "listbox": // handler for select boxes
711
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '" onchange="documentDirty=true;" size="8">';
711
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'" onchange="documentDirty=true;" size="8">';
712 712
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
713 713
                         $tvsArray));
714 714
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -716,13 +716,13 @@  discard block
 block discarded – undo
716 716
                         if (strlen($itemvalue) == 0) {
717 717
                             $itemvalue = $item;
718 718
                         }
719
-                        $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . ($itemvalue == $field_value ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
719
+                        $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.($itemvalue == $field_value ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
720 720
                     }
721 721
                     $field_html .= "</select>";
722 722
                     break;
723 723
                 case "listbox-multiple": // handler for select boxes where you can choose multiple items
724 724
                     $field_value = explode("||", $field_value);
725
-                    $field_html .= '<select id="tv' . $field_id . '" name="tv' . $field_id . '[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
725
+                    $field_html .= '<select id="tv'.$field_id.'" name="tv'.$field_id.'[]" multiple="multiple" onchange="documentDirty=true;" size="8">';
726 726
                     $index_list = ParseIntputOptions(ProcessTVCommand($field_elements, $field_id, '', 'tvform',
727 727
                         $tvsArray));
728 728
                     while (list($item, $itemvalue) = each($index_list)) {
@@ -730,8 +730,8 @@  discard block
 block discarded – undo
730 730
                         if (strlen($itemvalue) == 0) {
731 731
                             $itemvalue = $item;
732 732
                         }
733
-                        $field_html .= '<option value="' . $modx->htmlspecialchars($itemvalue) . '"' . (in_array($itemvalue,
734
-                                $field_value) ? ' selected="selected"' : '') . '>' . $modx->htmlspecialchars($item) . '</option>';
733
+                        $field_html .= '<option value="'.$modx->htmlspecialchars($itemvalue).'"'.(in_array($itemvalue,
734
+                                $field_value) ? ' selected="selected"' : '').'>'.$modx->htmlspecialchars($item).'</option>';
735 735
                     }
736 736
                     $field_html .= "</select>";
737 737
                     break;
@@ -743,17 +743,17 @@  discard block
 block discarded – undo
743 743
                         'ftp://'   => 'ftp://',
744 744
                         'mailto:'  => 'mailto:'
745 745
                     );
746
-                    $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv' . $field_id . '_prefix" name="tv' . $field_id . '_prefix" onchange="documentDirty=true;">';
746
+                    $field_html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_id.'_prefix" name="tv'.$field_id.'_prefix" onchange="documentDirty=true;">';
747 747
                     foreach ($urls as $k => $v) {
748 748
                         if (strpos($field_value, $v) === false) {
749
-                            $field_html .= '<option value="' . $v . '">' . $k . '</option>';
749
+                            $field_html .= '<option value="'.$v.'">'.$k.'</option>';
750 750
                         } else {
751 751
                             $field_value = str_replace($v, '', $field_value);
752
-                            $field_html .= '<option value="' . $v . '" selected="selected">' . $k . '</option>';
752
+                            $field_html .= '<option value="'.$v.'" selected="selected">'.$k.'</option>';
753 753
                         }
754 754
                     }
755 755
                     $field_html .= '</select></td><td>';
756
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" width="100" ' . $field_style . ' onchange="documentDirty=true;" /></td></tr></table>';
756
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" width="100" '.$field_style.' onchange="documentDirty=true;" /></td></tr></table>';
757 757
                     break;
758 758
                 case 'checkbox': // handles check boxes
759 759
                     $values = !is_array($field_value) ? explode('||', $field_value) : $field_value;
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
                         if (strlen($itemvalue) == 0) {
796 796
                             $itemvalue = $item;
797 797
                         }
798
-                        $field_html .= '<input type="radio" value="' . $modx->htmlspecialchars($itemvalue) . '" id="tv_' . $i . '" name="tv' . $field_id . '" ' . ($itemvalue == $field_value ? 'checked="checked"' : '') . ' onchange="documentDirty=true;" /><label for="tv_' . $i . '" class="radio">' . $item . '</label><br />';
798
+                        $field_html .= '<input type="radio" value="'.$modx->htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_id.'" '.($itemvalue == $field_value ? 'checked="checked"' : '').' onchange="documentDirty=true;" /><label for="tv_'.$i.'" class="radio">'.$item.'</label><br />';
799 799
                         $i++;
800 800
                     }
801 801
                     break;
@@ -825,13 +825,13 @@  discard block
 block discarded – undo
825 825
 									lastImageCtrl = ctrl;
826 826
 									var w = screen.width * 0.5;
827 827
 									var h = screen.height * 0.5;
828
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
828
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
829 829
 								}
830 830
 								function BrowseFileServer(ctrl) {
831 831
 									lastFileCtrl = ctrl;
832 832
 									var w = screen.width * 0.5;
833 833
 									var h = screen.height * 0.5;
834
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
834
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
835 835
 								}
836 836
 								function SetUrlChange(el) {
837 837
 									if ('createEvent' in document) {
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 						</script>";
866 866
                         $ResourceManagerLoaded = true;
867 867
                     }
868
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseServer(\'tv' . $field_id . '\')" />';
868
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseServer(\'tv'.$field_id.'\')" />';
869 869
                     break;
870 870
                 case "file": // handles the input of file uploads
871 871
                     /* Modified by Timon for use with resource browser */
@@ -895,13 +895,13 @@  discard block
 block discarded – undo
895 895
 									lastImageCtrl = ctrl;
896 896
 									var w = screen.width * 0.5;
897 897
 									var h = screen.height * 0.5;
898
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=images', w, h);
898
+									OpenServerBrowser('" . MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=images', w, h);
899 899
 								}
900 900
 								function BrowseFileServer(ctrl) {
901 901
 									lastFileCtrl = ctrl;
902 902
 									var w = screen.width * 0.5;
903 903
 									var h = screen.height * 0.5;
904
-									OpenServerBrowser('" . MODX_MANAGER_URL . "media/browser/{$which_browser}/browser.php?Type=files', w, h);
904
+									OpenServerBrowser('".MODX_MANAGER_URL."media/browser/{$which_browser}/browser.php?Type=files', w, h);
905 905
 								}
906 906
 								function SetUrlChange(el) {
907 907
 									if ('createEvent' in document) {
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 						</script>";
936 936
                         $ResourceManagerLoaded = true;
937 937
                     }
938
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '"  value="' . $field_value . '" ' . $field_style . ' onchange="documentDirty=true;" /><input type="button" value="' . $_lang['insert'] . '" onclick="BrowseFileServer(\'tv' . $field_id . '\')" />';
938
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'"  value="'.$field_value.'" '.$field_style.' onchange="documentDirty=true;" /><input type="button" value="'.$_lang['insert'].'" onclick="BrowseFileServer(\'tv'.$field_id.'\')" />';
939 939
 
940 940
                     break;
941 941
 
@@ -943,16 +943,16 @@  discard block
 block discarded – undo
943 943
                     $custom_output = '';
944 944
                     /* If we are loading a file */
945 945
                     if (substr($field_elements, 0, 5) == "@FILE") {
946
-                        $file_name = MODX_BASE_PATH . trim(substr($field_elements, 6));
946
+                        $file_name = MODX_BASE_PATH.trim(substr($field_elements, 6));
947 947
                         if (!file_exists($file_name)) {
948
-                            $custom_output = $file_name . ' does not exist';
948
+                            $custom_output = $file_name.' does not exist';
949 949
                         } else {
950 950
                             $custom_output = file_get_contents($file_name);
951 951
                         }
952 952
                     } elseif (substr($field_elements, 0, 8) == '@INCLUDE') {
953
-                        $file_name = MODX_BASE_PATH . trim(substr($field_elements, 9));
953
+                        $file_name = MODX_BASE_PATH.trim(substr($field_elements, 9));
954 954
                         if (!file_exists($file_name)) {
955
-                            $custom_output = $file_name . ' does not exist';
955
+                            $custom_output = $file_name.' does not exist';
956 956
                         } else {
957 957
                             ob_start();
958 958
                             include $file_name;
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
                         $chunk_name = trim(substr($field_elements, 7));
964 964
                         $chunk_body = $modx->getChunk($chunk_name);
965 965
                         if ($chunk_body == false) {
966
-                            $custom_output = $_lang['chunk_no_exist'] . '(' . $_lang['htmlsnippet_name'] . ':' . $chunk_name . ')';
966
+                            $custom_output = $_lang['chunk_no_exist'].'('.$_lang['htmlsnippet_name'].':'.$chunk_name.')';
967 967
                         } else {
968 968
                             $custom_output = $chunk_body;
969 969
                         }
@@ -988,15 +988,15 @@  discard block
 block discarded – undo
988 988
                     break;
989 989
 
990 990
                 default: // the default handler -- for errors, mostly
991
-                    $field_html .= '<input type="text" id="tv' . $field_id . '" name="tv' . $field_id . '" value="' . $modx->htmlspecialchars($field_value) . '" ' . $field_style . ' onchange="documentDirty=true;" />';
991
+                    $field_html .= '<input type="text" id="tv'.$field_id.'" name="tv'.$field_id.'" value="'.$modx->htmlspecialchars($field_value).'" '.$field_style.' onchange="documentDirty=true;" />';
992 992
 
993 993
             } // end switch statement
994 994
         } else {
995 995
             $custom = explode(":", $field_type);
996 996
             $custom_output = '';
997
-            $file_name = MODX_BASE_PATH . 'assets/tvs/' . $custom['1'] . '/' . $custom['1'] . '.customtv.php';
997
+            $file_name = MODX_BASE_PATH.'assets/tvs/'.$custom['1'].'/'.$custom['1'].'.customtv.php';
998 998
             if (!file_exists($file_name)) {
999
-                $custom_output = $file_name . ' does not exist';
999
+                $custom_output = $file_name.' does not exist';
1000 1000
             } else {
1001 1001
                 ob_start();
1002 1002
                 include $file_name;
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
     } // end renderFormElement function
1021 1021
 }
1022 1022
 
1023
-if (! function_exists('ParseIntputOptions')) {
1023
+if (!function_exists('ParseIntputOptions')) {
1024 1024
     /**
1025 1025
      * @param string|array|mysqli_result $v
1026 1026
      * @return array
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -573,7 +573,8 @@
 block discarded – undo
573 573
      * @return array|string
574 574
      */
575 575
     function parseInput($src, $delim = "||", $type = "string", $columns = true)
576
-    { // type can be: string, array
576
+    {
577
+// type can be: string, array
577 578
         $modx = evolutionCMS();
578 579
         if ($modx->db->isResult($src)) {
579 580
             // must be a recordset
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
                         $modx->setPlaceholder($rvKey, $rvValue);
52 52
                     }
53 53
                     $param = $modx->mergePlaceholderContent($param);
54
-                    $rs = $modx->db->query("SELECT $param;");
54
+                    $rs = $modx->db->query("select $param;");
55 55
                     $output = $rs;
56 56
                     break;
57 57
 
Please login to merge, or discard this patch.
manager/includes/src/Event.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     }
64 64
 
65 65
     /**
66
-     * @return mixed
66
+     * @return string
67 67
      */
68 68
     public function getOutput()
69 69
     {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
         if (is_array($SystemAlertMsgQueque)) {
36 36
             $title = '';
37 37
             if ($this->name && $this->activePlugin) {
38
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
38
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
39 39
             }
40 40
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
41 41
         }
Please login to merge, or discard this patch.
install/cli-install.php 1 patch
Spacing   +331 added lines, -332 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
  */
6 6
 
7 7
 $self = 'install/cli-install.php';
8
-$path = dirname(__FILE__) . '/';
9
-$base_path = str_replace($self,'',str_replace('\\','/', __FILE__));
8
+$path = dirname(__FILE__).'/';
9
+$base_path = str_replace($self, '', str_replace('\\', '/', __FILE__));
10 10
 define('MODX_API_MODE', true);
11 11
 define('MODX_BASE_PATH', $base_path);
12 12
 define('MODX_SITE_URL', '/');
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 if (is_file($base_path."assets/cache/siteManager.php")) {
20 20
     include_once($base_path."assets/cache/siteManager.php");
21 21
 }
22
-if(!defined('MGR_DIR') && is_dir($base_path."manager")) {
22
+if (!defined('MGR_DIR') && is_dir($base_path."manager")) {
23 23
     define('MGR_DIR', 'manager');
24 24
 }
25 25
 
@@ -33,43 +33,43 @@  discard block
 block discarded – undo
33 33
 $moduleSQLDataFile = $path."setup.data.sql";
34 34
 $moduleSQLResetFile = $path."setup.data.reset.sql";
35 35
 
36
-$moduleChunks = array (); // chunks - array : name, description, type - 0:file or 1:content, file or content
37
-$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content
38
-$moduleSnippets = array (); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties
39
-$modulePlugins = array (); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid
40
-$moduleModules = array (); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid
41
-$moduleTemplates = array (); // templates - array : name, description, type - 0:file or 1:content, file or content,properties
42
-$moduleTVs = array (); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties
36
+$moduleChunks = array(); // chunks - array : name, description, type - 0:file or 1:content, file or content
37
+$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content
38
+$moduleSnippets = array(); // snippets - array : name, description, type - 0:file or 1:content, file or content,properties
39
+$modulePlugins = array(); // plugins - array : name, description, type - 0:file or 1:content, file or content,properties, events,guid
40
+$moduleModules = array(); // modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid
41
+$moduleTemplates = array(); // templates - array : name, description, type - 0:file or 1:content, file or content,properties
42
+$moduleTVs = array(); // template variables - array : name, description, type - 0:file or 1:content, file or content,properties
43 43
 $moduleDependencies = array(); // module depedencies - array : module, table, column, type, name
44
-$errors= 0;
44
+$errors = 0;
45 45
 
46 46
 
47
-$installMode= 0;
47
+$installMode = 0;
48 48
 $installData = 0;
49 49
 $tableprefixauto = base_convert(rand(10, 20), 10, 36).substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), rand(0, 33), 3).'_';
50 50
 
51 51
 $args = array_slice($argv, 1);
52 52
 
53
-if ( empty($args) ){
53
+if (empty($args)) {
54 54
     echo 'Install Evolution CMS'.PHP_EOL;
55 55
     //$installYes = readline("Type 'y' to continue: ");
56 56
     //if ($installYes != 'y') return;
57 57
 
58 58
     //set param manual
59
-    $databasehost = readline($_lang['connection_screen_database_host']. ' [localhost] ');
60
-    $databaseloginname = readline($_lang['connection_screen_database_login']. ' ');
61
-    $databaseloginpassword = readline($_lang['connection_screen_database_pass']. ' ');
62
-    $database_name = readline($_lang['connection_screen_database_name']. ' ');
63
-    $tableprefix = readline($_lang['connection_screen_table_prefix']. ' ['.$tableprefixauto.'] ');
64
-    $database_connection_method = readline($_lang['connection_screen_connection_method']. ' [SET CHARACTER SET] ');
65
-    $database_collation = readline($_lang['connection_screen_collation']. ' [utf8_general_ci] ');
66
-    $cmsadmin = readline($_lang['connection_screen_default_admin_login']. ' [admin] ');
67
-    $cmsadminemail = readline($_lang['connection_screen_default_admin_email']. ' ');
68
-    $cmspassword = readline($_lang['connection_screen_default_admin_password']. ' ');
69
-    $managerlanguage = readline('Мanager language:' . ' [en] ');
70
-    $installData = readline('Instal demo-site (y/n):' . ' [n] ');
71
-
72
-}else{
59
+    $databasehost = readline($_lang['connection_screen_database_host'].' [localhost] ');
60
+    $databaseloginname = readline($_lang['connection_screen_database_login'].' ');
61
+    $databaseloginpassword = readline($_lang['connection_screen_database_pass'].' ');
62
+    $database_name = readline($_lang['connection_screen_database_name'].' ');
63
+    $tableprefix = readline($_lang['connection_screen_table_prefix'].' ['.$tableprefixauto.'] ');
64
+    $database_connection_method = readline($_lang['connection_screen_connection_method'].' [SET CHARACTER SET] ');
65
+    $database_collation = readline($_lang['connection_screen_collation'].' [utf8_general_ci] ');
66
+    $cmsadmin = readline($_lang['connection_screen_default_admin_login'].' [admin] ');
67
+    $cmsadminemail = readline($_lang['connection_screen_default_admin_email'].' ');
68
+    $cmspassword = readline($_lang['connection_screen_default_admin_password'].' ');
69
+    $managerlanguage = readline('Мanager language:'.' [en] ');
70
+    $installData = readline('Instal demo-site (y/n):'.' [n] ');
71
+
72
+} else {
73 73
 
74 74
     $cli_variables = [];
75 75
     foreach ($args as $arg) {
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 }
101 101
 
102 102
 
103
-if ($databasehost == '') { $databasehost= 'localhost'; }
104
-if ($tableprefix == ''){ $tableprefix = $tableprefixauto; }
103
+if ($databasehost == '') { $databasehost = 'localhost'; }
104
+if ($tableprefix == '') { $tableprefix = $tableprefixauto; }
105 105
 if ($database_connection_method == '') { $database_connection_method = 'SET CHARACTER SET'; }
106 106
 if ($database_collation == '') { $database_collation = 'utf8_general_ci'; }
107
-if ($cmsadmin == ''){ $cmsadmin = 'admin'; }
107
+if ($cmsadmin == '') { $cmsadmin = 'admin'; }
108 108
 if ($managerlanguage == '') { $managerlanguage = 'en'; }
109
-if ($installData == 'y') { $installData = 1;}
110
-if ($mode == 'upgrade') { $installMode = 1;}
109
+if ($installData == 'y') { $installData = 1; }
110
+if ($mode == 'upgrade') { $installMode = 1; }
111 111
 
112 112
 //добавить обработку языка
113 113
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 }
124 124
 
125 125
 //////////////////////////////////////////////////////////////////////////////////////
126
-if( ! function_exists('f_owc')){
126
+if (!function_exists('f_owc')) {
127 127
     /**
128 128
      * @param $path
129 129
      * @param $data
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
             fwrite($hnd, $data);
137 137
             fclose($hnd);
138 138
 
139
-            if(null !== $mode) chmod($path, $mode);
140
-        }catch(Exception $e){
139
+            if (null !== $mode) chmod($path, $mode);
140
+        } catch (Exception $e) {
141 141
             // Nothing, this is NOT normal
142 142
             unset($e);
143 143
         }
@@ -147,24 +147,24 @@  discard block
 block discarded – undo
147 147
 // check PHP version
148 148
 define('PHP_MIN_VERSION', '5.4.0');
149 149
 $phpMinVersion = PHP_MIN_VERSION; // Maybe not necessary. For backward compatibility
150
-echo PHP_EOL . $_lang['checking_php_version'];
150
+echo PHP_EOL.$_lang['checking_php_version'];
151 151
 // -1 if left is less, 0 if equal, +1 if left is higher
152 152
 if (version_compare(phpversion(), PHP_MIN_VERSION) < 0) {
153 153
     $errors++;
154
-    $tmp = $_lang['you_running_php'] . phpversion() . str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]);
155
-    echo $_lang['failed'] . ' ' . $tmp . PHP_EOL;
154
+    $tmp = $_lang['you_running_php'].phpversion().str_replace('[+min_version+]', PHP_MIN_VERSION, $_lang["modx_requires_php"]);
155
+    echo $_lang['failed'].' '.$tmp.PHP_EOL;
156 156
 } else {
157
-    echo $_lang['ok'] . PHP_EOL;
157
+    echo $_lang['ok'].PHP_EOL;
158 158
 }
159 159
 
160 160
 // check directories
161 161
 // cache exists?
162 162
 echo strip_tags($_lang['checking_if_cache_exist']);
163 163
 if (!file_exists($path."../assets/cache") || !file_exists($path."../assets/cache/rss")) {
164
-    echo $_lang['failed'] . PHP_EOL;
164
+    echo $_lang['failed'].PHP_EOL;
165 165
     $errors++;
166 166
 } else {
167
-    echo $_lang['ok'] . PHP_EOL;
167
+    echo $_lang['ok'].PHP_EOL;
168 168
 }
169 169
 
170 170
 
@@ -172,82 +172,82 @@  discard block
 block discarded – undo
172 172
 echo strip_tags($_lang['checking_if_cache_writable']);
173 173
 if (!is_writable($path."../assets/cache")) {
174 174
     $errors++;
175
-    echo $_lang['failed'] . PHP_EOL;
175
+    echo $_lang['failed'].PHP_EOL;
176 176
 } else {
177
-    echo $_lang['ok'] . PHP_EOL;
177
+    echo $_lang['ok'].PHP_EOL;
178 178
 }
179 179
 
180 180
 
181 181
 // cache files writable?
182 182
 echo strip_tags($_lang['checking_if_cache_file_writable']);
183 183
 $tmp = $path."../assets/cache/siteCache.idx.php";
184
-if ( ! file_exists($tmp)) {
184
+if (!file_exists($tmp)) {
185 185
     f_owc($tmp, "<?php //EVO site cache file ?>");
186 186
 }
187
-if ( ! is_writable($tmp)) {
187
+if (!is_writable($tmp)) {
188 188
     $errors++;
189
-    echo $_lang['failed'] . PHP_EOL;
189
+    echo $_lang['failed'].PHP_EOL;
190 190
 } else {
191
-    echo $_lang['ok'] . PHP_EOL;
191
+    echo $_lang['ok'].PHP_EOL;
192 192
 }
193 193
 
194 194
 
195 195
 echo strip_tags($_lang['checking_if_cache_file2_writable']);
196
-if ( ! is_writable($path."../assets/cache/sitePublishing.idx.php")) {
196
+if (!is_writable($path."../assets/cache/sitePublishing.idx.php")) {
197 197
     $errors++;
198
-    echo $_lang['failed'] . PHP_EOL;
198
+    echo $_lang['failed'].PHP_EOL;
199 199
 } else {
200
-    echo $_lang['ok'] . PHP_EOL;
200
+    echo $_lang['ok'].PHP_EOL;
201 201
 }
202 202
 
203 203
 
204 204
 // File Browser directories exists?
205 205
 echo strip_tags($_lang['checking_if_images_exist']);
206
-switch(true){
206
+switch (true) {
207 207
     case !file_exists($path."../assets/images"):
208 208
     case !file_exists($path."../assets/files"):
209 209
     case !file_exists($path."../assets/backup"):
210 210
     //case !file_exists("../assets/.thumbs"):
211 211
         $errors++;
212
-        echo $_lang['failed'] . PHP_EOL;
212
+        echo $_lang['failed'].PHP_EOL;
213 213
         break;
214 214
     default:
215
-        echo $_lang['ok'] . PHP_EOL;
215
+        echo $_lang['ok'].PHP_EOL;
216 216
 }
217 217
 
218 218
 
219 219
 // File Browser directories writable?
220 220
 echo strip_tags($_lang['checking_if_images_writable']);
221
-switch(true){
221
+switch (true) {
222 222
     case !is_writable($path."../assets/images"):
223 223
     case !is_writable($path."../assets/files"):
224 224
     case !is_writable($path."../assets/backup"):
225 225
     //case !is_writable("../assets/.thumbs"):
226 226
         $errors++;
227
-        echo $_lang['failed'] . PHP_EOL;
227
+        echo $_lang['failed'].PHP_EOL;
228 228
         break;
229 229
     default:
230
-        echo $_lang['ok'] . PHP_EOL;
230
+        echo $_lang['ok'].PHP_EOL;
231 231
 }
232 232
 
233 233
 
234 234
 // export exists?
235 235
 echo strip_tags($_lang['checking_if_export_exists']);
236 236
 if (!file_exists($path."../assets/export")) {
237
-    echo $_lang['failed'] . PHP_EOL;
237
+    echo $_lang['failed'].PHP_EOL;
238 238
     $errors++;
239 239
 } else {
240
-    echo $_lang['ok'] . PHP_EOL;
240
+    echo $_lang['ok'].PHP_EOL;
241 241
 }
242 242
 
243 243
 
244 244
 // export writable?
245 245
 echo strip_tags($_lang['checking_if_export_writable']);
246 246
 if (!is_writable($path."../assets/export")) {
247
-    echo $_lang['failed'] . PHP_EOL;
247
+    echo $_lang['failed'].PHP_EOL;
248 248
     $errors++;
249 249
 } else {
250
-    echo $_lang['ok'] . PHP_EOL;
250
+    echo $_lang['ok'].PHP_EOL;
251 251
 }
252 252
 
253 253
 
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 $isWriteable = is_writable($tmp);
263 263
 if (!$isWriteable) {
264 264
     $errors++;
265
-    echo $_lang['failed'] . PHP_EOL;
265
+    echo $_lang['failed'].PHP_EOL;
266 266
 } else {
267
-    echo $_lang['ok'] . PHP_EOL;
267
+    echo $_lang['ok'].PHP_EOL;
268 268
 }
269 269
 
270 270
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_') - 1);
281 281
     $database_connection_charset = $database_collation;
282 282
     $database_connection_method = $database_connection_method;
283
-    $dbase = '`' . $database_name . '`';
283
+    $dbase = '`'.$database_name.'`';
284 284
     $table_prefix = $tableprefix;
285 285
 }
286 286
 echo $_lang['creating_database_connection'];
@@ -320,33 +320,33 @@  discard block
 block discarded – undo
320 320
 
321 321
 // check table prefix
322 322
 if ($conn && $installMode == 0) {
323
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
324
-    if ($rs= mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
325
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
323
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
324
+    if ($rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
325
+        echo $_lang['failed'].' '.$_lang['table_prefix_already_inuse_note'].PHP_EOL;
326 326
         $errors++;
327 327
 
328 328
     } else {
329
-        echo $_lang['ok'] . PHP_EOL;
329
+        echo $_lang['ok'].PHP_EOL;
330 330
     }
331 331
 } elseif ($conn && $installMode == 2) {
332
-    echo $_lang['checking_table_prefix'] . $table_prefix . '`: ';
333
-    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
334
-        echo $_lang['failed'] . ' ' . $_lang['table_prefix_not_exist'] . PHP_EOL;
332
+    echo $_lang['checking_table_prefix'].$table_prefix.'`: ';
333
+    if (!$rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
334
+        echo $_lang['failed'].' '.$_lang['table_prefix_not_exist'].PHP_EOL;
335 335
         $errors++;
336 336
 
337 337
   } else {
338
-        echo $_lang['ok'] . PHP_EOL;
338
+        echo $_lang['ok'].PHP_EOL;
339 339
   }
340 340
 }
341 341
 
342 342
 // check mysql version
343 343
 if ($conn) {
344 344
     echo $_lang['checking_mysql_version'];
345
-    if ( version_compare(mysqli_get_server_info($conn), '5.0.51', '=') ) {
346
-        echo $_lang['warning'] . ' ' . $_lang['mysql_5051'] . PHP_EOL;
347
-        echo $_lang['mysql_5051_warning'] . PHP_EOL;
345
+    if (version_compare(mysqli_get_server_info($conn), '5.0.51', '=')) {
346
+        echo $_lang['warning'].' '.$_lang['mysql_5051'].PHP_EOL;
347
+        echo $_lang['mysql_5051_warning'].PHP_EOL;
348 348
     } else {
349
-        echo $_lang['ok'] . ' ' . $_lang['mysql_version_is'] . mysqli_get_server_info($conn) . PHP_EOL;
349
+        echo $_lang['ok'].' '.$_lang['mysql_version_is'].mysqli_get_server_info($conn).PHP_EOL;
350 350
     }
351 351
 }
352 352
 
@@ -354,20 +354,20 @@  discard block
 block discarded – undo
354 354
 if ($conn) {
355 355
     echo $_lang['checking_mysql_strict_mode'];
356 356
     $mysqlmode = mysqli_query($conn, "SELECT @@global.sql_mode");
357
-    if (mysqli_num_rows($mysqlmode) > 0){
357
+    if (mysqli_num_rows($mysqlmode) > 0) {
358 358
         $modes = mysqli_fetch_array($mysqlmode, MYSQLI_NUM);
359 359
         //$modes = array("STRICT_TRANS_TABLES"); // for testing
360 360
         // print_r($modes);
361 361
         foreach ($modes as $mode) {
362 362
             if (stristr($mode, "STRICT_TRANS_TABLES") !== false || stristr($mode, "STRICT_ALL_TABLES") !== false) {
363
-                echo $_lang['warning'] . ' ' . $_lang['strict_mode'] . PHP_EOL;
364
-                echo $_lang['strict_mode_error'] . PHP_EOL;
363
+                echo $_lang['warning'].' '.$_lang['strict_mode'].PHP_EOL;
364
+                echo $_lang['strict_mode_error'].PHP_EOL;
365 365
             } else {
366
-                echo $_lang['ok'] . PHP_EOL;
366
+                echo $_lang['ok'].PHP_EOL;
367 367
             }
368 368
         }
369 369
     } else {
370
-        echo $_lang['ok'] . PHP_EOL;
370
+        echo $_lang['ok'].PHP_EOL;
371 371
     }
372 372
 }
373 373
 // Version and strict mode check end
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
     f_owc($path."../assets/cache/installProc.inc.php", '<?php $installStartTime = '.time().'; ?>');
384 384
 }
385 385
 
386
-if($installMode > 0 && $_POST['installdata'] == "1") {
387
-    echo $_lang['sample_web_site'] . ': ' . $_lang['sample_web_site_note'] . PHP_EOL;
386
+if ($installMode > 0 && $_POST['installdata'] == "1") {
387
+    echo $_lang['sample_web_site'].': '.$_lang['sample_web_site_note'].PHP_EOL;
388 388
 }
389 389
 
390 390
 if ($errors > 0) {
391
-    echo $_lang['setup_cannot_continue'] . ' ';
391
+    echo $_lang['setup_cannot_continue'].' ';
392 392
 
393
-    if($errors > 1){
394
-        echo $errors . " " . $_lang['errors'] . $_lang['please_correct_errors'] . $_lang['and_try_again_plural'];
395
-    }else{
396
-        echo $_lang['error'] . $_lang['please_correct_error'] . $_lang['and_try_again']. PHP_EOL;
393
+    if ($errors > 1) {
394
+        echo $errors." ".$_lang['errors'].$_lang['please_correct_errors'].$_lang['and_try_again_plural'];
395
+    } else {
396
+        echo $_lang['error'].$_lang['please_correct_error'].$_lang['and_try_again'].PHP_EOL;
397 397
     }
398 398
 
399 399
     die();
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
     $database_charset = substr($database_collation, 0, strpos($database_collation, '_'));
423 423
     $database_connection_charset = $database_charset;
424 424
     $database_connection_method = $database_connection_method;
425
-    $dbase = "`" .$database_name. "`";
425
+    $dbase = "`".$database_name."`";
426 426
     $table_prefix = $tableprefix;
427 427
     $adminname = $cmsadmin;
428 428
     $adminemail = $cmsadminemail;
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 
434 434
 // set session name variable
435 435
 if (!isset ($site_sessionname)) {
436
-    $site_sessionname = 'SN' . uniqid('');
436
+    $site_sessionname = 'SN'.uniqid('');
437 437
 }
438 438
 
439 439
 // get base path and url
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
     array_pop($a);
448 448
 $pth = implode("install", $a);
449 449
 unset ($a);
450
-$base_url = $url . (substr($url, -1) != "/" ? "/" : "");
451
-$base_path = $pth . (substr($pth, -1) != "/" ? "/" : "");
450
+$base_url = $url.(substr($url, -1) != "/" ? "/" : "");
451
+$base_path = $pth.(substr($pth, -1) != "/" ? "/" : "");
452 452
 
453 453
 // connect to the database
454 454
 echo $_lang['setup_database_create_connection'].': ';
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 }
461 461
 
462 462
 // select database
463
-echo $_lang['setup_database_selection']. str_replace("`", "", $dbase) . "`: ";
463
+echo $_lang['setup_database_selection'].str_replace("`", "", $dbase)."`: ";
464 464
 if (!mysqli_select_db($conn, str_replace("`", "", $dbase))) {
465 465
     echo $_lang['setup_database_selection_failed']." ".$_lang['setup_database_selection_failed_note'].PHP_EOL;
466 466
     $create = true;
@@ -472,16 +472,16 @@  discard block
 block discarded – undo
472 472
 
473 473
 // try to create the database
474 474
 if ($create) {
475
-    echo $_lang['setup_database_creation']. str_replace("`", "", $dbase) . "`: ";
475
+    echo $_lang['setup_database_creation'].str_replace("`", "", $dbase)."`: ";
476 476
     //  if(!@mysqli_create_db(str_replace("`","",$dbase), $conn)) {
477
-    if (! mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
477
+    if (!mysqli_query($conn, "CREATE DATABASE $dbase DEFAULT CHARACTER SET $database_charset COLLATE $database_collation")) {
478 478
         echo $_lang['setup_database_creation_failed']." ".$_lang['setup_database_creation_failed_note'].PHP_EOL;
479 479
         $errors += 1;
480 480
 
481
-        echo 'database charset: ' . $database_charset . PHP_EOL;
482
-        echo 'database collation: ' . $database_collation . PHP_EOL;
481
+        echo 'database charset: '.$database_charset.PHP_EOL;
482
+        echo 'database collation: '.$database_collation.PHP_EOL;
483 483
 
484
-        echo $_lang['setup_database_creation_failed_note2'] . PHP_EOL;
484
+        echo $_lang['setup_database_creation_failed_note2'].PHP_EOL;
485 485
 
486 486
         die();
487 487
 
@@ -492,18 +492,18 @@  discard block
 block discarded – undo
492 492
 
493 493
 // check table prefix
494 494
 if ($installMode == 0) {
495
-    echo $_lang['checking_table_prefix'] . $table_prefix . "`: ";
496
-    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`")) {
497
-        echo $_lang['failed'] . " " . $_lang['table_prefix_already_inuse'] . PHP_EOL;
495
+    echo $_lang['checking_table_prefix'].$table_prefix."`: ";
496
+    if (@ $rs = mysqli_query($conn, "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`")) {
497
+        echo $_lang['failed']." ".$_lang['table_prefix_already_inuse'].PHP_EOL;
498 498
         $errors += 1;
499
-        echo $_lang['table_prefix_already_inuse_note'] . PHP_EOL;
499
+        echo $_lang['table_prefix_already_inuse_note'].PHP_EOL;
500 500
         return;
501 501
     } else {
502 502
         echo $_lang['ok'].PHP_EOL;
503 503
     }
504 504
 }
505 505
 
506
-if(!function_exists('parseProperties')) {
506
+if (!function_exists('parseProperties')) {
507 507
     /**
508 508
      * parses a resource property string and returns the result as an array
509 509
      * duplicate of method in documentParser class
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
      * @param string $propertyString
512 512
      * @return array
513 513
      */
514
-    function parseProperties($propertyString) {
515
-        $parameter= array ();
514
+    function parseProperties($propertyString){
515
+        $parameter = array();
516 516
         if (!empty ($propertyString)) {
517
-            $tmpParams= explode("&", $propertyString);
517
+            $tmpParams = explode("&", $propertyString);
518 518
             $countParams = count($tmpParams);
519
-            for ($x= 0; $x < $countParams; $x++) {
519
+            for ($x = 0; $x < $countParams; $x++) {
520 520
                 if (strpos($tmpParams[$x], '=', 0)) {
521
-                    $pTmp= explode("=", $tmpParams[$x]);
522
-                    $pvTmp= explode(";", trim($pTmp[1]));
521
+                    $pTmp = explode("=", $tmpParams[$x]);
522
+                    $pvTmp = explode(";", trim($pTmp[1]));
523 523
                     if ($pvTmp[1] == 'list' && $pvTmp[3] != "")
524
-                        $parameter[trim($pTmp[0])]= $pvTmp[3]; //list default
524
+                        $parameter[trim($pTmp[0])] = $pvTmp[3]; //list default
525 525
                     else
526 526
                         if ($pvTmp[1] != 'list' && $pvTmp[2] != "")
527
-                            $parameter[trim($pTmp[0])]= $pvTmp[2];
527
+                            $parameter[trim($pTmp[0])] = $pvTmp[2];
528 528
                 }
529 529
             }
530 530
         }
@@ -535,20 +535,20 @@  discard block
 block discarded – undo
535 535
 // check status of Inherit Parent Template plugin
536 536
 $auto_template_logic = 'parent';
537 537
 if ($installMode != 0) {
538
-    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'");
538
+    $rs = mysqli_query($conn, "SELECT properties, disabled FROM $dbase.`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'");
539 539
     $row = mysqli_fetch_row($rs);
540
-    if(!$row) {
540
+    if (!$row) {
541 541
         // not installed
542 542
         $auto_template_logic = 'system';
543 543
     } else {
544
-        if($row[1] == 1) {
544
+        if ($row[1] == 1) {
545 545
             // installed but disabled
546 546
             $auto_template_logic = 'system';
547 547
         } else {
548 548
             // installed, enabled .. see how it's configured
549 549
             $properties = parseProperties($row[0]);
550
-            if(isset($properties['inheritTemplate'])) {
551
-                if($properties['inheritTemplate'] == 'From First Sibling') {
550
+            if (isset($properties['inheritTemplate'])) {
551
+                if ($properties['inheritTemplate'] == 'From First Sibling') {
552 552
                     $auto_template_logic = 'sibling';
553 553
                 }
554 554
             }
@@ -570,17 +570,16 @@  discard block
 block discarded – undo
570 570
 
571 571
 // setup Template template files - array : name, description, type - 0:file or 1:content, parameters, category
572 572
 $mt = &$moduleTemplates;
573
-if(is_dir($templatePath) && is_readable($templatePath)) {
573
+if (is_dir($templatePath) && is_readable($templatePath)) {
574 574
     $d = dir($templatePath);
575 575
     while (false !== ($tplfile = $d->read()))
576 576
     {
577
-        if(substr($tplfile, -4) != '.tpl') continue;
577
+        if (substr($tplfile, -4) != '.tpl') continue;
578 578
         $params = parse_docblock($templatePath, $tplfile);
579
-        if(is_array($params) && (count($params)>0))
579
+        if (is_array($params) && (count($params) > 0))
580 580
         {
581 581
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
582
-            $mt[] = array
583
-            (
582
+            $mt[] = array(
584 583
                 $params['name'],
585 584
                 $description,
586 585
                 // Don't think this is gonna be used ... but adding it just in case 'type'
@@ -598,12 +597,12 @@  discard block
 block discarded – undo
598 597
 
599 598
 // setup Template Variable template files
600 599
 $mtv = &$moduleTVs;
601
-if(is_dir($tvPath) && is_readable($tvPath)) {
600
+if (is_dir($tvPath) && is_readable($tvPath)) {
602 601
     $d = dir($tvPath);
603 602
     while (false !== ($tplfile = $d->read())) {
604
-        if(substr($tplfile, -4) != '.tpl') continue;
603
+        if (substr($tplfile, -4) != '.tpl') continue;
605 604
         $params = parse_docblock($tvPath, $tplfile);
606
-        if(is_array($params) && (count($params)>0)) {
605
+        if (is_array($params) && (count($params) > 0)) {
607 606
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
608 607
             $mtv[] = array(
609 608
                 $params['name'],
@@ -615,9 +614,9 @@  discard block
 block discarded – undo
615 614
                 $params['output_widget'],
616 615
                 $params['output_widget_params'],
617 616
                 "$templatePath/{$params['filename']}", /* not currently used */
618
-                $params['template_assignments']!="*"?$params['template_assignments']:implode(",",array_map(create_function('$v','return $v[0];'),$mt)), /* comma-separated list of template names */
617
+                $params['template_assignments'] != "*" ? $params['template_assignments'] : implode(",", array_map(create_function('$v', 'return $v[0];'), $mt)), /* comma-separated list of template names */
619 618
                 $params['modx_category'],
620
-                $params['lock_tv'],  /* value should be 1 or 0 */
619
+                $params['lock_tv'], /* value should be 1 or 0 */
621 620
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
622 621
             );
623 622
         }
@@ -627,14 +626,14 @@  discard block
 block discarded – undo
627 626
 
628 627
 // setup chunks template files - array : name, description, type - 0:file or 1:content, file or content
629 628
 $mc = &$moduleChunks;
630
-if(is_dir($chunkPath) && is_readable($chunkPath)) {
629
+if (is_dir($chunkPath) && is_readable($chunkPath)) {
631 630
     $d = dir($chunkPath);
632 631
     while (false !== ($tplfile = $d->read())) {
633
-        if(substr($tplfile, -4) != '.tpl') {
632
+        if (substr($tplfile, -4) != '.tpl') {
634 633
             continue;
635 634
         }
636 635
         $params = parse_docblock($chunkPath, $tplfile);
637
-        if(is_array($params) && count($params) > 0) {
636
+        if (is_array($params) && count($params) > 0) {
638 637
             $mc[] = array(
639 638
                 $params['name'],
640 639
                 $params['description'],
@@ -650,14 +649,14 @@  discard block
 block discarded – undo
650 649
 
651 650
 // setup snippets template files - array : name, description, type - 0:file or 1:content, file or content,properties
652 651
 $ms = &$moduleSnippets;
653
-if(is_dir($snippetPath) && is_readable($snippetPath)) {
652
+if (is_dir($snippetPath) && is_readable($snippetPath)) {
654 653
     $d = dir($snippetPath);
655 654
     while (false !== ($tplfile = $d->read())) {
656
-        if(substr($tplfile, -4) != '.tpl') {
655
+        if (substr($tplfile, -4) != '.tpl') {
657 656
             continue;
658 657
         }
659 658
         $params = parse_docblock($snippetPath, $tplfile);
660
-        if(is_array($params) && count($params) > 0) {
659
+        if (is_array($params) && count($params) > 0) {
661 660
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
662 661
             $ms[] = array(
663 662
                 $params['name'],
@@ -674,14 +673,14 @@  discard block
 block discarded – undo
674 673
 
675 674
 // setup plugins template files - array : name, description, type - 0:file or 1:content, file or content,properties
676 675
 $mp = &$modulePlugins;
677
-if(is_dir($pluginPath) && is_readable($pluginPath)) {
676
+if (is_dir($pluginPath) && is_readable($pluginPath)) {
678 677
     $d = dir($pluginPath);
679 678
     while (false !== ($tplfile = $d->read())) {
680
-        if(substr($tplfile, -4) != '.tpl') {
679
+        if (substr($tplfile, -4) != '.tpl') {
681 680
             continue;
682 681
         }
683 682
         $params = parse_docblock($pluginPath, $tplfile);
684
-        if(is_array($params) && count($params) > 0) {
683
+        if (is_array($params) && count($params) > 0) {
685 684
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
686 685
             $mp[] = array(
687 686
                 $params['name'],
@@ -693,7 +692,7 @@  discard block
 block discarded – undo
693 692
                 $params['modx_category'],
694 693
                 $params['legacy_names'],
695 694
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false,
696
-                (int)$params['disabled']
695
+                (int) $params['disabled']
697 696
             );
698 697
         }
699 698
     }
@@ -703,14 +702,14 @@  discard block
 block discarded – undo
703 702
 // setup modules - array : name, description, type - 0:file or 1:content, file or content,properties, guid,enable_sharedparams
704 703
 $mm = &$moduleModules;
705 704
 $mdp = &$moduleDependencies;
706
-if(is_dir($modulePath) && is_readable($modulePath)) {
705
+if (is_dir($modulePath) && is_readable($modulePath)) {
707 706
     $d = dir($modulePath);
708 707
     while (false !== ($tplfile = $d->read())) {
709
-        if(substr($tplfile, -4) != '.tpl') {
708
+        if (substr($tplfile, -4) != '.tpl') {
710 709
             continue;
711 710
         }
712 711
         $params = parse_docblock($modulePath, $tplfile);
713
-        if(is_array($params) && count($params) > 0) {
712
+        if (is_array($params) && count($params) > 0) {
714 713
             $description = empty($params['version']) ? $params['description'] : "<strong>{$params['version']}</strong> {$params['description']}";
715 714
             $mm[] = array(
716 715
                 $params['name'],
@@ -718,12 +717,12 @@  discard block
 block discarded – undo
718 717
                 "$modulePath/{$params['filename']}",
719 718
                 $params['properties'],
720 719
                 $params['guid'],
721
-                (int)$params['shareparams'],
720
+                (int) $params['shareparams'],
722 721
                 $params['modx_category'],
723 722
                 array_key_exists('installset', $params) ? preg_split("/\s*,\s*/", $params['installset']) : false
724 723
             );
725 724
         }
726
-        if ((int)$params['shareparams'] || !empty($params['dependencies'])) {
725
+        if ((int) $params['shareparams'] || !empty($params['dependencies'])) {
727 726
             $dependencies = explode(',', $params['dependencies']);
728 727
             foreach ($dependencies as $dependency) {
729 728
                 $dependency = explode(':', $dependency);
@@ -794,103 +793,103 @@  discard block
 block discarded – undo
794 793
 // setup callback function
795 794
 $callBackFnc = "clean_up";
796 795
 
797
-function clean_up($sqlParser) {
796
+function clean_up($sqlParser){
798 797
     $ids = array();
799 798
 
800 799
     // secure web documents - privateweb
801
-    mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
802
-    $sql =  "SELECT DISTINCT sc.id
800
+    mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 0 WHERE privateweb = 1");
801
+    $sql = "SELECT DISTINCT sc.id
803 802
              FROM `".$sqlParser->prefix."site_content` sc
804 803
              LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id
805 804
              LEFT JOIN `".$sqlParser->prefix."webgroup_access` wga ON wga.documentgroup = dg.document_group
806 805
              WHERE wga.id>0";
807
-    $ds = mysqli_query($sqlParser->conn,$sql);
808
-    if(!$ds) {
806
+    $ds = mysqli_query($sqlParser->conn, $sql);
807
+    if (!$ds) {
809 808
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
810 809
     }
811 810
     else {
812
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
813
-        if(count($ids)>0) {
814
-            mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ",$ids).")");
811
+        while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"];
812
+        if (count($ids) > 0) {
813
+            mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privateweb = 1 WHERE id IN (".implode(", ", $ids).")");
815 814
             unset($ids);
816 815
         }
817 816
     }
818 817
 
819 818
     // secure manager documents privatemgr
820
-    mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
821
-    $sql =  "SELECT DISTINCT sc.id
819
+    mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 0 WHERE privatemgr = 1");
820
+    $sql = "SELECT DISTINCT sc.id
822 821
              FROM `".$sqlParser->prefix."site_content` sc
823 822
              LEFT JOIN `".$sqlParser->prefix."document_groups` dg ON dg.document = sc.id
824 823
              LEFT JOIN `".$sqlParser->prefix."membergroup_access` mga ON mga.documentgroup = dg.document_group
825 824
              WHERE mga.id>0";
826
-    $ds = mysqli_query($sqlParser->conn,$sql);
827
-    if(!$ds) {
825
+    $ds = mysqli_query($sqlParser->conn, $sql);
826
+    if (!$ds) {
828 827
         echo "An error occurred while executing a query: ".mysqli_error($sqlParser->conn);
829 828
     }
830 829
     else {
831
-        while($r = mysqli_fetch_assoc($ds)) $ids[]=$r["id"];
832
-        if(count($ids)>0) {
833
-            mysqli_query($sqlParser->conn,"UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ",$ids).")");
830
+        while ($r = mysqli_fetch_assoc($ds)) $ids[] = $r["id"];
831
+        if (count($ids) > 0) {
832
+            mysqli_query($sqlParser->conn, "UPDATE `".$sqlParser->prefix."site_content` SET privatemgr = 1 WHERE id IN (".implode(", ", $ids).")");
834 833
             unset($ids);
835 834
         }
836 835
     }
837 836
 }
838 837
 
839
-function parse_docblock($element_dir, $filename) {
838
+function parse_docblock($element_dir, $filename){
840 839
     $params = array();
841
-    $fullpath = $element_dir . '/' . $filename;
842
-    if(is_readable($fullpath)) {
840
+    $fullpath = $element_dir.'/'.$filename;
841
+    if (is_readable($fullpath)) {
843 842
         $tpl = @fopen($fullpath, "r");
844
-        if($tpl) {
843
+        if ($tpl) {
845 844
             $params['filename'] = $filename;
846 845
             $docblock_start_found = false;
847 846
             $name_found = false;
848 847
             $description_found = false;
849 848
 
850
-            while(!feof($tpl)) {
849
+            while (!feof($tpl)) {
851 850
                 $line = fgets($tpl);
852
-                if(!$docblock_start_found) {
851
+                if (!$docblock_start_found) {
853 852
                     // find docblock start
854
-                    if(strpos($line, '/**') !== false) {
853
+                    if (strpos($line, '/**') !== false) {
855 854
                         $docblock_start_found = true;
856 855
                     }
857 856
                     continue;
858
-                } elseif(!$name_found) {
857
+                } elseif (!$name_found) {
859 858
                     // find name
860 859
                     $ma = null;
861
-                    if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
860
+                    if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
862 861
                         $params['name'] = trim($ma[1]);
863 862
                         $name_found = !empty($params['name']);
864 863
                     }
865 864
                     continue;
866
-                } elseif(!$description_found) {
865
+                } elseif (!$description_found) {
867 866
                     // find description
868 867
                     $ma = null;
869
-                    if(preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
868
+                    if (preg_match("/^\s+\*\s+(.+)/", $line, $ma)) {
870 869
                         $params['description'] = trim($ma[1]);
871 870
                         $description_found = !empty($params['description']);
872 871
                     }
873 872
                     continue;
874 873
                 } else {
875 874
                     $ma = null;
876
-                    if(preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) {
875
+                    if (preg_match("/^\s+\*\s+\@([^\s]+)\s+(.+)/", $line, $ma)) {
877 876
                         $param = trim($ma[1]);
878 877
                         $val = trim($ma[2]);
879
-                        if(!empty($param) && !empty($val)) {
880
-                            if($param == 'internal') {
878
+                        if (!empty($param) && !empty($val)) {
879
+                            if ($param == 'internal') {
881 880
                                 $ma = null;
882
-                                if(preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) {
881
+                                if (preg_match("/\@([^\s]+)\s+(.+)/", $val, $ma)) {
883 882
                                     $param = trim($ma[1]);
884 883
                                     $val = trim($ma[2]);
885 884
                                 }
886 885
                                 //if($val !== '0' && (empty($param) || empty($val))) {
887
-                                if(empty($param)) {
886
+                                if (empty($param)) {
888 887
                                     continue;
889 888
                                 }
890 889
                             }
891 890
                             $params[$param] = $val;
892 891
                         }
893
-                    } elseif(preg_match("/^\s*\*\/\s*$/", $line)) {
892
+                    } elseif (preg_match("/^\s*\*\/\s*$/", $line)) {
894 893
                         break;
895 894
                     }
896 895
                 }
@@ -921,13 +920,13 @@  discard block
 block discarded – undo
921 920
     // display database results
922 921
     if ($sqlParser->installFailed == true) {
923 922
         $errors += 1;
924
-        echo $_lang['database_alerts'] . PHP_EOL;
925
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
926
-        echo $_lang['installation_error_occured'] . PHP_EOL;
923
+        echo $_lang['database_alerts'].PHP_EOL;
924
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
925
+        echo $_lang['installation_error_occured'].PHP_EOL;
927 926
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
928
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
927
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
929 928
         }
930
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
929
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
931 930
         die();
932 931
     } else {
933 932
         echo $_lang['ok'].PHP_EOL;
@@ -937,7 +936,7 @@  discard block
 block discarded – undo
937 936
 // custom or not
938 937
 if (file_exists($path."../assets/cache/siteManager.php")) {
939 938
     $mgrdir = 'include_once(dirname(__FILE__)."/../../assets/cache/siteManager.php");';
940
-}else{
939
+} else {
941 940
     $mgrdir = 'define(\'MGR_DIR\', \'manager\');';
942 941
 }
943 942
 
@@ -974,16 +973,16 @@  discard block
 block discarded – undo
974 973
 $chmodSuccess = @chmod($filename, 0404);
975 974
 
976 975
 if ($configFileFailed == true) {
977
-    echo $_lang['failed'] . PHP_EOL;
976
+    echo $_lang['failed'].PHP_EOL;
978 977
     $errors += 1;
979 978
 
980
-    echo $_lang['cant_write_config_file'] . ' ' . MGR_DIR .'/includes/config.inc.php' .PHP_EOL;
979
+    echo $_lang['cant_write_config_file'].' '.MGR_DIR.'/includes/config.inc.php'.PHP_EOL;
981 980
     echo ' '.PHP_EOL;
982 981
     echo ' '.PHP_EOL;
983 982
     echo $configString;
984 983
     echo ' '.PHP_EOL;
985 984
     echo ' '.PHP_EOL;
986
-    echo $_lang['cant_write_config_file_note'] . PHP_EOL;
985
+    echo $_lang['cant_write_config_file_note'].PHP_EOL;
987 986
     die();
988 987
 
989 988
 } else {
@@ -993,16 +992,16 @@  discard block
 block discarded – undo
993 992
 // generate new site_id and set manager theme to default
994 993
 if ($installMode == 0) {
995 994
     $siteid = uniqid('');
996
-    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
995
+    mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')");
997 996
 } else {
998 997
     // update site_id if missing
999
-    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'");
998
+    $ds = mysqli_query($sqlParser->conn, "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'");
1000 999
     if ($ds) {
1001 1000
         $r = mysqli_fetch_assoc($ds);
1002 1001
         $siteid = $r['setting_value'];
1003 1002
         if ($siteid == '' || $siteid = 'MzGeQ2faT4Dw06+U49x3') {
1004 1003
             $siteid = uniqid('');
1005
-            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
1004
+            mysqli_query($sqlParser->conn, "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')");
1006 1005
         }
1007 1006
     }
1008 1007
 }
@@ -1014,29 +1013,29 @@  discard block
 block discarded – undo
1014 1013
     // display database results
1015 1014
     if ($sqlParser->installFailed == true) {
1016 1015
         $errors += 1;
1017
-        echo $_lang['database_alerts'] . PHP_EOL;
1018
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1019
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1016
+        echo $_lang['database_alerts'].PHP_EOL;
1017
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1018
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1020 1019
         /*
1021 1020
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1022 1021
             echo "<em>" . $sqlParser->mysqlErrors[$i]["error"] . "</em>" . $_lang['during_execution_of_sql'] . "<span class='mono'>" . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . "</span>.<hr />";
1023 1022
         }
1024 1023
         echo "</p>";*/
1025
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1024
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1026 1025
         die();
1027 1026
     } else {
1028
-        echo $_lang['ok'] . PHP_EOL;
1027
+        echo $_lang['ok'].PHP_EOL;
1029 1028
     }
1030 1029
 }
1031 1030
 
1032 1031
 // Install Templates
1033 1032
 $moduleTemplate = $mt;
1034 1033
 if (!empty($moduleTemplate) || $installData) {
1035
-    echo PHP_EOL . $_lang['templates'] . ":" . PHP_EOL;
1034
+    echo PHP_EOL.$_lang['templates'].":".PHP_EOL;
1036 1035
     //$selTemplates = $_POST['template'];
1037 1036
     foreach ($moduleTemplates as $k=>$moduleTemplate) {
1038 1037
         $installSample = in_array('sample', $moduleTemplate[6]) && $installData == 1;
1039
-        if($installSample || is_array($moduleTemplate)) {
1038
+        if ($installSample || is_array($moduleTemplate)) {
1040 1039
             $name = mysqli_real_escape_string($conn, $moduleTemplate[0]);
1041 1040
             $desc = mysqli_real_escape_string($conn, $moduleTemplate[1]);
1042 1041
             $category = mysqli_real_escape_string($conn, $moduleTemplate[4]);
@@ -1044,7 +1043,7 @@  discard block
 block discarded – undo
1044 1043
             $filecontent = $moduleTemplate[3];
1045 1044
             $save_sql_id_as = $moduleTemplate[7]; // Nessecary for demo-site
1046 1045
             if (!file_exists($filecontent)) {
1047
-                echo "  $name: " . $_lang['unable_install_template'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1046
+                echo "  $name: ".$_lang['unable_install_template']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1048 1047
             } else {
1049 1048
                 // Create the category if it does not already exist
1050 1049
                 $category_id = getCreateDbCategory($category, $sqlParser);
@@ -1054,31 +1053,31 @@  discard block
 block discarded – undo
1054 1053
                 $template = mysqli_real_escape_string($conn, $template);
1055 1054
 
1056 1055
                 // See if the template already exists
1057
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'");
1056
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'");
1058 1057
 
1059 1058
                 if (mysqli_num_rows($rs)) {
1060
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1059
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked'  WHERE templatename='$name' LIMIT 1;")) {
1061 1060
                         $errors += 1;
1062
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1061
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1063 1062
                         return;
1064 1063
                     }
1065
-                    if(!is_null($save_sql_id_as)) {
1064
+                    if (!is_null($save_sql_id_as)) {
1066 1065
                         $sql_id = @mysqli_insert_id($sqlParser->conn);
1067
-                        if(!$sql_id) {
1068
-                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"));
1066
+                        if (!$sql_id) {
1067
+                            $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"));
1069 1068
                             $sql_id = $idQuery['id'];
1070 1069
                         }
1071 1070
                         $custom_placeholders[$save_sql_id_as] = $sql_id;
1072 1071
                     }
1073
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1072
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1074 1073
                 } else {
1075
-                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1074
+                    if (!@ mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');")) {
1076 1075
                         $errors += 1;
1077
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1076
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1078 1077
                         die();
1079 1078
                     }
1080
-                    if(!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1081
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1079
+                    if (!is_null($save_sql_id_as)) $custom_placeholders[$save_sql_id_as] = @mysqli_insert_id($sqlParser->conn);
1080
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1082 1081
                 }
1083 1082
             }
1084 1083
         }
@@ -1088,11 +1087,11 @@  discard block
 block discarded – undo
1088 1087
 // Install Template Variables
1089 1088
 $moduleTVs = $mtv;
1090 1089
 if (is_array($moduleTVs) || $installData) {
1091
-    echo PHP_EOL . $_lang['tvs'].': '.PHP_EOL;
1090
+    echo PHP_EOL.$_lang['tvs'].': '.PHP_EOL;
1092 1091
     //$selTVs = $_POST['tv'];
1093 1092
     foreach ($moduleTVs as $k=>$moduleTV) {
1094 1093
         $installSample = in_array('sample', $moduleTV[12]) && $installData == 1;
1095
-        if($installSample || is_array($moduleTVs)) {
1094
+        if ($installSample || is_array($moduleTVs)) {
1096 1095
             $name = mysqli_real_escape_string($conn, $moduleTV[0]);
1097 1096
             $caption = mysqli_real_escape_string($conn, $moduleTV[1]);
1098 1097
             $desc = mysqli_real_escape_string($conn, $moduleTV[2]);
@@ -1110,24 +1109,24 @@  discard block
 block discarded – undo
1110 1109
             // Create the category if it does not already exist
1111 1110
             $category = getCreateDbCategory($category, $sqlParser);
1112 1111
 
1113
-            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'");
1112
+            $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'");
1114 1113
             if (mysqli_num_rows($rs)) {
1115 1114
                 $insert = true;
1116
-                while($row = mysqli_fetch_assoc($rs)) {
1117
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
1118
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1115
+                while ($row = mysqli_fetch_assoc($rs)) {
1116
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_tmplvars` SET type='$input_type', caption='$caption', description='$desc', category=$category, locked=$locked, elements='$input_options', display='$output_widget', display_params='$output_widget_params', default_text='$input_default' WHERE id={$row['id']};")) {
1117
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1119 1118
                         return;
1120 1119
                     }
1121 1120
                     $insert = false;
1122 1121
                 }
1123
-                echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1122
+                echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1124 1123
             } else {
1125
-                $q = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
1124
+                $q = "INSERT INTO $dbase.`".$table_prefix."site_tmplvars` (type,name,caption,description,category,locked,elements,display,display_params,default_text) VALUES('$input_type','$name','$caption','$desc',$category,$locked,'$input_options','$output_widget','$output_widget_params','$input_default');";
1126 1125
                 if (!mysqli_query($sqlParser->conn, $q)) {
1127
-                    echo mysqli_error($sqlParser->conn) . PHP_EOL;
1126
+                    echo mysqli_error($sqlParser->conn).PHP_EOL;
1128 1127
                     return;
1129 1128
                 }
1130
-                echo "  $name: " . $_lang['installed'] . PHP_EOL;
1129
+                echo "  $name: ".$_lang['installed'].PHP_EOL;
1131 1130
             }
1132 1131
 
1133 1132
             // add template assignments
@@ -1136,10 +1135,10 @@  discard block
 block discarded – undo
1136 1135
             if (count($assignments) > 0) {
1137 1136
 
1138 1137
                 // remove existing tv -> template assignments
1139
-                $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1138
+                $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';");
1140 1139
                 $row = mysqli_fetch_assoc($ds);
1141 1140
                 $id = $row["id"];
1142
-                mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\'');
1141
+                mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\'');
1143 1142
 
1144 1143
                 // add tv -> template assignments
1145 1144
                 foreach ($assignments as $assignment) {
@@ -1148,7 +1147,7 @@  discard block
 block discarded – undo
1148 1147
                     if ($ds && $ts) {
1149 1148
                         $tRow = mysqli_fetch_assoc($ts);
1150 1149
                         $templateId = $tRow['id'];
1151
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1150
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)");
1152 1151
                    }
1153 1152
                 }
1154 1153
             }
@@ -1159,12 +1158,12 @@  discard block
 block discarded – undo
1159 1158
 
1160 1159
 $moduleChunks = $mc;
1161 1160
 // Install Chunks
1162
-if (is_array ($moduleChunks) || $installData) {
1163
-    echo PHP_EOL . $_lang['chunks'] . ": " . PHP_EOL;
1161
+if (is_array($moduleChunks) || $installData) {
1162
+    echo PHP_EOL.$_lang['chunks'].": ".PHP_EOL;
1164 1163
     foreach ($moduleChunks as $k=>$moduleChunk) {
1165 1164
         $installSample = in_array('sample', $moduleChunk[5]) && $installData == 1;
1166 1165
         $count_new_name = 0;
1167
-        if($installSample || is_array ($moduleChunks)) {
1166
+        if ($installSample || is_array($moduleChunks)) {
1168 1167
 
1169 1168
             $name = mysqli_real_escape_string($conn, $moduleChunk[0]);
1170 1169
             $desc = mysqli_real_escape_string($conn, $moduleChunk[1]);
@@ -1173,7 +1172,7 @@  discard block
 block discarded – undo
1173 1172
             $filecontent = $moduleChunk[2];
1174 1173
 
1175 1174
             if (!file_exists($filecontent))
1176
-                echo "  $name: " . $_lang['unable_install_chunk'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1175
+                echo "  $name: ".$_lang['unable_install_chunk']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1177 1176
             else {
1178 1177
 
1179 1178
                 // Create the category if it does not already exist
@@ -1181,31 +1180,31 @@  discard block
 block discarded – undo
1181 1180
 
1182 1181
                 $chunk = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', file_get_contents($filecontent), 1);
1183 1182
                 $chunk = mysqli_real_escape_string($conn, $chunk);
1184
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'");
1183
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'");
1185 1184
                 $count_original_name = mysqli_num_rows($rs);
1186
-                if($overwrite == 'false') {
1187
-                    $newname = $name . '-' . str_replace('.', '_', $modx_version);
1188
-                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'");
1185
+                if ($overwrite == 'false') {
1186
+                    $newname = $name.'-'.str_replace('.', '_', $modx_version);
1187
+                    $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'");
1189 1188
                     $count_new_name = mysqli_num_rows($rs);
1190 1189
                 }
1191 1190
                 $update = $count_original_name > 0 && $overwrite == 'true';
1192 1191
                 if ($update) {
1193
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1192
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) {
1194 1193
                         $errors += 1;
1195
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1194
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1196 1195
                         return;
1197 1196
                     }
1198
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1199
-                } elseif($count_new_name == 0) {
1200
-                    if($count_original_name > 0 && $overwrite == 'false') {
1197
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1198
+                } elseif ($count_new_name == 0) {
1199
+                    if ($count_original_name > 0 && $overwrite == 'false') {
1201 1200
                         $name = $newname;
1202 1201
                     }
1203
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1202
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);")) {
1204 1203
                         $errors += 1;
1205
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1204
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1206 1205
                         return;
1207 1206
                     }
1208
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1207
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1209 1208
                 }
1210 1209
             }
1211 1210
         }
@@ -1215,11 +1214,11 @@  discard block
 block discarded – undo
1215 1214
 // Install Modules
1216 1215
 $moduleModules = $mm;
1217 1216
 if (is_array($moduleModules) || $installData) {
1218
-    echo PHP_EOL . $_lang['modules'] . ":" . PHP_EOL;
1217
+    echo PHP_EOL.$_lang['modules'].":".PHP_EOL;
1219 1218
     //$selModules = $_POST['module'];
1220 1219
     foreach ($moduleModules as $k=>$moduleModule) {
1221 1220
         $installSample = in_array('sample', $moduleModule[7]) && $installData == 1;
1222
-        if($installSample || is_array($moduleModules)) {
1221
+        if ($installSample || is_array($moduleModules)) {
1223 1222
             $name = mysqli_real_escape_string($conn, $moduleModule[0]);
1224 1223
             $desc = mysqli_real_escape_string($conn, $moduleModule[1]);
1225 1224
             $filecontent = $moduleModule[2];
@@ -1228,7 +1227,7 @@  discard block
 block discarded – undo
1228 1227
             $shared = mysqli_real_escape_string($conn, $moduleModule[5]);
1229 1228
             $category = mysqli_real_escape_string($conn, $moduleModule[6]);
1230 1229
             if (!file_exists($filecontent))
1231
-                echo "  $name: " . $_lang['unable_install_module'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1230
+                echo "  $name: ".$_lang['unable_install_module']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1232 1231
             else {
1233 1232
 
1234 1233
                 // Create the category if it does not already exist
@@ -1237,24 +1236,24 @@  discard block
 block discarded – undo
1237 1236
                 $module = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
1238 1237
                 // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab
1239 1238
                 $module = mysqli_real_escape_string($conn, $module);
1240
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'");
1239
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'");
1241 1240
                 if (mysqli_num_rows($rs)) {
1242 1241
                     $row = mysqli_fetch_assoc($rs);
1243
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1244
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1245
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1242
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1243
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) {
1244
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1246 1245
                         return;
1247 1246
                     }
1248
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1247
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1249 1248
                 } else {
1250
-                    if ($properties != NULL ){
1249
+                    if ($properties != NULL) {
1251 1250
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1252 1251
                     }
1253
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1254
-                        echo "<p>" . mysqli_error($sqlParser->conn) . "</p>";
1252
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) {
1253
+                        echo "<p>".mysqli_error($sqlParser->conn)."</p>";
1255 1254
                         return;
1256 1255
                     }
1257
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1256
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1258 1257
                 }
1259 1258
             }
1260 1259
         }
@@ -1264,11 +1263,11 @@  discard block
 block discarded – undo
1264 1263
 // Install Plugins
1265 1264
 $modulePlugins = $mp;
1266 1265
 if (is_array($modulePlugins) || $installData) {
1267
-    echo PHP_EOL . $_lang['plugins'] . ":" . PHP_EOL;
1266
+    echo PHP_EOL.$_lang['plugins'].":".PHP_EOL;
1268 1267
     $selPlugs = $_POST['plugin'];
1269 1268
     foreach ($modulePlugins as $k=>$modulePlugin) {
1270 1269
         //$installSample = in_array('sample', $modulePlugin[8]) && $installData == 1;
1271
-        if($installSample || is_array($modulePlugins)) {
1270
+        if ($installSample || is_array($modulePlugins)) {
1272 1271
             $name = mysqli_real_escape_string($conn, $modulePlugin[0]);
1273 1272
             $desc = mysqli_real_escape_string($conn, $modulePlugin[1]);
1274 1273
             $filecontent = $modulePlugin[2];
@@ -1278,17 +1277,17 @@  discard block
 block discarded – undo
1278 1277
             $category = mysqli_real_escape_string($conn, $modulePlugin[6]);
1279 1278
             $leg_names = '';
1280 1279
             $disabled = $modulePlugin[9];
1281
-            if(array_key_exists(7, $modulePlugin)) {
1280
+            if (array_key_exists(7, $modulePlugin)) {
1282 1281
                 // parse comma-separated legacy names and prepare them for sql IN clause
1283
-                $leg_names = "'" . implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7]))) . "'";
1282
+                $leg_names = "'".implode("','", preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])))."'";
1284 1283
             }
1285 1284
             if (!file_exists($filecontent))
1286
-                echo "  $name: " . $_lang['unable_install_plugin'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1285
+                echo "  $name: ".$_lang['unable_install_plugin']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1287 1286
             else {
1288 1287
 
1289 1288
                 // disable legacy versions based on legacy_names provided
1290
-                if(!empty($leg_names)) {
1291
-                    $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1289
+                if (!empty($leg_names)) {
1290
+                    $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);";
1292 1291
                     $rs = mysqli_query($sqlParser->conn, $update_query);
1293 1292
                 }
1294 1293
 
@@ -1298,52 +1297,52 @@  discard block
 block discarded – undo
1298 1297
                 $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2));
1299 1298
                 $plugin = removeDocblock($plugin, 'plugin');
1300 1299
                 $plugin = mysqli_real_escape_string($conn, $plugin);
1301
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'");
1300
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'");
1302 1301
                 if (mysqli_num_rows($rs)) {
1303 1302
                     $insert = true;
1304
-                    while($row = mysqli_fetch_assoc($rs)) {
1305
-                        $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1306
-                        if($row['description'] == $desc){
1307
-                            if (! mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1308
-                                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1303
+                    while ($row = mysqli_fetch_assoc($rs)) {
1304
+                        $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1305
+                        if ($row['description'] == $desc) {
1306
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};")) {
1307
+                                echo mysqli_error($sqlParser->conn).PHP_EOL;
1309 1308
                                 return;
1310 1309
                             }
1311 1310
                             $insert = false;
1312 1311
                         } else {
1313
-                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1312
+                            if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};")) {
1314 1313
                                 echo mysqli_error($sqlParser->conn).PHP_EOL;
1315 1314
                                 return;
1316 1315
                             }
1317 1316
                         }
1318 1317
                     }
1319
-                    if($insert === true) {
1320
-                        $properties = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1321
-                        if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1318
+                    if ($insert === true) {
1319
+                        $properties = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1320
+                        if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$properties','$guid','0',$category);")) {
1322 1321
                             echo mysqli_error($sqlParser->conn).PHP_EOL;
1323 1322
                             return;
1324 1323
                         }
1325 1324
                     }
1326
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1325
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1327 1326
                 } else {
1328
-                    if ($properties != NULL ){
1327
+                    if ($properties != NULL) {
1329 1328
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1330 1329
                     }
1331
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1332
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1330
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);")) {
1331
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1333 1332
                         return;
1334 1333
                     }
1335
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1334
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1336 1335
                 }
1337 1336
                 // add system events
1338 1337
                 if (count($events) > 0) {
1339
-                    $ds=mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1338
+                    $ds = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';");
1340 1339
                     if ($ds) {
1341 1340
                         $row = mysqli_fetch_assoc($ds);
1342 1341
                         $id = $row["id"];
1343 1342
                         // remove existing events
1344
-                        mysqli_query($sqlParser->conn, 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_plugin_events` WHERE pluginid = \'' . $id . '\'');
1343
+                        mysqli_query($sqlParser->conn, 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_plugin_events` WHERE pluginid = \''.$id.'\'');
1345 1344
                         // add new events
1346
-                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`" . $table_prefix . "system_eventnames` se WHERE name IN ('" . implode("','", $events) . "')");
1345
+                        mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugin_events` (pluginid, evtid) SELECT '$id' as 'pluginid',se.id as 'evtid' FROM $dbase.`".$table_prefix."system_eventnames` se WHERE name IN ('".implode("','", $events)."')");
1347 1346
                     }
1348 1347
                 }
1349 1348
             }
@@ -1354,18 +1353,18 @@  discard block
 block discarded – undo
1354 1353
 // Install Snippets
1355 1354
 $moduleSnippet = $ms;
1356 1355
 if (is_array($moduleSnippet) || $installData) {
1357
-    echo PHP_EOL . $_lang['snippets'] . ":" . PHP_EOL;
1356
+    echo PHP_EOL.$_lang['snippets'].":".PHP_EOL;
1358 1357
     //$selSnips = $_POST['snippet'];
1359 1358
     foreach ($moduleSnippets as $k=>$moduleSnippet) {
1360 1359
         $installSample = in_array('sample', $moduleSnippet[5]) && $installData == 1;
1361
-        if($installSample || is_array($moduleSnippet)) {
1360
+        if ($installSample || is_array($moduleSnippet)) {
1362 1361
             $name = mysqli_real_escape_string($conn, $moduleSnippet[0]);
1363 1362
             $desc = mysqli_real_escape_string($conn, $moduleSnippet[1]);
1364 1363
             $filecontent = $moduleSnippet[2];
1365 1364
             $properties = $moduleSnippet[3];
1366 1365
             $category = mysqli_real_escape_string($conn, $moduleSnippet[4]);
1367 1366
             if (!file_exists($filecontent))
1368
-                echo "  $name: " . $_lang['unable_install_snippet'] . " '$filecontent' " . $_lang['not_found'] . PHP_EOL;
1367
+                echo "  $name: ".$_lang['unable_install_snippet']." '$filecontent' ".$_lang['not_found'].PHP_EOL;
1369 1368
             else {
1370 1369
 
1371 1370
                 // Create the category if it does not already exist
@@ -1374,24 +1373,24 @@  discard block
 block discarded – undo
1374 1373
                 $snippet = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent)));
1375 1374
                 $snippet = removeDocblock($snippet, 'snippet');
1376 1375
                 $snippet = mysqli_real_escape_string($conn, $snippet);
1377
-                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'");
1376
+                $rs = mysqli_query($sqlParser->conn, "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'");
1378 1377
                 if (mysqli_num_rows($rs)) {
1379 1378
                     $row = mysqli_fetch_assoc($rs);
1380
-                    $props = mysqli_real_escape_string($conn, propUpdate($properties,$row['properties']));
1381
-                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1382
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1379
+                    $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties']));
1380
+                    if (!mysqli_query($sqlParser->conn, "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) {
1381
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1383 1382
                         return;
1384 1383
                     }
1385
-                    echo "  $name: " . $_lang['upgraded'] . PHP_EOL;
1384
+                    echo "  $name: ".$_lang['upgraded'].PHP_EOL;
1386 1385
                 } else {
1387
-                    if ($properties != NULL ){
1386
+                    if ($properties != NULL) {
1388 1387
                         $properties = mysqli_real_escape_string($conn, parseProperties($properties, true));
1389 1388
                     }
1390
-                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1391
-                        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1389
+                    if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) {
1390
+                        echo mysqli_error($sqlParser->conn).PHP_EOL;
1392 1391
                         return;
1393 1392
                     }
1394
-                    echo "  $name: " . $_lang['installed'] . PHP_EOL;
1393
+                    echo "  $name: ".$_lang['installed'].PHP_EOL;
1395 1394
                 }
1396 1395
             }
1397 1396
         }
@@ -1400,24 +1399,24 @@  discard block
 block discarded – undo
1400 1399
 
1401 1400
 // Install demo-site
1402 1401
 if ($installData && $moduleSQLDataFile) {
1403
-    echo PHP_EOL . $_lang['installing_demo_site'];
1402
+    echo PHP_EOL.$_lang['installing_demo_site'];
1404 1403
     $sqlParser->process($moduleSQLDataFile);
1405 1404
     // display database results
1406 1405
     if ($sqlParser->installFailed == true) {
1407 1406
         $errors += 1;
1408
-        echo $_lang['database_alerts'] . PHP_EOL;
1409
-        echo $_lang['setup_couldnt_install'] . PHP_EOL;
1410
-        echo $_lang['installation_error_occured'] . PHP_EOL . PHP_EOL;
1407
+        echo $_lang['database_alerts'].PHP_EOL;
1408
+        echo $_lang['setup_couldnt_install'].PHP_EOL;
1409
+        echo $_lang['installation_error_occured'].PHP_EOL.PHP_EOL;
1411 1410
         for ($i = 0; $i < count($sqlParser->mysqlErrors); $i++) {
1412
-            echo $sqlParser->mysqlErrors[$i]["error"] . " " . $_lang['during_execution_of_sql'] . " " . strip_tags($sqlParser->mysqlErrors[$i]["sql"]) . PHP_EOL;
1411
+            echo $sqlParser->mysqlErrors[$i]["error"]." ".$_lang['during_execution_of_sql']." ".strip_tags($sqlParser->mysqlErrors[$i]["sql"]).PHP_EOL;
1413 1412
         }
1414 1413
 
1415
-        echo $_lang['some_tables_not_updated'] . PHP_EOL;
1414
+        echo $_lang['some_tables_not_updated'].PHP_EOL;
1416 1415
         return;
1417 1416
     } else {
1418 1417
         $sql = sprintf("SELECT id FROM `%ssite_templates` WHERE templatename='EVO startup - Bootstrap'", $sqlParser->prefix);
1419 1418
         $rs = mysqli_query($sqlParser->conn, $sql);
1420
-        if(mysqli_num_rows($rs)) {
1419
+        if (mysqli_num_rows($rs)) {
1421 1420
             $row = mysqli_fetch_assoc($rs);
1422 1421
             $sql = sprintf('UPDATE `%ssite_content` SET template=%s WHERE template=4', $sqlParser->prefix, $row['id']);
1423 1422
             mysqli_query($sqlParser->conn, $sql);
@@ -1429,9 +1428,9 @@  discard block
 block discarded – undo
1429 1428
 // Install Dependencies
1430 1429
 $moduleDependencies = $mdp;
1431 1430
 foreach ($moduleDependencies as $dependency) {
1432
-    $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"');
1431
+    $ds = mysqli_query($sqlParser->conn, 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"');
1433 1432
     if (!$ds) {
1434
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1433
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1435 1434
         return;
1436 1435
     } else {
1437 1436
         $row = mysqli_fetch_assoc($ds);
@@ -1439,37 +1438,37 @@  discard block
 block discarded – undo
1439 1438
         $moduleGuid = $row["guid"];
1440 1439
     }
1441 1440
     // get extra id
1442
-    $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"');
1441
+    $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"');
1443 1442
     if (!$ds) {
1444
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1443
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1445 1444
         return;
1446 1445
     } else {
1447 1446
         $row = mysqli_fetch_assoc($ds);
1448 1447
         $extraId = $row["id"];
1449 1448
     }
1450 1449
     // setup extra as module dependency
1451
-    $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1');
1450
+    $ds = mysqli_query($sqlParser->conn, 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1');
1452 1451
     if (!$ds) {
1453
-        echo mysqli_error($sqlParser->conn) . PHP_EOL;
1452
+        echo mysqli_error($sqlParser->conn).PHP_EOL;
1454 1453
         return;
1455 1454
     } else {
1456 1455
         if (mysqli_num_rows($ds) === 0) {
1457
-            mysqli_query($sqlParser->conn, 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')');
1458
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_create'] . PHP_EOL;
1456
+            mysqli_query($sqlParser->conn, 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')');
1457
+            echo $dependency['module'].' Module: '.$_lang['depedency_create'].PHP_EOL;
1459 1458
         } else {
1460
-            mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` SET module = ' . $moduleId . ', resource = ' . $extraId . ', type = ' . $dependency['type'] . ' WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type']);
1461
-            echo $dependency['module'] . ' Module: ' . $_lang['depedency_update'] . PHP_EOL;
1459
+            mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` SET module = '.$moduleId.', resource = '.$extraId.', type = '.$dependency['type'].' WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type']);
1460
+            echo $dependency['module'].' Module: '.$_lang['depedency_update'].PHP_EOL;
1462 1461
         }
1463 1462
         if ($dependency['type'] == 30 || $dependency['type'] == 40) {
1464 1463
             // set extra guid for plugins and snippets
1465
-            $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1');
1464
+            $ds = mysqli_query($sqlParser->conn, 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1');
1466 1465
             if (!$ds) {
1467
-                echo mysqli_error($sqlParser->conn) . PHP_EOL;
1466
+                echo mysqli_error($sqlParser->conn).PHP_EOL;
1468 1467
                 return;
1469 1468
             } else {
1470 1469
                 if (mysqli_num_rows($ds) != 0) {
1471
-                    mysqli_query($sqlParser->conn, 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId);
1472
-                    echo $dependency['name'] . ': ' . $_lang['guid_set'] . PHP_EOL;
1470
+                    mysqli_query($sqlParser->conn, 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId);
1471
+                    echo $dependency['name'].': '.$_lang['guid_set'].PHP_EOL;
1473 1472
                 }
1474 1473
             }
1475 1474
         }
@@ -1478,7 +1477,7 @@  discard block
 block discarded – undo
1478 1477
 
1479 1478
 // call back function
1480 1479
 if ($callBackFnc != "")
1481
-    $callBackFnc ($sqlParser);
1480
+    $callBackFnc($sqlParser);
1482 1481
 
1483 1482
 // Setup the MODX API -- needed for the cache processor
1484 1483
 if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
@@ -1510,17 +1509,17 @@  discard block
 block discarded – undo
1510 1509
 }
1511 1510
 
1512 1511
 // setup completed!
1513
-echo PHP_EOL . $_lang['installation_successful'] . PHP_EOL . PHP_EOL;
1512
+echo PHP_EOL.$_lang['installation_successful'].PHP_EOL.PHP_EOL;
1514 1513
 //echo "<p>" . $_lang['to_log_into_content_manager'] . "</p>";
1515 1514
 if ($installMode == 0) {
1516
-   echo strip_tags($_lang['installation_note']) . PHP_EOL;
1515
+   echo strip_tags($_lang['installation_note']).PHP_EOL;
1517 1516
 } else {
1518
-   echo strip_tags($_lang['upgrade_note']) . PHP_EOL;
1517
+   echo strip_tags($_lang['upgrade_note']).PHP_EOL;
1519 1518
 }
1520 1519
 
1521 1520
 
1522
-if ( empty($args) ){
1523
-    echo PHP_EOL . 'Remove install folder?'.PHP_EOL;
1521
+if (empty($args)) {
1522
+    echo PHP_EOL.'Remove install folder?'.PHP_EOL;
1524 1523
     $removeInstall = readline("Type 'y' or 'n' to continue: ");
1525 1524
 }
1526 1525
 //remove installFolder
@@ -1528,7 +1527,7 @@  discard block
 block discarded – undo
1528 1527
     removeFolder($path);
1529 1528
     removeFolder($base_path.'.tx');
1530 1529
     unlink($base_path.'README.md');
1531
-    echo 'Install folder deleted!'. PHP_EOL . PHP_EOL;
1530
+    echo 'Install folder deleted!'.PHP_EOL.PHP_EOL;
1532 1531
 }
1533 1532
 
1534 1533
 /**
@@ -1567,11 +1566,11 @@  discard block
 block discarded – undo
1567 1566
  * @param string $old
1568 1567
  * @return string
1569 1568
  */
1570
-function propUpdate($new,$old){
1569
+function propUpdate($new, $old){
1571 1570
     $newArr = parseProperties($new);
1572 1571
     $oldArr = parseProperties($old);
1573
-    foreach ($oldArr as $k => $v){
1574
-        if (isset($v['0']['options'])){
1572
+    foreach ($oldArr as $k => $v) {
1573
+        if (isset($v['0']['options'])) {
1575 1574
             $oldArr[$k]['0']['options'] = $newArr[$k]['0']['options'];
1576 1575
         }
1577 1576
     }
@@ -1586,30 +1585,30 @@  discard block
 block discarded – undo
1586 1585
  * @param bool|mixed $json
1587 1586
  * @return string
1588 1587
  */
1589
-function parseProperties($propertyString, $json=false) {
1590
-    $propertyString = str_replace('{}', '', $propertyString );
1591
-    $propertyString = str_replace('} {', ',', $propertyString );
1588
+function parseProperties($propertyString, $json = false){
1589
+    $propertyString = str_replace('{}', '', $propertyString);
1590
+    $propertyString = str_replace('} {', ',', $propertyString);
1592 1591
 
1593
-    if(empty($propertyString)) return array();
1594
-    if($propertyString=='{}' || $propertyString=='[]') return array();
1592
+    if (empty($propertyString)) return array();
1593
+    if ($propertyString == '{}' || $propertyString == '[]') return array();
1595 1594
 
1596 1595
     $jsonFormat = isJson($propertyString, true);
1597 1596
     $property = array();
1598 1597
     // old format
1599
-    if ( $jsonFormat === false) {
1600
-        $props= explode('&', $propertyString);
1598
+    if ($jsonFormat === false) {
1599
+        $props = explode('&', $propertyString);
1601 1600
         foreach ($props as $prop) {
1602 1601
             $prop = trim($prop);
1603
-            if($prop === '') {
1602
+            if ($prop === '') {
1604 1603
                 continue;
1605 1604
             }
1606 1605
 
1607 1606
             $arr = explode(';', $prop);
1608
-            if( ! is_array($arr)) {
1607
+            if (!is_array($arr)) {
1609 1608
                 $arr = array();
1610 1609
             }
1611 1610
             $key = explode('=', isset($arr[0]) ? $arr[0] : '');
1612
-            if( ! is_array($key) || empty($key[0])) {
1611
+            if (!is_array($key) || empty($key[0])) {
1613 1612
                 continue;
1614 1613
             }
1615 1614
 
@@ -1633,7 +1632,7 @@  discard block
 block discarded – undo
1633 1632
 
1634 1633
         }
1635 1634
     // new json-format
1636
-    } else if(!empty($jsonFormat)){
1635
+    } else if (!empty($jsonFormat)) {
1637 1636
         $property = $jsonFormat;
1638 1637
     }
1639 1638
     if ($json) {
@@ -1648,7 +1647,7 @@  discard block
 block discarded – undo
1648 1647
  * @param bool $returnData
1649 1648
  * @return bool|mixed
1650 1649
  */
1651
-function isJson($string, $returnData=false) {
1650
+function isJson($string, $returnData = false){
1652 1651
     $data = json_decode($string, true);
1653 1652
     return (json_last_error() == JSON_ERROR_NONE) ? ($returnData ? $data : true) : false;
1654 1653
 }
@@ -1658,20 +1657,20 @@  discard block
 block discarded – undo
1658 1657
  * @param SqlParser $sqlParser
1659 1658
  * @return int
1660 1659
  */
1661
-function getCreateDbCategory($category, $sqlParser) {
1660
+function getCreateDbCategory($category, $sqlParser){
1662 1661
     $dbase = $sqlParser->dbname;
1663
-    $dbase = '`' . trim($dbase,'`') . '`';
1662
+    $dbase = '`'.trim($dbase, '`').'`';
1664 1663
     $table_prefix = $sqlParser->prefix;
1665 1664
     $category_id = 0;
1666
-    if(!empty($category)) {
1665
+    if (!empty($category)) {
1667 1666
         $category = mysqli_real_escape_string($sqlParser->conn, $category);
1668 1667
         $rs = mysqli_query($sqlParser->conn, "SELECT id FROM $dbase.`".$table_prefix."categories` WHERE category = '".$category."'");
1669
-        if(mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
1668
+        if (mysqli_num_rows($rs) && ($row = mysqli_fetch_assoc($rs))) {
1670 1669
             $category_id = $row['id'];
1671 1670
         } else {
1672 1671
             $q = "INSERT INTO $dbase.`".$table_prefix."categories` (`category`) VALUES ('{$category}');";
1673 1672
             $rs = mysqli_query($sqlParser->conn, $q);
1674
-            if($rs) {
1673
+            if ($rs) {
1675 1674
                 $category_id = mysqli_insert_id($sqlParser->conn);
1676 1675
             }
1677 1676
         }
@@ -1686,12 +1685,12 @@  discard block
 block discarded – undo
1686 1685
  * @param string $type
1687 1686
  * @return string
1688 1687
  */
1689
-function removeDocblock($code, $type) {
1688
+function removeDocblock($code, $type){
1690 1689
 
1691 1690
     $cleaned = preg_replace("/^.*?\/\*\*.*?\*\/\s+/s", '', $code, 1);
1692 1691
 
1693 1692
     // Procedure taken from plugin.filesource.php
1694
-    switch($type) {
1693
+    switch ($type) {
1695 1694
         case 'snippet':
1696 1695
             $elm_name = 'snippets';
1697 1696
             $include = 'return require';
@@ -1707,7 +1706,7 @@  discard block
 block discarded – undo
1707 1706
         default:
1708 1707
             return $cleaned;
1709 1708
     };
1710
-    if(substr(trim($cleaned),0,$count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
1709
+    if (substr(trim($cleaned), 0, $count) == $include.' MODX_BASE_PATH.\'assets/'.$elm_name.'/')
1711 1710
         return $cleaned;
1712 1711
 
1713 1712
     // fileBinding not found - return code incl docblock
Please login to merge, or discard this patch.
manager/includes/error.class.inc.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * @deprecated EvolutionCMS\Legacy\ErrorHandler
6 6
  * @todo could be unnecessary
7 7
  */
8
-class errorHandler extends EvolutionCMS\Legacy\ErrorHandler {
8
+class errorHandler extends EvolutionCMS\Legacy\ErrorHandler{
9 9
     public function include_lang($context = 'common')
10 10
     {
11 11
         parent::includeLang($context);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,8 @@
 block discarded – undo
5 5
  * @deprecated EvolutionCMS\Legacy\ErrorHandler
6 6
  * @todo could be unnecessary
7 7
  */
8
-class errorHandler extends EvolutionCMS\Legacy\ErrorHandler {
8
+class errorHandler extends EvolutionCMS\Legacy\ErrorHandler
9
+{
9 10
     public function include_lang($context = 'common')
10 11
     {
11 12
         parent::includeLang($context);
Please login to merge, or discard this patch.
manager/includes/log.class.inc.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,4 +3,6 @@
 block discarded – undo
3 3
 /**
4 4
  * @deprecated use EvolutionCMS\Legacy\LogHandler
5 5
  */
6
-class logHandler extends EvolutionCMS\Legacy\LogHandler{}
6
+class logHandler extends EvolutionCMS\Legacy\LogHandler
7
+{
8
+}
Please login to merge, or discard this patch.
manager/includes/src/Legacy/mgrResources.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php namespace EvolutionCMS\Legacy;
2 2
 
3
-class mgrResources {
3
+class mgrResources{
4 4
     /**
5 5
      * @var array
6 6
      */
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     /**
22 22
      * mgrResources constructor.
23 23
      */
24
-    public function __construct() {
24
+    public function __construct(){
25 25
         $this->setTypes();
26 26
         $this->queryItemsFromDB();
27 27
         $this->prepareCategoryArrays();
@@ -30,47 +30,47 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * @return void
32 32
      */
33
-    public function setTypes() {
33
+    public function setTypes(){
34 34
         global $_lang;
35
-        $this->types['site_templates']    = array(
35
+        $this->types['site_templates'] = array(
36 36
             'title'=>$_lang["manage_templates"],
37
-            'actions'=>array( 'edit'=>array(16,'edit_template'), 'duplicate'=>array(96,'new_template'), 'remove'=>array(21,'delete_template') ),
38
-            'permissions'=>array('new_template','edit_template'),
37
+            'actions'=>array('edit'=>array(16, 'edit_template'), 'duplicate'=>array(96, 'new_template'), 'remove'=>array(21, 'delete_template')),
38
+            'permissions'=>array('new_template', 'edit_template'),
39 39
             'name'=>'templatename'
40 40
         );
41
-        $this->types['site_tmplvars']     = array(
41
+        $this->types['site_tmplvars'] = array(
42 42
             'title'=>$_lang["tmplvars"],
43
-            'actions'=>array('edit'=>array(301,'edit_template'), 'duplicate'=>array(304,'edit_template'), 'remove'=>array(303,'edit_template')),
44
-            'permissions'=>array('new_template','edit_template'),
43
+            'actions'=>array('edit'=>array(301, 'edit_template'), 'duplicate'=>array(304, 'edit_template'), 'remove'=>array(303, 'edit_template')),
44
+            'permissions'=>array('new_template', 'edit_template'),
45 45
         );
46 46
         $this->types['site_htmlsnippets'] = array(
47 47
             'title'=>$_lang["manage_htmlsnippets"],
48
-            'actions'=>array('edit'=>array(78,'edit_chunk'), 'duplicate'=>array(97,'new_chunk'), 'remove'=>array(80,'delete_chunk')),
49
-            'permissions'=>array('new_chunk','edit_chunk'),
48
+            'actions'=>array('edit'=>array(78, 'edit_chunk'), 'duplicate'=>array(97, 'new_chunk'), 'remove'=>array(80, 'delete_chunk')),
49
+            'permissions'=>array('new_chunk', 'edit_chunk'),
50 50
         );
51
-        $this->types['site_snippets']     = array(
51
+        $this->types['site_snippets'] = array(
52 52
             'title'=>$_lang["manage_snippets"],
53
-            'actions'=>array('edit'=>array(22,'edit_snippet'), 'duplicate'=>array(98,'new_snippet'), 'remove'=>array(25,'delete_snippet')),
54
-            'permissions'=>array('new_snippet','edit_snippet'),
53
+            'actions'=>array('edit'=>array(22, 'edit_snippet'), 'duplicate'=>array(98, 'new_snippet'), 'remove'=>array(25, 'delete_snippet')),
54
+            'permissions'=>array('new_snippet', 'edit_snippet'),
55 55
         );
56
-        $this->types['site_plugins']      = array(
56
+        $this->types['site_plugins'] = array(
57 57
             'title'=>$_lang["manage_plugins"],
58
-            'actions'=>array('edit'=>array(102,'edit_plugin'), 'duplicate'=>array(105,'new_plugin'), 'remove'=>array(104,'delete_plugin')),
59
-            'permissions'=>array('new_plugin','edit_plugin'),
58
+            'actions'=>array('edit'=>array(102, 'edit_plugin'), 'duplicate'=>array(105, 'new_plugin'), 'remove'=>array(104, 'delete_plugin')),
59
+            'permissions'=>array('new_plugin', 'edit_plugin'),
60 60
         );
61
-        $this->types['site_modules']      = array(
61
+        $this->types['site_modules'] = array(
62 62
             'title'=>$_lang["manage_modules"],
63
-            'actions'=>array('edit'=>array(108,'edit_module'), 'duplicate'=>array(111,'new_module'), 'remove'=>array(110,'delete_module')),
64
-            'permissions'=>array('new_module','edit_module'),
63
+            'actions'=>array('edit'=>array(108, 'edit_module'), 'duplicate'=>array(111, 'new_module'), 'remove'=>array(110, 'delete_module')),
64
+            'permissions'=>array('new_module', 'edit_module'),
65 65
         );
66 66
     }
67 67
 
68 68
     /**
69 69
      * @return void
70 70
      */
71
-    public function queryItemsFromDB() {
72
-        foreach($this->types as $resourceTable=>$type) {
73
-            if($this->hasAnyPermissions($type['permissions'])) {
71
+    public function queryItemsFromDB(){
72
+        foreach ($this->types as $resourceTable=>$type) {
73
+            if ($this->hasAnyPermissions($type['permissions'])) {
74 74
                 $nameField = isset($type['name']) ? $type['name'] : 'name';
75 75
                 $this->items[$resourceTable] = $this->queryResources($resourceTable, $nameField);
76 76
             }
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
      * @param array $permissions
82 82
      * @return bool
83 83
      */
84
-    public function hasAnyPermissions($permissions) {
84
+    public function hasAnyPermissions($permissions){
85 85
         $modx = evolutionCMS();
86 86
 
87
-        foreach($permissions as $p)
88
-            if($modx->hasPermission($p)) return true;
87
+        foreach ($permissions as $p)
88
+            if ($modx->hasPermission($p)) return true;
89 89
 
90 90
         return false;
91 91
     }
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * @param string $nameField
96 96
      * @return array|bool
97 97
      */
98
-    public function queryResources($resourceTable, $nameField = 'name') {
98
+    public function queryResources($resourceTable, $nameField = 'name'){
99 99
         $modx = evolutionCMS(); global $_lang;
100 100
 
101 101
         $allowed = array(
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
             'site_plugins',
105 105
             'site_modules'
106 106
         );
107
-        $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable . '.disabled, ' : '';
107
+        $pluginsql = !empty($resourceTable) && in_array($resourceTable, $allowed) ? $resourceTable.'.disabled, ' : '';
108 108
 
109 109
         $tvsql  = '';
110 110
         $tvjoin = '';
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 
120 120
         $rs = $modx->db->select(
121 121
             "{$sttfield} {$pluginsql} {$tvsql} {$resourceTable}.{$nameField} as name, {$resourceTable}.id, {$resourceTable}.description, {$resourceTable}.locked, {$selectableTemplates}IF(isnull(categories.category),'{$_lang['no_category']}',categories.category) as category, categories.id as catid",
122
-            $modx->getFullTableName($resourceTable) . " AS {$resourceTable}
123
-	            LEFT JOIN " . $modx->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
122
+            $modx->getFullTableName($resourceTable)." AS {$resourceTable}
123
+	            LEFT JOIN ".$modx->getFullTableName('categories')." AS categories ON {$resourceTable}.category = categories.id {$tvjoin}",
124 124
             "",
125 125
             "category,name"
126 126
         );
127 127
         $limit = $modx->db->getRecordCount($rs);
128 128
 
129
-        if($limit < 1) return false;
129
+        if ($limit < 1) return false;
130 130
 
131 131
         $result = array();
132 132
         while ($row = $modx->db->getRow($rs)) {
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
     /**
139 139
      * @return void
140 140
      */
141
-    public function prepareCategoryArrays() {
142
-        foreach($this->items as $type=>$items) {
143
-            foreach((array)$items as $item) {
141
+    public function prepareCategoryArrays(){
142
+        foreach ($this->items as $type=>$items) {
143
+            foreach ((array) $items as $item) {
144 144
                 $catid = $item['catid'] ? $item['catid'] : 0;
145 145
                 $this->categories[$catid] = $item['category'];
146 146
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
         natcasesort($this->categories);
154 154
 
155 155
         // Now sort by name
156
-        foreach($this->itemsPerCategory as $catid=>$items) {
157
-            usort($this->itemsPerCategory[$catid], function ($a, $b) {
156
+        foreach ($this->itemsPerCategory as $catid=>$items) {
157
+            usort($this->itemsPerCategory[$catid], function($a, $b){
158 158
                 return strcasecmp($a['name'], $b['name']);
159 159
             });
160 160
         }
Please login to merge, or discard this patch.
Braces   +23 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php namespace EvolutionCMS\Legacy;
2 2
 
3
-class mgrResources {
3
+class mgrResources
4
+{
4 5
     /**
5 6
      * @var array
6 7
      */
@@ -21,7 +22,8 @@  discard block
 block discarded – undo
21 22
     /**
22 23
      * mgrResources constructor.
23 24
      */
24
-    public function __construct() {
25
+    public function __construct()
26
+    {
25 27
         $this->setTypes();
26 28
         $this->queryItemsFromDB();
27 29
         $this->prepareCategoryArrays();
@@ -30,7 +32,8 @@  discard block
 block discarded – undo
30 32
     /**
31 33
      * @return void
32 34
      */
33
-    public function setTypes() {
35
+    public function setTypes()
36
+    {
34 37
         global $_lang;
35 38
         $this->types['site_templates']    = array(
36 39
             'title'=>$_lang["manage_templates"],
@@ -68,7 +71,8 @@  discard block
 block discarded – undo
68 71
     /**
69 72
      * @return void
70 73
      */
71
-    public function queryItemsFromDB() {
74
+    public function queryItemsFromDB()
75
+    {
72 76
         foreach($this->types as $resourceTable=>$type) {
73 77
             if($this->hasAnyPermissions($type['permissions'])) {
74 78
                 $nameField = isset($type['name']) ? $type['name'] : 'name';
@@ -81,11 +85,13 @@  discard block
 block discarded – undo
81 85
      * @param array $permissions
82 86
      * @return bool
83 87
      */
84
-    public function hasAnyPermissions($permissions) {
88
+    public function hasAnyPermissions($permissions)
89
+    {
85 90
         $modx = evolutionCMS();
86 91
 
87
-        foreach($permissions as $p)
88
-            if($modx->hasPermission($p)) return true;
92
+        foreach($permissions as $p) {
93
+                    if($modx->hasPermission($p)) return true;
94
+        }
89 95
 
90 96
         return false;
91 97
     }
@@ -95,7 +101,8 @@  discard block
 block discarded – undo
95 101
      * @param string $nameField
96 102
      * @return array|bool
97 103
      */
98
-    public function queryResources($resourceTable, $nameField = 'name') {
104
+    public function queryResources($resourceTable, $nameField = 'name')
105
+    {
99 106
         $modx = evolutionCMS(); global $_lang;
100 107
 
101 108
         $allowed = array(
@@ -112,8 +119,9 @@  discard block
 block discarded – undo
112 119
             $tvsql    = 'site_tmplvars.caption, ';
113 120
             $tvjoin   = sprintf('LEFT JOIN %s AS stt ON site_tmplvars.id=stt.tmplvarid GROUP BY site_tmplvars.id,reltpl', $modx->getFullTableName('site_tmplvar_templates'));
114 121
             $sttfield = 'IF(stt.templateid,1,0) AS reltpl,';
122
+        } else {
123
+            $sttfield = '';
115 124
         }
116
-        else $sttfield = '';
117 125
 
118 126
         $selectableTemplates = $resourceTable === 'site_templates' ? "{$resourceTable}.selectable, " : "";
119 127
 
@@ -126,7 +134,9 @@  discard block
 block discarded – undo
126 134
         );
127 135
         $limit = $modx->db->getRecordCount($rs);
128 136
 
129
-        if($limit < 1) return false;
137
+        if($limit < 1) {
138
+            return false;
139
+        }
130 140
 
131 141
         $result = array();
132 142
         while ($row = $modx->db->getRow($rs)) {
@@ -138,7 +148,8 @@  discard block
 block discarded – undo
138 148
     /**
139 149
      * @return void
140 150
      */
141
-    public function prepareCategoryArrays() {
151
+    public function prepareCategoryArrays()
152
+    {
142 153
         foreach($this->items as $type=>$items) {
143 154
             foreach((array)$items as $item) {
144 155
                 $catid = $item['catid'] ? $item['catid'] : 0;
@@ -154,7 +165,7 @@  discard block
 block discarded – undo
154 165
 
155 166
         // Now sort by name
156 167
         foreach($this->itemsPerCategory as $catid=>$items) {
157
-            usort($this->itemsPerCategory[$catid], function ($a, $b) {
168
+            usort($this->itemsPerCategory[$catid], function ($a, $b){
158 169
                 return strcasecmp($a['name'], $b['name']);
159 170
             });
160 171
         }
Please login to merge, or discard this patch.
manager/includes/src/Legacy/TemplateParser.php 3 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -8,46 +8,46 @@  discard block
 block discarded – undo
8 8
      * @param array $data
9 9
      * @return string
10 10
      */
11
-    public function output($config = array(), $data = array()) {
11
+    public function output($config = array(), $data = array()){
12 12
         $modx = evolutionCMS();
13 13
 
14 14
         $output = '';
15 15
         $action = !empty($config['action']) ? $config['action'] : (!empty($_REQUEST['a']) ? $_REQUEST['a'] : '');
16
-        $tab = isset($config['tab']) ? ' AND tab IN(' . $config['tab'] . ')' : '';
16
+        $tab = isset($config['tab']) ? ' AND tab IN('.$config['tab'].')' : '';
17 17
 
18
-        if($action) {
18
+        if ($action) {
19 19
             $sql = $modx->db->query('SELECT t1.*, IF(t1.alias=\'\',t1.name,t1.alias) AS alias, t2.category AS category_name
20
-			FROM ' . $modx->getFullTableName('system_templates') . ' AS t1
21
-			INNER JOIN ' . $modx->getFullTableName('categories') . ' AS t2 ON t2.id=t1.category
22
-			WHERE t1.action IN(' . $action . ') ' . $tab . '
20
+			FROM ' . $modx->getFullTableName('system_templates').' AS t1
21
+			INNER JOIN ' . $modx->getFullTableName('categories').' AS t2 ON t2.id=t1.category
22
+			WHERE t1.action IN(' . $action.') '.$tab.'
23 23
 			ORDER BY t1.tab ASC, t1.rank ASC');
24 24
 
25
-            if($modx->db->getRecordCount($sql)) {
25
+            if ($modx->db->getRecordCount($sql)) {
26 26
                 $tabs = array();
27
-                while($row = $modx->db->getRow($sql)) {
28
-                    if(!$row['value'] && !empty($data[$row['name']])) {
27
+                while ($row = $modx->db->getRow($sql)) {
28
+                    if (!$row['value'] && !empty($data[$row['name']])) {
29 29
                         $row['value'] = $data[$row['name']];
30 30
                     }
31 31
                     $tabs[$row['tab']]['category_name'] = $row['category_name'];
32 32
                     $tabs[$row['tab']][$row['name']] = $this->render($row);
33 33
                 }
34 34
 
35
-                if(!empty($config['toArray'])) {
35
+                if (!empty($config['toArray'])) {
36 36
                     $output = $tabs;
37 37
                 } else {
38
-                    $output .= '<div class="tab-pane" id="pane_' . $action . '">';
38
+                    $output .= '<div class="tab-pane" id="pane_'.$action.'">';
39 39
                     $output .= '
40 40
 					<script type="text/javascript">
41
-						var pane_' . $action . ' = new WebFXTabPane(document.getElementById("pane_' . $action . '"), ' . ($modx->config['remember_last_tab'] == 1 ? 'true' : 'false') . ');
41
+						var pane_' . $action.' = new WebFXTabPane(document.getElementById("pane_'.$action.'"), '.($modx->config['remember_last_tab'] == 1 ? 'true' : 'false').');
42 42
 					</script>';
43 43
 
44
-                    foreach($tabs as $idTab => $tab) {
45
-                        $output .= '<div class="tab-page" id="tab_' . $action . '_' . $idTab . '">';
44
+                    foreach ($tabs as $idTab => $tab) {
45
+                        $output .= '<div class="tab-page" id="tab_'.$action.'_'.$idTab.'">';
46 46
                         $output .= '
47
-						<h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']) . '</h2>
48
-						<script type="text/javascript">pane_' . $action . '.addTabPage(document.getElementById("tab_' . $action . '_' . $idTab . '"));</script>';
47
+						<h2 class="tab">' . (!empty($config['tabs'][$idTab]) ? $config['tabs'][$idTab] : $tab['category_name']).'</h2>
48
+						<script type="text/javascript">pane_' . $action.'.addTabPage(document.getElementById("tab_'.$action.'_'.$idTab.'"));</script>';
49 49
                         unset($tab['category_name']);
50
-                        foreach($tab as $item) {
50
+                        foreach ($tab as $item) {
51 51
                             $output .= $item;
52 52
                         }
53 53
                         $output .= '</div>';
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param array $data
65 65
      * @return string
66 66
      */
67
-    private function render($data) {
67
+    private function render($data){
68 68
         $modx = evolutionCMS(); global $_lang, $_country_lang;
69 69
 
70 70
         $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $output = '';
75 75
         $output .= '<div class="form-group row">';
76 76
 
77
-        switch($data['type']) {
77
+        switch ($data['type']) {
78 78
 
79 79
             case 'text':
80 80
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
109 109
                 $output .= '<div class="col-sm-7">';
110 110
                 $output .= '<select name="[+name+]" class="form-control" id="[+name+]" onChange="documentDirty=true;">';
111
-                if($data['name'] == 'country' && isset($_country_lang)) {
111
+                if ($data['name'] == 'country' && isset($_country_lang)) {
112 112
                     $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $data['country'];
113
-                    $output .= '<option value=""' . (!isset($chosenCountry) ? ' selected' : '') . '>&nbsp;</option>';
114
-                    foreach($_country_lang as $key => $value) {
115
-                        $output .= '<option value="' . $key . '"' . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . '>' . $value . '</option>';
113
+                    $output .= '<option value=""'.(!isset($chosenCountry) ? ' selected' : '').'>&nbsp;</option>';
114
+                    foreach ($_country_lang as $key => $value) {
115
+                        $output .= '<option value="'.$key.'"'.(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').'>'.$value.'</option>';
116 116
                     }
117 117
                 } else {
118
-                    if($data['elements']) {
118
+                    if ($data['elements']) {
119 119
                         $elements = explode('||', $data['elements']);
120
-                        foreach($elements as $key => $value) {
120
+                        foreach ($elements as $key => $value) {
121 121
                             $value = explode('==', $value);
122
-                            $output .= '<option value="' . $value[1] . '">' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]) . '</option>';
122
+                            $output .= '<option value="'.$value[1].'">'.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]).'</option>';
123 123
                         }
124 124
                     }
125 125
                 }
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
134 134
                 $output .= '<div class="col-sm-7">';
135 135
                 $output .= '<input type="checkbox" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />';
136
-                if($data['elements']) {
136
+                if ($data['elements']) {
137 137
                     $elements = explode('||', $data['elements']);
138
-                    foreach($elements as $key => $value) {
138
+                    foreach ($elements as $key => $value) {
139 139
                         $value = explode('==', $value);
140
-                        $output .= '<br /><input type="checkbox" name="' . $value[0] . '" class="form-control" id="' . $value[0] . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
140
+                        $output .= '<br /><input type="checkbox" name="'.$value[0].'" class="form-control" id="'.$value[0].'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
141 141
                     }
142 142
                 }
143 143
                 $output .= $data['content'];
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
                 $output .= '<label class="col-sm-3" for="[+name+]">[+lang.name+]</label>';
150 150
                 $output .= '<div class="col-sm-7">';
151 151
                 $output .= '<input type="radio" name="[+name+]" class="form-control" id="[+name+]" value="[+value+]" onChange="documentDirty=true;"[+readonly+] />';
152
-                if($data['elements']) {
152
+                if ($data['elements']) {
153 153
                     $elements = explode('||', $data['elements']);
154
-                    foreach($elements as $key => $value) {
154
+                    foreach ($elements as $key => $value) {
155 155
                         $value = explode('==', $value);
156
-                        $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_' . $key . '" value="' . $value[1] . '" onChange="documentDirty=true;"[+readonly+] /> ' . (isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
156
+                        $output .= '<br /><input type="radio" name="[+name+]" class="form-control" id="[+name+]_'.$key.'" value="'.$value[1].'" onChange="documentDirty=true;"[+readonly+] /> '.(isset($_lang[$value[0]]) ? $_lang[$value[0]] : $value[0]);
157 157
                     }
158 158
                 }
159 159
                 $output .= $data['content'];
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,8 @@  discard block
 block discarded – undo
8 8
      * @param array $data
9 9
      * @return string
10 10
      */
11
-    public function output($config = array(), $data = array()) {
11
+    public function output($config = array(), $data = array())
12
+    {
12 13
         $modx = evolutionCMS();
13 14
 
14 15
         $output = '';
@@ -64,7 +65,8 @@  discard block
 block discarded – undo
64 65
      * @param array $data
65 66
      * @return string
66 67
      */
67
-    private function render($data) {
68
+    private function render($data)
69
+    {
68 70
         $modx = evolutionCMS(); global $_lang, $_country_lang;
69 71
 
70 72
         $data['lang.name'] = (isset($_lang[$data['alias']]) ? $_lang[$data['alias']] : $data['alias']);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php namespace EvolutionCMS\Legacy;
2 2
 
3
-Class TemplateParser
3
+class TemplateParser
4 4
 {
5 5
 
6 6
     /**
Please login to merge, or discard this patch.
manager/includes/src/Legacy/ModuleCategoriesManager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
     {
86 86
         global $_lang, $_style;
87 87
 
88
-        $filename = trim($view_name) . '.tpl.phtml';
89
-        $file = self::get('views_dir') . $filename;
88
+        $filename = trim($view_name).'.tpl.phtml';
89
+        $file = self::get('views_dir').$filename;
90 90
         $view = &$this;
91 91
 
92 92
         if (is_file($file)
@@ -111,14 +111,14 @@  discard block
 block discarded – undo
111 111
     {
112 112
 
113 113
         $_update = array(
114
-            'id'       => (int)$element_id,
115
-            'category' => (int)$category_id
114
+            'id'       => (int) $element_id,
115
+            'category' => (int) $category_id
116 116
         );
117 117
 
118 118
         $this->db->update(
119 119
             $_update,
120 120
             $this->db_tbl[$element],
121
-            "`id` = '" . (int)$element_id . "'"
121
+            "`id` = '".(int) $element_id."'"
122 122
         );
123 123
 
124 124
         return $this->db->getAffectedRows() === 1;
Please login to merge, or discard this patch.