diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 33914d295b7..5798bcf0462 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -31,43 +31,54 @@ require("./pre.inc.php"); if (!$user->admin) accessforbidden(); +$langs->load("admin"); +$langs->load("other"); + + /* * Actions */ -$optionlogoutput=$_POST["optionlogoutput"]; -if ($optionlogoutput == "syslog") +if ($_POST["action"] == 'setlevel') { - if (defined($_POST["facility"])) - { - dolibarr_del_const($db,"SYSLOG_FILE"); - dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]); - dolibarr_set_const($db,"SYSLOG_LEVEL",$_POST["level"]); - dolibarr_syslog("Admin Syslog: New level ".$_POST["level"]); - Header("Location: syslog.php"); - exit; - } - else - { - print '
'.$langs->trans("ErrorUnknownSyslogConstant",$_POST["facility"]).'
'; - } -} -if ($optionlogoutput == "file") -{ - $file=fopen($_POST["filename"],"a+"); - if ($file) - { - fclose($file); - dolibarr_del_const($db,"SYSLOG_FACILITY"); - dolibarr_set_const($db,"SYSLOG_FILE",$_POST["filename"]); - } - else - { - print '
'.$langs->trans("ErrorFailedToOpenFile",$_POST["filename"]).'
'; - } + dolibarr_set_const($db,"SYSLOG_LEVEL",$_POST["level"]); + dolibarr_syslog("admin/syslog: level ".$_POST["level"]); +} + +if ($_POST["action"] == 'set') +{ + $optionlogoutput=$_POST["optionlogoutput"]; + if ($optionlogoutput == "syslog") + { + if (defined($_POST["facility"])) + { + dolibarr_del_const($db,"SYSLOG_FILE"); + dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"]); + dolibarr_syslog("admin/syslog: facility ".$_POST["facility"]); + Header("Location: syslog.php"); + exit; + } + else + { + print '
'.$langs->trans("ErrorUnknownSyslogConstant",$_POST["facility"]).'
'; + } + } + if ($optionlogoutput == "file") + { + $file=fopen($_POST["filename"],"a+"); + if ($file) + { + fclose($file); + dolibarr_del_const($db,"SYSLOG_FACILITY"); + dolibarr_set_const($db,"SYSLOG_FILE",$_POST["filename"]); + dolibarr_syslog("admin/syslog: file ".$_POST["filename"]); + } + else + { + print '
'.$langs->trans("ErrorFailedToOpenFile",$_POST["filename"]).'
'; + } + } } -$langs->load("admin"); -$langs->load("other"); llxHeader(); @@ -87,6 +98,7 @@ if (! $defaultsyslogfile) $defaultsyslogfile='dolibarr.log'; */ print_titre($langs->trans("SyslogOutput")); +// Mode print '
'; print ''; print ''; @@ -97,19 +109,7 @@ print "\n"; $var=true; $var=!$var; print ""; -print ''; +print ''; $var=!$var; print ""; @@ -118,5 +118,30 @@ print '
".$langs->trans("SyslogSyslog")."'.$langs->trans("SyslogFacility").': '; -print '   '; -print $langs->trans("SyslogLevel").':
'.$langs->trans("SyslogFacility").':
".$langs->trans("SyslogSimpleFile")."'.$langs->trans("SyslogFilename").': \n"; print "\n"; +// Level +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; +$var=true; +$var=!$var; +print ''; +print ''; +print '
'.$langs->trans("Type").''.$langs->trans("Parameter").'
'.$langs->trans("SyslogLevel").''; +print '
'; +print "
\n"; + llxFooter('$Date$ - $Revision$'); ?>