Completed
Push — develop ( 7c1bda...edae1e )
by Adam
18:38 queued 03:14
created
modules/ACLRoles/metadata/subpanels/default.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -41,24 +41,24 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 $subpanel_layout = array(
44
-	'top_buttons' => array(
45
-			array('widget_class' => 'SubPanelTopCreateButton'),
46
-			array('widget_class' => 'SubPanelTopSelectButton'),
47
-	),
44
+    'top_buttons' => array(
45
+            array('widget_class' => 'SubPanelTopCreateButton'),
46
+            array('widget_class' => 'SubPanelTopSelectButton'),
47
+    ),
48 48
 
49
-	'where' => '',
49
+    'where' => '',
50 50
 
51 51
 
52
-	'list_fields' => array(
52
+    'list_fields' => array(
53 53
         'name'=>array(
54
-		 	'vname' => 'LBL_NAME',
55
-			'width' => '25%',
56
-		),
57
-		'description'=>array(
58
-		 	'vname' => 'LBL_DESCRIPTION',
59
-			'width' => '70%',
60
-			'sortable'=>false,
61
-		),
54
+                'vname' => 'LBL_NAME',
55
+            'width' => '25%',
56
+        ),
57
+        'description'=>array(
58
+                'vname' => 'LBL_DESCRIPTION',
59
+            'width' => '70%',
60
+            'sortable'=>false,
61
+        ),
62 62
 /*		
63 63
 		'edit_button'=>array(
64 64
 			'vname' => 'LBL_EDIT_BUTTON',
@@ -75,6 +75,6 @@  discard block
 block discarded – undo
75 75
 		),
76 76
 */		
77 77
 		
78
-	),
78
+    ),
79 79
 );
80 80
 ?>
81 81
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/ACLRoles/views/view.list.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,9 @@
 block discarded – undo
45 45
     public function preDisplay()
46 46
     {
47 47
         //bug #46690: Developer Access to Users/Teams/Roles
48
-        if (!$GLOBALS['current_user']->isAdminForModule('Users') && !$GLOBALS['current_user']->isDeveloperForModule('Users'))
49
-            sugar_die('No Access');
48
+        if (!$GLOBALS['current_user']->isAdminForModule('Users') && !$GLOBALS['current_user']->isDeveloperForModule('Users')) {
49
+                    sugar_die('No Access');
50
+        }
50 51
 
51 52
         $this->lv = new ListViewSmarty();
52 53
         $this->lv->export = false;
Please login to merge, or discard this patch.
modules/ACLRoles/Save.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -44,30 +44,30 @@
 block discarded – undo
44 44
 $role = new ACLRole();
45 45
 if(isset($_REQUEST['record']))$role->id = $_POST['record'];
46 46
 if(!empty($_REQUEST['name'])){
47
-	$role->name = $_POST['name'];
48
-	$role->description = $_POST['description'];
49
-	$role->save();
50
-	//if duplicate
51
-	if(isset($_REQUEST['isduplicate']) && !empty($_REQUEST['isduplicate'])){
52
-	    //duplicate actions
53
-	    $role_actions=$role->getRoleActions($_REQUEST['isduplicate']);
54
-	    foreach($role_actions as $module){
55
-	        foreach($module as $type){
56
-	            foreach($type as $act){
57
-	                $role->setAction($role->id, $act['id'], $act['aclaccess']);
58
-	            }
59
-	        }
60
-	    }
61
-	}
47
+    $role->name = $_POST['name'];
48
+    $role->description = $_POST['description'];
49
+    $role->save();
50
+    //if duplicate
51
+    if(isset($_REQUEST['isduplicate']) && !empty($_REQUEST['isduplicate'])){
52
+        //duplicate actions
53
+        $role_actions=$role->getRoleActions($_REQUEST['isduplicate']);
54
+        foreach($role_actions as $module){
55
+            foreach($module as $type){
56
+                foreach($type as $act){
57
+                    $role->setAction($role->id, $act['id'], $act['aclaccess']);
58
+                }
59
+            }
60
+        }
61
+    }
62 62
 }else{
63 63
     ob_clean();	
64 64
     $flc_module = 'All';
65 65
     foreach($_POST as $name=>$value){
66
-    	if(substr_count($name, 'act_guid') > 0){
67
-    		$name = str_replace('act_guid', '', $name);
66
+        if(substr_count($name, 'act_guid') > 0){
67
+            $name = str_replace('act_guid', '', $name);
68 68
     
69
-    		$role->setAction($role->id,$name, $value);
70
-    	}
69
+            $role->setAction($role->id,$name, $value);
70
+        }
71 71
     	
72 72
     }
73 73
     echo "result = {role_id:'$role->id', module:'$flc_module'}";
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -42,31 +42,31 @@  discard block
 block discarded – undo
42 42
 
43 43
 
44 44
 $role = new ACLRole();
45
-if(isset($_REQUEST['record']))$role->id = $_POST['record'];
46
-if(!empty($_REQUEST['name'])){
45
+if (isset($_REQUEST['record']))$role->id = $_POST['record'];
46
+if (!empty($_REQUEST['name'])) {
47 47
 	$role->name = $_POST['name'];
48 48
 	$role->description = $_POST['description'];
49 49
 	$role->save();
50 50
 	//if duplicate
51
-	if(isset($_REQUEST['isduplicate']) && !empty($_REQUEST['isduplicate'])){
51
+	if (isset($_REQUEST['isduplicate']) && !empty($_REQUEST['isduplicate'])) {
52 52
 	    //duplicate actions
53
-	    $role_actions=$role->getRoleActions($_REQUEST['isduplicate']);
54
-	    foreach($role_actions as $module){
55
-	        foreach($module as $type){
56
-	            foreach($type as $act){
53
+	    $role_actions = $role->getRoleActions($_REQUEST['isduplicate']);
54
+	    foreach ($role_actions as $module) {
55
+	        foreach ($module as $type) {
56
+	            foreach ($type as $act) {
57 57
 	                $role->setAction($role->id, $act['id'], $act['aclaccess']);
58 58
 	            }
59 59
 	        }
60 60
 	    }
61 61
 	}
62
-}else{
62
+} else {
63 63
     ob_clean();	
64 64
     $flc_module = 'All';
65
-    foreach($_POST as $name=>$value){
66
-    	if(substr_count($name, 'act_guid') > 0){
65
+    foreach ($_POST as $name=>$value) {
66
+    	if (substr_count($name, 'act_guid') > 0) {
67 67
     		$name = str_replace('act_guid', '', $name);
68 68
     
69
-    		$role->setAction($role->id,$name, $value);
69
+    		$role->setAction($role->id, $name, $value);
70 70
     	}
71 71
     	
72 72
     }
@@ -74,5 +74,5 @@  discard block
 block discarded – undo
74 74
     sugar_cleanup(true);
75 75
 }
76 76
 
77
-header("Location: index.php?module=ACLRoles&action=DetailView&record=". $role->id);
77
+header("Location: index.php?module=ACLRoles&action=DetailView&record=".$role->id);
78 78
 ?>
79 79
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -42,7 +44,9 @@  discard block
 block discarded – undo
42 44
 
43 45
 
44 46
 $role = new ACLRole();
45
-if(isset($_REQUEST['record']))$role->id = $_POST['record'];
47
+if(isset($_REQUEST['record'])) {
48
+    $role->id = $_POST['record'];
49
+}
46 50
 if(!empty($_REQUEST['name'])){
47 51
 	$role->name = $_POST['name'];
48 52
 	$role->description = $_POST['description'];
@@ -59,7 +63,7 @@  discard block
 block discarded – undo
59 63
 	        }
60 64
 	    }
61 65
 	}
62
-}else{
66
+} else{
63 67
     ob_clean();	
64 68
     $flc_module = 'All';
65 69
     foreach($_POST as $name=>$value){
Please login to merge, or discard this patch.
modules/ACLRoles/Delete.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
 $role = new ACLRole();
43 43
 if(isset($_REQUEST['record'])){
44
-	$role->mark_deleted($_REQUEST['record']);
44
+    $role->mark_deleted($_REQUEST['record']);
45 45
 }
46 46
 require_once('include/formbase.php');
47 47
 handleRedirect();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 $role = new ACLRole();
43
-if(isset($_REQUEST['record'])){
43
+if (isset($_REQUEST['record'])) {
44 44
 	$role->mark_deleted($_REQUEST['record']);
45 45
 }
46 46
 require_once('include/formbase.php');
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Users/authentication/AuthenticationController.php 3 patches
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -127,7 +129,9 @@  discard block
 block discarded – undo
127 129
 		$_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts']))? $_SESSION['loginAttempts'] + 1: 1;
128 130
 		unset($GLOBALS['login_error']);
129 131
 
130
-		if($this->loggedIn)return $this->loginSuccess;
132
+		if($this->loggedIn) {
133
+		    return $this->loginSuccess;
134
+		}
131 135
 		LogicHook::initialize()->call_custom_logic('Users', 'before_login');
132 136
 
133 137
 		$this->loginSuccess = $this->authController->loginAuthenticate($username, $password, false, $PARAMS);
@@ -146,8 +150,9 @@  discard block
 block discarded – undo
146 150
 			}
147 151
 
148 152
 			//call business logic hook
149
-			if(isset($GLOBALS['current_user']))
150
-				$GLOBALS['current_user']->call_custom_logic('after_login');
153
+			if(isset($GLOBALS['current_user'])) {
154
+							$GLOBALS['current_user']->call_custom_logic('after_login');
155
+			}
151 156
 
152 157
 			// Check for running Admin Wizard
153 158
 			$config = new Administration();
@@ -172,7 +177,7 @@  discard block
 block discarded – undo
172 177
 				header("Location: index.php?module=Users&action=Wizard");
173 178
 				sugar_cleanup(true);
174 179
 			}
175
-		}else{
180
+		} else{
176 181
 			//kbrill bug #13225
177 182
 			LogicHook::initialize();
178 183
 			$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 {
45 45
 	public $loggedIn = false; //if a user has attempted to login
46 46
 	public $authenticated = false;
47
-	public $loginSuccess = false;// if a user has successfully logged in
47
+	public $loginSuccess = false; // if a user has successfully logged in
48 48
 
49 49
 	protected static $authcontrollerinstance = null;
50 50
 
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
         }
82 82
 
83 83
         // check in custom dir first, in case someone want's to override an auth controller
84
-		if (file_exists('custom/modules/Users/authentication/'.$type.'/' . $type . '.php')) {
85
-            require_once('custom/modules/Users/authentication/'.$type.'/' . $type . '.php');
86
-        } elseif (file_exists('modules/Users/authentication/'.$type.'/' . $type . '.php')) {
87
-            require_once('modules/Users/authentication/'.$type.'/' . $type . '.php');
84
+		if (file_exists('custom/modules/Users/authentication/'.$type.'/'.$type.'.php')) {
85
+            require_once('custom/modules/Users/authentication/'.$type.'/'.$type.'.php');
86
+        } elseif (file_exists('modules/Users/authentication/'.$type.'/'.$type.'.php')) {
87
+            require_once('modules/Users/authentication/'.$type.'/'.$type.'.php');
88 88
         } else {
89 89
             require_once('modules/Users/authentication/SugarAuthenticate/SugarAuthenticate.php');
90 90
             $type = 'SugarAuthenticate';
@@ -124,21 +124,21 @@  discard block
 block discarded – undo
124 124
 	public function login($username, $password, $PARAMS = array())
125 125
 	{
126 126
 		//kbrill bug #13225
127
-		$_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts']))? $_SESSION['loginAttempts'] + 1: 1;
127
+		$_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts'])) ? $_SESSION['loginAttempts'] + 1 : 1;
128 128
 		unset($GLOBALS['login_error']);
129 129
 
130
-		if($this->loggedIn)return $this->loginSuccess;
130
+		if ($this->loggedIn)return $this->loginSuccess;
131 131
 		LogicHook::initialize()->call_custom_logic('Users', 'before_login');
132 132
 
133 133
 		$this->loginSuccess = $this->authController->loginAuthenticate($username, $password, false, $PARAMS);
134 134
 		$this->loggedIn = true;
135 135
 
136
-		if($this->loginSuccess){
136
+		if ($this->loginSuccess) {
137 137
 			//Ensure the user is authorized
138 138
 			checkAuthUserStatus();
139 139
 
140 140
 			//loginLicense();
141
-			if(!empty($GLOBALS['login_error'])){
141
+			if (!empty($GLOBALS['login_error'])) {
142 142
 				unset($_SESSION['authenticated_user_id']);
143 143
 				$GLOBALS['log']->fatal('FAILED LOGIN: potential hack attempt:'.$GLOBALS['login_error']);
144 144
 				$this->loginSuccess = false;
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 			}
147 147
 
148 148
 			//call business logic hook
149
-			if(isset($GLOBALS['current_user']))
149
+			if (isset($GLOBALS['current_user']))
150 150
 				$GLOBALS['current_user']->call_custom_logic('after_login');
151 151
 
152 152
 			// Check for running Admin Wizard
153 153
 			$config = new Administration();
154 154
 			$config->retrieveSettings();
155 155
 			$postSilentInstallAdminWizardCompleted = $GLOBALS['current_user']->getPreference('postSilentInstallAdminWizardCompleted');
156
-		    if ( (is_admin($GLOBALS['current_user']) && empty($config->settings['system_adminwizard']) && $_REQUEST['action'] != 'AdminWizard') ||($postSilentInstallAdminWizardCompleted !== NULL && !$postSilentInstallAdminWizardCompleted) ) {
156
+		    if ((is_admin($GLOBALS['current_user']) && empty($config->settings['system_adminwizard']) && $_REQUEST['action'] != 'AdminWizard') || ($postSilentInstallAdminWizardCompleted !== NULL && !$postSilentInstallAdminWizardCompleted)) {
157 157
 				$GLOBALS['module'] = 'Configurator';
158 158
 				$GLOBALS['action'] = 'AdminWizard';
159 159
 				ob_clean();
@@ -166,18 +166,18 @@  discard block
 block discarded – undo
166 166
 			if (is_array($PARAMS) && !empty($PARAMS) && isset($PARAMS['passwordEncrypted'])) {
167 167
 				$checkTimeZone = false;
168 168
 			} // if
169
-			if(empty($ut) && $checkTimeZone && $_REQUEST['action'] != 'SetTimezone' && $_REQUEST['action'] != 'SaveTimezone' ) {
169
+			if (empty($ut) && $checkTimeZone && $_REQUEST['action'] != 'SetTimezone' && $_REQUEST['action'] != 'SaveTimezone') {
170 170
 				$GLOBALS['module'] = 'Users';
171 171
 				$GLOBALS['action'] = 'Wizard';
172 172
 				ob_clean();
173 173
 				header("Location: index.php?module=Users&action=Wizard");
174 174
 				sugar_cleanup(true);
175 175
 			}
176
-		}else{
176
+		} else {
177 177
 			//kbrill bug #13225
178 178
 			LogicHook::initialize();
179 179
 			$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
180
-			$GLOBALS['log']->fatal('FAILED LOGIN:attempts[' .$_SESSION['loginAttempts'] .'] - '. $username);
180
+			$GLOBALS['log']->fatal('FAILED LOGIN:attempts['.$_SESSION['loginAttempts'].'] - '.$username);
181 181
 		}
182 182
 		// if password has expired, set a session variable
183 183
 
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	public function sessionAuthenticate()
194 194
 	{
195
-		if(!$this->authenticated){
195
+		if (!$this->authenticated) {
196 196
 			$this->authenticated = $this->authController->sessionAuthenticate();
197 197
 		}
198
-		if($this->authenticated){
199
-			if(!isset($_SESSION['userStats']['pages'])){
198
+		if ($this->authenticated) {
199
+			if (!isset($_SESSION['userStats']['pages'])) {
200 200
 			    $_SESSION['userStats']['loginTime'] = time();
201 201
 			    $_SESSION['userStats']['pages'] = 0;
202 202
 			}
Please login to merge, or discard this patch.
Indentation   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -42,27 +42,27 @@  discard block
 block discarded – undo
42 42
 
43 43
 class AuthenticationController
44 44
 {
45
-	public $loggedIn = false; //if a user has attempted to login
46
-	public $authenticated = false;
47
-	public $loginSuccess = false;// if a user has successfully logged in
45
+    public $loggedIn = false; //if a user has attempted to login
46
+    public $authenticated = false;
47
+    public $loginSuccess = false;// if a user has successfully logged in
48 48
 
49
-	protected static $authcontrollerinstance = null;
49
+    protected static $authcontrollerinstance = null;
50 50
 
51 51
     /**
52 52
      * @var SugarAuthenticate
53 53
      */
54 54
     public $authController;
55 55
 
56
-	/**
57
-	 * Creates an instance of the authentication controller and loads it
58
-	 *
59
-	 * @param STRING $type - the authentication Controller
60
-	 * @return AuthenticationController -
61
-	 */
62
-	public function __construct($type = null)
63
-	{
56
+    /**
57
+     * Creates an instance of the authentication controller and loads it
58
+     *
59
+     * @param STRING $type - the authentication Controller
60
+     * @return AuthenticationController -
61
+     */
62
+    public function __construct($type = null)
63
+    {
64 64
         $this->authController = $this->getAuthController($type);
65
-	}
65
+    }
66 66
 
67 67
     /**
68 68
      * Get auth controller object
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         }
82 82
 
83 83
         // check in custom dir first, in case someone want's to override an auth controller
84
-		if (file_exists('custom/modules/Users/authentication/'.$type.'/' . $type . '.php')) {
84
+        if (file_exists('custom/modules/Users/authentication/'.$type.'/' . $type . '.php')) {
85 85
             require_once('custom/modules/Users/authentication/'.$type.'/' . $type . '.php');
86 86
         } elseif (file_exists('modules/Users/authentication/'.$type.'/' . $type . '.php')) {
87 87
             require_once('modules/Users/authentication/'.$type.'/' . $type . '.php');
@@ -92,133 +92,133 @@  discard block
 block discarded – undo
92 92
 
93 93
         if (!empty($_REQUEST['no_saml']) 
94 94
             && (
95
-				(is_subclass_of($type, 'SAMLAuthenticate') || 'SAMLAuthenticate' == $type) ||
96
-				(is_subclass_of($type, 'SAML2Authenticate') || 'SAML2Authenticate' == $type)
97
-			)) {
95
+                (is_subclass_of($type, 'SAMLAuthenticate') || 'SAMLAuthenticate' == $type) ||
96
+                (is_subclass_of($type, 'SAML2Authenticate') || 'SAML2Authenticate' == $type)
97
+            )) {
98 98
             $type = 'SugarAuthenticate';
99 99
         }
100 100
 
101 101
         return new $type();
102 102
     }
103 103
 
104
-	/**
105
-	 * Returns an instance of the authentication controller
106
-	 *
107
-	 * @param string $type this is the type of authetnication you want to use default is SugarAuthenticate
108
-	 * @return an instance of the authetnciation controller
109
-	 */
110
-	public static function getInstance($type = null)
111
-	{
112
-		if (empty(self::$authcontrollerinstance)) {
113
-			self::$authcontrollerinstance = new AuthenticationController($type);
114
-		}
115
-
116
-		return self::$authcontrollerinstance;
117
-	}
118
-
119
-	/**
120
-	 * This function is called when a user initially tries to login.
121
-	 *
122
-	 * @param string $username
123
-	 * @param string $password
124
-	 * @param array $PARAMS
125
-	 * @return boolean true if the user successfully logs in or false otherwise.
126
-	 */
127
-	public function login($username, $password, $PARAMS = array())
128
-	{
129
-		//kbrill bug #13225
130
-		$_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts']))? $_SESSION['loginAttempts'] + 1: 1;
131
-		unset($GLOBALS['login_error']);
132
-
133
-		if($this->loggedIn)return $this->loginSuccess;
134
-		LogicHook::initialize()->call_custom_logic('Users', 'before_login');
135
-
136
-		$this->loginSuccess = $this->authController->loginAuthenticate($username, $password, false, $PARAMS);
137
-		$this->loggedIn = true;
138
-
139
-		if($this->loginSuccess){
140
-			//Ensure the user is authorized
141
-			checkAuthUserStatus();
142
-
143
-			//loginLicense();
144
-			if(!empty($GLOBALS['login_error'])){
145
-				unset($_SESSION['authenticated_user_id']);
146
-				$GLOBALS['log']->fatal('FAILED LOGIN: potential hack attempt:'.$GLOBALS['login_error']);
147
-				$this->loginSuccess = false;
148
-				return false;
149
-			}
150
-
151
-			//call business logic hook
152
-			if(isset($GLOBALS['current_user']))
153
-				$GLOBALS['current_user']->call_custom_logic('after_login');
154
-
155
-			// Check for running Admin Wizard
156
-			$config = new Administration();
157
-			$config->retrieveSettings();
158
-			$postSilentInstallAdminWizardCompleted = $GLOBALS['current_user']->getPreference('postSilentInstallAdminWizardCompleted');
159
-		    if ( (is_admin($GLOBALS['current_user']) && empty($config->settings['system_adminwizard']) && $_REQUEST['action'] != 'AdminWizard') ||($postSilentInstallAdminWizardCompleted !== NULL && !$postSilentInstallAdminWizardCompleted) ) {
160
-				$GLOBALS['module'] = 'Configurator';
161
-				$GLOBALS['action'] = 'AdminWizard';
162
-				ob_clean();
163
-				header("Location: index.php?module=Configurator&action=AdminWizard");
164
-				sugar_cleanup(true);
165
-			}
166
-
167
-			$ut = $GLOBALS['current_user']->getPreference('ut');
168
-			$checkTimeZone = true;
169
-			if (is_array($PARAMS) && !empty($PARAMS) && isset($PARAMS['passwordEncrypted'])) {
170
-				$checkTimeZone = false;
171
-			} // if
172
-			if(empty($ut) && $checkTimeZone && $_REQUEST['action'] != 'SetTimezone' && $_REQUEST['action'] != 'SaveTimezone' ) {
173
-				$GLOBALS['module'] = 'Users';
174
-				$GLOBALS['action'] = 'Wizard';
175
-				ob_clean();
176
-				header("Location: index.php?module=Users&action=Wizard");
177
-				sugar_cleanup(true);
178
-			}
179
-		}else{
180
-			//kbrill bug #13225
181
-			LogicHook::initialize();
182
-			$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
183
-			$GLOBALS['log']->fatal('FAILED LOGIN:attempts[' .$_SESSION['loginAttempts'] .'] - '. $username);
184
-		}
185
-		// if password has expired, set a session variable
186
-
187
-		return $this->loginSuccess;
188
-	}
189
-
190
-	/**
191
-	 * This is called on every page hit.
192
-	 * It returns true if the current session is authenticated or false otherwise
193
-	 *
194
-	 * @return booelan
195
-	 */
196
-	public function sessionAuthenticate()
197
-	{
198
-		if(!$this->authenticated){
199
-			$this->authenticated = $this->authController->sessionAuthenticate();
200
-		}
201
-		if($this->authenticated){
202
-			if(!isset($_SESSION['userStats']['pages'])){
203
-			    $_SESSION['userStats']['loginTime'] = time();
204
-			    $_SESSION['userStats']['pages'] = 0;
205
-			}
206
-			$_SESSION['userStats']['lastTime'] = time();
207
-			$_SESSION['userStats']['pages']++;
208
-
209
-		}
210
-		return $this->authenticated;
211
-	}
212
-
213
-	/**
214
-	 * Called when a user requests to logout. Should invalidate the session and redirect
215
-	 * to the login page.
216
-	 */
217
-	public function logout()
218
-	{
219
-		$GLOBALS['current_user']->call_custom_logic('before_logout');
220
-		$this->authController->logout();
221
-		LogicHook::initialize();
222
-		$GLOBALS['logic_hook']->call_custom_logic('Users', 'after_logout');
223
-	}
104
+    /**
105
+     * Returns an instance of the authentication controller
106
+     *
107
+     * @param string $type this is the type of authetnication you want to use default is SugarAuthenticate
108
+     * @return an instance of the authetnciation controller
109
+     */
110
+    public static function getInstance($type = null)
111
+    {
112
+        if (empty(self::$authcontrollerinstance)) {
113
+            self::$authcontrollerinstance = new AuthenticationController($type);
114
+        }
115
+
116
+        return self::$authcontrollerinstance;
117
+    }
118
+
119
+    /**
120
+     * This function is called when a user initially tries to login.
121
+     *
122
+     * @param string $username
123
+     * @param string $password
124
+     * @param array $PARAMS
125
+     * @return boolean true if the user successfully logs in or false otherwise.
126
+     */
127
+    public function login($username, $password, $PARAMS = array())
128
+    {
129
+        //kbrill bug #13225
130
+        $_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts']))? $_SESSION['loginAttempts'] + 1: 1;
131
+        unset($GLOBALS['login_error']);
132
+
133
+        if($this->loggedIn)return $this->loginSuccess;
134
+        LogicHook::initialize()->call_custom_logic('Users', 'before_login');
135
+
136
+        $this->loginSuccess = $this->authController->loginAuthenticate($username, $password, false, $PARAMS);
137
+        $this->loggedIn = true;
138
+
139
+        if($this->loginSuccess){
140
+            //Ensure the user is authorized
141
+            checkAuthUserStatus();
142
+
143
+            //loginLicense();
144
+            if(!empty($GLOBALS['login_error'])){
145
+                unset($_SESSION['authenticated_user_id']);
146
+                $GLOBALS['log']->fatal('FAILED LOGIN: potential hack attempt:'.$GLOBALS['login_error']);
147
+                $this->loginSuccess = false;
148
+                return false;
149
+            }
150
+
151
+            //call business logic hook
152
+            if(isset($GLOBALS['current_user']))
153
+                $GLOBALS['current_user']->call_custom_logic('after_login');
154
+
155
+            // Check for running Admin Wizard
156
+            $config = new Administration();
157
+            $config->retrieveSettings();
158
+            $postSilentInstallAdminWizardCompleted = $GLOBALS['current_user']->getPreference('postSilentInstallAdminWizardCompleted');
159
+            if ( (is_admin($GLOBALS['current_user']) && empty($config->settings['system_adminwizard']) && $_REQUEST['action'] != 'AdminWizard') ||($postSilentInstallAdminWizardCompleted !== NULL && !$postSilentInstallAdminWizardCompleted) ) {
160
+                $GLOBALS['module'] = 'Configurator';
161
+                $GLOBALS['action'] = 'AdminWizard';
162
+                ob_clean();
163
+                header("Location: index.php?module=Configurator&action=AdminWizard");
164
+                sugar_cleanup(true);
165
+            }
166
+
167
+            $ut = $GLOBALS['current_user']->getPreference('ut');
168
+            $checkTimeZone = true;
169
+            if (is_array($PARAMS) && !empty($PARAMS) && isset($PARAMS['passwordEncrypted'])) {
170
+                $checkTimeZone = false;
171
+            } // if
172
+            if(empty($ut) && $checkTimeZone && $_REQUEST['action'] != 'SetTimezone' && $_REQUEST['action'] != 'SaveTimezone' ) {
173
+                $GLOBALS['module'] = 'Users';
174
+                $GLOBALS['action'] = 'Wizard';
175
+                ob_clean();
176
+                header("Location: index.php?module=Users&action=Wizard");
177
+                sugar_cleanup(true);
178
+            }
179
+        }else{
180
+            //kbrill bug #13225
181
+            LogicHook::initialize();
182
+            $GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
183
+            $GLOBALS['log']->fatal('FAILED LOGIN:attempts[' .$_SESSION['loginAttempts'] .'] - '. $username);
184
+        }
185
+        // if password has expired, set a session variable
186
+
187
+        return $this->loginSuccess;
188
+    }
189
+
190
+    /**
191
+     * This is called on every page hit.
192
+     * It returns true if the current session is authenticated or false otherwise
193
+     *
194
+     * @return booelan
195
+     */
196
+    public function sessionAuthenticate()
197
+    {
198
+        if(!$this->authenticated){
199
+            $this->authenticated = $this->authController->sessionAuthenticate();
200
+        }
201
+        if($this->authenticated){
202
+            if(!isset($_SESSION['userStats']['pages'])){
203
+                $_SESSION['userStats']['loginTime'] = time();
204
+                $_SESSION['userStats']['pages'] = 0;
205
+            }
206
+            $_SESSION['userStats']['lastTime'] = time();
207
+            $_SESSION['userStats']['pages']++;
208
+
209
+        }
210
+        return $this->authenticated;
211
+    }
212
+
213
+    /**
214
+     * Called when a user requests to logout. Should invalidate the session and redirect
215
+     * to the login page.
216
+     */
217
+    public function logout()
218
+    {
219
+        $GLOBALS['current_user']->call_custom_logic('before_logout');
220
+        $this->authController->logout();
221
+        LogicHook::initialize();
222
+        $GLOBALS['logic_hook']->call_custom_logic('Users', 'after_logout');
223
+    }
224 224
 }
Please login to merge, or discard this patch.
modules/Users/authentication/SugarAuthenticate/SugarAuthenticateUser.php 3 patches
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -47,91 +47,91 @@
 block discarded – undo
47 47
  */
48 48
 class SugarAuthenticateUser{
49 49
 
50
-	/**
51
-	 * Does the actual authentication of the user and returns an id that will be used
52
-	 * to load the current user (loadUserOnSession)
53
-	 *
54
-	 * @param STRING $name
55
-	 * @param STRING $password
56
-	 * @param STRING $fallback - is this authentication a fallback from a failed authentication
57
-	 * @return STRING id - used for loading the user
58
-	 */
59
-	function authenticateUser($name, $password, $fallback=false)
60
-	{
61
-	    $row = User::findUserPassword($name, $password, "(portal_only IS NULL OR portal_only !='1') AND (is_group IS NULL OR is_group !='1') AND status !='Inactive'");
50
+    /**
51
+     * Does the actual authentication of the user and returns an id that will be used
52
+     * to load the current user (loadUserOnSession)
53
+     *
54
+     * @param STRING $name
55
+     * @param STRING $password
56
+     * @param STRING $fallback - is this authentication a fallback from a failed authentication
57
+     * @return STRING id - used for loading the user
58
+     */
59
+    function authenticateUser($name, $password, $fallback=false)
60
+    {
61
+        $row = User::findUserPassword($name, $password, "(portal_only IS NULL OR portal_only !='1') AND (is_group IS NULL OR is_group !='1') AND status !='Inactive'");
62 62
     
63
-	    // set the ID in the seed user.  This can be used for retrieving the full user record later
64
-		//if it's falling back on Sugar Authentication after the login failed on an external authentication return empty if the user has external_auth_disabled for them
65
-		if (empty ($row) || !empty($row['external_auth_only'])) {
66
-			return '';
67
-		} else {
68
-			return $row['id'];
69
-		}
70
-	}
71
-	/**
72
-	 * Checks if a user is a sugarLogin user
73
-	 * which implies they should use the sugar authentication to login
74
-	 *
75
-	 * @param STRING $name
76
-	 * @param STRIUNG $password
77
-	 * @return boolean
78
-	 */
79
-	function isSugarLogin($name, $password)
80
-	{
81
-	    $row = User::findUserPassword($name, $password, "(portal_only IS NULL OR portal_only !='1') AND (is_group IS NULL OR is_group !='1') AND status !='Inactive' AND sugar_login=1");
82
-	    return !empty($row);
83
-	}
63
+        // set the ID in the seed user.  This can be used for retrieving the full user record later
64
+        //if it's falling back on Sugar Authentication after the login failed on an external authentication return empty if the user has external_auth_disabled for them
65
+        if (empty ($row) || !empty($row['external_auth_only'])) {
66
+            return '';
67
+        } else {
68
+            return $row['id'];
69
+        }
70
+    }
71
+    /**
72
+     * Checks if a user is a sugarLogin user
73
+     * which implies they should use the sugar authentication to login
74
+     *
75
+     * @param STRING $name
76
+     * @param STRIUNG $password
77
+     * @return boolean
78
+     */
79
+    function isSugarLogin($name, $password)
80
+    {
81
+        $row = User::findUserPassword($name, $password, "(portal_only IS NULL OR portal_only !='1') AND (is_group IS NULL OR is_group !='1') AND status !='Inactive' AND sugar_login=1");
82
+        return !empty($row);
83
+    }
84 84
 
85
-	/**
86
-	 * this is called when a user logs in
87
-	 *
88
-	 * @param STRING $name
89
-	 * @param STRING $password
90
-	 * @param STRING $fallback - is this authentication a fallback from a failed authentication
91
-	 * @return boolean
92
-	 */
93
-	function loadUserOnLogin($name, $password, $fallback = false, $PARAMS = array()) {
94
-		global $login_error;
85
+    /**
86
+     * this is called when a user logs in
87
+     *
88
+     * @param STRING $name
89
+     * @param STRING $password
90
+     * @param STRING $fallback - is this authentication a fallback from a failed authentication
91
+     * @return boolean
92
+     */
93
+    function loadUserOnLogin($name, $password, $fallback = false, $PARAMS = array()) {
94
+        global $login_error;
95 95
 
96
-		$GLOBALS['log']->debug("Starting user load for ". $name);
97
-		if(empty($name) || empty($password)) return false;
98
-		$input_hash = $password;
99
-		$passwordEncrypted = false;
100
-		if (!empty($PARAMS) && isset($PARAMS['passwordEncrypted']) && $PARAMS['passwordEncrypted']) {
101
-			$passwordEncrypted = true;
102
-		}// if
103
-		if (!$passwordEncrypted) {
104
-			$input_hash = SugarAuthenticate::encodePassword($password);
105
-		} // if
106
-		$user_id = $this->authenticateUser($name, $input_hash, $fallback);
107
-		if(empty($user_id)) {
108
-			$GLOBALS['log']->fatal('SECURITY: User authentication for '.$name.' failed');
109
-			return false;
110
-		}
111
-		$this->loadUserOnSession($user_id);
112
-		return true;
113
-	}
114
-	/**
115
-	 * Loads the current user bassed on the given user_id
116
-	 *
117
-	 * @param STRING $user_id
118
-	 * @return boolean
119
-	 */
120
-	function loadUserOnSession($user_id=''){
121
-		if(!empty($user_id)){
122
-			$_SESSION['authenticated_user_id'] = $user_id;
123
-		}
96
+        $GLOBALS['log']->debug("Starting user load for ". $name);
97
+        if(empty($name) || empty($password)) return false;
98
+        $input_hash = $password;
99
+        $passwordEncrypted = false;
100
+        if (!empty($PARAMS) && isset($PARAMS['passwordEncrypted']) && $PARAMS['passwordEncrypted']) {
101
+            $passwordEncrypted = true;
102
+        }// if
103
+        if (!$passwordEncrypted) {
104
+            $input_hash = SugarAuthenticate::encodePassword($password);
105
+        } // if
106
+        $user_id = $this->authenticateUser($name, $input_hash, $fallback);
107
+        if(empty($user_id)) {
108
+            $GLOBALS['log']->fatal('SECURITY: User authentication for '.$name.' failed');
109
+            return false;
110
+        }
111
+        $this->loadUserOnSession($user_id);
112
+        return true;
113
+    }
114
+    /**
115
+     * Loads the current user bassed on the given user_id
116
+     *
117
+     * @param STRING $user_id
118
+     * @return boolean
119
+     */
120
+    function loadUserOnSession($user_id=''){
121
+        if(!empty($user_id)){
122
+            $_SESSION['authenticated_user_id'] = $user_id;
123
+        }
124 124
 
125
-		if(!empty($_SESSION['authenticated_user_id']) || !empty($user_id)){
126
-			$GLOBALS['current_user'] = new User();
127
-			if($GLOBALS['current_user']->retrieve($_SESSION['authenticated_user_id'])){
125
+        if(!empty($_SESSION['authenticated_user_id']) || !empty($user_id)){
126
+            $GLOBALS['current_user'] = new User();
127
+            if($GLOBALS['current_user']->retrieve($_SESSION['authenticated_user_id'])){
128 128
 
129
-				return true;
130
-			}
131
-		}
132
-		return false;
129
+                return true;
130
+            }
131
+        }
132
+        return false;
133 133
 
134
-	}
134
+    }
135 135
 
136 136
 }
137 137
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * This file is where the user authentication occurs. No redirection should happen in this file.
46 46
  *
47 47
  */
48
-class SugarAuthenticateUser{
48
+class SugarAuthenticateUser {
49 49
 
50 50
 	/**
51 51
 	 * Does the actual authentication of the user and returns an id that will be used
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @param STRING $fallback - is this authentication a fallback from a failed authentication
57 57
 	 * @return STRING id - used for loading the user
58 58
 	 */
59
-	function authenticateUser($name, $password, $fallback=false)
59
+	function authenticateUser($name, $password, $fallback = false)
60 60
 	{
61 61
 	    $row = User::findUserPassword($name, $password, "(portal_only IS NULL OR portal_only !='1') AND (is_group IS NULL OR is_group !='1') AND status !='Inactive'");
62 62
     
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	function loadUserOnLogin($name, $password, $fallback = false, $PARAMS = array()) {
94 94
 		global $login_error;
95 95
 
96
-		$GLOBALS['log']->debug("Starting user load for ". $name);
97
-		if(empty($name) || empty($password)) return false;
96
+		$GLOBALS['log']->debug("Starting user load for ".$name);
97
+		if (empty($name) || empty($password)) return false;
98 98
 		$input_hash = $password;
99 99
 		$passwordEncrypted = false;
100 100
 		if (!empty($PARAMS) && isset($PARAMS['passwordEncrypted']) && $PARAMS['passwordEncrypted']) {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 			$input_hash = SugarAuthenticate::encodePassword($password);
105 105
 		} // if
106 106
 		$user_id = $this->authenticateUser($name, $input_hash, $fallback);
107
-		if(empty($user_id)) {
107
+		if (empty($user_id)) {
108 108
 			$GLOBALS['log']->fatal('SECURITY: User authentication for '.$name.' failed');
109 109
 			return false;
110 110
 		}
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 	 * @param STRING $user_id
118 118
 	 * @return boolean
119 119
 	 */
120
-	function loadUserOnSession($user_id=''){
121
-		if(!empty($user_id)){
120
+	function loadUserOnSession($user_id = '') {
121
+		if (!empty($user_id)) {
122 122
 			$_SESSION['authenticated_user_id'] = $user_id;
123 123
 		}
124 124
 
125
-		if(!empty($_SESSION['authenticated_user_id']) || !empty($user_id)){
125
+		if (!empty($_SESSION['authenticated_user_id']) || !empty($user_id)) {
126 126
 			$GLOBALS['current_user'] = new User();
127
-			if($GLOBALS['current_user']->retrieve($_SESSION['authenticated_user_id'])){
127
+			if ($GLOBALS['current_user']->retrieve($_SESSION['authenticated_user_id'])) {
128 128
 
129 129
 				return true;
130 130
 			}
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -94,7 +96,9 @@  discard block
 block discarded – undo
94 96
 		global $login_error;
95 97
 
96 98
 		$GLOBALS['log']->debug("Starting user load for ". $name);
97
-		if(empty($name) || empty($password)) return false;
99
+		if(empty($name) || empty($password)) {
100
+		    return false;
101
+		}
98 102
 		$input_hash = $password;
99 103
 		$passwordEncrypted = false;
100 104
 		if (!empty($PARAMS) && isset($PARAMS['passwordEncrypted']) && $PARAMS['passwordEncrypted']) {
Please login to merge, or discard this patch.
modules/Users/UserViewHelper.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
         //if this is an existing bean and the type is empty, then populate user type
220 220
         if(!empty($this->bean->id) && empty($this->bean->user_type))
221
-	    {
221
+        {
222 222
             $this->setUserType($this->bean);
223 223
             $userType = $this->bean->user_type;
224 224
         } else {
@@ -414,26 +414,26 @@  discard block
 block discarded – undo
414 414
             $this->ss->assign('NO_OPPS', 'CHECKED');
415 415
         }
416 416
 
417
-	    $reminder_time = $this->bean->getPreference('reminder_time');
418
-	    if(empty($reminder_time)){
419
-		    $reminder_time = -1;
420
-	    }
421
-	    $email_reminder_time = $this->bean->getPreference('email_reminder_time');
422
-	    if(empty($email_reminder_time)){
423
-		    $email_reminder_time = -1;
424
-	    }
417
+        $reminder_time = $this->bean->getPreference('reminder_time');
418
+        if(empty($reminder_time)){
419
+            $reminder_time = -1;
420
+        }
421
+        $email_reminder_time = $this->bean->getPreference('email_reminder_time');
422
+        if(empty($email_reminder_time)){
423
+            $email_reminder_time = -1;
424
+        }
425 425
 		
426 426
         $this->ss->assign("REMINDER_TIME_OPTIONS", $app_list_strings['reminder_time_options']);
427 427
         $this->ss->assign("EMAIL_REMINDER_TIME_OPTIONS", $app_list_strings['reminder_time_options']);
428
-	    $this->ss->assign("REMINDER_TIME", $reminder_time);
429
-	    $this->ss->assign("EMAIL_REMINDER_TIME", $email_reminder_time);
428
+        $this->ss->assign("REMINDER_TIME", $reminder_time);
429
+        $this->ss->assign("EMAIL_REMINDER_TIME", $email_reminder_time);
430 430
 
431 431
         $remindersDefaultPreferences = Reminder::loadRemindersDefaultValuesData();
432
-		$this->ss->assign("REMINDER_CHECKED", $remindersDefaultPreferences['popup']);
433
-	    $this->ss->assign("EMAIL_REMINDER_CHECKED", $remindersDefaultPreferences['email']);
432
+        $this->ss->assign("REMINDER_CHECKED", $remindersDefaultPreferences['popup']);
433
+        $this->ss->assign("EMAIL_REMINDER_CHECKED", $remindersDefaultPreferences['email']);
434 434
 		
435
-	    $this->ss->assign("REMINDER_TABINDEX", "12");
436
-	    $publish_key = $this->bean->getPreference('calendar_publish_key' );
435
+        $this->ss->assign("REMINDER_TABINDEX", "12");
436
+        $publish_key = $this->bean->getPreference('calendar_publish_key' );
437 437
         $this->ss->assign('CALENDAR_PUBLISH_KEY', $publish_key);
438 438
 
439 439
         $publish_url = $sugar_config['site_url'].'/vcal_server.php';
Please login to merge, or discard this patch.
Braces   +14 added lines, -11 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         if (isset($GLOBALS['sugar_config']['show_download_tab'])) {
160 160
             $enable_download_tab = $GLOBALS['sugar_config']['show_download_tab'];
161
-        }else{
161
+        } else{
162 162
             $enable_download_tab = true;
163 163
         }
164 164
 
@@ -175,8 +175,7 @@  discard block
 block discarded – undo
175 175
             if ($this->bean->id == $current_user->id) {
176 176
                 $reset_pref_warning = translate('LBL_RESET_PREFERENCES_WARNING','Users');
177 177
                 $reset_home_warning = translate('LBL_RESET_HOMEPAGE_WARNING','Users');
178
-            }
179
-            else {
178
+            } else {
180 179
                 $reset_pref_warning = translate('LBL_RESET_PREFERENCES_WARNING_USER','Users');
181 180
                 $reset_home_warning = translate('LBL_RESET_HOMEPAGE_WARNING_USER','Users');
182 181
             }
@@ -193,8 +192,12 @@  discard block
 block discarded – undo
193 192
             $buttons_footer[]="<input type='button' class='button' id='reset_homepage_footer' onclick='if(confirm(\"{$reset_home_warning}\"))window.location=\"".$_SERVER['PHP_SELF'] .'?'.$the_query_string."&reset_homepage=true\";' value='".translate('LBL_RESET_HOMEPAGE','Users')."' />";
194 193
 
195 194
         }
196
-        if (isset($buttons_header)) $this->ss->assign("BUTTONS_HEADER", $buttons_header);
197
-        if (isset($buttons_footer)) $this->ss->assign("BUTTONS_FOOTER", $buttons_footer);
195
+        if (isset($buttons_header)) {
196
+            $this->ss->assign("BUTTONS_HEADER", $buttons_header);
197
+        }
198
+        if (isset($buttons_footer)) {
199
+            $this->ss->assign("BUTTONS_FOOTER", $buttons_footer);
200
+        }
198 201
 
199 202
 
200 203
 
@@ -388,7 +391,9 @@  discard block
 block discarded – undo
388 391
 
389 392
         $this->ss->assign('EXPORT_DELIMITER', $this->bean->getPreference('export_delimiter'));
390 393
 
391
-        if($this->bean->receive_notifications ||(!isset($this->bean->id) && $admin->settings['notify_send_by_default'])) $this->ss->assign("RECEIVE_NOTIFICATIONS", "checked");
394
+        if($this->bean->receive_notifications ||(!isset($this->bean->id) && $admin->settings['notify_send_by_default'])) {
395
+            $this->ss->assign("RECEIVE_NOTIFICATIONS", "checked");
396
+        }
392 397
 
393 398
         //jc:12293 - modifying to use the accessor method which will translate the
394 399
         //available character sets using the translation files
@@ -479,7 +484,7 @@  discard block
 block discarded – undo
479 484
             $this->ss->assign('EXTERNAL_AUTH_CLASS_1', $sugar_config['authenticationClass']);
480 485
             $this->ss->assign('EXTERNAL_AUTH_CLASS', $sugar_config['authenticationClass']);
481 486
             $authclass = $sugar_config['authenticationClass'];
482
-        }else{
487
+        } else{
483 488
             if(!empty($GLOBALS['system_config']->settings['system_ldap_enabled'])){
484 489
                 $this->ss->assign('EXTERNAL_AUTH_CLASS_1', translate('LBL_LDAP','Users'));
485 490
                 $this->ss
@@ -772,12 +777,10 @@  discard block
 block discarded – undo
772 777
         if ($user->is_admin)
773 778
         {
774 779
             $user->user_type = 'Administrator';
775
-        }
776
-        else if ($user->is_group)
780
+        } else if ($user->is_group)
777 781
         {
778 782
             $user->user_type = 'GROUP';
779
-        }
780
-        else
783
+        } else
781 784
         {
782 785
             $user->user_type = 'RegularUser';
783 786
         }
Please login to merge, or discard this patch.
Spacing   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * Constructor, pass in the smarty template, the bean and the viewtype
81 81
      */
82
-    public function __construct(Sugar_Smarty &$smarty, SugarBean &$bean, $viewType = 'EditView' ) {
82
+    public function __construct(Sugar_Smarty & $smarty, SugarBean & $bean, $viewType = 'EditView') {
83 83
         $this->ss = $smarty;
84 84
         $this->bean = $bean;
85 85
         $this->viewType = $viewType;
@@ -103,37 +103,37 @@  discard block
 block discarded – undo
103 103
         global $current_user, $app_list_strings;
104 104
 
105 105
         // There is a lot of extra stuff that needs to go in here to properly render
106
-        $this->is_current_admin=is_admin($current_user)
106
+        $this->is_current_admin = is_admin($current_user)
107 107
             ||$current_user->isAdminForModule('Users');
108 108
         $this->is_super_admin = is_admin($current_user);
109 109
 
110
-        $this->usertype='REGULAR';
111
-        if($this->is_super_admin){
112
-            $this->usertype='Administrator';
110
+        $this->usertype = 'REGULAR';
111
+        if ($this->is_super_admin) {
112
+            $this->usertype = 'Administrator';
113 113
         }
114 114
 
115 115
 
116 116
         // check if the user has access to the User Management
117
-        $this->ss->assign('USER_ADMIN',$current_user->isAdminForModule('Users')&& !is_admin($current_user));
117
+        $this->ss->assign('USER_ADMIN', $current_user->isAdminForModule('Users') && !is_admin($current_user));
118 118
 
119 119
 
120 120
         if ($this->is_current_admin) {
121
-            $this->ss->assign('IS_ADMIN','1');
121
+            $this->ss->assign('IS_ADMIN', '1');
122 122
         } else {
123 123
             $this->ss->assign('IS_ADMIN', '0');
124 124
         }
125 125
 
126 126
         if ($this->is_super_admin) {
127
-            $this->ss->assign('IS_SUPER_ADMIN','1');
127
+            $this->ss->assign('IS_SUPER_ADMIN', '1');
128 128
         } else {
129 129
             $this->ss->assign('IS_SUPER_ADMIN', '0');
130 130
         }
131 131
 
132 132
         $this->ss->assign('IS_PORTALONLY', '0');
133 133
         $this->ss->assign('IS_GROUP', '0');
134
-        if((!empty($this->bean->is_group) && $this->bean->is_group)  || (isset($_REQUEST['usertype']) && $_REQUEST['usertype']=='group')){
134
+        if ((!empty($this->bean->is_group) && $this->bean->is_group) || (isset($_REQUEST['usertype']) && $_REQUEST['usertype'] == 'group')) {
135 135
             $this->ss->assign('IS_GROUP', '1');
136
-            $this->usertype='GROUP';
136
+            $this->usertype = 'GROUP';
137 137
         }
138 138
 
139 139
 
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 
145 145
         $this->ss->assign('IS_FOCUS_ADMIN', is_admin($this->bean));
146 146
 
147
-        if($edit_self) {
148
-            $this->ss->assign('EDIT_SELF','1');
147
+        if ($edit_self) {
148
+            $this->ss->assign('EDIT_SELF', '1');
149 149
         }
150
-        if($admin_edit_self) {
151
-            $this->ss->assign('ADMIN_EDIT_SELF','1');
150
+        if ($admin_edit_self) {
151
+            $this->ss->assign('ADMIN_EDIT_SELF', '1');
152 152
         }
153 153
 
154 154
     }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
         if (isset($GLOBALS['sugar_config']['show_download_tab'])) {
160 160
             $enable_download_tab = $GLOBALS['sugar_config']['show_download_tab'];
161
-        }else{
161
+        } else {
162 162
             $enable_download_tab = true;
163 163
         }
164 164
 
@@ -166,31 +166,31 @@  discard block
 block discarded – undo
166 166
 
167 167
 
168 168
         $the_query_string = 'module=Users&action=DetailView';
169
-        if(isset($_REQUEST['record'])) {
169
+        if (isset($_REQUEST['record'])) {
170 170
             $the_query_string .= '&record='.$_REQUEST['record'];
171 171
         }
172 172
         $buttons_header = array();
173 173
         $buttons_footer = array();
174
-        if (!$this->bean->is_group){
174
+        if (!$this->bean->is_group) {
175 175
             if ($this->bean->id == $current_user->id) {
176
-                $reset_pref_warning = translate('LBL_RESET_PREFERENCES_WARNING','Users');
177
-                $reset_home_warning = translate('LBL_RESET_HOMEPAGE_WARNING','Users');
176
+                $reset_pref_warning = translate('LBL_RESET_PREFERENCES_WARNING', 'Users');
177
+                $reset_home_warning = translate('LBL_RESET_HOMEPAGE_WARNING', 'Users');
178 178
             }
179 179
             else {
180
-                $reset_pref_warning = translate('LBL_RESET_PREFERENCES_WARNING_USER','Users');
181
-                $reset_home_warning = translate('LBL_RESET_HOMEPAGE_WARNING_USER','Users');
180
+                $reset_pref_warning = translate('LBL_RESET_PREFERENCES_WARNING_USER', 'Users');
181
+                $reset_home_warning = translate('LBL_RESET_HOMEPAGE_WARNING_USER', 'Users');
182 182
             }
183 183
 
184 184
             //bug 48170
185 185
             $user_preference_url = "module=Users&action=resetPreferences";
186
-            if(isset($_REQUEST['record'])){
186
+            if (isset($_REQUEST['record'])) {
187 187
                 $user_preference_url .= "&record=".$_REQUEST['record'];
188 188
             }
189
-            $buttons_header[]="<input type='button' class='button' id='reset_user_preferences_header' onclick='if(confirm(\"{$reset_pref_warning}\"))window.location=\"".$_SERVER['PHP_SELF'] .'?'.$user_preference_url."&reset_preferences=true\";' value='".translate('LBL_RESET_PREFERENCES','Users')."' />";
190
-            $buttons_header[]="<input type='button' class='button' id='reset_homepage_header' onclick='if(confirm(\"{$reset_home_warning}\"))window.location=\"".$_SERVER['PHP_SELF'] .'?'.$the_query_string."&reset_homepage=true\";' value='".translate('LBL_RESET_HOMEPAGE','Users')."' />";
189
+            $buttons_header[] = "<input type='button' class='button' id='reset_user_preferences_header' onclick='if(confirm(\"{$reset_pref_warning}\"))window.location=\"".$_SERVER['PHP_SELF'].'?'.$user_preference_url."&reset_preferences=true\";' value='".translate('LBL_RESET_PREFERENCES', 'Users')."' />";
190
+            $buttons_header[] = "<input type='button' class='button' id='reset_homepage_header' onclick='if(confirm(\"{$reset_home_warning}\"))window.location=\"".$_SERVER['PHP_SELF'].'?'.$the_query_string."&reset_homepage=true\";' value='".translate('LBL_RESET_HOMEPAGE', 'Users')."' />";
191 191
 
192
-            $buttons_footer[]="<input type='button' class='button' id='reset_user_preferences_footer' onclick='if(confirm(\"{$reset_pref_warning}\"))window.location=\"".$_SERVER['PHP_SELF'] .'?'.$user_preference_url."&reset_preferences=true\";' value='".translate('LBL_RESET_PREFERENCES','Users')."' />";
193
-            $buttons_footer[]="<input type='button' class='button' id='reset_homepage_footer' onclick='if(confirm(\"{$reset_home_warning}\"))window.location=\"".$_SERVER['PHP_SELF'] .'?'.$the_query_string."&reset_homepage=true\";' value='".translate('LBL_RESET_HOMEPAGE','Users')."' />";
192
+            $buttons_footer[] = "<input type='button' class='button' id='reset_user_preferences_footer' onclick='if(confirm(\"{$reset_pref_warning}\"))window.location=\"".$_SERVER['PHP_SELF'].'?'.$user_preference_url."&reset_preferences=true\";' value='".translate('LBL_RESET_PREFERENCES', 'Users')."' />";
193
+            $buttons_footer[] = "<input type='button' class='button' id='reset_homepage_footer' onclick='if(confirm(\"{$reset_home_warning}\"))window.location=\"".$_SERVER['PHP_SELF'].'?'.$the_query_string."&reset_homepage=true\";' value='".translate('LBL_RESET_HOMEPAGE', 'Users')."' />";
194 194
 
195 195
         }
196 196
         if (isset($buttons_header)) $this->ss->assign("BUTTONS_HEADER", $buttons_header);
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
 
201 201
         if (isset($this->bean->id)) {
202
-            $this->ss->assign('ID',$this->bean->id);
202
+            $this->ss->assign('ID', $this->bean->id);
203 203
         }
204 204
 
205 205
     }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 
218 218
 
219 219
         //if this is an existing bean and the type is empty, then populate user type
220
-        if(!empty($this->bean->id) && empty($this->bean->user_type))
220
+        if (!empty($this->bean->id) && empty($this->bean->user_type))
221 221
 	    {
222 222
             $this->setUserType($this->bean);
223 223
             $userType = $this->bean->user_type;
@@ -228,27 +228,27 @@  discard block
 block discarded – undo
228 228
         $availableUserTypes = array();
229 229
         $userTypes = array(
230 230
             'RegularUser' => array(
231
-                'label' => translate('LBL_REGULAR_USER','Users'),
232
-                'description' => translate('LBL_REGULAR_DESC','Users'),
231
+                'label' => translate('LBL_REGULAR_USER', 'Users'),
232
+                'description' => translate('LBL_REGULAR_DESC', 'Users'),
233 233
             ),
234 234
             'GROUP' => array(
235
-                'label' => translate('LBL_GROUP_USER','Users'),
236
-                'description' => translate('LBL_GROUP_DESC','Users'),
235
+                'label' => translate('LBL_GROUP_USER', 'Users'),
236
+                'description' => translate('LBL_GROUP_DESC', 'Users'),
237 237
             ),
238 238
             'Administrator' => array(
239
-                'label' => translate('LBL_ADMIN_USER','Users'),
240
-                'description' => translate('LBL_ADMIN_DESC','Users'),
239
+                'label' => translate('LBL_ADMIN_USER', 'Users'),
240
+                'description' => translate('LBL_ADMIN_DESC', 'Users'),
241 241
             ),
242 242
         );
243 243
 
244
-        if ( $userType == 'GROUP' || $userType == 'PORTAL_ONLY' ) {
244
+        if ($userType == 'GROUP' || $userType == 'PORTAL_ONLY') {
245 245
             $availableUserTypes = array($this->usertype);
246 246
         } else {
247
-            if ( $this->ss->get_template_vars('USER_ADMIN') ) {
247
+            if ($this->ss->get_template_vars('USER_ADMIN')) {
248 248
                 $availableUserTypes = array('RegularUser');
249
-            } elseif($this->ss->get_template_vars('ADMIN_EDIT_SELF')) {
249
+            } elseif ($this->ss->get_template_vars('ADMIN_EDIT_SELF')) {
250 250
                 $availableUserTypes = array('Administrator');
251
-            } elseif($this->ss->get_template_vars('IS_SUPER_ADMIN')) {
251
+            } elseif ($this->ss->get_template_vars('IS_SUPER_ADMIN')) {
252 252
                 $availableUserTypes = array(
253 253
                     'RegularUser',
254 254
                     'Administrator',
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         }
260 260
 
261 261
         $userTypeDropdown = '<select id="UserType" name="UserType" onchange="user_status_display(this);" ';
262
-        if ( count($availableUserTypes) == 1 ) {
262
+        if (count($availableUserTypes) == 1) {
263 263
             $userTypeDropdown .= ' disabled ';
264 264
         }
265 265
         $userTypeDropdown .= '>';
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 
269 269
         $setSelected = !empty($this->bean->id);
270 270
 
271
-        foreach ( $availableUserTypes as $currType ) {
272
-            if ($setSelected && $currType == $userType ) {
271
+        foreach ($availableUserTypes as $currType) {
272
+            if ($setSelected && $currType == $userType) {
273 273
                 $userTypeDropdown .= '<option value="'.$currType.'" SELECTED>'.$userTypes[$currType]['label'].'</option>';
274 274
             } else {
275 275
                 $userTypeDropdown .= '<option value="'.$currType.'">'.$userTypes[$currType]['label'].'</option>';
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
         }
278 278
         $userTypeDropdown .= '</select><div id="UserTypeDesc">&nbsp;</div>';
279 279
 
280
-        $this->ss->assign('USER_TYPE_DROPDOWN',$userTypeDropdown);
281
-        $this->ss->assign('USER_TYPE_READONLY',$userTypes[$userType]['label'] . "<input type='hidden' id='UserType' value='{$userType}'><div id='UserTypeDesc'>&nbsp;</div>");
280
+        $this->ss->assign('USER_TYPE_DROPDOWN', $userTypeDropdown);
281
+        $this->ss->assign('USER_TYPE_READONLY', $userTypes[$userType]['label']."<input type='hidden' id='UserType' value='{$userType}'><div id='UserTypeDesc'>&nbsp;</div>");
282 282
 
283 283
     }
284 284
 
@@ -288,48 +288,48 @@  discard block
 block discarded – undo
288 288
         $this->ss->assign('PWDSETTINGS', isset($GLOBALS['sugar_config']['passwordsetting']) ? $GLOBALS['sugar_config']['passwordsetting'] : array());
289 289
 
290 290
 
291
-        $enable_syst_generate_pwd=false;
292
-        if(isset($GLOBALS['sugar_config']['passwordsetting']) && isset($GLOBALS['sugar_config']['passwordsetting']['SystemGeneratedPasswordON'])){
293
-            $enable_syst_generate_pwd=$GLOBALS['sugar_config']['passwordsetting']['SystemGeneratedPasswordON'];
291
+        $enable_syst_generate_pwd = false;
292
+        if (isset($GLOBALS['sugar_config']['passwordsetting']) && isset($GLOBALS['sugar_config']['passwordsetting']['SystemGeneratedPasswordON'])) {
293
+            $enable_syst_generate_pwd = $GLOBALS['sugar_config']['passwordsetting']['SystemGeneratedPasswordON'];
294 294
         }
295 295
 
296 296
         // If new regular user without system generated password or new portal user
297
-        if(((isset($enable_syst_generate_pwd) && !$enable_syst_generate_pwd && $this->usertype!='GROUP') || $this->usertype =='PORTAL_ONLY') && empty($this->bean->id)) {
298
-            $this->ss->assign('REQUIRED_PASSWORD','1');
297
+        if (((isset($enable_syst_generate_pwd) && !$enable_syst_generate_pwd && $this->usertype != 'GROUP') || $this->usertype == 'PORTAL_ONLY') && empty($this->bean->id)) {
298
+            $this->ss->assign('REQUIRED_PASSWORD', '1');
299 299
         } else {
300
-            $this->ss->assign('REQUIRED_PASSWORD','0');
300
+            $this->ss->assign('REQUIRED_PASSWORD', '0');
301 301
         }
302 302
 
303 303
         // If my account page or portal only user or regular user without system generated password or a duplicate user
304
-        if((($current_user->id == $this->bean->id) || $this->usertype=='PORTAL_ONLY' || (($this->usertype=='REGULAR' || $this->usertype == 'Administrator' || (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true' && $this->usertype!='GROUP')) && !$enable_syst_generate_pwd)) && !$this->bean->external_auth_only ) {
304
+        if ((($current_user->id == $this->bean->id) || $this->usertype == 'PORTAL_ONLY' || (($this->usertype == 'REGULAR' || $this->usertype == 'Administrator' || (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true' && $this->usertype != 'GROUP')) && !$enable_syst_generate_pwd)) && !$this->bean->external_auth_only) {
305 305
             $this->ss->assign('CHANGE_PWD', '1');
306 306
         } else {
307 307
             $this->ss->assign('CHANGE_PWD', '0');
308 308
         }
309 309
 
310 310
         // Make sure group users don't get a password change prompt
311
-        if ( $this->usertype == 'GROUP' ) {
311
+        if ($this->usertype == 'GROUP') {
312 312
             $this->ss->assign('CHANGE_PWD', '0');
313 313
         }
314 314
 
315 315
         $configurator = new Configurator();
316
-        if ( isset($configurator->config['passwordsetting'])
316
+        if (isset($configurator->config['passwordsetting'])
317 317
              && ($configurator->config['passwordsetting']['SystemGeneratedPasswordON']
318 318
                  || $configurator->config['passwordsetting']['forgotpasswordON'])
319
-             && $this->usertype != 'GROUP' && $this->usertype != 'PORTAL_ONLY' ) {
320
-            $this->ss->assign('REQUIRED_EMAIL_ADDRESS','1');
319
+             && $this->usertype != 'GROUP' && $this->usertype != 'PORTAL_ONLY') {
320
+            $this->ss->assign('REQUIRED_EMAIL_ADDRESS', '1');
321 321
         } else {
322
-            $this->ss->assign('REQUIRED_EMAIL_ADDRESS','0');
322
+            $this->ss->assign('REQUIRED_EMAIL_ADDRESS', '0');
323 323
         }
324
-        if($this->usertype=='GROUP' || $this->usertype=='PORTAL_ONLY') {
324
+        if ($this->usertype == 'GROUP' || $this->usertype == 'PORTAL_ONLY') {
325 325
             $this->ss->assign('HIDE_FOR_GROUP_AND_PORTAL', 'none');
326
-            $this->ss->assign('HIDE_CHANGE_USERTYPE','none');
326
+            $this->ss->assign('HIDE_CHANGE_USERTYPE', 'none');
327 327
         } else {
328
-            $this->ss->assign('HIDE_FOR_NORMAL_AND_ADMIN','none');
328
+            $this->ss->assign('HIDE_FOR_NORMAL_AND_ADMIN', 'none');
329 329
             if (!$this->is_current_admin) {
330
-                $this->ss->assign('HIDE_CHANGE_USERTYPE','none');
330
+                $this->ss->assign('HIDE_CHANGE_USERTYPE', 'none');
331 331
             } else {
332
-                $this->ss->assign('HIDE_STATIC_USERTYPE','none');
332
+                $this->ss->assign('HIDE_STATIC_USERTYPE', 'none');
333 333
             }
334 334
         }
335 335
 
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
 
338 338
     protected function setupThemeTab() {
339 339
         $user_theme = $this->bean->getPreference('user_theme');
340
-        if(isset($user_theme)) {
340
+        if (isset($user_theme)) {
341 341
             $this->ss->assign("THEMES", get_select_options_with_id(SugarThemeRegistry::availableThemes(), $user_theme));
342 342
         } else {
343 343
             $this->ss->assign("THEMES", get_select_options_with_id(SugarThemeRegistry::availableThemes(), $GLOBALS['sugar_config']['default_theme']));
344 344
         }
345
-        $this->ss->assign("SHOW_THEMES",count(SugarThemeRegistry::availableThemes()) > 1);
345
+        $this->ss->assign("SHOW_THEMES", count(SugarThemeRegistry::availableThemes()) > 1);
346 346
         $this->ss->assign("USER_THEME_COLOR", $this->bean->getPreference('user_theme_color'));
347 347
         $this->ss->assign("USER_THEME_FONT", $this->bean->getPreference('user_theme_font'));
348 348
         $this->ss->assign("USER_THEME", $user_theme);
@@ -351,25 +351,25 @@  discard block
 block discarded – undo
351 351
         $this->ss->assign("DISPLAY_GROUP_TAB", 'none');
352 352
 
353 353
         $selectedTheme = $user_theme;
354
-        if(!isset($user_theme)) {
354
+        if (!isset($user_theme)) {
355 355
             $selectedTheme = $GLOBALS['sugar_config']['default_theme'];
356 356
         }
357 357
 
358 358
         $themeList = SugarThemeRegistry::availableThemes();
359 359
         $themeGroupList = array();
360 360
 
361
-        foreach ( $themeList as $themeId => $themeName ) {
361
+        foreach ($themeList as $themeId => $themeName) {
362 362
             $currThemeObj = SugarThemeRegistry::get($themeId);
363
-            if ( isset($currThemeObj->group_tabs) && $currThemeObj->group_tabs == 1 ) {
363
+            if (isset($currThemeObj->group_tabs) && $currThemeObj->group_tabs == 1) {
364 364
                 $themeGroupList[$themeId] = true;
365
-                if ( $themeId == $selectedTheme ) {
365
+                if ($themeId == $selectedTheme) {
366 366
                     $this->ss->assign("DISPLAY_GROUP_TAB", '');
367 367
                 }
368 368
             } else {
369 369
                 $themeGroupList[$themeId] = false;
370 370
             }
371 371
         }
372
-        $this->ss->assign("themeGroupListJSON",json_encode($themeGroupList));
372
+        $this->ss->assign("themeGroupListJSON", json_encode($themeGroupList));
373 373
 
374 374
     }
375 375
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
         $this->ss->assign('EXPORT_DELIMITER', $this->bean->getPreference('export_delimiter'));
390 390
 
391
-        if($this->bean->receive_notifications ||(!isset($this->bean->id) && $admin->settings['notify_send_by_default'])) $this->ss->assign("RECEIVE_NOTIFICATIONS", "checked");
391
+        if ($this->bean->receive_notifications || (!isset($this->bean->id) && $admin->settings['notify_send_by_default'])) $this->ss->assign("RECEIVE_NOTIFICATIONS", "checked");
392 392
 
393 393
         //jc:12293 - modifying to use the accessor method which will translate the
394 394
         //available character sets using the translation files
@@ -398,28 +398,28 @@  discard block
 block discarded – undo
398 398
         $this->ss->assign('EXPORT_CHARSET_DISPLAY', $export_charset);
399 399
         //end:12293
400 400
 
401
-        if( $this->bean->getPreference('use_real_names') == 'on'
402
-            || ( empty($this->bean->id)
401
+        if ($this->bean->getPreference('use_real_names') == 'on'
402
+            || (empty($this->bean->id)
403 403
                  && isset($GLOBALS['sugar_config']['use_real_names'])
404 404
                  && $GLOBALS['sugar_config']['use_real_names']
405
-                 && $this->bean->getPreference('use_real_names') != 'off') ) {
405
+                 && $this->bean->getPreference('use_real_names') != 'off')) {
406 406
             $this->ss->assign('USE_REAL_NAMES', 'CHECKED');
407 407
         }
408 408
 
409
-        if($this->bean->getPreference('mailmerge_on') == 'on') {
409
+        if ($this->bean->getPreference('mailmerge_on') == 'on') {
410 410
             $this->ss->assign('MAILMERGE_ON', 'checked');
411 411
         }
412 412
 
413
-        if($this->bean->getPreference('no_opps') == 'on') {
413
+        if ($this->bean->getPreference('no_opps') == 'on') {
414 414
             $this->ss->assign('NO_OPPS', 'CHECKED');
415 415
         }
416 416
 
417 417
 	    $reminder_time = $this->bean->getPreference('reminder_time');
418
-	    if(empty($reminder_time)){
418
+	    if (empty($reminder_time)) {
419 419
 		    $reminder_time = -1;
420 420
 	    }
421 421
 	    $email_reminder_time = $this->bean->getPreference('email_reminder_time');
422
-	    if(empty($email_reminder_time)){
422
+	    if (empty($email_reminder_time)) {
423 423
 		    $email_reminder_time = -1;
424 424
 	    }
425 425
 		
@@ -433,29 +433,29 @@  discard block
 block discarded – undo
433 433
 	    $this->ss->assign("EMAIL_REMINDER_CHECKED", $remindersDefaultPreferences['email']);
434 434
 		
435 435
 	    $this->ss->assign("REMINDER_TABINDEX", "12");
436
-	    $publish_key = $this->bean->getPreference('calendar_publish_key' );
436
+	    $publish_key = $this->bean->getPreference('calendar_publish_key');
437 437
         $this->ss->assign('CALENDAR_PUBLISH_KEY', $publish_key);
438 438
 
439 439
         $publish_url = $sugar_config['site_url'].'/vcal_server.php';
440 440
         $token = "/";
441 441
         //determine if the web server is running IIS
442 442
         //if so then change the publish url
443
-        if(isset($_SERVER) && !empty($_SERVER['SERVER_SOFTWARE'])){
443
+        if (isset($_SERVER) && !empty($_SERVER['SERVER_SOFTWARE'])) {
444 444
             $position = strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'iis');
445
-            if($position !== false){
445
+            if ($position !== false) {
446 446
                 $token = '?parms=';
447 447
             }
448 448
         }
449 449
 
450 450
         $publish_url .= $token."type=vfb&source=outlook&key=<span id=\"cal_pub_key_span\">$publish_key</span>";
451
-        if (! empty($this->bean->email1)) {
451
+        if (!empty($this->bean->email1)) {
452 452
             $publish_url .= '&email='.$this->bean->email1;
453 453
         } else {
454 454
             $publish_url .= '&user_name='.$this->bean->user_name;
455 455
         }
456 456
 
457 457
         $ical_url = $sugar_config['site_url']."/ical_server.php?type=ics&key=<span id=\"ical_pub_key_span\">$publish_key</span>";
458
-        if (! empty($this->bean->email1))
458
+        if (!empty($this->bean->email1))
459 459
         {
460 460
             $ical_url .= '&email='.$this->bean->email1;
461 461
         } else
@@ -475,24 +475,24 @@  discard block
 block discarded – undo
475 475
         global $sugar_config;
476 476
 
477 477
         $authclass = '';
478
-        if(!empty($sugar_config['authenticationClass'])){
478
+        if (!empty($sugar_config['authenticationClass'])) {
479 479
             $this->ss->assign('EXTERNAL_AUTH_CLASS_1', $sugar_config['authenticationClass']);
480 480
             $this->ss->assign('EXTERNAL_AUTH_CLASS', $sugar_config['authenticationClass']);
481 481
             $authclass = $sugar_config['authenticationClass'];
482
-        }else{
483
-            if(!empty($GLOBALS['system_config']->settings['system_ldap_enabled'])){
484
-                $this->ss->assign('EXTERNAL_AUTH_CLASS_1', translate('LBL_LDAP','Users'));
482
+        } else {
483
+            if (!empty($GLOBALS['system_config']->settings['system_ldap_enabled'])) {
484
+                $this->ss->assign('EXTERNAL_AUTH_CLASS_1', translate('LBL_LDAP', 'Users'));
485 485
                 $this->ss
486
-                        ->assign('EXTERNAL_AUTH_CLASS', translate('LBL_LDAP_AUTHENTICATION','Users'));
486
+                        ->assign('EXTERNAL_AUTH_CLASS', translate('LBL_LDAP_AUTHENTICATION', 'Users'));
487 487
                 $authclass = 'LDAPAuthenticate';
488 488
             }
489 489
         }
490
-        if(!empty($this->bean->external_auth_only)) {
490
+        if (!empty($this->bean->external_auth_only)) {
491 491
             $this->ss->assign('EXTERNAL_AUTH_ONLY_CHECKED', 'CHECKED');
492 492
         }
493 493
 
494
-        if($this->is_super_admin && !empty($authclass)) {
495
-            $this->ss->assign('DISPLAY_EXTERNAL_AUTH',true);
494
+        if ($this->is_super_admin && !empty($authclass)) {
495
+            $this->ss->assign('DISPLAY_EXTERNAL_AUTH', true);
496 496
         }
497 497
 
498 498
     }
@@ -502,19 +502,19 @@  discard block
 block discarded – undo
502 502
 
503 503
         // Grouped tabs?
504 504
         $useGroupTabs = $this->bean->getPreference('navigation_paradigm');
505
-        if ( ! isset($useGroupTabs) ) {
506
-            if ( ! isset($GLOBALS['sugar_config']['default_navigation_paradigm']) ) {
505
+        if (!isset($useGroupTabs)) {
506
+            if (!isset($GLOBALS['sugar_config']['default_navigation_paradigm'])) {
507 507
                 $GLOBALS['sugar_config']['default_navigation_paradigm'] = 'gm';
508 508
             }
509 509
             $useGroupTabs = $GLOBALS['sugar_config']['default_navigation_paradigm'];
510 510
         }
511
-        $this->ss->assign("USE_GROUP_TABS",($useGroupTabs=='gm')?'checked':'');
511
+        $this->ss->assign("USE_GROUP_TABS", ($useGroupTabs == 'gm') ? 'checked' : '');
512 512
 
513 513
         $user_subpanel_tabs = $this->bean->getPreference('subpanel_tabs');
514
-        if(isset($user_subpanel_tabs)) {
515
-            $this->ss->assign("SUBPANEL_TABS", $user_subpanel_tabs?'checked':'');
514
+        if (isset($user_subpanel_tabs)) {
515
+            $this->ss->assign("SUBPANEL_TABS", $user_subpanel_tabs ? 'checked' : '');
516 516
         } else {
517
-            $this->ss->assign("SUBPANEL_TABS", $GLOBALS['sugar_config']['default_subpanel_tabs']?'checked':'');
517
+            $this->ss->assign("SUBPANEL_TABS", $GLOBALS['sugar_config']['default_subpanel_tabs'] ? 'checked' : '');
518 518
         }
519 519
 
520 520
         /* Module Tab Chooser */
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
         $controller = new TabController();
525 525
 
526 526
 
527
-        if($this->is_current_admin || $controller->get_users_can_edit()) {
527
+        if ($this->is_current_admin || $controller->get_users_can_edit()) {
528 528
             $chooser->display_hide_tabs = true;
529 529
         } else {
530 530
             $chooser->display_hide_tabs = false;
@@ -532,29 +532,29 @@  discard block
 block discarded – undo
532 532
 
533 533
         $chooser->args['id'] = 'edit_tabs';
534 534
         $chooser->args['values_array'] = $controller->get_tabs($this->bean);
535
-        foreach($chooser->args['values_array'][0] as $key=>$value) {
535
+        foreach ($chooser->args['values_array'][0] as $key=>$value) {
536 536
             $chooser->args['values_array'][0][$key] = $app_list_strings['moduleList'][$key];
537 537
         }
538 538
 
539
-        foreach($chooser->args['values_array'][1] as $key=>$value) {
539
+        foreach ($chooser->args['values_array'][1] as $key=>$value) {
540 540
             $chooser->args['values_array'][1][$key] = $app_list_strings['moduleList'][$key];
541 541
         }
542 542
 
543
-        foreach($chooser->args['values_array'][2] as $key=>$value) {
543
+        foreach ($chooser->args['values_array'][2] as $key=>$value) {
544 544
             $chooser->args['values_array'][2][$key] = $app_list_strings['moduleList'][$key];
545 545
         }
546 546
 
547 547
         $chooser->args['left_name'] = 'display_tabs';
548 548
         $chooser->args['right_name'] = 'hide_tabs';
549 549
 
550
-        $chooser->args['left_label'] =  translate('LBL_DISPLAY_TABS','Users');
551
-        $chooser->args['right_label'] =  translate('LBL_HIDE_TABS','Users');
550
+        $chooser->args['left_label'] = translate('LBL_DISPLAY_TABS', 'Users');
551
+        $chooser->args['right_label'] = translate('LBL_HIDE_TABS', 'Users');
552 552
         require_once('include/Smarty/plugins/function.sugar_help.php');
553
-        $chooser->args['title'] =  translate('LBL_EDIT_TABS','Users').smarty_function_sugar_help(array("text"=>translate('LBL_CHOOSE_WHICH','Users')),$ss);
553
+        $chooser->args['title'] = translate('LBL_EDIT_TABS', 'Users').smarty_function_sugar_help(array("text"=>translate('LBL_CHOOSE_WHICH', 'Users')), $ss);
554 554
 
555 555
         $this->ss->assign('TAB_CHOOSER', $chooser->display());
556
-        $this->ss->assign('CHOOSER_SCRIPT','set_chooser();');
557
-        $this->ss->assign('CHOOSE_WHICH', translate('LBL_CHOOSE_WHICH','Users'));
556
+        $this->ss->assign('CHOOSER_SCRIPT', 'set_chooser();');
557
+        $this->ss->assign('CHOOSE_WHICH', translate('LBL_CHOOSE_WHICH', 'Users'));
558 558
 
559 559
     }
560 560
 
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
         ///////////////////////////////////////////////////////////////////////////////
565 565
         ////	LOCALE SETTINGS
566 566
         ////	Date/time format
567
-        $dformat = $locale->getPrecedentPreference($this->bean->id?'datef':'default_date_format', $this->bean);
568
-        $tformat = $locale->getPrecedentPreference($this->bean->id?'timef':'default_time_format', $this->bean);
567
+        $dformat = $locale->getPrecedentPreference($this->bean->id ? 'datef' : 'default_date_format', $this->bean);
568
+        $tformat = $locale->getPrecedentPreference($this->bean->id ? 'timef' : 'default_time_format', $this->bean);
569 569
         $nformat = $locale->getPrecedentPreference('default_locale_name_format', $this->bean);
570 570
         if (!array_key_exists($nformat, $sugar_config['name_formats'])) {
571 571
             $nformat = $sugar_config['default_locale_name_format'];
@@ -581,18 +581,18 @@  discard block
 block discarded – undo
581 581
         $this->ss->assign('NAMEFORMAT', $sugar_config['name_formats'][$nformat]);
582 582
 
583 583
         //// Timezone
584
-        if(empty($this->bean->id)) { // remove default timezone for new users(set later)
584
+        if (empty($this->bean->id)) { // remove default timezone for new users(set later)
585 585
             $this->bean->user_preferences['timezone'] = '';
586 586
         }
587 587
 
588 588
         $userTZ = $this->bean->getPreference('timezone');
589 589
 
590
-        if(empty($userTZ) && !$this->bean->is_group && !$this->bean->portal_only) {
590
+        if (empty($userTZ) && !$this->bean->is_group && !$this->bean->portal_only) {
591 591
             $userTZ = TimeDate::guessTimezone();
592 592
             $this->bean->setPreference('timezone', $userTZ);
593 593
         }
594 594
 
595
-        if(!$this->bean->getPreference('ut')) {
595
+        if (!$this->bean->getPreference('ut')) {
596 596
             $this->ss->assign('PROMPTTZ', ' checked');
597 597
         }
598 598
         $this->ss->assign('TIMEZONE_CURRENT', $userTZ);
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
         $this->ss->assign("FDOWOPTIONS", $fdowDays);
611 611
         $currentFDOW = $this->bean->get_first_day_of_week();
612 612
 
613
-        if (!isset($currentFDOW)) {$currentFDOW = 0;}
613
+        if (!isset($currentFDOW)) {$currentFDOW = 0; }
614 614
         $this->ss->assign("FDOWCURRENT", $currentFDOW);
615 615
         $this->ss->assign("FDOWDISPLAY", $fdowDays[$currentFDOW]);
616 616
 
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
         // Euro or other type of currency then this setting would not apply as the
625 625
         // default because it was being overridden by US Dollars.
626 626
         $cur_id = $locale->getPrecedentPreference('currency', $this->bean);
627
-        if($cur_id) {
627
+        if ($cur_id) {
628 628
             $selectCurrency = $currency->getSelectOptions($cur_id);
629 629
             $this->ss->assign("CURRENCY", $selectCurrency);
630 630
         } else {
@@ -633,25 +633,25 @@  discard block
 block discarded – undo
633 633
         }
634 634
 
635 635
         $currencyList = array();
636
-        foreach($locale->currencies as $id => $val ) {
636
+        foreach ($locale->currencies as $id => $val) {
637 637
             $currencyList[$id] = $val['symbol'];
638 638
         }
639 639
         $currencySymbolJSON = json_encode($currencyList);
640 640
         $this->ss->assign('currencySymbolJSON', $currencySymbolJSON);
641 641
 
642 642
         $currencyDisplay = new Currency();
643
-        if(isset($cur_id) ) {
643
+        if (isset($cur_id)) {
644 644
             $currencyDisplay->retrieve($cur_id);
645
-            $this->ss->assign('CURRENCY_DISPLAY', $currencyDisplay->iso4217 .' '.$currencyDisplay->symbol );
645
+            $this->ss->assign('CURRENCY_DISPLAY', $currencyDisplay->iso4217.' '.$currencyDisplay->symbol);
646 646
         } else {
647
-            $this->ss->assign("CURRENCY_DISPLAY", $currencyDisplay->getDefaultISO4217() .' '.$currencyDisplay->getDefaultCurrencySymbol() );
647
+            $this->ss->assign("CURRENCY_DISPLAY", $currencyDisplay->getDefaultISO4217().' '.$currencyDisplay->getDefaultCurrencySymbol());
648 648
         }
649 649
 
650 650
         // fill significant digits dropdown
651 651
         $significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $this->bean);
652 652
         $sigDigits = '';
653
-        for($i=0; $i<=6; $i++) {
654
-            if($significantDigits == $i) {
653
+        for ($i = 0; $i <= 6; $i++) {
654
+            if ($significantDigits == $i) {
655 655
                 $sigDigits .= "<option value=\"$i\" selected=\"true\">$i</option>";
656 656
             } else {
657 657
                 $sigDigits .= "<option value=\"$i\">{$i}</option>";
@@ -663,8 +663,8 @@  discard block
 block discarded – undo
663 663
 
664 664
         $num_grp_sep = $this->bean->getPreference('num_grp_sep');
665 665
         $dec_sep = $this->bean->getPreference('dec_sep');
666
-        $this->ss->assign("NUM_GRP_SEP",(empty($num_grp_sep) ? $GLOBALS['sugar_config']['default_number_grouping_seperator'] : $num_grp_sep));
667
-        $this->ss->assign("DEC_SEP",(empty($dec_sep) ? $GLOBALS['sugar_config']['default_decimal_seperator'] : $dec_sep));
666
+        $this->ss->assign("NUM_GRP_SEP", (empty($num_grp_sep) ? $GLOBALS['sugar_config']['default_number_grouping_seperator'] : $num_grp_sep));
667
+        $this->ss->assign("DEC_SEP", (empty($dec_sep) ? $GLOBALS['sugar_config']['default_decimal_seperator'] : $dec_sep));
668 668
         $this->ss->assign('getNumberJs', $locale->getNumberJs());
669 669
 
670 670
         //// Name display format
@@ -685,28 +685,28 @@  discard block
 block discarded – undo
685 685
         ///////////////////////////////////////////////////////////////////////////////
686 686
         ////	EMAIL OPTIONS
687 687
         // We need to turn off the requiredness of emails if it is a group or portal user
688
-        if ($this->usertype == 'GROUP' || $this->usertype == 'PORTAL_ONLY' ) {
688
+        if ($this->usertype == 'GROUP' || $this->usertype == 'PORTAL_ONLY') {
689 689
             global $dictionary;
690 690
             $dictionary['User']['fields']['email1']['required'] = false;
691 691
         }
692 692
         // hack to disable email field being required if it shouldn't be required
693
-        if ( $this->ss->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0' ) {
693
+        if ($this->ss->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') {
694 694
             $GLOBALS['dictionary']['User']['fields']['email1']['required'] = false;
695 695
         }
696
-        $this->ss->assign("NEW_EMAIL",  '<span id="email_span">' . getEmailAddressWidget($this->bean, "email1", $this->bean->email1, $this->viewType) . '</span>');
696
+        $this->ss->assign("NEW_EMAIL", '<span id="email_span">'.getEmailAddressWidget($this->bean, "email1", $this->bean->email1, $this->viewType).'</span>');
697 697
         // hack to undo that previous hack
698
-        if ( $this->ss->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0' ) {
698
+        if ($this->ss->get_template_vars("REQUIRED_EMAIL_ADDRESS") == '0') {
699 699
             $GLOBALS['dictionary']['User']['fields']['email1']['required'] = true;
700 700
         }
701 701
         $raw_email_link_type = $this->bean->getPreference('email_link_type');
702
-        if ( $this->viewType == 'EditView' ) {
702
+        if ($this->viewType == 'EditView') {
703 703
             $this->ss->assign('EMAIL_LINK_TYPE', get_select_options_with_id($app_list_strings['dom_email_link_type'], $raw_email_link_type));
704 704
         } else {
705 705
             $this->ss->assign('EMAIL_LINK_TYPE', $app_list_strings['dom_email_link_type'][$raw_email_link_type]);
706 706
         }
707 707
 
708 708
         $rawEditorType = $this->bean->getEditorType();
709
-        if ( $this->viewType == 'EditView' ) {
709
+        if ($this->viewType == 'EditView') {
710 710
             $this->ss->assign('EDITOR_TYPE', get_select_options_with_id($app_list_strings['dom_editor_type'], $rawEditorType));
711 711
         } else {
712 712
             $this->ss->assign('EDITOR_TYPE', $app_list_strings['dom_editor_type'][$rawEditorType]);
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
         /////////////////////////////////////////////
719 719
         /// Handle email account selections for users
720 720
         /////////////////////////////////////////////
721
-        if( !($this->usertype=='GROUP' || $this->usertype=='PORTAL_ONLY') ) {
721
+        if (!($this->usertype == 'GROUP' || $this->usertype == 'PORTAL_ONLY')) {
722 722
             // email smtp
723 723
             $systemOutboundEmail = new OutboundEmail();
724 724
             $systemOutboundEmail = $systemOutboundEmail->getSystemMailerSettings();
@@ -729,20 +729,20 @@  discard block
 block discarded – undo
729 729
             $mail_smtpuser = "";
730 730
             $mail_smtppass = "";
731 731
             $mail_smtpdisplay = $systemOutboundEmail->mail_smtpdisplay;
732
-            $mail_smtpauth_req=true;
732
+            $mail_smtpauth_req = true;
733 733
 
734
-            if( !$systemOutboundEmail->isAllowUserAccessToSystemDefaultOutbound() ) {
734
+            if (!$systemOutboundEmail->isAllowUserAccessToSystemDefaultOutbound()) {
735 735
                 $mail_smtpauth_req = $systemOutboundEmail->mail_smtpauth_req;
736 736
                 $userOverrideOE = $systemOutboundEmail->getUsersMailerForSystemOverride($this->bean->id);
737
-                if($userOverrideOE != null) {
737
+                if ($userOverrideOE != null) {
738 738
                     $mail_smtpuser = $userOverrideOE->mail_smtpuser;
739 739
                     $mail_smtppass = $userOverrideOE->mail_smtppass;
740 740
                 }
741 741
 
742 742
 
743
-                if(!$mail_smtpauth_req && (empty($systemOutboundEmail->mail_smtpserver) || empty($systemOutboundEmail->mail_smtpuser) || empty($systemOutboundEmail->mail_smtppass))) {
743
+                if (!$mail_smtpauth_req && (empty($systemOutboundEmail->mail_smtpserver) || empty($systemOutboundEmail->mail_smtpuser) || empty($systemOutboundEmail->mail_smtppass))) {
744 744
                     $hide_if_can_use_default = true;
745
-                } else{
745
+                } else {
746 746
                     $hide_if_can_use_default = false;
747 747
                 }
748 748
             }
@@ -751,10 +751,10 @@  discard block
 block discarded – undo
751 751
             $this->ss->assign("mail_smtpserver", $mail_smtpserver);
752 752
             $this->ss->assign("mail_smtpuser", $mail_smtpuser);
753 753
             $this->ss->assign("mail_smtppass", "");
754
-            $this->ss->assign("mail_haspass", empty($systemOutboundEmail->mail_smtppass)?0:1);
754
+            $this->ss->assign("mail_haspass", empty($systemOutboundEmail->mail_smtppass) ? 0 : 1);
755 755
             $this->ss->assign("mail_smtpauth_req", $mail_smtpauth_req);
756
-            $this->ss->assign('MAIL_SMTPPORT',$mail_smtpport);
757
-            $this->ss->assign('MAIL_SMTPSSL',$mail_smtpssl);
756
+            $this->ss->assign('MAIL_SMTPPORT', $mail_smtpport);
757
+            $this->ss->assign('MAIL_SMTPSSL', $mail_smtpssl);
758 758
         }
759 759
     }
760 760
 
Please login to merge, or discard this patch.
ModuleInstall/PackageManager/PackageManagerDownloader.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -41,34 +41,34 @@
 block discarded – undo
41 41
 define('PACKAGE_MANAGER_DOWNLOAD_PAGE', 'download.php');
42 42
 class PackageManagerDownloader{
43 43
 
44
-	/**
45
-	 * Using curl we will download the file from the depot server
46
-	 *
47
-	 * @param session_id		the session_id this file is queued for
48
-	 * @param file_name			the file_name to download
49
-	 * @param save_dir			(optional) if specified it will direct where to save the file once downloaded
50
-	 * @param download_sever	(optional) if specified it will direct the url for the download
51
-	 *
52
-	 * @return the full path of the saved file
53
-	 */
54
-	function download($session_id, $file_name, $save_dir = '', $download_server = ''){
55
-		if(empty($save_dir)){
56
-			$save_dir = "upload://";
57
-		}
58
-		if(empty($download_server)){
59
-			$download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER;
60
-		}
61
-		$download_server .= PACKAGE_MANAGER_DOWNLOAD_PAGE;
62
-		$ch = curl_init($download_server . '?filename='. $file_name);
63
-		$fp = sugar_fopen($save_dir . $file_name, 'w');
64
-		curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$session_id. ';');
65
-		curl_setopt($ch, CURLOPT_FILE, $fp);
66
-		curl_setopt($ch, CURLOPT_HEADER, 0);
67
-		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
68
-		curl_exec($ch);
69
-		curl_close($ch);
70
-		fclose($fp);
71
-		return $save_dir . $file_name;
72
-	}
44
+    /**
45
+     * Using curl we will download the file from the depot server
46
+     *
47
+     * @param session_id		the session_id this file is queued for
48
+     * @param file_name			the file_name to download
49
+     * @param save_dir			(optional) if specified it will direct where to save the file once downloaded
50
+     * @param download_sever	(optional) if specified it will direct the url for the download
51
+     *
52
+     * @return the full path of the saved file
53
+     */
54
+    function download($session_id, $file_name, $save_dir = '', $download_server = ''){
55
+        if(empty($save_dir)){
56
+            $save_dir = "upload://";
57
+        }
58
+        if(empty($download_server)){
59
+            $download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER;
60
+        }
61
+        $download_server .= PACKAGE_MANAGER_DOWNLOAD_PAGE;
62
+        $ch = curl_init($download_server . '?filename='. $file_name);
63
+        $fp = sugar_fopen($save_dir . $file_name, 'w');
64
+        curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$session_id. ';');
65
+        curl_setopt($ch, CURLOPT_FILE, $fp);
66
+        curl_setopt($ch, CURLOPT_HEADER, 0);
67
+        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
68
+        curl_exec($ch);
69
+        curl_close($ch);
70
+        fclose($fp);
71
+        return $save_dir . $file_name;
72
+    }
73 73
 }
74 74
 ?>
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
 define('PACKAGE_MANAGER_DOWNLOAD_SERVER', 'https://depot.sugarcrm.com/depot/');
41 41
 define('PACKAGE_MANAGER_DOWNLOAD_PAGE', 'download.php');
42
-class PackageManagerDownloader{
42
+class PackageManagerDownloader {
43 43
 
44 44
 	/**
45 45
 	 * Using curl we will download the file from the depot server
@@ -51,24 +51,24 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @return the full path of the saved file
53 53
 	 */
54
-	function download($session_id, $file_name, $save_dir = '', $download_server = ''){
55
-		if(empty($save_dir)){
54
+	function download($session_id, $file_name, $save_dir = '', $download_server = '') {
55
+		if (empty($save_dir)) {
56 56
 			$save_dir = "upload://";
57 57
 		}
58
-		if(empty($download_server)){
58
+		if (empty($download_server)) {
59 59
 			$download_server = PACKAGE_MANAGER_DOWNLOAD_SERVER;
60 60
 		}
61 61
 		$download_server .= PACKAGE_MANAGER_DOWNLOAD_PAGE;
62
-		$ch = curl_init($download_server . '?filename='. $file_name);
63
-		$fp = sugar_fopen($save_dir . $file_name, 'w');
64
-		curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$session_id. ';');
62
+		$ch = curl_init($download_server.'?filename='.$file_name);
63
+		$fp = sugar_fopen($save_dir.$file_name, 'w');
64
+		curl_setopt($ch, CURLOPT_COOKIE, 'PHPSESSID='.$session_id.';');
65 65
 		curl_setopt($ch, CURLOPT_FILE, $fp);
66 66
 		curl_setopt($ch, CURLOPT_HEADER, 0);
67 67
 		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
68 68
 		curl_exec($ch);
69 69
 		curl_close($ch);
70 70
 		fclose($fp);
71
-		return $save_dir . $file_name;
71
+		return $save_dir.$file_name;
72 72
 	}
73 73
 }
74 74
 ?>
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
ModuleInstall/PackageManager/ListViewPackages.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
38 38
  ********************************************************************************/
39 39
 
40
- require_once('include/ListView/ListViewSmarty.php');
40
+    require_once('include/ListView/ListViewSmarty.php');
41 41
  
42 42
 class ListViewPackages extends ListViewSmarty{
43 43
     var $secondaryDisplayColumns;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
 
40 40
  require_once('include/ListView/ListViewSmarty.php');
41 41
 
42
-class ListViewPackages extends ListViewSmarty{
42
+class ListViewPackages extends ListViewSmarty {
43 43
     var $secondaryDisplayColumns;
44 44
     /**
45 45
      * Constructor  Call ListViewSmarty
46 46
      */
47
-    function __construct(){
47
+    function __construct() {
48 48
         parent::__construct();
49 49
     }
50 50
 
51 51
     /**
52 52
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
53 53
      */
54
-    function ListViewPackages(){
54
+    function ListViewPackages() {
55 55
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
56
-        if(isset($GLOBALS['log'])) {
56
+        if (isset($GLOBALS['log'])) {
57 57
             $GLOBALS['log']->deprecated($deprecatedMessage);
58 58
         }
59 59
         else {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param data  the data to display on the page
70 70
      * @param file  the template file to parse
71 71
      */
72
-    function setup($data, $file, $where, $params = Array(), $offset = 0, $limit = -1, $filter_fields = Array(), $id_field = 'id'){
72
+    function setup($data, $file, $where, $params = Array(), $offset = 0, $limit = -1, $filter_fields = Array(), $id_field = 'id') {
73 73
         $this->data = $data;
74 74
         $this->tpl = $file;
75 75
     }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     /**
78 78
      * Override the display method
79 79
      */
80
-    function display($end = true){
80
+    function display($end = true) {
81 81
         global $odd_bg, $even_bg, $app_strings;
82 82
         $this->ss->assign('rowColor', array('oddListRow', 'evenListRow'));
83 83
         $this->ss->assign('bgColor', array($odd_bg, $even_bg));
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -347,8 +347,7 @@
 block discarded – undo
347 347
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
348 348
         if(isset($GLOBALS['log'])) {
349 349
             $GLOBALS['log']->deprecated($deprecatedMessage);
350
-        }
351
-        else {
350
+        } else {
352 351
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
353 352
         }
354 353
         self::__construct();
Please login to merge, or discard this patch.