diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index dab17330f27..a77e70deb45 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -49,30 +49,35 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) dol_add_file_process($upload_dir,0,0); } -if ($action == 'activate_captcha') +if (preg_match('/set_(.*)/',$action,$reg)) { - dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity); - header("Location: security_other.php"); - exit; + $code=$reg[1]; + $value=(GETPOST($code) ? GETPOST($code) : 1); + if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } -else if ($action == 'disable_captcha') + +else if (preg_match('/del_(.*)/',$action,$reg)) { - dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity); - header("Location: security_other.php"); - exit; -} -else if ($action == 'activate_advancedperms') -{ - dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity); - header("Location: security_other.php"); - exit; -} -else if ($action == 'disable_advancedperms') -{ - dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity); - header("Location: security_other.php"); - exit; + $code=$reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } } + else if ($action == 'MAIN_SESSION_TIMEOUT') { if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); @@ -165,14 +170,21 @@ print '