diff options
Diffstat (limited to 'usr')
-rw-r--r-- | usr/local/sbin/gmirror_status_check.php | 92 | ||||
-rw-r--r-- | usr/local/www/diag_gmirror.php | 346 | ||||
-rw-r--r-- | usr/local/www/diag_tables.php | 39 | ||||
-rwxr-xr-x | usr/local/www/fbegin.inc | 4 | ||||
-rw-r--r-- | usr/local/www/interfaces_groups.php | 1 | ||||
-rw-r--r-- | usr/local/www/interfaces_groups_edit.php | 6 | ||||
-rw-r--r-- | usr/local/www/system_gateways_edit.php | 6 | ||||
-rw-r--r-- | usr/local/www/widgets/include/gmirror_status.inc | 85 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/gmirror_status.widget.php | 2 |
9 files changed, 471 insertions, 110 deletions
diff --git a/usr/local/sbin/gmirror_status_check.php b/usr/local/sbin/gmirror_status_check.php new file mode 100644 index 0000000..88c186f --- /dev/null +++ b/usr/local/sbin/gmirror_status_check.php @@ -0,0 +1,92 @@ +#!/usr/local/bin/php -f +<?php +/* + gmirror_status_check.php + Copyright (C) 2014 Jim Pingle + + 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. + + 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. +*/ + +/* + pfSense_BUILDER_BINARIES: /sbin/gmirror /sbin/geom /usr/bin/grep /usr/bin/egrep /usr/bin/cut /usr/bin/head + pfSense_BUILDER_BINARIES: /sbin/mount /usr/bin/awk /usr/bin/sed + pfSense_MODULE: gmirror +*/ + +require_once("config.inc"); +require_once("notices.inc"); +require_once("globals.inc"); +require_once("gmirror.inc"); + +global $g; +$status_file = "{$g['varrun_path']}/gmirror.status"; + +$mirror_status = gmirror_get_status(); +$mirror_list = array_keys($mirror_status); +sort($mirror_list); +$notices = array(); + +// Check for gmirror.status +if (file_exists($status_file)) { + // If it exists, read status in + $previous_mirror_status = unserialize(file_get_contents($status_file)); + $previous_mirror_list = array_keys($previous_mirror_status); + sort($previous_mirror_list); + if (count($previous_mirror_status) > 0) { + // Check list of current mirrors vs old mirrors, notify if one has appeared/disappeared + if ($mirror_list != $previous_mirror_list) + $notices[] = sprintf(gettext("List of mirrors changed. Old: (%s) New: (%s)"), implode(", ", $previous_mirror_list), implode(", ", $mirror_list)); + + // For each mirror, check the mirror status, notify if changed + foreach ($mirror_list as $mirror) { + if (is_array($previous_mirror_status[$mirror])) { + // Notify if the status changed + if ($mirror_status[$mirror]['status'] != $previous_mirror_status[$mirror]['status']) { + $notices[] = sprintf(gettext("Mirror %s status changed from %s to %s."), $mirror, $previous_mirror_status[$mirror]['status'], $mirror_status[$mirror]['status']); + } + // Notify if the drive count changed + if (count($mirror_status[$mirror]['components']) != count($previous_mirror_status[$mirror]['components'])) { + // Notify if the consumer count changed. + $notices[] = sprintf(gettext("Mirror %s consumer count changed from %d to %d."), $mirror, count($previous_mirror_status[$mirror]['components']), count($mirror_status[$mirror]['components'])); + } + if (strtoupper($mirror_status[$mirror]['status']) == "DEGRADED") { + // Check the drive status as it may be different. + asort($mirror_status[$mirror]['components']); + asort($previous_mirror_status[$mirror]['components']); + if ($mirror_status[$mirror]['components'] != $previous_mirror_status[$mirror]['components']) + $notices[] = sprintf(gettext("Mirror %s drive status changed. Old: (%s) New: (%s)"), + $mirror, + implode(", ", $previous_mirror_status[$mirror]['components']), + implode(", ", $mirror_status[$mirror]['components'])); + } + } + } + } +} +if (count($notices)) { + file_notice("gmirror", implode("\n ", $notices), "GEOM Mirror Status Change", 1); +} +// Write out current status if changed +if ($mirror_status != $previous_mirror_status) + file_put_contents($status_file, serialize($mirror_status)); + +?>
\ No newline at end of file diff --git a/usr/local/www/diag_gmirror.php b/usr/local/www/diag_gmirror.php new file mode 100644 index 0000000..f200991 --- /dev/null +++ b/usr/local/www/diag_gmirror.php @@ -0,0 +1,346 @@ +<?php +/* + diag_gmirror.php + Copyright (C) 2014 Jim Pingle + + 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. + + 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. +*/ + +/* + pfSense_BUILDER_BINARIES: /sbin/gmirror /sbin/geom /usr/bin/grep /usr/bin/egrep /usr/bin/cut /usr/bin/head + pfSense_BUILDER_BINARIES: /sbin/mount /usr/bin/awk /usr/bin/sed + pfSense_MODULE: gmirror +*/ + +##|+PRIV +##|*IDENT=page-diagnostics-gmirror +##|*NAME=Diagnostics: GEOM Mirrors +##|*DESCR=Allow access to the 'Diagnostics: GEOM Mirrors' page. +##|*MATCH=diag_gmirror.php* +##|-PRIV + +require_once("guiconfig.inc"); +require_once("config.inc"); +require_once("gmirror.inc"); + +$pgtitle = array(gettext("Diagnostics"), gettext("GEOM Mirrors")); + +include("head.inc"); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?=$jsevents["body"]["onload"];?>"> + +<?php include("fbegin.inc"); ?> + +<?PHP +$action_list = array( + "forget" => gettext("Forget all formerly connected consumers"), + "clear" => gettext("Remove metadata from disk"), + "insert" => gettext("Insert consumer into mirror"), + "remove" => gettext("Remove consumer from mirror"), + "activate" => gettext("Reactivate consumer on mirror"), + "deactivate" => gettext("Deactivate consumer from mirror"), + "rebuild" => gettext("Force rebuild of mirror consumer"), +); + +/* User tried to pass a bogus action */ +if (!empty($_REQUEST['action']) && !array_key_exists($_REQUEST['action'], $action_list)) { + header("Location: diag_gmirror.php"); + return; +} + +if ($_POST) { + if (!isset($_POST['confirm']) || ($_POST['confirm'] != gettext("Confirm"))) { + header("Location: diag_gmirror.php"); + return; + } + $input_errors = ""; + + if (($_POST['action'] != "clear") && !is_valid_mirror($_POST['mirror'])) + $input_errors[] = gettext("You must supply a valid mirror name."); + + if (!empty($_POST['consumer']) && !is_valid_consumer($_POST['consumer'])) + $input_errors[] = gettext("You must supply a valid consumer name"); + + /* Additional action-specific validation that hasn't already been tested */ + switch ($_POST['action']) { + case "insert": + if (!is_consumer_unused($_POST['consumer'])) + $input_errors[] = gettext("Consumer is already in use and cannot be inserted. Remove consumer from existing mirror first."); + if (gmirror_consumer_has_metadata($_POST['consumer'])) + $input_errors[] = gettext("Consumer has metadata from an existing mirror. Clear metadata before inserting consumer."); + $mstat = gmirror_get_status_single($_POST['mirror']); + if (strtoupper($mstat) != "COMPLETE") + $input_errors[] = gettext("Mirror is not in a COMPLETE state, cannot insert consumer. Forget disconnected disks or wait for rebuild to finish."); + break; + case "clear": + if (!is_consumer_unused($_POST['consumer'])) + $input_errors[] = gettext("Consumer is in use and cannot be cleared. Deactivate disk first."); + if (!gmirror_consumer_has_metadata($_POST['consumer'])) + $input_errors[] = gettext("Consumer has no metadata to clear."); + break; + case "activate": + if (is_consumer_in_mirror($_POST['consumer'], $_POST['mirror'])) + $input_errors[] = gettext("Consumer is already present on specified mirror."); + if (!gmirror_consumer_has_metadata($_POST['consumer'])) + $input_errors[] = gettext("Consumer has no metadata and cannot be reactivated."); + + break; + case "remove": + case "deactivate": + case "rebuild": + if (!is_consumer_in_mirror($_POST['consumer'], $_POST['mirror'])) + $input_errors[] = gettext("Consumer must be present on the specified mirror."); + break; + } + +$result = 0; + if (empty($input_errors)) { + switch ($_POST['action']) { + case "forget": + $result = gmirror_forget_disconnected($_POST['mirror']); + break; + case "clear": + $result = gmirror_clear_consumer($_POST['consumer']); + break; + case "insert": + $result = gmirror_insert_consumer($_POST['mirror'], $_POST['consumer']); + break; + case "remove": + $result = gmirror_remove_consumer($_POST['mirror'], $_POST['consumer']); + break; + case "activate": + $result = gmirror_activate_consumer($_POST['mirror'], $_POST['consumer']); + break; + case "deactivate": + $result = gmirror_deactivate_consumer($_POST['mirror'], $_POST['consumer']); + break; + case "rebuild": + $result = gmirror_force_rebuild($_POST['mirror'], $_POST['consumer']); + break; + } + $redir = "Location: diag_gmirror.php"; + if ($result != 0) { + $redir .= "?error=" . urlencode($result); + } + /* If we reload the page too fast, the gmirror information may be missing or not up-to-date. */ + sleep(3); + header($redir); + return; + } +} + +$mirror_status = gmirror_get_status(); +$mirror_list = gmirror_get_mirrors(); +$unused_disks = gmirror_get_disks(); +$unused_consumers = array(); +foreach ($unused_disks as $disk) { + if (is_consumer_unused($disk)) + $unused_consumers = array_merge($unused_consumers, gmirror_get_all_unused_consumer_sizes_on_disk($disk)); +} + +if ($input_errors) + print_input_errors($input_errors); +if ($_GET["error"] && ($_GET["error"] != 0)) + print_info_box(gettext("There was an error performing the chosen mirror operation. Check the System Log for details.")); + +?> +<form action="diag_gmirror.php" method="POST" id="gmirror_form" name="gmirror_form"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td id="mainarea"> + <div class="tabcont"> + <span class="vexpl"> + <span class="red"> + <strong><?=gettext("NOTE:")?> </strong> + </span> + <?=gettext("The options on this page are intended for use by advanced users only. This page is for managing existing mirrors, not creating new mirrors.")?> + <br /> + </span> + <p/> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + +<?PHP if ($_GET["action"]): ?> + <tr> + <td colspan="2" valign="top" class="listtopic"><?PHP echo gettext("Confirm Action"); ?></td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell"> </td> + <td width="78%" class="vtable"> + <strong><?PHP echo gettext("Please confirm the selected action"); ?></strong>: + <br /> + <br /><strong><?PHP echo gettext("Action"); ?>:</strong> <?PHP echo $action_list[$_GET["action"]]; ?> + <input type="hidden" name="action" value="<?PHP echo htmlspecialchars($_GET["action"]); ?>" /> + <?PHP if (!empty($_GET["mirror"])): ?> + <br /><strong><?PHP echo gettext("Mirror"); ?>:</strong> <?PHP echo htmlspecialchars($_GET["mirror"]); ?> + <input type="hidden" name="mirror" value="<?PHP echo htmlspecialchars($_GET["mirror"]); ?>" /> + <?PHP endif; ?> + <?PHP if (!empty($_GET["consumer"])): ?> + <br /><strong><?PHP echo gettext("Consumer"); ?>:</strong> <?PHP echo htmlspecialchars($_GET["consumer"]); ?> + <input type="hidden" name="consumer" value="<?PHP echo htmlspecialchars($_GET["consumer"]); ?>" /> + <?PHP endif; ?> + <br /> + <br /><input type="submit" name="confirm" value="<?PHP echo gettext("Confirm"); ?>" /> + </td> + </tr> +<?PHP else: ?> + <tr> + <td colspan="2" valign="top" class="listtopic"><?PHP echo gettext("GEOM Mirror information"); ?></td> + </tr> + + <tr> + <td width="22%" valign="top" class="vncell"><?PHP echo gettext("Mirror Status"); ?></td> + <td width="78%" class="vtable"> + + <table width="100%" border="0" cellspacing="0" cellpadding="0" summary="gmirror status"> + <tbody id="gmirror_status_table"> + <?PHP if (count($mirror_status) > 0): ?> + <tr> + <td width="30%" class="vncellt"><?PHP echo gettext("Name"); ?></td> + <td width="30%" class="vncellt"><?PHP echo gettext("Status"); ?></td> + <td width="40%" class="vncellt"><?PHP echo gettext("Component"); ?></td> + </tr> + <?PHP foreach ($mirror_status as $mirror => $name): + $components = count($name["components"]); ?> + <tr> + <td width="30%" rowspan="<?PHP echo $components; ?>" class="listr"> + <?PHP echo htmlspecialchars($name['name']); ?> + <br />Size: <?PHP echo gmirror_get_mirror_size($name['name']); ?> + </td> + <td width="30%" rowspan="<?PHP echo $components; ?>" class="listr"> + <?PHP echo htmlspecialchars($name['status']); ?> + <?PHP if (strtoupper($name['status']) == "DEGRADED"): ?> + <br /><a href="diag_gmirror.php?action=forget&mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Forget Disconnected Disks"); ?>]</a> + <?PHP endif; ?> + </td> + <td width="40%" class="listr"> + <?PHP echo $name['components'][0]; ?> + <?PHP list($cname, $cstatus) = explode(" ", $name['components'][0], 2); ?> + <br /> + <?PHP if ((strtoupper($name['status']) == "COMPLETE") && (count($name["components"]) > 1)): ?> + <a href="diag_gmirror.php?action=rebuild&consumer=<?PHP echo htmlspecialchars($cname); ?>&mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Rebuild"); ?>]</a> + <a href="diag_gmirror.php?action=deactivate&consumer=<?PHP echo htmlspecialchars($cname); ?>&mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Deactivate"); ?>]</a> + <a href="diag_gmirror.php?action=remove&consumer=<?PHP echo htmlspecialchars($cname); ?>&mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Remove"); ?>]</a> + <?PHP endif; ?> + </td> + </tr> + <?PHP if (count($name["components"]) > 1): + $morecomponents = array_slice($name["components"], 1); ?> + <?PHP foreach ($morecomponents as $component): ?> + <tr> + <td width="40%" class="listr"> + <?PHP echo $component; ?> + <?PHP list($cname, $cstatus) = explode(" ", $component, 2); ?> + <br /> + <?PHP if ((strtoupper($name['status']) == "COMPLETE") && (count($name["components"]) > 1)): ?> + <a href="diag_gmirror.php?action=rebuild&consumer=<?PHP echo htmlspecialchars($cname); ?>&mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Rebuild"); ?>]</a> + <a href="diag_gmirror.php?action=deactivate&consumer=<?PHP echo htmlspecialchars($cname); ?>&mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Deactivate"); ?>]</a> + <a href="diag_gmirror.php?action=remove&consumer=<?PHP echo htmlspecialchars($cname); ?>&mirror=<?PHP echo htmlspecialchars($name['name']); ?>">[<?PHP echo gettext("Remove"); ?>]</a> + <?PHP endif; ?> + </td> + </tr> + <?PHP endforeach; ?> + <?PHP endif; ?> + <?PHP endforeach; ?> + <?PHP else: ?> + <tr><td colspan="3" class="listr"><?PHP echo gettext("No Mirrors Found"); ?></td></tr> + <?PHP endif; ?> + </tbody> + </table> + <br /><?PHP echo gettext("Some disk operations may only be performed when there are multiple consumers present in a mirror."); ?> + </td> + </tr> + + <tr> + <td colspan="2" valign="top" class="listtopic"><?PHP echo gettext("Consumer information"); ?></td> + </tr> + + <tr> + <td width="22%" valign="top" class="vncell"><?PHP echo gettext("Available Consumers"); ?></td> + <td width="78%" class="vtable"> + + <table width="100%" border="0" cellspacing="0" cellpadding="0" summary="consumer list"> + <tbody id="consumer_list"> + <?PHP if (count($unused_consumers) > 0): ?> + <tr> + <td width="30%" class="vncellt"><?PHP echo gettext("Name"); ?></td> + <td width="30%" class="vncellt"><?PHP echo gettext("Size"); ?></td> + <td width="40%" class="vncellt"><?PHP echo gettext("Add to Mirror"); ?></td> + </tr> + <?PHP foreach ($unused_consumers as $consumer): ?> + <tr> + <td width="30%" class="listr"> + <?PHP echo htmlspecialchars($consumer['name']); ?> + </td> + <td width="30%" class="listr"><?PHP echo htmlspecialchars($consumer['size']); ?> <?PHP echo htmlspecialchars($consumer['humansize']); ?></td> + <td width="40%" class="listr"> + <?PHP $oldmirror = gmirror_get_consumer_metadata_mirror($consumer['name']); + if ($oldmirror): ?> + <a href="diag_gmirror.php?action=activate&consumer=<?PHP echo htmlspecialchars($consumer['name']); ?>&mirror=<?PHP echo htmlspecialchars($oldmirror); ?>">[<?PHP echo gettext("Reactivate on:"); ?> <?PHP echo htmlspecialchars($oldmirror); ?>]</a> + <br /><a href="diag_gmirror.php?action=clear&consumer=<?PHP echo htmlspecialchars($consumer['name']); ?>">[<?PHP echo gettext("Remove metadata from disk"); ?>]</a> + <?PHP else: ?> + <?PHP foreach ($mirror_list as $mirror): + $mirror_size = gmirror_get_mirror_size($mirror); + $consumer_size = gmirror_get_unused_consumer_size($consumer['name']); + ?> + <?PHP if ($consumer_size > $mirror_size): ?> + <a href="diag_gmirror.php?action=insert&consumer=<?PHP echo htmlspecialchars($consumer['name']); ?>&mirror=<?PHP echo htmlspecialchars($mirror); ?>"><?PHP echo htmlspecialchars($mirror); ?></a> + <?PHP endif; ?> + <?PHP endforeach; ?> + <?PHP endif; ?> + </td> + </tr> + <?PHP endforeach; ?> + <?PHP else: ?> + <tr><td colspan="3" class="listr"><?PHP echo gettext("No unused consumers found"); ?></td></tr> + <?PHP endif; ?> + </tbody> + </table> + <br /><?PHP echo gettext("Consumers may only be added to a mirror if they are larger than the size of the mirror."); ?> + </td> + </tr> + <tr> + <td colspan="2" valign="top" class=""> </td> + </tr> + <tr> + <td colspan="2" valign="top" class=""><?PHP echo gettext("To repair a failed mirror, first perform a 'Forget' command on the mirror, followed by an 'insert' action on the new consumer."); ?></td> + </tr> +<?PHP endif;?> + </table> + </div> + </td> + </tr> +</table> +</form> +<?php require("fend.inc"); ?> +</body> +</html> + +<?php + +// Clear the loading indicator +echo "<script type=\"text/javascript\">"; +echo "jQuery('#loading').html('');"; +echo "</script>"; + +?> diff --git a/usr/local/www/diag_tables.php b/usr/local/www/diag_tables.php index d9c8f84..e181c80 100644 --- a/usr/local/www/diag_tables.php +++ b/usr/local/www/diag_tables.php @@ -91,14 +91,15 @@ exec("/sbin/pfctl -t " . escapeshellarg($tablename) . " -T show", $entries); exec("/sbin/pfctl -sT", $tables); include("head.inc"); -include("fbegin.inc"); - ?> +<body> +<?php include("fbegin.inc"); ?> <?php if ($savemsg) print_info_box($savemsg); ?> -<form method='post'> +<form method="post" action="diag_tables.php"> <script type="text/javascript"> +//<![CDATA[ function method_change(entrytype) { window.location='diag_tables.php?type=' + entrytype; } @@ -114,58 +115,62 @@ include("fbegin.inc"); } }); } +//]]> </script> <?=gettext("Table:");?> -<select id='type' onChange='method_change(jQuery("#type").val());' name='type'> +<select id="type" onchange="method_change(jQuery('#type').val());" name="type"> <?php foreach ($tables as $table) { - echo "<option name='{$table}' value='{$table}'"; + echo "<option value=\"{$table}\""; if ($tablename == $table) - echo " selected "; + echo " selected=\"selected\""; echo ">{$table}</option>\n"; } ?> </select> -<p/> +<br/><br/> -<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0"> +<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="tables"> <tr> <td class="listhdrr"><?=gettext("IP Address");?></td> </tr> <?php $count = 0; foreach($entries as $entryA): ?> <?php $entry = trim($entryA); ?> - <tr id='<?=$entry?>'> + <tr id="<?=$entry?>"> <td> <?php echo $entry; ?> </td> <td> <?php if ( ($tablename != "bogons") && ($tablename != "bogonsv6") ) { ?> - <a onClick='del_entry("<?=htmlspecialchars($entry)?>");'> - <img img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif"> - <?php } ?> + <a onclick="del_entry('<?=htmlspecialchars($entry)?>');"> + <img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" alt="delete" /> </a> + <?php } ?> </td> </tr> <?php $count++; endforeach; ?> <?php if($count == 0) if( ($tablename == "bogons") || ($tablename == "bogonsv6") ) - echo "<p/>" . gettext("No entries exist in this table.") . "  " . "<input name='Download' type='submit' class='formbtn' value='" . gettext("Download") . "'> " . gettext(" the latest bogon data."); + echo "<tr><td>" . gettext("No entries exist in this table.") . " " . "<input name=\"Download\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("Download") . "\" /> " . gettext(" the latest bogon data."); else - echo "<p/>" . gettext("No entries exist in this table."); + echo "<tr><td>" . gettext("No entries exist in this table."); ?> <?php if($count > 0) if( ($tablename == "bogons") || ($tablename == "bogonsv6") ) { $last_updated = exec('/usr/bin/grep -i -m 1 -E "^# last updated" /etc/' . escapeshellarg($tablename)); - echo "<p/> <b>$count</b> " . gettext("entries in this table.") . "  " . "<input name='Download' type='submit' class='formbtn' value='" . gettext("Download") . "'> " . gettext(" the latest bogon data.") . "<br />" . "$last_updated"; + echo "<tr><td> <b>$count</b> " . gettext("entries in this table.") . " " . "<input name=\"Download\" type=\"submit\" class=\"formbtn\" value=\"" . gettext("Download") . "\" /> " . gettext(" the latest bogon data.") . "<br />" . "$last_updated"; } else - echo "<p/>" . gettext("Delete") . " <a href='diag_tables.php?deleteall=true&type=" . htmlspecialchars($tablename) . "'>" . gettext("all") . "</a> " . "<b>$count</b> " . gettext("entries in this table."); + echo "<tr><td>" . gettext("Delete") . " <a href=\"diag_tables.php?deleteall=true&type=" . htmlspecialchars($tablename) . "\">" . gettext("all") . "</a> " . "<b>$count</b> " . gettext("entries in this table."); ?> - +</td></tr> </table> +</form> <?php include("fend.inc"); ?> +</body> +</html> diff --git a/usr/local/www/fbegin.inc b/usr/local/www/fbegin.inc index 22cc90b..680955e 100755 --- a/usr/local/www/fbegin.inc +++ b/usr/local/www/fbegin.inc @@ -210,6 +210,10 @@ $diagnostics_menu[] = array(gettext("Command Prompt"), "/exec.php"); $diagnostics_menu[] = array(gettext("DNS Lookup"), "/diag_dns.php"); $diagnostics_menu[] = array(gettext("Edit File"), "/edit.php"); $diagnostics_menu[] = array(gettext("Factory Defaults"), "/diag_defaults.php"); + +if(file_exists("/var/run/gmirror_active")) + $diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php" ); + $diagnostics_menu[] = array(gettext("Halt System"), "/halt.php" ); $diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php" ); $diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php" ); diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php index 3b50b5a..3f97dd3 100644 --- a/usr/local/www/interfaces_groups.php +++ b/usr/local/www/interfaces_groups.php @@ -110,6 +110,7 @@ include("head.inc"); $memberses_arr = array(); foreach ($members_arr as $memb) $memberses_arr[] = $iflist[$memb] ? $iflist[$memb] : $memb; + unset($iflist); $memberses = implode(", ", $memberses_arr); echo $memberses; if(count($members_arr) < 10) { diff --git a/usr/local/www/interfaces_groups_edit.php b/usr/local/www/interfaces_groups_edit.php index f8a3bb6..6fd5ac9 100644 --- a/usr/local/www/interfaces_groups_edit.php +++ b/usr/local/www/interfaces_groups_edit.php @@ -344,6 +344,10 @@ function removeRow(el) { //]]> </script> -<?php include("fend.inc"); ?> +<?php + unset($iflist); + unset($iflist_disabled); + include("fend.inc"); +?> </body> </html> diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 24936e1..82ab690 100644 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -660,12 +660,6 @@ function enable_change() { echo " selected='selected'"; echo ">" . htmlspecialchars($ifacename) . "</option>"; } - if (is_package_installed("openbgpd") == 1) { - echo "<option value=\"bgpd\""; - if ($pconfig['interface'] == "bgpd") - echo " selected='selected'"; - echo ">" . gettext("Use BGPD") . "</option>"; - } ?> </select><br /> <span class="vexpl"><?=gettext("Choose which interface this gateway applies to."); ?></span> diff --git a/usr/local/www/widgets/include/gmirror_status.inc b/usr/local/www/widgets/include/gmirror_status.inc deleted file mode 100644 index 8a04d4a..0000000 --- a/usr/local/www/widgets/include/gmirror_status.inc +++ /dev/null @@ -1,85 +0,0 @@ -<?php -/* - gmirror_status.widget.php - Copyright (C) 2009-2010 Jim Pingle - - 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. - - 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. -*/ - -function gmirror_get_status() { - $status = ""; - exec("/sbin/gmirror status -s", $status); - $mirrors = array(); - - /* Empty output = no mirrors found */ - if (count($status) > 0) { - /* Loop through gmirror status output. */ - foreach ($status as $line) { - /* Split the line by whitespace */ - $all = preg_split("/[\s\t]+/", trim($line), 3); - if (count($all) == 3) { - /* If there are three items on a line, it is mirror name, status, and component */ - $currentmirror = $all[0]; - $mirrors[$currentmirror]["name"] = $all[0]; - $mirrors[$currentmirror]["status"] = $all[1]; - if (!is_array($mirrors[$currentmirror]["components"])) - $mirrors[$currentmirror]["components"] = array(); - $mirrors[$currentmirror]["components"][] = $all[2]; - } - } - } - /* Return an hash of mirrors and components */ - return $mirrors; -} - -function gmirror_html_status() { - $mirrors = gmirror_get_status(); - $output = ""; - if (count($mirrors) > 0) { - $output .= "<tr>\n"; - $output .= "<td width=\"40%\" class=\"vncellt\">Name</td>\n"; - $output .= "<td width=\"40%\" class=\"vncellt\">Status</td>\n"; - $output .= "<td width=\"20%\" class=\"vncellt\">Component</td>\n"; - $output .= "</tr>\n"; - foreach ($mirrors as $mirror => $name) { - $components = count($name["components"]); - $output .= "<tr>\n"; - $output .= "<td width=\"40%\" rowspan=\"{$components}\" class=\"listr\">{$name['name']}</td>\n"; - $output .= "<td width=\"40%\" rowspan=\"{$components}\" class=\"listr\">{$name['status']}</td>\n"; - $output .= "<td width=\"20%\" class=\"listr\">{$name['components'][0]}</td>\n"; - $output .= "</tr>\n"; - if (count($name["components"]) > 1) { - $morecomponents = array_slice($name["components"], 1); - foreach ($morecomponents as $component) { - $output .= "<tr>\n"; - $output .= "<td width=\"20%\" class=\"listr\">{$component}</td>\n"; - $output .= "</tr>\n"; - } - } - } - } else { - $output .= "<tr><td colspan=\"3\" class=\"listr\">No Mirrors Found</td></tr>\n"; - } - // $output .= "<tr><td colspan=\"3\" class=\"listr\">Updated at " . date("F j, Y, g:i:s a") . "</td></tr>\n"; - return $output; -} -?>
\ No newline at end of file diff --git a/usr/local/www/widgets/widgets/gmirror_status.widget.php b/usr/local/www/widgets/widgets/gmirror_status.widget.php index 543daf4..2d040c0 100644 --- a/usr/local/www/widgets/widgets/gmirror_status.widget.php +++ b/usr/local/www/widgets/widgets/gmirror_status.widget.php @@ -28,7 +28,7 @@ $nocsrf = true; require_once("guiconfig.inc"); -require_once("/usr/local/www/widgets/include/gmirror_status.inc"); +require_once("gmirror.inc"); if ($_GET['textonly'] == "true") { header("Cache-Control: no-cache"); |