@@ -1,6 +1,6 @@ discard block |
||
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. |
@@ -40,41 +40,41 @@ discard block |
||
40 | 40 | ********************************************************************************/ |
41 | 41 | |
42 | 42 | |
43 | - global $mod_strings; |
|
44 | - global $current_language; |
|
45 | - $smarty = new Sugar_Smarty(); |
|
46 | - $temp_bean_list = $beanList; |
|
47 | - asort($temp_bean_list); |
|
48 | - $values= array_values($temp_bean_list); |
|
49 | - $output= array_keys($temp_bean_list); |
|
50 | - $output_local = array(); |
|
51 | - if($current_language != 'en_us') { |
|
52 | - foreach($output as $temp_out) { |
|
53 | - $output_local[] = translate($temp_out); |
|
54 | - } |
|
55 | - } else { |
|
56 | - $output_local = $output; |
|
57 | - } |
|
58 | - //sort($output); |
|
59 | - //sort($values); |
|
60 | - $values=array_merge(array($mod_strings['LBL_ALL_MODULES']), $values); |
|
61 | - $output= array_merge(array($mod_strings['LBL_ALL_MODULES']),$output_local); |
|
62 | - $checkbox_values=array( |
|
63 | - 'clearTpls', |
|
64 | - 'clearJsFiles', |
|
65 | - 'clearVardefs', |
|
66 | - 'clearJsLangFiles', |
|
67 | - 'clearDashlets', |
|
68 | - 'clearSugarFeedCache', |
|
69 | - 'clearThemeCache', |
|
70 | - 'rebuildAuditTables', |
|
71 | - 'rebuildExtensions', |
|
72 | - 'clearLangFiles', |
|
73 | - 'clearSearchCache', |
|
74 | - 'clearPDFFontCache', |
|
75 | - //'repairDatabase' |
|
76 | - ); |
|
77 | - $checkbox_output = array( $mod_strings['LBL_QR_CBOX_CLEARTPL'], |
|
43 | + global $mod_strings; |
|
44 | + global $current_language; |
|
45 | + $smarty = new Sugar_Smarty(); |
|
46 | + $temp_bean_list = $beanList; |
|
47 | + asort($temp_bean_list); |
|
48 | + $values= array_values($temp_bean_list); |
|
49 | + $output= array_keys($temp_bean_list); |
|
50 | + $output_local = array(); |
|
51 | + if($current_language != 'en_us') { |
|
52 | + foreach($output as $temp_out) { |
|
53 | + $output_local[] = translate($temp_out); |
|
54 | + } |
|
55 | + } else { |
|
56 | + $output_local = $output; |
|
57 | + } |
|
58 | + //sort($output); |
|
59 | + //sort($values); |
|
60 | + $values=array_merge(array($mod_strings['LBL_ALL_MODULES']), $values); |
|
61 | + $output= array_merge(array($mod_strings['LBL_ALL_MODULES']),$output_local); |
|
62 | + $checkbox_values=array( |
|
63 | + 'clearTpls', |
|
64 | + 'clearJsFiles', |
|
65 | + 'clearVardefs', |
|
66 | + 'clearJsLangFiles', |
|
67 | + 'clearDashlets', |
|
68 | + 'clearSugarFeedCache', |
|
69 | + 'clearThemeCache', |
|
70 | + 'rebuildAuditTables', |
|
71 | + 'rebuildExtensions', |
|
72 | + 'clearLangFiles', |
|
73 | + 'clearSearchCache', |
|
74 | + 'clearPDFFontCache', |
|
75 | + //'repairDatabase' |
|
76 | + ); |
|
77 | + $checkbox_output = array( $mod_strings['LBL_QR_CBOX_CLEARTPL'], |
|
78 | 78 | $mod_strings['LBL_QR_CBOX_CLEARJS'], |
79 | 79 | $mod_strings['LBL_QR_CBOX_CLEARVARDEFS'], |
80 | 80 | $mod_strings['LBL_QR_CBOX_CLEARJSLANG'], |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | $mod_strings['LBL_QR_CBOX_CLEARSEARCH'], |
88 | 88 | $mod_strings['LBL_QR_CBOX_CLEARPDFFONT'], |
89 | 89 | //$mod_strings['LBL_QR_CBOX_DATAB'], |
90 | - ); |
|
91 | - $smarty->assign('checkbox_values', $checkbox_values); |
|
92 | - $smarty->assign('values', $values); |
|
93 | - $smarty->assign('output', $output); |
|
94 | - $smarty->assign('MOD', $mod_strings); |
|
95 | - $smarty->assign('checkbox_output', $checkbox_output); |
|
96 | - $smarty->assign('checkbox_values', $checkbox_values); |
|
97 | - $smarty->display("modules/Administration/templates/QuickRepairAndRebuild.tpl"); |
|
90 | + ); |
|
91 | + $smarty->assign('checkbox_values', $checkbox_values); |
|
92 | + $smarty->assign('values', $values); |
|
93 | + $smarty->assign('output', $output); |
|
94 | + $smarty->assign('MOD', $mod_strings); |
|
95 | + $smarty->assign('checkbox_output', $checkbox_output); |
|
96 | + $smarty->assign('checkbox_values', $checkbox_values); |
|
97 | + $smarty->display("modules/Administration/templates/QuickRepairAndRebuild.tpl"); |
|
98 | 98 | |
99 | 99 | |
100 | 100 | ?> |
@@ -42,16 +42,16 @@ |
||
42 | 42 | require("include/modules.php"); |
43 | 43 | foreach ($beanFiles as $Classname => $filename){ |
44 | 44 | // Find the name of the file generated by the updateclass script |
45 | - $pos=strrpos($filename,"/"); |
|
46 | - $Newfilename=substr_replace($filename, 'SugarCore.', $pos+1, 0); |
|
45 | + $pos=strrpos($filename,"/"); |
|
46 | + $Newfilename=substr_replace($filename, 'SugarCore.', $pos+1, 0); |
|
47 | 47 | //delete the new SugarBean that extends CoreBean and replace it by the old one undoing all the changes |
48 | - if (file_exists($Newfilename)){ |
|
49 | - unlink($filename); |
|
50 | - $handle = file_get_contents($Newfilename); |
|
51 | - $data = preg_replace("/class SugarCore".$Classname."/", 'class '.$Classname, $handle); |
|
52 | - $data1 = preg_replace("/function SugarCore".$Classname."/", 'function '.$Classname, $data); |
|
53 | - file_put_contents($Newfilename,$data1); |
|
54 | - rename($Newfilename,$filename); |
|
55 | - } |
|
48 | + if (file_exists($Newfilename)){ |
|
49 | + unlink($filename); |
|
50 | + $handle = file_get_contents($Newfilename); |
|
51 | + $data = preg_replace("/class SugarCore".$Classname."/", 'class '.$Classname, $handle); |
|
52 | + $data1 = preg_replace("/function SugarCore".$Classname."/", 'function '.$Classname, $data); |
|
53 | + file_put_contents($Newfilename,$data1); |
|
54 | + rename($Newfilename,$filename); |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | ?> |
@@ -40,5 +40,5 @@ |
||
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 |
@@ -42,58 +42,58 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -51,17 +51,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |
@@ -127,9 +127,9 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -68,7 +68,7 @@ |
||
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 { |
@@ -46,9 +46,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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{ |
@@ -41,42 +41,42 @@ |
||
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 | ?> |