PageRenderTime 46ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/install.php

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