Completed
Push — develop ( cb7ecf...5e631f )
by Dmytro
17s
created
manager/processors/delete_plugin.processor.php 1 patch
Indentation   +8 added lines, -8 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('delete_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
 // Set the item name for logger
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 // invoke OnBeforePluginFormDelete event
19 19
 $modx->invokeEvent("OnBeforePluginFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the plugin.
25 25
 $modx->getDatabase()->delete($modx->getFullTableName('site_plugins'), "id='{$id}'");
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
 // invoke OnPluginFormDelete event
31 31
 $modx->invokeEvent("OnPluginFormDelete",
32
-	array(
33
-		"id"	=> $id
34
-	));
32
+    array(
33
+        "id"	=> $id
34
+    ));
35 35
 
36 36
 // empty cache
37 37
 $modx->clearCache('full');
Please login to merge, or discard this patch.
manager/processors/delete_role.processor.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,22 +3,22 @@
 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('delete_role')) {
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
 if($id==1){
15
-	$modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!");
15
+    $modx->webAlertAndQuit("The role you are trying to delete is the admin role. This role cannot be deleted!");
16 16
 }
17 17
 
18 18
 $rs = $modx->getDatabase()->select('COUNT(*)', $modx->getFullTableName('user_attributes'), "role='{$id}'");
19 19
 $count=$modx->getDatabase()->getValue($rs);
20 20
 if($count>0){
21
-	$modx->webAlertAndQuit("There are users with this role. It can't be deleted.");
21
+    $modx->webAlertAndQuit("There are users with this role. It can't be deleted.");
22 22
 }
23 23
 
24 24
 // Set the item name for logger
Please login to merge, or discard this patch.
manager/processors/publish_content.processor.php 1 patch
Indentation   +12 added lines, -12 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('save_document')||!$modx->hasPermission('publish_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_REQUEST['id'])? (int)$_REQUEST['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
 /************webber ********/
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 $udperms->role = $_SESSION['mgrRole'];
33 33
 
34 34
 if(!$udperms->checkPermissions()) {
35
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
35
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
36 36
 }
37 37
 
38 38
 // update the document
39 39
 $modx->getDatabase()->update(
40
-	array(
41
-		'published'   => 1,
42
-		'pub_date'    => 0,
43
-		'unpub_date'  => 0,
44
-		'editedby'    => $modx->getLoginUserID(),
45
-		'editedon'    => time(),
46
-		'publishedby' => $modx->getLoginUserID(),
47
-		'publishedon' => time(),
48
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
40
+    array(
41
+        'published'   => 1,
42
+        'pub_date'    => 0,
43
+        'unpub_date'  => 0,
44
+        'editedby'    => $modx->getLoginUserID(),
45
+        'editedon'    => time(),
46
+        'publishedby' => $modx->getLoginUserID(),
47
+        'publishedon' => time(),
48
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
49 49
 
50 50
 // invoke OnDocPublished  event
51 51
 $modx->invokeEvent("OnDocPublished",array("docid"=>$id));
Please login to merge, or discard this patch.
manager/processors/send_message.processor.php 1 patch
Indentation   +43 added lines, -43 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('messages')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $sendto = $_REQUEST['sendto'];
@@ -16,55 +16,55 @@  discard block
 block discarded – undo
16 16
 $postdate = time();
17 17
 
18 18
 if($sendto=='u') {
19
-	if($userid==0) {
20
-		$modx->webAlertAndQuit($_lang["error_no_user_selected"]);
21
-	}
22
-	$modx->getDatabase()->insert(
23
-		array(
24
-			'recipient' => $userid,
25
-			'sender'    => $modx->getLoginUserID(),
26
-			'subject'   => $subject,
27
-			'message'   => $message,
28
-			'postdate'  => $postdate,
29
-			'type'      => 'Message',
30
-			'private'   => 1,
31
-		), $modx->getFullTableName('user_messages'));
19
+    if($userid==0) {
20
+        $modx->webAlertAndQuit($_lang["error_no_user_selected"]);
21
+    }
22
+    $modx->getDatabase()->insert(
23
+        array(
24
+            'recipient' => $userid,
25
+            'sender'    => $modx->getLoginUserID(),
26
+            'subject'   => $subject,
27
+            'message'   => $message,
28
+            'postdate'  => $postdate,
29
+            'type'      => 'Message',
30
+            'private'   => 1,
31
+        ), $modx->getFullTableName('user_messages'));
32 32
 }
33 33
 
34 34
 if($sendto=='g') {
35
-	if($groupid==0) {
36
-		$modx->webAlertAndQuit($_lang["error_no_group_selected"]);
37
-	}
38
-	$rs = $modx->getDatabase()->select('internalKey', $modx->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'");
39
-	while ($row=$modx->getDatabase()->getRow($rs)) {
40
-		$modx->getDatabase()->insert(
41
-			array(
42
-				'recipient' => $row['internalKey'],
43
-				'sender'    => $modx->getLoginUserID(),
44
-				'subject'   => $subject,
45
-				'message'   => $message,
46
-				'postdate'  => $postdate,
47
-				'type'      => 'Message',
48
-				'private'   => 0,
49
-			), $modx->getFullTableName('user_messages'));
50
-	}
35
+    if($groupid==0) {
36
+        $modx->webAlertAndQuit($_lang["error_no_group_selected"]);
37
+    }
38
+    $rs = $modx->getDatabase()->select('internalKey', $modx->getFullTableName('user_attributes'), "role='{$groupid}' AND internalKey!='".$modx->getLoginUserID()."'");
39
+    while ($row=$modx->getDatabase()->getRow($rs)) {
40
+        $modx->getDatabase()->insert(
41
+            array(
42
+                'recipient' => $row['internalKey'],
43
+                'sender'    => $modx->getLoginUserID(),
44
+                'subject'   => $subject,
45
+                'message'   => $message,
46
+                'postdate'  => $postdate,
47
+                'type'      => 'Message',
48
+                'private'   => 0,
49
+            ), $modx->getFullTableName('user_messages'));
50
+    }
51 51
 }
52 52
 
53 53
 
54 54
 if($sendto=='a') {
55
-	$rs = $modx->getDatabase()->select('id', $modx->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'");
56
-	while ($row=$modx->getDatabase()->getRow($rs)) {
57
-		$modx->getDatabase()->insert(
58
-			array(
59
-				'recipient' => $row['id'],
60
-				'sender'    => $modx->getLoginUserID(),
61
-				'subject'   => $subject,
62
-				'message'   => $message,
63
-				'postdate'  => $postdate,
64
-				'type'      => 'Message',
65
-				'private'   => 0,
66
-			), $modx->getFullTableName('user_messages'));
67
-	}
55
+    $rs = $modx->getDatabase()->select('id', $modx->getFullTableName('manager_users'), "id!='".$modx->getLoginUserID()."'");
56
+    while ($row=$modx->getDatabase()->getRow($rs)) {
57
+        $modx->getDatabase()->insert(
58
+            array(
59
+                'recipient' => $row['id'],
60
+                'sender'    => $modx->getLoginUserID(),
61
+                'subject'   => $subject,
62
+                'message'   => $message,
63
+                'postdate'  => $postdate,
64
+                'type'      => 'Message',
65
+                'private'   => 0,
66
+            ), $modx->getFullTableName('user_messages'));
67
+    }
68 68
 }
69 69
 
70 70
 $header = "Location: index.php?a=10";
Please login to merge, or discard this patch.
manager/processors/delete_snippet.processor.php 1 patch
Indentation   +8 added lines, -8 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('delete_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
 // Set the item name for logger
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
 
18 18
 // invoke OnBeforeSnipFormDelete event
19 19
 $modx->invokeEvent("OnBeforeSnipFormDelete",
20
-	array(
21
-		"id"	=> $id
22
-	));
20
+    array(
21
+        "id"	=> $id
22
+    ));
23 23
 
24 24
 // delete the snippet.
25 25
 $modx->getDatabase()->delete($modx->getFullTableName('site_snippets'), "id='{$id}'");
26 26
 
27 27
 // invoke OnSnipFormDelete event
28 28
 $modx->invokeEvent("OnSnipFormDelete",
29
-	array(
30
-		"id"	=> $id
31
-	));
29
+    array(
30
+        "id"	=> $id
31
+    ));
32 32
 
33 33
 // empty cache
34 34
 $modx->clearCache('full');
Please login to merge, or discard this patch.
manager/processors/unpublish_content.processor.php 1 patch
Indentation   +12 added lines, -12 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('save_document')||!$modx->hasPermission('publish_document')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_REQUEST['id'])? (int)$_REQUEST['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
 /************webber ********/
@@ -32,20 +32,20 @@  discard block
 block discarded – undo
32 32
 $udperms->role = $_SESSION['mgrRole'];
33 33
 
34 34
 if(!$udperms->checkPermissions()) {
35
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
35
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
36 36
 }
37 37
 
38 38
 // update the document
39 39
 $modx->getDatabase()->update(
40
-	array(
41
-		'published'   => 0,
42
-		'pub_date'    => 0,
43
-		'unpub_date'  => 0,
44
-		'editedby'    => $modx->getLoginUserID(),
45
-		'editedon'    => time(),
46
-		'publishedby' => 0,
47
-		'publishedon' => 0,
48
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
40
+    array(
41
+        'published'   => 0,
42
+        'pub_date'    => 0,
43
+        'unpub_date'  => 0,
44
+        'editedby'    => $modx->getLoginUserID(),
45
+        'editedon'    => time(),
46
+        'publishedby' => 0,
47
+        'publishedon' => 0,
48
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
49 49
 
50 50
 // invoke OnDocUnPublished  event
51 51
 $modx->invokeEvent("OnDocUnPublished",array("docid"=>$id));
Please login to merge, or discard this patch.
manager/processors/save_user.processor.php 1 patch
Indentation   +245 added lines, -245 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_user')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $tbl_manager_users = $modx->getFullTableName('manager_users');
@@ -43,134 +43,134 @@  discard block
 block discarded – undo
43 43
 
44 44
 // verify password
45 45
 if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
46
-	webAlertAndQuit("Password typed is mismatched", 12);
46
+    webAlertAndQuit("Password typed is mismatched", 12);
47 47
 }
48 48
 
49 49
 // verify email
50 50
 if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
51
-	webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
51
+    webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
52 52
 }
53 53
 
54 54
 // verify admin security
55 55
 if($_SESSION['mgrRole'] != 1) {
56
-	// Check to see if user tried to spoof a "1" (admin) role
57
-	if(!$modx->hasPermission('save_user')) {
58
-		webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
59
-	}
60
-	// Verify that the user being edited wasn't an admin and the user ID got spoofed
61
-	$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1");
62
-	$limit = $modx->getDatabase()->getValue($rs);
63
-	if($limit > 0) {
64
-		webAlertAndQuit("You cannot alter an administrative user.", 12);
65
-	}
56
+    // Check to see if user tried to spoof a "1" (admin) role
57
+    if(!$modx->hasPermission('save_user')) {
58
+        webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
59
+    }
60
+    // Verify that the user being edited wasn't an admin and the user ID got spoofed
61
+    $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1");
62
+    $limit = $modx->getDatabase()->getValue($rs);
63
+    if($limit > 0) {
64
+        webAlertAndQuit("You cannot alter an administrative user.", 12);
65
+    }
66 66
 
67 67
 }
68 68
 
69 69
 switch($input['mode']) {
70
-	case '11' : // new user
71
-		// check if this user name already exist
72
-		$rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername)));
73
-		$limit = $modx->getDatabase()->getValue($rs);
74
-		if($limit > 0) {
75
-			webAlertAndQuit("User name is already in use!", 12);
76
-		}
77
-
78
-		// check if the email address already exist
79
-		$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id));
80
-		$limit = $modx->getDatabase()->getValue($rs);
81
-		if($limit > 0) {
82
-			webAlertAndQuit("Email is already in use!", 12);
83
-		}
84
-
85
-		// generate a new password for this user
86
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
87
-			if(strlen($specifiedpassword) < 6) {
88
-				webAlertAndQuit("Password is too short!", 12);
89
-			} else {
90
-				$newpassword = $specifiedpassword;
91
-			}
92
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
93
-			webAlertAndQuit("You didn't specify a password for this user!", 12);
94
-		} elseif($passwordgenmethod == 'g') {
95
-			$newpassword = generate_password(8);
96
-		} else {
97
-			webAlertAndQuit("No password generation method specified!", 12);
98
-		}
99
-
100
-		// invoke OnBeforeUserFormSave event
101
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
102
-			"mode" => "new",
103
-		));
104
-
105
-		// create the user account
106
-		$internalKey = $modx->getDatabase()->insert(array('username' => $modx->getDatabase()->escape($newusername)), $tbl_manager_users);
107
-
108
-		$field = array();
109
-		$field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
110
-		$modx->getDatabase()->update($field, $tbl_manager_users, "id='{$internalKey}'");
111
-
112
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
113
-		$field = $modx->getDatabase()->escape($field);
114
-		$modx->getDatabase()->insert($field, $tbl_user_attributes);
115
-
116
-		// Save user settings
70
+    case '11' : // new user
71
+        // check if this user name already exist
72
+        $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->getDatabase()->escape($newusername)));
73
+        $limit = $modx->getDatabase()->getValue($rs);
74
+        if($limit > 0) {
75
+            webAlertAndQuit("User name is already in use!", 12);
76
+        }
77
+
78
+        // check if the email address already exist
79
+        $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->getDatabase()->escape($email), $id));
80
+        $limit = $modx->getDatabase()->getValue($rs);
81
+        if($limit > 0) {
82
+            webAlertAndQuit("Email is already in use!", 12);
83
+        }
84
+
85
+        // generate a new password for this user
86
+        if($specifiedpassword != "" && $passwordgenmethod == "spec") {
87
+            if(strlen($specifiedpassword) < 6) {
88
+                webAlertAndQuit("Password is too short!", 12);
89
+            } else {
90
+                $newpassword = $specifiedpassword;
91
+            }
92
+        } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
93
+            webAlertAndQuit("You didn't specify a password for this user!", 12);
94
+        } elseif($passwordgenmethod == 'g') {
95
+            $newpassword = generate_password(8);
96
+        } else {
97
+            webAlertAndQuit("No password generation method specified!", 12);
98
+        }
99
+
100
+        // invoke OnBeforeUserFormSave event
101
+        $modx->invokeEvent("OnBeforeUserFormSave", array(
102
+            "mode" => "new",
103
+        ));
104
+
105
+        // create the user account
106
+        $internalKey = $modx->getDatabase()->insert(array('username' => $modx->getDatabase()->escape($newusername)), $tbl_manager_users);
107
+
108
+        $field = array();
109
+        $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
110
+        $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$internalKey}'");
111
+
112
+        $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
113
+        $field = $modx->getDatabase()->escape($field);
114
+        $modx->getDatabase()->insert($field, $tbl_user_attributes);
115
+
116
+        // Save user settings
117 117
         saveManagerUserSettings($internalKey);
118 118
 
119
-		// invoke OnManagerSaveUser event
120
-		$modx->invokeEvent("OnManagerSaveUser", array(
121
-			"mode" => "new",
122
-			"userid" => $internalKey,
123
-			"username" => $newusername,
124
-			"userpassword" => $newpassword,
125
-			"useremail" => $email,
126
-			"userfullname" => $fullname,
127
-			"userroleid" => $role
128
-		));
129
-
130
-		// invoke OnUserFormSave event
131
-		$modx->invokeEvent("OnUserFormSave", array(
132
-			"mode" => "new",
133
-			"id" => $internalKey
134
-		));
135
-
136
-		// Set the item name for logger
137
-		$_SESSION['itemname'] = $newusername;
138
-
139
-		/*******************************************************************************/
140
-		// put the user in the user_groups he/ she should be in
141
-		// first, check that up_perms are switched on!
142
-		if($use_udperms == 1) {
143
-			if(!empty($user_groups)) {
144
-				for($i = 0; $i < count($user_groups); $i++) {
145
-					$f = array();
146
-					$f['user_group'] = (int)$user_groups[$i];
147
-					$f['member'] = $internalKey;
148
-					$modx->getDatabase()->insert($f, $tbl_member_groups);
149
-				}
150
-			}
151
-		}
152
-		// end of user_groups stuff!
153
-
154
-		if($passwordnotifymethod == 'e') {
119
+        // invoke OnManagerSaveUser event
120
+        $modx->invokeEvent("OnManagerSaveUser", array(
121
+            "mode" => "new",
122
+            "userid" => $internalKey,
123
+            "username" => $newusername,
124
+            "userpassword" => $newpassword,
125
+            "useremail" => $email,
126
+            "userfullname" => $fullname,
127
+            "userroleid" => $role
128
+        ));
129
+
130
+        // invoke OnUserFormSave event
131
+        $modx->invokeEvent("OnUserFormSave", array(
132
+            "mode" => "new",
133
+            "id" => $internalKey
134
+        ));
135
+
136
+        // Set the item name for logger
137
+        $_SESSION['itemname'] = $newusername;
138
+
139
+        /*******************************************************************************/
140
+        // put the user in the user_groups he/ she should be in
141
+        // first, check that up_perms are switched on!
142
+        if($use_udperms == 1) {
143
+            if(!empty($user_groups)) {
144
+                for($i = 0; $i < count($user_groups); $i++) {
145
+                    $f = array();
146
+                    $f['user_group'] = (int)$user_groups[$i];
147
+                    $f['member'] = $internalKey;
148
+                    $modx->getDatabase()->insert($f, $tbl_member_groups);
149
+                }
150
+            }
151
+        }
152
+        // end of user_groups stuff!
153
+
154
+        if($passwordnotifymethod == 'e') {
155 155
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
156
-			if($input['stay'] != '') {
157
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
158
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
159
-				header($header);
160
-			} else {
161
-				$header = "Location: index.php?a=75&r=2";
162
-				header($header);
163
-			}
164
-		} else {
165
-			if($input['stay'] != '') {
166
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
167
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
168
-			} else {
169
-				$stayUrl = "index.php?a=75&r=2";
170
-			}
171
-
172
-			include_once "header.inc.php";
173
-			?>
156
+            if($input['stay'] != '') {
157
+                $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
158
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
159
+                header($header);
160
+            } else {
161
+                $header = "Location: index.php?a=75&r=2";
162
+                header($header);
163
+            }
164
+        } else {
165
+            if($input['stay'] != '') {
166
+                $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
167
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
168
+            } else {
169
+                $stayUrl = "index.php?a=75&r=2";
170
+            }
171
+
172
+            include_once "header.inc.php";
173
+            ?>
174 174
 
175 175
 			<h1><?php echo $_lang['user_title']; ?></h1>
176 176
 
@@ -192,125 +192,125 @@  discard block
 block discarded – undo
192 192
 			</div>
193 193
 			<?php
194 194
 
195
-			include_once "footer.inc.php";
196
-		}
197
-		break;
198
-	case '12' : // edit user
199
-		// generate a new password for this user
200
-		if($genpassword == 1) {
201
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
202
-				if(strlen($specifiedpassword) < 6) {
203
-					webAlertAndQuit("Password is too short!", 12);
204
-				} else {
205
-					$newpassword = $specifiedpassword;
206
-				}
207
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
208
-				webAlertAndQuit("You didn't specify a password for this user!", 12);
209
-			} elseif($passwordgenmethod == 'g') {
210
-				$newpassword = generate_password(8);
211
-			} else {
212
-				webAlertAndQuit("No password generation method specified!", 12);
213
-			}
214
-		}
215
-		if($passwordnotifymethod == 'e') {
195
+            include_once "footer.inc.php";
196
+        }
197
+        break;
198
+    case '12' : // edit user
199
+        // generate a new password for this user
200
+        if($genpassword == 1) {
201
+            if($specifiedpassword != "" && $passwordgenmethod == "spec") {
202
+                if(strlen($specifiedpassword) < 6) {
203
+                    webAlertAndQuit("Password is too short!", 12);
204
+                } else {
205
+                    $newpassword = $specifiedpassword;
206
+                }
207
+            } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
208
+                webAlertAndQuit("You didn't specify a password for this user!", 12);
209
+            } elseif($passwordgenmethod == 'g') {
210
+                $newpassword = generate_password(8);
211
+            } else {
212
+                webAlertAndQuit("No password generation method specified!", 12);
213
+            }
214
+        }
215
+        if($passwordnotifymethod == 'e') {
216 216
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
217
-		}
218
-
219
-		// check if the username already exist
220
-		$rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id));
221
-		$limit = $modx->getDatabase()->getValue($rs);
222
-		if($limit > 0) {
223
-			webAlertAndQuit("User name is already in use!", 12);
224
-		}
225
-
226
-		// check if the email address already exists
227
-		$rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id));
228
-		$limit = $modx->getDatabase()->getValue($rs);
229
-		if($limit > 0) {
230
-			webAlertAndQuit("Email is already in use!", 12);
231
-		}
232
-
233
-		// invoke OnBeforeUserFormSave event
234
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
235
-			"mode" => "upd",
236
-			"id" => $id
237
-		));
238
-
239
-		// update user name and password
240
-		$field = array();
241
-		$field['username'] = $modx->getDatabase()->escape($newusername);
242
-		if($genpassword == 1) {
243
-			$field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
244
-		}
245
-		$modx->getDatabase()->update($field, $tbl_manager_users, "id='{$id}'");
246
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
247
-		$field = $modx->getDatabase()->escape($field);
248
-		$modx->getDatabase()->update($field, $tbl_user_attributes, "internalKey='{$id}'");
249
-
250
-		// Save user settings
217
+        }
218
+
219
+        // check if the username already exist
220
+        $rs = $modx->getDatabase()->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->getDatabase()->escape($newusername), $id));
221
+        $limit = $modx->getDatabase()->getValue($rs);
222
+        if($limit > 0) {
223
+            webAlertAndQuit("User name is already in use!", 12);
224
+        }
225
+
226
+        // check if the email address already exists
227
+        $rs = $modx->getDatabase()->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->getDatabase()->escape($email), $id));
228
+        $limit = $modx->getDatabase()->getValue($rs);
229
+        if($limit > 0) {
230
+            webAlertAndQuit("Email is already in use!", 12);
231
+        }
232
+
233
+        // invoke OnBeforeUserFormSave event
234
+        $modx->invokeEvent("OnBeforeUserFormSave", array(
235
+            "mode" => "upd",
236
+            "id" => $id
237
+        ));
238
+
239
+        // update user name and password
240
+        $field = array();
241
+        $field['username'] = $modx->getDatabase()->escape($newusername);
242
+        if($genpassword == 1) {
243
+            $field['password'] = $modx->getPasswordHash()->HashPassword($newpassword);
244
+        }
245
+        $modx->getDatabase()->update($field, $tbl_manager_users, "id='{$id}'");
246
+        $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
247
+        $field = $modx->getDatabase()->escape($field);
248
+        $modx->getDatabase()->update($field, $tbl_user_attributes, "internalKey='{$id}'");
249
+
250
+        // Save user settings
251 251
         saveManagerUserSettings($id);
252 252
 
253
-		// Set the item name for logger
254
-		$_SESSION['itemname'] = $newusername;
255
-
256
-		// invoke OnManagerSaveUser event
257
-		$modx->invokeEvent("OnManagerSaveUser", array(
258
-			"mode" => "upd",
259
-			"userid" => $id,
260
-			"username" => $newusername,
261
-			"userpassword" => $newpassword,
262
-			"useremail" => $email,
263
-			"userfullname" => $fullname,
264
-			"userroleid" => $role,
265
-			"oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
266
-			"olduseremail" => (($oldemail != $email) ? $oldemail : "")
267
-		));
268
-
269
-		// invoke OnManagerChangePassword event
270
-		if($genpassword == 1) {
271
-			$modx->invokeEvent("OnManagerChangePassword", array(
272
-				"userid" => $id,
273
-				"username" => $newusername,
274
-				"userpassword" => $newpassword
275
-			));
276
-		}
277
-
278
-		// invoke OnUserFormSave event
279
-		$modx->invokeEvent("OnUserFormSave", array(
280
-			"mode" => "upd",
281
-			"id" => $id
282
-		));
283
-
284
-		/*******************************************************************************/
285
-		// put the user in the user_groups he/ she should be in
286
-		// first, check that up_perms are switched on!
287
-		if($use_udperms == 1) {
288
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
289
-			$modx->getDatabase()->delete($tbl_member_groups, "member='{$id}'");
290
-			if(!empty($user_groups)) {
291
-				for($i = 0; $i < count($user_groups); $i++) {
292
-					$field = array();
293
-					$field['user_group'] = (int)$user_groups[$i];
294
-					$field['member'] = $id;
295
-					$modx->getDatabase()->insert($field, $tbl_member_groups);
296
-				}
297
-			}
298
-		}
299
-		// end of user_groups stuff!
300
-		/*******************************************************************************/
301
-		if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
302
-			$modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
303
-		}
304
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
305
-			if($input['stay'] != '') {
306
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
307
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
308
-			} else {
309
-				$stayUrl = "index.php?a=75&r=2";
310
-			}
311
-
312
-			include_once "header.inc.php";
313
-			?>
253
+        // Set the item name for logger
254
+        $_SESSION['itemname'] = $newusername;
255
+
256
+        // invoke OnManagerSaveUser event
257
+        $modx->invokeEvent("OnManagerSaveUser", array(
258
+            "mode" => "upd",
259
+            "userid" => $id,
260
+            "username" => $newusername,
261
+            "userpassword" => $newpassword,
262
+            "useremail" => $email,
263
+            "userfullname" => $fullname,
264
+            "userroleid" => $role,
265
+            "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
266
+            "olduseremail" => (($oldemail != $email) ? $oldemail : "")
267
+        ));
268
+
269
+        // invoke OnManagerChangePassword event
270
+        if($genpassword == 1) {
271
+            $modx->invokeEvent("OnManagerChangePassword", array(
272
+                "userid" => $id,
273
+                "username" => $newusername,
274
+                "userpassword" => $newpassword
275
+            ));
276
+        }
277
+
278
+        // invoke OnUserFormSave event
279
+        $modx->invokeEvent("OnUserFormSave", array(
280
+            "mode" => "upd",
281
+            "id" => $id
282
+        ));
283
+
284
+        /*******************************************************************************/
285
+        // put the user in the user_groups he/ she should be in
286
+        // first, check that up_perms are switched on!
287
+        if($use_udperms == 1) {
288
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
289
+            $modx->getDatabase()->delete($tbl_member_groups, "member='{$id}'");
290
+            if(!empty($user_groups)) {
291
+                for($i = 0; $i < count($user_groups); $i++) {
292
+                    $field = array();
293
+                    $field['user_group'] = (int)$user_groups[$i];
294
+                    $field['member'] = $id;
295
+                    $modx->getDatabase()->insert($field, $tbl_member_groups);
296
+                }
297
+            }
298
+        }
299
+        // end of user_groups stuff!
300
+        /*******************************************************************************/
301
+        if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
302
+            $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
303
+        }
304
+        if($genpassword == 1 && $passwordnotifymethod == 's') {
305
+            if($input['stay'] != '') {
306
+                $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
307
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
308
+            } else {
309
+                $stayUrl = "index.php?a=75&r=2";
310
+            }
311
+
312
+            include_once "header.inc.php";
313
+            ?>
314 314
 
315 315
 			<h1><?php echo $_lang['user_title']; ?></h1>
316 316
 
@@ -330,18 +330,18 @@  discard block
 block discarded – undo
330 330
 			</div>
331 331
 			<?php
332 332
 
333
-			include_once "footer.inc.php";
334
-		} else {
335
-			if($input['stay'] != '') {
336
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
337
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
338
-				header($header);
339
-			} else {
340
-				$header = "Location: index.php?a=75&r=2";
341
-				header($header);
342
-			}
343
-		}
344
-		break;
345
-	default:
346
-		webAlertAndQuit("No operation set in request.", 12);
333
+            include_once "footer.inc.php";
334
+        } else {
335
+            if($input['stay'] != '') {
336
+                $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
337
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
338
+                header($header);
339
+            } else {
340
+                $header = "Location: index.php?a=75&r=2";
341
+                header($header);
342
+            }
343
+        }
344
+        break;
345
+    default:
346
+        webAlertAndQuit("No operation set in request.", 12);
347 347
 }
Please login to merge, or discard this patch.
manager/processors/export_site.processor.php 1 patch
Indentation   +5 added lines, -5 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('export_static')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $maxtime = (is_numeric($_POST['maxtime'])) ? $_POST['maxtime'] : 30;
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
15 15
 $modx->getExportSite()->targetDir = $export_dir;
16 16
 
17 17
 if(strpos($modx->config['base_path'],"{$export_dir}/")===0 && 0 <= strlen(str_replace("{$export_dir}/",'',$modx->config['base_path'])))
18
-	return $_lang['export_site.static.php6'];
18
+    return $_lang['export_site.static.php6'];
19 19
 elseif($modx->config['rb_base_dir'] === $export_dir . '/')
20
-	return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
20
+    return $modx->parsePlaceholder($_lang['export_site.static.php7'],'rb_base_url=' . $modx->config['base_url'] . $modx->config['rb_base_url']);
21 21
 elseif(!is_writable($export_dir))
22
-	return $_lang['export_site_target_unwritable'];
22
+    return $_lang['export_site_target_unwritable'];
23 23
 
24 24
 $modx->getExportSite()->generate_mode = $_POST['generate_mode'];
25 25
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
  ||$includenoncache!==$_POST['includenoncache']
36 36
  ||$repl_before!==$_POST['repl_before']
37 37
  ||$repl_after !==$_POST['repl_after']) {
38
-	$modx->clearCache('full');
38
+    $modx->clearCache('full');
39 39
 }
40 40
 
41 41
 $total = $modx->getExportSite()->getTotal($_POST['ignore_ids'], $modx->config['export_includenoncache']);
Please login to merge, or discard this patch.
manager/processors/delete_tmplvars.processor.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@  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
 $forced = isset($_GET['force']) ? $_GET['force'] : 0;
15 15
 
16 16
 // check for relations
17 17
 if(!$forced) {
18
-	$drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getFullTableName('site_content') . " AS sc
18
+    $drs = $modx->getDatabase()->select('sc.id, sc.pagetitle,sc.description', $modx->getFullTableName('site_content') . " AS sc
19 19
 			INNER JOIN " . $modx->getFullTableName('site_tmplvar_contentvalues') . " AS stcv ON stcv.contentid=sc.id", "stcv.tmplvarid='{$id}'");
20
-	$count = $modx->getDatabase()->getRecordCount($drs);
21
-	if($count > 0) {
22
-		include_once "header.inc.php";
23
-		?>
20
+    $count = $modx->getDatabase()->getRecordCount($drs);
21
+    if($count > 0) {
22
+        include_once "header.inc.php";
23
+        ?>
24 24
 		<script>
25 25
 			var actions = {
26 26
 				delete: function() {
@@ -42,17 +42,17 @@  discard block
 block discarded – undo
42 42
 				<p><?= $_lang['tmplvar_inuse'] ?></p>
43 43
 				<ul>
44 44
 					<?php
45
-					while($row = $modx->getDatabase()->getRow($drs)) {
46
-						echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>';
47
-					}
48
-					?>
45
+                    while($row = $modx->getDatabase()->getRow($drs)) {
46
+                        echo '<li><span style="width: 200px"><a href="index.php?id=' . $row['id'] . '&a=27">' . $row['pagetitle'] . '</a></span>' . ($row['description'] != '' ? ' - ' . $row['description'] : '') . '</li>';
47
+                    }
48
+                    ?>
49 49
 				</ul>
50 50
 			</div>
51 51
 		</div>
52 52
 		<?php
53
-		include_once "footer.inc.php";
54
-		exit;
55
-	}
53
+        include_once "footer.inc.php";
54
+        exit;
55
+    }
56 56
 }
57 57
 
58 58
 // Set the item name for logger
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
 // invoke OnBeforeTVFormDelete event
63 63
 $modx->invokeEvent("OnBeforeTVFormDelete", array(
64
-	"id" => $id
64
+    "id" => $id
65 65
 ));
66 66
 
67 67
 // delete variable
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 // invoke OnTVFormDelete event
80 80
 $modx->invokeEvent("OnTVFormDelete", array(
81
-	"id" => $id
81
+    "id" => $id
82 82
 ));
83 83
 
84 84
 // empty cache
Please login to merge, or discard this patch.