aboutsummaryrefslogtreecommitdiffstats
path: root/config/apcupsd/apcupsd_status.php
diff options
context:
space:
mode:
authorDanilo G. Baio (dbaio) <dbaio@bsd.com.br>2013-12-26 16:44:39 -0200
committerDanilo G. Baio (dbaio) <dbaio@bsd.com.br>2013-12-26 16:44:39 -0200
commitaf6e4bec14ca958e0c85c0819e4509b000f64e05 (patch)
tree1a66d5ecd84f60eac7a8430bc70dd87633c4bef1 /config/apcupsd/apcupsd_status.php
parent901c4c7a85e3056c5e86a0b19cfdccc1003f00ca (diff)
downloadpfsense-packages-af6e4bec14ca958e0c85c0819e4509b000f64e05.tar.gz
pfsense-packages-af6e4bec14ca958e0c85c0819e4509b000f64e05.tar.bz2
pfsense-packages-af6e4bec14ca958e0c85c0819e4509b000f64e05.zip
New package Apcupsd. A daemon for controlling APC UPSes.
Diffstat (limited to 'config/apcupsd/apcupsd_status.php')
-rwxr-xr-xconfig/apcupsd/apcupsd_status.php118
1 files changed, 118 insertions, 0 deletions
diff --git a/config/apcupsd/apcupsd_status.php b/config/apcupsd/apcupsd_status.php
new file mode 100755
index 00000000..e465f62c
--- /dev/null
+++ b/config/apcupsd/apcupsd_status.php
@@ -0,0 +1,118 @@
+<?php
+/*
+ apcupsd_status.php
+ part of pfSense (http://www.pfsense.com/)
+ Copyright (C) 2013 Danilo G. Baio <dbaio@bsd.com.br>
+ All rights reserved.
+
+ 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.
+*/
+
+require("guiconfig.inc");
+
+$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
+
+if(strstr($pfSversion, "1.2"))
+ $one_two = true;
+
+$pgtitle = "Services: Apcupsd (Status)";
+include("head.inc");
+
+function puts( $arg ) { echo "$arg\n"; }
+
+?>
+
+<style>
+<!--
+
+input {
+ font-family: courier new, courier;
+ font-weight: normal;
+ font-size: 9pt;
+}
+
+pre {
+ border: 2px solid #435370;
+ background: #F0F0F0;
+ padding: 1em;
+ font-family: courier new, courier;
+ white-space: pre;
+ line-height: 10pt;
+ font-size: 10pt;
+}
+
+.label {
+ font-family: tahoma, verdana, arial, helvetica;
+ font-size: 11px;
+ font-weight: bold;
+}
+
+.button {
+ font-family: tahoma, verdana, arial, helvetica;
+ font-weight: bold;
+ font-size: 11px;
+}
+
+-->
+</style>
+</head>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+
+ <?php include("fbegin.inc"); ?>
+
+ <?php if($one_two): ?>
+ <p class="pgtitle"><?=$pgtitle?></font></p>
+ <?php endif; ?>
+
+
+<div id="mainlevel">
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+ <?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("General"), false, "/pkg_edit.php?xml=apcupsd.xml&amp;id=0");
+ $tab_array[] = array(gettext("Status"), true, "/apcupsd_status.php");
+ display_top_tabs($tab_array);
+ ?>
+ </td></tr>
+ </table>
+</div>
+
+<div id="mainarea" style="padding-top: 0px; padding-bottom: 0px; ">
+ <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
+ <tr><td>
+<?php
+ puts("<pre>");
+ putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin");
+ $ph = popen('apcaccess 2>&1', "r" );
+ while ($line = fgets($ph)) echo htmlspecialchars($line);
+ pclose($ph);
+ puts("</pre>");
+?>
+ </td></tr>
+ </table>
+</div>
+<?php
+include("fend.inc");
+?>
+</body>
+</html>