Completed
Push — develop ( 4e806c...6a553b )
by Agel_Nash
10:03
created
manager/processors/save_password.processor.php 1 patch
Indentation   +13 added lines, -13 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('save_password')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = $_POST['id'];
@@ -11,25 +11,25 @@  discard block
 block discarded – undo
11 11
 $pass2 = $_POST['pass2'];
12 12
 
13 13
 if($pass1!=$pass2){
14
-	$modx->webAlertAndQuit("Passwords don't match!");
14
+    $modx->webAlertAndQuit("Passwords don't match!");
15 15
 }
16 16
 
17 17
 if(strlen($pass1)<6){
18
-	$modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters.");
18
+    $modx->webAlertAndQuit("Password is too short. Please specify a password of at least 6 characters.");
19 19
 }
20 20
 
21 21
     $pass1 = $modx->getPhpCompat()->htmlspecialchars($pass1, ENT_NOQUOTES);
22
-	$tbl_manager_users = $modx->getDatabase()->getFullTableName('manager_users');
23
-	$uid = $modx->getLoginUserID();
24
-	$f['password'] = $modx->getPasswordHash()->HashPassword($pass1);
25
-	$modx->getDatabase()->update($f,$tbl_manager_users,"id='{$uid}'");
22
+    $tbl_manager_users = $modx->getDatabase()->getFullTableName('manager_users');
23
+    $uid = $modx->getLoginUserID();
24
+    $f['password'] = $modx->getPasswordHash()->HashPassword($pass1);
25
+    $modx->getDatabase()->update($f,$tbl_manager_users,"id='{$uid}'");
26 26
 
27
-	// invoke OnManagerChangePassword event
28
-	$modx->invokeEvent('OnManagerChangePassword', array (
29
-		'userid' => $uid,
30
-		'username' => $_SESSION['mgrShortname'],
31
-		'userpassword' => $pass1
32
-	));
27
+    // invoke OnManagerChangePassword event
28
+    $modx->invokeEvent('OnManagerChangePassword', array (
29
+        'userid' => $uid,
30
+        'username' => $_SESSION['mgrShortname'],
31
+        'userpassword' => $pass1
32
+    ));
33 33
 
34 34
 $header="Location: index.php?a=2";
35 35
 header($header);
Please login to merge, or discard this patch.
manager/processors/save_settings.processor.php 1 patch
Indentation   +106 added lines, -106 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('settings')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 $data = $_POST;
9 9
 // lose the POST now, gets rid of quirky issue with Safari 3 - see FS#972
@@ -11,41 +11,41 @@  discard block
 block discarded – undo
11 11
 
12 12
 if($data['friendly_urls']==='1' && strpos($_SERVER['SERVER_SOFTWARE'],'IIS')===false)
13 13
 {
14
-	$htaccess        = $modx->config['base_path'] . '.htaccess';
15
-	$sample_htaccess = $modx->config['base_path'] . 'ht.access';
16
-	$dir = '/' . trim($modx->config['base_url'],'/');
17
-	if(is_file($htaccess))
18
-	{
19
-		$_ = file_get_contents($htaccess);
20
-		if(strpos($_,'RewriteBase')===false)
21
-		{
22
-			$warnings[] = $_lang["settings_friendlyurls_alert2"];
23
-		}
24
-		elseif(is_writable($htaccess))
25
-		{
26
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
-			if(!@file_put_contents($htaccess,$_))
28
-			{
29
-				$warnings[] = $_lang["settings_friendlyurls_alert2"];
30
-			}
31
-		}
32
-	}
33
-	elseif(is_file($sample_htaccess))
34
-	{
35
-		if(!@rename($sample_htaccess,$htaccess))
14
+    $htaccess        = $modx->config['base_path'] . '.htaccess';
15
+    $sample_htaccess = $modx->config['base_path'] . 'ht.access';
16
+    $dir = '/' . trim($modx->config['base_url'],'/');
17
+    if(is_file($htaccess))
18
+    {
19
+        $_ = file_get_contents($htaccess);
20
+        if(strpos($_,'RewriteBase')===false)
36 21
         {
37
-        	$warnings[] = $_lang["settings_friendlyurls_alert"];
38
-		}
39
-		elseif($modx->config['base_url']!=='/')
40
-		{
41
-			$_ = file_get_contents($htaccess);
42
-			$_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
-			if(!@file_put_contents($htaccess,$_))
44
-			{
45
-				$warnings[] = $_lang["settings_friendlyurls_alert2"];
46
-			}
47
-		}
48
-	}
22
+            $warnings[] = $_lang["settings_friendlyurls_alert2"];
23
+        }
24
+        elseif(is_writable($htaccess))
25
+        {
26
+            $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
27
+            if(!@file_put_contents($htaccess,$_))
28
+            {
29
+                $warnings[] = $_lang["settings_friendlyurls_alert2"];
30
+            }
31
+        }
32
+    }
33
+    elseif(is_file($sample_htaccess))
34
+    {
35
+        if(!@rename($sample_htaccess,$htaccess))
36
+        {
37
+            $warnings[] = $_lang["settings_friendlyurls_alert"];
38
+        }
39
+        elseif($modx->config['base_url']!=='/')
40
+        {
41
+            $_ = file_get_contents($htaccess);
42
+            $_ = preg_replace('@RewriteBase.+@',"RewriteBase {$dir}", $_);
43
+            if(!@file_put_contents($htaccess,$_))
44
+            {
45
+                $warnings[] = $_lang["settings_friendlyurls_alert2"];
46
+            }
47
+        }
48
+    }
49 49
 }
50 50
 
51 51
 if (file_exists(MODX_MANAGER_PATH . 'media/style/' . $modx->config['manager_theme'] . '/css/styles.min.css')) {
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 $data['rb_base_dir']      = str_replace('[(base_path)]',MODX_BASE_PATH,$data['rb_base_dir']);
57 57
 
58 58
 if (isset($data) && count($data) > 0) {
59
-	if(isset($data['manager_language'])) {
60
-		$lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
-		if(is_file($lang_path)) {
62
-			include($lang_path);
59
+    if(isset($data['manager_language'])) {
60
+        $lang_path = MODX_MANAGER_PATH . 'includes/lang/' . $data['manager_language'] . '.inc.php';
61
+        if(is_file($lang_path)) {
62
+            include($lang_path);
63 63
             global $modx_lang_attribute;
64 64
             $data['lang_code'] = !$modx_lang_attribute ? 'en' : $modx_lang_attribute;
65
-		}
66
-	}
67
-	$savethese = array();
68
-	$data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']);
69
-	$data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
70
-	foreach ($data as $k => $v) {
71
-		switch ($k) {
65
+        }
66
+    }
67
+    $savethese = array();
68
+    $data['sys_files_checksum'] = $modx->getManagerApi()->getSystemChecksum($data['check_files_onlogin']);
69
+    $data['mail_check_timeperiod'] = (int)$data['mail_check_timeperiod'] < 60 ? 60 : $data['mail_check_timeperiod']; // updateMail() in mainMenu no faster than every minute
70
+    foreach ($data as $k => $v) {
71
+        switch ($k) {
72 72
             case 'settings_version':{
73 73
                 if($modx->getVersionData('version')!=$data['settings_version']){
74 74
                     $modx->logEvent(17,2,'<pre>'.var_export($data['settings_version'],true).'</pre>','fake settings_version');
@@ -76,24 +76,24 @@  discard block
 block discarded – undo
76 76
                 }
77 77
                 break;
78 78
             }
79
-			case 'error_page':
80
-			case 'unauthorized_page':
81
-			if (trim($v) == '' || !is_numeric($v)) {
82
-				$v = $data['site_start'];
83
-			}
84
-			break;
79
+            case 'error_page':
80
+            case 'unauthorized_page':
81
+            if (trim($v) == '' || !is_numeric($v)) {
82
+                $v = $data['site_start'];
83
+            }
84
+            break;
85 85
 
86
-			case 'lst_custom_contenttype':
87
-			case 'txt_custom_contenttype':
88
-				// Skip these
89
-				$k = '';
90
-				break;
91
-			case 'rb_base_dir':
92
-			case 'rb_base_url':
93
-			case 'filemanager_path':
94
-				$v = trim($v);
95
-				$v = rtrim($v,'/') . '/';
96
-				break;
86
+            case 'lst_custom_contenttype':
87
+            case 'txt_custom_contenttype':
88
+                // Skip these
89
+                $k = '';
90
+                break;
91
+            case 'rb_base_dir':
92
+            case 'rb_base_url':
93
+            case 'filemanager_path':
94
+                $v = trim($v);
95
+                $v = rtrim($v,'/') . '/';
96
+                break;
97 97
             case 'manager_language':
98 98
                 $langDir = realpath(MODX_MANAGER_PATH . 'includes/lang');
99 99
                 $langFile = realpath(MODX_MANAGER_PATH . 'includes/lang/' . $v . '.inc.php');
@@ -101,56 +101,56 @@  discard block
 block discarded – undo
101 101
                 if($langDir !== $langFileDir || !file_exists($langFile)) {
102 102
                     $v = 'english';
103 103
                 }
104
-				break;
105
-			case 'smtppw':
106
-				if ($v !== '********************' && $v !== '') {
107
-					$v = trim($v);
108
-					$v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
109
-					$v = str_replace('=','%',$v);
110
-				} elseif ($v === '********************') {
111
-					$k = '';
112
-				}
113
-				break;
104
+                break;
105
+            case 'smtppw':
106
+                if ($v !== '********************' && $v !== '') {
107
+                    $v = trim($v);
108
+                    $v = base64_encode($v) . substr(str_shuffle('abcdefghjkmnpqrstuvxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'), 0, 7);
109
+                    $v = str_replace('=','%',$v);
110
+                } elseif ($v === '********************') {
111
+                    $k = '';
112
+                }
113
+                break;
114 114
             case 'valid_hostnames':
115
-				$v = str_replace(array(' ,', ', '), ',', $v);
116
-				if ($v !== ',') {
117
-					$v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : '';
118
-					$configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n";
119
-					@file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString);
120
-				}
121
-				$k = '';
122
-				break;
123
-			case 'session_timeout':
124
-				$mail_check_timeperiod = $data['mail_check_timeperiod'];
125
-				$v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
126
-				break;
127
-			default:
128
-			break;
129
-		}
130
-		$v = is_array($v) ? implode(",", $v) : $v;
115
+                $v = str_replace(array(' ,', ', '), ',', $v);
116
+                if ($v !== ',') {
117
+                    $v = ($v != 'MODX_SITE_HOSTNAMES') ? $v : '';
118
+                    $configString = '<?php' . "\n" . 'define(\'MODX_SITE_HOSTNAMES\', \'' . $v . '\');' . "\n";
119
+                    @file_put_contents(MODX_BASE_PATH . 'assets/cache/siteHostnames.php', $configString);
120
+                }
121
+                $k = '';
122
+                break;
123
+            case 'session_timeout':
124
+                $mail_check_timeperiod = $data['mail_check_timeperiod'];
125
+                $v = (int)$v < ($data['mail_check_timeperiod']/60+1) ? ($data['mail_check_timeperiod']/60+1) : $v; // updateMail() in mainMenu pings as per mail_check_timeperiod, so +1min is minimum
126
+                break;
127
+            default:
128
+            break;
129
+        }
130
+        $v = is_array($v) ? implode(",", $v) : $v;
131 131
 
132
-		$modx->config[$k] = $v;
132
+        $modx->config[$k] = $v;
133 133
 
134
-		if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')';
135
-	}
134
+        if(!empty($k)) $savethese[] = '(\''.$modx->getDatabase()->escape($k).'\', \''.$modx->getDatabase()->escape($v).'\')';
135
+    }
136 136
 
137
-	// Run a single query to save all the values
138
-	$sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value)
137
+    // Run a single query to save all the values
138
+    $sql = "REPLACE INTO ".$modx->getDatabase()->getFullTableName("system_settings")." (setting_name, setting_value)
139 139
 		VALUES ".implode(', ', $savethese);
140
-	$modx->getDatabase()->query($sql);
140
+    $modx->getDatabase()->query($sql);
141 141
 
142
-	// Reset Template Pages
143
-	if (isset($data['reset_template'])) {
144
-		$newtemplate = (int)$data['default_template'];
145
-		$oldtemplate = (int)$data['old_template'];
146
-		$tbl = $modx->getDatabase()->getFullTableName('site_content');
147
-		$reset = $data['reset_template'];
148
-		if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'");
149
-		else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
150
-	}
142
+    // Reset Template Pages
143
+    if (isset($data['reset_template'])) {
144
+        $newtemplate = (int)$data['default_template'];
145
+        $oldtemplate = (int)$data['old_template'];
146
+        $tbl = $modx->getDatabase()->getFullTableName('site_content');
147
+        $reset = $data['reset_template'];
148
+        if($reset==1) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "type='document'");
149
+        else if($reset==2) $modx->getDatabase()->update(array('template' => $newtemplate), $tbl, "template='{$oldtemplate}'");
150
+    }
151 151
 
152
-	// empty cache
153
-	$modx->clearCache('full');
152
+    // empty cache
153
+    $modx->clearCache('full');
154 154
 }
155 155
 $header="Location: index.php?a=7&r=10";
156 156
 header($header);
Please login to merge, or discard this patch.
manager/processors/purge_plugin.processor.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 }
5 5
 
6 6
 if(!$modx->hasPermission('delete_plugin')) {
7
-	$e->setError(3);
8
-	$e->dumpError();
7
+    $e->setError(3);
8
+    $e->dumpError();
9 9
 }
10 10
 
11 11
 $tbl_site_plugins = $modx->getDatabase()->getFullTableName('site_plugins');
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->getDatabase()->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/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->getDatabase()->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/save_web_user.processor.php 1 patch
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->getDatabase()->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.
manager/processors/empty_table.processor.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 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('settings')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $modx->getDatabase()->truncate($modx->getDatabase()->getFullTableName('manager_log'));
Please login to merge, or discard this patch.
manager/processors/delete_user.processor.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  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_user')) {
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 user, but first check if we are deleting our own record
15 15
 if($id==$modx->getLoginUserID()) {
16
-	$modx->webAlertAndQuit("You can't delete yourself!");
16
+    $modx->webAlertAndQuit("You can't delete yourself!");
17 17
 }
18 18
 
19 19
 // Set the item name for logger
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 
23 23
 // invoke OnBeforeUserFormDelete event
24 24
 $modx->invokeEvent("OnBeforeUserFormDelete",
25
-	array(
26
-		"id"	=> $id
27
-	));
25
+    array(
26
+        "id"	=> $id
27
+    ));
28 28
 
29 29
 // delete the user.
30 30
 $modx->getDatabase()->delete($modx->getDatabase()->getFullTableName('manager_users'), "id='{$id}'");
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 
40 40
 // invoke OnManagerDeleteUser event
41 41
 $modx->invokeEvent("OnManagerDeleteUser",
42
-	array(
43
-		"userid"		=> $id,
44
-		"username"		=> $username
45
-	));
42
+    array(
43
+        "userid"		=> $id,
44
+        "username"		=> $username
45
+    ));
46 46
 
47 47
 // invoke OnUserFormDelete event
48 48
 $modx->invokeEvent("OnUserFormDelete",
49
-	array(
50
-		"id"	=> $id
51
-	));
49
+    array(
50
+        "id"	=> $id
51
+    ));
52 52
 
53 53
 $header="Location: index.php?a=75";
54 54
 header($header);
Please login to merge, or discard this patch.
manager/processors/duplicate_snippet.processor.php 1 patch
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->getDatabase()->getFullTableName('site_snippets'), // Insert into
29
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getDatabase()->getFullTableName('site_snippets'), "id='{$id}'"); // Copy from
22
+    array(
23
+        'name'=>'',
24
+        'description'=>'',
25
+        'snippet'=>'',
26
+        'properties'=>'',
27
+        'category'=>'',
28
+        ), $modx->getDatabase()->getFullTableName('site_snippets'), // Insert into
29
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, snippet, properties, category", $modx->getDatabase()->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->getDatabase()->getFullTableName('site_snippets'), "id='{$newid}'"));
Please login to merge, or discard this patch.