<?php
/* 
	osCommerce, Open Source E-Commerce Solutions 
	http://www.oscommerce.com 
	
	Copyright (c) 2003 osCommerce 
	
	 
	
	Freeway eCommerce 
	http://www.openfreeway.org
	Copyright (c) 2007 ZacWare
	
	osConcert, Online Seat Booking 
  	http://www.osconcert.com

  	Copyright (c) 2023 osConcert
	

	
	Released under the GNU General Public License 
*/ 

  require('includes/application.php');
  $page_file = 'install.php';
  $page_title = 'Installation';
  $step=(isset($HTTP_GET_VARS["step"])?$HTTP_GET_VARS["step"]:'');
  $upgrade=(isset($HTTP_GET_VARS["upg"])?$HTTP_GET_VARS["upg"]:'');
  if ($step==9){
  	if ($HTTP_GET_VARS["action"]=="complete" || $HTTP_GET_VARS["action"]=="email_update"){
		$page_title=TEXT_COMPLETE;
	} else if ($HTTP_GET_VARS["action"]=="email" && isset($HTTP_POST_VARS["first_install"]) || $HTTP_POST_VARS["first_install"]!='1'){
		$page_title=TEXT_CONFIG." - Email";
	} else {
		$page_title=TEXT_COMPAT;
	}
  	$page_contents="install_9.php";
  } else if($step==10 && $upgrade=='license') {
  		$page_title='osConcert Licensing';
		$page_contents = 'license.php';
  } else if (isset($HTTP_POST_VARS["mode"]) || !isset($HTTP_POST_VARS["compat_test_pass"] ) && !$upgrade){
	  
  	$page_title=TEXT_COMPAT;
	$page_contents="install_compat.php";
  } else {
	  switch ($step) {
		case '2':
		  if (osc_in_array('database', $HTTP_POST_VARS['install'])) {
		  	$page_title=TEXT_DI;
			$page_contents = 'install_2.php';
		  } elseif (osc_in_array('configure', $HTTP_POST_VARS['install'])) {
			  $page_title=TEXT_CONFIG;
			$page_contents = 'install_4.php';
		  } else if($upgrade){
		  	 $page_title=TEXT_DI;	 
			 $page_contents='upgrade_1.php';
		  }else {
			$page_contents = 'install.php';
		  }
		  break;
		case '3':
		  if (osc_in_array('database', $HTTP_POST_VARS['install'])) {
			$page_title=TEXT_DI;
			$page_contents = 'install_3.php';
		  } else if($upgrade){  
		  	$page_title = TEXT_DI;	
			$page_contents = 'upgrade_2.php';
		  }else {
			$page_contents = 'install.php';
		  }
		  break;
		case '4':
		  if (osc_in_array('configure', $HTTP_POST_VARS['install'])) {
			$page_title=TEXT_CONFIG." - Server";
			$page_contents = 'install_4.php';
		  } else {
			$page_contents = 'install.php';
		  }
		  break;
		case '5':
		  if (osc_in_array('configure', $HTTP_POST_VARS['install'])) {
			if (isset($HTTP_POST_VARS['ENABLE_SSL']) && ($HTTP_POST_VARS['ENABLE_SSL'] == 'true')) {
			  $page_title=TEXT_CONFIG." - Server";
			  $page_contents = 'install_5.php';
			} else {
			  $page_title=TEXT_CONFIG." - ".TEXT_DB1;
			  $page_contents = 'install_6.php';
			}
		  } else {
			$page_contents = 'install.php';
		  }
		  break;
		case '6':
		  if (osc_in_array('configure', $HTTP_POST_VARS['install'])) {
		  $page_title=TEXT_CONFIG." - ".TEXT_DB1;
			$page_contents = 'install_6.php';
		  } else {
			$page_contents = 'install.php';
		  }
		  break;
		case '7':
		  if (osc_in_array('configure', $HTTP_POST_VARS['install'])) {
			$page_contents = 'install_7.php';
		  } else {
			$page_contents = 'install.php';
		  }
		  break;
		case '8':
		  if (osc_in_array('database', $HTTP_POST_VARS['install']) || osc_in_array('configure', $HTTP_POST_VARS['install'])) {
		  	$page_title=TEXT_CONFIG." - osConcert";
			$page_contents = 'install_8.php';
		  } else {
			$page_contents = 'install.php';
		  }
		  break;
		default:
		  $page_title=TEXT_NEW;
		  $page_contents = 'install.php';
	  }
  }
  require('templates/main_page.php');
?>
