install/includes/stages/install.php
changeset 1227 bdac73ed481e
parent 1081 745200a9cc2a
child 1378 e58294b867c1
equal deleted inserted replaced
1226:de56132c008d 1227:bdac73ed481e
    12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    13  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
    13  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
    14  */
    14  */
    15 
    15 
    16 if ( !defined('IN_ENANO_INSTALL') )
    16 if ( !defined('IN_ENANO_INSTALL') )
    17   die();
    17 	die();
    18 
    18 
    19 require ( ENANO_ROOT . '/install/includes/libenanoinstall.php' );
    19 require ( ENANO_ROOT . '/install/includes/libenanoinstall.php' );
    20 require ( ENANO_ROOT . '/includes/sql_parse.php' );
    20 require ( ENANO_ROOT . '/includes/sql_parse.php' );
    21 require ( ENANO_ROOT . '/includes/dbal.php' );
    21 require ( ENANO_ROOT . '/includes/dbal.php' );
    22 require ( ENANO_ROOT . '/config.new.php' );
    22 require ( ENANO_ROOT . '/config.new.php' );
    23 
    23 
    24 if ( !in_array($dbdriver, $supported_drivers) )
    24 if ( !in_array($dbdriver, $supported_drivers) )
    25 {
    25 {
    26   $ui->show_header();
    26 	$ui->show_header();
    27   echo '<h3>Installation error</h3>
    27 	echo '<h3>Installation error</h3>
    28          <p>ERROR: That database driver is not supported.</p>';
    28  				<p>ERROR: That database driver is not supported.</p>';
    29   return true;
    29 	return true;
    30 }
    30 }
    31 
    31 
    32 $db = new $dbdriver();
    32 $db = new $dbdriver();
    33 $result = $db->connect();
    33 $result = $db->connect();
    34 if ( !$result )
    34 if ( !$result )
    35 {
    35 {
    36   $ui->show_header();
    36 	$ui->show_header();
    37   // FIXME: l10n
    37 	// FIXME: l10n
    38   ?>
    38 	?>
    39   <form action="install.php?stage=database" method="post" name="database_info">
    39 	<form action="install.php?stage=database" method="post" name="database_info">
    40     <input type="hidden" name="language" value="<?php echo $lang_id; ?>" />
    40 		<input type="hidden" name="language" value="<?php echo $lang_id; ?>" />
    41     <input type="hidden" name="driver" value="<?php echo $dbdriver; ?>" />
    41 		<input type="hidden" name="driver" value="<?php echo $dbdriver; ?>" />
    42     <h3><?php echo $lang->get('database_msg_post_fail_title'); ?></h3>
    42 		<h3><?php echo $lang->get('database_msg_post_fail_title'); ?></h3>
    43     <p><?php echo $lang->get('database_msg_post_fail_body'); ?></p>
    43 		<p><?php echo $lang->get('database_msg_post_fail_body'); ?></p>
    44     <p><?php echo $lang->get('database_msg_post_fail_desc'); ?>
    44 		<p><?php echo $lang->get('database_msg_post_fail_desc'); ?>
    45       <?php
    45 			<?php
    46       echo $db->sql_error();
    46 			echo $db->sql_error();
    47       ?>
    47 			?>
    48     </p>
    48 		</p>
    49     <p>
    49 		<p>
    50       <!-- FIXME: l10n -->
    50 			<!-- FIXME: l10n -->
    51       <input type="submit" name="_cont" value="<?php echo $lang->get('database_btn_go_back'); ?>" />
    51 			<input type="submit" name="_cont" value="<?php echo $lang->get('database_btn_go_back'); ?>" />
    52     </p>
    52 		</p>
    53   </form>
    53 	</form>
    54   <?php
    54 	<?php
    55   return true;
    55 	return true;
    56 }
    56 }
    57 
    57 
    58 // we're connected to the database now.
    58 // we're connected to the database now.
    59 
    59 
    60 $ui->show_header();
    60 $ui->show_header();
    70 
    70 
    71 @set_time_limit(0);
    71 @set_time_limit(0);
    72 
    72 
    73 function stg_load_files()
    73 function stg_load_files()
    74 {
    74 {
    75   global $dbdriver;
    75 	global $dbdriver;
    76   if ( !@include( ENANO_ROOT . "/install/includes/payload.php" ) )
    76 	if ( !@include( ENANO_ROOT . "/install/includes/payload.php" ) )
    77     return false;
    77 		return false;
    78   
    78 	
    79   return true;
    79 	return true;
    80 }
    80 }
    81 
    81 
    82 start_install_table();
    82 start_install_table();
    83 
    83 
    84 run_installer_stage('load', $lang->get('install_stg_load_title'), 'stg_load_files', $lang->get('install_stg_load_body'), false);
    84 run_installer_stage('load', $lang->get('install_stg_load_title'), 'stg_load_files', $lang->get('install_stg_load_body'), false);
    91 // Now that the config is written, shutdown our primitive API and startup the full Enano API
    91 // Now that the config is written, shutdown our primitive API and startup the full Enano API
    92 $db->close();
    92 $db->close();
    93 
    93 
    94 @define('ENANO_ALLOW_LOAD_NOLANG', 1);
    94 @define('ENANO_ALLOW_LOAD_NOLANG', 1);
    95 require(ENANO_ROOT . '/includes/common.php');
    95 require(ENANO_ROOT . '/includes/common.php');
    96         
    96 				
    97 if ( is_object($db) && is_object($session) )
    97 if ( is_object($db) && is_object($session) )
    98 {
    98 {
    99   run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_sim_good', '...', false);
    99 	run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_sim_good', '...', false);
   100 }
   100 }
   101 else
   101 else
   102 {
   102 {
   103   run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_sim_bad', $lang->get('install_stg_startapi_body'), false);
   103 	run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_sim_bad', $lang->get('install_stg_startapi_body'), false);
   104 }
   104 }
   105 
   105 
   106 // Import languages
   106 // Import languages
   107 error_reporting(E_ALL | E_STRICT);
   107 error_reporting(E_ALL | E_STRICT);
   108 run_installer_stage('importlang', $lang->get('install_stg_importlang_title'), 'stg_language_setup', $lang->get('install_stg_importlang_body'));
   108 run_installer_stage('importlang', $lang->get('install_stg_importlang_title'), 'stg_language_setup', $lang->get('install_stg_importlang_body'));
   115 
   115 
   116 close_install_table();
   116 close_install_table();
   117 
   117 
   118 ?>
   118 ?>
   119 <form action="install.php?stage=finish" method="post" style="margin-top: 12px;">
   119 <form action="install.php?stage=finish" method="post" style="margin-top: 12px;">
   120   <input type="hidden" name="language" value="<?php echo $lang_id; ?>" />
   120 	<input type="hidden" name="language" value="<?php echo $lang_id; ?>" />
   121   <div style="text-align: center;">
   121 	<div style="text-align: center;">
   122     <input type="submit" name="_cont" value="<?php echo $lang->get('meta_btn_continue'); ?>" tabindex="1" />
   122 		<input type="submit" name="_cont" value="<?php echo $lang->get('meta_btn_continue'); ?>" tabindex="1" />
   123   </div>
   123 	</div>
   124 </form>
   124 </form>
   125 <?php
   125 <?php
   126 
   126 
   127 $db->close();
   127 $db->close();
   128 
   128