8722 sujets

Développement web côté serveur, CMS

Bonjour ; je recherche une personne avec grande connaisance en php5.4 pour petit coup de pouces svp Smiley smile

j'ai fait la migration de 5.2 a 5.3 tous fonctionne bien mais pour 5.4 il reste un petit bugs avec le $_post de variable ! si j entre les variables directement dans le code sa fonctionne mais si je passe par le formulaire sa fonctionne pas Smiley decu

un petit coup de mais serais bien apprecié, merci

Marc
Modifié par flirtetcompagnie (19 Nov 2013 - 03:52)
Lothindil a écrit :
Donne le code, je veux bien voir ça ^^ Smiley lol

merci a toi , désolé c est assé long comme code Smiley decu

voici le formulaire :
<form name="inst01" action="install.php?step=4" method="post" >
		<input name="config_opt" type=hidden value="N" />
		<input name="dbtype" type=hidden value="mysql" />
		<input name="dbversion" type=hidden value="" />
		<input name="dispstep" type=hidden value="1" />

	<table width="100%" bgcolor="#EEEEEE" class=normal style="border:1px solid #000000">
		<tr><td width="35%">Database Host: <font color=red>*</font></td>
			<td width="65%"><input type=text class="textinput" name=dbhost value="localhost"  /> (Usually "localhost")			</td>
		</tr>
		<tr><td width="35%">Database Type: <font color=red>*</font></td>
			<td width="65%"><select name=dbtype><option label="MySQL" value="mysql" selected="selected">MySQL</option>
<option label="PostgreSQL" value="pgsql">PostgreSQL</option>
<option label="InterBase" value="ibase">InterBase</option>
<option label="Mini SQL" value="msql">Mini SQL</option>
<option label="Microsoft SQL Server" value="mssql">Microsoft SQL Server</option>
<option label="Oracle 7/8/8i" value="oci8">Oracle 7/8/8i</option>
<option label="ODBC (Open Database Connectivity)" value="odbc">ODBC (Open Database Connectivity)</option>
<option label="SyBase" value="sybase">SyBase</option>
<option label="Informix" value="ifx">Informix</option>
<option label="FrontBase" value="fbsql">FrontBase</option>
</select>
						</td>
		</tr>
		<tr><td>Database Name: <font color=red>*</font></td>
			<td><input type=text class="textinput" name=dbname value=""  />
			</td>
		</tr>
		<tr><td>Database User: <font color=red>*</font></td>
			<td><input type=text class="textinput" name=dbuser value=""   />
			</td>
		</tr>
		<tr><td>Database Password: <font color=red>*</font></td>
			<td><input type=password class="textinput" name="dbpasswd" value=""  />
			</td>
		</tr>
		<tr><td>Table Prefix: <font color=red>*</font></td>
			<td ><input type=text class="textinput" name=prefix value="osdate"   />
			</td>
		</tr>
			</table>
	<table width=100%>
		<tr>
						<td align=right>
			<input type=submit value=" Continue>>" onclick="return checkme();"/>
		</td>
				</tr>
	</table>
	</form>

install :
session_start();
include 'install_files/consts.php'; 	// Constants
include 'install_files/funcs.php';		// Needed functions
include 'install_files/header.tpl';		// HTML Header
@set_time_limit(1200);



if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
error_reporting(error_reporting() & ~(E_DEPRECATED | E_STRICT));
}else{
error_reporting( E_ALL - E_NOTICE );
}

if ( (!isset( $_GET['step'])) || ($_GET['step'] < 1 || $_GET['step'] > 7) )
	$step = 1;
else
	$step = $_GET['step'];

if ($step > 1)
{


	$typeValues = array( 'mysql', 'pgsql', 'ibase', 'msql', 'mssql', 'oci8', 'odbc', 'sybase', 'ifx', 'fbsql');

	$typeNames  = array(
		'MySQL',
		'PostgreSQL',
		'InterBase',
		'Mini SQL',
		'Microsoft SQL Server',
		'Oracle 7/8/8i',
		'ODBC (Open Database Connectivity)',
		'SyBase',
		'Informix',
		'FrontBase'
		);
	// Can use templates
	$full_path = dirname(__FILE__) . '/';
	$dbtype='mysql'; //default db type
	//import_request_variables( 'pgs' );
	
    extract($_REQUEST, EXTR_PREFIX_ALL|EXTR_REFS, 'pgs');
	define ( 'SMARTY_DIR', $full_path . 'libs/Smarty/' );
	define ( 'TEMPLATES_DIR', $full_path . 'templates/' );
	define ( 'TEMPLATE_DIR', $full_path . 'templates/' );
	define ( 'TEMPLATE_C_DIR', $full_path . 'temp/templates_c/' );
	define ( 'PEAR_DIR', $full_path . 'libs/Pear/' );
	define ( 'CACHE_DIR', $full_path . 'temp/cache/' );
	define ( 'INCLUDE_DIR', $full_path . 'includes/' );
	define ( 'DOC_ROOT', $full_path );
//	define ( 'LANG_DIR', $full_path . 'language/' );

	require_once SMARTY_DIR . 'Config_File.class.php';
	require_once SMARTY_DIR . 'Smarty.class.php';
	require_once INCLUDE_DIR . 'internal/Functions.php';

	//ini_set( 'include_path', PEAR_DIR );

	require_once( PEAR_DIR . 'DB.php' );

	//	PEAR::setErrorHandling( PEAR_ERROR_CALLBACK, 'errhndl' );

	$t = new Smarty;
	$t->template_dir = TEMPLATE_DIR;
	$t->compile_dir = TEMPLATE_C_DIR;
	$t->cache_dir = CACHE_DIR;

	$t->assign('typeValues',$typeValues);
	$t->assign('typeNames',$typeNames);

	$t->assign('dbtype', $dbtype);

	if (!isset($_SESSION['configAvailable'])) $_SESSION['configAvailable'] = 'N';

	if ( !isset($_SESSION['replacearray']) || $dbuser != '') {


		if (file_exists('temp/myconfigs/config.php') ) {

			include_once('temp/myconfigs/config.php');
			$configdata = file('temp/myconfigs/config.php');

		} elseif (file_exists('myconfigs/config.php') ) {

			include_once('myconfigs/config.php');
			$configdata = file('myconfigs/config.php');

		} elseif (file_exists('config.php')) {

			$configdata = file('config.php');
			include_once('config.php');

		}
		if (count($configdata) > 2) {
			$_SESSION['configAvailable'] = 'Y';
			$_SESSION['osDate_current_version'] = C_VERSION;
			foreach ($configdata as $line) {
				if (substr_count($line,'define') > 0) {
					eval($line);
				}
			}
		}

		define ('DB_USER', $dbuser);
		define('DB_PASS', $dbpasswd);
		define('DB_HOST', $dbhost);
		define('DB_NAME', $dbname);
		define('DB_PREFIX', $prefix);
		define('DB_TYPE', $dbtype);
		$_SESSION['replacearray'] = array(
		'MAIL_FORMAT'	=> MAIL_FORMAT,
		'MAIL_TYPE'		=> MAIL_TYPE,
		'SMTP_HOST'		=> SMTP_HOST,
		'SMTP_PORT'		=> SMTP_PORT,
		'SMTP_AUTH'		=> SMTP_AUTH,
		'SMTP_USER'		=> SMTP_USER,
		'SMTP_PASS'		=> SMTP_PASS,
		'SM_PATH'		=> SM_PATH,
		'DB_USER'		=> DB_USER,
		'DB_NAME'		=> DB_NAME,
		'DB_HOST'		=> DB_HOST,
		'DB_PASS'		=> DB_PASS,
		'DB_TYPE'		=> DB_TYPE,
		'DB_PREFIX' 	=> DB_PREFIX
		);

	} elseif (isset($_SESSION['replacearray'])){

		define ('MAIL_FORMAT', $_SESSION['replacearray']['MAIL_FORMAT']);
		define ('MAIL_TYPE', $_SESSION['replacearray']['MAIL_TYPE']);
		define ('SMTP_HOST', $_SESSION['replacearray']['SMTP_HOST']);
		define ('SMTP_PORT', $_SESSION['replacearray']['SMTP_PORT']);
		define ('SMTP_AUTH', $_SESSION['replacearray']['SMTP_AUTH']);
		define ('SMTP_USER', $_SESSION['replacearray']['SMTP_USER']);
		define ('SMTP_PASS', $_SESSION['replacearray']['SMTP_PASS']);
		define ('SM_PATH', $_SESSION['replacearray']['SM_PATH']);
		define ('DB_USER', $_SESSION['replacearray']['DB_USER']);
		define ('DB_NAME', $_SESSION['replacearray']['DB_NAME']);
		define ('DB_HOST', $_SESSION['replacearray']['DB_HOST']);
		define ('DB_PASS', $_SESSION['replacearray']['DB_PASS']);
		define ('DB_TYPE', $_SESSION['replacearray']['DB_TYPE']);
		define ('DB_PREFIX', $_SESSION['replacearray']['DB_PREFIX']);
		define ('DOC_ROOT', $_SESSION['replacearray']['DOC_ROOT']);
	}

	define('VERSION',$_SESSION['osDate_current_version']);
}

// First step - general check

if ($step == 1) {
	

	unset($_SESSION['replacearray']);
	unset($_SESSION['configAvailable']);
	$canContinue = 1;

	include 'install_files/step_1.tpl';
	
	//check GD librarry
	$good = function_exists( 'gd_info' ) ? 1 : 0;
	$canContinue = $canContinue && $good;
	Message ( 'GD library exists: ', $good );

	//JPEG support
	$good = function_exists( 'imagecreatefromjpeg' ) && function_exists( 'imagejpeg' ) ? 1 : 0;
	$canContinue = $canContinue && $good;
	Message ( 'JPEG support exists for GD: ', $good );
	//---
	$canContinue = isWriteable ( $canContinue, 'temp/', 0777, 'temp folder' );
	$canContinue = isWriteable ( $canContinue, 'plugins/', 0777, 'plugins folder' );
	if (file_exists('temp/banners')) {
		$canContinue = isWriteable ( $canContinue, 'temp/banners/', 0777, 'temp/banners folder' );
	}
	if (file_exists('temp/cache')) {
		$canContinue = isWriteable ( $canContinue, 'temp/cache/', 0777, 'temp/cache folder' );
	}
	if (file_exists('temp/emailimages')) {
		$canContinue = isWriteable ( $canContinue, 'temp/emailimages/', 0777, 'temp/emailimages folder' );
	}
	if (file_exists('temp/myconfigs')) {
		$canContinue = isWriteable ( $canContinue, 'temp/myconfigs/', 0777, 'temp/myconfigs folder');
		if (file_exists('temp/myconfigs/config.php') ) {
			$canContinue = isWriteable ( $canContinue, 'temp/myconfigs/config.php', 0777, 'temp/myconfigs/config.php file');
		}
	}
	if (file_exists('temp/imageedits')) {
		$canContinue = isWriteable ( $canContinue, 'temp/imageedits/', 0777, 'temp/imageedits  folder' );
		if (file_exists('temp/imageedits/original')) {
			$canContinue = isWriteable ( $canContinue, 'temp/imageedits/original/', 0777, 'temp/imageedits/original folder' );
		}
	}
	if (file_exists('temp/templates_c')) {
		$canContinue = isWriteable ( $canContinue, 'temp/templates_c/', 0777, 'temp/templates_c folder' );
	}
	if (file_exists('temp/userimages')) {
		$canContinue = isWriteable ( $canContinue, 'temp/userimages/', 0777, 'temp/userimages folder' );
	}
	if (file_exists('temp/tempimages')) {
		$canContinue = isWriteable ( $canContinue, 'temp/tempimages/', 0777, 'temp/tempimages  folder' );
	}
	if (file_exists('temp/uservideos')) {
		$canContinue = isWriteable ( $canContinue, 'temp/uservideos/', 0777, 'temp/uservideos folder' );
	}
	$ftpCan = $canContinue;

	$good = function_exists( 'mysql_connect' ) ? 1 : 0;
	$canContinue = $canContinue && $good;

	Message ( 'MySQL support exists: ', $good );

	$good = phpversion() >= '5.4' ? 1 : 0;
	$canContinue = $canContinue && $good;

	Message ( 'PHP version >= 5.4: ', $good );

	echo '</table>';

	if ( $canContinue) {
		echo  '<tr><td colspan="2" align="center"><b><font style="font-size:12pt">Congratulations!</font></b><br />You may continue the installation.</td></tr><tr><td colspan=2 align="right"><input type="button" name="continue" value="Continue >>" onclick="javascript:document.location.href=\'?step=2&amp;dispstep=1\'" /></td></tr>';
	} else {
		echo  '<tr><td colspan="2" ><br />The installer has detected some problems with your server environment, which will not allow osDate to operate correctly.<br /><br />Please correct these issues and then refresh the page to re-check your environment.<br /><br />';

		echo '<br /><input type="button" name="continue" value="Continue >>" onclick="javascript:alert(\'Please correct the above problems before continuing.\')" /></td></tr>';
	}
}

// Second step - database login information

if ( $step == 2 )
{
	if (!file_exists('temp/templates_c')) {
		mkdir("temp/templates_c", 0755 );
		copy('install/index.html','temp/templates_c/index.html');
	}
	if (!file_exists('temp/banners')) {
		mkdir("temp/banners",0755);
		copy('install/index.html','temp/banners/index.html');
		copy('images/1.gif','temp/banners/1.gif');
	}

	if (!file_exists('temp/cache')) {
		mkdir("temp/cache", 0777 );
		copy('install/index.html','temp/cache/index.html');
	}

	if (!file_exists('temp/emailimages')) {
		mkdir("temp/emailimages", 0777 );
		copy('install/index.html','temp/emailimages/index.html');
	}
	if (!file_exists('temp/myconfigs')) {
		mkdir("temp/myconfigs",0777);
		copy('install/index.html','temp/myconfigs/index.html');
	}
	if (!file_exists('temp/imageedits')) {
		mkdir("temp/imageedits",0777 );
		copy('install/index.html','temp/imageedits/index.html');
	}
	
	if (!file_exists('temp/imageedits/original')) {
		mkdir("temp/imageedits/original",0777);
		copy('install/index.html','temp/imageedits/original/index.html');
	}
	if (!file_exists('temp/userimages')) {
		mkdir("temp/userimages",0777);
		copy('install/index.html','temp/userimages/index.html');
	}
	if (!file_exists('temp/tempimages')) {
		mkdir("temp/tempimages",0777);
		copy('install/index.html','temp/tempimages/index.html');
	}
	if (!file_exists('temp/uservideos')) {
		mkdir("temp/uservideos",0777);
		copy('install/index.html','temp/uservideos/index.html');
	}

	$t->assign( 'errorConnection', 0 );
	include 'install_files/step_2.php';
}

// Next step - test connection

if ( $step == 3 )
{
	include 'install_files/step_3.php';
}

if ($step == 4) {

	include 'install_files/step_4.php';
}
if ($step == 5) {

	include 'install_files/step_5.php';
}
if ($step == 6)
{
	/* Accept mail settings */

	$sendMailPath = @ini_get( sendmail_path );

	// if sendmail is found, then parse it to remove sendmail options

	if ( $sendMailPath ) {
		$sendMailPathParts = explode( ' ', $sendMailPath );
		$sendMailPath = $sendMailPathParts[0];
	}

	$t->assign( 'dispstep', $dispstep+1);
	$t->assign( 'config_opt', $config_opt);

	$t->assign( 'sendMailPath', $sendMailPath );

    $t->assign( 'formatValues', array( 'text', 'html') );
    $t->assign( 'formatNames', array(  'Text', 'HTML' ) );
    $t->assign( 'typeValues', array( 'sendmail', 'smtp', 'mail' ) );
    $t->assign( 'typeNames', array(  'Sendmail', 'SMTP', 'Standard Mail' ) );

    $t->display( 'install/install_step6.tpl' );
}

// Next step - writing mail settings
if ($step == 7)
{
	// clear the cache & template_c before starting osDate

	$t->clear_all_cache();
	$t->clear_compiled_tpl();

	// remove all files from image cache
	include_once( 'includes/internal/class.cacher.php' );
	$c = new Cacher();
	$c->clear();
	/* Now rename adodb directory based on php version */

	define ('CONFIG_FILE', 'temp/myconfigs/config.php');

	if ($_POST['mail_set']!= '' ) {

	    extract ($_POST);

	    if (!isset($smtpAuth))
			$smtpAuth = 0;

		// Replacing config variables

		$replace = array(
			'DB_USER' => $_SESSION['replacearray']['DB_USER'],
			'DB_NAME' => $_SESSION['replacearray']['DB_NAME'],
			'DB_HOST' => $_SESSION['replacearray']['DB_HOST'],
			'DB_PASS' => $_SESSION['replacearray']['DB_PASS'],
			'DB_TYPE' => $_SESSION['replacearray']['DB_TYPE'],
			'DB_PREFIX' => $_SESSION['replacearray']['DB_PREFIX'],
			'DOC_ROOT' => $_SESSION['replacearray']['DOC_ROOT'],
			'C_VERSION'	=> OSDATE_VERSION,
			'MAIL_FORMAT'	=> $mailFormat,
			'MAIL_TYPE'		=> $mailType,
			'SMTP_HOST'		=> $smtpHost,
			'SMTP_PORT'		=> $smtpPort,
			'SMTP_AUTH'		=> $smtpAuth,
			'SMTP_USER'		=> $smtpUser,
			'SMTP_PASS'		=> $smtpPassword,
			'SM_PATH'		=> $smPath );
		$dsn = $_SESSION['replacearray']['DB_TYPE'] . '://' . $_SESSION['replacearray']['DB_USER'] . ':' . $_SESSION['replacearray']['DB_PASS'] . '@' . $_SESSION['replacearray']['DB_HOST'] . '/' .$_SESSION['replacearray']['DB_NAME'];
		$db = @DB::connect( $dsn );
		$db->setFetchMode( DB_FETCHMODE_ASSOC );
		$sql = 'update '.$_SESSION['replacearray']['DB_PREFIX']."_glblsettings" ." set config_value='".$mailFormat."' where config_variable='MAIL_FORMAT'";
		$r = $db->query($sql) ;
		$db->query('update '.$_SESSION['replacearray']['DB_PREFIX']."_glblsettings" ." set config_value='".$mailType."' where config_variable='MAIL_TYPE'") ;
		$db->query('update '.$_SESSION['replacearray']['DB_PREFIX']."_glblsettings" ." set config_value='".$smtpHost."' where config_variable='SMTP_HOST'") ;
		$db->query('update '.$_SESSION['replacearray']['DB_PREFIX']."_glblsettings" ." set config_value='".$smtpPort."' where config_variable='SMTP_PORT'") ;
		$db->query('update '.$_SESSION['replacearray']['DB_PREFIX']."_glblsettings" ." set config_value='".$smtpAuth."' where config_variable='SMTP_AUTH'") ;
		$db->query('update '.$_SESSION['replacearray']['DB_PREFIX']."_glblsettings" ." set config_value='".$smtpUser."' where config_variable='SMTP_USER'") ;
		$db->query('update '.$_SESSION['replacearray']['DB_PREFIX']."_glblsettings" ." set config_value='".$smtpPassword."' where config_variable='SMTP_PASS'") ;
		$db->query('update '.$_SESSION['replacearray']['DB_PREFIX']."_glblsettings" ." set config_value='".$smPath."' where config_variable='SM_PATH'") ;
		$t->assign( 'configCreated', true );

	}
	$t->assign('mail_set', $_POST['mail_set']);
	$t->assign('config_opt', $config_opt);
	$t->assign('dispstep', $dispstep + 1);
	$t->display('install/install_step7.tpl');

}

unset( $db );

include './install_files/footer.tpl'; //HTML Footer.
?>


step4.php:
$dbhost = DB_HOST;
$dbtype = DB_TYPE;
$dbpasswd = DB_PASS;
$dbuser = DB_USER;
$prefix = DB_PREFIX;
$dbname = DB_NAME;


$dsn = $dbtype . '://' . $dbuser . ':' . $dbpasswd . '@' . $dbhost . '/' .$dbname;
$db = @DB::connect( $dsn );
$db_valid = '1';
$errorLogin == '0';
if ( DB::isError($db) ) {
	$db_valid='0';
	if ( $db->code == -24 ) {
		$t->assign( 'errorLogin', 1 );
	} else if ( $db->code == -9 ) {
		$t->assign( 'errorLogin', 1 );
	}

} else {

	if ($dbtype == 'mysql') {

		$result = $db->getAll( "show tables" );
		$tablesexist=0;
		foreach (array_values($result) as $table_exist) {
			foreach ($table_exist as $k => $tablename) {
				if (($prefix != '' && strpos($tablename,$prefix) !== false && strpos($tablename,$prefix.'_fc_') === false) || $prefix == '') {
					$tablesexist++;
					break;
				}
			}
		}

		// check if we have rights

		if ( !DB::isError( $result ) ) {

			foreach ( $result as $index => $dbarray ) {

				$name = $dbarray[0];

				if ( $name == $dbname ) {
					$db_valid = '1';
					break;
				}
			}

		}

	} else {
		// if no rights - assume user entered valid db name
		// if not - this will be found in the next lines
		$db_valid = '1';
	}

	$db->disconnect();

}

if ($docroot == '' or !isset($docroot)) {

	$callscript=$_SERVER['SCRIPT_NAME'];

	$calldir=str_replace('admin/','',substr($callscript,0,strrpos($callscript,'/')+1));

	$calldir = str_replace('chat/','',$calldir);

	/* Add last '/' for DOC_ROOT and replace // with single / */

	$calldir = $calldir.'/';

	$calldir = str_replace('//','/',$calldir);

	$docroot = $calldir;
}
$t->assign('docroot', $docroot);
$_SESSION['replacearray']['DOC_ROOT'] = $docroot;
$t->assign('dbversion',$dbversion);
$t->assign('dbname', $dbname);
$t->assign('dbuser', $dbuser);
$t->assign('dbpasswd', $dbpasswd);
$t->assign('dbhost', $dbhost);
$t->assign('prefix', $prefix);
$t->assign('db_valid', $db_valid);
$t->assign('dbtype', $dbtype);
$t->assign('config_opt',$config_opt);
$t->assign( 'errorLogin', $errorLogin );

$_SESSION['replacearray']['DB_NAME'] = $dbname;
$_SESSION['replacearray']['DB_HOST'] = $dbhost;
$_SESSION['replacearray']['DB_USER'] = $dbuser;
$_SESSION['replacearray']['DB_PASS'] = $dbpasswd;
$_SESSION['replacearray']['DB_PREFIX'] = $prefix;
$_SESSION['replacearray']['DB_TYPE'] = $dbtype;
define ('DB_TYPE',$dbtype);
define ('DB_PREFIX',$prefix);
define ('DB_NAME',$dbname);
define ('DB_HOST',$dbhost);
define ('DB_USER',$dbuser);
define ('DB_PASS',$dbpasswd);

if ($errorLogin == '1' || $db_valid != '1' || ( $config_opt=='N' && $tablesexist > 0) || ( $config_opt=='U' && $tablesexist == 0) ) {

	$t->assign('tablesexist', $tablesexist);

	$t->assign('dispstep', $dispstep);

	$t->display('install/install_step3.tpl');

	include('footer.tpl');

	exit;
}


/* OK. Now the database is accessible.
   In case of upgrade, let us proceed.
   Otherwise, let us accept other parameters.
*/

if ($config_opt != 'U') {

	/* Insert and forced installation */
	include( 'countries.php' );
	if ($admin_name == '' or !isset($admin_name)) $admin_name='admin';
	$t->assign('admin_name', $admin_name);

	$t->assign('dispstep', $dispstep+1);
	$t->assign( 'countrytypeValues', $countrytypeValues );
	$t->assign( 'countrytypeNames', $countrytypeNames );
	$t->assign( 'countryType', $countryType );
	$t->assign( 'langType', $langType );
	$t->assign( 'defaultLangValues', $defaultLangValues );
	$t->assign( 'defaultLangNames', $defaultLangNames );

	$t->display('install/install_step4.tpl');

	include('footer.tpl');

	exit;
}

if ($config_opt == 'U') {

	/* Upgrade from earlier version */
	define ('DB_PREFIX', $prefix);

	$dsn = $dbtype . '://' . $dbuser . ':' . $dbpasswd . '@' . $dbhost . '/' .$dbname;
	$db = @DB::connect( $dsn );
	$db->setFetchMode( DB_FETCHMODE_ASSOC );

	/* Upgrade option */
	$_SESSION['upgrade']='1';
	$replace = array(
		'DB_USER'	=> $dbuser,
		'DB_NAME'	=> $dbname,
		'DB_HOST'	=> $dbhost,
		'DB_PASS'	=> $dbpasswd,
		'DB_TYPE'	=> $dbtype,
		'DB_PREFIX' => $prefix,
		'DOC_ROOT' 	=> $docroot,
		'OSDATE_INSTALLED' => 1,
		'DEFAULT_LANG' => "'".str_replace('lang_','',$_REQUEST['langType'])."'",
		'DEFAULT_COUNTRY' => $countryType,
		'VERSION'	=> OSDATE_VERSION
	);

	// do upgrade here
	$t->assign( 'upgrade', 1 );

	$t->display('install/install_step5.tpl');
	if (substr(phpversion(),0,1) == '4') {
		/* php 4 */
		$replace['ADODB_DIR'] = 'libs/adodb4/';
	} else {
		$replace['ADODB_DIR'] = 'libs/adodb/';
	}

	echo("<tr><td>Writing installation parameters to config.php file... ");flush();
	ob_start();

	$configData = getConfigData( $replace );

	$configCreated = writeConfig( $configData );

	ob_start();

	if ($configCreated) {
	//	copy(CONFIG_FILE, 'config.php');

		echo("Done</td></tr>");flush();
	} else {
		echo('<font color=red>failed</font>..<br />Process to write updated config.php file failed. Please check and <a href="install.php">restart installation process</a></td></tr>');flush();
		include('footer.tpl');
		exit;
	}

	$succ = upgradeWithFile( SQL_FILE );

	/* Clear cache directory */
	$cache_deleted = DeleteFiles('./temp/cache/', '1');

	if ($succ === true) {
		echo('<tr><td><center><font size="+1"><b><br />Congratulations.<br /> Upgrade successfully completed</b></font></center></td></tr>
		<tr><td>&nbsp;</td></tr>');
		$t->assign('dispstep', $dispstep+1);
	} else {
		echo('<tr><td><font size="14px" color=red><center><br />Upgrade failed. Please check issues and then <a uhref="install.php"restart installation process</a>.</center></font></td></tr><tr><td>
		&nbsp;</td></tr>');
		exit;
	}
	$t->display('install/install_step5-1.tpl');

	include('footer.tpl');

	exit;
}
?>