mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Add: ajout d'un rpertoire par dfaut pour les logs dans /documents/entity_1/logs
cr l'activation du module syslog, on peut toujours modifier le chemin si on souhaite mettre ce fichier un autre endroit.
This commit is contained in:
parent
18a1b9188d
commit
8a1d511da4
File diff suppressed because one or more lines are too long
|
|
@ -62,11 +62,25 @@ if (! empty($_POST["action"]) && $_POST["action"] == 'set')
|
|||
print '<div class="error">'.$langs->trans("ErrorUnknownSyslogConstant",$_POST["facility"]).'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($optionlogoutput == "file")
|
||||
{
|
||||
$filelog=$_POST["filename"];
|
||||
$filelog=eregi_replace('DOL_DATA_ROOT',DOL_DATA_ROOT,$filelog);
|
||||
$filelog = $_POST["filename"];
|
||||
|
||||
if (eregi('(^[A-Za-z0-9_\-\\/:]+[\\/]+)([A-Za-z0-9_\-]+[.]?[A-Za-z0-9]+)?$', $filelog))
|
||||
{
|
||||
if (eregi('DOL_DATA_ROOT', $filelog))
|
||||
{
|
||||
$filelog = eregi_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, $filelog);
|
||||
}
|
||||
}
|
||||
else if ($conf->syslog->dir_output)
|
||||
{
|
||||
$filelog = $conf->syslog->dir_output."/".$filelog;
|
||||
}
|
||||
|
||||
$file=fopen($filelog,"a+");
|
||||
|
||||
if ($file)
|
||||
{
|
||||
fclose($file);
|
||||
|
|
@ -88,14 +102,16 @@ if (! empty($_POST["action"]) && $_POST["action"] == 'set')
|
|||
|
||||
llxHeader();
|
||||
|
||||
$html=new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print_fiche_titre($langs->trans("SyslogSetup"),$linkback,'setup');
|
||||
print '<br>';
|
||||
|
||||
$def = array();
|
||||
|
||||
$syslogfacility=$defaultsyslogfacility=dolibarr_get_const($db,"SYSLOG_FACILITY");
|
||||
$syslogfile=$defaultsyslogfile=dolibarr_get_const($db,"SYSLOG_FILE");
|
||||
$syslogfacility=$defaultsyslogfacility=dolibarr_get_const($db,"SYSLOG_FACILITY",$conf->entity);
|
||||
$syslogfile=$defaultsyslogfile=dolibarr_get_const($db,"SYSLOG_FILE",$conf->entity);
|
||||
|
||||
if (! $defaultsyslogfacility) $defaultsyslogfacility='LOG_USER';
|
||||
if (! $defaultsyslogfile) $defaultsyslogfile='dolibarr.log';
|
||||
|
|
@ -109,19 +125,20 @@ print '<input type="hidden" name="action" value="set">';
|
|||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '<td align="right" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td width=\"140\"><input ".$bc[$var]." type=\"radio\" name=\"optionlogoutput\" value=\"syslog\" ".($syslogfacility?" checked":"")."> ".$langs->trans("SyslogSyslog")."</td>";
|
||||
print '<td colspan="2">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" value="'.$defaultsyslogfacility.'">';
|
||||
print '<td colspan="3">'.$langs->trans("SyslogFacility").': <input type="text" class="flat" name="facility" value="'.$defaultsyslogfacility.'">';
|
||||
print ' '.img_info('Only LOG_USER supported on Windows');
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td width=\"140\"><input ".$bc[$var]." type=\"radio\" name=\"optionlogoutput\" value=\"file\"".($syslogfile?" checked":"")."> ".$langs->trans("SyslogSimpleFile")."</td>";
|
||||
print '<td colspan="2">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" size="60" value="'.$defaultsyslogfile.'">';
|
||||
print ' '.img_info($langs->trans("YouCanUseDOL_DATA_ROOT"));
|
||||
print '<td width="250" nowrap>'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" size="60" value="'.$defaultsyslogfile.'"></td>';
|
||||
$htmltext = $langs->trans("SyslogFilenameDesc",$conf->syslog->dir_output);
|
||||
print "<td align=\"left\">".$html->textwithhelp('',$htmltext);
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class Conf
|
|||
{
|
||||
$module=strtolower($reg[1]);
|
||||
$dir_name="dir_".strtolower($reg[2]);
|
||||
$this->$module->$dir_name = DOL_DATA_ROOT."/entity_".$this->entity."/".$value;
|
||||
$this->$module->$dir_name = DOL_DATA_ROOT."/entity_".$this->entity.$value;
|
||||
}
|
||||
// If this is a module constant
|
||||
if (eregi('^MAIN_MODULE_([A-Z]+)$',$key,$reg) && $value)
|
||||
|
|
|
|||
|
|
@ -56,8 +56,12 @@ class modSyslog extends DolibarrModules
|
|||
$this->special = 2;
|
||||
//$this->picto='phoning';
|
||||
|
||||
// Dir
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
$r=0;
|
||||
|
||||
$this->dirs[$r][0] = "output";
|
||||
$this->dirs[$r][1] = "/logs";
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array("syslog.php");
|
||||
|
|
|
|||
|
|
@ -925,7 +925,7 @@ SyslogFacility=Facility
|
|||
SyslogLevel=Level
|
||||
SyslogSimpleFile=File
|
||||
SyslogFilename=File name and path
|
||||
YouCanUseDOL_DATA_ROOT=You can user DOL_DATA_ROOT/dolibarr.log for a log file in Dolibarr documents directory.
|
||||
SyslogFilenameDesc = This log file is located by default in the directory:<br><b>%s</b><br><br>You can set a different path to store this file.
|
||||
ErrorUnknownSyslogConstant=Constant %s is not a known syslog constant
|
||||
##### Donations #####
|
||||
DonationsSetup=Donation module setup
|
||||
|
|
|
|||
|
|
@ -924,7 +924,7 @@ SyslogFacility = Facility
|
|||
SyslogLevel = Niveau
|
||||
SyslogSimpleFile = Fichier
|
||||
SyslogFilename = Nom et chemin du fichier
|
||||
YouCanUseDOL_DATA_ROOT = Vous pouvez utiliser DOL_DATA_ROOT/dolibarr.log pour une log dans le répertoire 'documents' de Dolibarr.
|
||||
SyslogFilenameDesc = Ce fichier de log est situé par défaut dans le répertoire:<br><b>%s</b><br><br>Vous pouvez néanmoins définir un chemin différent pour stocker ce fichier.
|
||||
ErrorUnknownSyslogConstant = La constante %s n'est pas une constante syslog connue
|
||||
##### Donations ##### = undefined
|
||||
DonationsSetup = Configuration du module Dons
|
||||
|
|
|
|||
|
|
@ -183,8 +183,22 @@ function dol_syslog($message, $level=LOG_INFO)
|
|||
// Check if log is to a file (SYSLOG_FILE defined) or to syslog
|
||||
if (defined("SYSLOG_FILE") && SYSLOG_FILE)
|
||||
{
|
||||
$filelog=SYSLOG_FILE;
|
||||
$filelog=eregi_replace('DOL_DATA_ROOT',DOL_DATA_ROOT,$filelog);
|
||||
if (eregi('(^[A-Za-z0-9_\-\\/:]+[\\/]+)([A-Za-z0-9_\-]+[.]?[A-Za-z0-9]+)?$', SYSLOG_FILE))
|
||||
{
|
||||
if (eregi('DOL_DATA_ROOT', SYSLOG_FILE))
|
||||
{
|
||||
$filelog = eregi_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, $filelog);
|
||||
}
|
||||
else
|
||||
{
|
||||
$filelog = SYSLOG_FILE;
|
||||
}
|
||||
}
|
||||
else if ($conf->syslog->dir_output)
|
||||
{
|
||||
$filelog = $conf->syslog->dir_output."/".SYSLOG_FILE;
|
||||
}
|
||||
|
||||
if (defined("SYSLOG_FILE_NO_ERROR")) $file=@fopen($filelog,"a+");
|
||||
else $file=fopen($filelog,"a+");
|
||||
|
||||
|
|
@ -2615,10 +2629,10 @@ function dol_textishtml($msg,$option=0)
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Effectue les substitutions des mots cl<EFBFBD>s par les donn<EFBFBD>es en fonction du tableau
|
||||
* \brief Effectue les substitutions des mots cles par les donnees en fonction du tableau
|
||||
* \param chaine Chaine dans laquelle faire les substitutions
|
||||
* \param substitutionarray Tableau cl<EFBFBD> substitution => valeur a mettre
|
||||
* \return string Chaine avec les substitutions effectu<EFBFBD>es
|
||||
* \param substitutionarray Tableau cle substitution => valeur a mettre
|
||||
* \return string Chaine avec les substitutions effectuees
|
||||
*/
|
||||
function make_substitutions($chaine,$substitutionarray)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -347,30 +347,30 @@ class Translate {
|
|||
*/
|
||||
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
|
||||
{
|
||||
if ($this->getTransFromTab($key))
|
||||
{
|
||||
// Translation is available
|
||||
$str=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
|
||||
if ($maxsize) $str=dol_trunc($str,$maxsize);
|
||||
// On remplace les tags HTML par __xx__ pour eviter traduction par htmlentities
|
||||
$newstr=ereg_replace('<','__lt__',$str);
|
||||
$newstr=ereg_replace('>','__gt__',$newstr);
|
||||
$newstr=ereg_replace('"','__quot__',$newstr);
|
||||
if ($this->getTransFromTab($key))
|
||||
{
|
||||
// Translation is available
|
||||
$str=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
|
||||
if ($maxsize) $str=dol_trunc($str,$maxsize);
|
||||
// On remplace les tags HTML par __xx__ pour eviter traduction par htmlentities
|
||||
$newstr=ereg_replace('<','__lt__',$str);
|
||||
$newstr=ereg_replace('>','__gt__',$newstr);
|
||||
$newstr=ereg_replace('"','__quot__',$newstr);
|
||||
|
||||
$newstr=$this->convToOutputCharset($newstr); // Convert string to $this->charset_output
|
||||
|
||||
$newstr=$this->convToOutputCharset($newstr); // Convert string to $this->charset_output
|
||||
// Cryptage en html de la chaine
|
||||
// $newstr est une chaine stockee en memoire au format $this->charset_output
|
||||
$newstr=htmlentities($newstr,ENT_QUOTES,$this->charset_output);
|
||||
|
||||
// Cryptage en html de la chaine
|
||||
// $newstr est une chaine stockee en memoire au format $this->charset_output
|
||||
$newstr=htmlentities($newstr,ENT_QUOTES,$this->charset_output);
|
||||
|
||||
// On restaure les tags HTML
|
||||
$newstr=ereg_replace('__lt__','<',$newstr);
|
||||
$newstr=ereg_replace('__gt__','>',$newstr);
|
||||
$newstr=ereg_replace('__quot__','"',$newstr);
|
||||
return $newstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// On restaure les tags HTML
|
||||
$newstr=ereg_replace('__lt__','<',$newstr);
|
||||
$newstr=ereg_replace('__gt__','>',$newstr);
|
||||
$newstr=ereg_replace('__quot__','"',$newstr);
|
||||
return $newstr;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Translation is not available
|
||||
$newstr=$key;
|
||||
if (eregi('CurrencyShort([A-Z]+)$',$key,$reg))
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_NOT_INSTA
|
|||
insert into llx_const (name, value, type, note, visible) values ('MAIN_MONNAIE','EUR','chaine','Monnaie',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_POPUP_CALENDAR','eldy','chaine','Popup calendar module',0);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible) values ('SYSLOG_FILE','DOL_DATA_ROOT/dolibarr.log','chaine','Directory where to write log file',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('SYSLOG_FILE','dolibarr.log','chaine','Directory where to write log file',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('SYSLOG_LEVEL','6','chaine','Level of debug info to show',0);
|
||||
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_MAIL_SMTP_SERVER','','chaine','Host or ip address for SMTP server',0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user