install
[ class tree: install ] [ index: install ] [ all elements ]

Source for file install.php

Documentation is available at install.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. // hide errors when trying to connect to the database. very unsettling when you
  9. // have pages of errors to scroll through
  10. if!empty$_REQUEST['submit_db_info'&& !empty$_REQUEST['step'&& $_REQUEST['step'== {
  11.     ini_set'display_errors''0' );
  12. }
  13.  
  14. // here we force the use of adodb during installation
  15. $gForceAdodb TRUE;
  16.  
  17. // If we are jumping to start over reset the session
  18. if!empty$_REQUEST['step'&& $_REQUEST['step'== {
  19.     unset$_REQUEST['BWSESSION');
  20. }
  21.  
  22. // Early check of memory limit just to be sure we can run.
  23. // Set the number '15' to a lower value if you know that the install process can handle it.
  24. ifget_cfg_var'memory_limit' !== FALSE && preg_replace'/M/i','',get_cfg_var'memory_limit' )) 15 {
  25.     $dir dirname$_SERVER['SCRIPT_NAME');
  26.     // We don't use smarty to avoid using any memory since we already know there is a problem.
  27.     echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
  28. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  29.     <head>
  30.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  31.         <title>Install Bitweaver - Not enough memory!</title>
  32.         <style type="text/css">
  33.             <!-- @import url( '.$dir.'/style/install.css ); -->
  34.         </style>
  35.     </head>
  36.     <body>
  37.         <div id="container">
  38.             <div id="header"></div>
  39.             <div id="wrapper">
  40.                 <div id="content">
  41.                     <div class="bittop"><h1>Bitweaver Installer</h1></div>
  42.                     <h1>Not enough memory!</h1>
  43.                     <form action="'.$dir.'/install.php">
  44.                         <fieldset>
  45.                             <legend>Unable to run installer</legend>
  46.                             <p class="alert alert-danger">The memory limit of <strong>"'.get_cfg_var'memory_limit' ).'"</strong> is not high enough to run the bitweaver installer. Please up the memory limit in you php.ini to at least 16M to install and run bitweaver.</p>
  47.                         </fieldset>
  48.                         <div class="row submit">
  49.                             <input type="submit" value="Reload" size="20"/>
  50.                         </div>
  51.                     </form>
  52.                 </div>
  53.             </div>
  54.         </div>
  55.     </body>
  56. </html>';
  57. die;
  58. }
  59.  
  60. /**
  61.  * required setup
  62.  */
  63. require_once'install_inc.php' );
  64.  
  65. // this variable will be appended to the template file called - useful for displaying messages after data input
  66. $app '';
  67.  
  68. // work out where in the installation process we are
  69. if!isset$_REQUEST['step')) {
  70.     $_REQUEST['step'0;
  71. }
  72. $step $_REQUEST['step'];
  73.  
  74. if!empty$_REQUEST['reload')) {
  75.     header"Location: ".$_SERVER['HTTP_REFERER');
  76. }
  77.  
  78. // for pages that should only be shown during a first install
  79. if( ( empty$gBitDbType || !$gBitUser->isAdmin() ) || $_SESSION['first_install') ) {
  80.     $onlyDuringFirstInstall TRUE;
  81. else {
  82.     $onlyDuringFirstInstall FALSE;
  83. }
  84.  
  85. // For MySql only, and if server supports InnoDB Engine
  86. // we catch here if it was selected as storage type and
  87. // set a session var for use in install_packages.php
  88. ifisset$_REQUEST['use_innodb') ) {
  89.     $_SESSION['use_innodb'TRUE;
  90. }
  91.  
  92. // updating $install_file name
  93. $i 0;
  94. $install_file[$i]['file''welcome';
  95. $install_file[$i++]['name''Welcome';
  96. $install_file[$i]['file''checks';
  97. $install_file[$i++]['name''Server';
  98. // Upgrading of a database can only occur during a first install
  99. if$onlyDuringFirstInstall {
  100.     $install_file[$i]['file''options';
  101.     $install_file[$i++]['name''Options';
  102. }
  103. // make it possible to reset the config/kernel/config_inc.php file if it's already filled with data
  104. if$onlyDuringFirstInstall {
  105.     $install_file[$i]['file''database';
  106.     $install_file[$i++]['name''Database';
  107. else {
  108.     $install_file[$i]['file''database_reset';
  109.     $install_file[$i++]['name''Database';
  110. }
  111. // if the admin is already set up and we are not installing for the first time, we skip admin creation page
  112. if$onlyDuringFirstInstall {
  113.     $install_file[$i]['file''admin_inc';
  114.     $install_file[$i++]['name''Admin';
  115. }
  116. $install_file[$i]['file''packages';
  117. $install_file[$i++]['name''Packages';
  118. if!$onlyDuringFirstInstall {
  119.     $install_file[$i]['file''upgrade';
  120.     $install_file[$i++]['name''Upgrade';
  121. }
  122. $install_file[$i]['file''cleanup';
  123. $install_file[$i++]['name''Cleanup';
  124. // these settings should only be present when we are installing for the first time
  125. if$onlyDuringFirstInstall {
  126.     $install_file[$i]['file''bit_settings';
  127.     $install_file[$i++]['name''Settings';
  128.     // only show db population page when we haven't just done an upgrade
  129.     if!isset$_SESSION['upgrade') ) {
  130.         $install_file[$i]['file''datapump';
  131.         $install_file[$i++]['name''Content';
  132.     }
  133. else {
  134.     $install_file[$i]['file''version';
  135.     $install_file[$i++]['name''Update';
  136. }
  137. $install_file[$i]['file''final';
  138. $install_file[$i]['name''Done';
  139. //don't increment last $i since it's used later on
  140.  
  141. // Needed for version number
  142. $gBitSmarty->assign_by_ref'gBitSystem'$gBitSystem );
  143.  
  144. if!empty$_POST['signin') ) {
  145.     $gBitUser->login$_POST['user']$_POST['pass');
  146.     if!$gBitUser->isRegistered() ) {
  147.         $gBitSmarty->assign'error'current$gBitUser->mErrors ) );
  148.     }
  149. }
  150.  
  151. // if we have to log in, call login template and die
  152. if!empty$gBitDbType && !empty$gBitInstaller->mPackages['users']['installed'&& !$gBitUser->isAdmin(&& !$_SESSION['first_install'{
  153.     $install_file 'login';
  154.     $gBitSmarty->assign'install_file'INSTALL_PKG_PATH."templates/install_".$install_file.".tpl" );
  155.     $gBitSmarty->assign'progress');
  156.     $gBitSmarty->displayINSTALL_PKG_PATH.'templates/install.tpl' );
  157.     die;
  158. }
  159.  
  160. // if the page has been renamed to anything else than 'install.php' we send it to the last installation stage
  161. if!strpos$_SERVER['SCRIPT_NAME'],'install/install.php' ) ) {
  162.     $step $i;
  163.     $gBitSmarty->assign'renamed',basename$_SERVER['SCRIPT_NAME') );
  164. }
  165.  
  166. // finally we are ready to include the actual php file
  167. include_once'install_'.$install_file[$step]['file'].'.php' );
  168.  
  169. $install_file set_menu$install_file$step );
  170.  
  171. $gBitSmarty->assign'install_file'INSTALL_PKG_PATH."templates/install_".$install_file[$step]['file'].$app.".tpl" );
  172. $gBitInstaller->in_display$install_file[$step]['name']INSTALL_PKG_PATH.'templates/install.tpl' );
  173. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:42 +0000 by phpDocumentor 1.5.0-lsces