diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index f761ff03b72..278cb00238b 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -74,12 +74,10 @@ if ($action == 'COMPANY_USE_SEARCH_TO_SELECT') if (! $res > 0) $error++; if (! $error) { - $db->commit(); $mesg = "".$langs->trans("SetupSaved").""; } else { - $db->rollback(); $mesg = "".$langs->trans("Error").""; } } diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 8ad476207c3..bedb7321d67 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -32,51 +32,92 @@ accessforbidden(); $langs->load("admin"); $langs->load("other"); +$action = GETPOST("action"); /* * Actions */ -if (! empty($_POST["action"]) && $_POST["action"] == 'setlevel') +if ($action== 'setlevel') { - dolibarr_set_const($db,"SYSLOG_LEVEL",$_POST["level"],'chaine',0,'',0); - dol_syslog("admin/syslog: level ".$_POST["level"]); + $level = GETPOST("level"); + $res = dolibarr_set_const($db,"SYSLOG_LEVEL",$level,'chaine',0,'',0); + dol_syslog("admin/syslog: level ".$level); + + if (! $res > 0) $error++; + if (! $error) + { + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $mesg = "".$langs->trans("Error").""; + } } -if (! empty($_POST["action"]) && $_POST["action"] == 'set') +if ($action == 'set') { - $optionlogoutput=$_POST["optionlogoutput"]; + $optionlogoutput=GETPOST("optionlogoutput"); + $facility=GETPOST("facility"); if ($optionlogoutput == "syslog") { if (defined($_POST["facility"])) { + $db->begin; // Only LOG_USER supported on Windows - if (! empty($_SERVER["WINDIR"])) $_POST["facility"]='LOG_USER'; + if (! empty($_SERVER["WINDIR"])) $facility='LOG_USER'; - dolibarr_del_const($db,"SYSLOG_FILE",0); - dolibarr_set_const($db,"SYSLOG_FACILITY",$_POST["facility"],'chaine',0,'',0); - dol_syslog("admin/syslog: facility ".$_POST["facility"]); + $res = dolibarr_del_const($db,"SYSLOG_FILE",0); + if (! $res > 0) $error++; + $res = dolibarr_set_const($db,"SYSLOG_FACILITY",$facility,'chaine',0,'',0); + if (! $res > 0) $error++; + dol_syslog("admin/syslog: facility ".$facility); + if (! $error) + { + $db->commit(); + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $db->rollback(); + $mesg = "".$langs->trans("Error").""; + } } else { - print '