From a3e00d53fc7bad39134422209665cbe9e1aef01d Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 18 May 2015 23:09:55 +0545 Subject: Code style vpn_l2tp --- usr/local/www/vpn_l2tp_users_edit.php | 114 +++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 51 deletions(-) (limited to 'usr/local/www/vpn_l2tp_users_edit.php') diff --git a/usr/local/www/vpn_l2tp_users_edit.php b/usr/local/www/vpn_l2tp_users_edit.php index 2d905a0..4fa0f52 100644 --- a/usr/local/www/vpn_l2tp_users_edit.php +++ b/usr/local/www/vpn_l2tp_users_edit.php @@ -39,17 +39,18 @@ $pgtitle = array(gettext("VPN"),gettext("L2TP"),gettext("User"),gettext("Edit")); $shortcut_section = "l2tps"; -function l2tpusercmp($a, $b) { +function l2tpusercmp($a, $b) { return strcasecmp($a['name'], $b['name']); } -function l2tp_users_sort() { - global $config; +function l2tp_users_sort() { + global $config; - if (!is_array($config['l2tp']['user'])) - return; + if (!is_array($config['l2tp']['user'])) { + return; + } - usort($config['l2tp']['user'], "l2tpusercmp"); + usort($config['l2tp']['user'], "l2tpusercmp"); } require("guiconfig.inc"); @@ -62,10 +63,12 @@ if (!is_array($config['l2tp']['user'])) { } $a_secret = &$config['l2tp']['user']; -if (is_numericint($_GET['id'])) +if (is_numericint($_GET['id'])) { $id = $_GET['id']; -if (isset($_POST['id']) && is_numericint($_POST['id'])) +} +if (isset($_POST['id']) && is_numericint($_POST['id'])) { $id = $_POST['id']; +} if (isset($id) && $a_secret[$id]) { $pconfig['usernamefld'] = $a_secret[$id]['name']; @@ -88,11 +91,13 @@ if ($_POST) { do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); - if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['usernamefld'])) + if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['usernamefld'])) { $input_errors[] = gettext("The username contains invalid characters."); + } - if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['passwordfld'])) + if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['passwordfld'])) { $input_errors[] = gettext("The password contains invalid characters."); + } if (($_POST['passwordfld']) && ($_POST['passwordfld'] != $_POST['passwordfld2'])) { $input_errors[] = gettext("The passwords do not match."); @@ -112,26 +117,29 @@ if ($_POST) { } /* if this is an AJAX caller then handle via JSON */ - if(isAjax() && is_array($input_errors)) { + if (isAjax() && is_array($input_errors)) { input_errors2Ajax($input_errors); exit; } if (!$input_errors) { - if (isset($id) && $a_secret[$id]) + if (isset($id) && $a_secret[$id]) { $secretent = $a_secret[$id]; + } $secretent['name'] = $_POST['usernamefld']; $secretent['ip'] = $_POST['ip']; - if ($_POST['passwordfld']) + if ($_POST['passwordfld']) { $secretent['password'] = $_POST['passwordfld']; + } - if (isset($id) && $a_secret[$id]) + if (isset($id) && $a_secret[$id]) { $a_secret[$id] = $secretent; - else + } else { $a_secret[] = $secretent; + } l2tp_users_sort(); write_config(); @@ -151,43 +159,47 @@ include("head.inc"); -
-
-
- - - - + + + + + + + + + + + + + +
+
+ +
+ + + + - - - - - - - - - - - - - -
-
- -
-  ()
- -
- -
  - - " onclick="window.location.href=''" /> - - - -
-
+
+ +
+  () + +
+ + +
+ +
+
  + + " onclick="window.location.href=''" /> + + + +
+
-- cgit v1.1