summaryrefslogtreecommitdiff
path: root/install.php
blob: 95aa388d5da24afee25ef6066f750f12a2160fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
/**
 * @version $Header: /cvsroot/bitweaver/_bit_install/install.php,v 1.6 2005/10/12 15:13:51 spiderr Exp $
 * @package install
 * @subpackage functions
 */

// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.

// hide error ouptut on database connection settings page
if( isset( $_REQUEST['step'] ) && $_REQUEST['step'] == '3' ) {
	ini_set( 'display_errors', '0' );
}
/**
 * required setup
 */
require_once( 'install_inc.php' );

// this variable will be appended to the template file called - useful for displaying messages after data input
$app = '';

// work out where in the installation process we are
if( !isset( $_REQUEST['step'] ) ) {
	$_REQUEST['step'] = 0;
}
$step = $_REQUEST['step'];

// for pages that should only be shown during a first install
if( ( empty( $gBitDbType ) || !$gBitUser->isAdmin() ) || ( $_SESSION['first_install'] ) ) {
	$onlyDuringFirstInstall = TRUE;
} else {
	$onlyDuringFirstInstall = FALSE;
}

// updating $install_file name
$i = 0;
$install_file[$i]['file'] = 'welcome';
$install_file[$i++]['name'] = 'Welcome';
$install_file[$i]['file'] = 'checks';
$install_file[$i++]['name'] = 'bitweaver Settings Check';
// Upgrading of a database can only occur during a first install
if( $onlyDuringFirstInstall ) {
	$install_file[$i]['file'] = 'options';
	$install_file[$i++]['name'] = 'Install Options';

//	$install_file[$i]['file'] = 'upgrade';
//	$install_file[$i++]['name'] = 'Database Upgrade';

//	$install_file[$i]['file'] = 'migrate';
//	$install_file[$i++]['name'] = 'Database Migration';
}
// make it possible to reset the config_inc.php file if it's already filled with data
if( $onlyDuringFirstInstall ) {
	$install_file[$i]['file'] = 'database';
	$install_file[$i++]['name'] = 'Database Connection';
} else {
	$install_file[$i]['file'] = 'database_reset';
	$install_file[$i++]['name'] = 'Database Connection';
}
// if the admin is already set up and we are not installing for the first time, we skip admin creation page
if( $onlyDuringFirstInstall ) {
	$install_file[$i]['file'] = 'admin_inc';
	$install_file[$i++]['name'] = 'Admin Setup';
}
$install_file[$i]['file'] = 'packages';
$install_file[$i++]['name'] = 'Package Installation';
$install_file[$i]['file'] = 'package_conflicts';
$install_file[$i++]['name'] = 'Resolve Conflicts';
// these settings should only be present when we are installing for the first time
if( $onlyDuringFirstInstall ) {
	$install_file[$i]['file'] = 'bit_settings';
	$install_file[$i++]['name'] = 'bitweaver Settings';
	// only show db population page when we haven't just done an upgrade
	if( !isset( $_SESSION['upgrade'] ) ) {
		$install_file[$i]['file'] = 'data';
		$install_file[$i++]['name'] = 'Database Population';
	}
}
$install_file[$i]['file'] = 'final';
$install_file[$i]['name'] = 'Installation Complete';
//don't increment last $i since it's used later on

// if we have to log in, call login template and die
if( !empty( $gBitDbType ) && $gBitInstaller->isPackageActive( 'users' ) && !$gBitUser->isAdmin() && !$_SESSION['first_install'] ) {
	$install_file = 'login';
	$gBitSmarty->assign( 'install_file', INSTALL_PKG_PATH."templates/install_".$install_file.".tpl" );
	$gBitSmarty->display( INSTALL_PKG_PATH.'templates/install.tpl' );
	die;
}

// if the page has been renamed to anything else than 'install.php' we send it to the last installation stage
if( !strpos( $_SERVER['PHP_SELF'],'install/install.php' ) ) {
	$step = $i;
	$gBitSmarty->assign( 'renamed',basename( $_SERVER['PHP_SELF'] ) );
}

// finally we are ready to include the actual php file
include_once( 'install_'.$install_file[$step]['file'].'.php' );

$install_file = set_menu( $install_file, $step );

$gBitSmarty->assign( 'install_file', INSTALL_PKG_PATH."templates/install_".$install_file[$step]['file'].$app.".tpl" );
$gBitInstaller->display( INSTALL_PKG_PATH.'templates/install.tpl', $install_file[$step]['name'] );
?>