Completed
Pull Request — develop (#725)
by Agel_Nash
14:22
created
manager/includes/src/Legacy/Permissions.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $role = $this->role;
40 40
 
41 41
         if ($role == 1) {
42
-            return true;  // administrator - grant all document permissions
42
+            return true; // administrator - grant all document permissions
43 43
         }
44 44
 
45 45
         if ($modx->config['use_udperms'] == 0 || $modx->config['use_udperms'] == "" || !isset($modx->config['use_udperms'])) {
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
             are private to the manager users will not be private to web users if the
67 67
             document group is not assigned to a web user group and visa versa.
68 68
          */
69
-        $permissionsok = false;  // set permissions to false
69
+        $permissionsok = false; // set permissions to false
70 70
 
71 71
         $rs = $modx->getDatabase()->select(
72 72
             'count(DISTINCT sc.id)',
73 73
             "{$tblsc} AS sc 
74 74
 				LEFT JOIN {$tbldg} AS dg on dg.document = sc.id 
75 75
 				LEFT JOIN {$tbldgn} dgn ON dgn.id = dg.document_group",
76
-            "sc.id='{$this->document}' AND (" . (empty($docgrp) ? '' : "dg.document_group = " . $docgrp . " ||") . " sc.privatemgr = 0)"
76
+            "sc.id='{$this->document}' AND (".(empty($docgrp) ? '' : "dg.document_group = ".$docgrp." ||")." sc.privatemgr = 0)"
77 77
         );
78 78
         $limit = $modx->getDatabase()->getValue($rs);
79 79
         if ($limit == 1) {
Please login to merge, or discard this patch.
manager/includes/src/Legacy/Categories.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         $this->db_tbl['categories'] = $modx->getFullTableName('categories');
21 21
 
22 22
         foreach ($this->elements as $element) {
23
-            $this->db_tbl[$element] = $modx->getFullTableName('site_' . $element);
23
+            $this->db_tbl[$element] = $modx->getFullTableName('site_'.$element);
24 24
         }
25 25
     }
26 26
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             $this->getDatabase()->select(
55 55
                 '*',
56 56
                 $this->db_tbl['categories'],
57
-                "`" . $where . "` = '" . $this->getDatabase()->escape($search) . "'"
57
+                "`".$where."` = '".$this->getDatabase()->escape($search)."'"
58 58
             )
59 59
         );
60 60
 
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
     {
72 72
         $_value = $this->getDatabase()->getValue(
73 73
             $this->getDatabase()->select(
74
-                '`' . $value . '`',
74
+                '`'.$value.'`',
75 75
                 $this->db_tbl['categories'],
76
-                "`" . $where . "` = '" . $this->getDatabase()->escape($search) . "'"
76
+                "`".$where."` = '".$this->getDatabase()->escape($search)."'"
77 77
             )
78 78
         );
79 79
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 $this->getDatabase()->select(
93 93
                     '*',
94 94
                     $this->db_tbl[$element],
95
-                    "`category` = '" . (int)$category_id . "'"
95
+                    "`category` = '".(int) $category_id."'"
96 96
                 )
97 97
             );
98 98
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
             $this->getDatabase()->update(
136 136
                 $_update,
137 137
                 $this->db_tbl[$element],
138
-                "`category` = '" . (int)$category_id . "'"
138
+                "`category` = '".(int) $category_id."'"
139 139
             );
140 140
         }
141 141
 
142 142
         $this->getDatabase()->delete(
143 143
             $this->db_tbl['categories'],
144
-            "`id` = '" . (int)$category_id . "'"
144
+            "`id` = '".(int) $category_id."'"
145 145
         );
146 146
 
147 147
         return $this->getDatabase()->getAffectedRows() === 1;
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 
161 161
         $_update = array(
162 162
             'category' => $this->getDatabase()->escape($data['category']),
163
-            'rank'     => (int)$data['rank']
163
+            'rank'     => (int) $data['rank']
164 164
         );
165 165
 
166 166
         $this->getDatabase()->update(
167 167
             $_update,
168 168
             $this->db_tbl['categories'],
169
-            "`id` = '" . (int)$category_id . "'"
169
+            "`id` = '".(int) $category_id."'"
170 170
         );
171 171
 
172 172
         if ($this->getDatabase()->getAffectedRows() === 1) {
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 
190 190
         $_insert = array(
191 191
             'category' => $this->getDatabase()->escape($category_name),
192
-            'rank'     => (int)$category_rank
192
+            'rank'     => (int) $category_rank
193 193
         );
194 194
 
195 195
         $this->getDatabase()->insert(
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
             $this->getDatabase()->select(
217 217
                 '`id`',
218 218
                 $this->db_tbl['categories'],
219
-                "`category` = '" . $category . "'"
219
+                "`category` = '".$category."'"
220 220
             )
221 221
         );
222 222
 
Please login to merge, or discard this patch.
manager/includes/src/Legacy/LogHandler.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,16 +36,16 @@  discard block
 block discarded – undo
36 36
         $action = "",
37 37
         $itemid = "",
38 38
         $itemname = ""
39
-    ) {
39
+    ){
40 40
         $modx = evolutionCMS();
41 41
         $this->entry['msg'] = $msg; // writes testmessage to the object
42
-        $this->entry['action'] = empty($action) ? $modx->getManagerApi()->action : $action;    // writes the action to the object
42
+        $this->entry['action'] = empty($action) ? $modx->getManagerApi()->action : $action; // writes the action to the object
43 43
 
44 44
         // User Credentials
45 45
         $this->entry['internalKey'] = $internalKey == "" ? $modx->getLoginUserID() : $internalKey;
46 46
         $this->entry['username'] = $username == "" ? $modx->getLoginUserName() : $username;
47 47
 
48
-        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid;  // writes the id to the object
48
+        $this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int) $_REQUEST['id'] : $itemid; // writes the id to the object
49 49
         if ($this->entry['itemId'] == 0) {
50 50
             $this->entry['itemId'] = "-";
51 51
         } // to stop items having id 0
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
 
97 97
         $insert_id = $modx->getDatabase()->insert($fields, $tbl_manager_log);
98 98
         if (!$insert_id) {
99
-            $modx->messageQuit("Logging error: couldn't save log to table! Error code: " . $modx->getDatabase()->getLastError());
99
+            $modx->messageQuit("Logging error: couldn't save log to table! Error code: ".$modx->getDatabase()->getLastError());
100 100
         } else {
101
-            $limit = (isset($modx->config['manager_log_limit'])) ? (int)$modx->config['manager_log_limit'] : 3000;
102
-            $trim = (isset($modx->config['manager_log_trim'])) ? (int)$modx->config['manager_log_trim'] : 100;
101
+            $limit = (isset($modx->config['manager_log_limit'])) ? (int) $modx->config['manager_log_limit'] : 3000;
102
+            $trim = (isset($modx->config['manager_log_trim'])) ? (int) $modx->config['manager_log_trim'] : 100;
103 103
             if (($insert_id % $trim) === 0) {
104 104
                 $modx->rotate_log('manager_log', $limit, $trim);
105 105
             }
106 106
         }
107 107
     }
108 108
 
109
-    private function getUserIP() {
110
-        if( array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
111
-            if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',')>0) {
112
-                $addr = explode(",",$_SERVER['HTTP_X_FORWARDED_FOR']);
109
+    private function getUserIP(){
110
+        if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
111
+            if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') > 0) {
112
+                $addr = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
113 113
                 return trim($addr[0]);
114 114
             } else {
115 115
                 return $_SERVER['HTTP_X_FORWARDED_FOR'];
Please login to merge, or discard this patch.
manager/includes/src/Legacy/mgrResources.php 1 patch
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->getDatabase()->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->getDatabase()->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->getDatabase()->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.
manager/includes/src/Legacy/DeprecatedCore.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -119,16 +119,16 @@  discard block
 block discarded – undo
119 119
         for ($i = 0; $i < $tablevel; $i++) {
120 120
             $tabs .= "\t";
121 121
         }
122
-        $listhtml = $ordered == true ? $tabs . "<ol class='$ulroot'$typestr>\n" : $tabs . "<ul class='$ulroot'$typestr>\n";
122
+        $listhtml = $ordered == true ? $tabs."<ol class='$ulroot'$typestr>\n" : $tabs."<ul class='$ulroot'$typestr>\n";
123 123
         foreach ($array as $key => $value) {
124 124
             if (is_array($value)) {
125
-                $listhtml .= $tabs . "\t<li>" . $key . "\n" . $this->makeList($value, $ulprefix . $ulroot, $ulprefix,
126
-                        $type, $ordered, $tablevel + 2) . $tabs . "\t</li>\n";
125
+                $listhtml .= $tabs."\t<li>".$key."\n".$this->makeList($value, $ulprefix.$ulroot, $ulprefix,
126
+                        $type, $ordered, $tablevel + 2).$tabs."\t</li>\n";
127 127
             } else {
128
-                $listhtml .= $tabs . "\t<li>" . $value . "</li>\n";
128
+                $listhtml .= $tabs."\t<li>".$value."</li>\n";
129 129
             }
130 130
         }
131
-        $listhtml .= $ordered == true ? $tabs . "</ol>\n" : $tabs . "</ul>\n";
131
+        $listhtml .= $ordered == true ? $tabs."</ol>\n" : $tabs."</ul>\n";
132 132
 
133 133
         return $listhtml;
134 134
     }
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
         $msg = addslashes($modx->getDatabase()->escape($msg));
300 300
         if (substr(strtolower($url), 0, 11) == "javascript:") {
301 301
             $act = "__WebAlert();";
302
-            $fnc = "function __WebAlert(){" . substr($url, 11) . "};";
302
+            $fnc = "function __WebAlert(){".substr($url, 11)."};";
303 303
         } else {
304
-            $act = ($url ? "window.location.href='" . addslashes($url) . "';" : "");
304
+            $act = ($url ? "window.location.href='".addslashes($url)."';" : "");
305 305
         }
306 306
         $html = "<script>$fnc window.setTimeout(\"alert('$msg');$act\",100);</script>";
307 307
         if ($modx->isFrontend()) {
Please login to merge, or discard this patch.
manager/includes/src/Legacy/TemplateParser.php 1 patch
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->getDatabase()->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->getDatabase()->getRecordCount($sql)) {
25
+            if ($modx->getDatabase()->getRecordCount($sql)) {
26 26
                 $tabs = array();
27
-                while($row = $modx->getDatabase()->getRow($sql)) {
28
-                    if(!$row['value'] && !empty($data[$row['name']])) {
27
+                while ($row = $modx->getDatabase()->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.
manager/includes/src/Legacy/PasswordHash.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
         $this->portable_hashes = $portable_hashes;
50 50
 
51
-        $this->random_state = microtime() . uniqid(mt_rand(), true);
51
+        $this->random_state = microtime().uniqid(mt_rand(), true);
52 52
     }
53 53
 
54 54
     /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             $output = '';
69 69
             for ($i = 0; $i < $count; $i += 16) {
70 70
                 $this->random_state =
71
-                    md5(microtime() . $this->random_state);
71
+                    md5(microtime().$this->random_state);
72 72
                 $output .=
73 73
                     pack('H*', md5($this->random_state));
74 74
             }
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
         // consequently in lower iteration counts and hashes that are
161 161
         // quicker to crack (by non-PHP code).
162 162
 
163
-        $hash = md5($salt . $password, true);
163
+        $hash = md5($salt.$password, true);
164 164
         do {
165
-            $hash = md5($hash . $password, true);
165
+            $hash = md5($hash.$password, true);
166 166
         } while (--$count);
167 167
 
168 168
         $output = substr($setting, 0, 12);
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->getDatabase()->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->getDatabase()->getAffectedRows() === 1;
Please login to merge, or discard this patch.
manager/includes/src/Database.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $pre = null,
34 34
         $charset = '',
35 35
         $connection_method = 'SET CHARACTER SET'
36
-    ) {
36
+    ){
37 37
         $this->config['host'] = $host ? $host : $GLOBALS['database_server'];
38 38
         $this->config['dbase'] = $dbase ? $dbase : $GLOBALS['dbase'];
39 39
         $this->config['user'] = $uid ? $uid : $GLOBALS['database_user'];
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                         $ua = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_USER_AGENT']);
74 74
                         $referer = $modx->getPhpCompat()->htmlspecialchars($_SERVER['HTTP_REFERER']);
75 75
                         $modx->sendmail(array(
76
-                            'subject' => 'Missing to create the database connection! from ' . $modx->config['site_name'],
76
+                            'subject' => 'Missing to create the database connection! from '.$modx->config['site_name'],
77 77
                             'body'    => "{$logtitle}\n{$request_uri}\n{$ua}\n{$referer}",
78 78
                             'type'    => 'text'
79 79
                         ));
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
             $tend = $modx->getMicroTime();
89 89
             $totaltime = $tend - $tstart;
90 90
             if ($modx->dumpSQL) {
91
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>" . sprintf("Database connection was created in %2.4f s",
92
-                        $totaltime) . "</fieldset><br />";
91
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Database connection</legend>".sprintf("Database connection was created in %2.4f s",
92
+                        $totaltime)."</fieldset><br />";
93 93
             }
94 94
             $this->conn->set_charset($this->config['charset']);
95 95
             $this->isConnected = true;
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         if (1000 < $safeCount) {
123 123
             exit("Too many loops '{$safeCount}'");
124 124
         }
125
-        if ( ! ($this->conn instanceof mysqli)) {
125
+        if (!($this->conn instanceof mysqli)) {
126 126
             $this->connect();
127 127
         }
128 128
         if (is_array($s)) {
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
     public function query($sql, $watchError = true)
149 149
     {
150 150
         $modx = evolutionCMS();
151
-        if ( ! ($this->conn instanceof mysqli)) {
151
+        if (!($this->conn instanceof mysqli)) {
152 152
             $this->connect();
153 153
         }
154 154
         $tStart = $modx->getMicroTime();
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
                 case 1091:
169 169
                     break;
170 170
                 default:
171
-                    $modx->messageQuit('Execution of a query to the database failed - ' . $this->getLastError(), $sql);
171
+                    $modx->messageQuit('Execution of a query to the database failed - '.$this->getLastError(), $sql);
172 172
             }
173 173
         } else {
174 174
             $tend = $modx->getMicroTime();
@@ -182,24 +182,24 @@  discard block
 block discarded – undo
182 182
                     $debug_path[] = $line['function'];
183 183
                 }
184 184
                 $debug_path = implode(' > ', array_reverse($debug_path));
185
-                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query " . ($modx->executedQueries + 1) . " - " . sprintf("%2.2f ms",
186
-                        $totalTime * 1000) . "</legend>";
187
-                $modx->queryCode .= $sql . '<br><br>';
185
+                $modx->queryCode .= "<fieldset style='text-align:left'><legend>Query ".($modx->executedQueries + 1)." - ".sprintf("%2.2f ms",
186
+                        $totalTime * 1000)."</legend>";
187
+                $modx->queryCode .= $sql.'<br><br>';
188 188
                 if ($modx->event->name) {
189
-                    $modx->queryCode .= 'Current Event  => ' . $modx->event->name . '<br>';
189
+                    $modx->queryCode .= 'Current Event  => '.$modx->event->name.'<br>';
190 190
                 }
191 191
                 if ($modx->event->activePlugin) {
192
-                    $modx->queryCode .= 'Current Plugin => ' . $modx->event->activePlugin . '<br>';
192
+                    $modx->queryCode .= 'Current Plugin => '.$modx->event->activePlugin.'<br>';
193 193
                 }
194 194
                 if ($modx->currentSnippet) {
195
-                    $modx->queryCode .= 'Current Snippet => ' . $modx->currentSnippet . '<br>';
195
+                    $modx->queryCode .= 'Current Snippet => '.$modx->currentSnippet.'<br>';
196 196
                 }
197 197
                 if (stripos($sql, 'select') === 0) {
198
-                    $modx->queryCode .= 'Record Count => ' . $this->getRecordCount($result) . '<br>';
198
+                    $modx->queryCode .= 'Record Count => '.$this->getRecordCount($result).'<br>';
199 199
                 } else {
200
-                    $modx->queryCode .= 'Affected Rows => ' . $this->getAffectedRows() . '<br>';
200
+                    $modx->queryCode .= 'Affected Rows => '.$this->getAffectedRows().'<br>';
201 201
                 }
202
-                $modx->queryCode .= 'Functions Path => ' . $debug_path . '<br>';
202
+                $modx->queryCode .= 'Functions Path => '.$debug_path.'<br>';
203 203
                 $modx->queryCode .= "</fieldset><br />";
204 204
             }
205 205
             $modx->executedQueries++;
@@ -306,9 +306,9 @@  discard block
 block discarded – undo
306 306
                     if ($value === null || strtolower($value) === 'null') {
307 307
                         $f = 'NULL';
308 308
                     } else {
309
-                        $f = "'" . $value . "'";
309
+                        $f = "'".$value."'";
310 310
                     }
311
-                    $fields[$key] = "`{$key}` = " . $f;
311
+                    $fields[$key] = "`{$key}` = ".$f;
312 312
                 }
313 313
                 $fields = implode(',', $fields);
314 314
             }
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
                 $this->query("INSERT INTO {$intotable} {$fields}");
344 344
             } else {
345 345
                 if (empty($fromtable)) {
346
-                    $fields = "(`" . implode("`, `", array_keys($fields)) . "`) VALUES('" . implode("', '",
347
-                            array_values($fields)) . "')";
346
+                    $fields = "(`".implode("`, `", array_keys($fields))."`) VALUES('".implode("', '",
347
+                            array_values($fields))."')";
348 348
                     $this->query("INSERT INTO {$intotable} {$fields}");
349 349
                 } else {
350 350
                     $fromtable = $this->replaceFullTableName($fromtable);
351
-                    $fields = "(" . implode(",", array_keys($fields)) . ")";
351
+                    $fields = "(".implode(",", array_keys($fields)).")";
352 352
                     $where = trim($where);
353 353
                     $limit = trim($limit);
354 354
                     if ($where !== '' && stripos($where, 'WHERE') !== 0) {
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
      */
443 443
     public function getInsertId($conn = null)
444 444
     {
445
-        if (! ($conn instanceof mysqli)) {
446
-            $conn =& $this->conn;
445
+        if (!($conn instanceof mysqli)) {
446
+            $conn = & $this->conn;
447 447
         }
448 448
 
449 449
         return $conn->insert_id;
@@ -455,8 +455,8 @@  discard block
 block discarded – undo
455 455
      */
456 456
     public function getAffectedRows($conn = null)
457 457
     {
458
-        if (! ($conn instanceof mysqli)) {
459
-            $conn =& $this->conn;
458
+        if (!($conn instanceof mysqli)) {
459
+            $conn = & $this->conn;
460 460
         }
461 461
 
462 462
         return $conn->affected_rows;
@@ -468,8 +468,8 @@  discard block
 block discarded – undo
468 468
      */
469 469
     public function getLastError($conn = null)
470 470
     {
471
-        if (! ($conn instanceof mysqli)) {
472
-            $conn =& $this->conn;
471
+        if (!($conn instanceof mysqli)) {
472
+            $conn = & $this->conn;
473 473
         }
474 474
 
475 475
         return $conn->error;
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
     {
494 494
         $out = false;
495 495
         if ($ds instanceof mysqli_result) {
496
-            switch($mode){
496
+            switch ($mode) {
497 497
                 case 'assoc':
498 498
                     $out = $ds->fetch_assoc();
499 499
                     break;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
     public function getColumn($name, $dsq)
524 524
     {
525 525
         $col = array();
526
-        if ( ! ($dsq instanceof mysqli_result)) {
526
+        if (!($dsq instanceof mysqli_result)) {
527 527
             $dsq = $this->query($dsq);
528 528
         }
529 529
         if ($dsq) {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
     public function getColumnNames($dsq)
543 543
     {
544 544
         $names = array();
545
-        if ( ! ($dsq instanceof mysqli_result)) {
545
+        if (!($dsq instanceof mysqli_result)) {
546 546
             $dsq = $this->query($dsq);
547 547
         }
548 548
         if ($dsq) {
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
     public function getValue($dsq)
563 563
     {
564 564
         $out = false;
565
-        if ( ! ($dsq instanceof mysqli_result)) {
565
+        if (!($dsq instanceof mysqli_result)) {
566 566
             $dsq = $this->query($dsq);
567 567
         }
568 568
         if ($dsq) {
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
         $tableName = trim($tableName);
661 661
         $dbase = trim($this->config['dbase'], '`');
662 662
         $prefix = $this->config['table_prefix'];
663
-        if ((bool)$force === true) {
663
+        if ((bool) $force === true) {
664 664
             $result = "`{$dbase}`.`{$prefix}{$tableName}`";
665 665
         } elseif (strpos($tableName, '[+prefix+]') !== false) {
666 666
             $result = preg_replace('@\[\+prefix\+\]([0-9a-zA-Z_]+)@', "`{$dbase}`.`{$prefix}$1`", $tableName);
Please login to merge, or discard this patch.