summaryrefslogtreecommitdiff
path: root/upgrade.php
blob: 5b3ff18d6145c43b261c3cc06cff2037f6eaea91 (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
<?php
/**
 * Page script - run an update process.
 *
 * @package install
 * @subpackage upgrade
 */

/**
 * @copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
 */

/**
 * 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;
} elseif( $_REQUEST['step'] == '0' ) {
	$_SESSION['upgrade_r1'] = NULL;
}
$step = $_REQUEST['step'];

// updating $install_file name
$i = 0;
$install_file[$i]['file'] = 'welcome';
$install_file[$i]['name'] = 'Welcome';
$i++;
$install_file[$i]['file'] = 'database';
$install_file[$i]['name'] = 'Database Connection';
$i++;
$install_file[$i]['file'] = 'packages';
$install_file[$i]['name'] = 'Upgrade Selection';
$i++;
$install_file[$i]['file'] = 'final';
$install_file[$i]['name'] = 'Upgrade Complete';

// currently i can't think of a better way to secure the upgrade pages
// redirect to the installer if we aren't sent here by the installer and the upgrade session variable hasn't been set
if( !isset( $_SESSION['upgrade'] ) || $_SESSION['upgrade'] != TRUE ||
	!isset( $_SERVER['HTTP_REFERER'] ) ||
	isset( $_SERVER['HTTP_REFERER'] ) &&
	( ( !strpos( $_SERVER['HTTP_REFERER'],'install/install.php' ) ) && ( !strpos( $_SERVER['HTTP_REFERER'],'install/upgrade.php' ) ) && ( !strpos( $_SERVER['HTTP_REFERER'],'install/migrate.php' ) ) )
) {
	header( 'Location: '.INSTALL_PKG_URL.'install.php' );
	die;
}
// For MySql only, if server supports InnoDB Engine and
// if it was selected as storage type, we set a session var
// for use in update_packages.php
if( isset( $_REQUEST['use_innodb'] ) ) {
	$_SESSION['use_innodb'] = TRUE;
}

/**
 * process upgrade step
 */
include_once( 'upgrade_'.$install_file[$step]['file'].'.php' );

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

$gBitSmarty->assign( 'menu_file', 'upgrade.php' );
$gBitSmarty->assign( 'section', 'Upgrade' );

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

?>