* Copyright (C) 2007 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ * $Source$ */ /** \file htdocs/install/etape1.php \brief Pemet d'afficher et de confirmer le charset par rapport aux informations précedntes -> sélection suite à connection' \version $Revision$ */ define('DONOTLOADCONF',1); // To avoid loading conf by file inc..php include_once("./inc.php"); $setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:'auto'); $langs->setDefaultLang($setuplang); $langs->load("admin"); $langs->load("install"); $error = 0; /* * Actions */ /* * Affichage page */ pHeader($langs->trans("ConfigurationFile"),"etape1"); // On reporte champ formulaire précédent pour propagation if ($_POST["action"] == "set") { umask(0); foreach($_POST as $cle=>$valeur) { echo ''; } } /** * Récuparation des information de connexion */ $userroot=isset($_POST["db_user_root"])?$_POST["db_user_root"]:""; $passroot=isset($_POST["db_pass_root"])?$_POST["db_pass_root"]:""; // Répertoire des pages dolibarr $main_dir=isset($_POST["main_dir"])?trim($_POST["main_dir"]):''; /** * Si l'utilisateur n'est pas créé déjà créé, on se connecte à l'aide du login root' */ require_once($main_dir."/lib/databases/".$_POST["db_type"].".lib.php"); if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on") { $databasefortest=$conf->db->name; if ($_POST["db_type"] == 'mysql' ||$_POST["db_type"] == 'mysqli') { $databasefortest='mysql'; }else{ $databasefortest='postgres'; } $db = new DoliDb($_POST["db_type"],$_POST["db_host"],$userroot,$passroot,$databasefortest); }else{ $db = new DoliDb($_POST["db_type"],$_POST["db_host"],$_POST["db_user"],$_POST["db_pass"],$_POST["db_name"]); } if ($db->error) { print '
'.$db->error.'
'; $error++; } /* * Si creation database demandée, il est possible de faire un choix */ $disabled=""; if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on")) { $disabled=""; }else{ $disabled="disabled"; } if ($db->connected) { ?> getDefaultCharacterSetDatabase(); $defaultCollationConnection=$db->getDefaultCollationConnection(); $listOfCharacterSet=$db->getListOfCharacterSet(); $listOfCollation=$db->getListOfCollation(); if ($defaultCharacterSet) { ?> trans("YouAskDatabaseCreationSoDolibarrNeedToConnect",$dolibarr_main_db_user,$dolibarr_main_db_host,$userroot); print '
'; print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'

'; print $langs->trans("ErrorGoBackAndCorrectParameters"); $error++; } else { print $db->lasterror(); print '
'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'

'; print $langs->trans("ErrorGoBackAndCorrectParameters"); $error++; } } ?>

trans("CharsetChoice");?>

trans("CharacterSetClient"); ?>
trans("CharacterSetClientComment"); ?>
trans("CharacterSetDatabase"); ?> '; $selected=""; foreach ($listOfCharacterSet as $characterSet) { if ($defaultCharacterSet == $characterSet['charset'] ) { $selected="selected"; } else { $selected=""; } print ''; } print ''; } else { print ''; } ?>
trans("CharacterSetDatabaseComment"); ?>
trans("CollationConnection"); ?> '; $selected=""; foreach ($listOfCollation as $collation) { if ($defaultCollationConnection == $collation['collation']) { $selected="selected"; } else { $selected=""; } print ''; } print ''; } else { print ''; } ?>
trans("CollationConnectionComment"); ?>