@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_module')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('save_password')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -8,11 +10,11 @@ discard block |
||
8 | 10 | $pass1 = $_POST['pass1']; |
9 | 11 | $pass2 = $_POST['pass2']; |
10 | 12 | |
11 | -if($pass1!=$pass2){ |
|
13 | +if($pass1!=$pass2) { |
|
12 | 14 | $modx->webAlertAndQuit("Passwords don't match!"); |
13 | 15 | } |
14 | 16 | |
15 | -if(strlen($pass1)<6){ |
|
17 | +if(strlen($pass1)<6) { |
|
16 | 18 | $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters."); |
17 | 19 | } |
18 | 20 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('access_permissions')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -117,7 +119,7 @@ discard block |
||
117 | 119 | } |
118 | 120 | |
119 | 121 | // secure manager documents - flag as private |
120 | -if($updategroupaccess==true){ |
|
122 | +if($updategroupaccess==true) { |
|
121 | 123 | include MODX_MANAGER_PATH."includes/secure_mgr_documents.inc.php"; |
122 | 124 | secureMgrDocument(); |
123 | 125 |
@@ -335,7 +335,8 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | // in case any plugins include a quoted_printable function |
338 | -function save_user_quoted_printable($string) { |
|
338 | +function save_user_quoted_printable($string) |
|
339 | +{ |
|
339 | 340 | $crlf = "\n"; |
340 | 341 | $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf; |
341 | 342 | $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e'; |
@@ -347,7 +348,8 @@ discard block |
||
347 | 348 | } |
348 | 349 | |
349 | 350 | // Send an email to the user |
350 | -function sendMailMessage($email, $uid, $pwd, $ufn) { |
|
351 | +function sendMailMessage($email, $uid, $pwd, $ufn) |
|
352 | +{ |
|
351 | 353 | global $modx, $_lang, $websignupemail_message; |
352 | 354 | global $emailsubject, $emailsender; |
353 | 355 | global $site_name, $site_url; |
@@ -375,7 +377,8 @@ discard block |
||
375 | 377 | } |
376 | 378 | |
377 | 379 | // Save User Settings |
378 | -function saveUserSettings($id) { |
|
380 | +function saveUserSettings($id) |
|
381 | +{ |
|
379 | 382 | global $modx; |
380 | 383 | $tbl_web_user_settings = $modx->getFullTableName('web_user_settings'); |
381 | 384 | |
@@ -404,7 +407,8 @@ discard block |
||
404 | 407 | } |
405 | 408 | |
406 | 409 | // Web alert - sends an alert to web browser |
407 | -function webAlertAndQuit($msg) { |
|
410 | +function webAlertAndQuit($msg) |
|
411 | +{ |
|
408 | 412 | global $id, $modx; |
409 | 413 | $mode = $_POST['mode']; |
410 | 414 | $modx->manager->saveFormValues($mode); |
@@ -412,7 +416,8 @@ discard block |
||
412 | 416 | } |
413 | 417 | |
414 | 418 | // Generate password |
415 | -function generate_password($length = 10) { |
|
419 | +function generate_password($length = 10) |
|
420 | +{ |
|
416 | 421 | $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789"; |
417 | 422 | $ps_len = strlen($allowable_characters); |
418 | 423 | mt_srand((double) microtime() * 1000000); |
@@ -423,7 +428,8 @@ discard block |
||
423 | 428 | return $pass; |
424 | 429 | } |
425 | 430 | |
426 | -function sanitize($str = '', $safecount = 0) { |
|
431 | +function sanitize($str = '', $safecount = 0) |
|
432 | +{ |
|
427 | 433 | global $modx; |
428 | 434 | $safecount++; |
429 | 435 | if(1000 < $safecount) { |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('edit_template')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -12,8 +14,11 @@ discard block |
||
12 | 14 | // count duplicates |
13 | 15 | $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "id='{$id}'")); |
14 | 16 | $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_tmplvars'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'")); |
15 | -if($count>=1) $count = ' '.($count+1); |
|
16 | -else $count = ''; |
|
17 | +if($count>=1) { |
|
18 | + $count = ' '.($count+1); |
|
19 | +} else { |
|
20 | + $count = ''; |
|
21 | +} |
|
17 | 22 | |
18 | 23 | // duplicate TV |
19 | 24 | $newid = $modx->db->insert( |
@@ -1,5 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('delete_eventlog')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('export_static')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -10,16 +12,20 @@ discard block |
||
10 | 12 | $modx->loadExtension('EXPORT_SITE'); |
11 | 13 | |
12 | 14 | |
13 | -if(is_dir(MODX_BASE_PATH . 'temp')) $export_dir = MODX_BASE_PATH . 'temp/export'; |
|
14 | -elseif(is_dir(MODX_BASE_PATH . 'assets')) $export_dir = MODX_BASE_PATH . 'assets/export'; |
|
15 | +if(is_dir(MODX_BASE_PATH . 'temp')) { |
|
16 | + $export_dir = MODX_BASE_PATH . 'temp/export'; |
|
17 | +} elseif(is_dir(MODX_BASE_PATH . 'assets')) { |
|
18 | + $export_dir = MODX_BASE_PATH . 'assets/export'; |
|
19 | +} |
|
15 | 20 | $modx->export->targetDir = $export_dir; |
16 | 21 | |
17 | -if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) |
|
22 | +if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path']))) { |
|
18 | 23 | return $_lang['export_site.static.php6']; |
19 | -elseif($modx->config['rb_base_dir'] === $export_dir . '/') |
|
24 | +} elseif($modx->config['rb_base_dir'] === $export_dir . '/') { |
|
20 | 25 | return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']); |
21 | -elseif(!is_writable($export_dir)) |
|
26 | +} elseif(!is_writable($export_dir)) { |
|
22 | 27 | return $_lang['export_site_target_unwritable']; |
28 | +} |
|
23 | 29 | |
24 | 30 | $modx->export->generate_mode = $_POST['generate_mode']; |
25 | 31 |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -if(IN_MANAGER_MODE!="true") die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly."); |
|
2 | +if(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."); |
|
4 | +} |
|
3 | 5 | if(!$modx->hasPermission('messages')) { |
4 | 6 | $modx->webAlertAndQuit($_lang["error_no_privileges"]); |
5 | 7 | } |
@@ -8,9 +10,13 @@ discard block |
||
8 | 10 | $userid = $_REQUEST['user']; |
9 | 11 | $groupid = $_REQUEST['group']; |
10 | 12 | $subject = $modx->db->escape($_REQUEST['messagesubject']); |
11 | -if($subject=="") $subject="(no subject)"; |
|
13 | +if($subject=="") { |
|
14 | + $subject="(no subject)"; |
|
15 | +} |
|
12 | 16 | $message = $modx->db->escape($_REQUEST['messagebody']); |
13 | -if($message=="") $message="(no message)"; |
|
17 | +if($message=="") { |
|
18 | + $message="(no message)"; |
|
19 | +} |
|
14 | 20 | $postdate = time(); |
15 | 21 | |
16 | 22 | if($sendto=='u') { |
@@ -292,7 +292,8 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | // show javascript alert |
295 | -function jsAlert($msg) { |
|
295 | +function jsAlert($msg) |
|
296 | +{ |
|
296 | 297 | global $modx; |
297 | 298 | if($_POST['ajax'] != 1) { |
298 | 299 | echo "<script>window.setTimeout(\"alert('" . addslashes($modx->db->escape($msg)) . "')\",10);history.go(-1)</script>"; |
@@ -301,12 +302,14 @@ discard block |
||
301 | 302 | } |
302 | 303 | } |
303 | 304 | |
304 | -function login($username, $givenPassword, $dbasePassword) { |
|
305 | +function login($username, $givenPassword, $dbasePassword) |
|
306 | +{ |
|
305 | 307 | global $modx; |
306 | 308 | return $modx->phpass->CheckPassword($givenPassword, $dbasePassword); |
307 | 309 | } |
308 | 310 | |
309 | -function loginV1($internalKey, $givenPassword, $dbasePassword, $username) { |
|
311 | +function loginV1($internalKey, $givenPassword, $dbasePassword, $username) |
|
312 | +{ |
|
310 | 313 | global $modx; |
311 | 314 | |
312 | 315 | $user_algo = $modx->manager->getV1UserHashAlgorithm($internalKey); |
@@ -329,7 +332,8 @@ discard block |
||
329 | 332 | return true; |
330 | 333 | } |
331 | 334 | |
332 | -function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) { |
|
335 | +function loginMD5($internalKey, $givenPassword, $dbasePassword, $username) |
|
336 | +{ |
|
333 | 337 | global $modx; |
334 | 338 | |
335 | 339 | if($dbasePassword != md5($givenPassword)) { |
@@ -339,7 +343,8 @@ discard block |
||
339 | 343 | return true; |
340 | 344 | } |
341 | 345 | |
342 | -function updateNewHash($username, $password) { |
|
346 | +function updateNewHash($username, $password) |
|
347 | +{ |
|
343 | 348 | global $modx; |
344 | 349 | |
345 | 350 | $field = array(); |
@@ -347,16 +352,19 @@ discard block |
||
347 | 352 | $modx->db->update($field, '[+prefix+]manager_users', "username='{$username}'"); |
348 | 353 | } |
349 | 354 | |
350 | -function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) { |
|
355 | +function incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes) |
|
356 | +{ |
|
351 | 357 | global $modx; |
352 | 358 | |
353 | 359 | $failedlogins += 1; |
354 | 360 | |
355 | 361 | $fields = array('failedlogincount' => $failedlogins); |
356 | - if($failedlogins >= $failed_allowed) //block user for too many fail attempts |
|
362 | + if($failedlogins >= $failed_allowed) { |
|
363 | + //block user for too many fail attempts |
|
357 | 364 | { |
358 | 365 | $fields['blockeduntil'] = time() + ($blocked_minutes * 60); |
359 | 366 | } |
367 | + } |
|
360 | 368 | |
361 | 369 | $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'"); |
362 | 370 |