Completed
Push — develop ( 6128e5...aad1a0 )
by Agel_Nash
08:50
created
manager/processors/move_document.processor.php 3 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  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('edit_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0;
@@ -25,68 +25,68 @@  discard block
 block discarded – undo
25 25
 // check user has permission to move document to chosen location
26 26
 
27 27
 if ($use_udperms == 1) {
28
-	if ($oldparent != $newParentID) {
29
-		$udperms = new EvolutionCMS\Legacy\Permissions();
30
-		$udperms->user = $modx->getLoginUserID();
31
-		$udperms->document = $newParentID;
32
-		$udperms->role = $_SESSION['mgrRole'];
28
+    if ($oldparent != $newParentID) {
29
+        $udperms = new EvolutionCMS\Legacy\Permissions();
30
+        $udperms->user = $modx->getLoginUserID();
31
+        $udperms->document = $newParentID;
32
+        $udperms->role = $_SESSION['mgrRole'];
33 33
 
34
-		 if (!$udperms->checkPermissions()) {
35
-			$modx->webAlertAndQuit($_lang["access_permission_parent_denied"]);
36
-		 }
37
-	}
34
+            if (!$udperms->checkPermissions()) {
35
+            $modx->webAlertAndQuit($_lang["access_permission_parent_denied"]);
36
+            }
37
+    }
38 38
 }
39 39
 
40 40
 $evtOut = $modx->invokeEvent("onBeforeMoveDocument", array (
41
-	"id_document" => $documentID,
42
-	"old_parent" => $oldparent,
43
-	"new_parent" => $newParentID
41
+    "id_document" => $documentID,
42
+    "old_parent" => $oldparent,
43
+    "new_parent" => $newParentID
44 44
 ));
45 45
 if (is_array($evtOut) && count($evtOut) > 0){
46
-	$newParent = array_pop($evtOut);
47
-	if($newParent == $oldparent) {
48
-		$modx->webAlertAndQuit($_lang["error_movedocument2"]);
49
-	}else{
50
-		$newParentID = $newParent;
51
-	}
46
+    $newParent = array_pop($evtOut);
47
+    if($newParent == $oldparent) {
48
+        $modx->webAlertAndQuit($_lang["error_movedocument2"]);
49
+    }else{
50
+        $newParentID = $newParent;
51
+    }
52 52
 }
53 53
 
54 54
 $children = allChildren($documentID);
55 55
 if (!array_search($newParentID, $children)) {
56
-	$modx->getDatabase()->update(array(
57
-		'isfolder' => 1,
58
-	), $modx->getFullTableName('site_content'), "id='{$newParentID}'");
56
+    $modx->getDatabase()->update(array(
57
+        'isfolder' => 1,
58
+    ), $modx->getFullTableName('site_content'), "id='{$newParentID}'");
59 59
 
60
-	$modx->getDatabase()->update(array(
61
-		'parent'   => $newParentID,
62
-		'editedby' => $modx->getLoginUserID(),
63
-		'editedon' => time(),
64
-	), $modx->getFullTableName('site_content'), "id='{$documentID}'");
60
+    $modx->getDatabase()->update(array(
61
+        'parent'   => $newParentID,
62
+        'editedby' => $modx->getLoginUserID(),
63
+        'editedon' => time(),
64
+    ), $modx->getFullTableName('site_content'), "id='{$documentID}'");
65 65
 
66
-	// finished moving the document, now check to see if the old_parent should no longer be a folder.
67
-	$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'");
68
-	$limit = $modx->getDatabase()->getValue($rs);
66
+    // finished moving the document, now check to see if the old_parent should no longer be a folder.
67
+    $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'");
68
+    $limit = $modx->getDatabase()->getValue($rs);
69 69
 
70
-	if(!$limit>0) {
71
-		$modx->getDatabase()->update(array(
72
-			'isfolder' => 0,
73
-		), $modx->getFullTableName('site_content'), "id='{$oldparent}'");
74
-	}
75
-	// Set the item name for logger
76
-	$pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'"));
77
-	$_SESSION['itemname'] = $pagetitle;
70
+    if(!$limit>0) {
71
+        $modx->getDatabase()->update(array(
72
+            'isfolder' => 0,
73
+        ), $modx->getFullTableName('site_content'), "id='{$oldparent}'");
74
+    }
75
+    // Set the item name for logger
76
+    $pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'"));
77
+    $_SESSION['itemname'] = $pagetitle;
78 78
 
79
-	$modx->invokeEvent("onAfterMoveDocument", array (
80
-		"id_document" => $documentID,
81
-		"old_parent" => $oldparent,
82
-		"new_parent" => $newParentID
83
-	));
79
+    $modx->invokeEvent("onAfterMoveDocument", array (
80
+        "id_document" => $documentID,
81
+        "old_parent" => $oldparent,
82
+        "new_parent" => $newParentID
83
+    ));
84 84
 
85
-	// empty cache & sync site
86
-	$modx->clearCache('full');
85
+    // empty cache & sync site
86
+    $modx->clearCache('full');
87 87
 
88
-	$header="Location: index.php?a=3&id={$documentID}&r=9";
89
-	header($header);
88
+    $header="Location: index.php?a=3&id={$documentID}&r=9";
89
+    header($header);
90 90
 } else {
91
-	$modx->webAlertAndQuit("You cannot move a document to a child document!");
91
+    $modx->webAlertAndQuit("You cannot move a document to a child document!");
92 92
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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('edit_document')) {
5
+if (!$modx->hasPermission('edit_document')) {
6 6
 	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$newParentID = isset($_REQUEST['new_parent']) ? (int)$_REQUEST['new_parent'] : 0;
10
-$documentID = isset($_REQUEST['id']) ? (int)$_REQUEST['id'] : 0;
9
+$newParentID = isset($_REQUEST['new_parent']) ? (int) $_REQUEST['new_parent'] : 0;
10
+$documentID = isset($_REQUEST['id']) ? (int) $_REQUEST['id'] : 0;
11 11
 
12 12
 // ok, two things to check.
13 13
 // first, document cannot be moved to itself
14 14
 // second, new parent must be a folder. If not, set it to folder.
15
-if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]);
16
-if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
17
-if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
15
+if ($documentID == $newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]);
16
+if ($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
17
+if ($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
18 18
 
19 19
 $parents = $modx->getParentIds($newParentID);
20 20
 if (in_array($documentID, $parents))  $modx->webAlertAndQuit($_lang["error_movedocument2"]);
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 }
39 39
 
40
-$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array (
40
+$evtOut = $modx->invokeEvent("onBeforeMoveDocument", array(
41 41
 	"id_document" => $documentID,
42 42
 	"old_parent" => $oldparent,
43 43
 	"new_parent" => $newParentID
44 44
 ));
45
-if (is_array($evtOut) && count($evtOut) > 0){
45
+if (is_array($evtOut) && count($evtOut) > 0) {
46 46
 	$newParent = array_pop($evtOut);
47
-	if($newParent == $oldparent) {
47
+	if ($newParent == $oldparent) {
48 48
 		$modx->webAlertAndQuit($_lang["error_movedocument2"]);
49
-	}else{
49
+	} else {
50 50
 		$newParentID = $newParent;
51 51
 	}
52 52
 }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	$rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'");
68 68
 	$limit = $modx->getDatabase()->getValue($rs);
69 69
 
70
-	if(!$limit>0) {
70
+	if (!$limit > 0) {
71 71
 		$modx->getDatabase()->update(array(
72 72
 			'isfolder' => 0,
73 73
 		), $modx->getFullTableName('site_content'), "id='{$oldparent}'");
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	$pagetitle = $modx->getDatabase()->getValue($modx->getDatabase()->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'"));
77 77
 	$_SESSION['itemname'] = $pagetitle;
78 78
 
79
-	$modx->invokeEvent("onAfterMoveDocument", array (
79
+	$modx->invokeEvent("onAfterMoveDocument", array(
80 80
 		"id_document" => $documentID,
81 81
 		"old_parent" => $oldparent,
82 82
 		"new_parent" => $newParentID
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	// empty cache & sync site
86 86
 	$modx->clearCache('full');
87 87
 
88
-	$header="Location: index.php?a=3&id={$documentID}&r=9";
88
+	$header = "Location: index.php?a=3&id={$documentID}&r=9";
89 89
 	header($header);
90 90
 } else {
91 91
 	$modx->webAlertAndQuit("You cannot move a document to a child document!");
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,12 +12,20 @@  discard block
 block discarded – undo
12 12
 // ok, two things to check.
13 13
 // first, document cannot be moved to itself
14 14
 // second, new parent must be a folder. If not, set it to folder.
15
-if($documentID==$newParentID) $modx->webAlertAndQuit($_lang["error_movedocument1"]);
16
-if($documentID <= 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
17
-if($newParentID < 0) $modx->webAlertAndQuit($_lang["error_movedocument2"]);
15
+if($documentID==$newParentID) {
16
+    $modx->webAlertAndQuit($_lang["error_movedocument1"]);
17
+}
18
+if($documentID <= 0) {
19
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
20
+}
21
+if($newParentID < 0) {
22
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
23
+}
18 24
 
19 25
 $parents = $modx->getParentIds($newParentID);
20
-if (in_array($documentID, $parents))  $modx->webAlertAndQuit($_lang["error_movedocument2"]);
26
+if (in_array($documentID, $parents)) {
27
+    $modx->webAlertAndQuit($_lang["error_movedocument2"]);
28
+}
21 29
 
22 30
 $rs = $modx->getDatabase()->select('parent', $modx->getFullTableName('site_content'), "id='{$documentID}'");
23 31
 $oldparent = $modx->getDatabase()->getValue($rs);
@@ -42,11 +50,11 @@  discard block
 block discarded – undo
42 50
 	"old_parent" => $oldparent,
43 51
 	"new_parent" => $newParentID
44 52
 ));
45
-if (is_array($evtOut) && count($evtOut) > 0){
53
+if (is_array($evtOut) && count($evtOut) > 0) {
46 54
 	$newParent = array_pop($evtOut);
47 55
 	if($newParent == $oldparent) {
48 56
 		$modx->webAlertAndQuit($_lang["error_movedocument2"]);
49
-	}else{
57
+	} else {
50 58
 		$newParentID = $newParent;
51 59
 	}
52 60
 }
Please login to merge, or discard this patch.
manager/processors/save_web_user.processor.php 3 patches
Indentation   +192 added lines, -192 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 = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES);
17
-	}
18
-	$input[$k] = $v;
15
+    if($k !== 'comment') {
16
+        $v = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES);
17
+    }
18
+    $input[$k] = $v;
19 19
 }
20 20
 
21 21
 $id = (int)$input['id'];
@@ -51,82 +51,82 @@  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", 88);
54
+    webAlertAndQuit("Password typed is mismatched", 88);
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!", 88);
59
+    webAlertAndQuit("E-mail address doesn't seem to be valid!", 88);
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->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
-		$limit = $modx->getDatabase()->getValue($rs);
67
-		if($limit > 0) {
68
-			webAlertAndQuit("User name is already in use!", 88);
69
-		}
70
-
71
-		// check if the email address already exist
72
-		if ($modx->config['allow_multiple_emails'] != 1) {
73
-			$rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74
-			$limit = $modx->getDatabase()->getValue($rs);
75
-			if($limit > 0) {
76
-				webAlertAndQuit("Email is already in use!", 88);
77
-			}
78
-		}
79
-
80
-		// generate a new password for this user
81
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
-			if(strlen($specifiedpassword) < 6) {
83
-				webAlertAndQuit("Password is too short!", 88);
84
-			} else {
85
-				$newpassword = $specifiedpassword;
86
-			}
87
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
88
-			webAlertAndQuit("You didn't specify a password for this user!", 88);
89
-		} elseif($passwordgenmethod == 'g') {
90
-			$newpassword = generate_password(8);
91
-		} else {
92
-			webAlertAndQuit("No password generation method specified!", 88);
93
-		}
94
-
95
-		// invoke OnBeforeWUsrFormSave event
96
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
97
-			"mode" => "new",
98
-		));
99
-
100
-		// create the user account
101
-		$field = array();
102
-		$field['username'] = $esc_newusername;
103
-		$field['password'] = md5($newpassword);
104
-		$internalKey = $modx->getDatabase()->insert($field, $tbl_web_users);
105
-
106
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
107
-		$field = $modx->getDatabase()->escape($field);
108
-		$modx->getDatabase()->insert($field, $tbl_web_user_attributes);
109
-
110
-		// Save User Settings
63
+    case '87' : // new user
64
+        // check if this user name already exist
65
+        $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
+        $limit = $modx->getDatabase()->getValue($rs);
67
+        if($limit > 0) {
68
+            webAlertAndQuit("User name is already in use!", 88);
69
+        }
70
+
71
+        // check if the email address already exist
72
+        if ($modx->config['allow_multiple_emails'] != 1) {
73
+            $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74
+            $limit = $modx->getDatabase()->getValue($rs);
75
+            if($limit > 0) {
76
+                webAlertAndQuit("Email is already in use!", 88);
77
+            }
78
+        }
79
+
80
+        // generate a new password for this user
81
+        if($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
+            if(strlen($specifiedpassword) < 6) {
83
+                webAlertAndQuit("Password is too short!", 88);
84
+            } else {
85
+                $newpassword = $specifiedpassword;
86
+            }
87
+        } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
88
+            webAlertAndQuit("You didn't specify a password for this user!", 88);
89
+        } elseif($passwordgenmethod == 'g') {
90
+            $newpassword = generate_password(8);
91
+        } else {
92
+            webAlertAndQuit("No password generation method specified!", 88);
93
+        }
94
+
95
+        // invoke OnBeforeWUsrFormSave event
96
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
97
+            "mode" => "new",
98
+        ));
99
+
100
+        // create the user account
101
+        $field = array();
102
+        $field['username'] = $esc_newusername;
103
+        $field['password'] = md5($newpassword);
104
+        $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users);
105
+
106
+        $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
107
+        $field = $modx->getDatabase()->escape($field);
108
+        $modx->getDatabase()->insert($field, $tbl_web_user_attributes);
109
+
110
+        // Save User Settings
111 111
         saveWebUserSettings($internalKey);
112 112
 
113
-		// Set the item name for logger
114
-		$_SESSION['itemname'] = $newusername;
115
-
116
-		/*******************************************************************************/
117
-		// put the user in the user_groups he/ she should be in
118
-		// first, check that up_perms are switched on!
119
-		if($use_udperms == 1) {
120
-			if(!empty($user_groups)) {
121
-				for($i = 0; $i < count($user_groups); $i++) {
122
-					$f = array();
123
-					$f['webgroup'] = (int)$user_groups[$i];
124
-					$f['webuser'] = $internalKey;
125
-					$modx->getDatabase()->insert($f, $tbl_web_groups);
126
-				}
127
-			}
128
-		}
129
-		// end of user_groups stuff!
113
+        // Set the item name for logger
114
+        $_SESSION['itemname'] = $newusername;
115
+
116
+        /*******************************************************************************/
117
+        // put the user in the user_groups he/ she should be in
118
+        // first, check that up_perms are switched on!
119
+        if($use_udperms == 1) {
120
+            if(!empty($user_groups)) {
121
+                for($i = 0; $i < count($user_groups); $i++) {
122
+                    $f = array();
123
+                    $f['webgroup'] = (int)$user_groups[$i];
124
+                    $f['webuser'] = $internalKey;
125
+                    $modx->getDatabase()->insert($f, $tbl_web_groups);
126
+                }
127
+            }
128
+        }
129
+        // end of user_groups stuff!
130 130
 
131 131
         // invoke OnWebSaveUser event
132 132
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -144,26 +144,26 @@  discard block
 block discarded – undo
144 144
             "id" => $internalKey
145 145
         ));
146 146
 
147
-		if($passwordnotifymethod == 'e') {
147
+        if($passwordnotifymethod == 'e') {
148 148
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
149
-			if($input['stay'] != '') {
150
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
151
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
152
-				header($header);
153
-			} else {
154
-				$header = "Location: index.php?a=99&r=2";
155
-				header($header);
156
-			}
157
-		} else {
158
-			if($input['stay'] != '') {
159
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
160
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
161
-			} else {
162
-				$stayUrl = "index.php?a=99&r=2";
163
-			}
164
-
165
-			include_once "header.inc.php";
166
-			?>
149
+            if($input['stay'] != '') {
150
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
151
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
152
+                header($header);
153
+            } else {
154
+                $header = "Location: index.php?a=99&r=2";
155
+                header($header);
156
+            }
157
+        } else {
158
+            if($input['stay'] != '') {
159
+                $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
160
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
161
+            } else {
162
+                $stayUrl = "index.php?a=99&r=2";
163
+            }
164
+
165
+            include_once "header.inc.php";
166
+            ?>
167 167
 
168 168
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
169 169
 
@@ -185,86 +185,86 @@  discard block
 block discarded – undo
185 185
 			</div>
186 186
 			<?php
187 187
 
188
-			include_once "footer.inc.php";
189
-		}
190
-		break;
191
-	case '88' : // edit user
192
-		// generate a new password for this user
193
-		if($genpassword == 1) {
194
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
-				if(strlen($specifiedpassword) < 6) {
196
-					webAlertAndQuit("Password is too short!", 88);
197
-				} else {
198
-					$newpassword = $specifiedpassword;
199
-				}
200
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
201
-				webAlertAndQuit("You didn't specify a password for this user!", 88);
202
-			} elseif($passwordgenmethod == 'g') {
203
-				$newpassword = generate_password(8);
204
-			} else {
205
-				webAlertAndQuit("No password generation method specified!", 88);
206
-			}
207
-		}
208
-		if($passwordnotifymethod == 'e') {
188
+            include_once "footer.inc.php";
189
+        }
190
+        break;
191
+    case '88' : // edit user
192
+        // generate a new password for this user
193
+        if($genpassword == 1) {
194
+            if($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
+                if(strlen($specifiedpassword) < 6) {
196
+                    webAlertAndQuit("Password is too short!", 88);
197
+                } else {
198
+                    $newpassword = $specifiedpassword;
199
+                }
200
+            } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
201
+                webAlertAndQuit("You didn't specify a password for this user!", 88);
202
+            } elseif($passwordgenmethod == 'g') {
203
+                $newpassword = generate_password(8);
204
+            } else {
205
+                webAlertAndQuit("No password generation method specified!", 88);
206
+            }
207
+        }
208
+        if($passwordnotifymethod == 'e') {
209 209
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
210
-		}
211
-
212
-		// check if the username already exist
213
-		$rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214
-		$limit = $modx->getDatabase()->getValue($rs);
215
-		if($limit > 0) {
216
-			webAlertAndQuit("User name is already in use!", 88);
217
-		}
218
-
219
-		// check if the email address already exists
220
-		if ($modx->config['allow_multiple_emails'] != 1) {
221
-			$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222
-			$limit = $modx->getDatabase()->getValue($rs);
223
-			if($limit > 0) {
224
-				webAlertAndQuit("Email is already in use!", 88);
225
-			}
226
-		}
227
-
228
-		// invoke OnBeforeWUsrFormSave event
229
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
230
-			"mode" => "upd",
231
-			"id" => $id
232
-		));
233
-
234
-		// update user name and password
235
-		$field = array();
236
-		$field['username'] = $esc_newusername;
237
-		if($genpassword == 1) {
238
-			$field['password'] = md5($newpassword);
239
-		}
240
-		$modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'");
241
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
242
-		$field = $modx->getDatabase()->escape($field);
243
-		$modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
244
-
245
-		// Save User Settings
210
+        }
211
+
212
+        // check if the username already exist
213
+        $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214
+        $limit = $modx->getDatabase()->getValue($rs);
215
+        if($limit > 0) {
216
+            webAlertAndQuit("User name is already in use!", 88);
217
+        }
218
+
219
+        // check if the email address already exists
220
+        if ($modx->config['allow_multiple_emails'] != 1) {
221
+            $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222
+            $limit = $modx->getDatabase()->getValue($rs);
223
+            if($limit > 0) {
224
+                webAlertAndQuit("Email is already in use!", 88);
225
+            }
226
+        }
227
+
228
+        // invoke OnBeforeWUsrFormSave event
229
+        $modx->invokeEvent("OnBeforeWUsrFormSave", array(
230
+            "mode" => "upd",
231
+            "id" => $id
232
+        ));
233
+
234
+        // update user name and password
235
+        $field = array();
236
+        $field['username'] = $esc_newusername;
237
+        if($genpassword == 1) {
238
+            $field['password'] = md5($newpassword);
239
+        }
240
+        $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'");
241
+        $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
242
+        $field = $modx->getDatabase()->escape($field);
243
+        $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
244
+
245
+        // Save User Settings
246 246
         saveWebUserSettings($id);
247 247
 
248
-		// Set the item name for logger
249
-		$_SESSION['itemname'] = $newusername;
250
-
251
-		/*******************************************************************************/
252
-		// put the user in the user_groups he/ she should be in
253
-		// first, check that up_perms are switched on!
254
-		if($use_udperms == 1) {
255
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
256
-			$modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'");
257
-			if(!empty($user_groups)) {
258
-				for($i = 0; $i < count($user_groups); $i++) {
259
-					$field = array();
260
-					$field['webgroup'] = (int)$user_groups[$i];
261
-					$field['webuser'] = $id;
262
-					$modx->getDatabase()->insert($field, $tbl_web_groups);
263
-				}
264
-			}
265
-		}
266
-		// end of user_groups stuff!
267
-		/*******************************************************************************/
248
+        // Set the item name for logger
249
+        $_SESSION['itemname'] = $newusername;
250
+
251
+        /*******************************************************************************/
252
+        // put the user in the user_groups he/ she should be in
253
+        // first, check that up_perms are switched on!
254
+        if($use_udperms == 1) {
255
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
256
+            $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'");
257
+            if(!empty($user_groups)) {
258
+                for($i = 0; $i < count($user_groups); $i++) {
259
+                    $field = array();
260
+                    $field['webgroup'] = (int)$user_groups[$i];
261
+                    $field['webuser'] = $id;
262
+                    $modx->getDatabase()->insert($field, $tbl_web_groups);
263
+                }
264
+            }
265
+        }
266
+        // end of user_groups stuff!
267
+        /*******************************************************************************/
268 268
 
269 269
         // invoke OnWebSaveUser event
270 270
         $modx->invokeEvent("OnWebSaveUser", array(
@@ -293,16 +293,16 @@  discard block
 block discarded – undo
293 293
             "id" => $id
294 294
         ));
295 295
 
296
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
297
-			if($input['stay'] != '') {
298
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
299
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
300
-			} else {
301
-				$stayUrl = "index.php?a=99&r=2";
302
-			}
296
+        if($genpassword == 1 && $passwordnotifymethod == 's') {
297
+            if($input['stay'] != '') {
298
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
299
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
300
+            } else {
301
+                $stayUrl = "index.php?a=99&r=2";
302
+            }
303 303
 
304
-			include_once "header.inc.php";
305
-			?>
304
+            include_once "header.inc.php";
305
+            ?>
306 306
 
307 307
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
308 308
 
@@ -322,18 +322,18 @@  discard block
 block discarded – undo
322 322
 			</div>
323 323
 			<?php
324 324
 
325
-			include_once "footer.inc.php";
326
-		} else {
327
-			if($input['stay'] != '') {
328
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
329
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
330
-				header($header);
331
-			} else {
332
-				$header = "Location: index.php?a=99&r=2";
333
-				header($header);
334
-			}
335
-		}
336
-		break;
337
-	default :
338
-		webAlertAndQuit("No operation set in request.", 88);
325
+            include_once "footer.inc.php";
326
+        } else {
327
+            if($input['stay'] != '') {
328
+                $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
329
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
330
+                header($header);
331
+            } else {
332
+                $header = "Location: index.php?a=99&r=2";
333
+                header($header);
334
+            }
335
+        }
336
+        break;
337
+    default :
338
+        webAlertAndQuit("No operation set in request.", 88);
339 339
 }
Please login to merge, or discard this patch.
Switch Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -60,110 +60,110 @@  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->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
-		$limit = $modx->getDatabase()->getValue($rs);
67
-		if($limit > 0) {
68
-			webAlertAndQuit("User name is already in use!", 88);
69
-		}
70
-
71
-		// check if the email address already exist
72
-		if ($modx->config['allow_multiple_emails'] != 1) {
73
-			$rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74
-			$limit = $modx->getDatabase()->getValue($rs);
75
-			if($limit > 0) {
76
-				webAlertAndQuit("Email is already in use!", 88);
77
-			}
78
-		}
79
-
80
-		// generate a new password for this user
81
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
-			if(strlen($specifiedpassword) < 6) {
83
-				webAlertAndQuit("Password is too short!", 88);
84
-			} else {
85
-				$newpassword = $specifiedpassword;
86
-			}
87
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
88
-			webAlertAndQuit("You didn't specify a password for this user!", 88);
89
-		} elseif($passwordgenmethod == 'g') {
90
-			$newpassword = generate_password(8);
91
-		} else {
92
-			webAlertAndQuit("No password generation method specified!", 88);
93
-		}
94
-
95
-		// invoke OnBeforeWUsrFormSave event
96
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
97
-			"mode" => "new",
98
-		));
99
-
100
-		// create the user account
101
-		$field = array();
102
-		$field['username'] = $esc_newusername;
103
-		$field['password'] = md5($newpassword);
104
-		$internalKey = $modx->getDatabase()->insert($field, $tbl_web_users);
105
-
106
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
107
-		$field = $modx->getDatabase()->escape($field);
108
-		$modx->getDatabase()->insert($field, $tbl_web_user_attributes);
109
-
110
-		// Save User Settings
111
-        saveWebUserSettings($internalKey);
112
-
113
-		// Set the item name for logger
114
-		$_SESSION['itemname'] = $newusername;
115
-
116
-		/*******************************************************************************/
117
-		// put the user in the user_groups he/ she should be in
118
-		// first, check that up_perms are switched on!
119
-		if($use_udperms == 1) {
120
-			if(!empty($user_groups)) {
121
-				for($i = 0; $i < count($user_groups); $i++) {
122
-					$f = array();
123
-					$f['webgroup'] = (int)$user_groups[$i];
124
-					$f['webuser'] = $internalKey;
125
-					$modx->getDatabase()->insert($f, $tbl_web_groups);
126
-				}
127
-			}
128
-		}
129
-		// end of user_groups stuff!
130
-
131
-        // invoke OnWebSaveUser event
132
-        $modx->invokeEvent("OnWebSaveUser", array(
133
-            "mode" => "new",
134
-            "userid" => $internalKey,
135
-            "username" => $newusername,
136
-            "userpassword" => $newpassword,
137
-            "useremail" => $email,
138
-            "userfullname" => $fullname
139
-        ));
140
-
141
-        // invoke OnWUsrFormSave event
142
-        $modx->invokeEvent("OnWUsrFormSave", array(
143
-            "mode" => "new",
144
-            "id" => $internalKey
145
-        ));
146
-
147
-		if($passwordnotifymethod == 'e') {
148
-            sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
149
-			if($input['stay'] != '') {
150
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
151
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
152
-				header($header);
153
-			} else {
154
-				$header = "Location: index.php?a=99&r=2";
155
-				header($header);
156
-			}
157
-		} else {
158
-			if($input['stay'] != '') {
159
-				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
160
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
161
-			} else {
162
-				$stayUrl = "index.php?a=99&r=2";
163
-			}
164
-
165
-			include_once "header.inc.php";
166
-			?>
63
+	    case '87' : // new user
64
+		    // check if this user name already exist
65
+		    $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
+		    $limit = $modx->getDatabase()->getValue($rs);
67
+		    if($limit > 0) {
68
+			    webAlertAndQuit("User name is already in use!", 88);
69
+		    }
70
+
71
+		    // check if the email address already exist
72
+		    if ($modx->config['allow_multiple_emails'] != 1) {
73
+			    $rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74
+			    $limit = $modx->getDatabase()->getValue($rs);
75
+			    if($limit > 0) {
76
+				    webAlertAndQuit("Email is already in use!", 88);
77
+			    }
78
+		    }
79
+
80
+		    // generate a new password for this user
81
+		    if($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
+			    if(strlen($specifiedpassword) < 6) {
83
+				    webAlertAndQuit("Password is too short!", 88);
84
+			    } else {
85
+				    $newpassword = $specifiedpassword;
86
+			    }
87
+		    } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
88
+			    webAlertAndQuit("You didn't specify a password for this user!", 88);
89
+		    } elseif($passwordgenmethod == 'g') {
90
+			    $newpassword = generate_password(8);
91
+		    } else {
92
+			    webAlertAndQuit("No password generation method specified!", 88);
93
+		    }
94
+
95
+		    // invoke OnBeforeWUsrFormSave event
96
+		    $modx->invokeEvent("OnBeforeWUsrFormSave", array(
97
+			    "mode" => "new",
98
+		    ));
99
+
100
+		    // create the user account
101
+		    $field = array();
102
+		    $field['username'] = $esc_newusername;
103
+		    $field['password'] = md5($newpassword);
104
+		    $internalKey = $modx->getDatabase()->insert($field, $tbl_web_users);
105
+
106
+		    $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
107
+		    $field = $modx->getDatabase()->escape($field);
108
+		    $modx->getDatabase()->insert($field, $tbl_web_user_attributes);
109
+
110
+		    // Save User Settings
111
+            saveWebUserSettings($internalKey);
112
+
113
+		    // Set the item name for logger
114
+		    $_SESSION['itemname'] = $newusername;
115
+
116
+		    /*******************************************************************************/
117
+		    // put the user in the user_groups he/ she should be in
118
+		    // first, check that up_perms are switched on!
119
+		    if($use_udperms == 1) {
120
+			    if(!empty($user_groups)) {
121
+				    for($i = 0; $i < count($user_groups); $i++) {
122
+					    $f = array();
123
+					    $f['webgroup'] = (int)$user_groups[$i];
124
+					    $f['webuser'] = $internalKey;
125
+					    $modx->getDatabase()->insert($f, $tbl_web_groups);
126
+				    }
127
+			    }
128
+		    }
129
+		    // end of user_groups stuff!
130
+
131
+            // invoke OnWebSaveUser event
132
+            $modx->invokeEvent("OnWebSaveUser", array(
133
+                "mode" => "new",
134
+                "userid" => $internalKey,
135
+                "username" => $newusername,
136
+                "userpassword" => $newpassword,
137
+                "useremail" => $email,
138
+                "userfullname" => $fullname
139
+            ));
140
+
141
+            // invoke OnWUsrFormSave event
142
+            $modx->invokeEvent("OnWUsrFormSave", array(
143
+                "mode" => "new",
144
+                "id" => $internalKey
145
+            ));
146
+
147
+		    if($passwordnotifymethod == 'e') {
148
+                sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
149
+			    if($input['stay'] != '') {
150
+				    $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
151
+				    $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
152
+				    header($header);
153
+			    } else {
154
+				    $header = "Location: index.php?a=99&r=2";
155
+				    header($header);
156
+			    }
157
+		    } else {
158
+			    if($input['stay'] != '') {
159
+				    $a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
160
+				    $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
161
+			    } else {
162
+				    $stayUrl = "index.php?a=99&r=2";
163
+			    }
164
+
165
+			    include_once "header.inc.php";
166
+			    ?>
167 167
 
168 168
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
169 169
 
@@ -185,124 +185,124 @@  discard block
 block discarded – undo
185 185
 			</div>
186 186
 			<?php
187 187
 
188
-			include_once "footer.inc.php";
189
-		}
190
-		break;
191
-	case '88' : // edit user
192
-		// generate a new password for this user
193
-		if($genpassword == 1) {
194
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
-				if(strlen($specifiedpassword) < 6) {
196
-					webAlertAndQuit("Password is too short!", 88);
197
-				} else {
198
-					$newpassword = $specifiedpassword;
199
-				}
200
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
201
-				webAlertAndQuit("You didn't specify a password for this user!", 88);
202
-			} elseif($passwordgenmethod == 'g') {
203
-				$newpassword = generate_password(8);
204
-			} else {
205
-				webAlertAndQuit("No password generation method specified!", 88);
206
-			}
207
-		}
208
-		if($passwordnotifymethod == 'e') {
209
-            sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
210
-		}
211
-
212
-		// check if the username already exist
213
-		$rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214
-		$limit = $modx->getDatabase()->getValue($rs);
215
-		if($limit > 0) {
216
-			webAlertAndQuit("User name is already in use!", 88);
217
-		}
218
-
219
-		// check if the email address already exists
220
-		if ($modx->config['allow_multiple_emails'] != 1) {
221
-			$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222
-			$limit = $modx->getDatabase()->getValue($rs);
223
-			if($limit > 0) {
224
-				webAlertAndQuit("Email is already in use!", 88);
225
-			}
226
-		}
227
-
228
-		// invoke OnBeforeWUsrFormSave event
229
-		$modx->invokeEvent("OnBeforeWUsrFormSave", array(
230
-			"mode" => "upd",
231
-			"id" => $id
232
-		));
233
-
234
-		// update user name and password
235
-		$field = array();
236
-		$field['username'] = $esc_newusername;
237
-		if($genpassword == 1) {
238
-			$field['password'] = md5($newpassword);
239
-		}
240
-		$modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'");
241
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
242
-		$field = $modx->getDatabase()->escape($field);
243
-		$modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
244
-
245
-		// Save User Settings
246
-        saveWebUserSettings($id);
247
-
248
-		// Set the item name for logger
249
-		$_SESSION['itemname'] = $newusername;
250
-
251
-		/*******************************************************************************/
252
-		// put the user in the user_groups he/ she should be in
253
-		// first, check that up_perms are switched on!
254
-		if($use_udperms == 1) {
255
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
256
-			$modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'");
257
-			if(!empty($user_groups)) {
258
-				for($i = 0; $i < count($user_groups); $i++) {
259
-					$field = array();
260
-					$field['webgroup'] = (int)$user_groups[$i];
261
-					$field['webuser'] = $id;
262
-					$modx->getDatabase()->insert($field, $tbl_web_groups);
263
-				}
264
-			}
265
-		}
266
-		// end of user_groups stuff!
267
-		/*******************************************************************************/
268
-
269
-        // invoke OnWebSaveUser event
270
-        $modx->invokeEvent("OnWebSaveUser", array(
271
-            "mode" => "upd",
272
-            "userid" => $id,
273
-            "username" => $newusername,
274
-            "userpassword" => $newpassword,
275
-            "useremail" => $email,
276
-            "userfullname" => $fullname,
277
-            "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
278
-            "olduseremail" => (($oldemail != $email) ? $oldemail : "")
279
-        ));
280
-
281
-        // invoke OnWebChangePassword event
282
-        if($genpassword == 1) {
283
-            $modx->invokeEvent("OnWebChangePassword", array(
188
+			    include_once "footer.inc.php";
189
+		    }
190
+		    break;
191
+	    case '88' : // edit user
192
+		    // generate a new password for this user
193
+		    if($genpassword == 1) {
194
+			    if($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
+				    if(strlen($specifiedpassword) < 6) {
196
+					    webAlertAndQuit("Password is too short!", 88);
197
+				    } else {
198
+					    $newpassword = $specifiedpassword;
199
+				    }
200
+			    } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
201
+				    webAlertAndQuit("You didn't specify a password for this user!", 88);
202
+			    } elseif($passwordgenmethod == 'g') {
203
+				    $newpassword = generate_password(8);
204
+			    } else {
205
+				    webAlertAndQuit("No password generation method specified!", 88);
206
+			    }
207
+		    }
208
+		    if($passwordnotifymethod == 'e') {
209
+                sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
210
+		    }
211
+
212
+		    // check if the username already exist
213
+		    $rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214
+		    $limit = $modx->getDatabase()->getValue($rs);
215
+		    if($limit > 0) {
216
+			    webAlertAndQuit("User name is already in use!", 88);
217
+		    }
218
+
219
+		    // check if the email address already exists
220
+		    if ($modx->config['allow_multiple_emails'] != 1) {
221
+			    $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222
+			    $limit = $modx->getDatabase()->getValue($rs);
223
+			    if($limit > 0) {
224
+				    webAlertAndQuit("Email is already in use!", 88);
225
+			    }
226
+		    }
227
+
228
+		    // invoke OnBeforeWUsrFormSave event
229
+		    $modx->invokeEvent("OnBeforeWUsrFormSave", array(
230
+			    "mode" => "upd",
231
+			    "id" => $id
232
+		    ));
233
+
234
+		    // update user name and password
235
+		    $field = array();
236
+		    $field['username'] = $esc_newusername;
237
+		    if($genpassword == 1) {
238
+			    $field['password'] = md5($newpassword);
239
+		    }
240
+		    $modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'");
241
+		    $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
242
+		    $field = $modx->getDatabase()->escape($field);
243
+		    $modx->getDatabase()->update($field, $tbl_web_user_attributes, "internalKey='{$id}'");
244
+
245
+		    // Save User Settings
246
+            saveWebUserSettings($id);
247
+
248
+		    // Set the item name for logger
249
+		    $_SESSION['itemname'] = $newusername;
250
+
251
+		    /*******************************************************************************/
252
+		    // put the user in the user_groups he/ she should be in
253
+		    // first, check that up_perms are switched on!
254
+		    if($use_udperms == 1) {
255
+			    // as this is an existing user, delete his/ her entries in the groups before saving the new groups
256
+			    $modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'");
257
+			    if(!empty($user_groups)) {
258
+				    for($i = 0; $i < count($user_groups); $i++) {
259
+					    $field = array();
260
+					    $field['webgroup'] = (int)$user_groups[$i];
261
+					    $field['webuser'] = $id;
262
+					    $modx->getDatabase()->insert($field, $tbl_web_groups);
263
+				    }
264
+			    }
265
+		    }
266
+		    // end of user_groups stuff!
267
+		    /*******************************************************************************/
268
+
269
+            // invoke OnWebSaveUser event
270
+            $modx->invokeEvent("OnWebSaveUser", array(
271
+                "mode" => "upd",
284 272
                 "userid" => $id,
285 273
                 "username" => $newusername,
286
-                "userpassword" => $newpassword
274
+                "userpassword" => $newpassword,
275
+                "useremail" => $email,
276
+                "userfullname" => $fullname,
277
+                "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
278
+                "olduseremail" => (($oldemail != $email) ? $oldemail : "")
287 279
             ));
288
-        }
289 280
 
290
-        // invoke OnWUsrFormSave event
291
-        $modx->invokeEvent("OnWUsrFormSave", array(
292
-            "mode" => "upd",
293
-            "id" => $id
294
-        ));
281
+            // invoke OnWebChangePassword event
282
+            if($genpassword == 1) {
283
+                $modx->invokeEvent("OnWebChangePassword", array(
284
+                    "userid" => $id,
285
+                    "username" => $newusername,
286
+                    "userpassword" => $newpassword
287
+                ));
288
+            }
289
+
290
+            // invoke OnWUsrFormSave event
291
+            $modx->invokeEvent("OnWUsrFormSave", array(
292
+                "mode" => "upd",
293
+                "id" => $id
294
+            ));
295 295
 
296
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
297
-			if($input['stay'] != '') {
298
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
299
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
300
-			} else {
301
-				$stayUrl = "index.php?a=99&r=2";
302
-			}
296
+		    if($genpassword == 1 && $passwordnotifymethod == 's') {
297
+			    if($input['stay'] != '') {
298
+				    $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
299
+				    $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
300
+			    } else {
301
+				    $stayUrl = "index.php?a=99&r=2";
302
+			    }
303 303
 
304
-			include_once "header.inc.php";
305
-			?>
304
+			    include_once "header.inc.php";
305
+			    ?>
306 306
 
307 307
 			<h1><?php echo $_lang['web_user_title']; ?></h1>
308 308
 
@@ -322,18 +322,18 @@  discard block
 block discarded – undo
322 322
 			</div>
323 323
 			<?php
324 324
 
325
-			include_once "footer.inc.php";
326
-		} else {
327
-			if($input['stay'] != '') {
328
-				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
329
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
330
-				header($header);
331
-			} else {
332
-				$header = "Location: index.php?a=99&r=2";
333
-				header($header);
334
-			}
335
-		}
336
-		break;
337
-	default :
338
-		webAlertAndQuit("No operation set in request.", 88);
325
+			    include_once "footer.inc.php";
326
+		    } else {
327
+			    if($input['stay'] != '') {
328
+				    $a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
329
+				    $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
330
+				    header($header);
331
+			    } else {
332
+				    $header = "Location: index.php?a=99&r=2";
333
+				    header($header);
334
+			    }
335
+		    }
336
+		    break;
337
+	    default :
338
+		    webAlertAndQuit("No operation set in request.", 88);
339 339
 }
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 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 = $modx->getPhpCompat()->htmlspecialchars($v, ENT_NOQUOTES);
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->getDatabase()->escape($newusername);
@@ -50,21 +50,21 @@  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", 88);
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!", 88);
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->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66 66
 		$limit = $modx->getDatabase()->getValue($rs);
67
-		if($limit > 0) {
67
+		if ($limit > 0) {
68 68
 			webAlertAndQuit("User name is already in use!", 88);
69 69
 		}
70 70
 
@@ -72,21 +72,21 @@  discard block
 block discarded – undo
72 72
 		if ($modx->config['allow_multiple_emails'] != 1) {
73 73
 			$rs = $modx->getDatabase()->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74 74
 			$limit = $modx->getDatabase()->getValue($rs);
75
-			if($limit > 0) {
75
+			if ($limit > 0) {
76 76
 				webAlertAndQuit("Email is already in use!", 88);
77 77
 			}
78 78
 		}
79 79
 
80 80
 		// generate a new password for this user
81
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
-			if(strlen($specifiedpassword) < 6) {
81
+		if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
82
+			if (strlen($specifiedpassword) < 6) {
83 83
 				webAlertAndQuit("Password is too short!", 88);
84 84
 			} else {
85 85
 				$newpassword = $specifiedpassword;
86 86
 			}
87
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
87
+		} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
88 88
 			webAlertAndQuit("You didn't specify a password for this user!", 88);
89
-		} elseif($passwordgenmethod == 'g') {
89
+		} elseif ($passwordgenmethod == 'g') {
90 90
 			$newpassword = generate_password(8);
91 91
 		} else {
92 92
 			webAlertAndQuit("No password generation method specified!", 88);
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 		/*******************************************************************************/
117 117
 		// put the user in the user_groups he/ she should be in
118 118
 		// first, check that up_perms are switched on!
119
-		if($use_udperms == 1) {
120
-			if(!empty($user_groups)) {
121
-				for($i = 0; $i < count($user_groups); $i++) {
119
+		if ($use_udperms == 1) {
120
+			if (!empty($user_groups)) {
121
+				for ($i = 0; $i < count($user_groups); $i++) {
122 122
 					$f = array();
123
-					$f['webgroup'] = (int)$user_groups[$i];
123
+					$f['webgroup'] = (int) $user_groups[$i];
124 124
 					$f['webuser'] = $internalKey;
125 125
 					$modx->getDatabase()->insert($f, $tbl_web_groups);
126 126
 				}
@@ -144,20 +144,20 @@  discard block
 block discarded – undo
144 144
             "id" => $internalKey
145 145
         ));
146 146
 
147
-		if($passwordnotifymethod == 'e') {
147
+		if ($passwordnotifymethod == 'e') {
148 148
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
149
-			if($input['stay'] != '') {
149
+			if ($input['stay'] != '') {
150 150
 				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
151
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
151
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
152 152
 				header($header);
153 153
 			} else {
154 154
 				$header = "Location: index.php?a=99&r=2";
155 155
 				header($header);
156 156
 			}
157 157
 		} else {
158
-			if($input['stay'] != '') {
158
+			if ($input['stay'] != '') {
159 159
 				$a = ($input['stay'] == '2') ? "88&id={$internalKey}" : "87";
160
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
160
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
161 161
 			} else {
162 162
 				$stayUrl = "index.php?a=99&r=2";
163 163
 			}
@@ -190,29 +190,29 @@  discard block
 block discarded – undo
190 190
 		break;
191 191
 	case '88' : // edit user
192 192
 		// generate a new password for this user
193
-		if($genpassword == 1) {
194
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
-				if(strlen($specifiedpassword) < 6) {
193
+		if ($genpassword == 1) {
194
+			if ($specifiedpassword != "" && $passwordgenmethod == "spec") {
195
+				if (strlen($specifiedpassword) < 6) {
196 196
 					webAlertAndQuit("Password is too short!", 88);
197 197
 				} else {
198 198
 					$newpassword = $specifiedpassword;
199 199
 				}
200
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
200
+			} elseif ($specifiedpassword == "" && $passwordgenmethod == "spec") {
201 201
 				webAlertAndQuit("You didn't specify a password for this user!", 88);
202
-			} elseif($passwordgenmethod == 'g') {
202
+			} elseif ($passwordgenmethod == 'g') {
203 203
 				$newpassword = generate_password(8);
204 204
 			} else {
205 205
 				webAlertAndQuit("No password generation method specified!", 88);
206 206
 			}
207 207
 		}
208
-		if($passwordnotifymethod == 'e') {
208
+		if ($passwordnotifymethod == 'e') {
209 209
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $websignupemail_message, $site_url);
210 210
 		}
211 211
 
212 212
 		// check if the username already exist
213 213
 		$rs = $modx->getDatabase()->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214 214
 		$limit = $modx->getDatabase()->getValue($rs);
215
-		if($limit > 0) {
215
+		if ($limit > 0) {
216 216
 			webAlertAndQuit("User name is already in use!", 88);
217 217
 		}
218 218
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 		if ($modx->config['allow_multiple_emails'] != 1) {
221 221
 			$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222 222
 			$limit = $modx->getDatabase()->getValue($rs);
223
-			if($limit > 0) {
223
+			if ($limit > 0) {
224 224
 				webAlertAndQuit("Email is already in use!", 88);
225 225
 			}
226 226
 		}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		// update user name and password
235 235
 		$field = array();
236 236
 		$field['username'] = $esc_newusername;
237
-		if($genpassword == 1) {
237
+		if ($genpassword == 1) {
238 238
 			$field['password'] = md5($newpassword);
239 239
 		}
240 240
 		$modx->getDatabase()->update($field, $tbl_web_users, "id='{$id}'");
@@ -251,13 +251,13 @@  discard block
 block discarded – undo
251 251
 		/*******************************************************************************/
252 252
 		// put the user in the user_groups he/ she should be in
253 253
 		// first, check that up_perms are switched on!
254
-		if($use_udperms == 1) {
254
+		if ($use_udperms == 1) {
255 255
 			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
256 256
 			$modx->getDatabase()->delete($tbl_web_groups, "webuser='{$id}'");
257
-			if(!empty($user_groups)) {
258
-				for($i = 0; $i < count($user_groups); $i++) {
257
+			if (!empty($user_groups)) {
258
+				for ($i = 0; $i < count($user_groups); $i++) {
259 259
 					$field = array();
260
-					$field['webgroup'] = (int)$user_groups[$i];
260
+					$field['webgroup'] = (int) $user_groups[$i];
261 261
 					$field['webuser'] = $id;
262 262
 					$modx->getDatabase()->insert($field, $tbl_web_groups);
263 263
 				}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
         ));
280 280
 
281 281
         // invoke OnWebChangePassword event
282
-        if($genpassword == 1) {
282
+        if ($genpassword == 1) {
283 283
             $modx->invokeEvent("OnWebChangePassword", array(
284 284
                 "userid" => $id,
285 285
                 "username" => $newusername,
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
             "id" => $id
294 294
         ));
295 295
 
296
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
297
-			if($input['stay'] != '') {
296
+		if ($genpassword == 1 && $passwordnotifymethod == 's') {
297
+			if ($input['stay'] != '') {
298 298
 				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
299
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
299
+				$stayUrl = "index.php?a={$a}&r=2&stay=".$input['stay'];
300 300
 			} else {
301 301
 				$stayUrl = "index.php?a=99&r=2";
302 302
 			}
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 
325 325
 			include_once "footer.inc.php";
326 326
 		} else {
327
-			if($input['stay'] != '') {
327
+			if ($input['stay'] != '') {
328 328
 				$a = ($input['stay'] == '2') ? "88&id={$id}" : "87";
329
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
329
+				$header = "Location: index.php?a={$a}&r=2&stay=".$input['stay'];
330 330
 				header($header);
331 331
 			} else {
332 332
 				$header = "Location: index.php?a=99&r=2";
Please login to merge, or discard this patch.
manager/processors/delete_template.processor.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  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('delete_template')) {
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
 // delete the template, but first check it doesn't have any documents using it
15 15
 $rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0");
16 16
 $limit = $modx->getDatabase()->getRecordCount($rs);
17 17
 if($limit > 0) {
18
-	include "header.inc.php";
19
-	?>
18
+    include "header.inc.php";
19
+    ?>
20 20
 
21 21
 	<h1><?php echo $_lang['manage_templates']; ?></h1>
22 22
 
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 			<p>Documents using this template:</p>
29 29
 			<ul>
30 30
 				<?php
31
-				while($row = $modx->getDatabase()->getRow($rs)) {
32
-					echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
33
-				}
34
-				?>
31
+                while($row = $modx->getDatabase()->getRow($rs)) {
32
+                    echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
33
+                }
34
+                ?>
35 35
 			</ul>
36 36
 		</div>
37 37
 	</div>
38 38
 	<?php
39
-	include_once "footer.inc.php";
40
-	exit;
39
+    include_once "footer.inc.php";
40
+    exit;
41 41
 }
42 42
 
43 43
 if($id == $default_template) {
44
-	$modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
44
+    $modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
45 45
 }
46 46
 
47 47
 // Set the item name for logger
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
 // invoke OnBeforeTempFormDelete event
52 52
 $modx->invokeEvent("OnBeforeTempFormDelete", array(
53
-		"id" => $id
54
-	));
53
+        "id" => $id
54
+    ));
55 55
 
56 56
 // delete the document.
57 57
 $modx->getDatabase()->delete($modx->getFullTableName('site_templates'), "id='{$id}'");
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 
61 61
 // invoke OnTempFormDelete event
62 62
 $modx->invokeEvent("OnTempFormDelete", array(
63
-		"id" => $id
64
-	));
63
+        "id" => $id
64
+    ));
65 65
 
66 66
 // empty cache
67 67
 $modx->clearCache('full');
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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('delete_template')) {
5
+if (!$modx->hasPermission('delete_template')) {
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
 // delete the template, but first check it doesn't have any documents using it
15 15
 $rs = $modx->getDatabase()->select('id, pagetitle,introtext', $modx->getFullTableName('site_content'), "template='{$id}' AND deleted=0");
16 16
 $limit = $modx->getDatabase()->getRecordCount($rs);
17
-if($limit > 0) {
17
+if ($limit > 0) {
18 18
 	include "header.inc.php";
19 19
 	?>
20 20
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 			<p>Documents using this template:</p>
29 29
 			<ul>
30 30
 				<?php
31
-				while($row = $modx->getDatabase()->getRow($rs)) {
32
-					echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['introtext'] != '' ? ' - ' . $row['introtext'] : '') . '</li>';
31
+				while ($row = $modx->getDatabase()->getRow($rs)) {
32
+					echo '<li><span style="width: 200px"><a href="index.php?id='.$row['id'].'&a=27">'.$row['pagetitle'].'</a></span>'.($row['introtext'] != '' ? ' - '.$row['introtext'] : '').'</li>';
33 33
 				}
34 34
 				?>
35 35
 			</ul>
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	exit;
41 41
 }
42 42
 
43
-if($id == $default_template) {
43
+if ($id == $default_template) {
44 44
 	$modx->webAlertAndQuit("This template is set as the default template. Please choose a different default template in the MODX configuration before deleting this template.");
45 45
 }
46 46
 
Please login to merge, or discard this patch.
manager/processors/save_snippet.processor.php 2 patches
Switch Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -66,111 +66,111 @@
 block discarded – undo
66 66
 }
67 67
 
68 68
 switch ($_POST['mode']) {
69
-    case '23': // Save new snippet
70
-
71
-        // invoke OnBeforeSnipFormSave event
72
-        $modx->invokeEvent("OnBeforeSnipFormSave", array(
73
-            "mode" => "new",
74
-            "id" => $id
75
-        ));
76
-
77
-        // disallow duplicate names for new snippets
78
-        $rs = $modx->getDatabase()->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'");
79
-        $count = $modx->getDatabase()->getValue($rs);
80
-        if ($count > 0) {
81
-            $modx->getManagerApi()->saveFormValues(23);
82
-            $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23");
83
-        }
84
-
85
-        //do stuff to save the new doc
86
-        $newid = $modx->getDatabase()->insert(array(
87
-            'name' => $name,
88
-            'description' => $description,
89
-            'snippet' => $snippet,
90
-            'moduleguid' => $moduleguid,
91
-            'locked' => $locked,
92
-            'properties' => $properties,
93
-            'category' => $categoryid,
94
-            'disabled' => $disabled,
95
-            'createdon' => $currentdate,
96
-            'editedon' => $currentdate
97
-        ), $modx->getFullTableName('site_snippets'));
98
-
99
-        // invoke OnSnipFormSave event
100
-        $modx->invokeEvent("OnSnipFormSave", array(
101
-            "mode" => "new",
102
-            "id" => $newid
103
-        ));
104
-
105
-        // Set the item name for logger
106
-        $_SESSION['itemname'] = $name;
107
-
108
-        // empty cache
109
-        $modx->clearCache('full');
110
-
111
-        // finished emptying cache - redirect
112
-        if ($_POST['stay'] != '') {
113
-            $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23";
114
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
115
-            header($header);
116
-        } else {
117
-            $header = "Location: index.php?a=76&r=2";
118
-            header($header);
119
-        }
120
-        break;
121
-    case '22': // Save existing snippet
122
-        // invoke OnBeforeSnipFormSave event
123
-        $modx->invokeEvent("OnBeforeSnipFormSave", array(
124
-            "mode" => "upd",
125
-            "id" => $id
126
-        ));
127
-
128
-        // disallow duplicate names for snippets
129
-        $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_snippets'), "name='{$name}' AND id!='{$id}'");
130
-        if ($modx->getDatabase()->getValue($rs) > 0) {
131
-            $modx->getManagerApi()->saveFormValues(22);
132
-            $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}");
133
-        }
134
-
135
-        //do stuff to save the edited doc
136
-        $modx->getDatabase()->update(array(
137
-            'name' => $name,
138
-            'description' => $description,
139
-            'snippet' => $snippet,
140
-            'moduleguid' => $moduleguid,
141
-            'locked' => $locked,
142
-            'properties' => $properties,
143
-            'category' => $categoryid,
144
-            'disabled' => $disabled,
145
-            'editedon' => $currentdate
146
-        ), $modx->getFullTableName('site_snippets'), "id='{$id}'");
147
-
148
-        // invoke OnSnipFormSave event
149
-        $modx->invokeEvent("OnSnipFormSave", array(
150
-            "mode" => "upd",
151
-            "id" => $id
152
-        ));
153
-
154
-        // Set the item name for logger
155
-        $_SESSION['itemname'] = $name;
156
-
157
-        // empty cache
158
-        $modx->clearCache('full');
159
-
160
-        if ($_POST['runsnippet']) {
161
-            run_snippet($snippet);
162
-        }
163
-        // finished emptying cache - redirect
164
-        if ($_POST['stay'] != '') {
165
-            $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23";
166
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
167
-            header($header);
168
-        } else {
169
-            $modx->unlockElement(4, $id);
170
-            $header = "Location: index.php?a=76&r=2";
171
-            header($header);
172
-        }
173
-        break;
174
-    default:
175
-        $modx->webAlertAndQuit("No operation set in request.");
69
+        case '23': // Save new snippet
70
+
71
+            // invoke OnBeforeSnipFormSave event
72
+            $modx->invokeEvent("OnBeforeSnipFormSave", array(
73
+                "mode" => "new",
74
+                "id" => $id
75
+            ));
76
+
77
+            // disallow duplicate names for new snippets
78
+            $rs = $modx->getDatabase()->select('COUNT(id)', $modx->getFullTableName('site_snippets'), "name='{$name}'");
79
+            $count = $modx->getDatabase()->getValue($rs);
80
+            if ($count > 0) {
81
+                $modx->getManagerApi()->saveFormValues(23);
82
+                $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=23");
83
+            }
84
+
85
+            //do stuff to save the new doc
86
+            $newid = $modx->getDatabase()->insert(array(
87
+                'name' => $name,
88
+                'description' => $description,
89
+                'snippet' => $snippet,
90
+                'moduleguid' => $moduleguid,
91
+                'locked' => $locked,
92
+                'properties' => $properties,
93
+                'category' => $categoryid,
94
+                'disabled' => $disabled,
95
+                'createdon' => $currentdate,
96
+                'editedon' => $currentdate
97
+            ), $modx->getFullTableName('site_snippets'));
98
+
99
+            // invoke OnSnipFormSave event
100
+            $modx->invokeEvent("OnSnipFormSave", array(
101
+                "mode" => "new",
102
+                "id" => $newid
103
+            ));
104
+
105
+            // Set the item name for logger
106
+            $_SESSION['itemname'] = $name;
107
+
108
+            // empty cache
109
+            $modx->clearCache('full');
110
+
111
+            // finished emptying cache - redirect
112
+            if ($_POST['stay'] != '') {
113
+                $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23";
114
+                $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
115
+                header($header);
116
+            } else {
117
+                $header = "Location: index.php?a=76&r=2";
118
+                header($header);
119
+            }
120
+            break;
121
+        case '22': // Save existing snippet
122
+            // invoke OnBeforeSnipFormSave event
123
+            $modx->invokeEvent("OnBeforeSnipFormSave", array(
124
+                "mode" => "upd",
125
+                "id" => $id
126
+            ));
127
+
128
+            // disallow duplicate names for snippets
129
+            $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('site_snippets'), "name='{$name}' AND id!='{$id}'");
130
+            if ($modx->getDatabase()->getValue($rs) > 0) {
131
+                $modx->getManagerApi()->saveFormValues(22);
132
+                $modx->webAlertAndQuit(sprintf($_lang['duplicate_name_found_general'], $_lang['snippet'], $name), "index.php?a=22&id={$id}");
133
+            }
134
+
135
+            //do stuff to save the edited doc
136
+            $modx->getDatabase()->update(array(
137
+                'name' => $name,
138
+                'description' => $description,
139
+                'snippet' => $snippet,
140
+                'moduleguid' => $moduleguid,
141
+                'locked' => $locked,
142
+                'properties' => $properties,
143
+                'category' => $categoryid,
144
+                'disabled' => $disabled,
145
+                'editedon' => $currentdate
146
+            ), $modx->getFullTableName('site_snippets'), "id='{$id}'");
147
+
148
+            // invoke OnSnipFormSave event
149
+            $modx->invokeEvent("OnSnipFormSave", array(
150
+                "mode" => "upd",
151
+                "id" => $id
152
+            ));
153
+
154
+            // Set the item name for logger
155
+            $_SESSION['itemname'] = $name;
156
+
157
+            // empty cache
158
+            $modx->clearCache('full');
159
+
160
+            if ($_POST['runsnippet']) {
161
+                run_snippet($snippet);
162
+            }
163
+            // finished emptying cache - redirect
164
+            if ($_POST['stay'] != '') {
165
+                $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23";
166
+                $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
167
+                header($header);
168
+            } else {
169
+                $modx->unlockElement(4, $id);
170
+                $header = "Location: index.php?a=76&r=2";
171
+                header($header);
172
+            }
173
+            break;
174
+        default:
175
+            $modx->webAlertAndQuit("No operation set in request.");
176 176
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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('save_snippet')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $snippet = trim($_POST['post']);
11 11
 $name = $modx->getDatabase()->escape(trim($_POST['name']));
12 12
 $description = $modx->getDatabase()->escape($_POST['description']);
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 
34 34
 //Kyle Jaebker - added category support
35 35
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
36
-    $categoryid = (int)$_POST['categoryid'];
36
+    $categoryid = (int) $_POST['categoryid'];
37 37
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
38 38
     $categoryid = 0;
39 39
 } else {
40
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
40
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
41 41
     $categoryid = checkCategory($_POST['newcategory']);
42 42
     if (!$categoryid) {
43 43
         $categoryid = newCategory($_POST['newcategory']);
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
     $moduleguid = isset($parsed['guid']) ? $parsed['guid'] : $moduleguid;
56 56
 
57 57
     $description = isset($parsed['description']) ? $parsed['description'] : $description;
58
-    $version = isset($parsed['version']) ? '<b>' . $parsed['version'] . '</b> ' : '';
58
+    $version = isset($parsed['version']) ? '<b>'.$parsed['version'].'</b> ' : '';
59 59
     if ($version) {
60
-        $description = $version . trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
60
+        $description = $version.trim(preg_replace('/(<b>.+?)+(<\/b>)/i', '', $description));
61 61
     }
62 62
     if (isset($parsed['modx_category'])) {
63
-        include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
63
+        include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
64 64
         $categoryid = getCategory($parsed['modx_category']);
65 65
     }
66 66
 }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         // finished emptying cache - redirect
112 112
         if ($_POST['stay'] != '') {
113 113
             $a = ($_POST['stay'] == '2') ? "22&id=$newid" : "23";
114
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
114
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
115 115
             header($header);
116 116
         } else {
117 117
             $header = "Location: index.php?a=76&r=2";
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         // finished emptying cache - redirect
164 164
         if ($_POST['stay'] != '') {
165 165
             $a = ($_POST['stay'] == '2') ? "22&id=$id" : "23";
166
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
166
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
167 167
             header($header);
168 168
         } else {
169 169
             $modx->unlockElement(4, $id);
Please login to merge, or discard this patch.
manager/processors/delete_content.processor.php 1 patch
Spacing   +15 added lines, -15 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->getDatabase()->getRow($modx->getDatabase()->select('parent, pagetitle', $modx->getFullTableName('site_content'), "id='{$id}'"));
16
-$pid=($content['parent']==0?$id:$content['parent']);
15
+$content = $modx->getDatabase()->getRow($modx->getDatabase()->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
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
                             "children"=>$children
46 46
                         ));
47 47
 
48
-if (count($children)>0) {
48
+if (count($children) > 0) {
49 49
     $modx->getDatabase()->update(
50 50
         array(
51 51
             'deleted'   => 1,
@@ -54,19 +54,19 @@  discard block
 block discarded – undo
54 54
         ), $modx->getFullTableName('site_content'), "id IN (".implode(", ", $children).")");
55 55
 }
56 56
 
57
-if ($site_start==$id) {
57
+if ($site_start == $id) {
58 58
     $modx->webAlertAndQuit("Document is 'Site start' and cannot be deleted!");
59 59
 }
60 60
 
61
-if ($site_unavailable_page==$id) {
61
+if ($site_unavailable_page == $id) {
62 62
     $modx->webAlertAndQuit("Document is used as the 'Site unavailable page' and cannot be deleted!");
63 63
 }
64 64
 
65
-if ($error_page==$id) {
65
+if ($error_page == $id) {
66 66
     $modx->webAlertAndQuit("Document is used as the 'Site error page' and cannot be deleted!");
67 67
 }
68 68
 
69
-if ($unauthorized_page==$id) {
69
+if ($unauthorized_page == $id) {
70 70
     $modx->webAlertAndQuit("Document is used as the 'Site unauthorized page' and cannot be deleted!");
71 71
 }
72 72
 
@@ -92,5 +92,5 @@  discard block
 block discarded – undo
92 92
 $modx->clearCache('full');
93 93
 
94 94
 // finished emptying cache - redirect
95
-$header="Location: index.php?a=3&id=$pid&r=1".$add_path;
95
+$header = "Location: index.php?a=3&id=$pid&r=1".$add_path;
96 96
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_tmplvars.processor.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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('save_template')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $name = $modx->getDatabase()->escape(trim($_POST['name']));
11 11
 $description = $modx->getDatabase()->escape($_POST['description']);
12 12
 $caption = $modx->getDatabase()->escape($_POST['caption']);
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
 $display = $modx->getDatabase()->escape($_POST['display']);
18 18
 $params = $modx->getDatabase()->escape($_POST['params']);
19 19
 $locked = $_POST['locked'] == 'on' ? 1 : 0;
20
-$origin = isset($_REQUEST['or']) ? (int)$_REQUEST['or'] : 76;
21
-$originId = isset($_REQUEST['oid']) ? (int)$_REQUEST['oid'] : null;
20
+$origin = isset($_REQUEST['or']) ? (int) $_REQUEST['or'] : 76;
21
+$originId = isset($_REQUEST['oid']) ? (int) $_REQUEST['oid'] : null;
22 22
 $currentdate = time() + $modx->config['server_offset_time'];
23 23
 
24 24
 //Kyle Jaebker - added category support
25 25
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
26
-    $categoryid = (int)$_POST['categoryid'];
26
+    $categoryid = (int) $_POST['categoryid'];
27 27
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
28 28
     $categoryid = 0;
29 29
 } else {
30
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
30
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
31 31
     $categoryid = checkCategory($_POST['newcategory']);
32 32
     if (!$categoryid) {
33 33
         $categoryid = newCategory($_POST['newcategory']);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         // finished emptying cache - redirect
100 100
         if ($_POST['stay'] != '') {
101 101
             $a = ($_POST['stay'] == '2') ? "301&id=$newid" : "300";
102
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
102
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
103 103
             header($header);
104 104
         } else {
105 105
             $header = "Location: index.php?a=76&r=2";
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
         // finished emptying cache - redirect
161 161
         if ($_POST['stay'] != '') {
162 162
             $a = ($_POST['stay'] == '2') ? "301&id=$id" : "300";
163
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'] . "&or=" . $origin . "&oid=" . $originId;
163
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay']."&or=".$origin."&oid=".$originId;
164 164
             header($header);
165 165
         } else {
166 166
             $modx->unlockElement(2, $id);
167
-            $header = "Location: index.php?a=" . $origin . "&r=2" . (empty($originId) ? '' : '&id=' . $originId);
167
+            $header = "Location: index.php?a=".$origin."&r=2".(empty($originId) ? '' : '&id='.$originId);
168 168
             header($header);
169 169
         }
170 170
 
Please login to merge, or discard this patch.
manager/processors/duplicate_plugin.processor.php 3 patches
Indentation   +18 added lines, -18 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_plugin')) {
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
 // count duplicates
@@ -19,25 +19,25 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate Plugin
21 21
 $newid = $modx->getDatabase()->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'disabled'=>'',
26
-		'moduleguid'=>'',
27
-		'plugincode'=>'',
28
-		'properties'=>'',
29
-		'category'=>'',
30
-		), $modx->getFullTableName('site_plugins'), // Insert into
31
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'disabled'=>'',
26
+        'moduleguid'=>'',
27
+        'plugincode'=>'',
28
+        'properties'=>'',
29
+        'category'=>'',
30
+        ), $modx->getFullTableName('site_plugins'), // Insert into
31
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, moduleguid, plugincode, properties, category", $modx->getFullTableName('site_plugins'), "id='{$id}'"); // Copy from
32 32
 
33 33
 // duplicate Plugin Event Listeners
34 34
 $modx->getDatabase()->insert(
35
-	array(
36
-		'pluginid'=>'',
37
-		'evtid'=>'',
38
-		'priority'=>'',
39
-		), $modx->getFullTableName('site_plugin_events'), // Insert into
40
-	"'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from
35
+    array(
36
+        'pluginid'=>'',
37
+        'evtid'=>'',
38
+        'priority'=>'',
39
+        ), $modx->getFullTableName('site_plugin_events'), // Insert into
40
+    "'{$newid}', evtid, priority", $modx->getFullTableName('site_plugin_events'), "pluginid='{$id}'"); // Copy from
41 41
 
42 42
 // Set the item name for logger
43 43
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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_plugin')) {
5
+if (!$modx->hasPermission('new_plugin')) {
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
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
17
+if ($count >= 1) $count = ' '.($count + 1);
18 18
 else $count = '';
19 19
 
20 20
 // duplicate Plugin
@@ -44,5 +44,5 @@  discard block
 block discarded – undo
44 44
 $_SESSION['itemname'] = $name;
45 45
 
46 46
 // finish duplicating - redirect to new plugin
47
-$header="Location: index.php?r=2&a=102&id=$newid";
47
+$header = "Location: index.php?r=2&a=102&id=$newid";
48 48
 header($header);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@
 block discarded – undo
14 14
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_plugins'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
18
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
19 22
 
20 23
 // duplicate Plugin
21 24
 $newid = $modx->getDatabase()->insert(
Please login to merge, or discard this patch.
manager/processors/save_htmlsnippet.processor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  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('save_chunk')) {
6 6
     $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9
-$id = (int)$_POST['id'];
9
+$id = (int) $_POST['id'];
10 10
 $snippet = $modx->getDatabase()->escape($_POST['post']);
11 11
 $name = $modx->getDatabase()->escape(trim($_POST['name']));
12 12
 $description = $modx->getDatabase()->escape($_POST['description']);
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
 
17 17
 //Kyle Jaebker - added category support
18 18
 if (empty($_POST['newcategory']) && $_POST['categoryid'] > 0) {
19
-    $categoryid = (int)$_POST['categoryid'];
19
+    $categoryid = (int) $_POST['categoryid'];
20 20
 } elseif (empty($_POST['newcategory']) && $_POST['categoryid'] <= 0) {
21 21
     $categoryid = 0;
22 22
 } else {
23
-    include_once(MODX_MANAGER_PATH . 'includes/categories.inc.php');
23
+    include_once(MODX_MANAGER_PATH.'includes/categories.inc.php');
24 24
     $categoryid = checkCategory($_POST['newcategory']);
25 25
     if (!$categoryid) {
26 26
         $categoryid = newCategory($_POST['newcategory']);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         // finished emptying cache - redirect
81 81
         if ($_POST['stay'] != '') {
82 82
             $a = ($_POST['stay'] == '2') ? "78&id=$newid" : "77";
83
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
83
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
84 84
             header($header);
85 85
         } else {
86 86
             $header = "Location: index.php?a=76&r=2";
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         // finished emptying cache - redirect
130 130
         if ($_POST['stay'] != '') {
131 131
             $a = ($_POST['stay'] == '2') ? "78&id=$id" : "77";
132
-            $header = "Location: index.php?a=" . $a . "&r=2&stay=" . $_POST['stay'];
132
+            $header = "Location: index.php?a=".$a."&r=2&stay=".$_POST['stay'];
133 133
             header($header);
134 134
         } else {
135 135
             $modx->unlockElement(3, $id);
Please login to merge, or discard this patch.
manager/processors/duplicate_snippet.processor.php 3 patches
Indentation   +10 added lines, -10 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_snippet')) {
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
 // count duplicates
@@ -19,14 +19,14 @@  discard block
 block discarded – undo
19 19
 
20 20
 // duplicate Snippet
21 21
 $newid = $modx->getDatabase()->insert(
22
-	array(
23
-		'name'=>'',
24
-		'description'=>'',
25
-		'snippet'=>'',
26
-		'properties'=>'',
27
-		'category'=>'',
28
-		), $modx->getFullTableName('site_snippets'), // Insert into
29
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'snippet'=>'',
26
+        'properties'=>'',
27
+        'category'=>'',
28
+        ), $modx->getFullTableName('site_snippets'), // Insert into
29
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from
30 30
 
31 31
 // Set the item name for logger
32 32
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  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_snippet')) {
5
+if (!$modx->hasPermission('new_snippet')) {
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
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
17
+if ($count >= 1) $count = ' '.($count + 1);
18 18
 else $count = '';
19 19
 
20 20
 // duplicate Snippet
@@ -33,5 +33,5 @@  discard block
 block discarded – undo
33 33
 $_SESSION['itemname'] = $name;
34 34
 
35 35
 // finish duplicating - redirect to new snippet
36
-$header="Location: index.php?r=2&a=22&id=$newid";
36
+$header = "Location: index.php?r=2&a=22&id=$newid";
37 37
 header($header);
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,11 @@
 block discarded – undo
14 14
 // count duplicates
15 15
 $name = $modx->getDatabase()->getValue($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "id='{$id}'"));
16 16
 $count = $modx->getDatabase()->getRecordCount($modx->getDatabase()->select('name', $modx->getFullTableName('site_snippets'), "name LIKE '{$name} {$_lang['duplicated_el_suffix']}%'"));
17
-if($count>=1) $count = ' '.($count+1);
18
-else $count = '';
17
+if($count>=1) {
18
+    $count = ' '.($count+1);
19
+} else {
20
+    $count = '';
21
+}
19 22
 
20 23
 // duplicate Snippet
21 24
 $newid = $modx->getDatabase()->insert(
Please login to merge, or discard this patch.