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$
  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 below for details and a complete list of authors.
  10. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  11.  
  12. /**
  13.  * set_menu function
  14.  */
  15. function set_menu$pInstallFiles$pStep {
  16.     global $gBitSmarty$gBitUser$gBitDbType$done$failedcommands$app;
  17.  
  18.     // here we set up the menu
  19.     for$done 0$done $pStep$done++ {
  20.         $pInstallFiles[$done]['state''complete';
  21.         $pInstallFiles[$done]['icon''icon-ok';
  22.     }
  23.  
  24.     // if the page is done, we can display the menu item as done and increase the progress bar
  25.     if$failedcommands || !empty$error ) ) {
  26.         $pInstallFiles[$pStep]['state''error';
  27.         $pInstallFiles[$pStep]['icon''dialog-error';
  28.     elseif!empty$warning ) ) {
  29.         $pInstallFiles[$pStep]['state''warning';
  30.         $pInstallFiles[$pStep]['icon''dialog-warning';
  31.     elseif$app == "_done" {
  32.         $pInstallFiles[$pStep]['state''complete';
  33.         $pInstallFiles[$pStep]['icon''icon-ok';
  34.         $done++;
  35.     else {
  36.         $pInstallFiles[$pStep]['state''current';
  37.         $pInstallFiles[$pStep]['icon''media-playback-start';
  38.     }
  39.  
  40.     foreach$pInstallFiles as $key => $menu_step {
  41.         if!isset$menu_step['state') ) {
  42.             if!empty$gBitDbType && $gBitUser->isAdmin(&& !$_SESSION['first_install'{
  43.                 $pInstallFiles[$key]['state''complete';
  44.                 $pInstallFiles[$key]['icon''icon-ok';
  45.             else {
  46.                 $pInstallFiles[$key]['state''uncompleted';
  47.                 $pInstallFiles[$key]['icon''spacer';
  48.             }
  49.         }
  50.     }
  51.  
  52.     // assign all this work to the template
  53.     $gBitSmarty->assign'step'$pStep );
  54.     $gBitSmarty->assign'menu_steps'$pInstallFiles );
  55.     $gBitSmarty->assign'progress'ceil100 count$pInstallFiles ) ) $done ) ) );
  56.  
  57.     return $pInstallFiles;
  58. }
  59.  
  60. /**
  61.  * Global flag to indicate we are installing
  62.  */
  63. define'BIT_INSTALL''TRUE' );
  64. // Uncomment to switch to role team model ...
  65. //define( 'ROLE_MODEL', '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']'../config/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("../kernel/setup_inc.php");
  105. require_once'BitInstaller.php' );
  106. if defined'ROLE_MODEL' ) ) {
  107.     require_onceUSERS_PKG_PATH.'RoleUser.php' );
  108. else {
  109.     require_onceUSERS_PKG_PATH.'BitUser.php' );
  110. }
  111.  
  112. // set some preferences during installation
  113. global $gBitInstaller$gBitSystem$gBitThemes;
  114. $gBitInstaller new BitInstaller();
  115.  
  116. // IF DB has not been created yet, then packages will not have been scanned yet.
  117. // and even if they have been scanned, then they will only include active packages,
  118. // not all packages. So we scan again here including all packages.
  119. $gBitSystem->scanPackages'bit_setup_inc.php'TRUE'all'TRUETRUE );
  120.  
  121. $gBitInstaller->mPackages $gBitSystem->mPackages;
  122.  
  123. // we need this massive array available during install to work out if bitweaver has already been installed
  124. // this array is so massive that it will kill system with too little memory allocated to php
  125. $dbTables $gBitInstaller->verifyInstalledPackages'all' );
  126.  
  127. // set prefs to display help during install
  128. $gBitSystem->setConfig'site_online_help''y' );
  129. $gBitSystem->setConfig'site_form_help''y' );
  130. $gBitSystem->setConfig'site_help_popup''n' );
  131.  
  132. $commands array();
  133. global $failedcommands;
  134. $failedcommands array();
  135. global $gBitLanguage;
  136. $gBitLanguage->mLanguage 'en';
  137.  
  138. // Empty SCRIPT_NAME and incorrect SCRIPT_NAME due to php-cgiwrap - wolff_borg
  139. ifempty$_SERVER['SCRIPT_NAME')) {
  140.     $_SERVER['SCRIPT_NAME'$_SERVER['SCRIPT_URL'];
  141. }
  142.  
  143. ifempty$_REQUEST['baseurl')) {
  144.     $bit_root_url substr$_SERVER['SCRIPT_NAME']0strpos$_SERVER['SCRIPT_NAME']'install/' ));
  145. else {
  146.     $bit_root_url BIT_ROOT_URL;
  147. }
  148.  
  149. global $gBitUser;
  150.  
  151. if!empty$_POST['signin') ) {
  152.     $gBitInstaller->login$_REQUEST['user']$_REQUEST['pass');    
  153. elseif!empty$_COOKIE[$gBitUser->getSiteCookieName()&& $gBitUser->mUserId $gBitUser->getUserIdFromCookieHash$_COOKIE[$gBitUser->getSiteCookieName()))) {
  154.     $userInfo $gBitUser->getUserInfoarray'user_id' => $gBitUser->mUserId ) );
  155.  
  156.     if$userInfo['user_id'!= ANONYMOUS_USER_ID {
  157.         // User is valid and not due to change pass..
  158.         $gBitUser->mInfo $userInfo;
  159.         $gBitUser->loadPermissionsTRUE );
  160.     }
  161. }
  162.  
  163. // if we came from anywhere appart from some installer page, nuke all settings in the _SESSION and set first_install FALSE
  164. if(
  165.     !isset$_SESSION['first_install')
  166.     || $_SESSION['first_install'!= TRUE )
  167.     || isset$_SESSION['upgrade'&& $_SESSION['upgrade'!= TRUE )
  168.     || !isset$_SERVER['HTTP_REFERER')
  169.     || isset$_SERVER['HTTP_REFERER'&& (
  170.         !strpos$_SERVER['HTTP_REFERER'],'install/install.php' ))
  171.         && !strpos$_SERVER['HTTP_REFERER'],'install/upgrade.php' ))
  172.         && !strpos$_SERVER['HTTP_REFERER'],'install/migrate.php' ))
  173.     )
  174. {
  175.     if!$gBitUser->isAdmin() ) {
  176.         $_SESSION NULL;
  177.     }
  178.     unset$_SESSION['upgrade');
  179.     $_SESSION['first_install'FALSE;
  180. }
  181.  
  182. // this is needed because some pages display some additional information during a first install
  183. $gBitSmarty->assign'first_install'$_SESSION['first_install');
  184. ?>

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