Fix: use ajax button on/off
This commit is contained in:
parent
026cf124af
commit
b9ac974013
@ -49,30 +49,35 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
|||||||
dol_add_file_process($upload_dir,0,0);
|
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);
|
$code=$reg[1];
|
||||||
header("Location: security_other.php");
|
$value=(GETPOST($code) ? GETPOST($code) : 1);
|
||||||
|
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
|
||||||
|
{
|
||||||
|
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
exit;
|
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);
|
$code=$reg[1];
|
||||||
header("Location: security_other.php");
|
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
|
||||||
exit;
|
{
|
||||||
}
|
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||||
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;
|
exit;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'MAIN_SESSION_TIMEOUT')
|
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);
|
if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db);
|
||||||
@ -165,13 +170,20 @@ print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
|
|||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if (function_exists("imagecreatefrompng"))
|
if (function_exists("imagecreatefrompng"))
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
print '<a href="security_other.php?action=activate_captcha">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="security_other.php?action=disable_captcha">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_SECURITY_ENABLECAPTCHA">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_SECURITY_ENABLECAPTCHA">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -180,28 +192,29 @@ else
|
|||||||
$desc = $form->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning');
|
$desc = $form->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning');
|
||||||
print $desc;
|
print $desc;
|
||||||
}
|
}
|
||||||
print "</td>";
|
print '</td></tr>';
|
||||||
|
|
||||||
print "</td>";
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Enable advanced perms
|
// Enable advanced perms
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print "<tr ".$bc[$var].">";
|
print "<tr ".$bc[$var].">";
|
||||||
print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
|
print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
if (! empty($conf->use_javascript_ajax))
|
||||||
{
|
{
|
||||||
print '<a href="security_other.php?action=activate_advancedperms">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="security_other.php?action=disable_advancedperms">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_MAIN_USE_ADVANCED_PERMS">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_MAIN_USE_ADVANCED_PERMS">'.img_picto($langs->trans("Enabled"),'on').'</a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print "</td>";
|
print "</td></tr>";
|
||||||
|
|
||||||
print "</td>";
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user