mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Add log inside install pages.
This commit is contained in:
parent
67e2efcb43
commit
d9b7bff2fd
|
|
@ -50,7 +50,9 @@ class Conf
|
|||
|
||||
var $css_modules=array();
|
||||
var $tabs_modules=array();
|
||||
|
||||
|
||||
var $logbuffer=array();
|
||||
|
||||
|
||||
/**
|
||||
* \brief Positionne toutes les variables de configuration
|
||||
|
|
|
|||
|
|
@ -15,44 +15,42 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
body {
|
||||
font-size:13px;
|
||||
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #F4F4F4;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
div.titre {
|
||||
padding: 5px 5px 5px 5px;
|
||||
margin: 0em 0em 0em 0em;
|
||||
font-size:13px;
|
||||
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
|
||||
background-color: #F4F4F4;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
span.titre {
|
||||
font-size:1.1em;
|
||||
font-weight: bold;
|
||||
background: #dcdcd3;
|
||||
color: #4965B3;
|
||||
padding: 5px 5px 5px 5px;
|
||||
margin: 0em 0em 0em 0em;
|
||||
border: 1px solid #8CACBB;
|
||||
font-size:1.1em;
|
||||
font-weight: bold;
|
||||
background: #dcdcd3;
|
||||
color: #4965B3;
|
||||
border: 1px solid #8CACBB;
|
||||
padding: 5px 5px 5px 5px;
|
||||
margin: 0em 0em 0em 0em;
|
||||
}
|
||||
|
||||
div.titre {
|
||||
padding: 5px 5px 5px 5px;
|
||||
margin: 0em 0em 0em 0em;
|
||||
}
|
||||
|
||||
div.soustitre {
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
color: #4965B3;
|
||||
padding: 0em 1.2em 0.5em 2em;
|
||||
margin: 1.2em 1.2em 1.2em 1.2em;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
border-right: 1px solid #8CACBB;
|
||||
text-align: right;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
color: #4965B3;
|
||||
padding: 0em 1.2em 0.5em 2em;
|
||||
margin: 1.2em 1.2em 1.2em 1.2em;
|
||||
border-bottom: 1px solid #8CACBB;
|
||||
border-right: 1px solid #8CACBB;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
inputdisabled
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
|
|
@ -20,16 +20,17 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/install/etape4.php
|
||||
\ingroup install
|
||||
\brief Demande le login et mot de passe de l'administrateur Dolibarr
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/install/etape4.php
|
||||
\ingroup install
|
||||
\brief Demande le login et mot de passe de l'administrateur Dolibarr
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
|
||||
include_once("./inc.php");
|
||||
require_once($dolibarr_main_document_root . "/lib/databases/".$dolibarr_main_db_type.".lib.php");
|
||||
require_once($dolibarr_main_document_root . "/conf/conf.class.php");
|
||||
require_once($dolibarr_main_document_root."/lib/databases/".$dolibarr_main_db_type.".lib.php");
|
||||
require_once($dolibarr_main_document_root."/conf/conf.class.php");
|
||||
require_once($dolibarr_main_document_root."/lib/admin.lib.php");
|
||||
|
||||
|
||||
$setuplang=isset($_POST["selectlang"])?$_POST["selectlang"]:(isset($_GET["selectlang"])?$_GET["selectlang"]:'auto');
|
||||
|
|
@ -44,64 +45,56 @@ if (file_exists("./install.forced.php")) include_once("./install.forced.php");
|
|||
|
||||
dolibarr_install_syslog("etape4: Entering etape4.php page");
|
||||
|
||||
$err=0;
|
||||
$ok = 0;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
* View
|
||||
*/
|
||||
|
||||
pHeader($langs->trans("AdminAccountCreation"),"etape5");
|
||||
|
||||
|
||||
|
||||
print '<table cellspacing="0" cellpadding="2" width="100%">';
|
||||
|
||||
$err=0;
|
||||
|
||||
$conf = new Conf();
|
||||
$conf->db->type = $dolibarr_main_db_type;
|
||||
$conf->db->host = $dolibarr_main_db_host;
|
||||
$conf->db->port = $dolibarr_main_db_port;
|
||||
$conf->db->name = $dolibarr_main_db_name;
|
||||
$conf->db->user = $dolibarr_main_db_user;
|
||||
$conf->db->pass = $dolibarr_main_db_pass;
|
||||
|
||||
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port);
|
||||
$ok = 0;
|
||||
if ($db->ok == 1)
|
||||
{
|
||||
|
||||
print '<tr><td>'.$langs->trans("DolibarrAdminLogin").' :</td><td>';
|
||||
print '<input name="login" value="'.(! empty($_GET["login"])?$_GET["login"]:$force_install_dolibarrlogin).'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").' :</td><td>';
|
||||
print '<input type="password" name="pass"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PasswordAgain").' :</td><td>';
|
||||
print '<input type="password" name="pass_verif"></td></tr>';
|
||||
print '</table>';
|
||||
print '<tr><td>'.$langs->trans("DolibarrAdminLogin").' :</td><td>';
|
||||
print '<input name="login" value="'.(! empty($_GET["login"])?$_GET["login"]:$force_install_dolibarrlogin).'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Password").' :</td><td>';
|
||||
print '<input type="password" name="pass"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("PasswordAgain").' :</td><td>';
|
||||
print '<input type="password" name="pass_verif"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
if (isset($_GET["error"]) && $_GET["error"] == 1)
|
||||
{
|
||||
print '<br>';
|
||||
print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
|
||||
}
|
||||
if (isset($_GET["error"]) && $_GET["error"] == 1)
|
||||
{
|
||||
print '<br>';
|
||||
print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
|
||||
$err=1;
|
||||
}
|
||||
|
||||
if (isset($_GET["error"]) && $_GET["error"] == 2)
|
||||
{
|
||||
print '<br>';
|
||||
print '<div class="error">';
|
||||
print $langs->trans("PleaseTypePassword");
|
||||
print '</div>';
|
||||
}
|
||||
if (isset($_GET["error"]) && $_GET["error"] == 2)
|
||||
{
|
||||
print '<br>';
|
||||
print '<div class="error">';
|
||||
print $langs->trans("PleaseTypePassword");
|
||||
print '</div>';
|
||||
$err=1;
|
||||
}
|
||||
|
||||
if (isset($_GET["error"]) && $_GET["error"] == 3)
|
||||
{
|
||||
print '<br>';
|
||||
print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
|
||||
}
|
||||
if (isset($_GET["error"]) && $_GET["error"] == 3)
|
||||
{
|
||||
print '<br>';
|
||||
print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
|
||||
$err=1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
pFooter($err,$setuplang);
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -170,11 +170,11 @@ if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
|||
$db->query("UPDATE llx_const set value='eldy_frontoffice.php' WHERE name='MAIN_MENUFRONT_BARRELEFT';");
|
||||
}
|
||||
|
||||
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_INSTALL const', LOG_ERR);
|
||||
dolibarr_install_syslog('install/etape5.php set MAIN_VERSION_LAST_INSTALL const to '.DOL_VERSION, LOG_DEBUG);
|
||||
$db->query("DELETE FROM llx_const WHERE name='MAIN_VERSION_LAST_INSTALL'");
|
||||
$db->query("INSERT INTO llx_const(name,value,type,visible,note) values('MAIN_VERSION_LAST_INSTALL','".DOL_VERSION."','chaine',0,'Dolibarr version for last install')");
|
||||
|
||||
dolibarr_install_syslog('install/etape5.php Remove MAIN_NOT_INSTALLED const', LOG_ERR);
|
||||
dolibarr_install_syslog('install/etape5.php Remove MAIN_NOT_INSTALLED const', LOG_DEBUG);
|
||||
$db->query("DELETE FROM llx_const WHERE name='MAIN_NOT_INSTALLED'");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ require_once('../lib/admin.lib.php');
|
|||
|
||||
// DOL_DOCUMENT_ROOT has been defined in function.inc.php to '..'
|
||||
|
||||
// Define REQUEST["logtohtml"]
|
||||
$REQUEST["logtohtml"]=1;
|
||||
|
||||
// Correction PHP_SELF (ex pour apache via caudium) car PHP_SELF doit valoir URL relative
|
||||
// et non path absolu.
|
||||
if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"])
|
||||
|
|
@ -255,7 +258,8 @@ function pHeader($soutitre,$next,$action='set')
|
|||
|
||||
function pFooter($nonext=0,$setuplang='')
|
||||
{
|
||||
global $langs;
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("admin");
|
||||
|
||||
|
|
@ -272,6 +276,22 @@ function pFooter($nonext=0,$setuplang='')
|
|||
}
|
||||
|
||||
print '</form>'."\n";
|
||||
|
||||
// If there is some logs in buffer to show
|
||||
if (sizeof($conf->logbuffer))
|
||||
{
|
||||
print "\n";
|
||||
print "<!-- Start of log output\n";
|
||||
//print '<div class="hidden">'."\n";
|
||||
foreach($conf->logbuffer as $logline)
|
||||
{
|
||||
print $logline."<br>\n";
|
||||
}
|
||||
//print '</div>'."\n";
|
||||
print "End of log output -->\n";
|
||||
print "\n";
|
||||
}
|
||||
|
||||
print '</body>'."\n";
|
||||
print '</html>'."\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,26 +158,32 @@ function dol_escape_js($stringtoescape)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* \brief Envoi des messages dolibarr dans un fichier ou dans syslog
|
||||
* Pour fichier: fichier defini par SYSLOG_FILE
|
||||
* Pour syslog: facility defini par SYSLOG_FACILITY
|
||||
* \param message Message a tracer. Ne doit pas etre traduit si level = LOG_ERR
|
||||
* \param level Niveau de l'erreur
|
||||
* \brief Write log message in a file or to syslog process
|
||||
* Pour fichier: fichier defined by SYSLOG_FILE
|
||||
* Pour syslog: facility defined by SYSLOG_FACILITY
|
||||
* Warning, les fonctions syslog sont buggues sous Windows et generent des
|
||||
* fautes de protection memoire. Pour resoudre, utiliser le loggage fichier,
|
||||
* au lieu du loggage syslog (configuration du module).
|
||||
* Si SYSLOG_FILE_NO_ERROR defini, on ne gere pas erreur ecriture log
|
||||
* \param message Line to log. Ne doit pas etre traduit si level = LOG_ERR
|
||||
* \param level Log level
|
||||
* \remarks Cette fonction n'a un effet que si le module syslog est active.
|
||||
* Warning, les fonctions syslog sont buggues sous Windows et generent des
|
||||
* fautes de protection memoire. Pour resoudre, utiliser le loggage fichier,
|
||||
* au lieu du loggage syslog (configuration du module).
|
||||
* Si SYSLOG_FILE_NO_ERROR defini, on ne gere pas erreur ecriture log
|
||||
* \remarks On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=LOG_DEBUG=6
|
||||
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||
*/
|
||||
function dolibarr_syslog($message, $level=LOG_INFO)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
global $conf,$user,$langs,$REQUEST;
|
||||
|
||||
// If adding log inside HTML page is required
|
||||
if (! empty($REQUEST['logtohtml']))
|
||||
{
|
||||
$conf->logbuffer[]=strftime("%Y-%m-%d %H:%M:%S",time())." ".$message;
|
||||
|
||||
}
|
||||
|
||||
// If syslog module enabled
|
||||
if (! empty($conf->syslog->enabled))
|
||||
{
|
||||
//print $level.' - '.$conf->global->SYSLOG_LEVEL.' - '.$conf->syslog->enabled." \n";
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ function llxFooter($foot='',$limitIEbug=1)
|
|||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_foot.js"></script>';
|
||||
print '<script type="text/javascript" src="'.DOL_URL_ROOT.'/lib/lib_foot.js"></script>'."\n";
|
||||
}
|
||||
|
||||
// Juste pour eviter bug IE qui reorganise mal div precedents si celui-ci absent
|
||||
|
|
|
|||
|
|
@ -677,13 +677,15 @@ class User extends CommonObject
|
|||
// Nettoyage parametres
|
||||
$this->login = trim($this->login);
|
||||
|
||||
dolibarr_syslog("User::Create login=".$this->login.", user=".(is_object($user)?$user->id:''));
|
||||
dolibarr_syslog("User::Create login=".$this->login.", user=".(is_object($user)?$user->id:''), LOG_DEBUG);
|
||||
|
||||
$error=0;
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql.= " WHERE login ='".addslashes($this->login)."'";
|
||||
|
||||
dolibarr_syslog("User::Create sql=".$sql, LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
|
@ -752,13 +754,15 @@ class User extends CommonObject
|
|||
else
|
||||
{
|
||||
$this->error=$interface->error;
|
||||
dolibarr_syslog("User::Create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
dolibarr_syslog("User::Create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
|
|
@ -766,7 +770,8 @@ class User extends CommonObject
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
dolibarr_syslog("User::Create ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -977,7 +982,7 @@ class User extends CommonObject
|
|||
$sql.= ", note = '".addslashes($this->note)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dolibarr_syslog("User::update sql=".$sql);
|
||||
dolibarr_syslog("User::update sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
|
@ -1117,7 +1122,7 @@ class User extends CommonObject
|
|||
|
||||
$error=0;
|
||||
|
||||
dolibarr_syslog("User::Password user=".$user->id." password=".eregi_replace('.','*',$password)." changelater=".$changelater." notrigger=".$notrigger);
|
||||
dolibarr_syslog("User::setPassword user=".$user->id." password=".eregi_replace('.','*',$password)." changelater=".$changelater." notrigger=".$notrigger, LOG_DEBUG);
|
||||
|
||||
// Si nouveau mot de passe non communique, on genere par module
|
||||
if (! $password)
|
||||
|
|
@ -1146,8 +1151,8 @@ class User extends CommonObject
|
|||
}
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
//dolibarr_syslog("User::Password sql=hidden");
|
||||
dolibarr_syslog("User::Password sql=".$sql);
|
||||
dolibarr_syslog("User::setPassword sql=hidden", LOG_DEBUG);
|
||||
//dolibarr_syslog("User::Password sql=".$sql);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
|
@ -1172,7 +1177,7 @@ class User extends CommonObject
|
|||
if ($result < 0)
|
||||
{
|
||||
$this->error=$adh->error;
|
||||
dolibarr_syslog("User::password ".$this->error,LOG_ERR);
|
||||
dolibarr_syslog("User::setPassword ".$this->error,LOG_ERR);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1214,7 +1219,7 @@ class User extends CommonObject
|
|||
$sql.= " SET pass_temp = '".addslashes($password)."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
// dolibarr_syslog("User::update sql=".$sql); Pas de trace
|
||||
dolibarr_syslog("User::setPassword sql=hidden", LOG_DEBUG); // No log
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user