From bb991b4129ff80faba150cf2328836c92da05c04 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Thu, 23 Jul 2015 15:56:36 +0000 Subject: [PATCH] (legacy) cleanups and dependencies --- src/www/vpn_openvpn_client.php | 27 +++++++++++++-------------- src/www/vpn_openvpn_csc.php | 4 ++-- src/www/vpn_openvpn_server.php | 6 +++--- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/www/vpn_openvpn_client.php b/src/www/vpn_openvpn_client.php index 7c80d9aa0..bfea89639 100644 --- a/src/www/vpn_openvpn_client.php +++ b/src/www/vpn_openvpn_client.php @@ -49,7 +49,7 @@ $openvpn_client_modes = array( $pgtitle = array(gettext("OpenVPN"), gettext("Client")); $shortcut_section = "openvpn"; -if (!is_array($config['openvpn']['openvpn-client'])) { +if (!isset($config['openvpn']['openvpn-client'])) { $config['openvpn']['openvpn-client'] = array(); } @@ -67,22 +67,25 @@ if (!is_array($config['cert'])) { $a_cert =& $config['cert']; -if (!is_array($config['crl'])) { +if (!isset($config['crl']) || !is_array($config['crl'])) { $config['crl'] = array(); } $a_crl =& $config['crl']; -if (is_numericint($_GET['id'])) { +if (isset($_GET['id']) && is_numericint($_GET['id'])) { $id = $_GET['id']; } if (isset($_POST['id']) && is_numericint($_POST['id'])) { $id = $_POST['id']; } -$act = $_GET['act']; if (isset($_POST['act'])) { $act = $_POST['act']; +} elseif (isset($_GET['act'])) { + $act = $_GET['act']; +} else { + $act = null; } if (isset($id) && $a_client[$id]) { @@ -91,7 +94,7 @@ if (isset($id) && $a_client[$id]) { $vpnid = 0; } -if ($_GET['act'] == "del") { +if (isset($_GET['act']) && $_GET['act'] == "del") { if (!isset($a_client[$id])) { redirectHeader("vpn_openvpn_client.php"); exit; @@ -104,7 +107,7 @@ if ($_GET['act'] == "del") { $savemsg = gettext("Client successfully deleted")."
"; } -if ($_GET['act']=="new") { +if (isset($_GET['act']) && $_GET['act']=="new") { $pconfig['autokey_enable'] = "yes"; $pconfig['tlsauth_enable'] = "yes"; $pconfig['autotls_enable'] = "yes"; @@ -118,7 +121,7 @@ if ($_GET['act']=="new") { global $simplefields; $simplefields = array('auth_user','auth_pass'); -if ($_GET['act']=="edit") { +if (isset($_GET['act']) && $_GET['act']=="edit") { if (isset($id) && $a_client[$id]) { foreach ($simplefields as $stat) { $pconfig[$stat] = $a_client[$id][$stat]; @@ -184,7 +187,7 @@ if ($_GET['act']=="edit") { } if ($_POST) { - unset($input_errors); + $input_errors = array(); $pconfig = $_POST; if (isset($id) && $a_client[$id]) { @@ -443,7 +446,7 @@ function useproxy_changed() { function tlsauth_change() { - if (document.iform.tlsauth_enable.checked) document.getElementById("tlsauth_opts").style.display=""; @@ -457,7 +460,7 @@ endif; ?> function autotls_change() { - autocheck = document.iform.autotls_enable.checked;
0) { print_input_errors($input_errors); } diff --git a/src/www/vpn_openvpn_csc.php b/src/www/vpn_openvpn_csc.php index ecfcc5085..4ac06d075 100644 --- a/src/www/vpn_openvpn_csc.php +++ b/src/www/vpn_openvpn_csc.php @@ -29,7 +29,7 @@ require_once("guiconfig.inc"); require_once("openvpn.inc"); require_once("services.inc"); - +require_once("interfaces.inc"); function openvpn_cleanup_csc($common_name) { @@ -45,7 +45,7 @@ function openvpn_delete_csc(&$settings) $pgtitle = array(gettext("OpenVPN"), gettext("Client Specific Override")); $shortcut_section = "openvpn"; -if (!is_array($config['openvpn']['openvpn-csc'])) { +if (!isset($config['openvpn']['openvpn-csc'])) { $config['openvpn']['openvpn-csc'] = array(); } diff --git a/src/www/vpn_openvpn_server.php b/src/www/vpn_openvpn_server.php index 88a6dba3c..3d9170624 100644 --- a/src/www/vpn_openvpn_server.php +++ b/src/www/vpn_openvpn_server.php @@ -85,10 +85,10 @@ if (isset($_POST['id']) && is_numericint($_POST['id'])) { $id = $_POST['id']; } -if (isset($_GET['act'])) { - $act = $_GET['act']; -} elseif (isset($_POST['act'])) { +if (isset($_POST['act'])) { $act = $_POST['act']; +} elseif (isset($_GET['act'])) { + $act = $_GET['act']; } else { $act = null; }