]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - install.php
Added SpellCheck Support to TinyMCE
[Github/sugarcrm.git] / install.php
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();
39 if (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();
44 if(empty($session_id)){
45         @session_start();
46 }
47 $GLOBALS['installing'] = true;
48 define('SUGARCRM_IS_INSTALLING', $GLOBALS['installing']);
49 $GLOBALS['sql_queries'] = 0;
50 require_once('include/SugarLogger/LoggerManager.php');
51 require_once('sugar_version.php');
52 require_once('include/utils.php');
53 require_once('install/install_utils.php');
54 require_once('install/install_defaults.php');
55 require_once('include/TimeDate.php');
56 require_once('include/Localization/Localization.php');
57 require_once('include/SugarTheme/SugarTheme.php');
58 require_once('include/utils/LogicHook.php');
59 require_once('data/SugarBean.php');
60 require_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';
64 if(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
70 setPhpIniSettings();
71 $locale = new Localization();
72
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
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
94 function 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';
115 if(!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
126 if(isset($_POST['language'])) {
127         $_SESSION['language'] = str_replace('-','_',$_POST['language']);
128 }
129
130 $current_language = isset($_SESSION['language']) ? $_SESSION['language'] : $default_lang;
131
132 if(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
138 if($current_language != 'en_us') {
139         $my_mod_strings = $mod_strings;
140         include('install/language/en_us.lang.php');
141         $mod_strings = sugarArrayMerge($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,
150 if(isset($_REQUEST['page']) && $_REQUEST['page'] == 'licensePrint')
151 {
152     include('install/licensePrint.php');
153     exit ();
154 }
155
156 if(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
159 if(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
167 if(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
175 if(isset($_REQUEST['install_type']) && $_REQUEST['install_type'] == 'custom'){
176         $_SESSION['install_type'] = $_REQUEST['install_type'];
177 }
178
179 //set the default settings into session
180 foreach($installer_defaults as $key =>$val){
181     if(!isset($_SESSION[$key])){
182         $_SESSION[$key] = $val;
183     }
184 }
185
186 // always perform
187 clean_special_arguments();
188 print_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
203 if($_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
211 if (!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
223 if(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
228 if(!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
236 if (!isset($_SESSION['setup_system_name']) || empty($_SESSION['setup_system_name'])) {
237     $_SESSION['setup_system_name'] = 'SugarCRM';
238 }
239 if (!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 }
242 if (!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 }
245 if (!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 }
248 if (!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
266 if(!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
288 elseif ( 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}" width="145" height="30" 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>
327 EOHTML;
328     die();
329 }
330
331
332
333     $exclude_files = array('register.php','download_modules.php');
334
335 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) {
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>
347 EOQ;
348 }
349 else{
350 $validation_errors = array();
351 // process the data posted
352 if($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             $_SESSION['setup_db_type'] = $_REQUEST['setup_db_type'];
390             $validation_errors = validate_systemOptions();
391             if(count($validation_errors) > 0) {
392                 $next_step--;
393             }
394             break;
395
396         case 'dbConfig_a.php':
397             //validation is now done through ajax call to checkDBSettings.php
398             if(isset($_REQUEST['setup_db_drop_tables'])){
399                 $_SESSION['setup_db_drop_tables'] = $_REQUEST['setup_db_drop_tables'];
400                 if($_SESSION['setup_db_drop_tables']=== true || $_SESSION['setup_db_drop_tables'] == 'true'){
401                     $_SESSION['setup_db_create_database'] = false;
402                 }
403             }
404             break;
405
406         case 'siteConfig_a.php':
407             if(isset($_REQUEST['setup_site_url'])){$_SESSION['setup_site_url']          = $_REQUEST['setup_site_url'];}
408             if(isset($_REQUEST['setup_system_name'])){$_SESSION['setup_system_name']    = $_REQUEST['setup_system_name'];}
409             if(isset($_REQUEST['setup_db_collation'])) {
410                 $_SESSION['setup_db_options']['collation'] = $_REQUEST['setup_db_collation'];
411             }
412             $_SESSION['setup_site_admin_user_name']             = $_REQUEST['setup_site_admin_user_name'];
413             $_SESSION['setup_site_admin_password']              = $_REQUEST['setup_site_admin_password'];
414             $_SESSION['setup_site_admin_password_retype']       = $_REQUEST['setup_site_admin_password_retype'];
415             $_SESSION['siteConfig_submitted']               = true;
416
417             $validation_errors = array();
418             $validation_errors = validate_siteConfig('a');
419             if(count($validation_errors) > 0) {
420                 $next_step--;
421             }
422             break;
423         case 'siteConfig_b.php':
424             $_SESSION['setup_site_sugarbeet_automatic_checks'] = get_boolean_from_request('setup_site_sugarbeet_automatic_checks');
425
426             $_SESSION['setup_site_custom_session_path']     = get_boolean_from_request('setup_site_custom_session_path');
427             if($_SESSION['setup_site_custom_session_path']){
428                 $_SESSION['setup_site_session_path']            = $_REQUEST['setup_site_session_path'];
429             }else{
430                 $_SESSION['setup_site_session_path'] = '';
431             }
432
433             $_SESSION['setup_site_custom_log_dir']          = get_boolean_from_request('setup_site_custom_log_dir');
434             if($_SESSION['setup_site_custom_log_dir']){
435                 $_SESSION['setup_site_log_dir']                 = $_REQUEST['setup_site_log_dir'];
436             }else{
437                 $_SESSION['setup_site_log_dir'] = '.';
438             }
439
440             $_SESSION['setup_site_specify_guid']            = get_boolean_from_request('setup_site_specify_guid');
441             if($_SESSION['setup_site_specify_guid']){
442                 $_SESSION['setup_site_guid']                    = $_REQUEST['setup_site_guid'];
443             }else{
444                 $_SESSION['setup_site_guid'] = '';
445             }
446             $_SESSION['siteConfig_submitted']               = true;
447             if(isset($_REQUEST['setup_site_sugarbeet_anonymous_stats'])){
448                 $_SESSION['setup_site_sugarbeet_anonymous_stats'] = get_boolean_from_request('setup_site_sugarbeet_anonymous_stats');
449             }else{
450                 $_SESSION['setup_site_sugarbeet_anonymous_stats'] = 0;
451             }
452
453             $validation_errors = array();
454             $validation_errors = validate_siteConfig('b');
455             if(count($validation_errors) > 0) {
456                 $next_step--;
457             }
458             break;
459 }
460     }
461
462 if($next_step == 9999) {
463     $the_file = 'SilentInstall';
464 }else if($next_step == 9191) {
465         $_SESSION['oc_server_url']      = $_REQUEST['oc_server_url'];
466     $_SESSION['oc_username']    = $_REQUEST['oc_username'];
467     $_SESSION['oc_password']    = $_REQUEST['oc_password'];
468     $the_file = 'oc_convert.php';
469 }
470 else{
471         $the_file = $workflow[$next_step];
472
473 }
474
475 switch($the_file) {
476     case 'welcome.php':
477     case 'license.php':
478                         //
479                         // Check to see if session variables are working properly
480                         //
481                         $_SESSION['test_session'] = 'sessions are available';
482         @session_write_close();
483                         unset($_SESSION['test_session']);
484         @session_start();
485
486                         if(!isset($_SESSION['test_session']))
487                         {
488                 $the_file = 'installDisabled.php';
489                                 // PHP.ini location -
490                                 $phpIniLocation = get_cfg_var("cfg_file_path");
491                                 $disabled_title = $mod_strings['LBL_SESSION_ERR_TITLE'];
492                                 $disabled_title_2 = $mod_strings['LBL_SESSION_ERR_TITLE'];
493                                 $disabled_text = $mod_strings['LBL_SESSION_ERR_DESCRIPTION']."<pre>{$phpIniLocation}</pre>";
494             break;
495                         }
496         // check to see if installer has been disabled
497         if(is_readable('config.php') && (filesize('config.php') > 0)) {
498             include_once('config.php');
499
500             if(!isset($sugar_config['installer_locked']) || $sugar_config['installer_locked'] == true) {
501                 $the_file = 'installDisabled.php';
502                                 $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION'];
503                                 $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2'];
504                                 $disabled_text =<<<EOQ
505                                         <p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p>
506                                         <pre>
507                                                 'installer_locked' => false,
508                                         </pre>
509                                         <p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p>
510
511                                         <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>
512 EOQ;
513                              //if this is an offline client installation but the conversion did not succeed,
514                             //then try to convert again
515                                         if(isset($sugar_config['disc_client']) && $sugar_config['disc_client'] == true && isset($sugar_config['oc_converted']) && $sugar_config['oc_converted'] == false) {
516                                   header('Location: index.php?entryPoint=oc_convert&first_time=true');
517                                                 exit ();
518                             }
519             }
520         }
521         break;
522     case 'register.php':
523         session_unset();
524         break;
525     case 'SilentInstall':
526         $si_errors = false;
527         pullSilentInstallVarsIntoSession();
528         $validation_errors = validate_dbConfig('a');
529         if(count($validation_errors) > 0) {
530             $the_file = 'dbConfig_a.php';
531             $si_errors = true;
532         }
533         $validation_errors = validate_siteConfig('a');
534         if(count($validation_errors) > 0) {
535             $the_file = 'siteConfig_a.php';
536             $si_errors = true;
537         }
538         $validation_errors = validate_siteConfig('b');
539         if(count($validation_errors) > 0) {
540             $the_file = 'siteConfig_b.php';
541             $si_errors = true;
542         }
543
544         if(!$si_errors){
545             $the_file = 'performSetup.php';
546         }
547         require_once('jssource/minify.php');
548         //since this is a SilentInstall we still need to make sure that
549         //the appropriate files are writable
550         // config.php
551         make_writable('./config.php');
552
553         // custom dir
554         make_writable('./custom');
555
556         // modules dir
557         recursive_make_writable('./modules');
558
559         // cache dir
560         create_writable_dir(sugar_cached('custom_fields'));
561         create_writable_dir(sugar_cached('dyn_lay'));
562         create_writable_dir(sugar_cached('images'));
563         create_writable_dir(sugar_cached('layout'));
564         create_writable_dir(sugar_cached('pdf'));
565         create_writable_dir(sugar_cached('upload/import'));
566         create_writable_dir(sugar_cached('xml'));
567         create_writable_dir(sugar_cached('include/javascript'));
568
569         // check whether we're getting this request from a command line tool
570         // we want to output brief messages if we're outputting to a command line tool
571         $cli_mode = false;
572         if(isset($_REQUEST['cli']) && ($_REQUEST['cli'] == 'true')) {
573             $_SESSION['cli'] = true;
574             // if we have errors, just shoot them back now
575             if(count($validation_errors) > 0) {
576                 foreach($validation_errors as $error) {
577                     print($mod_strings['ERR_ERROR_GENERAL']."\n");
578                     print("    " . $error . "\n");
579                     print("Exit 1\n");
580                     exit(1);
581                 }
582             }
583         }
584         break;
585         }
586 }
587
588
589 $the_file = clean_string($the_file, 'FILE');
590
591 installerHook('pre_installFileRequire', array('the_file' => $the_file));
592
593 // change to require to get a good file load error message if the file is not available.
594 require('install/' . $the_file);
595
596 installerHook('post_installFileRequire', array('the_file' => $the_file));
597
598 ?>