PageRenderTime 47ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/SugarCE-6.5.4/SugarCE-Full-6.5.4/install.php

https://bitbucket.org/blakeball/test-repository
PHP | 602 lines | 448 code | 73 blank | 81 comment | 121 complexity | a4e2e1c845b63962dfa89cd8ff50c9f7 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception
  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-2012 SugarCRM Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it under
  8. * the terms of the GNU Affero General Public License version 3 as published by the
  9. * Free Software Foundation with the addition of the following permission added
  10. * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
  11. * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
  12. * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
  13. *
  14. * This program is distributed in the hope that it will be useful, but WITHOUT
  15. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  16. * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License along with
  20. * this program; if not, see http://www.gnu.org/licenses or write to the Free
  21. * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  22. * 02110-1301 USA.
  23. *
  24. * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
  25. * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
  26. *
  27. * The interactive user interfaces in modified source and object code versions
  28. * of this program must display Appropriate Legal Notices, as required under
  29. * Section 5 of the GNU Affero General Public License version 3.
  30. *
  31. * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
  32. * these Appropriate Legal Notices must retain the display of the "Powered by
  33. * SugarCRM" logo. If the display of the logo is not reasonably feasible for
  34. * technical reasons, the Appropriate Legal Notices must display the words
  35. * "Powered by SugarCRM".
  36. ********************************************************************************/
  37. //session_destroy();
  38. if (version_compare(phpversion(),'5.2.0') < 0) {
  39. $msg = 'Minimum PHP version required is 5.2.0. You are using PHP version '. phpversion();
  40. die($msg);
  41. }
  42. $session_id = session_id();
  43. if(empty($session_id)){
  44. @session_start();
  45. }
  46. $GLOBALS['installing'] = true;
  47. define('SUGARCRM_IS_INSTALLING', $GLOBALS['installing']);
  48. $GLOBALS['sql_queries'] = 0;
  49. require_once('include/SugarLogger/LoggerManager.php');
  50. require_once('sugar_version.php');
  51. require_once('include/utils.php');
  52. require_once('install/install_utils.php');
  53. require_once('install/install_defaults.php');
  54. require_once('include/TimeDate.php');
  55. require_once('include/Localization/Localization.php');
  56. require_once('include/SugarTheme/SugarTheme.php');
  57. require_once('include/utils/LogicHook.php');
  58. require_once('data/SugarBean.php');
  59. require_once('include/entryPoint.php');
  60. //check to see if the script files need to be rebuilt, add needed variables to request array
  61. $_REQUEST['root_directory'] = getcwd();
  62. $_REQUEST['js_rebuild_concat'] = 'rebuild';
  63. if(isset($_REQUEST['goto']) && $_REQUEST['goto'] != 'SilentInstall') {
  64. require_once('jssource/minify.php');
  65. }
  66. $timedate = TimeDate::getInstance();
  67. // cn: set php.ini settings at entry points
  68. setPhpIniSettings();
  69. $locale = new Localization();
  70. if(get_magic_quotes_gpc() == 1) {
  71. $_REQUEST = array_map("stripslashes_checkstrings", $_REQUEST);
  72. $_POST = array_map("stripslashes_checkstrings", $_POST);
  73. $_GET = array_map("stripslashes_checkstrings", $_GET);
  74. }
  75. $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
  76. $setup_sugar_version = $sugar_version;
  77. $install_script = true;
  78. ///////////////////////////////////////////////////////////////////////////////
  79. //// INSTALL RESOURCE SETUP
  80. $css = 'install/install.css';
  81. $icon = 'include/images/sugar_icon.ico';
  82. $sugar_md = 'include/images/sugar_md_open.png';
  83. $loginImage = 'include/images/sugarcrm_login.png';
  84. $common = 'install/installCommon.js';
  85. ///////////////////////////////////////////////////////////////////////////////
  86. //// INSTALLER LANGUAGE
  87. function getSupportedInstallLanguages(){
  88. $supportedLanguages = array(
  89. 'en_us' => 'English (US)',
  90. );
  91. if(file_exists('install/lang.config.php')){
  92. include('install/lang.config.php');
  93. if(!empty($config['languages'])){
  94. foreach($config['languages'] as $k=>$v){
  95. if(file_exists('install/language/' . $k . '.lang.php')){
  96. $supportedLanguages[$k] = $v;
  97. }
  98. }
  99. }
  100. }
  101. return $supportedLanguages;
  102. }
  103. $supportedLanguages = getSupportedInstallLanguages();
  104. // after install language is selected, use that pack
  105. $default_lang = 'en_us';
  106. if(!isset($_POST['language']) && (!isset($_SESSION['language']) && empty($_SESSION['language']))) {
  107. if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
  108. $lang = parseAcceptLanguage();
  109. if(isset($supportedLanguages[$lang])) {
  110. $_POST['language'] = $lang;
  111. } else {
  112. $_POST['language'] = $default_lang;
  113. }
  114. }
  115. }
  116. if(isset($_POST['language'])) {
  117. $_SESSION['language'] = str_replace('-','_',$_POST['language']);
  118. }
  119. $current_language = isset($_SESSION['language']) ? $_SESSION['language'] : $default_lang;
  120. if(file_exists("install/language/{$current_language}.lang.php")) {
  121. require_once("install/language/{$current_language}.lang.php");
  122. } else {
  123. require_once("install/language/{$default_lang}.lang.php");
  124. }
  125. if($current_language != 'en_us') {
  126. $my_mod_strings = $mod_strings;
  127. include('install/language/en_us.lang.php');
  128. $mod_strings = sugarLangArrayMerge($mod_strings, $my_mod_strings);
  129. }
  130. //// END INSTALLER LANGUAGE
  131. ///////////////////////////////////////////////////////////////////////////////
  132. //get the url for the helper link
  133. $help_url = get_help_button_url();
  134. //if this license print, then redirect and exit,
  135. if(isset($_REQUEST['page']) && $_REQUEST['page'] == 'licensePrint')
  136. {
  137. include('install/licensePrint.php');
  138. exit ();
  139. }
  140. if(isset($_REQUEST['sugar_body_only']) && $_REQUEST['sugar_body_only'] == "1") {
  141. //if this is a system check, then just run the check and return,
  142. //this is an ajax call and there is no need for further processing
  143. if(isset($_REQUEST['checkInstallSystem']) && ($_REQUEST['checkInstallSystem'])){
  144. require_once('install/installSystemCheck.php');
  145. echo runCheck($install_script, $mod_strings);
  146. return;
  147. }
  148. //if this is a DB Settings check, then just run the check and return,
  149. //this is an ajax call and there is no need for further processing
  150. if(isset($_REQUEST['checkDBSettings']) && ($_REQUEST['checkDBSettings'])){
  151. require_once('install/checkDBSettings.php');
  152. echo checkDBSettings();
  153. return;
  154. }
  155. }
  156. //maintaining the install_type if earlier set to custom
  157. if(isset($_REQUEST['install_type']) && $_REQUEST['install_type'] == 'custom'){
  158. $_SESSION['install_type'] = $_REQUEST['install_type'];
  159. }
  160. //set the default settings into session
  161. foreach($installer_defaults as $key =>$val){
  162. if(!isset($_SESSION[$key])){
  163. $_SESSION[$key] = $val;
  164. }
  165. }
  166. // always perform
  167. clean_special_arguments();
  168. print_debug_comment();
  169. $next_clicked = false;
  170. $next_step = 0;
  171. // use a simple array to map out the steps of the installer page flow
  172. $workflow = array( 'welcome.php',
  173. 'ready.php',
  174. 'license.php',
  175. 'installType.php',
  176. );
  177. $workflow[] = 'systemOptions.php';
  178. $workflow[] = 'dbConfig_a.php';
  179. //$workflow[] = 'dbConfig_b.php';
  180. //define web root, which will be used as default for site_url
  181. if($_SERVER['SERVER_PORT']=='80'){
  182. $web_root = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
  183. }else{
  184. $web_root = $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['PHP_SELF'];
  185. }
  186. $web_root = str_replace("/install.php", "", $web_root);
  187. $web_root = "http://$web_root";
  188. if (!isset($_SESSION['oc_install']) || $_SESSION['oc_install'] == false) {
  189. $workflow[] = 'siteConfig_a.php';
  190. if (isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) &&
  191. $_SESSION['install_type'] == 'custom') {
  192. $workflow[] = 'siteConfig_b.php';
  193. }
  194. } else {
  195. if (is_readable('config.php')) {
  196. require_once ('config.php');
  197. }
  198. }
  199. if(empty($sugar_config['cache_dir']) && !empty($_SESSION['cache_dir'])) {
  200. $sugar_config['cache_dir'] = $_SESSION['cache_dir'];
  201. }
  202. // set the form's php var to the loaded config's var else default to sane settings
  203. if(!isset($_SESSION['setup_site_url']) || empty($_SESSION['setup_site_url'])) {
  204. if(isset($sugar_config['site_url']) && !empty($sugar_config['site_url'])) {
  205. $_SESSION['setup_site_url']= $sugar_config['site_url'];
  206. } else {
  207. $_SESSION['setup_site_url']= $web_root;
  208. }
  209. }
  210. if (!isset($_SESSION['setup_system_name']) || empty($_SESSION['setup_system_name'])) {
  211. $_SESSION['setup_system_name'] = 'SugarCRM';
  212. }
  213. if (!isset($_SESSION['setup_site_session_path']) || empty($_SESSION['setup_site_session_path'])) {
  214. $_SESSION['setup_site_session_path'] = (isset($sugar_config['session_dir'])) ? $sugar_config['session_dir'] : '';
  215. }
  216. if (!isset($_SESSION['setup_site_log_dir']) || empty($_SESSION['setup_site_log_dir'])) {
  217. $_SESSION['setup_site_log_dir'] = (isset($sugar_config['log_dir'])) ? $sugar_config['log_dir'] : '.';
  218. }
  219. if (!isset($_SESSION['setup_site_guid']) || empty($_SESSION['setup_site_guid'])) {
  220. $_SESSION['setup_site_guid'] = (isset($sugar_config['unique_key'])) ? $sugar_config['unique_key'] : '';
  221. }
  222. if (!isset($_SESSION['cache_dir']) || empty($_SESSION['cache_dir'])) {
  223. $_SESSION['cache_dir'] = isset($sugar_config['cache_dir']) ? $sugar_config['cache_dir'] : 'cache/';
  224. }
  225. $workflow[] = 'confirmSettings.php';
  226. $workflow[] = 'performSetup.php';
  227. if(!isset($_SESSION['oc_install']) || $_SESSION['oc_install'] == false){
  228. if(isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && $_SESSION['install_type']=='custom'){
  229. //$workflow[] = 'download_patches.php';
  230. $workflow[] = 'download_modules.php';
  231. }
  232. }
  233. $workflow[] = 'register.php';
  234. // increment/decrement the workflow pointer
  235. if(!empty($_REQUEST['goto'])) {
  236. switch($_REQUEST['goto']) {
  237. case $mod_strings['LBL_CHECKSYS_RECHECK']:
  238. $next_step = $_REQUEST['current_step'];
  239. break;
  240. case $mod_strings['LBL_BACK']:
  241. $next_step = $_REQUEST['current_step'] - 1;
  242. break;
  243. case $mod_strings['LBL_NEXT']:
  244. case $mod_strings['LBL_START']:
  245. $next_step = $_REQUEST['current_step'] + 1;
  246. $next_clicked = true;
  247. break;
  248. case 'SilentInstall':
  249. $next_step = 9999;
  250. break;
  251. case 'oc_convert':
  252. $next_step = 9191;
  253. break;
  254. }
  255. }
  256. // Add check here to see if a silent install config file exists; if so then launch silent installer
  257. elseif ( is_file('config_si.php') && empty($sugar_config['installer_locked'])) {
  258. $langHeader = get_language_header();
  259. echo <<<EOHTML
  260. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  261. <html {$langHeader}>
  262. <head>
  263. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  264. <meta http-equiv="Content-Style-Type" content="text/css">
  265. <meta http-equiv="Refresh" content="1; url=install.php?goto=SilentInstall&cli=true">
  266. <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_TITLE_WELCOME']} {$setup_sugar_version} {$mod_strings['LBL_WELCOME_SETUP_WIZARD']}</title>
  267. <link REL="SHORTCUT ICON" HREF="{$icon}">
  268. <link rel="stylesheet" href="{$css}" type="text/css">
  269. </head>
  270. <body>
  271. <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell">
  272. <tr>
  273. <td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr>
  274. <tr>
  275. <th width="500">
  276. <p>
  277. <img src="{$sugar_md}" alt="SugarCRM" border="0">
  278. </p>
  279. {$mod_strings['LBL_TITLE_WELCOME']} {$setup_sugar_version} {$mod_strings['LBL_WELCOME_SETUP_WIZARD']}</th>
  280. <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>
  281. </th>
  282. </tr>
  283. <tr>
  284. <td colspan="2" id="ready_image"><IMG src="include/images/install_themes.jpg" width="698" height="247" alt="Sugar Themes" border="0"></td>
  285. </tr>
  286. <tr>
  287. <td colspan="2" id="ready">{$mod_strings['LBL_LAUNCHING_SILENT_INSTALL']} </td>
  288. </tr>
  289. </table>
  290. </body>
  291. </html>
  292. EOHTML;
  293. die();
  294. }
  295. $exclude_files = array('register.php','download_modules.php');
  296. 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) {
  297. $the_file = 'installDisabled.php';
  298. $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION'];
  299. $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2'];
  300. $disabled_text =<<<EOQ
  301. <p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p>
  302. <pre>
  303. 'installer_locked' => false,
  304. </pre>
  305. <p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p>
  306. <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>
  307. EOQ;
  308. }
  309. else{
  310. $validation_errors = array();
  311. // process the data posted
  312. if($next_clicked) {
  313. // store the submitted data because the 'Next' button was clicked
  314. switch($workflow[trim($_REQUEST['current_step'])]) {
  315. case 'welcome.php':
  316. $_SESSION['language'] = $_REQUEST['language'];
  317. $_SESSION['setup_site_admin_user_name'] = 'admin';
  318. break;
  319. case 'license.php':
  320. $_SESSION['setup_license_accept'] = get_boolean_from_request('setup_license_accept');
  321. $_SESSION['license_submitted'] = true;
  322. // eventually default all vars here, with overrides from config.php
  323. if(is_readable('config.php')) {
  324. global $sugar_config;
  325. include_once('config.php');
  326. }
  327. $default_db_type = 'mysql';
  328. if(!isset($_SESSION['setup_db_type'])) {
  329. $_SESSION['setup_db_type'] = empty($sugar_config['dbconfig']['db_type']) ? $default_db_type : $sugar_config['dbconfig']['db_type'];
  330. }
  331. break;
  332. case 'installType.php':
  333. $_SESSION['install_type'] = $_REQUEST['install_type'];
  334. if(isset($_REQUEST['setup_license_key']) && !empty($_REQUEST['setup_license_key'])){
  335. $_SESSION['setup_license_key'] = $_REQUEST['setup_license_key'];
  336. }
  337. $_SESSION['licenseKey_submitted'] = true;
  338. break;
  339. case 'systemOptions.php':
  340. if(isset($_REQUEST['setup_db_type'])) {
  341. $_SESSION['setup_db_type'] = $_REQUEST['setup_db_type'];
  342. }
  343. $validation_errors = validate_systemOptions();
  344. if(count($validation_errors) > 0) {
  345. $next_step--;
  346. }
  347. break;
  348. case 'dbConfig_a.php':
  349. //validation is now done through ajax call to checkDBSettings.php
  350. if(isset($_REQUEST['setup_db_drop_tables'])){
  351. $_SESSION['setup_db_drop_tables'] = $_REQUEST['setup_db_drop_tables'];
  352. if($_SESSION['setup_db_drop_tables']=== true || $_SESSION['setup_db_drop_tables'] == 'true'){
  353. $_SESSION['setup_db_create_database'] = false;
  354. }
  355. }
  356. break;
  357. case 'siteConfig_a.php':
  358. if(isset($_REQUEST['setup_site_url'])){$_SESSION['setup_site_url'] = $_REQUEST['setup_site_url'];}
  359. if(isset($_REQUEST['setup_system_name'])){$_SESSION['setup_system_name'] = $_REQUEST['setup_system_name'];}
  360. if(isset($_REQUEST['setup_db_collation'])) {
  361. $_SESSION['setup_db_options']['collation'] = $_REQUEST['setup_db_collation'];
  362. }
  363. $_SESSION['setup_site_admin_user_name'] = $_REQUEST['setup_site_admin_user_name'];
  364. $_SESSION['setup_site_admin_password'] = $_REQUEST['setup_site_admin_password'];
  365. $_SESSION['setup_site_admin_password_retype'] = $_REQUEST['setup_site_admin_password_retype'];
  366. $_SESSION['siteConfig_submitted'] = true;
  367. $validation_errors = array();
  368. $validation_errors = validate_siteConfig('a');
  369. if(count($validation_errors) > 0) {
  370. $next_step--;
  371. }
  372. break;
  373. case 'siteConfig_b.php':
  374. $_SESSION['setup_site_sugarbeet_automatic_checks'] = get_boolean_from_request('setup_site_sugarbeet_automatic_checks');
  375. $_SESSION['setup_site_custom_session_path'] = get_boolean_from_request('setup_site_custom_session_path');
  376. if($_SESSION['setup_site_custom_session_path']){
  377. $_SESSION['setup_site_session_path'] = $_REQUEST['setup_site_session_path'];
  378. }else{
  379. $_SESSION['setup_site_session_path'] = '';
  380. }
  381. $_SESSION['setup_site_custom_log_dir'] = get_boolean_from_request('setup_site_custom_log_dir');
  382. if($_SESSION['setup_site_custom_log_dir']){
  383. $_SESSION['setup_site_log_dir'] = $_REQUEST['setup_site_log_dir'];
  384. }else{
  385. $_SESSION['setup_site_log_dir'] = '.';
  386. }
  387. $_SESSION['setup_site_specify_guid'] = get_boolean_from_request('setup_site_specify_guid');
  388. if($_SESSION['setup_site_specify_guid']){
  389. $_SESSION['setup_site_guid'] = $_REQUEST['setup_site_guid'];
  390. }else{
  391. $_SESSION['setup_site_guid'] = '';
  392. }
  393. $_SESSION['siteConfig_submitted'] = true;
  394. if(isset($_REQUEST['setup_site_sugarbeet_anonymous_stats'])){
  395. $_SESSION['setup_site_sugarbeet_anonymous_stats'] = get_boolean_from_request('setup_site_sugarbeet_anonymous_stats');
  396. }else{
  397. $_SESSION['setup_site_sugarbeet_anonymous_stats'] = 0;
  398. }
  399. $validation_errors = array();
  400. $validation_errors = validate_siteConfig('b');
  401. if(count($validation_errors) > 0) {
  402. $next_step--;
  403. }
  404. break;
  405. }
  406. }
  407. if($next_step == 9999) {
  408. $the_file = 'SilentInstall';
  409. }else if($next_step == 9191) {
  410. $_SESSION['oc_server_url'] = $_REQUEST['oc_server_url'];
  411. $_SESSION['oc_username'] = $_REQUEST['oc_username'];
  412. $_SESSION['oc_password'] = $_REQUEST['oc_password'];
  413. $the_file = 'oc_convert.php';
  414. }
  415. else{
  416. $the_file = $workflow[$next_step];
  417. }
  418. switch($the_file) {
  419. case 'welcome.php':
  420. case 'license.php':
  421. //
  422. // Check to see if session variables are working properly
  423. //
  424. $_SESSION['test_session'] = 'sessions are available';
  425. @session_write_close();
  426. unset($_SESSION['test_session']);
  427. @session_start();
  428. if(!isset($_SESSION['test_session']))
  429. {
  430. $the_file = 'installDisabled.php';
  431. // PHP.ini location -
  432. $phpIniLocation = get_cfg_var("cfg_file_path");
  433. $disabled_title = $mod_strings['LBL_SESSION_ERR_TITLE'];
  434. $disabled_title_2 = $mod_strings['LBL_SESSION_ERR_TITLE'];
  435. $disabled_text = $mod_strings['LBL_SESSION_ERR_DESCRIPTION']."<pre>{$phpIniLocation}</pre>";
  436. break;
  437. }
  438. // check to see if installer has been disabled
  439. if(is_readable('config.php') && (filesize('config.php') > 0)) {
  440. include_once('config.php');
  441. if(!isset($sugar_config['installer_locked']) || $sugar_config['installer_locked'] == true) {
  442. $the_file = 'installDisabled.php';
  443. $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION'];
  444. $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2'];
  445. $disabled_text =<<<EOQ
  446. <p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p>
  447. <pre>
  448. 'installer_locked' => false,
  449. </pre>
  450. <p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p>
  451. <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>
  452. EOQ;
  453. //if this is an offline client installation but the conversion did not succeed,
  454. //then try to convert again
  455. if(isset($sugar_config['disc_client']) && $sugar_config['disc_client'] == true && isset($sugar_config['oc_converted']) && $sugar_config['oc_converted'] == false) {
  456. header('Location: index.php?entryPoint=oc_convert&first_time=true');
  457. exit ();
  458. }
  459. }
  460. }
  461. break;
  462. case 'register.php':
  463. session_unset();
  464. break;
  465. case 'SilentInstall':
  466. $si_errors = false;
  467. pullSilentInstallVarsIntoSession();
  468. $validation_errors = validate_dbConfig('a');
  469. if(count($validation_errors) > 0) {
  470. $the_file = 'dbConfig_a.php';
  471. $si_errors = true;
  472. }
  473. $validation_errors = validate_siteConfig('a');
  474. if(count($validation_errors) > 0) {
  475. $the_file = 'siteConfig_a.php';
  476. $si_errors = true;
  477. }
  478. $validation_errors = validate_siteConfig('b');
  479. if(count($validation_errors) > 0) {
  480. $the_file = 'siteConfig_b.php';
  481. $si_errors = true;
  482. }
  483. if(!$si_errors){
  484. $the_file = 'performSetup.php';
  485. }
  486. require_once('jssource/minify.php');
  487. //since this is a SilentInstall we still need to make sure that
  488. //the appropriate files are writable
  489. // config.php
  490. make_writable('./config.php');
  491. // custom dir
  492. make_writable('./custom');
  493. // modules dir
  494. recursive_make_writable('./modules');
  495. // cache dir
  496. create_writable_dir(sugar_cached('custom_fields'));
  497. create_writable_dir(sugar_cached('dyn_lay'));
  498. create_writable_dir(sugar_cached('images'));
  499. create_writable_dir(sugar_cached('modules'));
  500. create_writable_dir(sugar_cached('layout'));
  501. create_writable_dir(sugar_cached('pdf'));
  502. create_writable_dir(sugar_cached('upload/import'));
  503. create_writable_dir(sugar_cached('xml'));
  504. create_writable_dir(sugar_cached('include/javascript'));
  505. recursive_make_writable(sugar_cached('modules'));
  506. // check whether we're getting this request from a command line tool
  507. // we want to output brief messages if we're outputting to a command line tool
  508. $cli_mode = false;
  509. if(isset($_REQUEST['cli']) && ($_REQUEST['cli'] == 'true')) {
  510. $_SESSION['cli'] = true;
  511. // if we have errors, just shoot them back now
  512. if(count($validation_errors) > 0) {
  513. foreach($validation_errors as $error) {
  514. print($mod_strings['ERR_ERROR_GENERAL']."\n");
  515. print(" " . $error . "\n");
  516. print("Exit 1\n");
  517. exit(1);
  518. }
  519. }
  520. }
  521. break;
  522. }
  523. }
  524. $the_file = clean_string($the_file, 'FILE');
  525. installerHook('pre_installFileRequire', array('the_file' => $the_file));
  526. // change to require to get a good file load error message if the file is not available.
  527. require('install/' . $the_file);
  528. installerHook('post_installFileRequire', array('the_file' => $the_file));
  529. ?>