Completed
Push — console-installer ( 3d54e5...e2b50d )
by Adam
69:10 queued 48:24
created
modules/Users/authentication/AuthenticationController.php 1 patch
Indentation   +133 added lines, -133 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');
@@ -98,123 +98,123 @@  discard block
 block discarded – undo
98 98
         return new $type();
99 99
     }
100 100
 
101
-	/**
102
-	 * Returns an instance of the authentication controller
103
-	 *
104
-	 * @param string $type this is the type of authetnication you want to use default is SugarAuthenticate
105
-	 * @return an instance of the authetnciation controller
106
-	 */
107
-	public static function getInstance($type = null)
108
-	{
109
-		if (empty(self::$authcontrollerinstance)) {
110
-			self::$authcontrollerinstance = new AuthenticationController($type);
111
-		}
112
-
113
-		return self::$authcontrollerinstance;
114
-	}
115
-
116
-	/**
117
-	 * This function is called when a user initially tries to login.
118
-	 *
119
-	 * @param string $username
120
-	 * @param string $password
121
-	 * @param array $PARAMS
122
-	 * @return boolean true if the user successfully logs in or false otherwise.
123
-	 */
124
-	public function login($username, $password, $PARAMS = array())
125
-	{
126
-		//kbrill bug #13225
127
-		$_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts']))? $_SESSION['loginAttempts'] + 1: 1;
128
-		unset($GLOBALS['login_error']);
129
-
130
-		if($this->loggedIn)return $this->loginSuccess;
131
-		LogicHook::initialize()->call_custom_logic('Users', 'before_login');
132
-
133
-		$this->loginSuccess = $this->authController->loginAuthenticate($username, $password, false, $PARAMS);
134
-		$this->loggedIn = true;
135
-
136
-		if($this->loginSuccess){
137
-			//Ensure the user is authorized
138
-			checkAuthUserStatus();
139
-
140
-			//loginLicense();
141
-			if(!empty($GLOBALS['login_error'])){
142
-				unset($_SESSION['authenticated_user_id']);
143
-				$GLOBALS['log']->fatal('FAILED LOGIN: potential hack attempt:'.$GLOBALS['login_error']);
144
-				$this->loginSuccess = false;
145
-				return false;
146
-			}
147
-
148
-			//call business logic hook
149
-			if(isset($GLOBALS['current_user']))
150
-				$GLOBALS['current_user']->call_custom_logic('after_login');
151
-
152
-			// Check for running Admin Wizard
153
-			$config = new Administration();
154
-			$config->retrieveSettings();
155
-		    if ( is_admin($GLOBALS['current_user']) && empty($config->settings['system_adminwizard']) && $_REQUEST['action'] != 'AdminWizard' ) {
156
-				$GLOBALS['module'] = 'Configurator';
157
-				$GLOBALS['action'] = 'AdminWizard';
158
-				ob_clean();
159
-				header("Location: index.php?module=Configurator&action=AdminWizard");
160
-				sugar_cleanup(true);
161
-			}
162
-
163
-			$ut = $GLOBALS['current_user']->getPreference('ut');
164
-			$checkTimeZone = true;
165
-			if (is_array($PARAMS) && !empty($PARAMS) && isset($PARAMS['passwordEncrypted'])) {
166
-				$checkTimeZone = false;
167
-			} // if
168
-			if(empty($ut) && $checkTimeZone && $_REQUEST['action'] != 'SetTimezone' && $_REQUEST['action'] != 'SaveTimezone' ) {
169
-				$GLOBALS['module'] = 'Users';
170
-				$GLOBALS['action'] = 'Wizard';
171
-				ob_clean();
172
-				header("Location: index.php?module=Users&action=Wizard");
173
-				sugar_cleanup(true);
174
-			}
175
-		}else{
176
-			//kbrill bug #13225
177
-			LogicHook::initialize();
178
-			$GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
179
-			$GLOBALS['log']->fatal('FAILED LOGIN:attempts[' .$_SESSION['loginAttempts'] .'] - '. $username);
180
-		}
181
-		// if password has expired, set a session variable
182
-
183
-		return $this->loginSuccess;
184
-	}
185
-
186
-	/**
187
-	 * This is called on every page hit.
188
-	 * It returns true if the current session is authenticated or false otherwise
189
-	 *
190
-	 * @return booelan
191
-	 */
192
-	public function sessionAuthenticate()
193
-	{
194
-		if(!$this->authenticated){
195
-			$this->authenticated = $this->authController->sessionAuthenticate();
196
-		}
197
-		if($this->authenticated){
198
-			if(!isset($_SESSION['userStats']['pages'])){
199
-			    $_SESSION['userStats']['loginTime'] = time();
200
-			    $_SESSION['userStats']['pages'] = 0;
201
-			}
202
-			$_SESSION['userStats']['lastTime'] = time();
203
-			$_SESSION['userStats']['pages']++;
204
-
205
-		}
206
-		return $this->authenticated;
207
-	}
208
-
209
-	/**
210
-	 * Called when a user requests to logout. Should invalidate the session and redirect
211
-	 * to the login page.
212
-	 */
213
-	public function logout()
214
-	{
215
-		$GLOBALS['current_user']->call_custom_logic('before_logout');
216
-		$this->authController->logout();
217
-		LogicHook::initialize();
218
-		$GLOBALS['logic_hook']->call_custom_logic('Users', 'after_logout');
219
-	}
101
+    /**
102
+     * Returns an instance of the authentication controller
103
+     *
104
+     * @param string $type this is the type of authetnication you want to use default is SugarAuthenticate
105
+     * @return an instance of the authetnciation controller
106
+     */
107
+    public static function getInstance($type = null)
108
+    {
109
+        if (empty(self::$authcontrollerinstance)) {
110
+            self::$authcontrollerinstance = new AuthenticationController($type);
111
+        }
112
+
113
+        return self::$authcontrollerinstance;
114
+    }
115
+
116
+    /**
117
+     * This function is called when a user initially tries to login.
118
+     *
119
+     * @param string $username
120
+     * @param string $password
121
+     * @param array $PARAMS
122
+     * @return boolean true if the user successfully logs in or false otherwise.
123
+     */
124
+    public function login($username, $password, $PARAMS = array())
125
+    {
126
+        //kbrill bug #13225
127
+        $_SESSION['loginAttempts'] = (isset($_SESSION['loginAttempts']))? $_SESSION['loginAttempts'] + 1: 1;
128
+        unset($GLOBALS['login_error']);
129
+
130
+        if($this->loggedIn)return $this->loginSuccess;
131
+        LogicHook::initialize()->call_custom_logic('Users', 'before_login');
132
+
133
+        $this->loginSuccess = $this->authController->loginAuthenticate($username, $password, false, $PARAMS);
134
+        $this->loggedIn = true;
135
+
136
+        if($this->loginSuccess){
137
+            //Ensure the user is authorized
138
+            checkAuthUserStatus();
139
+
140
+            //loginLicense();
141
+            if(!empty($GLOBALS['login_error'])){
142
+                unset($_SESSION['authenticated_user_id']);
143
+                $GLOBALS['log']->fatal('FAILED LOGIN: potential hack attempt:'.$GLOBALS['login_error']);
144
+                $this->loginSuccess = false;
145
+                return false;
146
+            }
147
+
148
+            //call business logic hook
149
+            if(isset($GLOBALS['current_user']))
150
+                $GLOBALS['current_user']->call_custom_logic('after_login');
151
+
152
+            // Check for running Admin Wizard
153
+            $config = new Administration();
154
+            $config->retrieveSettings();
155
+            if ( is_admin($GLOBALS['current_user']) && empty($config->settings['system_adminwizard']) && $_REQUEST['action'] != 'AdminWizard' ) {
156
+                $GLOBALS['module'] = 'Configurator';
157
+                $GLOBALS['action'] = 'AdminWizard';
158
+                ob_clean();
159
+                header("Location: index.php?module=Configurator&action=AdminWizard");
160
+                sugar_cleanup(true);
161
+            }
162
+
163
+            $ut = $GLOBALS['current_user']->getPreference('ut');
164
+            $checkTimeZone = true;
165
+            if (is_array($PARAMS) && !empty($PARAMS) && isset($PARAMS['passwordEncrypted'])) {
166
+                $checkTimeZone = false;
167
+            } // if
168
+            if(empty($ut) && $checkTimeZone && $_REQUEST['action'] != 'SetTimezone' && $_REQUEST['action'] != 'SaveTimezone' ) {
169
+                $GLOBALS['module'] = 'Users';
170
+                $GLOBALS['action'] = 'Wizard';
171
+                ob_clean();
172
+                header("Location: index.php?module=Users&action=Wizard");
173
+                sugar_cleanup(true);
174
+            }
175
+        }else{
176
+            //kbrill bug #13225
177
+            LogicHook::initialize();
178
+            $GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
179
+            $GLOBALS['log']->fatal('FAILED LOGIN:attempts[' .$_SESSION['loginAttempts'] .'] - '. $username);
180
+        }
181
+        // if password has expired, set a session variable
182
+
183
+        return $this->loginSuccess;
184
+    }
185
+
186
+    /**
187
+     * This is called on every page hit.
188
+     * It returns true if the current session is authenticated or false otherwise
189
+     *
190
+     * @return booelan
191
+     */
192
+    public function sessionAuthenticate()
193
+    {
194
+        if(!$this->authenticated){
195
+            $this->authenticated = $this->authController->sessionAuthenticate();
196
+        }
197
+        if($this->authenticated){
198
+            if(!isset($_SESSION['userStats']['pages'])){
199
+                $_SESSION['userStats']['loginTime'] = time();
200
+                $_SESSION['userStats']['pages'] = 0;
201
+            }
202
+            $_SESSION['userStats']['lastTime'] = time();
203
+            $_SESSION['userStats']['pages']++;
204
+
205
+        }
206
+        return $this->authenticated;
207
+    }
208
+
209
+    /**
210
+     * Called when a user requests to logout. Should invalidate the session and redirect
211
+     * to the login page.
212
+     */
213
+    public function logout()
214
+    {
215
+        $GLOBALS['current_user']->call_custom_logic('before_logout');
216
+        $this->authController->logout();
217
+        LogicHook::initialize();
218
+        $GLOBALS['logic_hook']->call_custom_logic('Users', 'after_logout');
219
+    }
220 220
 }
Please login to merge, or discard this patch.
modules/Users/authentication/SugarAuthenticate/SugarAuthenticateUser.php 1 patch
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.
modules/Users/Save.php 1 patch
Indentation   +254 added lines, -254 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 if (isset($_POST['id']))
60
-	sugar_die("Unauthorized access to administration.");
60
+    sugar_die("Unauthorized access to administration.");
61 61
 if (isset($_POST['record']) && !is_admin($current_user)
62 62
      && !$GLOBALS['current_user']->isAdminForModule('Users')
63 63
      && $_POST['record'] != $current_user->id)
@@ -115,39 +115,39 @@  discard block
 block discarded – undo
115 115
     }
116 116
 
117 117
 
118
-	$portal=array("user_name","last_name","status","portal_only");
119
-	$group=array("user_name","last_name","status","is_group");
120
-	if(isset($_POST['portal_only']) && ($_POST['portal_only']=='1' || $focus->portal_only)){
121
-		foreach($portal as $field){
122
-			if(isset($_POST[$field]))
123
-			{
124
-				$value = $_POST[$field];
125
-				$focus->$field = $value;
118
+    $portal=array("user_name","last_name","status","portal_only");
119
+    $group=array("user_name","last_name","status","is_group");
120
+    if(isset($_POST['portal_only']) && ($_POST['portal_only']=='1' || $focus->portal_only)){
121
+        foreach($portal as $field){
122
+            if(isset($_POST[$field]))
123
+            {
124
+                $value = $_POST[$field];
125
+                $focus->$field = $value;
126 126
 
127
-			}
128
-		}
129
-	}
127
+            }
128
+        }
129
+    }
130 130
 
131
-	if(isset($_POST['is_group']) && ($_POST['is_group']=='1' || $focus->is_group)){
132
-		foreach($group as $field){
133
-			if(isset($_POST[$field]))
134
-			{
135
-				$value = $_POST[$field];
136
-				$focus->$field = $value;
131
+    if(isset($_POST['is_group']) && ($_POST['is_group']=='1' || $focus->is_group)){
132
+        foreach($group as $field){
133
+            if(isset($_POST[$field]))
134
+            {
135
+                $value = $_POST[$field];
136
+                $focus->$field = $value;
137 137
 
138
-			}
139
-		}
140
-	}
138
+            }
139
+        }
140
+    }
141 141
 
142 142
 
143
-	// copy the group or portal user name over.  We renamed the field in order to ensure auto-complete would not change the value
144
-	if(isset($_POST['user_name']))
145
-	{
146
-		$focus->user_name = $_POST['user_name'];
147
-	}
143
+    // copy the group or portal user name over.  We renamed the field in order to ensure auto-complete would not change the value
144
+    if(isset($_POST['user_name']))
145
+    {
146
+        $focus->user_name = $_POST['user_name'];
147
+    }
148 148
 
149
-	// if the user saved is a Regular User
150
-	if(!$focus->is_group && !$focus->portal_only){
149
+    // if the user saved is a Regular User
150
+    if(!$focus->is_group && !$focus->portal_only){
151 151
 
152 152
         foreach ($focus->column_fields as $fieldName)
153 153
         {
@@ -178,63 +178,63 @@  discard block
 block discarded – undo
178 178
             }
179 179
         }
180 180
 
181
-		$focus->is_group=0;
182
-		$focus->portal_only=0;
181
+        $focus->is_group=0;
182
+        $focus->portal_only=0;
183 183
 
184
-     		if(isset($_POST['status']) && $_POST['status']== "Inactive") $focus->employee_status = "Terminated"; //bug49972
184
+                if(isset($_POST['status']) && $_POST['status']== "Inactive") $focus->employee_status = "Terminated"; //bug49972
185 185
 
186
-			if(isset($_POST['user_name']))
187
-		{
188
-			$focus->user_name = $_POST['user_name'];
189
-		}
190
-		if((isset($_POST['is_admin']) && ($_POST['is_admin'] == 'on' || $_POST['is_admin'] == '1')) ||
186
+            if(isset($_POST['user_name']))
187
+        {
188
+            $focus->user_name = $_POST['user_name'];
189
+        }
190
+        if((isset($_POST['is_admin']) && ($_POST['is_admin'] == 'on' || $_POST['is_admin'] == '1')) ||
191 191
            (isset($_POST['UserType']) && $_POST['UserType'] == "Administrator")) $focus->is_admin = 1;
192
-		elseif(isset($_POST['is_admin']) && empty($_POST['is_admin'])) $focus->is_admin = 0;
193
-		//if(empty($_POST['portal_only']) || !empty($_POST['is_admin'])) $focus->portal_only = 0;
194
-		//if(empty($_POST['is_group'])    || !empty($_POST['is_admin'])) $focus->is_group = 0;
195
-		if(empty($_POST['receive_notifications'])) $focus->receive_notifications = 0;
196
-
197
-		if(isset($_POST['mailmerge_on']) && !empty($_POST['mailmerge_on'])) {
198
-			$focus->setPreference('mailmerge_on','on', 0, 'global');
199
-		} else {
200
-			$focus->setPreference('mailmerge_on','off', 0, 'global');
201
-		}
202
-
203
-	    if(isset($_POST['user_swap_last_viewed']))
204
-	    {
205
-	        $focus->setPreference('swap_last_viewed', $_POST['user_swap_last_viewed'], 0, 'global');
206
-	    }
207
-	    else
208
-	    {
209
-	    	$focus->setPreference('swap_last_viewed', '', 0, 'global');
210
-	    }
211
-
212
-	    if(isset($_POST['user_swap_shortcuts']))
213
-	    {
214
-	        $focus->setPreference('swap_shortcuts', $_POST['user_swap_shortcuts'], 0, 'global');
215
-	    }
216
-	    else
217
-	    {
218
-	        $focus->setPreference('swap_shortcuts', '', 0, 'global');
219
-	    }
220
-
221
-	    if(isset($_POST['use_group_tabs']))
222
-	    {
223
-	        $focus->setPreference('navigation_paradigm', $_POST['use_group_tabs'], 0, 'global');
224
-	    }
225
-	    else
226
-	    {
227
-	        $focus->setPreference('navigation_paradigm', 'gm', 0, 'global');
228
-	    }
229
-
230
-	    if(isset($_POST['user_subpanel_tabs']))
231
-	    {
232
-	        $focus->setPreference('subpanel_tabs', $_POST['user_subpanel_tabs'], 0, 'global');
233
-	    }
234
-	    else
235
-	    {
236
-	        $focus->setPreference('subpanel_tabs', '', 0, 'global');
237
-	    }
192
+        elseif(isset($_POST['is_admin']) && empty($_POST['is_admin'])) $focus->is_admin = 0;
193
+        //if(empty($_POST['portal_only']) || !empty($_POST['is_admin'])) $focus->portal_only = 0;
194
+        //if(empty($_POST['is_group'])    || !empty($_POST['is_admin'])) $focus->is_group = 0;
195
+        if(empty($_POST['receive_notifications'])) $focus->receive_notifications = 0;
196
+
197
+        if(isset($_POST['mailmerge_on']) && !empty($_POST['mailmerge_on'])) {
198
+            $focus->setPreference('mailmerge_on','on', 0, 'global');
199
+        } else {
200
+            $focus->setPreference('mailmerge_on','off', 0, 'global');
201
+        }
202
+
203
+        if(isset($_POST['user_swap_last_viewed']))
204
+        {
205
+            $focus->setPreference('swap_last_viewed', $_POST['user_swap_last_viewed'], 0, 'global');
206
+        }
207
+        else
208
+        {
209
+            $focus->setPreference('swap_last_viewed', '', 0, 'global');
210
+        }
211
+
212
+        if(isset($_POST['user_swap_shortcuts']))
213
+        {
214
+            $focus->setPreference('swap_shortcuts', $_POST['user_swap_shortcuts'], 0, 'global');
215
+        }
216
+        else
217
+        {
218
+            $focus->setPreference('swap_shortcuts', '', 0, 'global');
219
+        }
220
+
221
+        if(isset($_POST['use_group_tabs']))
222
+        {
223
+            $focus->setPreference('navigation_paradigm', $_POST['use_group_tabs'], 0, 'global');
224
+        }
225
+        else
226
+        {
227
+            $focus->setPreference('navigation_paradigm', 'gm', 0, 'global');
228
+        }
229
+
230
+        if(isset($_POST['user_subpanel_tabs']))
231
+        {
232
+            $focus->setPreference('subpanel_tabs', $_POST['user_subpanel_tabs'], 0, 'global');
233
+        }
234
+        else
235
+        {
236
+            $focus->setPreference('subpanel_tabs', '', 0, 'global');
237
+        }
238 238
 
239 239
         if(isset($_POST['user_theme']))
240 240
         {
@@ -243,37 +243,37 @@  discard block
 block discarded – undo
243 243
         }
244 244
 
245 245
         if(isset($_POST['user_module_favicon']))
246
-	    {
247
-	        $focus->setPreference('module_favicon', $_POST['user_module_favicon'], 0, 'global');
248
-	    }
249
-	    else
250
-	    {
251
-	        $focus->setPreference('module_favicon', '', 0, 'global');
252
-	    }
253
-
254
-		$tabs = new TabController();
255
-		if(isset($_POST['display_tabs']))
256
-			$tabs->set_user_tabs($DISPLAY_ARR['display_tabs'], $focus, 'display');
257
-		if(isset($HIDE_ARR['hide_tabs'])){
258
-			$tabs->set_user_tabs($HIDE_ARR['hide_tabs'], $focus, 'hide');
259
-
260
-		}else{
261
-			$tabs->set_user_tabs(array(), $focus, 'hide');
262
-		}
263
-		if(is_admin($current_user)){
264
-			if(isset($REMOVE_ARR['remove_tabs'])){
265
-				$tabs->set_user_tabs($REMOVE_ARR['remove_tabs'], $focus, 'remove');
266
-			}else{
267
-				$tabs->set_user_tabs(array(), $focus, 'remove');
268
-			}
269
-		}
270
-
271
-	    if(isset($_POST['no_opps'])) {
272
-	        $focus->setPreference('no_opps',$_POST['no_opps'], 0, 'global');
273
-	    }
274
-	    else {
275
-	        $focus->setPreference('no_opps','off', 0, 'global');
276
-	    }
246
+        {
247
+            $focus->setPreference('module_favicon', $_POST['user_module_favicon'], 0, 'global');
248
+        }
249
+        else
250
+        {
251
+            $focus->setPreference('module_favicon', '', 0, 'global');
252
+        }
253
+
254
+        $tabs = new TabController();
255
+        if(isset($_POST['display_tabs']))
256
+            $tabs->set_user_tabs($DISPLAY_ARR['display_tabs'], $focus, 'display');
257
+        if(isset($HIDE_ARR['hide_tabs'])){
258
+            $tabs->set_user_tabs($HIDE_ARR['hide_tabs'], $focus, 'hide');
259
+
260
+        }else{
261
+            $tabs->set_user_tabs(array(), $focus, 'hide');
262
+        }
263
+        if(is_admin($current_user)){
264
+            if(isset($REMOVE_ARR['remove_tabs'])){
265
+                $tabs->set_user_tabs($REMOVE_ARR['remove_tabs'], $focus, 'remove');
266
+            }else{
267
+                $tabs->set_user_tabs(array(), $focus, 'remove');
268
+            }
269
+        }
270
+
271
+        if(isset($_POST['no_opps'])) {
272
+            $focus->setPreference('no_opps',$_POST['no_opps'], 0, 'global');
273
+        }
274
+        else {
275
+            $focus->setPreference('no_opps','off', 0, 'global');
276
+        }
277 277
 
278 278
 //		if(isset($_POST['reminder_checked']) && $_POST['reminder_checked'] == '1' && isset($_POST['reminder_checked'])){
279 279
 //			$focus->setPreference('reminder_time', $_POST['reminder_time'], 0, 'global');
@@ -289,129 +289,129 @@  discard block
 block discarded – undo
289 289
 //			$focus->setPreference('email_reminder_time', -1, 0, 'global');
290 290
 //		}
291 291
 		
292
-		$focus->setPreference('reminder_time', $_POST['reminder_time'], 0, 'global');
293
-		$focus->setPreference('email_reminder_time', $_POST['email_reminder_time'], 0, 'global');
294
-		$focus->setPreference('reminder_checked', $_POST['reminder_checked'], 0, 'global');
295
-		$focus->setPreference('email_reminder_checked', $_POST['email_reminder_checked'], 0, 'global');
292
+        $focus->setPreference('reminder_time', $_POST['reminder_time'], 0, 'global');
293
+        $focus->setPreference('email_reminder_time', $_POST['email_reminder_time'], 0, 'global');
294
+        $focus->setPreference('reminder_checked', $_POST['reminder_checked'], 0, 'global');
295
+        $focus->setPreference('email_reminder_checked', $_POST['email_reminder_checked'], 0, 'global');
296 296
 		
297
-		if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global');
298
-		if(isset($_POST['ut'])) $focus->setPreference('ut', '0', 0, 'global');
299
-		else $focus->setPreference('ut', '1', 0, 'global');
300
-		if(isset($_POST['currency'])) $focus->setPreference('currency',$_POST['currency'], 0, 'global');
301
-		if(isset($_POST['default_currency_significant_digits'])) $focus->setPreference('default_currency_significant_digits',$_POST['default_currency_significant_digits'], 0, 'global');
302
-		if(isset($_POST['num_grp_sep'])) $focus->setPreference('num_grp_sep', $_POST['num_grp_sep'], 0, 'global');
303
-		if(isset($_POST['dec_sep'])) $focus->setPreference('dec_sep', $_POST['dec_sep'], 0, 'global');
297
+        if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global');
298
+        if(isset($_POST['ut'])) $focus->setPreference('ut', '0', 0, 'global');
299
+        else $focus->setPreference('ut', '1', 0, 'global');
300
+        if(isset($_POST['currency'])) $focus->setPreference('currency',$_POST['currency'], 0, 'global');
301
+        if(isset($_POST['default_currency_significant_digits'])) $focus->setPreference('default_currency_significant_digits',$_POST['default_currency_significant_digits'], 0, 'global');
302
+        if(isset($_POST['num_grp_sep'])) $focus->setPreference('num_grp_sep', $_POST['num_grp_sep'], 0, 'global');
303
+        if(isset($_POST['dec_sep'])) $focus->setPreference('dec_sep', $_POST['dec_sep'], 0, 'global');
304 304
                 if(isset($_POST['fdow'])) $focus->setPreference('fdow', $_POST['fdow'], 0, 'global');
305
-		if(isset($_POST['dateformat'])) $focus->setPreference('datef',$_POST['dateformat'], 0, 'global');
306
-		if(isset($_POST['timeformat'])) $focus->setPreference('timef',$_POST['timeformat'], 0, 'global');
307
-		if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global');
308
-		if(isset($_POST['mail_fromname'])) $focus->setPreference('mail_fromname',$_POST['mail_fromname'], 0, 'global');
309
-		if(isset($_POST['mail_fromaddress'])) $focus->setPreference('mail_fromaddress',$_POST['mail_fromaddress'], 0, 'global');
310
-		if(isset($_POST['mail_sendtype'])) $focus->setPreference('mail_sendtype', $_POST['mail_sendtype'], 0, 'global');
311
-		if(isset($_POST['mail_smtpserver'])) $focus->setPreference('mail_smtpserver',$_POST['mail_smtpserver'], 0, 'global');
312
-		if(isset($_POST['mail_smtpport'])) $focus->setPreference('mail_smtpport',$_POST['mail_smtpport'], 0, 'global');
313
-		if(isset($_POST['mail_smtpuser'])) $focus->setPreference('mail_smtpuser',$_POST['mail_smtpuser'], 0, 'global');
314
-		if(isset($_POST['mail_smtppass'])) $focus->setPreference('mail_smtppass',$_POST['mail_smtppass'], 0, 'global');
315
-		if(isset($_POST['default_locale_name_format'])) $focus->setPreference('default_locale_name_format',$_POST['default_locale_name_format'], 0, 'global');
316
-		if(isset($_POST['export_delimiter'])) $focus->setPreference('export_delimiter', $_POST['export_delimiter'], 0, 'global');
317
-		if(isset($_POST['default_export_charset'])) $focus->setPreference('default_export_charset', $_POST['default_export_charset'], 0, 'global');
318
-		if(isset($_POST['use_real_names'])) {
319
-			$focus->setPreference('use_real_names', 'on', 0, 'global');
320
-		} elseif(!isset($_POST['use_real_names']) && !isset($_POST['from_dcmenu'])) {
321
-			// Make sure we're on the full form and not the QuickCreate.
322
-			$focus->setPreference('use_real_names', 'off', 0, 'global');
323
-		}
324
-
325
-		if(isset($_POST['mail_smtpauth_req'])) {
326
-			$focus->setPreference('mail_smtpauth_req',$_POST['mail_smtpauth_req'] , 0, 'global');
327
-		} else {
328
-			$focus->setPreference('mail_smtpauth_req','', 0, 'global');
329
-		}
330
-
331
-		// SSL-enabled SMTP connection
332
-		if(isset($_POST['mail_smtpssl'])) {
333
-			$focus->setPreference('mail_smtpssl', 1, 0, 'global');
334
-		} else {
335
-			$focus->setPreference('mail_smtpssl', 0, 0, 'global');
336
-		}
337
-	    ///////////////////////////////////////////////////////////////////////////
338
-	    ////    PDF SETTINGS
339
-	    foreach($_POST as $k=>$v){
340
-	        if(strpos($k,"sugarpdf_pdf") !== false){
341
-	            $focus->setPreference($k, $v, 0, 'global');
342
-	        }
343
-	    }
344
-	    ////    PDF SETTINGS
345
-		///////////////////////////////////////////////////////////////////////////
346
-
347
-		///////////////////////////////////////////////////////////////////////////
348
-		////	SIGNATURES
349
-		if(isset($_POST['signature_id']))
350
-			$focus->setPreference('signature_default', $_POST['signature_id'], 0, 'global');
351
-
352
-		if(isset($_POST['signature_prepend'])) $focus->setPreference('signature_prepend',$_POST['signature_prepend'], 0, 'global');
353
-		////	END SIGNATURES
354
-		///////////////////////////////////////////////////////////////////////////
355
-
356
-
357
-		 if(isset($_POST['email_link_type'])) $focus->setPreference('email_link_type', $_REQUEST['email_link_type']);
358
-		if(isset($_REQUEST['email_show_counts'])) {
359
-			$focus->setPreference('email_show_counts', $_REQUEST['email_show_counts'], 0, 'global');
360
-		} else {
361
-			$focus->setPreference('email_show_counts', 0, 0, 'global');
362
-		}
363
-		if(isset($_REQUEST['email_editor_option']))
364
-			$focus->setPreference('email_editor_option', $_REQUEST['email_editor_option'], 0, 'global');
365
-		if(isset($_REQUEST['default_email_charset']))
366
-			$focus->setPreference('default_email_charset', $_REQUEST['default_email_charset'], 0, 'global');
367
-
368
-		if(isset($_POST['calendar_publish_key'])) $focus->setPreference('calendar_publish_key',$_POST['calendar_publish_key'], 0, 'global');
369
-	}
370
-
371
-	if (!$focus->verify_data())
372
-	{
373
-		header("Location: index.php?action=Error&module=Users&error_string=".urlencode($focus->error_string));
374
-		exit;
375
-	}
376
-	else
377
-	{	$GLOBALS['sugar_config']['disable_team_access_check'] = true;
378
-		$focus->save();
379
-		$GLOBALS['sugar_config']['disable_team_access_check'] = false;
380
-		$return_id = $focus->id;
381
-		$ieVerified = true;
382
-
383
-		global $new_pwd;
384
-		$new_pwd='';
385
-		if((isset($_POST['old_password']) || $focus->portal_only) &&
386
-			(isset($_POST['new_password']) && !empty($_POST['new_password'])) &&
387
-			(isset($_POST['password_change']) && $_POST['password_change'] == 'true') ) {
388
-			if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) {
389
-			   if((isset($_POST['page']) && $_POST['page'] == 'EditView')){
390
-			       header("Location: index.php?action=EditView&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string));
391
-			       exit;
392
-			   }
393
-			   if((isset($_POST['page']) && $_POST['page'] == 'Change')){
394
-			       header("Location: index.php?action=ChangePassword&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string));
395
-			       exit;
396
-			   }
397
-		   }
398
-		   else{
399
-		   		if ($newUser)
400
-		   			$new_pwd='3';
401
-		   		else
402
-		   			$new_pwd='1';
403
-		   }
404
-		}
405
-
406
-		///////////////////////////////////////////////////////////////////////////
407
-		////	OUTBOUND EMAIL SAVES
408
-		///////////////////////////////////////////////////////////////////////////
409
-
410
-		$sysOutboundAccunt = new OutboundEmail();
411
-
412
-		//If a user is not alloweed to use the default system outbound account then they will be
413
-		//saving their own username/password for the system account
414
-		if( ! $sysOutboundAccunt->isAllowUserAccessToSystemDefaultOutbound() )
305
+        if(isset($_POST['dateformat'])) $focus->setPreference('datef',$_POST['dateformat'], 0, 'global');
306
+        if(isset($_POST['timeformat'])) $focus->setPreference('timef',$_POST['timeformat'], 0, 'global');
307
+        if(isset($_POST['timezone'])) $focus->setPreference('timezone',$_POST['timezone'], 0, 'global');
308
+        if(isset($_POST['mail_fromname'])) $focus->setPreference('mail_fromname',$_POST['mail_fromname'], 0, 'global');
309
+        if(isset($_POST['mail_fromaddress'])) $focus->setPreference('mail_fromaddress',$_POST['mail_fromaddress'], 0, 'global');
310
+        if(isset($_POST['mail_sendtype'])) $focus->setPreference('mail_sendtype', $_POST['mail_sendtype'], 0, 'global');
311
+        if(isset($_POST['mail_smtpserver'])) $focus->setPreference('mail_smtpserver',$_POST['mail_smtpserver'], 0, 'global');
312
+        if(isset($_POST['mail_smtpport'])) $focus->setPreference('mail_smtpport',$_POST['mail_smtpport'], 0, 'global');
313
+        if(isset($_POST['mail_smtpuser'])) $focus->setPreference('mail_smtpuser',$_POST['mail_smtpuser'], 0, 'global');
314
+        if(isset($_POST['mail_smtppass'])) $focus->setPreference('mail_smtppass',$_POST['mail_smtppass'], 0, 'global');
315
+        if(isset($_POST['default_locale_name_format'])) $focus->setPreference('default_locale_name_format',$_POST['default_locale_name_format'], 0, 'global');
316
+        if(isset($_POST['export_delimiter'])) $focus->setPreference('export_delimiter', $_POST['export_delimiter'], 0, 'global');
317
+        if(isset($_POST['default_export_charset'])) $focus->setPreference('default_export_charset', $_POST['default_export_charset'], 0, 'global');
318
+        if(isset($_POST['use_real_names'])) {
319
+            $focus->setPreference('use_real_names', 'on', 0, 'global');
320
+        } elseif(!isset($_POST['use_real_names']) && !isset($_POST['from_dcmenu'])) {
321
+            // Make sure we're on the full form and not the QuickCreate.
322
+            $focus->setPreference('use_real_names', 'off', 0, 'global');
323
+        }
324
+
325
+        if(isset($_POST['mail_smtpauth_req'])) {
326
+            $focus->setPreference('mail_smtpauth_req',$_POST['mail_smtpauth_req'] , 0, 'global');
327
+        } else {
328
+            $focus->setPreference('mail_smtpauth_req','', 0, 'global');
329
+        }
330
+
331
+        // SSL-enabled SMTP connection
332
+        if(isset($_POST['mail_smtpssl'])) {
333
+            $focus->setPreference('mail_smtpssl', 1, 0, 'global');
334
+        } else {
335
+            $focus->setPreference('mail_smtpssl', 0, 0, 'global');
336
+        }
337
+        ///////////////////////////////////////////////////////////////////////////
338
+        ////    PDF SETTINGS
339
+        foreach($_POST as $k=>$v){
340
+            if(strpos($k,"sugarpdf_pdf") !== false){
341
+                $focus->setPreference($k, $v, 0, 'global');
342
+            }
343
+        }
344
+        ////    PDF SETTINGS
345
+        ///////////////////////////////////////////////////////////////////////////
346
+
347
+        ///////////////////////////////////////////////////////////////////////////
348
+        ////	SIGNATURES
349
+        if(isset($_POST['signature_id']))
350
+            $focus->setPreference('signature_default', $_POST['signature_id'], 0, 'global');
351
+
352
+        if(isset($_POST['signature_prepend'])) $focus->setPreference('signature_prepend',$_POST['signature_prepend'], 0, 'global');
353
+        ////	END SIGNATURES
354
+        ///////////////////////////////////////////////////////////////////////////
355
+
356
+
357
+            if(isset($_POST['email_link_type'])) $focus->setPreference('email_link_type', $_REQUEST['email_link_type']);
358
+        if(isset($_REQUEST['email_show_counts'])) {
359
+            $focus->setPreference('email_show_counts', $_REQUEST['email_show_counts'], 0, 'global');
360
+        } else {
361
+            $focus->setPreference('email_show_counts', 0, 0, 'global');
362
+        }
363
+        if(isset($_REQUEST['email_editor_option']))
364
+            $focus->setPreference('email_editor_option', $_REQUEST['email_editor_option'], 0, 'global');
365
+        if(isset($_REQUEST['default_email_charset']))
366
+            $focus->setPreference('default_email_charset', $_REQUEST['default_email_charset'], 0, 'global');
367
+
368
+        if(isset($_POST['calendar_publish_key'])) $focus->setPreference('calendar_publish_key',$_POST['calendar_publish_key'], 0, 'global');
369
+    }
370
+
371
+    if (!$focus->verify_data())
372
+    {
373
+        header("Location: index.php?action=Error&module=Users&error_string=".urlencode($focus->error_string));
374
+        exit;
375
+    }
376
+    else
377
+    {	$GLOBALS['sugar_config']['disable_team_access_check'] = true;
378
+        $focus->save();
379
+        $GLOBALS['sugar_config']['disable_team_access_check'] = false;
380
+        $return_id = $focus->id;
381
+        $ieVerified = true;
382
+
383
+        global $new_pwd;
384
+        $new_pwd='';
385
+        if((isset($_POST['old_password']) || $focus->portal_only) &&
386
+            (isset($_POST['new_password']) && !empty($_POST['new_password'])) &&
387
+            (isset($_POST['password_change']) && $_POST['password_change'] == 'true') ) {
388
+            if (!$focus->change_password($_POST['old_password'], $_POST['new_password'])) {
389
+                if((isset($_POST['page']) && $_POST['page'] == 'EditView')){
390
+                    header("Location: index.php?action=EditView&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string));
391
+                    exit;
392
+                }
393
+                if((isset($_POST['page']) && $_POST['page'] == 'Change')){
394
+                    header("Location: index.php?action=ChangePassword&module=Users&record=".$_POST['record']."&error_password=".urlencode($focus->error_string));
395
+                    exit;
396
+                }
397
+            }
398
+            else{
399
+                    if ($newUser)
400
+                        $new_pwd='3';
401
+                    else
402
+                        $new_pwd='1';
403
+            }
404
+        }
405
+
406
+        ///////////////////////////////////////////////////////////////////////////
407
+        ////	OUTBOUND EMAIL SAVES
408
+        ///////////////////////////////////////////////////////////////////////////
409
+
410
+        $sysOutboundAccunt = new OutboundEmail();
411
+
412
+        //If a user is not alloweed to use the default system outbound account then they will be
413
+        //saving their own username/password for the system account
414
+        if( ! $sysOutboundAccunt->isAllowUserAccessToSystemDefaultOutbound() )
415 415
         {
416 416
             $userOverrideOE = $sysOutboundAccunt->getUsersMailerForSystemOverride($focus->id);
417 417
             if($userOverrideOE != null)
@@ -430,29 +430,29 @@  discard block
 block discarded – undo
430 430
         }
431 431
 
432 432
 
433
-		///////////////////////////////////////////////////////////////////////////
434
-		////	INBOUND EMAIL SAVES
435
-		if(isset($_REQUEST['server_url']) && !empty($_REQUEST['server_url'])) {
433
+        ///////////////////////////////////////////////////////////////////////////
434
+        ////	INBOUND EMAIL SAVES
435
+        if(isset($_REQUEST['server_url']) && !empty($_REQUEST['server_url'])) {
436 436
 
437
-			$ie = new InboundEmail();
438
-			if(false === $ie->savePersonalEmailAccount($return_id, $focus->user_name)) {
439
-				header("Location: index.php?action=Error&module=Users&error_string=&ie_error=true&id=".$return_id);
440
-				die(); // die here, else the header redirect below takes over.
441
-			}
442
-		} elseif(isset($_REQUEST['ie_id']) && !empty($_REQUEST['ie_id']) && empty($_REQUEST['server_url'])) {
443
-			// user is deleting their I-E
437
+            $ie = new InboundEmail();
438
+            if(false === $ie->savePersonalEmailAccount($return_id, $focus->user_name)) {
439
+                header("Location: index.php?action=Error&module=Users&error_string=&ie_error=true&id=".$return_id);
440
+                die(); // die here, else the header redirect below takes over.
441
+            }
442
+        } elseif(isset($_REQUEST['ie_id']) && !empty($_REQUEST['ie_id']) && empty($_REQUEST['server_url'])) {
443
+            // user is deleting their I-E
444 444
 
445
-			$ie = new InboundEmail();
446
-			$ie->deletePersonalEmailAccount($_REQUEST['ie_id'], $focus->user_name);
447
-		}
448
-		////	END INBOUND EMAIL SAVES
449
-		///////////////////////////////////////////////////////////////////////////
450
-		if(($newUser) && !($focus->is_group) && !($focus->portal_only) && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']){
451
-			$new_pwd='2';
452
-			require_once('modules/Users/GeneratePassword.php');
453
-		}
445
+            $ie = new InboundEmail();
446
+            $ie->deletePersonalEmailAccount($_REQUEST['ie_id'], $focus->user_name);
447
+        }
448
+        ////	END INBOUND EMAIL SAVES
449
+        ///////////////////////////////////////////////////////////////////////////
450
+        if(($newUser) && !($focus->is_group) && !($focus->portal_only) && isset($sugar_config['passwordsetting']['SystemGeneratedPasswordON']) && $sugar_config['passwordsetting']['SystemGeneratedPasswordON']){
451
+            $new_pwd='2';
452
+            require_once('modules/Users/GeneratePassword.php');
453
+        }
454 454
 
455
-	}
455
+    }
456 456
 
457 457
 
458 458
     //handle navigation from user wizard
Please login to merge, or discard this patch.
modules/Users/UserViewHelper.php 1 patch
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.
install/performSetup.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 if(strpos($server_software,'Microsoft-IIS') !== false)
157 157
 {
158 158
     installLog("calling handleWebConfig()");
159
-	handleWebConfig();
159
+    handleWebConfig();
160 160
 } else {
161
-	installLog("calling handleHtaccess()");
161
+    installLog("calling handleHtaccess()");
162 162
     handleHtaccess();
163 163
 }
164 164
 
@@ -228,27 +228,27 @@  discard block
 block discarded – undo
228 228
  * loop through all the Beans and create their tables
229 229
  */
230 230
 installStatus($mod_strings['STAT_CREATE_DB']);
231
- installLog("looping through all the Beans and create their tables");
232
- //start by clearing out the vardefs
233
- VardefManager::clearVardef();
231
+    installLog("looping through all the Beans and create their tables");
232
+    //start by clearing out the vardefs
233
+    VardefManager::clearVardef();
234 234
 installerHook('pre_createAllModuleTables');
235 235
 
236 236
 
237 237
 foreach( $beanFiles as $bean => $file ) {
238
-	$doNotInit = array('Scheduler', 'SchedulersJob', 'ProjectTask','jjwg_Maps','jjwg_Address_Cache','jjwg_Areas','jjwg_Markers');
238
+    $doNotInit = array('Scheduler', 'SchedulersJob', 'ProjectTask','jjwg_Maps','jjwg_Address_Cache','jjwg_Areas','jjwg_Markers');
239 239
 
240
-	if(in_array($bean, $doNotInit)) {
241
-		$focus = new $bean(false);
242
-	} else {
243
-	    $focus = new $bean();
244
-	}
240
+    if(in_array($bean, $doNotInit)) {
241
+        $focus = new $bean(false);
242
+    } else {
243
+        $focus = new $bean();
244
+    }
245 245
 
246
-	if ( $bean == 'Configurator' )
247
-	    continue;
246
+    if ( $bean == 'Configurator' )
247
+        continue;
248 248
 
249 249
     $table_name = $focus->table_name;
250 250
     //installStatus(sprintf($mod_strings['STAT_CREATE_DB_TABLE'], $focus->table_name ));
251
-     installLog("processing table ".$focus->table_name);
251
+        installLog("processing table ".$focus->table_name);
252 252
     // check to see if we have already setup this table
253 253
     if(!in_array($table_name, $processed_tables)) {
254 254
         if(!file_exists("modules/".$focus->module_dir."/vardefs.php")){
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
                 continue; // support new vardef definitions
261 261
             }
262 262
         } else {
263
-        	continue; //no further processing needed for ignored beans.
263
+            continue; //no further processing needed for ignored beans.
264 264
         }
265 265
 
266 266
         // table has not been setup...we will do it now and remember that
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
         installerHook('pre_createModuleTable', array('module' => $focus->getObjectName()));
289 289
         SugarBean::createRelationshipMeta($focus->getObjectName(), $db, $table_name, $empty, $focus->module_dir);
290 290
         installerHook('post_createModuleTable', array('module' => $focus->getObjectName()));
291
-		echo ".";
291
+        echo ".";
292 292
 
293 293
     } // end if()
294 294
 }
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 
421 421
     //require_once('modules/Connectors/InstallDefaultConnectors.php');
422 422
 
423
-	///////////////////////////////////////////////////////////////////////////////
424
-	////    INSTALL PASSWORD TEMPLATES
423
+    ///////////////////////////////////////////////////////////////////////////////
424
+    ////    INSTALL PASSWORD TEMPLATES
425 425
     include('install/seed_data/Advanced_Password_SeedData.php');
426 426
 
427 427
 ///////////////////////////////////////////////////////////////////////////////
Please login to merge, or discard this patch.
install/installConfig.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     }
222 222
 
223 223
     private function getFormItems($mod_strings, $app_list_strings, $sugarConfigDefaults, $drivers, $checked, $db, $errors, $supportedLanguages,
224
-                                  $current_language, $customSession, $customLog, $customId, $customSessionHidden, $customLogHidden, $customIdHidden) {
224
+                                    $current_language, $customSession, $customLog, $customId, $customSessionHidden, $customLogHidden, $customIdHidden) {
225 225
 
226 226
 
227 227
 
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
             $_SESSION['email1'] = null;
446 446
         }
447 447
 
448
-		if(!isset($_SESSION['setup_site_admin_user_name'])) {
449
-			$_SESSION['setup_site_admin_user_name'] = null;
450
-		}
448
+        if(!isset($_SESSION['setup_site_admin_user_name'])) {
449
+            $_SESSION['setup_site_admin_user_name'] = null;
450
+        }
451 451
 		
452 452
         $out .=<<<EOQ
453 453
 <div class='install_block'>
Please login to merge, or discard this patch.
ModuleInstall/PackageManager/PackageManagerDownloader.php 1 patch
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.
ModuleInstall/PackageManager/PackageManagerDisplay.php 1 patch
Indentation   +247 added lines, -247 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 class PackageManagerDisplay{
49 49
 
50
-   /**
50
+    /**
51 51
      * A Static method to Build the display for the package manager
52 52
      *
53 53
      * @param String form1 - the form to display for manual downloading
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @return String - a string of html which will be used to display the forms
59 59
      */
60 60
     static function buildPackageDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1', $install = false){
61
-		global $current_language;
61
+        global $current_language;
62 62
 
63 63
         $mod_strings = return_module_language($current_language, "Administration");
64 64
         global $app_strings;
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
         $show_login = $result['show_login'];
77 77
         $mi_errors = ModuleInstaller::getErrors();
78 78
         $error_html = "";
79
-		if(!empty($mi_errors)){
80
-			$error_html = "<tr><td><span>";
81
-			foreach($mi_errors as $error){
82
-				$error_html .= "<font color='red'>".$error."</font><br>";
83
-			}
84
-			$error_html .= "</span></td></tr>";
85
-		}
79
+        if(!empty($mi_errors)){
80
+            $error_html = "<tr><td><span>";
81
+            foreach($mi_errors as $error){
82
+                $error_html .= "<font color='red'>".$error."</font><br>";
83
+            }
84
+            $error_html .= "</span></td></tr>";
85
+        }
86 86
 
87 87
         $form2 = "<table  class='tabForm' width='100%'  cellpadding='0' cellspacing='0' width='100%' border='0'>";
88 88
         $form2 .= $error_html;
89 89
         if(!$isAlive)
90
-        	$form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>";
90
+            $form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>";
91 91
         $form2 .= "</table>";
92 92
 
93 93
         $tree = null;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         $form2 .= "<table  class='tabForm' cellpadding='0' cellspacing='0' width='100%' border='0'>";
101 101
         $form2 .= "<tr><td></td><td align='left'>";
102 102
         if($isAlive){
103
-        	$form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>";
103
+            $form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>";
104 104
         }else{
105 105
             $form2 .= "<input type='button' id='modifCredentialsBtn' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'style='display:none;'>";
106 106
         }
@@ -112,14 +112,14 @@  discard block
 block discarded – undo
112 112
             $form2 .= "<slot><a class=\"listViewTdToolsS1\" id='href_animate' onClick=\"PackageManager.toggleDiv('span_animate_server_div', 'catview');\"><span id='span_animate_server_div' style='display:none;'><img src='".SugarThemeRegistry::current()->getImageURL('basic_search.gif')."' width='8' height='8' border='0'>&nbsp;Collapse</span></a></slot>";
113 113
         }
114 114
         $form2 .= "</td></tr></table>";
115
-		$form2 = '';   //Commenting out the form as part of sugar depot hiding.
115
+        $form2 = '';   //Commenting out the form as part of sugar depot hiding.
116 116
         $ss->assign('installation', ($install ? 'true' : 'false'));
117 117
 
118 118
 
119
-       $mod_strings = return_module_language($current_language, "Administration");
119
+        $mod_strings = return_module_language($current_language, "Administration");
120 120
 
121 121
         $ss->assign('MOD', $mod_strings);
122
-		$ss->assign('module_load', 'true');
122
+        $ss->assign('module_load', 'true');
123 123
         if (UploadStream::getSuhosinStatus() == false)
124 124
         {
125 125
             $ss->assign('ERR_SUHOSIN', true);
@@ -129,14 +129,14 @@  discard block
 block discarded – undo
129 129
             $ss->assign('scripts', PackageManagerDisplay::getDisplayScript($install));
130 130
         }
131 131
         $show_login = false; //hiding install from sugar
132
-		$ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
133
-       $ss->assign('FORM_2_PLACE_HOLDER', $form2);
132
+        $ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
133
+        $ss->assign('FORM_2_PLACE_HOLDER', $form2);
134 134
         $ss->assign('MOD', $mod_strings);
135 135
         $descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
136 136
         $ss->assign('INSTALLED_PACKAGES_HOLDER', PackageManagerDisplay::buildInstalledGrid($mod_strings, $types));
137 137
 
138
-   $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl');
139
-      return $str;
138
+    $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl');
139
+        return $str;
140 140
     }
141 141
 
142 142
     /**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      * @return String - a string of html which will be used to display the forms
151 151
      */
152 152
     function buildPatchDisplay($form1, $hidden_fields, $form_action, $types = array('module'), $active_form = 'form1'){
153
-    	global $current_language;
153
+        global $current_language;
154 154
         $mod_strings = return_module_language($current_language, "Administration");
155 155
         $ss = new Sugar_Smarty();
156 156
         $ss->assign('FORM_1_PLACE_HOLDER', $form1);
@@ -169,43 +169,43 @@  discard block
 block discarded – undo
169 169
         //}
170 170
         $form2 = "<table  class='tabForm' width='100%'  cellpadding='0' cellspacing='0' width='100%' border='0'>";
171 171
         if(!$isAlive)
172
-        	$form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>";
172
+            $form2 .= "<tr><td><span id='span_display_html'>".$header_text."</span></td></tr>";
173 173
         $form2 .= "</table>";
174 174
         $form2 .= "<table width='100%'><tr><td align='left'>";
175 175
         if($show_login){
176
-        	$form2 .= "<input type='button' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>";
176
+            $form2 .= "<input type='button' class='button' onClick='PackageManager.showLoginDialog(true);' value='".$mod_strings['LBL_MODIFY_CREDENTIALS']."'>";
177 177
         }
178 178
         $form2 .= "</td><td align='right'><div id='workingStatusDiv' style='display:none;'>".SugarThemeRegistry::current()->getImage("sqsWait","border='0' align='bottom'",null,null,'.gif',"Loading")."</div></td></tr><tr><td colspan='2'>";
179 179
 
180 180
         $loginViewStyle = ($isAlive ? 'none' : 'block');
181
-		$selectViewStyle = ($isAlive ? 'block' : 'none');
182
-		$form2 .= "<div id='selectView' style='display:".$selectViewStyle."'>";
183
-		$form2 .= "  <div id='patch_downloads' class='ygrid-mso' style='height:205px; display: ".$display.";'></div>";
184
-		 $form2 .= "</div>";
185
-		 if(!$show_login)
186
-         	$loginViewStyle = 'none';
187
-         //$form2 .= "<div id='loginView' style='display:".$loginViewStyle."'>";
188
-    	 //$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings, $isAlive);
189
-    	 //$form2 .= "</div>";
181
+        $selectViewStyle = ($isAlive ? 'block' : 'none');
182
+        $form2 .= "<div id='selectView' style='display:".$selectViewStyle."'>";
183
+        $form2 .= "  <div id='patch_downloads' class='ygrid-mso' style='height:205px; display: ".$display.";'></div>";
184
+            $form2 .= "</div>";
185
+            if(!$show_login)
186
+                $loginViewStyle = 'none';
187
+            //$form2 .= "<div id='loginView' style='display:".$loginViewStyle."'>";
188
+            //$form2 .= PackageManagerDisplay::buildLoginPanel($mod_strings, $isAlive);
189
+            //$form2 .= "</div>";
190 190
 
191 191
         $form2 .= "</td></tr></table>";
192 192
         $form2 = '';
193 193
         $packages = array();
194 194
         $releases = array();
195 195
         if($isAlive){
196
-          	$filter = array();
197
-          	$count = count($types);
198
-          	$index = 1;
199
-          	$type_str = '"';
200
-          	foreach($types as $type){
201
-          		$type_str .= "'".$type."'";
202
-          		if($index < $count)
203
-          			$type_str .= ",";
204
-          		$index++;
205
-          	}
206
-          	$type_str .= '"';
207
-          	$filter = array('type' => $type_str);
208
-          	$filter = PackageManager::toNameValueList($filter);
196
+                $filter = array();
197
+                $count = count($types);
198
+                $index = 1;
199
+                $type_str = '"';
200
+                foreach($types as $type){
201
+                    $type_str .= "'".$type."'";
202
+                    if($index < $count)
203
+                        $type_str .= ",";
204
+                    $index++;
205
+                }
206
+                $type_str .= '"';
207
+                $filter = array('type' => $type_str);
208
+                $filter = PackageManager::toNameValueList($filter);
209 209
             $pm = new PackageManager();
210 210
             /*if(in_array('patch', $types)){
211 211
             	$releases = $pm->getReleases('3', '3', $filter);
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
             }*/
215 215
         }
216 216
         if($form_action == 'install.php' && (empty($releases) || count($releases['packages']) == 0)){
217
-        	//return false;
217
+            //return false;
218 218
         }
219 219
         $tree = PackageManagerDisplay::buildTreeView('treeview', $isAlive);
220 220
         $tree->tree_style= 'include/ytree/TreeView/css/check/tree.css';
221 221
         $ss->assign('TREEHEADER',$tree->generate_header());
222
-		$ss->assign('module_load', 'false');
223
-		$ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
222
+        $ss->assign('module_load', 'false');
223
+        $ss->assign('MODULE_SELECTOR', PackageManagerDisplay::buildGridOutput($tree, $mod_strings, $isAlive, $show_login));
224 224
         $ss->assign('FORM_2_PLACE_HOLDER', $form2);
225 225
         $ss->assign('scripts', PackageManagerDisplay::getDisplayScript(false, 'patch', $releases, $types, $isAlive));
226 226
         $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageForm.tpl');
@@ -228,34 +228,34 @@  discard block
 block discarded – undo
228 228
     }
229 229
 
230 230
     static function buildInstalledGrid($mod_strings, $types = array('modules')){
231
-    	  $descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
232
-    	  $output = '<table width="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td align="left">'.$descItemsInstalled.'</td>';
233
-          $output .= '</td></tr></table>';
234
-          $output .= "<table width='100%'><tr><td ><div id='installed_grid' class='ygrid-mso' style='height:205px;'></div></td></tr></table>";
235
-          return $output;
231
+            $descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
232
+            $output = '<table width="100%" border="0" cellspacing="0" cellpadding="0" ><tr><td align="left">'.$descItemsInstalled.'</td>';
233
+            $output .= '</td></tr></table>';
234
+            $output .= "<table width='100%'><tr><td ><div id='installed_grid' class='ygrid-mso' style='height:205px;'></div></td></tr></table>";
235
+            return $output;
236 236
     }
237 237
 
238 238
     function buildLoginPanel($mod_strings, $display_cancel){
239 239
         $credentials = PackageManager::getCredentials();
240
-    	$output = "<div id='login_panel'><div class='hd'><b>".$mod_strings['HDR_LOGIN_PANEL']."</b></div>";
240
+        $output = "<div id='login_panel'><div class='hd'><b>".$mod_strings['HDR_LOGIN_PANEL']."</b></div>";
241 241
         $output .= "<div class='bd'><form><table><tr><td>".$mod_strings['LBL_USERNAME']."</td><td><input type='text' name='login_panel_username' id='login_panel_username' value='".$credentials['username']."'></td><td><a href='http://www.sugarcrm.com/crm/index.php?option=com_registration&task=register' target='blank'>".$mod_strings['LNK_NEW_ACCOUNT']."</a></td>";
242 242
 
243 243
         $output .= "</tr><tr><td>".$mod_strings['LBL_PASSWORD']."</td><td><input type='password' name='login_panel_password' id='login_panel_password'></td><td><a href='http://www.sugarcrm.com/crm/component/option,com_registration/Itemid,0/task,lostPassword/' target='blank'>".$mod_strings['LNK_FORGOT_PASS']."</a></td>";
244 244
 
245
-		$terms = PackageManager::getTermsAndConditions();
246
-		$output .= "</tr><tr><td colspan='6' valign='top'><b>".$mod_strings['LBL_TERMS_AND_CONDITIONS']."</b><br><textarea readonly cols=80 rows=8>" . $terms['terms'] . '</textarea></td>';
247
-       	$_SESSION['SugarDepot_TermsVersion'] = (!empty($terms['version']) ? $terms['version'] : '');
245
+        $terms = PackageManager::getTermsAndConditions();
246
+        $output .= "</tr><tr><td colspan='6' valign='top'><b>".$mod_strings['LBL_TERMS_AND_CONDITIONS']."</b><br><textarea readonly cols=80 rows=8>" . $terms['terms'] . '</textarea></td>';
247
+            $_SESSION['SugarDepot_TermsVersion'] = (!empty($terms['version']) ? $terms['version'] : '');
248 248
 
249
-		$output .= "</td></tr><tr><td colspan='6'><input class='checkbox' type='checkbox' name='cb_terms' id='cb_terms' onclick='if(this.checked){this.form.panel_login_button.disabled=false;}else{this.form.panel_login_button.disabled=true;}'>".$mod_strings['LBL_ACCEPT_TERMS']."</td></tr><tr>";
249
+        $output .= "</td></tr><tr><td colspan='6'><input class='checkbox' type='checkbox' name='cb_terms' id='cb_terms' onclick='if(this.checked){this.form.panel_login_button.disabled=false;}else{this.form.panel_login_button.disabled=true;}'>".$mod_strings['LBL_ACCEPT_TERMS']."</td></tr><tr>";
250 250
         $output .= "<td align='left'>";
251 251
         $output .= "<input type='button' id='panel_login_button' name='panel_login_button' value='Login' class='button' onClick='PackageManager.authenticate(this.form.login_panel_username.value, this.form.login_panel_password.value, \"\",\"" . $terms['version'] . "\");' disabled>";
252 252
 
253 253
         if($display_cancel){
254
-        	$output .= "&nbsp;<input type='button' id='panel_cancel_button' value='Cancel' class='button' onClick='PackageManager.showLoginDialog(false);'>";
254
+            $output .= "&nbsp;<input type='button' id='panel_cancel_button' value='Cancel' class='button' onClick='PackageManager.showLoginDialog(false);'>";
255 255
         }
256 256
         $output .= "</td><td></td></tr>";
257
-		$output .= "<tr></td><td></td></tr>";
258
-		$output .= "</table></div>";
257
+        $output .= "<tr></td><td></td></tr>";
258
+        $output .= "</table></div>";
259 259
         $output .= "<div class='ft'></div></form></div>";
260 260
         return $output;
261 261
     }
@@ -267,48 +267,48 @@  discard block
 block discarded – undo
267 267
      *  @param Array mod_strings - the local mod strings to display
268 268
      *  @return String - a string of html
269 269
      */
270
-	static function buildGridOutput($tree, $mod_strings, $display = true, $show_login = true){
271
-		 $output = "<div id='catview'>";
272
-		$loginViewStyle = ($display ? 'none' : 'block');
273
-		$selectViewStyle = ($display ? 'block' : 'none');
274
-		$output .= "<div id='selectView' style='display:".$selectViewStyle."'>";
275
-         //if($display){
276
-    		$output .= "<table border=0 width='100%' class='moduleTitle'><tr><td width='100%' valign='top'>";
277
-    		$output .= "<div id='treeview'>";
278
-    		$output .= $tree->generate_nodes_array();
279
-    		$output .= "</div>";
280
-    		$output .= "</td></tr>";
270
+    static function buildGridOutput($tree, $mod_strings, $display = true, $show_login = true){
271
+            $output = "<div id='catview'>";
272
+        $loginViewStyle = ($display ? 'none' : 'block');
273
+        $selectViewStyle = ($display ? 'block' : 'none');
274
+        $output .= "<div id='selectView' style='display:".$selectViewStyle."'>";
275
+            //if($display){
276
+            $output .= "<table border=0 width='100%' class='moduleTitle'><tr><td width='100%' valign='top'>";
277
+            $output .= "<div id='treeview'>";
278
+            $output .= $tree->generate_nodes_array();
279
+            $output .= "</div>";
280
+            $output .= "</td></tr>";
281 281
             $output .= "<tr><td width='100%'>";
282
-			$output .= "<div id='tabs1'></div>";
282
+            $output .= "<div id='tabs1'></div>";
283 283
             $output .= "</td></tr>";
284 284
             $output .= "<tr><td width='100%' align='left'>";
285 285
             $output .= "<input type='button' class='button' value='Download Selected' onClick='PackageManager.download();'>";
286 286
             $output .= "</td></tr></table>";
287 287
         // }
288
-         $output .= "</div>";
289
-         if(!$show_login)
290
-         	$loginViewStyle = 'none';
288
+            $output .= "</div>";
289
+            if(!$show_login)
290
+                $loginViewStyle = 'none';
291 291
         // $output .= "<div id='loginView' style='display:".$loginViewStyle."'>";
292
-         // jchi ,#24296 :commented code because we are currently not using depot, in the future this may change so you can put this code back in.
293
-    	 //$output .= PackageManagerDisplay::buildLoginPanel($mod_strings, $display);
294
-    	 //$output .= "</div>";
295
-    	 //$output .= "<table width='100%' class='moduleTitle' border=1><tr><td><div id='patch_downloads' class='ygrid-mso' style='height:205px;'></div></td></tr></table>";
296
-		$output .= "</div>";
292
+            // jchi ,#24296 :commented code because we are currently not using depot, in the future this may change so you can put this code back in.
293
+            //$output .= PackageManagerDisplay::buildLoginPanel($mod_strings, $display);
294
+            //$output .= "</div>";
295
+            //$output .= "<table width='100%' class='moduleTitle' border=1><tr><td><div id='patch_downloads' class='ygrid-mso' style='height:205px;'></div></td></tr></table>";
296
+        $output .= "</div>";
297 297
 
298
-		return $output;
299
-	}
298
+        return $output;
299
+    }
300 300
 
301
-     /**
302
-     * A Static method used to build the initial treeview when the page is first displayed
303
-     *
304
-     * @param String div_id - this div in which to display the tree
305
-     * @return Tree - the tree that is built
306
-     */
301
+        /**
302
+         * A Static method used to build the initial treeview when the page is first displayed
303
+         *
304
+         * @param String div_id - this div in which to display the tree
305
+         * @return Tree - the tree that is built
306
+         */
307 307
     static function buildTreeView($div_id, $isAlive = true){
308 308
         $tree = new Tree($div_id);
309 309
         $nodes = array();
310 310
         if($isAlive)
311
-        	$nodes = PackageManager::getCategories('');
311
+            $nodes = PackageManager::getCategories('');
312 312
 
313 313
         foreach($nodes as $arr_node){
314 314
             $node = new Node($arr_node['id'], $arr_node['label']);
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
      * @return String - a form used to display the license
336 336
      */
337 337
     function getLicenseDisplay($license_file, $form_action, $next_step, $zipFile, $type, $manifest, $modify_field){
338
-    	global $current_language;
338
+        global $current_language;
339 339
         $mod_strings = return_module_language($current_language, "Administration");
340 340
         $contents = sugar_file_get_contents($license_file);
341 341
         $div_id = urlencode($zipFile);
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
         return $display;
373 373
     }
374 374
 
375
-     /**
376
-     * A Static method used to generate the javascript for the page
377
-     *
378
-     * @return String - the javascript required for the page
379
-     */
375
+        /**
376
+         * A Static method used to generate the javascript for the page
377
+         *
378
+         * @return String - the javascript required for the page
379
+         */
380 380
     static function getDisplayScript($install = false, $type = 'module', $releases = null, $types = array(), $isAlive = true){
381 381
         global $sugar_version, $sugar_config;
382 382
         global $current_language;
@@ -387,72 +387,72 @@  discard block
 block discarded – undo
387 387
         if(!$install){
388 388
             $install = 0;
389 389
         }
390
-		$ss->assign('INSTALLATION', $install);
390
+        $ss->assign('INSTALLATION', $install);
391 391
         $ss->assign('WAIT_IMAGE', SugarThemeRegistry::current()->getImage("loading","border='0' align='bottom'",null,null,'.gif',"Loading"));
392 392
 
393 393
         $ss->assign('sugar_version', $sugar_version);
394 394
         $ss->assign('js_custom_version', $sugar_config['js_custom_version']);
395
-         $ss->assign('IS_ALIVE', $isAlive);
395
+            $ss->assign('IS_ALIVE', $isAlive);
396 396
         //if($type == 'patch' && $releases != null){
397 397
         if($type == 'patch'){
398 398
             $ss->assign('module_load', 'false');
399 399
             $patches = PackageManagerDisplay::createJavascriptPackageArray($releases);
400 400
             $ss->assign('PATCHES', $patches);
401
-             $ss->assign('GRID_TYPE', implode(',', $types));
401
+                $ss->assign('GRID_TYPE', implode(',', $types));
402 402
         }else{
403
-           	$pm = new PackageManager();
404
-           	$releases = $pm->getPackagesInStaging();
405
-           	$patches = PackageManagerDisplay::createJavascriptModuleArray($releases);
403
+                $pm = new PackageManager();
404
+                $releases = $pm->getPackagesInStaging();
405
+                $patches = PackageManagerDisplay::createJavascriptModuleArray($releases);
406 406
             $ss->assign('PATCHES', $patches);
407 407
             $installeds = $pm->getinstalledPackages();
408
-           	$patches = PackageManagerDisplay::createJavascriptModuleArray($installeds, 'mti_installed_data');
408
+                $patches = PackageManagerDisplay::createJavascriptModuleArray($installeds, 'mti_installed_data');
409 409
             $ss->assign('INSTALLED_MODULES', $patches);
410
-			 $ss->assign('UPGARDE_WIZARD_URL', 'index.php?module=UpgradeWizard&action=index');
410
+                $ss->assign('UPGARDE_WIZARD_URL', 'index.php?module=UpgradeWizard&action=index');
411 411
             $ss->assign('module_load', 'true');
412 412
         }
413 413
         if(!empty($GLOBALS['ML_STATUS_MESSAGE']))
414
-        	$ss->assign('ML_STATUS_MESSAGE',$GLOBALS['ML_STATUS_MESSAGE']);
414
+            $ss->assign('ML_STATUS_MESSAGE',$GLOBALS['ML_STATUS_MESSAGE']);
415 415
 
416 416
         //Bug 24064. Checking and Defining labels since these might not be cached during Upgrade
417 417
         if(!isset($mod_strings['LBL_ML_INSTALL']) || empty($mod_strings['LBL_ML_INSTALL'])){
418
-			$mod_strings['LBL_ML_INSTALL'] = 'Install';
419
-    	}
420
-		if(!isset($mod_strings['LBL_ML_ENABLE_OR_DISABLE']) || empty($mod_strings['LBL_ML_ENABLE_OR_DISABLE'])) {
421
-			$mod_strings['LBL_ML_ENABLE_OR_DISABLE'] = 'Enable/Disable';
422
-		}
423
-		if(!isset($mod_strings['LBL_ML_DELETE'])|| empty($mod_strings['LBL_ML_DELETE'])){
424
-			$mod_strings['LBL_ML_DELETE'] = 'Delete';
425
-		}
418
+            $mod_strings['LBL_ML_INSTALL'] = 'Install';
419
+        }
420
+        if(!isset($mod_strings['LBL_ML_ENABLE_OR_DISABLE']) || empty($mod_strings['LBL_ML_ENABLE_OR_DISABLE'])) {
421
+            $mod_strings['LBL_ML_ENABLE_OR_DISABLE'] = 'Enable/Disable';
422
+        }
423
+        if(!isset($mod_strings['LBL_ML_DELETE'])|| empty($mod_strings['LBL_ML_DELETE'])){
424
+            $mod_strings['LBL_ML_DELETE'] = 'Delete';
425
+        }
426 426
         //Add by jchi 6/23/2008 to fix the bug 21667
427
-		$filegrid_column_ary = array(
428
-			'Name' => $mod_strings['LBL_ML_NAME'],
429
-			'Install' => $mod_strings['LBL_ML_INSTALL'],
430
-			'Delete' => $mod_strings['LBL_ML_DELETE'],
431
-			'Type' => $mod_strings['LBL_ML_TYPE'],
432
-			'Version' => $mod_strings['LBL_ML_VERSION'],
433
-			'Published' => $mod_strings['LBL_ML_PUBLISHED'],
434
-			'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'],
435
-			'Description' => $mod_strings['LBL_ML_DESCRIPTION']
436
-		);
437
-
438
-		$filegridinstalled_column_ary = array(
439
-			'Name' => $mod_strings['LBL_ML_NAME'],
440
-			'Install' => $mod_strings['LBL_ML_INSTALL'],
441
-			'Action' => $mod_strings['LBL_ML_ACTION'],
442
-			'Enable_Or_Disable' => $mod_strings['LBL_ML_ENABLE_OR_DISABLE'],
443
-			'Type' => $mod_strings['LBL_ML_TYPE'],
444
-			'Version' => $mod_strings['LBL_ML_VERSION'],
445
-			'Date_Installed' => $mod_strings['LBL_ML_INSTALLED'],
446
-			'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'],
447
-			'Description' => $mod_strings['LBL_ML_DESCRIPTION']
448
-		);
449
-
450
-		$ss->assign('ML_FILEGRID_COLUMN',$filegrid_column_ary);
451
-		$ss->assign('ML_FILEGRIDINSTALLED_COLUMN',$filegridinstalled_column_ary);
452
-		//end
453
-
454
-		$ss->assign('SHOW_IMG', SugarThemeRegistry::current()->getImage('advanced_search', 'border="0"', 8, 8, '.gif', 'Show'));
455
-		$ss->assign('HIDE_IMG', SugarThemeRegistry::current()->getImage('basic_search', 'border="0"', 8, 8, '.gif', 'Hide'));
427
+        $filegrid_column_ary = array(
428
+            'Name' => $mod_strings['LBL_ML_NAME'],
429
+            'Install' => $mod_strings['LBL_ML_INSTALL'],
430
+            'Delete' => $mod_strings['LBL_ML_DELETE'],
431
+            'Type' => $mod_strings['LBL_ML_TYPE'],
432
+            'Version' => $mod_strings['LBL_ML_VERSION'],
433
+            'Published' => $mod_strings['LBL_ML_PUBLISHED'],
434
+            'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'],
435
+            'Description' => $mod_strings['LBL_ML_DESCRIPTION']
436
+        );
437
+
438
+        $filegridinstalled_column_ary = array(
439
+            'Name' => $mod_strings['LBL_ML_NAME'],
440
+            'Install' => $mod_strings['LBL_ML_INSTALL'],
441
+            'Action' => $mod_strings['LBL_ML_ACTION'],
442
+            'Enable_Or_Disable' => $mod_strings['LBL_ML_ENABLE_OR_DISABLE'],
443
+            'Type' => $mod_strings['LBL_ML_TYPE'],
444
+            'Version' => $mod_strings['LBL_ML_VERSION'],
445
+            'Date_Installed' => $mod_strings['LBL_ML_INSTALLED'],
446
+            'Uninstallable' => $mod_strings['LBL_ML_UNINSTALLABLE'],
447
+            'Description' => $mod_strings['LBL_ML_DESCRIPTION']
448
+        );
449
+
450
+        $ss->assign('ML_FILEGRID_COLUMN',$filegrid_column_ary);
451
+        $ss->assign('ML_FILEGRIDINSTALLED_COLUMN',$filegridinstalled_column_ary);
452
+        //end
453
+
454
+        $ss->assign('SHOW_IMG', SugarThemeRegistry::current()->getImage('advanced_search', 'border="0"', 8, 8, '.gif', 'Show'));
455
+        $ss->assign('HIDE_IMG', SugarThemeRegistry::current()->getImage('basic_search', 'border="0"', 8, 8, '.gif', 'Hide'));
456 456
         $str = $ss->fetch('ModuleInstall/PackageManager/tpls/PackageManagerScripts.tpl');
457 457
         return $str;
458 458
     }
@@ -462,15 +462,15 @@  discard block
 block discarded – undo
462 462
         $count = count($releases);
463 463
         $index = 1;
464 464
         if(!empty($releases['packages'])){
465
-	        foreach($releases['packages'] as $release){
466
-	            $release = PackageManager::fromNameValueList($release);
467
-	            $output .= "[";
468
-	            $output .= "'".$release['description']."', '".$release['version']."', '".$release['build_number']."', '".$release['id']."'";
469
-	            $output .= "]";
470
-	            if($index < $count)
471
-	                $output .= ",";
472
-	            $index++;
473
-	        }
465
+            foreach($releases['packages'] as $release){
466
+                $release = PackageManager::fromNameValueList($release);
467
+                $output .= "[";
468
+                $output .= "'".$release['description']."', '".$release['version']."', '".$release['build_number']."', '".$release['id']."'";
469
+                $output .= "]";
470
+                if($index < $count)
471
+                    $output .= ",";
472
+                $index++;
473
+            }
474 474
         }
475 475
         $output .= "]\n;";
476 476
         return $output;
@@ -481,30 +481,30 @@  discard block
 block discarded – undo
481 481
         $count = count($modules);
482 482
         $index = 1;
483 483
         if(!empty($modules)){
484
-	        foreach($modules as $module){
485
-	            $output .= "[";
486
-	            $output .= "'".$module['name']."', '".$module['file_install']."', '".$module['file']."', '";
487
-	            if(!empty($module['enabled']))
488
-	            	$output .= $module['enabled'].'_'.$module['file']."', '";
489
-
490
- 				$description = js_escape($module['description']);
491
-	            $output .= $module['type']."', '".$module['version']."', '".$module['published_date']."', '".$module['uninstallable']."', '".$description."'".(isset($module['upload_file'])?" , '".$module['upload_file']."']":"]");
492
-	            if($index < $count)
493
-	                $output .= ",";
494
-	            $index++;
495
-	        }
484
+            foreach($modules as $module){
485
+                $output .= "[";
486
+                $output .= "'".$module['name']."', '".$module['file_install']."', '".$module['file']."', '";
487
+                if(!empty($module['enabled']))
488
+                    $output .= $module['enabled'].'_'.$module['file']."', '";
489
+
490
+                    $description = js_escape($module['description']);
491
+                $output .= $module['type']."', '".$module['version']."', '".$module['published_date']."', '".$module['uninstallable']."', '".$description."'".(isset($module['upload_file'])?" , '".$module['upload_file']."']":"]");
492
+                if($index < $count)
493
+                    $output .= ",";
494
+                $index++;
495
+            }
496 496
 
497 497
         }
498 498
         $output .= "]\n;";
499 499
         return $output;
500 500
     }
501 501
 
502
-   /**
503
-    *  This method is meant to be used to display the license agreement inline on the page
504
-    *  if the system would like to perform the installation on the same page via an Ajax call
505
-    */
502
+    /**
503
+     *  This method is meant to be used to display the license agreement inline on the page
504
+     *  if the system would like to perform the installation on the same page via an Ajax call
505
+     */
506 506
     function buildLicenseOutput($file){
507
-    	global $current_language;
507
+        global $current_language;
508 508
 
509 509
         $mod_strings = return_module_language($current_language, "Administration");
510 510
         $contents = '';
@@ -520,102 +520,102 @@  discard block
 block discarded – undo
520 520
     }
521 521
 
522 522
     static function getHeader(){
523
-    	global $current_language;
523
+        global $current_language;
524 524
 
525 525
         $mod_strings = return_module_language($current_language, "Administration");
526 526
         $header_text = '';
527 527
         $isAlive = false;
528 528
         $show_login = false;
529 529
         if(!function_exists('curl_init') && $show_login){
530
-        	$header_text = "<font color='red'><b>".$mod_strings['ERR_ENABLE_CURL']."</b></font>";
531
-        	$show_login = false;
530
+            $header_text = "<font color='red'><b>".$mod_strings['ERR_ENABLE_CURL']."</b></font>";
531
+            $show_login = false;
532 532
         }else{
533 533
             $credentials = PackageManager::getCredentials();
534 534
             if(empty($credentials['username']) || empty($credentials['password'])){
535
-            	//$header_text = "<font color='red'><b>".$mod_strings['ERR_CREDENTIALS_MISSING']."</b></font>";
535
+                //$header_text = "<font color='red'><b>".$mod_strings['ERR_CREDENTIALS_MISSING']."</b></font>";
536 536
             }
537 537
             else{
538
-            	$result = PackageManagerComm::login();
539
-            	if((is_array($result) && !empty($result['faultcode'])) || $result == false){
540
-            		$header_text = "<font color='red'><b>".$result['faultstring']."</b></font>";
541
-            	}else{
542
-            		$header_text = PackageManager::getPromotion();
543
-            		$isAlive = true;
544
-            	}
538
+                $result = PackageManagerComm::login();
539
+                if((is_array($result) && !empty($result['faultcode'])) || $result == false){
540
+                    $header_text = "<font color='red'><b>".$result['faultstring']."</b></font>";
541
+                }else{
542
+                    $header_text = PackageManager::getPromotion();
543
+                    $isAlive = true;
544
+                }
545 545
             }
546 546
         }
547 547
         return array('text' => $header_text, 'isAlive' => $isAlive, 'show_login' => $show_login);
548 548
     }
549 549
 
550 550
     function buildInstallGrid($view){
551
-    	$uh = new UpgradeHistory();
552
-    	$installeds = $uh->getAll();
553
-		$upgrades_installed = 0;
554
-		$installed_objects = array();
555
-		foreach($installeds as $installed)
556
-		{
557
-			$filename = from_html($installed->filename);
558
-			$date_entered = $installed->date_entered;
559
-			$type = $installed->type;
560
-			$version = $installed->version;
561
-			$upgrades_installed++;
562
-			$link = "";
563
-
564
-			switch($type)
565
-			{
566
-				case "theme":
567
-				case "langpack":
568
-				case "module":
569
-				case "patch":
570
-				$manifest_file = extractManifest($filename);
571
-				require_once($manifest_file);
572
-
573
-				$name = empty($manifest['name']) ? $filename : $manifest['name'];
574
-				$description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
575
-				if(($upgrades_installed==0 || $uh->UninstallAvailable($installeds, $installed))
576
-					&& is_file($filename) && !empty($manifest['is_uninstallable']))
577
-				{
578
-					$link = urlencode( $filename );
579
-				}
580
-				else
581
-				{
582
-					$link = 'false';
583
-				}
584
-
585
-				break;
586
-				default:
587
-					break;
588
-			}
589
-
590
-			if($view == 'default' && $type != 'patch')
591
-			{
592
-				continue;
593
-			}
594
-
595
-			if($view == 'module'
596
-				&& $type != 'module' && $type != 'theme' && $type != 'langpack')
597
-			{
598
-				continue;
599
-			}
600
-
601
-			$target_manifest = remove_file_extension( $filename ) . "-manifest.php";
602
-			require_once( "$target_manifest" );
603
-
604
-			if(isset($manifest['icon']) && $manifest['icon'] != "")
605
-			{
606
-				$manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
607
-				$manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
608
-				$manifest_icon = clean_path($manifest['icon']);
609
-				$icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir)+1) : $manifest_icon ) . "\">";
610
-			}
611
-			else
612
-			{
613
-				$icon = getImageForType( $manifest['type'] );
614
-			}
615
-			$installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link);
616
-			//print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" );
617
-			//print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" );
618
-			//print( "</form>\n" );
619
-		}
551
+        $uh = new UpgradeHistory();
552
+        $installeds = $uh->getAll();
553
+        $upgrades_installed = 0;
554
+        $installed_objects = array();
555
+        foreach($installeds as $installed)
556
+        {
557
+            $filename = from_html($installed->filename);
558
+            $date_entered = $installed->date_entered;
559
+            $type = $installed->type;
560
+            $version = $installed->version;
561
+            $upgrades_installed++;
562
+            $link = "";
563
+
564
+            switch($type)
565
+            {
566
+                case "theme":
567
+                case "langpack":
568
+                case "module":
569
+                case "patch":
570
+                $manifest_file = extractManifest($filename);
571
+                require_once($manifest_file);
572
+
573
+                $name = empty($manifest['name']) ? $filename : $manifest['name'];
574
+                $description = empty($manifest['description']) ? $mod_strings['LBL_UW_NONE'] : $manifest['description'];
575
+                if(($upgrades_installed==0 || $uh->UninstallAvailable($installeds, $installed))
576
+                    && is_file($filename) && !empty($manifest['is_uninstallable']))
577
+                {
578
+                    $link = urlencode( $filename );
579
+                }
580
+                else
581
+                {
582
+                    $link = 'false';
583
+                }
584
+
585
+                break;
586
+                default:
587
+                    break;
588
+            }
589
+
590
+            if($view == 'default' && $type != 'patch')
591
+            {
592
+                continue;
593
+            }
594
+
595
+            if($view == 'module'
596
+                && $type != 'module' && $type != 'theme' && $type != 'langpack')
597
+            {
598
+                continue;
599
+            }
600
+
601
+            $target_manifest = remove_file_extension( $filename ) . "-manifest.php";
602
+            require_once( "$target_manifest" );
603
+
604
+            if(isset($manifest['icon']) && $manifest['icon'] != "")
605
+            {
606
+                $manifest_copy_files_to_dir = isset($manifest['copy_files']['to_dir']) ? clean_path($manifest['copy_files']['to_dir']) : "";
607
+                $manifest_copy_files_from_dir = isset($manifest['copy_files']['from_dir']) ? clean_path($manifest['copy_files']['from_dir']) : "";
608
+                $manifest_icon = clean_path($manifest['icon']);
609
+                $icon = "<img src=\"" . $manifest_copy_files_to_dir . ($manifest_copy_files_from_dir != "" ? substr($manifest_icon, strlen($manifest_copy_files_from_dir)+1) : $manifest_icon ) . "\">";
610
+            }
611
+            else
612
+            {
613
+                $icon = getImageForType( $manifest['type'] );
614
+            }
615
+            $installed_objects[] = array('icon' => $icon, 'name' => $name, 'type' => $type, 'version' => $version, 'date_entered' => $date_entered, 'description' => $description, 'file' => $link);
616
+            //print( "<form action=\"" . $form_action . "_prepare\" method=\"post\">\n" );
617
+            //print( "<tr><td>$icon</td><td>$name</td><td>$type</td><td>$version</td><td>$date_entered</td><td>$description</td><td>$link</td></tr>\n" );
618
+            //print( "</form>\n" );
619
+        }
620
+    }
620 621
     }
621
- }
Please login to merge, or discard this patch.
ModuleInstall/PackageManager/ListViewPackages.php 1 patch
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.