Fix error on install
This commit is contained in:
parent
c3adbb11fe
commit
68d4f9c693
@ -73,7 +73,7 @@ if ($db->ok == 1)
|
|||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
|
print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
|
||||||
$err=1;
|
$err=0; // We show button
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET["error"]) && $_GET["error"] == 2)
|
if (isset($_GET["error"]) && $_GET["error"] == 2)
|
||||||
@ -82,14 +82,14 @@ if ($db->ok == 1)
|
|||||||
print '<div class="error">';
|
print '<div class="error">';
|
||||||
print $langs->trans("PleaseTypePassword");
|
print $langs->trans("PleaseTypePassword");
|
||||||
print '</div>';
|
print '</div>';
|
||||||
$err=1;
|
$err=0; // We show button
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_GET["error"]) && $_GET["error"] == 3)
|
if (isset($_GET["error"]) && $_GET["error"] == 3)
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
|
print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
|
||||||
$err=1;
|
$err=0; // We show button
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
|
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
|
||||||
*
|
*
|
||||||
@ -56,9 +56,9 @@ dolibarr_install_syslog("Fileconf: Entering fileconf.php page");
|
|||||||
|
|
||||||
pHeader($langs->trans("ConfigurationFile"),"etape0");
|
pHeader($langs->trans("ConfigurationFile"),"etape0");
|
||||||
|
|
||||||
if ($force_install_message_doliwamp)
|
if (! empty($force_install_message_doliwamp))
|
||||||
{
|
{
|
||||||
print $langs->trans("KeepDefaultValues").'<br>';
|
print $langs->trans("KeepDefaultValues").'<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -118,7 +118,7 @@ print $langs->trans("Examples").":<br>";
|
|||||||
<td valign="top" class="label"><b>
|
<td valign="top" class="label"><b>
|
||||||
<?php print $langs->trans("DocumentsDirectory"); ?>
|
<?php print $langs->trans("DocumentsDirectory"); ?>
|
||||||
</b></td>
|
</b></td>
|
||||||
<?php
|
<?php
|
||||||
if (empty($dolibarr_main_data_root))
|
if (empty($dolibarr_main_data_root))
|
||||||
{
|
{
|
||||||
// Si le repertoire documents non defini, on en propose un par defaut
|
// Si le repertoire documents non defini, on en propose un par defaut
|
||||||
@ -149,7 +149,7 @@ print $langs->trans("Examples").":<br>";
|
|||||||
<td valign="top" class="label"><b>
|
<td valign="top" class="label"><b>
|
||||||
<?php echo $langs->trans("URLRoot"); ?>
|
<?php echo $langs->trans("URLRoot"); ?>
|
||||||
</b></td><td valign="top" class="label"><input type="text" size="60" name="main_url" value="
|
</b></td><td valign="top" class="label"><input type="text" size="60" name="main_url" value="
|
||||||
<?php
|
<?php
|
||||||
if (isset($main_url) && $main_url)
|
if (isset($main_url) && $main_url)
|
||||||
$dolibarr_main_url_root=$main_url;
|
$dolibarr_main_url_root=$main_url;
|
||||||
if (! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0)
|
if (! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0)
|
||||||
@ -164,7 +164,7 @@ if (! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0)
|
|||||||
}
|
}
|
||||||
# Si SCRIPT_URI, SERVER_URL, DOCUMENT_URI non d<>fini (Ex: Apache 2.0.44 pour Windows)
|
# Si SCRIPT_URI, SERVER_URL, DOCUMENT_URI non d<>fini (Ex: Apache 2.0.44 pour Windows)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$proto='http';
|
$proto='http';
|
||||||
if (! empty($_SERVER["HTTP_HOST"])) $serverport=$_SERVER["HTTP_HOST"];
|
if (! empty($_SERVER["HTTP_HOST"])) $serverport=$_SERVER["HTTP_HOST"];
|
||||||
else $serverport=$_SERVER["SERVER_NAME"];
|
else $serverport=$_SERVER["SERVER_NAME"];
|
||||||
@ -230,7 +230,7 @@ while (($file = readdir($handle))!==false)
|
|||||||
if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; }
|
if ($type=='mysqli') { $versionbasemin=array(4,1,0); $testfunction='mysqli_connect'; }
|
||||||
if ($type=='pgsql') { $versionbasemin=array(8,1,0); $testfunction='pg_connect'; }
|
if ($type=='pgsql') { $versionbasemin=array(8,1,0); $testfunction='pg_connect'; }
|
||||||
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; }
|
if ($type=='mssql') { $versionbasemin=array(2000); $testfunction='mssql_connect'; }
|
||||||
|
|
||||||
// Remarques
|
// Remarques
|
||||||
$note='';
|
$note='';
|
||||||
if ($type=='mysql') $note='(Mysql >= '.versiontostring($versionbasemin).')';
|
if ($type=='mysql') $note='(Mysql >= '.versiontostring($versionbasemin).')';
|
||||||
@ -339,7 +339,7 @@ while (($file = readdir($handle))!==false)
|
|||||||
<?php echo $langs->trans("CreateUser"); ?>
|
<?php echo $langs->trans("CreateUser"); ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="label" valign="top"><input type="checkbox" name="db_create_user"<?php if ($force_install_createuser) print ' checked="on"'; ?>></td>
|
<td class="label" valign="top"><input type="checkbox" name="db_create_user"<?php if (! empty($force_install_createuser)) print ' checked="on"'; ?>></td>
|
||||||
<td class="comment">
|
<td class="comment">
|
||||||
<?php echo $langs->trans("CheckToCreateUser"); ?>
|
<?php echo $langs->trans("CheckToCreateUser"); ?>
|
||||||
</td>
|
</td>
|
||||||
@ -379,6 +379,7 @@ while (($file = readdir($handle))!==false)
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
pFooter($err,$setuplang);
|
$db->close();
|
||||||
|
|
||||||
|
pFooter($err,$setuplang);
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -107,6 +107,7 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile))
|
|||||||
$includeconferror='ErrorBadFormatForConfFile';
|
$includeconferror='ErrorBadFormatForConfFile';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$conf->global->MAIN_LOGTOHTML=1;
|
||||||
|
|
||||||
|
|
||||||
// Define prefix
|
// Define prefix
|
||||||
@ -294,7 +295,7 @@ function pFooter($nonext=0,$setuplang='')
|
|||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
|
|
||||||
// If there is some logs in buffer to show
|
// If there is some logs in buffer to show
|
||||||
if (sizeof($conf->logbuffer))
|
if (isset($conf->logbuffer) && sizeof($conf->logbuffer))
|
||||||
{
|
{
|
||||||
print "\n";
|
print "\n";
|
||||||
print "<!-- Start of log output\n";
|
print "<!-- Start of log output\n";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -43,13 +43,14 @@ dolibarr_install_syslog("Licence: Entering licence.php page");
|
|||||||
|
|
||||||
pHeader($langs->trans("License"),"fileconf");
|
pHeader($langs->trans("License"),"fileconf");
|
||||||
|
|
||||||
|
|
||||||
//print '<pre style="align: center; font-size: 12px">';
|
//print '<pre style="align: center; font-size: 12px">';
|
||||||
$result=$langs->print_file("html/gpl.html",1);
|
$result=$langs->print_file("html/gpl.html",1);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
print '<center>'."\n";
|
print '<center>'."\n";
|
||||||
print '<textarea readonly="1" rows="26" cols="80">';
|
print '<textarea readonly="1" rows="26" cols="80">';
|
||||||
$langs->print_file("html/gpl.txt",1);
|
$result=$langs->print_file("html/gpl.txt",1);
|
||||||
print '</textarea>';
|
print '</textarea>';
|
||||||
print '</center>'."\n";
|
print '</center>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -224,6 +224,7 @@ class DoliDb
|
|||||||
*/
|
*/
|
||||||
function close()
|
function close()
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog("DoliDB::disconnect",LOG_DEBUG);
|
||||||
return mssql_close($this->db);
|
return mssql_close($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +372,7 @@ class DoliDb
|
|||||||
|
|
||||||
$result = mssql_query("SELECT @@ERROR as code", $this->db);
|
$result = mssql_query("SELECT @@ERROR as code", $this->db);
|
||||||
$row = mssql_fetch_array($result);
|
$row = mssql_fetch_array($result);
|
||||||
|
|
||||||
$this->lasterror = $this->error();
|
$this->lasterror = $this->error();
|
||||||
$this->lasterrno = $row["code"];
|
$this->lasterrno = $row["code"];
|
||||||
}
|
}
|
||||||
@ -557,7 +558,7 @@ class DoliDb
|
|||||||
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4));
|
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4));
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
|
* \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
|
||||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||||
@ -568,7 +569,7 @@ class DoliDb
|
|||||||
{
|
{
|
||||||
return adodb_strftime("%Y%m%d%H%M%S",$param,true);
|
return adodb_strftime("%Y%m%d%H%M%S",$param,true);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
|
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
|
||||||
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||||
@ -671,7 +672,7 @@ class DoliDb
|
|||||||
1217 => 'DB_ERROR_CHILD_EXISTS',
|
1217 => 'DB_ERROR_CHILD_EXISTS',
|
||||||
1451 => 'DB_ERROR_CHILD_EXISTS'
|
1451 => 'DB_ERROR_CHILD_EXISTS'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($errorcode_map[$this->lasterrno]))
|
if (isset($errorcode_map[$this->lasterrno]))
|
||||||
{
|
{
|
||||||
return $errorcode_map[$this->lasterrno];
|
return $errorcode_map[$this->lasterrno];
|
||||||
|
|||||||
@ -269,6 +269,7 @@ class DoliDb
|
|||||||
*/
|
*/
|
||||||
function close()
|
function close()
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog("DoliDB::disconnect",LOG_DEBUG);
|
||||||
return mysql_close($this->db);
|
return mysql_close($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class DoliDb
|
|||||||
var $versionmin=array(4,1,0);
|
var $versionmin=array(4,1,0);
|
||||||
//! Resultset of last request
|
//! Resultset of last request
|
||||||
var $results;
|
var $results;
|
||||||
//! 1 if connected, 0 else
|
//! 1 if connected, 0 else
|
||||||
var $connected;
|
var $connected;
|
||||||
//! 1 if database selected, 0 else
|
//! 1 if database selected, 0 else
|
||||||
var $database_selected;
|
var $database_selected;
|
||||||
@ -162,7 +162,7 @@ class DoliDb
|
|||||||
{
|
{
|
||||||
// Pas de selection de base demandee, ok ou ko
|
// Pas de selection de base demandee, ok ou ko
|
||||||
$this->database_selected = 0;
|
$this->database_selected = 0;
|
||||||
|
|
||||||
if ($this->connected)
|
if ($this->connected)
|
||||||
{
|
{
|
||||||
// If client connected with different charset than Dolibarr HTML output
|
// If client connected with different charset than Dolibarr HTML output
|
||||||
@ -275,6 +275,7 @@ class DoliDb
|
|||||||
*/
|
*/
|
||||||
function close()
|
function close()
|
||||||
{
|
{
|
||||||
|
dolibarr_syslog("DoliDB::disconnect",LOG_DEBUG);
|
||||||
return mysqli_close($this->db);
|
return mysqli_close($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,7 +563,7 @@ class DoliDb
|
|||||||
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4));
|
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4));
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
|
* \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
|
||||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||||
@ -573,7 +574,7 @@ class DoliDb
|
|||||||
{
|
{
|
||||||
return adodb_strftime("%Y%m%d%H%M%S",$param,true);
|
return adodb_strftime("%Y%m%d%H%M%S",$param,true);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
|
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
|
||||||
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||||
@ -677,7 +678,7 @@ class DoliDb
|
|||||||
1217 => 'DB_ERROR_CHILD_EXISTS',
|
1217 => 'DB_ERROR_CHILD_EXISTS',
|
||||||
1451 => 'DB_ERROR_CHILD_EXISTS'
|
1451 => 'DB_ERROR_CHILD_EXISTS'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isset($errorcode_map[mysqli_errno($this->db)]))
|
if (isset($errorcode_map[mysqli_errno($this->db)]))
|
||||||
{
|
{
|
||||||
return $errorcode_map[mysqli_errno($this->db)];
|
return $errorcode_map[mysqli_errno($this->db)];
|
||||||
@ -744,7 +745,7 @@ class DoliDb
|
|||||||
{
|
{
|
||||||
if (empty($charset)) $charset=$this->forcecharset;
|
if (empty($charset)) $charset=$this->forcecharset;
|
||||||
if (empty($collation)) $collation=$this->collation;
|
if (empty($collation)) $collation=$this->collation;
|
||||||
|
|
||||||
// ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci
|
// ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci
|
||||||
$sql = 'CREATE DATABASE '.$database;
|
$sql = 'CREATE DATABASE '.$database;
|
||||||
$sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation;
|
$sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation;
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class DoliDb
|
|||||||
var $ok;
|
var $ok;
|
||||||
var $error;
|
var $error;
|
||||||
var $lasterror;
|
var $lasterror;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,7 +142,7 @@ class DoliDb
|
|||||||
return $this->ok;
|
return $this->ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Convert a SQL request in mysql syntax to database syntax
|
* \brief Convert a SQL request in mysql syntax to database syntax
|
||||||
* \param line SQL request line to convert
|
* \param line SQL request line to convert
|
||||||
@ -151,7 +151,7 @@ class DoliDb
|
|||||||
function convertSQLFromMysql($line)
|
function convertSQLFromMysql($line)
|
||||||
{
|
{
|
||||||
# comments or empty lines
|
# comments or empty lines
|
||||||
if (eregi('^-- \$Id',$line)) {
|
if (eregi('^-- \$Id',$line)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
# comments or empty lines
|
# comments or empty lines
|
||||||
@ -162,12 +162,12 @@ class DoliDb
|
|||||||
if ($create_sql != "")
|
if ($create_sql != "")
|
||||||
{ # we are inside create table statement so lets process datatypes
|
{ # we are inside create table statement so lets process datatypes
|
||||||
if (eregi('(ISAM|innodb)',$line)) { # end of create table sequence
|
if (eregi('(ISAM|innodb)',$line)) { # end of create table sequence
|
||||||
$line=eregi_replace('\) *type=(MyISAM|innodb);',');');
|
$line=eregi_replace('\) *type=(MyISAM|innodb);',');');
|
||||||
$line=eregi_replace('\) *engine=(MyISAM|innodb);',');');
|
$line=eregi_replace('\) *engine=(MyISAM|innodb);',');');
|
||||||
}
|
}
|
||||||
|
|
||||||
# int, auto_increment -> serial
|
# int, auto_increment -> serial
|
||||||
// } elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) {
|
// } elsif (/^[\s\t]*(\w*)\s*.*int.*auto_increment/i) {
|
||||||
// $seq = qq~${table}_${1}_seq~;
|
// $seq = qq~${table}_${1}_seq~;
|
||||||
// s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig;
|
// s/[\s\t]*([a-zA-Z_0-9]*)\s*.*int.*auto_increment[^,]*/ $1 SERIAL PRIMARY KEY/ig;
|
||||||
// $create_sql.=$_;
|
// $create_sql.=$_;
|
||||||
@ -186,44 +186,44 @@ class DoliDb
|
|||||||
s/\w*int\(\d+\)/$out/g;
|
s/\w*int\(\d+\)/$out/g;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
$line=eregi_replace('tinyint','smallint');
|
$line=eregi_replace('tinyint','smallint');
|
||||||
|
|
||||||
# nuke unsigned
|
# nuke unsigned
|
||||||
if (eregi_replace('(int\w+|smallint)\s+unsigned','smallint',$reg))
|
if (eregi_replace('(int\w+|smallint)\s+unsigned','smallint',$reg))
|
||||||
{
|
{
|
||||||
$line=eregi_replace('(int\w+|smallint)\s+unsigned',$reg[1]);
|
$line=eregi_replace('(int\w+|smallint)\s+unsigned',$reg[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# blob -> text
|
# blob -> text
|
||||||
$line=eregi_replace('\w*blob','text');
|
$line=eregi_replace('\w*blob','text');
|
||||||
|
|
||||||
# tinytext/mediumtext -> text
|
# tinytext/mediumtext -> text
|
||||||
$line=eregi_replace('tinytext','text');
|
$line=eregi_replace('tinytext','text');
|
||||||
$line=eregi_replace('mediumtext','text');
|
$line=eregi_replace('mediumtext','text');
|
||||||
|
|
||||||
# char -> varchar
|
# char -> varchar
|
||||||
# PostgreSQL would otherwise pad with spaces as opposed
|
# PostgreSQL would otherwise pad with spaces as opposed
|
||||||
# to MySQL! Your user interface may depend on this!
|
# to MySQL! Your user interface may depend on this!
|
||||||
// s/(\s+)char/${1}varchar/gi;
|
// s/(\s+)char/${1}varchar/gi;
|
||||||
|
|
||||||
# nuke date representation (not supported in PostgreSQL)
|
# nuke date representation (not supported in PostgreSQL)
|
||||||
// s/datetime default '[^']+'/datetime/i;
|
// s/datetime default '[^']+'/datetime/i;
|
||||||
// s/date default '[^']+'/datetime/i;
|
// s/date default '[^']+'/datetime/i;
|
||||||
// s/time default '[^']+'/datetime/i;
|
// s/time default '[^']+'/datetime/i;
|
||||||
|
|
||||||
# change not null datetime field to null valid ones
|
# change not null datetime field to null valid ones
|
||||||
# (to support remapping of "zero time" to null
|
# (to support remapping of "zero time" to null
|
||||||
$line=eregi_replace('datetime not null','datetime');
|
$line=eregi_replace('datetime not null','datetime');
|
||||||
$line=eregi_replace('datetime','timestamp');
|
$line=eregi_replace('datetime','timestamp');
|
||||||
|
|
||||||
# nuke size of timestamp
|
# nuke size of timestamp
|
||||||
// s/timestamp\([^)]*\)/timestamp/i;
|
// s/timestamp\([^)]*\)/timestamp/i;
|
||||||
|
|
||||||
# double -> real
|
# double -> real
|
||||||
// s/^double/real/i;
|
// s/^double/real/i;
|
||||||
// s/(\s*)double/${1}real/i;
|
// s/(\s*)double/${1}real/i;
|
||||||
|
|
||||||
# unique key(field1,field2)
|
# unique key(field1,field2)
|
||||||
/* if (/unique key\s*\((\w+\s*,\s*\w+)\)/i) {
|
/* if (/unique key\s*\((\w+\s*,\s*\w+)\)/i) {
|
||||||
s/unique key\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
|
s/unique key\s*\((\w+\s*,\s*\w+)\)/UNIQUE\($1\)/i;
|
||||||
@ -237,7 +237,7 @@ class DoliDb
|
|||||||
$create_sql.=$_;
|
$create_sql.=$_;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
# unique key [name] (field)
|
# unique key [name] (field)
|
||||||
/* if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
|
/* if (/unique key\s*(\w*)\s*\((\w+)\)/i) {
|
||||||
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
|
s/unique key\s*(\w*)\s*\((\w+)\)/UNIQUE\($2\)/i;
|
||||||
@ -266,30 +266,30 @@ class DoliDb
|
|||||||
$create_index .= "CREATE INDEX $idxname ON $table ($fieldlist);\n";
|
$create_index .= "CREATE INDEX $idxname ON $table ($fieldlist);\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
# index(field)
|
# index(field)
|
||||||
/* if (/index\s*(\w*)\s*\((\w+)\)/i) {
|
/* if (/index\s*(\w*)\s*\((\w+)\)/i) {
|
||||||
my $idxname=($1?"$1":"idx_${table}_$2");
|
my $idxname=($1?"$1":"idx_${table}_$2");
|
||||||
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
|
$create_index .= "CREATE INDEX $idxname ON $table ($2);\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
# primary key
|
# primary key
|
||||||
/* if (/\bkey\b/i && !/^\s+primary key\s+/i) {
|
/* if (/\bkey\b/i && !/^\s+primary key\s+/i) {
|
||||||
s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key
|
s/KEY(\s+)[^(]*(\s+)/$1 UNIQUE $2/i; # hack off name of the non-primary key
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
# key(xxx)
|
# key(xxx)
|
||||||
/* if (/key\s*\((\w+)\)/i) {
|
/* if (/key\s*\((\w+)\)/i) {
|
||||||
my $idxname="idx_${table}_$1";
|
my $idxname="idx_${table}_$1";
|
||||||
$create_index .= "CREATE INDEX $idxname ON $table ($1);\n";
|
$create_index .= "CREATE INDEX $idxname ON $table ($1);\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
# Quote column names
|
# Quote column names
|
||||||
/* s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i);
|
/* s/(^\s*)([^\s\-\(]+)(\s*)/$1"$2"$3/gi if (!/\bkey\b/i);
|
||||||
*/
|
*/
|
||||||
# Remap colums with names of existing system attribute
|
# Remap colums with names of existing system attribute
|
||||||
/* if (/"oid"/i) {
|
/* if (/"oid"/i) {
|
||||||
s/"oid"/"_oid"/g;
|
s/"oid"/"_oid"/g;
|
||||||
print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue.";
|
print STDERR "WARNING: table $table uses column \"oid\" which is renamed to \"_oid\"\nYou should fix application manually! Press return to continue.";
|
||||||
@ -309,13 +309,13 @@ class DoliDb
|
|||||||
s!\x85!... !g; # \ldots
|
s!\x85!... !g; # \ldots
|
||||||
s!\x92!`!g;
|
s!\x92!`!g;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
# fix dates '0000-00-00 00:00:00' (should be null)
|
# fix dates '0000-00-00 00:00:00' (should be null)
|
||||||
/* s/'0000-00-00 00:00:00'/null/gi;
|
/* s/'0000-00-00 00:00:00'/null/gi;
|
||||||
s/'0000-00-00'/null/gi;
|
s/'0000-00-00'/null/gi;
|
||||||
s/'00:00:00'/null/gi;
|
s/'00:00:00'/null/gi;
|
||||||
s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/;
|
s/([12]\d\d\d)([01]\d)([0-3]\d)([0-2]\d)([0-6]\d)([0-6]\d)/'$1-$2-$3 $4:$5:$6'/;
|
||||||
|
|
||||||
if (/create\s+table\s+(\w+)/i) {
|
if (/create\s+table\s+(\w+)/i) {
|
||||||
$create_sql = $_;
|
$create_sql = $_;
|
||||||
/create\s*table\s*(\w+)/i;
|
/create\s*table\s*(\w+)/i;
|
||||||
@ -325,11 +325,11 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
} # end of if inside create_table
|
} # end of if inside create_table
|
||||||
|
|
||||||
|
|
||||||
return $line;
|
return $line;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Selectionne une database.
|
\brief Selectionne une database.
|
||||||
\param database nom de la database
|
\param database nom de la database
|
||||||
@ -396,7 +396,7 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
return $vlist[0].$vlist[1].$vlist[2];
|
return $vlist[0].$vlist[1].$vlist[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Renvoie la version du serveur dans un tableau
|
\brief Renvoie la version du serveur dans un tableau
|
||||||
\return array Tableau de chaque niveau de version
|
\return array Tableau de chaque niveau de version
|
||||||
@ -412,7 +412,8 @@ class DoliDb
|
|||||||
*/
|
*/
|
||||||
function close()
|
function close()
|
||||||
{
|
{
|
||||||
return pg_close($this->db);
|
dolibarr_syslog("DoliDB::disconnect",LOG_DEBUG);
|
||||||
|
return pg_close($this->db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -448,7 +449,7 @@ class DoliDb
|
|||||||
if ($this->transaction_opened<=1)
|
if ($this->transaction_opened<=1)
|
||||||
{
|
{
|
||||||
$ret=$this->query("COMMIT;");
|
$ret=$this->query("COMMIT;");
|
||||||
if ($ret)
|
if ($ret)
|
||||||
{
|
{
|
||||||
$this->transaction_opened=0;
|
$this->transaction_opened=0;
|
||||||
dolibarr_syslog("COMMIT Transaction",LOG_DEBUG);
|
dolibarr_syslog("COMMIT Transaction",LOG_DEBUG);
|
||||||
@ -491,11 +492,11 @@ class DoliDb
|
|||||||
function query($query)
|
function query($query)
|
||||||
{
|
{
|
||||||
$query = trim($query);
|
$query = trim($query);
|
||||||
|
|
||||||
if ($this->forcecharset=="UTF-8"){
|
if ($this->forcecharset=="UTF-8"){
|
||||||
$buffer=utf8_encode ($buffer);
|
$buffer=utf8_encode ($buffer);
|
||||||
}
|
}
|
||||||
$ret = pg_query($this->db, $query);
|
$ret = pg_query($this->db, $query);
|
||||||
if (! eregi("^COMMIT",$query) && ! eregi("^ROLLBACK",$query))
|
if (! eregi("^COMMIT",$query) && ! eregi("^ROLLBACK",$query))
|
||||||
{
|
{
|
||||||
// Si requete utilisateur, on la sauvegarde ainsi que son resultset
|
// Si requete utilisateur, on la sauvegarde ainsi que son resultset
|
||||||
@ -622,7 +623,7 @@ class DoliDb
|
|||||||
{
|
{
|
||||||
if (! $return) $return.=' ORDER BY ';
|
if (! $return) $return.=' ORDER BY ';
|
||||||
else $return.=',';
|
else $return.=',';
|
||||||
|
|
||||||
$return.=$val;
|
$return.=$val;
|
||||||
if ($sortorder) $return.=' '.$sortorder;
|
if ($sortorder) $return.=' '.$sortorder;
|
||||||
}
|
}
|
||||||
@ -633,8 +634,8 @@ class DoliDb
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Escape a string to insert data.
|
\brief Escape a string to insert data.
|
||||||
\param stringtoencode String to escape
|
\param stringtoencode String to escape
|
||||||
@ -682,7 +683,7 @@ class DoliDb
|
|||||||
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4));
|
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4));
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
|
* \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
|
||||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||||
@ -693,7 +694,7 @@ class DoliDb
|
|||||||
{
|
{
|
||||||
return adodb_strftime("%Y%m%d%H%M%S",$param,true);
|
return adodb_strftime("%Y%m%d%H%M%S",$param,true);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
|
* \brief Convert (by PHP) a GM string date into a GM Timestamps date
|
||||||
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
* \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||||
@ -707,7 +708,7 @@ class DoliDb
|
|||||||
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),1);
|
$date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),1);
|
||||||
return $date;
|
return $date;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Formatage d'un if SQL
|
* \brief Formatage d'un if SQL
|
||||||
* \param test chaine test
|
* \param test chaine test
|
||||||
@ -834,7 +835,7 @@ class DoliDb
|
|||||||
{
|
{
|
||||||
if (empty($charset)) $charset=$this->forcecharset;
|
if (empty($charset)) $charset=$this->forcecharset;
|
||||||
if (empty($collation)) $collation=$this->collation;
|
if (empty($collation)) $collation=$this->collation;
|
||||||
|
|
||||||
$ret=$this->query('CREATE DATABASE '.$database.' OWNER '.$this->db_user.' ENCODING \''.$charset.'\' ;');
|
$ret=$this->query('CREATE DATABASE '.$database.' OWNER '.$this->db_user.' ENCODING \''.$charset.'\' ;');
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
@ -850,7 +851,7 @@ class DoliDb
|
|||||||
return $this->results;
|
return $this->results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Create a user
|
\brief Create a user
|
||||||
\param dolibarr_main_db_host Ip serveur
|
\param dolibarr_main_db_host Ip serveur
|
||||||
@ -869,28 +870,28 @@ class DoliDb
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultCharacterSetDatabase(){
|
function getDefaultCharacterSetDatabase(){
|
||||||
$resql=$this->query('SHOW SERVER_ENCODING');
|
$resql=$this->query('SHOW SERVER_ENCODING');
|
||||||
$liste=$this->fetch_array($resql);
|
$liste=$this->fetch_array($resql);
|
||||||
return $liste['server_encoding'];
|
return $liste['server_encoding'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getListOfCharacterSet(){
|
function getListOfCharacterSet(){
|
||||||
$resql=$this->query('SHOW CHARSET');
|
$resql=$this->query('SHOW CHARSET');
|
||||||
$liste = array();
|
$liste = array();
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($obj = $this->fetch_object($resql) )
|
while ($obj = $this->fetch_object($resql) )
|
||||||
{
|
{
|
||||||
$liste[$i]['charset'] = $obj->Charset;
|
$liste[$i]['charset'] = $obj->Charset;
|
||||||
$liste[$i]['description'] = $obj->Description;
|
$liste[$i]['description'] = $obj->Description;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->free($resql);
|
$this->free($resql);
|
||||||
} else {
|
} else {
|
||||||
// version Mysql < 4.1.1
|
// version Mysql < 4.1.1
|
||||||
@ -898,7 +899,7 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
return $liste;
|
return $liste;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultCollationDatabase(){
|
function getDefaultCollationDatabase(){
|
||||||
$resql=$this->query('SHOW VARIABLES LIKE \'collation_database\'');
|
$resql=$this->query('SHOW VARIABLES LIKE \'collation_database\'');
|
||||||
if (!$resql)
|
if (!$resql)
|
||||||
@ -909,18 +910,18 @@ class DoliDb
|
|||||||
$liste=$this->fetch_array($resql);
|
$liste=$this->fetch_array($resql);
|
||||||
return $liste['Value'];
|
return $liste['Value'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getListOfCollation(){
|
function getListOfCollation(){
|
||||||
$resql=$this->query('SHOW COLLATION');
|
$resql=$this->query('SHOW COLLATION');
|
||||||
$liste = array();
|
$liste = array();
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($obj = $this->fetch_object($resql) )
|
while ($obj = $this->fetch_object($resql) )
|
||||||
{
|
{
|
||||||
$liste[$i]['collation'] = $obj->Collation;
|
$liste[$i]['collation'] = $obj->Collation;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$this->free($resql);
|
$this->free($resql);
|
||||||
} else {
|
} else {
|
||||||
// version Mysql < 4.1.1
|
// version Mysql < 4.1.1
|
||||||
@ -928,6 +929,6 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
return $liste;
|
return $liste;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -522,10 +522,12 @@ class Translate {
|
|||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
// Test si fichier dans repertoire de la langue
|
|
||||||
|
// Test if file is in lang directory
|
||||||
foreach($this->dir as $searchdir)
|
foreach($this->dir as $searchdir)
|
||||||
{
|
{
|
||||||
$htmlfile=($searchdir."/langs/".$this->defaultlang."/".$filename);
|
$htmlfile=($searchdir."/langs/".$this->defaultlang."/".$filename);
|
||||||
|
dolibarr_syslog('Translate::print_file search file '.$htmlfile, LOG_DEBUG);
|
||||||
if (is_readable($htmlfile))
|
if (is_readable($htmlfile))
|
||||||
{
|
{
|
||||||
$content=file_get_contents($htmlfile);
|
$content=file_get_contents($htmlfile);
|
||||||
@ -535,20 +537,24 @@ class Translate {
|
|||||||
else print $content;
|
else print $content;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else dolibarr_syslog('Translate::print_file not found', LOG_DEBUG);
|
||||||
|
|
||||||
if ($searchalt) {
|
if ($searchalt) {
|
||||||
// Test si fichier dans repertoire de la langue alternative
|
// Test si fichier dans repertoire de la langue alternative
|
||||||
if ($this->defaultlang != "en_US") $htmlfilealt = $searchdir."/en_US/".$filename;
|
if ($this->defaultlang != "en_US") $htmlfilealt = $searchdir."/langs/en_US/".$filename;
|
||||||
else $htmlfilealt = $searchdir."/langs/fr_FR/".$filename;
|
else $htmlfilealt = $searchdir."/langs/fr_FR/".$filename;
|
||||||
if (is_readable($htmlfilealt))
|
dolibarr_syslog('Translate::print_file search alt file '.$htmlfilealt, LOG_DEBUG);
|
||||||
|
//print 'getcwd='.getcwd().' htmlfilealt='.$htmlfilealt.' X '.file_exists(getcwd().'/'.$htmlfilealt);
|
||||||
|
if (is_readable($htmlfilealt))
|
||||||
{
|
{
|
||||||
$content=file_get_contents($htmlfile);
|
$content=file_get_contents($htmlfilealt);
|
||||||
$isutf8=utf8_check($content);
|
$isutf8=utf8_check($content);
|
||||||
if (! $isutf8 && $conf->character_set_client == 'UTF-8') print utf8_encode($content);
|
if (! $isutf8 && $conf->character_set_client == 'UTF-8') print utf8_encode($content);
|
||||||
elseif ($isutf8 && $conf->character_set_client == 'ISO-8859-1') print utf8_decode($content);
|
elseif ($isutf8 && $conf->character_set_client == 'ISO-8859-1') print utf8_decode($content);
|
||||||
else print $content;
|
else print $content;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else dolibarr_syslog('Translate::print_file not found', LOG_DEBUG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user