unset($_POST["hostname"]); if (isset($action)) { switch ($action) { case "register": if (isset($hostname) && isset($client_ip) && secure_insert($SQL, $table, $hostname, $client_ip)) { echo "ok"; } else { echo "error"; } break; case "enable": if (isset($hostname) && isset($client_ip) && isset($passwd)) { Logger::warning('ha', "Configuration files has been written!"); set_response_xml(0, _("Host activation has been done successfully!")); $ret = ShellExec::exec_shell_cmd("register", $client_ip, $hostname, $passwd); } else { set_response_xml(1, _("An error occured in POST request activation!")); } break; case "disable": $ret = ShellExec::exec_shell_cmd("unregister", "0", "0", "0"); set_response_xml(0, _("Deleting host has been done successfully!")); break; default: set_response_xml(1, _("Request is not well formatted!")); break; } } else { set_response_xml(1, _("Request is not well formatted!")); } die;
break; } else { popup_error(sprintf(_('Cannot query slave host at address %s'), $s_ip)); break; } } else { popup_error(_('An error occured during disabling, can not disable host!')); } } } break; case "reload_vip": $prefs = Preferences::getInstance(); $all_prefs = $prefs->get('HA', 'high_availability'); if (isset($all_prefs["VIP"])) { $ret = ShellExec::exec_shell_cmd("reload_vip", $all_prefs["VIP"], "0", "0"); checkConfigurationHasChanged(true); popup_info(_('Changing configuration... Please wait a few seconds')); } else { popup_error(_('Changing configuration failded... Verify configuration at field HA::Virtual IP')); } break; case "delete": deleteAllUnregisteredServers($SQL, $table); break; case "update_vip": if (isset($_POST["ha_vip"])) { if (validateIpAddress($_POST["ha_vip"])) { $t = updateVIP($_POST["ha_vip"]); redirect("configuration.php"); } else {