1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php
|
2 |
2cd6010c
|
Scott Ullrich
|
<?php
|
3 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
4 |
5b237745
|
Scott Ullrich
|
/*
|
5 |
b49448ac
|
Scott Ullrich
|
index.php
|
6 |
|
|
Copyright (C) 2004, 2005 Scott Ullrich
|
7 |
|
|
All rights reserved.
|
8 |
|
|
|
9 |
|
|
Originally part of m0n0wall (http://m0n0.ch/wall)
|
10 |
|
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11 |
|
|
All rights reserved.
|
12 |
|
|
|
13 |
|
|
Redistribution and use in source and binary forms, with or without
|
14 |
|
|
modification, are permitted provided that the following conditions are met:
|
15 |
|
|
|
16 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
17 |
|
|
this list of conditions and the following disclaimer.
|
18 |
|
|
|
19 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
20 |
|
|
notice, this list of conditions and the following disclaimer in the
|
21 |
|
|
documentation and/or other materials provided with the distribution.
|
22 |
|
|
|
23 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27 |
0682e26b
|
Colin Smith
|
oR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28 |
b49448ac
|
Scott Ullrich
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
33 |
5b237745
|
Scott Ullrich
|
*/
|
34 |
|
|
|
35 |
1df0159c
|
Erik Kristensen
|
## Load Essential Includes
|
36 |
|
|
require_once('guiconfig.inc');
|
37 |
|
|
require_once('notices.inc');
|
38 |
d772ac32
|
Erik Kristensen
|
|
39 |
|
|
|
40 |
1df0159c
|
Erik Kristensen
|
## Load Functions Files
|
41 |
|
|
require_once('includes/functions.inc.php');
|
42 |
d772ac32
|
Erik Kristensen
|
|
43 |
|
|
|
44 |
1df0159c
|
Erik Kristensen
|
## Load AJAX, Initiate Class ###############################################
|
45 |
|
|
require_once('includes/sajax.class.php');
|
46 |
d772ac32
|
Erik Kristensen
|
|
47 |
1df0159c
|
Erik Kristensen
|
## Initiate Class and Set location of ajax file containing
|
48 |
|
|
## the information that we need for this page. Also set functions
|
49 |
|
|
## that SAJAX will be using.
|
50 |
|
|
$oSajax = new sajax();
|
51 |
|
|
$oSajax->sajax_remote_uri = 'sajax/index.sajax.php';
|
52 |
|
|
$oSajax->sajax_request_type = 'POST';
|
53 |
|
|
$oSajax->sajax_export("mem_usage","cpu_usage","get_uptime","get_pfstate");
|
54 |
|
|
$oSajax->sajax_handle_client_request();
|
55 |
|
|
############################################################################
|
56 |
d772ac32
|
Erik Kristensen
|
|
57 |
|
|
|
58 |
1df0159c
|
Erik Kristensen
|
## Check to see if we have a swap space,
|
59 |
|
|
## if true, display, if false, hide it ...
|
60 |
|
|
$swapinfo = `/usr/sbin/swapinfo`;
|
61 |
|
|
if(stristr($swapinfo,'%') == true) $showswap=true;
|
62 |
d772ac32
|
Erik Kristensen
|
|
63 |
f3e2c205
|
Scott Ullrich
|
|
64 |
1df0159c
|
Erik Kristensen
|
## User recently restored his config.
|
65 |
|
|
## If packages are installed lets resync
|
66 |
|
|
if(file_exists('/needs_package_sync')) {
|
67 |
|
|
if($config['installedpackages'] <> '') {
|
68 |
|
|
conf_mount_rw();
|
69 |
|
|
unlink('/needs_package_sync');
|
70 |
|
|
header('Location: pkg_mgr_install.php?mode=reinstallall');
|
71 |
|
|
exit;
|
72 |
|
|
}
|
73 |
|
|
}
|
74 |
8fecad11
|
Scott Ullrich
|
|
75 |
1df0159c
|
Erik Kristensen
|
|
76 |
|
|
## If it is the first time webGUI has been
|
77 |
|
|
## accessed since initial install show this stuff.
|
78 |
|
|
if(file_exists('/trigger_initial_wizard')) {
|
79 |
1ca54f04
|
Scott Ullrich
|
conf_mount_rw();
|
80 |
1df0159c
|
Erik Kristensen
|
unlink('/trigger_initial_wizard');
|
81 |
|
|
conf_mount_ro();
|
82 |
|
|
|
83 |
|
|
$pgtitle = 'pfSense first time setup';
|
84 |
|
|
include('head.inc');
|
85 |
|
|
|
86 |
|
|
echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
|
87 |
|
|
echo "<form>\n";
|
88 |
|
|
echo "<center>\n";
|
89 |
|
|
echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\"><p>\n";
|
90 |
|
|
echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n";
|
91 |
|
|
echo "Welcome to pfSense!<p>\n";
|
92 |
|
|
echo "One moment while we start the initial setup wizard.<p>\n";
|
93 |
|
|
echo "Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal gui.<p>\n";
|
94 |
|
|
echo "To bypass the wizard, click on the pfSense wizard on the initial page.\n";
|
95 |
|
|
echo "</div>\n";
|
96 |
|
|
echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n";
|
97 |
|
|
echo "<script type=\"text/javascript\">\n";
|
98 |
|
|
echo "NiftyCheck();\n";
|
99 |
|
|
echo "Rounded(\"div#nifty\",\"all\",\"#000\",\"#FFFFFF\",\"smooth\");\n";
|
100 |
|
|
echo "</script>\n";
|
101 |
1ca54f04
|
Scott Ullrich
|
exit;
|
102 |
|
|
}
|
103 |
|
|
|
104 |
bf787c0a
|
Scott Ullrich
|
|
105 |
1df0159c
|
Erik Kristensen
|
## Find out whether there's hardware encryption or not
|
106 |
|
|
unset($hwcrypto);
|
107 |
|
|
$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
|
108 |
|
|
if ($fd) {
|
109 |
|
|
while (!feof($fd)) {
|
110 |
|
|
$dmesgl = fgets($fd);
|
111 |
|
|
if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) {
|
112 |
|
|
$hwcrypto = $matches[1];
|
113 |
|
|
break;
|
114 |
|
|
}
|
115 |
5b237745
|
Scott Ullrich
|
}
|
116 |
1df0159c
|
Erik Kristensen
|
fclose($fd);
|
117 |
5b237745
|
Scott Ullrich
|
}
|
118 |
|
|
|
119 |
561d55ff
|
Erik Kristensen
|
|
120 |
1df0159c
|
Erik Kristensen
|
## Set Page Title and Include Header
|
121 |
|
|
$pgtitle = "pfSense webGUI";
|
122 |
|
|
include("head.inc");
|
123 |
5b237745
|
Scott Ullrich
|
|
124 |
a8726a3d
|
Scott Ullrich
|
?>
|
125 |
8dbbc3ed
|
Scott Ullrich
|
|
126 |
5b237745
|
Scott Ullrich
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
127 |
d772ac32
|
Erik Kristensen
|
|
128 |
5ffe7500
|
Scott Ullrich
|
<?php
|
129 |
|
|
include("fbegin.inc");
|
130 |
5e237c18
|
Erik Kristensen
|
if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo"))
|
131 |
|
|
echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>";
|
132 |
0682e26b
|
Colin Smith
|
?>
|
133 |
561d55ff
|
Erik Kristensen
|
<p class="pgtitle">System Overview</p>
|
134 |
|
|
|
135 |
1df0159c
|
Erik Kristensen
|
<div id="niftyOutter">
|
136 |
|
|
<form action="index.php" method="post">
|
137 |
d772ac32
|
Erik Kristensen
|
<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0">
|
138 |
|
|
<tbody>
|
139 |
|
|
<tr>
|
140 |
|
|
<td colspan="2" class="listtopic">System information</td>
|
141 |
|
|
</tr>
|
142 |
|
|
<tr>
|
143 |
|
|
<td width="25%" class="vncellt">Name</td>
|
144 |
|
|
<td width="75%" class="listr"><?php echo $config['system']['hostname'] . "." . $config['system']['domain']; ?></td>
|
145 |
|
|
</tr>
|
146 |
|
|
<tr>
|
147 |
|
|
<td width="25%" valign="top" class="vncellt">Version</td>
|
148 |
|
|
<td width="75%" class="listr">
|
149 |
|
|
<strong><?php readfile("/etc/version"); ?></strong>
|
150 |
|
|
<br />
|
151 |
|
|
built on <?php readfile("/etc/version.buildtime"); ?>
|
152 |
|
|
</td>
|
153 |
|
|
</tr>
|
154 |
|
|
<tr>
|
155 |
|
|
<td width="25%" class="vncellt">Platform</td>
|
156 |
|
|
<td width="75%" class="listr"><?=htmlspecialchars($g['platform']);?></td>
|
157 |
|
|
</tr>
|
158 |
|
|
<?php if ($hwcrypto): ?>
|
159 |
|
|
<tr>
|
160 |
|
|
<td width="25%" class="vncellt">Hardware crypto</td>
|
161 |
|
|
<td width="75%" class="listr"><?=htmlspecialchars($hwcrypto);?></td>
|
162 |
|
|
</tr>
|
163 |
|
|
<?php endif; ?>
|
164 |
|
|
<tr>
|
165 |
|
|
<td width="25%" class="vncellt">Uptime</td>
|
166 |
|
|
<td width="75%" class="listr"><input style="border: 0px solid white;" size="30" name="uptime" id="uptime" value="<?= htmlspecialchars(get_uptime()); ?>" /></td>
|
167 |
|
|
</tr>
|
168 |
|
|
<?php if ($config['lastchange']): ?>
|
169 |
|
|
<tr>
|
170 |
|
|
<td width="25%" class="vncellt">Last config change</td>
|
171 |
|
|
<td width="75%" class="listr"><?= htmlspecialchars(date("D M j G:i:s T Y", $config['revision']['time']));?></td>
|
172 |
|
|
</tr>
|
173 |
|
|
<?php endif; ?>
|
174 |
|
|
<tr>
|
175 |
|
|
<td width="25%" class="vncellt">State table size</td>
|
176 |
|
|
<td width="75%" class="listr">
|
177 |
|
|
<input style="border: 0px solid white;" size="30" name="pfstate" id="pfstate" value="<?= htmlspecialchars(get_pfstate()); ?>" />
|
178 |
|
|
<br />
|
179 |
|
|
<a href="diag_dump_states.php">Show states</a>
|
180 |
|
|
</td>
|
181 |
|
|
</tr>
|
182 |
|
|
<tr>
|
183 |
|
|
<td width="25%" class="vncellt">CPU usage</td>
|
184 |
561d55ff
|
Erik Kristensen
|
<td width="75%" class="listr">
|
185 |
a3d1ff72
|
Scott Ullrich
|
<?php $cpuUsage = "0"; ?>
|
186 |
|
|
<img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" name="cpuwidtha" id="cpuwidtha" width="<?= $cpuUsage; ?>" border="0" align="middle" alt="blue bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" name="cpuwidthb" id="cpuwidthb" width="<?= (100 - $cpuUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" />
|
187 |
|
|
|
188 |
b23a2cb3
|
Scott Ullrich
|
<input style="border: 0px solid white;" size="30" name="cpumeter" id="cpumeter" value="(Updating in 10 seconds)" />
|
189 |
d772ac32
|
Erik Kristensen
|
</td>
|
190 |
|
|
</tr>
|
191 |
|
|
<tr>
|
192 |
|
|
<td width="25%" class="vncellt">Memory usage</td>
|
193 |
|
|
<td width="75%" class="listr">
|
194 |
|
|
<?php $memUsage = mem_usage(); ?>
|
195 |
a3d1ff72
|
Scott Ullrich
|
<img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" name="memwidtha" id="memwidtha" width="<?= $memUsage; ?>" border="0" align="middle" alt="blue bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" name="memwidthb" id="memwidthb" width="<?= (100 - $memUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" />
|
196 |
|
|
|
197 |
|
|
<input style="border: 0px solid white;" size="30" name="memusagemeter" id="memusagemeter" value="<?= $memUsage.'%'; ?>" />
|
198 |
d772ac32
|
Erik Kristensen
|
</td>
|
199 |
|
|
</tr>
|
200 |
|
|
<?php if($showswap == true): ?>
|
201 |
|
|
<tr>
|
202 |
|
|
<td width="25%" class="vncellt">SWAP usage</td>
|
203 |
|
|
<td width="75%" class="listr">
|
204 |
|
|
<?php $swapusage = swap_usage(); ?>
|
205 |
a3d1ff72
|
Scott Ullrich
|
<img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" width="<?= $swapUsage; ?>" border="0" align="middle" alt="blue bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" width="<?= (100 - $swapUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" />
|
206 |
|
|
|
207 |
|
|
<input style="border: 0px solid white;" size="30" name="swapusagemeter" id="swapusagemeter" value="<?= $swapusage.'%'; ?>" />
|
208 |
d772ac32
|
Erik Kristensen
|
</td>
|
209 |
|
|
</tr>
|
210 |
|
|
<?php endif; ?>
|
211 |
561d55ff
|
Erik Kristensen
|
<?php
|
212 |
d772ac32
|
Erik Kristensen
|
/* XXX - Stub in the HW monitor for net4801 - needs to use platform var's once we start using them */
|
213 |
97174dfb
|
Bill Marquette
|
/* XXX - this should be grep net4801, but the graph doesn't update right now and I don't want to fix it right now - billm */
|
214 |
d772ac32
|
Erik Kristensen
|
$is4801 = `/sbin/dmesg -a | grep NET4801`;
|
215 |
|
|
if($is4801 <> ""):
|
216 |
|
|
exec("/usr/local/sbin/env4801 -i");
|
217 |
|
|
$Temp = rtrim(`/usr/local/sbin/env4801 | grep Temp |cut -c24-25`);
|
218 |
561d55ff
|
Erik Kristensen
|
?>
|
219 |
d772ac32
|
Erik Kristensen
|
<tr>
|
220 |
|
|
<td width='25%' class='vncellt'>Temperature</td>
|
221 |
|
|
<td width='75%' class='listr'>
|
222 |
a3d1ff72
|
Scott Ullrich
|
<img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_blue.gif" height="15" name="Tempwidtha" id="tempwidtha" width="<?= $temp; ?>" border="0" align="middle" alt="blue bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_gray.gif" height="15" name="Tempwidthb" id="tempwidthb" width="<?= (100 - $temp); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" />
|
223 |
|
|
|
224 |
|
|
<input style="border: 0px solid white;" size="30" name="Tempmeter" id="Tempmeter" value="<?= $temp."C"; ?>" />
|
225 |
561d55ff
|
Erik Kristensen
|
</td>
|
226 |
d772ac32
|
Erik Kristensen
|
</tr>
|
227 |
|
|
<?php endif; ?>
|
228 |
|
|
<tr>
|
229 |
|
|
<td width="25%" class="vncellt">Disk usage</td>
|
230 |
|
|
<td width="75%" class="listr">
|
231 |
|
|
<?php $diskusage = disk_usage(); ?>
|
232 |
1df0159c
|
Erik Kristensen
|
<img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_blue.gif" height="15" width="<?= $diskusage; ?>" border="0" align="middle" alt="blue bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_gray.gif" height="15" width="<?= (100 - $diskusage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" />
|
233 |
a3d1ff72
|
Scott Ullrich
|
|
234 |
d50e7978
|
Bill Marquette
|
<input style="border: 0px solid white;" size="30" name="diskusagemeter" id="diskusagemeter" value="<?= $diskusage.'%'; ?>" />
|
235 |
d772ac32
|
Erik Kristensen
|
</td>
|
236 |
|
|
</tr>
|
237 |
|
|
</tbody>
|
238 |
|
|
</table>
|
239 |
1df0159c
|
Erik Kristensen
|
</form>
|
240 |
d772ac32
|
Erik Kristensen
|
</div>
|
241 |
561d55ff
|
Erik Kristensen
|
|
242 |
d772ac32
|
Erik Kristensen
|
<?php include("fend.inc"); ?>
|
243 |
7f1f5492
|
Scott Ullrich
|
|
244 |
|
|
<script type="text/javascript">
|
245 |
d772ac32
|
Erik Kristensen
|
NiftyCheck();
|
246 |
|
|
Rounded("div#nifty","top","#FFF","#EEEEEE","smooth");
|
247 |
7f1f5492
|
Scott Ullrich
|
</script>
|
248 |
1df0159c
|
Erik Kristensen
|
|
249 |
7f1f5492
|
Scott Ullrich
|
|
250 |
5b237745
|
Scott Ullrich
|
</body>
|
251 |
561d55ff
|
Erik Kristensen
|
</html>
|