summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/status_services.php
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-04-18 14:27:11 -0400
committerStephen Beaver <sbeaver@netgate.com>2016-04-18 14:27:11 -0400
commitdca4eadf2a7da5f60359f10843d1e107dd09c6a1 (patch)
tree78c95b2ec23b832f00b50e3f290e08aebc73fda6 /src/usr/local/www/status_services.php
parentbf1a013f15732ee3210e814ad0bfa23d3a7ba1eb (diff)
downloadpfsense-dca4eadf2a7da5f60359f10843d1e107dd09c6a1.zip
pfsense-dca4eadf2a7da5f60359f10843d1e107dd09c6a1.tar.gz
Convert status_services and widget to POST
Diffstat (limited to 'src/usr/local/www/status_services.php')
-rwxr-xr-xsrc/usr/local/www/status_services.php128
1 files changed, 17 insertions, 111 deletions
diff --git a/src/usr/local/www/status_services.php b/src/usr/local/www/status_services.php
index 59bbd78..1753b4f 100755
--- a/src/usr/local/www/status_services.php
+++ b/src/usr/local/www/status_services.php
@@ -64,36 +64,26 @@ require_once("guiconfig.inc");
require_once("service-utils.inc");
require_once("shortcuts.inc");
-// Leave GET enabled in case any other pages use it.
-// ToDo: Check other pages and remove GET completely
-if (!$_GET && $_POST) {
- $_GET = $_POST;
-}
-
-$service_name = '';
-if (isset($_GET['service'])) {
- $service_name = htmlspecialchars($_GET['service']);
-}
-
-if (!empty($service_name)) {
- switch ($_GET['mode']) {
- case "restartservice":
- $savemsg = service_control_restart($service_name, $_GET);
- break;
- case "startservice":
- $savemsg = service_control_start($service_name, $_GET);
- break;
- case "stopservice":
- $savemsg = service_control_stop($service_name, $_GET);
- break;
+if ($_REQUEST['ajax']) {
+ if (isset($_REQUEST['service'])) {
+ $service_name = htmlspecialchars($_REQUEST['service']);
}
- sleep(5);
-}
-
+ if (!empty($service_name)) {
+ switch ($_REQUEST['mode']) {
+ case "restartservice":
+ $savemsg = service_control_restart($service_name, $_REQUEST);
+ break;
+ case "startservice":
+ $savemsg = service_control_start($service_name, $_REQUEST);
+ break;
+ case "stopservice":
+ $savemsg = service_control_stop($service_name, $_REQUEST);
+ break;
+ }
+ sleep(5);
+ }
-/* batch mode, allow other scripts to call this script */
-if ($_GET['batch']) {
exit;
}
@@ -197,89 +187,5 @@ if (count($services) > 0) {
} else {
print_info_box(gettext("No services found."), 'danger');
}
-?>
-<script type="text/javascript">
-//<![CDATA[
-events.push(function() {
- // If a restart button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=restartservice-]').click(function(event) {
- $('#mode').val('restartservice');
- $('#service').val(this.id.replace("restartservice-", ""));
- $(this).parents('form').submit();
- });
- // If a stop button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=stopservice-]').click(function(event) {
- $('#mode').val('stopservice');
- $('#service').val(this.id.replace("stopservice-", ""));
- $(this).parents('form').submit();
- });
-
- // If a start button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=startservice-]').click(function(event) {
- $('#mode').val('startservice');
- $('#service').val(this.id.replace("startservice-", ""));
- $(this).parents('form').submit();
- });
-
- // If an openvpn start button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=openvpn-startservice-]').click(function(event) {
- var args = this.id.split('-');
- $('#mode').val('startservice');
- $('#service').val('openvpn');
- $('#id').val(args[3]);
- $('#vpnmode').val(args[2]);
- $(this).parents('form').submit();
- });
-
- // If an openvpn restart button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=openvpn-restartservice-]').click(function(event) {
- var args = this.id.split('-');
- $('#mode').val('restartservice');
- $('#service').val('openvpn');
- $('#id').val(args[3]);
- $('#vpnmode').val(args[2]);
- $(this).parents('form').submit();
- });
-
- // If an openvpn stop button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=openvpn-stopservice-]').click(function(event) {
- var args = this.id.split('-');
- $('#mode').val('stopservice');
- $('#service').val('openvpn');
- $('#id').val(args[3]);
- $('#vpnmode').val(args[2]);
- $(this).parents('form').submit();
- });
-
- // If a captiveportal start button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=captiveportal-startservice-]').click(function(event) {
- var args = this.id.split('-');
- $('#mode').val('startservice');
- $('#service').val('captiveportal');
- $('#zone').val(args[2]);
- $(this).parents('form').submit();
- });
-
- // If a captiveportal restart button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=captiveportal-restartservice-]').click(function(event) {
- var args = this.id.split('-');
- $('#mode').val('restartservice');
- $('#service').val('captiveportal');
- $('#zone').val(args[2]);
- $(this).parents('form').submit();
- });
-
- // If a captiveportal stop button is clicked, populate the hidden inputs and submit the form (via POST)
- $('[id^=captiveportal-stopservice-]').click(function(event) {
- var args = this.id.split('-');
- $('#mode').val('stopservice');
- $('#service').val('captiveportal');
- $('#zone').val(args[2]);
- $(this).parents('form').submit();
- });
-});
-//]]>
-</script>
-<?php
include("foot.inc");
OpenPOWER on IntegriCloud