support saving via ajax

This commit is contained in:
Uwe Steinmann 2025-04-02 08:04:56 +02:00
parent f8ceb0d56a
commit c2d8b383c3

View File

@ -321,15 +321,21 @@ if ($action == "saveSettings")
// -------------------------------------------------------------------------
// save
// -------------------------------------------------------------------------
if (!$settings->save())
UI::exitError(getMLText("admin_tools"),getMLText("settings_SaveError"));
if (!$settings->save()) {
if(isAjax()) {
echo json_encode(array('success'=>false, 'msg'=>getMLText('settings_SaveError')));
exit;
} else {
UI::exitError(getMLText("admin_tools"),getMLText("settings_SaveError"));
}
}
add_log_line(".php&action=savesettings");
}
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_settings_saved')));
header("Location:../out/out.Settings.php?currenttab=".$_POST['currenttab']);
?>
if(isAjax()) {
echo json_encode(array('success'=>true, 'msg'=>getMLText('splash_settings_saved')));
} else {
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_settings_saved')));
header("Location:../out/out.Settings.php?currenttab=".$_POST['currenttab']);
}