Completed
Pull Request — develop (#716)
by Serg
08:10 queued 01:53
created
manager/actions/mutate_categories.dynamic.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -4,24 +4,24 @@  discard block
 block discarded – undo
4 4
 }
5 5
 
6 6
 if(!$modx->hasPermission('category_manager')) {
7
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
7
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
8 8
 }
9 9
 
10 10
 $_module_params = array(
11
-	'module_version'   => '1.0.0',
12
-	'module_params'    => '',
13
-	'module_id'        => $_GET['id'],
14
-	'package_name'     => 'Module_Categories_Manager',
15
-	'native_language'  => 'de',
16
-	'name'             => 'Categories Manager',
17
-	'dirname'          => $site_manager_url,
18
-	'url'              => 'index.php?a=120&id=' . $_GET['id'],
19
-	'path'             => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR,
20
-	'inc_dir'          => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR,
21
-	'languages_dir'    => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR,
22
-	'views_dir'        => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR,
23
-	'request_key'      => 'module_categories_manager',
24
-	'messages'         => array()
11
+    'module_version'   => '1.0.0',
12
+    'module_params'    => '',
13
+    'module_id'        => $_GET['id'],
14
+    'package_name'     => 'Module_Categories_Manager',
15
+    'native_language'  => 'de',
16
+    'name'             => 'Categories Manager',
17
+    'dirname'          => $site_manager_url,
18
+    'url'              => 'index.php?a=120&id=' . $_GET['id'],
19
+    'path'             => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR,
20
+    'inc_dir'          => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR,
21
+    'languages_dir'    => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR,
22
+    'views_dir'        => realpath( dirname(__FILE__) ) . DIRECTORY_SEPARATOR . 'category_mgr' . DIRECTORY_SEPARATOR . 'skin' . DIRECTORY_SEPARATOR,
23
+    'request_key'      => 'module_categories_manager',
24
+    'messages'         => array()
25 25
 );
26 26
 
27 27
 $cm = new EvolutionCMS\Legacy\ModuleCategoriesManager();
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 // assign module_params to internal params
30 30
 foreach( $_module_params as $param => $value )
31 31
 {
32
-	$cm->set( $param, $value );
32
+    $cm->set( $param, $value );
33 33
 }
34 34
 
35 35
 // catch the request actions
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 
38 38
 if( !$categories = $cm->getCategories() )
39 39
 {
40
-	setcookie('webfxtab_manage-categories-pane', 0 );
41
-	$cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' );
40
+    setcookie('webfxtab_manage-categories-pane', 0 );
41
+    $cm->addMessage( $cm->txt('Currently no categories available... JUST ADD A NEW ONE!'), 'global' );
42 42
 }
43 43
 
44 44
 $cm->renderView('main', $categories );
Please login to merge, or discard this patch.
manager/processors/execute_module.processor.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -3,51 +3,51 @@  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('exec_module')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 
14 14
 // check if user has access permission, except admins
15 15
 if($_SESSION['mgrRole']!=1){
16
-	$rs = $modx->db->select(
17
-		'sma.usergroup,mg.member',
18
-		$modx->getFullTableName("site_module_access")." sma
16
+    $rs = $modx->db->select(
17
+        'sma.usergroup,mg.member',
18
+        $modx->getFullTableName("site_module_access")." sma
19 19
 			LEFT JOIN ".$modx->getFullTableName("member_groups")." mg ON mg.user_group = sma.usergroup AND member='".$modx->getLoginUserID()."'",
20
-		"sma.module = '{$id}'"
21
-		);
22
-	//initialize permission to -1, if it stays -1 no permissions
23
-	//attached so permission granted
24
-	$permissionAccessInt = -1;
20
+        "sma.module = '{$id}'"
21
+        );
22
+    //initialize permission to -1, if it stays -1 no permissions
23
+    //attached so permission granted
24
+    $permissionAccessInt = -1;
25 25
 
26
-	while ($row = $modx->db->getRow($rs)) {
27
-		if($row["usergroup"] && $row["member"]) {
28
-			//if there are permissions and this member has permission, ofcourse
29
-			//this is granted
30
-			$permissionAccessInt = 1;
31
-		} elseif ($permissionAccessInt==-1) {
32
-			//if there are permissions but this member has no permission and the
33
-			//variable was still in init state we set permission to 0; no permissions
34
-			$permissionAccessInt = 0;
35
-		}
36
-	}
26
+    while ($row = $modx->db->getRow($rs)) {
27
+        if($row["usergroup"] && $row["member"]) {
28
+            //if there are permissions and this member has permission, ofcourse
29
+            //this is granted
30
+            $permissionAccessInt = 1;
31
+        } elseif ($permissionAccessInt==-1) {
32
+            //if there are permissions but this member has no permission and the
33
+            //variable was still in init state we set permission to 0; no permissions
34
+            $permissionAccessInt = 0;
35
+        }
36
+    }
37 37
 
38
-	if($permissionAccessInt==0) {
39
-		$modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106");
40
-	}
38
+    if($permissionAccessInt==0) {
39
+        $modx->webAlertAndQuit("You do not sufficient privileges to execute this module.", "index.php?a=106");
40
+    }
41 41
 }
42 42
 
43 43
 // get module data
44 44
 $rs = $modx->db->select('*', $modx->getFullTableName("site_modules"), "id='{$id}'");
45 45
 $content = $modx->db->getRow($rs);
46 46
 if(!$content) {
47
-	$modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106");
47
+    $modx->webAlertAndQuit("No record found for id {$id}.", "index.php?a=106");
48 48
 }
49 49
 if($content['disabled']) {
50
-	$modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106");
50
+    $modx->webAlertAndQuit("This module is disabled and cannot be executed.", "index.php?a=106");
51 51
 }
52 52
 
53 53
 // Set the item name for logger
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 $output = evalModule($content["modulecode"],$parameter);
64 64
 if (strpos(trim($output),'<')===0 && strpos(trim($output),'<?xml')!==0) {
65
-	echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller
65
+    echo "<style>@supports (-webkit-overflow-scrolling: touch) {body,html {-webkit-overflow-scrolling: touch;overflow:auto!important;height:100%!important}}</style>"; // for iframe scroller
66 66
 }
67 67
 echo $output;
68 68
 include MODX_MANAGER_PATH."includes/sysalert.display.inc.php";
Please login to merge, or discard this patch.
manager/processors/duplicate_content.processor.php 1 patch
Indentation   +3 added lines, -3 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_document') || !$modx->hasPermission('save_document')) {
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
 $children = array();
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $udperms->duplicateDoc = true;
22 22
 
23 23
 if(!$udperms->checkPermissions()) {
24
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
24
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
25 25
 }
26 26
 
27 27
 // Run the duplicator
Please login to merge, or discard this patch.
manager/processors/duplicate_module.processor.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -3,12 +3,12 @@  discard block
 block discarded – undo
3 3
     die("<b>INCLUDE_ORDERING_ERROR</b><br /><br />Please use the EVO Content Manager instead of accessing this file directly.");
4 4
 }
5 5
 if(!$modx->hasPermission('new_module')) {
6
-	$modx->webAlertAndQuit($_lang["error_no_privileges"]);
6
+    $modx->webAlertAndQuit($_lang["error_no_privileges"]);
7 7
 }
8 8
 
9 9
 $id = isset($_GET['id'])? (int)$_GET['id'] : 0;
10 10
 if($id==0) {
11
-	$modx->webAlertAndQuit($_lang["error_no_id"]);
11
+    $modx->webAlertAndQuit($_lang["error_no_id"]);
12 12
 }
13 13
 // count duplicates
14 14
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$id}'"));
@@ -18,40 +18,40 @@  discard block
 block discarded – undo
18 18
 
19 19
 // duplicate module
20 20
 $newid = $modx->db->insert(
21
-	array(
22
-		'name'=>'',
23
-		'description'=>'',
24
-		'disabled'=>'',
25
-		'category'=>'',
26
-		'wrap'=>'',
27
-		'icon'=>'',
28
-		'enable_resource'=>'',
29
-		'resourcefile'=>'',
30
-		'createdon'=>'',
31
-		'editedon'=>'',
32
-		'guid'=>'',
33
-		'enable_sharedparams'=>'',
34
-		'properties'=>'',
35
-		'modulecode'=>'',
36
-		), $modx->getFullTableName('site_modules'), // Insert into
37
-	"CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
21
+    array(
22
+        'name'=>'',
23
+        'description'=>'',
24
+        'disabled'=>'',
25
+        'category'=>'',
26
+        'wrap'=>'',
27
+        'icon'=>'',
28
+        'enable_resource'=>'',
29
+        'resourcefile'=>'',
30
+        'createdon'=>'',
31
+        'editedon'=>'',
32
+        'guid'=>'',
33
+        'enable_sharedparams'=>'',
34
+        'properties'=>'',
35
+        'modulecode'=>'',
36
+        ), $modx->getFullTableName('site_modules'), // Insert into
37
+    "CONCAT(name, ' {$_lang['duplicated_el_suffix']}{$count}') AS name, description, '1' AS disabled, category, wrap, icon, enable_resource, resourcefile, createdon, editedon, '".createGUID()."' AS guid, enable_sharedparams, properties, modulecode", $modx->getFullTableName('site_modules'), "id='{$id}'"); // Copy from
38 38
 
39 39
 // duplicate module dependencies
40 40
 $modx->db->insert(
41
-	array(
42
-		'module'=>'',
43
-		'resource'=>'',
44
-		'type'=>'',
45
-		), $modx->getFullTableName('site_module_depobj'), // Insert into
46
-	"'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
41
+    array(
42
+        'module'=>'',
43
+        'resource'=>'',
44
+        'type'=>'',
45
+        ), $modx->getFullTableName('site_module_depobj'), // Insert into
46
+    "'{$newid}', resource, type", $modx->getFullTableName('site_module_depobj'), "module='{$id}'"); // Copy from
47 47
 
48 48
 // duplicate module user group access
49 49
 $modx->db->insert(
50
-	array(
51
-		'module'=>'',
52
-		'usergroup'=>'',
53
-		), $modx->getFullTableName('site_module_access'), // Insert into
54
-	"'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
50
+    array(
51
+        'module'=>'',
52
+        'usergroup'=>'',
53
+        ), $modx->getFullTableName('site_module_access'), // Insert into
54
+    "'{$newid}', usergroup", $modx->getFullTableName('site_module_access'), "module='{$id}'"); // Copy from
55 55
 
56 56
 // Set the item name for logger
57 57
 $name = $modx->db->getValue($modx->db->select('name', $modx->getFullTableName('site_modules'), "id='{$newid}'"));
Please login to merge, or discard this patch.
manager/processors/login.processor.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
3
-	header('HTTP/1.0 404 Not Found');
4
-	exit('error');
3
+    header('HTTP/1.0 404 Not Found');
4
+    exit('error');
5 5
 }
6 6
 define('IN_MANAGER_MODE', true);  // we use this to make sure files are accessed through
7 7
 define('MODX_API_MODE', true);
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 include_once("{$core_path}lang/english.inc.php");
19 19
 
20 20
 if($manager_language !== 'english' && is_file("{$core_path}lang/{$manager_language}.inc.php")) {
21
-	include_once("{$core_path}lang/{$manager_language}.inc.php");
21
+    include_once("{$core_path}lang/{$manager_language}.inc.php");
22 22
 }
23 23
 
24 24
 // Initialize System Alert Message Queque
25 25
 if(!isset($_SESSION['SystemAlertMsgQueque'])) {
26
-	$_SESSION['SystemAlertMsgQueque'] = array();
26
+    $_SESSION['SystemAlertMsgQueque'] = array();
27 27
 }
28 28
 $SystemAlertMsgQueque = &$_SESSION['SystemAlertMsgQueque'];
29 29
 
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 
39 39
 // invoke OnBeforeManagerLogin event
40 40
 $modx->invokeEvent('OnBeforeManagerLogin', array(
41
-		'username' => $username,
42
-		'userpassword' => $givenPassword,
43
-		'rememberme' => $rememberme
44
-	));
41
+        'username' => $username,
42
+        'userpassword' => $givenPassword,
43
+        'rememberme' => $rememberme
44
+    ));
45 45
 $fields = 'mu.*, ua.*';
46 46
 $from = '[+prefix+]manager_users AS mu, [+prefix+]user_attributes AS ua';
47 47
 $where = "BINARY mu.username='{$username}' and ua.internalKey=mu.id";
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 $limit = $modx->db->getRecordCount($rs);
50 50
 
51 51
 if($limit == 0 || $limit > 1) {
52
-	jsAlert($_lang['login_processor_unknown_user']);
53
-	return;
52
+    jsAlert($_lang['login_processor_unknown_user']);
53
+    return;
54 54
 }
55 55
 
56 56
 $row = $modx->db->getRow($rs);
@@ -71,127 +71,127 @@  discard block
 block discarded – undo
71 71
 // get the user settings from the database
72 72
 $rs = $modx->db->select('setting_name, setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_value!=''");
73 73
 while($row = $modx->db->getRow($rs)) {
74
-	extract($row);
75
-	${$setting_name} = $setting_value;
74
+    extract($row);
75
+    ${$setting_name} = $setting_value;
76 76
 }
77 77
 
78 78
 // blocked due to number of login errors.
79 79
 if($failedlogins >= $failed_allowed && $blockeduntildate > time()) {
80
-	@session_destroy();
81
-	session_unset();
82
-	if($cip = getenv("HTTP_CLIENT_IP")) {
83
-		$ip = $cip;
84
-	} elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
85
-		$ip = $cip;
86
-	} elseif($cip = getenv("REMOTE_ADDR")) {
87
-		$ip = $cip;
88
-	} else {
89
-		$ip = "UNKNOWN";
90
-	}
91
-	$log = new EvolutionCMS\Legacy\LogHandler();
92
-	$log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
93
-	jsAlert($_lang['login_processor_many_failed_logins']);
94
-	return;
80
+    @session_destroy();
81
+    session_unset();
82
+    if($cip = getenv("HTTP_CLIENT_IP")) {
83
+        $ip = $cip;
84
+    } elseif($cip = getenv("HTTP_X_FORWARDED_FOR")) {
85
+        $ip = $cip;
86
+    } elseif($cip = getenv("REMOTE_ADDR")) {
87
+        $ip = $cip;
88
+    } else {
89
+        $ip = "UNKNOWN";
90
+    }
91
+    $log = new EvolutionCMS\Legacy\LogHandler();
92
+    $log->initAndWriteLog("Login Fail (Temporary Block)", $internalKey, $username, "119", $internalKey, "IP: " . $ip);
93
+    jsAlert($_lang['login_processor_many_failed_logins']);
94
+    return;
95 95
 }
96 96
 
97 97
 // blocked due to number of login errors, but get to try again
98 98
 if($failedlogins >= $failed_allowed && $blockeduntildate < time()) {
99
-	$fields = array();
100
-	$fields['failedlogincount'] = '0';
101
-	$fields['blockeduntil'] = time() - 1;
102
-	$modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
99
+    $fields = array();
100
+    $fields['failedlogincount'] = '0';
101
+    $fields['blockeduntil'] = time() - 1;
102
+    $modx->db->update($fields, '[+prefix+]user_attributes', "internalKey='{$internalKey}'");
103 103
 }
104 104
 
105 105
 // this user has been blocked by an admin, so no way he's loggin in!
106 106
 if($blocked == '1') {
107
-	@session_destroy();
108
-	session_unset();
109
-	jsAlert($_lang['login_processor_blocked1']);
110
-	return;
107
+    @session_destroy();
108
+    session_unset();
109
+    jsAlert($_lang['login_processor_blocked1']);
110
+    return;
111 111
 }
112 112
 
113 113
 // blockuntil: this user has a block until date
114 114
 if($blockeduntildate > time()) {
115
-	@session_destroy();
116
-	session_unset();
117
-	jsAlert($_lang['login_processor_blocked2']);
118
-	return;
115
+    @session_destroy();
116
+    session_unset();
117
+    jsAlert($_lang['login_processor_blocked2']);
118
+    return;
119 119
 }
120 120
 
121 121
 // blockafter: this user has a block after date
122 122
 if($blockedafterdate > 0 && $blockedafterdate < time()) {
123
-	@session_destroy();
124
-	session_unset();
125
-	jsAlert($_lang['login_processor_blocked3']);
126
-	return;
123
+    @session_destroy();
124
+    session_unset();
125
+    jsAlert($_lang['login_processor_blocked3']);
126
+    return;
127 127
 }
128 128
 
129 129
 // allowed ip
130 130
 if($allowed_ip) {
131
-	if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
132
-		if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
133
-			jsAlert($_lang['login_processor_remotehost_ip']);
134
-			return;
135
-		}
136
-	}
137
-	if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
138
-		jsAlert($_lang['login_processor_remote_ip']);
139
-		return;
140
-	}
131
+    if(($hostname = gethostbyaddr($_SERVER['REMOTE_ADDR'])) && ($hostname != $_SERVER['REMOTE_ADDR'])) {
132
+        if(gethostbyname($hostname) != $_SERVER['REMOTE_ADDR']) {
133
+            jsAlert($_lang['login_processor_remotehost_ip']);
134
+            return;
135
+        }
136
+    }
137
+    if(!in_array($_SERVER['REMOTE_ADDR'], array_filter(array_map('trim', explode(',', $allowed_ip))))) {
138
+        jsAlert($_lang['login_processor_remote_ip']);
139
+        return;
140
+    }
141 141
 }
142 142
 
143 143
 // allowed days
144 144
 if($allowed_days) {
145
-	$date = getdate();
146
-	$day = $date['wday'] + 1;
147
-	if(!in_array($day,explode(',',$allowed_days))) {
148
-		jsAlert($_lang['login_processor_date']);
149
-		return;
150
-	}
145
+    $date = getdate();
146
+    $day = $date['wday'] + 1;
147
+    if(!in_array($day,explode(',',$allowed_days))) {
148
+        jsAlert($_lang['login_processor_date']);
149
+        return;
150
+    }
151 151
 }
152 152
 
153 153
 // invoke OnManagerAuthentication event
154 154
 $rt = $modx->invokeEvent('OnManagerAuthentication', array(
155
-		'userid' => $internalKey,
156
-		'username' => $username,
157
-		'userpassword' => $givenPassword,
158
-		'savedpassword' => $dbasePassword,
159
-		'rememberme' => $rememberme
160
-	));
155
+        'userid' => $internalKey,
156
+        'username' => $username,
157
+        'userpassword' => $givenPassword,
158
+        'savedpassword' => $dbasePassword,
159
+        'rememberme' => $rememberme
160
+    ));
161 161
 
162 162
 // check if plugin authenticated the user
163 163
 $matchPassword = false;
164 164
 if(!isset($rt) || !$rt || (is_array($rt) && !in_array(true, $rt))) {
165
-	// check user password - local authentication
166
-	$hashType = $modx->manager->getHashType($dbasePassword);
167
-	if($hashType == 'phpass') {
168
-		$matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
169
-	} elseif($hashType == 'md5') {
170
-		$matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
171
-	} elseif($hashType == 'v1') {
172
-		$matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
173
-	} else {
174
-		$matchPassword = false;
175
-	}
165
+    // check user password - local authentication
166
+    $hashType = $modx->manager->getHashType($dbasePassword);
167
+    if($hashType == 'phpass') {
168
+        $matchPassword = login($username, $_REQUEST['password'], $dbasePassword);
169
+    } elseif($hashType == 'md5') {
170
+        $matchPassword = loginMD5($internalKey, $_REQUEST['password'], $dbasePassword, $username);
171
+    } elseif($hashType == 'v1') {
172
+        $matchPassword = loginV1($internalKey, $_REQUEST['password'], $dbasePassword, $username);
173
+    } else {
174
+        $matchPassword = false;
175
+    }
176 176
 } else if($rt === true || (is_array($rt) && in_array(true, $rt))) {
177
-	$matchPassword = true;
177
+    $matchPassword = true;
178 178
 }
179 179
 
180 180
 if(!$matchPassword) {
181
-	jsAlert($_lang['login_processor_wrong_password']);
182
-	incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
183
-	return;
181
+    jsAlert($_lang['login_processor_wrong_password']);
182
+    incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
183
+    return;
184 184
 }
185 185
 
186 186
 if($modx->config['use_captcha'] == 1) {
187
-	if(!isset ($_SESSION['veriword'])) {
188
-		jsAlert($_lang['login_processor_captcha_config']);
189
-		return;
190
-	} elseif($_SESSION['veriword'] != $captcha_code) {
191
-		jsAlert($_lang['login_processor_bad_code']);
192
-		incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
193
-		return;
194
-	}
187
+    if(!isset ($_SESSION['veriword'])) {
188
+        jsAlert($_lang['login_processor_captcha_config']);
189
+        return;
190
+    } elseif($_SESSION['veriword'] != $captcha_code) {
191
+        jsAlert($_lang['login_processor_bad_code']);
192
+        incrementFailedLoginCount($internalKey, $failedlogins, $failed_allowed, $blocked_minutes);
193
+        return;
194
+    }
195 195
 }
196 196
 
197 197
 $modx->cleanupExpiredLocks();
@@ -226,36 +226,36 @@  discard block
 block discarded – undo
226 226
 $_SESSION['mgrToken'] = md5($currentsessionid);
227 227
 
228 228
 if($rememberme == '1') {
229
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
230
-
231
-	// Set a cookie separate from the session cookie with the username in it.
232
-	// Are we using secure connection? If so, make sure the cookie is secure
233
-	global $https_port;
234
-
235
-	$secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
236
-	if(version_compare(PHP_VERSION, '5.2', '<')) {
237
-		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
238
-	} else {
239
-		setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
240
-	}
229
+    $_SESSION['modx.mgr.session.cookie.lifetime'] = (int)$modx->config['session.cookie.lifetime'];
230
+
231
+    // Set a cookie separate from the session cookie with the username in it.
232
+    // Are we using secure connection? If so, make sure the cookie is secure
233
+    global $https_port;
234
+
235
+    $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
236
+    if(version_compare(PHP_VERSION, '5.2', '<')) {
237
+        setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, '; HttpOnly', $secure);
238
+    } else {
239
+        setcookie('modx_remember_manager', $_SESSION['mgrShortname'], time() + 60 * 60 * 24 * 365, MODX_BASE_URL, NULL, $secure, true);
240
+    }
241 241
 } else {
242
-	$_SESSION['modx.mgr.session.cookie.lifetime'] = 0;
242
+    $_SESSION['modx.mgr.session.cookie.lifetime'] = 0;
243 243
 
244
-	// Remove the Remember Me cookie
245
-	setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL);
244
+    // Remove the Remember Me cookie
245
+    setcookie('modx_remember_manager', '', time() - 3600, MODX_BASE_URL);
246 246
 }
247 247
 
248 248
 // Check if user already has an active session, if not check if user pressed logout end of last session
249 249
 $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_user_sessions'), "internalKey='{$internalKey}'");
250 250
 $activeSession = $modx->db->getValue($rs);
251 251
 if(!$activeSession) {
252
-	$rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
253
-	if($lastHit = $modx->db->getValue($rs)) {
254
-		$_SESSION['show_logout_reminder'] = array(
255
-			'type' => 'logout_reminder',
256
-			'lastHit' => $lastHit
257
-		);
258
-	}
252
+    $rs = $modx->db->select('lasthit', $modx->getFullTableName('active_users'), "internalKey='{$internalKey}' AND action != 8");
253
+    if($lastHit = $modx->db->getValue($rs)) {
254
+        $_SESSION['show_logout_reminder'] = array(
255
+            'type' => 'logout_reminder',
256
+            'lastHit' => $lastHit
257
+        );
258
+    }
259 259
 }
260 260
 
261 261
 $log = new EvolutionCMS\Legacy\LogHandler();
@@ -263,27 +263,27 @@  discard block
 block discarded – undo
263 263
 
264 264
 // invoke OnManagerLogin event
265 265
 $modx->invokeEvent('OnManagerLogin', array(
266
-		'userid' => $internalKey,
267
-		'username' => $username,
268
-		'userpassword' => $givenPassword,
269
-		'rememberme' => $rememberme
270
-	));
266
+        'userid' => $internalKey,
267
+        'username' => $username,
268
+        'userpassword' => $givenPassword,
269
+        'rememberme' => $rememberme
270
+    ));
271 271
 
272 272
 // check if we should redirect user to a web page
273 273
 $rs = $modx->db->select('setting_value', '[+prefix+]user_settings', "user='{$internalKey}' AND setting_name='manager_login_startup'");
274 274
 $id = (int)$modx->db->getValue($rs);
275 275
 if($id > 0) {
276
-	$header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
277
-	if($_POST['ajax'] == 1) {
278
-		echo $header;
279
-	} else {
280
-		header($header);
281
-	}
276
+    $header = 'Location: ' . $modx->makeUrl($id, '', '', 'full');
277
+    if($_POST['ajax'] == 1) {
278
+        echo $header;
279
+    } else {
280
+        header($header);
281
+    }
282 282
 } else {
283
-	$header = 'Location: ' . MODX_MANAGER_URL;
284
-	if($_POST['ajax'] == 1) {
285
-		echo $header;
286
-	} else {
287
-		header($header);
288
-	}
283
+    $header = 'Location: ' . MODX_MANAGER_URL;
284
+    if($_POST['ajax'] == 1) {
285
+        echo $header;
286
+    } else {
287
+        header($header);
288
+    }
289 289
 }
Please login to merge, or discard this patch.
manager/processors/move_document.processor.php 1 patch
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->db->update(array(
57
-		'isfolder' => 1,
58
-	), $modx->getFullTableName('site_content'), "id='{$newParentID}'");
56
+    $modx->db->update(array(
57
+        'isfolder' => 1,
58
+    ), $modx->getFullTableName('site_content'), "id='{$newParentID}'");
59 59
 
60
-	$modx->db->update(array(
61
-		'parent'   => $newParentID,
62
-		'editedby' => $modx->getLoginUserID(),
63
-		'editedon' => time(),
64
-	), $modx->getFullTableName('site_content'), "id='{$documentID}'");
60
+    $modx->db->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->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'");
68
-	$limit = $modx->db->getValue($rs);
66
+    // finished moving the document, now check to see if the old_parent should no longer be a folder.
67
+    $rs = $modx->db->select('COUNT(*)', $modx->getFullTableName('site_content'), "parent='{$oldparent}'");
68
+    $limit = $modx->db->getValue($rs);
69 69
 
70
-	if(!$limit>0) {
71
-		$modx->db->update(array(
72
-			'isfolder' => 0,
73
-		), $modx->getFullTableName('site_content'), "id='{$oldparent}'");
74
-	}
75
-	// Set the item name for logger
76
-	$pagetitle = $modx->db->getValue($modx->db->select('pagetitle', $modx->getFullTableName('site_content'), "id='{$documentID}'"));
77
-	$_SESSION['itemname'] = $pagetitle;
70
+    if(!$limit>0) {
71
+        $modx->db->update(array(
72
+            'isfolder' => 0,
73
+        ), $modx->getFullTableName('site_content'), "id='{$oldparent}'");
74
+    }
75
+    // Set the item name for logger
76
+    $pagetitle = $modx->db->getValue($modx->db->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.
manager/processors/undelete_content.processor.php 1 patch
Indentation   +15 added lines, -15 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_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 ********/
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
 $udperms->role = $_SESSION['mgrRole'];
32 32
 
33 33
 if(!$udperms->checkPermissions()) {
34
-	$modx->webAlertAndQuit($_lang["access_permission_denied"]);
34
+    $modx->webAlertAndQuit($_lang["access_permission_denied"]);
35 35
 }
36 36
 
37 37
 // get the timestamp on which the document was deleted.
38 38
 $rs = $modx->db->select('deletedon', $modx->getFullTableName('site_content'), "id='{$id}' AND deleted=1");
39 39
 $deltime = $modx->db->getValue($rs);
40 40
 if(!$deltime) {
41
-	$modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
41
+    $modx->webAlertAndQuit("Couldn't find document to determine it's date of deletion!");
42 42
 }
43 43
 
44 44
 $children = array();
@@ -46,20 +46,20 @@  discard block
 block discarded – undo
46 46
 getChildrenForUnDelete($id);
47 47
 
48 48
 if(count($children)>0) {
49
-	$modx->db->update(
50
-		array(
51
-			'deleted'   => 0,
52
-			'deletedby' => 0,
53
-			'deletedon' => 0,
54
-		), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
49
+    $modx->db->update(
50
+        array(
51
+            'deleted'   => 0,
52
+            'deletedby' => 0,
53
+            'deletedon' => 0,
54
+        ), $modx->getFullTableName('site_content'), "id IN(".implode(", ", $children).")");
55 55
 }
56 56
 //'undelete' the document.
57 57
 $modx->db->update(
58
-	array(
59
-		'deleted'   => 0,
60
-		'deletedby' => 0,
61
-		'deletedon' => 0,
62
-	), $modx->getFullTableName('site_content'), "id='{$id}'");
58
+    array(
59
+        'deleted'   => 0,
60
+        'deletedby' => 0,
61
+        'deletedon' => 0,
62
+    ), $modx->getFullTableName('site_content'), "id='{$id}'");
63 63
 
64 64
 $modx->invokeEvent("OnDocFormUnDelete",
65 65
     array(
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
 $modx->loadExtension('phpass');
@@ -45,134 +45,134 @@  discard block
 block discarded – undo
45 45
 
46 46
 // verify password
47 47
 if($passwordgenmethod == "spec" && $input['specifiedpassword'] != $input['confirmpassword']) {
48
-	webAlertAndQuit("Password typed is mismatched", 12);
48
+    webAlertAndQuit("Password typed is mismatched", 12);
49 49
 }
50 50
 
51 51
 // verify email
52 52
 if($email == '' || !preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,24}$/i", $email)) {
53
-	webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
53
+    webAlertAndQuit("E-mail address doesn't seem to be valid!", 12);
54 54
 }
55 55
 
56 56
 // verify admin security
57 57
 if($_SESSION['mgrRole'] != 1) {
58
-	// Check to see if user tried to spoof a "1" (admin) role
59
-	if(!$modx->hasPermission('save_role')) {
60
-		webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
61
-	}
62
-	// Verify that the user being edited wasn't an admin and the user ID got spoofed
63
-	$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1");
64
-	$limit = $modx->db->getValue($rs);
65
-	if($limit > 0) {
66
-		webAlertAndQuit("You cannot alter an administrative user.", 12);
67
-	}
58
+    // Check to see if user tried to spoof a "1" (admin) role
59
+    if(!$modx->hasPermission('save_role')) {
60
+        webAlertAndQuit("Illegal attempt to create/modify administrator by non-administrator!", 12);
61
+    }
62
+    // Verify that the user being edited wasn't an admin and the user ID got spoofed
63
+    $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, "internalKey='{$id}' AND role=1");
64
+    $limit = $modx->db->getValue($rs);
65
+    if($limit > 0) {
66
+        webAlertAndQuit("You cannot alter an administrative user.", 12);
67
+    }
68 68
 
69 69
 }
70 70
 
71 71
 switch($input['mode']) {
72
-	case '11' : // new user
73
-		// check if this user name already exist
74
-		$rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername)));
75
-		$limit = $modx->db->getValue($rs);
76
-		if($limit > 0) {
77
-			webAlertAndQuit("User name is already in use!", 12);
78
-		}
79
-
80
-		// check if the email address already exist
81
-		$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id));
82
-		$limit = $modx->db->getValue($rs);
83
-		if($limit > 0) {
84
-			webAlertAndQuit("Email is already in use!", 12);
85
-		}
86
-
87
-		// generate a new password for this user
88
-		if($specifiedpassword != "" && $passwordgenmethod == "spec") {
89
-			if(strlen($specifiedpassword) < 6) {
90
-				webAlertAndQuit("Password is too short!", 12);
91
-			} else {
92
-				$newpassword = $specifiedpassword;
93
-			}
94
-		} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
95
-			webAlertAndQuit("You didn't specify a password for this user!", 12);
96
-		} elseif($passwordgenmethod == 'g') {
97
-			$newpassword = generate_password(8);
98
-		} else {
99
-			webAlertAndQuit("No password generation method specified!", 12);
100
-		}
101
-
102
-		// invoke OnBeforeUserFormSave event
103
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
104
-			"mode" => "new",
105
-		));
106
-
107
-		// create the user account
108
-		$internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users);
109
-
110
-		$field = array();
111
-		$field['password'] = $modx->phpass->HashPassword($newpassword);
112
-		$modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'");
113
-
114
-		$field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
115
-		$field = $modx->db->escape($field);
116
-		$modx->db->insert($field, $tbl_user_attributes);
117
-
118
-		// Save user settings
72
+    case '11' : // new user
73
+        // check if this user name already exist
74
+        $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s'", $modx->db->escape($newusername)));
75
+        $limit = $modx->db->getValue($rs);
76
+        if($limit > 0) {
77
+            webAlertAndQuit("User name is already in use!", 12);
78
+        }
79
+
80
+        // check if the email address already exist
81
+        $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND id!='%s'", $modx->db->escape($email), $id));
82
+        $limit = $modx->db->getValue($rs);
83
+        if($limit > 0) {
84
+            webAlertAndQuit("Email is already in use!", 12);
85
+        }
86
+
87
+        // generate a new password for this user
88
+        if($specifiedpassword != "" && $passwordgenmethod == "spec") {
89
+            if(strlen($specifiedpassword) < 6) {
90
+                webAlertAndQuit("Password is too short!", 12);
91
+            } else {
92
+                $newpassword = $specifiedpassword;
93
+            }
94
+        } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
95
+            webAlertAndQuit("You didn't specify a password for this user!", 12);
96
+        } elseif($passwordgenmethod == 'g') {
97
+            $newpassword = generate_password(8);
98
+        } else {
99
+            webAlertAndQuit("No password generation method specified!", 12);
100
+        }
101
+
102
+        // invoke OnBeforeUserFormSave event
103
+        $modx->invokeEvent("OnBeforeUserFormSave", array(
104
+            "mode" => "new",
105
+        ));
106
+
107
+        // create the user account
108
+        $internalKey = $modx->db->insert(array('username' => $modx->db->escape($newusername)), $tbl_manager_users);
109
+
110
+        $field = array();
111
+        $field['password'] = $modx->phpass->HashPassword($newpassword);
112
+        $modx->db->update($field, $tbl_manager_users, "id='{$internalKey}'");
113
+
114
+        $field = compact('internalKey', 'fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'blocked', 'blockeduntil', 'blockedafter');
115
+        $field = $modx->db->escape($field);
116
+        $modx->db->insert($field, $tbl_user_attributes);
117
+
118
+        // Save user settings
119 119
         saveManagerUserSettings($internalKey);
120 120
 
121
-		// invoke OnManagerSaveUser event
122
-		$modx->invokeEvent("OnManagerSaveUser", array(
123
-			"mode" => "new",
124
-			"userid" => $internalKey,
125
-			"username" => $newusername,
126
-			"userpassword" => $newpassword,
127
-			"useremail" => $email,
128
-			"userfullname" => $fullname,
129
-			"userroleid" => $role
130
-		));
131
-
132
-		// invoke OnUserFormSave event
133
-		$modx->invokeEvent("OnUserFormSave", array(
134
-			"mode" => "new",
135
-			"id" => $internalKey
136
-		));
137
-
138
-		// Set the item name for logger
139
-		$_SESSION['itemname'] = $newusername;
140
-
141
-		/*******************************************************************************/
142
-		// put the user in the user_groups he/ she should be in
143
-		// first, check that up_perms are switched on!
144
-		if($use_udperms == 1) {
145
-			if(!empty($user_groups)) {
146
-				for($i = 0; $i < count($user_groups); $i++) {
147
-					$f = array();
148
-					$f['user_group'] = (int)$user_groups[$i];
149
-					$f['member'] = $internalKey;
150
-					$modx->db->insert($f, $tbl_member_groups);
151
-				}
152
-			}
153
-		}
154
-		// end of user_groups stuff!
155
-
156
-		if($passwordnotifymethod == 'e') {
121
+        // invoke OnManagerSaveUser event
122
+        $modx->invokeEvent("OnManagerSaveUser", array(
123
+            "mode" => "new",
124
+            "userid" => $internalKey,
125
+            "username" => $newusername,
126
+            "userpassword" => $newpassword,
127
+            "useremail" => $email,
128
+            "userfullname" => $fullname,
129
+            "userroleid" => $role
130
+        ));
131
+
132
+        // invoke OnUserFormSave event
133
+        $modx->invokeEvent("OnUserFormSave", array(
134
+            "mode" => "new",
135
+            "id" => $internalKey
136
+        ));
137
+
138
+        // Set the item name for logger
139
+        $_SESSION['itemname'] = $newusername;
140
+
141
+        /*******************************************************************************/
142
+        // put the user in the user_groups he/ she should be in
143
+        // first, check that up_perms are switched on!
144
+        if($use_udperms == 1) {
145
+            if(!empty($user_groups)) {
146
+                for($i = 0; $i < count($user_groups); $i++) {
147
+                    $f = array();
148
+                    $f['user_group'] = (int)$user_groups[$i];
149
+                    $f['member'] = $internalKey;
150
+                    $modx->db->insert($f, $tbl_member_groups);
151
+                }
152
+            }
153
+        }
154
+        // end of user_groups stuff!
155
+
156
+        if($passwordnotifymethod == 'e') {
157 157
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
158
-			if($input['stay'] != '') {
159
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
161
-				header($header);
162
-			} else {
163
-				$header = "Location: index.php?a=75&r=2";
164
-				header($header);
165
-			}
166
-		} else {
167
-			if($input['stay'] != '') {
168
-				$a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
169
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
170
-			} else {
171
-				$stayUrl = "index.php?a=75&r=2";
172
-			}
173
-
174
-			include_once "header.inc.php";
175
-			?>
158
+            if($input['stay'] != '') {
159
+                $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
160
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
161
+                header($header);
162
+            } else {
163
+                $header = "Location: index.php?a=75&r=2";
164
+                header($header);
165
+            }
166
+        } else {
167
+            if($input['stay'] != '') {
168
+                $a = ($input['stay'] == '2') ? "12&id={$internalKey}" : "11";
169
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
170
+            } else {
171
+                $stayUrl = "index.php?a=75&r=2";
172
+            }
173
+
174
+            include_once "header.inc.php";
175
+            ?>
176 176
 
177 177
 			<h1><?php echo $_lang['user_title']; ?></h1>
178 178
 
@@ -194,125 +194,125 @@  discard block
 block discarded – undo
194 194
 			</div>
195 195
 			<?php
196 196
 
197
-			include_once "footer.inc.php";
198
-		}
199
-		break;
200
-	case '12' : // edit user
201
-		// generate a new password for this user
202
-		if($genpassword == 1) {
203
-			if($specifiedpassword != "" && $passwordgenmethod == "spec") {
204
-				if(strlen($specifiedpassword) < 6) {
205
-					webAlertAndQuit("Password is too short!", 12);
206
-				} else {
207
-					$newpassword = $specifiedpassword;
208
-				}
209
-			} elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
210
-				webAlertAndQuit("You didn't specify a password for this user!", 12);
211
-			} elseif($passwordgenmethod == 'g') {
212
-				$newpassword = generate_password(8);
213
-			} else {
214
-				webAlertAndQuit("No password generation method specified!", 12);
215
-			}
216
-		}
217
-		if($passwordnotifymethod == 'e') {
197
+            include_once "footer.inc.php";
198
+        }
199
+        break;
200
+    case '12' : // edit user
201
+        // generate a new password for this user
202
+        if($genpassword == 1) {
203
+            if($specifiedpassword != "" && $passwordgenmethod == "spec") {
204
+                if(strlen($specifiedpassword) < 6) {
205
+                    webAlertAndQuit("Password is too short!", 12);
206
+                } else {
207
+                    $newpassword = $specifiedpassword;
208
+                }
209
+            } elseif($specifiedpassword == "" && $passwordgenmethod == "spec") {
210
+                webAlertAndQuit("You didn't specify a password for this user!", 12);
211
+            } elseif($passwordgenmethod == 'g') {
212
+                $newpassword = generate_password(8);
213
+            } else {
214
+                webAlertAndQuit("No password generation method specified!", 12);
215
+            }
216
+        }
217
+        if($passwordnotifymethod == 'e') {
218 218
             sendMailMessageForUser($email, $newusername, $newpassword, $fullname, $signupemail_message, MODX_MANAGER_URL);
219
-		}
220
-
221
-		// check if the username already exist
222
-		$rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id));
223
-		$limit = $modx->db->getValue($rs);
224
-		if($limit > 0) {
225
-			webAlertAndQuit("User name is already in use!", 12);
226
-		}
227
-
228
-		// check if the email address already exists
229
-		$rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id));
230
-		$limit = $modx->db->getValue($rs);
231
-		if($limit > 0) {
232
-			webAlertAndQuit("Email is already in use!", 12);
233
-		}
234
-
235
-		// invoke OnBeforeUserFormSave event
236
-		$modx->invokeEvent("OnBeforeUserFormSave", array(
237
-			"mode" => "upd",
238
-			"id" => $id
239
-		));
240
-
241
-		// update user name and password
242
-		$field = array();
243
-		$field['username'] = $modx->db->escape($newusername);
244
-		if($genpassword == 1) {
245
-			$field['password'] = $modx->phpass->HashPassword($newpassword);
246
-		}
247
-		$modx->db->update($field, $tbl_manager_users, "id='{$id}'");
248
-		$field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
249
-		$field = $modx->db->escape($field);
250
-		$modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'");
251
-
252
-		// Save user settings
219
+        }
220
+
221
+        // check if the username already exist
222
+        $rs = $modx->db->select('count(id)', $tbl_manager_users, sprintf("username='%s' AND id!='%s'", $modx->db->escape($newusername), $id));
223
+        $limit = $modx->db->getValue($rs);
224
+        if($limit > 0) {
225
+            webAlertAndQuit("User name is already in use!", 12);
226
+        }
227
+
228
+        // check if the email address already exists
229
+        $rs = $modx->db->select('count(internalKey)', $tbl_user_attributes, sprintf("email='%s' AND internalKey!='%s'", $modx->db->escape($email), $id));
230
+        $limit = $modx->db->getValue($rs);
231
+        if($limit > 0) {
232
+            webAlertAndQuit("Email is already in use!", 12);
233
+        }
234
+
235
+        // invoke OnBeforeUserFormSave event
236
+        $modx->invokeEvent("OnBeforeUserFormSave", array(
237
+            "mode" => "upd",
238
+            "id" => $id
239
+        ));
240
+
241
+        // update user name and password
242
+        $field = array();
243
+        $field['username'] = $modx->db->escape($newusername);
244
+        if($genpassword == 1) {
245
+            $field['password'] = $modx->phpass->HashPassword($newpassword);
246
+        }
247
+        $modx->db->update($field, $tbl_manager_users, "id='{$id}'");
248
+        $field = compact('fullname', 'role', 'email', 'phone', 'mobilephone', 'fax', 'zip', 'street', 'city', 'state', 'country', 'gender', 'dob', 'photo', 'comment', 'failedlogincount', 'blocked', 'blockeduntil', 'blockedafter');
249
+        $field = $modx->db->escape($field);
250
+        $modx->db->update($field, $tbl_user_attributes, "internalKey='{$id}'");
251
+
252
+        // Save user settings
253 253
         saveManagerUserSettings($id);
254 254
 
255
-		// Set the item name for logger
256
-		$_SESSION['itemname'] = $newusername;
257
-
258
-		// invoke OnManagerSaveUser event
259
-		$modx->invokeEvent("OnManagerSaveUser", array(
260
-			"mode" => "upd",
261
-			"userid" => $id,
262
-			"username" => $newusername,
263
-			"userpassword" => $newpassword,
264
-			"useremail" => $email,
265
-			"userfullname" => $fullname,
266
-			"userroleid" => $role,
267
-			"oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
268
-			"olduseremail" => (($oldemail != $email) ? $oldemail : "")
269
-		));
270
-
271
-		// invoke OnManagerChangePassword event
272
-		if($genpassword == 1) {
273
-			$modx->invokeEvent("OnManagerChangePassword", array(
274
-				"userid" => $id,
275
-				"username" => $newusername,
276
-				"userpassword" => $newpassword
277
-			));
278
-		}
279
-
280
-		// invoke OnUserFormSave event
281
-		$modx->invokeEvent("OnUserFormSave", array(
282
-			"mode" => "upd",
283
-			"id" => $id
284
-		));
285
-
286
-		/*******************************************************************************/
287
-		// put the user in the user_groups he/ she should be in
288
-		// first, check that up_perms are switched on!
289
-		if($use_udperms == 1) {
290
-			// as this is an existing user, delete his/ her entries in the groups before saving the new groups
291
-			$modx->db->delete($tbl_member_groups, "member='{$id}'");
292
-			if(!empty($user_groups)) {
293
-				for($i = 0; $i < count($user_groups); $i++) {
294
-					$field = array();
295
-					$field['user_group'] = (int)$user_groups[$i];
296
-					$field['member'] = $id;
297
-					$modx->db->insert($field, $tbl_member_groups);
298
-				}
299
-			}
300
-		}
301
-		// end of user_groups stuff!
302
-		/*******************************************************************************/
303
-		if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
304
-			$modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
305
-		}
306
-		if($genpassword == 1 && $passwordnotifymethod == 's') {
307
-			if($input['stay'] != '') {
308
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
309
-				$stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
310
-			} else {
311
-				$stayUrl = "index.php?a=75&r=2";
312
-			}
313
-
314
-			include_once "header.inc.php";
315
-			?>
255
+        // Set the item name for logger
256
+        $_SESSION['itemname'] = $newusername;
257
+
258
+        // invoke OnManagerSaveUser event
259
+        $modx->invokeEvent("OnManagerSaveUser", array(
260
+            "mode" => "upd",
261
+            "userid" => $id,
262
+            "username" => $newusername,
263
+            "userpassword" => $newpassword,
264
+            "useremail" => $email,
265
+            "userfullname" => $fullname,
266
+            "userroleid" => $role,
267
+            "oldusername" => (($oldusername != $newusername) ? $oldusername : ""),
268
+            "olduseremail" => (($oldemail != $email) ? $oldemail : "")
269
+        ));
270
+
271
+        // invoke OnManagerChangePassword event
272
+        if($genpassword == 1) {
273
+            $modx->invokeEvent("OnManagerChangePassword", array(
274
+                "userid" => $id,
275
+                "username" => $newusername,
276
+                "userpassword" => $newpassword
277
+            ));
278
+        }
279
+
280
+        // invoke OnUserFormSave event
281
+        $modx->invokeEvent("OnUserFormSave", array(
282
+            "mode" => "upd",
283
+            "id" => $id
284
+        ));
285
+
286
+        /*******************************************************************************/
287
+        // put the user in the user_groups he/ she should be in
288
+        // first, check that up_perms are switched on!
289
+        if($use_udperms == 1) {
290
+            // as this is an existing user, delete his/ her entries in the groups before saving the new groups
291
+            $modx->db->delete($tbl_member_groups, "member='{$id}'");
292
+            if(!empty($user_groups)) {
293
+                for($i = 0; $i < count($user_groups); $i++) {
294
+                    $field = array();
295
+                    $field['user_group'] = (int)$user_groups[$i];
296
+                    $field['member'] = $id;
297
+                    $modx->db->insert($field, $tbl_member_groups);
298
+                }
299
+            }
300
+        }
301
+        // end of user_groups stuff!
302
+        /*******************************************************************************/
303
+        if($id == $modx->getLoginUserID() && ($genpassword !== 1 && $passwordnotifymethod != 's')) {
304
+            $modx->webAlertAndQuit($_lang["user_changeddata"], 'javascript:top.location.href="index.php?a=8";');
305
+        }
306
+        if($genpassword == 1 && $passwordnotifymethod == 's') {
307
+            if($input['stay'] != '') {
308
+                $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
309
+                $stayUrl = "index.php?a={$a}&r=2&stay=" . $input['stay'];
310
+            } else {
311
+                $stayUrl = "index.php?a=75&r=2";
312
+            }
313
+
314
+            include_once "header.inc.php";
315
+            ?>
316 316
 
317 317
 			<h1><?php echo $_lang['user_title']; ?></h1>
318 318
 
@@ -332,18 +332,18 @@  discard block
 block discarded – undo
332 332
 			</div>
333 333
 			<?php
334 334
 
335
-			include_once "footer.inc.php";
336
-		} else {
337
-			if($input['stay'] != '') {
338
-				$a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
339
-				$header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
340
-				header($header);
341
-			} else {
342
-				$header = "Location: index.php?a=75&r=2";
343
-				header($header);
344
-			}
345
-		}
346
-		break;
347
-	default:
348
-		webAlertAndQuit("No operation set in request.", 12);
335
+            include_once "footer.inc.php";
336
+        } else {
337
+            if($input['stay'] != '') {
338
+                $a = ($input['stay'] == '2') ? "12&id={$id}" : "11";
339
+                $header = "Location: index.php?a={$a}&r=2&stay=" . $input['stay'];
340
+                header($header);
341
+            } else {
342
+                $header = "Location: index.php?a=75&r=2";
343
+                header($header);
344
+            }
345
+        }
346
+        break;
347
+    default:
348
+        webAlertAndQuit("No operation set in request.", 12);
349 349
 }
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->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->htmlspecialchars($v, ENT_NOQUOTES);
17
-	}
18
-	$input[$k] = $v;
15
+    if($k !== 'comment') {
16
+        $v = $modx->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->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
-		$limit = $modx->db->getValue($rs);
67
-		if($limit > 0) {
68
-			webAlertAndQuit("User name is already in use!", 88);
69
-		}
70
-
71
-		// check if the email address already exist
72
-		if ($modx->config['allow_multiple_emails'] != 1) {
73
-			$rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74
-			$limit = $modx->db->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->db->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->db->escape($field);
108
-		$modx->db->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->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}'");
66
+        $limit = $modx->db->getValue($rs);
67
+        if($limit > 0) {
68
+            webAlertAndQuit("User name is already in use!", 88);
69
+        }
70
+
71
+        // check if the email address already exist
72
+        if ($modx->config['allow_multiple_emails'] != 1) {
73
+            $rs = $modx->db->select('count(id)', $tbl_web_user_attributes, "email='{$esc_email}' AND id!='{$id}'");
74
+            $limit = $modx->db->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->db->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->db->escape($field);
108
+        $modx->db->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->db->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->db->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->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214
-		$limit = $modx->db->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->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222
-			$limit = $modx->db->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->db->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->db->escape($field);
243
-		$modx->db->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->db->select('count(id)', $tbl_web_users, "username='{$esc_newusername}' AND id!='{$id}'");
214
+        $limit = $modx->db->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->db->select('count(internalKey)', $tbl_web_user_attributes, "email='{$esc_email}' AND internalKey!='{$id}'");
222
+            $limit = $modx->db->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->db->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->db->escape($field);
243
+        $modx->db->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->db->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->db->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->db->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->db->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.