Completed
Push — develop ( edae1e...431cf5 )
by Adam
20:48
created
modules/Administration/RepairSeedUsers.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,27 +42,27 @@  discard block
 block discarded – undo
42 42
 
43 43
 if(is_admin($current_user)){
44 44
     if(count($_POST)){
45
-    	if(!empty($_POST['activate'])){
45
+        if(!empty($_POST['activate'])){
46 46
 
47
-    		$status = '';
48
-    		if($_POST['activate'] == 'false'){
49
-    			$status = 'Inactive';
50
-    		}else{
51
-    			$status = 'Active';
52
-    		}
53
-    	}
54
-    	$query = "UPDATE users SET status = '$status' WHERE id LIKE 'seed%'";
55
-   		$GLOBALS['db']->query($query);
47
+            $status = '';
48
+            if($_POST['activate'] == 'false'){
49
+                $status = 'Inactive';
50
+            }else{
51
+                $status = 'Active';
52
+            }
53
+        }
54
+        $query = "UPDATE users SET status = '$status' WHERE id LIKE 'seed%'";
55
+            $GLOBALS['db']->query($query);
56 56
     }
57
-    	$query = "SELECT status FROM users WHERE id LIKE 'seed%'";
58
-    	$result = $GLOBALS['db']->query($query);
59
-		$row = $GLOBALS['db']->fetchByAssoc($result);
60
-		if(!empty($row['status'])){
61
-			$activate = 'false';
62
-			if($row['status'] == 'Inactive'){
63
-				$activate = 'true';
64
-			}
65
-			?>
57
+        $query = "SELECT status FROM users WHERE id LIKE 'seed%'";
58
+        $result = $GLOBALS['db']->query($query);
59
+        $row = $GLOBALS['db']->fetchByAssoc($result);
60
+        if(!empty($row['status'])){
61
+            $activate = 'false';
62
+            if($row['status'] == 'Inactive'){
63
+                $activate = 'true';
64
+            }
65
+            ?>
66 66
 				<p>
67 67
 				<form name="RepairSeedUsers" method="post" action="index.php">
68 68
 				<input type="hidden" name="module" value="Administration">
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 				</p>
81 81
 			<?php
82 82
 
83
-		}else{
84
-			echo 'No seed Users';
85
-		}
83
+        }else{
84
+            echo 'No seed Users';
85
+        }
86 86
 }
87 87
 else{
88
-	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
88
+    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
89 89
 }
90 90
 ?>
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 
41 41
 global $current_user;
42 42
 
43
-if(is_admin($current_user)){
44
-    if(count($_POST)){
45
-    	if(!empty($_POST['activate'])){
43
+if (is_admin($current_user)) {
44
+    if (count($_POST)) {
45
+    	if (!empty($_POST['activate'])) {
46 46
 
47 47
     		$status = '';
48
-    		if($_POST['activate'] == 'false'){
48
+    		if ($_POST['activate'] == 'false') {
49 49
     			$status = 'Inactive';
50
-    		}else{
50
+    		} else {
51 51
     			$status = 'Active';
52 52
     		}
53 53
     	}
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     	$query = "SELECT status FROM users WHERE id LIKE 'seed%'";
58 58
     	$result = $GLOBALS['db']->query($query);
59 59
 		$row = $GLOBALS['db']->fetchByAssoc($result);
60
-		if(!empty($row['status'])){
60
+		if (!empty($row['status'])) {
61 61
 			$activate = 'false';
62
-			if($row['status'] == 'Inactive'){
62
+			if ($row['status'] == 'Inactive') {
63 63
 				$activate = 'true';
64 64
 			}
65 65
 			?>
@@ -73,18 +73,18 @@  discard block
 block discarded – undo
73 73
 				<table cellspacing="{CELLSPACING}" class="otherview">
74 74
 					<tr>
75 75
 					    <td scope="row" width="30%"><?php echo $mod_strings['LBL_REPAIR_SEED_USERS_TITLE']; ?></td>
76
-					    <td><input type="submit" name="button" value="<?php if($row['status'] == 'Inactive'){echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE'];}else{echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE'];} ?>"></td>
76
+					    <td><input type="submit" name="button" value="<?php if ($row['status'] == 'Inactive') {echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE']; } else {echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE']; } ?>"></td>
77 77
 					</tr>
78 78
 				</table>
79 79
 				</form>
80 80
 				</p>
81 81
 			<?php
82 82
 
83
-		}else{
83
+		} else {
84 84
 			echo 'No seed Users';
85 85
 		}
86 86
 }
87
-else{
87
+else {
88 88
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
89 89
 }
90 90
 ?>
91 91
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -47,7 +49,7 @@  discard block
 block discarded – undo
47 49
     		$status = '';
48 50
     		if($_POST['activate'] == 'false'){
49 51
     			$status = 'Inactive';
50
-    		}else{
52
+    		} else{
51 53
     			$status = 'Active';
52 54
     		}
53 55
     	}
@@ -73,18 +75,17 @@  discard block
 block discarded – undo
73 75
 				<table cellspacing="{CELLSPACING}" class="otherview">
74 76
 					<tr>
75 77
 					    <td scope="row" width="30%"><?php echo $mod_strings['LBL_REPAIR_SEED_USERS_TITLE']; ?></td>
76
-					    <td><input type="submit" name="button" value="<?php if($row['status'] == 'Inactive'){echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE'];}else{echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE'];} ?>"></td>
78
+					    <td><input type="submit" name="button" value="<?php if($row['status'] == 'Inactive'){echo $mod_strings['LBL_REPAIR_SEED_USERS_ACTIVATE'];} else{echo $mod_strings['LBL_REPAIR_SEED_USERS_DECACTIVATE'];} ?>"></td>
77 79
 					</tr>
78 80
 				</table>
79 81
 				</form>
80 82
 				</p>
81 83
 			<?php
82 84
 
83
-		}else{
85
+		} else{
84 86
 			echo 'No seed Users';
85 87
 		}
86
-}
87
-else{
88
+} else{
88 89
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
89 90
 }
90 91
 ?>
91 92
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Administration/RebuildSchedulers.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@
 block discarded – undo
42 42
 
43 43
 if(isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
44 44
 	
45
-	require_once('install/install_utils.php');
46
-	$focus = new Scheduler();
47
-	$focus->rebuildDefaultSchedulers();
45
+    require_once('install/install_utils.php');
46
+    $focus = new Scheduler();
47
+    $focus->rebuildDefaultSchedulers();
48 48
 	
49 49
 $admin_mod_strings = return_module_language($current_language, 'Administration');	
50 50
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 echo getClassicModuleTitle('Administration', array($mod_strings['LBL_REBUILD_SCHEDULERS_TITLE']), false);
42 42
 
43
-if(isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
43
+if (isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') {
44 44
 	
45 45
 	require_once('install/install_utils.php');
46 46
 	$focus = new Scheduler();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Administration/updater_utils.php 3 patches
Indentation   +211 added lines, -211 removed lines patch added patch discarded remove patch
@@ -44,18 +44,18 @@  discard block
 block discarded – undo
44 44
 require_once('include/utils/encryption_utils.php');
45 45
 
46 46
 function getSystemInfo($send_usage_info=true){
47
-	global $sugar_config;
48
-	global $db, $administration, $timedate;
49
-	$info=array();
50
-	$info = getBaseSystemInfo($send_usage_info);
47
+    global $sugar_config;
48
+    global $db, $administration, $timedate;
49
+    $info=array();
50
+    $info = getBaseSystemInfo($send_usage_info);
51 51
     if($send_usage_info){
52
-		$info['application_key']=$sugar_config['unique_key'];
53
-		$info['php_version']=phpversion();
54
-		if(isset($_SERVER['SERVER_SOFTWARE'])) {
55
-			$info['server_software'] = $_SERVER['SERVER_SOFTWARE'];
56
-		} // if
52
+        $info['application_key']=$sugar_config['unique_key'];
53
+        $info['php_version']=phpversion();
54
+        if(isset($_SERVER['SERVER_SOFTWARE'])) {
55
+            $info['server_software'] = $_SERVER['SERVER_SOFTWARE'];
56
+        } // if
57 57
 
58
-		//get user count.
58
+        //get user count.
59 59
 
60 60
                 $query = "SELECT count(*) as total from users WHERE " . User::getLicensedUsersWhere();
61 61
                 $result = $db->getOne($query, false, 'fetching active users count');
@@ -63,58 +63,58 @@  discard block
 block discarded – undo
63 63
                     $info['users'] = $result;
64 64
                 }
65 65
 
66
-		if(empty($administration)){
66
+        if(empty($administration)){
67 67
 
68
-			$administration = new Administration();
69
-		}
70
-		$administration->retrieveSettings('system');
71
-		$info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):'';
68
+            $administration = new Administration();
69
+        }
70
+        $administration->retrieveSettings('system');
71
+        $info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):'';
72 72
 
73 73
 
74
-		$result=$db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count');
75
-		if($result !== false) {
76
-			$info['admin_users'] = $result;
77
-		}
74
+        $result=$db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count');
75
+        if($result !== false) {
76
+            $info['admin_users'] = $result;
77
+        }
78 78
 
79 79
 
80
-		$result=$db->getOne("select count(*) count from users", false, 'fetching all users count');
81
-		if($result !== false) {
82
-			$info['registered_users'] = $result;
83
-		}
80
+        $result=$db->getOne("select count(*) count from users", false, 'fetching all users count');
81
+        if($result !== false) {
82
+            $info['registered_users'] = $result;
83
+        }
84 84
 
85
-		$lastMonth = $db->convert("'". $timedate->getNow()->modify("-30 days")->asDb(false) . "'", 'datetime');
86
-		if( !$send_usage_info) {
87
-			$info['users_active_30_days'] = -1;
88
-		} else {
89
-			$info['users_active_30_days'] = $db->getOne("SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND  tracker.date_modified >= $lastMonth", false, 'fetching last 30 users count');
90
-		}
85
+        $lastMonth = $db->convert("'". $timedate->getNow()->modify("-30 days")->asDb(false) . "'", 'datetime');
86
+        if( !$send_usage_info) {
87
+            $info['users_active_30_days'] = -1;
88
+        } else {
89
+            $info['users_active_30_days'] = $db->getOne("SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND  tracker.date_modified >= $lastMonth", false, 'fetching last 30 users count');
90
+        }
91 91
 
92 92
 
93 93
 
94 94
 
95
-		if(!$send_usage_info){
96
-			$info['latest_tracker_id'] = -1;
97
-		}else{
98
-			$id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
-			if ( $id !== false )
100
-			    $info['latest_tracker_id'] = $id;
101
-		}
95
+        if(!$send_usage_info){
96
+            $info['latest_tracker_id'] = -1;
97
+        }else{
98
+            $id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
+            if ( $id !== false )
100
+                $info['latest_tracker_id'] = $id;
101
+        }
102 102
 
103
-		$info['db_type']=$sugar_config['dbconfig']['db_type'];
104
-		$info['db_version']=$db->version();
105
-	}
106
-	if(file_exists('distro.php')){
107
-		include('distro.php');
108
-		if(!empty($distro_name))$info['distro_name'] = $distro_name;
109
-	}
110
-	$info['os'] = php_uname('s');
111
-	$info['os_version'] = php_uname('r');
112
-	$info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone');
113
-	$info['timezone'] = date('e');
114
-	if($info['timezone'] == 'e'){
115
-		$info['timezone'] = date('T');
116
-	}
117
-	return $info;
103
+        $info['db_type']=$sugar_config['dbconfig']['db_type'];
104
+        $info['db_version']=$db->version();
105
+    }
106
+    if(file_exists('distro.php')){
107
+        include('distro.php');
108
+        if(!empty($distro_name))$info['distro_name'] = $distro_name;
109
+    }
110
+    $info['os'] = php_uname('s');
111
+    $info['os_version'] = php_uname('r');
112
+    $info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone');
113
+    $info['timezone'] = date('e');
114
+    if($info['timezone'] == 'e'){
115
+        $info['timezone'] = date('T');
116
+    }
117
+    return $info;
118 118
 
119 119
 }
120 120
 
@@ -137,28 +137,28 @@  discard block
 block discarded – undo
137 137
 }
138 138
 
139 139
 function check_now($send_usage_info=true, $get_request_data=false, $response_data = false, $from_install=false ) {
140
-	global $sugar_config, $timedate;
141
-	global $db, $license;
140
+    global $sugar_config, $timedate;
141
+    global $db, $license;
142 142
     include('sugar_version.php');
143 143
 
144 144
 
145
-	$return_array=array();
145
+    $return_array=array();
146 146
     if(!$from_install && empty($license))loadLicense(true);
147 147
 
148
-	if(!$response_data){
148
+    if(!$response_data){
149 149
 
150 150
         if($from_install){
151
-    		$info = getBaseSystemInfo(false);
151
+            $info = getBaseSystemInfo(false);
152 152
 
153 153
         }else{
154 154
             $info = getSystemInfo($send_usage_info);
155 155
         }
156 156
 
157
-		require_once('include/nusoap/nusoap.php');
157
+        require_once('include/nusoap/nusoap.php');
158 158
 
159
-		$GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
160
-		$sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15);
161
-		$ping = $sclient->call('sugarPing', array());
159
+        $GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT');
160
+        $sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15);
161
+        $ping = $sclient->call('sugarPing', array());
162 162
         if (empty($ping) || $sclient->getError()) {
163 163
             if (!$get_request_data) {
164 164
                 return array(
@@ -171,92 +171,92 @@  discard block
 block discarded – undo
171 171
         }
172 172
 
173 173
 
174
-			$key = '4829482749329';
175
-
176
-
177
-
178
-		$encoded = sugarEncode($key, serialize($info));
179
-
180
-		if($get_request_data){
181
-			$request_data = array('key'=>$key, 'data'=>$encoded);
182
-			return serialize($request_data);
183
-		}
184
-		$encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
185
-
186
-	}else{
187
-		$encodedResult = 	$response_data['data'];
188
-		$key = $response_data['key'];
189
-
190
-	}
191
-
192
-	if($response_data || !$sclient->getError()){
193
-		$serializedResultData = sugarDecode($key,$encodedResult);
194
-		$resultData = unserialize($serializedResultData);
195
-		if($response_data && empty($resultData))
196
-		{
197
-			$resultData = array();
198
-			$resultData['validation'] = 'invalid validation key';
199
-		}
200
-	}else
201
-	{
202
-		$resultData = array();
203
-		$resultData['versions'] = array();
204
-
205
-	}
206
-
207
-	if($response_data || !$sclient->getError() )
208
-	{
209
-		if(!empty($resultData['msg'])){
210
-			if(!empty($resultData['msg']['admin'])){
211
-				$license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
212
-			}else{
213
-				$license->saveSetting('license', 'msg_admin','');
214
-			}
215
-			if(!empty($resultData['msg']['all'])){
216
-				$license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
217
-			}else{
218
-				$license->saveSetting('license', 'msg_all','');
219
-			}
220
-		}else{
221
-			$license->saveSetting('license', 'msg_admin','');
222
-			$license->saveSetting('license', 'msg_all','');
223
-		}
224
-		$license->saveSetting('license', 'last_validation', 'success');
225
-		unset($_SESSION['COULD_NOT_CONNECT']);
226
-	}
227
-	else
228
-	{
229
-		$resultData = array();
230
-		$resultData['versions'] = array();
231
-
232
-		$license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
233
-		$license->saveSetting('license', 'last_validation', 'no_connection');
234
-
235
-		if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){
236
-			$license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
237
-
238
-			$license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false))));
239
-		}
240
-		$_SESSION['COULD_NOT_CONNECT'] =TimeDate::getInstance()->nowDb();
241
-
242
-	}
243
-	if(!empty($resultData['versions'])){
244
-
245
-		$license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
246
-	}else{
247
-		$resultData['versions'] = array();
248
-		$license->saveSetting('license', 'latest_versions','')	;
249
-	}
250
-
251
-	if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version'])
174
+            $key = '4829482749329';
175
+
176
+
177
+
178
+        $encoded = sugarEncode($key, serialize($info));
179
+
180
+        if($get_request_data){
181
+            $request_data = array('key'=>$key, 'data'=>$encoded);
182
+            return serialize($request_data);
183
+        }
184
+        $encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
185
+
186
+    }else{
187
+        $encodedResult = 	$response_data['data'];
188
+        $key = $response_data['key'];
189
+
190
+    }
191
+
192
+    if($response_data || !$sclient->getError()){
193
+        $serializedResultData = sugarDecode($key,$encodedResult);
194
+        $resultData = unserialize($serializedResultData);
195
+        if($response_data && empty($resultData))
196
+        {
197
+            $resultData = array();
198
+            $resultData['validation'] = 'invalid validation key';
199
+        }
200
+    }else
201
+    {
202
+        $resultData = array();
203
+        $resultData['versions'] = array();
204
+
205
+    }
206
+
207
+    if($response_data || !$sclient->getError() )
208
+    {
209
+        if(!empty($resultData['msg'])){
210
+            if(!empty($resultData['msg']['admin'])){
211
+                $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
212
+            }else{
213
+                $license->saveSetting('license', 'msg_admin','');
214
+            }
215
+            if(!empty($resultData['msg']['all'])){
216
+                $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
217
+            }else{
218
+                $license->saveSetting('license', 'msg_all','');
219
+            }
220
+        }else{
221
+            $license->saveSetting('license', 'msg_admin','');
222
+            $license->saveSetting('license', 'msg_all','');
223
+        }
224
+        $license->saveSetting('license', 'last_validation', 'success');
225
+        unset($_SESSION['COULD_NOT_CONNECT']);
226
+    }
227
+    else
228
+    {
229
+        $resultData = array();
230
+        $resultData['versions'] = array();
231
+
232
+        $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
233
+        $license->saveSetting('license', 'last_validation', 'no_connection');
234
+
235
+        if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){
236
+            $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
237
+
238
+            $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false))));
239
+        }
240
+        $_SESSION['COULD_NOT_CONNECT'] =TimeDate::getInstance()->nowDb();
241
+
242
+    }
243
+    if(!empty($resultData['versions'])){
244
+
245
+        $license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
246
+    }else{
247
+        $resultData['versions'] = array();
248
+        $license->saveSetting('license', 'latest_versions','')	;
249
+    }
250
+
251
+    if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version'])
252 252
         && compareVersions($sugar_version, $resultData['versions'][0]['version']))
253
-	{
254
-		$resultData['versions'][0]['version'] = $sugar_version;
255
-		$resultData['versions'][0]['description'] = "You have the latest version.";
256
-	}
253
+    {
254
+        $resultData['versions'][0]['version'] = $sugar_version;
255
+        $resultData['versions'][0]['description'] = "You have the latest version.";
256
+    }
257 257
 
258 258
 
259
-	return $resultData['versions'];
259
+    return $resultData['versions'];
260 260
 }
261 261
 /*
262 262
  * returns true if $ver1 > $ver2
@@ -268,126 +268,126 @@  discard block
 block discarded – undo
268 268
 function set_CheckUpdates_config_setting($value) {
269 269
 
270 270
 
271
-	$admin=new Administration();
272
-	$admin->saveSetting('Update','CheckUpdates',$value);
271
+    $admin=new Administration();
272
+    $admin->saveSetting('Update','CheckUpdates',$value);
273 273
 }
274 274
 /* return's value for the 'CheckUpdates' config setting
275 275
 * if the setting does not exist one gets created with a default value of automatic.
276 276
 */
277 277
 function get_CheckUpdates_config_setting() {
278 278
 
279
-	$checkupdates='automatic';
279
+    $checkupdates='automatic';
280 280
 
281 281
 
282
-	$admin=new Administration();
283
-	$admin=$admin->retrieveSettings('Update',true);
284
-	if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) {
285
-		$admin->saveSetting('Update','CheckUpdates','automatic');
286
-	} else {
287
-		$checkupdates=$admin->settings['Update_CheckUpdates'];
288
-	}
289
-	return $checkupdates;
282
+    $admin=new Administration();
283
+    $admin=$admin->retrieveSettings('Update',true);
284
+    if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) {
285
+        $admin->saveSetting('Update','CheckUpdates','automatic');
286
+    } else {
287
+        $checkupdates=$admin->settings['Update_CheckUpdates'];
288
+    }
289
+    return $checkupdates;
290 290
 }
291 291
 
292 292
 function set_last_check_version_config_setting($value) {
293 293
 
294 294
 
295
-	$admin=new Administration();
296
-	$admin->saveSetting('Update','last_check_version',$value);
295
+    $admin=new Administration();
296
+    $admin->saveSetting('Update','last_check_version',$value);
297 297
 }
298 298
 function get_last_check_version_config_setting() {
299 299
 
300 300
 
301 301
 
302
-	$admin=new Administration();
303
-	$admin=$admin->retrieveSettings('Update');
304
-	if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) {
305
-		return null;
306
-	} else {
307
-		return $admin->settings['Update_last_check_version'];
308
-	}
302
+    $admin=new Administration();
303
+    $admin=$admin->retrieveSettings('Update');
304
+    if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) {
305
+        return null;
306
+    } else {
307
+        return $admin->settings['Update_last_check_version'];
308
+    }
309 309
 }
310 310
 
311 311
 
312 312
 function set_last_check_date_config_setting($value) {
313 313
 
314 314
 
315
-	$admin=new Administration();
316
-	$admin->saveSetting('Update','last_check_date',$value);
315
+    $admin=new Administration();
316
+    $admin->saveSetting('Update','last_check_date',$value);
317 317
 }
318 318
 function get_last_check_date_config_setting() {
319 319
 
320 320
 
321 321
 
322
-	$admin=new Administration();
323
-	$admin=$admin->retrieveSettings('Update');
324
-	if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) {
325
-		return 0;
326
-	} else {
327
-		return $admin->settings['Update_last_check_date'];
328
-	}
322
+    $admin=new Administration();
323
+    $admin=$admin->retrieveSettings('Update');
324
+    if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) {
325
+        return 0;
326
+    } else {
327
+        return $admin->settings['Update_last_check_date'];
328
+    }
329 329
 }
330 330
 
331 331
 function set_sugarbeat($value) {
332
-	global $sugar_config;
333
-	$_SUGARBEAT="sugarbeet";
334
-	$sugar_config[$_SUGARBEAT] = $value;
335
-	write_array_to_file( "sugar_config", $sugar_config, "config.php" );
332
+    global $sugar_config;
333
+    $_SUGARBEAT="sugarbeet";
334
+    $sugar_config[$_SUGARBEAT] = $value;
335
+    write_array_to_file( "sugar_config", $sugar_config, "config.php" );
336 336
 }
337 337
 function get_sugarbeat() {
338 338
 
339 339
 
340
-	global $sugar_config;
341
-	$_SUGARBEAT="sugarbeet";
340
+    global $sugar_config;
341
+    $_SUGARBEAT="sugarbeet";
342 342
 
343
-	if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) {
344
-	return false;
345
-	}
346
-	return true;
343
+    if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) {
344
+    return false;
345
+    }
346
+    return true;
347 347
 
348 348
 }
349 349
 
350 350
 
351 351
 
352 352
 function shouldCheckSugar(){
353
-	global $license, $timedate;
354
-	if(
353
+    global $license, $timedate;
354
+    if(
355 355
 
356
-	get_CheckUpdates_config_setting() == 'automatic' ){
357
-		return true;
358
-	}
356
+    get_CheckUpdates_config_setting() == 'automatic' ){
357
+        return true;
358
+    }
359 359
 
360
-	return false;
360
+    return false;
361 361
 }
362 362
 
363 363
 
364 364
 
365 365
 function loadLicense($firstLogin=false){
366 366
 
367
-	$GLOBALS['license']=new Administration();
368
-	$GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin);
367
+    $GLOBALS['license']=new Administration();
368
+    $GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin);
369 369
 
370 370
 }
371 371
 
372 372
 function loginLicense(){
373
-	global $current_user, $license;
374
-	loadLicense(true);
373
+    global $current_user, $license;
374
+    loadLicense(true);
375 375
 
376 376
 
377
-	if (shouldCheckSugar()) {
377
+    if (shouldCheckSugar()) {
378 378
 
379 379
 
380
-		$last_check_date=get_last_check_date_config_setting();
381
-		$current_date_time=time();
382
-		$time_period=3*23*3600 ;
383
-		if (($current_date_time - $last_check_date) > $time_period
384
-		) {
385
-			$version = check_now(get_sugarbeat());
380
+        $last_check_date=get_last_check_date_config_setting();
381
+        $current_date_time=time();
382
+        $time_period=3*23*3600 ;
383
+        if (($current_date_time - $last_check_date) > $time_period
384
+        ) {
385
+            $version = check_now(get_sugarbeat());
386 386
 
387
-			unset($_SESSION['license_seats_needed']);
388
-			loadLicense();
389
-			set_last_check_date_config_setting("$current_date_time");
390
-			include('sugar_version.php');
387
+            unset($_SESSION['license_seats_needed']);
388
+            loadLicense();
389
+            set_last_check_date_config_setting("$current_date_time");
390
+            include('sugar_version.php');
391 391
 
392 392
             $newVersion = '';
393 393
             if (!empty($version) && count($version) == 1)
@@ -396,14 +396,14 @@  discard block
 block discarded – undo
396 396
             }
397 397
 
398 398
             if (version_compare($newVersion, $sugar_version, '>') && is_admin($current_user))
399
-			{
400
-				//set session variables.
401
-				$_SESSION['available_version']=$version[0]['version'];
402
-				$_SESSION['available_version_description']=$version[0]['description'];
403
-				set_last_check_version_config_setting($version[0]['version']);
404
-			}
405
-		}
406
-	}
399
+            {
400
+                //set session variables.
401
+                $_SESSION['available_version']=$version[0]['version'];
402
+                $_SESSION['available_version_description']=$version[0]['description'];
403
+                set_last_check_version_config_setting($version[0]['version']);
404
+            }
405
+        }
406
+    }
407 407
 
408 408
 
409 409
 }
Please login to merge, or discard this patch.
Braces   +21 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -94,10 +96,11 @@  discard block
 block discarded – undo
94 96
 
95 97
 		if(!$send_usage_info){
96 98
 			$info['latest_tracker_id'] = -1;
97
-		}else{
99
+		} else{
98 100
 			$id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
-			if ( $id !== false )
100
-			    $info['latest_tracker_id'] = $id;
101
+			if ( $id !== false ) {
102
+						    $info['latest_tracker_id'] = $id;
103
+			}
101 104
 		}
102 105
 
103 106
 		$info['db_type']=$sugar_config['dbconfig']['db_type'];
@@ -105,7 +108,9 @@  discard block
 block discarded – undo
105 108
 	}
106 109
 	if(file_exists('distro.php')){
107 110
 		include('distro.php');
108
-		if(!empty($distro_name))$info['distro_name'] = $distro_name;
111
+		if(!empty($distro_name)) {
112
+		    $info['distro_name'] = $distro_name;
113
+		}
109 114
 	}
110 115
 	$info['os'] = php_uname('s');
111 116
 	$info['os_version'] = php_uname('r');
@@ -143,14 +148,16 @@  discard block
 block discarded – undo
143 148
 
144 149
 
145 150
 	$return_array=array();
146
-    if(!$from_install && empty($license))loadLicense(true);
151
+    if(!$from_install && empty($license)) {
152
+        loadLicense(true);
153
+    }
147 154
 
148 155
 	if(!$response_data){
149 156
 
150 157
         if($from_install){
151 158
     		$info = getBaseSystemInfo(false);
152 159
 
153
-        }else{
160
+        } else{
154 161
             $info = getSystemInfo($send_usage_info);
155 162
         }
156 163
 
@@ -183,7 +190,7 @@  discard block
 block discarded – undo
183 190
 		}
184 191
 		$encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
185 192
 
186
-	}else{
193
+	} else{
187 194
 		$encodedResult = 	$response_data['data'];
188 195
 		$key = $response_data['key'];
189 196
 
@@ -197,7 +204,7 @@  discard block
 block discarded – undo
197 204
 			$resultData = array();
198 205
 			$resultData['validation'] = 'invalid validation key';
199 206
 		}
200
-	}else
207
+	} else
201 208
 	{
202 209
 		$resultData = array();
203 210
 		$resultData['versions'] = array();
@@ -209,22 +216,21 @@  discard block
 block discarded – undo
209 216
 		if(!empty($resultData['msg'])){
210 217
 			if(!empty($resultData['msg']['admin'])){
211 218
 				$license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
212
-			}else{
219
+			} else{
213 220
 				$license->saveSetting('license', 'msg_admin','');
214 221
 			}
215 222
 			if(!empty($resultData['msg']['all'])){
216 223
 				$license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
217
-			}else{
224
+			} else{
218 225
 				$license->saveSetting('license', 'msg_all','');
219 226
 			}
220
-		}else{
227
+		} else{
221 228
 			$license->saveSetting('license', 'msg_admin','');
222 229
 			$license->saveSetting('license', 'msg_all','');
223 230
 		}
224 231
 		$license->saveSetting('license', 'last_validation', 'success');
225 232
 		unset($_SESSION['COULD_NOT_CONNECT']);
226
-	}
227
-	else
233
+	} else
228 234
 	{
229 235
 		$resultData = array();
230 236
 		$resultData['versions'] = array();
@@ -243,7 +249,7 @@  discard block
 block discarded – undo
243 249
 	if(!empty($resultData['versions'])){
244 250
 
245 251
 		$license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
246
-	}else{
252
+	} else{
247 253
 		$resultData['versions'] = array();
248 254
 		$license->saveSetting('license', 'latest_versions','')	;
249 255
 	}
Please login to merge, or discard this patch.
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -43,47 +43,47 @@  discard block
 block discarded – undo
43 43
 ********************************************************************************/
44 44
 require_once('include/utils/encryption_utils.php');
45 45
 
46
-function getSystemInfo($send_usage_info=true){
46
+function getSystemInfo($send_usage_info = true) {
47 47
 	global $sugar_config;
48 48
 	global $db, $administration, $timedate;
49
-	$info=array();
49
+	$info = array();
50 50
 	$info = getBaseSystemInfo($send_usage_info);
51
-    if($send_usage_info){
52
-		$info['application_key']=$sugar_config['unique_key'];
53
-		$info['php_version']=phpversion();
54
-		if(isset($_SERVER['SERVER_SOFTWARE'])) {
51
+    if ($send_usage_info) {
52
+		$info['application_key'] = $sugar_config['unique_key'];
53
+		$info['php_version'] = phpversion();
54
+		if (isset($_SERVER['SERVER_SOFTWARE'])) {
55 55
 			$info['server_software'] = $_SERVER['SERVER_SOFTWARE'];
56 56
 		} // if
57 57
 
58 58
 		//get user count.
59 59
 
60
-                $query = "SELECT count(*) as total from users WHERE " . User::getLicensedUsersWhere();
60
+                $query = "SELECT count(*) as total from users WHERE ".User::getLicensedUsersWhere();
61 61
                 $result = $db->getOne($query, false, 'fetching active users count');
62 62
                 if ($result !== false) {
63 63
                     $info['users'] = $result;
64 64
                 }
65 65
 
66
-		if(empty($administration)){
66
+		if (empty($administration)) {
67 67
 
68 68
 			$administration = new Administration();
69 69
 		}
70 70
 		$administration->retrieveSettings('system');
71
-		$info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):'';
71
+		$info['system_name'] = (!empty($administration->settings['system_name'])) ?substr($administration->settings['system_name'], 0, 255) : '';
72 72
 
73 73
 
74
-		$result=$db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count');
75
-		if($result !== false) {
74
+		$result = $db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count');
75
+		if ($result !== false) {
76 76
 			$info['admin_users'] = $result;
77 77
 		}
78 78
 
79 79
 
80
-		$result=$db->getOne("select count(*) count from users", false, 'fetching all users count');
81
-		if($result !== false) {
80
+		$result = $db->getOne("select count(*) count from users", false, 'fetching all users count');
81
+		if ($result !== false) {
82 82
 			$info['registered_users'] = $result;
83 83
 		}
84 84
 
85
-		$lastMonth = $db->convert("'". $timedate->getNow()->modify("-30 days")->asDb(false) . "'", 'datetime');
86
-		if( !$send_usage_info) {
85
+		$lastMonth = $db->convert("'".$timedate->getNow()->modify("-30 days")->asDb(false)."'", 'datetime');
86
+		if (!$send_usage_info) {
87 87
 			$info['users_active_30_days'] = -1;
88 88
 		} else {
89 89
 			$info['users_active_30_days'] = $db->getOne("SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND  tracker.date_modified >= $lastMonth", false, 'fetching last 30 users count');
@@ -92,41 +92,41 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 
95
-		if(!$send_usage_info){
95
+		if (!$send_usage_info) {
96 96
 			$info['latest_tracker_id'] = -1;
97
-		}else{
98
-			$id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
-			if ( $id !== false )
97
+		} else {
98
+			$id = $db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry');
99
+			if ($id !== false)
100 100
 			    $info['latest_tracker_id'] = $id;
101 101
 		}
102 102
 
103
-		$info['db_type']=$sugar_config['dbconfig']['db_type'];
104
-		$info['db_version']=$db->version();
103
+		$info['db_type'] = $sugar_config['dbconfig']['db_type'];
104
+		$info['db_version'] = $db->version();
105 105
 	}
106
-	if(file_exists('distro.php')){
106
+	if (file_exists('distro.php')) {
107 107
 		include('distro.php');
108
-		if(!empty($distro_name))$info['distro_name'] = $distro_name;
108
+		if (!empty($distro_name))$info['distro_name'] = $distro_name;
109 109
 	}
110 110
 	$info['os'] = php_uname('s');
111 111
 	$info['os_version'] = php_uname('r');
112 112
 	$info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone');
113 113
 	$info['timezone'] = date('e');
114
-	if($info['timezone'] == 'e'){
114
+	if ($info['timezone'] == 'e') {
115 115
 		$info['timezone'] = date('T');
116 116
 	}
117 117
 	return $info;
118 118
 
119 119
 }
120 120
 
121
-function getBaseSystemInfo($send_usage_info=true){
121
+function getBaseSystemInfo($send_usage_info = true) {
122 122
     include('sugar_version.php');
123
-    $info=array();
123
+    $info = array();
124 124
 
125
-    if($send_usage_info){
126
-        $info['sugar_db_version']=$sugar_db_version;
125
+    if ($send_usage_info) {
126
+        $info['sugar_db_version'] = $sugar_db_version;
127 127
     }
128
-    $info['sugar_version']=$sugar_version;
129
-    $info['sugar_flavor']=$sugar_flavor;
128
+    $info['sugar_version'] = $sugar_version;
129
+    $info['sugar_flavor'] = $sugar_flavor;
130 130
     $info['auth_level'] = 0;
131 131
 
132 132
 
@@ -136,21 +136,21 @@  discard block
 block discarded – undo
136 136
 
137 137
 }
138 138
 
139
-function check_now($send_usage_info=true, $get_request_data=false, $response_data = false, $from_install=false ) {
139
+function check_now($send_usage_info = true, $get_request_data = false, $response_data = false, $from_install = false) {
140 140
 	global $sugar_config, $timedate;
141 141
 	global $db, $license;
142 142
     include('sugar_version.php');
143 143
 
144 144
 
145
-	$return_array=array();
146
-    if(!$from_install && empty($license))loadLicense(true);
145
+	$return_array = array();
146
+    if (!$from_install && empty($license))loadLicense(true);
147 147
 
148
-	if(!$response_data){
148
+	if (!$response_data) {
149 149
 
150
-        if($from_install){
150
+        if ($from_install) {
151 151
     		$info = getBaseSystemInfo(false);
152 152
 
153
-        }else{
153
+        } else {
154 154
             $info = getSystemInfo($send_usage_info);
155 155
         }
156 156
 
@@ -177,49 +177,49 @@  discard block
 block discarded – undo
177 177
 
178 178
 		$encoded = sugarEncode($key, serialize($info));
179 179
 
180
-		if($get_request_data){
180
+		if ($get_request_data) {
181 181
 			$request_data = array('key'=>$key, 'data'=>$encoded);
182 182
 			return serialize($request_data);
183 183
 		}
184 184
 		$encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded));
185 185
 
186
-	}else{
187
-		$encodedResult = 	$response_data['data'];
186
+	} else {
187
+		$encodedResult = $response_data['data'];
188 188
 		$key = $response_data['key'];
189 189
 
190 190
 	}
191 191
 
192
-	if($response_data || !$sclient->getError()){
193
-		$serializedResultData = sugarDecode($key,$encodedResult);
192
+	if ($response_data || !$sclient->getError()) {
193
+		$serializedResultData = sugarDecode($key, $encodedResult);
194 194
 		$resultData = unserialize($serializedResultData);
195
-		if($response_data && empty($resultData))
195
+		if ($response_data && empty($resultData))
196 196
 		{
197 197
 			$resultData = array();
198 198
 			$resultData['validation'] = 'invalid validation key';
199 199
 		}
200
-	}else
200
+	} else
201 201
 	{
202 202
 		$resultData = array();
203 203
 		$resultData['versions'] = array();
204 204
 
205 205
 	}
206 206
 
207
-	if($response_data || !$sclient->getError() )
207
+	if ($response_data || !$sclient->getError())
208 208
 	{
209
-		if(!empty($resultData['msg'])){
210
-			if(!empty($resultData['msg']['admin'])){
209
+		if (!empty($resultData['msg'])) {
210
+			if (!empty($resultData['msg']['admin'])) {
211 211
 				$license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin']));
212
-			}else{
213
-				$license->saveSetting('license', 'msg_admin','');
212
+			} else {
213
+				$license->saveSetting('license', 'msg_admin', '');
214 214
 			}
215
-			if(!empty($resultData['msg']['all'])){
215
+			if (!empty($resultData['msg']['all'])) {
216 216
 				$license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all']));
217
-			}else{
218
-				$license->saveSetting('license', 'msg_all','');
217
+			} else {
218
+				$license->saveSetting('license', 'msg_all', '');
219 219
 			}
220
-		}else{
221
-			$license->saveSetting('license', 'msg_admin','');
222
-			$license->saveSetting('license', 'msg_all','');
220
+		} else {
221
+			$license->saveSetting('license', 'msg_admin', '');
222
+			$license->saveSetting('license', 'msg_all', '');
223 223
 		}
224 224
 		$license->saveSetting('license', 'last_validation', 'success');
225 225
 		unset($_SESSION['COULD_NOT_CONNECT']);
@@ -232,23 +232,23 @@  discard block
 block discarded – undo
232 232
 		$license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb());
233 233
 		$license->saveSetting('license', 'last_validation', 'no_connection');
234 234
 
235
-		if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){
235
+		if (empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])) {
236 236
 			$license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb());
237 237
 
238 238
 			$license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false))));
239 239
 		}
240
-		$_SESSION['COULD_NOT_CONNECT'] =TimeDate::getInstance()->nowDb();
240
+		$_SESSION['COULD_NOT_CONNECT'] = TimeDate::getInstance()->nowDb();
241 241
 
242 242
 	}
243
-	if(!empty($resultData['versions'])){
243
+	if (!empty($resultData['versions'])) {
244 244
 
245
-		$license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions'])));
246
-	}else{
245
+		$license->saveSetting('license', 'latest_versions', base64_encode(serialize($resultData['versions'])));
246
+	} else {
247 247
 		$resultData['versions'] = array();
248
-		$license->saveSetting('license', 'latest_versions','')	;
248
+		$license->saveSetting('license', 'latest_versions', '');
249 249
 	}
250 250
 
251
-	if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version'])
251
+	if (sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version'])
252 252
         && compareVersions($sugar_version, $resultData['versions'][0]['version']))
253 253
 	{
254 254
 		$resultData['versions'][0]['version'] = $sugar_version;
@@ -268,23 +268,23 @@  discard block
 block discarded – undo
268 268
 function set_CheckUpdates_config_setting($value) {
269 269
 
270 270
 
271
-	$admin=new Administration();
272
-	$admin->saveSetting('Update','CheckUpdates',$value);
271
+	$admin = new Administration();
272
+	$admin->saveSetting('Update', 'CheckUpdates', $value);
273 273
 }
274 274
 /* return's value for the 'CheckUpdates' config setting
275 275
 * if the setting does not exist one gets created with a default value of automatic.
276 276
 */
277 277
 function get_CheckUpdates_config_setting() {
278 278
 
279
-	$checkupdates='automatic';
279
+	$checkupdates = 'automatic';
280 280
 
281 281
 
282
-	$admin=new Administration();
283
-	$admin=$admin->retrieveSettings('Update',true);
282
+	$admin = new Administration();
283
+	$admin = $admin->retrieveSettings('Update', true);
284 284
 	if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) {
285
-		$admin->saveSetting('Update','CheckUpdates','automatic');
285
+		$admin->saveSetting('Update', 'CheckUpdates', 'automatic');
286 286
 	} else {
287
-		$checkupdates=$admin->settings['Update_CheckUpdates'];
287
+		$checkupdates = $admin->settings['Update_CheckUpdates'];
288 288
 	}
289 289
 	return $checkupdates;
290 290
 }
@@ -292,15 +292,15 @@  discard block
 block discarded – undo
292 292
 function set_last_check_version_config_setting($value) {
293 293
 
294 294
 
295
-	$admin=new Administration();
296
-	$admin->saveSetting('Update','last_check_version',$value);
295
+	$admin = new Administration();
296
+	$admin->saveSetting('Update', 'last_check_version', $value);
297 297
 }
298 298
 function get_last_check_version_config_setting() {
299 299
 
300 300
 
301 301
 
302
-	$admin=new Administration();
303
-	$admin=$admin->retrieveSettings('Update');
302
+	$admin = new Administration();
303
+	$admin = $admin->retrieveSettings('Update');
304 304
 	if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) {
305 305
 		return null;
306 306
 	} else {
@@ -312,15 +312,15 @@  discard block
 block discarded – undo
312 312
 function set_last_check_date_config_setting($value) {
313 313
 
314 314
 
315
-	$admin=new Administration();
316
-	$admin->saveSetting('Update','last_check_date',$value);
315
+	$admin = new Administration();
316
+	$admin->saveSetting('Update', 'last_check_date', $value);
317 317
 }
318 318
 function get_last_check_date_config_setting() {
319 319
 
320 320
 
321 321
 
322
-	$admin=new Administration();
323
-	$admin=$admin->retrieveSettings('Update');
322
+	$admin = new Administration();
323
+	$admin = $admin->retrieveSettings('Update');
324 324
 	if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) {
325 325
 		return 0;
326 326
 	} else {
@@ -330,15 +330,15 @@  discard block
 block discarded – undo
330 330
 
331 331
 function set_sugarbeat($value) {
332 332
 	global $sugar_config;
333
-	$_SUGARBEAT="sugarbeet";
333
+	$_SUGARBEAT = "sugarbeet";
334 334
 	$sugar_config[$_SUGARBEAT] = $value;
335
-	write_array_to_file( "sugar_config", $sugar_config, "config.php" );
335
+	write_array_to_file("sugar_config", $sugar_config, "config.php");
336 336
 }
337 337
 function get_sugarbeat() {
338 338
 
339 339
 
340 340
 	global $sugar_config;
341
-	$_SUGARBEAT="sugarbeet";
341
+	$_SUGARBEAT = "sugarbeet";
342 342
 
343 343
 	if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) {
344 344
 	return false;
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
 
350 350
 
351 351
 
352
-function shouldCheckSugar(){
352
+function shouldCheckSugar() {
353 353
 	global $license, $timedate;
354
-	if(
354
+	if (
355 355
 
356
-	get_CheckUpdates_config_setting() == 'automatic' ){
356
+	get_CheckUpdates_config_setting() == 'automatic' ) {
357 357
 		return true;
358 358
 	}
359 359
 
@@ -362,14 +362,14 @@  discard block
 block discarded – undo
362 362
 
363 363
 
364 364
 
365
-function loadLicense($firstLogin=false){
365
+function loadLicense($firstLogin = false) {
366 366
 
367
-	$GLOBALS['license']=new Administration();
368
-	$GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin);
367
+	$GLOBALS['license'] = new Administration();
368
+	$GLOBALS['license'] = $GLOBALS['license']->retrieveSettings('license', $firstLogin);
369 369
 
370 370
 }
371 371
 
372
-function loginLicense(){
372
+function loginLicense() {
373 373
 	global $current_user, $license;
374 374
 	loadLicense(true);
375 375
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
 	if (shouldCheckSugar()) {
378 378
 
379 379
 
380
-		$last_check_date=get_last_check_date_config_setting();
381
-		$current_date_time=time();
382
-		$time_period=3*23*3600 ;
380
+		$last_check_date = get_last_check_date_config_setting();
381
+		$current_date_time = time();
382
+		$time_period = 3 * 23 * 3600;
383 383
 		if (($current_date_time - $last_check_date) > $time_period
384 384
 		) {
385 385
 			$version = check_now(get_sugarbeat());
@@ -398,8 +398,8 @@  discard block
 block discarded – undo
398 398
             if (version_compare($newVersion, $sugar_version, '>') && is_admin($current_user))
399 399
 			{
400 400
 				//set session variables.
401
-				$_SESSION['available_version']=$version[0]['version'];
402
-				$_SESSION['available_version_description']=$version[0]['description'];
401
+				$_SESSION['available_version'] = $version[0]['version'];
402
+				$_SESSION['available_version_description'] = $version[0]['description'];
403 403
 				set_last_check_version_config_setting($version[0]['version']);
404 404
 			}
405 405
 		}
Please login to merge, or discard this patch.
modules/Administration/DiagnosticDownload.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 
51 51
 if(!isset($_REQUEST['guid']) || !isset($_REQUEST['time']))
52 52
 {
53
-	die('Did not receive a filename to download');
53
+    die('Did not receive a filename to download');
54 54
 }
55 55
 $time = str_replace(array('.', '/', '\\'), '', $_REQUEST['time']);
56 56
 $guid = str_replace(array('.', '/', '\\'), '', $_REQUEST['guid']);
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     sugar_die("Unauthorized access to diagnostic tool.");
49 49
 }
50 50
 
51
-if(!isset($_REQUEST['guid']) || !isset($_REQUEST['time']))
51
+if (!isset($_REQUEST['guid']) || !isset($_REQUEST['time']))
52 52
 {
53 53
 	die('Did not receive a filename to download');
54 54
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -42,7 +44,9 @@  discard block
 block discarded – undo
42 44
 global $current_user;
43 45
 
44 46
 
45
-if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
47
+if (!is_admin($current_user)) {
48
+    sugar_die("Unauthorized access to administration.");
49
+}
46 50
 if (isset($GLOBALS['sugar_config']['hide_admin_diagnostics']) && $GLOBALS['sugar_config']['hide_admin_diagnostics'])
47 51
 {
48 52
     sugar_die("Unauthorized access to diagnostic tool.");
Please login to merge, or discard this patch.
modules/Administration/expandDatabase.php 3 patches
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -40,38 +40,38 @@  discard block
 block discarded – undo
40 40
 
41 41
 $db = DBManagerFactory::getInstance();
42 42
 if(!$db->supports('fix:expandDatabase')) {
43
-	echo "<BR>";
44
-	echo "<p>".$mod_strings['ERR_NOT_IMPLEMENTED']."</p>";
45
-	echo "<BR>";
46
-	sugar_die('');
43
+    echo "<BR>";
44
+    echo "<p>".$mod_strings['ERR_NOT_IMPLEMENTED']."</p>";
45
+    echo "<BR>";
46
+    sugar_die('');
47 47
 }
48 48
 global $current_user,$beanFiles;
49 49
 
50 50
 set_time_limit(3600);
51 51
 if(is_admin($current_user) || isset($from_sync_client)){
52 52
 
53
-	$execute = false;
54
-	$export = false;
55
-
56
-
57
-	if(isset($_REQUEST['do_action'])){
58
-		switch($_REQUEST['do_action']){
59
-			case 'display':
60
-				break;
61
-			case 'execute':
62
-				$execute = true;
63
-				break;
64
-			case 'export':
65
-				header('Location: index.php?module=Administration&action=expandDatabase&do_action=do_export&to_pdf=true');
66
-				die();
67
-			case 'do_export':
68
-				$export = true;
69
-				break;
70
-		}
71
-
72
-		if(!$export && empty($_REQUEST['repair_silent'])){
73
-			echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'],$_REQUEST['do_action']), true);
74
-		}
53
+    $execute = false;
54
+    $export = false;
55
+
56
+
57
+    if(isset($_REQUEST['do_action'])){
58
+        switch($_REQUEST['do_action']){
59
+            case 'display':
60
+                break;
61
+            case 'execute':
62
+                $execute = true;
63
+                break;
64
+            case 'export':
65
+                header('Location: index.php?module=Administration&action=expandDatabase&do_action=do_export&to_pdf=true');
66
+                die();
67
+            case 'do_export':
68
+                $export = true;
69
+                break;
70
+        }
71
+
72
+        if(!$export && empty($_REQUEST['repair_silent'])){
73
+            echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'],$_REQUEST['do_action']), true);
74
+        }
75 75
 
76 76
         $alter_queries = array();
77 77
         $restore_quries = array();
@@ -88,60 +88,60 @@  discard block
 block discarded – undo
88 88
         $theRestoreQueries = '';
89 89
         $alter_queries = array();
90 90
         while ($row = $db->fetchByAssoc($result)) {
91
-   	      $length = (int)$row['length'];
92
-   	      if($length < 255) {
93
-   	         $newLength = ($length * 3 < 255) ? $length * 3 : 255;
94
-   	         $sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')';
95
-             $theAlterQueries .= $sql . "\n";
96
-             $alter_queries[] = $sql;
97
-
98
-             $sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')';
99
-             $theRestoreQueries .= $sql2 . "\n";
100
-          }
91
+                $length = (int)$row['length'];
92
+                if($length < 255) {
93
+                $newLength = ($length * 3 < 255) ? $length * 3 : 255;
94
+                $sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')';
95
+                $theAlterQueries .= $sql . "\n";
96
+                $alter_queries[] = $sql;
97
+
98
+                $sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')';
99
+                $theRestoreQueries .= $sql2 . "\n";
100
+            }
101 101
         } //while
102 102
 
103 103
         //If there are no ALTER queries to run, echo message
104 104
         if(count($alter_queries) == 0) {
105
-           echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND'];
105
+            echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND'];
106 106
         } else {
107 107
 
108
-	        // Create a backup file to restore columns to original length
109
-	        if($execute) {
110
-	           $fh = sugar_fopen('restoreExpand.sql', 'w');
111
-	           if(-1 == fwrite($fh, $theRestoreQueries)) {
112
-	           	  $GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
113
-	           	  echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
114
-	           } else {
115
-	           	  $GLOBALS['log']->info($mod_strings['LBL_CREATE_RESOTRE_FILE']);
116
-	           	  echo($mod_strings['LBL_CREATE_RESOTRE_FILE']);
117
-	           }
118
-
119
-	           foreach($alter_queries as $key=>$value) {
120
-	           	       $db->query($value);
121
-	           }
122
-	        }
123
-
124
-			if($export) {
125
-		   		header("Content-Disposition: attachment; filename=expandSugarDB.sql");
126
-				header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
127
-				header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
128
-				header( "Last-Modified: " . TimeDate::httpTime() );
129
-				header( "Cache-Control: post-check=0, pre-check=0", false );
130
-				header("Content-Length: ".strlen($theAlterQueries));
131
-		   		echo $theAlterQueries;
132
-		   		die();
133
-			} else {
134
-				if(empty($_REQUEST['repair_silent'])) {
135
-					echo nl2br($theAlterQueries);
136
-				}
137
-			}
108
+            // Create a backup file to restore columns to original length
109
+            if($execute) {
110
+                $fh = sugar_fopen('restoreExpand.sql', 'w');
111
+                if(-1 == fwrite($fh, $theRestoreQueries)) {
112
+                        $GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
113
+                        echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
114
+                } else {
115
+                        $GLOBALS['log']->info($mod_strings['LBL_CREATE_RESOTRE_FILE']);
116
+                        echo($mod_strings['LBL_CREATE_RESOTRE_FILE']);
117
+                }
118
+
119
+                foreach($alter_queries as $key=>$value) {
120
+                            $db->query($value);
121
+                }
122
+            }
123
+
124
+            if($export) {
125
+                    header("Content-Disposition: attachment; filename=expandSugarDB.sql");
126
+                header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
127
+                header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
128
+                header( "Last-Modified: " . TimeDate::httpTime() );
129
+                header( "Cache-Control: post-check=0, pre-check=0", false );
130
+                header("Content-Length: ".strlen($theAlterQueries));
131
+                    echo $theAlterQueries;
132
+                    die();
133
+            } else {
134
+                if(empty($_REQUEST['repair_silent'])) {
135
+                    echo nl2br($theAlterQueries);
136
+                }
137
+            }
138 138
 
139 139
         } //if-else
140
-	} // end do_action
140
+    } // end do_action
141 141
 
142
-	if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
143
-		if(!file_exists('restoreExpand.sql')) {
144
-		        echo "	<b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br>
142
+    if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
143
+        if(!file_exists('restoreExpand.sql')) {
144
+                echo "	<b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br>
145 145
 				<form name='repairdb'>
146 146
 					<input type='hidden' name='action' value='expandDatabase'>
147 147
 					<input type='hidden' name='module' value='Administration'>
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 					</select><input type='submit' class='button' value='".$mod_strings['LBL_GO']."'>
154 154
 				</form><br><br>
155 155
 				".$mod_strings['LBL_EXPAND_DATABASE_TEXT'];
156
-		} else {
157
-			    echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
158
-		} //if-else
159
-	} //if
156
+        } else {
157
+                echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
158
+        } //if-else
159
+    } //if
160 160
 }else{
161
-	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
161
+    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
162 162
 }
163 163
 
164 164
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -39,23 +39,23 @@  discard block
 block discarded – undo
39 39
  ********************************************************************************/
40 40
 
41 41
 $db = DBManagerFactory::getInstance();
42
-if(!$db->supports('fix:expandDatabase')) {
42
+if (!$db->supports('fix:expandDatabase')) {
43 43
 	echo "<BR>";
44 44
 	echo "<p>".$mod_strings['ERR_NOT_IMPLEMENTED']."</p>";
45 45
 	echo "<BR>";
46 46
 	sugar_die('');
47 47
 }
48
-global $current_user,$beanFiles;
48
+global $current_user, $beanFiles;
49 49
 
50 50
 set_time_limit(3600);
51
-if(is_admin($current_user) || isset($from_sync_client)){
51
+if (is_admin($current_user) || isset($from_sync_client)) {
52 52
 
53 53
 	$execute = false;
54 54
 	$export = false;
55 55
 
56 56
 
57
-	if(isset($_REQUEST['do_action'])){
58
-		switch($_REQUEST['do_action']){
57
+	if (isset($_REQUEST['do_action'])) {
58
+		switch ($_REQUEST['do_action']) {
59 59
 			case 'display':
60 60
 				break;
61 61
 			case 'execute':
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 				break;
70 70
 		}
71 71
 
72
-		if(!$export && empty($_REQUEST['repair_silent'])){
73
-			echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'],$_REQUEST['do_action']), true);
72
+		if (!$export && empty($_REQUEST['repair_silent'])) {
73
+			echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], $_REQUEST['do_action']), true);
74 74
 		}
75 75
 
76 76
         $alter_queries = array();
@@ -89,26 +89,26 @@  discard block
 block discarded – undo
89 89
         $alter_queries = array();
90 90
         while ($row = $db->fetchByAssoc($result)) {
91 91
    	      $length = (int)$row['length'];
92
-   	      if($length < 255) {
92
+   	      if ($length < 255) {
93 93
    	         $newLength = ($length * 3 < 255) ? $length * 3 : 255;
94
-   	         $sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')';
95
-             $theAlterQueries .= $sql . "\n";
94
+   	         $sql = 'ALTER TABLE '.$row['table_name'].' ALTER COLUMN '.$row['column_name'].' '.$row['type'].' ('.$newLength.')';
95
+             $theAlterQueries .= $sql."\n";
96 96
              $alter_queries[] = $sql;
97 97
 
98
-             $sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')';
99
-             $theRestoreQueries .= $sql2 . "\n";
98
+             $sql2 = 'ALTER TABLE '.$row['table_name'].' ALTER COLUMN '.$row['column_name'].' '.$row['type'].' ('.$length.')';
99
+             $theRestoreQueries .= $sql2."\n";
100 100
           }
101 101
         } //while
102 102
 
103 103
         //If there are no ALTER queries to run, echo message
104
-        if(count($alter_queries) == 0) {
104
+        if (count($alter_queries) == 0) {
105 105
            echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND'];
106 106
         } else {
107 107
 
108 108
 	        // Create a backup file to restore columns to original length
109
-	        if($execute) {
109
+	        if ($execute) {
110 110
 	           $fh = sugar_fopen('restoreExpand.sql', 'w');
111
-	           if(-1 == fwrite($fh, $theRestoreQueries)) {
111
+	           if (-1 == fwrite($fh, $theRestoreQueries)) {
112 112
 	           	  $GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
113 113
 	           	  echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']);
114 114
 	           } else {
@@ -116,22 +116,22 @@  discard block
 block discarded – undo
116 116
 	           	  echo($mod_strings['LBL_CREATE_RESOTRE_FILE']);
117 117
 	           }
118 118
 
119
-	           foreach($alter_queries as $key=>$value) {
119
+	           foreach ($alter_queries as $key=>$value) {
120 120
 	           	       $db->query($value);
121 121
 	           }
122 122
 	        }
123 123
 
124
-			if($export) {
124
+			if ($export) {
125 125
 		   		header("Content-Disposition: attachment; filename=expandSugarDB.sql");
126 126
 				header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
127
-				header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
128
-				header( "Last-Modified: " . TimeDate::httpTime() );
129
-				header( "Cache-Control: post-check=0, pre-check=0", false );
127
+				header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
128
+				header("Last-Modified: ".TimeDate::httpTime());
129
+				header("Cache-Control: post-check=0, pre-check=0", false);
130 130
 				header("Content-Length: ".strlen($theAlterQueries));
131 131
 		   		echo $theAlterQueries;
132 132
 		   		die();
133 133
 			} else {
134
-				if(empty($_REQUEST['repair_silent'])) {
134
+				if (empty($_REQUEST['repair_silent'])) {
135 135
 					echo nl2br($theAlterQueries);
136 136
 				}
137 137
 			}
@@ -139,8 +139,8 @@  discard block
 block discarded – undo
139 139
         } //if-else
140 140
 	} // end do_action
141 141
 
142
-	if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
143
-		if(!file_exists('restoreExpand.sql')) {
142
+	if (empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) {
143
+		if (!file_exists('restoreExpand.sql')) {
144 144
 		        echo "	<b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br>
145 145
 				<form name='repairdb'>
146 146
 					<input type='hidden' name='action' value='expandDatabase'>
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			    echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
158 158
 		} //if-else
159 159
 	} //if
160
-}else{
160
+} else {
161 161
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
162 162
 }
163 163
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -157,7 +159,7 @@  discard block
 block discarded – undo
157 159
 			    echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>";
158 160
 		} //if-else
159 161
 	} //if
160
-}else{
162
+} else{
161 163
 	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
162 164
 }
163 165
 
Please login to merge, or discard this patch.
modules/Administration/RebuildAudit.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -44,18 +44,18 @@
 block discarded – undo
44 44
 echo $mod_strings['LBL_REBUILD_AUDIT_SEARCH'] . ' <BR>';
45 45
 foreach ($beanFiles as $bean => $file)
46 46
 {
47
-	if(strlen($file) > 0 && file_exists($file)) {
48
-		require_once($file);
49
-	    $focus = new $bean();
50
-		if ($focus->is_AuditEnabled()) {
51
-			if (!$focus->db->tableExists($focus->get_audit_table_name())) {
52
-				printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name);
53
-				$focus->create_audit_table();
54
-			} else {
55
-				printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name);	
56
-			}
57
-		}
58
-	}
47
+    if(strlen($file) > 0 && file_exists($file)) {
48
+        require_once($file);
49
+        $focus = new $bean();
50
+        if ($focus->is_AuditEnabled()) {
51
+            if (!$focus->db->tableExists($focus->get_audit_table_name())) {
52
+                printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name);
53
+                $focus->create_audit_table();
54
+            } else {
55
+                printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name);	
56
+            }
57
+        }
58
+    }
59 59
 }
60 60
 echo $mod_strings['LBL_DONE'];
61 61
 ?>
62 62
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 include('include/modules.php');
42 42
 
43 43
 global $beanFiles, $mod_strings;
44
-echo $mod_strings['LBL_REBUILD_AUDIT_SEARCH'] . ' <BR>';
44
+echo $mod_strings['LBL_REBUILD_AUDIT_SEARCH'].' <BR>';
45 45
 foreach ($beanFiles as $bean => $file)
46 46
 {
47
-	if(strlen($file) > 0 && file_exists($file)) {
47
+	if (strlen($file) > 0 && file_exists($file)) {
48 48
 		require_once($file);
49 49
 	    $focus = new $bean();
50 50
 		if ($focus->is_AuditEnabled()) {
51 51
 			if (!$focus->db->tableExists($focus->get_audit_table_name())) {
52
-				printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name);
52
+				printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'], $focus->get_audit_table_name(), $focus->object_name);
53 53
 				$focus->create_audit_table();
54 54
 			} else {
55
-				printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name);	
55
+				printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'], $focus->object_name);	
56 56
 			}
57 57
 		}
58 58
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Administration/upgrade_custom_relationships.php 3 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -44,82 +44,82 @@
 block discarded – undo
44 44
  */
45 45
 function upgrade_custom_relationships($modules = array())
46 46
 {
47
-	global $current_user, $moduleList;
48
-	if (!is_admin($current_user)) sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
47
+    global $current_user, $moduleList;
48
+    if (!is_admin($current_user)) sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
49 49
 	
50
-	require_once("modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php");
51
-	require_once("modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php");
50
+    require_once("modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php");
51
+    require_once("modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php");
52 52
 	
53
-	if (empty($modules))
54
-		$modules = $moduleList;
53
+    if (empty($modules))
54
+        $modules = $moduleList;
55 55
 	
56
-	foreach($modules as $module)
57
-	{
58
-		$depRels = new DeployedRelationships($module);
59
-		$relList = $depRels->getRelationshipList();
60
-		foreach($relList as $relName)
61
-		{
62
-			$relObject = $depRels->get($relName);
63
-			$def = $relObject->getDefinition();
64
-			//We only need to fix self referencing one to many relationships
65
-			if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many")
66
-			{
67
-				$layout_defs = array();
68
-				if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
69
-					continue;
70
-				//Find the extension file containing the vardefs for this relationship
71
-				foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
72
-				{
73
-					if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
74
-					{
75
-						$dictionary = array($module => array("fields" => array()));
76
-						$filePath = "custom/Extension/modules/$module/Ext/Vardefs/$file";
77
-						include($filePath);
78
-						if(isset($dictionary[$module]["fields"][$relName]))
79
-						{
80
-							$rhsDef = $dictionary[$module]["fields"][$relName];
81
-							//Update the vardef for the left side link field
82
-							if (!isset($rhsDef['side']) || $rhsDef['side'] != 'left')
83
-							{
84
-								$rhsDef['side'] = 'left';
85
-								$fileContents = file_get_contents($filePath);
86
-								$out = preg_replace(
87
-									'/\$dictionary[\w"\'\[\]]*?' . $relName . '["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
88
-									'$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";",
89
-									$fileContents
90
-								);
91
-								file_put_contents($filePath, $out);
92
-							}
93
-						}
94
-					}
95
-				}
96
-				//Find the extension file containing the subpanel definition for this relationship
97
-				foreach(scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
98
-				{
99
-					if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
100
-					{
101
-						$layout_defs = array($module => array("subpanel_setup" => array()));
102
-						$filePath = "custom/Extension/modules/$module/Ext/Layoutdefs/$file";
103
-						include($filePath);
104
-						foreach($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
105
-						{
106
-							if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName)
107
-							{
108
-								$fileContents = file_get_contents($filePath);
109
-								$out = preg_replace(
110
-									'/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]' . $relName . '[\'"],/s',
111
-									"'get_subpanel_data' => '{$def["join_key_lhs"]}',",
112
-									$fileContents
113
-								);
114
-								file_put_contents($filePath, $out);
115
-							}
116
-						}
117
-					}
118
-				}
119
-			}
120
-		}
121
-	}
56
+    foreach($modules as $module)
57
+    {
58
+        $depRels = new DeployedRelationships($module);
59
+        $relList = $depRels->getRelationshipList();
60
+        foreach($relList as $relName)
61
+        {
62
+            $relObject = $depRels->get($relName);
63
+            $def = $relObject->getDefinition();
64
+            //We only need to fix self referencing one to many relationships
65
+            if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many")
66
+            {
67
+                $layout_defs = array();
68
+                if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
69
+                    continue;
70
+                //Find the extension file containing the vardefs for this relationship
71
+                foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
72
+                {
73
+                    if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
74
+                    {
75
+                        $dictionary = array($module => array("fields" => array()));
76
+                        $filePath = "custom/Extension/modules/$module/Ext/Vardefs/$file";
77
+                        include($filePath);
78
+                        if(isset($dictionary[$module]["fields"][$relName]))
79
+                        {
80
+                            $rhsDef = $dictionary[$module]["fields"][$relName];
81
+                            //Update the vardef for the left side link field
82
+                            if (!isset($rhsDef['side']) || $rhsDef['side'] != 'left')
83
+                            {
84
+                                $rhsDef['side'] = 'left';
85
+                                $fileContents = file_get_contents($filePath);
86
+                                $out = preg_replace(
87
+                                    '/\$dictionary[\w"\'\[\]]*?' . $relName . '["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
88
+                                    '$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";",
89
+                                    $fileContents
90
+                                );
91
+                                file_put_contents($filePath, $out);
92
+                            }
93
+                        }
94
+                    }
95
+                }
96
+                //Find the extension file containing the subpanel definition for this relationship
97
+                foreach(scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
98
+                {
99
+                    if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
100
+                    {
101
+                        $layout_defs = array($module => array("subpanel_setup" => array()));
102
+                        $filePath = "custom/Extension/modules/$module/Ext/Layoutdefs/$file";
103
+                        include($filePath);
104
+                        foreach($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
105
+                        {
106
+                            if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName)
107
+                            {
108
+                                $fileContents = file_get_contents($filePath);
109
+                                $out = preg_replace(
110
+                                    '/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]' . $relName . '[\'"],/s',
111
+                                    "'get_subpanel_data' => '{$def["join_key_lhs"]}',",
112
+                                    $fileContents
113
+                                );
114
+                                file_put_contents($filePath, $out);
115
+                            }
116
+                        }
117
+                    }
118
+                }
119
+            }
120
+        }
121
+    }
122 122
 }
123 123
 
124 124
 if (isset($_REQUEST['execute']) && $_REQUEST['execute'])
125
-	upgrade_custom_relationships();
126 125
\ No newline at end of file
126
+    upgrade_custom_relationships();
127 127
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 	if (empty($modules))
54 54
 		$modules = $moduleList;
55 55
 	
56
-	foreach($modules as $module)
56
+	foreach ($modules as $module)
57 57
 	{
58 58
 		$depRels = new DeployedRelationships($module);
59 59
 		$relList = $depRels->getRelationshipList();
60
-		foreach($relList as $relName)
60
+		foreach ($relList as $relName)
61 61
 		{
62 62
 			$relObject = $depRels->get($relName);
63 63
 			$def = $relObject->getDefinition();
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 				if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
69 69
 					continue;
70 70
 				//Find the extension file containing the vardefs for this relationship
71
-				foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
71
+				foreach (scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
72 72
 				{
73
-					if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
73
+					if (substr($file, 0, 1) != "." && strtolower(substr($file, -4)) == ".php")
74 74
 					{
75 75
 						$dictionary = array($module => array("fields" => array()));
76 76
 						$filePath = "custom/Extension/modules/$module/Ext/Vardefs/$file";
77 77
 						include($filePath);
78
-						if(isset($dictionary[$module]["fields"][$relName]))
78
+						if (isset($dictionary[$module]["fields"][$relName]))
79 79
 						{
80 80
 							$rhsDef = $dictionary[$module]["fields"][$relName];
81 81
 							//Update the vardef for the left side link field
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 								$rhsDef['side'] = 'left';
85 85
 								$fileContents = file_get_contents($filePath);
86 86
 								$out = preg_replace(
87
-									'/\$dictionary[\w"\'\[\]]*?' . $relName . '["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
88
-									'$dictionary["' . $module . '"]["fields"]["' . $relName . '"]=' . var_export_helper($rhsDef) . ";",
87
+									'/\$dictionary[\w"\'\[\]]*?'.$relName.'["\'\[\]]*?\s*?=\s*?array\s*?\(.*?\);/s',
88
+									'$dictionary["'.$module.'"]["fields"]["'.$relName.'"]='.var_export_helper($rhsDef).";",
89 89
 									$fileContents
90 90
 								);
91 91
 								file_put_contents($filePath, $out);
@@ -94,20 +94,20 @@  discard block
 block discarded – undo
94 94
 					}
95 95
 				}
96 96
 				//Find the extension file containing the subpanel definition for this relationship
97
-				foreach(scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
97
+				foreach (scandir("custom/Extension/modules/$module/Ext/Layoutdefs") as $file)
98 98
 				{
99
-					if (substr($file,0,1) != "." && strtolower(substr($file, -4)) == ".php")
99
+					if (substr($file, 0, 1) != "." && strtolower(substr($file, -4)) == ".php")
100 100
 					{
101 101
 						$layout_defs = array($module => array("subpanel_setup" => array()));
102 102
 						$filePath = "custom/Extension/modules/$module/Ext/Layoutdefs/$file";
103 103
 						include($filePath);
104
-						foreach($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
104
+						foreach ($layout_defs[$module]["subpanel_setup"] as $key => $subDef)
105 105
 						{
106 106
 							if ($layout_defs[$module]["subpanel_setup"][$key]['get_subpanel_data'] == $relName)
107 107
 							{
108 108
 								$fileContents = file_get_contents($filePath);
109 109
 								$out = preg_replace(
110
-									'/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]' . $relName . '[\'"],/s',
110
+									'/[\'"]get_subpanel_data[\'"]\s*=>\s*[\'"]'.$relName.'[\'"],/s',
111 111
 									"'get_subpanel_data' => '{$def["join_key_lhs"]}',",
112 112
 									$fileContents
113 113
 								);
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,13 +45,16 @@  discard block
 block discarded – undo
45 45
 function upgrade_custom_relationships($modules = array())
46 46
 {
47 47
 	global $current_user, $moduleList;
48
-	if (!is_admin($current_user)) sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
48
+	if (!is_admin($current_user)) {
49
+	    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
50
+	}
49 51
 	
50 52
 	require_once("modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php");
51 53
 	require_once("modules/ModuleBuilder/parsers/relationships/OneToManyRelationship.php");
52 54
 	
53
-	if (empty($modules))
54
-		$modules = $moduleList;
55
+	if (empty($modules)) {
56
+			$modules = $moduleList;
57
+	}
55 58
 	
56 59
 	foreach($modules as $module)
57 60
 	{
@@ -65,8 +68,9 @@  discard block
 block discarded – undo
65 68
 			if ($def['lhs_module'] == $def['rhs_module'] && $def['is_custom'] && $def['relationship_type'] == "one-to-many")
66 69
 			{
67 70
 				$layout_defs = array();
68
-				if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs"))
69
-					continue;
71
+				if (!is_dir("custom/Extension/modules/$module/Ext/Layoutdefs") || !is_dir("custom/Extension/modules/$module/Ext/Vardefs")) {
72
+									continue;
73
+				}
70 74
 				//Find the extension file containing the vardefs for this relationship
71 75
 				foreach(scandir("custom/Extension/modules/$module/Ext/Vardefs") as $file)
72 76
 				{
@@ -121,5 +125,6 @@  discard block
 block discarded – undo
121 125
 	}
122 126
 }
123 127
 
124
-if (isset($_REQUEST['execute']) && $_REQUEST['execute'])
125
-	upgrade_custom_relationships();
126 128
\ No newline at end of file
129
+if (isset($_REQUEST['execute']) && $_REQUEST['execute']) {
130
+	upgrade_custom_relationships();
131
+}
Please login to merge, or discard this patch.
modules/Administration/DiagnosticDelete.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
         "Administration",
52 52
         array(
53 53
             "<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>",
54
-           translate('LBL_DIAGNOSTIC_TITLE')
55
-           ),
54
+            translate('LBL_DIAGNOSTIC_TITLE')
55
+            ),
56 56
         true
57 57
         );
58 58
 
59 59
 
60 60
 if(empty($_REQUEST['file']) || empty($_REQUEST['guid']))
61 61
 {
62
-	echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
62
+    echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
63 63
 }
64 64
 else
65 65
 {
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
     clean_string($_REQUEST['guid'], "ALPHANUM");
68 68
     clean_string($_REQUEST['file'], "FILE");
69 69
 
70
-	//Making sure someone doesn't pass a variable name as a false reference
71
-	//  to delete a file
72
-	if(strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
73
-	{
74
-		die($mod_strings['LBL_DIAGNOSTIC_DELETE_DIE']);
75
-	}
70
+    //Making sure someone doesn't pass a variable name as a false reference
71
+    //  to delete a file
72
+    if(strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
73
+    {
74
+        die($mod_strings['LBL_DIAGNOSTIC_DELETE_DIE']);
75
+    }
76 76
 
77
-	if(file_exists($cachedfile = sugar_cached("diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip")))
78
-	{
79
-  	  unlink($cachedfile);
80
-  	  rmdir(dirname($cachedfile));
81
-	  echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
82
-	}
83
-	else
84
-	  echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
77
+    if(file_exists($cachedfile = sugar_cached("diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip")))
78
+    {
79
+        unlink($cachedfile);
80
+        rmdir(dirname($cachedfile));
81
+        echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
82
+    }
83
+    else
84
+        echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
85 85
 }
86 86
 
87 87
 print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN'] . "</a><br>";
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         );
58 58
 
59 59
 
60
-if(empty($_REQUEST['file']) || empty($_REQUEST['guid']))
60
+if (empty($_REQUEST['file']) || empty($_REQUEST['guid']))
61 61
 {
62 62
 	echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
63 63
 }
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
 
70 70
 	//Making sure someone doesn't pass a variable name as a false reference
71 71
 	//  to delete a file
72
-	if(strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
72
+	if (strcmp(substr($_REQUEST['file'], 0, 10), "diagnostic") != 0)
73 73
 	{
74 74
 		die($mod_strings['LBL_DIAGNOSTIC_DELETE_DIE']);
75 75
 	}
76 76
 
77
-	if(file_exists($cachedfile = sugar_cached("diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip")))
77
+	if (file_exists($cachedfile = sugar_cached("diagnostic/".$_REQUEST['guid']."/".$_REQUEST['file'].".zip")))
78 78
 	{
79 79
   	  unlink($cachedfile);
80 80
   	  rmdir(dirname($cachedfile));
81 81
 	  echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
82 82
 	}
83 83
 	else
84
-	  echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
84
+	  echo $mod_strings['LBL_DIAGNOSTIC_FILE'].$_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
85 85
 }
86 86
 
87
-print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN'] . "</a><br>";
87
+print "<a href=\"index.php?module=Administration&action=index\">".$mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN']."</a><br>";
88 88
 
89 89
 ?>
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -60,8 +62,7 @@  discard block
 block discarded – undo
60 62
 if(empty($_REQUEST['file']) || empty($_REQUEST['guid']))
61 63
 {
62 64
 	echo $mod_strings['LBL_DIAGNOSTIC_DELETE_ERROR'];
63
-}
64
-else
65
+} else
65 66
 {
66 67
     // Make sure the guid and file are valid file names for security purposes
67 68
     clean_string($_REQUEST['guid'], "ALPHANUM");
@@ -79,10 +80,10 @@  discard block
 block discarded – undo
79 80
   	  unlink($cachedfile);
80 81
   	  rmdir(dirname($cachedfile));
81 82
 	  echo $mod_strings['LBL_DIAGNOSTIC_DELETED']."<br><br>";
83
+	} else {
84
+		  echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
85
+	}
82 86
 	}
83
-	else
84
-	  echo $mod_strings['LBL_DIAGNOSTIC_FILE'] . $_REQUEST['file'].$mod_strings['LBL_DIAGNOSTIC_ZIP'];
85
-}
86 87
 
87 88
 print "<a href=\"index.php?module=Administration&action=index\">" . $mod_strings['LBL_DIAGNOSTIC_DELETE_RETURN'] . "</a><br>";
88 89
 
Please login to merge, or discard this patch.
modules/Administration/RebuildRelationship.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@
 block discarded – undo
79 79
 // do the same for custom relationships (true in the last parameter to SugarBean::createRelationshipMeta) - that is, relationships defined in the custom/modules/<modulename>/Ext/vardefs/ area
80 80
 foreach ( $GLOBALS['beanFiles'] as $bean => $file )
81 81
 {
82
-	//skip this file if it does not exist
83
-	if(!file_exists($file)) continue;
82
+    //skip this file if it does not exist
83
+    if(!file_exists($file)) continue;
84 84
 
85
-	if (! class_exists ( $bean ))
85
+    if (! class_exists ( $bean ))
86 86
     {
87 87
         require ($file) ;
88 88
     }
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
3
-    die ( 'Not A Valid Entry Point' ) ;
2
+if (!defined('sugarEntry') || !sugarEntry)
3
+    die ('Not A Valid Entry Point');
4 4
 /*********************************************************************************
5 5
  * SugarCRM Community Edition is a customer relationship management program developed by
6 6
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -39,107 +39,107 @@  discard block
 block discarded – undo
39 39
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
40 40
  ********************************************************************************/
41 41
 
42
-include ('include/modules.php') ;
42
+include ('include/modules.php');
43 43
 
44 44
 
45 45
 
46
-global $db, $mod_strings ;
47
-$log = & $GLOBALS [ 'log' ] ;
46
+global $db, $mod_strings;
47
+$log = & $GLOBALS ['log'];
48 48
 
49
-$query = "DELETE FROM relationships" ;
50
-$db->query ( $query ) ;
49
+$query = "DELETE FROM relationships";
50
+$db->query($query);
51 51
 
52 52
 //clear cache before proceeding..
53
-VardefManager::clearVardef () ;
53
+VardefManager::clearVardef();
54 54
 
55 55
 // loop through all of the modules and create entries in the Relationships table (the relationships metadata) for every standard relationship, that is, relationships defined in the /modules/<module>/vardefs.php
56 56
 // SugarBean::createRelationshipMeta just takes the relationship definition in a file and inserts it as is into the Relationships table
57 57
 // It does not override or recreate existing relationships
58
-foreach ( $GLOBALS['beanFiles'] as $bean => $file )
58
+foreach ($GLOBALS['beanFiles'] as $bean => $file)
59 59
 {
60
-    if (strlen ( $file ) > 0 && file_exists ( $file ))
60
+    if (strlen($file) > 0 && file_exists($file))
61 61
     {
62
-        if (! class_exists ( $bean ))
62
+        if (!class_exists($bean))
63 63
         {
64
-            require ($file) ;
64
+            require ($file);
65 65
         }
66
-        $focus = new $bean ( ) ;
67
-        if ( $focus instanceOf SugarBean ) {
68
-            $table_name = $focus->table_name ;
69
-            $empty = array() ;
70
-            if (empty ( $_REQUEST [ 'silent' ] ))
71
-                echo $mod_strings [ 'LBL_REBUILD_REL_PROC_META' ] . $focus->table_name . "..." ;
72
-            SugarBean::createRelationshipMeta ( $focus->getObjectName (), $db, $table_name, $empty, $focus->module_dir ) ;
73
-            if (empty ( $_REQUEST [ 'silent' ] ))
74
-                echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
66
+        $focus = new $bean( );
67
+        if ($focus instanceOf SugarBean) {
68
+            $table_name = $focus->table_name;
69
+            $empty = array();
70
+            if (empty ($_REQUEST ['silent']))
71
+                echo $mod_strings ['LBL_REBUILD_REL_PROC_META'].$focus->table_name."...";
72
+            SugarBean::createRelationshipMeta($focus->getObjectName(), $db, $table_name, $empty, $focus->module_dir);
73
+            if (empty ($_REQUEST ['silent']))
74
+                echo $mod_strings ['LBL_DONE'].'<br>';
75 75
         }
76 76
     }
77 77
 }
78 78
 
79 79
 // do the same for custom relationships (true in the last parameter to SugarBean::createRelationshipMeta) - that is, relationships defined in the custom/modules/<modulename>/Ext/vardefs/ area
80
-foreach ( $GLOBALS['beanFiles'] as $bean => $file )
80
+foreach ($GLOBALS['beanFiles'] as $bean => $file)
81 81
 {
82 82
 	//skip this file if it does not exist
83
-	if(!file_exists($file)) continue;
83
+	if (!file_exists($file)) continue;
84 84
 
85
-	if (! class_exists ( $bean ))
85
+	if (!class_exists($bean))
86 86
     {
87
-        require ($file) ;
87
+        require ($file);
88 88
     }
89
-    $focus = new $bean ( ) ;
90
-    if ( $focus instanceOf SugarBean ) {
91
-        $table_name = $focus->table_name ;
92
-        $empty = array() ;
93
-        if (empty ( $_REQUEST [ 'silent' ] ))
94
-            echo $mod_strings [ 'LBL_REBUILD_REL_PROC_C_META' ] . $focus->table_name . "..." ;
95
-        SugarBean::createRelationshipMeta ( $focus->getObjectName (), $db, $table_name, $empty, $focus->module_dir, true ) ;
96
-        if (empty ( $_REQUEST [ 'silent' ] ))
97
-            echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
89
+    $focus = new $bean( );
90
+    if ($focus instanceOf SugarBean) {
91
+        $table_name = $focus->table_name;
92
+        $empty = array();
93
+        if (empty ($_REQUEST ['silent']))
94
+            echo $mod_strings ['LBL_REBUILD_REL_PROC_C_META'].$focus->table_name."...";
95
+        SugarBean::createRelationshipMeta($focus->getObjectName(), $db, $table_name, $empty, $focus->module_dir, true);
96
+        if (empty ($_REQUEST ['silent']))
97
+            echo $mod_strings ['LBL_DONE'].'<br>';
98 98
     }
99 99
 }
100 100
 
101 101
 // finally, whip through the list of relationships defined in TableDictionary.php, that is all the relationships in the metadata directory, and install those
102
-    $dictionary = array ( ) ;
103
-    require ('modules/TableDictionary.php') ;
102
+    $dictionary = array( );
103
+    require ('modules/TableDictionary.php');
104 104
     //for module installer incase we already loaded the table dictionary
105
-    if (file_exists ( 'custom/application/Ext/TableDictionary/tabledictionary.ext.php' ))
105
+    if (file_exists('custom/application/Ext/TableDictionary/tabledictionary.ext.php'))
106 106
     {
107
-        include ('custom/application/Ext/TableDictionary/tabledictionary.ext.php') ;
107
+        include ('custom/application/Ext/TableDictionary/tabledictionary.ext.php');
108 108
     }
109
-    $rel_dictionary = $dictionary ;
110
-    foreach ( $rel_dictionary as $rel_name => $rel_data )
109
+    $rel_dictionary = $dictionary;
110
+    foreach ($rel_dictionary as $rel_name => $rel_data)
111 111
     {
112
-        $table = isset($rel_data [ 'table' ]) ? $rel_data [ 'table' ] : "" ;
112
+        $table = isset($rel_data ['table']) ? $rel_data ['table'] : "";
113 113
 
114
-        if (empty ( $_REQUEST [ 'silent' ] ))
115
-            echo $mod_strings [ 'LBL_REBUILD_REL_PROC_C_META' ] . $rel_name . "..." ;
116
-        SugarBean::createRelationshipMeta ( $rel_name, $db, $table, $rel_dictionary, '' ) ;
117
-        if (empty ( $_REQUEST [ 'silent' ] ))
118
-            echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
114
+        if (empty ($_REQUEST ['silent']))
115
+            echo $mod_strings ['LBL_REBUILD_REL_PROC_C_META'].$rel_name."...";
116
+        SugarBean::createRelationshipMeta($rel_name, $db, $table, $rel_dictionary, '');
117
+        if (empty ($_REQUEST ['silent']))
118
+            echo $mod_strings ['LBL_DONE'].'<br>';
119 119
     }
120 120
 
121 121
 //clean relationship cache..will be rebuilt upon first access.
122
-if (empty ( $_REQUEST [ 'silent' ] ))
123
-    echo $mod_strings [ 'LBL_REBUILD_REL_DEL_CACHE' ] ;
124
-Relationship::delete_cache () ;
122
+if (empty ($_REQUEST ['silent']))
123
+    echo $mod_strings ['LBL_REBUILD_REL_DEL_CACHE'];
124
+Relationship::delete_cache();
125 125
 
126 126
 //////////////////////////////////////////////////////////////////////////////
127 127
 // Remove the "Rebuild Relationships" red text message on admin logins
128 128
 
129 129
 
130
-if (empty ( $_REQUEST [ 'silent' ] ))
131
-    echo $mod_strings [ 'LBL_REBUILD_REL_UPD_WARNING' ] ;
130
+if (empty ($_REQUEST ['silent']))
131
+    echo $mod_strings ['LBL_REBUILD_REL_UPD_WARNING'];
132 132
 
133 133
 $rel = new Relationship();
134 134
 Relationship::delete_cache();
135 135
 $rel->build_relationship_cache();
136 136
 
137 137
 // unset the session variable so it is not picked up in DisplayWarnings.php
138
-if (isset ( $_SESSION [ 'rebuild_relationships' ] ))
138
+if (isset ($_SESSION ['rebuild_relationships']))
139 139
 {
140
-    unset ( $_SESSION [ 'rebuild_relationships' ] ) ;
140
+    unset ($_SESSION ['rebuild_relationships']);
141 141
 }
142 142
 
143
-if (empty ( $_REQUEST [ 'silent' ] ))
144
-    echo $mod_strings [ 'LBL_DONE' ] ;
143
+if (empty ($_REQUEST ['silent']))
144
+    echo $mod_strings ['LBL_DONE'];
145 145
 ?>
Please login to merge, or discard this patch.
Braces   +29 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (! defined ( 'sugarEntry' ) || ! sugarEntry)
2
+if (! defined ( 'sugarEntry' ) || ! sugarEntry) {
3 3
     die ( 'Not A Valid Entry Point' ) ;
4
+}
4 5
 /*********************************************************************************
5 6
  * SugarCRM Community Edition is a customer relationship management program developed by
6 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -67,11 +68,13 @@  discard block
 block discarded – undo
67 68
         if ( $focus instanceOf SugarBean ) {
68 69
             $table_name = $focus->table_name ;
69 70
             $empty = array() ;
70
-            if (empty ( $_REQUEST [ 'silent' ] ))
71
-                echo $mod_strings [ 'LBL_REBUILD_REL_PROC_META' ] . $focus->table_name . "..." ;
71
+            if (empty ( $_REQUEST [ 'silent' ] )) {
72
+                            echo $mod_strings [ 'LBL_REBUILD_REL_PROC_META' ] . $focus->table_name . "..." ;
73
+            }
72 74
             SugarBean::createRelationshipMeta ( $focus->getObjectName (), $db, $table_name, $empty, $focus->module_dir ) ;
73
-            if (empty ( $_REQUEST [ 'silent' ] ))
74
-                echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
75
+            if (empty ( $_REQUEST [ 'silent' ] )) {
76
+                            echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
77
+            }
75 78
         }
76 79
     }
77 80
 }
@@ -80,7 +83,9 @@  discard block
 block discarded – undo
80 83
 foreach ( $GLOBALS['beanFiles'] as $bean => $file )
81 84
 {
82 85
 	//skip this file if it does not exist
83
-	if(!file_exists($file)) continue;
86
+	if(!file_exists($file)) {
87
+	    continue;
88
+	}
84 89
 
85 90
 	if (! class_exists ( $bean ))
86 91
     {
@@ -90,11 +95,13 @@  discard block
 block discarded – undo
90 95
     if ( $focus instanceOf SugarBean ) {
91 96
         $table_name = $focus->table_name ;
92 97
         $empty = array() ;
93
-        if (empty ( $_REQUEST [ 'silent' ] ))
94
-            echo $mod_strings [ 'LBL_REBUILD_REL_PROC_C_META' ] . $focus->table_name . "..." ;
98
+        if (empty ( $_REQUEST [ 'silent' ] )) {
99
+                    echo $mod_strings [ 'LBL_REBUILD_REL_PROC_C_META' ] . $focus->table_name . "..." ;
100
+        }
95 101
         SugarBean::createRelationshipMeta ( $focus->getObjectName (), $db, $table_name, $empty, $focus->module_dir, true ) ;
96
-        if (empty ( $_REQUEST [ 'silent' ] ))
97
-            echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
102
+        if (empty ( $_REQUEST [ 'silent' ] )) {
103
+                    echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
104
+        }
98 105
     }
99 106
 }
100 107
 
@@ -111,24 +118,28 @@  discard block
 block discarded – undo
111 118
     {
112 119
         $table = isset($rel_data [ 'table' ]) ? $rel_data [ 'table' ] : "" ;
113 120
 
114
-        if (empty ( $_REQUEST [ 'silent' ] ))
115
-            echo $mod_strings [ 'LBL_REBUILD_REL_PROC_C_META' ] . $rel_name . "..." ;
121
+        if (empty ( $_REQUEST [ 'silent' ] )) {
122
+                    echo $mod_strings [ 'LBL_REBUILD_REL_PROC_C_META' ] . $rel_name . "..." ;
123
+        }
116 124
         SugarBean::createRelationshipMeta ( $rel_name, $db, $table, $rel_dictionary, '' ) ;
117
-        if (empty ( $_REQUEST [ 'silent' ] ))
118
-            echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
125
+        if (empty ( $_REQUEST [ 'silent' ] )) {
126
+                    echo $mod_strings [ 'LBL_DONE' ] . '<br>' ;
127
+        }
119 128
     }
120 129
 
121 130
 //clean relationship cache..will be rebuilt upon first access.
122
-if (empty ( $_REQUEST [ 'silent' ] ))
131
+if (empty ( $_REQUEST [ 'silent' ] )) {
123 132
     echo $mod_strings [ 'LBL_REBUILD_REL_DEL_CACHE' ] ;
133
+}
124 134
 Relationship::delete_cache () ;
125 135
 
126 136
 //////////////////////////////////////////////////////////////////////////////
127 137
 // Remove the "Rebuild Relationships" red text message on admin logins
128 138
 
129 139
 
130
-if (empty ( $_REQUEST [ 'silent' ] ))
140
+if (empty ( $_REQUEST [ 'silent' ] )) {
131 141
     echo $mod_strings [ 'LBL_REBUILD_REL_UPD_WARNING' ] ;
142
+}
132 143
 
133 144
 $rel = new Relationship();
134 145
 Relationship::delete_cache();
@@ -140,6 +151,7 @@  discard block
 block discarded – undo
140 151
     unset ( $_SESSION [ 'rebuild_relationships' ] ) ;
141 152
 }
142 153
 
143
-if (empty ( $_REQUEST [ 'silent' ] ))
154
+if (empty ( $_REQUEST [ 'silent' ] )) {
144 155
     echo $mod_strings [ 'LBL_DONE' ] ;
156
+}
145 157
 ?>
Please login to merge, or discard this patch.