Project

General

Profile

Download (10.9 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
    index.php
5
    Copyright (C) 2004, 2005 Scott Ullrich
6
    All rights reserved.
7

    
8
    Originally part of m0n0wall (http://m0n0.ch/wall)
9
    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
    All rights reserved.
11

    
12
    Redistribution and use in source and binary forms, with or without
13
    modification, are permitted provided that the following conditions are met:
14

    
15
    1. Redistributions of source code must retain the above copyright notice,
16
       this list of conditions and the following disclaimer.
17

    
18
    2. Redistributions in binary form must reproduce the above copyright
19
       notice, this list of conditions and the following disclaimer in the
20
       documentation and/or other materials provided with the distribution.
21

    
22
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
    oR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
    POSSIBILITY OF SUCH DAMAGE.
32
*/
33

    
34
	## Load Essential Includes
35
	require_once('guiconfig.inc');
36
	require_once('notices.inc');
37

    
38

    
39
	## Load Functions Files
40
	require_once('includes/functions.inc.php');
41

    
42

    
43
	## Load AJAX, Initiate Class ###############################################
44
	require_once('includes/sajax.class.php');
45

    
46
	## Initiate Class and Set location of ajax file containing 
47
	## the information that we need for this page. Also set functions
48
	## that SAJAX will be using.
49
	$oSajax = new sajax();
50
	$oSajax->sajax_remote_uri = 'sajax/index.sajax.php';
51
	$oSajax->sajax_request_type = 'POST';
52
	$oSajax->sajax_export("get_stats");
53
	$oSajax->sajax_handle_client_request();
54
	############################################################################
55

    
56

    
57
	## Check to see if we have a swap space,
58
	## if true, display, if false, hide it ...
59
	$swapinfo = `/usr/sbin/swapinfo`;
60
	if(stristr($swapinfo,'%') == true) $showswap=true;
61

    
62

    
63
	## User recently restored his config.
64
	## If packages are installed lets resync
65
	if(file_exists('/conf/needs_package_sync')) {
66
		if($config['installedpackages'] <> '') {
67
			conf_mount_rw();
68
			unlink('/conf/needs_package_sync');
69
			header('Location: pkg_mgr_install.php?mode=reinstallall');
70
			exit;
71
		}
72
	}
73

    
74

    
75
	## If it is the first time webGUI has been
76
	## accessed since initial install show this stuff.
77
	if(file_exists('/conf/trigger_initial_wizard')) {
78
		conf_mount_rw();
79
		unlink('/conf/trigger_initial_wizard');
80
		conf_mount_ro();
81

    
82
		$pgtitle = 'pfSense first time setup';
83
		include('head.inc');
84

    
85
		echo "<body link=\"#0000CC\" vlink=\"#0000CC\" alink=\"#0000CC\">\n";
86
		echo "<form>\n";
87
		echo "<center>\n";
88
		echo "<img src=\"/themes/{$g['theme']}/images/logo.gif\" border=\"0\"><p>\n";
89
		echo "<div \" style=\"width:700px;background-color:#ffffff\" id=\"nifty\">\n";
90
		echo "Welcome to pfSense!<p>\n";
91
		echo "One moment while we start the initial setup wizard.<p>\n";
92
		echo "Embedded platform users: Please be patient, the wizard takes a little longer to run than the normal gui.<p>\n";
93
		echo "To bypass the wizard, click on the pfSense wizard on the initial page.\n";
94
		echo "</div>\n";
95
		echo "<meta http-equiv=\"refresh\" content=\"1;url=wizard.php?xml=setup_wizard.xml\">\n";
96
		echo "<script type=\"text/javascript\">\n";
97
		echo "NiftyCheck();\n";
98
		echo "Rounded(\"div#nifty\",\"all\",\"#000\",\"#FFFFFF\",\"smooth\");\n";
99
		echo "</script>\n";
100
		exit;
101
	}
102

    
103

    
104
	## Find out whether there's hardware encryption or not
105
	unset($hwcrypto);
106
	$fd = @fopen("{$g['varlog_path']}/dmesg.boot", "r");
107
	if ($fd) {
108
		while (!feof($fd)) {
109
			$dmesgl = fgets($fd);
110
			if (preg_match("/^hifn.: (.*?),/", $dmesgl, $matches)) {
111
				$hwcrypto = $matches[1];
112
				break;
113
			}
114
		}
115
		fclose($fd);
116
	}
117

    
118

    
119
	## Set Page Title and Include Header
120
	$pgtitle = "pfSense webGUI";
121
	include("head.inc");
122

    
123
?>
124

    
125
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
126

    
127
<?php
128
include("fbegin.inc");
129
	if(!file_exists("/usr/local/www/themes/{$g['theme']}/no_big_logo"))
130
		echo "<center><img src=\"./themes/".$g['theme']."/images/logobig.jpg\"></center><br>";
131
?>
132
<p class="pgtitle">System Overview</p>
133

    
134
<div id="niftyOutter">
135
<form action="index.php" method="post">
136
<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0">
137
	<tbody>
138
		<tr>
139
			<td colspan="2" class="listtopic">System information</td>
140
		</tr>
141
		<tr>
142
			<td width="25%" class="vncellt">Name</td>
143
			<td width="75%" class="listr"><?php echo $config['system']['hostname'] . "." . $config['system']['domain']; ?></td>
144
		</tr>
145
		<tr>
146
			<td width="25%" valign="top" class="vncellt">Version</td>
147
			<td width="75%" class="listr">
148
				<strong><?php readfile("/etc/version"); ?></strong>
149
				<br />
150
				built on <?php readfile("/etc/version.buildtime"); ?>
151
			</td>
152
		</tr>
153
		<tr>
154
			<td width="25%" class="vncellt">Platform</td>
155
			<td width="75%" class="listr"><?=htmlspecialchars($g['platform']);?></td>
156
		</tr>
157
		<?php if ($hwcrypto): ?>
158
		<tr>
159
			<td width="25%" class="vncellt">Hardware crypto</td>
160
			<td width="75%" class="listr"><?=htmlspecialchars($hwcrypto);?></td>
161
		</tr>
162
		<?php endif; ?>
163
		<tr>
164
			<td width="25%" class="vncellt">Uptime</td>
165
			<td width="75%" class="listr"><input style="border: 0px solid white;" size="30" name="uptime" id="uptime" value="<?= htmlspecialchars(get_uptime()); ?>" /></td>
166
		</tr>
167
		<?php if ($config['lastchange']): ?>
168
		<tr>
169
			<td width="25%" class="vncellt">Last config change</td>
170
			<td width="75%" class="listr"><?= htmlspecialchars(date("D M j G:i:s T Y", $config['revision']['time']));?></td>
171
		</tr>
172
		<?php endif; ?>
173
		<tr>
174
			<td width="25%" class="vncellt">State table size</td>
175
			<td width="75%" class="listr">
176
				<input style="border: 0px solid white;" size="30" name="pfstate" id="pfstate" value="<?= htmlspecialchars(get_pfstate()); ?>" />
177
		    	<br />
178
		    	<a href="diag_dump_states.php">Show states</a>
179
			</td>
180
		</tr>
181
		<tr>
182
			<td width="25%" class="vncellt">CPU usage</td>
183
			<td width="75%" class="listr">
184
				<?php $cpuUsage = "0"; ?>
185
				<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" />
186
				&nbsp;
187
				<input style="border: 0px solid white;" size="30" name="cpumeter" id="cpumeter" value="(Updating in 5 seconds)" />
188
			</td>
189
		</tr>
190
		<tr>
191
			<td width="25%" class="vncellt">Memory usage</td>
192
			<td width="75%" class="listr">
193
				<?php $memUsage = mem_usage(); ?>
194
				<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" />
195
				&nbsp;
196
				<input style="border: 0px solid white;" size="30" name="memusagemeter" id="memusagemeter" value="<?= $memUsage.'%'; ?>" />
197
			</td>
198
		</tr>
199
		<?php if($showswap == true): ?>
200
		<tr>
201
			<td width="25%" class="vncellt">SWAP usage</td>
202
			<td width="75%" class="listr">
203
				<?php $swapusage = swap_usage(); ?>
204
				<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" />
205
				&nbsp;
206
				<input style="border: 0px solid white;" size="30" name="swapusagemeter" id="swapusagemeter" value="<?= $swapusage.'%'; ?>" />
207
			</td>
208
		</tr>
209
		<?php endif; ?>
210
<?php
211
		if(has_temp()):
212
?>
213
		<tr>
214
			<td width='25%' class='vncellt'>Temperature</td>
215
			<td width='75%' class='listr'>
216
				<?php $temp = get_temp(); ?>
217
				<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" />
218
				&nbsp;
219
				<input style="border: 0px solid white;" size="30" name="tempmeter" id="tempmeter" value="<?= $temp."C"; ?>" />
220
			</td>
221
		</tr>
222
		<?php endif; ?>
223
		<tr>
224
			<td width="25%" class="vncellt">Disk usage</td>
225
			<td width="75%" class="listr">
226
				<?php $diskusage = disk_usage(); ?>
227
				<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" />
228
				&nbsp;
229
				<input style="border: 0px solid white;" size="30" name="diskusagemeter" id="diskusagemeter" value="<?= $diskusage.'%'; ?>" />
230
			</td>
231
		</tr>
232
	</tbody>
233
</table>
234
</form>
235
</div>
236

    
237
<?php include("fend.inc"); ?>
238
	    
239
<script type="text/javascript">
240
	NiftyCheck();
241
	Rounded("div#nifty","top","#FFF","#EEEEEE","smooth");
242
</script>
243

    
244
<meta http-equiv="refresh" content="120;url=<?php print $_SERVER['PHP_SELF']; ?>">
245

    
246
</body>
247
</html>
(58-58/155)