Completed
Push — master ( 58f496...a833c2 )
by Adam
18:52
created
modules/Administration/RebuildExpressionPlugins.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,5 +40,5 @@
 block discarded – undo
40 40
 global $current_user;
41 41
 
42 42
 if(is_admin($current_user)){
43
-	require_once("include/Expressions/updatecache.php");
43
+    require_once("include/Expressions/updatecache.php");
44 44
 }
45 45
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Administration/RepairIndex.php 1 patch
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -42,58 +42,58 @@  discard block
 block discarded – undo
42 42
 ///////////////////////////////////////////////////////////////////////////////
43 43
 ////	LOCAL UTILITY
44 44
 function compare($table_name, $db_indexes, $var_indexes) {
45
-	global $add_index, $drop_index, $change_index;
46
-	if(empty($change_index))$change_index = array();
47
-	foreach ($var_indexes as $var_i_name=>$var_i_def) {
48
-		//find corresponding db index with same name
49
-		//else by columns in the index.
50
-		$sel_db_index = null;
51
-		$var_fields_string ='';
52
-		if(count($var_i_def['fields'])>0)
53
-			$var_fields_string = implode('',$var_i_def['fields']);
54
-		$field_list_match = false;
55
-		if(isset($db_indexes[$var_i_name])) {
56
-			$sel_db_index = $db_indexes[$var_i_name];
57
-			$db_fields_string = implode('', $db_indexes[$var_i_name]['fields']);
58
-			if(strcasecmp($var_fields_string, $db_fields_string)==0) {
59
-				$field_list_match=true;
60
-			}
61
-		} else {
62
-			//search by column list.
63
-			foreach ($db_indexes as $db_i_name=>$db_i_def) {
64
-				$db_fields_string=implode('',$db_i_def['fields']);
65
-				if(strcasecmp($var_fields_string , $db_fields_string)==0) {
66
-					$sel_db_index=$db_indexes[$db_i_name];
67
-					$field_list_match=true;
68
-					break;
69
-				}
70
-			}
71
-		}
45
+    global $add_index, $drop_index, $change_index;
46
+    if(empty($change_index))$change_index = array();
47
+    foreach ($var_indexes as $var_i_name=>$var_i_def) {
48
+        //find corresponding db index with same name
49
+        //else by columns in the index.
50
+        $sel_db_index = null;
51
+        $var_fields_string ='';
52
+        if(count($var_i_def['fields'])>0)
53
+            $var_fields_string = implode('',$var_i_def['fields']);
54
+        $field_list_match = false;
55
+        if(isset($db_indexes[$var_i_name])) {
56
+            $sel_db_index = $db_indexes[$var_i_name];
57
+            $db_fields_string = implode('', $db_indexes[$var_i_name]['fields']);
58
+            if(strcasecmp($var_fields_string, $db_fields_string)==0) {
59
+                $field_list_match=true;
60
+            }
61
+        } else {
62
+            //search by column list.
63
+            foreach ($db_indexes as $db_i_name=>$db_i_def) {
64
+                $db_fields_string=implode('',$db_i_def['fields']);
65
+                if(strcasecmp($var_fields_string , $db_fields_string)==0) {
66
+                    $sel_db_index=$db_indexes[$db_i_name];
67
+                    $field_list_match=true;
68
+                    break;
69
+                }
70
+            }
71
+        }
72 72
 
73
-		//no matching index in database.
74
-		if(empty($sel_db_index)) {
75
-			$add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
76
-			continue;
77
-		}
78
-		if(!$field_list_match) {
79
-			//drop the db index and create new index based on vardef
80
-			$drop_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$sel_db_index,true);
81
-			$add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
82
-			continue;
83
-		}
84
-		//check for name match.
85
-		//it should not occur for indexes of type primary or unique.
86
-		if( $var_i_def['type'] != 'primary' and $var_i_def['type'] != 'unique' and $var_i_def['name'] != $sel_db_index['name']) {
87
-			//rename index.
88
-			$rename=$GLOBALS['db']->renameIndexDefs($sel_db_index,$var_i_def,$table_name);
89
-			if(is_array($rename)) {
90
-				$change_index=array_merge($change_index,$rename);
91
-			} else {
92
-				$change_index[]=$rename;
93
-			}
94
-			continue;
95
-		}
96
-	}
73
+        //no matching index in database.
74
+        if(empty($sel_db_index)) {
75
+            $add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
76
+            continue;
77
+        }
78
+        if(!$field_list_match) {
79
+            //drop the db index and create new index based on vardef
80
+            $drop_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$sel_db_index,true);
81
+            $add_index[]=$GLOBALS['db']->add_drop_constraint($table_name,$var_i_def);
82
+            continue;
83
+        }
84
+        //check for name match.
85
+        //it should not occur for indexes of type primary or unique.
86
+        if( $var_i_def['type'] != 'primary' and $var_i_def['type'] != 'unique' and $var_i_def['name'] != $sel_db_index['name']) {
87
+            //rename index.
88
+            $rename=$GLOBALS['db']->renameIndexDefs($sel_db_index,$var_i_def,$table_name);
89
+            if(is_array($rename)) {
90
+                $change_index=array_merge($change_index,$rename);
91
+            } else {
92
+                $change_index[]=$rename;
93
+            }
94
+            continue;
95
+        }
96
+    }
97 97
 }
98 98
 ////	END LOCAL UTILITY
99 99
 ///////////////////////////////////////////////////////////////////////////////
@@ -124,38 +124,38 @@  discard block
 block discarded – undo
124 124
 (function_exists('logThis')) ? logThis("found ".count($dictionary)." Dictionary entries to process") : "";
125 125
 
126 126
 foreach ($beanFiles as $beanname=>$beanpath) {
127
-	require_once($beanpath);
128
-	$focus= new $beanname();
127
+    require_once($beanpath);
128
+    $focus= new $beanname();
129 129
 
130
-	//skips beans based on same tables. user, employee and group are an example.
131
-	if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
132
-		continue;
133
-	} else {
134
-		$processed_tables[$focus->table_name]=$focus->table_name;
135
-	}
130
+    //skips beans based on same tables. user, employee and group are an example.
131
+    if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
132
+        continue;
133
+    } else {
134
+        $processed_tables[$focus->table_name]=$focus->table_name;
135
+    }
136 136
 
137
-	if(!empty($dictionary[$focus->object_name]['indices'])) {
138
-		$indices=$dictionary[$focus->object_name]['indices'];
139
-	} else {
140
-		$indices=array();
141
-	}
137
+    if(!empty($dictionary[$focus->object_name]['indices'])) {
138
+        $indices=$dictionary[$focus->object_name]['indices'];
139
+    } else {
140
+        $indices=array();
141
+    }
142 142
 
143
-	//clean vardef defintions.. removed indexes not value for this dbtype.
144
-	//set index name as the key.
145
-	$var_indices=array();
146
-	foreach ($indices as $definition) {
147
-		//database helpers do not know how to handle full text indices
148
-		if ($definition['type']=='fulltext') {
149
-			continue;
150
-		}
143
+    //clean vardef defintions.. removed indexes not value for this dbtype.
144
+    //set index name as the key.
145
+    $var_indices=array();
146
+    foreach ($indices as $definition) {
147
+        //database helpers do not know how to handle full text indices
148
+        if ($definition['type']=='fulltext') {
149
+            continue;
150
+        }
151 151
 
152
-		if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
153
-			$var_indices[$definition['name']] = $definition;
154
-		}
155
-	}
152
+        if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
153
+            $var_indices[$definition['name']] = $definition;
154
+        }
155
+    }
156 156
 
157
-	$db_indices=$focus->db->get_indices($focus->table_name);
158
-	compare($focus->table_name,$db_indices,$var_indices);
157
+    $db_indices=$focus->db->get_indices($focus->table_name);
158
+    compare($focus->table_name,$db_indices,$var_indices);
159 159
 }
160 160
 ////	END PROCESS MODULE BEANS
161 161
 ///////////////////////////////////////////////////////////////////////////////
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
 ////	PROCESS RELATIONSHIP METADATA - run thru many to many relationship files too...
166 166
 include('modules/TableDictionary.php');
167 167
 foreach ($dictionary as $rel=>$rel_def) {
168
-	if(!empty($rel_def['indices'])) {
169
-		$indices=$rel_def['indices'];
170
-	} else {
171
-		$indices=array();
172
-	}
168
+    if(!empty($rel_def['indices'])) {
169
+        $indices=$rel_def['indices'];
170
+    } else {
171
+        $indices=array();
172
+    }
173 173
 
174
-	//clean vardef defintions.. removed indexes not value for this dbtype.
175
-	//set index name as the key.
176
-	$var_indices=array();
177
-	foreach ($indices as $definition) {
178
-		if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
179
-			$var_indices[$definition['name']] = $definition;
180
-		}
181
-	}
174
+    //clean vardef defintions.. removed indexes not value for this dbtype.
175
+    //set index name as the key.
176
+    $var_indices=array();
177
+    foreach ($indices as $definition) {
178
+        if(empty($definition['db']) or $definition['db'] == $focus->db->dbType) {
179
+            $var_indices[$definition['name']] = $definition;
180
+        }
181
+    }
182 182
 
183
-	$db_indices=$focus->db->get_indices($rel_def['table']);
183
+    $db_indices=$focus->db->get_indices($rel_def['table']);
184 184
 
185
-	compare($rel_def['table'],$db_indices,$var_indices);
185
+    compare($rel_def['table'],$db_indices,$var_indices);
186 186
 }
187 187
 ////	END PROCESS RELATIONSHIP METADATA
188 188
 ///////////////////////////////////////////////////////////////////////////////
@@ -193,64 +193,64 @@  discard block
 block discarded – undo
193 193
 (function_exists('logThis')) ? logThis("RepairIndex: we have ".count($change_index)." indices to CHANGE.") : "";
194 194
 
195 195
 if((count($drop_index) > 0 or count($add_index) > 0 or count($change_index) > 0)) {
196
-	if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
197
-		echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
198
-		echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
199
-	}
196
+    if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
197
+        echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
198
+        echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
199
+    }
200 200
 
201
-	$focus = new Account();
202
-	if(count($drop_index) > 0) {
203
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
204
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROPPING'];
205
-			foreach ($drop_index as $statement) {
206
-				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
207
-				(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
208
-				$focus->db->query($statement);
209
-			}
210
-		} else {
211
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROP'];
212
-			foreach ($drop_index as $statement) {
213
-				echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
214
-			}
215
-		}
216
-	}
201
+    $focus = new Account();
202
+    if(count($drop_index) > 0) {
203
+        if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
204
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROPPING'];
205
+            foreach ($drop_index as $statement) {
206
+                echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
207
+                (function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
208
+                $focus->db->query($statement);
209
+            }
210
+        } else {
211
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_DROP'];
212
+            foreach ($drop_index as $statement) {
213
+                echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
214
+            }
215
+        }
216
+    }
217 217
 
218
-	if(count($add_index) > 0) {
219
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
220
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADDING'];
221
-			foreach ($add_index as $statement) {
222
-				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
223
-				(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
224
-				$focus->db->query($statement);
225
-			}
226
-		} else {
227
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADD'];
228
-			foreach ($add_index as $statement) {
229
-				echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
230
-			}
231
-		}
232
-	}
233
-	if(count($change_index) > 0) {
234
-		if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
235
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTERING'];
236
-			foreach ($change_index as $statement) {
237
-				echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
238
-				(function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
239
-				$focus->db->query($statement);
240
-			}
241
-		} else {
242
-			echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTER'];
243
-			foreach ($change_index as $statement) {
244
-				echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
245
-			}
246
-		}
247
-	}
218
+    if(count($add_index) > 0) {
219
+        if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
220
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADDING'];
221
+            foreach ($add_index as $statement) {
222
+                echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
223
+                (function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
224
+                $focus->db->query($statement);
225
+            }
226
+        } else {
227
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ADD'];
228
+            foreach ($add_index as $statement) {
229
+                echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
230
+            }
231
+        }
232
+    }
233
+    if(count($change_index) > 0) {
234
+        if(isset($_REQUEST['mode']) and $_REQUEST['mode']=='execute') {
235
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTERING'];
236
+            foreach ($change_index as $statement) {
237
+                echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_EXECUTING'].$statement;
238
+                (function_exists('logThis')) ? logThis("RepairIndex: {$statement}") : "";
239
+                $focus->db->query($statement);
240
+            }
241
+        } else {
242
+            echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_ALTER'];
243
+            foreach ($change_index as $statement) {
244
+                echo ($_REQUEST['silent']) ? "" : "<BR>".$statement.";";
245
+            }
246
+        }
247
+    }
248 248
 
249
-	if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
250
-		echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
251
-		echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
252
-	}
249
+    if(!isset($_REQUEST['mode']) or $_REQUEST['mode'] != 'execute') {
250
+        echo ($_REQUEST['silent']) ? "" : "<BR><BR><BR>";
251
+        echo ($_REQUEST['silent']) ? "" : "<a href='index.php?module=Administration&action=RepairIndex&mode=execute'>Execute Script</a>";
252
+    }
253 253
 } else {
254
-	(function_exists('logThis')) ? logThis("RepairIndex: Index definitions are in sync.") : "";
255
-	echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_SYNC'];
254
+    (function_exists('logThis')) ? logThis("RepairIndex: Index definitions are in sync.") : "";
255
+    echo ($_REQUEST['silent']) ? "" : $mod_strings['LBL_REPAIR_INDEX_SYNC'];
256 256
 }
257 257
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Administration/PasswordManager.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -51,17 +51,17 @@  discard block
 block discarded – undo
51 51
     sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); 
52 52
 }
53 53
 function clearPasswordSettings() {
54
-	    $_POST['passwordsetting_SystemGeneratedPasswordON'] = '';
55
-	    $_POST['passwordsetting_generatepasswordtmpl'] = '';
56
-	    $_POST['passwordsetting_lostpasswordtmpl'] = '';
57
-	    $_POST['passwordsetting_forgotpasswordON'] = '0';
58
-	    $_POST['passwordsetting_linkexpiration'] = '1';
59
-	    $_POST['passwordsetting_linkexpirationtime'] = '30';
60
-	    $_POST['passwordsetting_linkexpirationtype'] = '1';
61
-	    $_POST['passwordsetting_systexpiration'] = '0';
62
-	    $_POST['passwordsetting_systexpirationtime'] = '';
63
-	    $_POST['passwordsetting_systexpirationtype'] = '0';
64
-	    $_POST['passwordsetting_systexpirationlogin'] = '';
54
+        $_POST['passwordsetting_SystemGeneratedPasswordON'] = '';
55
+        $_POST['passwordsetting_generatepasswordtmpl'] = '';
56
+        $_POST['passwordsetting_lostpasswordtmpl'] = '';
57
+        $_POST['passwordsetting_forgotpasswordON'] = '0';
58
+        $_POST['passwordsetting_linkexpiration'] = '1';
59
+        $_POST['passwordsetting_linkexpirationtime'] = '30';
60
+        $_POST['passwordsetting_linkexpirationtype'] = '1';
61
+        $_POST['passwordsetting_systexpiration'] = '0';
62
+        $_POST['passwordsetting_systexpirationtime'] = '';
63
+        $_POST['passwordsetting_systexpirationtype'] = '0';
64
+        $_POST['passwordsetting_systexpirationlogin'] = '';
65 65
 
66 66
 }
67 67
 require_once('modules/Administration/Forms.php');
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
         "Administration", 
70 70
         array(
71 71
             "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
72
-           $mod_strings['LBL_MANAGE_PASSWORD_TITLE'],
73
-           ), 
72
+            $mod_strings['LBL_MANAGE_PASSWORD_TITLE'],
73
+            ), 
74 74
         false
75 75
         );
76 76
 require_once('modules/Configurator/Configurator.php');
@@ -81,30 +81,30 @@  discard block
 block discarded – undo
81 81
 $valid_public_key= true;
82 82
 if(!empty($_POST['saveConfig'])){
83 83
     if ($_POST['captcha_on'] == '1'){
84
-		$handle = @fopen("http://www.google.com/recaptcha/api/challenge?k=".$_POST['captcha_public_key']."&cachestop=35235354", "r");
85
-		$buffer ='';
86
-		if ($handle) {
87
-		    while (!feof($handle)) {
88
-		        $buffer .= fgets($handle, 4096);
89
-		    }
90
-		    fclose($handle);
91
-		}
92
-		$valid_public_key= substr($buffer, 1, 4) == 'var '? true : false;
93
-	}
94
-	if ($valid_public_key){
95
-		if (isset($_REQUEST['system_ldap_enabled']) && $_REQUEST['system_ldap_enabled'] == 'on') {
96
-			$_POST['system_ldap_enabled'] = 1;
97
-			clearPasswordSettings();
98
-		} 
99
-		else 
100
-			$_POST['system_ldap_enabled'] = 0;
84
+        $handle = @fopen("http://www.google.com/recaptcha/api/challenge?k=".$_POST['captcha_public_key']."&cachestop=35235354", "r");
85
+        $buffer ='';
86
+        if ($handle) {
87
+            while (!feof($handle)) {
88
+                $buffer .= fgets($handle, 4096);
89
+            }
90
+            fclose($handle);
91
+        }
92
+        $valid_public_key= substr($buffer, 1, 4) == 'var '? true : false;
93
+    }
94
+    if ($valid_public_key){
95
+        if (isset($_REQUEST['system_ldap_enabled']) && $_REQUEST['system_ldap_enabled'] == 'on') {
96
+            $_POST['system_ldap_enabled'] = 1;
97
+            clearPasswordSettings();
98
+        } 
99
+        else 
100
+            $_POST['system_ldap_enabled'] = 0;
101 101
 
102 102
 
103 103
         if(isset($_REQUEST['authenticationClass']))
104 104
         {
105
-	        $configurator->useAuthenticationClass = true;
105
+            $configurator->useAuthenticationClass = true;
106 106
         } else {
107
-	        $configurator->useAuthenticationClass = false;
107
+            $configurator->useAuthenticationClass = false;
108 108
             $_POST['authenticationClass'] = '';
109 109
         }
110 110
 
@@ -114,25 +114,25 @@  discard block
 block discarded – undo
114 114
             $_POST['ldap_group_attr_req_dn'] = 0;
115 115
         }
116 116
 
117
-		if (isset($_REQUEST['ldap_group_checkbox']) && $_REQUEST['ldap_group_checkbox'] == 'on') 
118
-			$_POST['ldap_group'] = 1;
119
-		else
120
-			$_POST['ldap_group'] = 0;
117
+        if (isset($_REQUEST['ldap_group_checkbox']) && $_REQUEST['ldap_group_checkbox'] == 'on') 
118
+            $_POST['ldap_group'] = 1;
119
+        else
120
+            $_POST['ldap_group'] = 0;
121 121
 			
122
-		if (isset($_REQUEST['ldap_authentication_checkbox']) && $_REQUEST['ldap_authentication_checkbox'] == 'on') 
123
-			$_POST['ldap_authentication'] = 1;
124
-		else
125
-		    $_POST['ldap_authentication'] = 0;
122
+        if (isset($_REQUEST['ldap_authentication_checkbox']) && $_REQUEST['ldap_authentication_checkbox'] == 'on') 
123
+            $_POST['ldap_authentication'] = 1;
124
+        else
125
+            $_POST['ldap_authentication'] = 0;
126 126
 		
127
-		if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime'])  )
128
-		    $_POST['passwordsetting_lockoutexpiration'] = 2;
127
+        if( isset($_REQUEST['passwordsetting_lockoutexpirationtime']) && is_numeric($_REQUEST['passwordsetting_lockoutexpirationtime'])  )
128
+            $_POST['passwordsetting_lockoutexpiration'] = 2;
129 129
 
130
-		$configurator->saveConfig();
130
+        $configurator->saveConfig();
131 131
 		
132
-		$focus->saveConfig();
132
+        $focus->saveConfig();
133 133
 		
134
-		header('Location: index.php?module=Administration&action=index');
135
-	}
134
+        header('Location: index.php?module=Administration&action=index');
135
+    }
136 136
 }
137 137
 
138 138
 $focus->retrieveSettings();
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 
166 166
 
167 167
 if(!function_exists('mcrypt_cbc')){
168
-	$sugar_smarty->assign("LDAP_ENC_KEY_READONLY", 'readonly');
169
-	$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']);
168
+    $sugar_smarty->assign("LDAP_ENC_KEY_READONLY", 'readonly');
169
+    $sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LDAP_ENC_KEY_NO_FUNC_DESC']);
170 170
 }else{
171
-	$sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
171
+    $sugar_smarty->assign("LDAP_ENC_KEY_DESC", $config_strings['LBL_LDAP_ENC_KEY_DESC']);
172 172
 }
173 173
 $sugar_smarty->assign("settings", $focus->settings);
174 174
 
175 175
 if ($valid_public_key){
176
-	if(!empty($focus->settings['captcha_on'])){
177
-		$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
178
-	}else{
179
-		$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
180
-	}
176
+    if(!empty($focus->settings['captcha_on'])){
177
+        $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
178
+    }else{
179
+        $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'none');
180
+    }
181 181
 }else{
182
-	$sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
182
+    $sugar_smarty->assign("CAPTCHA_CONFIG_DISPLAY", 'inline');
183 183
 }
184 184
 
185 185
 $sugar_smarty->assign("VALID_PUBLIC_KEY", $valid_public_key);
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 $mail = new SugarPHPMailer();
194 194
 $mail->setMailerForSystem();
195 195
 if($mail->Mailer == 'smtp' && $mail->Host ==''){
196
-	$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
197
-	}
196
+    $sugar_smarty->assign("SMTP_SERVER_NOT_SET", '1');
197
+    }
198 198
 else
199
-	$sugar_smarty->assign("SMTP_SERVER_NOT_SET", '0');
199
+    $sugar_smarty->assign("SMTP_SERVER_NOT_SET", '0');
200 200
 	
201 201
 $focus = new InboundEmail();
202 202
 $focus->checkImap();
Please login to merge, or discard this patch.
modules/Administration/UpgradeHistory.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
     function determineIfUpgrade($id_name, $version){
128 128
         $query = "SELECT id, version FROM " . $this->table_name . " WHERE id_name = '$id_name' ORDER BY date_entered DESC";
129 129
         $result = $this->db->query($query);
130
-         if(empty($result)){
130
+            if(empty($result)){
131 131
             return null;
132
-         }else{
132
+            }else{
133 133
             $temp_version = 0;
134 134
             $id = '';
135 135
             while($row = $this->db->fetchByAssoc($result))
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                 return array('id' => $id, 'version' => $temp_version);
144 144
             else
145 145
                 return null;
146
-         }
146
+            }
147 147
     }
148 148
 
149 149
     function getAll()
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             return $this->is_right_version_greater($left, $right, $equals_is_greater);
255 255
         }
256 256
         else if($left[0] < $right[0]){
257
-           return true;
257
+            return true;
258 258
         }
259 259
         else
260 260
             return false;
Please login to merge, or discard this patch.
modules/Administration/RebuildConfig.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
     // is not merged (bug #54403)
69 69
     $clean_config = loadCleanConfig();
70 70
     if ( rebuildConfigFile($clean_config, $sugar_version) ) {
71
-    	$config_check = $mod_strings['MSG_CONFIG_FILE_REBUILD_SUCCESS'];
71
+        $config_check = $mod_strings['MSG_CONFIG_FILE_REBUILD_SUCCESS'];
72 72
         $disable_config_rebuild = 'disabled="disabled"';
73 73
     }
74 74
     else {
Please login to merge, or discard this patch.
modules/Administration/UpgradeWizard.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 $uh = new UpgradeHistory();
47 47
 
48 48
 function unlinkTempFiles() {
49
-	global $sugar_config;
50
-	@unlink($_FILES['upgrade_zip']['tmp_name']);
51
-	@unlink("upload://".$_FILES['upgrade_zip']['name']);
49
+    global $sugar_config;
50
+    @unlink($_FILES['upgrade_zip']['tmp_name']);
51
+    @unlink("upload://".$_FILES['upgrade_zip']['name']);
52 52
 }
53 53
 
54 54
 $base_upgrade_dir       = "upload://upgrades";
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 
64 64
 // get labels and text that are specific to either Module Loader or Upgrade Wizard
65 65
 if( $view == "module") {
66
-	$uploaddLabel = $mod_strings['LBL_UW_UPLOAD_MODULE'];
67
-	$descItemsQueued = $mod_strings['LBL_UW_DESC_MODULES_QUEUED'];
68
-	$descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
66
+    $uploaddLabel = $mod_strings['LBL_UW_UPLOAD_MODULE'];
67
+    $descItemsQueued = $mod_strings['LBL_UW_DESC_MODULES_QUEUED'];
68
+    $descItemsInstalled = $mod_strings['LBL_UW_DESC_MODULES_INSTALLED'];
69 69
 }
70 70
 else {
71 71
 
72
-	$uploaddLabel = $mod_strings['LBL_UPLOAD_UPGRADE'];
73
-	$descItemsQueued = $mod_strings['DESC_FILES_QUEUED'];
74
-	$descItemsInstalled = $mod_strings['DESC_FILES_INSTALLED'];
72
+    $uploaddLabel = $mod_strings['LBL_UPLOAD_UPGRADE'];
73
+    $descItemsQueued = $mod_strings['DESC_FILES_QUEUED'];
74
+    $descItemsInstalled = $mod_strings['DESC_FILES_INSTALLED'];
75 75
 }
76 76
 
77 77
 //
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 $upload_max_filesize_bytes = return_bytes($upload_max_filesize);
85 85
 if($upload_max_filesize_bytes < constant('SUGARCRM_MIN_UPLOAD_MAX_FILESIZE_BYTES'))
86 86
 {
87
-	$GLOBALS['log']->debug("detected upload_max_filesize: $upload_max_filesize");
88
-	print('<p class="error">' . $mod_strings['MSG_INCREASE_UPLOAD_MAX_FILESIZE'] . ' '
89
-		. get_cfg_var('cfg_file_path') . "</p>\n");
87
+    $GLOBALS['log']->debug("detected upload_max_filesize: $upload_max_filesize");
88
+    print('<p class="error">' . $mod_strings['MSG_INCREASE_UPLOAD_MAX_FILESIZE'] . ' '
89
+        . get_cfg_var('cfg_file_path') . "</p>\n");
90 90
 }
91 91
 
92 92
 //
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
             $perform = true;
106 106
             $base_filename = urldecode($tempFile);
107 107
         } elseif(!empty($_REQUEST['load_module_from_dir'])) {
108
-        	//copy file to proper location then call performSetup
109
-        	copy($_REQUEST['load_module_from_dir'].'/'.$_REQUEST['upgrade_zip_escaped'], "upload://".$_REQUEST['upgrade_zip_escaped']);
108
+            //copy file to proper location then call performSetup
109
+            copy($_REQUEST['load_module_from_dir'].'/'.$_REQUEST['upgrade_zip_escaped'], "upload://".$_REQUEST['upgrade_zip_escaped']);
110 110
 
111
-        	$perform = true;
111
+            $perform = true;
112 112
             $base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] );
113 113
         } else {
114 114
             if( empty( $_FILES['upgrade_zip']['tmp_name'] ) ){
@@ -119,72 +119,72 @@  discard block
 block discarded – undo
119 119
                     strtolower(pathinfo($upload->get_stored_file_name(), PATHINFO_EXTENSION)) != 'zip' ||
120 120
                     !$upload->final_move($upload->get_stored_file_name())
121 121
                     ) {
122
-    			    unlinkTempFiles();
122
+                    unlinkTempFiles();
123 123
                     sugar_die("Invalid Package");
124
-            	} else {
125
-    			     $tempFile = "upload://".$upload->get_stored_file_name();
126
-                     $perform = true;
127
-                     $base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] );
128
-    		    }
124
+                } else {
125
+                        $tempFile = "upload://".$upload->get_stored_file_name();
126
+                        $perform = true;
127
+                        $base_filename = urldecode( $_REQUEST['upgrade_zip_escaped'] );
128
+                }
129 129
             }
130 130
         }
131 131
         if($perform) {
132 132
             $manifest_file = extractManifest( $tempFile );
133
-			if(is_file($manifest_file))
134
-			{
135
-    			//SCAN THE MANIFEST FILE TO MAKE SURE NO COPIES OR ANYTHING ARE HAPPENING IN IT
136
-	    		$ms = new ModuleScanner();
137
-	    		$ms->lockConfig();
138
-		    	$fileIssues = $ms->scanFile($manifest_file);
139
-    			if(!empty($fileIssues)){
140
-    				echo '<h2>' . $mod_strings['ML_MANIFEST_ISSUE'] . '</h2><br>';
141
-    				$ms->displayIssues();
142
-    				die();
143
-    			}
144
-    			list($manifest, $installdefs) = MSLoadManifest($manifest_file);
145
-    			if($ms->checkConfig($manifest_file)) {
146
-    				echo '<h2>' . $mod_strings['ML_MANIFEST_ISSUE'] . '</h2><br>';
147
-    				$ms->displayIssues();
148
-    				die();
149
-    			}
150
-    			validate_manifest( $manifest );
151
-
152
-			    $upgrade_zip_type = $manifest['type'];
153
-
154
-    			// exclude the bad permutations
155
-    			if( $view == "module" )	{
156
-    				if ($upgrade_zip_type != "module" && $upgrade_zip_type != "theme" && $upgrade_zip_type != "langpack") {
157
-    					unlinkTempFiles();
158
-    					 die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']);
159
-    				}
160
-    			} elseif( $view == "default" ) {
161
-    				if($upgrade_zip_type != "patch" ) {
162
-    					unlinkTempFiles();
163
-    					die($mod_strings['ERR_UW_ONLY_PATCHES']);
164
-    				}
165
-    			}
166
-
167
-    			$base_filename = pathinfo($tempFile, PATHINFO_BASENAME);
168
-
169
-    			mkdir_recursive( "$base_upgrade_dir/$upgrade_zip_type" );
170
-	    		$target_path = "$base_upgrade_dir/$upgrade_zip_type/$base_filename";
171
-			    $target_manifest = remove_file_extension( $target_path ) . "-manifest.php";
172
-
173
-    			if( isset($manifest['icon']) && $manifest['icon'] != "" ){
174
-	    			 $icon_location = extractFile( $tempFile ,$manifest['icon'] );
175
-    				 copy($icon_location, remove_file_extension( $target_path )."-icon.".pathinfo($icon_location, PATHINFO_EXTENSION));
176
-	    		}
177
-
178
-				if(rename( $tempFile , $target_path )) {
179
-					 copy( $manifest_file, $target_manifest );
180
-					$GLOBALS['ML_STATUS_MESSAGE'] = $base_filename.$mod_strings['LBL_UW_UPLOAD_SUCCESS'];
133
+            if(is_file($manifest_file))
134
+            {
135
+                //SCAN THE MANIFEST FILE TO MAKE SURE NO COPIES OR ANYTHING ARE HAPPENING IN IT
136
+                $ms = new ModuleScanner();
137
+                $ms->lockConfig();
138
+                $fileIssues = $ms->scanFile($manifest_file);
139
+                if(!empty($fileIssues)){
140
+                    echo '<h2>' . $mod_strings['ML_MANIFEST_ISSUE'] . '</h2><br>';
141
+                    $ms->displayIssues();
142
+                    die();
143
+                }
144
+                list($manifest, $installdefs) = MSLoadManifest($manifest_file);
145
+                if($ms->checkConfig($manifest_file)) {
146
+                    echo '<h2>' . $mod_strings['ML_MANIFEST_ISSUE'] . '</h2><br>';
147
+                    $ms->displayIssues();
148
+                    die();
149
+                }
150
+                validate_manifest( $manifest );
151
+
152
+                $upgrade_zip_type = $manifest['type'];
153
+
154
+                // exclude the bad permutations
155
+                if( $view == "module" )	{
156
+                    if ($upgrade_zip_type != "module" && $upgrade_zip_type != "theme" && $upgrade_zip_type != "langpack") {
157
+                        unlinkTempFiles();
158
+                            die($mod_strings['ERR_UW_NOT_ACCEPTIBLE_TYPE']);
159
+                    }
160
+                } elseif( $view == "default" ) {
161
+                    if($upgrade_zip_type != "patch" ) {
162
+                        unlinkTempFiles();
163
+                        die($mod_strings['ERR_UW_ONLY_PATCHES']);
164
+                    }
165
+                }
166
+
167
+                $base_filename = pathinfo($tempFile, PATHINFO_BASENAME);
168
+
169
+                mkdir_recursive( "$base_upgrade_dir/$upgrade_zip_type" );
170
+                $target_path = "$base_upgrade_dir/$upgrade_zip_type/$base_filename";
171
+                $target_manifest = remove_file_extension( $target_path ) . "-manifest.php";
172
+
173
+                if( isset($manifest['icon']) && $manifest['icon'] != "" ){
174
+                        $icon_location = extractFile( $tempFile ,$manifest['icon'] );
175
+                        copy($icon_location, remove_file_extension( $target_path )."-icon.".pathinfo($icon_location, PATHINFO_EXTENSION));
176
+                }
177
+
178
+                if(rename( $tempFile , $target_path )) {
179
+                        copy( $manifest_file, $target_manifest );
180
+                    $GLOBALS['ML_STATUS_MESSAGE'] = $base_filename.$mod_strings['LBL_UW_UPLOAD_SUCCESS'];
181 181
                 } else{
182
-					 $GLOBALS['ML_STATUS_MESSAGE'] = $mod_strings['ERR_UW_UPLOAD_ERROR'];
183
-				}
184
-			} else {
185
-				unlinkTempFiles();
186
-				die($mod_strings['ERR_UW_NO_MANIFEST']);
187
-			}
182
+                        $GLOBALS['ML_STATUS_MESSAGE'] = $mod_strings['ERR_UW_UPLOAD_ERROR'];
183
+                }
184
+            } else {
185
+                unlinkTempFiles();
186
+                die($mod_strings['ERR_UW_NO_MANIFEST']);
187
+            }
188 188
         }
189 189
     } else if( $run == $mod_strings['LBL_UW_BTN_DELETE_PACKAGE'] ){
190 190
         if(!empty ($_REQUEST['install_file']) ){
@@ -199,36 +199,36 @@  discard block
 block discarded – undo
199 199
         strpos($checkFile, "..") !== false || !file_exists($checkFile)) {
200 200
             die("<span class='error'>File is not a zipped archive.</span>");
201 201
         }
202
-		if(unlink($delete_me)) { // successful deletion?
203
-			echo "Package $delete_me has been removed.<br>";
204
-		} else {
205
-			die("Problem removing package $delete_me.");
206
-		}
202
+        if(unlink($delete_me)) { // successful deletion?
203
+            echo "Package $delete_me has been removed.<br>";
204
+        } else {
205
+            die("Problem removing package $delete_me.");
206
+        }
207 207
     }
208 208
 }
209 209
 
210 210
 if( $view == "module") {
211
-	print( getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_LOADER_TITLE']), false) );
211
+    print( getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_LOADER_TITLE']), false) );
212 212
 }
213 213
 else {
214
-	print( getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_NAME'],$mod_strings['LBL_UPGRADE_WIZARD_TITLE']), false) );
214
+    print( getClassicModuleTitle($mod_strings['LBL_MODULE_NAME'], array($mod_strings['LBL_MODULE_NAME'],$mod_strings['LBL_UPGRADE_WIZARD_TITLE']), false) );
215 215
 }
216 216
 
217 217
 // upload link
218 218
 if(!empty($GLOBALS['sugar_config']['use_common_ml_dir']) && $GLOBALS['sugar_config']['use_common_ml_dir'] && !empty($GLOBALS['sugar_config']['common_ml_dir'])){
219
-	//rrs
220
-	$form = '<form name="move_form" action="index.php?module=Administration&view=module&action=UpgradeWizard" method="post"  ><input type=hidden name="run" value="upload" /><input type=hidden name="load_module_from_dir" id="load_module_from_dir" value="'.$GLOBALS['sugar_config']['common_ml_dir'].'" /><input type=hidden name="upgrade_zip_escaped" value="" />';
221
-	$form .= '<br>'.$mod_strings['LBL_MODULE_UPLOAD_DISABLE_HELP_TEXT'].'</br>';
222
-	$form .='<table width="100%" class="edit view"><tr><th align="left">'.$mod_strings['LBL_ML_NAME'].'</th><th align="left">'.$mod_strings['LBL_ML_ACTION'].'</th></tr>';
223
-	if ($handle = opendir($GLOBALS['sugar_config']['common_ml_dir'])) {
224
-		while (false !== ($filename = readdir($handle))) {
225
-	        if($filename == '.' || $filename == '..' || !preg_match("#.*\.zip\$#", $filename)) {
219
+    //rrs
220
+    $form = '<form name="move_form" action="index.php?module=Administration&view=module&action=UpgradeWizard" method="post"  ><input type=hidden name="run" value="upload" /><input type=hidden name="load_module_from_dir" id="load_module_from_dir" value="'.$GLOBALS['sugar_config']['common_ml_dir'].'" /><input type=hidden name="upgrade_zip_escaped" value="" />';
221
+    $form .= '<br>'.$mod_strings['LBL_MODULE_UPLOAD_DISABLE_HELP_TEXT'].'</br>';
222
+    $form .='<table width="100%" class="edit view"><tr><th align="left">'.$mod_strings['LBL_ML_NAME'].'</th><th align="left">'.$mod_strings['LBL_ML_ACTION'].'</th></tr>';
223
+    if ($handle = opendir($GLOBALS['sugar_config']['common_ml_dir'])) {
224
+        while (false !== ($filename = readdir($handle))) {
225
+            if($filename == '.' || $filename == '..' || !preg_match("#.*\.zip\$#", $filename)) {
226 226
                 continue;
227 227
             }
228
-	        $form .= '<tr><td>'.$filename.'</td><td><input type=button class="button" value="'.$mod_strings['LBL_UW_BTN_UPLOAD'].'" onClick="document.move_form.upgrade_zip_escaped.value = escape( \''.$filename.'\');document.move_form.submit();" /></td></tr>';
229
-	    }
230
-	}
231
-	$form .= '</table></form>';
228
+            $form .= '<tr><td>'.$filename.'</td><td><input type=button class="button" value="'.$mod_strings['LBL_UW_BTN_UPLOAD'].'" onClick="document.move_form.upgrade_zip_escaped.value = escape( \''.$filename.'\');document.move_form.submit();" /></td></tr>';
229
+        }
230
+    }
231
+    $form .= '</table></form>';
232 232
 //rrs
233 233
 
234 234
 }else{
Please login to merge, or discard this patch.
modules/Administration/RebuildFulltextIndices.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -41,42 +41,42 @@
 block discarded – undo
41 41
 global $current_user;
42 42
 
43 43
 if(!is_admin($current_user)){
44
-	die('Unauthorized Access. Aborting.');
44
+    die('Unauthorized Access. Aborting.');
45 45
 }
46 46
 
47 47
 //find  modules that have a full-text index and rebuild it.
48 48
 global $beanFiles;
49 49
 foreach ($beanFiles as $beanname=>$beanpath) {
50
-	require_once($beanpath);
51
-	$focus= new $beanname();
50
+    require_once($beanpath);
51
+    $focus= new $beanname();
52 52
 
53
-	//skips beans based on same tables. user, employee and group are an example.
54
-	if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
55
-		continue;
56
-	} else {
57
-		$processed_tables[$focus->table_name]=$focus->table_name;
58
-	}
53
+    //skips beans based on same tables. user, employee and group are an example.
54
+    if(empty($focus->table_name) || isset($processed_tables[$focus->table_name])) {
55
+        continue;
56
+    } else {
57
+        $processed_tables[$focus->table_name]=$focus->table_name;
58
+    }
59 59
 
60
-	if(!empty($dictionary[$focus->object_name]['indices'])) {
61
-		$indices=$dictionary[$focus->object_name]['indices'];
62
-	} else {
63
-		$indices=array();
64
-	}
60
+    if(!empty($dictionary[$focus->object_name]['indices'])) {
61
+        $indices=$dictionary[$focus->object_name]['indices'];
62
+    } else {
63
+        $indices=array();
64
+    }
65 65
 
66
-	//clean vardef definitions.. removed indexes not value for this dbtype.
67
-	//set index name as the key.
68
-	$var_indices=array();
69
-	foreach ($indices as $definition) {
70
-		//database helpers do not know how to handle full text indices
71
-		if ($definition['type']=='fulltext') {
72
-			if (isset($definition['db']) and $definition['db'] != $GLOBALS['db']->dbType) {
73
-				continue;
74
-			}
66
+    //clean vardef definitions.. removed indexes not value for this dbtype.
67
+    //set index name as the key.
68
+    $var_indices=array();
69
+    foreach ($indices as $definition) {
70
+        //database helpers do not know how to handle full text indices
71
+        if ($definition['type']=='fulltext') {
72
+            if (isset($definition['db']) and $definition['db'] != $GLOBALS['db']->dbType) {
73
+                continue;
74
+            }
75 75
 
76
-			echo "Rebuilding Index {$definition['name']} <BR/>";
77
-			$GLOBALS['db']->query('alter index ' .$definition['name'] . " REBUILD");
78
-		}
76
+            echo "Rebuilding Index {$definition['name']} <BR/>";
77
+            $GLOBALS['db']->query('alter index ' .$definition['name'] . " REBUILD");
78
+        }
79 79
 
80
-	}
80
+    }
81 81
 }
82 82
 ?>
Please login to merge, or discard this patch.
modules/Administration/repairDatabase.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if (!defined('sugarEntry') || !sugarEntry)
3
-	die('Not A Valid Entry Point');
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.
@@ -47,78 +47,78 @@  discard block
 block discarded – undo
47 47
 $db = DBManagerFactory::getInstance();
48 48
 
49 49
 if (is_admin($current_user) || isset ($from_sync_client) || is_admin_for_any_module($current_user)) {
50
-	isset($_REQUEST['execute'])? $execute=$_REQUEST['execute'] : $execute= false;
51
-	$export = false;
52
-
53
-	if (sizeof($_POST) && isset ($_POST['raction'])) {
54
-		if (isset ($_POST['raction']) && strtolower($_POST['raction']) == "export") {
55
-			//jc - output buffering is being used. if we do not clean the output buffer
56
-			//the contents of the buffer up to the length of the repair statement(s)
57
-			//will be saved in the file...
58
-			ob_clean();
59
-
60
-			header("Content-Disposition: attachment; filename=repairSugarDB.sql");
61
-			header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
62
-			header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
63
-			header("Last-Modified: " . TimeDate::httpTime());
64
-			header("Cache-Control: post-check=0, pre-check=0", false);
65
-			header("Content-Length: " . strlen($_POST['sql']));
66
-
67
-		    //jc:7347 - for whatever reason, html_entity_decode is choking on converting
68
-		    //the html entity &#039; to a single quote, so we will use str_replace
69
-		    //instead
70
-		    $sql = str_replace('&#039;',"'", $_POST['sql']);
71
-		    //echo html_entity_decode($_POST['sql']);
72
-		    echo $sql;
73
-		}
74
-		elseif (isset ($_POST['raction']) && strtolower($_POST['raction']) == "execute") {
75
-			$sql = str_replace(
76
-				array(
77
-					"\n",
78
-					'&#039;',
79
-				),
80
-				array(
81
-					'',
82
-					"'",
83
-				),
84
-				preg_replace('#(/\*.+?\*/\n*)#', '', $_POST['sql'])
85
-			);
86
-			foreach (explode(";", $sql) as $stmt) {
87
-				$stmt = trim($stmt);
88
-
89
-				if (!empty ($stmt)) {
90
-					$db->query($stmt,true,'Executing repair query: ');
91
-				}
92
-			}
93
-
94
-			echo "<h3>{$mod_strings['LBL_REPAIR_DATABASE_SYNCED']}</h3>";
95
-		}
96
-	} else {
97
-
98
-		if (!$export && empty ($_REQUEST['repair_silent'])) {
99
-			if ( empty($hideModuleMenu) )
100
-		        echo getClassicModuleTitle($mod_strings['LBL_REPAIR_DATABASE'], array($mod_strings['LBL_REPAIR_DATABASE']), true);
101
-			echo "<h1 id=\"rdloading\">{$mod_strings['LBL_REPAIR_DATABASE_PROCESSING']}</h1>";
102
-			ob_flush();
103
-		}
104
-
105
-		$sql = '';
106
-
107
-		VardefManager::clearVardef();
108
-		$repairedTables = array();
109
-
110
-		foreach ($beanFiles as $bean => $file) {
111
-			if(file_exists($file)){
112
-				require_once ($file);
113
-				unset($GLOBALS['dictionary'][$bean]);
114
-				$focus = new $bean ();
115
-				if (($focus instanceOf SugarBean) && !isset($repairedTables[$focus->table_name])) {
116
-				    $sql .= $db->repairTable($focus, $execute);
117
-				    $repairedTables[$focus->table_name] = true;
118
-				}
50
+    isset($_REQUEST['execute'])? $execute=$_REQUEST['execute'] : $execute= false;
51
+    $export = false;
52
+
53
+    if (sizeof($_POST) && isset ($_POST['raction'])) {
54
+        if (isset ($_POST['raction']) && strtolower($_POST['raction']) == "export") {
55
+            //jc - output buffering is being used. if we do not clean the output buffer
56
+            //the contents of the buffer up to the length of the repair statement(s)
57
+            //will be saved in the file...
58
+            ob_clean();
59
+
60
+            header("Content-Disposition: attachment; filename=repairSugarDB.sql");
61
+            header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}");
62
+            header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
63
+            header("Last-Modified: " . TimeDate::httpTime());
64
+            header("Cache-Control: post-check=0, pre-check=0", false);
65
+            header("Content-Length: " . strlen($_POST['sql']));
66
+
67
+            //jc:7347 - for whatever reason, html_entity_decode is choking on converting
68
+            //the html entity &#039; to a single quote, so we will use str_replace
69
+            //instead
70
+            $sql = str_replace('&#039;',"'", $_POST['sql']);
71
+            //echo html_entity_decode($_POST['sql']);
72
+            echo $sql;
73
+        }
74
+        elseif (isset ($_POST['raction']) && strtolower($_POST['raction']) == "execute") {
75
+            $sql = str_replace(
76
+                array(
77
+                    "\n",
78
+                    '&#039;',
79
+                ),
80
+                array(
81
+                    '',
82
+                    "'",
83
+                ),
84
+                preg_replace('#(/\*.+?\*/\n*)#', '', $_POST['sql'])
85
+            );
86
+            foreach (explode(";", $sql) as $stmt) {
87
+                $stmt = trim($stmt);
88
+
89
+                if (!empty ($stmt)) {
90
+                    $db->query($stmt,true,'Executing repair query: ');
91
+                }
92
+            }
93
+
94
+            echo "<h3>{$mod_strings['LBL_REPAIR_DATABASE_SYNCED']}</h3>";
95
+        }
96
+    } else {
97
+
98
+        if (!$export && empty ($_REQUEST['repair_silent'])) {
99
+            if ( empty($hideModuleMenu) )
100
+                echo getClassicModuleTitle($mod_strings['LBL_REPAIR_DATABASE'], array($mod_strings['LBL_REPAIR_DATABASE']), true);
101
+            echo "<h1 id=\"rdloading\">{$mod_strings['LBL_REPAIR_DATABASE_PROCESSING']}</h1>";
102
+            ob_flush();
103
+        }
104
+
105
+        $sql = '';
106
+
107
+        VardefManager::clearVardef();
108
+        $repairedTables = array();
109
+
110
+        foreach ($beanFiles as $bean => $file) {
111
+            if(file_exists($file)){
112
+                require_once ($file);
113
+                unset($GLOBALS['dictionary'][$bean]);
114
+                $focus = new $bean ();
115
+                if (($focus instanceOf SugarBean) && !isset($repairedTables[$focus->table_name])) {
116
+                    $sql .= $db->repairTable($focus, $execute);
117
+                    $repairedTables[$focus->table_name] = true;
118
+                }
119 119
                 //Repair Custom Fields
120 120
                 if (($focus instanceOf SugarBean) && $focus->hasCustomFields() && !isset($repairedTables[$focus->table_name . '_cstm'])) {
121
-				    $df = new DynamicField($focus->module_dir);
121
+                    $df = new DynamicField($focus->module_dir);
122 122
                     //Need to check if the method exists as during upgrade an old version of Dynamic Fields may be loaded.
123 123
                     if (method_exists($df, "repairCustomFields"))
124 124
                     {
@@ -126,56 +126,56 @@  discard block
 block discarded – undo
126 126
                         $sql .= $df->repairCustomFields($execute);
127 127
                         $repairedTables[$focus->table_name . '_cstm'] = true;
128 128
                     }
129
-				}
130
-			}
131
-		}
129
+                }
130
+            }
131
+        }
132 132
 
133
-		$olddictionary = $dictionary;
133
+        $olddictionary = $dictionary;
134 134
 
135
-		unset ($dictionary);
136
-		include ('modules/TableDictionary.php');
135
+        unset ($dictionary);
136
+        include ('modules/TableDictionary.php');
137 137
 
138
-		foreach ($dictionary as $meta) {
138
+        foreach ($dictionary as $meta) {
139 139
 
140
-			if ( !isset($meta['table']) || isset($repairedTables[$meta['table']]))
140
+            if ( !isset($meta['table']) || isset($repairedTables[$meta['table']]))
141 141
                 continue;
142 142
             
143 143
             $tablename = $meta['table'];
144
-			$fielddefs = $meta['fields'];
145
-			$indices = $meta['indices'];
146
-			$engine = isset($meta['engine'])?$meta['engine']:null;
147
-			$sql .= $db->repairTableParams($tablename, $fielddefs, $indices, $execute, $engine);
148
-			$repairedTables[$tablename] = true;
149
-		}
144
+            $fielddefs = $meta['fields'];
145
+            $indices = $meta['indices'];
146
+            $engine = isset($meta['engine'])?$meta['engine']:null;
147
+            $sql .= $db->repairTableParams($tablename, $fielddefs, $indices, $execute, $engine);
148
+            $repairedTables[$tablename] = true;
149
+        }
150 150
 
151
-		$dictionary = $olddictionary;
151
+        $dictionary = $olddictionary;
152 152
 
153 153
 
154 154
 
155
-		if (empty ($_REQUEST['repair_silent'])) {
156
-			echo "<script type=\"text/javascript\">document.getElementById('rdloading').style.display = \"none\";</script>";
155
+        if (empty ($_REQUEST['repair_silent'])) {
156
+            echo "<script type=\"text/javascript\">document.getElementById('rdloading').style.display = \"none\";</script>";
157 157
 
158
-			if (isset ($sql) && !empty ($sql)) {
158
+            if (isset ($sql) && !empty ($sql)) {
159 159
 
160
-				$qry_str = "";
161
-				foreach (explode("\n", $sql) as $line) {
162
-					if (!empty ($line) && substr($line, -2) != "*/") {
163
-						$line .= ";";
164
-					}
160
+                $qry_str = "";
161
+                foreach (explode("\n", $sql) as $line) {
162
+                    if (!empty ($line) && substr($line, -2) != "*/") {
163
+                        $line .= ";";
164
+                    }
165 165
 
166
-					$qry_str .= $line . "\n";
167
-				}
166
+                    $qry_str .= $line . "\n";
167
+                }
168 168
 
169
-	            $ss = new Sugar_Smarty();
170
-	            $ss->assign('MOD', $GLOBALS['mod_strings']);
171
-	            $ss->assign('qry_str', $qry_str);
172
-	            echo $ss->fetch('modules/Administration/templates/RepairDatabase.tpl');
173
-			} else {
174
-				echo "<h3>{$mod_strings['LBL_REPAIR_DATABASE_SYNCED']}</h3>";
175
-			}
176
-		}
177
-	}
169
+                $ss = new Sugar_Smarty();
170
+                $ss->assign('MOD', $GLOBALS['mod_strings']);
171
+                $ss->assign('qry_str', $qry_str);
172
+                echo $ss->fetch('modules/Administration/templates/RepairDatabase.tpl');
173
+            } else {
174
+                echo "<h3>{$mod_strings['LBL_REPAIR_DATABASE_SYNCED']}</h3>";
175
+            }
176
+        }
177
+    }
178 178
 
179 179
 } else {
180
-	sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
180
+    sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
181 181
 }
182 182
\ No newline at end of file
Please login to merge, or discard this patch.
modules/Administration/UpgradeFields.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(!defined('sugarEntry') || !sugarEntry)
3
-	die('Not A Valid Entry Point');
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.
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 global $db;
45 45
 
46 46
 if (!isset ($db)) {
47
-	$db = DBManagerFactory:: getInstance();
47
+    $db = DBManagerFactory:: getInstance();
48 48
 }
49 49
 
50 50
 $result = $db->query('SELECT * FROM fields_meta_data WHERE deleted = 0 ORDER BY custom_module');
@@ -53,82 +53,82 @@  discard block
 block discarded – undo
53 53
  * get the real field_meta_data
54 54
  */
55 55
 while ($row = $db->fetchByAssoc($result)) {
56
-	$the_modules = $row['custom_module'];
57
-	if (!isset ($modules[$the_modules])) {
58
-		$modules[$the_modules] = array ();
59
-	}
60
-	$modules[$the_modules][$row['name']] = $row['name'];
56
+    $the_modules = $row['custom_module'];
57
+    if (!isset ($modules[$the_modules])) {
58
+        $modules[$the_modules] = array ();
59
+    }
60
+    $modules[$the_modules][$row['name']] = $row['name'];
61 61
 }
62 62
 
63 63
 $simulate = false;
64 64
 if (!isset ($_REQUEST['run'])) {
65
-	$simulate = true;
66
-	echo "SIMULATION MODE - NO CHANGES WILL BE MADE EXCEPT CLEARING CACHE";
65
+    $simulate = true;
66
+    echo "SIMULATION MODE - NO CHANGES WILL BE MADE EXCEPT CLEARING CACHE";
67 67
 }
68 68
 
69 69
 foreach ($modules as $the_module => $fields) {
70
-	$class_name = $beanList[$the_module];
71
-	echo "<br><br>Scanning $the_module <br>";
70
+    $class_name = $beanList[$the_module];
71
+    echo "<br><br>Scanning $the_module <br>";
72 72
 
73
-	require_once ($beanFiles[$class_name]);
74
-	$mod = new $class_name ();
75
-	if (!$db->tableExists($mod->table_name."_cstm")) {
76
-		$mod->custom_fields = new DynamicField();
77
-		$mod->custom_fields->setup($mod);
78
-		$mod->custom_fields->createCustomTable();
79
-	}
73
+    require_once ($beanFiles[$class_name]);
74
+    $mod = new $class_name ();
75
+    if (!$db->tableExists($mod->table_name."_cstm")) {
76
+        $mod->custom_fields = new DynamicField();
77
+        $mod->custom_fields->setup($mod);
78
+        $mod->custom_fields->createCustomTable();
79
+    }
80 80
 
81
-	$table = $db->getTableDescription($mod->table_name."_cstm");
82
-	foreach($table as $row) {
83
-		$col = strtolower(empty ($row['Field']) ? $row['field'] : $row['Field']);
84
-		$the_field = $mod->custom_fields->getField($col);
85
-		$type = strtolower(empty ($row['Type']) ? $row['type'] : $row['Type']);
86
-		if (!empty($row['data_precision']) && !empty($row['data_scale'])) {
87
-			$type.='(' . $row['data_precision'];
88
-			if (!empty($row['data_scale'])) {
89
-				$type.=',' . $row['data_scale'];
90
-			}
91
-			$type.=')';
92
-		} elseif(!empty($row['data_length']) && (strtolower($row['type'])=='varchar' or strtolower($row['type'])=='varchar2')) {
93
-			$type.='(' . $row['data_length'] . ')';
94
-		}
95
-		if (!isset ($fields[$col]) && $col != 'id_c') {
96
-			if (!$simulate) {
97
-				$db->query("ALTER TABLE $mod->table_name"."_cstm DROP COLUMN $col");
98
-			}
99
-			unset ($fields[$col]);
100
-			echo "Dropping Column $col from $mod->table_name"."_cstm for module $the_module<br>";
101
-		} else {
102
-			if ($col != 'id_c') {
103
-				$db_data_type = strtolower(str_replace(' ' , '', $the_field->get_db_type()));
81
+    $table = $db->getTableDescription($mod->table_name."_cstm");
82
+    foreach($table as $row) {
83
+        $col = strtolower(empty ($row['Field']) ? $row['field'] : $row['Field']);
84
+        $the_field = $mod->custom_fields->getField($col);
85
+        $type = strtolower(empty ($row['Type']) ? $row['type'] : $row['Type']);
86
+        if (!empty($row['data_precision']) && !empty($row['data_scale'])) {
87
+            $type.='(' . $row['data_precision'];
88
+            if (!empty($row['data_scale'])) {
89
+                $type.=',' . $row['data_scale'];
90
+            }
91
+            $type.=')';
92
+        } elseif(!empty($row['data_length']) && (strtolower($row['type'])=='varchar' or strtolower($row['type'])=='varchar2')) {
93
+            $type.='(' . $row['data_length'] . ')';
94
+        }
95
+        if (!isset ($fields[$col]) && $col != 'id_c') {
96
+            if (!$simulate) {
97
+                $db->query("ALTER TABLE $mod->table_name"."_cstm DROP COLUMN $col");
98
+            }
99
+            unset ($fields[$col]);
100
+            echo "Dropping Column $col from $mod->table_name"."_cstm for module $the_module<br>";
101
+        } else {
102
+            if ($col != 'id_c') {
103
+                $db_data_type = strtolower(str_replace(' ' , '', $the_field->get_db_type()));
104 104
 
105
-				$type = strtolower(str_replace(' ' , '', $type));
106
-				if (strcmp($db_data_type,$type) != 0) {
105
+                $type = strtolower(str_replace(' ' , '', $type));
106
+                if (strcmp($db_data_type,$type) != 0) {
107 107
 
108
-					echo "Fixing Column Type for $col changing $type to ".$db_data_type."<br>";
109
-					if (!$simulate) {
110
-						$db->query($the_field->get_db_modify_alter_table($mod->table_name.'_cstm'));
108
+                    echo "Fixing Column Type for $col changing $type to ".$db_data_type."<br>";
109
+                    if (!$simulate) {
110
+                        $db->query($the_field->get_db_modify_alter_table($mod->table_name.'_cstm'));
111 111
                     }
112
-				}
113
-			}
112
+                }
113
+            }
114 114
 
115
-			unset ($fields[$col]);
116
-		}
115
+            unset ($fields[$col]);
116
+        }
117 117
 
118
-	}
118
+    }
119 119
 
120
-	echo sizeof($fields)." field(s) missing from $mod->table_name"."_cstm<br>";
121
-	foreach ($fields as $field) {
122
-		echo "Adding Column $field to $mod->table_name"."_cstm<br>";
123
-		if (!$simulate)
124
-			$mod->custom_fields->add_existing_custom_field($field);
125
-	}
120
+    echo sizeof($fields)." field(s) missing from $mod->table_name"."_cstm<br>";
121
+    foreach ($fields as $field) {
122
+        echo "Adding Column $field to $mod->table_name"."_cstm<br>";
123
+        if (!$simulate)
124
+            $mod->custom_fields->add_existing_custom_field($field);
125
+    }
126 126
 
127 127
 }
128 128
 
129 129
 DynamicField :: deleteCache();
130 130
 echo '<br>Done<br>';
131 131
 if ($simulate) {
132
-	echo '<a href="index.php?module=Administration&action=UpgradeFields&run=true">Execute non-simulation mode</a>';
132
+    echo '<a href="index.php?module=Administration&action=UpgradeFields&run=true">Execute non-simulation mode</a>';
133 133
 }
134 134
 ?>
135 135
\ No newline at end of file
Please login to merge, or discard this patch.