install.php
changeset 240 f0149a27df5f
parent 239 0f1b353570a7
child 241 c671f3bb8aed
equal deleted inserted replaced
239:0f1b353570a7 240:f0149a27df5f
    25 define('IN_ENANO_INSTALL', 'true');
    25 define('IN_ENANO_INSTALL', 'true');
    26 
    26 
    27 define('ENANO_VERSION', '1.1.1');
    27 define('ENANO_VERSION', '1.1.1');
    28 // In beta versions, define ENANO_BETA_VERSION here
    28 // In beta versions, define ENANO_BETA_VERSION here
    29 
    29 
       
    30 // This is required to make installation work right
       
    31 define("ENANO_ALLOW_LOAD_NOLANG", 1);
       
    32 
    30 if(!defined('scriptPath')) {
    33 if(!defined('scriptPath')) {
    31   $sp = dirname($_SERVER['REQUEST_URI']);
    34   $sp = dirname($_SERVER['REQUEST_URI']);
    32   if($sp == '/' || $sp == '\\') $sp = '';
    35   if($sp == '/' || $sp == '\\') $sp = '';
    33   define('scriptPath', $sp);
    36   define('scriptPath', $sp);
    34 }
    37 }
   117 }
   120 }
   118 
   121 
   119 function start_install_table()
   122 function start_install_table()
   120 {
   123 {
   121   echo '<table border="0" cellspacing="0" cellpadding="0">' . "\n";
   124   echo '<table border="0" cellspacing="0" cellpadding="0">' . "\n";
       
   125   ob_start();
   122 }
   126 }
   123 
   127 
   124 function close_install_table()
   128 function close_install_table()
   125 {
   129 {
   126   echo '</table>' . "\n\n";
   130   echo '</table>' . "\n\n";
       
   131   ob_end_flush();
   127 }
   132 }
   128 
   133 
   129 function echo_stage_success($stage_id, $stage_name)
   134 function echo_stage_success($stage_id, $stage_name)
   130 {
   135 {
   131   global $neutral_color;
   136   global $neutral_color;
   132   $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A';
   137   $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A';
   133   ob_start();
       
   134   echo '<tr><td style="width: 500px; background-color: #' . "{$neutral_color}{$neutral_color}FF{$neutral_color}{$neutral_color}" . '; padding: 0 5px;">' . htmlspecialchars($stage_name) . '</td><td style="padding: 0 5px;"><img alt="Done" src="images/good.gif" /></td></tr>' . "\n";
   138   echo '<tr><td style="width: 500px; background-color: #' . "{$neutral_color}{$neutral_color}FF{$neutral_color}{$neutral_color}" . '; padding: 0 5px;">' . htmlspecialchars($stage_name) . '</td><td style="padding: 0 5px;"><img alt="Done" src="images/good.gif" /></td></tr>' . "\n";
   135   ob_end_flush();
   139   ob_flush();
       
   140   flush();
   136 }
   141 }
   137 
   142 
   138 function echo_stage_failure($stage_id, $stage_name, $failure_explanation, $resume_stack)
   143 function echo_stage_failure($stage_id, $stage_name, $failure_explanation, $resume_stack)
   139 {
   144 {
   140   global $neutral_color;
   145   global $neutral_color;
   141   
   146   
   142   $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A';
   147   $neutral_color = ( $neutral_color == 'A' ) ? 'C' : 'A';
   143   ob_start();
       
   144   echo '<tr><td style="width: 500px; background-color: #' . "FF{$neutral_color}{$neutral_color}{$neutral_color}{$neutral_color}" . '; padding: 0 5px;">' . htmlspecialchars($stage_name) . '</td><td style="padding: 0 5px;"><img alt="Failed" src="images/bad.gif" /></td></tr>' . "\n";
   148   echo '<tr><td style="width: 500px; background-color: #' . "FF{$neutral_color}{$neutral_color}{$neutral_color}{$neutral_color}" . '; padding: 0 5px;">' . htmlspecialchars($stage_name) . '</td><td style="padding: 0 5px;"><img alt="Failed" src="images/bad.gif" /></td></tr>' . "\n";
   145   ob_end_flush();
   149   ob_flush();
       
   150   flush();
   146   close_install_table();
   151   close_install_table();
   147   $post_data = '';
   152   $post_data = '';
   148   $mysql_error = mysql_error();
   153   $mysql_error = mysql_error();
   149   foreach ( $_POST as $key => $value )
   154   foreach ( $_POST as $key => $value )
   150   {
   155   {
   570 }
   575 }
   571 
   576 
   572 function stg_start_api_failure()
   577 function stg_start_api_failure()
   573 {
   578 {
   574   return false;
   579   return false;
       
   580 }
       
   581 
       
   582 function stg_import_language()
       
   583 {
       
   584   global $db, $session, $paths, $template, $plugins; // Common objects
       
   585   
       
   586   $lang_file = ENANO_ROOT . "/language/english/enano.json";
       
   587   install_language("eng", "English", "English", $lang_file);
       
   588   
       
   589   $lang = new Language('eng');
       
   590   $lang->import($lang_file);
       
   591   
       
   592   return true;
   575 }
   593 }
   576 
   594 
   577 function stg_init_logs()
   595 function stg_init_logs()
   578 {
   596 {
   579   global $db, $session, $paths, $template, $plugins; // Common objects
   597   global $db, $session, $paths, $template, $plugins; // Common objects
  1570       
  1588       
  1571       // Now that login cookies are set, initialize the session manager and ACLs
  1589       // Now that login cookies are set, initialize the session manager and ACLs
  1572       $session->start();
  1590       $session->start();
  1573       $paths->init();
  1591       $paths->init();
  1574       
  1592       
       
  1593       run_installer_stage('importlang', 'Import default language', 'stg_import_language', 'Enano couldn\'t import the English language file.');
       
  1594       
  1575       run_installer_stage('initlogs', 'Initialize logs', 'stg_init_logs', '<b>The session manager denied the request to flush logs for the main page.</b><br />
  1595       run_installer_stage('initlogs', 'Initialize logs', 'stg_init_logs', '<b>The session manager denied the request to flush logs for the main page.</b><br />
  1576                            While under most circumstances you can still <a href="install.php?mode=finish">finish the installation</a>, you should be aware that some servers cannot
  1596                            While under most circumstances you can still <a href="install.php?mode=finish">finish the installation</a>, you should be aware that some servers cannot
  1577                            properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose
  1597                            properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose
  1578                            to finish the installation, please be aware that you may be unable to log into your site.');
  1598                            to finish the installation, please be aware that you may be unable to log into your site.');
  1579       close_install_table();
  1599       close_install_table();