Commit b0156ef3 authored by Franco Fichtner's avatar Franco Fichtner

ppps: avoid more potential config issues

parent 41e5e457
...@@ -57,8 +57,14 @@ if ($_GET['act'] == "del") { ...@@ -57,8 +57,14 @@ if ($_GET['act'] == "del") {
} }
} }
if (!is_array($config['ppps']['ppp'])) if (!is_array($config['ppps'])) {
$config['ppps'] = array();
}
if (!is_array($config['ppps']['ppp'])) {
$config['ppps']['ppp'] = array(); $config['ppps']['ppp'] = array();
}
$a_ppps = $config['ppps']['ppp']; $a_ppps = $config['ppps']['ppp'];
$pgtitle = gettext("Interfaces: PPPs"); $pgtitle = gettext("Interfaces: PPPs");
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
...@@ -37,8 +38,13 @@ define("CRON_WEEKLY_PATTERN", "0 0 * * 0"); ...@@ -37,8 +38,13 @@ define("CRON_WEEKLY_PATTERN", "0 0 * * 0");
define("CRON_DAILY_PATTERN", "0 0 * * *"); define("CRON_DAILY_PATTERN", "0 0 * * *");
define("CRON_HOURLY_PATTERN", "0 * * * *"); define("CRON_HOURLY_PATTERN", "0 * * * *");
if (!is_array($config['ppps']['ppp'])) if (!is_array($config['ppps'])) {
$config['ppps'] = array();
}
if (!is_array($config['ppps']['ppp'])) {
$config['ppps']['ppp'] = array(); $config['ppps']['ppp'] = array();
}
$a_ppps = &$config['ppps']['ppp']; $a_ppps = &$config['ppps']['ppp'];
......
...@@ -433,17 +433,20 @@ ...@@ -433,17 +433,20 @@
} }
$type = $_POST['selectedtype']; $type = $_POST['selectedtype'];
if (!is_array($config['ppps']['ppp'])) if (!is_array($config['ppps'])) {
$config['ppps'] = array();
}
if (!is_array($config['ppps']['ppp'])) {
$config['ppps']['ppp'] = array(); $config['ppps']['ppp'] = array();
if (count($config['ppps']['ppp'])) { }
foreach ($config['ppps']['ppp'] as $pppid => $ppp) { foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
if ($ppp['ptpid'] == "0") { if ($ppp['ptpid'] == "0") {
if ((substr($config['interfaces']['wan']['if'],0,5) == "pppoe") || (substr($config['interfaces']['wan']['if'],0,4) == "pptp")) { if ((substr($config['interfaces']['wan']['if'],0,5) == "pppoe") || (substr($config['interfaces']['wan']['if'],0,4) == "pptp")) {
$oldif = explode(",", $ppp['ports']); $oldif = explode(",", $ppp['ports']);
$config['interfaces']['wan']['if'] = $oldif[0]; $config['interfaces']['wan']['if'] = $oldif[0];
} }
if ($type == "pppoe" || $type == "pptp") if ($type == "pppoe" || $type == "pptp") {
unset($config['ppps']['ppp'][$pppid]); unset($config['ppps']['ppp'][$pppid]);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment