Simplification du code
This commit is contained in:
parent
f3db537f93
commit
16c4d99933
@ -101,28 +101,125 @@ if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_databa
|
||||
}else{
|
||||
$disabled="disabled";
|
||||
}
|
||||
if ($db->connected){
|
||||
|
||||
if ($db->connected)
|
||||
{
|
||||
?>
|
||||
<table border="0" cellpadding="1" cellspacing="0">
|
||||
<tr><td valign="top" class="label" colspan="3"><?php echo $langs->trans("CharsetChoice");?></td></tr>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CharacterSetClient"); ?></td>
|
||||
<td valign="top" class="label"><select name="character_set_client"><option>ISO-8859-1</option><option>ISO-8859-15</option><option>UTF-8</option><option>cp866</option><option>cp1251</option><option>cp1252</option><option>KOI8-R</option><option>BIG5</option><option>GB2312</option><option>BIG5-HKSCS</option><option>Shift_JIS</option><option>EUC-JP</option></select></td>
|
||||
<td valign="top" class="label"><select name="character_set_client">
|
||||
<option>ISO-8859-1</option>
|
||||
<option>ISO-8859-15</option>
|
||||
<option>UTF-8</option>
|
||||
<option>cp866</option>
|
||||
<option>cp1251</option>
|
||||
<option>cp1252</option>
|
||||
<option>KOI8-R</option>
|
||||
<option>BIG5</option>
|
||||
<option>GB2312</option>
|
||||
<option>BIG5-HKSCS</option>
|
||||
<option>Shift_JIS</option>
|
||||
<option>EUC-JP</option>
|
||||
</select></td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CharacterSetClientComment"); ?></div></td>
|
||||
</tr>
|
||||
<?php include($_POST["db_type"].'.php');?>
|
||||
<?php
|
||||
}else{
|
||||
|
||||
|
||||
<?php
|
||||
$defaultCharacterSet=$db->getDefaultCharacterSetDatabase();
|
||||
$defaultCollationConnection=$db->getDefaultCollationConnection();
|
||||
$listOfCharacterSet=$db->getListOfCharacterSet();
|
||||
$listOfCollation=$db->getListOfCollation();
|
||||
|
||||
if ($defaultCharacterSet)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CharacterSetDatabase"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<?php
|
||||
if (sizeof($listOfCharacterSet))
|
||||
{
|
||||
print '<select name="character_set_database" '.$disabled.'>';
|
||||
$selected="";
|
||||
foreach ($listOfCharacterSet as $characterSet)
|
||||
{
|
||||
if ($defaultCharacterSet == $characterSet['charset'] )
|
||||
{
|
||||
$selected="selected";
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected="";
|
||||
}
|
||||
print '<option value="'.$characterSet['charset'].'" '.$selected.'>'.$characterSet['charset'].' ('.$characterSet['description'].')</option>';
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input name="character_set_database" '.$disabled.' value="'.$defaultCharacterSet.'">';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CharacterSetDatabaseComment"); ?></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($defaultCollationConnection)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CollationConnection"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<?php
|
||||
if (sizeof($listOfCollation))
|
||||
{
|
||||
print '<select name="collation_connection" '.$disabled.'>';
|
||||
$selected="";
|
||||
foreach ($listOfCollation as $collation)
|
||||
{
|
||||
if ($defaultCollationConnection == $collation['collation'])
|
||||
{
|
||||
$selected="selected";
|
||||
}
|
||||
else
|
||||
{
|
||||
$selected="";
|
||||
}
|
||||
print '<option value="'.$collation['collation'].'" '.$selected.'>'.$collation['collation'].'</option>';
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="hidden" name="collation_connection" value="'.$collation['collation'].'">';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CollationConnectionComment"); ?></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_POST["db_create_user"]) && $_POST["db_create_user"] == "on")
|
||||
{
|
||||
print 'Vous avez demandé la création du login Dolibarr "<b>'.$dolibarr_main_db_user.'</b>", mais pour cela, ';
|
||||
print 'Dolibarr doit se connecter sur le serveur "<b>'.$dolibarr_main_db_host.'</b>" via le super utilisateur "<b>'.$userroot.'</b>".<br>';
|
||||
print 'La connexion ayant échoué, les paramètres du serveur ou du super utilisateur sont peut-etre incorrects.<br>';
|
||||
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
||||
}else{
|
||||
print 'La connexion ayant échoué, les paramètres de connexion de l\'utilisateur sont peut-etre incorrects.<br>';
|
||||
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
||||
print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect",$dolibarr_main_db_user,$dolibarr_main_db_host,$userroot);
|
||||
print '<br>';
|
||||
print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
||||
print $langs->trans("ErrorGoBackAndCorrectParameters");
|
||||
$error++;
|
||||
}
|
||||
else
|
||||
{
|
||||
print $db->lasterror();
|
||||
print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
||||
print $langs->trans("ErrorGoBackAndCorrectParameters");
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2007 Cyrille de Lambert <cyrille.delambert@auguria.net>
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
$listOfCharacterSet=$db->getListOfCharacterSet();
|
||||
$listOfCollation=$db->getListOfCollation();
|
||||
?>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CharacterSetDatabase"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<?php
|
||||
$listOfCharacterSet=$db->getListOfCharacterSet();
|
||||
?>
|
||||
<select name="character_set_database" <?php echo $disabled ?>>
|
||||
<?php
|
||||
$selected="";
|
||||
foreach ($listOfCharacterSet as $characterSet) {
|
||||
if ($db->getDefaultCharacterSetDatabase() ==$characterSet['charset'] ){
|
||||
$selected="selected";
|
||||
}else{
|
||||
$selected="";
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo $characterSet['charset'];?>" <?php echo $selected;?>> <?php echo $characterSet['charset'];?> (<?php echo $characterSet['description'];?>)</option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CharacterSetDatabaseComment"); ?></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CollationConnection"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<?php
|
||||
$listOfCollation=$db->getListOfCollation();
|
||||
?>
|
||||
<select name="collation_connection" <?php echo $disabled ?>>
|
||||
<?php
|
||||
$selected="";
|
||||
foreach ($listOfCollation as $collation) {
|
||||
if ($db->getDefaultCollationConnection() ==$collation['collation'] ){
|
||||
$selected="selected";
|
||||
}else{
|
||||
$selected="";
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo $collation['collation'];?>" <?php echo $selected;?>> <?php echo $collation['collation'];?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?if ($disabled && $disabled=="disabled"){
|
||||
?>
|
||||
<input type="hidden" name="character_set_database" value="<?php echo $collation['charset'] ?>">
|
||||
<input type="hidden" name="collation_connection" value="<?php echo $collation['collation'] ?>">
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CollationConnectionComment"); ?></div></td>
|
||||
</tr>
|
||||
@ -1,79 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2007 Cyrille de Lambert <cyrille.delambert@auguria.net>
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
|
||||
$listOfCharacterSet=$db->getListOfCharacterSet();
|
||||
$listOfCollation=$db->getListOfCollation();
|
||||
?>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CharacterSetDatabase"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<?php
|
||||
$listOfCharacterSet=$db->getListOfCharacterSet();
|
||||
?>
|
||||
<select name="character_set_database" <?php echo $disabled ?>>
|
||||
<?php
|
||||
$selected="";
|
||||
foreach ($listOfCharacterSet as $characterSet) {
|
||||
if ($db->getDefaultCharacterSetDatabase() ==$characterSet['charset'] ){
|
||||
$selected="selected";
|
||||
}else{
|
||||
$selected="";
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo $characterSet['charset'];?>" <?php echo $selected;?>> <?php echo $characterSet['charset'];?> (<?php echo $characterSet['description'];?>)</option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CharacterSetDatabaseComment"); ?></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CollationConnection"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<?php
|
||||
$listOfCollation=$db->getListOfCollation();
|
||||
?>
|
||||
<select name="collation_connection" <?php echo $disabled ?>>
|
||||
<?php
|
||||
$selected="";
|
||||
foreach ($listOfCollation as $collation) {
|
||||
if ($db->getDefaultCollationConnection() ==$collation['collation'] ){
|
||||
$selected="selected";
|
||||
}else{
|
||||
$selected="";
|
||||
}
|
||||
?>
|
||||
<option value="<?php echo $collation['collation'];?>" <?php echo $selected;?>> <?php echo $collation['collation'];?></option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?if ($disabled && $disabled=="disabled"){
|
||||
?>
|
||||
<input type="hidden" name="character_set_database" value="<?php echo $db->getDefaultCharacterSetDatabase() ?>">
|
||||
<input type="hidden" name="collation_connection" value="<?php echo $db->getDefaultCollationConnection() ?>">
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CollationConnectionComment"); ?></div></td>
|
||||
</tr>
|
||||
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2007 Cyrille de Lambert <cyrille.delambert@auguria.net>
|
||||
*
|
||||
* 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$
|
||||
*/
|
||||
?>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CharacterSetDatabase"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<input name="character_set_database" <?php echo $disabled ?> value="<?php echo $db->getDefaultCharacterSetDatabase()?>">
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CharacterSetDatabaseComment"); ?></div></td>
|
||||
</tr>
|
||||
Loading…
Reference in New Issue
Block a user