This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | if(!defined('sugarEntry'))define('sugarEntry', true); |
||
3 | /********************************************************************************* |
||
4 | * SugarCRM Community Edition is a customer relationship management program developed by |
||
5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
||
6 | |||
7 | * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
||
8 | * Copyright (C) 2011 - 2014 Salesagility Ltd. |
||
9 | * |
||
10 | * This program is free software; you can redistribute it and/or modify it under |
||
11 | * the terms of the GNU Affero General Public License version 3 as published by the |
||
12 | * Free Software Foundation with the addition of the following permission added |
||
13 | * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
||
14 | * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
||
15 | * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
||
16 | * |
||
17 | * This program is distributed in the hope that it will be useful, but WITHOUT |
||
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
19 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
||
20 | * details. |
||
21 | * |
||
22 | * You should have received a copy of the GNU Affero General Public License along with |
||
23 | * this program; if not, see http://www.gnu.org/licenses or write to the Free |
||
24 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
||
25 | * 02110-1301 USA. |
||
26 | * |
||
27 | * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
||
28 | * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
||
29 | * |
||
30 | * The interactive user interfaces in modified source and object code versions |
||
31 | * of this program must display Appropriate Legal Notices, as required under |
||
32 | * Section 5 of the GNU Affero General Public License version 3. |
||
33 | * |
||
34 | * In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
||
35 | * these Appropriate Legal Notices must retain the display of the "Powered by |
||
36 | * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
||
37 | * reasonably feasible for technical reasons, the Appropriate Legal Notices must |
||
38 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
||
39 | ********************************************************************************/ |
||
40 | |||
41 | @session_start(); |
||
42 | if(isset($_REQUEST['clear_session']) || !empty($_SESSION['loginAttempts'])) { |
||
43 | session_destroy(); |
||
44 | header('Location: install.php'); |
||
45 | echo 'session clean, page refresh...'; |
||
46 | exit; |
||
47 | } |
||
48 | |||
49 | // recover smtp settings |
||
50 | if(isset($_POST['smtp_tab_selected'])) { |
||
51 | $_POST = array_merge($_POST, $_POST[$_POST['smtp_tab_selected']]); |
||
52 | } |
||
53 | |||
54 | //session_destroy(); |
||
55 | if (version_compare(phpversion(),'5.2.0') < 0) { |
||
56 | $msg = 'Minimum PHP version required is 5.2.0. You are using PHP version '. phpversion(); |
||
57 | die($msg); |
||
58 | } |
||
59 | $session_id = session_id(); |
||
60 | if(empty($session_id)){ |
||
61 | @session_start(); |
||
62 | } |
||
63 | $GLOBALS['installing'] = true; |
||
64 | define('SUGARCRM_IS_INSTALLING', $GLOBALS['installing']); |
||
65 | $GLOBALS['sql_queries'] = 0; |
||
66 | require_once('include/SugarLogger/LoggerManager.php'); |
||
67 | require_once('sugar_version.php'); |
||
68 | require_once('suitecrm_version.php'); |
||
69 | require_once('include/utils.php'); |
||
70 | require_once('install/install_utils.php'); |
||
71 | require_once('install/install_defaults.php'); |
||
72 | require_once('include/TimeDate.php'); |
||
73 | require_once('include/Localization/Localization.php'); |
||
74 | require_once('include/SugarTheme/SugarTheme.php'); |
||
75 | require_once('include/utils/LogicHook.php'); |
||
76 | require_once('data/SugarBean.php'); |
||
77 | require_once('include/entryPoint.php'); |
||
78 | //check to see if the script files need to be rebuilt, add needed variables to request array |
||
79 | $_REQUEST['root_directory'] = getcwd(); |
||
80 | $_REQUEST['js_rebuild_concat'] = 'rebuild'; |
||
81 | if(isset($_REQUEST['goto']) && $_REQUEST['goto'] != 'SilentInstall') { |
||
82 | require_once('jssource/minify.php'); |
||
83 | } |
||
84 | |||
85 | $timedate = TimeDate::getInstance(); |
||
86 | // cn: set php.ini settings at entry points |
||
87 | setPhpIniSettings(); |
||
88 | $locale = new Localization(); |
||
89 | |||
90 | if(get_magic_quotes_gpc() == 1) { |
||
91 | $_REQUEST = array_map("stripslashes_checkstrings", $_REQUEST); |
||
92 | $_POST = array_map("stripslashes_checkstrings", $_POST); |
||
93 | $_GET = array_map("stripslashes_checkstrings", $_GET); |
||
94 | } |
||
95 | |||
96 | |||
97 | $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM'); |
||
0 ignored issues
–
show
|
|||
98 | $setup_sugar_version = $suitecrm_version; |
||
99 | $install_script = true; |
||
100 | |||
101 | /////////////////////////////////////////////////////////////////////////////// |
||
102 | //// INSTALL RESOURCE SETUP |
||
103 | $css = 'install/install.css'; |
||
104 | $icon = 'include/images/sugar_icon.ico'; |
||
105 | $sugar_md = 'include/images/sugar_md_open.png'; |
||
106 | $loginImage = 'include/images/sugarcrm_login.png'; |
||
107 | $common = 'install/installCommon.js'; |
||
108 | |||
109 | /////////////////////////////////////////////////////////////////////////////// |
||
110 | //// INSTALLER LANGUAGE |
||
111 | function getSupportedInstallLanguages(){ |
||
112 | $supportedLanguages = array( |
||
113 | 'en_us' => 'English (US)', |
||
114 | ); |
||
115 | if(file_exists('install/lang.config.php')){ |
||
116 | include('install/lang.config.php'); |
||
117 | if(!empty($config['languages'])){ |
||
118 | |||
119 | foreach($config['languages'] as $k=>$v){ |
||
120 | if(file_exists('install/language/' . $k . '.lang.php')){ |
||
121 | $supportedLanguages[$k] = $v; |
||
122 | } |
||
123 | } |
||
124 | } |
||
125 | } |
||
126 | return $supportedLanguages; |
||
127 | } |
||
128 | $supportedLanguages = getSupportedInstallLanguages(); |
||
129 | |||
130 | // after install language is selected, use that pack |
||
131 | $default_lang = 'en_us'; |
||
132 | if(!isset($_POST['language']) && (!isset($_SESSION['language']) && empty($_SESSION['language']))) { |
||
133 | if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
||
134 | $lang = parseAcceptLanguage(); |
||
135 | if(isset($supportedLanguages[$lang])) { |
||
136 | $_POST['language'] = $lang; |
||
137 | } else { |
||
138 | $_POST['language'] = $default_lang; |
||
139 | } |
||
140 | } |
||
141 | } |
||
142 | |||
143 | if(isset($_POST['language'])) { |
||
144 | $_SESSION['language'] = str_replace('-','_',$_POST['language']); |
||
145 | } |
||
146 | |||
147 | $current_language = isset($_SESSION['language']) ? $_SESSION['language'] : $default_lang; |
||
148 | |||
149 | if(file_exists("install/language/{$current_language}.lang.php")) { |
||
150 | require_once("install/language/{$current_language}.lang.php"); |
||
151 | } else { |
||
152 | require_once("install/language/{$default_lang}.lang.php"); |
||
153 | } |
||
154 | |||
155 | if($current_language != 'en_us') { |
||
156 | $my_mod_strings = $mod_strings; |
||
157 | include('install/language/en_us.lang.php'); |
||
158 | $mod_strings = sugarLangArrayMerge($mod_strings, $my_mod_strings); |
||
159 | } |
||
160 | |||
161 | $app_list_strings = return_app_list_strings_language($current_language); |
||
162 | //// END INSTALLER LANGUAGE |
||
163 | /////////////////////////////////////////////////////////////////////////////// |
||
164 | |||
165 | //get the url for the helper link |
||
166 | $help_url = get_help_button_url(); |
||
167 | |||
168 | //if this license print, then redirect and exit, |
||
169 | if(isset($_REQUEST['page']) && $_REQUEST['page'] == 'licensePrint') |
||
170 | { |
||
171 | include('install/licensePrint.php'); |
||
172 | exit (); |
||
173 | } |
||
174 | |||
175 | if(isset($_REQUEST['sugar_body_only']) && $_REQUEST['sugar_body_only'] == "1") { |
||
176 | //if this is a system check, then just run the check and return, |
||
177 | //this is an ajax call and there is no need for further processing |
||
178 | |||
179 | if(isset($_REQUEST['uploadLogoFrame']) && ($_REQUEST['uploadLogoFrame'])){ |
||
180 | echo 'I\'m an uploader iframe!'; |
||
181 | return; |
||
182 | } |
||
183 | |||
184 | // upload company logo |
||
185 | if(isset($_REQUEST['uploadLogo']) && ($_REQUEST['uploadLogo'])){ |
||
186 | $filepath = ''; |
||
187 | $errors = array(); |
||
188 | |||
189 | switch($_FILES['company_logo']['error']) { |
||
190 | |||
191 | case UPLOAD_ERR_OK: |
||
192 | $allowedTypes = array(IMAGETYPE_PNG, IMAGETYPE_JPEG/*, IMAGETYPE_GIF */); |
||
193 | $detectedType = exif_imagetype($_FILES['company_logo']['tmp_name']); |
||
194 | if(!in_array($detectedType, $allowedTypes)) { |
||
195 | $errors[] = $mod_strings['ERR_UPLOAD_FILETYPE']; |
||
196 | } |
||
197 | else { |
||
198 | // uploaded image stored in the /custom path instead of put into the original theme directory.. |
||
199 | |||
200 | mkdir_recursive('custom/' . SugarThemeRegistry::current()->getDefaultImagePath(), true); |
||
201 | $tmpvar = explode('?', SugarThemeRegistry::current()->getImageURL('company_logo.png')); |
||
202 | $destFile = 'custom/' . $tmpvar[0]; |
||
203 | if (!move_uploaded_file($_FILES['company_logo']['tmp_name'], $destFile)) { |
||
204 | $errors[] = $mod_strings['ERR_LANG_UPLOAD_1']; |
||
205 | } |
||
206 | else { |
||
207 | $filepath = $destFile; |
||
208 | } |
||
209 | } |
||
210 | break; |
||
211 | |||
212 | case UPLOAD_ERR_INI_SIZE: |
||
213 | $errors[] = $mod_strings['ERR_UPLOAD_FILE_UPLOAD_ERR_INI_SIZE']; |
||
214 | break; |
||
215 | |||
216 | case UPLOAD_ERR_FORM_SIZE: |
||
217 | $errors[] = $mod_strings['ERR_UPLOAD_FILE_UPLOAD_ERR_FORM_SIZE']; |
||
218 | break; |
||
219 | |||
220 | case UPLOAD_ERR_PARTIAL: |
||
221 | $errors[] = $mod_strings['ERR_UPLOAD_FILE_UPLOAD_ERR_PARTIAL']; |
||
222 | break; |
||
223 | |||
224 | case UPLOAD_ERR_NO_FILE: |
||
225 | $errors[] = $mod_strings['ERR_UPLOAD_FILE_UPLOAD_ERR_NO_FILE']; |
||
226 | break; |
||
227 | |||
228 | case UPLOAD_ERR_NO_TMP_DIR: |
||
229 | $errors[] = $mod_strings['ERR_UPLOAD_FILE_UPLOAD_ERR_NO_TMP_DIR']; |
||
230 | break; |
||
231 | |||
232 | case UPLOAD_ERR_CANT_WRITE: |
||
233 | $errors[] = $mod_strings['ERR_UPLOAD_FILE_UPLOAD_ERR_CANT_WRITE']; |
||
234 | break; |
||
235 | |||
236 | case UPLOAD_ERR_EXTENSION: |
||
237 | $errors[] = $mod_strings['ERR_UPLOAD_FILE_UPLOAD_ERR_EXTENSION']; |
||
238 | break; |
||
239 | default: |
||
240 | $errors[] = $mod_strings['ERR_LANG_UPLOAD_UNKNOWN']; |
||
241 | break; |
||
242 | } |
||
243 | |||
244 | |||
245 | $result['filepath'] = $filepath; |
||
246 | $result['errors'] = $errors ? $errors : false; |
||
247 | |||
248 | // TODO--low: validate file size & image width/height and save, show status result to client js |
||
249 | |||
250 | echo "<script>window.top.window.{$_REQUEST['callback']}(" . json_encode($result) . ");</script>"; |
||
251 | return; |
||
252 | } |
||
253 | |||
254 | if(isset($_REQUEST['storeConfig']) && ($_REQUEST['storeConfig'])){ |
||
255 | // store configuration by form to session |
||
256 | if(!isset($_SESSION)) session_start(); |
||
257 | $_SESSION = array_merge($_SESSION, $_POST); |
||
258 | |||
259 | // TODO--low: don't forget the custom type install settings! validate here.. |
||
260 | // if(count($validation_errors = validate_dbConfig('a')) > 0) { |
||
261 | // $si_errors = true; |
||
262 | // } |
||
263 | // else if(count($validation_errors = validate_siteConfig('a')) > 0) { |
||
264 | // $si_errors = true; |
||
265 | // } |
||
266 | // else if(count($validation_errors = validate_siteConfig('b')) > 0) { |
||
267 | // $si_errors = true; |
||
268 | // } |
||
269 | $errors = ''; |
||
270 | if( isset($validation_errors) && is_array($validation_errors)){ |
||
271 | if( count($validation_errors) > 0 ){ |
||
272 | // $errors = '<div id="errorMsgs">'; |
||
273 | $errors .= '<p>'.$mod_strings['LBL_SITECFG_FIX_ERRORS'].'</p><ul>'; |
||
274 | foreach( $validation_errors as $error ){ |
||
275 | $errors .= '<li class="error">' . $error . '</li>'; |
||
276 | } |
||
277 | $errors .= '</ul>'; //</div>'; |
||
278 | } |
||
279 | } |
||
280 | echo $errors; |
||
281 | return; |
||
282 | } |
||
283 | |||
284 | if(isset($_REQUEST['checkInstallSystem']) && ($_REQUEST['checkInstallSystem'])){ |
||
285 | require_once('install/installSystemCheck.php'); |
||
286 | echo runCheck($install_script, $mod_strings); |
||
287 | return; |
||
288 | } |
||
289 | |||
290 | //if this is a DB Settings check, then just run the check and return, |
||
291 | //this is an ajax call and there is no need for further processing |
||
292 | if(isset($_REQUEST['checkDBSettings']) && ($_REQUEST['checkDBSettings'])){ |
||
293 | require_once('install/checkDBSettings.php'); |
||
294 | echo checkDBSettings(); |
||
295 | return; |
||
296 | } |
||
297 | } |
||
298 | |||
299 | //maintaining the install_type if earlier set to custom |
||
300 | if(isset($_REQUEST['install_type']) && $_REQUEST['install_type'] == 'custom'){ |
||
301 | $_SESSION['install_type'] = $_REQUEST['install_type']; |
||
302 | } |
||
303 | |||
304 | //set the default settings into session |
||
305 | foreach($installer_defaults as $key =>$val){ |
||
306 | if(!isset($_SESSION[$key])){ |
||
307 | $_SESSION[$key] = $val; |
||
308 | } |
||
309 | } |
||
310 | |||
311 | // always perform |
||
312 | clean_special_arguments(); |
||
313 | print_debug_comment(); |
||
314 | $next_clicked = false; |
||
315 | $next_step = 0; |
||
316 | |||
317 | // use a simple array to map out the steps of the installer page flow |
||
318 | $workflow = array( 'welcome.php', |
||
319 | 'ready.php', |
||
320 | |||
321 | // TODO-g: remove these files.. |
||
322 | //'license.php', |
||
323 | //'installType.php', |
||
324 | ); |
||
325 | $workflow[] = 'installConfig.php'; |
||
326 | //$workflow[] = 'systemOptions.php'; |
||
327 | //$workflow[] = 'dbConfig_a.php'; |
||
328 | //$workflow[] = 'dbConfig_b.php'; |
||
329 | |||
330 | //define web root, which will be used as default for site_url |
||
331 | if($_SERVER['SERVER_PORT']=='80'){ |
||
332 | $web_root = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF']; |
||
333 | }else{ |
||
334 | $web_root = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF']; |
||
335 | } |
||
336 | $web_root = str_replace("/install.php", "", $web_root); |
||
337 | $web_root = "http://$web_root"; |
||
338 | |||
339 | if (!isset($_SESSION['oc_install']) || $_SESSION['oc_install'] == false) { |
||
340 | //$workflow[] = 'siteConfig_a.php'; |
||
341 | if (isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && |
||
342 | $_SESSION['install_type'] == 'custom') { |
||
343 | $workflow[] = 'siteConfig_b.php'; |
||
344 | } |
||
345 | } else { |
||
346 | if (is_readable('config.php')) { |
||
347 | require_once ('config.php'); |
||
348 | } |
||
349 | } |
||
350 | |||
351 | if(empty($sugar_config['cache_dir']) && !empty($_SESSION['cache_dir'])) { |
||
352 | $sugar_config['cache_dir'] = $_SESSION['cache_dir']; |
||
353 | } |
||
354 | |||
355 | // set the form's php var to the loaded config's var else default to sane settings |
||
356 | if(!isset($_SESSION['setup_site_url']) || empty($_SESSION['setup_site_url'])) { |
||
357 | if(isset($sugar_config['site_url']) && !empty($sugar_config['site_url'])) { |
||
358 | $_SESSION['setup_site_url']= $sugar_config['site_url']; |
||
359 | } else { |
||
360 | $_SESSION['setup_site_url']= $web_root; |
||
361 | } |
||
362 | } |
||
363 | |||
364 | if (!isset($_SESSION['setup_system_name']) || empty($_SESSION['setup_system_name'])) { |
||
365 | $_SESSION['setup_system_name'] = 'SugarCRM'; |
||
366 | } |
||
367 | if (!isset($_SESSION['setup_site_session_path']) || empty($_SESSION['setup_site_session_path'])) { |
||
368 | $_SESSION['setup_site_session_path'] = (isset($sugar_config['session_dir'])) ? $sugar_config['session_dir'] : ''; |
||
369 | } |
||
370 | if (!isset($_SESSION['setup_site_log_dir']) || empty($_SESSION['setup_site_log_dir'])) { |
||
371 | $_SESSION['setup_site_log_dir'] = (isset($sugar_config['log_dir'])) ? $sugar_config['log_dir'] : '.'; |
||
372 | } |
||
373 | if (!isset($_SESSION['setup_site_guid']) || empty($_SESSION['setup_site_guid'])) { |
||
374 | $_SESSION['setup_site_guid'] = (isset($sugar_config['unique_key'])) ? $sugar_config['unique_key'] : ''; |
||
375 | } |
||
376 | if (!isset($_SESSION['cache_dir']) || empty($_SESSION['cache_dir'])) { |
||
377 | $_SESSION['cache_dir'] = isset($sugar_config['cache_dir']) ? $sugar_config['cache_dir'] : 'cache/'; |
||
378 | } |
||
379 | |||
380 | //$workflow[] = 'confirmSettings.php'; |
||
381 | $workflow[] = 'performSetup.php'; |
||
382 | |||
383 | if(!isset($_SESSION['oc_install']) || $_SESSION['oc_install'] == false){ |
||
384 | if(isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && $_SESSION['install_type']=='custom'){ |
||
385 | //$workflow[] = 'download_patches.php'; |
||
386 | $workflow[] = 'download_modules.php'; |
||
387 | } |
||
388 | } |
||
389 | |||
390 | //$workflow[] = 'register.php'; |
||
391 | $workflow[] = 'complete_install.php'; |
||
392 | |||
393 | |||
394 | // increment/decrement the workflow pointer |
||
395 | if(!empty($_REQUEST['goto'])) { |
||
396 | switch($_REQUEST['goto']) { |
||
397 | case $mod_strings['LBL_CHECKSYS_RECHECK']: |
||
398 | $next_step = $_REQUEST['current_step']; |
||
399 | break; |
||
400 | case $mod_strings['LBL_BACK']: |
||
401 | $next_step = $_REQUEST['current_step'] - 1; |
||
402 | break; |
||
403 | case 'resend': |
||
404 | case $mod_strings['LBL_NEXT']: |
||
405 | case $mod_strings['LBL_START']: |
||
406 | $next_step = $_REQUEST['current_step'] + 1; |
||
407 | $next_clicked = true; |
||
408 | break; |
||
409 | case 'SilentInstall': |
||
410 | $next_step = 9999; |
||
411 | break; |
||
412 | case 'oc_convert': |
||
413 | $next_step = 9191; |
||
414 | break; |
||
415 | } |
||
416 | } |
||
417 | // Add check here to see if a silent install config file exists; if so then launch silent installer |
||
418 | elseif ( is_file('config_si.php') && empty($sugar_config['installer_locked'])) { |
||
419 | |||
420 | $langHeader = get_language_header(); |
||
421 | |||
422 | echo <<<EOHTML |
||
423 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
||
424 | <html {$langHeader}> |
||
425 | <head> |
||
426 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
||
427 | <meta http-equiv="Content-Style-Type" content="text/css"> |
||
428 | <meta http-equiv="Refresh" content="1; url=install.php?goto=SilentInstall&cli=true"> |
||
429 | <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_TITLE_WELCOME']} {$setup_sugar_version} {$mod_strings['LBL_WELCOME_SETUP_WIZARD']}</title> |
||
430 | <link REL="SHORTCUT ICON" HREF="{$icon}"> |
||
431 | <link rel="stylesheet" href="{$css}" type="text/css"> |
||
432 | </head> |
||
433 | <body> |
||
434 | <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell"> |
||
435 | <tr> |
||
436 | <td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr> |
||
437 | <tr> |
||
438 | <th width="500"> |
||
439 | <p> |
||
440 | <img src="{$sugar_md}" alt="SugarCRM" border="0"> |
||
441 | </p> |
||
442 | {$mod_strings['LBL_TITLE_WELCOME']} {$setup_sugar_version} {$mod_strings['LBL_WELCOME_SETUP_WIZARD']}</th> |
||
443 | |||
444 | <th width="200" height="30" style="text-align: right;"><a href="http://www.sugarcrm.com" target="_blank"><IMG src="{$loginImage}" alt="SugarCRM" border="0"></a> |
||
445 | </th> |
||
446 | </tr> |
||
447 | <tr> |
||
448 | <td colspan="2" id="ready_image"><IMG src="include/images/install_themes.jpg" width="698" height="247" alt="Sugar Themes" border="0"></td> |
||
449 | </tr> |
||
450 | |||
451 | <tr> |
||
452 | <td colspan="2" id="ready">{$mod_strings['LBL_LAUNCHING_SILENT_INSTALL']} </td> |
||
453 | </tr> |
||
454 | </table> |
||
455 | </body> |
||
456 | </html> |
||
457 | EOHTML; |
||
458 | die(); |
||
459 | } |
||
460 | |||
461 | |||
462 | |||
463 | $exclude_files = array('complete_install.php','register.php','download_modules.php'); |
||
464 | |||
465 | if(isset($next_step) && isset($workflow[$next_step]) && !in_array($workflow[$next_step],$exclude_files) && isset($sugar_config['installer_locked']) && $sugar_config['installer_locked'] == true) { |
||
466 | $the_file = 'installDisabled.php'; |
||
467 | $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION']; |
||
468 | $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2']; |
||
469 | $disabled_text =<<<EOQ |
||
470 | <p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p> |
||
471 | <pre> |
||
472 | 'installer_locked' => false, |
||
473 | </pre> |
||
474 | <p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p> |
||
475 | |||
476 | <p>{$mod_strings['LBL_DISABLED_HELP_1']} <a href="{$mod_strings['LBL_DISABLED_HELP_LNK']}" target="_blank">{$mod_strings['LBL_DISABLED_HELP_2']}</a>.</p> |
||
477 | EOQ; |
||
478 | } |
||
479 | else{ |
||
480 | $validation_errors = array(); |
||
481 | // process the data posted |
||
482 | if($next_clicked) { |
||
483 | // store the submitted data because the 'Next' button was clicked |
||
484 | switch($workflow[trim($_REQUEST['current_step'])]) { |
||
485 | case 'welcome.php': |
||
486 | $_SESSION['language'] = $_REQUEST['language']; |
||
487 | $_SESSION['setup_site_admin_user_name'] = 'admin'; |
||
488 | // break; |
||
489 | // case 'license.php': |
||
490 | $_SESSION['setup_license_accept'] = get_boolean_from_request('setup_license_accept'); |
||
491 | $_SESSION['license_submitted'] = true; |
||
492 | |||
493 | |||
494 | // eventually default all vars here, with overrides from config.php |
||
495 | if(is_readable('config.php')) { |
||
496 | global $sugar_config; |
||
497 | include_once('config.php'); |
||
498 | } |
||
499 | |||
500 | $default_db_type = 'mysql'; |
||
501 | |||
502 | if(!isset($_SESSION['setup_db_type'])) { |
||
503 | $_SESSION['setup_db_type'] = empty($sugar_config['dbconfig']['db_type']) ? $default_db_type : $sugar_config['dbconfig']['db_type']; |
||
504 | } |
||
505 | |||
506 | break; |
||
507 | //TODO--low: add this functionality to installConfig.php |
||
508 | case 'installType.php': |
||
509 | $_SESSION['install_type'] = $_REQUEST['install_type']; |
||
510 | if(isset($_REQUEST['setup_license_key']) && !empty($_REQUEST['setup_license_key'])){ |
||
511 | $_SESSION['setup_license_key'] = $_REQUEST['setup_license_key']; |
||
512 | } |
||
513 | $_SESSION['licenseKey_submitted'] = true; |
||
514 | |||
515 | |||
516 | |||
517 | break; |
||
518 | |||
519 | case 'installConfig.php': |
||
520 | |||
521 | //case 'systemOptions.php': |
||
522 | if(isset($_REQUEST['setup_db_type'])) { |
||
523 | $_SESSION['setup_db_type'] = $_REQUEST['setup_db_type']; |
||
524 | } |
||
525 | $validation_errors = validate_systemOptions(); |
||
526 | if(count($validation_errors) > 0) { |
||
527 | $next_step--; |
||
528 | } |
||
529 | //break; |
||
530 | |||
531 | //case 'dbConfig_a.php': |
||
532 | //validation is now done through ajax call to checkDBSettings.php |
||
533 | if(isset($_REQUEST['setup_db_drop_tables'])){ |
||
534 | $_SESSION['setup_db_drop_tables'] = $_REQUEST['setup_db_drop_tables']; |
||
535 | if($_SESSION['setup_db_drop_tables']=== true || $_SESSION['setup_db_drop_tables'] == 'true'){ |
||
536 | $_SESSION['setup_db_create_database'] = false; |
||
537 | } |
||
538 | } |
||
539 | //break; |
||
540 | |||
541 | //case 'siteConfig_a.php': |
||
542 | if(isset($_REQUEST['setup_site_url'])){$_SESSION['setup_site_url'] = $_REQUEST['setup_site_url'];} |
||
543 | if(isset($_REQUEST['setup_system_name'])){$_SESSION['setup_system_name'] = $_REQUEST['setup_system_name'];} |
||
544 | if(isset($_REQUEST['setup_db_collation'])) { |
||
545 | $_SESSION['setup_db_options']['collation'] = $_REQUEST['setup_db_collation']; |
||
546 | } |
||
547 | $_SESSION['setup_site_admin_user_name'] = $_REQUEST['setup_site_admin_user_name']; |
||
548 | $_SESSION['setup_site_admin_password'] = $_REQUEST['setup_site_admin_password']; |
||
549 | $_SESSION['setup_site_admin_password_retype'] = $_REQUEST['setup_site_admin_password_retype']; |
||
550 | $_SESSION['siteConfig_submitted'] = true; |
||
551 | |||
552 | $validation_errors = array(); |
||
553 | $validation_errors = validate_siteConfig('a'); |
||
554 | if(count($validation_errors) > 0 || $_REQUEST['goto'] == 'resend') { |
||
555 | $next_step--; |
||
556 | } |
||
557 | //break; |
||
558 | // add old custom install settings to new install form |
||
559 | //case 'siteConfig_b.php': |
||
560 | $_SESSION['setup_site_sugarbeet_automatic_checks'] = get_boolean_from_request('setup_site_sugarbeet_automatic_checks'); |
||
561 | |||
562 | $_SESSION['setup_site_custom_session_path'] = get_boolean_from_request('setup_site_custom_session_path'); |
||
563 | if($_SESSION['setup_site_custom_session_path']){ |
||
564 | $_SESSION['setup_site_session_path'] = $_REQUEST['setup_site_session_path']; |
||
565 | }else{ |
||
566 | $_SESSION['setup_site_session_path'] = ''; |
||
567 | } |
||
568 | |||
569 | $_SESSION['setup_site_custom_log_dir'] = get_boolean_from_request('setup_site_custom_log_dir'); |
||
570 | if($_SESSION['setup_site_custom_log_dir']){ |
||
571 | $_SESSION['setup_site_log_dir'] = $_REQUEST['setup_site_log_dir']; |
||
572 | }else{ |
||
573 | $_SESSION['setup_site_log_dir'] = '.'; |
||
574 | } |
||
575 | |||
576 | $_SESSION['setup_site_specify_guid'] = get_boolean_from_request('setup_site_specify_guid'); |
||
577 | if($_SESSION['setup_site_specify_guid']){ |
||
578 | $_SESSION['setup_site_guid'] = $_REQUEST['setup_site_guid']; |
||
579 | }else{ |
||
580 | $_SESSION['setup_site_guid'] = ''; |
||
581 | } |
||
582 | $_SESSION['siteConfig_submitted'] = true; |
||
583 | if(isset($_REQUEST['setup_site_sugarbeet_anonymous_stats'])){ |
||
584 | $_SESSION['setup_site_sugarbeet_anonymous_stats'] = get_boolean_from_request('setup_site_sugarbeet_anonymous_stats'); |
||
585 | }else{ |
||
586 | $_SESSION['setup_site_sugarbeet_anonymous_stats'] = 0; |
||
587 | } |
||
588 | |||
589 | $validation_errors = array(); |
||
590 | $validation_errors = validate_siteConfig('b'); |
||
591 | if(count($validation_errors) > 0) { |
||
592 | $next_step--; |
||
593 | } |
||
594 | break; |
||
595 | } |
||
596 | } |
||
597 | |||
598 | if($next_step == 9999) { |
||
599 | $the_file = 'SilentInstall'; |
||
600 | }else if($next_step == 9191) { |
||
601 | $_SESSION['oc_server_url'] = $_REQUEST['oc_server_url']; |
||
602 | $_SESSION['oc_username'] = $_REQUEST['oc_username']; |
||
603 | $_SESSION['oc_password'] = $_REQUEST['oc_password']; |
||
604 | $the_file = 'oc_convert.php'; |
||
605 | } |
||
606 | else{ |
||
607 | $the_file = $workflow[$next_step]; |
||
608 | |||
609 | } |
||
610 | |||
611 | switch($the_file) { |
||
612 | case 'welcome.php': |
||
613 | case 'license.php': |
||
614 | // |
||
615 | // Check to see if session variables are working properly |
||
616 | // |
||
617 | $_SESSION['test_session'] = 'sessions are available'; |
||
618 | @session_write_close(); |
||
619 | unset($_SESSION['test_session']); |
||
620 | @session_start(); |
||
621 | |||
622 | if(!isset($_SESSION['test_session'])) |
||
623 | { |
||
624 | $the_file = 'installDisabled.php'; |
||
625 | // PHP.ini location - |
||
626 | $phpIniLocation = get_cfg_var("cfg_file_path"); |
||
627 | $disabled_title = $mod_strings['LBL_SESSION_ERR_TITLE']; |
||
628 | $disabled_title_2 = $mod_strings['LBL_SESSION_ERR_TITLE']; |
||
629 | $disabled_text = $mod_strings['LBL_SESSION_ERR_DESCRIPTION']."<pre>{$phpIniLocation}</pre>"; |
||
630 | break; |
||
631 | } |
||
632 | // check to see if installer has been disabled |
||
633 | if(is_readable('config.php') && (filesize('config.php') > 0)) { |
||
634 | include_once('config.php'); |
||
635 | |||
636 | if(!isset($sugar_config['installer_locked']) || $sugar_config['installer_locked'] == true) { |
||
637 | $the_file = 'installDisabled.php'; |
||
638 | $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION']; |
||
639 | $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2']; |
||
640 | $disabled_text =<<<EOQ |
||
641 | <p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p> |
||
642 | <pre> |
||
643 | 'installer_locked' => false, |
||
644 | </pre> |
||
645 | <p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p> |
||
646 | |||
647 | <p>{$mod_strings['LBL_DISABLED_HELP_1']} <a href="{$mod_strings['LBL_DISABLED_HELP_LNK']}" target="_blank">{$mod_strings['LBL_DISABLED_HELP_2']}</a>.</p> |
||
648 | EOQ; |
||
649 | //if this is an offline client installation but the conversion did not succeed, |
||
650 | //then try to convert again |
||
651 | if(isset($sugar_config['disc_client']) && $sugar_config['disc_client'] == true && isset($sugar_config['oc_converted']) && $sugar_config['oc_converted'] == false) { |
||
652 | header('Location: index.php?entryPoint=oc_convert&first_time=true'); |
||
653 | exit (); |
||
654 | } |
||
655 | } |
||
656 | } |
||
657 | break; |
||
658 | case 'register.php': |
||
659 | case 'complete_install.php': |
||
660 | session_unset(); |
||
661 | break; |
||
662 | case 'SilentInstall': |
||
663 | $si_errors = false; |
||
664 | pullSilentInstallVarsIntoSession(); |
||
665 | |||
666 | /* |
||
667 | * Make sure we are using the correct unique_key. The logic |
||
668 | * to save a custom unique_key happens lower in the process. |
||
669 | * However because of the initial FTS check we are already |
||
670 | * relying on this value which will not get reinitialized |
||
671 | * when we actual need it during index creation because |
||
672 | * SilentInstaller runs in one single process. |
||
673 | */ |
||
674 | if (!empty($_SESSION['setup_site_specify_guid']) && !empty($_SESSION['setup_site_guid'])) { |
||
675 | $sugar_config['unique_key'] = $_SESSION['setup_site_guid']; |
||
676 | } else { |
||
677 | $sugar_config['unique_key'] = md5(create_guid()); |
||
678 | } |
||
679 | |||
680 | $validation_errors = validate_dbConfig('a'); |
||
0 ignored issues
–
show
The call to
validate_dbConfig() has too many arguments starting with 'a' .
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. In this case you can add the ![]() |
|||
681 | if(count($validation_errors) > 0) { |
||
682 | $the_file = 'dbConfig_a.php'; |
||
683 | $si_errors = true; |
||
684 | } |
||
685 | $validation_errors = validate_siteConfig('a'); |
||
686 | if(count($validation_errors) > 0) { |
||
687 | $the_file = 'siteConfig_a.php'; |
||
688 | $si_errors = true; |
||
689 | } |
||
690 | $validation_errors = validate_siteConfig('b'); |
||
691 | if(count($validation_errors) > 0) { |
||
692 | $the_file = 'siteConfig_b.php'; |
||
693 | $si_errors = true; |
||
694 | } |
||
695 | |||
696 | if(!$si_errors){ |
||
697 | $the_file = 'performSetup.php'; |
||
698 | } |
||
699 | require_once('jssource/minify.php'); |
||
700 | //since this is a SilentInstall we still need to make sure that |
||
701 | //the appropriate files are writable |
||
702 | // config.php |
||
703 | make_writable('./config.php'); |
||
704 | |||
705 | // custom dir |
||
706 | make_writable('./custom'); |
||
707 | |||
708 | // modules dir |
||
709 | recursive_make_writable('./modules'); |
||
710 | |||
711 | // cache dir |
||
712 | create_writable_dir(sugar_cached('custom_fields')); |
||
713 | create_writable_dir(sugar_cached('dyn_lay')); |
||
714 | create_writable_dir(sugar_cached('images')); |
||
715 | create_writable_dir(sugar_cached('modules')); |
||
716 | create_writable_dir(sugar_cached('layout')); |
||
717 | create_writable_dir(sugar_cached('pdf')); |
||
718 | create_writable_dir(sugar_cached('upload/import')); |
||
719 | create_writable_dir(sugar_cached('xml')); |
||
720 | create_writable_dir(sugar_cached('include/javascript')); |
||
721 | recursive_make_writable(sugar_cached('modules')); |
||
722 | |||
723 | // check whether we're getting this request from a command line tool |
||
724 | // we want to output brief messages if we're outputting to a command line tool |
||
725 | $cli_mode = false; |
||
726 | if(isset($_REQUEST['cli']) && ($_REQUEST['cli'] == 'true')) { |
||
727 | $_SESSION['cli'] = true; |
||
728 | // if we have errors, just shoot them back now |
||
729 | if(count($validation_errors) > 0) { |
||
730 | foreach($validation_errors as $error) { |
||
731 | print($mod_strings['ERR_ERROR_GENERAL']."\n"); |
||
732 | print(" " . $error . "\n"); |
||
733 | print("Exit 1\n"); |
||
734 | exit(1); |
||
735 | } |
||
736 | } |
||
737 | } |
||
738 | break; |
||
739 | } |
||
740 | } |
||
741 | |||
742 | |||
743 | $the_file = clean_string($the_file, 'FILE'); |
||
744 | |||
745 | installerHook('pre_installFileRequire', array('the_file' => $the_file)); |
||
746 | |||
747 | // change to require to get a good file load error message if the file is not available. |
||
748 | |||
749 | require('install/' . $the_file); |
||
750 | |||
751 | installerHook('post_installFileRequire', array('the_file' => $the_file)); |
||
752 | |||
753 | ?> |
||
754 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.