@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once MODX_MANAGER_PATH . 'includes/functions/tv.php'; |
|
3 | +include_once MODX_MANAGER_PATH.'includes/functions/tv.php'; |
@@ -1,3 +1,3 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once MODX_MANAGER_PATH . 'includes/functions/tv.php'; |
|
3 | +include_once MODX_MANAGER_PATH.'includes/functions/tv.php'; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | <?php endif; ?> |
66 | 66 | <?php endif; ?> |
67 | 67 | |
68 | -<?php if ($installLevel >= 2 && $moduleSQLBaseFile) : ?> |
|
68 | +<?php if ($installLevel >= 2 && $moduleSQLBaseFile) : ?> |
|
69 | 69 | <?php if ($sqlParser->installFailed === false) : ?> |
70 | 70 | <p> |
71 | 71 | <?=$_lang['setup_database_creating_tables']?> |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | <?php $sqlErrors = count($sqlParser->mysqlErrors); ?> |
77 | 77 | <?php for ($i = 0; $i < $sqlErrors; $i++) : ?> |
78 | 78 | <em><?=$sqlParser->mysqlErrors[$i]["error"]?></em> |
79 | - <?=$_lang['during_execution_of_sql'];?> |
|
79 | + <?=$_lang['during_execution_of_sql']; ?> |
|
80 | 80 | <span class="mono"><?=strip_tags($sqlParser->mysqlErrors[$i]["sql"])?></span> |
81 | 81 | <hr /> |
82 | 82 | <?php endfor; ?> |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | <?php $sqlErrors = count($sqlParser->mysqlErrors); ?> |
113 | 113 | <?php for ($i = 0; $i < $sqlErrors; $i++) : ?> |
114 | 114 | <em><?=$sqlParser->mysqlErrors[$i]["error"]?></em> <?=$_lang['during_execution_of_sql']?> |
115 | - <span class='mono'><?=strip_tags($sqlParser->mysqlErrors[$i]["sql"]);?></span> |
|
115 | + <span class='mono'><?=strip_tags($sqlParser->mysqlErrors[$i]["sql"]); ?></span> |
|
116 | 116 | <hr /> |
117 | 117 | <?php endfor; ?> |
118 | 118 | </p> |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | <h3><?=$_lang['templates']?>:</h3> |
131 | 131 | <?php foreach ($installDataLevel['templates'] as $itemName => $itemData) : ?> |
132 | 132 | <?php if (empty($itemData['error'])) : ?> |
133 | - <?php if($itemData['type'] === 'create') : ?> |
|
133 | + <?php if ($itemData['type'] === 'create') : ?> |
|
134 | 134 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p> |
135 | - <?php elseif($itemData['type'] === 'update') : ?> |
|
135 | + <?php elseif ($itemData['type'] === 'update') : ?> |
|
136 | 136 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p> |
137 | 137 | <?php endif; ?> |
138 | 138 | <?php else : ?> |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | <h3><?=$_lang['tvs']?>:</h3> |
155 | 155 | <?php foreach ($installDataLevel['tvs'] as $itemName => $itemData) : ?> |
156 | 156 | <?php if (empty($itemData['error'])) : ?> |
157 | - <?php if($itemData['type'] === 'create') : ?> |
|
157 | + <?php if ($itemData['type'] === 'create') : ?> |
|
158 | 158 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p> |
159 | - <?php elseif($itemData['type'] === 'update') : ?> |
|
159 | + <?php elseif ($itemData['type'] === 'update') : ?> |
|
160 | 160 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p> |
161 | - <?php elseif($itemData['type'] === 'skip') : ?> |
|
161 | + <?php elseif ($itemData['type'] === 'skip') : ?> |
|
162 | 162 | <!-- SKIP --> |
163 | 163 | <?php endif; ?> |
164 | 164 | <?php else : ?> |
@@ -173,13 +173,13 @@ discard block |
||
173 | 173 | <h3><?=$_lang['chunks']?>:</h3> |
174 | 174 | <?php foreach ($installDataLevel['chunks'] as $itemName => $itemData) : ?> |
175 | 175 | <?php if (empty($itemData['error'])) : ?> |
176 | - <?php if($itemData['type'] === 'create') : ?> |
|
176 | + <?php if ($itemData['type'] === 'create') : ?> |
|
177 | 177 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p> |
178 | - <?php elseif($itemData['type'] === 'overwrite') : ?> |
|
178 | + <?php elseif ($itemData['type'] === 'overwrite') : ?> |
|
179 | 179 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p> |
180 | - <?php elseif($itemData['type'] === 'update') : ?> |
|
180 | + <?php elseif ($itemData['type'] === 'update') : ?> |
|
181 | 181 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p> |
182 | - <?php elseif($itemData['type'] === 'skip') : ?> |
|
182 | + <?php elseif ($itemData['type'] === 'skip') : ?> |
|
183 | 183 | <!-- SKIP --> |
184 | 184 | <?php endif; ?> |
185 | 185 | <?php else : ?> |
@@ -201,11 +201,11 @@ discard block |
||
201 | 201 | <h3><?=$_lang['modules']?>:</h3> |
202 | 202 | <?php foreach ($installDataLevel['modules'] as $itemName => $itemData) : ?> |
203 | 203 | <?php if (empty($itemData['error'])) : ?> |
204 | - <?php if($itemData['type'] === 'create') : ?> |
|
204 | + <?php if ($itemData['type'] === 'create') : ?> |
|
205 | 205 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p> |
206 | - <?php elseif($itemData['type'] === 'update') : ?> |
|
206 | + <?php elseif ($itemData['type'] === 'update') : ?> |
|
207 | 207 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p> |
208 | - <?php elseif($itemData['type'] === 'skip') : ?> |
|
208 | + <?php elseif ($itemData['type'] === 'skip') : ?> |
|
209 | 209 | <!-- SKIP --> |
210 | 210 | <?php endif; ?> |
211 | 211 | <?php else : ?> |
@@ -227,11 +227,11 @@ discard block |
||
227 | 227 | <h3><?=$_lang['plugins']?>:</h3> |
228 | 228 | <?php foreach ($installDataLevel['plugins'] as $itemName => $itemData) : ?> |
229 | 229 | <?php if (empty($itemData['error'])) : ?> |
230 | - <?php if($itemData['type'] === 'create') : ?> |
|
230 | + <?php if ($itemData['type'] === 'create') : ?> |
|
231 | 231 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p> |
232 | - <?php elseif($itemData['type'] === 'update') : ?> |
|
232 | + <?php elseif ($itemData['type'] === 'update') : ?> |
|
233 | 233 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p> |
234 | - <?php elseif($itemData['type'] === 'skip') : ?> |
|
234 | + <?php elseif ($itemData['type'] === 'skip') : ?> |
|
235 | 235 | <!-- SKIP --> |
236 | 236 | <?php endif; ?> |
237 | 237 | <?php else : ?> |
@@ -253,13 +253,13 @@ discard block |
||
253 | 253 | <h3><?=$_lang['snippets']?>:</h3> |
254 | 254 | <?php foreach ($installDataLevel['snippets'] as $itemName => $itemData) : ?> |
255 | 255 | <?php if (empty($itemData['error'])) : ?> |
256 | - <?php if($itemData['type'] === 'create') : ?> |
|
256 | + <?php if ($itemData['type'] === 'create') : ?> |
|
257 | 257 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p> |
258 | - <?php elseif($itemData['type'] === 'overwrite') : ?> |
|
258 | + <?php elseif ($itemData['type'] === 'overwrite') : ?> |
|
259 | 259 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['installed']?></span></p> |
260 | - <?php elseif($itemData['type'] === 'update') : ?> |
|
260 | + <?php elseif ($itemData['type'] === 'update') : ?> |
|
261 | 261 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p> |
262 | - <?php elseif($itemData['type'] === 'skip') : ?> |
|
262 | + <?php elseif ($itemData['type'] === 'skip') : ?> |
|
263 | 263 | <!-- SKIP --> |
264 | 264 | <?php endif; ?> |
265 | 265 | <?php else : ?> |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | <p><?=$_lang['setup_couldnt_install']?></p> |
287 | 287 | <p><?=$_lang['installation_error_occured']?></p> |
288 | 288 | <br /><br /> |
289 | - <?php foreach($installDataLevel['demo']['error'] as $error): ?> |
|
289 | + <?php foreach ($installDataLevel['demo']['error'] as $error): ?> |
|
290 | 290 | <em><?=$error['content']?></em> |
291 | 291 | <?=$_lang['during_execution_of_sql']?> |
292 | 292 | <span class="mono"><?=htmlspecialchars($error['sql'])?></span> |
@@ -300,9 +300,9 @@ discard block |
||
300 | 300 | <?php if ($installLevel >= 6): ?> |
301 | 301 | <?php foreach ($installDependencyLevel as $itemName => $itemData) : ?> |
302 | 302 | <?php if (empty($itemData['error'])) : ?> |
303 | - <?php if($itemData['type'] === 'create') : ?> |
|
303 | + <?php if ($itemData['type'] === 'create') : ?> |
|
304 | 304 | <p> ✓ <?=$itemName?>Module: <span class="ok"><?=$_lang['depedency_create']?></span></p> |
305 | - <?php elseif($itemData['type'] === 'update') : ?> |
|
305 | + <?php elseif ($itemData['type'] === 'update') : ?> |
|
306 | 306 | <p> ✓ <?=$itemName?>Module: <span class="ok"><?=$_lang['depedency_update']?></span></p> |
307 | 307 | <?php endif; ?> |
308 | 308 | |
@@ -370,10 +370,10 @@ discard block |
||
370 | 370 | var chk = document.install.rminstaller; |
371 | 371 | if (chk && chk.checked) { |
372 | 372 | // remove install folder and files |
373 | - window.location.href = "../<?=MGR_DIR;?>/processors/remove_installer.processor.php?rminstall=1"; |
|
373 | + window.location.href = "../<?=MGR_DIR; ?>/processors/remove_installer.processor.php?rminstall=1"; |
|
374 | 374 | } |
375 | 375 | else { |
376 | - window.location.href = "../<?=MGR_DIR;?>/"; |
|
376 | + window.location.href = "../<?=MGR_DIR; ?>/"; |
|
377 | 377 | } |
378 | 378 | } |
379 | 379 | /* ]]> */ |
@@ -16,7 +16,8 @@ discard block |
||
16 | 16 | <span class="notok"><?=$_lang['setup_database_create_connection_failed']?></span> |
17 | 17 | </p> |
18 | 18 | <p><?=$_lang['setup_database_create_connection_failed_note']?></p> |
19 | -<?php else : ?> |
|
19 | +<?php else { |
|
20 | + : ?> |
|
20 | 21 | <p><?=$_lang['setup_database_create_connection']?> <span class="ok"><?=$_lang['ok']?></span></p> |
21 | 22 | <?php if ($selectDatabase === false) : ?> |
22 | 23 | <p><?=rtrim($_lang['setup_database_selection'], '`')?> <strong><?=trim($dbase, '`')?></strong>: |
@@ -41,13 +42,18 @@ discard block |
||
41 | 42 | <?=rtrim($_lang['setup_database_creation'], '`')?> <strong><?=trim($dbase, '`')?></strong>: |
42 | 43 | <span class="ok"><?=$_lang['ok']?></span> |
43 | 44 | </p> |
44 | - <?php endif; ?> |
|
45 | - <?php else : ?> |
|
45 | + <?php endif; |
|
46 | +} |
|
47 | +?> |
|
48 | + <?php else { |
|
49 | + : ?> |
|
46 | 50 | <p> |
47 | 51 | <?=rtrim($_lang['setup_database_selection'], '`')?> <strong><?=trim($dbase, '`')?></strong>: |
48 | 52 | <span class="ok"><?=$_lang['ok']?></span> |
49 | 53 | </p> |
50 | - <?php endif; ?> |
|
54 | + <?php endif; |
|
55 | +} |
|
56 | +?> |
|
51 | 57 | <?php endif; ?> |
52 | 58 | |
53 | 59 | <?php if ($installLevel >= 1) : ?> |
@@ -57,12 +63,15 @@ discard block |
||
57 | 63 | <span class="notok"><?=$_lang['failed']?></span> <?=$_lang['table_prefix_already_inuse']?> |
58 | 64 | </p> |
59 | 65 | <p><?=$_lang['table_prefix_already_inuse_note']?></p> |
60 | - <?php else : ?> |
|
66 | + <?php else { |
|
67 | + : ?> |
|
61 | 68 | <p> |
62 | 69 | <?=rtrim($_lang['checking_table_prefix'], '`')?> <strong><?=trim($table_prefix, '`')?></strong>: |
63 | 70 | <span class="ok"><?=$_lang['ok']?></span> |
64 | 71 | </p> |
65 | - <?php endif; ?> |
|
72 | + <?php endif; |
|
73 | +} |
|
74 | +?> |
|
66 | 75 | <?php endif; ?> |
67 | 76 | |
68 | 77 | <?php if ($installLevel >= 2 && $moduleSQLBaseFile) : ?> |
@@ -81,9 +90,12 @@ discard block |
||
81 | 90 | <hr /> |
82 | 91 | <?php endfor; ?> |
83 | 92 | <p><?=$_lang['some_tables_not_updated']?></p> |
84 | - <?php else : ?> |
|
93 | + <?php else { |
|
94 | + : ?> |
|
85 | 95 | <p><?=$_lang['setup_database_creating_tables']?> <span class="ok"><?=$_lang['ok']?></span></p> |
86 | - <?php endif; ?> |
|
96 | + <?php endif; |
|
97 | +} |
|
98 | +?> |
|
87 | 99 | <?php endif; ?> |
88 | 100 | |
89 | 101 | <?php if ($installLevel >= 3) : ?> |
@@ -94,11 +106,14 @@ discard block |
||
94 | 106 | <p><?=$_lang['cant_write_config_file']?> <span class="mono"><?=MGR_DIR?>/includes/config.inc.php</span></p> |
95 | 107 | <textarea style="width:400px; height:160px;"><?=$configString?></textarea> |
96 | 108 | <p><?=$_lang['cant_write_config_file_note']?></p> |
97 | - <?php else : ?> |
|
109 | + <?php else { |
|
110 | + : ?> |
|
98 | 111 | <p> |
99 | 112 | <?=$_lang['writing_config_file']?> <span class="ok"><?=$_lang['ok']?></span> |
100 | 113 | </p> |
101 | - <?php endif; ?> |
|
114 | + <?php endif; |
|
115 | +} |
|
116 | +?> |
|
102 | 117 | <?php endif; ?> |
103 | 118 | |
104 | 119 | <?php if ($installLevel >= 4 && $installData && $moduleSQLDataFile && $moduleSQLResetFile) : ?> |
@@ -117,12 +132,15 @@ discard block |
||
117 | 132 | <?php endfor; ?> |
118 | 133 | </p> |
119 | 134 | <p><?=$_lang['some_tables_not_updated']?></p> |
120 | - <?php else : ?> |
|
135 | + <?php else { |
|
136 | + : ?> |
|
121 | 137 | <p> |
122 | 138 | <?=$_lang['resetting_database']?> |
123 | 139 | <span class="ok"><?=$_lang['ok']?></span> |
124 | 140 | </p> |
125 | - <?php endif; ?> |
|
141 | + <?php endif; |
|
142 | +} |
|
143 | +?> |
|
126 | 144 | <?php endif; ?> |
127 | 145 | |
128 | 146 | <?php if ($installLevel >= 5) : ?> |
@@ -135,7 +153,8 @@ discard block |
||
135 | 153 | <?php elseif($itemData['type'] === 'update') : ?> |
136 | 154 | <p> ✓ <?=$itemName?>: <span class="ok"><?=$_lang['upgraded']?></span></p> |
137 | 155 | <?php endif; ?> |
138 | - <?php else : ?> |
|
156 | + <?php else { |
|
157 | + : ?> |
|
139 | 158 | <?php if ($itemData['error']['type'] === 'sql') : ?> |
140 | 159 | <p>❌ <?=$itemData['error']['content']?></p> |
141 | 160 | <?php elseif ($itemData['error']['type'] === 'file_not_found') : ?> |
@@ -145,7 +164,9 @@ discard block |
||
145 | 164 | <?=$_lang['not_found']?>. |
146 | 165 | </span> |
147 | 166 | </p> |
148 | - <?php endif; ?> |
|
167 | + <?php endif; |
|
168 | +} |
|
169 | +?> |
|
149 | 170 | <?php endif; ?> |
150 | 171 | <?php endforeach; ?> |
151 | 172 | <?php endif; ?> |
@@ -161,10 +182,13 @@ discard block |
||
161 | 182 | <?php elseif($itemData['type'] === 'skip') : ?> |
162 | 183 | <!-- SKIP --> |
163 | 184 | <?php endif; ?> |
164 | - <?php else : ?> |
|
185 | + <?php else { |
|
186 | + : ?> |
|
165 | 187 | <?php if ($itemData['error']['type'] === 'sql') : ?> |
166 | 188 | <p>❌ <?=$itemData['error']['content']?></p> |
167 | - <?php endif; ?> |
|
189 | + <?php endif; |
|
190 | +} |
|
191 | +?> |
|
168 | 192 | <?php endif; ?> |
169 | 193 | <?php endforeach; ?> |
170 | 194 | <?php endif; ?> |
@@ -182,7 +206,8 @@ discard block |
||
182 | 206 | <?php elseif($itemData['type'] === 'skip') : ?> |
183 | 207 | <!-- SKIP --> |
184 | 208 | <?php endif; ?> |
185 | - <?php else : ?> |
|
209 | + <?php else { |
|
210 | + : ?> |
|
186 | 211 | <?php if ($itemData['error']['type'] === 'sql') : ?> |
187 | 212 | <p>❌ <?=$itemData['error']['content']?></p> |
188 | 213 | <?php elseif ($itemData['error']['type'] === 'file_not_found') : ?> |
@@ -192,7 +217,9 @@ discard block |
||
192 | 217 | <?=$_lang['not_found']?>. |
193 | 218 | </span> |
194 | 219 | </p> |
195 | - <?php endif; ?> |
|
220 | + <?php endif; |
|
221 | +} |
|
222 | +?> |
|
196 | 223 | <?php endif; ?> |
197 | 224 | <?php endforeach; ?> |
198 | 225 | <?php endif; ?> |
@@ -208,7 +235,8 @@ discard block |
||
208 | 235 | <?php elseif($itemData['type'] === 'skip') : ?> |
209 | 236 | <!-- SKIP --> |
210 | 237 | <?php endif; ?> |
211 | - <?php else : ?> |
|
238 | + <?php else { |
|
239 | + : ?> |
|
212 | 240 | <?php if ($itemData['error']['type'] === 'sql') : ?> |
213 | 241 | <p>❌ <?=$itemData['error']['content']?></p> |
214 | 242 | <?php elseif ($itemData['error']['type'] === 'file_not_found') : ?> |
@@ -218,7 +246,9 @@ discard block |
||
218 | 246 | <?=$_lang['not_found']?>. |
219 | 247 | </span> |
220 | 248 | </p> |
221 | - <?php endif; ?> |
|
249 | + <?php endif; |
|
250 | +} |
|
251 | +?> |
|
222 | 252 | <?php endif; ?> |
223 | 253 | <?php endforeach; ?> |
224 | 254 | <?php endif; ?> |
@@ -234,7 +264,8 @@ discard block |
||
234 | 264 | <?php elseif($itemData['type'] === 'skip') : ?> |
235 | 265 | <!-- SKIP --> |
236 | 266 | <?php endif; ?> |
237 | - <?php else : ?> |
|
267 | + <?php else { |
|
268 | + : ?> |
|
238 | 269 | <?php if ($itemData['error']['type'] === 'sql') : ?> |
239 | 270 | <p>❌ <?=$itemData['error']['content']?></p> |
240 | 271 | <?php elseif ($itemData['error']['type'] === 'file_not_found') : ?> |
@@ -244,7 +275,9 @@ discard block |
||
244 | 275 | <?=$_lang['not_found']?>. |
245 | 276 | </span> |
246 | 277 | </p> |
247 | - <?php endif; ?> |
|
278 | + <?php endif; |
|
279 | +} |
|
280 | +?> |
|
248 | 281 | <?php endif; ?> |
249 | 282 | <?php endforeach; ?> |
250 | 283 | <?php endif; ?> |
@@ -262,7 +295,8 @@ discard block |
||
262 | 295 | <?php elseif($itemData['type'] === 'skip') : ?> |
263 | 296 | <!-- SKIP --> |
264 | 297 | <?php endif; ?> |
265 | - <?php else : ?> |
|
298 | + <?php else { |
|
299 | + : ?> |
|
266 | 300 | <?php if ($itemData['error']['type'] === 'sql') : ?> |
267 | 301 | <p>❌ <?=$itemData['error']['content']?></p> |
268 | 302 | <?php elseif ($itemData['error']['type'] === 'file_not_found') : ?> |
@@ -272,7 +306,9 @@ discard block |
||
272 | 306 | <?=$_lang['not_found']?>. |
273 | 307 | </span> |
274 | 308 | </p> |
275 | - <?php endif; ?> |
|
309 | + <?php endif; |
|
310 | +} |
|
311 | +?> |
|
276 | 312 | <?php endif; ?> |
277 | 313 | <?php endforeach; ?> |
278 | 314 | <?php endif; ?> |
@@ -281,7 +317,8 @@ discard block |
||
281 | 317 | <h3><?=$_lang['installing_demo_site']?></h3> |
282 | 318 | <?php if (empty($installDataLevel['demo']['error'])) : ?> |
283 | 319 | <p> ✓  <span class="ok"><?=$_lang['ok']?></span></p> |
284 | - <?php else : ?> |
|
320 | + <?php else { |
|
321 | + : ?> |
|
285 | 322 | <p><span class="notok"><b><?=$_lang['database_alerts']?></span></p> |
286 | 323 | <p><?=$_lang['setup_couldnt_install']?></p> |
287 | 324 | <p><?=$_lang['installation_error_occured']?></p> |
@@ -291,7 +328,9 @@ discard block |
||
291 | 328 | <?=$_lang['during_execution_of_sql']?> |
292 | 329 | <span class="mono"><?=htmlspecialchars($error['sql'])?></span> |
293 | 330 | <hr /> |
294 | - <?php endforeach; ?> |
|
331 | + <?php endforeach; |
|
332 | +} |
|
333 | +?> |
|
295 | 334 | <p><?=$_lang['some_tables_not_updated']?></p> |
296 | 335 | <?php endif; ?> |
297 | 336 | <?php endif; ?> |
@@ -316,10 +355,13 @@ discard block |
||
316 | 355 | <span class="ok"><?=$_lang['guid_set']?></span> |
317 | 356 | </p> |
318 | 357 | <?php endif; ?> |
319 | - <?php else : ?> |
|
358 | + <?php else { |
|
359 | + : ?> |
|
320 | 360 | <?php if ($itemData['error']['type'] === 'sql') : ?> |
321 | 361 | <p>❌ <?=$itemData['error']['content']?></p> |
322 | - <?php endif; ?> |
|
362 | + <?php endif; |
|
363 | +} |
|
364 | +?> |
|
323 | 365 | <?php endif; ?> |
324 | 366 | <?php endforeach; ?> |
325 | 367 | <?php endif; ?> |
@@ -332,12 +374,15 @@ discard block |
||
332 | 374 | <img src="img/ico_info.png" width="40" height="42" align="left" style="margin-right:10px;" /> |
333 | 375 | <?=$_lang['installation_note']?> |
334 | 376 | </p> |
335 | - <?php else : ?> |
|
377 | + <?php else { |
|
378 | + : ?> |
|
336 | 379 | <p> |
337 | 380 | <img src="img/ico_info.png" width="40" height="42" align="left" style="margin-right:10px;" /> |
338 | 381 | <?=$_lang['upgrade_note']?> |
339 | 382 | </p> |
340 | - <?php endif; ?> |
|
383 | + <?php endif; |
|
384 | +} |
|
385 | +?> |
|
341 | 386 | |
342 | 387 | <form name="install" id="install_form" action="index.php?action=options" method="post"> |
343 | 388 | <?php if ($errors === 0) : ?> |
@@ -350,11 +395,14 @@ discard block |
||
350 | 395 | /> |
351 | 396 | <?=$_lang['remove_install_folder_auto'] ?> |
352 | 397 | </span> |
353 | - <?php else : ?> |
|
398 | + <?php else { |
|
399 | + : ?> |
|
354 | 400 | <span id="removeinstall" style="float:left;color:#505050;line-height:18px;"> |
355 | 401 | <?=$_lang['remove_install_folder_manual'] ?> |
356 | 402 | </span> |
357 | - <?php endif; ?> |
|
403 | + <?php endif; |
|
404 | +} |
|
405 | +?> |
|
358 | 406 | <?php endif; ?> |
359 | 407 | <p class="buttonlinks"> |
360 | 408 | <a href="javascript:closepage();" title="<?=$_lang['btnclose_value'] ?>"> |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | |
295 | 295 | if (mysqli_num_rows($rs)) { |
296 | 296 | $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'update'; |
297 | - $query = "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;"; |
|
297 | + $query = "update $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;"; |
|
298 | 298 | if (!mysqli_query($sqlParser->conn, $query)) { |
299 | 299 | $errors += 1; |
300 | 300 | $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array( |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | if (mysqli_num_rows($rs)) { |
386 | 386 | $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'update'; |
387 | 387 | while ($row = mysqli_fetch_assoc($rs)) { |
388 | - $query = "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']};"; |
|
388 | + $query = "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']};"; |
|
389 | 389 | if (!mysqli_query($sqlParser->conn, $query)) { |
390 | 390 | $installDataLevel['tvs'][$moduleTV[0]]['error'] = array( |
391 | 391 | 'type' => 'sql', |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | if ($update) { |
497 | 497 | $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'update'; |
498 | 498 | if (!mysqli_query($sqlParser->conn, |
499 | - "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
499 | + "update $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
500 | 500 | $errors += 1; |
501 | 501 | $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array( |
502 | 502 | 'type' => 'sql', |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | $row = mysqli_fetch_assoc($rs); |
582 | 582 | $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
583 | 583 | if (!mysqli_query($sqlParser->conn, |
584 | - "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
584 | + "update $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
585 | 585 | $installDataLevel['modules'][$moduleModule[0]]['error'] = array( |
586 | 586 | 'type' => 'sql', |
587 | 587 | 'content' => mysqli_error($sqlParser->conn) |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | |
661 | 661 | // disable legacy versions based on legacy_names provided |
662 | 662 | if (!empty($leg_names)) { |
663 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
663 | + $update_query = "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
664 | 664 | $rs = mysqli_query($sqlParser->conn, $update_query); |
665 | 665 | } |
666 | 666 | |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | while ($row = mysqli_fetch_assoc($rs)) { |
679 | 679 | $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
680 | 680 | if ($row['description'] == $desc) { |
681 | - $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};"; |
|
681 | + $query = "update $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};"; |
|
682 | 682 | if (!mysqli_query($sqlParser->conn, $query)) { |
683 | 683 | $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array( |
684 | 684 | 'type' => 'sql', |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | } |
690 | 690 | $insert = false; |
691 | 691 | } else { |
692 | - $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};"; |
|
692 | + $query = "update $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};"; |
|
693 | 693 | if (!mysqli_query($sqlParser->conn, $query)) { |
694 | 694 | $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array( |
695 | 695 | 'type' => 'sql', |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | $row = mysqli_fetch_assoc($rs); |
793 | 793 | $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
794 | 794 | if (!mysqli_query($sqlParser->conn, |
795 | - "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
795 | + "update $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
796 | 796 | $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array( |
797 | 797 | 'type' => 'sql', |
798 | 798 | 'content' => mysqli_error($sqlParser->conn) |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if (file_exists(dirname(__DIR__, 3) . "/assets/cache/siteManager.php")) { |
|
3 | - include_once dirname(__DIR__, 3) . "/assets/cache/siteManager.php"; |
|
2 | +if (file_exists(dirname(__DIR__, 3)."/assets/cache/siteManager.php")) { |
|
3 | + include_once dirname(__DIR__, 3)."/assets/cache/siteManager.php"; |
|
4 | 4 | } else { |
5 | 5 | define('MGR_DIR', 'manager'); |
6 | 6 | } |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | // set timout limit |
25 | 25 | @ set_time_limit(120); // used @ to prevent warning when using safe mode? |
26 | 26 | |
27 | -$installMode = (int)$_POST['installmode']; |
|
28 | -$installData = (int)!empty($_POST['installdata']); |
|
27 | +$installMode = (int) $_POST['installmode']; |
|
28 | +$installData = (int) !empty($_POST['installdata']); |
|
29 | 29 | |
30 | 30 | // get db info from post |
31 | 31 | $database_server = $_POST['databasehost']; |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $database_charset = substr($database_collation, 0, strpos($database_collation, '_')); |
36 | 36 | $database_connection_charset = $_POST['database_connection_charset']; |
37 | 37 | $database_connection_method = $_POST['database_connection_method']; |
38 | -$dbase = "`" . $_POST['database_name'] . "`"; |
|
38 | +$dbase = "`".$_POST['database_name']."`"; |
|
39 | 39 | $table_prefix = $_POST['tableprefix']; |
40 | 40 | $adminname = $_POST['cmsadmin']; |
41 | 41 | $adminemail = $_POST['cmsadminemail']; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | // set session name variable |
47 | 47 | if (!isset ($site_sessionname)) { |
48 | - $site_sessionname = 'SN' . uniqid(''); |
|
48 | + $site_sessionname = 'SN'.uniqid(''); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // get base path and url |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | } |
62 | 62 | $pth = implode('install', $a); |
63 | 63 | unset ($a); |
64 | -$base_url = $url . (substr($url, -1) != '/' ? '/' : ''); |
|
65 | -$base_path = $pth . (substr($pth, -1) != '/' ? '/' : ''); |
|
64 | +$base_url = $url.(substr($url, -1) != '/' ? '/' : ''); |
|
65 | +$base_path = $pth.(substr($pth, -1) != '/' ? '/' : ''); |
|
66 | 66 | |
67 | 67 | // connect to the database |
68 | 68 | $host = explode(':', $database_server, 2); |
69 | -$conn = @mysqli_connect($host[0], $database_user, $database_password,'', isset($host[1]) ? $host[1] : null); |
|
69 | +$conn = @mysqli_connect($host[0], $database_user, $database_password, '', isset($host[1]) ? $host[1] : null); |
|
70 | 70 | $installLevel = 0; |
71 | 71 | if ($conn) { |
72 | 72 | $installLevel = 0; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | if ($installLevel === 1) { |
93 | 93 | // check table prefix |
94 | 94 | if ($installMode === 0) { |
95 | - $query = "SELECT COUNT(*) FROM $dbase.`" . $table_prefix . "site_content`"; |
|
95 | + $query = "SELECT COUNT(*) FROM $dbase.`".$table_prefix."site_content`"; |
|
96 | 96 | if (@mysqli_query($conn, $query)) { |
97 | 97 | $errors += 1; |
98 | 98 | } else { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | // check status of Inherit Parent Template plugin |
108 | 108 | $auto_template_logic = 'parent'; |
109 | 109 | if ($installMode !== 0) { |
110 | - $query = "SELECT properties, disabled FROM " . $dbase . ".`" . $table_prefix . "site_plugins` WHERE name='Inherit Parent Template'"; |
|
110 | + $query = "SELECT properties, disabled FROM ".$dbase.".`".$table_prefix."site_plugins` WHERE name='Inherit Parent Template'"; |
|
111 | 111 | $rs = mysqli_query($conn, $query); |
112 | 112 | $row = mysqli_fetch_row($rs); |
113 | 113 | if (!$row) { |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | // open db connection |
133 | - include dirname(__DIR__) . '/processor/result.php'; |
|
134 | - include_once dirname(__DIR__) . '/sqlParser.class.php'; |
|
133 | + include dirname(__DIR__).'/processor/result.php'; |
|
134 | + include_once dirname(__DIR__).'/sqlParser.class.php'; |
|
135 | 135 | $sqlParser = new SqlParser( |
136 | 136 | $database_server, |
137 | 137 | $database_user, |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | $confph['lastInstallTime'] = time(); |
180 | 180 | $confph['site_sessionname'] = $site_sessionname; |
181 | 181 | |
182 | - $configString = file_get_contents(dirname(__DIR__, 2) . '/stubs/files/config/database/connections/default.tpl'); |
|
182 | + $configString = file_get_contents(dirname(__DIR__, 2).'/stubs/files/config/database/connections/default.tpl'); |
|
183 | 183 | $configString = parse($configString, $confph); |
184 | 184 | |
185 | - $filename = EVO_CORE_PATH . 'config/database/connections/default.php'; |
|
185 | + $filename = EVO_CORE_PATH.'config/database/connections/default.php'; |
|
186 | 186 | $configFileFailed = false; |
187 | 187 | if (@ !$handle = fopen($filename, 'w')) { |
188 | 188 | $configFileFailed = true; |
@@ -210,13 +210,13 @@ discard block |
||
210 | 210 | $siteid = uniqid(''); |
211 | 211 | mysqli_query( |
212 | 212 | $sqlParser->conn, |
213 | - "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')" |
|
213 | + "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid'),('manager_theme','default')" |
|
214 | 214 | ); |
215 | 215 | } else { |
216 | 216 | // update site_id if missing |
217 | 217 | $ds = mysqli_query( |
218 | 218 | $sqlParser->conn, |
219 | - "SELECT setting_name,setting_value FROM $dbase.`" . $table_prefix . "system_settings` WHERE setting_name='site_id'" |
|
219 | + "SELECT setting_name,setting_value FROM $dbase.`".$table_prefix."system_settings` WHERE setting_name='site_id'" |
|
220 | 220 | ); |
221 | 221 | if ($ds) { |
222 | 222 | $r = mysqli_fetch_assoc($ds); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $siteid = uniqid(''); |
226 | 226 | mysqli_query( |
227 | 227 | $sqlParser->conn, |
228 | - "REPLACE INTO $dbase.`" . $table_prefix . "system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')" |
|
228 | + "REPLACE INTO $dbase.`".$table_prefix."system_settings` (setting_name,setting_value) VALUES('site_id','$siteid')" |
|
229 | 229 | ); |
230 | 230 | } |
231 | 231 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | if ($installLevel === 5 && (isset ($_POST['template']) || $installData)) { |
252 | 252 | $selTemplates = $_POST['template']; |
253 | 253 | foreach ($moduleTemplates as $k => $moduleTemplate) { |
254 | - if (! is_array($moduleTemplate)) { |
|
254 | + if (!is_array($moduleTemplate)) { |
|
255 | 255 | continue; |
256 | 256 | } |
257 | 257 | $installDataLevel['templates'][$moduleTemplate[0]] = array( |
@@ -289,12 +289,12 @@ discard block |
||
289 | 289 | $template = mysqli_real_escape_string($conn, $template); |
290 | 290 | |
291 | 291 | // See if the template already exists |
292 | - $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name'"; |
|
292 | + $query = "SELECT * FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name'"; |
|
293 | 293 | $rs = mysqli_query($sqlParser->conn, $query); |
294 | 294 | |
295 | 295 | if (mysqli_num_rows($rs)) { |
296 | 296 | $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'update'; |
297 | - $query = "UPDATE $dbase.`" . $table_prefix . "site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;"; |
|
297 | + $query = "UPDATE $dbase.`".$table_prefix."site_templates` SET content='$template', description='$desc', category=$category_id, locked='$locked' WHERE templatename='$name' LIMIT 1;"; |
|
298 | 298 | if (!mysqli_query($sqlParser->conn, $query)) { |
299 | 299 | $errors += 1; |
300 | 300 | $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array( |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | if (!is_null($save_sql_id_as)) { |
308 | 308 | $sql_id = @mysqli_insert_id($sqlParser->conn); |
309 | 309 | if (!$sql_id) { |
310 | - $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$name' LIMIT 1;"; |
|
310 | + $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$name' LIMIT 1;"; |
|
311 | 311 | $idQuery = mysqli_fetch_assoc(mysqli_query($sqlParser->conn, $query)); |
312 | 312 | $sql_id = $idQuery['id']; |
313 | 313 | } |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } |
316 | 316 | } else { |
317 | 317 | $installDataLevel['templates'][$moduleTemplate[0]]['type'] = 'create'; |
318 | - $query = "INSERT INTO $dbase.`" . $table_prefix . "site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');"; |
|
318 | + $query = "INSERT INTO $dbase.`".$table_prefix."site_templates` (templatename,description,content,category,locked) VALUES('$name','$desc','$template',$category_id,'$locked');"; |
|
319 | 319 | if (!@mysqli_query($sqlParser->conn, $query)) { |
320 | 320 | $errors += 1; |
321 | 321 | $installDataLevel['templates'][$moduleTemplate[0]]['error'] = array( |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | // Create the category if it does not already exist |
381 | 381 | $category = getCreateDbCategory($category, $sqlParser); |
382 | 382 | |
383 | - $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name'"; |
|
384 | - $rs = mysqli_query($sqlParser->conn,$query); |
|
383 | + $query = "SELECT * FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name'"; |
|
384 | + $rs = mysqli_query($sqlParser->conn, $query); |
|
385 | 385 | if (mysqli_num_rows($rs)) { |
386 | 386 | $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'update'; |
387 | 387 | while ($row = mysqli_fetch_assoc($rs)) { |
388 | - $query = "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']};"; |
|
388 | + $query = "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']};"; |
|
389 | 389 | if (!mysqli_query($sqlParser->conn, $query)) { |
390 | 390 | $installDataLevel['tvs'][$moduleTV[0]]['error'] = array( |
391 | 391 | 'type' => 'sql', |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | } |
399 | 399 | } else { |
400 | 400 | $installDataLevel['tvs'][$moduleTV[0]]['type'] = 'create'; |
401 | - $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');"; |
|
401 | + $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');"; |
|
402 | 402 | if (!mysqli_query($sqlParser->conn, $q)) { |
403 | 403 | $installDataLevel['tvs'][$moduleTV[0]]['error'] = array( |
404 | 404 | 'type' => 'sql', |
@@ -415,23 +415,23 @@ discard block |
||
415 | 415 | if (count($assignments) > 0) { |
416 | 416 | |
417 | 417 | // remove existing tv -> template assignments |
418 | - $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_tmplvars` WHERE name='$name' AND description='$desc';"; |
|
418 | + $query = "SELECT id FROM $dbase.`".$table_prefix."site_tmplvars` WHERE name='$name' AND description='$desc';"; |
|
419 | 419 | $ds = mysqli_query($sqlParser->conn, $query); |
420 | 420 | $row = mysqli_fetch_assoc($ds); |
421 | 421 | $id = $row["id"]; |
422 | - $query = 'DELETE FROM ' . $dbase . '.`' . $table_prefix . 'site_tmplvar_templates` WHERE tmplvarid = \'' . $id . '\''; |
|
422 | + $query = 'DELETE FROM '.$dbase.'.`'.$table_prefix.'site_tmplvar_templates` WHERE tmplvarid = \''.$id.'\''; |
|
423 | 423 | mysqli_query($sqlParser->conn, $query); |
424 | 424 | |
425 | 425 | // add tv -> template assignments |
426 | 426 | foreach ($assignments as $assignment) { |
427 | 427 | $template = mysqli_real_escape_string($conn, $assignment); |
428 | - $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_templates` WHERE templatename='$template';"; |
|
428 | + $query = "SELECT id FROM $dbase.`".$table_prefix."site_templates` WHERE templatename='$template';"; |
|
429 | 429 | $ts = mysqli_query($sqlParser->conn, $query); |
430 | 430 | if ($ds && $ts) { |
431 | 431 | $tRow = mysqli_fetch_assoc($ts); |
432 | 432 | $templateId = $tRow['id']; |
433 | - $query = "INSERT INTO $dbase.`" . $table_prefix . "site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"; |
|
434 | - mysqli_query($sqlParser->conn,$query); |
|
433 | + $query = "INSERT INTO $dbase.`".$table_prefix."site_tmplvar_templates` (tmplvarid, templateid) VALUES($id, $templateId)"; |
|
434 | + mysqli_query($sqlParser->conn, $query); |
|
435 | 435 | } |
436 | 436 | } |
437 | 437 | } |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | if ($installLevel === 5 && $errorData === false && (isset ($_POST['chunk']) || $installData)) { |
444 | 444 | $selChunks = $_POST['chunk']; |
445 | 445 | foreach ($moduleChunks as $k => $moduleChunk) { |
446 | - if (! is_array($moduleChunk)) { |
|
446 | + if (!is_array($moduleChunk)) { |
|
447 | 447 | continue; |
448 | 448 | } |
449 | 449 | $installDataLevel['chunks'][$moduleChunk[0]] = array( |
@@ -481,14 +481,14 @@ discard block |
||
481 | 481 | $chunk = mysqli_real_escape_string($conn, $chunk); |
482 | 482 | $rs = mysqli_query( |
483 | 483 | $sqlParser->conn, |
484 | - "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$name'" |
|
484 | + "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$name'" |
|
485 | 485 | ); |
486 | 486 | $count_original_name = mysqli_num_rows($rs); |
487 | 487 | if ($overwrite == 'false') { |
488 | - $newname = $name . '-' . str_replace('.', '_', $modx_version); |
|
488 | + $newname = $name.'-'.str_replace('.', '_', $modx_version); |
|
489 | 489 | $rs = mysqli_query( |
490 | 490 | $sqlParser->conn, |
491 | - "SELECT * FROM $dbase.`" . $table_prefix . "site_htmlsnippets` WHERE name='$newname'" |
|
491 | + "SELECT * FROM $dbase.`".$table_prefix."site_htmlsnippets` WHERE name='$newname'" |
|
492 | 492 | ); |
493 | 493 | $count_new_name = mysqli_num_rows($rs); |
494 | 494 | } |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | if ($update) { |
497 | 497 | $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'update'; |
498 | 498 | if (!mysqli_query($sqlParser->conn, |
499 | - "UPDATE $dbase.`" . $table_prefix . "site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
499 | + "UPDATE $dbase.`".$table_prefix."site_htmlsnippets` SET snippet='$chunk', description='$desc', category=$category_id WHERE name='$name';")) { |
|
500 | 500 | $errors += 1; |
501 | 501 | $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array( |
502 | 502 | 'type' => 'sql', |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | } else { |
514 | 514 | $installDataLevel['chunks'][$moduleChunk[0]]['type'] = 'create'; |
515 | 515 | } |
516 | - $query = "INSERT INTO $dbase.`" . $table_prefix . "site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);"; |
|
516 | + $query = "INSERT INTO $dbase.`".$table_prefix."site_htmlsnippets` (name,description,snippet,category) VALUES('$name','$desc','$chunk',$category_id);"; |
|
517 | 517 | if (!mysqli_query($sqlParser->conn, $query)) { |
518 | 518 | $errors += 1; |
519 | 519 | $installDataLevel['chunks'][$moduleChunk[0]]['error'] = array( |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | if ($installLevel === 5 && $errorData === false && (isset ($_POST['module']) || $installData)) { |
537 | 537 | $selModules = $_POST['module']; |
538 | 538 | foreach ($moduleModules as $k => $moduleModule) { |
539 | - if (! is_array($moduleModule)) { |
|
539 | + if (!is_array($moduleModule)) { |
|
540 | 540 | continue; |
541 | 541 | } |
542 | 542 | $installDataLevel['modules'][$moduleModule[0]] = array( |
@@ -575,13 +575,13 @@ discard block |
||
575 | 575 | // $module = removeDocblock($module, 'module'); // Modules have no fileBinding, keep docblock for info-tab |
576 | 576 | $module = mysqli_real_escape_string($conn, $module); |
577 | 577 | $rs = mysqli_query($sqlParser->conn, |
578 | - "SELECT * FROM $dbase.`" . $table_prefix . "site_modules` WHERE name='$name'"); |
|
578 | + "SELECT * FROM $dbase.`".$table_prefix."site_modules` WHERE name='$name'"); |
|
579 | 579 | if (mysqli_num_rows($rs)) { |
580 | 580 | $installDataLevel['modules'][$moduleModule[0]]['type'] = 'update'; |
581 | 581 | $row = mysqli_fetch_assoc($rs); |
582 | 582 | $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
583 | 583 | if (!mysqli_query($sqlParser->conn, |
584 | - "UPDATE $dbase.`" . $table_prefix . "site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
584 | + "UPDATE $dbase.`".$table_prefix."site_modules` SET modulecode='$module', description='$desc', properties='$props', enable_sharedparams='$shared' WHERE name='$name';")) { |
|
585 | 585 | $installDataLevel['modules'][$moduleModule[0]]['error'] = array( |
586 | 586 | 'type' => 'sql', |
587 | 587 | 'content' => mysqli_error($sqlParser->conn) |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $installDataLevel['modules'][$moduleModule[0]]['type'] = 'create'; |
594 | 594 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
595 | 595 | if (!mysqli_query($sqlParser->conn, |
596 | - "INSERT INTO $dbase.`" . $table_prefix . "site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
596 | + "INSERT INTO $dbase.`".$table_prefix."site_modules` (name,description,modulecode,properties,guid,enable_sharedparams,category) VALUES('$name','$desc','$module','$properties','$guid','$shared', $category);")) { |
|
597 | 597 | $installDataLevel['modules'][$moduleModule[0]]['error'] = array( |
598 | 598 | 'type' => 'sql', |
599 | 599 | 'content' => mysqli_error($sqlParser->conn) |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | if ($installLevel === 5 && $errorData === false && (isset ($_POST['plugin']) || $installData)) { |
614 | 614 | $selPlugs = $_POST['plugin']; |
615 | 615 | foreach ($modulePlugins as $k => $modulePlugin) { |
616 | - if (! is_array($modulePlugin)) { |
|
616 | + if (!is_array($modulePlugin)) { |
|
617 | 617 | continue; |
618 | 618 | } |
619 | 619 | $installDataLevel['plugins'][$modulePlugin[0]] = array( |
@@ -647,12 +647,12 @@ discard block |
||
647 | 647 | $disabled = $modulePlugin[9]; |
648 | 648 | if (array_key_exists(7, $modulePlugin)) { |
649 | 649 | // parse comma-separated legacy names and prepare them for sql IN clause |
650 | - $leg_names = "'" . implode( |
|
650 | + $leg_names = "'".implode( |
|
651 | 651 | "','", |
652 | 652 | preg_split('/\s*,\s*/', mysqli_real_escape_string($conn, $modulePlugin[7])) |
653 | - ) . "'"; |
|
653 | + )."'"; |
|
654 | 654 | } |
655 | - if (! file_exists($filecontent)) { |
|
655 | + if (!file_exists($filecontent)) { |
|
656 | 656 | $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array( |
657 | 657 | 'type' => 'file_not_found' |
658 | 658 | ); |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | |
661 | 661 | // disable legacy versions based on legacy_names provided |
662 | 662 | if (!empty($leg_names)) { |
663 | - $update_query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
663 | + $update_query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE name IN ($leg_names);"; |
|
664 | 664 | $rs = mysqli_query($sqlParser->conn, $update_query); |
665 | 665 | } |
666 | 666 | |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | $plugin = end(preg_split("/(\/\/)?\s*\<\?php/", file_get_contents($filecontent), 2)); |
671 | 671 | $plugin = removeDocblock($plugin, 'plugin'); |
672 | 672 | $plugin = mysqli_real_escape_string($conn, $plugin); |
673 | - $query = "SELECT * FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name'"; |
|
673 | + $query = "SELECT * FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name'"; |
|
674 | 674 | $rs = mysqli_query($sqlParser->conn, $query); |
675 | 675 | if (mysqli_num_rows($rs)) { |
676 | 676 | $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'update'; |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | while ($row = mysqli_fetch_assoc($rs)) { |
679 | 679 | $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
680 | 680 | if ($row['description'] == $desc) { |
681 | - $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};"; |
|
681 | + $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET plugincode='$plugin', description='$desc', properties='$props' WHERE id={$row['id']};"; |
|
682 | 682 | if (!mysqli_query($sqlParser->conn, $query)) { |
683 | 683 | $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array( |
684 | 684 | 'type' => 'sql', |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | } |
690 | 690 | $insert = false; |
691 | 691 | } else { |
692 | - $query = "UPDATE $dbase.`" . $table_prefix . "site_plugins` SET disabled='1' WHERE id={$row['id']};"; |
|
692 | + $query = "UPDATE $dbase.`".$table_prefix."site_plugins` SET disabled='1' WHERE id={$row['id']};"; |
|
693 | 693 | if (!mysqli_query($sqlParser->conn, $query)) { |
694 | 694 | $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array( |
695 | 695 | 'type' => 'sql', |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | } |
702 | 702 | } |
703 | 703 | if ($insert === true) { |
704 | - if(!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$props','$guid','0',$category);")) { |
|
704 | + if (!mysqli_query($sqlParser->conn, "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,disabled,category) VALUES('$name','$desc','$plugin','$props','$guid','0',$category);")) { |
|
705 | 705 | $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array( |
706 | 706 | 'type' => 'sql', |
707 | 707 | 'content' => mysqli_error($sqlParser->conn) |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | } else { |
714 | 714 | $installDataLevel['plugins'][$modulePlugin[0]]['type'] = 'create'; |
715 | 715 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
716 | - $query = "INSERT INTO $dbase.`" . $table_prefix . "site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);"; |
|
716 | + $query = "INSERT INTO $dbase.`".$table_prefix."site_plugins` (name,description,plugincode,properties,moduleguid,category,disabled) VALUES('$name','$desc','$plugin','$properties','$guid',$category,$disabled);"; |
|
717 | 717 | if (!mysqli_query($sqlParser->conn, $query)) { |
718 | 718 | $installDataLevel['plugins'][$modulePlugin[0]]['error'] = array( |
719 | 719 | 'type' => 'sql', |
@@ -725,14 +725,14 @@ discard block |
||
725 | 725 | } |
726 | 726 | // add system events |
727 | 727 | if (count($events) > 0) { |
728 | - $query = "SELECT id FROM $dbase.`" . $table_prefix . "site_plugins` WHERE name='$name' AND description='$desc';"; |
|
728 | + $query = "SELECT id FROM $dbase.`".$table_prefix."site_plugins` WHERE name='$name' AND description='$desc';"; |
|
729 | 729 | $ds = mysqli_query($sqlParser->conn, $query); |
730 | 730 | if ($ds) { |
731 | 731 | $row = mysqli_fetch_assoc($ds); |
732 | 732 | $id = $row["id"]; |
733 | 733 | $_events = implode("','", $events); |
734 | 734 | // add new events |
735 | - $sql = "INSERT IGNORE 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 ('{$_events}')"; |
|
735 | + $sql = "INSERT IGNORE 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 ('{$_events}')"; |
|
736 | 736 | mysqli_query($sqlParser->conn, $sql); |
737 | 737 | // remove absent events |
738 | 738 | $sql = "DELETE `pe` FROM {$dbase}.`{$table_prefix}site_plugin_events` `pe` LEFT JOIN {$dbase}.`{$table_prefix}system_eventnames` `se` ON `pe`.`evtid`=`se`.`id` AND `name` IN ('{$_events}') WHERE ISNULL(`name`) AND `pluginid` = {$id}"; |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | if ($installLevel === 5 && $errorData === false && (isset ($_POST['snippet']) || $installData)) { |
751 | 751 | $selSnips = $_POST['snippet']; |
752 | 752 | foreach ($moduleSnippets as $k => $moduleSnippet) { |
753 | - if (! is_array($moduleSnippet)) { |
|
753 | + if (!is_array($moduleSnippet)) { |
|
754 | 754 | continue; |
755 | 755 | } |
756 | 756 | $installDataLevel['snippets'][$moduleSnippet[0]] = array( |
@@ -785,13 +785,13 @@ discard block |
||
785 | 785 | $snippet = removeDocblock($snippet, 'snippet'); |
786 | 786 | $snippet = mysqli_real_escape_string($conn, $snippet); |
787 | 787 | $rs = mysqli_query($sqlParser->conn, |
788 | - "SELECT * FROM $dbase.`" . $table_prefix . "site_snippets` WHERE name='$name'"); |
|
788 | + "SELECT * FROM $dbase.`".$table_prefix."site_snippets` WHERE name='$name'"); |
|
789 | 789 | if (mysqli_num_rows($rs)) { |
790 | 790 | $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'update'; |
791 | 791 | $row = mysqli_fetch_assoc($rs); |
792 | 792 | $props = mysqli_real_escape_string($conn, propUpdate($properties, $row['properties'])); |
793 | 793 | if (!mysqli_query($sqlParser->conn, |
794 | - "UPDATE $dbase.`" . $table_prefix . "site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
794 | + "UPDATE $dbase.`".$table_prefix."site_snippets` SET snippet='$snippet', description='$desc', properties='$props' WHERE name='$name';")) { |
|
795 | 795 | $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array( |
796 | 796 | 'type' => 'sql', |
797 | 797 | 'content' => mysqli_error($sqlParser->conn) |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | $installDataLevel['snippets'][$moduleSnippet[0]]['type'] = 'create'; |
804 | 804 | $properties = mysqli_real_escape_string($conn, parseProperties($properties, true)); |
805 | 805 | if (!mysqli_query($sqlParser->conn, |
806 | - "INSERT INTO $dbase.`" . $table_prefix . "site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
806 | + "INSERT INTO $dbase.`".$table_prefix."site_snippets` (name,description,snippet,properties,category) VALUES('$name','$desc','$snippet','$properties',$category);")) { |
|
807 | 807 | $installDataLevel['snippets'][$moduleSnippet[0]]['error'] = array( |
808 | 808 | 'type' => 'sql', |
809 | 809 | 'content' => mysqli_error($sqlParser->conn) |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | 'content' => '' //dependency name or error message |
871 | 871 | )*/ |
872 | 872 | ); |
873 | - $query = 'SELECT id, guid FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_modules` WHERE name="' . $dependency['module'] . '"'; |
|
873 | + $query = 'SELECT id, guid FROM '.$dbase.'`'.$sqlParser->prefix.'site_modules` WHERE name="'.$dependency['module'].'"'; |
|
874 | 874 | $ds = mysqli_query($sqlParser->conn, $query); |
875 | 875 | if (!$ds) { |
876 | 876 | $installDependencyLevel[$dependency['module']]['error'] = array( |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | $moduleGuid = $row["guid"]; |
886 | 886 | } |
887 | 887 | // get extra id |
888 | - $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE ' . $dependency['column'] . '="' . $dependency['name'] . '"'; |
|
888 | + $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE '.$dependency['column'].'="'.$dependency['name'].'"'; |
|
889 | 889 | $ds = mysqli_query($sqlParser->conn, $query); |
890 | 890 | if (!$ds) { |
891 | 891 | $installDependencyLevel[$dependency['module']]['error'] = array( |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | $extraId = $row["id"]; |
900 | 900 | } |
901 | 901 | // setup extra as module dependency |
902 | - $query = 'SELECT module FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` WHERE module=' . $moduleId . ' AND resource=' . $extraId . ' AND type=' . $dependency['type'] . ' LIMIT 1'; |
|
902 | + $query = 'SELECT module FROM '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` WHERE module='.$moduleId.' AND resource='.$extraId.' AND type='.$dependency['type'].' LIMIT 1'; |
|
903 | 903 | $ds = mysqli_query($sqlParser->conn, $query); |
904 | 904 | if (!$ds) { |
905 | 905 | $installDependencyLevel[$dependency['module']]['error'] = array( |
@@ -910,17 +910,17 @@ discard block |
||
910 | 910 | break; |
911 | 911 | } else { |
912 | 912 | if (mysqli_num_rows($ds) === 0) { |
913 | - $query = 'INSERT INTO ' . $dbase . '`' . $sqlParser->prefix . 'site_module_depobj` (module, resource, type) VALUES(' . $moduleId . ',' . $extraId . ',' . $dependency['type'] . ')'; |
|
913 | + $query = 'INSERT INTO '.$dbase.'`'.$sqlParser->prefix.'site_module_depobj` (module, resource, type) VALUES('.$moduleId.','.$extraId.','.$dependency['type'].')'; |
|
914 | 914 | mysqli_query($sqlParser->conn, $query); |
915 | 915 | $installDependencyLevel[$dependency['module']]['type'] = 'create'; |
916 | 916 | } else { |
917 | - $query = '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']; |
|
917 | + $query = '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']; |
|
918 | 918 | mysqli_query($sqlParser->conn, $query); |
919 | 919 | $installDependencyLevel[$dependency['module']]['type'] = 'update'; |
920 | 920 | } |
921 | 921 | if ($dependency['type'] == 30 || $dependency['type'] == 40) { |
922 | 922 | // set extra guid for plugins and snippets |
923 | - $query = 'SELECT id FROM ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` WHERE id=' . $extraId . ' LIMIT 1'; |
|
923 | + $query = 'SELECT id FROM '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` WHERE id='.$extraId.' LIMIT 1'; |
|
924 | 924 | $ds = mysqli_query($sqlParser->conn, $query); |
925 | 925 | if (!$ds) { |
926 | 926 | $installDependencyLevel[$dependency['module']]['extra'] = array( |
@@ -931,8 +931,8 @@ discard block |
||
931 | 931 | break; |
932 | 932 | } else { |
933 | 933 | if (mysqli_num_rows($ds) != 0) { |
934 | - $query = 'UPDATE ' . $dbase . '`' . $sqlParser->prefix . 'site_' . $dependency['table'] . '` SET moduleguid = ' . $moduleGuid . ' WHERE id=' . $extraId; |
|
935 | - $ds= mysqli_query($sqlParser->conn, $query); |
|
934 | + $query = 'UPDATE '.$dbase.'`'.$sqlParser->prefix.'site_'.$dependency['table'].'` SET moduleguid = '.$moduleGuid.' WHERE id='.$extraId; |
|
935 | + $ds = mysqli_query($sqlParser->conn, $query); |
|
936 | 936 | $installDependencyLevel[$dependency['module']]['extra'] = array( |
937 | 937 | 'type' => 'done', |
938 | 938 | 'content' => $dependency['name'] |
@@ -954,24 +954,24 @@ discard block |
||
954 | 954 | } |
955 | 955 | |
956 | 956 | // Setup the MODX API -- needed for the cache processor |
957 | - if (file_exists(dirname(__DIR__, 3) . '/' . MGR_DIR . '/includes/config_mutator.php')) { |
|
958 | - require_once dirname(__DIR__, 3) . '/' . MGR_DIR . '/includes/config_mutator.php'; |
|
957 | + if (file_exists(dirname(__DIR__, 3).'/'.MGR_DIR.'/includes/config_mutator.php')) { |
|
958 | + require_once dirname(__DIR__, 3).'/'.MGR_DIR.'/includes/config_mutator.php'; |
|
959 | 959 | } |
960 | 960 | define('MODX_API_MODE', true); |
961 | 961 | if (!defined('MODX_BASE_PATH')) { |
962 | 962 | define('MODX_BASE_PATH', $base_path); |
963 | 963 | } |
964 | 964 | if (!defined('MODX_MANAGER_PATH')) { |
965 | - define('MODX_MANAGER_PATH', $base_path . MGR_DIR . '/'); |
|
965 | + define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/'); |
|
966 | 966 | } |
967 | 967 | $database_type = 'mysqli'; |
968 | 968 | // initiate a new document parser |
969 | 969 | if (!defined('EVO_BOOTSTRAP_FILE')) { |
970 | - define('EVO_BOOTSTRAP_FILE', EVO_CORE_PATH . 'bootstrap.php'); |
|
971 | - require_once EVO_CORE_PATH . 'bootstrap.php'; |
|
970 | + define('EVO_BOOTSTRAP_FILE', EVO_CORE_PATH.'bootstrap.php'); |
|
971 | + require_once EVO_CORE_PATH.'bootstrap.php'; |
|
972 | 972 | } |
973 | 973 | |
974 | - if (! defined('MODX_CLASS')) { |
|
974 | + if (!defined('MODX_CLASS')) { |
|
975 | 975 | define('MODX_CLASS', '\DocumentParser'); |
976 | 976 | } |
977 | 977 | |
@@ -985,20 +985,20 @@ discard block |
||
985 | 985 | // $sync->emptyCache(); // first empty the cache |
986 | 986 | |
987 | 987 | // try to chmod the cache go-rwx (for suexeced php) |
988 | - @chmod(dirname(__DIR__, 3) . '/assets/cache/siteCache.idx.php', 0600); |
|
989 | - @chmod(dirname(__DIR__, 3) . '/assets/cache/sitePublishing.idx.php', 0600); |
|
988 | + @chmod(dirname(__DIR__, 3).'/assets/cache/siteCache.idx.php', 0600); |
|
989 | + @chmod(dirname(__DIR__, 3).'/assets/cache/sitePublishing.idx.php', 0600); |
|
990 | 990 | |
991 | 991 | // remove any locks on the manager functions so initial manager login is not blocked |
992 | - mysqli_query($conn, "TRUNCATE TABLE `" . $table_prefix . "active_users`"); |
|
992 | + mysqli_query($conn, "TRUNCATE TABLE `".$table_prefix."active_users`"); |
|
993 | 993 | |
994 | 994 | // close db connection |
995 | 995 | // $sqlParser->close(); |
996 | 996 | |
997 | 997 | // andrazk 20070416 - release manager access |
998 | - if (file_exists(dirname(__DIR__, 3) . '/assets/cache/installProc.inc.php')) { |
|
999 | - @chmod(dirname(__DIR__, 3) . '/assets/cache/installProc.inc.php', 0755); |
|
1000 | - unlink(dirname(__DIR__, 3) . '/assets/cache/installProc.inc.php'); |
|
998 | + if (file_exists(dirname(__DIR__, 3).'/assets/cache/installProc.inc.php')) { |
|
999 | + @chmod(dirname(__DIR__, 3).'/assets/cache/installProc.inc.php', 0755); |
|
1000 | + unlink(dirname(__DIR__, 3).'/assets/cache/installProc.inc.php'); |
|
1001 | 1001 | } |
1002 | 1002 | } |
1003 | 1003 | } |
1004 | -include_once dirname(__DIR__) . '/template/actions/install.php'; |
|
1004 | +include_once dirname(__DIR__).'/template/actions/install.php'; |
@@ -376,10 +376,10 @@ |
||
376 | 376 | if ($properties = $modx->getDatabase()->getValue($res)) { |
377 | 377 | $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
378 | 378 | } else { |
379 | - $properties = NULL; |
|
379 | + $properties = null; |
|
380 | 380 | } |
381 | 381 | } else { |
382 | - $properties = NULL; |
|
382 | + $properties = null; |
|
383 | 383 | } |
384 | 384 | return $properties; |
385 | 385 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | /** |
314 | 314 | * @param $filename |
315 | - * @return mixed|string |
|
315 | + * @return string |
|
316 | 316 | */ |
317 | 317 | protected function normalizeFilename($filename) { |
318 | 318 | if ($this->getTransaliasSettings()) { |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
327 | - * @param $dirname |
|
327 | + * @param string $dirname |
|
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | protected function normalizeDirname($dirname) { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @param $dir |
409 | 409 | * @param bool $inclType |
410 | 410 | * @param bool $existing |
411 | - * @return bool|string |
|
411 | + * @return false|string |
|
412 | 412 | */ |
413 | 413 | protected function checkInputDir($dir, $inclType=true, $existing=true) { |
414 | 414 | $dir = path::normalize($dir); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | /** |
440 | - * @param $ext |
|
440 | + * @param string $ext |
|
441 | 441 | * @param $type |
442 | 442 | * @return bool |
443 | 443 | */ |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | /** |
470 | 470 | * @param $path |
471 | - * @return mixed |
|
471 | + * @return string |
|
472 | 472 | */ |
473 | 473 | protected function getTypeFromPath($path) { |
474 | 474 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | } |
477 | 477 | |
478 | 478 | /** |
479 | - * @param $path |
|
479 | + * @param string $path |
|
480 | 480 | * @return string |
481 | 481 | */ |
482 | 482 | protected function removeTypeFromPath($path) { |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | } |
695 | 695 | |
696 | 696 | /** |
697 | - * @param $url |
|
697 | + * @param string $url |
|
698 | 698 | * @param string $message |
699 | 699 | */ |
700 | 700 | protected function callBack($url, $message="") { |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | /** This file is part of KCFinder project |
4 | - * |
|
5 | - * @desc Uploader class |
|
6 | - * @package KCFinder |
|
7 | - * @version 2.54 |
|
8 | - * @author Pavel Tzonkov <[email protected]> |
|
9 | - * @copyright 2010-2014 KCFinder Project |
|
10 | - * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | - * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | - * @link http://kcfinder.sunhater.com |
|
13 | - */ |
|
4 | + * |
|
5 | + * @desc Uploader class |
|
6 | + * @package KCFinder |
|
7 | + * @version 2.54 |
|
8 | + * @author Pavel Tzonkov <[email protected]> |
|
9 | + * @copyright 2010-2014 KCFinder Project |
|
10 | + * @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2 |
|
11 | + * @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2 |
|
12 | + * @link http://kcfinder.sunhater.com |
|
13 | + */ |
|
14 | 14 | |
15 | 15 | class uploader { |
16 | 16 | |
@@ -18,92 +18,92 @@ discard block |
||
18 | 18 | const VERSION = "2.54"; |
19 | 19 | |
20 | 20 | /** Config session-overrided settings |
21 | - * @var array */ |
|
21 | + * @var array */ |
|
22 | 22 | protected $config = array(); |
23 | 23 | |
24 | 24 | /** Default image driver |
25 | - * @var string */ |
|
25 | + * @var string */ |
|
26 | 26 | protected $imageDriver = "gd"; |
27 | 27 | |
28 | 28 | /** Opener applocation properties |
29 | - * $opener['name'] Got from $_GET['opener']; |
|
30 | - * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | - * $opener['TinyMCE'] Boolean |
|
32 | - * @var array */ |
|
29 | + * $opener['name'] Got from $_GET['opener']; |
|
30 | + * $opener['CKEditor']['funcNum'] CKEditor function number (got from $_GET) |
|
31 | + * $opener['TinyMCE'] Boolean |
|
32 | + * @var array */ |
|
33 | 33 | protected $opener = array(); |
34 | 34 | |
35 | 35 | /** Got from $_GET['type'] or first one $config['types'] array key, if inexistant |
36 | - * @var string */ |
|
36 | + * @var string */ |
|
37 | 37 | protected $type; |
38 | 38 | |
39 | 39 | /** Helper property. Local filesystem path to the Type Directory |
40 | - * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | - * @var string */ |
|
40 | + * Equivalent: $config['uploadDir'] . "/" . $type |
|
41 | + * @var string */ |
|
42 | 42 | protected $typeDir; |
43 | 43 | |
44 | 44 | /** Helper property. Web URL to the Type Directory |
45 | - * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | - * @var string */ |
|
45 | + * Equivalent: $config['uploadURL'] . "/" . $type |
|
46 | + * @var string */ |
|
47 | 47 | protected $typeURL; |
48 | 48 | |
49 | 49 | /** Linked to $config['types'] |
50 | - * @var array */ |
|
50 | + * @var array */ |
|
51 | 51 | protected $types = array(); |
52 | 52 | |
53 | 53 | /** Settings which can override default settings if exists as keys in $config['types'][$type] array |
54 | - * @var array */ |
|
54 | + * @var array */ |
|
55 | 55 | protected $typeSettings = array('disabled', 'theme', 'dirPerms', 'filePerms', 'denyZipDownload', 'maxImageWidth', 'maxImageHeight', 'thumbWidth', 'thumbHeight', 'jpegQuality', 'access', 'filenameChangeChars', 'dirnameChangeChars', 'denyExtensionRename', 'deniedExts', 'watermark'); |
56 | 56 | |
57 | 57 | /** Got from language file |
58 | - * @var string */ |
|
58 | + * @var string */ |
|
59 | 59 | protected $charset; |
60 | 60 | |
61 | 61 | /** The language got from $_GET['lng'] or $_GET['lang'] or... Please see next property |
62 | - * @var string */ |
|
62 | + * @var string */ |
|
63 | 63 | protected $lang = 'en'; |
64 | 64 | |
65 | 65 | /** Possible language $_GET keys |
66 | - * @var array */ |
|
66 | + * @var array */ |
|
67 | 67 | protected $langInputNames = array('lang', 'langCode', 'lng', 'language', 'lang_code'); |
68 | 68 | |
69 | 69 | /** Uploaded file(s) info. Linked to first $_FILES element |
70 | - * @var array */ |
|
70 | + * @var array */ |
|
71 | 71 | protected $file; |
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | - * @var string */ |
|
74 | + * @var string */ |
|
75 | 75 | protected $dateTimeFull; // Currently not used |
76 | 76 | protected $dateTimeMid; // Currently not used |
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
80 | - * @var array */ |
|
80 | + * @var array */ |
|
81 | 81 | protected $labels = array(); |
82 | 82 | |
83 | 83 | /** Contain unprocessed $_GET array. Please use this instead of $_GET |
84 | - * @var array */ |
|
84 | + * @var array */ |
|
85 | 85 | protected $get; |
86 | 86 | |
87 | 87 | /** Contain unprocessed $_POST array. Please use this instead of $_POST |
88 | - * @var array */ |
|
88 | + * @var array */ |
|
89 | 89 | protected $post; |
90 | 90 | |
91 | 91 | /** Contain unprocessed $_COOKIE array. Please use this instead of $_COOKIE |
92 | - * @var array */ |
|
92 | + * @var array */ |
|
93 | 93 | protected $cookie; |
94 | 94 | |
95 | 95 | /** Session array. Please use this property instead of $_SESSION |
96 | - * @var array */ |
|
96 | + * @var array */ |
|
97 | 97 | protected $session; |
98 | 98 | |
99 | 99 | /** CMS integration attribute (got from $_GET['cms']) |
100 | - * @var string */ |
|
100 | + * @var string */ |
|
101 | 101 | protected $cms = ""; |
102 | 102 | |
103 | 103 | protected $modx = null; |
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | - * @param string $property |
|
106 | - * @return mixed */ |
|
105 | + * @param string $property |
|
106 | + * @return mixed */ |
|
107 | 107 | public function __get($property) { |
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ) |
137 | 137 | $this->cms = $this->get['cms']; |
138 | 138 | |
139 | - // LINKING UPLOADED FILE |
|
139 | + // LINKING UPLOADED FILE |
|
140 | 140 | if (count($_FILES)) |
141 | 141 | $this->file = &$_FILES[key($_FILES)]; |
142 | 142 | |
@@ -217,8 +217,8 @@ discard block |
||
217 | 217 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
218 | 218 | ? path::normalize($this->config['uploadDir']) |
219 | 219 | : path::url2fullPath("/$path"); |
220 | - $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
221 | - $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
220 | + $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
|
221 | + $this->typeURL = "{$this->config['siteURL']}/{$this->config['uploadURL']}/{$this->type}"; |
|
222 | 222 | |
223 | 223 | // SITE ROOT |
224 | 224 | } elseif ($this->config['uploadURL'] == "/") { |
@@ -291,23 +291,23 @@ discard block |
||
291 | 291 | * @return array|bool|int|null|string|void |
292 | 292 | */ |
293 | 293 | protected function getTransaliasSettings() { |
294 | - $modx = evolutionCMS(); |
|
295 | - |
|
296 | - // Cleaning uploaded filename? |
|
297 | - $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
298 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
299 | - // Transalias plugin active? |
|
300 | - $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
301 | - if ($properties = $modx->getDatabase()->getValue($res)) { |
|
302 | - $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
303 | - } else { |
|
304 | - $properties = NULL; |
|
305 | - } |
|
306 | - } else { |
|
307 | - $properties = NULL; |
|
308 | - } |
|
309 | - return $properties; |
|
310 | - } |
|
294 | + $modx = evolutionCMS(); |
|
295 | + |
|
296 | + // Cleaning uploaded filename? |
|
297 | + $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
|
298 | + if ($modx->getDatabase()->getValue($setting)>0) { |
|
299 | + // Transalias plugin active? |
|
300 | + $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
|
301 | + if ($properties = $modx->getDatabase()->getValue($res)) { |
|
302 | + $properties = $modx->parseProperties($properties, 'TransAlias', 'plugin'); |
|
303 | + } else { |
|
304 | + $properties = NULL; |
|
305 | + } |
|
306 | + } else { |
|
307 | + $properties = NULL; |
|
308 | + } |
|
309 | + return $properties; |
|
310 | + } |
|
311 | 311 | |
312 | 312 | |
313 | 313 | /** |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | * @return mixed|string |
316 | 316 | */ |
317 | 317 | protected function normalizeFilename($filename) { |
318 | - if ($this->getTransaliasSettings()) { |
|
319 | - $format = strrchr($filename, "."); |
|
320 | - $filename = str_replace($format, "", $filename); |
|
321 | - $filename = $this->modx->stripAlias($filename).$format; |
|
322 | - } |
|
323 | - return $filename; |
|
324 | - } |
|
318 | + if ($this->getTransaliasSettings()) { |
|
319 | + $format = strrchr($filename, "."); |
|
320 | + $filename = str_replace($format, "", $filename); |
|
321 | + $filename = $this->modx->stripAlias($filename).$format; |
|
322 | + } |
|
323 | + return $filename; |
|
324 | + } |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * @param $dirname |
@@ -396,10 +396,10 @@ discard block |
||
396 | 396 | return $this->label("The image is too big and/or cannot be resized."); |
397 | 397 | |
398 | 398 | |
399 | - // CHECK FOR MODX MAX FILE SIZE |
|
400 | - $actualfilesize=filesize($file['tmp_name']); |
|
401 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
399 | + // CHECK FOR MODX MAX FILE SIZE |
|
400 | + $actualfilesize=filesize($file['tmp_name']); |
|
401 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
403 | 403 | |
404 | 404 | return true; |
405 | 405 | } |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | $top = isset($this->config['watermark']['top']) |
576 | 576 | ? $this->config['watermark']['top'] : false; |
577 | 577 | $img->watermark($this->config['watermark']['file'], $left, $top); |
578 | - } |
|
578 | + } |
|
579 | 579 | |
580 | 580 | $options = array( 'file' => $file ); |
581 | 581 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader{ |
|
16 | 16 | |
17 | 17 | /** Release version */ |
18 | 18 | const VERSION = "2.54"; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | |
73 | 73 | /** Next three properties are got from the current language file |
74 | 74 | * @var string */ |
75 | - protected $dateTimeFull; // Currently not used |
|
76 | - protected $dateTimeMid; // Currently not used |
|
75 | + protected $dateTimeFull; // Currently not used |
|
76 | + protected $dateTimeMid; // Currently not used |
|
77 | 77 | protected $dateTimeSmall; |
78 | 78 | |
79 | 79 | /** Contain Specified language labels |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** Magic method which allows read-only access to protected or private class properties |
105 | 105 | * @param string $property |
106 | 106 | * @return mixed */ |
107 | - public function __get($property) { |
|
107 | + public function __get($property){ |
|
108 | 108 | return property_exists($this, $property) ? $this->$property : null; |
109 | 109 | } |
110 | 110 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * uploader constructor. |
113 | 113 | * @param DocumentParser $modx |
114 | 114 | */ |
115 | - public function __construct(DocumentParser $modx) { |
|
115 | + public function __construct(DocumentParser $modx){ |
|
116 | 116 | |
117 | 117 | //MODX |
118 | 118 | try { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | |
196 | 196 | // COOKIES INIT |
197 | 197 | $ip = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; |
198 | - $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
|
198 | + $ip = '/^'.implode('\.', array($ip, $ip, $ip, $ip)).'$/'; |
|
199 | 199 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
200 | 200 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
201 | 201 | ) |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | ) { |
214 | 214 | list($unused, $protocol, $domain, $unused, $port, $path) = $patt; |
215 | 215 | $path = path::normalize($path); |
216 | - $this->config['uploadURL'] = "$protocol://$domain" . (strlen($port) ? ":$port" : "") . "/$path"; |
|
216 | + $this->config['uploadURL'] = "$protocol://$domain".(strlen($port) ? ":$port" : "")."/$path"; |
|
217 | 217 | $this->config['uploadDir'] = strlen($this->config['uploadDir']) |
218 | 218 | ? path::normalize($this->config['uploadDir']) |
219 | 219 | : path::url2fullPath("/$path"); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | foreach ($this->langInputNames as $key) |
257 | 257 | if (isset($this->get[$key]) && |
258 | 258 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
259 | - file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
|
259 | + file_exists("lang/".strtolower($this->get[$key]).".php") |
|
260 | 260 | ) { |
261 | 261 | $this->lang = $this->get[$key]; |
262 | 262 | break; |
@@ -290,12 +290,12 @@ discard block |
||
290 | 290 | /** |
291 | 291 | * @return array|bool|int|null|string|void |
292 | 292 | */ |
293 | - protected function getTransaliasSettings() { |
|
293 | + protected function getTransaliasSettings(){ |
|
294 | 294 | $modx = evolutionCMS(); |
295 | 295 | |
296 | 296 | // Cleaning uploaded filename? |
297 | 297 | $setting = $modx->getDatabase()->select('count(*)', $modx->getDatabase()->getFullTableName('system_settings'), 'setting_name="clean_uploaded_filename" AND setting_value=1'); |
298 | - if ($modx->getDatabase()->getValue($setting)>0) { |
|
298 | + if ($modx->getDatabase()->getValue($setting) > 0) { |
|
299 | 299 | // Transalias plugin active? |
300 | 300 | $res = $modx->getDatabase()->select('properties', $modx->getDatabase()->getFullTableName('site_plugins'), 'name="TransAlias" AND disabled=0'); |
301 | 301 | if ($properties = $modx->getDatabase()->getValue($res)) { |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | * @param $filename |
315 | 315 | * @return mixed|string |
316 | 316 | */ |
317 | - protected function normalizeFilename($filename) { |
|
317 | + protected function normalizeFilename($filename){ |
|
318 | 318 | if ($this->getTransaliasSettings()) { |
319 | 319 | $format = strrchr($filename, "."); |
320 | 320 | $filename = str_replace($format, "", $filename); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @param $dirname |
328 | 328 | * @return string |
329 | 329 | */ |
330 | - protected function normalizeDirname($dirname) { |
|
330 | + protected function normalizeDirname($dirname){ |
|
331 | 331 | return $this->modx->stripAlias($dirname); |
332 | 332 | } |
333 | 333 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | * @param array|null $aFile |
336 | 336 | * @return bool|mixed |
337 | 337 | */ |
338 | - protected function checkUploadedFile(array $aFile=null) { |
|
338 | + protected function checkUploadedFile(array $aFile = null){ |
|
339 | 339 | $config = &$this->config; |
340 | 340 | $file = ($aFile === null) ? $this->file : $aFile; |
341 | 341 | |
@@ -361,8 +361,7 @@ discard block |
||
361 | 361 | ($file['error'] == UPLOAD_ERR_NO_TMP_DIR) ? |
362 | 362 | $this->label("Missing a temporary folder.") : ( |
363 | 363 | ($file['error'] == UPLOAD_ERR_CANT_WRITE) ? |
364 | - $this->label("Failed to write file.") : |
|
365 | - $this->label("Unknown error.") |
|
364 | + $this->label("Failed to write file.") : $this->label("Unknown error.") |
|
366 | 365 | ))))); |
367 | 366 | |
368 | 367 | // HIDDEN FILENAMES CHECK |
@@ -397,7 +396,7 @@ discard block |
||
397 | 396 | |
398 | 397 | |
399 | 398 | // CHECK FOR MODX MAX FILE SIZE |
400 | - $actualfilesize=filesize($file['tmp_name']); |
|
399 | + $actualfilesize = filesize($file['tmp_name']); |
|
401 | 400 | if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
402 | 401 | return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
403 | 402 | |
@@ -410,7 +409,7 @@ discard block |
||
410 | 409 | * @param bool $existing |
411 | 410 | * @return bool|string |
412 | 411 | */ |
413 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
412 | + protected function checkInputDir($dir, $inclType = true, $existing = true){ |
|
414 | 413 | $dir = path::normalize($dir); |
415 | 414 | if (substr($dir, 0, 1) == "/") |
416 | 415 | $dir = substr($dir, 1); |
@@ -441,7 +440,7 @@ discard block |
||
441 | 440 | * @param $type |
442 | 441 | * @return bool |
443 | 442 | */ |
444 | - protected function validateExtension($ext, $type) { |
|
443 | + protected function validateExtension($ext, $type){ |
|
445 | 444 | $ext = trim(strtolower($ext)); |
446 | 445 | if (!isset($this->types[$type])) |
447 | 446 | return false; |
@@ -470,7 +469,7 @@ discard block |
||
470 | 469 | * @param $path |
471 | 470 | * @return mixed |
472 | 471 | */ |
473 | - protected function getTypeFromPath($path) { |
|
472 | + protected function getTypeFromPath($path){ |
|
474 | 473 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
475 | 474 | ? $patt[1] : $path; |
476 | 475 | } |
@@ -479,7 +478,7 @@ discard block |
||
479 | 478 | * @param $path |
480 | 479 | * @return string |
481 | 480 | */ |
482 | - protected function removeTypeFromPath($path) { |
|
481 | + protected function removeTypeFromPath($path){ |
|
483 | 482 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
484 | 483 | ? $patt[1] : ""; |
485 | 484 | } |
@@ -489,7 +488,7 @@ discard block |
||
489 | 488 | * @param null $file |
490 | 489 | * @return bool |
491 | 490 | */ |
492 | - protected function imageResize($image, $file=null) { |
|
491 | + protected function imageResize($image, $file = null){ |
|
493 | 492 | |
494 | 493 | if (!($image instanceof image)) { |
495 | 494 | $img = image::factory($this->imageDriver, $image); |
@@ -577,19 +576,19 @@ discard block |
||
577 | 576 | $img->watermark($this->config['watermark']['file'], $left, $top); |
578 | 577 | } |
579 | 578 | |
580 | - $options = array( 'file' => $file ); |
|
579 | + $options = array('file' => $file); |
|
581 | 580 | |
582 | - $type = exif_imagetype( $file ); |
|
581 | + $type = exif_imagetype($file); |
|
583 | 582 | |
584 | - switch ( $type ) { |
|
583 | + switch ($type) { |
|
585 | 584 | case IMAGETYPE_GIF: |
586 | - return $img->output( 'gif', $options ); |
|
585 | + return $img->output('gif', $options); |
|
587 | 586 | |
588 | 587 | case IMAGETYPE_PNG: |
589 | - return $img->output( 'png', $options ); |
|
588 | + return $img->output('png', $options); |
|
590 | 589 | |
591 | 590 | default: |
592 | - return $img->output( 'jpeg', array_merge( $options, array( 'quality' => $this->config['jpegQuality'] ) ) ); |
|
591 | + return $img->output('jpeg', array_merge($options, array('quality' => $this->config['jpegQuality']))); |
|
593 | 592 | } |
594 | 593 | |
595 | 594 | } |
@@ -599,7 +598,7 @@ discard block |
||
599 | 598 | * @param bool $overwrite |
600 | 599 | * @return bool |
601 | 600 | */ |
602 | - protected function makeThumb($file, $overwrite=true) { |
|
601 | + protected function makeThumb($file, $overwrite = true){ |
|
603 | 602 | $img = image::factory($this->imageDriver, $file); |
604 | 603 | |
605 | 604 | // Drop files which are not images |
@@ -607,7 +606,7 @@ discard block |
||
607 | 606 | return true; |
608 | 607 | |
609 | 608 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
610 | - $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
|
609 | + $thumb = $this->config['uploadDir']."/".$this->config['thumbsDir']."/".$thumb; |
|
611 | 610 | $thumb = path::normalize($thumb); |
612 | 611 | $thumbDir = dirname($thumb); |
613 | 612 | if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
@@ -630,15 +629,15 @@ discard block |
||
630 | 629 | if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
631 | 630 | return false; |
632 | 631 | |
633 | - if ( $this->imageDriver == 'gd' ) { |
|
634 | - $width = imagesx( $img->image ); |
|
635 | - $height = imagesy( $img->image ); |
|
636 | - $back = image::factory( $this->imageDriver, array( $width, $height ) ); |
|
637 | - $tile = image::factory( $this->imageDriver, __DIR__ . '/../themes/' . $this->config['theme'] . '/img/bg_transparent.png' ); |
|
632 | + if ($this->imageDriver == 'gd') { |
|
633 | + $width = imagesx($img->image); |
|
634 | + $height = imagesy($img->image); |
|
635 | + $back = image::factory($this->imageDriver, array($width, $height)); |
|
636 | + $tile = image::factory($this->imageDriver, __DIR__.'/../themes/'.$this->config['theme'].'/img/bg_transparent.png'); |
|
638 | 637 | |
639 | - imagesettile( $back->image, $tile->image ); |
|
640 | - imagefilledrectangle( $back->image, 0, 0, $width, $height, IMG_COLOR_TILED ); |
|
641 | - imagecopy( $back->image, $img->image, 0, 0, 0, 0, $width, $height ); |
|
638 | + imagesettile($back->image, $tile->image); |
|
639 | + imagefilledrectangle($back->image, 0, 0, $width, $height, IMG_COLOR_TILED); |
|
640 | + imagecopy($back->image, $img->image, 0, 0, 0, 0, $width, $height); |
|
642 | 641 | |
643 | 642 | $img = $back; |
644 | 643 | } |
@@ -653,7 +652,7 @@ discard block |
||
653 | 652 | /** |
654 | 653 | * @param $langCode |
655 | 654 | */ |
656 | - protected function localize($langCode) { |
|
655 | + protected function localize($langCode){ |
|
657 | 656 | require "lang/{$langCode}.php"; |
658 | 657 | setlocale(LC_ALL, $lang['_locale']); |
659 | 658 | $this->charset = $lang['_charset']; |
@@ -673,7 +672,7 @@ discard block |
||
673 | 672 | * @param array|null $data |
674 | 673 | * @return mixed |
675 | 674 | */ |
676 | - protected function label($string, array $data=null) { |
|
675 | + protected function label($string, array $data = null){ |
|
677 | 676 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
678 | 677 | if (is_array($data)) |
679 | 678 | foreach ($data as $key => $val) |
@@ -685,7 +684,7 @@ discard block |
||
685 | 684 | * @param $message |
686 | 685 | * @param array|null $data |
687 | 686 | */ |
688 | - protected function backMsg($message, array $data=null) { |
|
687 | + protected function backMsg($message, array $data = null){ |
|
689 | 688 | $message = $this->label($message, $data); |
690 | 689 | if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
691 | 690 | @unlink($this->file['tmp_name']); |
@@ -697,7 +696,7 @@ discard block |
||
697 | 696 | * @param $url |
698 | 697 | * @param string $message |
699 | 698 | */ |
700 | - protected function callBack($url, $message="") { |
|
699 | + protected function callBack($url, $message = ""){ |
|
701 | 700 | $message = text::jsValue($message); |
702 | 701 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
703 | 702 | ? $this->opener['CKEditor']['funcNum'] : 0; |
@@ -741,7 +740,7 @@ discard block |
||
741 | 740 | /** |
742 | 741 | * @return string |
743 | 742 | */ |
744 | - protected function get_htaccess() { |
|
743 | + protected function get_htaccess(){ |
|
745 | 744 | return "<IfModule mod_php4.c> |
746 | 745 | php_value engine off |
747 | 746 | </IfModule> |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | * @link http://kcfinder.sunhater.com |
13 | 13 | */ |
14 | 14 | |
15 | -class uploader { |
|
15 | +class uploader |
|
16 | +{ |
|
16 | 17 | |
17 | 18 | /** Release version */ |
18 | 19 | const VERSION = "2.54"; |
@@ -104,7 +105,8 @@ discard block |
||
104 | 105 | /** Magic method which allows read-only access to protected or private class properties |
105 | 106 | * @param string $property |
106 | 107 | * @return mixed */ |
107 | - public function __get($property) { |
|
108 | + public function __get($property) |
|
109 | + { |
|
108 | 110 | return property_exists($this, $property) ? $this->$property : null; |
109 | 111 | } |
110 | 112 | |
@@ -112,13 +114,16 @@ discard block |
||
112 | 114 | * uploader constructor. |
113 | 115 | * @param DocumentParser $modx |
114 | 116 | */ |
115 | - public function __construct(DocumentParser $modx) { |
|
117 | + public function __construct(DocumentParser $modx) |
|
118 | + { |
|
116 | 119 | |
117 | 120 | //MODX |
118 | 121 | try { |
119 | 122 | if ($modx instanceof DocumentParser) { |
120 | 123 | $this->modx = $modx; |
121 | - } else throw new Exception('MODX should be instance of DocumentParser'); |
|
124 | + } else { |
|
125 | + throw new Exception('MODX should be instance of DocumentParser'); |
|
126 | + } |
|
122 | 127 | } catch (Exception $e) { |
123 | 128 | die($e->getMessage()); |
124 | 129 | } |
@@ -133,12 +138,14 @@ discard block |
||
133 | 138 | // SET CMS INTEGRATION ATTRIBUTE |
134 | 139 | if (isset($this->get['cms']) && |
135 | 140 | in_array($this->get['cms'], array("drupal")) |
136 | - ) |
|
137 | - $this->cms = $this->get['cms']; |
|
141 | + ) { |
|
142 | + $this->cms = $this->get['cms']; |
|
143 | + } |
|
138 | 144 | |
139 | 145 | // LINKING UPLOADED FILE |
140 | - if (count($_FILES)) |
|
141 | - $this->file = &$_FILES[key($_FILES)]; |
|
146 | + if (count($_FILES)) { |
|
147 | + $this->file = &$_FILES[key($_FILES)]; |
|
148 | + } |
|
142 | 149 | |
143 | 150 | // LOAD DEFAULT CONFIGURATION |
144 | 151 | require "config.php"; |
@@ -148,31 +155,37 @@ discard block |
||
148 | 155 | if (isset($_CONFIG['_sessionVar']) && |
149 | 156 | is_array($_CONFIG['_sessionVar']) |
150 | 157 | ) { |
151 | - foreach ($_CONFIG['_sessionVar'] as $key => $val) |
|
152 | - if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
158 | + foreach ($_CONFIG['_sessionVar'] as $key => $val) { |
|
159 | + if ((substr($key, 0, 1) != "_") && isset($_CONFIG[$key])) |
|
153 | 160 | $this->config[$key] = $val; |
154 | - if (!isset($this->config['_sessionVar']['self'])) |
|
155 | - $this->config['_sessionVar']['self'] = array(); |
|
161 | + } |
|
162 | + if (!isset($this->config['_sessionVar']['self'])) { |
|
163 | + $this->config['_sessionVar']['self'] = array(); |
|
164 | + } |
|
156 | 165 | $this->session = &$this->config['_sessionVar']['self']; |
157 | - } else |
|
158 | - $this->session = &$_SESSION; |
|
166 | + } else { |
|
167 | + $this->session = &$_SESSION; |
|
168 | + } |
|
159 | 169 | |
160 | 170 | // IMAGE DRIVER INIT |
161 | 171 | if (isset($this->config['imageDriversPriority'])) { |
162 | 172 | $this->config['imageDriversPriority'] = |
163 | 173 | text::clearWhitespaces($this->config['imageDriversPriority']); |
164 | 174 | $driver = image::getDriver(explode(' ', $this->config['imageDriversPriority'])); |
165 | - if ($driver !== false) |
|
166 | - $this->imageDriver = $driver; |
|
175 | + if ($driver !== false) { |
|
176 | + $this->imageDriver = $driver; |
|
177 | + } |
|
167 | 178 | } |
168 | 179 | if ((!isset($driver) || ($driver === false)) && |
169 | 180 | (image::getDriver(array($this->imageDriver)) === false) |
170 | - ) |
|
171 | - die("Cannot find any of the supported PHP image extensions!"); |
|
181 | + ) { |
|
182 | + die("Cannot find any of the supported PHP image extensions!"); |
|
183 | + } |
|
172 | 184 | |
173 | 185 | // WATERMARK INIT |
174 | - if (isset($this->config['watermark']) && is_string($this->config['watermark'])) |
|
175 | - $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
186 | + if (isset($this->config['watermark']) && is_string($this->config['watermark'])) { |
|
187 | + $this->config['watermark'] = array('file' => $this->config['watermark']); |
|
188 | + } |
|
176 | 189 | |
177 | 190 | // GET TYPE DIRECTORY |
178 | 191 | $this->types = &$this->config['types']; |
@@ -186,9 +199,10 @@ discard block |
||
186 | 199 | |
187 | 200 | // LOAD TYPE DIRECTORY SPECIFIC CONFIGURATION IF EXISTS |
188 | 201 | if (is_array($this->types[$this->type])) { |
189 | - foreach ($this->types[$this->type] as $key => $val) |
|
190 | - if (in_array($key, $this->typeSettings)) |
|
202 | + foreach ($this->types[$this->type] as $key => $val) { |
|
203 | + if (in_array($key, $this->typeSettings)) |
|
191 | 204 | $this->config[$key] = $val; |
205 | + } |
|
192 | 206 | $this->types[$this->type] = isset($this->types[$this->type]['type']) |
193 | 207 | ? $this->types[$this->type]['type'] : ""; |
194 | 208 | } |
@@ -198,12 +212,14 @@ discard block |
||
198 | 212 | $ip = '/^' . implode('\.', array($ip, $ip, $ip, $ip)) . '$/'; |
199 | 213 | if (preg_match($ip, $_SERVER['HTTP_HOST']) || |
200 | 214 | preg_match('/^[^\.]+$/', $_SERVER['HTTP_HOST']) |
201 | - ) |
|
202 | - $this->config['cookieDomain'] = ""; |
|
203 | - elseif (!strlen($this->config['cookieDomain'])) |
|
204 | - $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
205 | - if (!strlen($this->config['cookiePath'])) |
|
206 | - $this->config['cookiePath'] = "/"; |
|
215 | + ) { |
|
216 | + $this->config['cookieDomain'] = ""; |
|
217 | + } elseif (!strlen($this->config['cookieDomain'])) { |
|
218 | + $this->config['cookieDomain'] = $_SERVER['HTTP_HOST']; |
|
219 | + } |
|
220 | + if (!strlen($this->config['cookiePath'])) { |
|
221 | + $this->config['cookiePath'] = "/"; |
|
222 | + } |
|
207 | 223 | |
208 | 224 | // UPLOAD FOLDER INIT |
209 | 225 | |
@@ -239,26 +255,30 @@ discard block |
||
239 | 255 | $this->typeDir = "{$this->config['uploadDir']}/{$this->type}"; |
240 | 256 | $this->typeURL = "{$this->config['uploadURL']}/{$this->type}"; |
241 | 257 | } |
242 | - if (!is_dir($this->config['uploadDir'])) |
|
243 | - @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
258 | + if (!is_dir($this->config['uploadDir'])) { |
|
259 | + @mkdir($this->config['uploadDir'], $this->config['dirPerms']); |
|
260 | + } |
|
244 | 261 | |
245 | 262 | // HOST APPLICATIONS INIT |
246 | - if (isset($this->get['CKEditorFuncNum'])) |
|
247 | - $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
263 | + if (isset($this->get['CKEditorFuncNum'])) { |
|
264 | + $this->opener['CKEditor']['funcNum'] = $this->get['CKEditorFuncNum']; |
|
265 | + } |
|
248 | 266 | if (isset($this->get['opener']) && |
249 | 267 | (strtolower($this->get['opener']) == "tinymce") && |
250 | 268 | isset($this->config['_tinyMCEPath']) && |
251 | 269 | strlen($this->config['_tinyMCEPath']) |
252 | - ) |
|
253 | - $this->opener['TinyMCE'] = true; |
|
270 | + ) { |
|
271 | + $this->opener['TinyMCE'] = true; |
|
272 | + } |
|
254 | 273 | |
255 | 274 | // LOCALIZATION |
256 | - foreach ($this->langInputNames as $key) |
|
257 | - if (isset($this->get[$key]) && |
|
275 | + foreach ($this->langInputNames as $key) { |
|
276 | + if (isset($this->get[$key]) && |
|
258 | 277 | preg_match('/^[a-z][a-z\._\-]*$/i', $this->get[$key]) && |
259 | 278 | file_exists("lang/" . strtolower($this->get[$key]) . ".php") |
260 | 279 | ) { |
261 | 280 | $this->lang = $this->get[$key]; |
281 | + } |
|
262 | 282 | break; |
263 | 283 | } |
264 | 284 | $this->localize($this->lang); |
@@ -269,28 +289,34 @@ discard block |
||
269 | 289 | ) { |
270 | 290 | $htaccess = "{$this->config['uploadDir']}/.htaccess"; |
271 | 291 | if (!file_exists($htaccess)) { |
272 | - if (!@file_put_contents($htaccess, $this->get_htaccess())) |
|
273 | - $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
292 | + if (!@file_put_contents($htaccess, $this->get_htaccess())) { |
|
293 | + $this->backMsg("Cannot write to upload folder. {$this->config['uploadDir']}"); |
|
294 | + } |
|
274 | 295 | } else { |
275 | - if (false === ($data = @file_get_contents($htaccess))) |
|
276 | - $this->backMsg("Cannot read .htaccess"); |
|
277 | - if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) |
|
278 | - $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
296 | + if (false === ($data = @file_get_contents($htaccess))) { |
|
297 | + $this->backMsg("Cannot read .htaccess"); |
|
298 | + } |
|
299 | + if (($data != $this->get_htaccess()) && !@file_put_contents($htaccess, $data)) { |
|
300 | + $this->backMsg("Incorrect .htaccess file. Cannot rewrite it!"); |
|
301 | + } |
|
279 | 302 | } |
280 | 303 | } |
281 | 304 | |
282 | 305 | // CHECK & CREATE UPLOAD FOLDER |
283 | 306 | if (!is_dir($this->typeDir)) { |
284 | - if (!mkdir($this->typeDir, $this->config['dirPerms'])) |
|
285 | - $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
286 | - } elseif (!is_readable($this->typeDir)) |
|
287 | - $this->backMsg("Cannot read upload folder."); |
|
307 | + if (!mkdir($this->typeDir, $this->config['dirPerms'])) { |
|
308 | + $this->backMsg("Cannot create {dir} folder.", array('dir' => $this->type)); |
|
309 | + } |
|
310 | + } elseif (!is_readable($this->typeDir)) { |
|
311 | + $this->backMsg("Cannot read upload folder."); |
|
312 | + } |
|
288 | 313 | } |
289 | 314 | |
290 | 315 | /** |
291 | 316 | * @return array|bool|int|null|string|void |
292 | 317 | */ |
293 | - protected function getTransaliasSettings() { |
|
318 | + protected function getTransaliasSettings() |
|
319 | + { |
|
294 | 320 | $modx = evolutionCMS(); |
295 | 321 | |
296 | 322 | // Cleaning uploaded filename? |
@@ -314,7 +340,8 @@ discard block |
||
314 | 340 | * @param $filename |
315 | 341 | * @return mixed|string |
316 | 342 | */ |
317 | - protected function normalizeFilename($filename) { |
|
343 | + protected function normalizeFilename($filename) |
|
344 | + { |
|
318 | 345 | if ($this->getTransaliasSettings()) { |
319 | 346 | $format = strrchr($filename, "."); |
320 | 347 | $filename = str_replace($format, "", $filename); |
@@ -327,7 +354,8 @@ discard block |
||
327 | 354 | * @param $dirname |
328 | 355 | * @return string |
329 | 356 | */ |
330 | - protected function normalizeDirname($dirname) { |
|
357 | + protected function normalizeDirname($dirname) |
|
358 | + { |
|
331 | 359 | return $this->modx->stripAlias($dirname); |
332 | 360 | } |
333 | 361 | |
@@ -335,19 +363,21 @@ discard block |
||
335 | 363 | * @param array|null $aFile |
336 | 364 | * @return bool|mixed |
337 | 365 | */ |
338 | - protected function checkUploadedFile(array $aFile=null) { |
|
366 | + protected function checkUploadedFile(array $aFile=null) |
|
367 | + { |
|
339 | 368 | $config = &$this->config; |
340 | 369 | $file = ($aFile === null) ? $this->file : $aFile; |
341 | 370 | |
342 | - if (!is_array($file) || !isset($file['name'])) |
|
343 | - return $this->label("Unknown error."); |
|
371 | + if (!is_array($file) || !isset($file['name'])) { |
|
372 | + return $this->label("Unknown error."); |
|
373 | + } |
|
344 | 374 | |
345 | 375 | $extension = file::getExtension($file['name']); |
346 | 376 | $typePatt = strtolower(text::clearWhitespaces($this->types[$this->type])); |
347 | 377 | |
348 | 378 | // CHECK FOR UPLOAD ERRORS |
349 | - if ($file['error']) |
|
350 | - return |
|
379 | + if ($file['error']) { |
|
380 | + return |
|
351 | 381 | ($file['error'] == UPLOAD_ERR_INI_SIZE) ? |
352 | 382 | $this->label("The uploaded file exceeds {size} bytes.", |
353 | 383 | array('size' => ini_get('upload_max_filesize'))) : ( |
@@ -364,14 +394,17 @@ discard block |
||
364 | 394 | $this->label("Failed to write file.") : |
365 | 395 | $this->label("Unknown error.") |
366 | 396 | ))))); |
397 | + } |
|
367 | 398 | |
368 | 399 | // HIDDEN FILENAMES CHECK |
369 | - elseif (substr($file['name'], 0, 1) == ".") |
|
370 | - return $this->label("File name shouldn't begins with '.'"); |
|
400 | + elseif (substr($file['name'], 0, 1) == ".") { |
|
401 | + return $this->label("File name shouldn't begins with '.'"); |
|
402 | + } |
|
371 | 403 | |
372 | 404 | // EXTENSION CHECK |
373 | - elseif (!$this->validateExtension($extension, $this->type)) |
|
374 | - return $this->label("Denied file extension."); |
|
405 | + elseif (!$this->validateExtension($extension, $this->type)) { |
|
406 | + return $this->label("Denied file extension."); |
|
407 | + } |
|
375 | 408 | |
376 | 409 | // SPECIAL DIRECTORY TYPES CHECK (e.g. *img) |
377 | 410 | elseif (preg_match('/^\*([^ ]+)(.*)?$/s', $typePatt, $patt)) { |
@@ -381,25 +414,30 @@ discard block |
||
381 | 414 | $type = new $class(); |
382 | 415 | $cfg = $config; |
383 | 416 | $cfg['filename'] = $file['name']; |
384 | - if (strlen($params)) |
|
385 | - $cfg['params'] = trim($params); |
|
417 | + if (strlen($params)) { |
|
418 | + $cfg['params'] = trim($params); |
|
419 | + } |
|
386 | 420 | $response = $type->checkFile($file['tmp_name'], $cfg); |
387 | - if ($response !== true) |
|
388 | - return $this->label($response); |
|
389 | - } else |
|
390 | - return $this->label("Non-existing directory type."); |
|
421 | + if ($response !== true) { |
|
422 | + return $this->label($response); |
|
423 | + } |
|
424 | + } else { |
|
425 | + return $this->label("Non-existing directory type."); |
|
426 | + } |
|
391 | 427 | } |
392 | 428 | |
393 | 429 | // IMAGE RESIZE |
394 | 430 | $img = image::factory($this->imageDriver, $file['tmp_name']); |
395 | - if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) |
|
396 | - return $this->label("The image is too big and/or cannot be resized."); |
|
431 | + if (!$img->initError && !$this->imageResize($img, $file['tmp_name'])) { |
|
432 | + return $this->label("The image is too big and/or cannot be resized."); |
|
433 | + } |
|
397 | 434 | |
398 | 435 | |
399 | 436 | // CHECK FOR MODX MAX FILE SIZE |
400 | 437 | $actualfilesize=filesize($file['tmp_name']); |
401 | - if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) |
|
402 | - return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
438 | + if (isset($this->config['maxfilesize']) && $actualfilesize > $this->config['maxfilesize']) { |
|
439 | + return $this->label("File is too big: ".$actualfilesize." Bytes. (max ".$this->config['maxfilesize']." Bytes)"); |
|
440 | + } |
|
403 | 441 | |
404 | 442 | return true; |
405 | 443 | } |
@@ -410,27 +448,32 @@ discard block |
||
410 | 448 | * @param bool $existing |
411 | 449 | * @return bool|string |
412 | 450 | */ |
413 | - protected function checkInputDir($dir, $inclType=true, $existing=true) { |
|
451 | + protected function checkInputDir($dir, $inclType=true, $existing=true) |
|
452 | + { |
|
414 | 453 | $dir = path::normalize($dir); |
415 | - if (substr($dir, 0, 1) == "/") |
|
416 | - $dir = substr($dir, 1); |
|
454 | + if (substr($dir, 0, 1) == "/") { |
|
455 | + $dir = substr($dir, 1); |
|
456 | + } |
|
417 | 457 | |
418 | - if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) |
|
419 | - return false; |
|
458 | + if ((substr($dir, 0, 1) == ".") || (substr(basename($dir), 0, 1) == ".")) { |
|
459 | + return false; |
|
460 | + } |
|
420 | 461 | |
421 | 462 | if ($inclType) { |
422 | 463 | $first = explode("/", $dir); |
423 | 464 | $first = $first[0]; |
424 | - if ($first != $this->type) |
|
425 | - return false; |
|
465 | + if ($first != $this->type) { |
|
466 | + return false; |
|
467 | + } |
|
426 | 468 | $return = $this->removeTypeFromPath($dir); |
427 | 469 | } else { |
428 | 470 | $return = $dir; |
429 | 471 | $dir = "{$this->type}/$dir"; |
430 | 472 | } |
431 | 473 | |
432 | - if (!$existing) |
|
433 | - return $return; |
|
474 | + if (!$existing) { |
|
475 | + return $return; |
|
476 | + } |
|
434 | 477 | |
435 | 478 | $path = "{$this->config['uploadDir']}/$dir"; |
436 | 479 | return (is_dir($path) && is_readable($path)) ? $return : false; |
@@ -441,21 +484,25 @@ discard block |
||
441 | 484 | * @param $type |
442 | 485 | * @return bool |
443 | 486 | */ |
444 | - protected function validateExtension($ext, $type) { |
|
487 | + protected function validateExtension($ext, $type) |
|
488 | + { |
|
445 | 489 | $ext = trim(strtolower($ext)); |
446 | - if (!isset($this->types[$type])) |
|
447 | - return false; |
|
490 | + if (!isset($this->types[$type])) { |
|
491 | + return false; |
|
492 | + } |
|
448 | 493 | |
449 | 494 | $exts = strtolower(text::clearWhitespaces($this->config['deniedExts'])); |
450 | 495 | if (strlen($exts)) { |
451 | 496 | $exts = explode(" ", $exts); |
452 | - if (in_array($ext, $exts)) |
|
453 | - return false; |
|
497 | + if (in_array($ext, $exts)) { |
|
498 | + return false; |
|
499 | + } |
|
454 | 500 | } |
455 | 501 | |
456 | 502 | $exts = trim($this->types[$type]); |
457 | - if (!strlen($exts) || substr($exts, 0, 1) == "*") |
|
458 | - return true; |
|
503 | + if (!strlen($exts) || substr($exts, 0, 1) == "*") { |
|
504 | + return true; |
|
505 | + } |
|
459 | 506 | |
460 | 507 | if (substr($exts, 0, 1) == "!") { |
461 | 508 | $exts = explode(" ", trim(strtolower(substr($exts, 1)))); |
@@ -470,7 +517,8 @@ discard block |
||
470 | 517 | * @param $path |
471 | 518 | * @return mixed |
472 | 519 | */ |
473 | - protected function getTypeFromPath($path) { |
|
520 | + protected function getTypeFromPath($path) |
|
521 | + { |
|
474 | 522 | return preg_match('/^([^\/]*)\/.*$/', $path, $patt) |
475 | 523 | ? $patt[1] : $path; |
476 | 524 | } |
@@ -479,7 +527,8 @@ discard block |
||
479 | 527 | * @param $path |
480 | 528 | * @return string |
481 | 529 | */ |
482 | - protected function removeTypeFromPath($path) { |
|
530 | + protected function removeTypeFromPath($path) |
|
531 | + { |
|
483 | 532 | return preg_match('/^[^\/]*\/(.*)$/', $path, $patt) |
484 | 533 | ? $patt[1] : ""; |
485 | 534 | } |
@@ -489,16 +538,20 @@ discard block |
||
489 | 538 | * @param null $file |
490 | 539 | * @return bool |
491 | 540 | */ |
492 | - protected function imageResize($image, $file=null) { |
|
541 | + protected function imageResize($image, $file=null) |
|
542 | + { |
|
493 | 543 | |
494 | 544 | if (!($image instanceof image)) { |
495 | 545 | $img = image::factory($this->imageDriver, $image); |
496 | - if ($img->initError) return false; |
|
546 | + if ($img->initError) { |
|
547 | + return false; |
|
548 | + } |
|
497 | 549 | $file = $image; |
498 | - } elseif ($file === null) |
|
499 | - return false; |
|
500 | - else |
|
501 | - $img = $image; |
|
550 | + } elseif ($file === null) { |
|
551 | + return false; |
|
552 | + } else { |
|
553 | + $img = $image; |
|
554 | + } |
|
502 | 555 | |
503 | 556 | $orientation = 1; |
504 | 557 | if (function_exists("exif_read_data")) { |
@@ -520,8 +573,9 @@ discard block |
||
520 | 573 | ) |
521 | 574 | ) && |
522 | 575 | ($orientation == 1) |
523 | - ) |
|
524 | - return true; |
|
576 | + ) { |
|
577 | + return true; |
|
578 | + } |
|
525 | 579 | |
526 | 580 | |
527 | 581 | // PROPORTIONAL RESIZE |
@@ -541,15 +595,17 @@ discard block |
||
541 | 595 | $width = $img->getPropWidth($height); |
542 | 596 | } |
543 | 597 | |
544 | - if (isset($width) && isset($height) && !$img->resize($width, $height)) |
|
545 | - return false; |
|
598 | + if (isset($width) && isset($height) && !$img->resize($width, $height)) { |
|
599 | + return false; |
|
600 | + } |
|
546 | 601 | |
547 | 602 | // RESIZE TO FIT |
548 | 603 | } elseif ( |
549 | 604 | $this->config['maxImageWidth'] && $this->config['maxImageHeight'] && |
550 | 605 | !$img->resizeFit($this->config['maxImageWidth'], $this->config['maxImageHeight']) |
551 | - ) |
|
552 | - return false; |
|
606 | + ) { |
|
607 | + return false; |
|
608 | + } |
|
553 | 609 | |
554 | 610 | // AUTO FLIP AND ROTATE FROM EXIF |
555 | 611 | if ((($orientation == 2) && !$img->flipHorizontal()) || |
@@ -559,11 +615,13 @@ discard block |
||
559 | 615 | (($orientation == 6) && !$img->rotate(90)) || |
560 | 616 | (($orientation == 7) && (!$img->flipHorizontal() || !$img->rotate(90))) || |
561 | 617 | (($orientation == 8) && !$img->rotate(270)) |
562 | - ) |
|
563 | - return false; |
|
564 | - if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) |
|
565 | - try { |
|
618 | + ) { |
|
619 | + return false; |
|
620 | + } |
|
621 | + if (($orientation >= 2) && ($orientation <= 8) && ($this->imageDriver == "imagick")) { |
|
622 | + try { |
|
566 | 623 | $img->image->setImageProperty('exif:Orientation', "1"); |
624 | + } |
|
567 | 625 | } catch (Exception $e) {} |
568 | 626 | |
569 | 627 | // WATERMARK |
@@ -599,22 +657,26 @@ discard block |
||
599 | 657 | * @param bool $overwrite |
600 | 658 | * @return bool |
601 | 659 | */ |
602 | - protected function makeThumb($file, $overwrite=true) { |
|
660 | + protected function makeThumb($file, $overwrite=true) |
|
661 | + { |
|
603 | 662 | $img = image::factory($this->imageDriver, $file); |
604 | 663 | |
605 | 664 | // Drop files which are not images |
606 | - if ($img->initError) |
|
607 | - return true; |
|
665 | + if ($img->initError) { |
|
666 | + return true; |
|
667 | + } |
|
608 | 668 | |
609 | 669 | $thumb = substr($file, strlen($this->config['uploadDir'])); |
610 | 670 | $thumb = $this->config['uploadDir'] . "/" . $this->config['thumbsDir'] . "/" . $thumb; |
611 | 671 | $thumb = path::normalize($thumb); |
612 | 672 | $thumbDir = dirname($thumb); |
613 | - if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) |
|
614 | - return false; |
|
673 | + if (!is_dir($thumbDir) && !@mkdir($thumbDir, $this->config['dirPerms'], true)) { |
|
674 | + return false; |
|
675 | + } |
|
615 | 676 | |
616 | - if (!$overwrite && is_file($thumb)) |
|
617 | - return true; |
|
677 | + if (!$overwrite && is_file($thumb)) { |
|
678 | + return true; |
|
679 | + } |
|
618 | 680 | |
619 | 681 | // Images with smaller resolutions than thumbnails |
620 | 682 | /*if (($img->width <= $this->config['thumbWidth']) && |
@@ -627,8 +689,9 @@ discard block |
||
627 | 689 | |
628 | 690 | // Resize image |
629 | 691 | } else */ |
630 | - if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) |
|
631 | - return false; |
|
692 | + if (!$img->resizeFit($this->config['thumbWidth'], $this->config['thumbHeight'])) { |
|
693 | + return false; |
|
694 | + } |
|
632 | 695 | |
633 | 696 | if ( $this->imageDriver == 'gd' ) { |
634 | 697 | $width = imagesx( $img->image ); |
@@ -653,7 +716,8 @@ discard block |
||
653 | 716 | /** |
654 | 717 | * @param $langCode |
655 | 718 | */ |
656 | - protected function localize($langCode) { |
|
719 | + protected function localize($langCode) |
|
720 | + { |
|
657 | 721 | require "lang/{$langCode}.php"; |
658 | 722 | setlocale(LC_ALL, $lang['_locale']); |
659 | 723 | $this->charset = $lang['_charset']; |
@@ -673,11 +737,13 @@ discard block |
||
673 | 737 | * @param array|null $data |
674 | 738 | * @return mixed |
675 | 739 | */ |
676 | - protected function label($string, array $data=null) { |
|
740 | + protected function label($string, array $data=null) |
|
741 | + { |
|
677 | 742 | $return = isset($this->labels[$string]) ? $this->labels[$string] : $string; |
678 | - if (is_array($data)) |
|
679 | - foreach ($data as $key => $val) |
|
743 | + if (is_array($data)) { |
|
744 | + foreach ($data as $key => $val) |
|
680 | 745 | $return = str_replace("{{$key}}", $val, $return); |
746 | + } |
|
681 | 747 | return $return; |
682 | 748 | } |
683 | 749 | |
@@ -685,10 +751,12 @@ discard block |
||
685 | 751 | * @param $message |
686 | 752 | * @param array|null $data |
687 | 753 | */ |
688 | - protected function backMsg($message, array $data=null) { |
|
754 | + protected function backMsg($message, array $data=null) |
|
755 | + { |
|
689 | 756 | $message = $this->label($message, $data); |
690 | - if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) |
|
691 | - @unlink($this->file['tmp_name']); |
|
757 | + if (isset($this->file['tmp_name']) && file_exists($this->file['tmp_name'])) { |
|
758 | + @unlink($this->file['tmp_name']); |
|
759 | + } |
|
692 | 760 | $this->callBack("", $message); |
693 | 761 | die; |
694 | 762 | } |
@@ -697,11 +765,14 @@ discard block |
||
697 | 765 | * @param $url |
698 | 766 | * @param string $message |
699 | 767 | */ |
700 | - protected function callBack($url, $message="") { |
|
768 | + protected function callBack($url, $message="") |
|
769 | + { |
|
701 | 770 | $message = text::jsValue($message); |
702 | 771 | $CKfuncNum = isset($this->opener['CKEditor']['funcNum']) |
703 | 772 | ? $this->opener['CKEditor']['funcNum'] : 0; |
704 | - if (!$CKfuncNum) $CKfuncNum = 0; |
|
773 | + if (!$CKfuncNum) { |
|
774 | + $CKfuncNum = 0; |
|
775 | + } |
|
705 | 776 | header("Content-Type: text/html; charset={$this->charset}"); |
706 | 777 | |
707 | 778 | ?><html> |
@@ -741,7 +812,8 @@ discard block |
||
741 | 812 | /** |
742 | 813 | * @return string |
743 | 814 | */ |
744 | - protected function get_htaccess() { |
|
815 | + protected function get_htaccess() |
|
816 | + { |
|
745 | 817 | return "<IfModule mod_php4.c> |
746 | 818 | php_value engine off |
747 | 819 | </IfModule> |
@@ -4,18 +4,18 @@ |
||
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->getManagerApi()->action) { |
7 | - case 88: |
|
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 87: |
|
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 88: |
|
8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 87: |
|
13 | + if(!$modx->hasPermission('new_web_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -1,21 +1,21 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | switch($modx->getManagerApi()->action) { |
7 | - case 88: |
|
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
9 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | - } |
|
11 | - break; |
|
12 | - case 87: |
|
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
14 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | - } |
|
16 | - break; |
|
17 | - default: |
|
18 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
7 | + case 88: |
|
8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
9 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
10 | + } |
|
11 | + break; |
|
12 | + case 87: |
|
13 | + if(!$modx->hasPermission('new_web_user')) { |
|
14 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
15 | + } |
|
16 | + break; |
|
17 | + default: |
|
18 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
@@ -24,64 +24,64 @@ discard block |
||
24 | 24 | // check to see the snippet editor isn't locked |
25 | 25 | $rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
26 | 26 | if($username = $modx->getDatabase()->getValue($rs)) { |
27 | - $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
27 | + $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
|
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
31 | 31 | if($modx->getManagerApi()->action == '88') { |
32 | - // get user attributes |
|
33 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
|
34 | - $userdata = $modx->getDatabase()->getRow($rs); |
|
35 | - if(!$userdata) { |
|
36 | - $modx->webAlertAndQuit("No user returned!"); |
|
37 | - } |
|
38 | - |
|
39 | - // get user settings |
|
40 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
|
41 | - $usersettings = array(); |
|
42 | - while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | - extract($usersettings, EXTR_OVERWRITE); |
|
44 | - |
|
45 | - // get user name |
|
46 | - $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_users'), "id = '{$user}'"); |
|
47 | - $usernamedata = $modx->getDatabase()->getRow($rs); |
|
48 | - if(!$usernamedata) { |
|
49 | - $modx->webAlertAndQuit("No user returned while getting username!"); |
|
50 | - } |
|
51 | - $_SESSION['itemname'] = $usernamedata['username']; |
|
32 | + // get user attributes |
|
33 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
|
34 | + $userdata = $modx->getDatabase()->getRow($rs); |
|
35 | + if(!$userdata) { |
|
36 | + $modx->webAlertAndQuit("No user returned!"); |
|
37 | + } |
|
38 | + |
|
39 | + // get user settings |
|
40 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
|
41 | + $usersettings = array(); |
|
42 | + while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | + extract($usersettings, EXTR_OVERWRITE); |
|
44 | + |
|
45 | + // get user name |
|
46 | + $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_users'), "id = '{$user}'"); |
|
47 | + $usernamedata = $modx->getDatabase()->getRow($rs); |
|
48 | + if(!$usernamedata) { |
|
49 | + $modx->webAlertAndQuit("No user returned while getting username!"); |
|
50 | + } |
|
51 | + $_SESSION['itemname'] = $usernamedata['username']; |
|
52 | 52 | } else { |
53 | - $userdata = array(); |
|
54 | - $usersettings = array(); |
|
55 | - $usernamedata = array(); |
|
56 | - $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
53 | + $userdata = array(); |
|
54 | + $usersettings = array(); |
|
55 | + $usernamedata = array(); |
|
56 | + $_SESSION['itemname'] = $_lang["new_web_user"]; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
60 | 60 | foreach($userdata as $key => $val) { |
61 | - $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
61 | + $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
|
62 | 62 | }; |
63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
64 | 64 | |
65 | 65 | // restore saved form |
66 | 66 | $formRestored = false; |
67 | 67 | if($modx->getManagerApi()->hasFormValues()) { |
68 | - $modx->getManagerApi()->loadFormValues(); |
|
69 | - // restore post values |
|
70 | - $userdata = array_merge($userdata, $_POST); |
|
71 | - $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
72 | - $usernamedata['username'] = $userdata['newusername']; |
|
73 | - $usernamedata['oldusername'] = $_POST['oldusername']; |
|
74 | - $usersettings = array_merge($usersettings, $userdata); |
|
75 | - $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
76 | - extract($usersettings, EXTR_OVERWRITE); |
|
68 | + $modx->getManagerApi()->loadFormValues(); |
|
69 | + // restore post values |
|
70 | + $userdata = array_merge($userdata, $_POST); |
|
71 | + $userdata['dob'] = $modx->toTimeStamp($userdata['dob']); |
|
72 | + $usernamedata['username'] = $userdata['newusername']; |
|
73 | + $usernamedata['oldusername'] = $_POST['oldusername']; |
|
74 | + $usersettings = array_merge($usersettings, $userdata); |
|
75 | + $usersettings['allowed_days'] = is_array($_POST['allowed_days']) ? implode(",", $_POST['allowed_days']) : ""; |
|
76 | + extract($usersettings, EXTR_OVERWRITE); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // include the country list language file |
80 | 80 | $_country_lang = array(); |
81 | 81 | if($manager_language != "english" && file_exists(MODX_MANAGER_PATH . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
82 | - include_once MODX_MANAGER_PATH . "includes/lang/country/" . $manager_language . "_country.inc.php"; |
|
82 | + include_once MODX_MANAGER_PATH . "includes/lang/country/" . $manager_language . "_country.inc.php"; |
|
83 | 83 | } else { |
84 | - include_once MODX_MANAGER_PATH . "includes/lang/country/english_country.inc.php"; |
|
84 | + include_once MODX_MANAGER_PATH . "includes/lang/country/english_country.inc.php"; |
|
85 | 85 | } |
86 | 86 | asort($_country_lang); |
87 | 87 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | |
190 | 190 | <form action="index.php?a=89" method="post" name="userform"> |
191 | 191 | <?php |
192 | - // invoke OnWUsrFormPrerender event |
|
193 | - $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
|
194 | - if(is_array($evtOut)) { |
|
195 | - echo implode("", $evtOut); |
|
196 | - } |
|
197 | - ?> |
|
192 | + // invoke OnWUsrFormPrerender event |
|
193 | + $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
|
194 | + if(is_array($evtOut)) { |
|
195 | + echo implode("", $evtOut); |
|
196 | + } |
|
197 | + ?> |
|
198 | 198 | <input type="hidden" name="mode" value="<?php echo $modx->getManagerApi()->action; ?>" /> |
199 | 199 | <input type="hidden" name="id" value="<?php echo $user ?>" /> |
200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
@@ -326,10 +326,10 @@ discard block |
||
326 | 326 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
327 | 327 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
328 | 328 | <?php |
329 | - foreach($_country_lang as $key => $country) { |
|
330 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
331 | - } |
|
332 | - ?> |
|
329 | + foreach($_country_lang as $key => $country) { |
|
330 | + echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
331 | + } |
|
332 | + ?> |
|
333 | 333 | </select></td> |
334 | 334 | </tr> |
335 | 335 | <tr> |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | <i onClick="document.userform.blockedafter.value=''; return true;" class="clearDate <?php echo $_style["actions_calendar_delete"] ?>" data-tooltip="<?php echo $_lang['remove_date']; ?>"></i></td> |
390 | 390 | </tr> |
391 | 391 | <?php |
392 | - } |
|
393 | - ?> |
|
392 | + } |
|
393 | + ?> |
|
394 | 394 | </table> |
395 | 395 | </div> |
396 | 396 | |
@@ -498,40 +498,40 @@ discard block |
||
498 | 498 | </table> |
499 | 499 | </div> |
500 | 500 | <?php |
501 | - if($modx->getConfig('use_udperms')) { |
|
502 | - |
|
503 | - $groupsarray = array(); |
|
504 | - |
|
505 | - if($modx->getManagerApi()->action == '88') { // only do this bit if the user is being edited |
|
506 | - $rs = $modx->getDatabase()->select('webgroup', $modx->getDatabase()->getFullTableName('web_groups'), "webuser='{$user}'"); |
|
507 | - $groupsarray = $modx->getDatabase()->getColumn('webgroup', $rs); |
|
508 | - } |
|
509 | - // retain selected user groups between post |
|
510 | - if(is_array($_POST['user_groups'])) { |
|
511 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
512 | - } |
|
513 | - ?> |
|
501 | + if($modx->getConfig('use_udperms')) { |
|
502 | + |
|
503 | + $groupsarray = array(); |
|
504 | + |
|
505 | + if($modx->getManagerApi()->action == '88') { // only do this bit if the user is being edited |
|
506 | + $rs = $modx->getDatabase()->select('webgroup', $modx->getDatabase()->getFullTableName('web_groups'), "webuser='{$user}'"); |
|
507 | + $groupsarray = $modx->getDatabase()->getColumn('webgroup', $rs); |
|
508 | + } |
|
509 | + // retain selected user groups between post |
|
510 | + if(is_array($_POST['user_groups'])) { |
|
511 | + foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
512 | + } |
|
513 | + ?> |
|
514 | 514 | <div class="tab-page" id="tabPermissions"> |
515 | 515 | <h2 class="tab"><?php echo $_lang['web_access_permissions'] ?></h2> |
516 | 516 | <script type="text/javascript">tpUser.addTabPage(document.getElementById("tabPermissions"));</script> |
517 | 517 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
518 | 518 | <?php |
519 | - $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('webgroup_names'), '', 'name'); |
|
520 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
521 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
522 | - } |
|
523 | - } |
|
524 | - ?> |
|
519 | + $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('webgroup_names'), '', 'name'); |
|
520 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
521 | + echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
522 | + } |
|
523 | + } |
|
524 | + ?> |
|
525 | 525 | </div> |
526 | 526 | <?php |
527 | - // invoke OnWUsrFormRender event |
|
528 | - $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
|
529 | - "id" => $user |
|
530 | - )); |
|
531 | - if(is_array($evtOut)) { |
|
532 | - echo implode("", $evtOut); |
|
533 | - } |
|
534 | - ?> |
|
527 | + // invoke OnWUsrFormRender event |
|
528 | + $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
|
529 | + "id" => $user |
|
530 | + )); |
|
531 | + if(is_array($evtOut)) { |
|
532 | + echo implode("", $evtOut); |
|
533 | + } |
|
534 | + ?> |
|
535 | 535 | </div> |
536 | 536 | </div> |
537 | 537 | <input type="submit" name="save" style="display:none"> |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -switch($modx->getManagerApi()->action) { |
|
6 | +switch ($modx->getManagerApi()->action) { |
|
7 | 7 | case 88: |
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
8 | + if (!$modx->hasPermission('edit_web_user')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 87: |
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
13 | + if (!$modx->hasPermission('new_web_user')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -18,34 +18,34 @@ discard block |
||
18 | 18 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
19 | 19 | } |
20 | 20 | |
21 | -$user = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
21 | +$user = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
22 | 22 | |
23 | 23 | |
24 | 24 | // check to see the snippet editor isn't locked |
25 | -$rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
|
26 | -if($username = $modx->getDatabase()->getValue($rs)) { |
|
25 | +$rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='".$modx->getLoginUserID()."'"); |
|
26 | +if ($username = $modx->getDatabase()->getValue($rs)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
31 | -if($modx->getManagerApi()->action == '88') { |
|
31 | +if ($modx->getManagerApi()->action == '88') { |
|
32 | 32 | // get user attributes |
33 | 33 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
34 | 34 | $userdata = $modx->getDatabase()->getRow($rs); |
35 | - if(!$userdata) { |
|
35 | + if (!$userdata) { |
|
36 | 36 | $modx->webAlertAndQuit("No user returned!"); |
37 | 37 | } |
38 | 38 | |
39 | 39 | // get user settings |
40 | 40 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
41 | 41 | $usersettings = array(); |
42 | - while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
42 | + while ($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
43 | 43 | extract($usersettings, EXTR_OVERWRITE); |
44 | 44 | |
45 | 45 | // get user name |
46 | 46 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_users'), "id = '{$user}'"); |
47 | 47 | $usernamedata = $modx->getDatabase()->getRow($rs); |
48 | - if(!$usernamedata) { |
|
48 | + if (!$usernamedata) { |
|
49 | 49 | $modx->webAlertAndQuit("No user returned while getting username!"); |
50 | 50 | } |
51 | 51 | $_SESSION['itemname'] = $usernamedata['username']; |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // avoid doubling htmlspecialchars (already encoded in DB) |
60 | -foreach($userdata as $key => $val) { |
|
60 | +foreach ($userdata as $key => $val) { |
|
61 | 61 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
62 | 62 | }; |
63 | 63 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
64 | 64 | |
65 | 65 | // restore saved form |
66 | 66 | $formRestored = false; |
67 | -if($modx->getManagerApi()->hasFormValues()) { |
|
67 | +if ($modx->getManagerApi()->hasFormValues()) { |
|
68 | 68 | $modx->getManagerApi()->loadFormValues(); |
69 | 69 | // restore post values |
70 | 70 | $userdata = array_merge($userdata, $_POST); |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | |
79 | 79 | // include the country list language file |
80 | 80 | $_country_lang = array(); |
81 | -if($manager_language != "english" && file_exists(MODX_MANAGER_PATH . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
82 | - include_once MODX_MANAGER_PATH . "includes/lang/country/" . $manager_language . "_country.inc.php"; |
|
81 | +if ($manager_language != "english" && file_exists(MODX_MANAGER_PATH."includes/lang/country/".$manager_language."_country.inc.php")) { |
|
82 | + include_once MODX_MANAGER_PATH."includes/lang/country/".$manager_language."_country.inc.php"; |
|
83 | 83 | } else { |
84 | - include_once MODX_MANAGER_PATH . "includes/lang/country/english_country.inc.php"; |
|
84 | + include_once MODX_MANAGER_PATH."includes/lang/country/english_country.inc.php"; |
|
85 | 85 | } |
86 | 86 | asort($_country_lang); |
87 | 87 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | <?php |
192 | 192 | // invoke OnWUsrFormPrerender event |
193 | 193 | $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
194 | - if(is_array($evtOut)) { |
|
194 | + if (is_array($evtOut)) { |
|
195 | 195 | echo implode("", $evtOut); |
196 | 196 | } |
197 | 197 | ?> |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | <input type="hidden" name="blockedmode" value="<?php echo ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) ? "1" : "0" ?>" /> |
201 | 201 | |
202 | 202 | <h1> |
203 | - <i class="fa fa fa-users"></i><?= ($usernamedata['username'] ? $usernamedata['username'] . '<small>(' . $usernamedata['id'] . ')</small>' : $_lang['web_user_title']) ?> |
|
203 | + <i class="fa fa fa-users"></i><?= ($usernamedata['username'] ? $usernamedata['username'].'<small>('.$usernamedata['id'].')</small>' : $_lang['web_user_title']) ?> |
|
204 | 204 | </h1> |
205 | 205 | |
206 | 206 | <?= ManagerTheme::getStyle('actionbuttons.dynamic.user') ?> |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | <table border="0" cellspacing="0" cellpadding="3" class="table table--edit table--editUser"> |
219 | 219 | <tr> |
220 | 220 | <td colspan="3"><span id="blocked" class="warning"> |
221 | - <?php if($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) { ?> |
|
221 | + <?php if ($userdata['blocked'] == 1 || ($userdata['blockeduntil'] > time() && $userdata['blockeduntil'] != 0) || ($userdata['blockedafter'] < time() && $userdata['blockedafter'] != 0) || $userdata['failedlogins'] > 3) { ?> |
|
222 | 222 | <b><?php echo $_lang['user_is_blocked']; ?></b> |
223 | 223 | <?php } ?> |
224 | 224 | </span> |
225 | 225 | <br /></td> |
226 | 226 | </tr> |
227 | - <?php if(!empty($userdata['id'])) { ?> |
|
227 | + <?php if (!empty($userdata['id'])) { ?> |
|
228 | 228 | <tr id="showname" style="display: <?php echo ($modx->getManagerApi()->action == '88' && (!isset($usernamedata['oldusername']) || $usernamedata['oldusername'] == $usernamedata['username'])) ? $displayStyle : 'none'; ?> "> |
229 | 229 | <th><?php echo $_lang['username']; ?>:</th> |
230 | 230 | <td> </td> |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | <td><input type="text" name="newusername" class="inputBox" value="<?php echo $modx->getPhpCompat()->htmlspecialchars(isset($_POST['newusername']) ? $_POST['newusername'] : $usernamedata['username']); ?>" onChange='documentDirty=true;' maxlength="100" /></td> |
240 | 240 | </tr> |
241 | 241 | <tr> |
242 | - <th><?php echo $modx->getManagerApi()->action == '87' ? $_lang['password'] . ":" : $_lang['change_password_new'] . ":"; ?></th> |
|
242 | + <th><?php echo $modx->getManagerApi()->action == '87' ? $_lang['password'].":" : $_lang['change_password_new'].":"; ?></th> |
|
243 | 243 | <td> </td> |
244 | 244 | <td><input name="newpasswordcheck" type="checkbox" onClick="changestate(document.userform.newpassword);changePasswordState(document.userform.newpassword);"<?php echo $modx->getManagerApi()->action == "87" ? " checked disabled" : ""; ?>> |
245 | 245 | <input type="hidden" name="newpassword" value="<?php echo $modx->getManagerApi()->action == "87" ? 1 : 0; ?>" onChange="documentDirty=true;" /> |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
327 | 327 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
328 | 328 | <?php |
329 | - foreach($_country_lang as $key => $country) { |
|
330 | - echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
|
329 | + foreach ($_country_lang as $key => $country) { |
|
330 | + echo "<option value=\"$key\"".(isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '').">$country</option>"; |
|
331 | 331 | } |
332 | 332 | ?> |
333 | 333 | </select></td> |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | <td> </td> |
354 | 354 | <td><textarea type="text" name="comment" class="inputBox" rows="5" onChange="documentDirty=true;"><?php echo $modx->getPhpCompat()->htmlspecialchars(isset($_POST['comment']) ? $_POST['comment'] : $userdata['comment']); ?></textarea></td> |
355 | 355 | </tr> |
356 | - <?php if($modx->getManagerApi()->action == '88') { ?> |
|
356 | + <?php if ($modx->getManagerApi()->action == '88') { ?> |
|
357 | 357 | <tr> |
358 | 358 | <th><?php echo $_lang['user_logincount']; ?>:</th> |
359 | 359 | <td> </td> |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | function BrowseServer() { |
475 | 475 | var w = screen.width * 0.7; |
476 | 476 | var h = screen.height * 0.7; |
477 | - OpenServerBrowser("<?php echo MODX_MANAGER_URL;?>media/browser/<?php echo $which_browser;?>/browser.php?Type=images", w, h); |
|
477 | + OpenServerBrowser("<?php echo MODX_MANAGER_URL; ?>media/browser/<?php echo $which_browser; ?>/browser.php?Type=images", w, h); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | function SetUrl(url, width, height, alt) { |
@@ -493,22 +493,22 @@ discard block |
||
493 | 493 | <td class='comment'><?php echo $_lang["user_photo_message"] ?></td> |
494 | 494 | </tr> |
495 | 495 | <tr> |
496 | - <td colspan="2" align="center"><img name="iphoto" src="<?php echo isset($_POST['photo']) ? (strpos($_POST['photo'], "http://") === false ? MODX_SITE_URL : "") . $_POST['photo'] : !empty($userdata['photo']) ? (strpos($userdata['photo'], "http://") === false ? MODX_SITE_URL : "") . $userdata['photo'] : $_style["tx"]; ?>" /></td> |
|
496 | + <td colspan="2" align="center"><img name="iphoto" src="<?php echo isset($_POST['photo']) ? (strpos($_POST['photo'], "http://") === false ? MODX_SITE_URL : "").$_POST['photo'] : !empty($userdata['photo']) ? (strpos($userdata['photo'], "http://") === false ? MODX_SITE_URL : "").$userdata['photo'] : $_style["tx"]; ?>" /></td> |
|
497 | 497 | </tr> |
498 | 498 | </table> |
499 | 499 | </div> |
500 | 500 | <?php |
501 | - if($modx->getConfig('use_udperms')) { |
|
501 | + if ($modx->getConfig('use_udperms')) { |
|
502 | 502 | |
503 | 503 | $groupsarray = array(); |
504 | 504 | |
505 | - if($modx->getManagerApi()->action == '88') { // only do this bit if the user is being edited |
|
505 | + if ($modx->getManagerApi()->action == '88') { // only do this bit if the user is being edited |
|
506 | 506 | $rs = $modx->getDatabase()->select('webgroup', $modx->getDatabase()->getFullTableName('web_groups'), "webuser='{$user}'"); |
507 | 507 | $groupsarray = $modx->getDatabase()->getColumn('webgroup', $rs); |
508 | 508 | } |
509 | 509 | // retain selected user groups between post |
510 | - if(is_array($_POST['user_groups'])) { |
|
511 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
510 | + if (is_array($_POST['user_groups'])) { |
|
511 | + foreach ($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
512 | 512 | } |
513 | 513 | ?> |
514 | 514 | <div class="tab-page" id="tabPermissions"> |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
518 | 518 | <?php |
519 | 519 | $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('webgroup_names'), '', 'name'); |
520 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
521 | - echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
|
520 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
521 | + echo '<label><input type="checkbox" name="user_groups[]" value="'.$row['id'].'"'.(in_array($row['id'], $groupsarray) ? ' checked="checked"' : '').' />'.$row['name'].'</label><br />'; |
|
522 | 522 | } |
523 | 523 | } |
524 | 524 | ?> |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
529 | 529 | "id" => $user |
530 | 530 | )); |
531 | - if(is_array($evtOut)) { |
|
531 | + if (is_array($evtOut)) { |
|
532 | 532 | echo implode("", $evtOut); |
533 | 533 | } |
534 | 534 | ?> |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | |
6 | -switch($modx->getManagerApi()->action) { |
|
6 | +switch($modx->getManagerApi()->action) { |
|
7 | 7 | case 88: |
8 | - if(!$modx->hasPermission('edit_web_user')) { |
|
8 | + if(!$modx->hasPermission('edit_web_user')) { |
|
9 | 9 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
10 | 10 | } |
11 | 11 | break; |
12 | 12 | case 87: |
13 | - if(!$modx->hasPermission('new_web_user')) { |
|
13 | + if(!$modx->hasPermission('new_web_user')) { |
|
14 | 14 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
15 | 15 | } |
16 | 16 | break; |
@@ -23,33 +23,35 @@ discard block |
||
23 | 23 | |
24 | 24 | // check to see the snippet editor isn't locked |
25 | 25 | $rs = $modx->getDatabase()->select('username', $modx->getDatabase()->getFullTableName('active_users'), "action=88 AND id='{$user}' AND internalKey!='" . $modx->getLoginUserID() . "'"); |
26 | -if($username = $modx->getDatabase()->getValue($rs)) { |
|
26 | +if($username = $modx->getDatabase()->getValue($rs)) { |
|
27 | 27 | $modx->webAlertAndQuit(sprintf($_lang["lock_msg"], $username, "web user")); |
28 | 28 | } |
29 | 29 | // end check for lock |
30 | 30 | |
31 | -if($modx->getManagerApi()->action == '88') { |
|
31 | +if($modx->getManagerApi()->action == '88') { |
|
32 | 32 | // get user attributes |
33 | 33 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_attributes'), "internalKey = '{$user}'"); |
34 | 34 | $userdata = $modx->getDatabase()->getRow($rs); |
35 | - if(!$userdata) { |
|
35 | + if(!$userdata) { |
|
36 | 36 | $modx->webAlertAndQuit("No user returned!"); |
37 | 37 | } |
38 | 38 | |
39 | 39 | // get user settings |
40 | 40 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_user_settings'), "webuser = '{$user}'"); |
41 | 41 | $usersettings = array(); |
42 | - while($row = $modx->getDatabase()->getRow($rs)) $usersettings[$row['setting_name']] = $row['setting_value']; |
|
42 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
43 | + $usersettings[$row['setting_name']] = $row['setting_value']; |
|
44 | + } |
|
43 | 45 | extract($usersettings, EXTR_OVERWRITE); |
44 | 46 | |
45 | 47 | // get user name |
46 | 48 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('web_users'), "id = '{$user}'"); |
47 | 49 | $usernamedata = $modx->getDatabase()->getRow($rs); |
48 | - if(!$usernamedata) { |
|
50 | + if(!$usernamedata) { |
|
49 | 51 | $modx->webAlertAndQuit("No user returned while getting username!"); |
50 | 52 | } |
51 | 53 | $_SESSION['itemname'] = $usernamedata['username']; |
52 | -} else { |
|
54 | +} else { |
|
53 | 55 | $userdata = array(); |
54 | 56 | $usersettings = array(); |
55 | 57 | $usernamedata = array(); |
@@ -57,14 +59,14 @@ discard block |
||
57 | 59 | } |
58 | 60 | |
59 | 61 | // avoid doubling htmlspecialchars (already encoded in DB) |
60 | -foreach($userdata as $key => $val) { |
|
62 | +foreach($userdata as $key => $val) { |
|
61 | 63 | $userdata[$key] = html_entity_decode($val, ENT_NOQUOTES, $modx->config['modx_charset']); |
62 | 64 | }; |
63 | 65 | $usernamedata['username'] = html_entity_decode($usernamedata['username'], ENT_NOQUOTES, $modx->config['modx_charset']); |
64 | 66 | |
65 | 67 | // restore saved form |
66 | 68 | $formRestored = false; |
67 | -if($modx->getManagerApi()->hasFormValues()) { |
|
69 | +if($modx->getManagerApi()->hasFormValues()) { |
|
68 | 70 | $modx->getManagerApi()->loadFormValues(); |
69 | 71 | // restore post values |
70 | 72 | $userdata = array_merge($userdata, $_POST); |
@@ -78,9 +80,9 @@ discard block |
||
78 | 80 | |
79 | 81 | // include the country list language file |
80 | 82 | $_country_lang = array(); |
81 | -if($manager_language != "english" && file_exists(MODX_MANAGER_PATH . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
83 | +if($manager_language != "english" && file_exists(MODX_MANAGER_PATH . "includes/lang/country/" . $manager_language . "_country.inc.php")) { |
|
82 | 84 | include_once MODX_MANAGER_PATH . "includes/lang/country/" . $manager_language . "_country.inc.php"; |
83 | -} else { |
|
85 | +} else { |
|
84 | 86 | include_once MODX_MANAGER_PATH . "includes/lang/country/english_country.inc.php"; |
85 | 87 | } |
86 | 88 | asort($_country_lang); |
@@ -191,7 +193,7 @@ discard block |
||
191 | 193 | <?php |
192 | 194 | // invoke OnWUsrFormPrerender event |
193 | 195 | $evtOut = $modx->invokeEvent("OnWUsrFormPrerender", array("id" => $user)); |
194 | - if(is_array($evtOut)) { |
|
196 | + if(is_array($evtOut)) { |
|
195 | 197 | echo implode("", $evtOut); |
196 | 198 | } |
197 | 199 | ?> |
@@ -326,7 +328,7 @@ discard block |
||
326 | 328 | <?php $chosenCountry = isset($_POST['country']) ? $_POST['country'] : $userdata['country']; ?> |
327 | 329 | <option value="" <?php (!isset($chosenCountry) ? ' selected' : '') ?> > </option> |
328 | 330 | <?php |
329 | - foreach($_country_lang as $key => $country) { |
|
331 | + foreach($_country_lang as $key => $country) { |
|
330 | 332 | echo "<option value=\"$key\"" . (isset($chosenCountry) && $chosenCountry == $key ? ' selected' : '') . ">$country</option>"; |
331 | 333 | } |
332 | 334 | ?> |
@@ -498,17 +500,20 @@ discard block |
||
498 | 500 | </table> |
499 | 501 | </div> |
500 | 502 | <?php |
501 | - if($modx->getConfig('use_udperms')) { |
|
503 | + if($modx->getConfig('use_udperms')) { |
|
502 | 504 | |
503 | 505 | $groupsarray = array(); |
504 | 506 | |
505 | - if($modx->getManagerApi()->action == '88') { // only do this bit if the user is being edited |
|
507 | + if($modx->getManagerApi()->action == '88') { |
|
508 | +// only do this bit if the user is being edited |
|
506 | 509 | $rs = $modx->getDatabase()->select('webgroup', $modx->getDatabase()->getFullTableName('web_groups'), "webuser='{$user}'"); |
507 | 510 | $groupsarray = $modx->getDatabase()->getColumn('webgroup', $rs); |
508 | 511 | } |
509 | 512 | // retain selected user groups between post |
510 | - if(is_array($_POST['user_groups'])) { |
|
511 | - foreach($_POST['user_groups'] as $n => $v) $groupsarray[] = $v; |
|
513 | + if(is_array($_POST['user_groups'])) { |
|
514 | + foreach($_POST['user_groups'] as $n => $v) { |
|
515 | + $groupsarray[] = $v; |
|
516 | + } |
|
512 | 517 | } |
513 | 518 | ?> |
514 | 519 | <div class="tab-page" id="tabPermissions"> |
@@ -517,7 +522,7 @@ discard block |
||
517 | 522 | <p><?php echo $_lang['access_permissions_user_message'] ?></p> |
518 | 523 | <?php |
519 | 524 | $rs = $modx->getDatabase()->select('name, id', $modx->getDatabase()->getFullTableName('webgroup_names'), '', 'name'); |
520 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
525 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
521 | 526 | echo '<label><input type="checkbox" name="user_groups[]" value="' . $row['id'] . '"' . (in_array($row['id'], $groupsarray) ? ' checked="checked"' : '') . ' />' . $row['name'] . '</label><br />'; |
522 | 527 | } |
523 | 528 | } |
@@ -528,7 +533,7 @@ discard block |
||
528 | 533 | $evtOut = $modx->invokeEvent("OnWUsrFormRender", array( |
529 | 534 | "id" => $user |
530 | 535 | )); |
531 | - if(is_array($evtOut)) { |
|
536 | + if(is_array($evtOut)) { |
|
532 | 537 | echo implode("", $evtOut); |
533 | 538 | } |
534 | 539 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | if (!$modx->hasPermission('save_template')) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | $updateMsg = ''; |
16 | 16 | |
17 | 17 | if (isset($_POST['listSubmitted'])) { |
18 | - $updateMsg .= '<span class="text-success" id="updated">' . $_lang['sort_updated'] . '</span>'; |
|
18 | + $updateMsg .= '<span class="text-success" id="updated">'.$_lang['sort_updated'].'</span>'; |
|
19 | 19 | foreach ($_POST as $listName => $listValue) { |
20 | 20 | if ($listName == 'listSubmitted' || $listName == 'reset') { |
21 | 21 | continue; |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | $sortableList = '<div class="clearfix"><ul id="sortlist" class="sortableList">'; |
41 | 41 | while ($row = $modx->getDatabase()->getRow($rs)) { |
42 | 42 | $caption = $row['caption'] != '' ? $row['caption'] : $row['name']; |
43 | - $sortableList .= '<li id="item_' . $row['id'] . '"><i class="fa fa-list-alt"></i> ' . $caption . ' <small class="protectedNode" style="float:right">[*' . $row['name'] . '*]</small></li>'; |
|
43 | + $sortableList .= '<li id="item_'.$row['id'].'"><i class="fa fa-list-alt"></i> '.$caption.' <small class="protectedNode" style="float:right">[*'.$row['name'].'*]</small></li>'; |
|
44 | 44 | } |
45 | 45 | $sortableList .= '</ul></div>'; |
46 | 46 | } else { |
47 | - $updateMsg = '<p class="text-danger">' . $_lang['tmplvars_novars'] . '</p>'; |
|
47 | + $updateMsg = '<p class="text-danger">'.$_lang['tmplvars_novars'].'</p>'; |
|
48 | 48 | } |
49 | 49 | ?> |
50 | 50 |
@@ -3,18 +3,18 @@ |
||
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | 5 | switch($modx->getManagerApi()->action) { |
6 | - case 107: |
|
7 | - if(!$modx->hasPermission('new_module')) { |
|
8 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | - } |
|
10 | - break; |
|
11 | - case 108: |
|
12 | - if(!$modx->hasPermission('edit_module')) { |
|
13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | - } |
|
15 | - break; |
|
16 | - default: |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + case 107: |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
10 | + break; |
|
11 | + case 108: |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | + } |
|
15 | + break; |
|
16 | + default: |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | 18 | } |
19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
20 | 20 | // Get table names (alphabetical) |
@@ -1,15 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -switch($modx->getManagerApi()->action) { |
|
5 | +switch($modx->getManagerApi()->action) { |
|
6 | 6 | case 107: |
7 | - if(!$modx->hasPermission('new_module')) { |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
9 | 9 | } |
10 | 10 | break; |
11 | 11 | case 108: |
12 | - if(!$modx->hasPermission('edit_module')) { |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
14 | 14 | } |
15 | 15 | break; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | // check to see the module editor isn't locked |
34 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
34 | +if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
35 | 35 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
36 | 36 | } |
37 | 37 | // end check for lock |
@@ -39,22 +39,22 @@ discard block |
||
39 | 39 | // Lock snippet for other users to edit |
40 | 40 | $modx->lockElement(6, $id); |
41 | 41 | |
42 | -if(isset($_GET['id'])) { |
|
42 | +if(isset($_GET['id'])) { |
|
43 | 43 | $rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'"); |
44 | 44 | $content = $modx->getDatabase()->getRow($rs); |
45 | - if(!$content) { |
|
45 | + if(!$content) { |
|
46 | 46 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
47 | 47 | } |
48 | 48 | $content['properties'] = str_replace("&", "&", $content['properties']); |
49 | 49 | $_SESSION['itemname'] = $content['name']; |
50 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
50 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
51 | 51 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
52 | 52 | } |
53 | -} else { |
|
53 | +} else { |
|
54 | 54 | $_SESSION['itemname'] = $_lang["new_module"]; |
55 | 55 | $content['wrap'] = '1'; |
56 | 56 | } |
57 | -if($modx->getManagerApi()->hasFormValues()) { |
|
57 | +if($modx->getManagerApi()->hasFormValues()) { |
|
58 | 58 | $modx->getManagerApi()->loadFormValues(); |
59 | 59 | } |
60 | 60 | |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <?php |
429 | 429 | // invoke OnModFormPrerender event |
430 | 430 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
431 | - if(is_array($evtOut)) { |
|
431 | + if(is_array($evtOut)) { |
|
432 | 432 | echo implode('', $evtOut); |
433 | 433 | } |
434 | 434 | |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | <option> </option> |
492 | 492 | <?php |
493 | 493 | include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
494 | - foreach(getCategories() as $n => $v) { |
|
494 | + foreach(getCategories() as $n => $v) { |
|
495 | 495 | echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n"; |
496 | 496 | } |
497 | 497 | ?> |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | $rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
644 | 644 | $groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs); |
645 | 645 | |
646 | - if($modx->hasPermission('access_permissions')) { |
|
646 | + if($modx->hasPermission('access_permissions')) { |
|
647 | 647 | ?> |
648 | 648 | <!-- User Group Access Permissions --> |
649 | 649 | <script type="text/javascript"> |
@@ -671,21 +671,21 @@ discard block |
||
671 | 671 | } |
672 | 672 | $chk = ''; |
673 | 673 | $rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name'); |
674 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
674 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
675 | 675 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
676 | 676 | $checked = in_array($row['id'], $groupsarray); |
677 | - if($modx->hasPermission('access_permissions')) { |
|
678 | - if($checked) { |
|
677 | + if($modx->hasPermission('access_permissions')) { |
|
678 | + if($checked) { |
|
679 | 679 | $notPublic = true; |
680 | 680 | } |
681 | 681 | $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
682 | - } else { |
|
683 | - if($checked) { |
|
682 | + } else { |
|
683 | + if($checked) { |
|
684 | 684 | $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
685 | 685 | } |
686 | 686 | } |
687 | 687 | } |
688 | - if($modx->hasPermission('access_permissions')) { |
|
688 | + if($modx->hasPermission('access_permissions')) { |
|
689 | 689 | $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
690 | 690 | } |
691 | 691 | echo $chks; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | <?php |
708 | 708 | // invoke OnModFormRender event |
709 | 709 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
710 | - if(is_array($evtOut)) { |
|
710 | + if(is_array($evtOut)) { |
|
711 | 711 | echo implode('', $evtOut); |
712 | 712 | } |
713 | 713 | ?> |
@@ -1,20 +1,20 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
3 | - die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
3 | + die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
4 | 4 | } |
5 | 5 | switch($modx->getManagerApi()->action) { |
6 | - case 107: |
|
7 | - if(!$modx->hasPermission('new_module')) { |
|
8 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | - } |
|
10 | - break; |
|
11 | - case 108: |
|
12 | - if(!$modx->hasPermission('edit_module')) { |
|
13 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | - } |
|
15 | - break; |
|
16 | - default: |
|
17 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
6 | + case 107: |
|
7 | + if(!$modx->hasPermission('new_module')) { |
|
8 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
9 | + } |
|
10 | + break; |
|
11 | + case 108: |
|
12 | + if(!$modx->hasPermission('edit_module')) { |
|
13 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
14 | + } |
|
15 | + break; |
|
16 | + default: |
|
17 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
18 | 18 | } |
19 | 19 | $id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
20 | 20 | // Get table names (alphabetical) |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | // check to see the module editor isn't locked |
34 | 34 | if($lockedEl = $modx->elementIsLocked(6, $id)) { |
35 | - $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
35 | + $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
|
36 | 36 | } |
37 | 37 | // end check for lock |
38 | 38 | |
@@ -40,22 +40,22 @@ discard block |
||
40 | 40 | $modx->lockElement(6, $id); |
41 | 41 | |
42 | 42 | if(isset($_GET['id'])) { |
43 | - $rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'"); |
|
44 | - $content = $modx->getDatabase()->getRow($rs); |
|
45 | - if(!$content) { |
|
46 | - $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
47 | - } |
|
48 | - $content['properties'] = str_replace("&", "&", $content['properties']); |
|
49 | - $_SESSION['itemname'] = $content['name']; |
|
50 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
51 | - $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
52 | - } |
|
43 | + $rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'"); |
|
44 | + $content = $modx->getDatabase()->getRow($rs); |
|
45 | + if(!$content) { |
|
46 | + $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
|
47 | + } |
|
48 | + $content['properties'] = str_replace("&", "&", $content['properties']); |
|
49 | + $_SESSION['itemname'] = $content['name']; |
|
50 | + if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
51 | + $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
|
52 | + } |
|
53 | 53 | } else { |
54 | - $_SESSION['itemname'] = $_lang["new_module"]; |
|
55 | - $content['wrap'] = '1'; |
|
54 | + $_SESSION['itemname'] = $_lang["new_module"]; |
|
55 | + $content['wrap'] = '1'; |
|
56 | 56 | } |
57 | 57 | if($modx->getManagerApi()->hasFormValues()) { |
58 | - $modx->getManagerApi()->loadFormValues(); |
|
58 | + $modx->getManagerApi()->loadFormValues(); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | // Add lock-element JS-Script |
@@ -426,18 +426,18 @@ discard block |
||
426 | 426 | |
427 | 427 | <form name="mutate" id="mutate" class="module" method="post" action="index.php?a=109"> |
428 | 428 | <?php |
429 | - // invoke OnModFormPrerender event |
|
430 | - $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
|
431 | - if(is_array($evtOut)) { |
|
432 | - echo implode('', $evtOut); |
|
433 | - } |
|
434 | - |
|
435 | - // Prepare internal params & info-tab via parseDocBlock |
|
436 | - $modulecode = isset($content['modulecode']) ? $modx->getDatabase()->escape($content['modulecode']) : ''; |
|
437 | - $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
438 | - $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
439 | - $internal = array(); |
|
440 | - ?> |
|
429 | + // invoke OnModFormPrerender event |
|
430 | + $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
|
431 | + if(is_array($evtOut)) { |
|
432 | + echo implode('', $evtOut); |
|
433 | + } |
|
434 | + |
|
435 | + // Prepare internal params & info-tab via parseDocBlock |
|
436 | + $modulecode = isset($content['modulecode']) ? $modx->getDatabase()->escape($content['modulecode']) : ''; |
|
437 | + $docBlock = $modx->parseDocBlockFromString($modulecode); |
|
438 | + $docBlockList = $modx->convertDocBlockIntoList($docBlock); |
|
439 | + $internal = array(); |
|
440 | + ?> |
|
441 | 441 | <input type="hidden" name="id" value="<?= $content['id'] ?>"> |
442 | 442 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>"> |
443 | 443 | |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
491 | 491 | <option> </option> |
492 | 492 | <?php |
493 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
494 | - foreach(getCategories() as $n => $v) { |
|
495 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n"; |
|
496 | - } |
|
497 | - ?> |
|
493 | + include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
494 | + foreach(getCategories() as $n => $v) { |
|
495 | + echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n"; |
|
496 | + } |
|
497 | + ?> |
|
498 | 498 | </select> |
499 | 499 | </div> |
500 | 500 | </div> |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | <i class="<?= $_style["actions_save"] ?>"></i> <?= $_lang['manage_depends'] ?></a> |
602 | 602 | </div> |
603 | 603 | <?php |
604 | - $ds = $modx->getDatabase()->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, |
|
604 | + $ds = $modx->getDatabase()->select("smd.id, COALESCE(ss.name,st.templatename,sv.name,sc.name,sp.name,sd.pagetitle) AS name, |
|
605 | 605 | CASE smd.type |
606 | 606 | WHEN 10 THEN 'Chunk' |
607 | 607 | WHEN 20 THEN 'Document' |
@@ -617,16 +617,16 @@ discard block |
||
617 | 617 | LEFT JOIN {$tbl_site_templates} AS st ON st.id = smd.resource AND smd.type = 50 |
618 | 618 | LEFT JOIN {$tbl_site_tmplvars} AS sv ON sv.id = smd.resource AND smd.type = 60", "smd.module='{$id}'", 'smd.type,name'); |
619 | 619 | |
620 | - $grd = new \EvolutionCMS\Support\DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
621 | - $grd->noRecordMsg = $_lang['no_records_found']; |
|
622 | - $grd->cssClass = 'grid'; |
|
623 | - $grd->columnHeaderClass = 'gridHeader'; |
|
624 | - $grd->itemClass = 'gridItem'; |
|
625 | - $grd->altItemClass = 'gridAltItem'; |
|
626 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
627 | - $grd->fields = "name,type"; |
|
628 | - echo $grd->render(); |
|
629 | - ?> |
|
620 | + $grd = new \EvolutionCMS\Support\DataGrid('', $ds, 0); // set page size to 0 t show all items |
|
621 | + $grd->noRecordMsg = $_lang['no_records_found']; |
|
622 | + $grd->cssClass = 'grid'; |
|
623 | + $grd->columnHeaderClass = 'gridHeader'; |
|
624 | + $grd->itemClass = 'gridItem'; |
|
625 | + $grd->altItemClass = 'gridAltItem'; |
|
626 | + $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
627 | + $grd->fields = "name,type"; |
|
628 | + echo $grd->render(); |
|
629 | + ?> |
|
630 | 630 | </div> |
631 | 631 | </div> |
632 | 632 | <?php endif; ?> |
@@ -638,12 +638,12 @@ discard block |
||
638 | 638 | <div class="container container-body"> |
639 | 639 | <?php if($modx->getConfig('use_udperms')) : ?> |
640 | 640 | <?php |
641 | - // fetch user access permissions for the module |
|
642 | - $rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
|
643 | - $groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs); |
|
641 | + // fetch user access permissions for the module |
|
642 | + $rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
|
643 | + $groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs); |
|
644 | 644 | |
645 | - if($modx->hasPermission('access_permissions')) { |
|
646 | - ?> |
|
645 | + if($modx->hasPermission('access_permissions')) { |
|
646 | + ?> |
|
647 | 647 | <!-- User Group Access Permissions --> |
648 | 648 | <script type="text/javascript"> |
649 | 649 | function makePublic(b) { |
@@ -667,28 +667,28 @@ discard block |
||
667 | 667 | </script> |
668 | 668 | <p><?= $_lang['module_group_access_msg'] ?></p> |
669 | 669 | <?php |
670 | - } |
|
671 | - $chk = ''; |
|
672 | - $rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name'); |
|
673 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
674 | - $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
675 | - $checked = in_array($row['id'], $groupsarray); |
|
676 | - if($modx->hasPermission('access_permissions')) { |
|
677 | - if($checked) { |
|
678 | - $notPublic = true; |
|
679 | - } |
|
680 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
681 | - } else { |
|
682 | - if($checked) { |
|
683 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
684 | - } |
|
685 | - } |
|
686 | - } |
|
687 | - if($modx->hasPermission('access_permissions')) { |
|
688 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
689 | - } |
|
690 | - echo $chks; |
|
691 | - ?> |
|
670 | + } |
|
671 | + $chk = ''; |
|
672 | + $rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name'); |
|
673 | + while($row = $modx->getDatabase()->getRow($rs)) { |
|
674 | + $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
|
675 | + $checked = in_array($row['id'], $groupsarray); |
|
676 | + if($modx->hasPermission('access_permissions')) { |
|
677 | + if($checked) { |
|
678 | + $notPublic = true; |
|
679 | + } |
|
680 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
681 | + } else { |
|
682 | + if($checked) { |
|
683 | + $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
684 | + } |
|
685 | + } |
|
686 | + } |
|
687 | + if($modx->hasPermission('access_permissions')) { |
|
688 | + $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
689 | + } |
|
690 | + echo $chks; |
|
691 | + ?> |
|
692 | 692 | <?php endif; ?> |
693 | 693 | </div> |
694 | 694 | </div> |
@@ -704,11 +704,11 @@ discard block |
||
704 | 704 | |
705 | 705 | <input type="submit" name="save" style="display:none;"> |
706 | 706 | <?php |
707 | - // invoke OnModFormRender event |
|
708 | - $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
|
709 | - if(is_array($evtOut)) { |
|
710 | - echo implode('', $evtOut); |
|
711 | - } |
|
712 | - ?> |
|
707 | + // invoke OnModFormRender event |
|
708 | + $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
|
709 | + if(is_array($evtOut)) { |
|
710 | + echo implode('', $evtOut); |
|
711 | + } |
|
712 | + ?> |
|
713 | 713 | </form> |
714 | 714 | <script type="text/javascript">setTimeout('showParameters();', 10);</script> |
@@ -1,22 +1,22 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
4 | 4 | } |
5 | -switch($modx->getManagerApi()->action) { |
|
5 | +switch ($modx->getManagerApi()->action) { |
|
6 | 6 | case 107: |
7 | - if(!$modx->hasPermission('new_module')) { |
|
7 | + if (!$modx->hasPermission('new_module')) { |
|
8 | 8 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
9 | 9 | } |
10 | 10 | break; |
11 | 11 | case 108: |
12 | - if(!$modx->hasPermission('edit_module')) { |
|
12 | + if (!$modx->hasPermission('edit_module')) { |
|
13 | 13 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
14 | 14 | } |
15 | 15 | break; |
16 | 16 | default: |
17 | 17 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
18 | 18 | } |
19 | -$id = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0; |
|
19 | +$id = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0; |
|
20 | 20 | // Get table names (alphabetical) |
21 | 21 | $tbl_membergroup_names = $modx->getDatabase()->getFullTableName('membergroup_names'); |
22 | 22 | $tbl_site_content = $modx->getDatabase()->getFullTableName('site_content'); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | |
33 | 33 | // check to see the module editor isn't locked |
34 | -if($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
34 | +if ($lockedEl = $modx->elementIsLocked(6, $id)) { |
|
35 | 35 | $modx->webAlertAndQuit(sprintf($_lang['lock_msg'], $lockedEl['username'], $_lang['module'])); |
36 | 36 | } |
37 | 37 | // end check for lock |
@@ -39,29 +39,29 @@ discard block |
||
39 | 39 | // Lock snippet for other users to edit |
40 | 40 | $modx->lockElement(6, $id); |
41 | 41 | |
42 | -if(isset($_GET['id'])) { |
|
42 | +if (isset($_GET['id'])) { |
|
43 | 43 | $rs = $modx->getDatabase()->select('*', $tbl_site_modules, "id='{$id}'"); |
44 | 44 | $content = $modx->getDatabase()->getRow($rs); |
45 | - if(!$content) { |
|
45 | + if (!$content) { |
|
46 | 46 | $modx->webAlertAndQuit("Module not found for id '{$id}'."); |
47 | 47 | } |
48 | 48 | $content['properties'] = str_replace("&", "&", $content['properties']); |
49 | 49 | $_SESSION['itemname'] = $content['name']; |
50 | - if($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
50 | + if ($content['locked'] == 1 && $_SESSION['mgrRole'] != 1) { |
|
51 | 51 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
52 | 52 | } |
53 | 53 | } else { |
54 | 54 | $_SESSION['itemname'] = $_lang["new_module"]; |
55 | 55 | $content['wrap'] = '1'; |
56 | 56 | } |
57 | -if($modx->getManagerApi()->hasFormValues()) { |
|
57 | +if ($modx->getManagerApi()->hasFormValues()) { |
|
58 | 58 | $modx->getManagerApi()->loadFormValues(); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Add lock-element JS-Script |
62 | 62 | $lockElementId = $id; |
63 | 63 | $lockElementType = 6; |
64 | -require_once(MODX_MANAGER_PATH . 'includes/active_user_locks.inc.php'); |
|
64 | +require_once(MODX_MANAGER_PATH.'includes/active_user_locks.inc.php'); |
|
65 | 65 | ?> |
66 | 66 | <script type="text/javascript"> |
67 | 67 | function loadDependencies() { |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | function BrowseServer() { |
409 | 409 | var w = screen.width * 0.7; |
410 | 410 | var h = screen.height * 0.7; |
411 | - OpenServerBrowser("<?= MODX_MANAGER_URL;?>media/browser/<?= $which_browser;?>/browser.php?Type=images", w, h); |
|
411 | + OpenServerBrowser("<?= MODX_MANAGER_URL; ?>media/browser/<?= $which_browser; ?>/browser.php?Type=images", w, h); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | function SetUrl(url, width, height, alt) { |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <?php |
429 | 429 | // invoke OnModFormPrerender event |
430 | 430 | $evtOut = $modx->invokeEvent('OnModFormPrerender', array('id' => $id)); |
431 | - if(is_array($evtOut)) { |
|
431 | + if (is_array($evtOut)) { |
|
432 | 432 | echo implode('', $evtOut); |
433 | 433 | } |
434 | 434 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | <input type="hidden" name="mode" value="<?= $modx->getManagerApi()->action ?>"> |
443 | 443 | |
444 | 444 | <h1> |
445 | - <i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'] . '<small>(' . $content['id'] . ')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i> |
|
445 | + <i class="<?= ($content['icon'] != '' ? $content['icon'] : $_style['icons_module']) ?>"></i><?= ($content['name'] ? $content['name'].'<small>('.$content['id'].')</small>' : $_lang['new_module']) ?><i class="fa fa-question-circle help"></i> |
|
446 | 446 | </h1> |
447 | 447 | |
448 | 448 | <?= ManagerTheme::getStyle('actionbuttons.dynamic.element') ?> |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | <div class="col-md-9 col-lg-10"> |
468 | 468 | <div class="form-control-name clearfix"> |
469 | 469 | <input name="name" type="text" maxlength="100" value="<?= $modx->getPhpCompat()->htmlspecialchars($content['name']) ?>" class="form-control form-control-lg" onchange="documentDirty=true;" /> |
470 | - <?php if($modx->hasPermission('save_role')): ?> |
|
471 | - <label class="custom-control" title="<?= $_lang['lock_module'] . "\n" . $_lang['lock_module_msg'] ?>" tooltip> |
|
470 | + <?php if ($modx->hasPermission('save_role')): ?> |
|
471 | + <label class="custom-control" title="<?= $_lang['lock_module']."\n".$_lang['lock_module_msg'] ?>" tooltip> |
|
472 | 472 | <input name="locked" type="checkbox"<?= ($content['locked'] == 1 ? ' checked="checked"' : '') ?> /> |
473 | 473 | <i class="fa fa-lock"></i> |
474 | 474 | </label> |
@@ -490,9 +490,9 @@ discard block |
||
490 | 490 | <select name="categoryid" class="form-control" onchange="documentDirty=true;"> |
491 | 491 | <option> </option> |
492 | 492 | <?php |
493 | - include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php'); |
|
494 | - foreach(getCategories() as $n => $v) { |
|
495 | - echo "\t\t\t" . '<option value="' . $v['id'] . '"' . ($content['category'] == $v['id'] ? ' selected="selected"' : '') . '>' . $modx->getPhpCompat()->htmlspecialchars($v['category']) . "</option>\n"; |
|
493 | + include_once(MODX_MANAGER_PATH.'includes/categories.inc.php'); |
|
494 | + foreach (getCategories() as $n => $v) { |
|
495 | + echo "\t\t\t".'<option value="'.$v['id'].'"'.($content['category'] == $v['id'] ? ' selected="selected"' : '').'>'.$modx->getPhpCompat()->htmlspecialchars($v['category'])."</option>\n"; |
|
496 | 496 | } |
497 | 497 | ?> |
498 | 498 | </select> |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | <div class="form-group"> |
525 | 525 | <div class="form-row"> |
526 | 526 | <label for="disabled"><input name="disabled" id="disabled" type="checkbox" value="on"<?= ($content['disabled'] == 1 ? ' checked="checked"' : '') ?> /> |
527 | - <?= ($content['disabled'] == 1 ? '<span class="text-danger">' . $_lang['module_disabled'] . '</span>' : $_lang['module_disabled']) ?></label> |
|
527 | + <?= ($content['disabled'] == 1 ? '<span class="text-danger">'.$_lang['module_disabled'].'</span>' : $_lang['module_disabled']) ?></label> |
|
528 | 528 | </div> |
529 | 529 | <div class="form-row"> |
530 | 530 | <label for="parse_docblock"> |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | </div> |
590 | 590 | <!-- HTML text editor end --> |
591 | 591 | </div> |
592 | - <?php if($modx->getManagerApi()->action == '108'): ?> |
|
592 | + <?php if ($modx->getManagerApi()->action == '108'): ?> |
|
593 | 593 | <!-- Dependencies --> |
594 | 594 | <div class="tab-page" id="tabDepend"> |
595 | 595 | <h2 class="tab"><?= $_lang['settings_dependencies'] ?></h2> |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | $grd->columnHeaderClass = 'gridHeader'; |
624 | 624 | $grd->itemClass = 'gridItem'; |
625 | 625 | $grd->altItemClass = 'gridAltItem'; |
626 | - $grd->columns = $_lang['element_name'] . " ," . $_lang['type']; |
|
626 | + $grd->columns = $_lang['element_name']." ,".$_lang['type']; |
|
627 | 627 | $grd->fields = "name,type"; |
628 | 628 | echo $grd->render(); |
629 | 629 | ?> |
@@ -636,13 +636,13 @@ discard block |
||
636 | 636 | <h2 class="tab"><?= $_lang['access_permissions'] ?></h2> |
637 | 637 | <script type="text/javascript">tp.addTabPage(document.getElementById("tabPermissions"));</script> |
638 | 638 | <div class="container container-body"> |
639 | - <?php if($modx->getConfig('use_udperms')) : ?> |
|
639 | + <?php if ($modx->getConfig('use_udperms')) : ?> |
|
640 | 640 | <?php |
641 | 641 | // fetch user access permissions for the module |
642 | 642 | $rs = $modx->getDatabase()->select('usergroup', $tbl_site_module_access, "module='{$id}'"); |
643 | 643 | $groupsarray = $modx->getDatabase()->getColumn('usergroup', $rs); |
644 | 644 | |
645 | - if($modx->hasPermission('access_permissions')) { |
|
645 | + if ($modx->hasPermission('access_permissions')) { |
|
646 | 646 | ?> |
647 | 647 | <!-- User Group Access Permissions --> |
648 | 648 | <script type="text/javascript"> |
@@ -670,22 +670,22 @@ discard block |
||
670 | 670 | } |
671 | 671 | $chk = ''; |
672 | 672 | $rs = $modx->getDatabase()->select('name, id', $tbl_membergroup_names, '', 'name'); |
673 | - while($row = $modx->getDatabase()->getRow($rs)) { |
|
673 | + while ($row = $modx->getDatabase()->getRow($rs)) { |
|
674 | 674 | $groupsarray = is_numeric($id) && $id > 0 ? $groupsarray : array(); |
675 | 675 | $checked = in_array($row['id'], $groupsarray); |
676 | - if($modx->hasPermission('access_permissions')) { |
|
677 | - if($checked) { |
|
676 | + if ($modx->hasPermission('access_permissions')) { |
|
677 | + if ($checked) { |
|
678 | 678 | $notPublic = true; |
679 | 679 | } |
680 | - $chks .= '<label><input type="checkbox" name="usrgroups[]" value="' . $row['id'] . '"' . ($checked ? ' checked="checked"' : '') . ' onclick="makePublic(false)" /> ' . $row['name'] . "</label><br />\n"; |
|
680 | + $chks .= '<label><input type="checkbox" name="usrgroups[]" value="'.$row['id'].'"'.($checked ? ' checked="checked"' : '').' onclick="makePublic(false)" /> '.$row['name']."</label><br />\n"; |
|
681 | 681 | } else { |
682 | - if($checked) { |
|
683 | - $chks = '<input type="hidden" name="usrgroups[]" value="' . $row['id'] . '" />' . "\n" . $chks; |
|
682 | + if ($checked) { |
|
683 | + $chks = '<input type="hidden" name="usrgroups[]" value="'.$row['id'].'" />'."\n".$chks; |
|
684 | 684 | } |
685 | 685 | } |
686 | 686 | } |
687 | - if($modx->hasPermission('access_permissions')) { |
|
688 | - $chks = '<label><input type="checkbox" name="chkallgroups"' . (!$notPublic ? ' checked="checked"' : '') . ' onclick="makePublic(true)" /><span class="warning"> ' . $_lang['all_usr_groups'] . '</span></label><br />' . "\n" . $chks; |
|
687 | + if ($modx->hasPermission('access_permissions')) { |
|
688 | + $chks = '<label><input type="checkbox" name="chkallgroups"'.(!$notPublic ? ' checked="checked"' : '').' onclick="makePublic(true)" /><span class="warning"> '.$_lang['all_usr_groups'].'</span></label><br />'."\n".$chks; |
|
689 | 689 | } |
690 | 690 | echo $chks; |
691 | 691 | ?> |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | <?php |
707 | 707 | // invoke OnModFormRender event |
708 | 708 | $evtOut = $modx->invokeEvent('OnModFormRender', array('id' => $id)); |
709 | - if(is_array($evtOut)) { |
|
709 | + if (is_array($evtOut)) { |
|
710 | 710 | echo implode('', $evtOut); |
711 | 711 | } |
712 | 712 | ?> |
@@ -118,18 +118,18 @@ |
||
118 | 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
119 | 119 | $articul_result = $modx->getDatabase()->query($articul_query); |
120 | 120 | $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
121 | - if(count($articul_id_array)>0){ |
|
121 | + if(count($articul_id_array)>0) { |
|
122 | 122 | $articul_id = ''; |
123 | 123 | $i = 1; |
124 | 124 | foreach( $articul_id_array as $articul ) { |
125 | 125 | $articul_id.=$articul['contentid']; |
126 | - if($i !== count($articul_id_array)){ |
|
126 | + if($i !== count($articul_id_array)) { |
|
127 | 127 | $articul_id.=','; |
128 | 128 | } |
129 | 129 | $i++; |
130 | 130 | } |
131 | 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $articul_id_query = ''; |
134 | 134 | } |
135 | 135 | /*end search by TV*/ |
@@ -113,31 +113,31 @@ |
||
113 | 113 | // Handle Input "Search in main fields" |
114 | 114 | if ($searchfields != '') { |
115 | 115 | |
116 | - /*start search by TV. Added Rising13*/ |
|
117 | - $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | - $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | - $articul_result = $modx->getDatabase()->query($articul_query); |
|
120 | - $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
|
121 | - if(count($articul_id_array)>0){ |
|
122 | - $articul_id = ''; |
|
123 | - $i = 1; |
|
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
128 | - } |
|
129 | - $i++; |
|
130 | - } |
|
131 | - $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | - }else{ |
|
133 | - $articul_id_query = ''; |
|
134 | - } |
|
135 | - /*end search by TV*/ |
|
116 | + /*start search by TV. Added Rising13*/ |
|
117 | + $tbl_site_tmplvar_contentvalues = $modx->getDatabase()->getFullTableName('site_tmplvar_contentvalues'); |
|
118 | + $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
|
119 | + $articul_result = $modx->getDatabase()->query($articul_query); |
|
120 | + $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
|
121 | + if(count($articul_id_array)>0){ |
|
122 | + $articul_id = ''; |
|
123 | + $i = 1; |
|
124 | + foreach( $articul_id_array as $articul ) { |
|
125 | + $articul_id.=$articul['contentid']; |
|
126 | + if($i !== count($articul_id_array)){ |
|
127 | + $articul_id.=','; |
|
128 | + } |
|
129 | + $i++; |
|
130 | + } |
|
131 | + $articul_id_query = " OR sc.id IN ({$articul_id})"; |
|
132 | + }else{ |
|
133 | + $articul_id_query = ''; |
|
134 | + } |
|
135 | + /*end search by TV*/ |
|
136 | 136 | |
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query;//search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if( ! defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
2 | +if (!defined('IN_MANAGER_MODE') || IN_MANAGER_MODE !== true) { |
|
3 | 3 | exit(); |
4 | 4 | } |
5 | 5 | unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | <div class="col-md-9 col-lg-10"> |
41 | 41 | <?php |
42 | 42 | $rs = $modx->getDatabase()->select('*', $modx->getDatabase()->getFullTableName('site_templates')); |
43 | - $option[] = '<option value="">' . $_lang['none'] . '</option>'; |
|
44 | - $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int)$_REQUEST['templateid'] : ''; |
|
43 | + $option[] = '<option value="">'.$_lang['none'].'</option>'; |
|
44 | + $templateid = (isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '') ? (int) $_REQUEST['templateid'] : ''; |
|
45 | 45 | $selected = $templateid === 0 ? ' selected="selected"' : ''; |
46 | - $option[] = '<option value="0"' . $selected . '>(blank)</option>'; |
|
46 | + $option[] = '<option value="0"'.$selected.'>(blank)</option>'; |
|
47 | 47 | while ($row = $modx->getDatabase()->getRow($rs)) { |
48 | 48 | $templatename = htmlspecialchars($row['templatename'], ENT_QUOTES, $modx->config['modx_charset']); |
49 | 49 | $selected = $row['id'] == $templateid ? ' selected="selected"' : ''; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | <div class="row form-row"> |
59 | 59 | <div class="col-md-3 col-lg-2">URL</div> |
60 | 60 | <div class="col-md-9 col-lg-10"> |
61 | - <input name="url" type="text" value="<?= entities(get_by_key($_REQUEST,'url', '', 'is_scalar'), $modx->getConfig('modx_charset')) ?>" /> |
|
61 | + <input name="url" type="text" value="<?= entities(get_by_key($_REQUEST, 'url', '', 'is_scalar'), $modx->getConfig('modx_charset')) ?>" /> |
|
62 | 62 | <small class="form-text"><?= $_lang['search_criteria_url_msg'] ?></small> |
63 | 63 | </div> |
64 | 64 | </div> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $searchfields = htmlentities(trim($_POST['searchfields']), ENT_QUOTES, ManagerTheme::getCharset()); |
87 | 87 | $searchlongtitle = $modx->getDatabase()->escape(trim($_REQUEST['searchfields'])); |
88 | 88 | $search_alias = $modx->getDatabase()->escape(trim($_REQUEST['searchfields'])); |
89 | - $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int)$_REQUEST['templateid'] : ''; |
|
89 | + $templateid = isset($_REQUEST['templateid']) && $_REQUEST['templateid'] !== '' ? (int) $_REQUEST['templateid'] : ''; |
|
90 | 90 | $searchcontent = $modx->getDatabase()->escape($_REQUEST['content']); |
91 | 91 | |
92 | 92 | $fields = 'DISTINCT sc.id, contenttype, pagetitle, longtitle, description, introtext, menutitle, deleted, published, isfolder, type'; |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | $friendly_url_suffix = $modx->config['friendly_url_suffix']; |
101 | 101 | $base_url = MODX_BASE_URL; |
102 | 102 | $site_url = MODX_SITE_URL; |
103 | - $url = preg_replace('@' . $friendly_url_suffix . '$@', '', $url); |
|
103 | + $url = preg_replace('@'.$friendly_url_suffix.'$@', '', $url); |
|
104 | 104 | if ($url[0] === '/') { |
105 | - $url = preg_replace('@^' . $base_url . '@', '', $url); |
|
105 | + $url = preg_replace('@^'.$base_url.'@', '', $url); |
|
106 | 106 | } |
107 | 107 | if (substr($url, 0, 4) === 'http') { |
108 | - $url = preg_replace('@^' . $site_url . '@', '', $url); |
|
108 | + $url = preg_replace('@^'.$site_url.'@', '', $url); |
|
109 | 109 | } |
110 | 110 | $idFromAlias = $modx->getIdFromAlias($url); |
111 | 111 | } |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | $articul_query = "SELECT `contentid` FROM {$tbl_site_tmplvar_contentvalues} WHERE `value` LIKE '%{$searchfields}%'"; |
119 | 119 | $articul_result = $modx->getDatabase()->query($articul_query); |
120 | 120 | $articul_id_array = $modx->getDatabase()->makeArray($articul_result); |
121 | - if(count($articul_id_array)>0){ |
|
121 | + if (count($articul_id_array) > 0) { |
|
122 | 122 | $articul_id = ''; |
123 | 123 | $i = 1; |
124 | - foreach( $articul_id_array as $articul ) { |
|
125 | - $articul_id.=$articul['contentid']; |
|
126 | - if($i !== count($articul_id_array)){ |
|
127 | - $articul_id.=','; |
|
124 | + foreach ($articul_id_array as $articul) { |
|
125 | + $articul_id .= $articul['contentid']; |
|
126 | + if ($i !== count($articul_id_array)) { |
|
127 | + $articul_id .= ','; |
|
128 | 128 | } |
129 | 129 | $i++; |
130 | 130 | } |
131 | 131 | $articul_id_query = " OR sc.id IN ({$articul_id})"; |
132 | - }else{ |
|
132 | + } else { |
|
133 | 133 | $articul_id_query = ''; |
134 | 134 | } |
135 | 135 | /*end search by TV*/ |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (ctype_digit($searchfields)) { |
138 | 138 | $sqladd .= "sc.id='{$searchfields}'"; |
139 | 139 | if (strlen($searchfields) > 3) { |
140 | - $sqladd .= $articul_id_query;//search by TV |
|
140 | + $sqladd .= $articul_id_query; //search by TV |
|
141 | 141 | $sqladd .= " OR sc.pagetitle LIKE '%{$searchfields}%'"; |
142 | 142 | } |
143 | 143 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $sqladd .= " OR sc.introtext LIKE '%{$searchlongtitle}%'"; |
158 | 158 | $sqladd .= " OR sc.menutitle LIKE '%{$searchlongtitle}%'"; |
159 | 159 | $sqladd .= " OR sc.alias LIKE '%{$search_alias}%'"; |
160 | - $sqladd .= $articul_id_query;//search by TV |
|
160 | + $sqladd .= $articul_id_query; //search by TV |
|
161 | 161 | $sqladd .= ")"; |
162 | 162 | } |
163 | 163 | } elseif ($idFromAlias) { |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : ''; |
182 | 182 | $mgrRole = (isset ($_SESSION['mgrRole']) && $_SESSION['mgrRole'] == 1) ? 1 : 0; |
183 | 183 | $docgrp_cond = $docgrp ? " OR dg.document_group IN ({$docgrp})" : ''; |
184 | - $fields .= ', MAX(IF(1=' . $mgrRole . ' OR sc.privatemgr=0' . $docgrp_cond . ',1,0)) AS hasAccess'; |
|
185 | - $sqladd = '(' . $sqladd . ") AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
184 | + $fields .= ', MAX(IF(1='.$mgrRole.' OR sc.privatemgr=0'.$docgrp_cond.',1,0)) AS hasAccess'; |
|
185 | + $sqladd = '('.$sqladd.") AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))"); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | if ($sqladd) { |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $where = $sqladd; |
193 | 193 | |
194 | 194 | if ($where) { |
195 | - $rs = $modx->getDatabase()->select($fields, $tbl_site_content . ' AS sc LEFT JOIN ' . $tbldg . ' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
195 | + $rs = $modx->getDatabase()->select($fields, $tbl_site_content.' AS sc LEFT JOIN '.$tbldg.' AS dg ON dg.document=sc.id', $where, 'sc.id'); |
|
196 | 196 | $limit = $modx->getDatabase()->getRecordCount($rs); |
197 | 197 | } else { |
198 | 198 | $limit = 0; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | if ($limit < 1) { |
212 | 212 | echo $_lang['search_empty']; |
213 | 213 | } else { |
214 | - printf('<p>' . $_lang['search_results_returned_msg'] . '</p>', $limit); |
|
214 | + printf('<p>'.$_lang['search_results_returned_msg'].'</p>', $limit); |
|
215 | 215 | ?> |
216 | 216 | <script type="text/javascript" src="media/script/tablesort.js"></script> |
217 | 217 | <table class="grid sortabletable sortable-onload-2 rowstyle-even" id="table-1"> |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | if (function_exists('mb_strlen') && function_exists('mb_substr')) { |
272 | 272 | ?> |
273 | 273 | <td<?= $tdClass ?>> |
274 | - <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], ManagerTheme::getCharset()) > 70 ? mb_substr($row['pagetitle'], 0, 70, ManagerTheme::getCharset()) . "..." : $row['pagetitle'] ?></a> |
|
274 | + <a href="index.php?a=27&id=<?= $row['id'] ?>"><?= mb_strlen($row['pagetitle'], ManagerTheme::getCharset()) > 70 ? mb_substr($row['pagetitle'], 0, 70, ManagerTheme::getCharset())."..." : $row['pagetitle'] ?></a> |
|
275 | 275 | </td> |
276 | - <td<?= $tdClass ?>><?= mb_strlen($row['description'], ManagerTheme::getCharset()) > 70 ? mb_substr($row['description'], 0, 70, ManagerTheme::getCharset()) . "..." : $row['description'] ?></td> |
|
276 | + <td<?= $tdClass ?>><?= mb_strlen($row['description'], ManagerTheme::getCharset()) > 70 ? mb_substr($row['description'], 0, 70, ManagerTheme::getCharset())."..." : $row['description'] ?></td> |
|
277 | 277 | <?php |
278 | 278 | } else { |
279 | 279 | ?> |
280 | - <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20) . '...' : $row['pagetitle'] ?></td> |
|
281 | - <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35) . '...' : $row['description'] ?></td> |
|
280 | + <td<?= $tdClass ?>><?= strlen($row['pagetitle']) > 20 ? substr($row['pagetitle'], 0, 20).'...' : $row['pagetitle'] ?></td> |
|
281 | + <td<?= $tdClass ?>><?= strlen($row['description']) > 35 ? substr($row['description'], 0, 35).'...' : $row['description'] ?></td> |
|
282 | 282 | <?php |
283 | 283 | } |
284 | 284 | ?> |
@@ -298,11 +298,11 @@ discard block |
||
298 | 298 | if ($modx->hasPermission('new_document') && $modx->hasPermission('edit_document') && $modx->hasPermission('save_document')) { |
299 | 299 | $docscounts = $modx->getDatabase()->getRecordCount($rs); |
300 | 300 | if ($docscounts > 0) { |
301 | - $output .= '<li><b><i class="fa fa-sitemap"></i> ' . $_lang["manage_documents"] . ' (' . $docscounts . ')</b></li>'; |
|
301 | + $output .= '<li><b><i class="fa fa-sitemap"></i> '.$_lang["manage_documents"].' ('.$docscounts.')</b></li>'; |
|
302 | 302 | while ($row = $modx->getDatabase()->getRow($rs)) { |
303 | - $output .= '<li' . addClassForItemList('', !$row['published'], $row['deleted']) . '> |
|
304 | - <a href="index.php?a=27&id=' . $row['id'] . '" id="content_' . $row['id'] . '" target="main">' . |
|
305 | - highlightingCoincidence($row['pagetitle'], $_REQUEST['searchfields']) . ' <small>(' . highlightingCoincidence($row['id'], $_REQUEST['searchfields']) . ')</small>' . '<i class="fa fa-external-link"></i> |
|
303 | + $output .= '<li'.addClassForItemList('', !$row['published'], $row['deleted']).'> |
|
304 | + <a href="index.php?a=27&id=' . $row['id'].'" id="content_'.$row['id'].'" target="main">'. |
|
305 | + highlightingCoincidence($row['pagetitle'], $_REQUEST['searchfields']).' <small>('.highlightingCoincidence($row['id'], $_REQUEST['searchfields']).')</small>'.'<i class="fa fa-external-link"></i> |
|
306 | 306 | </a> |
307 | 307 | </li>'; |
308 | 308 | } |
@@ -311,15 +311,15 @@ discard block |
||
311 | 311 | |
312 | 312 | //templates |
313 | 313 | if ($modx->hasPermission('edit_template')) { |
314 | - $rs = $modx->getDatabase()->select("id,templatename,locked", $modx->getDatabase()->getFullTableName('site_templates'), "`id` like '%" . $searchfields . "%' |
|
315 | - OR `templatename` like '%" . $searchfields . "%' |
|
316 | - OR `description` like '%" . $searchfields . "%' |
|
317 | - OR `content` like '%" . $searchfields . "%'"); |
|
314 | + $rs = $modx->getDatabase()->select("id,templatename,locked", $modx->getDatabase()->getFullTableName('site_templates'), "`id` like '%".$searchfields."%' |
|
315 | + OR `templatename` like '%" . $searchfields."%' |
|
316 | + OR `description` like '%" . $searchfields."%' |
|
317 | + OR `content` like '%" . $searchfields."%'"); |
|
318 | 318 | $templatecounts = $modx->getDatabase()->getRecordCount($rs); |
319 | 319 | if ($templatecounts > 0) { |
320 | - $output .= '<li><b><i class="fa fa-newspaper-o"></i> ' . $_lang["manage_templates"] . ' (' . $templatecounts . ')</b></li>'; |
|
320 | + $output .= '<li><b><i class="fa fa-newspaper-o"></i> '.$_lang["manage_templates"].' ('.$templatecounts.')</b></li>'; |
|
321 | 321 | while ($row = $modx->getDatabase()->getRow($rs)) { |
322 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=16&id=' . $row['id'] . '" id="templates_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
|
322 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=16&id='.$row['id'].'" id="templates_'.$row['id'].'" target="main">'.highlightingCoincidence($row['templatename'], $_REQUEST['searchfields']).'<i class="fa fa-external-link"></i></a></li>'; |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | } |
@@ -329,19 +329,19 @@ discard block |
||
329 | 329 | $rs = $modx->getDatabase()->select( |
330 | 330 | "id,name,locked", |
331 | 331 | $modx->getDatabase()->getFullTableName('site_tmplvars'), |
332 | - "`id` like '%" . $searchfields . "%' |
|
333 | - OR `name` like '%" . $searchfields . "%' |
|
334 | - OR `description` like '%" . $searchfields . "%' |
|
335 | - OR `type` like '%" . $searchfields . "%' |
|
336 | - OR `elements` like '%" . $searchfields . "%' |
|
337 | - OR `display` like '%" . $searchfields . "%' |
|
338 | - OR `display_params` like '%" . $searchfields . "%' |
|
339 | - OR `default_text` like '%" . $searchfields . "%'"); |
|
332 | + "`id` like '%".$searchfields."%' |
|
333 | + OR `name` like '%" . $searchfields."%' |
|
334 | + OR `description` like '%" . $searchfields."%' |
|
335 | + OR `type` like '%" . $searchfields."%' |
|
336 | + OR `elements` like '%" . $searchfields."%' |
|
337 | + OR `display` like '%" . $searchfields."%' |
|
338 | + OR `display_params` like '%" . $searchfields."%' |
|
339 | + OR `default_text` like '%" . $searchfields."%'"); |
|
340 | 340 | $tvscounts = $modx->getDatabase()->getRecordCount($rs); |
341 | 341 | if ($tvscounts > 0) { |
342 | - $output .= '<li><b><i class="fa fa-list-alt"></i> ' . $_lang["settings_templvars"] . ' (' . $tvscounts . ')</b></li>'; |
|
342 | + $output .= '<li><b><i class="fa fa-list-alt"></i> '.$_lang["settings_templvars"].' ('.$tvscounts.')</b></li>'; |
|
343 | 343 | while ($row = $modx->getDatabase()->getRow($rs)) { |
344 | - $output .= '<li' . addClassForItemList($row['locked']) . '><a href="index.php?a=301&id=' . $row['id'] . '" id="tmplvars_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
|
344 | + $output .= '<li'.addClassForItemList($row['locked']).'><a href="index.php?a=301&id='.$row['id'].'" id="tmplvars_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).'<i class="fa fa-external-link"></i></a></li>'; |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | } |
@@ -351,15 +351,15 @@ discard block |
||
351 | 351 | $rs = $modx->getDatabase()->select( |
352 | 352 | "id,name,locked,disabled", |
353 | 353 | $modx->getDatabase()->getFullTableName('site_htmlsnippets'), |
354 | - "`id` like '%" . $searchfields . "%' |
|
355 | - OR `name` like '%" . $searchfields . "%' |
|
356 | - OR `description` like '%" . $searchfields . "%' |
|
357 | - OR `snippet` like '%" . $searchfields . "%'"); |
|
354 | + "`id` like '%".$searchfields."%' |
|
355 | + OR `name` like '%" . $searchfields."%' |
|
356 | + OR `description` like '%" . $searchfields."%' |
|
357 | + OR `snippet` like '%" . $searchfields."%'"); |
|
358 | 358 | $chunkscounts = $modx->getDatabase()->getRecordCount($rs); |
359 | 359 | if ($chunkscounts > 0) { |
360 | - $output .= '<li><b><i class="fa fa-th-large"></i> ' . $_lang["manage_htmlsnippets"] . ' (' . $chunkscounts . ')</b></li>'; |
|
360 | + $output .= '<li><b><i class="fa fa-th-large"></i> '.$_lang["manage_htmlsnippets"].' ('.$chunkscounts.')</b></li>'; |
|
361 | 361 | while ($row = $modx->getDatabase()->getRow($rs)) { |
362 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=78&id=' . $row['id'] . '" id="htmlsnippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
|
362 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=78&id='.$row['id'].'" id="htmlsnippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).'<i class="fa fa-external-link"></i></a></li>'; |
|
363 | 363 | } |
364 | 364 | } |
365 | 365 | } |
@@ -369,17 +369,17 @@ discard block |
||
369 | 369 | $rs = $modx->getDatabase()->select( |
370 | 370 | "id,name,locked,disabled", |
371 | 371 | $modx->getDatabase()->getFullTableName('site_snippets'), |
372 | - "`id` like '%" . $searchfields . "%' |
|
373 | - OR `name` like '%" . $searchfields . "%' |
|
374 | - OR `description` like '%" . $searchfields . "%' |
|
375 | - OR `snippet` like '%" . $searchfields . "%' |
|
376 | - OR `properties` like '%" . $searchfields . "%' |
|
377 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
372 | + "`id` like '%".$searchfields."%' |
|
373 | + OR `name` like '%" . $searchfields."%' |
|
374 | + OR `description` like '%" . $searchfields."%' |
|
375 | + OR `snippet` like '%" . $searchfields."%' |
|
376 | + OR `properties` like '%" . $searchfields."%' |
|
377 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
378 | 378 | $snippetscounts = $modx->getDatabase()->getRecordCount($rs); |
379 | 379 | if ($snippetscounts > 0) { |
380 | - $output .= '<li><b><i class="fa fa-code"></i> ' . $_lang["manage_snippets"] . ' (' . $snippetscounts . ')</b></li>'; |
|
380 | + $output .= '<li><b><i class="fa fa-code"></i> '.$_lang["manage_snippets"].' ('.$snippetscounts.')</b></li>'; |
|
381 | 381 | while ($row = $modx->getDatabase()->getRow($rs)) { |
382 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=22&id=' . $row['id'] . '" id="snippets_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
|
382 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=22&id='.$row['id'].'" id="snippets_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).'<i class="fa fa-external-link"></i></a></li>'; |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | } |
@@ -389,17 +389,17 @@ discard block |
||
389 | 389 | $rs = $modx->getDatabase()->select( |
390 | 390 | "id,name,locked,disabled", |
391 | 391 | $modx->getDatabase()->getFullTableName('site_plugins'), |
392 | - "`id` like '%" . $searchfields . "%' |
|
393 | - OR `name` like '%" . $searchfields . "%' |
|
394 | - OR `description` like '%" . $searchfields . "%' |
|
395 | - OR `plugincode` like '%" . $searchfields . "%' |
|
396 | - OR `properties` like '%" . $searchfields . "%' |
|
397 | - OR `moduleguid` like '%" . $searchfields . "%'"); |
|
392 | + "`id` like '%".$searchfields."%' |
|
393 | + OR `name` like '%" . $searchfields."%' |
|
394 | + OR `description` like '%" . $searchfields."%' |
|
395 | + OR `plugincode` like '%" . $searchfields."%' |
|
396 | + OR `properties` like '%" . $searchfields."%' |
|
397 | + OR `moduleguid` like '%" . $searchfields."%'"); |
|
398 | 398 | $pluginscounts = $modx->getDatabase()->getRecordCount($rs); |
399 | 399 | if ($pluginscounts > 0) { |
400 | - $output .= '<li><b><i class="fa fa-plug"></i> ' . $_lang["manage_plugins"] . ' (' . $pluginscounts . ')</b></li>'; |
|
400 | + $output .= '<li><b><i class="fa fa-plug"></i> '.$_lang["manage_plugins"].' ('.$pluginscounts.')</b></li>'; |
|
401 | 401 | while ($row = $modx->getDatabase()->getRow($rs)) { |
402 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=102&id=' . $row['id'] . '" id="plugins_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
|
402 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=102&id='.$row['id'].'" id="plugins_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).'<i class="fa fa-external-link"></i></a></li>'; |
|
403 | 403 | } |
404 | 404 | } |
405 | 405 | } |
@@ -409,23 +409,23 @@ discard block |
||
409 | 409 | $rs = $modx->getDatabase()->select( |
410 | 410 | "id,name,locked,disabled", |
411 | 411 | $modx->getDatabase()->getFullTableName('site_modules'), |
412 | - "`id` like '%" . $searchfields . "%' |
|
413 | - OR `name` like '%" . $searchfields . "%' |
|
414 | - OR `description` like '%" . $searchfields . "%' |
|
415 | - OR `modulecode` like '%" . $searchfields . "%' |
|
416 | - OR `properties` like '%" . $searchfields . "%' |
|
417 | - OR `guid` like '%" . $searchfields . "%' |
|
418 | - OR `resourcefile` like '%" . $searchfields . "%'"); |
|
412 | + "`id` like '%".$searchfields."%' |
|
413 | + OR `name` like '%" . $searchfields."%' |
|
414 | + OR `description` like '%" . $searchfields."%' |
|
415 | + OR `modulecode` like '%" . $searchfields."%' |
|
416 | + OR `properties` like '%" . $searchfields."%' |
|
417 | + OR `guid` like '%" . $searchfields."%' |
|
418 | + OR `resourcefile` like '%" . $searchfields."%'"); |
|
419 | 419 | $modulescounts = $modx->getDatabase()->getRecordCount($rs); |
420 | 420 | if ($modulescounts > 0) { |
421 | - $output .= '<li><b><i class="fa fa-cogs"></i> ' . $_lang["modules"] . ' (' . $modulescounts . ')</b></li>'; |
|
421 | + $output .= '<li><b><i class="fa fa-cogs"></i> '.$_lang["modules"].' ('.$modulescounts.')</b></li>'; |
|
422 | 422 | while ($row = $modx->getDatabase()->getRow($rs)) { |
423 | - $output .= '<li' . addClassForItemList($row['locked'], $row['disabled']) . '><a href="index.php?a=108&id=' . $row['id'] . '" id="modules_' . $row['id'] . '" target="main">' . highlightingCoincidence($row['name'], $_REQUEST['searchfields']) . '<i class="fa fa-external-link"></i></a></li>'; |
|
423 | + $output .= '<li'.addClassForItemList($row['locked'], $row['disabled']).'><a href="index.php?a=108&id='.$row['id'].'" id="modules_'.$row['id'].'" target="main">'.highlightingCoincidence($row['name'], $_REQUEST['searchfields']).'<i class="fa fa-external-link"></i></a></li>'; |
|
424 | 424 | } |
425 | 425 | } |
426 | 426 | } |
427 | 427 | |
428 | - echo $output ? '<div class="ajaxSearchResults"><ul>' . $output . '</ul></div>' : '1'; |
|
428 | + echo $output ? '<div class="ajaxSearchResults"><ul>'.$output.'</ul></div>' : '1'; |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | ?> |