Commit c9687a6f authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(legacy) remove isAjax

Mostly merge from master plus a few more that were still in the
stable/15.7 code base.

(cherry picked from commit 343aa7df)
(cherry picked from commit 692a8f77)
(cherry picked from commit f8b281e9)
(cherry picked from commit 8d2e334b)
(cherry picked from commit b9346703)
(cherry picked from commit 418b13af)
(cherry picked from commit b235235d)
(cherry picked from commit e259289f)
(cherry picked from commit 68fed4c9)
(cherry picked from commit 8757d000)
(cherry picked from commit 33394bdc)
(cherry picked from commit 8cccf2e8)
(cherry picked from commit eb29c782)
(cherry picked from commit 3fcda571)
(cherry picked from commit 4ff0b327)
parent 95e0fdcb
......@@ -290,10 +290,6 @@ function display_error_form($http_code, $desc)
{
global $config, $g;
$g['theme'] = get_current_theme();
if (isAjax()) {
printf(gettext('Error: %s, Description: %s'), $http_code, $desc);
return;
}
?><!doctype html>
<!--[if IE 8 ]><html lang="en" class="ie ie8 lte9 lte8 no-js"><![endif]-->
......@@ -339,11 +335,6 @@ function display_login_form()
unset($input_errors);
if (isAjax()) {
exit;
}
/* Check against locally configured IP addresses, which will catch when someone
port forwards WebGUI access from WAN to an internal IP on the router. */
// fix, local ip check was previously done using "filter_generate_optcfg_array" which basically includes alomst everything here.
......
......@@ -1266,18 +1266,6 @@ function unmute_kernel_msgs()
exec('/sbin/conscontrol mute off');
}
/****f* util/isAjax
* NAME
* isAjax - reports if the request is driven from prototype
* INPUTS
* none
* RESULT
* true/false
******/
function isAjax() {
return isset ($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
}
/****f* util/msort
* NAME
* msort - sort array
......
......@@ -660,28 +660,7 @@ function get_crash_report($pedantic = false)
function redirectHeader($text)
{
global $_SERVER;
if (isAjax()) {
if ($_SERVER['HTTPS'] == 'on') {
$protocol = 'https';
} else {
$protocol = 'http';
}
$port = '';
if (
!($_SERVER['SERVER_PORT'] == '80' && $protocol == 'http') &&
!($_SERVER['SERVER_PORT'] == '443' && $protocol == 'https')
) {
$port = ":{$_SERVER['SERVER_PORT']}";
}
echo "\ndocument.location.href = '{$protocol}://{$_SERVER['SERVER_NAME']}{$port}/{$text}';\n";
} else {
header("Location: $text");
}
header("Location: $text");
}
......
......@@ -85,12 +85,6 @@ if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if ($_POST['apply']) {
$retval = 0;
system_setup_sysctl();
......
......@@ -62,11 +62,6 @@ if ($act == "edit") {
if ($act == "del") {
if ($a_tunable[$id]) {
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if (!$input_errors) {
unset($a_tunable[$id]);
write_config();
......@@ -81,12 +76,6 @@ if ($_POST) {
unset($input_errors);
$pconfig = $_POST;
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if ($_POST['apply']) {
$retval = 0;
system_setup_sysctl();
......
......@@ -330,12 +330,6 @@ if ($_POST) {
}
}
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
/* save modifications */
if (!$input_errors) {
$ca = array();
......
......@@ -385,12 +385,6 @@ if ($_POST) {
}
}
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
/* save modifications */
if (!$input_errors) {
if ($pconfig['method'] == "existing") {
......@@ -520,12 +514,6 @@ if ($_POST) {
$subject_mismatch = true;
}
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
/* save modifications */
if (!$input_errors) {
$cert = $a_cert[$id];
......
......@@ -272,12 +272,6 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
/* save modifications */
if (!$input_errors) {
$result = false;
......
......@@ -74,12 +74,6 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if (!$input_errors) {
if (!is_array($pconfig['sysprivs'])) {
$pconfig['sysprivs'] = array();
......@@ -110,11 +104,6 @@ if ($_POST) {
}
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
print_info_box($savemsg);
}
include("head.inc");
?>
......
......@@ -286,12 +286,6 @@ if (isset($_POST['save'])) {
}
}
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if (count($input_errors)==0) {
$userent = array();
......
......@@ -74,12 +74,6 @@ if ($_POST) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if (!$input_errors) {
if (!is_array($pconfig['sysprivs'])) {
$pconfig['sysprivs'] = array();
......@@ -102,11 +96,6 @@ if ($_POST) {
}
}
/* if ajax is calling, give them an update message */
if (isAjax()) {
print_info_box($savemsg);
}
include("head.inc");
?>
......
......@@ -88,12 +88,6 @@ if ($_POST) {
$input_errors[] = gettext("A valid RADIUS server address must be specified.");
}
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if (!$input_errors) {
$_POST['remoteip'] = $pconfig['remoteip'] = gen_subnet($_POST['remoteip'], $_POST['l2tp_subnet']);
$subnet_start = ip2ulong($_POST['remoteip']);
......@@ -109,12 +103,6 @@ if ($_POST) {
}
}
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if (!$input_errors) {
$l2tpcfg['remoteip'] = $_POST['remoteip'];
$l2tpcfg['localip'] = $_POST['localip'];
......@@ -175,11 +163,6 @@ if ($_POST) {
$retval = 0;
$retval = vpn_l2tp_configure();
$savemsg = get_std_save_message();
/* if ajax is calling, give them an update message */
if (isAjax()) {
print_info_box($savemsg);
}
}
}
......
......@@ -107,12 +107,6 @@ if ($_POST) {
}
}
/* if this is an AJAX caller then handle via JSON */
if (isAjax() && is_array($input_errors)) {
input_errors2Ajax($input_errors);
exit;
}
if (!$input_errors) {
if (isset($id) && $a_secret[$id]) {
$secretent = $a_secret[$id];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment