From 931788ad45b4f1114e97e6ac2869ab84efa767e2 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Mon, 13 Jun 2016 11:23:09 +0200 Subject: Per router options to disable/enable IP versions. Remove the global options to disable/enable IPv6 or IPv4. These options can now be used on the router configuration level, which seems more appropriate. --- index.php | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 5cef958..9b90915 100644 --- a/index.php +++ b/index.php @@ -30,6 +30,8 @@ final class LookingGlass { private $routers; function __construct($config) { + set_defaults_for_routers($config); + $this->release = $config['release']; $this->frontpage = $config['frontpage']; $this->contact = $config['contact']; @@ -44,14 +46,24 @@ final class LookingGlass { $first = true; foreach (array_keys($this->routers) as $router) { + // IPv6 and IPv4 both disabled for the router, ignore it + if ($this->routers[$router]['disable_ipv6'] && + $this->routers[$router]['disable_ipv4']) { + continue; + } + + print(''); - } else { - print(''); + print(' selected="selected"'); } + print('>'.$this->routers[$router]['desc']); + if ($this->routers[$router]['disable_ipv6']) { + print(' (IPv4 only)'); + } else if ($this->routers[$router]['disable_ipv4']) { + print(' (IPv6 only)'); + } + print(''); } print(''); @@ -112,17 +124,6 @@ final class LookingGlass { } private function render_content() { - if ($this->misc['disable_ipv6'] && $this->misc['disable_ipv4']) { - print('
'); - print('Configuration error!
'); - print('It looks like you have disabled IPv6 and IPv4. Do you want to do any networking someday?
'); - print('Please enable IPv6 or IPv4 (or even both) by using the following lines in your configuration:

'); - print('
$config[\'misc\'][\'disable_ipv6\'] = false;
'); - print('
$config[\'misc\'][\'disable_ipv4\'] = false;
'); - print('
'); - return; - } - print('
'); print(''); print('Error! '); -- cgit v1.2.3