$setting) { if (!isset($setting['disable'])) { $ifdescrs['ovpn' . substr($mode, 0, 1) . $setting['vpnid']] = gettext("OpenVPN") . " " . $mode . ": ".htmlspecialchars($setting['description']); } } } } // Compatiblity to restore GET parameters used pre-2.3 // Useful to save a URL for a given graph configuration if (isset($_GET['if']) && !isset($_POST['if'])) { $_POST['if'] = $_GET['if']; } if (isset($_GET['sort']) && !isset($_POST['sort'])) { $_POST['sort'] = $_GET['sort']; } if (isset($_GET['filter']) && !isset($_POST['filter'])) { $_POST['filter'] = $_GET['filter']; } if (isset($_GET['hostipformat']) && !isset($_POST['hostipformat'])) { $_POST['hostipformat'] = $_GET['hostipformat']; } if ($_POST['if']) { $curif = $_POST['if']; $found = false; foreach ($ifdescrs as $descr => $ifdescr) { if ($descr == $curif) { $found = true; break; } } if ($found === false) { header("Location: status_graph.php"); exit; } } else { if (empty($ifdescrs["wan"])) { /* Handle the case when WAN has been disabled. Use the first key in ifdescrs. */ reset($ifdescrs); $curif = key($ifdescrs); } else { $curif = "wan"; } } if ($_POST['sort']) { $cursort = $_POST['sort']; } else { $cursort = ""; } if ($_POST['filter']) { $curfilter = $_POST['filter']; } else { $curfilter = ""; } if ($_POST['hostipformat']) { $curhostipformat = $_POST['hostipformat']; } else { $curhostipformat = ""; } function iflist() { global $ifdescrs; $iflist = array(); foreach ($ifdescrs as $ifn => $ifd) { $iflist[$ifn] = $ifd; } return($iflist); } $pgtitle = array(gettext("Status"), gettext("Traffic Graph")); include("head.inc"); $form = new Form(false); $form->addClass('auto-submit'); $section = new Form_Section('Graph Settings'); $group = new Form_Group(''); $group->add(new Form_Select( 'if', null, $curif, iflist() ))->setHelp('Interface'); $group->add(new Form_Select( 'sort', null, $cursort, array ( 'in' => gettext('Bandwidth In'), 'out' => gettext('Bandwidth Out') ) ))->setHelp('Sort by'); $group->add(new Form_Select( 'filter', null, $curfilter, array ( 'local' => gettext('Local'), 'remote'=> gettext('Remote'), 'all' => gettext('All') ) ))->setHelp('Filter'); $group->add(new Form_Select( 'hostipformat', null, $curhostipformat, array ( '' => gettext('IP Address'), 'hostname' => gettext('Host Name'), 'descr' => gettext('Description'), 'fqdn' => gettext('FQDN') ) ))->setHelp('Display'); $section->add($group); $form->add($section); print $form; ?>