<?php
 /***************************************************************************
 *   Copyright (C) 2008 by oscim   Project lossim                          *
 *   a@oscim.fr                                                            *
 *       [created : 14.03.2008, 17:53:41] @oscim                           *
 ***************************************************************************/

 function add_entete_file(){
 }

 $datas_file=array( "sommaire","liens","");

// Si le fichier a les bonnes permissions on le modifie sinon on dit ce qu'il faut faire
if(file_exists("../xml"))  {
	if(is_writable("../xml") OR $os_du_serveur == "windows") {


		## verif rep bak
		if(!file_exists("../xml/bak")) @mkdir("../xml/bak");

		$page_enete = fread("data/_top_data.xml-dist");
		$error = false;
		$error_mess = '';

		$cfg_admin = new configfile('../admin/config/sys_config.php');

			$cfg_admin->prefix = '_PX_config';

	if (!empty($_POST['url_du_site'])) {
		$cfg_admin->editVar('url_admin',(string)$_POST['url_du_site']."admin/");
		$cfg_admin->editVar('url_du_site',(string)$_POST['url_du_site']);
	}
	if (!empty($_POST['chemin_du_site'])) {
		$cfg_admin->editVar('chemin_admin',(string)$_POST['chemin_du_site']."admin/");
		$cfg_admin->editVar('chemin_du_site',(string)$_POST['chemin_du_site']);
	}
	$cfg_admin->editVar('url_admin',(string)$_POST['url_du_site']."admin/");

	if (!empty($_POST['nom_du_site'])) $cfg_admin->editVar('nom_du_site',(string)utf8_encode($_POST['nom_du_site']));
	if (!empty($_POST['slogan_du_site'])) $cfg_admin->editVar('slogan_du_site',(string)utf8_encode($_POST['slogan_du_site']));
	if (!empty($_POST['select_template'])) $cfg_admin->editVar('nom_du_theme',(string)utf8_encode($_POST['select_template']));
	if (!empty($_POST['base_css'])) $cfg_admin->editVar('nom_styles_css',(string)utf8_encode($_POST['base_css']));

			if (!$cfg_admin->saveFile()) {
				 $error_mess .= 'Error: Impossible to create the configuration file. pour \$cfg_admin';
				$error = true;
			}
			else  $error_mess .= 'Ok. pour cfg_admin <br /> <a href="'.$_POST['url_du_site'].'/admin" >L\'admin </a> <br /> Mot de pass admin et login admin <br />';

	}else { $tit=NOT_WRITE; $det=NOT_WRITE_DETAIL; }
echo "<h2>$tit</h2>\n<p>$det</p>\n<p>$error_mess</p>\n";

?>
<form name='formt' enctype="multipart/form-data" action='setup.php?etape=2' Method='POST'>
	<?php if($error == false) print"<input type='hidden' name='success_base' value='1' />";?>
	<?php post_hidden($_POST) ?>
	<input type='submit' name='boutton' value='La Suite'>
</form>