diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2004-12-12 06:50:25 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2004-12-12 06:50:25 +0000 |
commit | c6c150e92a9cc3d853d30589fce56d0c1e3583f7 (patch) | |
tree | 18de15cf2360f991dc48ef3192f31f8bd63ba8be /usr/local/www | |
parent | 55e50bd6aabace95bb98d82d34b3a4fe2acd657f (diff) | |
download | pfsense-c6c150e92a9cc3d853d30589fce56d0c1e3583f7.zip pfsense-c6c150e92a9cc3d853d30589fce56d0c1e3583f7.tar.gz |
Include menu item in the subsections on the left. Menu XML file must be in lower case,. Ex: /usr/local/www/ext/Servuces/ifgraph.xml
Diffstat (limited to 'usr/local/www')
-rwxr-xr-x | usr/local/www/fbegin.inc | 43 | ||||
-rwxr-xr-x | usr/local/www/pkg_mgr_install.php | 27 |
2 files changed, 48 insertions, 22 deletions
diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 4b96a6a..32e72d8 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -1,3 +1,24 @@ +<?php + function return_menu($section) { + global $g; + $htmltext = ""; + $dh = @opendir($g['www_path'] . "/ext/" . $section); + if ($dh) { + while (($extd = readdir($dh)) !== false) { + if (($extd === ".") || ($extd === "..")) + continue; + $fdt = fopen("{$g['www_path']}/ext/" . $section . "/" . $extd, "r"); + $description = fread($fdt, 1024); + fclose($fdt); + echo "<!-- <a href=\"/pkg.php?xml=" . strtolower($extd) . ".xml\" class=\"navlnk\">" . $description . "</a><br> -->\n"; + $htmltext .= " <a href=\"/pkg.php?xml=" . strtolower($extd) . ".xml\" class=\"navlnk\">" . $description . "</a><br>\n"; + } + closedir($dh); + } + return $htmltext; + } +?> + <script language="javascript"> <!-- var tri_open = ""; @@ -51,6 +72,7 @@ function showhide(tspan, tri) { <a href="/system_firmware.php" class="navlnk">Firmware</a><br> <a href="/system_advanced.php" class="navlnk">Advanced</a><br> <a href="/pkg_mgr.php" class="navlnk">Package Manager</a><br> + <?php echo return_menu("System"); ?> <strong>Interfaces</strong> <?php if (!isset($config['system']['webgui']['noassigninterfaces'])): ?> <a href="/interfaces_assign.php" class="navlnks">(assign)</a> @@ -61,10 +83,12 @@ function showhide(tspan, tri) { <?php for ($i = 1; isset($config['interfaces']['opt' . $i]); $i++): if (!isset($config['interfaces']['opt' . $i]['ovpn'])): ?> <a href="/interfaces_opt.php?index=<?=$i;?>" class="navlnk"><?=htmlspecialchars($config['interfaces']['opt' . $i]['descr']);?></a><br> <?php endif; endfor; ?> + <?php echo return_menu("Interfaces"); ?> <strong>Firewall</strong><br> <a href="/firewall_rules.php" class="navlnk">Rules</a><br> <a href="/firewall_nat.php" class="navlnk">NAT</a><br> <a href="/firewall_aliases.php" class="navlnk">Aliases</a><br> + <?php echo return_menu("Firewall"); ?> <strong>Services</strong><br> <a href="/services_dnsmasq.php" class="navlnk">DNS forwarder</a><br> <a href="/services_dyndns.php" class="navlnk">Dynamic @@ -75,6 +99,7 @@ function showhide(tspan, tri) { <a href="/services_proxyarp.php" class="navlnk">Proxy ARP</a><br> <a href="/services_captiveportal.php" class="navlnk">Captive portal</a><br> <a href="/services_wol.php" class="navlnk">Wake on LAN</a><br> + <?php echo return_menu("Services"); ?> <strong>VPN</strong><br> <a href="/vpn_ipsec.php" class="navlnk">IPsec</a><br> <a href="/vpn_pptp.php" class="navlnk">PPTP</a><br> @@ -87,23 +112,7 @@ function showhide(tspan, tri) { <?php if (isset($config['captiveportal']['enable'])): ?> <a href="/status_captiveportal.php" class="navlnk">Captive portal</a><br> <?php endif; ?> -<?php -/* extensions section */ -if (is_dir("{$g['www_path']}/ext")): -?> - <strong>Extensions</strong><br> -<?php -$dh = @opendir("{$g['www_path']}/ext"); -if ($dh) { - while (($extd = readdir($dh)) !== false) { - if (($extd === ".") || ($extd === "..")) - continue; - @include("{$g['www_path']}/ext/" . $extd . "/menu.inc"); - } - closedir($dh); -} -endif; -?> + <?php echo return_menu("Status"); ?> <?php if (isset($config['system']['webgui']['expanddiags']) || strstr($_SERVER['SCRIPT_FILENAME'], "diag_") || strstr($_SERVER['SCRIPT_FILENAME'], "reboot")): ?> <a href="javascript:showhide('diag','tri_diag')"><img src="/tri_o.gif" id="tri_diag" width="14" height="10" border="0"></a><strong><a href="javascript:showhide('diag','tri_diag')" class="navlnk">Diagnostics</a></strong><br> <span id="diag"> diff --git a/usr/local/www/pkg_mgr_install.php b/usr/local/www/pkg_mgr_install.php index 4c2a9a0..9b6bf9a 100755 --- a/usr/local/www/pkg_mgr_install.php +++ b/usr/local/www/pkg_mgr_install.php @@ -65,6 +65,20 @@ function get_dir($dir) { } /* + * exec_command_and_return_text_array: execute command and return output + */ +function exec_command_and_return_text_array($command) { + $counter = 0; + $fd = popen($command . " 2>&1 ", "r"); + while(!feof($fd)) { + $tmp .= fread($fd,49); + } + fclose($fd); + $temp_array = split("\n", $tmp); + return $tmp_array; +} + +/* * exec_command_and_return_text: execute command and return output */ function exec_command_and_return_text($command) { @@ -181,6 +195,14 @@ if(!$pkg_config['packages']) { /* install the package */ +// Ensure directories are in place for pkg_add. +mwexec("mkdir /usr/local/www/ext/Services >/dev/null 2>&1"); +mwexec("mkdir /usr/local/www/ext/System >/dev/null 2>&1"); +mwexec("mkdir /usr/local/www/ext/Interfaces >/dev/null 2>&1"); +mwexec("mkdir /usr/local/www/ext/Firewall >/dev/null 2>&1"); +mwexec("mkdir /usr/local/www/ext/VPN >/dev/null 2>&1"); +mwexec("mkdir /usr/local/www/ext/Status >/dev/null 2>&1"); + $a_out = &$pkg_config['packages']['package']; $pkgent = array(); $pkgent['name'] = $pkg_config['packages']['package'][$id]['name']; @@ -242,11 +264,6 @@ if(file_exists("/usr/local/pkg/" . $pkgent['name'] . ".xml")) { } } // install menu item into the ext folder - mwexec("mkdir /usr/local/www/ext/System >/dev/null 2>&1"); - mwexec("mkdir /usr/local/www/ext/Interfaces >/dev/null 2>&1"); - mwexec("mkdir /usr/local/www/ext/Firewall >/dev/null 2>&1"); - mwexec("mkdir /usr/local/www/ext/VPN >/dev/null 2>&1"); - mwexec("mkdir /usr/local/www/ext/Status >/dev/null 2>&1"); fwrite($fd_log, "Adding menu option to " . $config['menu']['section'] . "/" . $config['name'] . ":\n"); $fd = fopen("/usr/local/www/ext/" . $config['menu']['section'] . "/" . $config['name'] , "w"); fwrite($fd, "/usr/local/www/pkg.php?xml=" . $config['name'] . "\n"); |