PageRenderTime 59ms CodeModel.GetById 2ms app.highlight 48ms RepoModel.GetById 1ms app.codeStats 1ms

/install.php

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