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

Source for file install_inc.php

Documentation is available at install_inc.php

  1. <?php
  2. /**
  3.  * @version $Header: /cvsroot/bitweaver/_bit_install/install_inc.php,v 1.22 2007/02/07 03:26:43 spiderr Exp $
  4.  * @package install
  5.  * @subpackage functions
  6.  */
  7.  
  8. // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  9. // All Rights Reserved. See copyright.txt for details and a complete list of authors.
  10. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
  11.  
  12.  
  13.  
  14. /**
  15.  * set_menu function
  16.  */
  17. function set_menu$pInstallFiles$pStep {
  18.     global $gBitSmarty$gBitUser$gBitDbType$done$failedcommands$app;
  19.  
  20.     // here we set up the menu
  21.     for$done 0$done $pStep$done++ {
  22.         $pInstallFiles[$done]['state''success';
  23.         $pInstallFiles[$done]['icon''dialog-ok';
  24.     }
  25.  
  26.     // if the page is done, we can display the menu item as done and increase the progress bar
  27.     if$failedcommands || !empty$error ) ) {
  28.         $pInstallFiles[$pStep]['state''error';
  29.         $pInstallFiles[$pStep]['icon''dialog-error';
  30.     elseif!empty$warning ) ) {
  31.         $pInstallFiles[$pStep]['state''warning';
  32.         $pInstallFiles[$pStep]['icon''dialog-warning';
  33.     elseif$app == "_done" {
  34.         $pInstallFiles[$pStep]['state''success';
  35.         $pInstallFiles[$pStep]['icon''dialog-ok';
  36.         $done++;
  37.     else {
  38.         $pInstallFiles[$pStep]['state''current';
  39.         $pInstallFiles[$pStep]['icon''media-playback-start';
  40.     }
  41.  
  42.     foreach$pInstallFiles as $key => $menu_step {
  43.         if!isset$menu_step['state') ) {
  44.             if!empty$gBitDbType && $gBitUser->isAdmin(&& !$_SESSION['first_install'{
  45.                 $pInstallFiles[$key]['state''success';
  46.                 $pInstallFiles[$key]['icon''dialog-ok';
  47.             else {
  48.                 $pInstallFiles[$key]['state''uncompleted';
  49.                 $pInstallFiles[$key]['icon''spacer';
  50.             }
  51.         }
  52.     }
  53.  
  54.     // assign all this work to the template
  55.     $gBitSmarty->assign'step'$pStep );
  56.     $gBitSmarty->assign'menu_steps'$pInstallFiles );
  57.     $gBitSmarty->assign'progress'ceil100 count$pInstallFiles ) ) $done ) ) );
  58.  
  59.     return $pInstallFiles;
  60. }
  61.  
  62. /**
  63.  * Global flag to indicate we are installing
  64.  */
  65. define'BIT_INSTALL''TRUE' );
  66. global $gBitSmarty;
  67.  
  68. // use relative path if no CONFIG_INC path specified - we know we are in installer here...
  69. $config_file empty($_SERVER['CONFIG_INC']'../kernel/config_inc.php' $_SERVER['CONFIG_INC'];
  70. // We can't call clean_file_path here even though we would like to.
  71. $config_file (strpos($_SERVER["SERVER_SOFTWARE"],"IIS"str_replace"/""\\"$config_file$config_file);
  72.  
  73. // DO THIS FIRST! Before we include any kernel stuff to avoid duplicate defines
  74. ifisset$_REQUEST['submit_db_info') ) {
  75.     if $_REQUEST['db'== "firebird" && empty$gBitDbName ) ) {
  76.         {
  77.             //    Should only be called when creating the datatabse
  78.             require_once("create_firebird_database.php");
  79.             FirebirdCreateDB($_REQUEST['host']$_REQUEST['user']$_REQUEST['pass']$_REQUEST['name']$_REQUEST['fbpath']);
  80.         }
  81.     }
  82.     if empty$gBitDbType ) ) {
  83.         $tmpHost $_REQUEST['host'];
  84.         if ($_REQUEST['db'== 'mssql' && get_magic_quotes_gpc(== 1// pull doubled up slashes from config
  85.             $tmpHost stripslashes($tmpHost);
  86.         }
  87.         require_once'create_config_inc.php' );
  88.         $createHash array(
  89.             "gBitDbType"            => $_REQUEST['db'],
  90.             "gBitDbHost"            => $tmpHost,
  91.             "gBitDbUser"            => $_REQUEST['user'],
  92.             "gBitDbPassword"        => $_REQUEST['pass'],
  93.             "gBitDbName"            => $_REQUEST['name'],
  94.             "gBitDbCaseSensitivity" => $_REQUEST['dbcase'],
  95.             "bit_db_prefix"         => $_REQUEST['prefix'],
  96.             "bit_root_url"          => $_REQUEST['baseurl'],
  97.             "auto_bug_submit"       => !empty$_REQUEST['auto_bug_submit''TRUE' 'FALSE',
  98.             "is_live"               => !empty$_REQUEST['is_live''TRUE' 'FALSE',
  99.         );
  100.         create_config$createHash );
  101.         include$config_file );
  102.     }
  103. }
  104. require_once("../bit_setup_inc.php");
  105. require_once'BitInstaller.php' );
  106. require_onceUSERS_PKG_PATH.'BitUser.php' );
  107.  
  108. // set some preferences during installation
  109. global $gBitInstaller$gBitSystem;
  110. $gBitInstaller new BitInstaller();
  111. $gBitInstaller->setStyleDEFAULT_THEME );
  112.  
  113. // IF DB has not been created yet, then packages will not have been scanned yet.
  114. // and even if they have been scanned, then they will only include active packages,
  115. // not all packages.
  116. // So we scan again here including all packages
  117.  
  118. // this is important! since bit_setup_inc's are only included_once, and $gBitSystem has already scanned them, we need to make a copy - spiderr
  119. #if( !empty( $gBitSystem->mPackages ) ) {
  120. #    $gBitInstaller->mPackages = $gBitSystem->mPackages;
  121. #    }
  122. //} else {
  123. //    $gBitInstaller->scanPackages();
  124. //}
  125.  
  126. #function scanPackages( $pScanFile = 'bit_setup_inc.php',
  127. #        $pOnce=TRUE, $pSelect='', $autoRegister=TRUE, $fileSystemScan=TRUE ) {
  128. #bad things happen if you do $gBitInstaller->scanPackages...
  129.  
  130. $gBitSystem->scanPackages(    
  131.         'bit_setup_inc.php'TRUE'all'TRUETRUE
  132.         );
  133.  
  134. $gBitInstaller->mPackages $gBitSystem->mPackages;
  135.  
  136. // we need this massive array available during install to work out if bitweaver has already been installed
  137. $gBitInstaller->verifyInstalledPackages('all',TRUE);
  138.  
  139. // set prefs to display help during install
  140. $gBitSystem->setConfig'site_online_help''y' );
  141. $gBitSystem->setConfig'site_form_help''y' );
  142. $gBitSystem->setConfig'site_help_popup''n' );
  143.  
  144. $commands array();
  145. global $failedcommands;
  146. $failedcommands array();
  147. global $gBitLanguage;
  148. $gBitLanguage->mLanguage 'en';
  149.  
  150. // Empty PHP_SELF and incorrect SCRIPT_NAME due to php-cgiwrap - wolff_borg
  151. if (empty($_SERVER['PHP_SELF']))
  152.     $_SERVER['PHP_SELF'$_SERVER['SCRIPT_NAME'$_SERVER['SCRIPT_URL'];
  153.  
  154. ifempty$_REQUEST['baseurl') ) {
  155.     $bit_root_url substr$_SERVER['PHP_SELF']0strpos$_SERVER['PHP_SELF']'install/' ) );
  156. else {
  157.     $bit_root_url BIT_ROOT_URL;
  158. }
  159.  
  160. $errors '';
  161.  
  162. // do some session stuff
  163. // check_session_save_path();
  164.  
  165. if!isset$_SESSION )) {
  166. //     session_start();
  167. //     vd( "session start" );
  168.  
  169. }
  170.  
  171. // if we came from anywhere appart from some installer page, nuke all settings in the _SESSION and set first_install FALSE
  172. if( ( !isset$_SESSION['first_install'|| $_SESSION['first_install'!= TRUE ||
  173.     isset$_SESSION['upgrade'&& $_SESSION['upgrade'!= TRUE ||
  174.     !isset$_SERVER['HTTP_REFERER'||
  175.     isset$_SERVER['HTTP_REFERER'&&
  176.     ( ( !strpos$_SERVER['HTTP_REFERER'],'install/install.php' ) ) && !strpos$_SERVER['HTTP_REFERER'],'install/upgrade.php' ) ) && !strpos$_SERVER['HTTP_REFERER'],'install/migrate.php' ) ) )
  177. {
  178.     if!$gBitUser->isAdmin() ) {
  179.         $_SESSION NULL;
  180.     }
  181.     unset$_SESSION['upgrade');
  182.     $_SESSION['first_install'FALSE;
  183. }
  184.  
  185. // this is needed because some pages display some additional information during a first install
  186. $gBitSmarty->assign'first_install',$_SESSION['first_install');
  187. ?>

Documentation generated on Thu, 15 Feb 2007 20:41:33 +0000 by phpDocumentor 1.3.0