From 54ae88aea3d41658b5465fb8bad2ae0e0a9fb593 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 10 Aug 2017 22:29:40 +0200 Subject: [PATCH] interfaces: correct content-type match, it can have ;charset etc. suffix PR: https://forum.opnsense.org/index.php?topic=5709.0 --- src/www/interfaces.php | 4 ++-- src/www/system_gateways_edit.php | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/www/interfaces.php b/src/www/interfaces.php index 1702e1755..fec555525 100644 --- a/src/www/interfaces.php +++ b/src/www/interfaces.php @@ -1400,7 +1400,7 @@ include("head.inc"); type: 'post', data: 'isAjax=true&ipprotocol=inet' + defaultgw + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip), error: function(request, textStatus, errorThrown){ - if (textStatus === "error" && request.getResponseHeader("Content-Type") === "text/plain") { + if (textStatus === "error" && request.getResponseHeader("Content-Type").indexOf("text/plain") === 0) { alert(request.responseText); } else { alert("Sorry, we could not create your IPv4 gateway at this time."); @@ -1433,7 +1433,7 @@ include("head.inc"); type: 'post', data: 'isAjax=true&ipprotocol=inet6' + defaultgw + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip), error: function(request, textStatus, errorThrown){ - if (textStatus === "error" && request.getResponseHeader("Content-Type") === "text/plain") { + if (textStatus === "error" && request.getResponseHeader("Content-Type").indexOf("text/plain") === 0) { alert(request.responseText); } else { alert("Sorry, we could not create your IPv6 gateway at this time."); diff --git a/src/www/system_gateways_edit.php b/src/www/system_gateways_edit.php index d3306f92d..95ce65b38 100644 --- a/src/www/system_gateways_edit.php +++ b/src/www/system_gateways_edit.php @@ -437,9 +437,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!empty($_REQUEST['isAjax'])) { header("HTTP/1.0 500 Internal Server Error"); header("Content-type: text/plain"); - foreach ($input_errors as $error) { - echo("$error\n"); - } + echo implode("\n\n", $input_errors); exit; }