@@ -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 |
@@ -10,7 +10,8 @@ discard block |
||
10 | 10 | * @param $theme |
11 | 11 | * @param string $hereid |
12 | 12 | */ |
13 | -function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') { |
|
13 | +function makeHTML($indent, $parent, $expandAll, $theme, $hereid = '') |
|
14 | +{ |
|
14 | 15 | global $modx; |
15 | 16 | global $icons, $iconsPrivate, $_style; |
16 | 17 | global $_lang, $opened, $opened2, $closed2; //added global vars |
@@ -450,7 +451,8 @@ discard block |
||
450 | 451 | return $output; |
451 | 452 | } |
452 | 453 | |
453 | -function getIconInfo($_style) { |
|
454 | +function getIconInfo($_style) |
|
455 | +{ |
|
454 | 456 | if(!isset($_style['tree_page_gif'])) { |
455 | 457 | $_style['tree_page_gif'] = $_style['tree_page']; |
456 | 458 | } |
@@ -477,7 +479,8 @@ discard block |
||
477 | 479 | return $icons; |
478 | 480 | } |
479 | 481 | |
480 | -function getPrivateIconInfo($_style) { |
|
482 | +function getPrivateIconInfo($_style) |
|
483 | +{ |
|
481 | 484 | if(!isset($_style['tree_page_gif_secure'])) { |
482 | 485 | $_style['tree_page_gif_secure'] = $_style['tree_page_secure']; |
483 | 486 | } |
@@ -504,7 +507,8 @@ discard block |
||
504 | 507 | return $iconsPrivate; |
505 | 508 | } |
506 | 509 | |
507 | -function getNodeTitle($nodeNameSource, $row) { |
|
510 | +function getNodeTitle($nodeNameSource, $row) |
|
511 | +{ |
|
508 | 512 | global $modx; |
509 | 513 | |
510 | 514 | switch($nodeNameSource) { |
@@ -550,7 +554,8 @@ discard block |
||
550 | 554 | return $nodetitle; |
551 | 555 | } |
552 | 556 | |
553 | -function isDateNode($nodeNameSource) { |
|
557 | +function isDateNode($nodeNameSource) |
|
558 | +{ |
|
554 | 559 | switch($nodeNameSource) { |
555 | 560 | case 'createdon': |
556 | 561 | case 'editedon': |
@@ -563,13 +568,15 @@ discard block |
||
563 | 568 | } |
564 | 569 | } |
565 | 570 | |
566 | -function checkIsFolder($parent = 0, $isfolder = 1) { |
|
571 | +function checkIsFolder($parent = 0, $isfolder = 1) |
|
572 | +{ |
|
567 | 573 | global $modx; |
568 | 574 | |
569 | 575 | return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' ')); |
570 | 576 | } |
571 | 577 | |
572 | -function _htmlentities($array) { |
|
578 | +function _htmlentities($array) |
|
579 | +{ |
|
573 | 580 | global $modx; |
574 | 581 | |
575 | 582 | $array = json_encode($array, JSON_UNESCAPED_UNICODE); |
@@ -578,7 +585,8 @@ discard block |
||
578 | 585 | return $array; |
579 | 586 | } |
580 | 587 | |
581 | -function getTplSingleNode() { |
|
588 | +function getTplSingleNode() |
|
589 | +{ |
|
582 | 590 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
583 | 591 | onclick="modx.tree.treeAction(event,[+id+]);" |
584 | 592 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -602,7 +610,8 @@ discard block |
||
602 | 610 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a></div>'; |
603 | 611 | } |
604 | 612 | |
605 | -function getTplFolderNode() { |
|
613 | +function getTplFolderNode() |
|
614 | +{ |
|
606 | 615 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
607 | 616 | onclick="modx.tree.treeAction(event,[+id+]);" |
608 | 617 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -638,7 +647,8 @@ discard block |
||
638 | 647 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>'; |
639 | 648 | } |
640 | 649 | |
641 | -function getTplFolderNodeNotChildren() { |
|
650 | +function getTplFolderNodeNotChildren() |
|
651 | +{ |
|
642 | 652 | return '<div id="node[+id+]"><a class="[+treeNodeClass+]" |
643 | 653 | onclick="modx.tree.treeAction(event,[+id+]);" |
644 | 654 | oncontextmenu="modx.tree.showPopup(event,[+id+],\'[+nodetitle_esc+]\');" |
@@ -670,7 +680,8 @@ discard block |
||
670 | 680 | title="[+title+]">[+nodetitleDisplay+][+weblinkDisplay+]</span>[+pageIdDisplay+]</a><div>'; |
671 | 681 | } |
672 | 682 | |
673 | -function dbug($str, $flag = false) { |
|
683 | +function dbug($str, $flag = false) |
|
684 | +{ |
|
674 | 685 | print('<pre>'); |
675 | 686 | print_r($str); |
676 | 687 | print('</pre>'); |