PageRenderTime 41ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 1ms

/install.php

https://github.com/mikmagic/sugarcrm_dev
PHP | 587 lines | 423 code | 81 blank | 83 comment | 109 complexity | 19729b83b5d2ea947763f56f264a88e8 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-3-Clause, AGPL-3.0
  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-2011 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. require_once('jssource/minify.php');
  64. $timedate = TimeDate::getInstance();
  65. // cn: set php.ini settings at entry points
  66. setPhpIniSettings();
  67. $locale = new Localization();
  68. if(get_magic_quotes_gpc() == 1) {
  69. $_REQUEST = array_map("stripslashes_checkstrings", $_REQUEST);
  70. $_POST = array_map("stripslashes_checkstrings", $_POST);
  71. $_GET = array_map("stripslashes_checkstrings", $_GET);
  72. }
  73. $GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
  74. $setup_sugar_version = $sugar_version;
  75. $install_script = true;
  76. ///////////////////////////////////////////////////////////////////////////////
  77. //// INSTALL RESOURCE SETUP
  78. $css = 'install/install.css';
  79. $icon = 'include/images/sugar_icon.ico';
  80. $sugar_md = 'include/images/sugar_md_open.png';
  81. $loginImage = 'include/images/sugarcrm_login.png';
  82. $common = 'install/installCommon.js';
  83. ///////////////////////////////////////////////////////////////////////////////
  84. //// INSTALLER LANGUAGE
  85. function getSupportedInstallLanguages(){
  86. $supportedLanguages = array(
  87. 'en_us' => 'English (US)',
  88. );
  89. if(file_exists('install/lang.config.php')){
  90. include('install/lang.config.php');
  91. if(!empty($config['languages'])){
  92. foreach($config['languages'] as $k=>$v){
  93. if(file_exists('install/language/' . $k . '.lang.php')){
  94. $supportedLanguages[$k] = $v;
  95. }
  96. }
  97. }
  98. }
  99. return $supportedLanguages;
  100. }
  101. $supportedLanguages = getSupportedInstallLanguages();
  102. // after install language is selected, use that pack
  103. $default_lang = 'en_us';
  104. if(!isset($_POST['language']) && (!isset($_SESSION['language']) && empty($_SESSION['language']))) {
  105. if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
  106. $lang = parseAcceptLanguage();
  107. if(isset($supportedLanguages[$lang])) {
  108. $_POST['language'] = $lang;
  109. } else {
  110. $_POST['language'] = $default_lang;
  111. }
  112. }
  113. }
  114. if(isset($_POST['language'])) {
  115. $_SESSION['language'] = str_replace('-','_',$_POST['language']);
  116. }
  117. $current_language = isset($_SESSION['language']) ? $_SESSION['language'] : $default_lang;
  118. if(file_exists("install/language/{$current_language}.lang.php")) {
  119. require_once("install/language/{$current_language}.lang.php");
  120. } else {
  121. require_once("install/language/{$default_lang}.lang.php");
  122. }
  123. if($current_language != 'en_us') {
  124. $my_mod_strings = $mod_strings;
  125. include('install/language/en_us.lang.php');
  126. $mod_strings = sugarArrayMerge($mod_strings, $my_mod_strings);
  127. }
  128. //// END INSTALLER LANGUAGE
  129. ///////////////////////////////////////////////////////////////////////////////
  130. //get the url for the helper link
  131. $help_url = get_help_button_url();
  132. //if this license print, then redirect and exit,
  133. if(isset($_REQUEST['page']) && $_REQUEST['page'] == 'licensePrint')
  134. {
  135. include('install/licensePrint.php');
  136. exit ();
  137. }
  138. //check to see if mysqli is enabled
  139. if(function_exists('mysqli_connect')){
  140. $_SESSION['mysql_type'] = 'mysqli';
  141. }
  142. //if this is a system check, then just run the check and return,
  143. //this is an ajax call and there is no need for further processing
  144. if(isset($_REQUEST['checkInstallSystem']) && ($_REQUEST['checkInstallSystem'])){
  145. require_once('install/installSystemCheck.php');
  146. echo runCheck($install_script, $mod_strings);
  147. return;
  148. }
  149. //if this is a DB Settings check, then just run the check and return,
  150. //this is an ajax call and there is no need for further processing
  151. if(isset($_REQUEST['checkDBSettings']) && ($_REQUEST['checkDBSettings'])){
  152. require_once('install/checkDBSettings.php');
  153. echo checkDBSettings();
  154. return;
  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']) && $_SESSION['install_type']=='custom'){
  191. $workflow[] = 'siteConfig_b.php';
  192. }
  193. } else {
  194. if(is_readable('config.php')) {
  195. require_once('config.php');
  196. }
  197. }
  198. // set the form's php var to the loaded config's var else default to sane settings
  199. if(!isset($_SESSION['setup_site_url']) || empty($_SESSION['setup_site_url'])){
  200. if(isset($sugar_config['site_url']) && !empty($sugar_config['site_url'])){
  201. $_SESSION['setup_site_url']= $sugar_config['site_url'];
  202. }else{
  203. $_SESSION['setup_site_url']= $web_root;
  204. }
  205. }
  206. if(!isset($_SESSION['setup_system_name']) || empty($_SESSION['setup_system_name'])){$_SESSION['setup_system_name'] = 'SugarCRM';}
  207. if(!isset($_SESSION['setup_site_session_path']) || empty($_SESSION['setup_site_session_path'])){$_SESSION['setup_site_session_path'] = (isset($sugar_config['session_dir'])) ? $sugar_config['session_dir'] : '';}
  208. if(!isset($_SESSION['setup_site_log_dir']) || empty($_SESSION['setup_site_log_dir'])){$_SESSION['setup_site_log_dir'] = (isset($sugar_config['log_dir'])) ? $sugar_config['log_dir'] : '.';}
  209. if(!isset($_SESSION['setup_site_guid']) || empty($_SESSION['setup_site_guid'])){$_SESSION['setup_site_guid'] = (isset($sugar_config['unique_key'])) ? $sugar_config['unique_key'] : '';}
  210. $workflow[] = 'confirmSettings.php';
  211. $workflow[] = 'performSetup.php';
  212. if(!isset($_SESSION['oc_install']) || $_SESSION['oc_install'] == false){
  213. if(isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && $_SESSION['install_type']=='custom'){
  214. //$workflow[] = 'download_patches.php';
  215. $workflow[] = 'download_modules.php';
  216. }
  217. }
  218. $workflow[] = 'register.php';
  219. // increment/decrement the workflow pointer
  220. if(!empty($_REQUEST['goto'])) {
  221. switch($_REQUEST['goto']) {
  222. case $mod_strings['LBL_CHECKSYS_RECHECK']:
  223. $next_step = $_REQUEST['current_step'];
  224. break;
  225. case $mod_strings['LBL_BACK']:
  226. $next_step = $_REQUEST['current_step'] - 1;
  227. break;
  228. case $mod_strings['LBL_NEXT']:
  229. case $mod_strings['LBL_START']:
  230. $next_step = $_REQUEST['current_step'] + 1;
  231. $next_clicked = true;
  232. break;
  233. case 'SilentInstall':
  234. $next_step = 9999;
  235. break;
  236. case 'oc_convert':
  237. $next_step = 9191;
  238. break;
  239. }
  240. }
  241. // Add check here to see if a silent install config file exists; if so then launch silent installer
  242. elseif ( is_file('config_si.php') && empty($sugar_config['installer_locked'])) {
  243. echo <<<EOHTML
  244. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  245. <html>
  246. <head>
  247. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  248. <meta http-equiv="Content-Style-Type" content="text/css">
  249. <meta http-equiv="Refresh" content="1; url=install.php?goto=SilentInstall&cli=true">
  250. <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_TITLE_WELCOME']} {$setup_sugar_version} {$mod_strings['LBL_WELCOME_SETUP_WIZARD']}</title>
  251. <link REL="SHORTCUT ICON" HREF="{$icon}">
  252. <link rel="stylesheet" href="{$css}" type="text/css">
  253. </head>
  254. <body>
  255. <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell">
  256. <tr>
  257. <td colspan="2" id="help"><a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a></td></tr>
  258. <tr>
  259. <th width="500">
  260. <p>
  261. <img src="{$sugar_md}" alt="SugarCRM" border="0">
  262. </p>
  263. {$mod_strings['LBL_TITLE_WELCOME']} {$setup_sugar_version} {$mod_strings['LBL_WELCOME_SETUP_WIZARD']}</th>
  264. <th width="200" height="30" style="text-align: right;"><a href="http://www.sugarcrm.com" target="_blank"><IMG src="{$loginImage}" width="145" height="30" alt="SugarCRM" border="0"></a>
  265. </th>
  266. </tr>
  267. <tr>
  268. <td colspan="2" id="ready_image"><IMG src="include/images/install_themes.jpg" width="698" height="247" alt="Sugar Themes" border="0"></td>
  269. </tr>
  270. <tr>
  271. <td colspan="2" id="ready">{$mod_strings['LBL_LAUNCHING_SILENT_INSTALL']} </td>
  272. </tr>
  273. </table>
  274. </body>
  275. </html>
  276. EOHTML;
  277. die();
  278. }
  279. $exclude_files = array('register.php','download_modules.php');
  280. 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) {
  281. $the_file = 'installDisabled.php';
  282. $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION'];
  283. $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2'];
  284. $disabled_text =<<<EOQ
  285. <p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p>
  286. <pre>
  287. 'installer_locked' => false,
  288. </pre>
  289. <p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p>
  290. <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>
  291. EOQ;
  292. }
  293. else{
  294. $validation_errors = array();
  295. // process the data posted
  296. if($next_clicked) {
  297. // store the submitted data because the 'Next' button was clicked
  298. switch($workflow[trim($_REQUEST['current_step'])]) {
  299. case 'welcome.php':
  300. $_SESSION['language'] = $_REQUEST['language'];
  301. $_SESSION['setup_site_admin_user_name'] = 'admin';
  302. break;
  303. case 'license.php':
  304. $_SESSION['setup_license_accept'] = get_boolean_from_request('setup_license_accept');
  305. $_SESSION['license_submitted'] = true;
  306. // eventually default all vars here, with overrides from config.php
  307. if(is_readable('config.php')) {
  308. global $sugar_config;
  309. include_once('config.php');
  310. }
  311. $default_db_type = 'mysql';
  312. if(!isset($_SESSION['setup_db_type'])) {
  313. $_SESSION['setup_db_type'] = empty($sugar_config['dbconfig']['db_type']) ? $default_db_type : $sugar_config['dbconfig']['db_type'];
  314. }
  315. break;
  316. case 'installType.php':
  317. $_SESSION['install_type'] = $_REQUEST['install_type'];
  318. if(isset($_REQUEST['setup_license_key']) && !empty($_REQUEST['setup_license_key'])){
  319. $_SESSION['setup_license_key'] = $_REQUEST['setup_license_key'];
  320. }
  321. $_SESSION['licenseKey_submitted'] = true;
  322. break;
  323. case 'systemOptions.php':
  324. $_SESSION['setup_db_type'] = $_REQUEST['setup_db_type'];
  325. $validation_errors = validate_systemOptions();
  326. if(count($validation_errors) > 0) {
  327. $next_step--;
  328. }
  329. break;
  330. case 'dbConfig_a.php':
  331. //validation is now done through ajax call to checkDBSettings.php
  332. if(isset($_REQUEST['setup_db_drop_tables'])){
  333. $_SESSION['setup_db_drop_tables'] = $_REQUEST['setup_db_drop_tables'];
  334. if($_SESSION['setup_db_drop_tables']=== true || $_SESSION['setup_db_drop_tables'] == 'true'){
  335. $_SESSION['setup_db_create_database'] = false;
  336. }
  337. }
  338. break;
  339. case 'siteConfig_a.php':
  340. if(isset($_REQUEST['setup_site_url'])){$_SESSION['setup_site_url'] = $_REQUEST['setup_site_url'];}
  341. if(isset($_REQUEST['setup_system_name'])){$_SESSION['setup_system_name'] = $_REQUEST['setup_system_name'];}
  342. $_SESSION['setup_site_admin_user_name'] = $_REQUEST['setup_site_admin_user_name'];
  343. $_SESSION['setup_site_admin_password'] = $_REQUEST['setup_site_admin_password'];
  344. $_SESSION['setup_site_admin_password_retype'] = $_REQUEST['setup_site_admin_password_retype'];
  345. $_SESSION['siteConfig_submitted'] = true;
  346. $validation_errors = array();
  347. $validation_errors = validate_siteConfig('a');
  348. if(count($validation_errors) > 0) {
  349. $next_step--;
  350. }
  351. break;
  352. case 'siteConfig_b.php':
  353. $_SESSION['setup_site_sugarbeet_automatic_checks'] = get_boolean_from_request('setup_site_sugarbeet_automatic_checks');
  354. $_SESSION['setup_site_custom_session_path'] = get_boolean_from_request('setup_site_custom_session_path');
  355. if($_SESSION['setup_site_custom_session_path']){
  356. $_SESSION['setup_site_session_path'] = $_REQUEST['setup_site_session_path'];
  357. }else{
  358. $_SESSION['setup_site_session_path'] = '';
  359. }
  360. $_SESSION['setup_site_custom_log_dir'] = get_boolean_from_request('setup_site_custom_log_dir');
  361. if($_SESSION['setup_site_custom_log_dir']){
  362. $_SESSION['setup_site_log_dir'] = $_REQUEST['setup_site_log_dir'];
  363. }else{
  364. $_SESSION['setup_site_log_dir'] = '.';
  365. }
  366. $_SESSION['setup_site_specify_guid'] = get_boolean_from_request('setup_site_specify_guid');
  367. if($_SESSION['setup_site_specify_guid']){
  368. $_SESSION['setup_site_guid'] = $_REQUEST['setup_site_guid'];
  369. }else{
  370. $_SESSION['setup_site_guid'] = '';
  371. }
  372. $_SESSION['siteConfig_submitted'] = true;
  373. if(isset($_REQUEST['setup_site_sugarbeet_anonymous_stats'])){
  374. $_SESSION['setup_site_sugarbeet_anonymous_stats'] = get_boolean_from_request('setup_site_sugarbeet_anonymous_stats');
  375. }else{
  376. $_SESSION['setup_site_sugarbeet_anonymous_stats'] = 0;
  377. }
  378. $validation_errors = array();
  379. $validation_errors = validate_siteConfig('b');
  380. if(count($validation_errors) > 0) {
  381. $next_step--;
  382. }
  383. break;
  384. }
  385. }
  386. if($next_step == 9999) {
  387. $the_file = 'SilentInstall';
  388. }else if($next_step == 9191) {
  389. $_SESSION['oc_server_url'] = $_REQUEST['oc_server_url'];
  390. $_SESSION['oc_username'] = $_REQUEST['oc_username'];
  391. $_SESSION['oc_password'] = $_REQUEST['oc_password'];
  392. $the_file = 'oc_convert.php';
  393. }
  394. else{
  395. $the_file = $workflow[$next_step];
  396. }
  397. switch($the_file) {
  398. case 'welcome.php':
  399. case 'license.php':
  400. //
  401. // Check to see if session variables are working properly
  402. //
  403. $_SESSION['test_session'] = 'sessions are available';
  404. @session_write_close();
  405. unset($_SESSION['test_session']);
  406. @session_start();
  407. if(!isset($_SESSION['test_session']))
  408. {
  409. $the_file = 'installDisabled.php';
  410. // PHP.ini location -
  411. $phpIniLocation = get_cfg_var("cfg_file_path");
  412. $disabled_title = $mod_strings['LBL_SESSION_ERR_TITLE'];
  413. $disabled_title_2 = $mod_strings['LBL_SESSION_ERR_TITLE'];
  414. $disabled_text = $mod_strings['LBL_SESSION_ERR_DESCRIPTION']."<pre>{$phpIniLocation}</pre>";
  415. break;
  416. }
  417. // check to see if installer has been disabled
  418. if(is_readable('config.php') && (filesize('config.php') > 0)) {
  419. include_once('config.php');
  420. if(!isset($sugar_config['installer_locked']) || $sugar_config['installer_locked'] == true) {
  421. $the_file = 'installDisabled.php';
  422. $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION'];
  423. $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2'];
  424. $disabled_text =<<<EOQ
  425. <p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p>
  426. <pre>
  427. 'installer_locked' => false,
  428. </pre>
  429. <p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p>
  430. <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>
  431. EOQ;
  432. //if this is an offline client installation but the conversion did not succeed,
  433. //then try to convert again
  434. if(isset($sugar_config['disc_client']) && $sugar_config['disc_client'] == true && isset($sugar_config['oc_converted']) && $sugar_config['oc_converted'] == false) {
  435. header('Location: index.php?entryPoint=oc_convert&first_time=true');
  436. exit ();
  437. }
  438. }
  439. }
  440. break;
  441. case 'register.php':
  442. session_unset();
  443. break;
  444. case 'SilentInstall':
  445. $si_errors = false;
  446. pullSilentInstallVarsIntoSession();
  447. $validation_errors = validate_dbConfig('a');
  448. if(count($validation_errors) > 0) {
  449. $the_file = 'dbConfig_a.php';
  450. $si_errors = true;
  451. }
  452. $validation_errors = validate_siteConfig('a');
  453. if(count($validation_errors) > 0) {
  454. $the_file = 'siteConfig_a.php';
  455. $si_errors = true;
  456. }
  457. $validation_errors = validate_siteConfig('b');
  458. if(count($validation_errors) > 0) {
  459. $the_file = 'siteConfig_b.php';
  460. $si_errors = true;
  461. }
  462. if(!$si_errors){
  463. $the_file = 'performSetup.php';
  464. }
  465. //since this is a SilentInstall we still need to make sure that
  466. //the appropriate files are writable
  467. // config.php
  468. make_writable('./config.php');
  469. // custom dir
  470. make_writable('./custom');
  471. // modules dir
  472. recursive_make_writable('./modules');
  473. // data dir
  474. make_writable('./data');
  475. make_writable('./data/upload');
  476. // cache dir
  477. make_writable('./cache/custom_fields');
  478. make_writable('./cache/dyn_lay');
  479. make_writable('./cache/images');
  480. make_writable('./cache/import');
  481. make_writable('./cache/layout');
  482. make_writable('./cache/pdf');
  483. make_writable('./cache/upload');
  484. make_writable('./cache/xml');
  485. // check whether we're getting this request from a command line tool
  486. // we want to output brief messages if we're outputting to a command line tool
  487. $cli_mode = false;
  488. if(isset($_REQUEST['cli']) && ($_REQUEST['cli'] == 'true')) {
  489. $_SESSION['cli'] = true;
  490. // if we have errors, just shoot them back now
  491. if(count($validation_errors) > 0) {
  492. foreach($validation_errors as $error) {
  493. print($mod_strings['ERR_ERROR_GENERAL']."\n");
  494. print(" " . $error . "\n");
  495. print("Exit 1\n");
  496. exit(1);
  497. }
  498. }
  499. }
  500. break;
  501. }
  502. }
  503. $the_file = clean_string($the_file, 'FILE');
  504. // change to require to get a good file load error message if the file is not available.
  505. require('install/' . $the_file);
  506. ?>