Issues (4069)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

modules/Users/Save.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3
/*********************************************************************************
4
 * SugarCRM Community Edition is a customer relationship management program developed by
5
 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
6
7
 * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
8
 * Copyright (C) 2011 - 2014 Salesagility Ltd.
9
 *
10
 * This program is free software; you can redistribute it and/or modify it under
11
 * the terms of the GNU Affero General Public License version 3 as published by the
12
 * Free Software Foundation with the addition of the following permission added
13
 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
14
 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
15
 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
16
 *
17
 * This program is distributed in the hope that it will be useful, but WITHOUT
18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
20
 * details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License along with
23
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
24
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25
 * 02110-1301 USA.
26
 *
27
 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
28
 * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
29
 *
30
 * The interactive user interfaces in modified source and object code versions
31
 * of this program must display Appropriate Legal Notices, as required under
32
 * Section 5 of the GNU Affero General Public License version 3.
33
 *
34
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
35
 * these Appropriate Legal Notices must retain the display of the "Powered by
36
 * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
37
 * reasonably feasible for  technical reasons, the Appropriate Legal Notices must
38
 * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39
 ********************************************************************************/
40
41
42
require_once('include/SugarFields/SugarFieldHandler.php');
43
require_once('modules/MySettings/TabController.php');
44
45
$display_tabs_def = isset($_REQUEST['display_tabs_def']) ? urldecode($_REQUEST['display_tabs_def']) : '';
46
$hide_tabs_def = isset($_REQUEST['hide_tabs_def']) ? urldecode($_REQUEST['hide_tabs_def']): '';
47
$remove_tabs_def = isset($_REQUEST['remove_tabs_def']) ? urldecode($_REQUEST['remove_tabs_def']): '';
48
49
$DISPLAY_ARR = array();
50
$HIDE_ARR = array();
51
$REMOVE_ARR = array();
52
53
parse_str($display_tabs_def,$DISPLAY_ARR);
54
parse_str($hide_tabs_def,$HIDE_ARR);
55
parse_str($remove_tabs_def,$REMOVE_ARR);
56
57
58
59
if (isset($_POST['id']))
60
	sugar_die("Unauthorized access to administration.");
61
if (isset($_POST['record']) && !is_admin($current_user)
62
     && !$GLOBALS['current_user']->isAdminForModule('Users')
63
     && $_POST['record'] != $current_user->id)
64
sugar_die("Unauthorized access to administration.");
65
elseif (!isset($_POST['record']) && !is_admin($current_user)
66
     && !$GLOBALS['current_user']->isAdminForModule('Users'))
67
sugar_die ("Unauthorized access to user administration.");
68
$focus = new User();
69
$focus->retrieve($_POST['record']);
70
71
//update any ETag seeds that are tied to the user object changing
72
$focus->incrementETag("mainMenuETag");
73
74
// Flag to determine whether to save a new password or not.
75
// Bug 43241 - Changed $focus->id to $focus->user_name to make sure that a system generated password is made when converting employee to user
76
if(empty($focus->user_name))
77
{
78
    $newUser = true;
79
    clear_register_value('user_array',$focus->object_name);
80
} else {
81
    $newUser = false;
82
}
83
84
85
if(!$current_user->is_admin && !$GLOBALS['current_user']->isAdminForModule('Users')
86
) {
87
    if($current_user->id != $focus->id
88
    || !empty($_POST['is_admin'])
89
    || (!empty($_POST['UserType']) && $_POST['UserType'] == 'Administrator')
90
    ) {
91
        $GLOBALS['log']->fatal("SECURITY:Non-Admin ". $current_user->id . " attempted to change settings for user:". $focus->id);
92
        header("Location: index.php?module=Users&action=Logout");
93
        exit;
94
    }
95
}
96
97
98
    // Populate the custom fields
99
    $sfh = new SugarFieldHandler();
100
    foreach ($focus->field_defs as $fieldName => $field)
101
    {
102
        if (isset($field['source']) && $field['source'] == 'custom_fields')
103
        {
104
            $type = !empty($field['custom_type']) ? $field['custom_type'] : $field['type'];
105
            $sf = $sfh->getSugarField($type);
106
            if ($sf != null)
107
            {
108
                $sf->save($focus, $_POST, $fieldName, $field, '');
109
            }
110
            else
111
            {
112
                $GLOBALS['log']->fatal("Field '$fieldName' does not have a SugarField handler");
113
            }
114
        }
115
    }
116
117
118
	$portal=array("user_name","last_name","status","portal_only");
119
	$group=array("user_name","last_name","status","is_group");
120
	if(isset($_POST['portal_only']) && ($_POST['portal_only']=='1' || $focus->portal_only)){
121
		foreach($portal as $field){
122
			if(isset($_POST[$field]))
123
			{
124
				$value = $_POST[$field];
125
				$focus->$field = $value;
126
127
			}
128
		}
129
	}
130
131
	if(isset($_POST['is_group']) && ($_POST['is_group']=='1' || $focus->is_group)){
132
		foreach($group as $field){
133
			if(isset($_POST[$field]))
134
			{
135
				$value = $_POST[$field];
136
				$focus->$field = $value;
137
138
			}
139
		}
140
	}
141
142
143
	// copy the group or portal user name over.  We renamed the field in order to ensure auto-complete would not change the value
144
	if(isset($_POST['user_name']))
145
	{
146
		$focus->user_name = $_POST['user_name'];
147
	}
148
149
	// if the user saved is a Regular User
150
	if(!$focus->is_group && !$focus->portal_only){
151
152
        foreach ($focus->column_fields as $fieldName)
153
        {
154
            $field = $focus->field_defs[$fieldName];
155
            $type = !empty($field['custom_type']) ? $field['custom_type'] : $field['type'];
156
            $sf = $sfh->getSugarField($type);
157
            if ($sf != null)
158
            {
159
                $sf->save($focus, $_POST, $fieldName, $field, '');
160
            }
161
            else
162
            {
163
                $GLOBALS['log']->fatal("Field '$fieldName' does not have a SugarField handler");
164
            }
165
        }
166
        foreach ($focus->additional_column_fields as $fieldName)
167
        {
168
            $field = $focus->field_defs[$fieldName];
169
            $type = !empty($field['custom_type']) ? $field['custom_type'] : $field['type'];
170
            $sf = $sfh->getSugarField($type);
171
            if ($sf != null)
172
            {
173
                $sf->save($focus, $_POST, $fieldName, $field, '');
174
            }
175
            else
176
            {
177
                $GLOBALS['log']->fatal("Field '$fieldName' does not have a SugarField handler");
178
            }
179
        }
180
181
		$focus->is_group=0;
182
		$focus->portal_only=0;
183
184
     		if(isset($_POST['status']) && $_POST['status']== "Inactive") $focus->employee_status = "Terminated"; //bug49972
185
186
			if(isset($_POST['user_name']))
187
		{
188
			$focus->user_name = $_POST['user_name'];
189
		}
190
		if((isset($_POST['is_admin']) && ($_POST['is_admin'] == 'on' || $_POST['is_admin'] == '1')) ||
191
           (isset($_POST['UserType']) && $_POST['UserType'] == "Administrator")) $focus->is_admin = 1;
192
		elseif(isset($_POST['is_admin']) && empty($_POST['is_admin'])) $focus->is_admin = 0;
193
		//if(empty($_POST['portal_only']) || !empty($_POST['is_admin'])) $focus->portal_only = 0;
194
		//if(empty($_POST['is_group'])    || !empty($_POST['is_admin'])) $focus->is_group = 0;
195
		if(empty($_POST['receive_notifications'])) $focus->receive_notifications = 0;
196
197
		if(isset($_POST['mailmerge_on']) && !empty($_POST['mailmerge_on'])) {
198
			$focus->setPreference('mailmerge_on','on', 0, 'global');
199
		} else {
200
			$focus->setPreference('mailmerge_on','off', 0, 'global');
201
		}
202
203
	    if(isset($_POST['user_swap_last_viewed']))
204
	    {
205
	        $focus->setPreference('swap_last_viewed', $_POST['user_swap_last_viewed'], 0, 'global');
206
	    }
207
	    else
208
	    {
209
	    	$focus->setPreference('swap_last_viewed', '', 0, 'global');
210
	    }
211
212
	    if(isset($_POST['user_swap_shortcuts']))
213
	    {
214
	        $focus->setPreference('swap_shortcuts', $_POST['user_swap_shortcuts'], 0, 'global');
215
	    }
216
	    else
217
	    {
218
	        $focus->setPreference('swap_shortcuts', '', 0, 'global');
219
	    }
220
221
	    if(isset($_POST['use_group_tabs']))
222
	    {
223
	        $focus->setPreference('navigation_paradigm', $_POST['use_group_tabs'], 0, 'global');
224
	    }
225
	    else
226
	    {
227
	        $focus->setPreference('navigation_paradigm', 'gm', 0, 'global');
228
	    }
229
230
	    if(isset($_POST['user_subpanel_tabs']))
231
	    {
232
	        $focus->setPreference('subpanel_tabs', $_POST['user_subpanel_tabs'], 0, 'global');
233
	    }
234
	    else
235
	    {
236
	        $focus->setPreference('subpanel_tabs', '', 0, 'global');
237
	    }
238
239
        if(isset($_POST['user_theme']))
240
        {
241
            $focus->setPreference('user_theme', $_POST['user_theme'], 0, 'global');
242
            $_SESSION['authenticated_user_theme'] = $_POST['user_theme'];
243
        }
244
245
        if(isset($_POST['user_module_favicon']))
246
	    {
247
	        $focus->setPreference('module_favicon', $_POST['user_module_favicon'], 0, 'global');
248
	    }
249
	    else
250
	    {
251
	        $focus->setPreference('module_favicon', '', 0, 'global');
252
	    }
253
254
		$tabs = new TabController();
255
		if(isset($_POST['display_tabs']))
256
			$tabs->set_user_tabs($DISPLAY_ARR['display_tabs'], $focus, 'display');
257
		if(isset($HIDE_ARR['hide_tabs'])){
258
			$tabs->set_user_tabs($HIDE_ARR['hide_tabs'], $focus, 'hide');
259
260
		}else{
261
			$tabs->set_user_tabs(array(), $focus, 'hide');
262
		}
263
		if(is_admin($current_user)){
264
			if(isset($REMOVE_ARR['remove_tabs'])){
265
				$tabs->set_user_tabs($REMOVE_ARR['remove_tabs'], $focus, 'remove');
266
			}else{
267
				$tabs->set_user_tabs(array(), $focus, 'remove');
268
			}
269
		}
270
271
	    if(isset($_POST['no_opps'])) {
272
	        $focus->setPreference('no_opps',$_POST['no_opps'], 0, 'global');
273
	    }
274
	    else {
275
	        $focus->setPreference('no_opps','off', 0, 'global');
276
	    }
277
278
//		if(isset($_POST['reminder_checked']) && $_POST['reminder_checked'] == '1' && isset($_POST['reminder_checked'])){
279
//			$focus->setPreference('reminder_time', $_POST['reminder_time'], 0, 'global');
280
//		}else{
281
//			// cn: bug 5522, need to unset reminder time if unchecked.
282
//			$focus->setPreference('reminder_time', -1, 0, 'global');
283
//		}
284
		
285
286
//		if(isset($_POST['email_reminder_checked']) && $_POST['email_reminder_checked'] == '1' && isset($_POST['email_reminder_checked'])){
287
//			$focus->setPreference('email_reminder_time', $_POST['email_reminder_time'], 0, 'global');
288
//		}else{
289
//			$focus->setPreference('email_reminder_time', -1, 0, 'global');
290
//		}
291
		
292
		$focus->setPreference('reminder_time', $_POST['reminder_time'], 0, 'global');
293
		$focus->setPreference('email_reminder_time', $_POST['email_reminder_time'], 0, 'global');
294
		$focus->setPreference('reminder_checked', $_POST['reminder_checked'], 0, 'global');
295
		$focus->setPreference('email_reminder_checked', $_POST['email_reminder_checked'], 0, 'global');
296
		
297
		if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global');
298
		if(isset($_POST['ut'])) $focus->setPreference('ut', '0', 0, 'global');
299
		else $focus->setPreference('ut', '1', 0, 'global');
300
		if(isset($_POST['currency'])) $focus->setPreference('currency',$_POST['currency'], 0, 'global');
301
		if(isset($_POST['default_currency_significant_digits'])) $focus->setPreference('default_currency_significant_digits',$_POST['default_currency_significant_digits'], 0, 'global');
302
		if(isset($_POST['num_grp_sep'])) $focus->setPreference('num_grp_sep', $_POST['num_grp_sep'], 0, 'global');
303
		if(isset($_POST['dec_sep'])) $focus->setPreference('dec_sep', $_POST['dec_sep'], 0, 'global');
304
                if(isset($_POST['fdow'])) $focus->setPreference('fdow', $_POST['fdow'], 0, 'global');
305
		if(isset($_POST['dateformat'])) $focus->setPreference('datef',$_POST['dateformat'], 0, 'global');
306
		if(isset($_POST['timeformat'])) $focus->setPreference('timef',$_POST['timeformat'], 0, 'global');
307
		if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global');
308
		if(isset($_POST['mail_fromname'])) $focus->setPreference('mail_fromname',$_POST['mail_fromname'], 0, 'global');
309
		if(isset($_POST['mail_fromaddress'])) $focus->setPreference('mail_fromaddress',$_POST['mail_fromaddress'], 0, 'global');
310
		if(isset($_POST['mail_sendtype'])) $focus->setPreference('mail_sendtype', $_POST['mail_sendtype'], 0, 'global');
311
		if(isset($_POST['mail_smtpserver'])) $focus->setPreference('mail_smtpserver',$_POST['mail_smtpserver'], 0, 'global');
312
		if(isset($_POST['mail_smtpport'])) $focus->setPreference('mail_smtpport',$_POST['mail_smtpport'], 0, 'global');
313
		if(isset($_POST['mail_smtpuser'])) $focus->setPreference('mail_smtpuser',$_POST['mail_smtpuser'], 0, 'global');
314
		if(isset($_POST['mail_smtppass'])) $focus->setPreference('mail_smtppass',$_POST['mail_smtppass'], 0, 'global');
315
		if(isset($_POST['default_locale_name_format'])) $focus->setPreference('default_locale_name_format',$_POST['default_locale_name_format'], 0, 'global');
316
		if(isset($_POST['export_delimiter'])) $focus->setPreference('export_delimiter', $_POST['export_delimiter'], 0, 'global');
317
		if(isset($_POST['default_export_charset'])) $focus->setPreference('default_export_charset', $_POST['default_export_charset'], 0, 'global');
318
		if(isset($_POST['use_real_names'])) {
319
			$focus->setPreference('use_real_names', 'on', 0, 'global');
320
		} elseif(!isset($_POST['use_real_names']) && !isset($_POST['from_dcmenu'])) {
321
			// Make sure we're on the full form and not the QuickCreate.
322
			$focus->setPreference('use_real_names', 'off', 0, 'global');
323
		}
324
325
		if(isset($_POST['mail_smtpauth_req'])) {
326
			$focus->setPreference('mail_smtpauth_req',$_POST['mail_smtpauth_req'] , 0, 'global');
327
		} else {
328
			$focus->setPreference('mail_smtpauth_req','', 0, 'global');
329
		}
330
331
		// SSL-enabled SMTP connection
332
		if(isset($_POST['mail_smtpssl'])) {
333
			$focus->setPreference('mail_smtpssl', 1, 0, 'global');
334
		} else {
335
			$focus->setPreference('mail_smtpssl', 0, 0, 'global');
336
		}
337
	    ///////////////////////////////////////////////////////////////////////////
338
	    ////    PDF SETTINGS
339
	    foreach($_POST as $k=>$v){
340
	        if(strpos($k,"sugarpdf_pdf") !== false){
341
	            $focus->setPreference($k, $v, 0, 'global');
342
	        }
343
	    }
344
	    ////    PDF SETTINGS
345
		///////////////////////////////////////////////////////////////////////////
346
347
		///////////////////////////////////////////////////////////////////////////
348
		////	SIGNATURES
349
		if(isset($_POST['signature_id']))
350
			$focus->setPreference('signature_default', $_POST['signature_id'], 0, 'global');
351
352
		if(isset($_POST['signature_prepend'])) $focus->setPreference('signature_prepend',$_POST['signature_prepend'], 0, 'global');
353
		////	END SIGNATURES
354
		///////////////////////////////////////////////////////////////////////////
355
356
357
		 if(isset($_POST['email_link_type'])) $focus->setPreference('email_link_type', $_REQUEST['email_link_type']);
358
		if(isset($_REQUEST['email_show_counts'])) {
359
			$focus->setPreference('email_show_counts', $_REQUEST['email_show_counts'], 0, 'global');
360
		} else {
361
			$focus->setPreference('email_show_counts', 0, 0, 'global');
362
		}
363
		if(isset($_REQUEST['email_editor_option']))
364
			$focus->setPreference('email_editor_option', $_REQUEST['email_editor_option'], 0, 'global');
365
		if(isset($_REQUEST['default_email_charset']))
366
			$focus->setPreference('default_email_charset', $_REQUEST['default_email_charset'], 0, 'global');
367
368
		if(isset($_POST['calendar_publish_key'])) $focus->setPreference('calendar_publish_key',$_POST['calendar_publish_key'], 0, 'global');
369
	}
370
371
	if (!$focus->verify_data())
372
	{
373
		header("Location: index.php?action=Error&module=Users&error_string=".urlencode($focus->error_string));
374
		exit;
375
	}
376
	else
377
	{	$GLOBALS['sugar_config']['disable_team_access_check'] = true;
378
		$focus->save();
379
		$GLOBALS['sugar_config']['disable_team_access_check'] = false;
380
		$return_id = $focus->id;
381
		$ieVerified = true;
382
383
		global $new_pwd;
384
		$new_pwd='';
385
		if((isset($_POST['old_password']) || $focus->portal_only) &&
386
			(isset($_POST['new_password']) && !empty($_POST['new_password'])) &&
387
			(isset($_POST['password_change']) && $_POST['password_change'] == 'true') ) {
388
			if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) {
389
			   if((isset($_POST['page']) && $_POST['page'] == 'EditView')){
390
			       header("Location: index.php?action=EditView&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string));
391
			       exit;
392
			   }
393
			   if((isset($_POST['page']) && $_POST['page'] == 'Change')){
394
			       header("Location: index.php?action=ChangePassword&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string));
395
			       exit;
396
			   }
397
		   }
398
		   else{
399
		   		if ($newUser)
400
		   			$new_pwd='3';
401
		   		else
402
		   			$new_pwd='1';
403
		   }
404
		}
405
406
		///////////////////////////////////////////////////////////////////////////
407
		////	OUTBOUND EMAIL SAVES
408
		///////////////////////////////////////////////////////////////////////////
409
410
		$sysOutboundAccunt = new OutboundEmail();
411
412
		//If a user is not alloweed to use the default system outbound account then they will be
413
		//saving their own username/password for the system account
414
		if( ! $sysOutboundAccunt->isAllowUserAccessToSystemDefaultOutbound() )
415
        {
416
            $userOverrideOE = $sysOutboundAccunt->getUsersMailerForSystemOverride($focus->id);
417
            if($userOverrideOE != null)
418
            {
419
                //User is alloweed to clear username and pass so no need to check for blanks.
420
                $userOverrideOE->mail_smtpuser = $_REQUEST['mail_smtpuser'];
421
                $userOverrideOE->mail_smtppass = $_REQUEST['mail_smtppass'];
422
                $userOverrideOE->save();
423
            }
424
            else
425
            {
426
                //If a user name and password for the mail account is set, create the users override account.
427
                if( ! (empty($_REQUEST['mail_smtpuser']) || empty($_REQUEST['mail_smtppass'])) )
428
                    $sysOutboundAccunt->createUserSystemOverrideAccount($focus->id,$_REQUEST['mail_smtpuser'],$_REQUEST['mail_smtppass'] );
429
            }
430
        }
431
432
433
		///////////////////////////////////////////////////////////////////////////
434
		////	INBOUND EMAIL SAVES
435
		if(isset($_REQUEST['server_url']) && !empty($_REQUEST['server_url'])) {
436
437
			$ie = new InboundEmail();
438
			if(false === $ie->savePersonalEmailAccount($return_id, $focus->user_name)) {
439
				header("Location: index.php?action=Error&module=Users&error_string=&ie_error=true&id=".$return_id);
440
				die(); // die here, else the header redirect below takes over.
441
			}
442
		} elseif(isset($_REQUEST['ie_id']) && !empty($_REQUEST['ie_id']) && empty($_REQUEST['server_url'])) {
443
			// user is deleting their I-E
444
445
			$ie = new InboundEmail();
446
			$ie->deletePersonalEmailAccount($_REQUEST['ie_id'], $focus->user_name);
447
		}
448
		////	END INBOUND EMAIL SAVES
449
		///////////////////////////////////////////////////////////////////////////
450
		if(($newUser) && !($focus->is_group) && !($focus->portal_only) && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']){
451
			$new_pwd='2';
452
			require_once('modules/Users/GeneratePassword.php');
453
		}
454
455
	}
456
457
458
    //handle navigation from user wizard
459
    if(isset($_REQUEST['whatnext'])){
460
        if($_REQUEST['whatnext']== 'import'){
461
            header("Location:index.php?module=Import&action=step1&import_module=Administration");
462
            return;
463
        }elseif($_REQUEST['whatnext']== 'users'){
464
            header("Location:index.php?module=Users&action=index");
465
            return;
466
        }elseif($_REQUEST['whatnext']== 'settings'){
467
            header("Location:index.php?module=Configurator&action=EditView");
468
            return;
469
        }elseif($_REQUEST['whatnext']== 'studio'){
470
            header("Location:index.php?module=ModuleBuilder&action=index&type=studio");
471
            return;
472
        }else{
0 ignored issues
show
This else statement is empty and can be removed.

This check looks for the else branches of if statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

These else branches can be removed.

if (rand(1, 6) > 3) {
print "Check failed";
} else {
    //print "Check succeeded";
}

could be turned into

if (rand(1, 6) > 3) {
    print "Check failed";
}

This is much more concise to read.

Loading history...
473
            //do nothing, let the navigation continue as normal using code below
474
        }
475
476
    }
477
478
if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = $_REQUEST['return_module'];
479
else $return_module = "Users";
480
if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = $_REQUEST['return_action'];
481
else $return_action = "DetailView";
482
if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = $_REQUEST['return_id'];
483
484
$GLOBALS['log']->debug("Saved record with id of ".$return_id);
485
486
$redirect = "index.php?action={$return_action}&module={$return_module}&record={$return_id}";
487
$redirect .= isset($_REQUEST['type']) ? "&type={$_REQUEST['type']}" : ''; // cn: bug 6897 - detect redirect to Email compose
488
$redirect .= isset($_REQUEST['return_id']) ? "&return_id={$_REQUEST['return_id']}" : '';
489
$redirect .= ($new_pwd!='') ? "&pwd_set=".$new_pwd : '';
490
header("Location: {$redirect}");
491
?>
492