Completed
Push — develop ( 4a389e...d0bb9b )
by Maxim
15s
created
manager/processors/duplicate_module.processor.php 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
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('new_module')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 /**
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
  * @return string
18 18
  */
19 19
 function createGUID(){
20
-	srand((double)microtime()*1000000);
21
-	$r = rand() ;
22
-	$u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
23
-	$m = md5 ($u);
24
-	return $m;
20
+    srand((double)microtime()*1000000);
21
+    $r = rand() ;
22
+    $u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
23
+    $m = md5 ($u);
24
+    return $m;
25 25
 }
26 26
 
27 27
 // count duplicates
@@ -32,40 +32,40 @@  discard block
 block discarded – undo
32 32
 
33 33
 // duplicate module
34 34
 $newid = $modx->db->insert(
35
-	array(
36
-		'name'=>'',
37
-		'description'=>'',
38
-		'disabled'=>'',
39
-		'category'=>'',
40
-		'wrap'=>'',
41
-		'icon'=>'',
42
-		'enable_resource'=>'',
43
-		'resourcefile'=>'',
44
-		'createdon'=>'',
45
-		'editedon'=>'',
46
-		'guid'=>'',
47
-		'enable_sharedparams'=>'',
48
-		'properties'=>'',
49
-		'modulecode'=>'',
50
-		), $modx->getFullTableName('site_modules'), // Insert into
51
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
35
+    array(
36
+        'name'=>'',
37
+        'description'=>'',
38
+        'disabled'=>'',
39
+        'category'=>'',
40
+        'wrap'=>'',
41
+        'icon'=>'',
42
+        'enable_resource'=>'',
43
+        'resourcefile'=>'',
44
+        'createdon'=>'',
45
+        'editedon'=>'',
46
+        'guid'=>'',
47
+        'enable_sharedparams'=>'',
48
+        'properties'=>'',
49
+        'modulecode'=>'',
50
+        ), $modx->getFullTableName('site_modules'), // Insert into
51
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
52 52
 
53 53
 // duplicate module dependencies
54 54
 $modx->db->insert(
55
-	array(
56
-		'module'=>'',
57
-		'resource'=>'',
58
-		'type'=>'',
59
-		), $modx->getFullTableName('site_module_depobj'), // Insert into
60
-	"'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
55
+    array(
56
+        'module'=>'',
57
+        'resource'=>'',
58
+        'type'=>'',
59
+        ), $modx->getFullTableName('site_module_depobj'), // Insert into
60
+    "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
61 61
 
62 62
 // duplicate module user group access
63 63
 $modx->db->insert(
64
-	array(
65
-		'module'=>'',
66
-		'usergroup'=>'',
67
-		), $modx->getFullTableName('site_module_access'), // Insert into
68
-	"'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
64
+    array(
65
+        'module'=>'',
66
+        'usergroup'=>'',
67
+        ), $modx->getFullTableName('site_module_access'), // Insert into
68
+    "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
69 69
 
70 70
 // Set the item name for logger
71 71
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
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
-if(!$modx->hasPermission('new_module')) {
5
+if (!$modx->hasPermission('new_module')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
 	$modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
  * @return string
18 18
  */
19 19
 function createGUID(){
20
-	srand((double)microtime()*1000000);
21
-	$r = rand() ;
22
-	$u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
23
-	$m = md5 ($u);
20
+	srand((double) microtime() * 1000000);
21
+	$r = rand();
22
+	$u = uniqid(getmypid().$r.(double) microtime() * 1000000, 1);
23
+	$m = md5($u);
24 24
 	return $m;
25 25
 }
26 26
 
27 27
 // count duplicates
28 28
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'"));
29 29
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
30
-if($count>=1) $count = ' '.($count+1);
30
+if ($count >= 1) $count = ' '.($count + 1);
31 31
 else $count = '';
32 32
 
33 33
 // duplicate module
@@ -72,5 +72,5 @@  discard block
 block discarded – undo
72 72
 $_SESSION['itemname'] = $name;
73 73
 
74 74
 // finish duplicating - redirect to new module
75
-$header="Location: index.php?r=2&a=108&id=$newid";
75
+$header = "Location: index.php?r=2&a=108&id=$newid";
76 76
 header($header);
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,7 +16,8 @@  discard block
 block discarded – undo
16 16
  *
17 17
  * @return string
18 18
  */
19
-function createGUID(){
19
+function createGUID()
20
+{
20 21
 	srand((double)microtime()*1000000);
21 22
 	$r = rand() ;
22 23
 	$u = uniqid(getmypid() . $r . (double)microtime()*1000000,1);
@@ -27,8 +28,11 @@  discard block
 block discarded – undo
27 28
 // count duplicates
28 29
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'"));
29 30
 $count = $modx->db->getRecordCount($modx->db->select('name', $modx->getFullTableName('site_modules'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
30
-if($count>=1) $count = ' '.($count+1);
31
-else $count = '';
31
+if($count>=1) {
32
+    $count = ' '.($count+1);
33
+} else {
34
+    $count = '';
35
+}
32 36
 
33 37
 // duplicate module
34 38
 $newid = $modx->db->insert(
Please login to merge, or discard this patch.
manager/processors/delete_content.processor.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
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('delete_document')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10
-if ($id==0) {
9
+$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
10
+if ($id == 0) {
11 11
     $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 /*******ищем родителя чтобы к нему вернуться********/
15
-$content=$modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
-$pid=($content['parent']==0?$id:$content['parent']);
15
+$content = $modx->db->getRow($modx->db->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
+$pid = ($content['parent'] == 0 ? $id : $content['parent']);
17 17
 
18 18
 /************ а заодно и путь возврата (сам путь внизу файла) **********/
19
-$sd=isset($_REQUEST['dir'])?'&dir='.$_REQUEST['dir']:'&dir=DESC';
20
-$sb=isset($_REQUEST['sort'])?'&sort='.$_REQUEST['sort']:'&sort=createdon';
21
-$pg=isset($_REQUEST['page'])?'&page='.(int)$_REQUEST['page']:'';
22
-$add_path=$sd.$sb.$pg;
19
+$sd = isset($_REQUEST['dir']) ? '&dir='.$_REQUEST['dir'] : '&dir=DESC';
20
+$sb = isset($_REQUEST['sort']) ? '&sort='.$_REQUEST['sort'] : '&sort=createdon';
21
+$pg = isset($_REQUEST['page']) ? '&page='.(int) $_REQUEST['page'] : '';
22
+$add_path = $sd.$sb.$pg;
23 23
 
24 24
 /*****************************/
25 25
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 $children = array();
28 28
 
29 29
 // check permissions on the document
30
-include_once MODX_MANAGER_PATH . "processors/user_documents_permissions.class.php";
30
+include_once MODX_MANAGER_PATH."processors/user_documents_permissions.class.php";
31 31
 $udperms = new udperms();
32 32
 $udperms->user = $modx->getLoginUserID();
33 33
 $udperms->document = $id;
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
     $parent = $modx->db->escape($parent);
53 53
     $rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent={$parent} AND deleted=0");
54 54
         // the document has children documents, we'll need to delete those too
55
-        while ($childid=$modx->db->getValue($rs)) {
56
-            if ($childid==$site_start) {
55
+        while ($childid = $modx->db->getValue($rs)) {
56
+            if ($childid == $site_start) {
57 57
                 $modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site start' document, and cannot be deleted. Please assign another document as your 'Site start' document and try again.");
58 58
             }
59
-            if ($childid==$site_unavailable_page) {
59
+            if ($childid == $site_unavailable_page) {
60 60
                 $modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site unavailable page' document, and cannot be deleted. Please assign another document as your 'Site unavailable page' document and try again.");
61 61
             }
62
-            if ($childid==$error_page) {
62
+            if ($childid == $error_page) {
63 63
                 $modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site error page' document, and cannot be deleted. Please assign another document as your 'Site error page' document and try again.");
64 64
             }
65
-            if ($childid==$unauthorized_page) {
65
+            if ($childid == $unauthorized_page) {
66 66
                 $modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site unauthorized page' document, and cannot be deleted. Please assign another document as your 'Site unauthorized page' document and try again.");
67 67
             }
68 68
             $children[] = $childid;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                             "children"=>$children
81 81
                         ));
82 82
 
83
-if (count($children)>0) {
83
+if (count($children) > 0) {
84 84
     $modx->db->update(
85 85
         array(
86 86
             'deleted'   => 1,
@@ -89,19 +89,19 @@  discard block
 block discarded – undo
89 89
         ), $modx->getFullTableName('site_content'), "id IN (".implode(", ", $children).")");
90 90
 }
91 91
 
92
-if ($site_start==$id) {
92
+if ($site_start == $id) {
93 93
     $modx->webAlertAndQuit("Document is 'Site start' and cannot be deleted!");
94 94
 }
95 95
 
96
-if ($site_unavailable_page==$id) {
96
+if ($site_unavailable_page == $id) {
97 97
     $modx->webAlertAndQuit("Document is used as the 'Site unavailable page' and cannot be deleted!");
98 98
 }
99 99
 
100
-if ($error_page==$id) {
100
+if ($error_page == $id) {
101 101
     $modx->webAlertAndQuit("Document is used as the 'Site error page' and cannot be deleted!");
102 102
 }
103 103
 
104
-if ($unauthorized_page==$id) {
104
+if ($unauthorized_page == $id) {
105 105
     $modx->webAlertAndQuit("Document is used as the 'Site unauthorized page' and cannot be deleted!");
106 106
 }
107 107
 
@@ -127,5 +127,5 @@  discard block
 block discarded – undo
127 127
 $modx->clearCache('full');
128 128
 
129 129
 // finished emptying cache - redirect
130
-$header="Location: index.php?a=3&id=$pid&r=1".$add_path;
130
+$header = "Location: index.php?a=3&id=$pid&r=1".$add_path;
131 131
 header($header);
Please login to merge, or discard this patch.
manager/processors/remove_installer.processor.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 $pth = dirname(dirname(dirname(__FILE__)))."/install/";
17 17
 $pth = str_replace("\\","/",$pth);
18 18
 if(isset($_GET["rminstall"])) {
19
-	if(is_dir($pth)) {
20
-		if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder";
21
-	}
19
+    if(is_dir($pth)) {
20
+        if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder";
21
+    }
22 22
 }
23 23
 if($msg) echo "<script>alert('".addslashes($msg)."');</script>";
24 24
 echo "<script>window.location='../index.php?a=2';</script>";
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
  * @return bool
32 32
  */
33 33
 function rmdirRecursive($path, $followLinks=false) {
34
-   $dir = opendir($path) ;
35
-   while ($entry = readdir($dir)) {
36
-	   if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) {
37
-		   @unlink( "$path/$entry" );
38
-	   }
39
-	   elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
40
-		   rmdirRecursive("$path/$entry"); // recursive
41
-	   }
42
-   }
43
-   closedir($dir);
44
-   return @rmdir($path);
34
+    $dir = opendir($path) ;
35
+    while ($entry = readdir($dir)) {
36
+        if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) {
37
+            @unlink( "$path/$entry" );
38
+        }
39
+        elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
40
+            rmdirRecursive("$path/$entry"); // recursive
41
+        }
42
+    }
43
+    closedir($dir);
44
+    return @rmdir($path);
45 45
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
  *
13 13
  */
14 14
 
15
-$msg ='';
15
+$msg = '';
16 16
 $pth = dirname(dirname(dirname(__FILE__)))."/install/";
17
-$pth = str_replace("\\","/",$pth);
18
-if(isset($_GET["rminstall"])) {
19
-	if(is_dir($pth)) {
20
-		if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder";
17
+$pth = str_replace("\\", "/", $pth);
18
+if (isset($_GET["rminstall"])) {
19
+	if (is_dir($pth)) {
20
+		if (!rmdirRecursive($pth)) $msg = "An error occured while attempting to remove the install folder";
21 21
 	}
22 22
 }
23
-if($msg) echo "<script>alert('".addslashes($msg)."');</script>";
23
+if ($msg) echo "<script>alert('".addslashes($msg)."');</script>";
24 24
 echo "<script>window.location='../index.php?a=2';</script>";
25 25
 
26 26
 /**
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
  * @param bool $followLinks
31 31
  * @return bool
32 32
  */
33
-function rmdirRecursive($path, $followLinks=false) {
34
-   $dir = opendir($path) ;
33
+function rmdirRecursive($path, $followLinks = false){
34
+   $dir = opendir($path);
35 35
    while ($entry = readdir($dir)) {
36 36
 	   if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) {
37
-		   @unlink( "$path/$entry" );
37
+		   @unlink("$path/$entry");
38 38
 	   }
39
-	   elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
39
+	   elseif (is_dir("$path/$entry") && $entry != '.' && $entry != '..') {
40 40
 		   rmdirRecursive("$path/$entry"); // recursive
41 41
 	   }
42 42
    }
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,10 +17,14 @@  discard block
 block discarded – undo
17 17
 $pth = str_replace("\\","/",$pth);
18 18
 if(isset($_GET["rminstall"])) {
19 19
 	if(is_dir($pth)) {
20
-		if(!rmdirRecursive($pth)) $msg="An error occured while attempting to remove the install folder";
20
+		if(!rmdirRecursive($pth)) {
21
+		    $msg="An error occured while attempting to remove the install folder";
22
+		}
21 23
 	}
22 24
 }
23
-if($msg) echo "<script>alert('".addslashes($msg)."');</script>";
25
+if($msg) {
26
+    echo "<script>alert('".addslashes($msg)."');</script>";
27
+}
24 28
 echo "<script>window.location='../index.php?a=2';</script>";
25 29
 
26 30
 /**
@@ -30,13 +34,13 @@  discard block
 block discarded – undo
30 34
  * @param bool $followLinks
31 35
  * @return bool
32 36
  */
33
-function rmdirRecursive($path, $followLinks=false) {
37
+function rmdirRecursive($path, $followLinks=false)
38
+{
34 39
    $dir = opendir($path) ;
35 40
    while ($entry = readdir($dir)) {
36 41
 	   if (is_file("$path/$entry") || ((!$followLinks) && is_link("$path/$entry"))) {
37 42
 		   @unlink( "$path/$entry" );
38
-	   }
39
-	   elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
43
+	   } elseif (is_dir("$path/$entry") && $entry!='.' && $entry!='..') {
40 44
 		   rmdirRecursive("$path/$entry"); // recursive
41 45
 	   }
42 46
    }
Please login to merge, or discard this patch.
manager/processors/save_web_user.processor.php 4 patches
Switch Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -60,108 +60,108 @@  discard block
 block discarded – undo
60 60
 }
61 61
 
62 62
 switch($input['mode']) {
63
-	case '87' : // new user
64
-		// check if this user name already exist
65
-		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
-		$limit = $modx->db->getValue($rs);
67
-		if($limit > 0) {
68
-			webAlertAndQuit("User name is already in use!");
69
-		}
70
-
71
-		// check if the email address already exist
72
-		$rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
73
-		$limit = $modx->db->getValue($rs);
74
-		if($limit > 0) {
75
-			webAlertAndQuit("Email is already in use!");
76
-		}
63
+	    case '87' : // new user
64
+		    // check if this user name already exist
65
+		    $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
+		    $limit = $modx->db->getValue($rs);
67
+		    if($limit > 0) {
68
+			    webAlertAndQuit("User name is already in use!");
69
+		    }
70
+
71
+		    // check if the email address already exist
72
+		    $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
73
+		    $limit = $modx->db->getValue($rs);
74
+		    if($limit > 0) {
75
+			    webAlertAndQuit("Email is already in use!");
76
+		    }
77
+
78
+		    // generate a new password for this user
79
+		    if($specifiedpassword != "" && $passwordgenmethod == "spec") {
80
+			    if(strlen($specifiedpassword) < 6) {
81
+				    webAlertAndQuit("Password is too short!");
82
+			    } else {
83
+				    $newpassword = $specifiedpassword;
84
+			    }
85
+		    } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
86
+			    webAlertAndQuit("You didn't specify a password for this user!");
87
+		    } elseif($passwordgenmethod == 'g') {
88
+			    $newpassword = generate_password(8);
89
+		    } else {
90
+			    webAlertAndQuit("No password generation method specified!");
91
+		    }
92
+
93
+		    // invoke OnBeforeWUsrFormSave event
94
+		    $modx->invokeEvent("OnBeforeWUsrFormSave", array(
95
+			    "mode" => "new",
96
+		    ));
97
+
98
+		    // create the user account
99
+		    $field = array();
100
+		    $field['username'] = $esc_newusername;
101
+		    $field['password'] = md5($newpassword);
102
+		    $internalKey = $modx->db->insert($field, $tbl_web_users);
103
+
104
+		    $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
105
+		    $field = $modx->db->escape($field);
106
+		    $modx->db->insert($field, $tbl_web_user_attributes);
107
+
108
+		    // Save User Settings
109
+		    saveUserSettings($internalKey);
110
+
111
+		    // Set the item name for logger
112
+		    $_SESSION['itemname'] = $newusername;
113
+
114
+		    /*******************************************************************************/
115
+		    // put the user in the user_groups he/ she should be in
116
+		    // first, check that up_perms are switched on!
117
+		    if($use_udperms == 1) {
118
+			    if(!empty($user_groups)) {
119
+				    for($i = 0; $i < count($user_groups); $i++) {
120
+					    $f = array();
121
+					    $f['webgroup'] = (int)$user_groups[$i];
122
+					    $f['webuser'] = $internalKey;
123
+					    $modx->db->insert($f, $tbl_web_groups);
124
+				    }
125
+			    }
126
+		    }
127
+		    // end of user_groups stuff!
128
+
129
+            // invoke OnWebSaveUser event
130
+            $modx->invokeEvent("OnWebSaveUser", array(
131
+                "mode" => "new",
132
+                "userid" => $internalKey,
133
+                "username" => $newusername,
134
+                "userpassword" => $newpassword,
135
+                "useremail" => $email,
136
+                "userfullname" => $fullname
137
+            ));
77 138
 
78
-		// generate a new password for this user
79
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
80
-			if(strlen($specifiedpassword) < 6) {
81
-				webAlertAndQuit("Password is too short!");
82
-			} else {
83
-				$newpassword = $specifiedpassword;
84
-			}
85
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
86
-			webAlertAndQuit("You didn't specify a password for this user!");
87
-		} elseif($passwordgenmethod == 'g') {
88
-			$newpassword = generate_password(8);
89
-		} else {
90
-			webAlertAndQuit("No password generation method specified!");
91
-		}
139
+            // invoke OnWUsrFormSave event
140
+            $modx->invokeEvent("OnWUsrFormSave", array(
141
+                "mode" => "new",
142
+                "id" => $internalKey
143
+            ));
92 144
 
93
-		// invoke OnBeforeWUsrFormSave event
94
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
95
-			"mode" => "new",
96
-		));
97
-
98
-		// create the user account
99
-		$field = array();
100
-		$field['username'] = $esc_newusername;
101
-		$field['password'] = md5($newpassword);
102
-		$internalKey = $modx->db->insert($field, $tbl_web_users);
103
-
104
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
105
-		$field = $modx->db->escape($field);
106
-		$modx->db->insert($field, $tbl_web_user_attributes);
107
-
108
-		// Save User Settings
109
-		saveUserSettings($internalKey);
110
-
111
-		// Set the item name for logger
112
-		$_SESSION['itemname'] = $newusername;
113
-
114
-		/*******************************************************************************/
115
-		// put the user in the user_groups he/ she should be in
116
-		// first, check that up_perms are switched on!
117
-		if($use_udperms == 1) {
118
-			if(!empty($user_groups)) {
119
-				for($i = 0; $i < count($user_groups); $i++) {
120
-					$f = array();
121
-					$f['webgroup'] = (int)$user_groups[$i];
122
-					$f['webuser'] = $internalKey;
123
-					$modx->db->insert($f, $tbl_web_groups);
124
-				}
125
-			}
126
-		}
127
-		// end of user_groups stuff!
128
-
129
-        // invoke OnWebSaveUser event
130
-        $modx->invokeEvent("OnWebSaveUser", array(
131
-            "mode" => "new",
132
-            "userid" => $internalKey,
133
-            "username" => $newusername,
134
-            "userpassword" => $newpassword,
135
-            "useremail" => $email,
136
-            "userfullname" => $fullname
137
-        ));
138
-
139
-        // invoke OnWUsrFormSave event
140
-        $modx->invokeEvent("OnWUsrFormSave", array(
141
-            "mode" => "new",
142
-            "id" => $internalKey
143
-        ));
144
-
145
-		if($passwordnotifymethod == 'e') {
146
-			sendMailMessage($email, $newusername, $newpassword, $fullname);
147
-			if($input['stay'] != '') {
148
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
149
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
150
-				header($header);
151
-			} else {
152
-				$header = "Location: index.php?a=99&r=2";
153
-				header($header);
154
-			}
155
-		} else {
156
-			if($input['stay'] != '') {
157
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
158
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
159
-			} else {
160
-				$stayUrl = "index.php?a=99&r=2";
161
-			}
162
-
163
-			include_once "header.inc.php";
164
-			?>
145
+		    if($passwordnotifymethod == 'e') {
146
+			    sendMailMessage($email, $newusername, $newpassword, $fullname);
147
+			    if($input['stay'] != '') {
148
+				    $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
149
+				    $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
150
+				    header($header);
151
+			    } else {
152
+				    $header = "Location: index.php?a=99&r=2";
153
+				    header($header);
154
+			    }
155
+		    } else {
156
+			    if($input['stay'] != '') {
157
+				    $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
158
+				    $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
159
+			    } else {
160
+				    $stayUrl = "index.php?a=99&r=2";
161
+			    }
162
+
163
+			    include_once "header.inc.php";
164
+			    ?>
165 165
 
166 166
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
167 167
 
@@ -183,122 +183,122 @@  discard block
 block discarded – undo
183 183
 			</div>
184 184
 			<?php
185 185
 
186
-			include_once "footer.inc.php";
187
-		}
188
-		break;
189
-	case '88' : // edit user
190
-		// generate a new password for this user
191
-		if($genpassword == 1) {
192
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
193
-				if(strlen($specifiedpassword) < 6) {
194
-					webAlertAndQuit("Password is too short!");
195
-				} else {
196
-					$newpassword = $specifiedpassword;
197
-				}
198
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
199
-				webAlertAndQuit("You didn't specify a password for this user!");
200
-			} elseif($passwordgenmethod == 'g') {
201
-				$newpassword = generate_password(8);
202
-			} else {
203
-				webAlertAndQuit("No password generation method specified!");
204
-			}
205
-		}
206
-		if($passwordnotifymethod == 'e') {
207
-			sendMailMessage($email, $newusername, $newpassword, $fullname);
208
-		}
209
-
210
-		// check if the username already exist
211
-		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
212
-		$limit = $modx->db->getValue($rs);
213
-		if($limit > 0) {
214
-			webAlertAndQuit("User name is already in use!");
215
-		}
216
-
217
-		// check if the email address already exists
218
-		$rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
219
-		$limit = $modx->db->getValue($rs);
220
-		if($limit > 0) {
221
-			webAlertAndQuit("Email is already in use!");
222
-		}
223
-
224
-		// invoke OnBeforeWUsrFormSave event
225
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
226
-			"mode" => "upd",
227
-			"id" => $id
228
-		));
229
-
230
-		// update user name and password
231
-		$field = array();
232
-		$field['username'] = $esc_newusername;
233
-		if($genpassword == 1) {
234
-			$field['password'] = md5($newpassword);
235
-		}
236
-		$modx->db->update($field, $tbl_web_users, "id='{$id}'");
237
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
238
-		$field = $modx->db->escape($field);
239
-		$modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
240
-
241
-		// Save User Settings
242
-		saveUserSettings($id);
243
-
244
-		// Set the item name for logger
245
-		$_SESSION['itemname'] = $newusername;
246
-
247
-		/*******************************************************************************/
248
-		// put the user in the user_groups he/ she should be in
249
-		// first, check that up_perms are switched on!
250
-		if($use_udperms == 1) {
251
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
252
-			$modx->db->delete($tbl_web_groups, "webuser='{$id}'");
253
-			if(!empty($user_groups)) {
254
-				for($i = 0; $i < count($user_groups); $i++) {
255
-					$field = array();
256
-					$field['webgroup'] = (int)$user_groups[$i];
257
-					$field['webuser'] = $id;
258
-					$modx->db->insert($field, $tbl_web_groups);
259
-				}
260
-			}
261
-		}
262
-		// end of user_groups stuff!
263
-		/*******************************************************************************/
264
-
265
-        // invoke OnWebSaveUser event
266
-        $modx->invokeEvent("OnWebSaveUser", array(
267
-            "mode" => "upd",
268
-            "userid" => $id,
269
-            "username" => $newusername,
270
-            "userpassword" => $newpassword,
271
-            "useremail" => $email,
272
-            "userfullname" => $fullname,
273
-            "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
274
-            "olduseremail" => (($oldemail != $email) ? $oldemail : "")
275
-        ));
276
-
277
-        // invoke OnWebChangePassword event
278
-        if($genpassword == 1) {
279
-            $modx->invokeEvent("OnWebChangePassword", array(
186
+			    include_once "footer.inc.php";
187
+		    }
188
+		    break;
189
+	    case '88' : // edit user
190
+		    // generate a new password for this user
191
+		    if($genpassword == 1) {
192
+			    if($specifiedpassword != "" && $passwordgenmethod == "spec") {
193
+				    if(strlen($specifiedpassword) < 6) {
194
+					    webAlertAndQuit("Password is too short!");
195
+				    } else {
196
+					    $newpassword = $specifiedpassword;
197
+				    }
198
+			    } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
199
+				    webAlertAndQuit("You didn't specify a password for this user!");
200
+			    } elseif($passwordgenmethod == 'g') {
201
+				    $newpassword = generate_password(8);
202
+			    } else {
203
+				    webAlertAndQuit("No password generation method specified!");
204
+			    }
205
+		    }
206
+		    if($passwordnotifymethod == 'e') {
207
+			    sendMailMessage($email, $newusername, $newpassword, $fullname);
208
+		    }
209
+
210
+		    // check if the username already exist
211
+		    $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
212
+		    $limit = $modx->db->getValue($rs);
213
+		    if($limit > 0) {
214
+			    webAlertAndQuit("User name is already in use!");
215
+		    }
216
+
217
+		    // check if the email address already exists
218
+		    $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
219
+		    $limit = $modx->db->getValue($rs);
220
+		    if($limit > 0) {
221
+			    webAlertAndQuit("Email is already in use!");
222
+		    }
223
+
224
+		    // invoke OnBeforeWUsrFormSave event
225
+		    $modx->invokeEvent("OnBeforeWUsrFormSave", array(
226
+			    "mode" => "upd",
227
+			    "id" => $id
228
+		    ));
229
+
230
+		    // update user name and password
231
+		    $field = array();
232
+		    $field['username'] = $esc_newusername;
233
+		    if($genpassword == 1) {
234
+			    $field['password'] = md5($newpassword);
235
+		    }
236
+		    $modx->db->update($field, $tbl_web_users, "id='{$id}'");
237
+		    $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
238
+		    $field = $modx->db->escape($field);
239
+		    $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
240
+
241
+		    // Save User Settings
242
+		    saveUserSettings($id);
243
+
244
+		    // Set the item name for logger
245
+		    $_SESSION['itemname'] = $newusername;
246
+
247
+		    /*******************************************************************************/
248
+		    // put the user in the user_groups he/ she should be in
249
+		    // first, check that up_perms are switched on!
250
+		    if($use_udperms == 1) {
251
+			    // as this is an existing user, delete his/ her entries in the groups before saving the new groups
252
+			    $modx->db->delete($tbl_web_groups, "webuser='{$id}'");
253
+			    if(!empty($user_groups)) {
254
+				    for($i = 0; $i < count($user_groups); $i++) {
255
+					    $field = array();
256
+					    $field['webgroup'] = (int)$user_groups[$i];
257
+					    $field['webuser'] = $id;
258
+					    $modx->db->insert($field, $tbl_web_groups);
259
+				    }
260
+			    }
261
+		    }
262
+		    // end of user_groups stuff!
263
+		    /*******************************************************************************/
264
+
265
+            // invoke OnWebSaveUser event
266
+            $modx->invokeEvent("OnWebSaveUser", array(
267
+                "mode" => "upd",
280 268
                 "userid" => $id,
281 269
                 "username" => $newusername,
282
-                "userpassword" => $newpassword
270
+                "userpassword" => $newpassword,
271
+                "useremail" => $email,
272
+                "userfullname" => $fullname,
273
+                "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
274
+                "olduseremail" => (($oldemail != $email) ? $oldemail : "")
283 275
             ));
284
-        }
285 276
 
286
-        // invoke OnWUsrFormSave event
287
-        $modx->invokeEvent("OnWUsrFormSave", array(
288
-            "mode" => "upd",
289
-            "id" => $id
290
-        ));
277
+            // invoke OnWebChangePassword event
278
+            if($genpassword == 1) {
279
+                $modx->invokeEvent("OnWebChangePassword", array(
280
+                    "userid" => $id,
281
+                    "username" => $newusername,
282
+                    "userpassword" => $newpassword
283
+                ));
284
+            }
285
+
286
+            // invoke OnWUsrFormSave event
287
+            $modx->invokeEvent("OnWUsrFormSave", array(
288
+                "mode" => "upd",
289
+                "id" => $id
290
+            ));
291 291
 
292
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
293
-			if($input['stay'] != '') {
294
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
295
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
296
-			} else {
297
-				$stayUrl = "index.php?a=99&r=2";
298
-			}
292
+		    if($genpassword == 1 && $passwordnotifymethod == 's') {
293
+			    if($input['stay'] != '') {
294
+				    $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
295
+				    $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
296
+			    } else {
297
+				    $stayUrl = "index.php?a=99&r=2";
298
+			    }
299 299
 
300
-			include_once "header.inc.php";
301
-			?>
300
+			    include_once "header.inc.php";
301
+			    ?>
302 302
 
303 303
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
304 304
 
@@ -318,20 +318,20 @@  discard block
 block discarded – undo
318 318
 			</div>
319 319
 			<?php
320 320
 
321
-			include_once "footer.inc.php";
322
-		} else {
323
-			if($input['stay'] != '') {
324
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
325
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
326
-				header($header);
327
-			} else {
328
-				$header = "Location: index.php?a=99&r=2";
329
-				header($header);
330
-			}
331
-		}
332
-		break;
333
-	default :
334
-		webAlertAndQuit("No operation set in request.");
321
+			    include_once "footer.inc.php";
322
+		    } else {
323
+			    if($input['stay'] != '') {
324
+				    $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
325
+				    $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
326
+				    header($header);
327
+			    } else {
328
+				    $header = "Location: index.php?a=99&r=2";
329
+				    header($header);
330
+			    }
331
+		    }
332
+		    break;
333
+	    default :
334
+		    webAlertAndQuit("No operation set in request.");
335 335
 }
336 336
 
337 337
 /**
Please login to merge, or discard this patch.
Indentation   +277 added lines, -277 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
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
 if(!$modx->hasPermission('save_web_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $tbl_web_users = $modx->getFullTableName('web_users');
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 $input = $_POST;
14 14
 foreach($input as $k => $v) {
15
-	if($k !== 'comment') {
16
-		$v = sanitize($v);
17
-	}
18
-	$input[$k] = $v;
15
+    if($k !== 'comment') {
16
+        $v = sanitize($v);
17
+    }
18
+    $input[$k] = $v;
19 19
 }
20 20
 
21 21
 $id = (int)$input['id'];
@@ -51,80 +51,80 @@  discard block
 block discarded – undo
51 51
 
52 52
 // verify password
53 53
 if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
54
-	webAlertAndQuit("Password typed is mismatched");
54
+    webAlertAndQuit("Password typed is mismatched");
55 55
 }
56 56
 
57 57
 // verify email
58 58
 if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
59
-	webAlertAndQuit("E-mail address doesn't seem to be valid!");
59
+    webAlertAndQuit("E-mail address doesn't seem to be valid!");
60 60
 }
61 61
 
62 62
 switch($input['mode']) {
63
-	case '87' : // new user
64
-		// check if this user name already exist
65
-		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
-		$limit = $modx->db->getValue($rs);
67
-		if($limit > 0) {
68
-			webAlertAndQuit("User name is already in use!");
69
-		}
70
-
71
-		// check if the email address already exist
72
-		$rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
73
-		$limit = $modx->db->getValue($rs);
74
-		if($limit > 0) {
75
-			webAlertAndQuit("Email is already in use!");
76
-		}
77
-
78
-		// generate a new password for this user
79
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
80
-			if(strlen($specifiedpassword) < 6) {
81
-				webAlertAndQuit("Password is too short!");
82
-			} else {
83
-				$newpassword = $specifiedpassword;
84
-			}
85
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
86
-			webAlertAndQuit("You didn't specify a password for this user!");
87
-		} elseif($passwordgenmethod == 'g') {
88
-			$newpassword = generate_password(8);
89
-		} else {
90
-			webAlertAndQuit("No password generation method specified!");
91
-		}
92
-
93
-		// invoke OnBeforeWUsrFormSave event
94
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
95
-			"mode" => "new",
96
-		));
97
-
98
-		// create the user account
99
-		$field = array();
100
-		$field['username'] = $esc_newusername;
101
-		$field['password'] = md5($newpassword);
102
-		$internalKey = $modx->db->insert($field, $tbl_web_users);
103
-
104
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
105
-		$field = $modx->db->escape($field);
106
-		$modx->db->insert($field, $tbl_web_user_attributes);
107
-
108
-		// Save User Settings
109
-		saveUserSettings($internalKey);
110
-
111
-		// Set the item name for logger
112
-		$_SESSION['itemname'] = $newusername;
113
-
114
-		/*******************************************************************************/
115
-		// put the user in the user_groups he/ she should be in
116
-		// first, check that up_perms are switched on!
117
-		if($use_udperms == 1) {
118
-			if(!empty($user_groups)) {
119
-				for($i = 0; $i < count($user_groups); $i++) {
120
-					$f = array();
121
-					$f['webgroup'] = (int)$user_groups[$i];
122
-					$f['webuser'] = $internalKey;
123
-					$modx->db->insert($f, $tbl_web_groups);
124
-				}
125
-			}
126
-		}
127
-		// end of user_groups stuff!
63
+    case '87' : // new user
64
+        // check if this user name already exist
65
+        $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
+        $limit = $modx->db->getValue($rs);
67
+        if($limit > 0) {
68
+            webAlertAndQuit("User name is already in use!");
69
+        }
70
+
71
+        // check if the email address already exist
72
+        $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
73
+        $limit = $modx->db->getValue($rs);
74
+        if($limit > 0) {
75
+            webAlertAndQuit("Email is already in use!");
76
+        }
77
+
78
+        // generate a new password for this user
79
+        if($specifiedpassword != "" && $passwordgenmethod == "spec") {
80
+            if(strlen($specifiedpassword) < 6) {
81
+                webAlertAndQuit("Password is too short!");
82
+            } else {
83
+                $newpassword = $specifiedpassword;
84
+            }
85
+        } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
86
+            webAlertAndQuit("You didn't specify a password for this user!");
87
+        } elseif($passwordgenmethod == 'g') {
88
+            $newpassword = generate_password(8);
89
+        } else {
90
+            webAlertAndQuit("No password generation method specified!");
91
+        }
92
+
93
+        // invoke OnBeforeWUsrFormSave event
94
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
95
+            "mode" => "new",
96
+        ));
97
+
98
+        // create the user account
99
+        $field = array();
100
+        $field['username'] = $esc_newusername;
101
+        $field['password'] = md5($newpassword);
102
+        $internalKey = $modx->db->insert($field, $tbl_web_users);
103
+
104
+        $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
105
+        $field = $modx->db->escape($field);
106
+        $modx->db->insert($field, $tbl_web_user_attributes);
107
+
108
+        // Save User Settings
109
+        saveUserSettings($internalKey);
110
+
111
+        // Set the item name for logger
112
+        $_SESSION['itemname'] = $newusername;
113
+
114
+        /*******************************************************************************/
115
+        // put the user in the user_groups he/ she should be in
116
+        // first, check that up_perms are switched on!
117
+        if($use_udperms == 1) {
118
+            if(!empty($user_groups)) {
119
+                for($i = 0; $i < count($user_groups); $i++) {
120
+                    $f = array();
121
+                    $f['webgroup'] = (int)$user_groups[$i];
122
+                    $f['webuser'] = $internalKey;
123
+                    $modx->db->insert($f, $tbl_web_groups);
124
+                }
125
+            }
126
+        }
127
+        // end of user_groups stuff!
128 128
 
129 129
         // invoke OnWebSaveUser event
130 130
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -142,26 +142,26 @@  discard block
 block discarded – undo
142 142
             "id" => $internalKey
143 143
         ));
144 144
 
145
-		if($passwordnotifymethod == 'e') {
146
-			sendMailMessage($email, $newusername, $newpassword, $fullname);
147
-			if($input['stay'] != '') {
148
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
149
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
150
-				header($header);
151
-			} else {
152
-				$header = "Location: index.php?a=99&r=2";
153
-				header($header);
154
-			}
155
-		} else {
156
-			if($input['stay'] != '') {
157
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
158
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
159
-			} else {
160
-				$stayUrl = "index.php?a=99&r=2";
161
-			}
162
-
163
-			include_once "header.inc.php";
164
-			?>
145
+        if($passwordnotifymethod == 'e') {
146
+            sendMailMessage($email, $newusername, $newpassword, $fullname);
147
+            if($input['stay'] != '') {
148
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
149
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
150
+                header($header);
151
+            } else {
152
+                $header = "Location: index.php?a=99&r=2";
153
+                header($header);
154
+            }
155
+        } else {
156
+            if($input['stay'] != '') {
157
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
158
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
159
+            } else {
160
+                $stayUrl = "index.php?a=99&r=2";
161
+            }
162
+
163
+            include_once "header.inc.php";
164
+            ?>
165 165
 
166 166
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
167 167
 
@@ -183,84 +183,84 @@  discard block
 block discarded – undo
183 183
 			</div>
184 184
 			<?php
185 185
 
186
-			include_once "footer.inc.php";
187
-		}
188
-		break;
189
-	case '88' : // edit user
190
-		// generate a new password for this user
191
-		if($genpassword == 1) {
192
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
193
-				if(strlen($specifiedpassword) < 6) {
194
-					webAlertAndQuit("Password is too short!");
195
-				} else {
196
-					$newpassword = $specifiedpassword;
197
-				}
198
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
199
-				webAlertAndQuit("You didn't specify a password for this user!");
200
-			} elseif($passwordgenmethod == 'g') {
201
-				$newpassword = generate_password(8);
202
-			} else {
203
-				webAlertAndQuit("No password generation method specified!");
204
-			}
205
-		}
206
-		if($passwordnotifymethod == 'e') {
207
-			sendMailMessage($email, $newusername, $newpassword, $fullname);
208
-		}
209
-
210
-		// check if the username already exist
211
-		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
212
-		$limit = $modx->db->getValue($rs);
213
-		if($limit > 0) {
214
-			webAlertAndQuit("User name is already in use!");
215
-		}
216
-
217
-		// check if the email address already exists
218
-		$rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
219
-		$limit = $modx->db->getValue($rs);
220
-		if($limit > 0) {
221
-			webAlertAndQuit("Email is already in use!");
222
-		}
223
-
224
-		// invoke OnBeforeWUsrFormSave event
225
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
226
-			"mode" => "upd",
227
-			"id" => $id
228
-		));
229
-
230
-		// update user name and password
231
-		$field = array();
232
-		$field['username'] = $esc_newusername;
233
-		if($genpassword == 1) {
234
-			$field['password'] = md5($newpassword);
235
-		}
236
-		$modx->db->update($field, $tbl_web_users, "id='{$id}'");
237
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
238
-		$field = $modx->db->escape($field);
239
-		$modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
240
-
241
-		// Save User Settings
242
-		saveUserSettings($id);
243
-
244
-		// Set the item name for logger
245
-		$_SESSION['itemname'] = $newusername;
246
-
247
-		/*******************************************************************************/
248
-		// put the user in the user_groups he/ she should be in
249
-		// first, check that up_perms are switched on!
250
-		if($use_udperms == 1) {
251
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
252
-			$modx->db->delete($tbl_web_groups, "webuser='{$id}'");
253
-			if(!empty($user_groups)) {
254
-				for($i = 0; $i < count($user_groups); $i++) {
255
-					$field = array();
256
-					$field['webgroup'] = (int)$user_groups[$i];
257
-					$field['webuser'] = $id;
258
-					$modx->db->insert($field, $tbl_web_groups);
259
-				}
260
-			}
261
-		}
262
-		// end of user_groups stuff!
263
-		/*******************************************************************************/
186
+            include_once "footer.inc.php";
187
+        }
188
+        break;
189
+    case '88' : // edit user
190
+        // generate a new password for this user
191
+        if($genpassword == 1) {
192
+            if($specifiedpassword != "" && $passwordgenmethod == "spec") {
193
+                if(strlen($specifiedpassword) < 6) {
194
+                    webAlertAndQuit("Password is too short!");
195
+                } else {
196
+                    $newpassword = $specifiedpassword;
197
+                }
198
+            } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
199
+                webAlertAndQuit("You didn't specify a password for this user!");
200
+            } elseif($passwordgenmethod == 'g') {
201
+                $newpassword = generate_password(8);
202
+            } else {
203
+                webAlertAndQuit("No password generation method specified!");
204
+            }
205
+        }
206
+        if($passwordnotifymethod == 'e') {
207
+            sendMailMessage($email, $newusername, $newpassword, $fullname);
208
+        }
209
+
210
+        // check if the username already exist
211
+        $rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
212
+        $limit = $modx->db->getValue($rs);
213
+        if($limit > 0) {
214
+            webAlertAndQuit("User name is already in use!");
215
+        }
216
+
217
+        // check if the email address already exists
218
+        $rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
219
+        $limit = $modx->db->getValue($rs);
220
+        if($limit > 0) {
221
+            webAlertAndQuit("Email is already in use!");
222
+        }
223
+
224
+        // invoke OnBeforeWUsrFormSave event
225
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
226
+            "mode" => "upd",
227
+            "id" => $id
228
+        ));
229
+
230
+        // update user name and password
231
+        $field = array();
232
+        $field['username'] = $esc_newusername;
233
+        if($genpassword == 1) {
234
+            $field['password'] = md5($newpassword);
235
+        }
236
+        $modx->db->update($field, $tbl_web_users, "id='{$id}'");
237
+        $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
238
+        $field = $modx->db->escape($field);
239
+        $modx->db->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
240
+
241
+        // Save User Settings
242
+        saveUserSettings($id);
243
+
244
+        // Set the item name for logger
245
+        $_SESSION['itemname'] = $newusername;
246
+
247
+        /*******************************************************************************/
248
+        // put the user in the user_groups he/ she should be in
249
+        // first, check that up_perms are switched on!
250
+        if($use_udperms == 1) {
251
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
252
+            $modx->db->delete($tbl_web_groups, "webuser='{$id}'");
253
+            if(!empty($user_groups)) {
254
+                for($i = 0; $i < count($user_groups); $i++) {
255
+                    $field = array();
256
+                    $field['webgroup'] = (int)$user_groups[$i];
257
+                    $field['webuser'] = $id;
258
+                    $modx->db->insert($field, $tbl_web_groups);
259
+                }
260
+            }
261
+        }
262
+        // end of user_groups stuff!
263
+        /*******************************************************************************/
264 264
 
265 265
         // invoke OnWebSaveUser event
266 266
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -289,16 +289,16 @@  discard block
 block discarded – undo
289 289
             "id" => $id
290 290
         ));
291 291
 
292
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
293
-			if($input['stay'] != '') {
294
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
295
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
296
-			} else {
297
-				$stayUrl = "index.php?a=99&r=2";
298
-			}
292
+        if($genpassword == 1 && $passwordnotifymethod == 's') {
293
+            if($input['stay'] != '') {
294
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
295
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
296
+            } else {
297
+                $stayUrl = "index.php?a=99&r=2";
298
+            }
299 299
 
300
-			include_once "header.inc.php";
301
-			?>
300
+            include_once "header.inc.php";
301
+            ?>
302 302
 
303 303
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
304 304
 
@@ -318,20 +318,20 @@  discard block
 block discarded – undo
318 318
 			</div>
319 319
 			<?php
320 320
 
321
-			include_once "footer.inc.php";
322
-		} else {
323
-			if($input['stay'] != '') {
324
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
325
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
326
-				header($header);
327
-			} else {
328
-				$header = "Location: index.php?a=99&r=2";
329
-				header($header);
330
-			}
331
-		}
332
-		break;
333
-	default :
334
-		webAlertAndQuit("No operation set in request.");
321
+            include_once "footer.inc.php";
322
+        } else {
323
+            if($input['stay'] != '') {
324
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
325
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
326
+                header($header);
327
+            } else {
328
+                $header = "Location: index.php?a=99&r=2";
329
+                header($header);
330
+            }
331
+        }
332
+        break;
333
+    default :
334
+        webAlertAndQuit("No operation set in request.");
335 335
 }
336 336
 
337 337
 /**
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
  * @return string
342 342
  */
343 343
 function save_user_quoted_printable($string) {
344
-	$crlf = "\n";
345
-	$string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf;
346
-	$f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e';
347
-	$r[] = "'=' . sprintf('%02X', ord('\\1'))";
348
-	$f[] = '/([\011\040])' . $crlf . '/e';
349
-	$r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'";
350
-	$string = preg_replace($f, $r, $string);
351
-	return trim(wordwrap($string, 70, ' =' . $crlf));
344
+    $crlf = "\n";
345
+    $string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf;
346
+    $f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e';
347
+    $r[] = "'=' . sprintf('%02X', ord('\\1'))";
348
+    $f[] = '/([\011\040])' . $crlf . '/e';
349
+    $r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'";
350
+    $string = preg_replace($f, $r, $string);
351
+    return trim(wordwrap($string, 70, ' =' . $crlf));
352 352
 }
353 353
 
354 354
 /**
@@ -360,94 +360,94 @@  discard block
 block discarded – undo
360 360
  * @param string $ufn
361 361
  */
362 362
 function sendMailMessage($email, $uid, $pwd, $ufn) {
363
-	$modx = evolutionCMS(); global $_lang, $websignupemail_message;
364
-	global $emailsubject, $emailsender;
365
-	global $site_name, $site_url;
366
-	$message = sprintf($websignupemail_message, $uid, $pwd); // use old method
367
-	// replace placeholders
368
-	$message = str_replace("[+uid+]", $uid, $message);
369
-	$message = str_replace("[+pwd+]", $pwd, $message);
370
-	$message = str_replace("[+ufn+]", $ufn, $message);
371
-	$message = str_replace("[+sname+]", $site_name, $message);
372
-	$message = str_replace("[+saddr+]", $emailsender, $message);
373
-	$message = str_replace("[+semail+]", $emailsender, $message);
374
-	$message = str_replace("[+surl+]", $site_url, $message);
375
-
376
-	$param = array();
377
-	$param['from'] = "{$site_name}<{$emailsender}>";
378
-	$param['subject'] = $emailsubject;
379
-	$param['body'] = $message;
380
-	$param['to'] = $email;
381
-	$param['type'] = 'text';
382
-	$rs = $modx->sendmail($param);
383
-	if(!$rs) {
384
-		$modx->manager->saveFormValues();
385
-		$modx->messageQuit("{$email} - {$_lang['error_sending_email']}");
386
-	}
363
+    $modx = evolutionCMS(); global $_lang, $websignupemail_message;
364
+    global $emailsubject, $emailsender;
365
+    global $site_name, $site_url;
366
+    $message = sprintf($websignupemail_message, $uid, $pwd); // use old method
367
+    // replace placeholders
368
+    $message = str_replace("[+uid+]", $uid, $message);
369
+    $message = str_replace("[+pwd+]", $pwd, $message);
370
+    $message = str_replace("[+ufn+]", $ufn, $message);
371
+    $message = str_replace("[+sname+]", $site_name, $message);
372
+    $message = str_replace("[+saddr+]", $emailsender, $message);
373
+    $message = str_replace("[+semail+]", $emailsender, $message);
374
+    $message = str_replace("[+surl+]", $site_url, $message);
375
+
376
+    $param = array();
377
+    $param['from'] = "{$site_name}<{$emailsender}>";
378
+    $param['subject'] = $emailsubject;
379
+    $param['body'] = $message;
380
+    $param['to'] = $email;
381
+    $param['type'] = 'text';
382
+    $rs = $modx->sendmail($param);
383
+    if(!$rs) {
384
+        $modx->manager->saveFormValues();
385
+        $modx->messageQuit("{$email} - {$_lang['error_sending_email']}");
386
+    }
387 387
 }
388 388
 
389 389
 // Save User Settings
390 390
 function saveUserSettings($id) {
391
-	$modx = evolutionCMS();
392
-	$tbl_web_user_settings = $modx->getFullTableName('web_user_settings');
393
-
394
-	$settings = array(
395
-		"login_home",
396
-		"allowed_ip",
397
-		"allowed_days"
398
-	);
399
-
400
-	$modx->db->delete($tbl_web_user_settings, "webuser='{$id}'");
401
-
402
-	foreach($settings as $n) {
403
-		$vl = $_POST[$n];
404
-		if(is_array($vl)) {
405
-			$vl = implode(",", $vl);
406
-		}
407
-		if($vl != '') {
408
-			$f = array();
409
-			$f['webuser'] = $id;
410
-			$f['setting_name'] = $n;
411
-			$f['setting_value'] = $vl;
412
-			$f = $modx->db->escape($f);
413
-			$modx->db->insert($f, $tbl_web_user_settings);
414
-		}
415
-	}
391
+    $modx = evolutionCMS();
392
+    $tbl_web_user_settings = $modx->getFullTableName('web_user_settings');
393
+
394
+    $settings = array(
395
+        "login_home",
396
+        "allowed_ip",
397
+        "allowed_days"
398
+    );
399
+
400
+    $modx->db->delete($tbl_web_user_settings, "webuser='{$id}'");
401
+
402
+    foreach($settings as $n) {
403
+        $vl = $_POST[$n];
404
+        if(is_array($vl)) {
405
+            $vl = implode(",", $vl);
406
+        }
407
+        if($vl != '') {
408
+            $f = array();
409
+            $f['webuser'] = $id;
410
+            $f['setting_name'] = $n;
411
+            $f['setting_value'] = $vl;
412
+            $f = $modx->db->escape($f);
413
+            $modx->db->insert($f, $tbl_web_user_settings);
414
+        }
415
+    }
416 416
 }
417 417
 
418 418
 // Web alert -  sends an alert to web browser
419 419
 function webAlertAndQuit($msg) {
420
-	global $id, $modx;
421
-	$mode = $_POST['mode'];
422
-	$modx->manager->saveFormValues($mode);
423
-	$modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : ''));
420
+    global $id, $modx;
421
+    $mode = $_POST['mode'];
422
+    $modx->manager->saveFormValues($mode);
423
+    $modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : ''));
424 424
 }
425 425
 
426 426
 // Generate password
427 427
 function generate_password($length = 10) {
428
-	$allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
429
-	$ps_len = strlen($allowable_characters);
430
-	mt_srand((double) microtime() * 1000000);
431
-	$pass = "";
432
-	for($i = 0; $i < $length; $i++) {
433
-		$pass .= $allowable_characters[mt_rand(0, $ps_len - 1)];
434
-	}
435
-	return $pass;
428
+    $allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
429
+    $ps_len = strlen($allowable_characters);
430
+    mt_srand((double) microtime() * 1000000);
431
+    $pass = "";
432
+    for($i = 0; $i < $length; $i++) {
433
+        $pass .= $allowable_characters[mt_rand(0, $ps_len - 1)];
434
+    }
435
+    return $pass;
436 436
 }
437 437
 
438 438
 function sanitize($str = '', $safecount = 0) {
439
-	$modx = evolutionCMS();
440
-	$safecount++;
441
-	if(1000 < $safecount) {
442
-		exit("error too many loops '{$safecount}'");
443
-	}
444
-	if(is_array($str)) {
445
-		foreach($str as $i => $v) {
446
-			$str[$i] = sanitize($v, $safecount);
447
-		}
448
-	} else {
449
-		// $str = strip_tags($str); // LEAVE < and > intact
450
-		$str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']);
451
-	}
452
-	return $str;
439
+    $modx = evolutionCMS();
440
+    $safecount++;
441
+    if(1000 < $safecount) {
442
+        exit("error too many loops '{$safecount}'");
443
+    }
444
+    if(is_array($str)) {
445
+        foreach($str as $i => $v) {
446
+            $str[$i] = sanitize($v, $safecount);
447
+        }
448
+    } else {
449
+        // $str = strip_tags($str); // LEAVE < and > intact
450
+        $str = htmlspecialchars($str, ENT_NOQUOTES, $modx->config['modx_charset']);
451
+    }
452
+    return $str;
453 453
 }
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
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
-if(!$modx->hasPermission('save_web_user')) {
5
+if (!$modx->hasPermission('save_web_user')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 $tbl_web_groups = $modx->getFullTableName('web_groups');
12 12
 
13 13
 $input = $_POST;
14
-foreach($input as $k => $v) {
15
-	if($k !== 'comment') {
14
+foreach ($input as $k => $v) {
15
+	if ($k !== 'comment') {
16 16
 		$v = sanitize($v);
17 17
 	}
18 18
 	$input[$k] = $v;
19 19
 }
20 20
 
21
-$id = (int)$input['id'];
21
+$id = (int) $input['id'];
22 22
 $oldusername = $input['oldusername'];
23 23
 $newusername = !empty ($input['newusername']) ? trim($input['newusername']) : "New User";
24 24
 $esc_newusername = $modx->db->escape($newusername);
@@ -50,41 +50,41 @@  discard block
 block discarded – undo
50 50
 $user_groups = $input['user_groups'];
51 51
 
52 52
 // verify password
53
-if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
53
+if ($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
54 54
 	webAlertAndQuit("Password typed is mismatched");
55 55
 }
56 56
 
57 57
 // verify email
58
-if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
58
+if ($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
59 59
 	webAlertAndQuit("E-mail address doesn't seem to be valid!");
60 60
 }
61 61
 
62
-switch($input['mode']) {
62
+switch ($input['mode']) {
63 63
 	case '87' : // new user
64 64
 		// check if this user name already exist
65 65
 		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66 66
 		$limit = $modx->db->getValue($rs);
67
-		if($limit > 0) {
67
+		if ($limit > 0) {
68 68
 			webAlertAndQuit("User name is already in use!");
69 69
 		}
70 70
 
71 71
 		// check if the email address already exist
72 72
 		$rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
73 73
 		$limit = $modx->db->getValue($rs);
74
-		if($limit > 0) {
74
+		if ($limit > 0) {
75 75
 			webAlertAndQuit("Email is already in use!");
76 76
 		}
77 77
 
78 78
 		// generate a new password for this user
79
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
80
-			if(strlen($specifiedpassword) < 6) {
79
+		if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
80
+			if (strlen($specifiedpassword) < 6) {
81 81
 				webAlertAndQuit("Password is too short!");
82 82
 			} else {
83 83
 				$newpassword = $specifiedpassword;
84 84
 			}
85
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
85
+		} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
86 86
 			webAlertAndQuit("You didn't specify a password for this user!");
87
-		} elseif($passwordgenmethod == 'g') {
87
+		} elseif ($passwordgenmethod == 'g') {
88 88
 			$newpassword = generate_password(8);
89 89
 		} else {
90 90
 			webAlertAndQuit("No password generation method specified!");
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 		/*******************************************************************************/
115 115
 		// put the user in the user_groups he/ she should be in
116 116
 		// first, check that up_perms are switched on!
117
-		if($use_udperms == 1) {
118
-			if(!empty($user_groups)) {
119
-				for($i = 0; $i < count($user_groups); $i++) {
117
+		if ($use_udperms == 1) {
118
+			if (!empty($user_groups)) {
119
+				for ($i = 0; $i < count($user_groups); $i++) {
120 120
 					$f = array();
121
-					$f['webgroup'] = (int)$user_groups[$i];
121
+					$f['webgroup'] = (int) $user_groups[$i];
122 122
 					$f['webuser'] = $internalKey;
123 123
 					$modx->db->insert($f, $tbl_web_groups);
124 124
 				}
@@ -142,20 +142,20 @@  discard block
 block discarded – undo
142 142
             "id" => $internalKey
143 143
         ));
144 144
 
145
-		if($passwordnotifymethod == 'e') {
145
+		if ($passwordnotifymethod == 'e') {
146 146
 			sendMailMessage($email, $newusername, $newpassword, $fullname);
147
-			if($input['stay'] != '') {
147
+			if ($input['stay'] != '') {
148 148
 				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
149
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
149
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
150 150
 				header($header);
151 151
 			} else {
152 152
 				$header = "Location: index.php?a=99&r=2";
153 153
 				header($header);
154 154
 			}
155 155
 		} else {
156
-			if($input['stay'] != '') {
156
+			if ($input['stay'] != '') {
157 157
 				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
158
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
158
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
159 159
 			} else {
160 160
 				$stayUrl = "index.php?a=99&r=2";
161 161
 			}
@@ -188,36 +188,36 @@  discard block
 block discarded – undo
188 188
 		break;
189 189
 	case '88' : // edit user
190 190
 		// generate a new password for this user
191
-		if($genpassword == 1) {
192
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
193
-				if(strlen($specifiedpassword) < 6) {
191
+		if ($genpassword == 1) {
192
+			if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
193
+				if (strlen($specifiedpassword) < 6) {
194 194
 					webAlertAndQuit("Password is too short!");
195 195
 				} else {
196 196
 					$newpassword = $specifiedpassword;
197 197
 				}
198
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
198
+			} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
199 199
 				webAlertAndQuit("You didn't specify a password for this user!");
200
-			} elseif($passwordgenmethod == 'g') {
200
+			} elseif ($passwordgenmethod == 'g') {
201 201
 				$newpassword = generate_password(8);
202 202
 			} else {
203 203
 				webAlertAndQuit("No password generation method specified!");
204 204
 			}
205 205
 		}
206
-		if($passwordnotifymethod == 'e') {
206
+		if ($passwordnotifymethod == 'e') {
207 207
 			sendMailMessage($email, $newusername, $newpassword, $fullname);
208 208
 		}
209 209
 
210 210
 		// check if the username already exist
211 211
 		$rs = $modx->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
212 212
 		$limit = $modx->db->getValue($rs);
213
-		if($limit > 0) {
213
+		if ($limit > 0) {
214 214
 			webAlertAndQuit("User name is already in use!");
215 215
 		}
216 216
 
217 217
 		// check if the email address already exists
218 218
 		$rs = $modx->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
219 219
 		$limit = $modx->db->getValue($rs);
220
-		if($limit > 0) {
220
+		if ($limit > 0) {
221 221
 			webAlertAndQuit("Email is already in use!");
222 222
 		}
223 223
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		// update user name and password
231 231
 		$field = array();
232 232
 		$field['username'] = $esc_newusername;
233
-		if($genpassword == 1) {
233
+		if ($genpassword == 1) {
234 234
 			$field['password'] = md5($newpassword);
235 235
 		}
236 236
 		$modx->db->update($field, $tbl_web_users, "id='{$id}'");
@@ -247,13 +247,13 @@  discard block
 block discarded – undo
247 247
 		/*******************************************************************************/
248 248
 		// put the user in the user_groups he/ she should be in
249 249
 		// first, check that up_perms are switched on!
250
-		if($use_udperms == 1) {
250
+		if ($use_udperms == 1) {
251 251
 			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
252 252
 			$modx->db->delete($tbl_web_groups, "webuser='{$id}'");
253
-			if(!empty($user_groups)) {
254
-				for($i = 0; $i < count($user_groups); $i++) {
253
+			if (!empty($user_groups)) {
254
+				for ($i = 0; $i < count($user_groups); $i++) {
255 255
 					$field = array();
256
-					$field['webgroup'] = (int)$user_groups[$i];
256
+					$field['webgroup'] = (int) $user_groups[$i];
257 257
 					$field['webuser'] = $id;
258 258
 					$modx->db->insert($field, $tbl_web_groups);
259 259
 				}
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         ));
276 276
 
277 277
         // invoke OnWebChangePassword event
278
-        if($genpassword == 1) {
278
+        if ($genpassword == 1) {
279 279
             $modx->invokeEvent("OnWebChangePassword", array(
280 280
                 "userid" => $id,
281 281
                 "username" => $newusername,
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
             "id" => $id
290 290
         ));
291 291
 
292
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
293
-			if($input['stay'] != '') {
292
+		if ($genpassword == 1 && $passwordnotifymethod == 's') {
293
+			if ($input['stay'] != '') {
294 294
 				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
295
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
295
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
296 296
 			} else {
297 297
 				$stayUrl = "index.php?a=99&r=2";
298 298
 			}
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
 
321 321
 			include_once "footer.inc.php";
322 322
 		} else {
323
-			if($input['stay'] != '') {
323
+			if ($input['stay'] != '') {
324 324
 				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
325
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
325
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
326 326
 				header($header);
327 327
 			} else {
328 328
 				$header = "Location: index.php?a=99&r=2";
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
  * @param string $string
341 341
  * @return string
342 342
  */
343
-function save_user_quoted_printable($string) {
343
+function save_user_quoted_printable($string){
344 344
 	$crlf = "\n";
345
-	$string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf;
345
+	$string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string).$crlf;
346 346
 	$f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e';
347 347
 	$r[] = "'=' . sprintf('%02X', ord('\\1'))";
348
-	$f[] = '/([\011\040])' . $crlf . '/e';
349
-	$r[] = "'=' . sprintf('%02X', ord('\\1')) . '" . $crlf . "'";
348
+	$f[] = '/([\011\040])'.$crlf.'/e';
349
+	$r[] = "'=' . sprintf('%02X', ord('\\1')) . '".$crlf."'";
350 350
 	$string = preg_replace($f, $r, $string);
351
-	return trim(wordwrap($string, 70, ' =' . $crlf));
351
+	return trim(wordwrap($string, 70, ' ='.$crlf));
352 352
 }
353 353
 
354 354
 /**
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
  * @param string $pwd
360 360
  * @param string $ufn
361 361
  */
362
-function sendMailMessage($email, $uid, $pwd, $ufn) {
362
+function sendMailMessage($email, $uid, $pwd, $ufn){
363 363
 	$modx = evolutionCMS(); global $_lang, $websignupemail_message;
364 364
 	global $emailsubject, $emailsender;
365 365
 	global $site_name, $site_url;
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
 	$param['to'] = $email;
381 381
 	$param['type'] = 'text';
382 382
 	$rs = $modx->sendmail($param);
383
-	if(!$rs) {
383
+	if (!$rs) {
384 384
 		$modx->manager->saveFormValues();
385 385
 		$modx->messageQuit("{$email} - {$_lang['error_sending_email']}");
386 386
 	}
387 387
 }
388 388
 
389 389
 // Save User Settings
390
-function saveUserSettings($id) {
390
+function saveUserSettings($id){
391 391
 	$modx = evolutionCMS();
392 392
 	$tbl_web_user_settings = $modx->getFullTableName('web_user_settings');
393 393
 
@@ -399,12 +399,12 @@  discard block
 block discarded – undo
399 399
 
400 400
 	$modx->db->delete($tbl_web_user_settings, "webuser='{$id}'");
401 401
 
402
-	foreach($settings as $n) {
402
+	foreach ($settings as $n) {
403 403
 		$vl = $_POST[$n];
404
-		if(is_array($vl)) {
404
+		if (is_array($vl)) {
405 405
 			$vl = implode(",", $vl);
406 406
 		}
407
-		if($vl != '') {
407
+		if ($vl != '') {
408 408
 			$f = array();
409 409
 			$f['webuser'] = $id;
410 410
 			$f['setting_name'] = $n;
@@ -416,33 +416,33 @@  discard block
 block discarded – undo
416 416
 }
417 417
 
418 418
 // Web alert -  sends an alert to web browser
419
-function webAlertAndQuit($msg) {
419
+function webAlertAndQuit($msg){
420 420
 	global $id, $modx;
421 421
 	$mode = $_POST['mode'];
422 422
 	$modx->manager->saveFormValues($mode);
423
-	$modx->webAlertAndQuit($msg, "index.php?a={$mode}" . ($mode == '88' ? "&id={$id}" : ''));
423
+	$modx->webAlertAndQuit($msg, "index.php?a={$mode}".($mode == '88' ? "&id={$id}" : ''));
424 424
 }
425 425
 
426 426
 // Generate password
427
-function generate_password($length = 10) {
427
+function generate_password($length = 10){
428 428
 	$allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
429 429
 	$ps_len = strlen($allowable_characters);
430 430
 	mt_srand((double) microtime() * 1000000);
431 431
 	$pass = "";
432
-	for($i = 0; $i < $length; $i++) {
432
+	for ($i = 0; $i < $length; $i++) {
433 433
 		$pass .= $allowable_characters[mt_rand(0, $ps_len - 1)];
434 434
 	}
435 435
 	return $pass;
436 436
 }
437 437
 
438
-function sanitize($str = '', $safecount = 0) {
438
+function sanitize($str = '', $safecount = 0){
439 439
 	$modx = evolutionCMS();
440 440
 	$safecount++;
441
-	if(1000 < $safecount) {
441
+	if (1000 < $safecount) {
442 442
 		exit("error too many loops '{$safecount}'");
443 443
 	}
444
-	if(is_array($str)) {
445
-		foreach($str as $i => $v) {
444
+	if (is_array($str)) {
445
+		foreach ($str as $i => $v) {
446 446
 			$str[$i] = sanitize($v, $safecount);
447 447
 		}
448 448
 	} else {
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -340,7 +340,8 @@  discard block
 block discarded – undo
340 340
  * @param string $string
341 341
  * @return string
342 342
  */
343
-function save_user_quoted_printable($string) {
343
+function save_user_quoted_printable($string)
344
+{
344 345
 	$crlf = "\n";
345 346
 	$string = preg_replace('!(\r\n|\r|\n)!', $crlf, $string) . $crlf;
346 347
 	$f[] = '/([\000-\010\013\014\016-\037\075\177-\377])/e';
@@ -359,7 +360,8 @@  discard block
 block discarded – undo
359 360
  * @param string $pwd
360 361
  * @param string $ufn
361 362
  */
362
-function sendMailMessage($email, $uid, $pwd, $ufn) {
363
+function sendMailMessage($email, $uid, $pwd, $ufn)
364
+{
363 365
 	$modx = evolutionCMS(); global $_lang, $websignupemail_message;
364 366
 	global $emailsubject, $emailsender;
365 367
 	global $site_name, $site_url;
@@ -387,7 +389,8 @@  discard block
 block discarded – undo
387 389
 }
388 390
 
389 391
 // Save User Settings
390
-function saveUserSettings($id) {
392
+function saveUserSettings($id)
393
+{
391 394
 	$modx = evolutionCMS();
392 395
 	$tbl_web_user_settings = $modx->getFullTableName('web_user_settings');
393 396
 
@@ -416,7 +419,8 @@  discard block
 block discarded – undo
416 419
 }
417 420
 
418 421
 // Web alert -  sends an alert to web browser
419
-function webAlertAndQuit($msg) {
422
+function webAlertAndQuit($msg)
423
+{
420 424
 	global $id, $modx;
421 425
 	$mode = $_POST['mode'];
422 426
 	$modx->manager->saveFormValues($mode);
@@ -424,7 +428,8 @@  discard block
 block discarded – undo
424 428
 }
425 429
 
426 430
 // Generate password
427
-function generate_password($length = 10) {
431
+function generate_password($length = 10)
432
+{
428 433
 	$allowable_characters = "abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789";
429 434
 	$ps_len = strlen($allowable_characters);
430 435
 	mt_srand((double) microtime() * 1000000);
@@ -435,7 +440,8 @@  discard block
 block discarded – undo
435 440
 	return $pass;
436 441
 }
437 442
 
438
-function sanitize($str = '', $safecount = 0) {
443
+function sanitize($str = '', $safecount = 0)
444
+{
439 445
 	$modx = evolutionCMS();
440 446
 	$safecount++;
441 447
 	if(1000 < $safecount) {
Please login to merge, or discard this patch.
manager/media/script/air-datepicker/datepicker.inc.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 
9 9
         $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl');
10 10
         if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode();
11
-		$modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy';
11
+        $modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy';
12 12
         return $modx->mergeSettingsContent($load_script);
13 13
     }
14 14
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class DATEPICKER {
2
+class DATEPICKER{
3 3
     /**
4 4
      * @return string
5 5
      */
6
-    public function getDP() {
6
+    public function getDP(){
7 7
         $modx = evolutionCMS();
8 8
 
9 9
         $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl');
10
-        if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode();
10
+        if (!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode();
11 11
 		$modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy';
12 12
         return $modx->mergeSettingsContent($load_script);
13 13
     }
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @return string
17 17
      */
18
-    public function getLangCode() {
18
+    public function getLangCode(){
19 19
         $modx = evolutionCMS(); global $modx_lang_attribute;
20 20
 
21
-        if(!$modx_lang_attribute) return 'en';
21
+        if (!$modx_lang_attribute) return 'en';
22 22
 
23 23
         $lc = $modx_lang_attribute;
24
-        if($lc === 'uk') return 'ru';
25
-        $dp_path = str_replace('\\','/',dirname(__FILE__));
24
+        if ($lc === 'uk') return 'ru';
25
+        $dp_path = str_replace('\\', '/', dirname(__FILE__));
26 26
 
27 27
         return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en';
28 28
     }
Please login to merge, or discard this patch.
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,17 @@  discard block
 block discarded – undo
1 1
 <?php
2
-class DATEPICKER {
2
+class DATEPICKER
3
+{
3 4
     /**
4 5
      * @return string
5 6
      */
6
-    public function getDP() {
7
+    public function getDP()
8
+    {
7 9
         $modx = evolutionCMS();
8 10
 
9 11
         $load_script = file_get_contents(dirname(__FILE__).'/datepicker.tpl');
10
-        if(!isset($modx->config['lang_code'])) $modx->config['lang_code'] = $this->getLangCode();
12
+        if(!isset($modx->config['lang_code'])) {
13
+            $modx->config['lang_code'] = $this->getLangCode();
14
+        }
11 15
 		$modx->config['datetime_format_lc'] = isset($modx->config['datetime_format']) ? strtolower($modx->config['datetime_format']) : 'dd-mm-yyyy';
12 16
         return $modx->mergeSettingsContent($load_script);
13 17
     }
@@ -15,13 +19,18 @@  discard block
 block discarded – undo
15 19
     /**
16 20
      * @return string
17 21
      */
18
-    public function getLangCode() {
22
+    public function getLangCode()
23
+    {
19 24
         $modx = evolutionCMS(); global $modx_lang_attribute;
20 25
 
21
-        if(!$modx_lang_attribute) return 'en';
26
+        if(!$modx_lang_attribute) {
27
+            return 'en';
28
+        }
22 29
 
23 30
         $lc = $modx_lang_attribute;
24
-        if($lc === 'uk') return 'ru';
31
+        if($lc === 'uk') {
32
+            return 'ru';
33
+        }
25 34
         $dp_path = str_replace('\\','/',dirname(__FILE__));
26 35
 
27 36
         return (is_file("{$dp_path}/i18n/datepicker.{$lc}.js")) ? $modx_lang_attribute : 'en';
Please login to merge, or discard this patch.
manager/frames/nodes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@
 block discarded – undo
18 18
     exit('send some data');
19 19
 } //??
20 20
 
21
-$indent = (int)$_REQUEST['indent'];
22
-$parent = (int)$_REQUEST['parent'];
23
-$expandAll = (int)$_REQUEST['expandAll'];
21
+$indent = (int) $_REQUEST['indent'];
22
+$parent = (int) $_REQUEST['parent'];
23
+$expandAll = (int) $_REQUEST['expandAll'];
24 24
 $output = '';
25 25
 $hereid = isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) ? $_REQUEST['id'] : '';
26 26
 
Please login to merge, or discard this patch.
manager/includes/document.parser.class.inc.php 4 patches
Doc Comments   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
      * MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php"
281 281
      * $extname - extension name in lowercase
282 282
      *
283
-     * @param $extname
283
+     * @param string $extname
284 284
      * @param bool $reload
285 285
      * @return bool
286 286
      */
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
      * @param int $count_attempts
326 326
      * @param string $type $type
327 327
      * @param string $responseCode
328
-     * @return bool|null
328
+     * @return false|null
329 329
      * @global string $base_url
330 330
      * @global string $site_url
331 331
      */
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
     }
1042 1042
 
1043 1043
     /**
1044
-     * @param $contents
1044
+     * @param string $contents
1045 1045
      * @return mixed
1046 1046
      */
1047 1047
     public function RecoveryEscapedTags($contents)
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
     }
1068 1068
 
1069 1069
     /**
1070
-     * @param $tstart
1070
+     * @param double $tstart
1071 1071
      * @return array
1072 1072
      */
1073 1073
     public function getTimerStats($tstart)
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
 
1851 1851
     /**
1852 1852
      * Remove Comment-Tags from output like <!--@- Comment -@-->
1853
-     * @param $content
1853
+     * @param string $content
1854 1854
      * @param string $left
1855 1855
      * @param string $right
1856 1856
      * @return mixed
@@ -2028,7 +2028,7 @@  discard block
 block discarded – undo
2028 2028
     /**
2029 2029
      * Run snippets as per the tags in $documentSource and replace the tags with the returned values.
2030 2030
      *
2031
-     * @param $content
2031
+     * @param string $content
2032 2032
      * @return string
2033 2033
      * @internal param string $documentSource
2034 2034
      */
@@ -3095,7 +3095,7 @@  discard block
 block discarded – undo
3095 3095
 
3096 3096
     /**
3097 3097
      * @param $templateID
3098
-     * @return mixed
3098
+     * @return string
3099 3099
      */
3100 3100
     public function _getTemplateCodeFromDB($templateID)
3101 3101
     {
@@ -3137,9 +3137,9 @@  discard block
 block discarded – undo
3137 3137
     }
3138 3138
 
3139 3139
     /**
3140
-     * @param $id
3140
+     * @param integer $id
3141 3141
      * @param int $top
3142
-     * @return mixed
3142
+     * @return string
3143 3143
      */
3144 3144
     public function getUltimateParentId($id, $top = 0)
3145 3145
     {
@@ -3479,7 +3479,7 @@  discard block
 block discarded – undo
3479 3479
      *
3480 3480
      * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role
3481 3481
      * @param int $id Element- / Resource-id
3482
-     * @return bool
3482
+     * @return false|null
3483 3483
      */
3484 3484
     public function lockElement($type, $id)
3485 3485
     {
@@ -3502,7 +3502,7 @@  discard block
 block discarded – undo
3502 3502
      * @param int $type Types: 1=template, 2=tv, 3=chunk, 4=snippet, 5=plugin, 6=module, 7=resource, 8=role
3503 3503
      * @param int $id Element- / Resource-id
3504 3504
      * @param bool $includeAllUsers true = Deletes not only own user-locks
3505
-     * @return bool
3505
+     * @return false|null
3506 3506
      */
3507 3507
     public function unlockElement($type, $id, $includeAllUsers = false)
3508 3508
     {
@@ -3613,7 +3613,7 @@  discard block
 block discarded – undo
3613 3613
      * @param array $params
3614 3614
      * @param string $msg
3615 3615
      * @param array $files
3616
-     * @return mixed
3616
+     * @return boolean
3617 3617
      */
3618 3618
     public function sendmail($params = array(), $msg = '', $files = array())
3619 3619
     {
@@ -4050,7 +4050,7 @@  discard block
 block discarded – undo
4050 4050
      *                     Default: 1
4051 4051
      * @param string $fields List of fields
4052 4052
      *                       Default: id, pagetitle, description, alias
4053
-     * @return boolean|array
4053
+     * @return string
4054 4054
      */
4055 4055
     public function getPageInfo($pageid = -1, $active = 1, $fields = 'id, pagetitle, description, alias')
4056 4056
     {
@@ -4148,7 +4148,7 @@  discard block
 block discarded – undo
4148 4148
      *
4149 4149
      * @param string $type
4150 4150
      * @param bool $report
4151
-     * @return bool
4151
+     * @return boolean|null
4152 4152
      */
4153 4153
     public function clearCache($type = '', $report = false)
4154 4154
     {
@@ -4521,7 +4521,7 @@  discard block
 block discarded – undo
4521 4521
      * - Placeholders prefix. Default: '{'.
4522 4522
      * @param string $suffix {string}
4523 4523
      * - Placeholders suffix. Default: '}'.
4524
-     * @return bool|mixed|string {string; false} - Parsed chunk or false if $chunkArr is not array.
4524
+     * @return false|string {string; false} - Parsed chunk or false if $chunkArr is not array.
4525 4525
      * - Parsed chunk or false if $chunkArr is not array.
4526 4526
      */
4527 4527
     public function parseChunk($chunkName, $chunkArr, $prefix = '{', $suffix = '}')
@@ -5555,7 +5555,7 @@  discard block
 block discarded – undo
5555 5555
      * Remove event listener - only for use within the current execution cycle
5556 5556
      *
5557 5557
      * @param string $evtName
5558
-     * @return boolean
5558
+     * @return false|null
5559 5559
      */
5560 5560
     public function removeEventListener($evtName)
5561 5561
     {
@@ -5579,7 +5579,7 @@  discard block
 block discarded – undo
5579 5579
      *
5580 5580
      * @param string $evtName
5581 5581
      * @param array $extParams Parameters available to plugins. Each array key will be the PHP variable name, and the array value will be the variable value.
5582
-     * @return boolean|array
5582
+     * @return false|null
5583 5583
      */
5584 5584
     public function invokeEvent($evtName, $extParams = array())
5585 5585
     {
@@ -6201,7 +6201,7 @@  discard block
 block discarded – undo
6201 6201
 
6202 6202
     /**
6203 6203
      * @param string $str
6204
-     * @return bool|mixed|string
6204
+     * @return string
6205 6205
      */
6206 6206
     public function atBindFileContent($str = '')
6207 6207
     {
@@ -6258,8 +6258,8 @@  discard block
 block discarded – undo
6258 6258
     }
6259 6259
 
6260 6260
     /**
6261
-     * @param $str
6262
-     * @return bool|string
6261
+     * @param string $str
6262
+     * @return false|string
6263 6263
      */
6264 6264
     public function getExtFromFilename($str)
6265 6265
     {
@@ -6287,7 +6287,7 @@  discard block
 block discarded – undo
6287 6287
      * @param string $text Error message
6288 6288
      * @param string $file File where the error was detected
6289 6289
      * @param string $line Line number within $file
6290
-     * @return boolean
6290
+     * @return boolean|null
6291 6291
      */
6292 6292
     public function phpError($nr, $text, $file, $line)
6293 6293
     {
@@ -6339,7 +6339,7 @@  discard block
 block discarded – undo
6339 6339
      * @param string $text
6340 6340
      * @param string $line
6341 6341
      * @param string $output
6342
-     * @return bool
6342
+     * @return null|boolean
6343 6343
      */
6344 6344
     public function messageQuit(
6345 6345
         $msg = 'unspecified error',
@@ -6782,7 +6782,7 @@  discard block
 block discarded – undo
6782 6782
 
6783 6783
     /**
6784 6784
      * @param string $str
6785
-     * @return bool|mixed|string
6785
+     * @return string
6786 6786
      */
6787 6787
     public function atBindInclude($str = '')
6788 6788
     {
@@ -6834,7 +6834,7 @@  discard block
 block discarded – undo
6834 6834
      * @param $str
6835 6835
      * @param int $flags
6836 6836
      * @param string $encode
6837
-     * @return mixed
6837
+     * @return string
6838 6838
      */
6839 6839
     public function htmlspecialchars($str, $flags = ENT_COMPAT, $encode = '')
6840 6840
     {
@@ -6844,7 +6844,7 @@  discard block
 block discarded – undo
6844 6844
     }
6845 6845
 
6846 6846
     /**
6847
-     * @param $string
6847
+     * @param string $string
6848 6848
      * @param bool $returnData
6849 6849
      * @return bool|mixed
6850 6850
      */
Please login to merge, or discard this patch.
Spacing   +268 added lines, -268 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
      */
229 229
     function __call($method_name, $arguments)
230 230
     {
231
-        include_once(MODX_MANAGER_PATH . 'includes/extenders/deprecated.functions.inc.php');
231
+        include_once(MODX_MANAGER_PATH.'includes/extenders/deprecated.functions.inc.php');
232 232
         if (method_exists($this->old, $method_name)) {
233 233
             $error_type = 1;
234 234
         } else {
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
             $info = debug_backtrace();
247 247
             $m[] = $msg;
248 248
             if (!empty($this->currentSnippet)) {
249
-                $m[] = 'Snippet - ' . $this->currentSnippet;
249
+                $m[] = 'Snippet - '.$this->currentSnippet;
250 250
             } elseif (!empty($this->event->activePlugin)) {
251
-                $m[] = 'Plugin - ' . $this->event->activePlugin;
251
+                $m[] = 'Plugin - '.$this->event->activePlugin;
252 252
             }
253 253
             $m[] = $this->decoded_request_uri;
254
-            $m[] = str_replace('\\', '/', $info[0]['file']) . '(line:' . $info[0]['line'] . ')';
254
+            $m[] = str_replace('\\', '/', $info[0]['file']).'(line:'.$info[0]['line'].')';
255 255
             $msg = implode('<br />', $m);
256 256
             $this->logEvent(0, $error_type, $msg, $title);
257 257
         }
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     {
269 269
         $flag = false;
270 270
         if (is_scalar($connector) && !empty($connector) && isset($this->{$connector}) && $this->{$connector} instanceof DBAPI) {
271
-            $flag = (bool)$this->{$connector}->conn;
271
+            $flag = (bool) $this->{$connector}->conn;
272 272
         }
273 273
 
274 274
         return $flag;
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         }
297 297
         if (!$out && $flag) {
298 298
             $extname = trim(str_replace(array('..', '/', '\\'), '', strtolower($extname)));
299
-            $filename = MODX_MANAGER_PATH . "includes/extenders/ex_{$extname}.inc.php";
299
+            $filename = MODX_MANAGER_PATH."includes/extenders/ex_{$extname}.inc.php";
300 300
             $out = is_file($filename) ? include $filename : false;
301 301
         }
302 302
         if ($out && !in_array($extname, $this->extensions)) {
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
     {
316 316
         list ($usec, $sec) = explode(' ', microtime());
317 317
 
318
-        return ((float)$usec + (float)$sec);
318
+        return ((float) $usec + (float) $sec);
319 319
     }
320 320
 
321 321
     /**
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             // append the redirect count string to the url
340 340
             $currentNumberOfRedirects = isset ($_REQUEST['err']) ? $_REQUEST['err'] : 0;
341 341
             if ($currentNumberOfRedirects > 3) {
342
-                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>' . $url . '</i></p>');
342
+                $this->messageQuit('Redirection attempt failed - please ensure the document you\'re trying to redirect to exists. <p>Redirection URL: <i>'.$url.'</i></p>');
343 343
             } else {
344 344
                 $currentNumberOfRedirects += 1;
345 345
                 if (strpos($url, "?") > 0) {
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
             }
351 351
         }
352 352
         if ($type == 'REDIRECT_REFRESH') {
353
-            $header = 'Refresh: 0;URL=' . $url;
353
+            $header = 'Refresh: 0;URL='.$url;
354 354
         } elseif ($type == 'REDIRECT_META') {
355
-            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=' . $url . '" />';
355
+            $header = '<META HTTP-EQUIV="Refresh" CONTENT="0; URL='.$url.'" />';
356 356
             echo $header;
357 357
             exit;
358 358
         } elseif ($type == 'REDIRECT_HEADER' || empty ($type)) {
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
             global $base_url, $site_url;
361 361
             if (substr($url, 0, strlen($base_url)) == $base_url) {
362 362
                 // append $site_url to make it work with Location:
363
-                $url = $site_url . substr($url, strlen($base_url));
363
+                $url = $site_url.substr($url, strlen($base_url));
364 364
             }
365 365
             if (strpos($url, "\n") === false) {
366
-                $header = 'Location: ' . $url;
366
+                $header = 'Location: '.$url;
367 367
             } else {
368 368
                 $this->messageQuit('No newline allowed in redirect url.');
369 369
             }
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 
478 478
     private function recoverySiteCache()
479 479
     {
480
-        $site_cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
481
-        $site_cache_path = $site_cache_dir . 'siteCache.idx.php';
480
+        $site_cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
481
+        $site_cache_path = $site_cache_dir.'siteCache.idx.php';
482 482
 
483 483
         if (is_file($site_cache_path)) {
484 484
             include($site_cache_path);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
             return;
488 488
         }
489 489
 
490
-        include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
490
+        include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
491 491
         $cache = new synccache();
492 492
         $cache->setCachepath($site_cache_dir);
493 493
         $cache->setReport(false);
@@ -539,8 +539,8 @@  discard block
 block discarded – undo
539 539
                 $this->invokeEvent("OnBeforeManagerPageInit");
540 540
             }
541 541
 
542
-            if (isset ($_SESSION[$usrType . 'UsrConfigSet'])) {
543
-                $usrSettings = &$_SESSION[$usrType . 'UsrConfigSet'];
542
+            if (isset ($_SESSION[$usrType.'UsrConfigSet'])) {
543
+                $usrSettings = &$_SESSION[$usrType.'UsrConfigSet'];
544 544
             } else {
545 545
                 if ($usrType == 'web') {
546 546
                     $from = $tbl_web_user_settings;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
                     $usrSettings[$row['setting_name']] = $row['setting_value'];
561 561
                 }
562 562
                 if (isset ($usrType)) {
563
-                    $_SESSION[$usrType . 'UsrConfigSet'] = $usrSettings;
563
+                    $_SESSION[$usrType.'UsrConfigSet'] = $usrSettings;
564 564
                 } // store user settings in session
565 565
             }
566 566
         }
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
         $suf = $this->config['friendly_url_suffix'];
707 707
         $pre = preg_quote($pre, '/');
708 708
         $suf = preg_quote($suf, '/');
709
-        if ($pre && preg_match('@^' . $pre . '(.*)$@', $q, $_)) {
709
+        if ($pre && preg_match('@^'.$pre.'(.*)$@', $q, $_)) {
710 710
             $q = $_[1];
711 711
         }
712
-        if ($suf && preg_match('@(.*)' . $suf . '$@', $q, $_)) {
712
+        if ($suf && preg_match('@(.*)'.$suf.'$@', $q, $_)) {
713 713
             $q = $_[1];
714 714
         }
715 715
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
                 $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
733 733
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
734 734
             if ($this->config['use_alias_path'] == 1) {
735
-                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q,
735
+                if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir.'/'.$q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q,
736 736
                                 $this->getChildIds($this->documentListing[$this->virtualDir],
737 737
                                     1))) || ($this->virtualDir == '' && in_array($q, $this->getChildIds(0, 1))))) {
738 738
                     $this->documentMethod = 'id';
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
      */
773 773
     public function getHashFile($key)
774 774
     {
775
-        return $this->getCacheFolder() . "docid_" . $key . ".pageCache.php";
775
+        return $this->getCacheFolder()."docid_".$key.".pageCache.php";
776 776
     }
777 777
 
778 778
     /**
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
                 // Sort GET parameters so that the order of parameters on the HTTP request don't affect the generated cache ID.
792 792
                 $params = $_GET;
793 793
                 ksort($params);
794
-                $hash .= '_' . md5(http_build_query($params));
794
+                $hash .= '_'.md5(http_build_query($params));
795 795
             }
796 796
         }
797 797
         $evtOut = $this->invokeEvent("OnMakePageCacheKey", array("hash" => $hash, "id" => $id, 'params' => $params));
@@ -940,12 +940,12 @@  discard block
 block discarded – undo
940 940
         if ($js = $this->getRegisteredClientStartupScripts()) {
941 941
             // change to just before closing </head>
942 942
             // $this->documentContent = preg_replace("/(<head[^>]*>)/i", "\\1\n".$js, $this->documentContent);
943
-            $this->documentOutput = preg_replace("/(<\/head>)/i", $js . "\n\\1", $this->documentOutput);
943
+            $this->documentOutput = preg_replace("/(<\/head>)/i", $js."\n\\1", $this->documentOutput);
944 944
         }
945 945
 
946 946
         // Insert jscripts & html block into template - template must have a </body> tag
947 947
         if ($js = $this->getRegisteredClientScripts()) {
948
-            $this->documentOutput = preg_replace("/(<\/body>)/i", $js . "\n\\1", $this->documentOutput);
948
+            $this->documentOutput = preg_replace("/(<\/body>)/i", $js."\n\\1", $this->documentOutput);
949 949
         }
950 950
         // End fix by sirlancelot
951 951
 
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
         // send out content-type and content-disposition headers
957 957
         if (IN_PARSER_MODE == "true") {
958 958
             $type = !empty ($this->contentTypes[$this->documentIdentifier]) ? $this->contentTypes[$this->documentIdentifier] : "text/html";
959
-            header('Content-Type: ' . $type . '; charset=' . $this->config['modx_charset']);
959
+            header('Content-Type: '.$type.'; charset='.$this->config['modx_charset']);
960 960
             //            if (($this->documentIdentifier == $this->config['error_page']) || $redirect_error)
961 961
             //                header('HTTP/1.0 404 Not Found');
962 962
             if (!$this->checkPreview() && $this->documentObject['content_dispo'] == 1) {
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
                     $name = preg_replace('|-+|', '-', $name);
975 975
                     $name = trim($name, '-');
976 976
                 }
977
-                $header = 'Content-Disposition: attachment; filename=' . $name;
977
+                $header = 'Content-Disposition: attachment; filename='.$name;
978 978
                 header($header);
979 979
             }
980 980
         }
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 
983 983
         $stats = $this->getTimerStats($this->tstart);
984 984
 
985
-        $out =& $this->documentOutput;
985
+        $out = & $this->documentOutput;
986 986
         $out = str_replace("[^q^]", $stats['queries'], $out);
987 987
         $out = str_replace("[^qt^]", $stats['queryTime'], $out);
988 988
         $out = str_replace("[^p^]", $stats['phpTime'], $out);
@@ -1021,19 +1021,19 @@  discard block
 block discarded – undo
1021 1021
                 $sc .= sprintf("%s. %s (%s)<br>", $s, $sname, sprintf("%2.2f ms", $t)); // currentSnippet
1022 1022
                 $tt += $t;
1023 1023
             }
1024
-            echo "<fieldset><legend><b>Snippets</b> (" . count($this->snippetsTime) . " / " . sprintf("%2.2f ms",
1025
-                    $tt) . ")</legend>{$sc}</fieldset><br />";
1024
+            echo "<fieldset><legend><b>Snippets</b> (".count($this->snippetsTime)." / ".sprintf("%2.2f ms",
1025
+                    $tt).")</legend>{$sc}</fieldset><br />";
1026 1026
             echo $this->snippetsCode;
1027 1027
         }
1028 1028
         if ($this->dumpPlugins) {
1029 1029
             $ps = "";
1030 1030
             $tt = 0;
1031 1031
             foreach ($this->pluginsTime as $s => $t) {
1032
-                $ps .= "$s (" . sprintf("%2.2f ms", $t * 1000) . ")<br>";
1032
+                $ps .= "$s (".sprintf("%2.2f ms", $t * 1000).")<br>";
1033 1033
                 $tt += $t;
1034 1034
             }
1035
-            echo "<fieldset><legend><b>Plugins</b> (" . count($this->pluginsTime) . " / " . sprintf("%2.2f ms",
1036
-                    $tt * 1000) . ")</legend>{$ps}</fieldset><br />";
1035
+            echo "<fieldset><legend><b>Plugins</b> (".count($this->pluginsTime)." / ".sprintf("%2.2f ms",
1036
+                    $tt * 1000).")</legend>{$ps}</fieldset><br />";
1037 1037
             echo $this->pluginsCode;
1038 1038
         }
1039 1039
 
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
         $srcTags = explode(',', $tags);
1061 1061
         $repTags = array();
1062 1062
         foreach ($srcTags as $tag) {
1063
-            $repTags[] = '\\' . $tag[0] . '\\' . $tag[1];
1063
+            $repTags[] = '\\'.$tag[0].'\\'.$tag[1];
1064 1064
         }
1065 1065
 
1066 1066
         return array($srcTags, $repTags);
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
         $stats['phpTime'] = sprintf("%2.4f s", $stats['phpTime']);
1084 1084
         $stats['source'] = $this->documentGenerated == 1 ? "database" : "cache";
1085 1085
         $stats['queries'] = isset ($this->executedQueries) ? $this->executedQueries : 0;
1086
-        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024) . " mb";
1086
+        $stats['phpMemory'] = (memory_get_peak_usage(true) / 1024 / 1024)." mb";
1087 1087
 
1088 1088
         return $stats;
1089 1089
     }
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
     {
1117 1117
         $cacheRefreshTime = 0;
1118 1118
         $recent_update = 0;
1119
-        @include(MODX_BASE_PATH . $this->getCacheFolder() . 'sitePublishing.idx.php');
1119
+        @include(MODX_BASE_PATH.$this->getCacheFolder().'sitePublishing.idx.php');
1120 1120
         $this->recentUpdate = $recent_update;
1121 1121
 
1122 1122
         $timeNow = $_SERVER['REQUEST_TIME'] + $this->config['server_offset_time'];
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
                 }
1171 1171
 
1172 1172
                 $docObjSerial = serialize($this->documentObject);
1173
-                $cacheContent = $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
1174
-                $page_cache_path = MODX_BASE_PATH . $this->getHashFile($this->cacheKey);
1173
+                $cacheContent = $docObjSerial."<!--__MODxCacheSpliter__-->".$this->documentContent;
1174
+                $page_cache_path = MODX_BASE_PATH.$this->getHashFile($this->cacheKey);
1175 1175
                 file_put_contents($page_cache_path, "<?php die('Unauthorized access.'); ?>$cacheContent");
1176 1176
             }
1177 1177
         }
@@ -1231,7 +1231,7 @@  discard block
 block discarded – undo
1231 1231
         $pos[']]>'] = strpos($content, ']]>');
1232 1232
 
1233 1233
         if ($pos['<![CDATA['] !== false && $pos[']]>'] !== false) {
1234
-            $content = substr($content, 0, $pos['<![CDATA[']) . substr($content, $pos[']]>'] + 3);
1234
+            $content = substr($content, 0, $pos['<![CDATA[']).substr($content, $pos[']]>'] + 3);
1235 1235
         }
1236 1236
 
1237 1237
         $lp = explode($left, $content);
@@ -1361,8 +1361,8 @@  discard block
 block discarded – undo
1361 1361
             }
1362 1362
 
1363 1363
             if (is_array($value)) {
1364
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.format.inc.php');
1365
-                include_once(MODX_MANAGER_PATH . 'includes/tmplvars.commands.inc.php');
1364
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.format.inc.php');
1365
+                include_once(MODX_MANAGER_PATH.'includes/tmplvars.commands.inc.php');
1366 1366
                 $value = getTVDisplayFormat($value[0], $value[1], $value[2], $value[3], $value[4]);
1367 1367
             }
1368 1368
 
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
             if (strpos($content, $s) !== false) {
1375 1375
                 $content = str_replace($s, $value, $content);
1376 1376
             } elseif ($this->debug) {
1377
-                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1377
+                $this->addLog('mergeDocumentContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1378 1378
             }
1379 1379
         }
1380 1380
 
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
             if (strpos($content, $s) !== false) {
1544 1544
                 $content = str_replace($s, $value, $content);
1545 1545
             } elseif ($this->debug) {
1546
-                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1546
+                $this->addLog('mergeSettingsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1547 1547
             }
1548 1548
         }
1549 1549
 
@@ -1597,7 +1597,7 @@  discard block
 block discarded – undo
1597 1597
             }
1598 1598
 
1599 1599
             $value = $this->parseText($value, $params); // parse local scope placeholers for ConditionalTags
1600
-            $value = $this->mergePlaceholderContent($value, $params);  // parse page global placeholers
1600
+            $value = $this->mergePlaceholderContent($value, $params); // parse page global placeholers
1601 1601
             if ($this->config['enable_at_syntax']) {
1602 1602
                 $value = $this->mergeConditionalTagsContent($value);
1603 1603
             }
@@ -1613,7 +1613,7 @@  discard block
 block discarded – undo
1613 1613
             if (strpos($content, $s) !== false) {
1614 1614
                 $content = str_replace($s, $value, $content);
1615 1615
             } elseif ($this->debug) {
1616
-                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1616
+                $this->addLog('mergeChunkContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1617 1617
             }
1618 1618
         }
1619 1619
 
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
             if (strpos($content, $s) !== false) {
1674 1674
                 $content = str_replace($s, $value, $content);
1675 1675
             } elseif ($this->debug) {
1676
-                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1676
+                $this->addLog('mergePlaceholderContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1677 1677
             }
1678 1678
         }
1679 1679
 
@@ -1694,7 +1694,7 @@  discard block
 block discarded – undo
1694 1694
         $elseiftag = '<@ELSEIF:',
1695 1695
         $elsetag = '<@ELSE>',
1696 1696
         $endiftag = '<@ENDIF>'
1697
-    ) {
1697
+    ){
1698 1698
         if (strpos($content, '@IF') !== false) {
1699 1699
             $content = $this->_prepareCTag($content, $iftag, $elseiftag, $elsetag, $endiftag);
1700 1700
         }
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
             return $content;
1704 1704
         }
1705 1705
 
1706
-        $sp = '#' . md5('ConditionalTags' . $_SERVER['REQUEST_TIME']) . '#';
1706
+        $sp = '#'.md5('ConditionalTags'.$_SERVER['REQUEST_TIME']).'#';
1707 1707
         $content = str_replace(array('<?php', '<?=', '<?', '?>'), array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"),
1708 1708
             $content);
1709 1709
 
@@ -1715,7 +1715,7 @@  discard block
 block discarded – undo
1715 1715
             }
1716 1716
             list($cmd, $text) = explode('>', $split, 2);
1717 1717
             $cmd = str_replace("'", "\'", $cmd);
1718
-            $content .= "<?php if(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1718
+            $content .= "<?php if(\$this->_parseCTagCMD('".$cmd."')): ?>";
1719 1719
             $content .= $text;
1720 1720
         }
1721 1721
         $pieces = explode('<@ELSEIF:', $content);
@@ -1726,13 +1726,13 @@  discard block
 block discarded – undo
1726 1726
             }
1727 1727
             list($cmd, $text) = explode('>', $split, 2);
1728 1728
             $cmd = str_replace("'", "\'", $cmd);
1729
-            $content .= "<?php elseif(\$this->_parseCTagCMD('" . $cmd . "')): ?>";
1729
+            $content .= "<?php elseif(\$this->_parseCTagCMD('".$cmd."')): ?>";
1730 1730
             $content .= $text;
1731 1731
         }
1732 1732
 
1733 1733
         $content = str_replace(array('<@ELSE>', '<@ENDIF>'), array('<?php else:?>', '<?php endif;?>'), $content);
1734 1734
         ob_start();
1735
-        $content = eval('?>' . $content);
1735
+        $content = eval('?>'.$content);
1736 1736
         $content = ob_get_clean();
1737 1737
         $content = str_replace(array("{$sp}b", "{$sp}p", "{$sp}s", "{$sp}e"), array('<?php', '<?=', '<?', '?>'),
1738 1738
             $content);
@@ -1754,7 +1754,7 @@  discard block
 block discarded – undo
1754 1754
         $elseiftag = '<@ELSEIF:',
1755 1755
         $elsetag = '<@ELSE>',
1756 1756
         $endiftag = '<@ENDIF>'
1757
-    ) {
1757
+    ){
1758 1758
         if (strpos($content, '<!--@IF ') !== false) {
1759 1759
             $content = str_replace('<!--@IF ', $iftag, $content);
1760 1760
         } // for jp
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
         $matches = $this->getTagsFromContent($content, $left, $right);
1865 1865
         if (!empty($matches)) {
1866 1866
             foreach ($matches[0] as $i => $v) {
1867
-                $addBreakMatches[$i] = $v . "\n";
1867
+                $addBreakMatches[$i] = $v."\n";
1868 1868
             }
1869 1869
             $content = str_replace($addBreakMatches, '', $content);
1870 1870
             if (strpos($content, $left) !== false) {
@@ -1899,7 +1899,7 @@  discard block
 block discarded – undo
1899 1899
             if (strpos($content, $s) !== false) {
1900 1900
                 $content = str_replace($s, $v, $content);
1901 1901
             } elseif ($this->debug) {
1902
-                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'] . $s, 2);
1902
+                $this->addLog('ignoreCommentedTagsContent parse error', $_SERVER['REQUEST_URI'].$s, 2);
1903 1903
             }
1904 1904
         }
1905 1905
 
@@ -1966,7 +1966,7 @@  discard block
 block discarded – undo
1966 1966
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Plugin',
1967 1967
                     $error_info['message'], $error_info['line'], $msg);
1968 1968
                 if ($this->isBackend()) {
1969
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>' . $msg . '</p>');
1969
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information.<p>'.$msg.'</p>');
1970 1970
                 }
1971 1971
             }
1972 1972
         } else {
@@ -2013,7 +2013,7 @@  discard block
 block discarded – undo
2013 2013
                 $this->messageQuit('PHP Parse Error', '', true, $error_info['type'], $error_info['file'], 'Snippet',
2014 2014
                     $error_info['message'], $error_info['line'], $echo);
2015 2015
                 if ($this->isBackend()) {
2016
-                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>' . $echo . $return . '</p>');
2016
+                    $this->event->alert('An error occurred while loading. Please see the event log for more information<p>'.$echo.$return.'</p>');
2017 2017
                 }
2018 2018
             }
2019 2019
         }
@@ -2021,7 +2021,7 @@  discard block
 block discarded – undo
2021 2021
         if (is_array($return) || is_object($return)) {
2022 2022
             return $return;
2023 2023
         } else {
2024
-            return $echo . $return;
2024
+            return $echo.$return;
2025 2025
         }
2026 2026
     }
2027 2027
 
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
                 if (strpos($content, $s) !== false) {
2062 2062
                     $content = str_replace($s, $value, $content);
2063 2063
                 } elseif ($this->debug) {
2064
-                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2064
+                    $this->addLog('evalSnippetsSGVar parse error', $_SERVER['REQUEST_URI'].$s, 2);
2065 2065
                 }
2066 2066
                 continue;
2067 2067
             }
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
             if (strpos($content, $s) !== false) {
2074 2074
                 $content = str_replace($s, $value, $content);
2075 2075
             } elseif ($this->debug) {
2076
-                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'] . $s, 2);
2076
+                $this->addLog('evalSnippets parse error', $_SERVER['REQUEST_URI'].$s, 2);
2077 2077
             }
2078 2078
         }
2079 2079
 
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
             $code = str_replace("\t", '  ', $this->htmlspecialchars($value));
2167 2167
             $piece = str_replace("\t", '  ', $this->htmlspecialchars($piece));
2168 2168
             $print_r_params = str_replace("\t", '  ',
2169
-                $this->htmlspecialchars('$modx->event->params = ' . print_r($params, true)));
2169
+                $this->htmlspecialchars('$modx->event->params = '.print_r($params, true)));
2170 2170
             $this->snippetsCode .= sprintf('<fieldset style="margin:1em;"><legend><b>%s</b>(%s)</legend><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">[[%s]]</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre><pre style="white-space: pre-wrap;background-color:#fff;width:90%%;">%s</pre></fieldset>',
2171 2171
                 $snippetObject['name'], $eventtime, $piece, $print_r_params, $code);
2172 2172
             $this->snippetsTime[] = array('sname' => $key, 'time' => $eventtime);
@@ -2415,7 +2415,7 @@  discard block
 block discarded – undo
2415 2415
             $rs = $this->db->select('name,snippet,properties', '[+prefix+]site_snippets', $where);
2416 2416
             $count = $this->db->getRecordCount($rs);
2417 2417
             if (1 < $count) {
2418
-                exit('Error $modx->_getSnippetObject()' . $snip_name);
2418
+                exit('Error $modx->_getSnippetObject()'.$snip_name);
2419 2419
             }
2420 2420
             if ($count) {
2421 2421
                 $row = $this->db->getRow($rs);
@@ -2444,13 +2444,13 @@  discard block
 block discarded – undo
2444 2444
         $suff = $this->config['friendly_url_suffix'];
2445 2445
 
2446 2446
         return str_replace(array(
2447
-            '.xml' . $suff,
2448
-            '.rss' . $suff,
2449
-            '.js' . $suff,
2450
-            '.css' . $suff,
2451
-            '.txt' . $suff,
2452
-            '.json' . $suff,
2453
-            '.pdf' . $suff
2447
+            '.xml'.$suff,
2448
+            '.rss'.$suff,
2449
+            '.js'.$suff,
2450
+            '.css'.$suff,
2451
+            '.txt'.$suff,
2452
+            '.json'.$suff,
2453
+            '.pdf'.$suff
2454 2454
         ), array('.xml', '.rss', '.js', '.css', '.txt', '.json', '.pdf'), $text);
2455 2455
     }
2456 2456
 
@@ -2483,7 +2483,7 @@  discard block
 block discarded – undo
2483 2483
                 $suff = '/';
2484 2484
             }
2485 2485
 
2486
-            $url = ($dir != '' ? $dir . '/' : '') . $pre . $alias . $suff;
2486
+            $url = ($dir != '' ? $dir.'/' : '').$pre.$alias.$suff;
2487 2487
         }
2488 2488
 
2489 2489
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -2521,7 +2521,7 @@  discard block
 block discarded – undo
2521 2521
                 $ids = implode(',', array_unique($match['1']));
2522 2522
                 if ($ids) {
2523 2523
                     $res = $this->db->select("id,alias,isfolder,parent,alias_visible",
2524
-                        $this->getFullTableName('site_content'), "id IN (" . $ids . ") AND isfolder = '0'");
2524
+                        $this->getFullTableName('site_content'), "id IN (".$ids.") AND isfolder = '0'");
2525 2525
                     while ($row = $this->db->getRow($res)) {
2526 2526
                         if ($this->config['use_alias_path'] == '1' && $row['parent'] != 0) {
2527 2527
                             $parent = $row['parent'];
@@ -2532,7 +2532,7 @@  discard block
 block discarded – undo
2532 2532
                                 $parent = $this->aliasListing[$parent]['parent'];
2533 2533
                             }
2534 2534
 
2535
-                            $aliases[$row['id']] = $path . '/' . $row['alias'];
2535
+                            $aliases[$row['id']] = $path.'/'.$row['alias'];
2536 2536
                         } else {
2537 2537
                             $aliases[$row['id']] = $row['alias'];
2538 2538
                         }
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
             $pref = $this->config['friendly_url_prefix'];
2546 2546
             $suff = $this->config['friendly_url_suffix'];
2547 2547
             $documentSource = preg_replace_callback($in,
2548
-                function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2548
+                function($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2549 2549
                     $modx = evolutionCMS();
2550 2550
                     $thealias = $aliases[$m[1]];
2551 2551
                     $thefolder = $isfolder[$m[1]];
@@ -2564,7 +2564,7 @@  discard block
 block discarded – undo
2564 2564
 
2565 2565
         } else {
2566 2566
             $in = '!\[\~([0-9]+)\~\]!is';
2567
-            $out = "index.php?id=" . '\1';
2567
+            $out = "index.php?id=".'\1';
2568 2568
             $documentSource = preg_replace($in, $out, $documentSource);
2569 2569
         }
2570 2570
 
@@ -2585,7 +2585,7 @@  discard block
 block discarded – undo
2585 2585
         $scheme = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
2586 2586
         $len_base_url = strlen($this->config['base_url']);
2587 2587
 
2588
-        $url_path = $q;//LANG
2588
+        $url_path = $q; //LANG
2589 2589
 
2590 2590
         if (substr($url_path, 0, $len_base_url) === $this->config['base_url']) {
2591 2591
             $url_path = substr($url_path, $len_base_url);
@@ -2597,7 +2597,7 @@  discard block
 block discarded – undo
2597 2597
             $strictURL = substr($strictURL, $len_base_url);
2598 2598
         }
2599 2599
         $http_host = $_SERVER['HTTP_HOST'];
2600
-        $requestedURL = "{$scheme}://{$http_host}" . '/' . $q; //LANG
2600
+        $requestedURL = "{$scheme}://{$http_host}".'/'.$q; //LANG
2601 2601
 
2602 2602
         $site_url = $this->config['site_url'];
2603 2603
 
@@ -2614,7 +2614,7 @@  discard block
 block discarded – undo
2614 2614
                 }
2615 2615
                 if ($this->config['base_url'] != $_SERVER['REQUEST_URI']) {
2616 2616
                     if (empty($_POST)) {
2617
-                        if (($this->config['base_url'] . '?' . $qstring) != $_SERVER['REQUEST_URI']) {
2617
+                        if (($this->config['base_url'].'?'.$qstring) != $_SERVER['REQUEST_URI']) {
2618 2618
                             $this->sendRedirect($url, 0, 'REDIRECT_HEADER', 'HTTP/1.0 301 Moved Permanently');
2619 2619
                             exit(0);
2620 2620
                         }
@@ -2679,7 +2679,7 @@  discard block
 block discarded – undo
2679 2679
                 $docgrp = implode(",", $docgrp);
2680 2680
             }
2681 2681
             // get document
2682
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2682
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
2683 2683
             $rs = $this->db->select('sc.*', "{$tblsc} sc
2684 2684
                 LEFT JOIN {$tbldg} dg ON dg.document = sc.id", "sc.{$method} = '{$identifier}' AND ({$access})", "", 1);
2685 2685
             if ($this->db->getRecordCount($rs) < 1) {
@@ -2717,9 +2717,9 @@  discard block
 block discarded – undo
2717 2717
             if ($documentObject['template']) {
2718 2718
                 // load TVs and merge with document - Orig by Apodigm - Docvars
2719 2719
                 $rs = $this->db->select("tv.*, IF(tvc.value!='',tvc.value,tv.default_text) as value",
2720
-                    $this->getFullTableName("site_tmplvars") . " tv
2721
-                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates") . " tvtpl ON tvtpl.tmplvarid = tv.id
2722
-                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues") . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'",
2720
+                    $this->getFullTableName("site_tmplvars")." tv
2721
+                INNER JOIN " . $this->getFullTableName("site_tmplvar_templates")." tvtpl ON tvtpl.tmplvarid = tv.id
2722
+                LEFT JOIN " . $this->getFullTableName("site_tmplvar_contentvalues")." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$documentObject['id']}'",
2723 2723
                     "tvtpl.templateid = '{$documentObject['template']}'");
2724 2724
                 $tmplvars = array();
2725 2725
                 while ($row = $this->db->getRow($rs)) {
@@ -2766,7 +2766,7 @@  discard block
 block discarded – undo
2766 2766
                 $st = md5($source);
2767 2767
             }
2768 2768
             if ($this->dumpSnippets == 1) {
2769
-                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS " . ($i + 1) . "</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2769
+                $this->snippetsCode .= "<fieldset><legend><b style='color: #821517;'>PARSE PASS ".($i + 1)."</b></legend><p>The following snippets (if any) were parsed during this pass.</p>";
2770 2770
             }
2771 2771
 
2772 2772
             // invoke OnParseDocument event
@@ -2853,7 +2853,7 @@  discard block
 block discarded – undo
2853 2853
 
2854 2854
             // Check use_alias_path and check if $this->virtualDir is set to anything, then parse the path
2855 2855
             if ($this->config['use_alias_path'] == 1) {
2856
-                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir . '/' : '') . $this->documentIdentifier;
2856
+                $alias = (strlen($this->virtualDir) > 0 ? $this->virtualDir.'/' : '').$this->documentIdentifier;
2857 2857
                 if (isset($this->documentListing[$alias])) {
2858 2858
                     $this->documentIdentifier = $this->documentListing[$alias];
2859 2859
                 } else {
@@ -2916,7 +2916,7 @@  discard block
 block discarded – undo
2916 2916
                     $docAlias = $this->db->escape($this->documentIdentifier);
2917 2917
                     $rs = $this->db->select('id', $this->getFullTableName('site_content'),
2918 2918
                         "deleted=0 and alias='{$docAlias}'");
2919
-                    $this->documentIdentifier = (int)$this->db->getValue($rs);
2919
+                    $this->documentIdentifier = (int) $this->db->getValue($rs);
2920 2920
                 }
2921 2921
             }
2922 2922
             $this->documentMethod = 'id';
@@ -2970,7 +2970,7 @@  discard block
 block discarded – undo
2970 2970
                 $_REQUEST[$n] = $_GET[$n] = $v;
2971 2971
             }
2972 2972
         }
2973
-        $_SERVER['PHP_SELF'] = $this->config['base_url'] . $qp['path'];
2973
+        $_SERVER['PHP_SELF'] = $this->config['base_url'].$qp['path'];
2974 2974
         $this->q = $qp['path'];
2975 2975
 
2976 2976
         return $qp['path'];
@@ -3066,7 +3066,7 @@  discard block
 block discarded – undo
3066 3066
             $this->sendErrorPage();
3067 3067
         } else {
3068 3068
             // Inculde the necessary files to check document permissions
3069
-            include_once(MODX_MANAGER_PATH . 'processors/user_documents_permissions.class.php');
3069
+            include_once(MODX_MANAGER_PATH.'processors/user_documents_permissions.class.php');
3070 3070
             $udperms = new udperms();
3071 3071
             $udperms->user = $this->getLoginUserID();
3072 3072
             $udperms->document = $this->documentIdentifier;
@@ -3120,7 +3120,7 @@  discard block
 block discarded – undo
3120 3120
         while ($id && $height--) {
3121 3121
             $thisid = $id;
3122 3122
             if ($this->config['aliaslistingfolder'] == 1) {
3123
-                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM " . $this->getFullTableName("site_content") . " WHERE `id` = '{$id}' LIMIT 0,1");
3123
+                $id = isset($this->aliasListing[$id]['parent']) ? $this->aliasListing[$id]['parent'] : $this->db->getValue("SELECT `parent` FROM ".$this->getFullTableName("site_content")." WHERE `id` = '{$id}' LIMIT 0,1");
3124 3124
                 if (!$id || $id == '0') {
3125 3125
                     break;
3126 3126
                 }
@@ -3174,15 +3174,15 @@  discard block
 block discarded – undo
3174 3174
         if ($this->config['aliaslistingfolder'] == 1) {
3175 3175
 
3176 3176
             $res = $this->db->select("id,alias,isfolder,parent", $this->getFullTableName('site_content'),
3177
-                "parent IN (" . $id . ") AND deleted = '0'");
3177
+                "parent IN (".$id.") AND deleted = '0'");
3178 3178
             $idx = array();
3179 3179
             while ($row = $this->db->getRow($res)) {
3180 3180
                 $pAlias = '';
3181 3181
                 if (isset($this->aliasListing[$row['parent']])) {
3182
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'] . '/' : '';
3183
-                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'] . '/' : '';
3182
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['path']) ? $this->aliasListing[$row['parent']]['path'].'/' : '';
3183
+                    $pAlias .= !empty($this->aliasListing[$row['parent']]['alias']) ? $this->aliasListing[$row['parent']]['alias'].'/' : '';
3184 3184
                 };
3185
-                $children[$pAlias . $row['alias']] = $row['id'];
3185
+                $children[$pAlias.$row['alias']] = $row['id'];
3186 3186
                 if ($row['isfolder'] == 1) {
3187 3187
                     $idx[] = $row['id'];
3188 3188
                 }
@@ -3215,7 +3215,7 @@  discard block
 block discarded – undo
3215 3215
                 $depth--;
3216 3216
 
3217 3217
                 foreach ($documentMap_cache[$id] as $childId) {
3218
-                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '') . $this->aliasListing[$childId]['alias'];
3218
+                    $pkey = (strlen($this->aliasListing[$childId]['path']) ? "{$this->aliasListing[$childId]['path']}/" : '').$this->aliasListing[$childId]['alias'];
3219 3219
                     if (!strlen($pkey)) {
3220 3220
                         $pkey = "{$childId}";
3221 3221
                     }
@@ -3245,7 +3245,7 @@  discard block
 block discarded – undo
3245 3245
         if (substr(strtolower($url), 0, 11) == "javascript:") {
3246 3246
             $fnc = substr($url, 11);
3247 3247
         } elseif ($url) {
3248
-            $fnc = "window.location.href='" . addslashes($url) . "';";
3248
+            $fnc = "window.location.href='".addslashes($url)."';";
3249 3249
         } else {
3250 3250
             $fnc = "history.back(-1);";
3251 3251
         }
@@ -3254,7 +3254,7 @@  discard block
 block discarded – undo
3254 3254
             <meta http-equiv=\"Content-Type\" content=\"text/html; charset={$modx_manager_charset};\">
3255 3255
             <script>
3256 3256
                 function __alertQuit() {
3257
-                    alert('" . addslashes($msg) . "');
3257
+                    alert('".addslashes($msg)."');
3258 3258
                     {$fnc}
3259 3259
                 }
3260 3260
                 window.setTimeout('__alertQuit();',100);
@@ -3276,10 +3276,10 @@  discard block
 block discarded – undo
3276 3276
         $state = 0;
3277 3277
         $pms = $_SESSION['mgrPermissions'];
3278 3278
         if ($pms) {
3279
-            $state = ((bool)$pms[$pm] === true);
3279
+            $state = ((bool) $pms[$pm] === true);
3280 3280
         }
3281 3281
 
3282
-        return (int)$state;
3282
+        return (int) $state;
3283 3283
     }
3284 3284
 
3285 3285
     /**
@@ -3292,8 +3292,8 @@  discard block
 block discarded – undo
3292 3292
      */
3293 3293
     public function elementIsLocked($type, $id, $includeThisUser = false)
3294 3294
     {
3295
-        $id = (int)$id;
3296
-        $type = (int)$type;
3295
+        $id = (int) $id;
3296
+        $type = (int) $type;
3297 3297
         if (!$type || !$id) {
3298 3298
             return null;
3299 3299
         }
@@ -3343,7 +3343,7 @@  discard block
 block discarded – undo
3343 3343
             return $lockedElements;
3344 3344
         }
3345 3345
 
3346
-        $type = (int)$type;
3346
+        $type = (int) $type;
3347 3347
         if (isset($lockedElements[$type])) {
3348 3348
             return $lockedElements[$type];
3349 3349
         } else {
@@ -3361,7 +3361,7 @@  discard block
 block discarded – undo
3361 3361
             $this->cleanupExpiredLocks();
3362 3362
 
3363 3363
             $rs = $this->db->select('sid,internalKey,elementType,elementId,lasthit,username',
3364
-                $this->getFullTableName('active_user_locks') . " ul
3364
+                $this->getFullTableName('active_user_locks')." ul
3365 3365
                 LEFT JOIN {$this->getFullTableName('manager_users')} mu on ul.internalKey = mu.id");
3366 3366
             while ($row = $this->db->getRow($rs)) {
3367 3367
                 $this->lockedElements[$row['elementType']][$row['elementId']] = array(
@@ -3384,7 +3384,7 @@  discard block
 block discarded – undo
3384 3384
     public function cleanupExpiredLocks()
3385 3385
     {
3386 3386
         // Clean-up active_user_sessions first
3387
-        $timeout = (int)$this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3387
+        $timeout = (int) $this->config['session_timeout'] < 2 ? 120 : $this->config['session_timeout'] * 60; // session.js pings every 10min, updateMail() in mainMenu pings every minute, so 2min is minimum
3388 3388
         $validSessionTimeLimit = $this->time - $timeout;
3389 3389
         $this->db->delete($this->getFullTableName('active_user_sessions'), "lasthit < {$validSessionTimeLimit}");
3390 3390
 
@@ -3397,7 +3397,7 @@  discard block
 block discarded – undo
3397 3397
             foreach ($rs as $row) {
3398 3398
                 $userSids[] = $row['sid'];
3399 3399
             }
3400
-            $userSids = "'" . implode("','", $userSids) . "'";
3400
+            $userSids = "'".implode("','", $userSids)."'";
3401 3401
             $this->db->delete($this->getFullTableName('active_user_locks'), "sid NOT IN({$userSids})");
3402 3402
         } else {
3403 3403
             $this->db->delete($this->getFullTableName('active_user_locks'));
@@ -3484,8 +3484,8 @@  discard block
 block discarded – undo
3484 3484
     public function lockElement($type, $id)
3485 3485
     {
3486 3486
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3487
-        $type = (int)$type;
3488
-        $id = (int)$id;
3487
+        $type = (int) $type;
3488
+        $id = (int) $id;
3489 3489
         if (!$type || !$id || !$userId) {
3490 3490
             return false;
3491 3491
         }
@@ -3507,8 +3507,8 @@  discard block
 block discarded – undo
3507 3507
     public function unlockElement($type, $id, $includeAllUsers = false)
3508 3508
     {
3509 3509
         $userId = $this->isBackend() && $_SESSION['mgrInternalKey'] ? $_SESSION['mgrInternalKey'] : 0;
3510
-        $type = (int)$type;
3511
-        $id = (int)$id;
3510
+        $type = (int) $type;
3511
+        $id = (int) $id;
3512 3512
         if (!$type || !$id) {
3513 3513
             return false;
3514 3514
         }
@@ -3578,8 +3578,8 @@  discard block
 block discarded – undo
3578 3578
         }
3579 3579
 
3580 3580
         $usertype = $this->isFrontend() ? 1 : 0;
3581
-        $evtid = (int)$evtid;
3582
-        $type = (int)$type;
3581
+        $evtid = (int) $evtid;
3582
+        $type = (int) $type;
3583 3583
 
3584 3584
         // Types: 1 = information, 2 = warning, 3 = error
3585 3585
         if ($type < 1) {
@@ -3601,8 +3601,8 @@  discard block
 block discarded – undo
3601 3601
         if (isset($this->config['send_errormail']) && $this->config['send_errormail'] !== '0') {
3602 3602
             if ($this->config['send_errormail'] <= $type) {
3603 3603
                 $this->sendmail(array(
3604
-                    'subject' => 'MODX System Error on ' . $this->config['site_name'],
3605
-                    'body'    => 'Source: ' . $source . ' - The details of the error could be seen in the MODX system events log.',
3604
+                    'subject' => 'MODX System Error on '.$this->config['site_name'],
3605
+                    'body'    => 'Source: '.$source.' - The details of the error could be seen in the MODX system events log.',
3606 3606
                     'type'    => 'text'
3607 3607
                 ));
3608 3608
             }
@@ -3650,7 +3650,7 @@  discard block
 block discarded – undo
3650 3650
             $p['fromname'] = $userinfo['username'];
3651 3651
         }
3652 3652
         if ($msg === '' && !isset($p['body'])) {
3653
-            $p['body'] = $_SERVER['REQUEST_URI'] . "\n" . $_SERVER['HTTP_USER_AGENT'] . "\n" . $_SERVER['HTTP_REFERER'];
3653
+            $p['body'] = $_SERVER['REQUEST_URI']."\n".$_SERVER['HTTP_USER_AGENT']."\n".$_SERVER['HTTP_REFERER'];
3654 3654
         } elseif (is_string($msg) && 0 < strlen($msg)) {
3655 3655
             $p['body'] = $msg;
3656 3656
         }
@@ -3690,8 +3690,8 @@  discard block
 block discarded – undo
3690 3690
             $files = array();
3691 3691
         }
3692 3692
         foreach ($files as $f) {
3693
-            if (file_exists(MODX_BASE_PATH . $f) && is_file(MODX_BASE_PATH . $f) && is_readable(MODX_BASE_PATH . $f)) {
3694
-                $this->mail->AddAttachment(MODX_BASE_PATH . $f);
3693
+            if (file_exists(MODX_BASE_PATH.$f) && is_file(MODX_BASE_PATH.$f) && is_readable(MODX_BASE_PATH.$f)) {
3694
+                $this->mail->AddAttachment(MODX_BASE_PATH.$f);
3695 3695
             }
3696 3696
         }
3697 3697
         $rs = $this->mail->send();
@@ -3756,7 +3756,7 @@  discard block
 block discarded – undo
3756 3756
         $sort = 'menuindex',
3757 3757
         $dir = 'ASC',
3758 3758
         $fields = 'id, pagetitle, description, parent, alias, menutitle'
3759
-    ) {
3759
+    ){
3760 3760
 
3761 3761
         $cacheKey = md5(print_r(func_get_args(), true));
3762 3762
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
@@ -3766,14 +3766,14 @@  discard block
 block discarded – undo
3766 3766
         $tblsc = $this->getFullTableName("site_content");
3767 3767
         $tbldg = $this->getFullTableName("document_groups");
3768 3768
         // modify field names to use sc. table reference
3769
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3770
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3769
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3770
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3771 3771
         // get document groups for current user
3772 3772
         if ($docgrp = $this->getUserDocGroups()) {
3773 3773
             $docgrp = implode(",", $docgrp);
3774 3774
         }
3775 3775
         // build query
3776
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3776
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3777 3777
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3778 3778
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id",
3779 3779
             "{$sort} {$dir}");
@@ -3799,7 +3799,7 @@  discard block
 block discarded – undo
3799 3799
         $sort = 'menuindex',
3800 3800
         $dir = 'ASC',
3801 3801
         $fields = 'id, pagetitle, description, parent, alias, menutitle'
3802
-    ) {
3802
+    ){
3803 3803
         $cacheKey = md5(print_r(func_get_args(), true));
3804 3804
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
3805 3805
             return $this->tmpCache[__FUNCTION__][$cacheKey];
@@ -3809,14 +3809,14 @@  discard block
 block discarded – undo
3809 3809
         $tbldg = $this->getFullTableName("document_groups");
3810 3810
 
3811 3811
         // modify field names to use sc. table reference
3812
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3813
-        $sort = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3812
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3813
+        $sort = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3814 3814
         // get document groups for current user
3815 3815
         if ($docgrp = $this->getUserDocGroups()) {
3816 3816
             $docgrp = implode(",", $docgrp);
3817 3817
         }
3818 3818
         // build query
3819
-        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3819
+        $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3820 3820
         $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3821 3821
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id",
3822 3822
             "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
@@ -3853,23 +3853,23 @@  discard block
 block discarded – undo
3853 3853
         $sort = 'menuindex',
3854 3854
         $dir = 'ASC',
3855 3855
         $limit = ''
3856
-    ) {
3856
+    ){
3857 3857
 
3858 3858
         $cacheKey = md5(print_r(func_get_args(), true));
3859 3859
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
3860 3860
             return $this->tmpCache[__FUNCTION__][$cacheKey];
3861 3861
         }
3862 3862
 
3863
-        $published = ($published !== 'all') ? 'AND sc.published = ' . $published : '';
3864
-        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = ' . $deleted : '';
3863
+        $published = ($published !== 'all') ? 'AND sc.published = '.$published : '';
3864
+        $deleted = ($deleted !== 'all') ? 'AND sc.deleted = '.$deleted : '';
3865 3865
 
3866 3866
         if ($where != '') {
3867
-            $where = 'AND ' . $where;
3867
+            $where = 'AND '.$where;
3868 3868
         }
3869 3869
 
3870 3870
         // modify field names to use sc. table reference
3871
-        $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3872
-        $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3871
+        $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3872
+        $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3873 3873
 
3874 3874
         // get document groups for current user
3875 3875
         if ($docgrp = $this->getUserDocGroups()) {
@@ -3877,7 +3877,7 @@  discard block
 block discarded – undo
3877 3877
         }
3878 3878
 
3879 3879
         // build query
3880
-        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3880
+        $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3881 3881
 
3882 3882
         $tblsc = $this->getFullTableName('site_content');
3883 3883
         $tbldg = $this->getFullTableName('document_groups');
@@ -3920,7 +3920,7 @@  discard block
 block discarded – undo
3920 3920
         $sort = 'menuindex',
3921 3921
         $dir = 'ASC',
3922 3922
         $limit = ''
3923
-    ) {
3923
+    ){
3924 3924
 
3925 3925
         $cacheKey = md5(print_r(func_get_args(), true));
3926 3926
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
@@ -3940,10 +3940,10 @@  discard block
 block discarded – undo
3940 3940
             return false;
3941 3941
         } else {
3942 3942
             // modify field names to use sc. table reference
3943
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3944
-            $sort = ($sort == '') ? '' : 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3943
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
3944
+            $sort = ($sort == '') ? '' : 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $sort))));
3945 3945
             if ($where != '') {
3946
-                $where = 'AND ' . $where;
3946
+                $where = 'AND '.$where;
3947 3947
             }
3948 3948
 
3949 3949
             $published = ($published !== 'all') ? "AND sc.published = '{$published}'" : '';
@@ -3954,14 +3954,14 @@  discard block
 block discarded – undo
3954 3954
                 $docgrp = implode(',', $docgrp);
3955 3955
             }
3956 3956
 
3957
-            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="' . $_SESSION['mgrRole'] . '" OR sc.privatemgr=0') . (!$docgrp ? '' : ' OR dg.document_group IN (' . $docgrp . ')');
3957
+            $access = ($this->isFrontend() ? 'sc.privateweb=0' : '1="'.$_SESSION['mgrRole'].'" OR sc.privatemgr=0').(!$docgrp ? '' : ' OR dg.document_group IN ('.$docgrp.')');
3958 3958
 
3959 3959
             $tblsc = $this->getFullTableName('site_content');
3960 3960
             $tbldg = $this->getFullTableName('document_groups');
3961 3961
 
3962 3962
             $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3963
-                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',',
3964
-                    $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id",
3963
+                    LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (".implode(',',
3964
+                    $ids).") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id",
3965 3965
                 ($sort ? "{$sort} {$dir}" : ""), $limit);
3966 3966
 
3967 3967
             $resourceArray = $this->db->makeArray($result);
@@ -4067,12 +4067,12 @@  discard block
 block discarded – undo
4067 4067
             $tbldg = $this->getFullTableName("document_groups");
4068 4068
             $activeSql = $active == 1 ? "AND sc.published=1 AND sc.deleted=0" : "";
4069 4069
             // modify field names to use sc. table reference
4070
-            $fields = 'sc.' . implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4070
+            $fields = 'sc.'.implode(',sc.', array_filter(array_map('trim', explode(',', $fields))));
4071 4071
             // get document groups for current user
4072 4072
             if ($docgrp = $this->getUserDocGroups()) {
4073 4073
                 $docgrp = implode(",", $docgrp);
4074 4074
             }
4075
-            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4075
+            $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='".$_SESSION['mgrRole']."' OR sc.privatemgr=0").(!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
4076 4076
             $result = $this->db->select($fields, "{$tblsc} sc LEFT JOIN {$tbldg} dg on dg.document = sc.id",
4077 4077
                 "(sc.id='{$pageid}' {$activeSql}) AND ({$access})", "", 1);
4078 4078
             $pageInfo = $this->db->getRow($result);
@@ -4124,7 +4124,7 @@  discard block
 block discarded – undo
4124 4124
     {
4125 4125
         if ($this->currentSnippet) {
4126 4126
             $tbl = $this->getFullTableName("site_snippets");
4127
-            $rs = $this->db->select('id', $tbl, "name='" . $this->db->escape($this->currentSnippet) . "'", '', 1);
4127
+            $rs = $this->db->select('id', $tbl, "name='".$this->db->escape($this->currentSnippet)."'", '', 1);
4128 4128
             if ($snippetId = $this->db->getValue($rs)) {
4129 4129
                 return $snippetId;
4130 4130
             }
@@ -4152,23 +4152,23 @@  discard block
 block discarded – undo
4152 4152
      */
4153 4153
     public function clearCache($type = '', $report = false)
4154 4154
     {
4155
-        $cache_dir = MODX_BASE_PATH . $this->getCacheFolder();
4155
+        $cache_dir = MODX_BASE_PATH.$this->getCacheFolder();
4156 4156
         if (is_array($type)) {
4157 4157
             foreach ($type as $_) {
4158 4158
                 $this->clearCache($_, $report);
4159 4159
             }
4160 4160
         } elseif ($type == 'full') {
4161
-            include_once(MODX_MANAGER_PATH . 'processors/cache_sync.class.processor.php');
4161
+            include_once(MODX_MANAGER_PATH.'processors/cache_sync.class.processor.php');
4162 4162
             $sync = new synccache();
4163 4163
             $sync->setCachepath($cache_dir);
4164 4164
             $sync->setReport($report);
4165 4165
             $sync->emptyCache();
4166 4166
         } elseif (preg_match('@^[1-9][0-9]*$@', $type)) {
4167 4167
             $key = ($this->config['cache_type'] == 2) ? $this->makePageCacheKey($type) : $type;
4168
-            $file_name = "docid_" . $key . "_*.pageCache.php";
4169
-            $cache_path = $cache_dir . $file_name;
4168
+            $file_name = "docid_".$key."_*.pageCache.php";
4169
+            $cache_path = $cache_dir.$file_name;
4170 4170
             $files = glob($cache_path);
4171
-            $files[] = $cache_dir . "docid_" . $key . ".pageCache.php";
4171
+            $files[] = $cache_dir."docid_".$key.".pageCache.php";
4172 4172
             foreach ($files as $file) {
4173 4173
                 if (!is_file($file)) {
4174 4174
                     continue;
@@ -4176,7 +4176,7 @@  discard block
 block discarded – undo
4176 4176
                 unlink($file);
4177 4177
             }
4178 4178
         } else {
4179
-            $files = glob($cache_dir . '*');
4179
+            $files = glob($cache_dir.'*');
4180 4180
             foreach ($files as $file) {
4181 4181
                 $name = basename($file);
4182 4182
                 if (strpos($name, '.pageCache.php') === false) {
@@ -4245,7 +4245,7 @@  discard block
 block discarded – undo
4245 4245
                         $f_url_suffix = '/';
4246 4246
                     }
4247 4247
 
4248
-                    $alPath = !empty ($al['path']) ? $al['path'] . '/' : '';
4248
+                    $alPath = !empty ($al['path']) ? $al['path'].'/' : '';
4249 4249
 
4250 4250
                     if ($al && $al['alias']) {
4251 4251
                         $alias = $al['alias'];
@@ -4253,7 +4253,7 @@  discard block
 block discarded – undo
4253 4253
 
4254 4254
                 }
4255 4255
 
4256
-                $alias = $alPath . $f_url_prefix . $alias . $f_url_suffix;
4256
+                $alias = $alPath.$f_url_prefix.$alias.$f_url_suffix;
4257 4257
                 $url = "{$alias}{$args}";
4258 4258
             } else {
4259 4259
                 $url = "index.php?id={$id}{$args}";
@@ -4272,7 +4272,7 @@  discard block
 block discarded – undo
4272 4272
             }
4273 4273
 
4274 4274
             //TODO: check to make sure that $site_url incudes the url :port (e.g. :8080)
4275
-            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme . '://' . $_SERVER['HTTP_HOST'] . $host;
4275
+            $host = $scheme == 'full' ? $this->config['site_url'] : $scheme.'://'.$_SERVER['HTTP_HOST'].$host;
4276 4276
         }
4277 4277
 
4278 4278
         //fix strictUrl by Bumkaka
@@ -4281,9 +4281,9 @@  discard block
 block discarded – undo
4281 4281
         }
4282 4282
 
4283 4283
         if ($this->config['xhtml_urls']) {
4284
-            $url = preg_replace("/&(?!amp;)/", "&amp;", $host . $virtualDir . $url);
4284
+            $url = preg_replace("/&(?!amp;)/", "&amp;", $host.$virtualDir.$url);
4285 4285
         } else {
4286
-            $url = $host . $virtualDir . $url;
4286
+            $url = $host.$virtualDir.$url;
4287 4287
         }
4288 4288
 
4289 4289
         $evtOut = $this->invokeEvent('OnMakeDocUrl', array(
@@ -4307,21 +4307,21 @@  discard block
 block discarded – undo
4307 4307
         if (isset($this->aliasListing[$id])) {
4308 4308
             $out = $this->aliasListing[$id];
4309 4309
         } else {
4310
-            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM " . $this->getFullTableName("site_content") . " WHERE id=" . (int)$id);
4310
+            $q = $this->db->query("SELECT id,alias,isfolder,parent FROM ".$this->getFullTableName("site_content")." WHERE id=".(int) $id);
4311 4311
             if ($this->db->getRecordCount($q) == '1') {
4312 4312
                 $q = $this->db->getRow($q);
4313 4313
                 $this->aliasListing[$id] = array(
4314
-                    'id'       => (int)$q['id'],
4314
+                    'id'       => (int) $q['id'],
4315 4315
                     'alias'    => $q['alias'] == '' ? $q['id'] : $q['alias'],
4316
-                    'parent'   => (int)$q['parent'],
4317
-                    'isfolder' => (int)$q['isfolder'],
4316
+                    'parent'   => (int) $q['parent'],
4317
+                    'isfolder' => (int) $q['isfolder'],
4318 4318
                 );
4319 4319
                 if ($this->aliasListing[$id]['parent'] > 0) {
4320 4320
                     //fix alias_path_usage
4321 4321
                     if ($this->config['use_alias_path'] == '1') {
4322 4322
                         //&& $tmp['path'] != '' - fix error slash with epty path
4323 4323
                         $tmp = $this->getAliasListing($this->aliasListing[$id]['parent']);
4324
-                        $this->aliasListing[$id]['path'] = $tmp['path'] . ($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '') . $tmp['alias'] : '');
4324
+                        $this->aliasListing[$id]['path'] = $tmp['path'].($tmp['alias_visible'] ? (($tmp['parent'] > 0 && $tmp['path'] != '') ? '/' : '').$tmp['alias'] : '');
4325 4325
                     } else {
4326 4326
                         $this->aliasListing[$id]['path'] = '';
4327 4327
                     }
@@ -4363,7 +4363,7 @@  discard block
 block discarded – undo
4363 4363
         $out = array();
4364 4364
         if (empty($this->version) || !is_array($this->version)) {
4365 4365
             //include for compatibility modx version < 1.0.10
4366
-            include MODX_MANAGER_PATH . "includes/version.inc.php";
4366
+            include MODX_MANAGER_PATH."includes/version.inc.php";
4367 4367
             $this->version = array();
4368 4368
             $this->version['version'] = isset($modx_version) ? $modx_version : '';
4369 4369
             $this->version['branch'] = isset($modx_branch) ? $modx_branch : '';
@@ -4386,19 +4386,19 @@  discard block
 block discarded – undo
4386 4386
     {
4387 4387
         if (isset ($this->snippetCache[$snippetName])) {
4388 4388
             $snippet = $this->snippetCache[$snippetName];
4389
-            $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4389
+            $properties = !empty($this->snippetCache[$snippetName."Props"]) ? $this->snippetCache[$snippetName."Props"] : '';
4390 4390
         } else { // not in cache so let's check the db
4391
-            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4391
+            $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM ".$this->getFullTableName("site_snippets")." as ss LEFT JOIN ".$this->getFullTableName('site_modules')." as sm on sm.guid=ss.moduleguid WHERE ss.`name`='".$this->db->escape($snippetName)."'  AND ss.disabled=0;";
4392 4392
             $result = $this->db->query($sql);
4393 4393
             if ($this->db->getRecordCount($result) == 1) {
4394 4394
                 $row = $this->db->getRow($result);
4395 4395
                 $snippet = $this->snippetCache[$snippetName] = $row['snippet'];
4396 4396
                 $mergedProperties = array_merge($this->parseProperties($row['properties']),
4397 4397
                     $this->parseProperties($row['sharedproperties']));
4398
-                $properties = $this->snippetCache[$snippetName . "Props"] = json_encode($mergedProperties);
4398
+                $properties = $this->snippetCache[$snippetName."Props"] = json_encode($mergedProperties);
4399 4399
             } else {
4400 4400
                 $snippet = $this->snippetCache[$snippetName] = "return false;";
4401
-                $properties = $this->snippetCache[$snippetName . "Props"] = '';
4401
+                $properties = $this->snippetCache[$snippetName."Props"] = '';
4402 4402
             }
4403 4403
         }
4404 4404
         // load default params/properties
@@ -4502,7 +4502,7 @@  discard block
 block discarded – undo
4502 4502
             if (strpos($tpl, $s) !== false) {
4503 4503
                 $tpl = str_replace($s, $value, $tpl);
4504 4504
             } elseif ($this->debug) {
4505
-                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'] . $s, 2);
4505
+                $this->addLog('parseText parse error', $_SERVER['REQUEST_URI'].$s, 2);
4506 4506
             }
4507 4507
         }
4508 4508
 
@@ -4551,7 +4551,7 @@  discard block
 block discarded – undo
4551 4551
             case 'CODE':
4552 4552
                 break;
4553 4553
             case 'FILE':
4554
-                $template = file_get_contents(MODX_BASE_PATH . $template);
4554
+                $template = file_get_contents(MODX_BASE_PATH.$template);
4555 4555
                 break;
4556 4556
             case 'CHUNK':
4557 4557
                 $template = $this->getChunk($template);
@@ -4585,7 +4585,7 @@  discard block
 block discarded – undo
4585 4585
         if ($mode !== 'formatOnly' && empty($timestamp)) {
4586 4586
             return '-';
4587 4587
         }
4588
-        $timestamp = (int)$timestamp;
4588
+        $timestamp = (int) $timestamp;
4589 4589
 
4590 4590
         switch ($this->config['datetime_format']) {
4591 4591
             case 'YYYY/mm/dd':
@@ -4605,7 +4605,7 @@  discard block
 block discarded – undo
4605 4605
         }
4606 4606
 
4607 4607
         if (empty($mode)) {
4608
-            $strTime = strftime($dateFormat . " %H:%M:%S", $timestamp);
4608
+            $strTime = strftime($dateFormat." %H:%M:%S", $timestamp);
4609 4609
         } elseif ($mode == 'dateOnly') {
4610 4610
             $strTime = strftime($dateFormat, $timestamp);
4611 4611
         } elseif ($mode == 'formatOnly') {
@@ -4660,7 +4660,7 @@  discard block
 block discarded – undo
4660 4660
             $S = 0;
4661 4661
         }
4662 4662
         $timeStamp = mktime($H, $M, $S, $m, $d, $Y);
4663
-        $timeStamp = (int)$timeStamp;
4663
+        $timeStamp = (int) $timeStamp;
4664 4664
 
4665 4665
         return $timeStamp;
4666 4666
     }
@@ -4698,7 +4698,7 @@  discard block
 block discarded – undo
4698 4698
         $tvfields = "*",
4699 4699
         $tvsort = "rank",
4700 4700
         $tvsortdir = "ASC"
4701
-    ) {
4701
+    ){
4702 4702
         $docs = $this->getDocumentChildren($parentid, $published, 0, '*', '', $docsort, $docsortdir);
4703 4703
         if (!$docs) {
4704 4704
             return false;
@@ -4711,7 +4711,7 @@  discard block
 block discarded – undo
4711 4711
                     if ($v === 'value') {
4712 4712
                         unset($_[$i]);
4713 4713
                     } else {
4714
-                        $_[$i] = 'tv.' . $v;
4714
+                        $_[$i] = 'tv.'.$v;
4715 4715
                     }
4716 4716
                 }
4717 4717
                 $fields = implode(',', $_);
@@ -4720,13 +4720,13 @@  discard block
 block discarded – undo
4720 4720
             }
4721 4721
 
4722 4722
             if ($tvsort != '') {
4723
-                $tvsort = 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4723
+                $tvsort = 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $tvsort))));
4724 4724
             }
4725 4725
             if ($tvidnames == "*") {
4726 4726
                 $query = "tv.id<>0";
4727 4727
             } else {
4728
-                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name") . " IN ('" . implode("','",
4729
-                        $tvidnames) . "')";
4728
+                $query = (is_numeric($tvidnames[0]) ? "tv.id" : "tv.name")." IN ('".implode("','",
4729
+                        $tvidnames)."')";
4730 4730
             }
4731 4731
 
4732 4732
             $this->getUserDocGroups();
@@ -4788,7 +4788,7 @@  discard block
 block discarded – undo
4788 4788
         $sortDir = 'ASC',
4789 4789
         $where = '',
4790 4790
         $resultKey = 'id'
4791
-    ) {
4791
+    ){
4792 4792
         $docs = $this->getDocumentChildren($parentid, $published, 0, 'id', $where, $sortBy, $sortDir);
4793 4793
 
4794 4794
         if (!$docs) {
@@ -4883,7 +4883,7 @@  discard block
 block discarded – undo
4883 4883
         $published = 1,
4884 4884
         $sort = 'rank',
4885 4885
         $dir = 'ASC'
4886
-    ) {
4886
+    ){
4887 4887
         $cacheKey = md5(print_r(func_get_args(), true));
4888 4888
         if (isset($this->tmpCache[__FUNCTION__][$cacheKey])) {
4889 4889
             return $this->tmpCache[__FUNCTION__][$cacheKey];
@@ -4908,20 +4908,20 @@  discard block
 block discarded – undo
4908 4908
             }
4909 4909
 
4910 4910
             // get user defined template variables
4911
-            $fields = ($fields == '') ? 'tv.*' : 'tv.' . implode(',tv.',
4911
+            $fields = ($fields == '') ? 'tv.*' : 'tv.'.implode(',tv.',
4912 4912
                     array_filter(array_map('trim', explode(',', $fields))));
4913
-            $sort = ($sort == '') ? '' : 'tv.' . implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4913
+            $sort = ($sort == '') ? '' : 'tv.'.implode(',tv.', array_filter(array_map('trim', explode(',', $sort))));
4914 4914
 
4915 4915
             if ($idnames == '*') {
4916 4916
                 $query = 'tv.id<>0';
4917 4917
             } else {
4918
-                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name') . " IN ('" . implode("','", $idnames) . "')";
4918
+                $query = (is_numeric($idnames[0]) ? 'tv.id' : 'tv.name')." IN ('".implode("','", $idnames)."')";
4919 4919
             }
4920 4920
 
4921 4921
             $rs = $this->db->select("{$fields}, IF(tvc.value != '', tvc.value, tv.default_text) as value",
4922
-                $this->getFullTableName('site_tmplvars') . " tv
4923
-                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates') . " tvtpl ON tvtpl.tmplvarid = tv.id
4924
-                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues') . " tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'",
4922
+                $this->getFullTableName('site_tmplvars')." tv
4923
+                    INNER JOIN " . $this->getFullTableName('site_tmplvar_templates')." tvtpl ON tvtpl.tmplvarid = tv.id
4924
+                    LEFT JOIN " . $this->getFullTableName('site_tmplvar_contentvalues')." tvc ON tvc.tmplvarid=tv.id AND tvc.contentid = '{$docid}'",
4925 4925
                 "{$query} AND tvtpl.templateid = '{$docRow['template']}'", ($sort ? "{$sort} {$dir}" : ""));
4926 4926
 
4927 4927
             $result = $this->db->makeArray($rs);
@@ -4971,16 +4971,16 @@  discard block
 block discarded – undo
4971 4971
             $output = array();
4972 4972
             $vars = ($idnames == '*' || is_array($idnames)) ? $idnames : array($idnames);
4973 4973
 
4974
-            $docid = (int)$docid > 0 ? (int)$docid : $this->documentIdentifier;
4974
+            $docid = (int) $docid > 0 ? (int) $docid : $this->documentIdentifier;
4975 4975
             // remove sort for speed
4976 4976
             $result = $this->getTemplateVars($vars, '*', $docid, $published, '', '');
4977 4977
 
4978 4978
             if ($result == false) {
4979 4979
                 return false;
4980 4980
             } else {
4981
-                $baspath = MODX_MANAGER_PATH . 'includes';
4982
-                include_once $baspath . '/tmplvars.format.inc.php';
4983
-                include_once $baspath . '/tmplvars.commands.inc.php';
4981
+                $baspath = MODX_MANAGER_PATH.'includes';
4982
+                include_once $baspath.'/tmplvars.format.inc.php';
4983
+                include_once $baspath.'/tmplvars.commands.inc.php';
4984 4984
 
4985 4985
                 for ($i = 0; $i < count($result); $i++) {
4986 4986
                     $row = $result[$i];
@@ -5006,7 +5006,7 @@  discard block
 block discarded – undo
5006 5006
      */
5007 5007
     public function getFullTableName($tbl)
5008 5008
     {
5009
-        return $this->db->config['dbase'] . ".`" . $this->db->config['table_prefix'] . $tbl . "`";
5009
+        return $this->db->config['dbase'].".`".$this->db->config['table_prefix'].$tbl."`";
5010 5010
     }
5011 5011
 
5012 5012
     /**
@@ -5085,7 +5085,7 @@  discard block
 block discarded – undo
5085 5085
     public function getCachePath()
5086 5086
     {
5087 5087
         global $base_url;
5088
-        $pth = $base_url . $this->getCacheFolder();
5088
+        $pth = $base_url.$this->getCacheFolder();
5089 5089
 
5090 5090
         return $pth;
5091 5091
     }
@@ -5138,8 +5138,8 @@  discard block
 block discarded – undo
5138 5138
         $out = false;
5139 5139
 
5140 5140
         if (!empty($context)) {
5141
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5142
-                $out = $_SESSION[$context . 'InternalKey'];
5141
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5142
+                $out = $_SESSION[$context.'InternalKey'];
5143 5143
             }
5144 5144
         } else {
5145 5145
             switch (true) {
@@ -5168,8 +5168,8 @@  discard block
 block discarded – undo
5168 5168
         $out = false;
5169 5169
 
5170 5170
         if (!empty($context)) {
5171
-            if (is_scalar($context) && isset($_SESSION[$context . 'Validated'])) {
5172
-                $out = $_SESSION[$context . 'Shortname'];
5171
+            if (is_scalar($context) && isset($_SESSION[$context.'Validated'])) {
5172
+                $out = $_SESSION[$context.'Shortname'];
5173 5173
             }
5174 5174
         } else {
5175 5175
             switch (true) {
@@ -5241,8 +5241,8 @@  discard block
 block discarded – undo
5241 5241
      */
5242 5242
     public function getWebUserInfo($uid)
5243 5243
     {
5244
-        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users") . " wu
5245
-                INNER JOIN " . $this->getFullTableName("web_user_attributes") . " wua ON wua.internalkey=wu.id",
5244
+        $rs = $this->db->select('wu.username, wu.password, wua.*', $this->getFullTableName("web_users")." wu
5245
+                INNER JOIN " . $this->getFullTableName("web_user_attributes")." wua ON wua.internalkey=wu.id",
5246 5246
             "wu.id='{$uid}'");
5247 5247
         if ($row = $this->db->getRow($rs)) {
5248 5248
             if (!isset($row['usertype']) or !$row["usertype"]) {
@@ -5285,7 +5285,7 @@  discard block
 block discarded – undo
5285 5285
                     // resolve ids to names
5286 5286
                     $dgn = array();
5287 5287
                     $ds = $this->db->select('name', $this->getFullTableName("documentgroup_names"),
5288
-                        "id IN (" . implode(",", $dg) . ")");
5288
+                        "id IN (".implode(",", $dg).")");
5289 5289
                     while ($row = $this->db->getRow($ds)) {
5290 5290
                         $dgn[] = $row['name'];
5291 5291
                     }
@@ -5316,7 +5316,7 @@  discard block
 block discarded – undo
5316 5316
         $rt = false;
5317 5317
         if ($_SESSION["webValidated"] == 1) {
5318 5318
             $tbl = $this->getFullTableName("web_users");
5319
-            $ds = $this->db->select('id, username, password', $tbl, "id='" . $this->getLoginUserID() . "'");
5319
+            $ds = $this->db->select('id, username, password', $tbl, "id='".$this->getLoginUserID()."'");
5320 5320
             if ($row = $this->db->getRow($ds)) {
5321 5321
                 if ($row["password"] == md5($oldPwd)) {
5322 5322
                     if (strlen($newPwd) < 6) {
@@ -5326,7 +5326,7 @@  discard block
 block discarded – undo
5326 5326
                     } else {
5327 5327
                         $this->db->update(array(
5328 5328
                             'password' => $this->db->escape($newPwd),
5329
-                        ), $tbl, "id='" . $this->getLoginUserID() . "'");
5329
+                        ), $tbl, "id='".$this->getLoginUserID()."'");
5330 5330
                         // invoke OnWebChangePassword event
5331 5331
                         $this->invokeEvent("OnWebChangePassword", array(
5332 5332
                             "userid"       => $row["id"],
@@ -5359,8 +5359,8 @@  discard block
 block discarded – undo
5359 5359
         // check cache
5360 5360
         $grpNames = isset ($_SESSION['webUserGroupNames']) ? $_SESSION['webUserGroupNames'] : false;
5361 5361
         if (!is_array($grpNames)) {
5362
-            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names") . " wgn
5363
-                    INNER JOIN " . $this->getFullTableName("web_groups") . " wg ON wg.webgroup=wgn.id AND wg.webuser='" . $this->getLoginUserID() . "'");
5362
+            $rs = $this->db->select('wgn.name', $this->getFullTableName("webgroup_names")." wgn
5363
+                    INNER JOIN " . $this->getFullTableName("web_groups")." wg ON wg.webgroup=wgn.id AND wg.webuser='".$this->getLoginUserID()."'");
5364 5364
             $grpNames = $this->db->getColumn("name", $rs);
5365 5365
             // save to cache
5366 5366
             $_SESSION['webUserGroupNames'] = $grpNames;
@@ -5394,7 +5394,7 @@  discard block
 block discarded – undo
5394 5394
         if (strpos(strtolower($src), "<style") !== false || strpos(strtolower($src), "<link") !== false) {
5395 5395
             $this->sjscripts[$nextpos] = $src;
5396 5396
         } else {
5397
-            $this->sjscripts[$nextpos] = "\t" . '<link rel="stylesheet" type="text/css" href="' . $src . '" ' . ($media ? 'media="' . $media . '" ' : '') . '/>';
5397
+            $this->sjscripts[$nextpos] = "\t".'<link rel="stylesheet" type="text/css" href="'.$src.'" '.($media ? 'media="'.$media.'" ' : '').'/>';
5398 5398
         }
5399 5399
     }
5400 5400
 
@@ -5421,7 +5421,7 @@  discard block
 block discarded – undo
5421 5421
         $src,
5422 5422
         $options = array('name' => '', 'version' => '0', 'plaintext' => false),
5423 5423
         $startup = false
5424
-    ) {
5424
+    ){
5425 5425
         if (empty($src)) {
5426 5426
             return '';
5427 5427
         } // nothing to register
@@ -5476,7 +5476,7 @@  discard block
 block discarded – undo
5476 5476
         }
5477 5477
 
5478 5478
         if ($useThisVer && $plaintext != true && (strpos(strtolower($src), "<script") === false)) {
5479
-            $src = "\t" . '<script type="text/javascript" src="' . $src . '"></script>';
5479
+            $src = "\t".'<script type="text/javascript" src="'.$src.'"></script>';
5480 5480
         }
5481 5481
         if ($startup) {
5482 5482
             $pos = isset($overwritepos) ? $overwritepos : max(array_merge(array(0), array_keys($this->sjscripts))) + 1;
@@ -5627,7 +5627,7 @@  discard block
 block discarded – undo
5627 5627
                 $this->pluginsCode .= sprintf('<fieldset><legend><b>%s / %s</b> (%2.2f ms)</legend>', $evtName,
5628 5628
                     $pluginName, $eventtime * 1000);
5629 5629
                 foreach ($parameter as $k => $v) {
5630
-                    $this->pluginsCode .= "{$k} => " . print_r($v, true) . '<br>';
5630
+                    $this->pluginsCode .= "{$k} => ".print_r($v, true).'<br>';
5631 5631
                 }
5632 5632
                 $this->pluginsCode .= '</fieldset><br />';
5633 5633
                 $this->pluginsTime["{$evtName} / {$pluginName}"] += $eventtime;
@@ -5656,14 +5656,14 @@  discard block
 block discarded – undo
5656 5656
         $plugin = array();
5657 5657
         if (isset ($this->pluginCache[$pluginName])) {
5658 5658
             $pluginCode = $this->pluginCache[$pluginName];
5659
-            $pluginProperties = isset($this->pluginCache[$pluginName . "Props"]) ? $this->pluginCache[$pluginName . "Props"] : '';
5659
+            $pluginProperties = isset($this->pluginCache[$pluginName."Props"]) ? $this->pluginCache[$pluginName."Props"] : '';
5660 5660
         } else {
5661 5661
             $pluginName = $this->db->escape($pluginName);
5662 5662
             $result = $this->db->select('name, plugincode, properties', $this->getFullTableName("site_plugins"),
5663 5663
                 "name='{$pluginName}' AND disabled=0");
5664 5664
             if ($row = $this->db->getRow($result)) {
5665 5665
                 $pluginCode = $this->pluginCache[$row['name']] = $row['plugincode'];
5666
-                $pluginProperties = $this->pluginCache[$row['name'] . "Props"] = $row['properties'];
5666
+                $pluginProperties = $this->pluginCache[$row['name']."Props"] = $row['properties'];
5667 5667
             } else {
5668 5668
                 $pluginCode = $this->pluginCache[$pluginName] = "return false;";
5669 5669
                 $pluginProperties = '';
@@ -5773,7 +5773,7 @@  discard block
 block discarded – undo
5773 5773
     public function parseDocBlockFromFile($element_dir, $filename, $escapeValues = false)
5774 5774
     {
5775 5775
         $params = array();
5776
-        $fullpath = $element_dir . '/' . $filename;
5776
+        $fullpath = $element_dir.'/'.$filename;
5777 5777
         if (is_readable($fullpath)) {
5778 5778
             $tpl = @fopen($fullpath, "r");
5779 5779
             if ($tpl) {
@@ -5885,7 +5885,7 @@  discard block
 block discarded – undo
5885 5885
         $name_found,
5886 5886
         $description_found,
5887 5887
         $docblock_end_found
5888
-    ) {
5888
+    ){
5889 5889
         $param = '';
5890 5890
         $val = '';
5891 5891
         $ma = null;
@@ -5950,8 +5950,8 @@  discard block
 block discarded – undo
5950 5950
         $ph = array('site_url' => MODX_SITE_URL);
5951 5951
         $regexUrl = "/((http|https|ftp|ftps)\:\/\/[^\/]+(\/[^\s]+[^,.?!:;\s])?)/";
5952 5952
         $regexEmail = '#([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)#i';
5953
-        $emailSubject = isset($parsed['name']) ? '?subject=' . $parsed['name'] : '';
5954
-        $emailSubject .= isset($parsed['version']) ? ' v' . $parsed['version'] : '';
5953
+        $emailSubject = isset($parsed['name']) ? '?subject='.$parsed['name'] : '';
5954
+        $emailSubject .= isset($parsed['version']) ? ' v'.$parsed['version'] : '';
5955 5955
         foreach ($parsed as $key => $val) {
5956 5956
             if (is_array($val)) {
5957 5957
                 foreach ($val as $key2 => $val2) {
@@ -5961,7 +5961,7 @@  discard block
 block discarded – undo
5961 5961
                             $val2);
5962 5962
                     }
5963 5963
                     if (preg_match($regexEmail, $val2, $url)) {
5964
-                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val2);
5964
+                        $val2 = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val2);
5965 5965
                     }
5966 5966
                     $parsed[$key][$key2] = $val2;
5967 5967
                 }
@@ -5971,7 +5971,7 @@  discard block
 block discarded – undo
5971 5971
                     $val = preg_replace($regexUrl, "<a href=\"{$url[0]}\" target=\"_blank\">{$url[0]}</a> ", $val);
5972 5972
                 }
5973 5973
                 if (preg_match($regexEmail, $val, $url)) {
5974
-                    $val = preg_replace($regexEmail, '<a href="mailto:\\1' . $emailSubject . '">\\1</a>', $val);
5974
+                    $val = preg_replace($regexEmail, '<a href="mailto:\\1'.$emailSubject.'">\\1</a>', $val);
5975 5975
                 }
5976 5976
                 $parsed[$key] = $val;
5977 5977
             }
@@ -5985,33 +5985,33 @@  discard block
 block discarded – undo
5985 5985
         );
5986 5986
 
5987 5987
         $nl = "\n";
5988
-        $list = isset($parsed['logo']) ? '<img src="' . $this->config['base_url'] . ltrim($parsed['logo'],
5989
-                "/") . '" style="float:right;max-width:100px;height:auto;" />' . $nl : '';
5990
-        $list .= '<p>' . $nl;
5991
-        $list .= isset($parsed['name']) ? '<strong>' . $parsed['name'] . '</strong><br/>' . $nl : '';
5992
-        $list .= isset($parsed['description']) ? $parsed['description'] . $nl : '';
5993
-        $list .= '</p><br/>' . $nl;
5994
-        $list .= isset($parsed['version']) ? '<p><strong>' . $_lang['version'] . ':</strong> ' . $parsed['version'] . '</p>' . $nl : '';
5995
-        $list .= isset($parsed['license']) ? '<p><strong>' . $_lang['license'] . ':</strong> ' . $parsed['license'] . '</p>' . $nl : '';
5996
-        $list .= isset($parsed['lastupdate']) ? '<p><strong>' . $_lang['last_update'] . ':</strong> ' . $parsed['lastupdate'] . '</p>' . $nl : '';
5997
-        $list .= '<br/>' . $nl;
5988
+        $list = isset($parsed['logo']) ? '<img src="'.$this->config['base_url'].ltrim($parsed['logo'],
5989
+                "/").'" style="float:right;max-width:100px;height:auto;" />'.$nl : '';
5990
+        $list .= '<p>'.$nl;
5991
+        $list .= isset($parsed['name']) ? '<strong>'.$parsed['name'].'</strong><br/>'.$nl : '';
5992
+        $list .= isset($parsed['description']) ? $parsed['description'].$nl : '';
5993
+        $list .= '</p><br/>'.$nl;
5994
+        $list .= isset($parsed['version']) ? '<p><strong>'.$_lang['version'].':</strong> '.$parsed['version'].'</p>'.$nl : '';
5995
+        $list .= isset($parsed['license']) ? '<p><strong>'.$_lang['license'].':</strong> '.$parsed['license'].'</p>'.$nl : '';
5996
+        $list .= isset($parsed['lastupdate']) ? '<p><strong>'.$_lang['last_update'].':</strong> '.$parsed['lastupdate'].'</p>'.$nl : '';
5997
+        $list .= '<br/>'.$nl;
5998 5998
         $first = true;
5999 5999
         foreach ($arrayParams as $param => $label) {
6000 6000
             if (isset($parsed[$param])) {
6001 6001
                 if ($first) {
6002
-                    $list .= '<p><strong>' . $_lang['references'] . '</strong></p>' . $nl;
6003
-                    $list .= '<ul class="docBlockList">' . $nl;
6002
+                    $list .= '<p><strong>'.$_lang['references'].'</strong></p>'.$nl;
6003
+                    $list .= '<ul class="docBlockList">'.$nl;
6004 6004
                     $first = false;
6005 6005
                 }
6006
-                $list .= '    <li><strong>' . $label . '</strong>' . $nl;
6007
-                $list .= '        <ul>' . $nl;
6006
+                $list .= '    <li><strong>'.$label.'</strong>'.$nl;
6007
+                $list .= '        <ul>'.$nl;
6008 6008
                 foreach ($parsed[$param] as $val) {
6009
-                    $list .= '            <li>' . $val . '</li>' . $nl;
6009
+                    $list .= '            <li>'.$val.'</li>'.$nl;
6010 6010
                 }
6011
-                $list .= '        </ul></li>' . $nl;
6011
+                $list .= '        </ul></li>'.$nl;
6012 6012
             }
6013 6013
         }
6014
-        $list .= !$first ? '</ul>' . $nl : '';
6014
+        $list .= !$first ? '</ul>'.$nl : '';
6015 6015
 
6016 6016
         return $list;
6017 6017
     }
@@ -6089,7 +6089,7 @@  discard block
 block discarded – undo
6089 6089
      */
6090 6090
     public function addSnippet($name, $phpCode)
6091 6091
     {
6092
-        $this->snippetCache['#' . $name] = $phpCode;
6092
+        $this->snippetCache['#'.$name] = $phpCode;
6093 6093
     }
6094 6094
 
6095 6095
     /**
@@ -6098,7 +6098,7 @@  discard block
 block discarded – undo
6098 6098
      */
6099 6099
     public function addChunk($name, $text)
6100 6100
     {
6101
-        $this->chunkCache['#' . $name] = $text;
6101
+        $this->chunkCache['#'.$name] = $text;
6102 6102
     }
6103 6103
 
6104 6104
     /**
@@ -6134,7 +6134,7 @@  discard block
 block discarded – undo
6134 6134
         }
6135 6135
 
6136 6136
         if (!$isSafe) {
6137
-            $msg = $phpcode . "\n" . $this->currentSnippet . "\n" . print_r($_SERVER, true);
6137
+            $msg = $phpcode."\n".$this->currentSnippet."\n".print_r($_SERVER, true);
6138 6138
             $title = sprintf('Unknown eval was executed (%s)', $this->htmlspecialchars(substr(trim($phpcode), 0, 50)));
6139 6139
             $this->messageQuit($title, '', true, '', '', 'Parser', $msg);
6140 6140
 
@@ -6149,7 +6149,7 @@  discard block
 block discarded – undo
6149 6149
             return 'array()';
6150 6150
         }
6151 6151
 
6152
-        $output = $echo . $return;
6152
+        $output = $echo.$return;
6153 6153
         modx_sanitize_gpc($output);
6154 6154
 
6155 6155
         return $this->htmlspecialchars($output); // Maybe, all html tags are dangerous
@@ -6168,8 +6168,8 @@  discard block
 block discarded – undo
6168 6168
 
6169 6169
         $safe = explode(',', $safe_functions);
6170 6170
 
6171
-        $phpcode = rtrim($phpcode, ';') . ';';
6172
-        $tokens = token_get_all('<?php ' . $phpcode);
6171
+        $phpcode = rtrim($phpcode, ';').';';
6172
+        $tokens = token_get_all('<?php '.$phpcode);
6173 6173
         foreach ($tokens as $i => $token) {
6174 6174
             if (!is_array($token)) {
6175 6175
                 continue;
@@ -6210,7 +6210,7 @@  discard block
 block discarded – undo
6210 6210
             'assets/tvs/',
6211 6211
             'assets/chunks/',
6212 6212
             'assets/templates/',
6213
-            $this->config['rb_base_url'] . 'files/',
6213
+            $this->config['rb_base_url'].'files/',
6214 6214
             ''
6215 6215
         );
6216 6216
 
@@ -6235,7 +6235,7 @@  discard block
 block discarded – undo
6235 6235
         $errorMsg = sprintf("Could not retrieve string '%s'.", $str);
6236 6236
 
6237 6237
         foreach ($search_path as $path) {
6238
-            $file_path = MODX_BASE_PATH . $path . $str;
6238
+            $file_path = MODX_BASE_PATH.$path.$str;
6239 6239
             if (strpos($file_path, MODX_MANAGER_PATH) === 0) {
6240 6240
                 return $errorMsg;
6241 6241
             } elseif (is_file($file_path)) {
@@ -6249,7 +6249,7 @@  discard block
 block discarded – undo
6249 6249
             return $errorMsg;
6250 6250
         }
6251 6251
 
6252
-        $content = (string)file_get_contents($file_path);
6252
+        $content = (string) file_get_contents($file_path);
6253 6253
         if ($content === false) {
6254 6254
             return $errorMsg;
6255 6255
         }
@@ -6351,7 +6351,7 @@  discard block
 block discarded – undo
6351 6351
         $text = '',
6352 6352
         $line = '',
6353 6353
         $output = ''
6354
-    ) {
6354
+    ){
6355 6355
 
6356 6356
         if (0 < $this->messageQuitCount) {
6357 6357
             return;
@@ -6371,22 +6371,22 @@  discard block
 block discarded – undo
6371 6371
 
6372 6372
         $version = isset ($GLOBALS['modx_version']) ? $GLOBALS['modx_version'] : '';
6373 6373
         $release_date = isset ($GLOBALS['release_date']) ? $GLOBALS['release_date'] : '';
6374
-        $request_uri = "http://" . $_SERVER['HTTP_HOST'] . ($_SERVER["SERVER_PORT"] == 80 ? "" : (":" . $_SERVER["SERVER_PORT"])) . $_SERVER['REQUEST_URI'];
6374
+        $request_uri = "http://".$_SERVER['HTTP_HOST'].($_SERVER["SERVER_PORT"] == 80 ? "" : (":".$_SERVER["SERVER_PORT"])).$_SERVER['REQUEST_URI'];
6375 6375
         $request_uri = $this->htmlspecialchars($request_uri, ENT_QUOTES, $this->config['modx_charset']);
6376 6376
         $ua = $this->htmlspecialchars($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $this->config['modx_charset']);
6377 6377
         $referer = $this->htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES, $this->config['modx_charset']);
6378 6378
         if ($is_error) {
6379 6379
             $str = '<h2 style="color:red">&laquo; Evo Parse Error &raquo;</h2>';
6380 6380
             if ($msg != 'PHP Parse Error') {
6381
-                $str .= '<h3 style="color:red">' . $msg . '</h3>';
6381
+                $str .= '<h3 style="color:red">'.$msg.'</h3>';
6382 6382
             }
6383 6383
         } else {
6384 6384
             $str = '<h2 style="color:#003399">&laquo; Evo Debug/ stop message &raquo;</h2>';
6385
-            $str .= '<h3 style="color:#003399">' . $msg . '</h3>';
6385
+            $str .= '<h3 style="color:#003399">'.$msg.'</h3>';
6386 6386
         }
6387 6387
 
6388 6388
         if (!empty ($query)) {
6389
-            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">' . $query . '</span></div>';
6389
+            $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">SQL &gt; <span id="sqlHolder">'.$query.'</span></div>';
6390 6390
         }
6391 6391
 
6392 6392
         $errortype = array(
@@ -6409,13 +6409,13 @@  discard block
 block discarded – undo
6409 6409
 
6410 6410
         if (!empty($nr) || !empty($file)) {
6411 6411
             if ($text != '') {
6412
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : ' . $text . '</div>';
6412
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">Error : '.$text.'</div>';
6413 6413
             }
6414 6414
             if ($output != '') {
6415
-                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">' . $output . '</div>';
6415
+                $str .= '<div style="font-weight:bold;border:1px solid #ccc;padding:8px;color:#333;background-color:#ffffcd;margin-bottom:15px;">'.$output.'</div>';
6416 6416
             }
6417 6417
             if ($nr !== '') {
6418
-                $table[] = array('ErrorType[num]', $errortype [$nr] . "[" . $nr . "]");
6418
+                $table[] = array('ErrorType[num]', $errortype [$nr]."[".$nr."]");
6419 6419
             }
6420 6420
             if ($file) {
6421 6421
                 $table[] = array('File', $file);
@@ -6435,7 +6435,7 @@  discard block
 block discarded – undo
6435 6435
         }
6436 6436
 
6437 6437
         if (!empty($this->event->activePlugin)) {
6438
-            $table[] = array('Current Plugin', $this->event->activePlugin . '(' . $this->event->name . ')');
6438
+            $table[] = array('Current Plugin', $this->event->activePlugin.'('.$this->event->name.')');
6439 6439
         }
6440 6440
 
6441 6441
         $str .= $MakeTable->create($table, array('Error information', ''));
@@ -6445,11 +6445,11 @@  discard block
 block discarded – undo
6445 6445
         $table[] = array('REQUEST_URI', $request_uri);
6446 6446
 
6447 6447
         if ($this->manager->action) {
6448
-            include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
6448
+            include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
6449 6449
             global $action_list;
6450 6450
             $actionName = (isset($action_list[$this->manager->action])) ? " - {$action_list[$this->manager->action]}" : '';
6451 6451
 
6452
-            $table[] = array('Manager action', $this->manager->action . $actionName);
6452
+            $table[] = array('Manager action', $this->manager->action.$actionName);
6453 6453
         }
6454 6454
 
6455 6455
         if (preg_match('@^[0-9]+@', $this->documentIdentifier)) {
@@ -6457,7 +6457,7 @@  discard block
 block discarded – undo
6457 6457
             $url = $this->makeUrl($this->documentIdentifier, '', '', 'full');
6458 6458
             $table[] = array(
6459 6459
                 'Resource',
6460
-                '[' . $this->documentIdentifier . '] <a href="' . $url . '" target="_blank">' . $resource['pagetitle'] . '</a>'
6460
+                '['.$this->documentIdentifier.'] <a href="'.$url.'" target="_blank">'.$resource['pagetitle'].'</a>'
6461 6461
             );
6462 6462
         }
6463 6463
         $table[] = array('Referer', $referer);
@@ -6482,7 +6482,7 @@  discard block
 block discarded – undo
6482 6482
 
6483 6483
         $mem = memory_get_peak_usage(true);
6484 6484
         $total_mem = $mem - $this->mstart;
6485
-        $total_mem = ($total_mem / 1024 / 1024) . ' mb';
6485
+        $total_mem = ($total_mem / 1024 / 1024).' mb';
6486 6486
 
6487 6487
         $queryTime = $this->queryTime;
6488 6488
         $phpTime = $totalTime - $queryTime;
@@ -6503,18 +6503,18 @@  discard block
 block discarded – undo
6503 6503
         $str .= $this->get_backtrace(debug_backtrace());
6504 6504
         // Log error
6505 6505
         if (!empty($this->currentSnippet)) {
6506
-            $source = 'Snippet - ' . $this->currentSnippet;
6506
+            $source = 'Snippet - '.$this->currentSnippet;
6507 6507
         } elseif (!empty($this->event->activePlugin)) {
6508
-            $source = 'Plugin - ' . $this->event->activePlugin;
6508
+            $source = 'Plugin - '.$this->event->activePlugin;
6509 6509
         } elseif ($source !== '') {
6510
-            $source = 'Parser - ' . $source;
6510
+            $source = 'Parser - '.$source;
6511 6511
         } elseif ($query !== '') {
6512 6512
             $source = 'SQL Query';
6513 6513
         } else {
6514 6514
             $source = 'Parser';
6515 6515
         }
6516 6516
         if ($msg) {
6517
-            $source .= ' / ' . $msg;
6517
+            $source .= ' / '.$msg;
6518 6518
         }
6519 6519
         if (isset($actionName) && !empty($actionName)) {
6520 6520
             $source .= $actionName;
@@ -6546,12 +6546,12 @@  discard block
 block discarded – undo
6546 6546
 
6547 6547
         // Display error
6548 6548
         if (isset($_SESSION['mgrValidated'])) {
6549
-            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager ' . $version . ' &raquo; ' . $release_date . '</title>
6549
+            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head><title>EVO Content Manager '.$version.' &raquo; '.$release_date.'</title>
6550 6550
                  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6551
-                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'] . 'media/style/' . $this->config['manager_theme'] . '/style.css" />
6551
+                 <link rel="stylesheet" type="text/css" href="' . $this->config['site_manager_url'].'media/style/'.$this->config['manager_theme'].'/style.css" />
6552 6552
                  <style type="text/css">body { padding:10px; } td {font:inherit;}</style>
6553 6553
                  </head><body>
6554
-                 ' . $str . '</body></html>';
6554
+                 ' . $str.'</body></html>';
6555 6555
 
6556 6556
         } else {
6557 6557
             echo 'Error';
@@ -6589,7 +6589,7 @@  discard block
 block discarded – undo
6589 6589
             switch ($val['type']) {
6590 6590
                 case '->':
6591 6591
                 case '::':
6592
-                    $functionName = $val['function'] = $val['class'] . $val['type'] . $val['function'];
6592
+                    $functionName = $val['function'] = $val['class'].$val['type'].$val['function'];
6593 6593
                     break;
6594 6594
                 default:
6595 6595
                     $functionName = $val['function'];
@@ -6599,7 +6599,7 @@  discard block
 block discarded – undo
6599 6599
             $args = array_pad(array(), $_, '$var');
6600 6600
             $args = implode(", ", $args);
6601 6601
             $modx = &$this;
6602
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6602
+            $args = preg_replace_callback('/\$var/', function() use ($modx, &$tmp, $val) {
6603 6603
                 $arg = $val['args'][$tmp - 1];
6604 6604
                 switch (true) {
6605 6605
                     case is_null($arg): {
@@ -6611,8 +6611,8 @@  discard block
 block discarded – undo
6611 6611
                         break;
6612 6612
                     }
6613 6613
                     case is_scalar($arg): {
6614
-                        $out = strlen($arg) > 20 ? 'string $var' . $tmp : ("'" . $this->htmlspecialchars(str_replace("'",
6615
-                                "\\'", $arg)) . "'");
6614
+                        $out = strlen($arg) > 20 ? 'string $var'.$tmp : ("'".$this->htmlspecialchars(str_replace("'",
6615
+                                "\\'", $arg))."'");
6616 6616
                         break;
6617 6617
                     }
6618 6618
                     case is_bool($arg): {
@@ -6620,15 +6620,15 @@  discard block
 block discarded – undo
6620 6620
                         break;
6621 6621
                     }
6622 6622
                     case is_array($arg): {
6623
-                        $out = 'array $var' . $tmp;
6623
+                        $out = 'array $var'.$tmp;
6624 6624
                         break;
6625 6625
                     }
6626 6626
                     case is_object($arg): {
6627
-                        $out = get_class($arg) . ' $var' . $tmp;
6627
+                        $out = get_class($arg).' $var'.$tmp;
6628 6628
                         break;
6629 6629
                     }
6630 6630
                     default: {
6631
-                        $out = '$var' . $tmp;
6631
+                        $out = '$var'.$tmp;
6632 6632
                     }
6633 6633
                 }
6634 6634
                 $tmp++;
@@ -6636,8 +6636,8 @@  discard block
 block discarded – undo
6636 6636
                 return $out;
6637 6637
             }, $args);
6638 6638
             $line = array(
6639
-                "<strong>" . $functionName . "</strong>(" . $args . ")",
6640
-                $path . " on line " . $val['line']
6639
+                "<strong>".$functionName."</strong>(".$args.")",
6640
+                $path." on line ".$val['line']
6641 6641
             );
6642 6642
             $table[] = array(implode("<br />", $line));
6643 6643
         }
@@ -6679,7 +6679,7 @@  discard block
 block discarded – undo
6679 6679
             $alias = strip_tags($alias); // strip HTML
6680 6680
             $alias = preg_replace('/[^\.A-Za-z0-9 _-]/', '', $alias); // strip non-alphanumeric characters
6681 6681
             $alias = preg_replace('/\s+/', '-', $alias); // convert white-space to dash
6682
-            $alias = preg_replace('/-+/', '-', $alias);  // convert multiple dashes to one
6682
+            $alias = preg_replace('/-+/', '-', $alias); // convert multiple dashes to one
6683 6683
             $alias = trim($alias, '-'); // trim excess
6684 6684
 
6685 6685
             return $alias;
@@ -6696,7 +6696,7 @@  discard block
 block discarded – undo
6696 6696
         $precisions = count($sizes) - 1;
6697 6697
         foreach ($sizes as $unit => $bytes) {
6698 6698
             if ($size >= $bytes) {
6699
-                return number_format($size / $bytes, $precisions) . ' ' . $unit;
6699
+                return number_format($size / $bytes, $precisions).' '.$unit;
6700 6700
             }
6701 6701
             $precisions--;
6702 6702
         }
@@ -6802,10 +6802,10 @@  discard block
 block discarded – undo
6802 6802
 
6803 6803
         if (strpos($str, MODX_MANAGER_PATH) === 0) {
6804 6804
             return false;
6805
-        } elseif (is_file(MODX_BASE_PATH . $str)) {
6806
-            $file_path = MODX_BASE_PATH . $str;
6807
-        } elseif (is_file(MODX_BASE_PATH . "{$tpl_dir}{$str}")) {
6808
-            $file_path = MODX_BASE_PATH . $tpl_dir . $str;
6805
+        } elseif (is_file(MODX_BASE_PATH.$str)) {
6806
+            $file_path = MODX_BASE_PATH.$str;
6807
+        } elseif (is_file(MODX_BASE_PATH."{$tpl_dir}{$str}")) {
6808
+            $file_path = MODX_BASE_PATH.$tpl_dir.$str;
6809 6809
         } else {
6810 6810
             return false;
6811 6811
         }
@@ -6935,7 +6935,7 @@  discard block
 block discarded – undo
6935 6935
             $title = 'no title';
6936 6936
         }
6937 6937
         if (is_array($msg)) {
6938
-            $msg = '<pre>' . print_r($msg, true) . '</pre>';
6938
+            $msg = '<pre>'.print_r($msg, true).'</pre>';
6939 6939
         } elseif ($msg === '') {
6940 6940
             $msg = $_SERVER['REQUEST_URI'];
6941 6941
         }
@@ -6980,7 +6980,7 @@  discard block
 block discarded – undo
6980 6980
         if (is_array($SystemAlertMsgQueque)) {
6981 6981
             $title = '';
6982 6982
             if ($this->name && $this->activePlugin) {
6983
-                $title = "<div><b>" . $this->activePlugin . "</b> - <span style='color:maroon;'>" . $this->name . "</span></div>";
6983
+                $title = "<div><b>".$this->activePlugin."</b> - <span style='color:maroon;'>".$this->name."</span></div>";
6984 6984
             }
6985 6985
             $SystemAlertMsgQueque[] = "$title<div style='margin-left:10px;margin-top:3px;'>$msg</div>";
6986 6986
         }
Please login to merge, or discard this patch.
Braces   +30 added lines, -15 removed lines patch added patch discarded remove patch
@@ -729,7 +729,8 @@  discard block
 block discarded – undo
729 729
         }
730 730
 
731 731
         if (preg_match('@^[1-9][0-9]*$@',
732
-                $q) && !isset($this->documentListing[$q])) { /* we got an ID returned, check to make sure it's not an alias */
732
+                $q) && !isset($this->documentListing[$q])) {
733
+/* we got an ID returned, check to make sure it's not an alias */
733 734
             /* FS#476 and FS#308: check that id is valid in terms of virtualDir structure */
734 735
             if ($this->config['use_alias_path'] == 1) {
735 736
                 if (($this->virtualDir != '' && !isset($this->documentListing[$this->virtualDir . '/' . $q]) || ($this->virtualDir == '' && !isset($this->documentListing[$q]))) && (($this->virtualDir != '' && isset($this->documentListing[$this->virtualDir]) && in_array($q,
@@ -738,7 +739,8 @@  discard block
 block discarded – undo
738 739
                     $this->documentMethod = 'id';
739 740
 
740 741
                     return $q;
741
-                } else { /* not a valid id in terms of virtualDir, treat as alias */
742
+                } else {
743
+/* not a valid id in terms of virtualDir, treat as alias */
742 744
                     $this->documentMethod = 'alias';
743 745
 
744 746
                     return $q;
@@ -748,7 +750,8 @@  discard block
 block discarded – undo
748 750
 
749 751
                 return $q;
750 752
             }
751
-        } else { /* we didn't get an ID back, so instead we assume it's an alias */
753
+        } else {
754
+/* we didn't get an ID back, so instead we assume it's an alias */
752 755
             if ($this->config['friendly_alias_urls'] != 1) {
753 756
                 $q = $qOrig;
754 757
             }
@@ -1278,7 +1281,8 @@  discard block
 block discarded – undo
1278 1281
                         }
1279 1282
                     }
1280 1283
 
1281
-                    if (!in_array($fetch, $tags)) {  // Avoid double Matches
1284
+                    if (!in_array($fetch, $tags)) {
1285
+// Avoid double Matches
1282 1286
                         $tags[] = $fetch; // Fetch
1283 1287
                     };
1284 1288
                     $fetch = ''; // and reset
@@ -2089,7 +2093,8 @@  discard block
 block discarded – undo
2089 2093
      * @return mixed|string
2090 2094
      */
2091 2095
     public function _getSGVar($value)
2092
-    { // Get super globals
2096
+    {
2097
+// Get super globals
2093 2098
         $key = $value;
2094 2099
         $_ = $this->config['enable_filter'];
2095 2100
         $this->config['enable_filter'] = 1;
@@ -2510,7 +2515,8 @@  discard block
 block discarded – undo
2510 2515
         if ($this->config['friendly_urls'] == 1) {
2511 2516
             $aliases = array();
2512 2517
             if (is_array($this->documentListing)) {
2513
-                foreach ($this->documentListing as $path => $docid) { // This is big Loop on large site!
2518
+                foreach ($this->documentListing as $path => $docid) {
2519
+// This is big Loop on large site!
2514 2520
                     $aliases[$docid] = $path;
2515 2521
                     $isfolder[$docid] = $this->aliasListing[$docid]['isfolder'];
2516 2522
                 }
@@ -2545,7 +2551,7 @@  discard block
 block discarded – undo
2545 2551
             $pref = $this->config['friendly_url_prefix'];
2546 2552
             $suff = $this->config['friendly_url_suffix'];
2547 2553
             $documentSource = preg_replace_callback($in,
2548
-                function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff) {
2554
+                function ($m) use ($aliases, $isfolder, $isfriendly, $pref, $suff){
2549 2555
                     $modx = evolutionCMS();
2550 2556
                     $thealias = $aliases[$m[1]];
2551 2557
                     $thefolder = $isfolder[$m[1]];
@@ -4387,7 +4393,8 @@  discard block
 block discarded – undo
4387 4393
         if (isset ($this->snippetCache[$snippetName])) {
4388 4394
             $snippet = $this->snippetCache[$snippetName];
4389 4395
             $properties = !empty($this->snippetCache[$snippetName . "Props"]) ? $this->snippetCache[$snippetName . "Props"] : '';
4390
-        } else { // not in cache so let's check the db
4396
+        } else {
4397
+// not in cache so let's check the db
4391 4398
             $sql = "SELECT ss.`name`, ss.`snippet`, ss.`properties`, sm.properties as `sharedproperties` FROM " . $this->getFullTableName("site_snippets") . " as ss LEFT JOIN " . $this->getFullTableName('site_modules') . " as sm on sm.guid=ss.moduleguid WHERE ss.`name`='" . $this->db->escape($snippetName) . "'  AND ss.disabled=0;";
4392 4399
             $result = $this->db->query($sql);
4393 4400
             if ($this->db->getRecordCount($result) == 1) {
@@ -5426,12 +5433,16 @@  discard block
 block discarded – undo
5426 5433
             return '';
5427 5434
         } // nothing to register
5428 5435
         if (!is_array($options)) {
5429
-            if (is_bool($options))  // backward compatibility with old plaintext parameter
5436
+            if (is_bool($options)) {
5437
+                // backward compatibility with old plaintext parameter
5430 5438
             {
5431 5439
                 $options = array('plaintext' => $options);
5432
-            } elseif (is_string($options)) // Also allow script name as 2nd param
5440
+            }
5441
+            } elseif (is_string($options)) {
5442
+                // Also allow script name as 2nd param
5433 5443
             {
5434 5444
                 $options = array('name' => $options);
5445
+            }
5435 5446
             } else {
5436 5447
                 $options = array();
5437 5448
             }
@@ -5443,7 +5454,8 @@  discard block
 block discarded – undo
5443 5454
         unset($overwritepos); // probably unnecessary--just making sure
5444 5455
 
5445 5456
         $useThisVer = true;
5446
-        if (isset($this->loadedjscripts[$key])) { // a matching script was found
5457
+        if (isset($this->loadedjscripts[$key])) {
5458
+// a matching script was found
5447 5459
             // if existing script is a startup script, make sure the candidate is also a startup script
5448 5460
             if ($this->loadedjscripts[$key]['startup']) {
5449 5461
                 $startup = true;
@@ -5463,7 +5475,8 @@  discard block
 block discarded – undo
5463 5475
                     // overwrite the old script (the position may be important for dependent scripts)
5464 5476
                     $overwritepos = $this->loadedjscripts[$key]['pos'];
5465 5477
                 }
5466
-            } else { // Use the original version
5478
+            } else {
5479
+// Use the original version
5467 5480
                 if ($startup == true && $this->loadedjscripts[$key]['startup'] == false) {
5468 5481
                     // need to move the exisiting script to the head
5469 5482
                     $version = $this->loadedjscripts[$key][$version];
@@ -5591,7 +5604,8 @@  discard block
 block discarded – undo
5591 5604
         }
5592 5605
 
5593 5606
         $results = null;
5594
-        foreach ($this->pluginEvent[$evtName] as $pluginName) { // start for loop
5607
+        foreach ($this->pluginEvent[$evtName] as $pluginName) {
5608
+// start for loop
5595 5609
             if ($this->dumpPlugins) {
5596 5610
                 $eventtime = $this->getMicroTime();
5597 5611
             }
@@ -6161,7 +6175,8 @@  discard block
 block discarded – undo
6161 6175
      * @return bool
6162 6176
      */
6163 6177
     public function isSafeCode($phpcode = '', $safe_functions = '')
6164
-    { // return true or false
6178
+    {
6179
+// return true or false
6165 6180
         if ($safe_functions == '') {
6166 6181
             return false;
6167 6182
         }
@@ -6599,7 +6614,7 @@  discard block
 block discarded – undo
6599 6614
             $args = array_pad(array(), $_, '$var');
6600 6615
             $args = implode(", ", $args);
6601 6616
             $modx = &$this;
6602
-            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val) {
6617
+            $args = preg_replace_callback('/\$var/', function () use ($modx, &$tmp, $val){
6603 6618
                 $arg = $val['args'][$tmp - 1];
6604 6619
                 switch (true) {
6605 6620
                     case is_null($arg): {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2399,11 +2399,11 @@  discard block
 block discarded – undo
2399 2399
         if (isset($this->snippetCache[$snip_name])) {
2400 2400
             $snippetObject['name'] = $snip_name;
2401 2401
             $snippetObject['content'] = $this->snippetCache[$snip_name];
2402
-            if (isset($this->snippetCache["{$snip_name}Props"])) {
2403
-                if (!isset($this->snippetCache["{$snip_name}Props"])) {
2404
-                    $this->snippetCache["{$snip_name}Props"] = '';
2402
+            if (isset($this->snippetCache["{$snip_name}props"])) {
2403
+                if (!isset($this->snippetCache["{$snip_name}props"])) {
2404
+                    $this->snippetCache["{$snip_name}props"] = '';
2405 2405
                 }
2406
-                $snippetObject['properties'] = $this->snippetCache["{$snip_name}Props"];
2406
+                $snippetObject['properties'] = $this->snippetCache["{$snip_name}props"];
2407 2407
             }
2408 2408
         } elseif (substr($snip_name, 0, 1) === '@' && isset($this->pluginEvent[trim($snip_name, '@')])) {
2409 2409
             $snippetObject['name'] = trim($snip_name, '@');
@@ -2429,7 +2429,7 @@  discard block
 block discarded – undo
2429 2429
             $snippetObject['content'] = $snip_content;
2430 2430
             $snippetObject['properties'] = $snip_prop;
2431 2431
             $this->snippetCache[$snip_name] = $snip_content;
2432
-            $this->snippetCache["{$snip_name}Props"] = $snip_prop;
2432
+            $this->snippetCache["{$snip_name}props"] = $snip_prop;
2433 2433
         }
2434 2434
 
2435 2435
         return $snippetObject;
@@ -3774,7 +3774,7 @@  discard block
 block discarded – undo
3774 3774
         }
3775 3775
         // build query
3776 3776
         $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3777
-        $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3777
+        $result = $this->db->select("distinct {$fields}", "{$tblsc} sc
3778 3778
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id", "sc.parent = '{$id}' AND ({$access}) GROUP BY sc.id",
3779 3779
             "{$sort} {$dir}");
3780 3780
         $resourceArray = $this->db->makeArray($result);
@@ -3817,7 +3817,7 @@  discard block
 block discarded – undo
3817 3817
         }
3818 3818
         // build query
3819 3819
         $access = ($this->isFrontend() ? "sc.privateweb=0" : "1='" . $_SESSION['mgrRole'] . "' OR sc.privatemgr=0") . (!$docgrp ? "" : " OR dg.document_group IN ($docgrp)");
3820
-        $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3820
+        $result = $this->db->select("distinct {$fields}", "{$tblsc} sc
3821 3821
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id",
3822 3822
             "sc.parent = '{$id}' AND sc.published=1 AND sc.deleted=0 AND ({$access}) GROUP BY sc.id", "{$sort} {$dir}");
3823 3823
         $resourceArray = $this->db->makeArray($result);
@@ -3882,7 +3882,7 @@  discard block
 block discarded – undo
3882 3882
         $tblsc = $this->getFullTableName('site_content');
3883 3883
         $tbldg = $this->getFullTableName('document_groups');
3884 3884
 
3885
-        $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3885
+        $result = $this->db->select("distinct {$fields}", "{$tblsc} sc
3886 3886
                 LEFT JOIN {$tbldg} dg on dg.document = sc.id",
3887 3887
             "sc.parent = '{$parentid}' {$published} {$deleted} {$where} AND ({$access}) GROUP BY sc.id",
3888 3888
             ($sort ? "{$sort} {$dir}" : ""), $limit);
@@ -3959,7 +3959,7 @@  discard block
 block discarded – undo
3959 3959
             $tblsc = $this->getFullTableName('site_content');
3960 3960
             $tbldg = $this->getFullTableName('document_groups');
3961 3961
 
3962
-            $result = $this->db->select("DISTINCT {$fields}", "{$tblsc} sc
3962
+            $result = $this->db->select("distinct {$fields}", "{$tblsc} sc
3963 3963
                     LEFT JOIN {$tbldg} dg on dg.document = sc.id", "(sc.id IN (" . implode(',',
3964 3964
                     $ids) . ") {$published} {$deleted} {$where}) AND ({$access}) GROUP BY sc.id",
3965 3965
                 ($sort ? "{$sort} {$dir}" : ""), $limit);
@@ -4561,7 +4561,7 @@  discard block
 block discarded – undo
4561 4561
                 $template = $doc['content'];
4562 4562
                 break;
4563 4563
             case 'SELECT':
4564
-                $this->db->getValue($this->db->query("SELECT {$template}"));
4564
+                $this->db->getValue($this->db->query("select {$template}"));
4565 4565
                 break;
4566 4566
             default:
4567 4567
                 if (!($template = $this->getChunk($tpl))) {
Please login to merge, or discard this patch.
manager/frames/nodes.functions.inc.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
         case 'publishedon':
39 39
         case 'pub_date':
40 40
         case 'unpub_date':
41
-            $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.' . $_SESSION['tree_sortby'], 'sc.' . $_SESSION['tree_sortby']);
41
+            $sortby = sprintf('CASE WHEN %s IS NULL THEN 1 ELSE 0 END, %s', 'sc.'.$_SESSION['tree_sortby'], 'sc.'.$_SESSION['tree_sortby']);
42 42
             break;
43 43
         default:
44
-            $sortby = 'sc.' . $_SESSION['tree_sortby'];
44
+            $sortby = 'sc.'.$_SESSION['tree_sortby'];
45 45
     };
46 46
 
47
-    $orderby = $modx->db->escape($sortby . ' ' . $_SESSION['tree_sortdir']);
47
+    $orderby = $modx->db->escape($sortby.' '.$_SESSION['tree_sortdir']);
48 48
 
49 49
     // Folder sorting gets special setup ;) Add menuindex and pagetitle
50 50
     if ($_SESSION['tree_sortby'] == 'isfolder') {
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
     $docgrp = (isset($_SESSION['mgrDocgroups']) && is_array($_SESSION['mgrDocgroups'])) ? implode(',', $_SESSION['mgrDocgroups']) : '';
59 59
     $showProtected = false;
60 60
     if (isset ($modx->config['tree_show_protected'])) {
61
-        $showProtected = (boolean)$modx->config['tree_show_protected'];
61
+        $showProtected = (boolean) $modx->config['tree_show_protected'];
62 62
     }
63
-    $mgrRole = (isset ($_SESSION['mgrRole']) && (string)$_SESSION['mgrRole'] === '1') ? '1' : '0';
63
+    $mgrRole = (isset ($_SESSION['mgrRole']) && (string) $_SESSION['mgrRole'] === '1') ? '1' : '0';
64 64
     if ($showProtected == false) {
65
-        $access = "AND (1={$mgrRole} OR sc.privatemgr=0" . (!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
65
+        $access = "AND (1={$mgrRole} OR sc.privatemgr=0".(!$docgrp ? ')' : " OR dg.document_group IN ({$docgrp}))");
66 66
     } else {
67 67
         $access = '';
68 68
     }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         }
99 99
 
100 100
         $weblinkDisplay = $row['type'] == 'reference' ? sprintf('&nbsp;%s', $_style['tree_linkgo']) : '';
101
-        $pageIdDisplay = '<small>(' . ($modx_textdir ? '&rlm;' : '') . $row['id'] . ')</small>';
101
+        $pageIdDisplay = '<small>('.($modx_textdir ? '&rlm;' : '').$row['id'].')</small>';
102 102
 
103 103
         // Prepare displaying user-locks
104 104
         $lockedByUser = '';
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                     'element_type' => $_lang["lock_element_type_7"],
110 110
                     'lasthit_df' => $rowLock['lasthit_df']
111 111
                 ));
112
-                $lockedByUser = '<span title="' . $title . '" class="editResource">' . $_style['tree_preview_resource'] . '</span>';
112
+                $lockedByUser = '<span title="'.$title.'" class="editResource">'.$_style['tree_preview_resource'].'</span>';
113 113
             } else {
114 114
                 $title = $modx->parseText($_lang["lock_element_locked_by"], array(
115 115
                     'element_type' => $_lang["lock_element_type_7"],
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
                     'lasthit_df' => $rowLock['lasthit_df']
118 118
                 ));
119 119
                 if ($modx->hasPermission('remove_locks')) {
120
-                    $lockedByUser = '<span onclick="modx.tree.unlockElement(7, ' . $row['id'] . ', this);return false;" title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
120
+                    $lockedByUser = '<span onclick="modx.tree.unlockElement(7, '.$row['id'].', this);return false;" title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
121 121
                 } else {
122
-                    $lockedByUser = '<span title="' . $title . '" class="lockedResource">' . $_style['icons_secured'] . '</span>';
122
+                    $lockedByUser = '<span title="'.$title.'" class="lockedResource">'.$_style['icons_secured'].'</span>';
123 123
                 }
124 124
             }
125 125
         }
@@ -128,22 +128,22 @@  discard block
 block discarded – undo
128 128
 
129 129
         $title = '';
130 130
         if (isDateNode($nodeNameSource)) {
131
-            $title = $_lang['pagetitle'] . ': ' . $row['pagetitle'] . '[+lf+]';
131
+            $title = $_lang['pagetitle'].': '.$row['pagetitle'].'[+lf+]';
132 132
         }
133
-        $title .= $_lang['id'] . ': ' . $row['id'];
134
-        $title .= '[+lf+]' . $_lang['resource_opt_menu_title'] . ': ' . $row['menutitle'];
135
-        $title .= '[+lf+]' . $_lang['resource_opt_menu_index'] . ': ' . $row['menuindex'];
136
-        $title .= '[+lf+]' . $_lang['alias'] . ': ' . (!empty($row['alias']) ? $row['alias'] : '-');
137
-        $title .= '[+lf+]' . $_lang['template'] . ': ' . $row['templatename'];
138
-        $title .= '[+lf+]' . $_lang['publish_date'] . ': ' . $modx->toDateFormat($row['pub_date']);
139
-        $title .= '[+lf+]' . $_lang['unpublish_date'] . ': ' . $modx->toDateFormat($row['unpub_date']);
140
-        $title .= '[+lf+]' . $_lang['page_data_web_access'] . ': ' . ($row['privateweb'] ? $_lang['private'] : $_lang['public']);
141
-        $title .= '[+lf+]' . $_lang['page_data_mgr_access'] . ': ' . ($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
142
-        $title .= '[+lf+]' . $_lang['resource_opt_richtext'] . ': ' . ($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
143
-        $title .= '[+lf+]' . $_lang['page_data_searchable'] . ': ' . ($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
144
-        $title .= '[+lf+]' . $_lang['page_data_cacheable'] . ': ' . ($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
133
+        $title .= $_lang['id'].': '.$row['id'];
134
+        $title .= '[+lf+]'.$_lang['resource_opt_menu_title'].': '.$row['menutitle'];
135
+        $title .= '[+lf+]'.$_lang['resource_opt_menu_index'].': '.$row['menuindex'];
136
+        $title .= '[+lf+]'.$_lang['alias'].': '.(!empty($row['alias']) ? $row['alias'] : '-');
137
+        $title .= '[+lf+]'.$_lang['template'].': '.$row['templatename'];
138
+        $title .= '[+lf+]'.$_lang['publish_date'].': '.$modx->toDateFormat($row['pub_date']);
139
+        $title .= '[+lf+]'.$_lang['unpublish_date'].': '.$modx->toDateFormat($row['unpub_date']);
140
+        $title .= '[+lf+]'.$_lang['page_data_web_access'].': '.($row['privateweb'] ? $_lang['private'] : $_lang['public']);
141
+        $title .= '[+lf+]'.$_lang['page_data_mgr_access'].': '.($row['privatemgr'] ? $_lang['private'] : $_lang['public']);
142
+        $title .= '[+lf+]'.$_lang['resource_opt_richtext'].': '.($row['richtext'] == 0 ? $_lang['no'] : $_lang['yes']);
143
+        $title .= '[+lf+]'.$_lang['page_data_searchable'].': '.($row['searchable'] == 0 ? $_lang['no'] : $_lang['yes']);
144
+        $title .= '[+lf+]'.$_lang['page_data_cacheable'].': '.($row['cacheable'] == 0 ? $_lang['no'] : $_lang['yes']);
145 145
         $title = $modx->htmlspecialchars($title);
146
-        $title = str_replace('[+lf+]', ' &#13;', $title);   // replace line-breaks with empty space as fall-back
146
+        $title = str_replace('[+lf+]', ' &#13;', $title); // replace line-breaks with empty space as fall-back
147 147
 
148 148
         $data = array(
149 149
             'id' => $row['id'],
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
             }
228 228
 
229 229
             if ($ph['contextmenu']) {
230
-                $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
230
+                $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
231 231
             }
232 232
 
233 233
             if ($_SESSION['tree_show_only_folders']) {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                     }
286 286
 
287 287
                     if ($ph['contextmenu']) {
288
-                        $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
288
+                        $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
289 289
                     }
290 290
 
291 291
                     $node .= $modx->parseText($tpl, $ph);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
                     }
324 324
 
325 325
                     if ($ph['contextmenu']) {
326
-                        $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
326
+                        $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
327 327
                     }
328 328
 
329 329
                     $node .= $modx->parseText($tpl, $ph);
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
                     }
375 375
 
376 376
                     if ($ph['contextmenu']) {
377
-                        $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
377
+                        $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
378 378
                     }
379 379
 
380 380
                     $node .= $modx->parseText($tpl, $ph);
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                     }
417 417
 
418 418
                     if ($ph['contextmenu']) {
419
-                        $ph['contextmenu'] = ' data-contextmenu="' . _htmlentities($ph['contextmenu']) . '"';
419
+                        $ph['contextmenu'] = ' data-contextmenu="'._htmlentities($ph['contextmenu']).'"';
420 420
                     }
421 421
 
422 422
                     $node .= $modx->parseText($tpl, $ph);
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
                     $nodetitle .= $modx->config['friendly_url_suffix'];
494 494
                 }
495 495
             }
496
-            $nodetitle = $modx->config['friendly_url_prefix'] . $nodetitle;
496
+            $nodetitle = $modx->config['friendly_url_prefix'].$nodetitle;
497 497
             break;
498 498
         case 'pagetitle':
499 499
             $nodetitle = $row['pagetitle'];
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 {
554 554
     $modx = evolutionCMS();
555 555
 
556
-    return (int)$modx->db->getValue($modx->db->query('SELECT count(*) FROM ' . $modx->getFullTableName('site_content') . ' WHERE parent=' . $parent . ' AND isfolder=' . $isfolder . ' '));
556
+    return (int) $modx->db->getValue($modx->db->query('SELECT count(*) FROM '.$modx->getFullTableName('site_content').' WHERE parent='.$parent.' AND isfolder='.$isfolder.' '));
557 557
 }
558 558
 
559 559
 /**
Please login to merge, or discard this patch.
manager/actions/welcome.static.php 3 patches
Indentation   +226 added lines, -226 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
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
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8 8
 if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9
-	// seems to be a new install - send the user to the configuration page
10
-	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
9
+    // seems to be a new install - send the user to the configuration page
10
+    exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
12 12
 
13 13
 // set placeholders
@@ -17,70 +17,70 @@  discard block
 block discarded – undo
17 17
 
18 18
 // setup message info
19 19
 if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
-	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
-	$_SESSION['nrnewmessages'] = $nrnewmessages;
23
-
24
-	$msg = array();
25
-	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
-	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
-	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
-	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
-	$ph['MessageInfo'] = implode("\n", $msg);
20
+    include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21
+    $_SESSION['nrtotalmessages'] = $nrtotalmessages;
22
+    $_SESSION['nrnewmessages'] = $nrnewmessages;
23
+
24
+    $msg = array();
25
+    $msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
27
+    $msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
+    $nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
29
+    $welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30
+    $msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31
+    $ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35 35
 if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36
-	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
-	$ph['SecurityIcon'] = wrapIcon($icon, 75);
36
+    $icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37
+    $ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39 39
 if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40
-	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
-	$ph['WebUserIcon'] = wrapIcon($icon, 99);
40
+    $icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41
+    $ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43 43
 if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44
-	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
-	$ph['ModulesIcon'] = wrapIcon($icon, 106);
44
+    $icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45
+    $ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47 47
 if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48
-	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
-	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
48
+    $icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49
+    $ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51 51
 if($modx->hasPermission('bk_manager')) {
52
-	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
-	$ph['BackupIcon'] = wrapIcon($icon, 93);
52
+    $icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53
+    $ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55 55
 if($modx->hasPermission('help')) {
56
-	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
-	$ph['HelpIcon'] = wrapIcon($icon, 9);
56
+    $icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57
+    $ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
60 60
 if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
-	if($config_check_results != $_lang['configcheck_ok']) {
63
-		$ph['config_check_results'] = $config_check_results;
64
-		$ph['config_display'] = 'block';
65
-	} else {
66
-		$ph['config_display'] = 'none';
67
-	}
61
+    include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
+    if($config_check_results != $_lang['configcheck_ok']) {
63
+        $ph['config_check_results'] = $config_check_results;
64
+        $ph['config_display'] = 'block';
65
+    } else {
66
+        $ph['config_display'] = 'none';
67
+    }
68 68
 } else {
69
-	$ph['config_display'] = 'none';
69
+    $ph['config_display'] = 'none';
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73 73
 if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
75
-		case 'logout_reminder':
76
-			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77
-			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
78
-			break;
79
-	}
80
-	$ph['show_logout_reminder'] = 'block';
81
-	unset($_SESSION['show_logout_reminder']);
74
+    switch($_SESSION['show_logout_reminder']['type']) {
75
+        case 'logout_reminder':
76
+            $date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77
+            $ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
78
+            break;
79
+    }
80
+    $ph['show_logout_reminder'] = 'block';
81
+    unset($_SESSION['show_logout_reminder']);
82 82
 } else {
83
-	$ph['show_logout_reminder'] = 'none';
83
+    $ph['show_logout_reminder'] = 'none';
84 84
 }
85 85
 
86 86
 // Check multiple sessions
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 $nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
129 129
 
130 130
 $ph['UserInfo'] = $modx->parseText($tpl, array(
131
-	'username' => $modx->getLoginUserName(),
132
-	'role' => $_SESSION['mgrPermissions']['name'],
133
-	'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
134
-	'logincount' => $_SESSION['mgrLogincount'] + 1,
135
-	'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
131
+    'username' => $modx->getLoginUserName(),
132
+    'role' => $_SESSION['mgrPermissions']['name'],
133
+    'lastlogin' => $modx->toDateFormat($_SESSION['mgrLastlogin'] + $server_offset_time),
134
+    'logincount' => $_SESSION['mgrLogincount'] + 1,
135
+    'msginfo' => sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages)
136 136
 ));
137 137
 
138 138
 $from = array();
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143 143
 if($modx->db->getRecordCount($rs) < 1) {
144
-	$html = '<p>[%no_active_users_found%]</p>';
144
+    $html = '<p>[%no_active_users_found%]</p>';
145 145
 } else {
146
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147
-	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148
-	$ph['now'] = strftime('%H:%M:%S', $now);
149
-	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
150
-	$html = '
146
+    include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147
+    $now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148
+    $ph['now'] = strftime('%H:%M:%S', $now);
149
+    $timetocheck = ($now - (60 * 20)); //+$server_offset_time;
150
+    $html = '
151 151
 	<div class="card-body">
152 152
 		[%onlineusers_message%] 
153 153
 		<b>[+now+]</b>):
@@ -165,33 +165,33 @@  discard block
 block discarded – undo
165 165
 	</thead>
166 166
 	<tbody>';
167 167
 
168
-	$userList = array();
169
-	$userCount = array();
170
-	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
172
-		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173
-
174
-		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
175
-		$webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
176
-		$ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
177
-		$currentaction = getAction($activeusers['action'], $activeusers['id']);
178
-		$userList[] = array(
179
-			$idle,
180
-			'',
181
-			$activeusers['username'],
182
-			$webicon,
183
-			abs($activeusers['internalKey']),
184
-			$ip,
185
-			strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
186
-			$currentaction
187
-		);
188
-	}
189
-	foreach($userList as $params) {
190
-		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
192
-	}
193
-
194
-	$html .= '
168
+    $userList = array();
169
+    $userCount = array();
170
+    // Create userlist with session-count first before output
171
+    while($activeusers = $modx->db->getRow($rs)) {
172
+        $userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173
+
174
+        $idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
175
+        $webicon = $activeusers['internalKey'] < 0 ? '<img src="[&tree_globe&]" alt="Web user" />&nbsp;' : '';
176
+        $ip = $activeusers['ip'] === '::1' ? '127.0.0.1' : $activeusers['ip'];
177
+        $currentaction = getAction($activeusers['action'], $activeusers['id']);
178
+        $userList[] = array(
179
+            $idle,
180
+            '',
181
+            $activeusers['username'],
182
+            $webicon,
183
+            abs($activeusers['internalKey']),
184
+            $ip,
185
+            strftime('%H:%M:%S', $activeusers['lasthit'] + $server_offset_time),
186
+            $currentaction
187
+        );
188
+    }
189
+    foreach($userList as $params) {
190
+        $params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191
+        $html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
192
+    }
193
+
194
+    $html .= '
195 195
 	</tbody>
196 196
 	</table>
197 197
 </div>
@@ -232,17 +232,17 @@  discard block
 block discarded – undo
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234 234
 if(is_array($evtOut)) {
235
-	$output = implode('', $evtOut);
236
-	$ph['OnManagerWelcomePrerender'] = $output;
235
+    $output = implode('', $evtOut);
236
+    $ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
238 238
 
239 239
 $widgets['welcome'] = array(
240
-	'menuindex' => '10',
241
-	'id' => 'welcome',
242
-	'cols' => 'col-sm-6',
243
-	'icon' => 'fa-home',
244
-	'title' => '[%welcome_title%]',
245
-	'body' => '
240
+    'menuindex' => '10',
241
+    'id' => 'welcome',
242
+    'cols' => 'col-sm-6',
243
+    'icon' => 'fa-home',
244
+    'title' => '[%welcome_title%]',
245
+    'body' => '
246 246
 				<div class="wm_buttons card-body"> 
247 247
 					<!--@IF:[[#hasPermission?key=new_user]] OR [[#hasPermission?key=edit_user]]--> 
248 248
 					<span class="wm_button">
@@ -320,25 +320,25 @@  discard block
 block discarded – undo
320 320
 					</table>
321 321
 				</div>
322 322
 		',
323
-	'hide'=>'0'
323
+    'hide'=>'0'
324 324
 );
325 325
 $widgets['onlineinfo'] = array(
326
-	'menuindex' => '20',
327
-	'id' => 'onlineinfo',
328
-	'cols' => 'col-sm-6',
329
-	'icon' => 'fa-user',
330
-	'title' => '[%onlineusers_title%]',
331
-	'body' => '<div class="userstable">[+OnlineInfo+]</div>',
332
-	'hide'=>'0'
326
+    'menuindex' => '20',
327
+    'id' => 'onlineinfo',
328
+    'cols' => 'col-sm-6',
329
+    'icon' => 'fa-user',
330
+    'title' => '[%onlineusers_title%]',
331
+    'body' => '<div class="userstable">[+OnlineInfo+]</div>',
332
+    'hide'=>'0'
333 333
 );
334 334
 $widgets['recentinfo'] = array(
335
-	'menuindex' => '30',
336
-	'id' => 'modxrecent_widget',
337
-	'cols' => 'col-sm-12',
338
-	'icon' => 'fa-pencil-square-o',
339
-	'title' => '[%activity_title%]',
340
-	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341
-	'hide'=>'0'
335
+    'menuindex' => '30',
336
+    'id' => 'modxrecent_widget',
337
+    'cols' => 'col-sm-12',
338
+    'icon' => 'fa-pencil-square-o',
339
+    'title' => '[%activity_title%]',
340
+    'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341
+    'hide'=>'0'
342 342
 );
343 343
 if ($modx->config['rss_url_news']) {
344 344
     $widgets['news'] = array(
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368 368
 if(is_array($sitewidgets)) {
369
-	$newwidgets = array();
369
+    $newwidgets = array();
370 370
     foreach($sitewidgets as $widget){
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
@@ -374,21 +374,21 @@  discard block
 block discarded – undo
374 374
 }
375 375
 
376 376
 usort($widgets, function ($a, $b) {
377
-	return $a['menuindex'] - $b['menuindex'];
377
+    return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382 382
 foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
384
-		$output .= $modx->parseText($tpl, $widget);
385
-	}
383
+    if ($widget['hide'] != '1'){
384
+        $output .= $modx->parseText($tpl, $widget);
385
+    }
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
390 390
 if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
391
+    $modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
392 392
 }
393 393
 
394 394
 $target = $modx->config['manager_welcome_tpl'];
@@ -396,27 +396,27 @@  discard block
 block discarded – undo
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398 398
 if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
400
-		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
402
-		$content = file_get_contents(trim(substr($target, 6)));
403
-	} else {
404
-		$content = '';
405
-	}
399
+    if(substr($target, 0, 6) === '@CHUNK') {
400
+        $content = $modx->getChunk(trim(substr($target, 7)));
401
+    } elseif(substr($target, 0, 5) === '@FILE') {
402
+        $content = file_get_contents(trim(substr($target, 6)));
403
+    } else {
404
+        $content = '';
405
+    }
406 406
 } else {
407
-	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
409
-		$content = $chunk;
410
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
411
-		$content = file_get_contents(MODX_BASE_PATH . $target);
412
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
415
-	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
-	} else {
418
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419
-	}
407
+    $chunk = $modx->getChunk($target);
408
+    if($chunk !== false && !empty($chunk)) {
409
+        $content = $chunk;
410
+    } elseif(is_file(MODX_BASE_PATH . $target)) {
411
+        $content = file_get_contents(MODX_BASE_PATH . $target);
412
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
+    } elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
415
+    {
416
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
+    } else {
418
+        $content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419
+    }
420 420
 }
421 421
 
422 422
 // merge placeholders
@@ -424,8 +424,8 @@  discard block
 block discarded – undo
424 424
 $content = $modx->mergeSettingsContent($content);
425 425
 $content = $modx->parseText($content, $ph);
426 426
 if(strpos($content, '[+') !== false) {
427
-	$modx->toPlaceholders($ph);
428
-	$content = $modx->mergePlaceholderContent($content);
427
+    $modx->toPlaceholders($ph);
428
+    $content = $modx->mergePlaceholderContent($content);
429 429
 }
430 430
 $content = $modx->parseDocumentSource($content);
431 431
 $content = $modx->parseText($content, $_lang, '[%', '%]');
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 434
 
435 435
 if($js = $modx->getRegisteredClientScripts()) {
436
-	$content .= $js;
436
+    $content .= $js;
437 437
 }
438 438
 
439 439
 echo $content;
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 444
 //</span>
445 445
 function getTplWidget() { // recent document info
446
-	return '
446
+    return '
447 447
 		<div class="[+cols+]" id="[+id+]">
448 448
 			<div class="card"[+cardAttr+]>
449 449
 				<div class="card-header"[+headAttr+]> <i class="fa [+icon+]"></i> [+title+] </div>
@@ -454,11 +454,11 @@  discard block
 block discarded – undo
454 454
 }
455 455
 
456 456
 function getRecentInfo() { // recent document info
457
-	$modx = evolutionCMS();
457
+    $modx = evolutionCMS();
458 458
 
459
-	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
459
+    $modx->addSnippet('recentInfoList', 'getRecentInfoList');
460 460
 
461
-	$html = '
461
+    $html = '
462 462
 			<div class="table-responsive">
463 463
 				<table class="table data">
464 464
 					<thead>
@@ -476,96 +476,96 @@  discard block
 block discarded – undo
476 476
 				</table>
477 477
 			</div>
478 478
 ';
479
-	return $html;
479
+    return $html;
480 480
 }
481 481
 
482 482
 function getRecentInfoList() {
483
-	$modx = evolutionCMS();
484
-
485
-	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486
-
487
-	if($modx->db->getRecordCount($rs) < 1) {
488
-		return '<tr><td>[%no_activity_message%]</td></tr>';
489
-	}
490
-
491
-	$tpl = getRecentInfoRowTpl();
492
-
493
-	$btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
494
-	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
495
-
496
-	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
498
-		$docid = $ph['id'];
499
-		$_ = $modx->getUserInfo($ph['editedby']);
500
-		$ph['username'] = $_['username'];
501
-
502
-		if($ph['deleted'] == 1) {
503
-			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
505
-			$ph['status'] = 'unpublished font-italic text-muted';
506
-		} else {
507
-			$ph['status'] = 'published';
508
-		}
509
-
510
-		if($modx->hasPermission('edit_document')) {
511
-			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
-		} else {
513
-			$ph['edit_btn'] = '';
514
-		}
515
-
516
-		$preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
517
-		$ph['preview_btn'] = str_replace(array(
518
-			'[+id+]',
519
-			'[+preview_disabled+]'
520
-		), array(
521
-			$docid,
522
-			$preview_disabled
523
-		), $btntpl['preview_btn']);
524
-
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
527
-				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
528
-			} else {
529
-				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
530
-			}
531
-			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
-		} else {
533
-			$ph['delete_btn'] = '';
534
-		}
535
-
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
537
-			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
538
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539
-			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
540
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541
-			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
542
-		} else {
543
-			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
544
-		}
545
-		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546
-
547
-		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548
-
549
-		if($ph['longtitle'] == '') {
550
-			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551
-		}
552
-		if($ph['description'] == '') {
553
-			$ph['description'] = '(<i>[%not_set%]</i>)';
554
-		}
555
-		if($ph['introtext'] == '') {
556
-			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557
-		}
558
-		if($ph['alias'] == '') {
559
-			$ph['alias'] = '(<i>[%not_set%]</i>)';
560
-		}
561
-
562
-		$output[] = $modx->parseText($tpl, $ph);
563
-	}
564
-	return implode("\n", $output);
483
+    $modx = evolutionCMS();
484
+
485
+    $rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486
+
487
+    if($modx->db->getRecordCount($rs) < 1) {
488
+        return '<tr><td>[%no_activity_message%]</td></tr>';
489
+    }
490
+
491
+    $tpl = getRecentInfoRowTpl();
492
+
493
+    $btntpl['edit'] = '<a title="[%edit_resource%]" href="index.php?a=27&amp;id=[+id+]" target="main"><i class="fa fa-edit fa-fw"></i></a> ';
494
+    $btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
495
+
496
+    $output = array();
497
+    while($ph = $modx->db->getRow($rs)) {
498
+        $docid = $ph['id'];
499
+        $_ = $modx->getUserInfo($ph['editedby']);
500
+        $ph['username'] = $_['username'];
501
+
502
+        if($ph['deleted'] == 1) {
503
+            $ph['status'] = 'deleted text-danger';
504
+        } elseif($ph['published'] == 0) {
505
+            $ph['status'] = 'unpublished font-italic text-muted';
506
+        } else {
507
+            $ph['status'] = 'published';
508
+        }
509
+
510
+        if($modx->hasPermission('edit_document')) {
511
+            $ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
+        } else {
513
+            $ph['edit_btn'] = '';
514
+        }
515
+
516
+        $preview_disabled = ($ph['deleted'] == 1) ? 'disabled' : '';
517
+        $ph['preview_btn'] = str_replace(array(
518
+            '[+id+]',
519
+            '[+preview_disabled+]'
520
+        ), array(
521
+            $docid,
522
+            $preview_disabled
523
+        ), $btntpl['preview_btn']);
524
+
525
+        if($modx->hasPermission('delete_document')) {
526
+            if($ph['deleted'] == 0) {
527
+                $delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
528
+            } else {
529
+                $delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
530
+            }
531
+            $ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
+        } else {
533
+            $ph['delete_btn'] = '';
534
+        }
535
+
536
+        if($ph['deleted'] == 1 && $ph['published'] == 0) {
537
+            $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
538
+        } elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539
+            $publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
540
+        } elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541
+            $publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
542
+        } else {
543
+            $publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
544
+        }
545
+        $ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546
+
547
+        $ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548
+
549
+        if($ph['longtitle'] == '') {
550
+            $ph['longtitle'] = '(<i>[%not_set%]</i>)';
551
+        }
552
+        if($ph['description'] == '') {
553
+            $ph['description'] = '(<i>[%not_set%]</i>)';
554
+        }
555
+        if($ph['introtext'] == '') {
556
+            $ph['introtext'] = '(<i>[%not_set%]</i>)';
557
+        }
558
+        if($ph['alias'] == '') {
559
+            $ph['alias'] = '(<i>[%not_set%]</i>)';
560
+        }
561
+
562
+        $output[] = $modx->parseText($tpl, $ph);
563
+    }
564
+    return implode("\n", $output);
565 565
 }
566 566
 
567 567
 function getRecentInfoRowTpl() {
568
-	$tpl = '
568
+    $tpl = '
569 569
 						<tr>
570 570
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
571 571
 							<td data-toggle="collapse" data-target=".collapse[+id+]"><a class="[+status+]" title="[%edit_resource%]" href="index.php?a=3&amp;id=[+id+]" target="main">[+pagetitle+]</a></td>
@@ -589,16 +589,16 @@  discard block
 block discarded – undo
589 589
 								</div>
590 590
 							</td>
591 591
 						</tr>';
592
-	return $tpl;
592
+    return $tpl;
593 593
 }
594 594
 
595 595
 // setup icons
596 596
 function wrapIcon($i, $action) {
597
-	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
597
+    return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
598 598
 }
599 599
 
600 600
 function getStartUpScript() {
601
-	$script = '
601
+    $script = '
602 602
         <script type="text/javascript">
603 603
         function hideConfigCheckWarning(key) {
604 604
         	var xhr = new XMLHttpRequest();
@@ -622,5 +622,5 @@  discard block
 block discarded – undo
622 622
 		})(jQuery);        
623 623
         </script>
624 624
 ';
625
-	return $script;
625
+    return $script;
626 626
 }
Please login to merge, or discard this patch.
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
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 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if ($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,50 +16,50 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
20
-	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
19
+if ($modx->hasPermission('messages')) {
20
+	include_once(MODX_MANAGER_PATH.'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
23 23
 
24 24
 	$msg = array();
25 25
 	$msg[] = sprintf('<a href="index.php?a=10" target="main"><img src="%s" /></a>', $_style['icons_mail_large']);
26
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">' . $_SESSION['nrnewmessages'] . '</span>)' : '';
26
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? ' (<span style="color:red">'.$_SESSION['nrnewmessages'].'</span>)' : '';
27 27
 	$msg[] = sprintf('<span style="color:#909090;font-size:15px;font-weight:bold">&nbsp;<a class="wm_messages_inbox_link" href="index.php?a=10" target="main">[%%inbox%%]</a>%s</span><br />', $nrnewmessages);
28
-	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">' . $_SESSION['nrnewmessages'] . '</span>' : '0';
28
+	$nrnewmessages = $_SESSION['nrnewmessages'] > 0 ? '<span style="color:red;">'.$_SESSION['nrnewmessages'].'</span>' : '0';
29 29
 	$welcome_messages = sprintf($_lang['welcome_messages'], $_SESSION['nrtotalmessages'], $nrnewmessages);
30 30
 	$msg[] = sprintf('<span class="comment">%s</span>', $welcome_messages);
31 31
 	$ph['MessageInfo'] = implode("\n", $msg);
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if ($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if ($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if ($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if ($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if ($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if ($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
60
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61
-	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
-	if($config_check_results != $_lang['configcheck_ok']) {
60
+if (($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61
+	include_once(MODX_MANAGER_PATH.'includes/config_check.inc.php');
62
+	if ($config_check_results != $_lang['configcheck_ok']) {
63 63
 		$ph['config_check_results'] = $config_check_results;
64 64
 		$ph['config_display'] = 'block';
65 65
 	} else {
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73
-if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
73
+if (isset($_SESSION['show_logout_reminder'])) {
74
+	switch ($_SESSION['show_logout_reminder']['type']) {
75 75
 		case 'logout_reminder':
76 76
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77 77
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	</tr>
126 126
 </table>';
127 127
 
128
-$nrnewmessages = '<span class="text-danger">' . $_SESSION['nrnewmessages'] . '</span>';
128
+$nrnewmessages = '<span class="text-danger">'.$_SESSION['nrnewmessages'].'</span>';
129 129
 
130 130
 $ph['UserInfo'] = $modx->parseText($tpl, array(
131 131
 	'username' => $modx->getLoginUserName(),
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143
-if($modx->db->getRecordCount($rs) < 1) {
143
+if ($modx->db->getRecordCount($rs) < 1) {
144 144
 	$html = '<p>[%no_active_users_found%]</p>';
145 145
 } else {
146
-	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
146
+	include_once(MODX_MANAGER_PATH.'includes/actionlist.inc.php');
147 147
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148 148
 	$ph['now'] = strftime('%H:%M:%S', $now);
149 149
 	$timetocheck = ($now - (60 * 20)); //+$server_offset_time;
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	$userList = array();
169 169
 	$userCount = array();
170 170
 	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
171
+	while ($activeusers = $modx->db->getRow($rs)) {
172 172
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173 173
 
174 174
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 			$currentaction
187 187
 		);
188 188
 	}
189
-	foreach($userList as $params) {
189
+	foreach ($userList as $params) {
190 190
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191
-		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
191
+		$html .= "\n\t\t".vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
192 192
 	}
193 193
 
194 194
 	$html .= '
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 $ph['OnlineInfo'] = $html;
201 201
 
202 202
 // include rss feeds for important forum topics
203
-include_once(MODX_MANAGER_PATH . 'includes/rss.inc.php');
203
+include_once(MODX_MANAGER_PATH.'includes/rss.inc.php');
204 204
 $ph['modx_security_notices_content'] = $feedData['modx_security_notices_content'];
205 205
 $ph['modx_news_content'] = $feedData['modx_news_content'];
206 206
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234
-if(is_array($evtOut)) {
234
+if (is_array($evtOut)) {
235 235
 	$output = implode('', $evtOut);
236 236
 	$ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
@@ -365,57 +365,57 @@  discard block
 block discarded – undo
365 365
 
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368
-if(is_array($sitewidgets)) {
368
+if (is_array($sitewidgets)) {
369 369
 	$newwidgets = array();
370
-    foreach($sitewidgets as $widget){
370
+    foreach ($sitewidgets as $widget) {
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
373 373
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
374 374
 }
375 375
 
376
-usort($widgets, function ($a, $b) {
376
+usort($widgets, function($a, $b){
377 377
 	return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382
-foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
382
+foreach ($widgets as $widget) {
383
+	if ($widget['hide'] != '1') {
384 384
 		$output .= $modx->parseText($tpl, $widget);
385 385
 	}
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
390
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391
-	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
390
+if (!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391
+	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH.'media/style/common/welcome.tpl';
392 392
 }
393 393
 
394 394
 $target = $modx->config['manager_welcome_tpl'];
395 395
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398
-if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
398
+if (substr($target, 0, 1) === '@') {
399
+	if (substr($target, 0, 6) === '@CHUNK') {
400 400
 		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
401
+	} elseif (substr($target, 0, 5) === '@FILE') {
402 402
 		$content = file_get_contents(trim(substr($target, 6)));
403 403
 	} else {
404 404
 		$content = '';
405 405
 	}
406 406
 } else {
407 407
 	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
408
+	if ($chunk !== false && !empty($chunk)) {
409 409
 		$content = $chunk;
410
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
411
-		$content = file_get_contents(MODX_BASE_PATH . $target);
412
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
410
+	} elseif (is_file(MODX_BASE_PATH.$target)) {
411
+		$content = file_get_contents(MODX_BASE_PATH.$target);
412
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl')) {
413
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/welcome.tpl');
414
+	} elseif (is_file(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html')) // ClipperCMS compatible
415 415
 	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
416
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/'.$modx->config['manager_theme'].'/html/welcome.html');
417 417
 	} else {
418
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
418
+		$content = file_get_contents(MODX_MANAGER_PATH.'media/style/common/welcome.tpl');
419 419
 	}
420 420
 }
421 421
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 $content = $modx->mergeConditionalTagsContent($content);
424 424
 $content = $modx->mergeSettingsContent($content);
425 425
 $content = $modx->parseText($content, $ph);
426
-if(strpos($content, '[+') !== false) {
426
+if (strpos($content, '[+') !== false) {
427 427
 	$modx->toPlaceholders($ph);
428 428
 	$content = $modx->mergePlaceholderContent($content);
429 429
 }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 $content = $modx->parseText($content, $_style, '[&', '&]');
433 433
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 434
 
435
-if($js = $modx->getRegisteredClientScripts()) {
435
+if ($js = $modx->getRegisteredClientScripts()) {
436 436
 	$content .= $js;
437 437
 }
438 438
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
443 443
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 444
 //</span>
445
-function getTplWidget() { // recent document info
445
+function getTplWidget(){ // recent document info
446 446
 	return '
447 447
 		<div class="[+cols+]" id="[+id+]">
448 448
 			<div class="card"[+cardAttr+]>
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 ';
454 454
 }
455 455
 
456
-function getRecentInfo() { // recent document info
456
+function getRecentInfo(){ // recent document info
457 457
 	$modx = evolutionCMS();
458 458
 
459 459
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -479,12 +479,12 @@  discard block
 block discarded – undo
479 479
 	return $html;
480 480
 }
481 481
 
482
-function getRecentInfoList() {
482
+function getRecentInfoList(){
483 483
 	$modx = evolutionCMS();
484 484
 
485 485
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486 486
 
487
-	if($modx->db->getRecordCount($rs) < 1) {
487
+	if ($modx->db->getRecordCount($rs) < 1) {
488 488
 		return '<tr><td>[%no_activity_message%]</td></tr>';
489 489
 	}
490 490
 
@@ -494,20 +494,20 @@  discard block
 block discarded – undo
494 494
 	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
495 495
 
496 496
 	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
497
+	while ($ph = $modx->db->getRow($rs)) {
498 498
 		$docid = $ph['id'];
499 499
 		$_ = $modx->getUserInfo($ph['editedby']);
500 500
 		$ph['username'] = $_['username'];
501 501
 
502
-		if($ph['deleted'] == 1) {
502
+		if ($ph['deleted'] == 1) {
503 503
 			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
504
+		} elseif ($ph['published'] == 0) {
505 505
 			$ph['status'] = 'unpublished font-italic text-muted';
506 506
 		} else {
507 507
 			$ph['status'] = 'published';
508 508
 		}
509 509
 
510
-		if($modx->hasPermission('edit_document')) {
510
+		if ($modx->hasPermission('edit_document')) {
511 511
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512 512
 		} else {
513 513
 			$ph['edit_btn'] = '';
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 			$preview_disabled
523 523
 		), $btntpl['preview_btn']);
524 524
 
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
525
+		if ($modx->hasPermission('delete_document')) {
526
+			if ($ph['deleted'] == 0) {
527 527
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
528 528
 			} else {
529 529
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
@@ -533,11 +533,11 @@  discard block
 block discarded – undo
533 533
 			$ph['delete_btn'] = '';
534 534
 		}
535 535
 
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
536
+		if ($ph['deleted'] == 1 && $ph['published'] == 0) {
537 537
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
538
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
538
+		} elseif ($ph['deleted'] == 1 && $ph['published'] == 1) {
539 539
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
540
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
540
+		} elseif ($ph['deleted'] == 0 && $ph['published'] == 0) {
541 541
 			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
542 542
 		} else {
543 543
 			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
@@ -546,16 +546,16 @@  discard block
 block discarded – undo
546 546
 
547 547
 		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548 548
 
549
-		if($ph['longtitle'] == '') {
549
+		if ($ph['longtitle'] == '') {
550 550
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551 551
 		}
552
-		if($ph['description'] == '') {
552
+		if ($ph['description'] == '') {
553 553
 			$ph['description'] = '(<i>[%not_set%]</i>)';
554 554
 		}
555
-		if($ph['introtext'] == '') {
555
+		if ($ph['introtext'] == '') {
556 556
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557 557
 		}
558
-		if($ph['alias'] == '') {
558
+		if ($ph['alias'] == '') {
559 559
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
560 560
 		}
561 561
 
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 	return implode("\n", $output);
565 565
 }
566 566
 
567
-function getRecentInfoRowTpl() {
567
+function getRecentInfoRowTpl(){
568 568
 	$tpl = '
569 569
 						<tr>
570 570
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -593,11 +593,11 @@  discard block
 block discarded – undo
593 593
 }
594 594
 
595 595
 // setup icons
596
-function wrapIcon($i, $action) {
596
+function wrapIcon($i, $action){
597 597
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
598 598
 }
599 599
 
600
-function getStartUpScript() {
600
+function getStartUpScript(){
601 601
 	$script = '
602 602
         <script type="text/javascript">
603 603
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.
Braces   +77 added lines, -67 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
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 6
 unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
7 7
 
8
-if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
8
+if($modx->hasPermission('settings') && (!isset($settings_version) || $settings_version != $modx->getVersionData('version'))) {
9 9
 	// seems to be a new install - send the user to the configuration page
10 10
 	exit('<script type="text/javascript">document.location.href="index.php?a=17";</script>');
11 11
 }
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 $_SESSION['nrnewmessages'] = 0;
17 17
 
18 18
 // setup message info
19
-if($modx->hasPermission('messages')) {
19
+if($modx->hasPermission('messages')) {
20 20
 	include_once(MODX_MANAGER_PATH . 'includes/messageCount.inc.php');
21 21
 	$_SESSION['nrtotalmessages'] = $nrtotalmessages;
22 22
 	$_SESSION['nrnewmessages'] = $nrnewmessages;
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
 }
33 33
 
34 34
 // setup icons
35
-if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
35
+if($modx->hasPermission('new_user') || $modx->hasPermission('edit_user')) {
36 36
 	$icon = '<i class="[&icons_security_large&]" alt="[%user_management_title%]"> </i>[%user_management_title%]';
37 37
 	$ph['SecurityIcon'] = wrapIcon($icon, 75);
38 38
 }
39
-if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
39
+if($modx->hasPermission('new_web_user') || $modx->hasPermission('edit_web_user')) {
40 40
 	$icon = '<i class="[&icons_webusers_large&]" alt="[%web_user_management_title%]"> </i>[%web_user_management_title%]';
41 41
 	$ph['WebUserIcon'] = wrapIcon($icon, 99);
42 42
 }
43
-if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
43
+if($modx->hasPermission('new_module') || $modx->hasPermission('edit_module')) {
44 44
 	$icon = '<i class="[&icons_modules_large&]" alt="[%manage_modules%]"> </i>[%modules%]';
45 45
 	$ph['ModulesIcon'] = wrapIcon($icon, 106);
46 46
 }
47
-if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
47
+if($modx->hasPermission('new_template') || $modx->hasPermission('edit_template') || $modx->hasPermission('new_snippet') || $modx->hasPermission('edit_snippet') || $modx->hasPermission('new_plugin') || $modx->hasPermission('edit_plugin') || $modx->hasPermission('manage_metatags')) {
48 48
 	$icon = '<i class="[&icons_resources_large&]" alt="[%element_management%]"> </i>[%elements%]';
49 49
 	$ph['ResourcesIcon'] = wrapIcon($icon, 76);
50 50
 }
51
-if($modx->hasPermission('bk_manager')) {
51
+if($modx->hasPermission('bk_manager')) {
52 52
 	$icon = '<i class="[&icons_backup_large&]" alt="[%bk_manager%]"> </i>[%backup%]';
53 53
 	$ph['BackupIcon'] = wrapIcon($icon, 93);
54 54
 }
55
-if($modx->hasPermission('help')) {
55
+if($modx->hasPermission('help')) {
56 56
 	$icon = '<i class="[&icons_help_large&]" alt="[%help%]" /> </i>[%help%]';
57 57
 	$ph['HelpIcon'] = wrapIcon($icon, 9);
58 58
 }
59 59
 // do some config checks
60
-if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
60
+if(($modx->config['warning_visibility'] == 0 && $_SESSION['mgrRole'] == 1) || $modx->config['warning_visibility'] == 1) {
61 61
 	include_once(MODX_MANAGER_PATH . 'includes/config_check.inc.php');
62
-	if($config_check_results != $_lang['configcheck_ok']) {
62
+	if($config_check_results != $_lang['configcheck_ok']) {
63 63
 		$ph['config_check_results'] = $config_check_results;
64 64
 		$ph['config_display'] = 'block';
65
-	} else {
65
+	} else {
66 66
 		$ph['config_display'] = 'none';
67 67
 	}
68
-} else {
68
+} else {
69 69
 	$ph['config_display'] = 'none';
70 70
 }
71 71
 
72 72
 // Check logout-reminder
73
-if(isset($_SESSION['show_logout_reminder'])) {
74
-	switch($_SESSION['show_logout_reminder']['type']) {
73
+if(isset($_SESSION['show_logout_reminder'])) {
74
+	switch($_SESSION['show_logout_reminder']['type']) {
75 75
 		case 'logout_reminder':
76 76
 			$date = $modx->toDateFormat($_SESSION['show_logout_reminder']['lastHit'], 'dateOnly');
77 77
 			$ph['logout_reminder_msg'] = str_replace('[+date+]', $date, $_lang['logout_reminder_msg']);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	}
80 80
 	$ph['show_logout_reminder'] = 'block';
81 81
 	unset($_SESSION['show_logout_reminder']);
82
-} else {
82
+} else {
83 83
 	$ph['show_logout_reminder'] = 'none';
84 84
 }
85 85
 
@@ -140,9 +140,9 @@  discard block
 block discarded – undo
140 140
 $from[] = " us LEFT JOIN [+prefix+]active_users au ON au.sid=us.sid WHERE au.action <> '8'";
141 141
 $rs = $modx->db->select('*', $from, '', 'username ASC, au.sid ASC');
142 142
 
143
-if($modx->db->getRecordCount($rs) < 1) {
143
+if($modx->db->getRecordCount($rs) < 1) {
144 144
 	$html = '<p>[%no_active_users_found%]</p>';
145
-} else {
145
+} else {
146 146
 	include_once(MODX_MANAGER_PATH . 'includes/actionlist.inc.php');
147 147
 	$now = $_SERVER['REQUEST_TIME'] + $server_offset_time;
148 148
 	$ph['now'] = strftime('%H:%M:%S', $now);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	$userList = array();
169 169
 	$userCount = array();
170 170
 	// Create userlist with session-count first before output
171
-	while($activeusers = $modx->db->getRow($rs)) {
171
+	while($activeusers = $modx->db->getRow($rs)) {
172 172
 		$userCount[$activeusers['internalKey']] = isset($userCount[$activeusers['internalKey']]) ? $userCount[$activeusers['internalKey']] + 1 : 1;
173 173
 
174 174
 		$idle = $activeusers['lasthit'] < $timetocheck ? ' class="userIdle"' : '';
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 			$currentaction
187 187
 		);
188 188
 	}
189
-	foreach($userList as $params) {
189
+	foreach($userList as $params) {
190 190
 		$params[1] = $userCount[$params[4]] > 1 ? ' class="userMultipleSessions"' : '';
191 191
 		$html .= "\n\t\t" . vsprintf('<tr%s><td><strong%s>%s</strong></td><td>%s%s</td><td>%s</td><td>%s</td><td>%s</td></tr>', $params);
192 192
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 // invoke event OnManagerWelcomePrerender
233 233
 $evtOut = $modx->invokeEvent('OnManagerWelcomePrerender');
234
-if(is_array($evtOut)) {
234
+if(is_array($evtOut)) {
235 235
 	$output = implode('', $evtOut);
236 236
 	$ph['OnManagerWelcomePrerender'] = $output;
237 237
 }
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	'body' => '<div class="widget-stage">[+RecentInfo+]</div>',
341 341
 	'hide'=>'0'
342 342
 );
343
-if ($modx->config['rss_url_news']) {
343
+if ($modx->config['rss_url_news']) {
344 344
     $widgets['news'] = array(
345 345
         'menuindex' => '40',
346 346
         'id' => 'news',
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         'hide'=>'0'
352 352
     );
353 353
 }
354
-if ($modx->config['rss_url_security']) {
354
+if ($modx->config['rss_url_security']) {
355 355
     $widgets['security'] = array(
356 356
         'menuindex' => '50',
357 357
         'id' => 'security',
@@ -365,29 +365,29 @@  discard block
 block discarded – undo
365 365
 
366 366
 // invoke OnManagerWelcomeHome event
367 367
 $sitewidgets = $modx->invokeEvent("OnManagerWelcomeHome", array('widgets' => $widgets));
368
-if(is_array($sitewidgets)) {
368
+if(is_array($sitewidgets)) {
369 369
 	$newwidgets = array();
370
-    foreach($sitewidgets as $widget){
370
+    foreach($sitewidgets as $widget) {
371 371
         $newwidgets = array_merge($newwidgets, unserialize($widget));
372 372
     }
373 373
     $widgets = (count($newwidgets) > 0) ? $newwidgets : $widgets;
374 374
 }
375 375
 
376
-usort($widgets, function ($a, $b) {
376
+usort($widgets, function ($a, $b){
377 377
 	return $a['menuindex'] - $b['menuindex'];
378 378
 });
379 379
 
380 380
 $tpl = getTplWidget();
381 381
 $output = '';
382
-foreach($widgets as $widget) {
383
-	if ($widget['hide'] != '1'){
382
+foreach($widgets as $widget) {
383
+	if ($widget['hide'] != '1') {
384 384
 		$output .= $modx->parseText($tpl, $widget);
385 385
 	}
386 386
 }
387 387
 $ph['widgets'] = $output;
388 388
 
389 389
 // load template
390
-if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
390
+if(!isset($modx->config['manager_welcome_tpl']) || empty($modx->config['manager_welcome_tpl'])) {
391 391
 	$modx->config['manager_welcome_tpl'] = MODX_MANAGER_PATH . 'media/style/common/welcome.tpl';
392 392
 }
393 393
 
@@ -395,26 +395,28 @@  discard block
 block discarded – undo
395 395
 $target = str_replace('[+base_path+]', MODX_BASE_PATH, $target);
396 396
 $target = $modx->mergeSettingsContent($target);
397 397
 
398
-if(substr($target, 0, 1) === '@') {
399
-	if(substr($target, 0, 6) === '@CHUNK') {
398
+if(substr($target, 0, 1) === '@') {
399
+	if(substr($target, 0, 6) === '@CHUNK') {
400 400
 		$content = $modx->getChunk(trim(substr($target, 7)));
401
-	} elseif(substr($target, 0, 5) === '@FILE') {
401
+	} elseif(substr($target, 0, 5) === '@FILE') {
402 402
 		$content = file_get_contents(trim(substr($target, 6)));
403
-	} else {
403
+	} else {
404 404
 		$content = '';
405 405
 	}
406
-} else {
406
+} else {
407 407
 	$chunk = $modx->getChunk($target);
408
-	if($chunk !== false && !empty($chunk)) {
408
+	if($chunk !== false && !empty($chunk)) {
409 409
 		$content = $chunk;
410
-	} elseif(is_file(MODX_BASE_PATH . $target)) {
410
+	} elseif(is_file(MODX_BASE_PATH . $target)) {
411 411
 		$content = file_get_contents(MODX_BASE_PATH . $target);
412
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
412
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl')) {
413 413
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/welcome.tpl');
414
-	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) // ClipperCMS compatible
414
+	} elseif(is_file(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html')) {
415
+	    // ClipperCMS compatible
415 416
 	{
416
-		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
417
-	} else {
417
+		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/html/welcome.html');
418
+	}
419
+	} else {
418 420
 		$content = file_get_contents(MODX_MANAGER_PATH . 'media/style/common/welcome.tpl');
419 421
 	}
420 422
 }
@@ -423,7 +425,7 @@  discard block
 block discarded – undo
423 425
 $content = $modx->mergeConditionalTagsContent($content);
424 426
 $content = $modx->mergeSettingsContent($content);
425 427
 $content = $modx->parseText($content, $ph);
426
-if(strpos($content, '[+') !== false) {
428
+if(strpos($content, '[+') !== false) {
427 429
 	$modx->toPlaceholders($ph);
428 430
 	$content = $modx->mergePlaceholderContent($content);
429 431
 }
@@ -432,7 +434,7 @@  discard block
 block discarded – undo
432 434
 $content = $modx->parseText($content, $_style, '[&', '&]');
433 435
 $content = $modx->cleanUpMODXTags($content); //cleanup
434 436
 
435
-if($js = $modx->getRegisteredClientScripts()) {
437
+if($js = $modx->getRegisteredClientScripts()) {
436 438
 	$content .= $js;
437 439
 }
438 440
 
@@ -442,7 +444,9 @@  discard block
 block discarded – undo
442 444
 //	<a href="javascript:;" class="setting"><i class="fa fa-cog"></i></a>
443 445
 //  <a href="javascript:;" class="closed"><i class="fa fa-close"></i></a>
444 446
 //</span>
445
-function getTplWidget() { // recent document info
447
+function getTplWidget()
448
+{
449
+// recent document info
446 450
 	return '
447 451
 		<div class="[+cols+]" id="[+id+]">
448 452
 			<div class="card"[+cardAttr+]>
@@ -453,7 +457,9 @@  discard block
 block discarded – undo
453 457
 ';
454 458
 }
455 459
 
456
-function getRecentInfo() { // recent document info
460
+function getRecentInfo()
461
+{
462
+// recent document info
457 463
 	$modx = evolutionCMS();
458 464
 
459 465
 	$modx->addSnippet('recentInfoList', 'getRecentInfoList');
@@ -479,12 +485,13 @@  discard block
 block discarded – undo
479 485
 	return $html;
480 486
 }
481 487
 
482
-function getRecentInfoList() {
488
+function getRecentInfoList()
489
+{
483 490
 	$modx = evolutionCMS();
484 491
 
485 492
 	$rs = $modx->db->select('*', '[+prefix+]site_content', '', 'editedon DESC', 10);
486 493
 
487
-	if($modx->db->getRecordCount($rs) < 1) {
494
+	if($modx->db->getRecordCount($rs) < 1) {
488 495
 		return '<tr><td>[%no_activity_message%]</td></tr>';
489 496
 	}
490 497
 
@@ -494,22 +501,22 @@  discard block
 block discarded – undo
494 501
 	$btntpl['preview_btn'] = '<a [+preview_disabled+]" title="[%preview_resource%]" target="_blank" href="../index.php?&amp;id=[+id+]"><i class="fa fa-eye fa-fw"></i></a> ';
495 502
 
496 503
 	$output = array();
497
-	while($ph = $modx->db->getRow($rs)) {
504
+	while($ph = $modx->db->getRow($rs)) {
498 505
 		$docid = $ph['id'];
499 506
 		$_ = $modx->getUserInfo($ph['editedby']);
500 507
 		$ph['username'] = $_['username'];
501 508
 
502
-		if($ph['deleted'] == 1) {
509
+		if($ph['deleted'] == 1) {
503 510
 			$ph['status'] = 'deleted text-danger';
504
-		} elseif($ph['published'] == 0) {
511
+		} elseif($ph['published'] == 0) {
505 512
 			$ph['status'] = 'unpublished font-italic text-muted';
506
-		} else {
513
+		} else {
507 514
 			$ph['status'] = 'published';
508 515
 		}
509 516
 
510
-		if($modx->hasPermission('edit_document')) {
517
+		if($modx->hasPermission('edit_document')) {
511 518
 			$ph['edit_btn'] = str_replace('[+id+]', $docid, $btntpl['edit']);
512
-		} else {
519
+		} else {
513 520
 			$ph['edit_btn'] = '';
514 521
 		}
515 522
 
@@ -522,40 +529,40 @@  discard block
 block discarded – undo
522 529
 			$preview_disabled
523 530
 		), $btntpl['preview_btn']);
524 531
 
525
-		if($modx->hasPermission('delete_document')) {
526
-			if($ph['deleted'] == 0) {
532
+		if($modx->hasPermission('delete_document')) {
533
+			if($ph['deleted'] == 0) {
527 534
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_delete_record%]\')" title="[%delete_resource%]" href="index.php?a=6&amp;id=[+id+]" target="main"><i class="fa fa-trash fa-fw"></i></a> ';
528
-			} else {
535
+			} else {
529 536
 				$delete_btn = '<a onclick="return confirm(\'[%confirm_undelete%]\')" title="[%undelete_resource%]" href="index.php?a=63&amp;id=[+id+]" target="main"><i class="fa fa-arrow-circle-o-up fa-fw"></i></a> ';
530 537
 			}
531 538
 			$ph['delete_btn'] = str_replace('[+id+]', $docid, $delete_btn);
532
-		} else {
539
+		} else {
533 540
 			$ph['delete_btn'] = '';
534 541
 		}
535 542
 
536
-		if($ph['deleted'] == 1 && $ph['published'] == 0) {
543
+		if($ph['deleted'] == 1 && $ph['published'] == 0) {
537 544
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
538
-		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
545
+		} elseif($ph['deleted'] == 1 && $ph['published'] == 1) {
539 546
 			$publish_btn = '<a class="disabled" title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
540
-		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
547
+		} elseif($ph['deleted'] == 0 && $ph['published'] == 0) {
541 548
 			$publish_btn = '<a title="[%publish_resource%]" href="index.php?a=61&amp;id=[+id+]" target="main"><i class="fa fa-arrow-up fa-fw"></i></a> ';
542
-		} else {
549
+		} else {
543 550
 			$publish_btn = '<a title="[%unpublish_resource%]" href="index.php?a=62&amp;id=[+id+]" target="main"><i class="fa fa-arrow-down fa-fw"></i></a> ';
544 551
 		}
545 552
 		$ph['publish_btn'] = str_replace('[+id+]', $docid, $publish_btn);
546 553
 
547 554
 		$ph['info_btn'] = str_replace('[+id+]', $docid, '<a title="[%resource_overview%]" data-toggle="collapse" data-target=".collapse[+id+]"><i class="fa fa-info fa-fw"></i></a>');
548 555
 
549
-		if($ph['longtitle'] == '') {
556
+		if($ph['longtitle'] == '') {
550 557
 			$ph['longtitle'] = '(<i>[%not_set%]</i>)';
551 558
 		}
552
-		if($ph['description'] == '') {
559
+		if($ph['description'] == '') {
553 560
 			$ph['description'] = '(<i>[%not_set%]</i>)';
554 561
 		}
555
-		if($ph['introtext'] == '') {
562
+		if($ph['introtext'] == '') {
556 563
 			$ph['introtext'] = '(<i>[%not_set%]</i>)';
557 564
 		}
558
-		if($ph['alias'] == '') {
565
+		if($ph['alias'] == '') {
559 566
 			$ph['alias'] = '(<i>[%not_set%]</i>)';
560 567
 		}
561 568
 
@@ -564,7 +571,8 @@  discard block
 block discarded – undo
564 571
 	return implode("\n", $output);
565 572
 }
566 573
 
567
-function getRecentInfoRowTpl() {
574
+function getRecentInfoRowTpl()
575
+{
568 576
 	$tpl = '
569 577
 						<tr>
570 578
 							<td data-toggle="collapse" data-target=".collapse[+id+]" class="text-right"><span class="label label-info">[+id+]</span></td>
@@ -593,11 +601,13 @@  discard block
 block discarded – undo
593 601
 }
594 602
 
595 603
 // setup icons
596
-function wrapIcon($i, $action) {
604
+function wrapIcon($i, $action)
605
+{
597 606
 	return sprintf('<a href="index.php?a=%s" target="main"><span class="wm_button" style="border:0">%s</span></a>', $action, $i);
598 607
 }
599 608
 
600
-function getStartUpScript() {
609
+function getStartUpScript()
610
+{
601 611
 	$script = '
602 612
         <script type="text/javascript">
603 613
         function hideConfigCheckWarning(key) {
Please login to merge, or discard this patch.