@@ -4,15 +4,15 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), |
7 | - "recipient=" . $modx->getLoginUserID() . " AND messageread=0"); |
|
7 | + "recipient=".$modx->getLoginUserID()." AND messageread=0"); |
|
8 | 8 | $nrnewmessages = $modx->getDatabase()->getValue($rs); |
9 | -$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=" . $modx->getLoginUserID()); |
|
9 | +$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getDatabase()->getFullTableName('user_messages'), "recipient=".$modx->getLoginUserID()); |
|
10 | 10 | $nrtotalmessages = $modx->getDatabase()->getValue($rs); |
11 | 11 | $messagesallowed = $modx->hasPermission('messages'); |
12 | 12 | |
13 | 13 | // ajax response |
14 | 14 | if (isset($_POST['updateMsgCount'])) { |
15 | 15 | header("Content-Type: application/json; charset=utf-8"); |
16 | - print $nrnewmessages . ',' . $nrtotalmessages; |
|
16 | + print $nrnewmessages.','.$nrtotalmessages; |
|
17 | 17 | exit; |
18 | 18 | } |
@@ -1,6 +1,6 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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->getDatabase()->getFullTableName($resourceTable) . " AS {$resourceTable} |
|
123 | - LEFT JOIN " . $modx->getDatabase()->getFullTableName('categories') . " AS categories ON {$resourceTable}.category = categories.id {$tvjoin}", |
|
122 | + $modx->getDatabase()->getFullTableName($resourceTable)." AS {$resourceTable} |
|
123 | + LEFT JOIN ".$modx->getDatabase()->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 |
||
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 |
||
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 | } |
@@ -1,6 +1,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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->getDatabase()->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 |
||
126 | 134 | ); |
127 | 135 | $limit = $modx->getDatabase()->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->getDatabase()->getRow($rs)) { |
@@ -138,7 +148,8 @@ discard block |
||
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 |
||
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 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $this->db_tbl['categories'] = $modx->getDatabase()->getFullTableName('categories'); |
18 | 18 | |
19 | 19 | foreach ($this->elements as $element) { |
20 | - $this->db_tbl[$element] = $modx->getDatabase()->getFullTableName('site_' . $element); |
|
20 | + $this->db_tbl[$element] = $modx->getDatabase()->getFullTableName('site_'.$element); |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $this->db->select( |
52 | 52 | '*', |
53 | 53 | $this->db_tbl['categories'], |
54 | - "`" . $where . "` = '" . $this->db->escape($search) . "'" |
|
54 | + "`".$where."` = '".$this->db->escape($search)."'" |
|
55 | 55 | ) |
56 | 56 | ); |
57 | 57 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | { |
69 | 69 | $_value = $this->db->getValue( |
70 | 70 | $this->db->select( |
71 | - '`' . $value . '`', |
|
71 | + '`'.$value.'`', |
|
72 | 72 | $this->db_tbl['categories'], |
73 | - "`" . $where . "` = '" . $this->db->escape($search) . "'" |
|
73 | + "`".$where."` = '".$this->db->escape($search)."'" |
|
74 | 74 | ) |
75 | 75 | ); |
76 | 76 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->db->select( |
90 | 90 | '*', |
91 | 91 | $this->db_tbl[$element], |
92 | - "`category` = '" . (int)$category_id . "'" |
|
92 | + "`category` = '".(int) $category_id."'" |
|
93 | 93 | ) |
94 | 94 | ); |
95 | 95 | |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | $this->db->update( |
133 | 133 | $_update, |
134 | 134 | $this->db_tbl[$element], |
135 | - "`category` = '" . (int)$category_id . "'" |
|
135 | + "`category` = '".(int) $category_id."'" |
|
136 | 136 | ); |
137 | 137 | } |
138 | 138 | |
139 | 139 | $this->db->delete( |
140 | 140 | $this->db_tbl['categories'], |
141 | - "`id` = '" . (int)$category_id . "'" |
|
141 | + "`id` = '".(int) $category_id."'" |
|
142 | 142 | ); |
143 | 143 | |
144 | 144 | return $this->db->getAffectedRows() === 1; |
@@ -157,13 +157,13 @@ discard block |
||
157 | 157 | |
158 | 158 | $_update = array( |
159 | 159 | 'category' => $this->db->escape($data['category']), |
160 | - 'rank' => (int)$data['rank'] |
|
160 | + 'rank' => (int) $data['rank'] |
|
161 | 161 | ); |
162 | 162 | |
163 | 163 | $this->db->update( |
164 | 164 | $_update, |
165 | 165 | $this->db_tbl['categories'], |
166 | - "`id` = '" . (int)$category_id . "'" |
|
166 | + "`id` = '".(int) $category_id."'" |
|
167 | 167 | ); |
168 | 168 | |
169 | 169 | if ($this->db->getAffectedRows() === 1) { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | |
187 | 187 | $_insert = array( |
188 | 188 | 'category' => $this->db->escape($category_name), |
189 | - 'rank' => (int)$category_rank |
|
189 | + 'rank' => (int) $category_rank |
|
190 | 190 | ); |
191 | 191 | |
192 | 192 | $this->db->insert( |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $this->db->select( |
214 | 214 | '`id`', |
215 | 215 | $this->db_tbl['categories'], |
216 | - "`category` = '" . $category . "'" |
|
216 | + "`category` = '".$category."'" |
|
217 | 217 | ) |
218 | 218 | ); |
219 | 219 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | } |
38 | 38 | |
39 | -if(!function_exists('duplicateDocument')) { |
|
39 | +if (!function_exists('duplicateDocument')) { |
|
40 | 40 | /** |
41 | 41 | * @param int $docid |
42 | 42 | * @param null|int $parent |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('pagetitle', $modx->getDatabase()->getFullTableName('site_content'), |
91 | 91 | "pagetitle LIKE '{$pagetitle} Duplicate%'")); |
92 | 92 | if ($count >= 1) { |
93 | - $count = ' ' . ($count + 1); |
|
93 | + $count = ' '.($count + 1); |
|
94 | 94 | } else { |
95 | 95 | $count = ''; |
96 | 96 | } |
97 | 97 | |
98 | - $content['pagetitle'] = $_lang['duplicated_el_suffix'] . $count . ' ' . $content['pagetitle']; |
|
98 | + $content['pagetitle'] = $_lang['duplicated_el_suffix'].$count.' '.$content['pagetitle']; |
|
99 | 99 | $content['alias'] = null; |
100 | 100 | } elseif ($modx->config['friendly_urls'] == 0 || $modx->config['allow_duplicate_alias'] == 0) { |
101 | 101 | $content['alias'] = null; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
156 | -if(!function_exists('duplicateTVs')) { |
|
156 | +if (!function_exists('duplicateTVs')) { |
|
157 | 157 | /** |
158 | 158 | * Duplicate Document TVs |
159 | 159 | * |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | |
167 | 167 | $tbltvc = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
168 | 168 | |
169 | - $newid = (int)$newid; |
|
170 | - $oldid = (int)$oldid; |
|
169 | + $newid = (int) $newid; |
|
170 | + $oldid = (int) $oldid; |
|
171 | 171 | |
172 | 172 | $modx->getDatabase()->insert( |
173 | 173 | array('contentid' => '', 'tmplvarid' => '', 'value' => ''), $tbltvc, // Insert into |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | -if(!function_exists('duplicateAccess')) { |
|
179 | +if (!function_exists('duplicateAccess')) { |
|
180 | 180 | /** |
181 | 181 | * Duplicate Document Access Permissions |
182 | 182 | * |
@@ -189,8 +189,8 @@ discard block |
||
189 | 189 | |
190 | 190 | $tbldg = $modx->getDatabase()->getFullTableName('document_groups'); |
191 | 191 | |
192 | - $newid = (int)$newid; |
|
193 | - $oldid = (int)$oldid; |
|
192 | + $newid = (int) $newid; |
|
193 | + $oldid = (int) $oldid; |
|
194 | 194 | |
195 | 195 | $modx->getDatabase()->insert( |
196 | 196 | array('document' => '', 'document_group' => ''), $tbldg, // Insert into |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | -if(!function_exists('evalModule')) { |
|
202 | +if (!function_exists('evalModule')) { |
|
203 | 203 | /** |
204 | 204 | * evalModule |
205 | 205 | * |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | } |
236 | 236 | if ($modx->config['error_reporting'] === '99' || 2 < $error_level) { |
237 | 237 | $modx->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], |
238 | - $_SESSION['itemname'] . ' - Module', $error_info['message'], $error_info['line'], $msg); |
|
238 | + $_SESSION['itemname'].' - Module', $error_info['message'], $error_info['line'], $msg); |
|
239 | 239 | $modx->event->alert("An error occurred while loading. Please see the event log for more information<p>{$msg}</p>"); |
240 | 240 | } |
241 | 241 | } |
242 | 242 | unset($modx->event->params); |
243 | 243 | |
244 | - return $mod . $msg; |
|
244 | + return $mod.$msg; |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | |
248 | -if(!function_exists('allChildren')) { |
|
248 | +if (!function_exists('allChildren')) { |
|
249 | 249 | /** |
250 | 250 | * @param int $currDocID |
251 | 251 | * @return array |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | -if(!function_exists('jsAlert')) { |
|
268 | +if (!function_exists('jsAlert')) { |
|
269 | 269 | /** |
270 | 270 | * show javascript alert |
271 | 271 | * |
@@ -275,14 +275,14 @@ discard block |
||
275 | 275 | { |
276 | 276 | $modx = evolutionCMS(); |
277 | 277 | if ($_POST['ajax'] != 1) { |
278 | - echo "<script>window.setTimeout(\"alert('" . addslashes($modx->getDatabase()->escape($msg)) . "')\",10);history.go(-1)</script>"; |
|
278 | + echo "<script>window.setTimeout(\"alert('".addslashes($modx->getDatabase()->escape($msg))."')\",10);history.go(-1)</script>"; |
|
279 | 279 | } else { |
280 | - echo $msg . "\n"; |
|
280 | + echo $msg."\n"; |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
285 | -if(!function_exists('login')) { |
|
285 | +if (!function_exists('login')) { |
|
286 | 286 | /** |
287 | 287 | * @param string $username |
288 | 288 | * @param string $givenPassword |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | -if(!function_exists('loginV1')) { |
|
300 | +if (!function_exists('loginV1')) { |
|
301 | 301 | /** |
302 | 302 | * @param int $internalKey |
303 | 303 | * @param string $givenPassword |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
333 | -if(!function_exists('loginMD5')) { |
|
333 | +if (!function_exists('loginMD5')) { |
|
334 | 334 | /** |
335 | 335 | * @param int $internalKey |
336 | 336 | * @param string $givenPassword |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | -if(!function_exists('updateNewHash')) { |
|
354 | +if (!function_exists('updateNewHash')) { |
|
355 | 355 | /** |
356 | 356 | * @param string $username |
357 | 357 | * @param string $password |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
373 | -if(!function_exists('incrementFailedLoginCount')) { |
|
373 | +if (!function_exists('incrementFailedLoginCount')) { |
|
374 | 374 | /** |
375 | 375 | * @param int $internalKey |
376 | 376 | * @param int $failedlogins |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | |
398 | 398 | if ($failedlogins < $failed_allowed) { |
399 | 399 | //sleep to help prevent brute force attacks |
400 | - $sleep = (int)$failedlogins / 2; |
|
400 | + $sleep = (int) $failedlogins / 2; |
|
401 | 401 | if ($sleep > 5) { |
402 | 402 | $sleep = 5; |
403 | 403 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | } |
411 | 411 | } |
412 | 412 | |
413 | -if(!function_exists('saveUserGroupAccessPermissons')) { |
|
413 | +if (!function_exists('saveUserGroupAccessPermissons')) { |
|
414 | 414 | /** |
415 | 415 | * saves module user group access |
416 | 416 | */ |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | } |
442 | 442 | } |
443 | 443 | |
444 | -if(!function_exists('saveEventListeners')) { |
|
444 | +if (!function_exists('saveEventListeners')) { |
|
445 | 445 | # Save Plugin Event Listeners |
446 | 446 | function saveEventListeners($id, $sysevents, $mode) |
447 | 447 | { |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | -if(!function_exists('getEventIdByName')) { |
|
514 | +if (!function_exists('getEventIdByName')) { |
|
515 | 515 | /** |
516 | 516 | * @param string $name |
517 | 517 | * @return string|int |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
540 | -if(!function_exists('saveTemplateAccess')) { |
|
540 | +if (!function_exists('saveTemplateAccess')) { |
|
541 | 541 | /** |
542 | 542 | * @param int $id |
543 | 543 | */ |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | } |
577 | 577 | } |
578 | 578 | |
579 | -if(!function_exists('saveTemplateVarAccess')) { |
|
579 | +if (!function_exists('saveTemplateVarAccess')) { |
|
580 | 580 | /** |
581 | 581 | * @return void |
582 | 582 | */ |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | } |
616 | 616 | } |
617 | 617 | |
618 | -if(!function_exists('saveDocumentAccessPermissons')) { |
|
618 | +if (!function_exists('saveDocumentAccessPermissons')) { |
|
619 | 619 | function saveDocumentAccessPermissons() |
620 | 620 | { |
621 | 621 | global $id, $newid; |
@@ -784,10 +784,10 @@ discard block |
||
784 | 784 | } |
785 | 785 | |
786 | 786 | foreach ($defaults as $k) { |
787 | - if (isset($settings['default_' . $k]) && $settings['default_' . $k] == '1') { |
|
787 | + if (isset($settings['default_'.$k]) && $settings['default_'.$k] == '1') { |
|
788 | 788 | unset($settings[$k]); |
789 | 789 | } |
790 | - unset($settings['default_' . $k]); |
|
790 | + unset($settings['default_'.$k]); |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | $modx->getDatabase()->delete($tbl_user_settings, "user='{$id}'"); |
@@ -819,7 +819,7 @@ discard block |
||
819 | 819 | global $id, $modx; |
820 | 820 | $mode = $_POST['mode']; |
821 | 821 | $modx->getManagerApi()->saveFormValues($mode); |
822 | - $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode === $action ? "&id={$id}" : '')); |
|
822 | + $modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode === $action ? "&id={$id}" : '')); |
|
823 | 823 | } |
824 | 824 | } |
825 | 825 | |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | global $deltime; |
836 | 836 | |
837 | 837 | $rs = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('site_content'), |
838 | - "parent='" . (int)$parent . "' AND deleted=1 AND deletedon='" . (int)$deltime . "'"); |
|
838 | + "parent='".(int) $parent."' AND deleted=1 AND deletedon='".(int) $deltime."'"); |
|
839 | 839 | // the document has children documents, we'll need to delete those too |
840 | 840 | while ($row = $modx->getDatabase()->getRow($rs)) { |
841 | 841 | $children[] = $row['id']; |
@@ -384,10 +384,12 @@ |
||
384 | 384 | $failedlogins += 1; |
385 | 385 | |
386 | 386 | $fields = array('failedlogincount' => $failedlogins); |
387 | - if ($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
387 | + if ($failedlogins >= $failed_allowed) { |
|
388 | + //block user for too many fail attempts |
|
388 | 389 | { |
389 | 390 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
390 | 391 | } |
392 | + } |
|
391 | 393 | |
392 | 394 | $modx->getDatabase()->update( |
393 | 395 | $fields, |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!function_exists('makeHTML')) { |
|
3 | +if (!function_exists('makeHTML')) { |
|
4 | 4 | /** |
5 | 5 | * @param int $indent |
6 | 6 | * @param int $parent |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | case 'publishedon': |
38 | 38 | case 'pub_date': |
39 | 39 | case 'unpub_date': |
40 | - $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], |
|
41 | - 'sc.' . $_SESSION['tree_sortby']); |
|
40 | + $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], |
|
41 | + 'sc.'.$_SESSION['tree_sortby']); |
|
42 | 42 | break; |
43 | 43 | default: |
44 | - $sortby = 'sc.' . $_SESSION['tree_sortby']; |
|
44 | + $sortby = 'sc.'.$_SESSION['tree_sortby']; |
|
45 | 45 | }; |
46 | 46 | |
47 | - $orderby = $modx->getDatabase()->escape($sortby . ' ' . $_SESSION['tree_sortdir']); |
|
47 | + $orderby = $modx->getDatabase()->escape($sortby.' '.$_SESSION['tree_sortdir']); |
|
48 | 48 | |
49 | 49 | // Folder sorting gets special setup ;) Add menuindex and pagetitle |
50 | 50 | if ($_SESSION['tree_sortby'] == 'isfolder') { |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $_SESSION['mgrDocgroups']) : ''; |
60 | 60 | $showProtected = false; |
61 | 61 | if (isset ($modx->config['tree_show_protected'])) { |
62 | - $showProtected = (boolean)$modx->config['tree_show_protected']; |
|
62 | + $showProtected = (boolean) $modx->config['tree_show_protected']; |
|
63 | 63 | } |
64 | - $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
64 | + $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0'; |
|
65 | 65 | if ($showProtected == false) { |
66 | - $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
66 | + $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
67 | 67 | } else { |
68 | 68 | $access = ''; |
69 | 69 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | $weblinkDisplay = $row['type'] == 'reference' ? sprintf(' %s', $_style['tree_linkgo']) : ''; |
103 | - $pageIdDisplay = '<small>(' . ($modx_textdir ? '‏' : '') . $row['id'] . ')</small>'; |
|
103 | + $pageIdDisplay = '<small>('.($modx_textdir ? '‏' : '').$row['id'].')</small>'; |
|
104 | 104 | |
105 | 105 | // Prepare displaying user-locks |
106 | 106 | $lockedByUser = ''; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'element_type' => $_lang["lock_element_type_7"], |
112 | 112 | 'lasthit_df' => $rowLock['lasthit_df'] |
113 | 113 | )); |
114 | - $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>'; |
|
114 | + $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>'; |
|
115 | 115 | } else { |
116 | 116 | $title = $modx->parseText($_lang["lock_element_locked_by"], array( |
117 | 117 | 'element_type' => $_lang["lock_element_type_7"], |
@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | 'lasthit_df' => $rowLock['lasthit_df'] |
120 | 120 | )); |
121 | 121 | if ($modx->hasPermission('remove_locks')) { |
122 | - $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
122 | + $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
123 | 123 | } else { |
124 | - $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>'; |
|
124 | + $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>'; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | |
131 | 131 | $title = ''; |
132 | 132 | if (isDateNode($nodeNameSource)) { |
133 | - $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]'; |
|
133 | + $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]'; |
|
134 | 134 | } |
135 | - $title .= $_lang['id'] . ': ' . $row['id']; |
|
136 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle']; |
|
137 | - $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex']; |
|
138 | - $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-'); |
|
139 | - $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename']; |
|
140 | - $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']); |
|
141 | - $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']); |
|
142 | - $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
143 | - $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
144 | - $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
145 | - $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
146 | - $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
135 | + $title .= $_lang['id'].': '.$row['id']; |
|
136 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle']; |
|
137 | + $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex']; |
|
138 | + $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-'); |
|
139 | + $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename']; |
|
140 | + $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']); |
|
141 | + $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']); |
|
142 | + $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']); |
|
143 | + $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']); |
|
144 | + $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
145 | + $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
146 | + $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']); |
|
147 | 147 | $title = $modx->getPhpCompat()->htmlspecialchars($title); |
148 | - $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
148 | + $title = str_replace('[+lf+]', ' ', $title); // replace line-breaks with empty space as fall-back |
|
149 | 149 | |
150 | 150 | $data = array( |
151 | 151 | 'id' => $row['id'], |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | } |
230 | 230 | |
231 | 231 | if ($ph['contextmenu']) { |
232 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
232 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | if ($_SESSION['tree_show_only_folders']) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | } |
288 | 288 | |
289 | 289 | if ($ph['contextmenu']) { |
290 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
290 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | $node .= $modx->parseText($tpl, $ph); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | if ($ph['contextmenu']) { |
328 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
328 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | $node .= $modx->parseText($tpl, $ph); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | if ($ph['contextmenu']) { |
379 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
379 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | $node .= $modx->parseText($tpl, $ph); |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | } |
419 | 419 | |
420 | 420 | if ($ph['contextmenu']) { |
421 | - $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"'; |
|
421 | + $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"'; |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | $node .= $modx->parseText($tpl, $ph); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | } |
445 | 445 | } |
446 | 446 | |
447 | -if(!function_exists('getIconInfo')) { |
|
447 | +if (!function_exists('getIconInfo')) { |
|
448 | 448 | /** |
449 | 449 | * @param array $_style |
450 | 450 | * @return array |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | |
481 | -if(!function_exists('getNodeTitle')) { |
|
481 | +if (!function_exists('getNodeTitle')) { |
|
482 | 482 | /** |
483 | 483 | * @param string $nodeNameSource |
484 | 484 | * @param array $row |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | $nodetitle .= $modx->config['friendly_url_suffix']; |
500 | 500 | } |
501 | 501 | } |
502 | - $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle; |
|
502 | + $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle; |
|
503 | 503 | break; |
504 | 504 | case 'pagetitle': |
505 | 505 | $nodetitle = $row['pagetitle']; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | } |
534 | 534 | } |
535 | 535 | |
536 | -if(!function_exists('isDateNode')) { |
|
536 | +if (!function_exists('isDateNode')) { |
|
537 | 537 | /** |
538 | 538 | * @param string $nodeNameSource |
539 | 539 | * @return bool |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
556 | -if(!function_exists('checkIsFolder')) { |
|
556 | +if (!function_exists('checkIsFolder')) { |
|
557 | 557 | /** |
558 | 558 | * @param int $parent |
559 | 559 | * @param int $isfolder |
@@ -563,11 +563,11 @@ discard block |
||
563 | 563 | { |
564 | 564 | $modx = evolutionCMS(); |
565 | 565 | |
566 | - return (int)$modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM ' . $modx->getDatabase()->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
|
566 | + return (int) $modx->getDatabase()->getValue($modx->getDatabase()->query('SELECT count(*) FROM '.$modx->getDatabase()->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' ')); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
570 | -if(!function_exists('_htmlentities')) { |
|
570 | +if (!function_exists('_htmlentities')) { |
|
571 | 571 | /** |
572 | 572 | * @param mixed $array |
573 | 573 | * @return string |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | } |
584 | 584 | } |
585 | 585 | |
586 | -if(!function_exists('getTplSingleNode')) { |
|
586 | +if (!function_exists('getTplSingleNode')) { |
|
587 | 587 | /** |
588 | 588 | * @return string |
589 | 589 | */ |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
616 | -if(!function_exists('getTplFolderNode')) { |
|
616 | +if (!function_exists('getTplFolderNode')) { |
|
617 | 617 | /** |
618 | 618 | * @return string |
619 | 619 | */ |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>'; |
655 | 655 | } |
656 | 656 | } |
657 | -if(!function_exists('getTplFolderNodeNotChildren')) { |
|
657 | +if (!function_exists('getTplFolderNodeNotChildren')) { |
|
658 | 658 | /** |
659 | 659 | * @return string |
660 | 660 | */ |
@@ -20,14 +20,14 @@ |
||
20 | 20 | ($docid > 0 ? "id='$docid'" : "privateweb = 1")); |
21 | 21 | $rs = $modx->getDatabase()->select( |
22 | 22 | 'DISTINCT sc.id', |
23 | - $modx->getDatabase()->getFullTableName("site_content") . " sc |
|
24 | - LEFT JOIN " . $modx->getDatabase()->getFullTableName("document_groups") . " dg ON dg.document = sc.id |
|
25 | - LEFT JOIN " . $modx->getDatabase()->getFullTableName("webgroup_access") . " wga ON wga.documentgroup = dg.document_group", |
|
26 | - ($docid > 0 ? " sc.id='{$docid}' AND " : "") . "wga.id>0" |
|
23 | + $modx->getDatabase()->getFullTableName("site_content")." sc |
|
24 | + LEFT JOIN " . $modx->getDatabase()->getFullTableName("document_groups")." dg ON dg.document = sc.id |
|
25 | + LEFT JOIN " . $modx->getDatabase()->getFullTableName("webgroup_access")." wga ON wga.documentgroup = dg.document_group", |
|
26 | + ($docid > 0 ? " sc.id='{$docid}' AND " : "")."wga.id>0" |
|
27 | 27 | ); |
28 | 28 | $ids = $modx->getDatabase()->getColumn("id", $rs); |
29 | 29 | if (count($ids) > 0) { |
30 | 30 | $modx->getDatabase()->update('privateweb = 1', $modx->getDatabase()->getFullTableName("site_content"), |
31 | - "id IN (" . implode(", ", $ids) . ")"); |
|
31 | + "id IN (".implode(", ", $ids).")"); |
|
32 | 32 | } |
33 | 33 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
7 | 7 | } |
8 | 8 | |
9 | -require_once(dirname(__FILE__) . '/protect.inc.php'); |
|
9 | +require_once(dirname(__FILE__).'/protect.inc.php'); |
|
10 | 10 | |
11 | 11 | $action = preg_replace('/[^A-Za-z0-9_\-\.\/]/', '', $_POST['action']); |
12 | 12 | $lang = preg_replace('/[^A-Za-z0-9_\s\+\-\.\/]/', '', $_POST['lang']); |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | |
24 | 24 | switch (true) { |
25 | 25 | case ($action == 'get' && preg_match('/^[A-z0-9_-]+$/', |
26 | - $lang) && file_exists(dirname(__FILE__) . '/lang/' . $lang . '.inc.php')): { |
|
27 | - include(dirname(__FILE__) . '/lang/' . $lang . '.inc.php'); |
|
26 | + $lang) && file_exists(dirname(__FILE__).'/lang/'.$lang.'.inc.php')): { |
|
27 | + include(dirname(__FILE__).'/lang/'.$lang.'.inc.php'); |
|
28 | 28 | $str = isset($key, $_lang, $_lang[$key]) ? $_lang[$key] : ""; |
29 | 29 | break; |
30 | 30 | } |
31 | 31 | case ($action == 'setsetting' && !empty($key) && !empty($value)): { |
32 | - $sql = "REPLACE INTO " . $modx->getDatabase()->getFullTableName("system_settings") . " (setting_name, setting_value) VALUES('{$key}', '{$value}');"; |
|
32 | + $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value) VALUES('{$key}', '{$value}');"; |
|
33 | 33 | $str = "true"; |
34 | 34 | $modx->getDatabase()->query($sql); |
35 | 35 | $emptyCache = true; |
@@ -2,29 +2,29 @@ |
||
2 | 2 | $userID = abs($modx->getLoginUserID('web')); |
3 | 3 | $modx->qs_hash = md5($modx->qs_hash."^{$userID}^"); |
4 | 4 | |
5 | -$groupNames = ($this->strlen($opt) > 0 ) ? explode(',',$opt) : array(); |
|
5 | +$groupNames = ($this->strlen($opt) > 0) ? explode(',', $opt) : array(); |
|
6 | 6 | |
7 | 7 | // if $groupNames is not an array return false |
8 | -if(!is_array($groupNames)) return 0; |
|
8 | +if (!is_array($groupNames)) return 0; |
|
9 | 9 | |
10 | 10 | // Creates an array with all webgroups the user id is in |
11 | 11 | if (isset($modx->getModifiers()->cache['mo'][$userID])) $grpNames = $modx->getModifiers()->cache['mo'][$userID]; |
12 | 12 | else { |
13 | 13 | $from = sprintf( |
14 | - $modx->getDatabase()->getFullTableName('webgroup_names') . |
|
15 | - " wgn INNER JOIN " . |
|
16 | - $modx->getDatabase()->getFullTableName('web_groups') . |
|
14 | + $modx->getDatabase()->getFullTableName('webgroup_names'). |
|
15 | + " wgn INNER JOIN ". |
|
16 | + $modx->getDatabase()->getFullTableName('web_groups'). |
|
17 | 17 | " wg ON wg.webgroup=wgn.id AND wg.webuser='%s'", |
18 | 18 | |
19 | 19 | $userID |
20 | 20 | ); |
21 | - $rs = $modx->getDatabase()->select('wgn.name',$from); |
|
22 | - $modx->getModifiers()->cache['mo'][$userID] = $grpNames = $modx->getDatabase()->getColumn('name',$rs); |
|
21 | + $rs = $modx->getDatabase()->select('wgn.name', $from); |
|
22 | + $modx->getModifiers()->cache['mo'][$userID] = $grpNames = $modx->getDatabase()->getColumn('name', $rs); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | // Check if a supplied group matches a webgroup from the array we just created |
26 | -foreach($groupNames as $k=>$v) { |
|
27 | - if(in_array(trim($v),$grpNames)) return 1; |
|
26 | +foreach ($groupNames as $k=>$v) { |
|
27 | + if (in_array(trim($v), $grpNames)) return 1; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | // If we get here the above logic did not find a match, so return false |
@@ -5,11 +5,14 @@ discard block |
||
5 | 5 | $groupNames = ($this->strlen($opt) > 0 ) ? explode(',',$opt) : array(); |
6 | 6 | |
7 | 7 | // if $groupNames is not an array return false |
8 | -if(!is_array($groupNames)) return 0; |
|
8 | +if(!is_array($groupNames)) { |
|
9 | + return 0; |
|
10 | +} |
|
9 | 11 | |
10 | 12 | // Creates an array with all webgroups the user id is in |
11 | -if (isset($modx->getModifiers()->cache['mo'][$userID])) $grpNames = $modx->getModifiers()->cache['mo'][$userID]; |
|
12 | -else { |
|
13 | +if (isset($modx->getModifiers()->cache['mo'][$userID])) { |
|
14 | + $grpNames = $modx->getModifiers()->cache['mo'][$userID]; |
|
15 | +} else { |
|
13 | 16 | $from = sprintf( |
14 | 17 | $modx->getDatabase()->getFullTableName('webgroup_names') . |
15 | 18 | " wgn INNER JOIN " . |
@@ -24,8 +27,10 @@ discard block |
||
24 | 27 | |
25 | 28 | // Check if a supplied group matches a webgroup from the array we just created |
26 | 29 | foreach($groupNames as $k=>$v) { |
27 | - if(in_array(trim($v),$grpNames)) return 1; |
|
28 | -} |
|
30 | + if(in_array(trim($v),$grpNames)) { |
|
31 | + return 1; |
|
32 | + } |
|
33 | + } |
|
29 | 34 | |
30 | 35 | // If we get here the above logic did not find a match, so return false |
31 | 36 | return 0; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $newCat = $modx->getDatabase()->escape($newCat); |
35 | 35 | $cats = $modx->getDatabase()->select('id', $modx->getDatabase()->getFullTableName('categories'), "category='{$newCat}'"); |
36 | 36 | if ($cat = $modx->getDatabase()->getValue($cats)) { |
37 | - return (int)$cat; |
|
37 | + return (int) $cat; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return 0; |