* 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$ */ /** \file htdocs/install/etape0.php \brief Permet d'afficher et de confirmer le charset par rapport aux informations précédentes -> sélection suite à connexion' \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; /** * 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"]):''; /* * 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 ''; } } // Check parameters if (! isset($_POST["db_type"]) || ! $_POST["db_type"]) { print '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DatabaseType")).'
'; $error++; } if (! isset($_POST["db_host"]) || ! $_POST["db_host"]) { print '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Server")).'
'; $error++; } if (! isset($_POST["db_name"]) || ! $_POST["db_name"]) { print '
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("DatabaseName")).'
'; $error++; } /** * Si l'utilisateur n'est pas déjà créé, on se connecte à l'aide du login root' */ if (! $error) { 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'; } elseif ($_POST["db_type"] == 'pgsql') { $databasefortest='postgres'; } else { $databasefortest='mssql'; } $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 (! $error && $db->connected) { ?> getDefaultCharacterSetDatabase(); $defaultCollationConnection=$db->getDefaultCollationConnection(); $listOfCharacterSet=$db->getListOfCharacterSet(); $listOfCollation=$db->getListOfCollation(); ?>

trans("CharsetChoice");?>

trans("CharacterSetClient"); ?>
trans("CharacterSetClientComment"); ?>
trans("CharacterSetDatabase"); ?> '; $selected=""; foreach ($listOfCharacterSet as $characterSet) { if ($defaultCharacterSet == $characterSet['charset'] ) { $selected="selected"; } else { $selected=""; } print ''; } print ''; if ($disabled=="disabled"){ print ''; } } else { print ''; } ?>
trans("CharacterSetDatabaseComment"); ?>
trans("CollationConnection"); ?> '; $selected=""; foreach ($listOfCollation as $collation) { if ($defaultCollationConnection == $collation['collation']) { $selected="selected"; } else { $selected=""; } print ''; } print ''; if ($disabled=="disabled"){ print ''; } } else { print ''; } ?>
trans("CollationConnectionComment"); ?>
trans("YouAskDatabaseCreationSoDolibarrNeedToConnect",$dolibarr_main_db_user,$dolibarr_main_db_host,$userroot); print '
'; print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'

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

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