From b5cd617e8644f3ee46ee9f9cccff484b7fb0faaf Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 18 Mar 2016 16:52:38 +0100 Subject: [PATCH] (legacy) quick refactor of vpn_pptp.php --- src/www/vpn_pptp.php | 672 +++++++++++++++++++------------------------ 1 file changed, 300 insertions(+), 372 deletions(-) diff --git a/src/www/vpn_pptp.php b/src/www/vpn_pptp.php index cad25e260..16fe8a51f 100644 --- a/src/www/vpn_pptp.php +++ b/src/www/vpn_pptp.php @@ -1,30 +1,30 @@ . - All rights reserved. + Copyright (C) 2014-2016 Deciso B.V. + Copyright (C) 2003-2005 Manuel Kasper . + All rights reserved. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ require_once('guiconfig.inc'); @@ -41,31 +41,31 @@ if (!is_array($config['pptpd']['radius'])) { } $pptpcfg = &$config['pptpd']; -$pconfig['remoteip'] = $pptpcfg['remoteip']; -$pconfig['localip'] = $pptpcfg['localip']; -$pconfig['redir'] = $pptpcfg['redir']; -$pconfig['mode'] = $pptpcfg['mode']; -$pconfig['wins'] = $pptpcfg['wins']; -$pconfig['req128'] = isset($pptpcfg['req128']); -$pconfig['n_pptp_units'] = $pptpcfg['n_pptp_units']; -$pconfig['pptp_dns1'] = $pptpcfg['dns1']; -$pconfig['pptp_dns2'] = $pptpcfg['dns2']; -$pconfig['radiusenable'] = isset($pptpcfg['radius']['server']['enable']); -$pconfig['radiusissueips'] = isset($pptpcfg['radius']['radiusissueips']); -$pconfig['radiussecenable'] = isset($pptpcfg['radius']['server2']['enable']); -$pconfig['radacct_enable'] = isset($pptpcfg['radius']['accounting']); -$pconfig['radiusserver'] = $pptpcfg['radius']['server']['ip']; -$pconfig['radiusserverport'] = $pptpcfg['radius']['server']['port']; -$pconfig['radiusserveracctport'] = $pptpcfg['radius']['server']['acctport']; -$pconfig['radiussecret'] = $pptpcfg['radius']['server']['secret']; -$pconfig['radiusserver2'] = $pptpcfg['radius']['server2']['ip']; -$pconfig['radiusserver2port'] = $pptpcfg['radius']['server2']['port']; -$pconfig['radiusserver2acctport'] = $pptpcfg['radius']['server2']['acctport']; -$pconfig['radiussecret2'] = $pptpcfg['radius']['server2']['secret2']; -$pconfig['radius_acct_update'] = $pptpcfg['radius']['acct_update']; -$pconfig['radius_nasip'] = $pptpcfg['radius']['nasip']; - -if ($_POST) { +if ($_SERVER['REQUEST_METHOD'] === 'GET') { + $pconfig['remoteip'] = $pptpcfg['remoteip']; + $pconfig['localip'] = $pptpcfg['localip']; + $pconfig['redir'] = $pptpcfg['redir']; + $pconfig['mode'] = $pptpcfg['mode']; + $pconfig['wins'] = $pptpcfg['wins']; + $pconfig['req128'] = isset($pptpcfg['req128']); + $pconfig['n_pptp_units'] = $pptpcfg['n_pptp_units']; + $pconfig['pptp_dns1'] = $pptpcfg['dns1']; + $pconfig['pptp_dns2'] = $pptpcfg['dns2']; + $pconfig['radiusenable'] = isset($pptpcfg['radius']['server']['enable']); + $pconfig['radiusissueips'] = isset($pptpcfg['radius']['radiusissueips']); + $pconfig['radiussecenable'] = isset($pptpcfg['radius']['server2']['enable']); + $pconfig['radacct_enable'] = isset($pptpcfg['radius']['accounting']); + $pconfig['radiusserver'] = $pptpcfg['radius']['server']['ip']; + $pconfig['radiusserverport'] = $pptpcfg['radius']['server']['port']; + $pconfig['radiusserveracctport'] = $pptpcfg['radius']['server']['acctport']; + $pconfig['radiussecret'] = $pptpcfg['radius']['server']['secret']; + $pconfig['radiusserver2'] = $pptpcfg['radius']['server2']['ip']; + $pconfig['radiusserver2port'] = $pptpcfg['radius']['server2']['port']; + $pconfig['radiusserver2acctport'] = $pptpcfg['radius']['server2']['acctport']; + $pconfig['radiussecret2'] = $pptpcfg['radius']['server2']['secret2']; + $pconfig['radius_acct_update'] = $pptpcfg['radius']['acct_update']; + $pconfig['radius_nasip'] = $pptpcfg['radius']['nasip']; +} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { if (isset($input_errors) && count($input_errors) > 0) { unset($input_errors); } @@ -197,341 +197,269 @@ if ($_POST) { } $service_hook = 'pptpd'; - +legacy_html_escape_form_data($pconfig); include("head.inc"); ?> - - -
-
-
- - - 0) { +
+
+
+ 0) { print_input_errors($input_errors); } ?> - - ' . - gettext('Read more') . '.', - 'danger' - ); ?> - -
- -
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - /> -
  - - /> - :
- -
- .
  - /> -
- -
-
- -
- . -
- . -
-
- .
- -
- .
-
- -
- -
-
-
- -
- /> -
- .
-
- /> -
-
.
-
- /> -
-
-
- /> - -
. -
- -
- -
- - - -
- .
- -
- .
- - - -
- .
- -
- .
  - /> -
- .
  - " onclick="enable_change(true)" /> -
 ','') ?>
-
-
- -
-
-
-
-
- - + ' . + gettext('Read more') . '.', + 'danger' + ); ?> +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ /> +
+ /> + : +
+ + +
+ /> + +
+ + +
+ + +
+ + +
+
+ + +
+ +
+ /> +
+ + /> +
+ + /> +
+ + /> + + +
+ +
+ + +
+ + + + + + + + + + + + + + + +
+ +
+ + +
+ + + + + + + + + + + + + + + +
+ +
+ + +
+ /> + + +
+ " /> +
','') ?>
+
+
+
+
+
+
+