aboutsummaryrefslogtreecommitdiffstats
path: root/packages/freenas/www
diff options
context:
space:
mode:
authorDaniel Stefan Haischt <dsh@pfsense.org>2006-08-15 15:06:54 +0000
committerDaniel Stefan Haischt <dsh@pfsense.org>2006-08-15 15:06:54 +0000
commit94be140cc8597228b2b7e07fbb85027fd0993b92 (patch)
tree555036f49463238e5ef784cb4cbe4ed6d3edb397 /packages/freenas/www
parent255f3c2826af0a38fd463e27ad385e2e1e199f50 (diff)
downloadpfsense-packages-94be140cc8597228b2b7e07fbb85027fd0993b92.tar.gz
pfsense-packages-94be140cc8597228b2b7e07fbb85027fd0993b92.tar.bz2
pfsense-packages-94be140cc8597228b2b7e07fbb85027fd0993b92.zip
initial version of a FreeNAS package
Diffstat (limited to 'packages/freenas/www')
-rw-r--r--packages/freenas/www/diag_ad_infos.php156
-rw-r--r--packages/freenas/www/diag_ataidle_infos.php145
-rw-r--r--packages/freenas/www/diag_disk_infos.php141
-rw-r--r--packages/freenas/www/diag_fn_logs_daemon.php109
-rw-r--r--packages/freenas/www/diag_fn_logs_ftp.php109
-rw-r--r--packages/freenas/www/diag_fn_logs_rsyncd.php108
-rw-r--r--packages/freenas/www/diag_fn_logs_samba.php165
-rw-r--r--packages/freenas/www/diag_fn_logs_settings.php296
-rw-r--r--packages/freenas/www/diag_fn_logs_smartd.php109
-rw-r--r--packages/freenas/www/diag_fn_logs_sshd.php108
-rw-r--r--packages/freenas/www/diag_iscsi_infos.php133
-rw-r--r--packages/freenas/www/diag_mounts_infos.php128
-rw-r--r--packages/freenas/www/diag_part_infos.php134
-rw-r--r--packages/freenas/www/diag_raid_infos.php135
-rw-r--r--packages/freenas/www/diag_smart_infos.php133
-rw-r--r--packages/freenas/www/diag_space_infos.php128
-rw-r--r--packages/freenas/www/disks_manage.php203
-rw-r--r--packages/freenas/www/disks_manage_edit.php276
-rw-r--r--packages/freenas/www/disks_manage_init.php294
-rw-r--r--packages/freenas/www/disks_manage_iscsi.php199
-rw-r--r--packages/freenas/www/disks_mount.php208
-rw-r--r--packages/freenas/www/disks_mount_edit.php279
-rw-r--r--packages/freenas/www/disks_raid_gmirror.php223
-rw-r--r--packages/freenas/www/disks_raid_gmirror_edit.php267
-rw-r--r--packages/freenas/www/disks_raid_gmirror_infos.php132
-rw-r--r--packages/freenas/www/disks_raid_gmirror_init.php167
-rw-r--r--packages/freenas/www/disks_raid_gmirror_tools.php184
-rw-r--r--packages/freenas/www/disks_raid_gvinum.php222
-rw-r--r--packages/freenas/www/disks_raid_gvinum_edit.php266
-rw-r--r--packages/freenas/www/disks_raid_gvinum_infos.php132
-rw-r--r--packages/freenas/www/disks_raid_gvinum_init.php169
-rw-r--r--packages/freenas/www/disks_raid_gvinum_tools.php207
-rw-r--r--packages/freenas/www/services_afp.php190
-rw-r--r--packages/freenas/www/services_ftp.php347
-rw-r--r--packages/freenas/www/services_nfs.php219
-rw-r--r--packages/freenas/www/services_rsyncd.php263
-rw-r--r--packages/freenas/www/services_rsyncd_client.php565
-rw-r--r--packages/freenas/www/services_samba.php416
-rw-r--r--packages/freenas/www/status_disks.php119
39 files changed, 7784 insertions, 0 deletions
diff --git a/packages/freenas/www/diag_ad_infos.php b/packages/freenas/www/diag_ad_infos.php
new file mode 100644
index 00000000..b877c514
--- /dev/null
+++ b/packages/freenas/www/diag_ad_infos.php
@@ -0,0 +1,156 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("Active Directory Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_ad_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ if (! isset($freenas_config['ad']['enable'])) {
+ echo "<strong>AD Authentication disable</strong><br />";
+ } else {
+ echo "<pre style=\"font-size: medium;\">";
+ echo "<strong>Accessiblity test to MS domain:</strong><br />";
+ echo htmlspecialchars("Results for net rpc testjoin:") . "<br />";
+
+ exec("/usr/local/bin/net rpc testjoin",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($rawdata);
+
+ echo "<br />";
+ echo htmlspecialchars("Ping winbindd to see if it is alive:") . "<br />";
+
+ exec("/usr/local/bin/wbinfo -p",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($rawdata);
+
+ echo "<br />";
+ echo htmlspecialchars("Check shared secret:") . "<br />";
+
+ exec("/usr/local/bin/wbinfo -t",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($rawdata);
+
+ echo "<br>";
+ echo "</pre>";
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_ataidle_infos.php b/packages/freenas/www/diag_ataidle_infos.php
new file mode 100644
index 00000000..cffccc8f
--- /dev/null
+++ b/packages/freenas/www/diag_ataidle_infos.php
@@ -0,0 +1,145 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("ATAidle Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_ataidle_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), true, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ echo "<pre style=\"font-size: medium;\">";
+ $disklist=get_ata_disks_list();
+
+ echo "<strong>List of Advanced ATA capabilities on all ATA disk:</strong><br />";
+ foreach ($disklist as $disknamek => $disknamev)
+ {
+
+ /* Found the channel and device number from the /dev name */
+ /* Divise the number by 2, the interger is the channel number, the rest is the device */
+
+ echo htmlspecialchars("Results for $disknamek:") . "<br />";
+ $value=trim($disknamek,'ad');
+
+ $value=intval($value);
+ $channel = $value/2;
+ $device=$value % 2;
+ $channel=intval($channel);
+
+ exec("/usr/local/sbin/ataidle $channel $device",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($rawdata);
+ }
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_disk_infos.php b/packages/freenas/www/diag_disk_infos.php
new file mode 100644
index 00000000..7cf1d71a
--- /dev/null
+++ b/packages/freenas/www/diag_disk_infos.php
@@ -0,0 +1,141 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("Disk Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_disk_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), true, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ exec("/sbin/atacontrol list",$iderawdata);
+
+ echo "<pre style=\"font-size: medium;\">";
+
+ echo "<strong>List of detected ATA disks:</strong><br />";
+ foreach ($iderawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+
+ unset ($line);
+
+ exec("/sbin/camcontrol devlist",$scsirawdata);
+
+ echo "<strong>List of detected SCSI disks:</strong><br />";
+ foreach ($scsirawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+
+ }
+
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_fn_logs_daemon.php b/packages/freenas/www/diag_fn_logs_daemon.php
new file mode 100644
index 00000000..d320caa9
--- /dev/null
+++ b/packages/freenas/www/diag_fn_logs_daemon.php
@@ -0,0 +1,109 @@
+<?php
+/* $Id$ */
+/*
+ diag_logs_settings.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("System logs"),
+ gettext("Daemon"));
+
+require("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$nentries = $config['syslog']['nentries'];
+if (!$nentries)
+ $nentries = 50;
+
+if ($_POST['clear'])
+{
+ exec("/usr/sbin/clog -i -s 262144 /var/log/daemon.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_logs_daemon.php");
+ exit;
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="diag_fn_logs_daemon.php" method="post" name="iform" id="iform">
+<div id="inputerrors"></div>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), true, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> Daemon log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/daemon.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_fn_logs_ftp.php b/packages/freenas/www/diag_fn_logs_ftp.php
new file mode 100644
index 00000000..6f29e986
--- /dev/null
+++ b/packages/freenas/www/diag_fn_logs_ftp.php
@@ -0,0 +1,109 @@
+<?php
+/* $Id$ */
+/*
+ diag_logs_settings.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("System logs"),
+ gettext("FTP"));
+
+require("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$nentries = $config['syslog']['nentries'];
+if (!$nentries)
+ $nentries = 50;
+
+if ($_POST['clear'])
+{
+ exec("/usr/sbin/clog -i -s 262144 /var/log/ftp.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_ftp.php");
+ exit;
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="diag_fn_logs_ftp.php" method="post" name="iform" id="iform">
+<div id="inputerrors"></div>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), true, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> FTP log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/ftp.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_fn_logs_rsyncd.php b/packages/freenas/www/diag_fn_logs_rsyncd.php
new file mode 100644
index 00000000..ac3b458a
--- /dev/null
+++ b/packages/freenas/www/diag_fn_logs_rsyncd.php
@@ -0,0 +1,108 @@
+<?php
+/* $Id$ */
+/*
+ diag_logs_settings.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("System logs"),
+ gettext("RSYNCD"));
+
+require("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$nentries = $config['syslog']['nentries'];
+if (!$nentries)
+ $nentries = 50;
+
+if ($_POST['clear']) {
+ exec("/usr/sbin/clog -i -s 262144 /var/log/rsyncd.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_rsyncd.php");
+ exit;
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="diag_fn_logs_rsyncd.php" method="post" name="iform" id="iform">
+<div id="inputerrors"></div>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), true, "diag_fn_logs_rsyncd.php");
+ $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> RSYNCD log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/rsyncd.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_fn_logs_samba.php b/packages/freenas/www/diag_fn_logs_samba.php
new file mode 100644
index 00000000..679c8826
--- /dev/null
+++ b/packages/freenas/www/diag_fn_logs_samba.php
@@ -0,0 +1,165 @@
+<?php
+/* $Id$ */
+/*
+ diag_logs_settings.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("System logs"),
+ gettext("Samba"));
+
+require("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$nentries = $config['syslog']['nentries'];
+if (!$nentries)
+ $nentries = 50;
+
+if ($_POST['clear']) {
+ exec("/bin/cp /dev/null /var/log/samba/log.nmbd");
+ exec("/bin/cp /dev/null /var/log/samba/log.smbd");
+ exec("/bin/cp /dev/null /var/log/samba/log.winbindd");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_samba.php");
+ exit;
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="diag_fn_logs_samba.php" method="post" name="iform" id="iform">
+<div id="inputerrors"></div>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), true, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> nmbd service log entries
+ </td>
+ </tr>
+ <?php
+ if (file_exists("/var/log/samba/log.nmbd")) {
+ exec("cat /var/log/samba/log.nmbd", $rawlog);
+ } else {
+ $rawlog=array("No logs");
+ }
+ ?>
+ <?php foreach ($rawlog as $log) { ?>
+ <tr>
+ <td class="listr" nowrap>
+ <pre><?php echo htmlspecialchars($log); } ?></pre>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <?php unset ($rawlog); ?>
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> smbd service log entries
+ </td>
+ </tr>
+ <?php
+ if (file_exists("/var/log/samba/log.smbd")) {
+ exec("cat /var/log/samba/log.smbd", $rawlog);
+ } else {
+ $rawlog=array("No logs");
+ }
+ ?>
+ <?php foreach ($rawlog as $log) { ?>
+ <tr>
+ <td class="listr" nowrap>
+ <pre><?php echo htmlspecialchars($log); } ?></pre>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> winbindd service log entries
+ </td>
+ </tr>
+ <?php
+ if (file_exists("/var/log/samba/log.winbindd")) {
+ exec("cat /var/log/samba/log.winbindd", $rawlog);
+ } else {
+ $rawlog=array("No logs");
+ }
+ ?>
+ <?php foreach ($rawlog as $log) { ?>
+ <tr>
+ <td class="listr" nowrap>
+ <pre><?php echo htmlspecialchars($log); } ?></pre>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_fn_logs_settings.php b/packages/freenas/www/diag_fn_logs_settings.php
new file mode 100644
index 00000000..1f4ada67
--- /dev/null
+++ b/packages/freenas/www/diag_fn_logs_settings.php
@@ -0,0 +1,296 @@
+<?php
+/* $Id$ */
+/*
+ diag_logs_settings.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("System logs"),
+ gettext("Settings"));
+
+require("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$pconfig['reverse'] = isset($config['syslog']['reverse']);
+$pconfig['nentries'] = $config['syslog']['nentries'];
+$pconfig['remoteserver'] = $config['syslog']['remoteserver'];
+$pconfig['filter'] = isset($config['syslog']['filter']);
+$pconfig['dhcp'] = isset($config['syslog']['dhcp']);
+$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
+$pconfig['vpn'] = isset($config['syslog']['vpn']);
+$pconfig['system'] = isset($config['syslog']['system']);
+$pconfig['enable'] = isset($config['syslog']['enable']);
+$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
+$pconfig['rawfilter'] = isset($config['syslog']['rawfilter']);
+$pconfig['disablelocallogging'] = isset($config['syslog']['disablelocallogging']);
+$pconfig['webservlogs'] = isset($config['syslog']['webservlogs']);
+
+$pconfig['sshd'] = isset($config['syslog']['sshd']);
+$pconfig['ftp'] = isset($config['syslog']['ftp']);
+$pconfig['rsyncd'] = isset($config['syslog']['rsyncd']);
+$pconfig['smartd'] = isset($config['syslog']['smartd']);
+$pconfig['daemon'] = isset($config['syslog']['daemon']);
+
+if (!$pconfig['nentries'])
+ $pconfig['nentries'] = 50;
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable'] && !is_ipaddr($_POST['remoteserver'])) {
+ $input_errors[] = gettext("A valid IP address must be specified.");
+ }
+ if (($_POST['nentries'] < 5) || ($_POST['nentries'] > 2000)) {
+ $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
+ }
+
+ if (!$input_errors) {
+ $config['syslog']['reverse'] = $_POST['reverse'] ? true : false;
+ $config['syslog']['nentries'] = (int)$_POST['nentries'];
+ $config['syslog']['remoteserver'] = $_POST['remoteserver'];
+ $config['syslog']['filter'] = $_POST['filter'] ? true : false;
+ $config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
+ $config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
+ $config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
+ $config['syslog']['system'] = $_POST['system'] ? true : false;
+ $config['syslog']['disablelocallogging'] = $_POST['disablelocallogging'] ? true : false;
+ $config['syslog']['enable'] = $_POST['enable'] ? true : false;
+ $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
+ $config['syslog']['nologdefaultblock'] = $_POST['logdefaultblock'] ? false : true;
+ $config['syslog']['rawfilter'] = $_POST['rawfilter'] ? true : false;
+ $config['syslog']['webservlogs'] = $_POST['webservlogs'] ? true : false;
+ $config['syslog']['sshd'] = $_POST['sshd'] ? true : false;
+ $config['syslog']['ftp'] = $_POST['ftp'] ? true : false;
+ $config['syslog']['rsyncd'] = $_POST['rsyncd'] ? true : false;
+ $config['syslog']['smartd'] = $_POST['smartd'] ? true : false;
+ $config['syslog']['daemon'] = $_POST['daemon'] ? true : false;
+ if($config['syslog']['enable'] == false)
+ unset($config['syslog']['remoteserver']);
+
+ write_config();
+
+ $retval = 0;
+ config_lock();
+ $retval = system_syslogd_start();
+ if ($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock']))
+ $retval |= filter_configure();
+ config_unlock();
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script language="JavaScript" type="text/javascript">
+<!--
+function enable_change(enable_over) {
+ endis = !(document.iform.enable.checked || enable_over);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+ if (document.iform.enable.checked || enable_over) {
+ document.iform.remoteserver.disabled = 0;
+ document.iform.filter.disabled = 0;
+ document.iform.dhcp.disabled = 0;
+ document.iform.portalauth.disabled = 0;
+ document.iform.vpn.disabled = 0;
+ document.iform.system.disabled = 0;
+ document.iform.webservlogs.disabled = 0;
+ document.iform.sshd.disabled = 0;
+ document.iform.ftp.disabled = 0;
+ document.iform.rsyncd.disabled = 0;
+ document.iform.smartd.disabled = 0;
+ document.iform.daemon.disabled = 0;
+
+ } else {
+ document.iform.remoteserver.disabled = 1;
+ document.iform.filter.disabled = 1;
+ document.iform.dhcp.disabled = 1;
+ document.iform.portalauth.disabled = 1;
+ document.iform.vpn.disabled = 1;
+ document.iform.system.disabled = 1;
+ document.iform.webservlogs.disabled = 1;
+ document.iform.sshd.disabled = 1;
+ document.iform.ftp.disabled = 1;
+ document.iform.rsyncd.disabled = 1;
+ document.iform.smartd.disabled = 1;
+ document.iform.daemon.disabled = 1;
+ }
+
+ /* color adjustments */
+ document.iform.remoteserver.style.backgrounColor = color;
+ document.iform.filter.style.backgrounColor = color;
+ document.iform.dhcp.style.backgrounColor = color;
+ document.iform.portalauth.style.backgrounColor = color;
+ document.iform.vpn.style.backgrounColor = color;
+ document.iform.system.style.backgrounColor = color;
+ document.iform.webservlogs.style.backgrounColor = color;
+ document.iform.sshd.style.backgrounColor = color;
+ document.iform.ftp.style.backgrounColor = color;
+ document.iform.rsyncd.style.backgrounColor = color;
+ document.iform.smartd.style.backgrounColor = color;
+ document.iform.daemon.style.backgrounColor = color;
+}
+// -->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="diag_fn_logs_settings.php" method="post" name="iform" id="iform">
+<div id="inputerrors"></div>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), true, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"> <input name="reverse" class="formfld" type="checkbox" id="reverse" value="yes" <?php if ($pconfig['reverse']) echo "checked"; ?> />
+ <strong><?=gettext("Show log entries in reverse order (newest entries on top)");?></strong></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"><?=gettext("Number of log entries to show");?>:
+ <input name="nentries" id="nentries" type="text" class="formfld unknown" size="4" value="<?=htmlspecialchars($pconfig['nentries']);?>" /></td>
+ </tr>
+ <tr>
+ <td valign="top" class="vtable">&nbsp;</td>
+ <td class="vtable"> <input name="logdefaultblock" class="formfld" type="checkbox" id="logdefaultblock" value="yes" <?php if ($pconfig['logdefaultblock']) echo "checked"; ?> />
+ <strong><?=gettext("Log packets blocked by the default rule");?></strong><br />
+ <?=gettext("Hint: packets that are blocked by the
+ implicit default block rule will not be logged anymore
+ if you uncheck this option. Per-rule logging options are not affected.");?></td>
+ </tr>
+ <tr>
+ <td valign="top" class="vtable">&nbsp;</td>
+ <td class="vtable"> <input name="rawfilter" class="formfld" type="checkbox" id="rawfilter" value="yes" <?php if ($pconfig['rawfilter']) echo "checked"; ?> />
+ <strong><?=gettext("Show raw filter logs");?></strong><br />
+ <?=gettext("Hint: If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information.");?> </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"> <input name="disablelocallogging" class="formfld" type="checkbox" id="disablelocallogging" value="yes" <?php if ($pconfig['disablelocallogging']) echo "checked"; ?> onclick="enable_change(false)" />
+ <strong><?=gettext("Disable writing log files to the local disk");?></strong></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vtable">&nbsp;</td>
+ <td width="78%" class="vtable"> <input name="enable" class="formfld" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onclick="enable_change(false)" />
+ <strong><?=gettext("Enable syslog'ing to remote syslog server");?></strong></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Remote syslog
+ server</td>
+ <td width="78%" class="vtable">
+ <input name="remoteserver" id="remoteserver" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['remoteserver']);?>" />
+ <br /><?=gettext("IP address of remote syslog server");?>
+ <br /><br />
+ <input name="system" id="system" class="formfld" type="checkbox" value="yes" onclick="enable_change(false)" <?php if ($pconfig['system']) echo "checked=\"checked\""; ?> />
+ <?=gettext("system events");?><br />
+ <input name="filter" id="filter" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['filter']) echo "checked=\"checked\""; ?> />
+ <?=gettext("firewall events");?><br />
+ <input name="dhcp" id="dhcp" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['dhcp']) echo "checked=\"checked\""; ?> />
+ <?=gettext("DHCP service events");?><br />
+ <input name="portalauth" id="portalauth" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['portalauth']) echo "checked=\"checked\""; ?> />
+ <?=gettext("Portal Auth");?><br />
+ <input name="vpn" id="vpn" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['vpn']) echo "checked=\"checked\""; ?> />
+ <?=gettext("PPTP VPN events");?><br />
+ <input name="webservlogs" id="webservlogs" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['webservlogs']) echo "checked=\"checked\""; ?> />
+ <?=gettext("webConfigurator Logs");?><br />
+ <input name="sshd" id="sshd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['sshd']) echo "checked=\"checked\""; ?> />
+ <?=gettext("SSHD events");?><br />
+ <input name="ftp" id="ftp" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['ftp']) echo "checked=\"checked\""; ?> />
+ <?=gettext("FTP events");?><br />
+ <input name="rsyncd" id="rsyncd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['rsyncd']) echo "checked=\"checked\""; ?> />
+ <?=gettext("RSYNCD events");?><br />
+ <input name="smartd" id="smartd" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['smartd']) echo "checked=\"checked\""; ?> />
+ <?=gettext("SMARTD events");?><br />
+ <input name="daemon" id="daemon" class="formfld" type="checkbox" value="yes" <?php if ($pconfig['daemon']) echo "checked=\"checked\""; ?> />
+ <?=gettext("Daemon events");?><br />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%"> <input id="submit" name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" height="53" valign="top">&nbsp;</td>
+ <td width="78%"><strong><span class="red"><?=gettext("Note");?>:</span></strong><br />
+ <?=gettext("
+ syslog sends UDP datagrams to port 514 on the specified
+ remote syslog server. Be sure to set syslogd on the
+ remote server to accept syslog messages from {$g['product_name']}.
+ ");?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<script language="JavaScript" type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_fn_logs_smartd.php b/packages/freenas/www/diag_fn_logs_smartd.php
new file mode 100644
index 00000000..c5e9cb88
--- /dev/null
+++ b/packages/freenas/www/diag_fn_logs_smartd.php
@@ -0,0 +1,109 @@
+<?php
+/* $Id$ */
+/*
+ diag_logs_settings.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("System logs"),
+ gettext("SMARTD"));
+
+require("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$nentries = $config['syslog']['nentries'];
+if (!$nentries)
+ $nentries = 50;
+
+if ($_POST['clear'])
+{
+ exec("/usr/sbin/clog -i -s 262144 /var/log/smartd.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_fn_logs_smartd.php");
+ exit;
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="diag_fn_logs_smartd.php" method="post" name="iform" id="iform">
+<div id="inputerrors"></div>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array[] = array(gettext("SSHD"), false, "diag_fn_logs_sshd.php");
+ $tab_array[] = array(gettext("SMARTD"), true, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> SmartD log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/smartd.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_fn_logs_sshd.php b/packages/freenas/www/diag_fn_logs_sshd.php
new file mode 100644
index 00000000..56c6147a
--- /dev/null
+++ b/packages/freenas/www/diag_fn_logs_sshd.php
@@ -0,0 +1,108 @@
+<?php
+/* $Id$ */
+/*
+ diag_logs_settings.php
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
+
+ originially part of m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("System logs"),
+ gettext("SSHD"));
+
+require("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$nentries = $config['syslog']['nentries'];
+if (!$nentries)
+ $nentries = 50;
+
+if ($_POST['clear']) {
+ exec("/usr/sbin/clog -i -s 262144 /var/log/sshd.log");
+ /* redirect to avoid reposting form data on refresh */
+ pfSenseHeader("diag_logs_sshd.php");
+ exit;
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<form action="diag_fn_logs_sshd.php" method="post" name="iform" id="iform">
+<div id="inputerrors"></div>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Samba"), false, "diag_fn_logs_samba.php");
+ $tab_array[] = array(gettext("FTP"), false, "diag_fn_logs_ftp.php");
+ $tab_array[] = array(gettext("RSYNCD"), false, "diag_fn_logs_rsyncd.php");
+ $tab_array[] = array(gettext("SSHD"), true, "diag_fn_logs_sshd.php");
+ $tab_array[] = array(gettext("SMARTD"), false, "diag_fn_logs_smartd.php");
+ $tab_array[] = array(gettext("Daemon"), false, "diag_fn_logs_daemon.php");
+ $tab_array[] = array(gettext("Settings"), false, "diag_fn_logs_settings.php");
+ display_top_tabs($tab_array);?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic">
+ Last <?=$nentries;?> SSHD log entries
+ </td>
+ </tr>
+ <?php dump_clog("/var/log/sshd.log", $nentries); ?>
+ <tr>
+ <td align="left" valign="top" height="12">&nbsp;</td>
+ </tr>
+ <tr>
+ <td align="left" valign="top">
+ <input name="clear" type="submit" class="formbtn" value="Clear log" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_iscsi_infos.php b/packages/freenas/www/diag_iscsi_infos.php
new file mode 100644
index 00000000..e90bf8ed
--- /dev/null
+++ b/packages/freenas/www/diag_iscsi_infos.php
@@ -0,0 +1,133 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("iSCSI Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_iscsi_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), true, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ if (! isset($freenas_config['iscsi']['enable'])) {
+ echo "<strong>iSCSI initiator disabled</strong><br />";
+ } else {
+ echo "<pre style=\"font-size: medium;\">";
+ echo "<strong>Show the list of available target Name on the iSCSI target</strong><br>";
+
+ exec("/usr/local/sbin/iscontrol -d targetaddress={$freenas_config['iscsi']['targetaddress']}",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br>";
+ }
+ unset ($rawdata);
+ echo "</pre>";
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_mounts_infos.php b/packages/freenas/www/diag_mounts_infos.php
new file mode 100644
index 00000000..36bbec52
--- /dev/null
+++ b/packages/freenas/www/diag_mounts_infos.php
@@ -0,0 +1,128 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("Mount Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_mounts_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), true, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ echo "<pre style=\"font-size: medium;\">";
+ echo "<strong>List of mounted point:</strong><br />";
+ exec("/sbin/mount",$mountrawdata);
+ foreach ($mountrawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($line);
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_part_infos.php b/packages/freenas/www/diag_part_infos.php
new file mode 100644
index 00000000..7201f11c
--- /dev/null
+++ b/packages/freenas/www/diag_part_infos.php
@@ -0,0 +1,134 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("Partition Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_part_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), true, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ echo "<pre style=\"font-size: medium;\">";
+
+ $disklist = get_physical_disks_list();
+
+ echo "<strong>List of partition on all detected disk:</strong><br />";
+ foreach ($disklist as $disknamek => $disknamev)
+ {
+ exec("/sbin/fdisk $disknamek",$fdiskrawdata);
+ foreach ($fdiskrawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($fdiskrawdata);
+ }
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_raid_infos.php b/packages/freenas/www/diag_raid_infos.php
new file mode 100644
index 00000000..b469aa52
--- /dev/null
+++ b/packages/freenas/www/diag_raid_infos.php
@@ -0,0 +1,135 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("RAID Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_raid_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), true, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ echo "<pre style=\"font-size: medium;\">";
+ echo "<strong>Software RAID - gmirror status:</strong><br />";
+ exec("/sbin/gmirror list",$rawdata);
+ foreach ($rawdata as $line) {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($line);
+ unset ($rawdata);
+
+ echo "<strong>Software RAID - gvinum status:</strong><br />";
+ exec("/sbin/gvinum list",$rawdata);
+ foreach ($rawdata as $line) {
+ echo htmlspecialchars($line) . "<br>";
+ }
+ unset ($line);
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_smart_infos.php b/packages/freenas/www/diag_smart_infos.php
new file mode 100644
index 00000000..9a43e210
--- /dev/null
+++ b/packages/freenas/www/diag_smart_infos.php
@@ -0,0 +1,133 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("SMART Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_smart_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), true, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), false, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ echo "<pre style=\"font-size: medium;\">";
+ $disklist = get_physical_disks_list();
+
+ echo "<strong>List of SMART capabilities on all detected disk:</strong><br />";
+ foreach ($disklist as $disknamek => $disknamev)
+ {
+ exec("/usr/local/sbin/smartctl -a /dev/$disknamek",$fdiskrawdata);
+ foreach ($fdiskrawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ unset ($fdiskrawdata);
+ }
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/diag_space_infos.php b/packages/freenas/www/diag_space_infos.php
new file mode 100644
index 00000000..f30688e1
--- /dev/null
+++ b/packages/freenas/www/diag_space_infos.php
@@ -0,0 +1,128 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Diagnostics"),
+ gettext("Space Infos"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="diag_space_infos.php" method="post" name="iform" id="iform">
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Disks"), false, "diag_disks_infos.php");
+ $tab_array[1] = array(gettext("Partitions"), false, "diag_part_infos.php");
+ $tab_array[2] = array(gettext("SMART"), false, "diag_smart_infos.php");
+ $tab_array[3] = array(gettext("ataidle"), false, "diag_ataidle_infos.php");
+ $tab_array[4] = array(gettext("Space used"), true, "diag_space_infos.php");
+ $tab_array[5] = array(gettext("Mounts"), false, "diag_mounts_infos.php");
+ $tab_array[6] = array(gettext("Software RAID"), false, "diag_raid_infos.php");
+ $tab_array[7] = array(gettext("iSCSI"), false, "diag_iscsi_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "diag_ad_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="top">
+ <?php
+ echo "<pre style=\"font-size: medium;\">";
+ exec("/bin/df -h",$rawdata);
+
+ echo "<strong>Free Space:</strong><br />";
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br />";
+ }
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_manage.php b/packages/freenas/www/disks_manage.php
new file mode 100644
index 00000000..ee2e6dc0
--- /dev/null
+++ b/packages/freenas/www/disks_manage.php
@@ -0,0 +1,203 @@
+#!/usr/local/bin/php
+<?php
+/* $Id$ */
+/*
+ disks_manage.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ All rights reserved.
+
+ Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("Management"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['disks']['disk']))
+ $freenas_config['disks']['disk'] = array();
+
+disks_sort();
+
+$a_disk_conf = &$freenas_config['disks']['disk'];
+
+if ($_POST) {
+
+ unset($input_errors);
+
+ /* input validation */
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (! file_exists($d_sysrebootreqd_path)) {
+ config_lock();
+ /* reload all components that mount disk */
+ // disks_mount_all();
+ /* Is formated?: If not create FS */
+ /* $retval = disk_disks_create_ufs(); */
+
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_diskdirty_path)) {
+ unlink($d_diskdirty_path);
+ }
+ }
+ }
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($input_errors)) {
+ input_errors2Ajax($input_errors);
+ exit;
+ }
+
+ if (!$input_errors) {
+ /* No errors detected, so update the config */
+ }
+}
+
+if ($_GET['act'] == "del") {
+ if ($a_disk_conf[$_GET['id']]) {
+ unset($a_disk_conf[$_GET['id']]);
+ write_config();
+ touch($d_diskdirty_path);
+ pfSenseHeader("disks_manage.php");
+ exit;
+ }
+}
+
+/* if ajax is calling, give them an update message */
+if(isAjax())
+ print_info_box_np($savemsg);
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="disks_manage.php" method="post" name="iform" id="iform">
+<?php if (file_exists($d_diskdirty_path)): ?>
+<?php print_info_box_np(gettext("The disk list has been changed.") . "<br />" .
+ gettext("You must apply the changes in order for them to take effect."));?>
+<?php endif; ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage"), true, "disks_manage.php");
+ $tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php");
+ $tab_array[2] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Disk");?></td>
+ <td class="listhdrr"><?=gettext("Size");?></td>
+ <td class="listhdrr"><?=gettext("Description");?></td>
+ <td class="listhdrr"><?=gettext("Standby time");?></td>
+ <td class="listhdrr"><?=gettext("File system");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_disk_conf as $disk): ?>
+ <tr>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($disk['name']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($disk['size']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($disk['desc']);?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ if ($disk['harddiskstandby']) {
+ $value = $disk['harddiskstandby'];
+ //htmlspecialchars($value);
+ echo $value;
+ } else {
+ echo "Always on";
+ }
+ ?>
+ </td>
+ <td valign="middle" class="listr">
+ <?= ($disk['fstype']) ? $disk['fstype']: gettext("unknown or unformatted"); ?>
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ $stat = disks_status($disk);
+ echo $stat;
+ ?>
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_manage_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_manage.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="6"></td>
+ <td class="list" nowrap>
+ <a href="disks_manage_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+</table>
+</div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_manage_edit.php b/packages/freenas/www/disks_manage_edit.php
new file mode 100644
index 00000000..416d9bc6
--- /dev/null
+++ b/packages/freenas/www/disks_manage_edit.php
@@ -0,0 +1,276 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("Management"),
+ gettext("Edit"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+/* get disk list (without CDROM) */
+$disklist = get_physical_disks_list();
+
+if (!is_array($freenas_config['disks']['disk']))
+ $freenas_config['disks']['disk'] = array();
+
+disks_sort();
+
+$a_disk = &$freenas_config['disks']['disk'];
+
+if (isset($id) && $a_disk[$id])
+{
+ $pconfig['name'] = $a_disk[$id]['name'];
+ $pconfig['harddiskstandby'] = $a_disk[$id]['harddiskstandby'];
+ $pconfig['acoustic'] = $a_disk[$id]['acoustic'];
+ $pconfig['fstype'] = $a_disk[$id]['fstype'];
+ $pconfig['apm'] = $a_disk[$id]['apm'];
+ $pconfig['udma'] = $a_disk[$id]['udma'];
+
+}
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = split(" ", "name");
+ $reqdfieldsn = split(",", "Name");
+
+ do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
+ $pconfig = $_POST;
+
+ /* check for name conflicts */
+ foreach ($a_disk as $disk)
+ {
+ if (isset($id) && ($a_disk[$id]) && ($a_disk[$id] === $disk))
+ continue;
+
+ if ($disk['name'] == $_POST['name'])
+ {
+ $error_bucket[] = array("error" => gettext("This disk already exists in the disk list."),
+ "field" => "name");
+ break;
+ }
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $disks = array();
+
+ $devname = $_POST['name'];
+ $devharddiskstandby = $_POST['harddiskstandby'];
+ $harddiskacoustic = $_POST['acoustic'];
+ $harddiskapm = $_POST['apm'];
+ $harddiskudma = $_POST['udma'];
+ $harddiskfstype = $_POST['fstype'];
+
+ $disks['name'] = $devname;
+ $disks['harddiskstandby'] = $devharddiskstandby ;
+ $disks['acoustic'] = $harddiskacoustic ;
+ if ($harddiskfstype) $disks['fstype'] = $harddiskfstype ;
+ $disks['apm'] = $harddiskapm ;
+ $disks['udma'] = $harddiskudma ;
+ $disks['type'] = $disklist[$devname]['type'];
+ $disks['desc'] = $disklist[$devname]['desc'];
+ $disks['size'] = $disklist[$devname]['size'];
+
+ if (isset($id) && $a_disk[$id])
+ $a_disk[$id] = $disks;
+ else
+ $a_disk[] = $disks;
+
+ touch($d_diskdirty_path);
+
+ disks_set_ataidle();
+ write_config();
+
+ pfSenseHeader("disks_manage.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="disks_manage_edit.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td>
+ <td width="78%" class="vtable">
+ <select name="name" class="formselect" id="name">
+ <?php foreach ($disklist as $diski => $diskv): ?>
+ <option value="<?=$diski;?>" <?php if ($diski == $pconfig['name']) echo "selected=\"selected\"";?>>
+ <?php echo htmlspecialchars($diski . ": " .$diskv['size'] . " (" . $diskv['desc'] . ")");?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("UDMA mode");?></td>
+ <td width="78%" class="vtable">
+ <select name="udma" class="formselect" id="udma">
+ <?php
+ $types = explode(",", "Auto,UDMA-33,UDMA-66,UDMA-100,UDMA-133");
+ $vals = explode(" ", "auto UDMA2 UDMA4 UDMA5 UDMA6");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['udma']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ <br />
+ <?= gettext("You can force UDMA mode if you have \"UDMA_ERROR.... LBA\" message with your hard drive."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Hard disk standby time");?></td>
+ <td width="78%" class="vtable">
+ <select name="harddiskstandby" class="formselect">
+ <?php
+ $sbvals = array(0=>"Always on",5=>"5 minutes",10=>"10 minutes",20=>"20 minutes",30=>"30 minutes",60=>"60 minutes");
+ ?>
+ <?php foreach ($sbvals as $sbval => $sbname): ?>
+ <option value="<?=$sbval;?>" <?php if($pconfig['harddiskstandby'] == $sbval) echo 'selected="selected"';?>><?=htmlspecialchars($sbname);?></option>
+ <?php endforeach; ?>
+ </select>
+ <br />
+ <?= gettext("Puts the hard disk into standby mode when the selected amount of time after the last
+ access has elapsed. <em>Do not set this for CF cards.</em>"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Advanced Power Management");?></td>
+ <td width="78%" class="vtable">
+ <select name="apm" class="formselect">
+ <?php
+ $apmvals = array(0=>"Disabled",1=>"Minimum power usage with Standby",64=>"Medium power usage with Standby",128=>"Minimum power usage without Standby",192=>"Medium power usage without Standby",254=>"Maximum performance, maximum power usage");
+ ?>
+ <?php foreach ($apmvals as $apmval => $apmname): ?>
+ <option value="<?=$apmval;?>" <?php if($pconfig['apm'] == $apmval) echo 'selected="selected"';?>><?=htmlspecialchars($apmname);?></option>
+ <?php endforeach; ?>
+ </select>
+ <br />
+ <?= gettext("This allows you to lower the power consumption of the drive, at the expense of performance.<em>Do not set this for CF cards.</em>"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("acoustic level");?></td>
+ <td width="78%" class="vtable">
+ <select name="acoustic" class="formselect">
+ <?php
+ $acvals = array(0=>"Disabled",1=>"Minimum performance, Minimum acoustic output",64=>"Medium acoustic output",127=>"Maximum performance, maximum acoustic output");
+ ?>
+ <?php foreach ($acvals as $acval => $acname): ?>
+ <option value="<?=$acval;?>" <?php if($pconfig['acoustic'] == $acval) echo 'selected';?>><?=htmlspecialchars($acname);?></option>
+ <?php endforeach; ?>
+ </select>
+ <br />
+ <?= gettext("This allows you to set how loud the drive is while it\'s operating.<em>Do not set this for CF cards.</em>"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("preformated FS");?></td>
+ <td width="78%" class="vtable">
+ <select name="fstype" class="formselect">
+ <?php
+ $fstvals = array(
+ ""=>"unformated",
+ "ufs"=>"UFS with Soft Updates (use 8% space disk)",
+ "ufs_no_su"=>"UFS",
+ "ufsgpt"=>"UFS (EFI/GPT) with Soft Updates (use 8% space disk)",
+ "ufsgpt_no_su"=>"UFS (EFI/GPT)",
+ "msdos"=>"FAT32",
+ "ntfs"=>"NTFS",
+ "raid"=>"Software RAID: gmirror",
+ "raid"=>"Software RAID: gvinum");
+ ?>
+ <?php foreach ($fstvals as $fstval => $fstname): ?>
+ <option value="<?=$fstval;?>" <?php if($pconfig['fstype'] == $fstval) echo 'selected';?>><?=htmlspecialchars($fstname);?></option>
+ <?php endforeach; ?>
+ </select>
+ <br />
+ <?= gettext("This allows you to set FS type for preformated disk with data.<br />
+ <em>Leave \"unformated\" for unformated disk and then use Format menu.</em>"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ <?php if (isset($id) && $a_disk[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>">
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_manage_init.php b/packages/freenas/www/disks_manage_init.php
new file mode 100644
index 00000000..b6fce877
--- /dev/null
+++ b/packages/freenas/www/disks_manage_init.php
@@ -0,0 +1,294 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("Initialize"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['disks']['disk']))
+ $freenas_config['disks']['disk'] = array();
+
+disks_sort();
+
+$a_disk = &$freenas_config['disks']['disk'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_format);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = explode(" ", "disk type");
+ $reqdfieldsn = explode(",", "Disk,Type");
+
+ do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $do_format = true;
+ $disk = $_POST['disk'];
+ $type = $_POST['type'];
+ $diskid = $_POST['id'];
+ $notinitmbr= $_POST['notinitmbr'];
+
+ /* found the name in the config: Must be a better way for did that */
+
+ $id=0;
+ $i=0;
+ foreach ($a_disk as $disks)
+ {
+ $diskname=$disks['name'];
+ if (strcmp($diskname,$disk)==0)
+ $id=$i;
+ $i++;
+ }
+
+ if ($type == "ufs" || $type == "ufsgpt" || $type == "ufs_no_su" || $type == "ufsgpt_no_su")
+ $a_disk[$id]['fstype'] = "ufs";
+ else
+ $a_disk[$id]['fstype'] = $type;
+ write_config();
+ }
+}
+
+if (!isset($do_format))
+{
+ $do_format = false;
+ $disk = '';
+ $type = '';
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage"), false, "disks_manage.php");
+ $tab_array[1] = array(gettext("Format"), true, "disks_manage_init.php");
+ $tab_array[2] = array(gettext("iSCSI Initiator"), false, "disks_manage_iscsi.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form id="iform" name="iform" action="disks_manage_init.php" method="post">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td>
+ <td width="78%" class="vtable">
+ <select name="disk" class="formselect" id="disk">
+ <?php foreach ($a_disk as $diskn): ?>
+ <option value="<?=$diskn['name'];?>"<?php if ($diskn['name'] == $disk) echo "selected=\"selected\"";?>>
+ <?php echo htmlspecialchars($diskn['name'] . ": " .$diskn['size'] . " (" . $diskn['desc'] . ")");?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("File system");?></td>
+ <td width="78%" class="vtable">
+ <select name="type" class="formselect" id="type">
+ <option value="ufs" <?php if ($type == "ufs") echo "selected=\"selected\""; ?>>UFS with Soft Updates (use 8% space disk)</option>
+ <option value="ufs_no_su" <?php if ($type == "ufs_no_su") echo "selected=\"selected\""; ?>>UFS</option>
+ <option value="ufsgpt" <?php if ($type == "ufsgpt") echo "selected=\"selected\""; ?>>UFS (EFI/GPT) with Soft Updates (use 8% space disk)</option>
+ <option value="ufsgpt_no_su" <?php if ($type == "ufsgpt_no_su") echo "selected=\"selected\""; ?>>UFS (EFI/GPT)</option>
+ <option value="msdos" <?php if ($type == "msdos") echo "selected=\"selected\""; ?>>FAT32</option>
+ <option value="gmirror" <?php if ($type == "gmirror") echo "selected=\"selected\""; ?>>Software RAID: Geom mirror</option>
+ <option value="raid" <?php if ($type == "raid") echo "selected=\"selected\""; ?>>Software RAID: Geom Vinum</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("File system");?></td>
+ <td width="78%" class="vtable">
+ <input name="notinitmbr" id="notinitmbr" type="checkbox" value="yes" /><br />
+ <?= gettext("don't erase the MBR (useful for some RAID controller cards)"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Format disk!");?>" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <? if ($do_format)
+ {
+ echo(_DISKSMANAGEINITPHP_INITTEXT);
+ echo('<pre>');
+ ob_end_flush();
+
+ /* Erase MBR if not checked*/
+
+ if (!$notinitmbr) {
+ echo "Erasing MBR\n";
+ system("dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . " bs=32k count=640");
+
+ }
+ else
+ echo "Keeping the MBR\n";
+
+ switch ($type)
+ {
+ case "ufs":
+ /* Initialize disk */
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ echo "\"fdisk: Geom not found\"is not an error message!\n";
+ /* Initialise the partition (optional) */
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Create s1 label */
+ system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
+ // Create filesystem
+ system("/sbin/newfs -U /dev/" . escapeshellarg($disk) . "s1");
+ break;
+ case "ufs_no_su":
+ /* Initialize disk */
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ /* Initialise the partition (optional) */
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Create s1 label */
+ system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
+ // Create filesystem
+ system("/sbin/newfs -m 0 /dev/" . escapeshellarg($disk) . "s1");
+ break;
+ case "ufsgpt":
+ /* Create GPT partition table */
+ system("/sbin/gpt destroy " . escapeshellarg($disk));
+ system("/sbin/gpt create -f " . escapeshellarg($disk));
+ system("/sbin/gpt add -t ufs " . escapeshellarg($disk));
+ // Create filesystem
+ system("/sbin/newfs -U /dev/" . escapeshellarg($disk) . "p1");
+ break;
+ case "ufsgpt_no_su":
+ /* Create GPT partition table */
+ system("/sbin/gpt destroy " . escapeshellarg($disk));
+ system("/sbin/gpt create -f " . escapeshellarg($disk));
+ system("/sbin/gpt add -t ufs " . escapeshellarg($disk));
+ // Create filesystem
+ system("/sbin/newfs -m 0 /dev/" . escapeshellarg($disk) . "p1");
+ break;
+ case "gmirror":
+ /* Initialize disk */
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ /* Initialise the partition (optional) */
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Create s1 label */
+ //system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
+ /* Delete old gmirror information */
+ system("/sbin/gmirror clear /dev/" . escapeshellarg($disk));
+ break;
+ case "raid":
+ /* Initialize disk */
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ echo "\"fdisk: Geom not found\"is not an error message!\n";
+ /* Initialise the partition (optional) */
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Create s1 label */
+ system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
+ break;
+ case "msdos":
+ /* Initialize disk */
+ system("/sbin/fdisk -I -b /boot/mbr " . escapeshellarg($disk));
+ echo "\"fdisk: Geom not found\"is not an error message!\n";
+ /* Initialise the partition (optional) */
+ system("/bin/dd if=/dev/zero of=/dev/" . escapeshellarg($disk) . "s1 bs=32k count=16");
+ /* Create s1 label */
+ system("/sbin/bsdlabel -w " . escapeshellarg($disk) . "s1 auto");
+ // Create filesystem
+ system("/sbin/newfs_msdos -F 32 /dev/" . escapeshellarg($disk) . "s1");
+ break;
+ }
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong>WARNING:</strong>
+ </span>
+ <br />
+ <span class="vexpl">
+ <?= gettext("This step will erase all your partition, create partition number 1 and format the hard drive with the file system specified."); ?>
+ </span>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_manage_iscsi.php b/packages/freenas/www/disks_manage_iscsi.php
new file mode 100644
index 00000000..4a156ee7
--- /dev/null
+++ b/packages/freenas/www/disks_manage_iscsi.php
@@ -0,0 +1,199 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("iSCSI Initiator"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! is_array($freenas_config['iscsi']))
+{
+ $freenas_config['iscsi'] = array();
+}
+
+$pconfig['enable'] = isset($freenas_config['iscsi']['enable']);
+$pconfig['targetaddress'] = $freenas_config['iscsi']['targetaddress'];
+$pconfig['targetname'] = $freenas_config['iscsi']['targetname'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_format);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable'])
+ {
+ $reqdfields = array_merge($reqdfields, explode(" ", "targetaddress targetname"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "targetaddress,targetname"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable'] && !is_ipaddr($_POST['targetaddress'])){
+ $error_bucket[] = array("error" => gettext("A valid IP address must be specified."),
+ "field" => "targetaddress");
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['iscsi']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['iscsi']['targetaddress'] = $_POST['targetaddress'];
+ $freenas_config['iscsi']['targetname'] = $_POST['targetname'];
+
+ write_config();
+
+ $retval = 0;
+ if (! file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_iscsi_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+ document.iform.targetname.disabled = endis;
+ document.iform.targetaddress.disabled = endis;
+ /* adjust colors */
+ document.iform.targetname.style.backgroundColor = color;
+ document.iform.targetaddress.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage"), false, "disks_manage.php");
+ $tab_array[1] = array(gettext("Format"), false, "disks_manage_init.php");
+ $tab_array[2] = array(gettext("iSCSI Initiator"), true, "disks_manage_iscsi.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form id="iform" name="iform" action="disks_manage_iscsi.php" method="post">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("iSCSI Initiator");?></span>
+ <span style="vertical-align: middle; position: relative; left: 81%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Target IP address"); ?></td>
+ <td width="78%" class="vtable">
+ <input name="targetaddress" type="text" class="formfld unknown" id="targetaddress" size="20" value="<?=htmlspecialchars($pconfig['targetaddress']);?>" />
+ <br /><?= gettext("Target IP address"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("targetname"); ?></td>
+ <td width="78%" class="vtable">
+ <input name="targetname" type="text" class="formfld unknown" id="targetname" size="20" value="<?=htmlspecialchars($pconfig['targetname']);?>" />
+ <br /><?= gettext("targetname"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_mount.php b/packages/freenas/www/disks_mount.php
new file mode 100644
index 00000000..c5bd6f2b
--- /dev/null
+++ b/packages/freenas/www/disks_mount.php
@@ -0,0 +1,208 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("Mount Point"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['mounts']['mount']))
+ $freenas_config['mounts']['mount'] = array();
+
+mount_sort();
+
+$a_mount = &$freenas_config['mounts']['mount'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if ($_POST['apply']) {
+ $retval = 0;
+
+ if (!file_exists($d_sysrebootreqd_path)) {
+ config_lock();
+ /* reload all components that mount disk */
+ disks_mount_all();
+ /* reload all components that use mount */
+ services_samba_configure();
+ services_nfs_configure();
+ services_rsyncd_configure();
+ services_afpd_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_mountdirty_path))
+ unlink($d_mountdirty_path);
+ }
+ }
+}
+
+if ($_GET['act'] == "del")
+{
+ if ($a_mount[$_GET['id']]) {
+ disks_umount_adv($a_mount[$_GET['id']]);
+ unset($a_mount[$_GET['id']]);
+ write_config();
+ touch($d_mountdirty_path);
+ pfSenseHeader("disks_mount.php");
+ exit;
+ }
+}
+
+if ($_GET['act'] == "ret")
+{
+ if ($a_mount[$_GET['id']]) {
+ disks_mount($a_mount[$_GET['id']]);
+ pfSenseHeader("disks_mount.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form id="iform" name="iform" action="disks_mount.php" method="post">
+<?php if (file_exists($d_diskdirty_path)): ?>
+<?php print_info_box_np(gettext("The mount point list has been changed.") . "<br />" .
+ gettext("You must apply the changes in order for them to take effect."));?>
+<?php endif; ?>
+ <div id="inputerrors"></div>
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Disk");?></td>
+ <td class="listhdrr"><?=gettext("Partition");?></td>
+ <td class="listhdrr"><?=gettext("File system");?></td>
+ <td class="listhdrr"><?=gettext("Share name");?></td>
+ <td class="listhdrr"><?=gettext("Description");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_mount as $mount): ?>
+ <tr>
+ <td valign="middle" class="listlr">
+ <?=htmlspecialchars($mount['mdisk']);?> &nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($mount['partition']);?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($mount['fstype']);?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($mount['sharename']);?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($mount['desc']);?>&nbsp;
+ </td>
+ </td>
+ <td valign="middle" class="listbg">
+ <?php
+ if (file_exists($d_mountdirty_path))
+ $stat=_CONFIGURING;
+ else {
+ $stat=disks_mount_status($mount);
+ if ($stat == "ERROR")
+ echo "ERROR - <a href=\"disks_mount.php?act=ret&id=$i\">retry</a>";
+ else
+ echo $stat;
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_mount_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit mount");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_mount.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" onclick="return confirm('<? gettext("Do you really want to delete this mount point? All elements that still use it will become invalid (e.g. share)!"); ?>');" title="<?=gettext("delete mount");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="6"></td>
+ <td class="list" nowrap>
+ <a href="disks_mount_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add mount");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="7">
+ <span class="red">
+ <strong>Note:</strong>
+ </span>
+ <br />
+ <span class="vexpl">
+ <?= gettext("Second configuration step: Declaring the filesystem used by your"); ?>
+ </span>
+ <br />
+ <span class="vexpl">
+ <a href="disk_manage.php">previously configured disk</a>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_mount_edit.php b/packages/freenas/www/disks_mount_edit.php
new file mode 100644
index 00000000..31221570
--- /dev/null
+++ b/packages/freenas/www/disks_mount_edit.php
@@ -0,0 +1,279 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("Mount Point"),
+ gettext("Edit"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['mounts']['mount']))
+ $freenas_config['mounts']['mount'] = array();
+
+mount_sort();
+
+if (!is_array($freenas_config['disks']['disk']))
+ $freenas_config['disks']['disk'] = array();
+
+disks_sort();
+
+if (!is_array($freenas_config['raid']['vdisk']))
+ $freenas_config['raid']['vdisk'] = array();
+
+gvinum_sort();
+
+if (!is_array($freenas_config['gmirror']['vdisk']))
+ $freenas_config['gmirror']['vdisk'] = array();
+
+gmirror_sort();
+
+$a_mount = &$freenas_config['mounts']['mount'];
+
+$a_disk = array_merge($freenas_config['disks']['disk'],$freenas_config['raid']['vdisk'],$freenas_config['gmirror']['vdisk']);
+
+/* Load the cfdevice file*/
+$filename=$g['varetc_path']."/cfdevice";
+if (file_exists($filename))
+ $cfdevice = trim(file_get_contents("$filename"));
+
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (isset($id) && $a_mount[$id]) {
+ $pconfig['mdisk'] = $a_mount[$id]['mdisk'];
+ $pconfig['partition'] = $a_mount[$id]['partition'];
+ $pconfig['fstype'] = $a_mount[$id]['fstype'];
+ $pconfig['sharename'] = $a_mount[$id]['sharename'];
+ $pconfig['desc'] = $a_mount[$id]['desc'];
+}
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = split(" ", "partition mdisk fstype");
+ $reqdfieldsn = split(",", "Partition,Mdisk,Fstype");
+
+ do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
+
+ if (($_POST['sharename'] && !is_validsharename($_POST['sharename'])))
+ {
+ $error_bucket[] = array("error" => gettext("The share name may only consist of the characters a-z, A-Z, 0-9, _ , -."),
+ "field" => "sharename");
+ }
+
+
+ if (($_POST['desc'] && !is_validdesc($_POST['desc'])))
+ {
+ $error_bucket[] = array("error" => gettext("The description name contain invalid characters."),
+ "field" => "desc");
+
+ }
+ $device=$_POST['mdisk'].$_POST['partition'];
+
+ if ($device == $cfdevice )
+ {
+ $error_bucket[] = array("error" => gettext("Can't mount the system partition 1, the DATA partition is the 2."),
+ "field" => "mdisk");
+
+ }
+
+ /* check for name conflicts */
+ foreach ($a_mount as $mount)
+ {
+ if (isset($id) && ($a_mount[$id]) && ($a_mount[$id] === $mount))
+ continue;
+
+ /* Remove the duplicate disk use
+ if ($mount['mdisk'] == $_POST['mdisk'])
+ {
+ $input_errors[] = "This device already exists in the mount point list.";
+ break;
+ }
+ */
+
+ if (($_POST['sharename']) && ($mount['sharename'] == $_POST['sharename']))
+ {
+ $error_bucket[] = array("error" => gettext("Duplicate Share Name."),
+ "field" => "sharename");
+ break;
+ }
+
+
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $mount = array();
+ $mount['mdisk'] = $_POST['mdisk'];
+ $mount['partition'] = $_POST['partition'];
+ $mount['fstype'] = $_POST['fstype'];
+ $mount['desc'] = $_POST['desc'];
+ /* if not sharename given, create one */
+ if (!$_POST['sharename'])
+ $mount['sharename'] = "disk_{$_POST['mdisk']}_part_{$_POST['partition']}";
+ else
+ $mount['sharename'] = $_POST['sharename'];
+ if (isset($id) && $a_mount[$id])
+ $a_mount[$id] = $mount;
+ else
+ $a_mount[] = $mount;
+
+ touch($d_mountdirty_path);
+
+ write_config();
+
+ pfSenseHeader("disks_mount.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="disks_mount_edit.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Disk");?></td>
+ <td width="78%" class="vtable">
+ <select name="mdisk" class="formselect" id="mdisk">
+ <?php foreach ($a_disk as $disk): ?>
+ <?php if ((strcmp($disk['fstype'],"raid")!=0) | (strcmp($disk['fstype'],"gmirror")!=0)): ?>
+ <option value="<?=$disk['name'];?>" <?php if ($pconfig['mdisk'] == $disk['name']) echo "selected";?>>
+ <?php echo htmlspecialchars($disk['name'] . ": " .$disk['size'] . " (" . $disk['desc'] . ")"); ?>
+ </option>
+ <?php endif; ?>
+ <?php endforeach; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Partition");?></td>
+ <td width="78%" class="vtable">
+ <select name="partition" class="formselect" id="partition number">
+ <option value="s1" <?php if ($pconfig['partition'] == "s1") echo "selected=\"selected\""; ?>>1</option>
+ <option value="s2" <?php if ($pconfig['partition'] == "s2") echo "selected\"selected\""; ?>>2</option>
+ <option value="s3" <?php if ($pconfig['partition'] == "s3") echo "selected\"selected\""; ?>>3</option>
+ <option value="s4" <?php if ($pconfig['partition'] == "s4") echo "selected\"selected\""; ?>>4</option>
+ <option value="gmirror" <?php if ($pconfig['partition'] == "gmirror") echo "selected\"selected\""; ?>><?=_SOFTRAID ;?> - gmirror</option>
+ <option value="gvinum" <?php if ($pconfig['partition'] == "gvinum") echo "selected\"selected\""; ?>><?=_SOFTRAID ;?> - gvinum</option>
+ <option value="p1" <?php if ($pconfig['partition'] == "gpt") echo "selected\"selected\""; ?>>GPT</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("File system");?></td>
+ <td width="78%" class="vtable">
+ <select name="fstype" class="formselect" id="fstype">
+ <option value="ufs" <?php if ($pconfig['fstype'] == "ufs") echo "selected=\"selected\""; ?>>UFS</option>
+ <option value="msdosfs" <?php if ($pconfig['fstype'] == "msdosfs") echo "selected\"selected\""; ?>>FAT</option>
+ <option value="ntfs" <?php if ($pconfig['fstype'] == "ntfs") echo "selected\"selected\""; ?>>NTFS (read-only)</option>
+ <option value="ext2fs" <?php if ($pconfig['fstype'] == "ext2fs") echo "selected\"selected\""; ?>>EXT2 FS</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Share name");?></td>
+ <td width="78%" class="vtable">
+ <input name="sharename" type="text" class="formfld unknown" id="sharename" size="20" value="<?=htmlspecialchars($pconfig['sharename']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
+ <td width="78%" class="vtable">
+ <input name="desc" type="text" class="formfld unknown" id="desc" size="20" value="<?=htmlspecialchars($pconfig['desc']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ <?php if (isset($id) && $a_mount[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="100%" align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong><?= gettext("WARNING"); ?>:</strong>
+ </span>
+ <ol>
+ <li>
+ <span class="vexpl">
+ <?= gettext("You can't mount the partition '"); ?>
+ <?php echo htmlspecialchars($cfdevice);?>
+ <?= gettext("' where the config file is stored"); ?>
+ </span>
+ </li>
+ <li><span class="vexpl"><?= gettext("FreeBSD NTFS has lots of bugs."); ?></span></li>
+ </ol>
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gmirror.php b/packages/freenas/www/disks_raid_gmirror.php
new file mode 100644
index 00000000..4d51ba0f
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gmirror.php
@@ -0,0 +1,223 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Mirror"),
+ gettext("RAID"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['gmirror']['vdisk']))
+ $freenas_config['gmirror']['vdisk'] = array();
+
+gmirror_sort();
+
+$raidstatus=get_sraid_disks_list();
+
+$a_raid = &$freenas_config['gmirror']['vdisk'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $pconfig = $_POST;
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ config_lock();
+ /* reload all components that create raid device */
+ disks_raid_gmirror_configure();
+ config_unlock();
+ write_config();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_raidconfdirty_path))
+ unlink($d_raidconfdirty_path);
+ }
+ }
+}
+
+if ($_GET['act'] == "del") {
+ if ($a_raid[$_GET['id']]) {
+ $raidname=$a_raid[$_GET['id']]['name'];
+ disks_raid_gmirror_delete($raidname);
+ unset($a_raid[$_GET['id']]);
+ write_config();
+ pfSenseHeader("disks_raid_gmirror.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="disks_raid_gmirror.php" method="post" name="iform" id="iform">
+<?php if (file_exists($d_diskdirty_path)): ?>
+<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" .
+ gettext("You must apply the changes in order for them to take effect."));?>
+<?php endif; ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
+ $tab_array[3] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Volume name");?></td>
+ <td class="listhdrr"><?=gettext("Type");?></td>
+ <td class="listhdrr"><?=gettext("Size");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_raid as $raid): ?>
+ <tr>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['name']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['type']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ $raidconfiguring = file_exists($d_raidconfdirty_path) &&
+ in_array($raid['name']."\n",file($d_raidconfdirty_path));
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ $tempo=$raid['name'];
+ echo "{$raidstatus[$tempo]['size']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ echo "{$raidstatus[$tempo]['desc']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_raid_gmirror_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_raid_gmirror.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="4"></td>
+ <td class="list" nowrap>
+ <a href="disks_raid_gmirror_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="5">
+ <span class="red">
+ <strong><?= gettext("Note:"); ?></strong>
+ </span>
+ <br />
+ <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span>
+ <br />
+ <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span>
+ <br />
+ <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gmirror_edit.php b/packages/freenas/www/disks_raid_gmirror_edit.php
new file mode 100644
index 00000000..4fba1242
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gmirror_edit.php
@@ -0,0 +1,267 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Mirror"),
+ gettext("RAID"),
+ gettext("Edit"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['gmirror']['vdisk']))
+ $freenas_config['gmirror']['vdisk'] = array();
+
+gmirror_sort();
+
+if (!is_array($freenas_config['disks']['disk']))
+ $nodisk_errors[] = _DISKSRAIDEDITPHP_MSGADDDISKFIRST;
+else
+ disks_sort();
+
+$a_raid = &$freenas_config['gmirror']['vdisk'];
+
+$a_disk = &$freenas_config['disks']['disk'];
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (isset($id) && $a_raid[$id]) {
+ $pconfig['name'] = $a_raid[$id]['name'];
+ $pconfig['type'] = $a_raid[$id]['type'];
+ $pconfig['balance'] = $a_raid[$id]['balance'];
+ $pconfig['diskr'] = $a_raid[$id]['diskr'];
+}
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "name");
+ $reqdfieldsn = explode(",", "Name");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['name'] && !is_validaliasname($_POST['name'])))
+ {
+ $error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."),
+ "field" => "name");
+ }
+
+
+ /* check for name conflicts */
+ foreach ($a_raid as $raid)
+ {
+ if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
+ continue;
+
+ if ($raid['name'] == $_POST['name'])
+ {
+ $error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."),
+ "field" => "name");
+ break;
+ }
+ }
+
+ /* check the number of RAID disk for volume */
+
+ if (count($_POST['diskr']) != 2)
+ $error_bucket[] = array("error" => gettext("There must be 2 disks in a RAID 1 volume."),
+ "field" => "diskr");
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $raid = array();
+ $raid['name'] = $_POST['name'];
+ $raid['balance'] = $_POST['balance'];
+ $raid['type'] = 1;
+ $raid['diskr'] = $_POST['diskr'];
+ $raid['desc'] = "Software RAID {$_POST['type']}";
+
+ if (isset($id) && $a_raid[$id])
+ $a_raid[$id] = $raid;
+ else
+ $a_raid[] = $raid;
+
+ $fd = @fopen("$d_raidconfdirty_path", "a");
+ if (!$fd) {
+ echo "ERR Could not save RAID configuration.\n";
+ exit(0);
+ }
+ fwrite($fd, "$raid[name]\n");
+ fclose($fd);
+
+ write_config();
+
+ pfSenseHeader("disks_raid_gmirror.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
+ $tab_array[3] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gmirror_edit.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Volume name");?></td>
+ <td width="78%" class="vtable">
+ <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td>
+ <td class="vtable">
+ RAID 1 (<?= gettext("mirroring"); ?>)
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Balance algorithm"); ?></td>
+ <td width="78%" class="vtable">
+ <select name="balance" class="formselect">
+ <?php $balvals = array(
+ "split"=>"Split request",
+ "load"=>"Read from lowest load",
+ "round-robin"=>"Round-robin read");
+ ?>
+ <?php foreach ($balvals as $balval => $balname): ?>
+ <option value="<?=$balval;?>" <?php if($pconfig['balance'] == $balval) echo 'selected';?>><?=htmlspecialchars($balname);?></option>
+ <?php endforeach; ?>
+ </select>
+ <br />
+ <?= gettext("Select your read balance algorithm."); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td>
+ <td width="78%" class="vtable">
+ <?
+ $i=0;
+ $disable_script="";
+
+ foreach ($a_disk as $diskv) {
+ $r_name="";
+
+ if (strcmp($diskv['fstype'],"gmirror")==0) {
+ foreach($a_raid as $raid) {
+ if (in_array($diskv['name'],$raid['diskr'])) {
+ $r_name=$raid['name'];
+
+ if ($r_name!=$pconfig['name'])
+ $disable_script.="document.getElementById($i).disabled=1;\n";
+ break;
+ }
+ }
+
+ echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[name]'".
+ ((is_array($pconfig['diskr']) && in_array($diskv['name'], $pconfig['diskr'])) ? " checked=\"checked\"":"").
+ " />$diskv[name] ($diskv[size], $diskv[desc])" . (($r_name) ? " - assigned to $r_name" : "") . "<br />\n";
+ }
+
+ $i++;
+ }
+
+ if ($disable_script)
+ echo "<script type='text/javascript'><!--\n$disable_script--></script>\n";
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gmirror_infos.php b/packages/freenas/www/disks_raid_gmirror_infos.php
new file mode 100644
index 00000000..e6b208e7
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gmirror_infos.php
@@ -0,0 +1,132 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Mirror"),
+ gettext("Information"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ }
+}
+if (!isset($do_action)) {
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php");
+ $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
+ $tab_array[3] = array(gettext("Information"), true, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gmirror_infos.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" class="vtable">
+ <?php
+ echo "<pre>";
+ echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />";
+
+ exec("/sbin/gmirror list",$rawdata);
+ foreach ($rawdata as $line){
+ echo htmlspecialchars($line) . "<br>";
+ }
+
+ unset ($line);
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gmirror_init.php b/packages/freenas/www/disks_raid_gmirror_init.php
new file mode 100644
index 00000000..c849be52
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gmirror_init.php
@@ -0,0 +1,167 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Mirror"),
+ gettext("Initialize"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "disk");
+ $reqdfieldsn = explode(",", "Disk");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (! $input_errors) {
+ $do_format = true;
+ $disk = $_POST['disk'];
+ }
+}
+
+if (! isset($do_format)) {
+ $do_format = false;
+ $disk = '';
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Format RAID"), true, "disks_raid_gmirror_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gmirror_tools.php");
+ $tab_array[3] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gmirror_init.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Volume name");?></td>
+ <td width="78%" class="vtable">
+ <input name="disk" type="text" class="formfld" id="disk" size="20" value="<?=htmlspecialchars($disk);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <?
+ if ($do_format) {
+ echo("<strong>" . gettext("Disk format UFS output:") . "</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ /* Create filesystem */
+ system("/sbin/newfs -U /dev/mirror/" . escapeshellarg($disk));
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong>WARNING:</strong><br />
+ </span>
+ <span class="vexpl">
+ <?= gettext("This step will format the RAID volume in Unix FileSystem (UFS)."); ?>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gmirror_tools.php b/packages/freenas/www/disks_raid_gmirror_tools.php
new file mode 100644
index 00000000..714dea7f
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gmirror_tools.php
@@ -0,0 +1,184 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Mirror"),
+ gettext("Tools"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "action object");
+ $reqdfieldsn = explode(",", "Action,Object");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $do_action = true;
+ $action = $_POST['action'];
+ $object = $_POST['object'];
+ }
+}
+if (!isset($do_action)) {
+ $do_action = false;
+ $action = '';
+ $object = '';
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), true, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), false, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gmirror_init.php");
+ $tab_array[2] = array(gettext("Tools"), true, "disks_raid_gmirror_tools.php");
+ $tab_array[3] = array(gettext("Information"), false, "disks_raid_gmirror_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gmirror_tools.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <select name="action" class="formselect" id="action">
+ <option value="rebuild" <?php if ($action == "rebuild") echo "selected=\"selected\""; ?>>rebuild</option>
+ <option value="list" <?php if ($action == "list") echo "selected=\"selected\""; ?>>list</option>
+ <option value="status" <?php if ($action == "status") echo "selected=\"selected\""; ?>>status</option>
+ <option value="remove" <?php if ($action == "remove") echo "selected=\"selected\""; ?>>remove</option>
+ <option value="activate" <?php if ($action == "activate") echo "selected=\"selected\""; ?>>activate</option>
+ <option value="deactivate" <?php if ($action == "deactivate") echo "selected=\"selected\""; ?>>deactivate</option>
+ <option value="forget" <?php if ($action == "forget") echo "selected=\"selected\""; ?>>forget</option>
+ <option value="clear" <?php if ($action == "clear") echo "selected=\"selected\""; ?>>clear</option>
+ <option value="stop" <?php if ($action == "stop") echo "selected=\"selected\""; ?>>stop</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Send Command!" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <?
+ if ($do_action) {
+ echo("<strong>" . gettext("GMIRROR command output:") . "</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ system("/sbin/gmirror $action " . escapeshellarg($object));
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong>WARNING:</strong><br />
+ </span>
+ <ol>
+ <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li>
+ <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li>
+ </ol>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gvinum.php b/packages/freenas/www/disks_raid_gvinum.php
new file mode 100644
index 00000000..260fae14
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gvinum.php
@@ -0,0 +1,222 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Vinum"),
+ gettext("RAID"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['raid']['vdisk']))
+ $freenas_config['raid']['vdisk'] = array();
+
+gvinum_sort();
+
+$raidstatus=get_sraid_disks_list();
+
+$a_raid = &$freenas_config['raid']['vdisk'];
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $pconfig = $_POST;
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if ($_POST['apply']) {
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ config_lock();
+ /* reload all components that create raid device */
+ disks_raid_configure();
+ config_unlock();
+ write_config();
+ }
+ $savemsg = get_std_save_message($retval);
+ if ($retval == 0) {
+ if (file_exists($d_raidconfdirty_path))
+ unlink($d_raidconfdirty_path);
+ }
+ }
+}
+
+if ($_GET['act'] == "del") {
+ if ($a_raid[$_GET['id']]) {
+ $raidname=$a_raid[$_GET['id']]['name'];
+ disks_raid_gvinum_delete($raidname);
+ unset($a_raid[$_GET['id']]);
+ write_config();
+ pfSenseHeader("disks_raid_gvinum.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="disks_raid_gvinum.php" method="post" name="iform" id="iform">
+<?php if (file_exists($d_diskdirty_path)): ?>
+<?php print_info_box_np(gettext("The Raid configuration has been changed.") . "<br />" .
+ gettext("You must apply the changes in order for them to take effect."));?>
+<?php endif; ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gvinum.php");
+ $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
+ $tab_array[3] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="listhdrr"><?=gettext("Volume name");?></td>
+ <td class="listhdrr"><?=gettext("Type");?></td>
+ <td class="listhdrr"><?=gettext("Size");?></td>
+ <td class="listhdrr"><?=gettext("Status");?></td>
+ <td class="list">&nbsp;</td>
+ </tr>
+ <?php $i = 0; foreach ($a_raid as $raid): ?>
+ <tr>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['name']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?=htmlspecialchars($raid['type']);?>
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ $raidconfiguring = file_exists($d_raidconfdirty_path) &&
+ in_array($raid['name']."\n",file($d_raidconfdirty_path));
+ if ($raidconfiguring)
+ echo gettext("configuring");
+ else {
+ $tempo=$raid['name'];
+ echo "{$raidstatus[$tempo]['size']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="listr">
+ <?php
+ if ($raidconfiguring)
+ echo "_CONFIGURING";
+ else {
+ echo "{$raidstatus[$tempo]['desc']}";
+ }
+ ?>&nbsp;
+ </td>
+ <td valign="middle" class="list">
+ <a href="disks_raid_gvinum_edit.php?id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="<?=gettext("edit raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ <a href="disks_raid_gvinum.php?act=del&id=<?=$i;?>">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="<?=gettext("delete raid");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <?php $i++; endforeach; ?>
+ <tr>
+ <td class="list" colspan="4"></td>
+ <td class="list" nowrap>
+ <a href="disks_raid_gvinum_edit.php">
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="<?=gettext("add disk");?>" width="17" height="17" border="0" alt="" />
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="5">
+ <span class="red">
+ <strong><?= gettext("Note:"); ?></strong>
+ </span>
+ <br />
+ <span class="vexpl"><?= gettext("Optional configuration step: Configuring a virtual RAID disk using your"); ?></span>
+ <br />
+ <span class="vexpl"><a href="disks_manage.php"><?= gettext("previsously configured disk."); ?></a></span>
+ <br />
+ <span class="vexpl"><?= gettext("Wait for the \"up\" status before format it and mount it!."); ?></span>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gvinum_edit.php b/packages/freenas/www/disks_raid_gvinum_edit.php
new file mode 100644
index 00000000..45cbac88
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gvinum_edit.php
@@ -0,0 +1,266 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Vinum"),
+ gettext("RAID"),
+ gettext("Edit"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['raid']['vdisk']))
+ $freenas_config['raid']['vdisk'] = array();
+
+gvinum_sort();
+
+if (!is_array($freenas_config['disks']['disk']))
+ $nodisk_errors[] = _DISKSRAIDEDITPHP_MSGADDDISKFIRST;
+else
+ disks_sort();
+
+$a_raid = &$freenas_config['raid']['vdisk'];
+
+$a_disk = &$freenas_config['disks']['disk'];
+
+$id = $_GET['id'];
+if (isset($_POST['id']))
+ $id = $_POST['id'];
+
+if (isset($id) && $a_raid[$id]) {
+ $pconfig['name'] = $a_raid[$id]['name'];
+ $pconfig['type'] = $a_raid[$id]['type'];
+ $pconfig['diskr'] = $a_raid[$id]['diskr'];
+}
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "name type");
+ $reqdfieldsn = explode(",", "Name,Type");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['name'] && !is_validaliasname($_POST['name'])))
+ {
+ $error_bucket[] = array("error" => gettext("The device name may only consist of the characters a-z, A-Z, 0-9."),
+ "field" => "name");
+ }
+
+ /* check for name conflicts */
+ foreach ($a_raid as $raid)
+ {
+ if (isset($id) && ($a_raid[$id]) && ($a_raid[$id] === $raid))
+ continue;
+
+ if ($raid['name'] == $_POST['name'])
+ {
+ $error_bucket[] = array("error" => gettext("This device already exists in the raid volume list."),
+ "field" => "name");
+ break;
+ }
+ }
+
+ /* check the number of RAID disk for volume */
+
+ /* check the number of RAID disk for volume */
+
+ switch ($_POST['type'])
+ {
+ case 0:
+ if (count($_POST['diskr']) < 2)
+ $error_bucket[] = array("error" => gettext("There must be a minimum of 2 disks in a RAID 0 volume."),
+ "field" => "diskr");
+ break;
+ case 1:
+ if (count($_POST['diskr']) != 2)
+ $error_bucket[] = array("error" => gettext("There must be 2 disks in a RAID 1 volume."),
+ "field" => "diskr");
+ break;
+ case 5:
+ if (count($_POST['diskr']) < 3)
+ $error_bucket[] = array("error" => gettext("There must be a minimum of 3 disks in a RAID 5 volume."),
+ "field" => "diskr");
+ break;
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $raid = array();
+ $raid['name'] = $_POST['name'];
+ $raid['type'] = $_POST['type'];
+ $raid['diskr'] = $_POST['diskr'];
+ $raid['desc'] = "Software RAID {$_POST['type']}";
+
+ if (isset($id) && $a_raid[$id])
+ $a_raid[$id] = $raid;
+ else
+ $a_raid[] = $raid;
+
+ $fd = @fopen("$d_raidconfdirty_path", "a");
+ if (!$fd) {
+ echo "_DISKSRAIDEDITPHP_MSGERROR";
+ exit(0);
+ }
+ fwrite($fd, "$raid[name]\n");
+ fclose($fd);
+
+ write_config();
+
+ pfSenseHeader("disks_raid_gvinum.php");
+ exit;
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), true, "disks_raid_gvinum.php");
+ $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
+ $tab_array[3] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gvinum_edit.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Volume name");?></td>
+ <td width="78%" class="vtable">
+ <input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" class="vncellreq"><?= gettext("Type"); ?></td>
+ <td class="vtable">
+ <select name="type" class="formselect" id="type">
+ <option value="0" <?php if ($pconfig['type'] == 0) echo "selected=\"selected\""; ?>>RAID 0 (<?= gettext("striping"); ?>)</option>
+ <option value="1" <?php if ($pconfig['type'] == 1) echo "selected=\"selected\""; ?>>RAID 1 (<?= gettext("mirroring"); ?>)</option>
+ <option value="5" <?php if ($pconfig['type'] == 5) echo "selected=\"selected\""; ?>>RAID 5 (<?= gettext("rotated block-interleaved parity"); ?>)</option>
+
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Members of this volume"); ?></td>
+ <td width="78%" class="vtable">
+ <?
+ $i=0;
+ $disable_script="";
+
+ foreach ($a_disk as $diskv) {
+ $r_name="";
+
+ if (strcmp($diskv['fstype'],"raid")==0) {
+ foreach($a_raid as $raid) {
+ if (in_array($diskv['name'],$raid['diskr'])) {
+ $r_name=$raid['name'];
+
+ if ($r_name!=$pconfig['name'])
+ $disable_script.="document.getElementById($i).disabled=1;\n";
+ break;
+ }
+ }
+ echo "<input name='diskr[]' id='$i' type='checkbox' value='$diskv[name]'".
+ ((is_array($pconfig['diskr']) && in_array($diskv['name'], $pconfig['diskr'])) ? " checked=\"checked\"" : "").
+ " />$diskv[name] ($diskv[size], $diskv[desc])" . (($r_name) ? " - assigned to $r_name" : "") . "<br>\n";
+ }
+ $i++;
+ }
+ if ($disable_script) echo "<script type='text/javascript'><!--\n$disable_script--></script>\n";
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gvinum_infos.php b/packages/freenas/www/disks_raid_gvinum_infos.php
new file mode 100644
index 00000000..7b9cfcb2
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gvinum_infos.php
@@ -0,0 +1,132 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Vinum"),
+ gettext("Information"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ }
+}
+if (!isset($do_action)) {
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php");
+ $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
+ $tab_array[3] = array(gettext("Information"), true, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gvinum_infos.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" class="vtable">
+ <?php
+ echo "<pre>";
+ echo "<strong>" . gettext("Software RAID information and status") . "</strong><br />";
+
+ exec("/sbin/gvinum list",$rawdata);
+ foreach ($rawdata as $line)
+ {
+ echo htmlspecialchars($line) . "<br>";
+ }
+ unset ($line);
+ echo "</pre>";
+ ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gvinum_init.php b/packages/freenas/www/disks_raid_gvinum_init.php
new file mode 100644
index 00000000..2befcaa0
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gvinum_init.php
@@ -0,0 +1,169 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Vinum"),
+ gettext("Initialize"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "disk");
+ $reqdfieldsn = explode(",", "Disk");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (! $input_errors) {
+ $do_format = true;
+ $disk = $_POST['disk'];
+ }
+}
+
+if (! isset($do_format)) {
+ $do_format = false;
+ $disk = '';
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php");
+ $tab_array[1] = array(gettext("Format RAID"), true, "disks_raid_gvinum_init.php");
+ $tab_array[2] = array(gettext("Tools"), false, "disks_raid_gvinum_tools.php");
+ $tab_array[3] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gvinum_init.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Volume name");?></td>
+ <td width="78%" class="vtable">
+ <input name="disk" type="text" class="formfld" id="disk" size="20" value="<?=htmlspecialchars($disk);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <?
+ if ($do_format) {
+ echo("<strong>_DISKSRAIDINITPHP_INFO</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ /* Create filesystem */
+ system("/sbin/newfs -U /dev/gvinum/" . escapeshellarg($disk));
+ /* Do it twice for test the RAID5 bug at reboot*/
+ system("/sbin/newfs -U /dev/gvinum/" . escapeshellarg($disk));
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong>WARNING:</strong><br />
+ </span>
+ <span class="vexpl">
+ <?= gettext("This step will format the RAID volume in Unix FileSystem (UFS)."); ?>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/disks_raid_gvinum_tools.php b/packages/freenas/www/disks_raid_gvinum_tools.php
new file mode 100644
index 00000000..97853e29
--- /dev/null
+++ b/packages/freenas/www/disks_raid_gvinum_tools.php
@@ -0,0 +1,207 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("System"),
+ gettext("Disks"),
+ gettext("GEOM Vinum"),
+ gettext("Tools"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+
+ $reqdfields = explode(" ", "action object");
+ $reqdfieldsn = explode(",", "Action,Object");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors) {
+ $do_action = true;
+ $action = $_POST['action'];
+ $object = $_POST['object'];
+ }
+}
+if (!isset($do_action)) {
+ $do_action = false;
+ $action = '';
+ $object = '';
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Geom Mirror"), false, "disks_raid_gmirror.php");
+ $tab_array[1] = array(gettext("Geom Vinum (unstable)"), true, "disks_raid_gvinum.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td class="tabnavtbl">
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Manage RAID"), false, "disks_raid_gvinum.php");
+ $tab_array[1] = array(gettext("Format RAID"), false, "disks_raid_gvinum_init.php");
+ $tab_array[2] = array(gettext("Tools"), true, "disks_raid_gvinum_tools.php");
+ $tab_array[3] = array(gettext("Information"), false, "disks_raid_gvinum_infos.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form action="disks_raid_gvinum_tools.php" method="post" name="iform" id="iform">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <input name="object" type="text" class="formfld unknown" id="object" size="20" value="<?=htmlspecialchars($disk);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Object name");?></td>
+ <td width="78%" class="vtable">
+ <select name="action" class="formselect" id="action">
+ <option value="start" <?php if ($action == "start") echo "selected=\"selected\""; ?>>start</option>
+ <option value="rebuild" <?php if ($action == "rebuild") echo "selected=\"selected\""; ?>>rebuild parity</option>
+ <option value="list" <?php if ($action == "list") echo "selected=\"selected\""; ?>>list</option>
+ <option value="remove" <?php if ($action == "remove") echo "selected=\"selected\""; ?>>remove</option>
+ <option value="forceup" <?php if ($action == "forceup") echo "selected=\"selected\""; ?>>Force State to UP</option>
+ <option value="saveconfig" <?php if ($action == "saveconfig") echo "selected=\"selected\""; ?>>saveconfig</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Send Command!" />
+ <?php if (isset($id) && $a_raid[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>" />
+ <?php endif; ?>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" colspan="2">
+ <?
+ if ($do_action) {
+ echo("<strong>" . gettext("GVINUM command output:") . "</strong><br />");
+ echo('<pre>');
+ ob_end_flush();
+
+ switch ($action)
+ {
+ case "remove":
+ /* Remove recursivly object */
+ system("/sbin/gvinum rm -r " . escapeshellarg($object));
+ break;
+ case "start":
+ /* Start object */
+ system("/sbin/gvinum start " . escapeshellarg($object));
+ break;
+ case "rebuild":
+ /* Rebuild RAID 5 parity */
+ system("/sbin/gvinum rebuildparity " . escapeshellarg($object));
+ break;
+ case "list":
+ /* Disaply a detailed list of object */
+ system("/sbin/gvinum list " . escapeshellarg($object));
+ break;
+ case "forceup":
+ /* Force object state up */
+ system("/sbin/gvinum setstate -f up " . escapeshellarg($object));
+ break;
+ case "saveconfig":
+ /* Save config */
+ system("/sbin/gvinum saveconfig");
+ break;
+ }
+
+ echo('</pre>');
+ }
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" colspan="2">
+ <span class="red">
+ <strong>WARNING:</strong><br />
+ </span>
+ <ol>
+ <li><span class="vexpl"><?= gettext("Use these specials actions for debugging only!"); ?></span></li>
+ <li><span class="vexpl"><?= gettext("There is no need of using this menu for start a RAID volume (start automaticaly)."); ?></span></li>
+ </ol>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/packages/freenas/www/services_afp.php b/packages/freenas/www/services_afp.php
new file mode 100644
index 00000000..c3648b9f
--- /dev/null
+++ b/packages/freenas/www/services_afp.php
@@ -0,0 +1,190 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Services"),
+ gettext("AFP"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['afp'])) {
+ $freenas_config['afp'] = array();
+}
+
+
+$pconfig['enable'] = isset($freenas_config['afp']['enable']);
+$pconfig['afpname'] = $freenas_config['afp']['afpname'];
+$pconfig['guest'] = isset($freenas_config['afp']['guest']);
+$pconfig['local'] = isset($freenas_config['afp']['local']);
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = split(" ", "afpname");
+ $reqdfieldsn = split(",", "Afpname");
+
+ do_input_validation_new($_POST, $reqdfields, $reqdfieldsn, &$error_bucket);
+
+ if ($_POST['enable'] && !$_POST['guest'])
+ {
+ if (!$_POST['local'])
+ $error_bucket[] = array("error" => gettext("You must select at least one authentication method."),
+ "field" => "local");
+ }
+ if ($_POST['enable'] && !$_POST['local'])
+ {
+ if (!$_POST['guest'])
+ $error_bucket[] = array("error" => gettext("You must select at least one authentication method."),
+ "field" => "name");
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['afp']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['afp']['guest'] = $_POST['guest'] ? true : false;
+ $freenas_config['afp']['local'] = $_POST['local'] ? true : false;
+ $freenas_config['afp']['afpname'] = $_POST['afpname'];
+
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_afpd_configure();
+ services_mdnsresponder_configure();
+ config_unlock();
+ }
+
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+ document.iform.guest.disabled = endis;
+ document.iform.local.disabled = endis;
+ document.iform.afpname.disabled = endis;
+ /* color adjustments */
+ document.iform.guest.style.backgroundColor = color;
+ document.iform.local.style.backgroundColor = color;
+ document.iform.afpname.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="services_afp.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("AFP Server");?></span>
+ <span style="vertical-align: middle; position: relative; left: 84%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Server Name");?></td>
+ <td width="78%" class="vtable">
+ <input name="afpname" type="text" class="formfld" id="afpname" size="20" value="<?=htmlspecialchars($pconfig['afpname']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Authentication");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="guest" id="guest" type="checkbox" value="yes" <?php if ($pconfig['guest']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Enable guest access."); ?><br />
+ <input name="local" id="local" type="checkbox" value="yes" <?php if ($pconfig['local']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Enable local user authentication."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/services_ftp.php b/packages/freenas/www/services_ftp.php
new file mode 100644
index 00000000..da144349
--- /dev/null
+++ b/packages/freenas/www/services_ftp.php
@@ -0,0 +1,347 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Services"),
+ gettext("FTP"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['ftp']))
+{
+ $freenas_config['ftp'] = array();
+
+}
+
+$pconfig['enable'] = isset($freenas_config['ftp']['enable']);
+$pconfig['port'] = $freenas_config['ftp']['port'];
+$pconfig['numberclients'] = $freenas_config['ftp']['numberclients'];
+$pconfig['maxconperip'] = $freenas_config['ftp']['maxconperip'];
+$pconfig['timeout'] = $freenas_config['ftp']['timeout'];
+$pconfig['anonymous'] = isset($freenas_config['ftp']['anonymous']);
+$pconfig['localuser'] = isset($freenas_config['ftp']['localuser']);
+$pconfig['pasv_max_port'] = $freenas_config['ftp']['pasv_max_port'];
+$pconfig['pasv_min_port'] = $freenas_config['ftp']['pasv_min_port'];
+$pconfig['pasv_address'] = $freenas_config['ftp']['pasv_address'];
+$pconfig['banner'] = $freenas_config['ftp']['banner'];
+$pconfig['natmode'] = isset($freenas_config['ftp']['natmode']);
+$pconfig['passiveip'] = $freenas_config['ftp']['passiveip'];
+$pconfig['fxp'] = isset($freenas_config['ftp']['fxp']);
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable']) {
+ $reqdfields = array_merge($reqdfields, explode(" ", "numberclients maxconperip timeout port"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Numberclients,Maxconperip,Timeout,Port"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable'] && !is_port($_POST['port']))
+ {
+ $error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."),
+ "field" => "port");
+ }
+ if ($_POST['enable'] && !is_numericint($_POST['numberclients'])) {
+ $error_bucket[] = array("error" => gettext("The maximum Number of client must be a number."),
+ "field" => "numberclients");
+ }
+
+ if ($_POST['enable'] && !is_numericint($_POST['maxconperip'])) {
+ $error_bucket[] = array("error" => gettext("The max con per ip must be a number."),
+ "field" => "maxconperip");
+ }
+ if ($_POST['enable'] && !is_numericint($_POST['timeout'])) {
+ $error_bucket[] = array("error" => gettext("The maximum idle time be a number."),
+ "field" => "timeout");
+ }
+
+ if ($_POST['enable'] && ($_POST['pasv_address']))
+ {
+ if (!is_ipaddr($_POST['pasv_address']))
+ $error_bucket[] = array("error" => gettext("The pasv address must be a public IP address."),
+ "field" => "pasv_address");
+
+ }
+
+ if ($_POST['enable'] && ($_POST['pasv_max_port']))
+ {
+ if (!is_port($_POST['pasv_max_port']))
+ $error_bucket[] = array("error" => gettext("The pasv_max_port port must be a valid port number."),
+ "field" => "pasv_max_port");
+ }
+
+ if ($_POST['enable'] && ($_POST['pasv_min_port']))
+ {
+ if (!is_port($_POST['pasv_min_port']))
+ $error_bucket[] = array("error" => gettext("The pasv_min_port port must be a valid port number."),
+ "field" => "pasv_min_port");
+
+ }
+
+ if (($_POST['passiveip'] && !is_ipaddr($_POST['passiveip']))) {
+ $error_bucket[] = array("error" => gettext("A valid IP address must be specified."),
+ "field" => "passiveip");
+
+ }
+
+ if (!($_POST['anonymous']) && !($_POST['localuser'])) {
+ $input_errors[] = _SRVFTP_MSGVALIDAUTH;
+ $error_bucket[] = array("error" => gettext("You must select at minium anonymous or/and local user authentication."),
+ "field" => "localuser");
+
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['ftp']['numberclients'] = $_POST['numberclients'];
+ $freenas_config['ftp']['maxconperip'] = $_POST['maxconperip'];
+ $freenas_config['ftp']['timeout'] = $_POST['timeout'];
+ $freenas_config['ftp']['port'] = $_POST['port'];
+ $freenas_config['ftp']['anonymous'] = $_POST['anonymous'] ? true : false;
+ $freenas_config['ftp']['localuser'] = $_POST['localuser'] ? true : false;
+ $freenas_config['ftp']['pasv_max_port'] = $_POST['pasv_max_port'];
+ $freenas_config['ftp']['pasv_min_port'] = $_POST['pasv_min_port'];
+ $freenas_config['ftp']['pasv_address'] = $_POST['pasv_address'];
+ $freenas_config['ftp']['banner'] = $_POST['banner'];
+ $freenas_config['ftp']['passiveip'] = $_POST['passiveip'];
+ $freenas_config['ftp']['fxp'] = $_POST['fxp'] ? true : false;
+ $freenas_config['ftp']['natmode'] = $_POST['natmode'] ? true : false;
+ $freenas_config['ftp']['enable'] = $_POST['enable'] ? true : false;
+
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path)) {
+ /* nuke the cache file */
+ config_lock();
+ services_ftpd_configure();
+ services_mdnsresponder_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+ document.iform.port.disabled = endis;
+ document.iform.timeout.disabled = endis;
+ document.iform.numberclients.disabled = endis;
+ document.iform.maxconperip.disabled = endis;
+ document.iform.anonymous.disabled = endis;
+ document.iform.localuser.disabled = endis;
+ document.iform.banner.disabled = endis;
+ document.iform.fxp.disabled = endis;
+ document.iform.natmode.disabled = endis;
+ document.iform.passiveip.disabled = endis;
+ document.iform.pasv_max_port.disabled = endis;
+ document.iform.pasv_min_port.disabled = endis;
+ /* color adjustments */
+ document.iform.port.style.backgroundColor = color;
+ document.iform.timeout.style.backgroundColor = color;
+ document.iform.numberclients.style.backgroundColor = color;
+ document.iform.maxconperip.style.backgroundColor = color;
+ document.iform.anonymous.style.backgroundColor = color;
+ document.iform.localuser.style.backgroundColor = color;
+ document.iform.banner.style.backgroundColor = color;
+ document.iform.fxp.style.backgroundColor = color;
+ document.iform.natmode.style.backgroundColor = color;
+ document.iform.passiveip.style.backgroundColor = color;
+ document.iform.pasv_max_port.style.backgroundColor = color;
+ document.iform.pasv_min_port.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="services_ftp.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("FTP Server");?></span>
+ <span style="vertical-align: middle; position: relative; left: 84%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("TCP port");?></td>
+ <td width="78%" class="vtable">
+ <input name="port" type="text" class="formfld unknown" id="port" size="20" value="<?=htmlspecialchars($pconfig['port']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Number of clients");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="numberclients" type="text" class="formfld unknown" id="numberclients" size="20" value="<?=htmlspecialchars($pconfig['numberclients']);?>" />
+ <br />
+ <?= gettext("Maximum number of simultaneous clients."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Max conn per ip");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="maxconperip" type="text" class="formfld unknown" id="maxconperip" size="20" value="<?=htmlspecialchars($pconfig['maxconperip']);?>" />
+ <br />
+ <?= gettext("Maximum connection per IP address."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Timeout");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="timeout" type="text" class="formfld unknown" id="timeout" size="20" value="<?=htmlspecialchars($pconfig['timeout']);?>" />
+ <br />
+ <?= gettext("Maximum idle time in seconds."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Anonymous login");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="anonymous" type="checkbox" id="anonymous" value="yes" <?php if ($pconfig['anonymous']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Enable Anonymous login"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Local User");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="localuser" type="checkbox" id="localuser" value="yes" <?php if ($pconfig['localuser']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Enable local User login"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Banner");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <textarea name="banner" cols="65" rows="7" id="banner" class="formpre"><?=htmlspecialchars($pconfig['banner']);?></textarea>
+ <br />
+ <?= gettext("Greeting banner displayed by FTP when a connection first comes in."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("FXP");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="fxp" type="checkbox" id="fxp" value="yes" <?php if ($pconfig['fxp']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Enable FXP protocol."); ?>
+ <br />
+ <?= gettext("FXP allows transfers between two remote servers without any file data going to the client asking for the transfer (insecure!)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("NAT mode");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="natmode" type="checkbox" id="natmode" value="yes" <?php if ($pconfig['natmode']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Force NAT mode"); ?>
+ <br />
+ <?= gettext("Enable it if your FTP server is behind a NAT box that doesn't support applicative FTP proxying"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Passive IP address");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="passiveip" type="text" class="formfld unknown" id="passiveip" size="30" value="<?=htmlspecialchars($pconfig['passiveip']);?>" />
+ <?= gettext("Use this option to override the IP address that FTP daemon will advertise in response to the PASV command."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("pasv_min_port");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="pasv_min_port" type="text" class="formfld unknown" id="pasv_min_port" size="20" value="<?=htmlspecialchars($pconfig['pasv_min_port']);?>" />
+ <?= gettext("The minimum port to allocate for PASV style data connections."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("pasv_max_port");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="pasv_max_port" type="text" class="formfld unknown" id="pasv_max_port" size="20" value="<?=htmlspecialchars($pconfig['pasv_max_port']);?>" />
+ <?= gettext("The maximum port to allocate for PASV style data connections."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/services_nfs.php b/packages/freenas/www/services_nfs.php
new file mode 100644
index 00000000..403ea17c
--- /dev/null
+++ b/packages/freenas/www/services_nfs.php
@@ -0,0 +1,219 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Services"),
+ gettext("NFS"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['nfs']))
+{
+ $freenas_config['nfs'] = array();
+}
+
+$pconfig['enable'] = isset($freenas_config['nfs']['enable']);
+$pconfig['mapall'] = $freenas_config['nfs']['mapall'];
+
+list($pconfig['network'],$pconfig['network_subnet']) =
+ explode('/', $freenas_config['nfs']['nfsnetwork']);
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ $reqdfields = explode(" ", "network network_subnet");
+ $reqdfieldsn = explode(",", "Destination network,Destination network bit count");
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['network'] && !is_ipaddr($_POST['network']))) {
+ $error_bucket[] = array("error" => gettext("A valid network must be specified."),
+ "field" => "network");
+ }
+
+ if (($_POST['network_subnet'] && !is_numeric($_POST['network_subnet']))) {
+ $error_bucket[] = array("error" => gettext("A valid network bit count must be specified."),
+ "field" => "network_subnet");
+
+ }
+
+ $osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['nfs']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['nfs']['mapall'] = $_POST['mapall'];
+ $freenas_config['nfs']['nfsnetwork'] = $osn;
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_nfs_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+ document.iform.mapall.disabled = endis;
+ document.iform.network.disabled = endis;
+ document.iform.network_subnet.disabled = endis;
+ /* color adjustments */
+ document.iform.mapall.style.backgroundColor = color;
+ document.iform.network.style.backgroundColor = color;
+ document.iform.network_subnet.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="services_nfs.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("NFS Server");?></span>
+ <span style="vertical-align: middle; position: relative; left: 84%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("map all user to root");?></td>
+ <td width="78%" class="vtable">
+ <select name="mapall" class="formselect" id="mapall">
+ <?php
+ $types = explode(",", "Yes,No");
+ $vals = explode(" ", "yes no");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['mapall']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ <br />
+ <?= gettext("All users will have the root privilege."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Authorised network");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="network" type="text" class="formfld host" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>" />
+ /
+ <select name="network_subnet" class="formselect" id="network_subnet">
+ <?php for ($i = 32; $i >= 1; $i--): ?>
+ <option value="<?=$i;?>" <?php if ($i == $pconfig['network_subnet']) echo "selected=\"selected\""; ?>>
+ <?=$i;?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ <br />
+ <?= gettext("Network that is authorised to access to NFS share"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <span class="red">
+ <strong><?= gettext("WARNING"); ?></strong>
+ </span>
+ <span class="vexpl">
+ <?= gettext("The name of the exported directories are : /mnt/sharename"); ?>
+ </span>
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/services_rsyncd.php b/packages/freenas/www/services_rsyncd.php
new file mode 100644
index 00000000..b28bca34
--- /dev/null
+++ b/packages/freenas/www/services_rsyncd.php
@@ -0,0 +1,263 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Services"),
+ gettext("RSYNCD"),
+ gettext("Server"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+/* TODO: use pfSense users/groups. */
+if (!is_array($freenas_config['access']['user']))
+ $freenas_config['access']['user'] = array();
+
+users_sort();
+
+$a_user = &$freenas_config['access']['user'];
+
+if (!is_array($freenas_config['rsync']))
+{
+ $freenas_config['rsync'] = array();
+}
+
+$pconfig['readonly'] = $freenas_config['rsyncd']['readonly'];
+$pconfig['port'] = $freenas_config['rsyncd']['port'];
+$pconfig['motd'] = $freenas_config['rsyncd']['motd'];
+$pconfig['maxcon'] = $freenas_config['rsyncd']['maxcon'];
+$pconfig['rsyncd_user'] = $freenas_config['rsyncd']['rsyncd_user'];
+$pconfig['enable'] = isset($freenas_config['rsyncd']['enable']);
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_format);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable'])
+ {
+ $reqdfields = array_merge($reqdfields, explode(" ", "readonly port"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Readonly,Port"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable']) {
+ if (!is_port($_POST['port']))
+ $error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."),
+ "field" => "port");
+ else if (!is_numericint($_POST['maxcon']))
+ $error_bucket[] = array("error" => gettext("The value provided by the maximum connections field is not a number"),
+ "field" => "maxcon");
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['rsyncd']['readonly'] = $_POST['readonly'];
+ $freenas_config['rsyncd']['port'] = $_POST['port'];
+ $freenas_config['rsyncd']['motd'] = $_POST['motd'];
+ $freenas_config['rsyncd']['maxcon'] = $_POST['maxcon'];
+ $freenas_config['rsyncd']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['rsyncd']['rsyncd_user'] = $_POST['rsyncd_user'];
+
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path))
+ {
+ /* nuke the cache file */
+ config_lock();
+ services_rsyncd_configure();
+ services_mdnsresponder_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+ document.iform.readonly.disabled = endis;
+ document.iform.port.disabled = endis;
+ document.iform.motd.disabled = endis;
+ document.iform.maxcon.disabled = endis;
+ document.iform.rsyncd_user.disabled = endis;
+ /* adjust colors */
+ document.iform.readonly.style.backgroundColor = color;
+ document.iform.port.style.backgroundColor = color;
+ document.iform.motd.style.backgroundColor = color;
+ document.iform.maxcon.style.backgroundColor = color;
+ document.iform.rsyncd_user.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Server"), true, "services_rsyncd.php");
+ $tab_array[1] = array(gettext("Client"), false, "services_rsyncd_client.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form id="iform" name="iform" action="services_rsyncd.php" method="post">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("Rsync Daemon");?></span>
+ <span style="vertical-align: middle; position: relative; left: 81%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Read only"); ?></td>
+ <td width="78%" class="vtable">
+ <select name="readonly" class="formselect" id="readonly">
+ <?php
+ $types = explode(",", "Yes,No");
+ $vals = explode(" ", "yes no");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['readonly']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Map to user"); ?></td>
+ <td width="78%" class="vtable">
+ <select name="rsyncd_user" class="formselect" id="rsyncd_user">
+ <option value="ftp"<?php if ($pconfig['rsyncd_user'] == "ftp") echo "selected";?>>
+ <?php echo htmlspecialchars("guest"); ?>
+ <?php foreach ($a_user as $user): ?>
+ <option value="<?=$user['login'];?>"<?php if ($user['login'] == $pconfig['rsyncd_user']) echo "selected";?>>
+ <?php echo htmlspecialchars($user['login']); ?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("TCP port"); ?></td>
+ <td width="78%" class="vtable">
+ <input name="port" type="text" class="formfld" id="port" size="20" value="<?=htmlspecialchars($pconfig['port']);?>" />
+ <br /><?= gettext("Alternate TCP port."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?= gettext("Maximum connections"); ?></td>
+ <td width="78%" class="vtable">
+ <input name="maxcon" type="text" class="formfld" id="maxcon" size="20" value="<?=htmlspecialchars($pconfig['maxcon']);?>" />
+ <br /><?= gettext("Maximum number of simultaneous connections. Default is 0 (unlimited)"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?= gettext("MOTD"); ?></td>
+ <td width="78%" class="vtable">
+ <textarea name="motd" cols="65" rows="7" id="motd" class="formpre"><?=htmlspecialchars($pconfig['motd']);?></textarea>
+ <br />
+ <?= gettext("message of the day");?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/services_rsyncd_client.php b/packages/freenas/www/services_rsyncd_client.php
new file mode 100644
index 00000000..f5e86e07
--- /dev/null
+++ b/packages/freenas/www/services_rsyncd_client.php
@@ -0,0 +1,565 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Services"),
+ gettext("RSYNCD"),
+ gettext("Client"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+/* TODO: use pfSense users/groups. */
+if (!is_array($freenas_config['access']['user']))
+ $freenas_config['access']['user'] = array();
+
+users_sort();
+
+$a_user = &$freenas_config['access']['user'];
+
+if (!is_array($freenas_config['rsync']))
+{
+ $freenas_config['rsync'] = array();
+}
+
+$a_months = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
+$a_weekdays = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
+
+$pconfig['readonly'] = $freenas_config['rsyncd']['readonly'];
+$pconfig['port'] = $freenas_config['rsyncd']['port'];
+$pconfig['motd'] = $freenas_config['rsyncd']['motd'];
+$pconfig['maxcon'] = $freenas_config['rsyncd']['maxcon'];
+$pconfig['rsyncd_user'] = $freenas_config['rsyncd']['rsyncd_user'];
+$pconfig['enable'] = isset($freenas_config['rsyncd']['enable']);
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ unset($do_format);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable']){
+ $reqdfields = array_merge($reqdfields, explode(" ", "rsyncserverip sharetosync"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Rsyncserverip,Sharetosync"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if ($_POST['enable']) {
+ if (!is_port($_POST['port']))
+ $error_bucket[] = array("error" => gettext("The TCP port must be a valid port number."),
+ "field" => "port");
+ else if (!is_numericint($_POST['maxcon']))
+ $error_bucket[] = array("error" => gettext("The value provided by the maximum connections field is not a number"),
+ "field" => "maxcon");
+ }
+
+ if (!is_array($freenas_config['mounts']['mount'])) {
+ $error_bucket[] = array("error" => gettext("You must configure mount point first."),
+ "field" => "none");
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['rsyncclient']['opt_delete'] = $_POST['opt_delete'] ? true : false;;
+ $freenas_config['rsyncclient']['rsyncserverip'] = $_POST['rsyncserverip'];
+ $freenas_config['rsyncclient']['minute'] = $_POST['minutes'];
+ $freenas_config['rsyncclient']['hour'] = $_POST['hours'];
+ $freenas_config['rsyncclient']['day'] = $_POST['days'];
+ $freenas_config['rsyncclient']['month'] = $_POST['months'];
+ $freenas_config['rsyncclient']['weekday'] = $_POST['weekdays'];
+ $freenas_config['rsyncclient']['rsyncshare'] = $_POST['rsyncshare'];
+ $freenas_config['rsyncclient']['enable'] = $_POST['enable'] ? true : false;
+ $freenas_config['rsyncclient']['sharetosync'] = $_POST['sharetosync'];
+ $freenas_config['rsyncclient']['all_mins'] = $_POST['all_mins'];
+ $freenas_config['rsyncclient']['all_hours'] = $_POST['all_hours'];
+ $freenas_config['rsyncclient']['all_days'] = $_POST['all_days'];
+ $freenas_config['rsyncclient']['all_months'] = $_POST['all_months'];
+ $freenas_config['rsyncclient']['all_weekdays'] = $_POST['all_weekdays'];
+
+ write_config();
+
+ $retval = 0;
+
+ if (!file_exists($d_sysrebootreqd_path)){
+ /* nuke the cache file */
+ config_lock();
+ services_rsyncclient_configure();
+ services_cron_configure();
+ config_unlock();
+ }
+
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+if (is_array($freenas_config['mounts']['mount'])) {
+ mount_sort();
+ $a_mount = &$freenas_config['mounts']['mount'];
+
+ $pconfig['opt_delete'] = isset($freenas_config['rsyncclient']['opt_delete']);
+ $pconfig['enable'] = isset($freenas_config['rsyncclient']['enable']);
+ $pconfig['rsyncserverip'] = $freenas_config['rsyncclient']['rsyncserverip'];
+ $pconfig['rsyncshare'] = $freenas_config['rsyncclient']['rsyncshare'];
+ $pconfig['minute'] = $freenas_config['rsyncclient']['minute'];
+ $pconfig['hour'] = $freenas_config['rsyncclient']['hour'];
+ $pconfig['day'] = $freenas_config['rsyncclient']['day'];
+ $pconfig['month'] = $freenas_config['rsyncclient']['month'];
+ $pconfig['weekday'] = $freenas_config['rsyncclient']['weekday'];
+ $pconfig['sharetosync'] = $freenas_config['rsyncclient']['sharetosync'];
+ $pconfig['all_mins'] = $freenas_config['rsyncclient']['all_mins'];
+ $pconfig['all_hours'] = $freenas_config['rsyncclient']['all_hours'];
+ $pconfig['all_days'] = $freenas_config['rsyncclient']['all_days'];
+ $pconfig['all_months'] = $freenas_config['rsyncclient']['all_months'];
+ $pconfig['all_weekdays'] = $freenas_config['rsyncclient']['all_weekdays'];
+
+ if ($pconfig['all_mins'] == 1){
+ $all_mins_all = " checked";
+ } else {
+ $all_mins_selected = " checked";
+ }
+
+ if ($pconfig['all_hours'] == 1){
+ $all_hours_all = " checked";
+ } else {
+ $all_hours_selected = " checked";
+ }
+
+ if ($pconfig['all_days'] == 1){
+ $all_days_all = " checked";
+ } else {
+ $all_days_selected = " checked";
+ }
+
+ if ($pconfig['all_months'] == 1){
+ $all_months_all = " checked";
+ } else {
+ $all_months_selected = " checked";
+ }
+
+ if ($pconfig['all_weekdays'] == 1){
+ $all_weekdays_all = " checked";
+ } else {
+ $all_weekdays_selected = " checked";
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+EOD;
+
+$i = 0;
+
+if (is_array($a_mount)) {
+ foreach ($a_mount as $mountv) {
+ $jscriptstr .= " document.iform.share_" . $i . ".disabled = endis;\n";
+ $i++;
+ }
+}
+
+$jscriptstr .= <<<EOD
+
+ document.iform.rsyncserverip.disabled = endis;
+ document.iform.minutes1.disabled = endis;
+ document.iform.minutes2.disabled = endis;
+ document.iform.minutes3.disabled = endis;
+ document.iform.hours1.disabled = endis;
+ document.iform.days1.disabled = endis;
+ document.iform.days2.disabled = endis;
+ document.iform.months.disabled = endis;
+ document.iform.weekdays.disabled = endis;
+ document.iform.all_mins1.disabled = endis;
+ document.iform.all_mins2.disabled = endis;
+ document.iform.all_hours1.disabled = endis;
+ document.iform.all_hours2.disabled = endis;
+ document.iform.all_days1.disabled = endis;
+ document.iform.all_days2.disabled = endis;
+ document.iform.all_months1.disabled = endis;
+ document.iform.all_months2.disabled = endis;
+ document.iform.all_weekdays1.disabled = endis;
+ document.iform.all_weekdays2.disabled = endis;
+ document.iform.opt_delete.disabled = endis;
+ /* color adjustments */
+ document.iform.rsyncserverip.style.backgroundColor = color;
+ document.iform.minutes1.style.backgroundColor = color;
+ document.iform.minutes2.style.backgroundColor = color;
+ document.iform.minutes3.style.backgroundColor = color;
+ document.iform.hours1.style.backgroundColor = color;
+ document.iform.days1.style.backgroundColor = color;
+ document.iform.days2.style.backgroundColor = color;
+ document.iform.months.style.backgroundColor = color;
+ document.iform.weekdays.style.backgroundColor = color;
+ document.iform.all_mins1.style.backgroundColor = color;
+ document.iform.all_mins2.style.backgroundColor = color;
+ document.iform.all_hours1.style.backgroundColor = color;
+ document.iform.all_hours2.style.backgroundColor = color;
+ document.iform.all_days1.style.backgroundColor = color;
+ document.iform.all_days2.style.backgroundColor = color;
+ document.iform.all_months1.style.backgroundColor = color;
+ document.iform.all_months2.style.backgroundColor = color;
+ document.iform.all_weekdays1.style.backgroundColor = color;
+ document.iform.all_weekdays2.style.backgroundColor = color;
+ document.iform.opt_delete.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+<div id="inputerrors"></div>
+<table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+<?php
+ $tab_array = array();
+ $tab_array[0] = array(gettext("Server"), false, "services_rsyncd.php");
+ $tab_array[1] = array(gettext("Client"), true, "services_rsyncd_client.php");
+ display_top_tabs($tab_array);
+?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <form id="iform" name="iform" action="services_rsyncd_client.php" method="post">
+ <table class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("Rsync Client Synchronization");?></span>
+ <span style="vertical-align: middle; position: relative; left: 70%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top" class="vncellreq"><?= gettext("Remote RSYNC Server"); ?></td>
+ <td width="84%" class="vtable">
+ <input name="rsyncserverip" id="rsyncserverip" type="text" class="formfld unknown" size="20" value="<?=htmlspecialchars($pconfig['rsyncserverip']);?>" />
+ <br />
+ <?= gettext("IP address of remote RSYNC server"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top" class="vncellreq"><?= gettext("RSYNC Options"); ?></td>
+ <td width="84%" class="vtable">
+ <input name="opt_delete" id="opt_delete" type="checkbox" value="yes" <?php if ($pconfig['opt_delete']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Delete files that don't exist on sender."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top" class="vncellreq"><?= gettext("Shares to be synchronized"); ?></td>
+ <td width="84%" class="vtable">
+ <?php
+ $i=0;
+ if (is_array($freenas_config['mounts']['mount'])) {
+ foreach ($a_mount as $mountv) {
+ echo "<input name=\"sharetosync[]\" id=\"share_" . $i . "\" type=\"checkbox\" value=\"" . $mountv['sharename'] . "\"";
+
+ if (in_array($mountv['sharename'], $pconfig['sharetosync']))
+ echo " checked=\"checked\"";
+ echo" />";
+ echo $mountv['sharename'] . " (" . $mountv['desc'] . ")<br />\n";
+ $i++;
+ }
+ }
+ else
+ echo "You must configure mount point before!";
+ ?>
+ <br />
+ <?= gettext("This same local share must be present on the Remote Server."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top" class="vncellreq"><?= gettext("Synchronization Time"); ?></td>
+ <td width="84%" class="vtable">
+ <table width="100%" border="1" cellpadding="4" cellspacing="0">
+ <tr>
+ <td align="left" valign="top" class="listtopic"><?= gettext("minutes"); ?></td>
+ <td align="left" valign="top" class="listtopic"><?= gettext("hours"); ?></td>
+ <td align="left" valign="top" class="listtopic"><?= gettext("days"); ?></td>
+ <td align="left" valign="top" class="listtopic"><?= gettext("months"); ?></td>
+ <td align="left" valign="top" class="listtopic"><?= gettext("week days"); ?></td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" class="vncell" nowrap="nowrap">
+ <div id="all_min_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_mins" id="all_mins1" value="1"<?php echo $all_mins_all;?> />
+ <label for="all_mins1">All</label><br />
+ <input type="radio" name="all_mins" id="all_mins2" value="0"<?php echo $all_mins_selected;?> />
+ <label for="all_mins2">Selected ...</label>
+ </div>
+ <div id="all_min_select" style="vertical-align: top;">
+ <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes1" style="vertical-align: top;">
+ <?php
+ $i = 0;
+ while ($i <= 23){
+ if (isset($pconfig['minute'])) {
+ if (in_array($i, $pconfig['minute'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ <select multiple="multible" class="formselect" size="24" name="minutes[]" id="minutes2" style="vertical-align: top;">
+ <?php
+ $i = 24;
+ while ($i <= 47) {
+ if (isset($pconfig['minute'])) {
+ if (in_array($i, $pconfig['minute'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ <select multiple="multible" class="formselect" size="12" name="minutes[]" id="minutes3" style="vertical-align: top;">
+ <?php
+ $i = 48;
+ while ($i <= 59) {
+ if (isset($pconfig['minute'])) {
+ if (in_array($i, $pconfig['minute'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ <td align="left" valign="top" class="vncell" nowrap="nowrap">
+ <div id="all_hours_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_hours" id="all_hours1" value="1"<?php echo $all_hours_all;?> />
+ <label for="all_hours1">All</label><br />
+ <input type="radio" name="all_hours" id="all_hours2" value="0"<?php echo $all_hours_selected;?> />
+ <label for="all_hours2">Selected ...</label>
+ </div>
+ <div id="all_hours_select" style="vertical-align: top;">
+ <select multiple size="24" name="hours[]" id="hours1" style="vertical-align: top;">
+ <?php
+ $i = 0;
+ while ($i <= 23) {
+ if (isset($pconfig['hour'])) {
+ if (in_array($i, $pconfig['hour'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ <td align="left" valign="top" class="vncell" nowrap="nowrap">
+ <div id="all_days_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_days" id="all_days1" value="1" <?php echo $all_days_all;?> />
+ <label for="all_days1">All</label><br />
+ <input type="radio" name="all_days" id="all_days2" value="0"<?php echo $all_days_selected;?> />
+ <label for="all_days2">Selected ...</label>
+ </div>
+ <div id="all_days_select" style="vertical-align: top;">
+ <select multiple size="24" name="days[]" id="days1" style="vertical-align: top;">
+ <?php
+ $i = 1;
+ while ($i <= 24) {
+ if (isset($pconfig['day'])) {
+ if (in_array($i, $pconfig['day'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ <select multiple size="7" name="days[]" id="days2" style="vertical-align: top;">
+ <?php
+ $i = 25;
+ while ($i <= 31) {
+ if (isset($pconfig['day'])) {
+ if (in_array($i, $pconfig['day'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $i . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ <td align="left" valign="top" class="vncell">
+ <div id="all_months_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_months" id="all_months1" value="1"<?php echo $all_months_all;?> />
+ <label for="all_months1">All</label><br />
+ <input type="radio" name="all_months" id="all_months2" value="0"<?php echo $all_months_selected;?> />
+ <label for="all_months2">Selected ...</label>
+ </div>
+ <div id="all_months_select" style="vertical-align: top;">
+ <select multiple size="12" name="months[]" id="months" style="vertical-align: top;">
+ <?php
+ $i=1;
+ foreach ($a_months as $monthv) {
+ if (isset($pconfig['month'])) {
+ if (in_array($i, $pconfig['month'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $monthv . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ <td align="left" valign="top" class="vncell">
+ <div id="all_weekdays_rdbtns" style="padding-bottom: 10px;" >
+ <input type="radio" name="all_weekdays" id="all_weekdays1" value="1"<?php echo $all_weekdays_all;?> />
+ <label for="all_weekdays1">All</label><br />
+ <input type="radio" name="all_weekdays" id="all_weekdays2" value="0"<?php echo $all_weekdays_selected;?> />
+ <label for="all_weekdays2">Selected ...</label>
+ </div>
+ <div id="all_weekdays_select" style="vertical-align: top;">
+ <select multiple size="7" name="weekdays[]" id="weekdays" style="vertical-align: top;">
+ <?php
+ $i=0;
+ foreach ($a_weekdays as $weekdayv) {
+ if (isset($pconfig['weekday'])){
+ if (in_array($i, $pconfig['weekday'])) {
+ $is_selected = " selected";
+ } else {
+ $is_selected = "";
+ }
+ }
+
+ echo "<option value=\"" . $i . "\"" . $is_selected . ">" . $weekdayv . "\n";
+ $i++;
+ }
+ ?>
+ </select>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td align="left" valign="top" class="vncell" colspan="5">
+ <?= gettext("Note: Ctrl-click (or command-click on the Mac) to select and de-select minutes, hours, days and months."); ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" valign="top">&nbsp;</td>
+ <td width="84%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+ </td>
+ </tr>
+</table>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/services_samba.php b/packages/freenas/www/services_samba.php
new file mode 100644
index 00000000..1703b645
--- /dev/null
+++ b/packages/freenas/www/services_samba.php
@@ -0,0 +1,416 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Services"),
+ gettext("CIFS"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['samba']))
+{
+ $freenas_config['samba'] = array();
+}
+
+if (!is_array($freenas_config['mounts']['mount']))
+ $freenas_config['mounts']['mount'] = array();
+
+mount_sort();
+
+$a_mount = &$freenas_config['mounts']['mount'];
+
+$pconfig['netbiosname'] = $freenas_config['samba']['netbiosname'];
+$pconfig['workgroup'] = $freenas_config['samba']['workgroup'];
+$pconfig['serverdesc'] = $freenas_config['samba']['serverdesc'];
+$pconfig['security'] = $freenas_config['samba']['security'];
+$pconfig['localmaster'] = $freenas_config['samba']['localmaster'];
+$pconfig['winssrv'] = $freenas_config['samba']['winssrv'];
+$pconfig['hidemount'] = $freenas_config['samba']['hidemount'];
+$pconfig['timesrv'] = $freenas_config['samba']['timesrv'];
+$pconfig['unixcharset'] = $freenas_config['samba']['unixcharset'];
+$pconfig['doscharset'] = $freenas_config['samba']['doscharset'];
+$pconfig['loglevel'] = $freenas_config['samba']['loglevel'];
+$pconfig['sndbuf'] = $freenas_config['samba']['sndbuf'];
+$pconfig['rcvbuf'] = $freenas_config['samba']['rcvbuf'];
+$pconfig['enable'] = isset($freenas_config['samba']['enable']);
+$pconfig['recyclebin'] = isset($freenas_config['samba']['recyclebin']);
+
+if (! empty($_POST))
+{
+ /* hash */
+ unset($error_bucket);
+ /* simple error list */
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if ($_POST['enable']) {
+ $reqdfields = array_merge($reqdfields, explode(" ", "netbiosname workgroup security localmaster"));
+ $reqdfieldsn = array_merge($reqdfieldsn, explode(",", "Netbiosname,Workgroup,Security, Localmaster"));
+ }
+
+ do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
+
+ if (($_POST['netbiosname'] && !is_domain($_POST['netbiosname']))) {
+ $error_bucket[] = array("error" => gettext("The Netbios name contains invalid characters."),
+ "field" => "netbiosname");
+ }
+ if (($_POST['workgroup'] && !is_domain($_POST['workgroup']))) {
+ $error_bucket[] = array("error" => gettext("The Workgroup name contains invalid characters."),
+ "field" => "workgroup");
+ }
+ if (($_POST['winssrv'] && !is_ipaddr($_POST['winssrv']))) {
+ $error_bucket[] = array("error" => gettext("The WINS server must be an IP address."),
+ "field" => "winssrv");
+ }
+
+ if (!is_numericint($_POST['sndbuf'])) {
+ $error_bucket[] = array("error" => gettext("PediaXThe SND Buffer value must be a number."),
+ "field" => "sndbuf");
+ }
+
+ if (!is_numericint($_POST['rcvbuf'])) {
+ $error_bucket[] = array("error" => gettext("The RCV Buffer value must be a number."),
+ "field" => "rcvbuf");
+ }
+
+ if (is_array($error_bucket))
+ foreach($error_bucket as $elem)
+ $input_errors[] =& $elem["error"];
+
+ /* if this is an AJAX caller then handle via JSON */
+ if(isAjax() && is_array($error_bucket)) {
+ input_errors2Ajax(NULL, $error_bucket);
+ exit;
+ }
+
+ if (!$input_errors)
+ {
+ $freenas_config['samba']['netbiosname'] = $_POST['netbiosname'];
+ $freenas_config['samba']['workgroup'] = $_POST['workgroup'];
+ $freenas_config['samba']['serverdesc'] = $_POST['serverdesc'];
+ $freenas_config['samba']['security'] = $_POST['security'];
+ $freenas_config['samba']['localmaster'] = $_POST['localmaster'];
+ $freenas_config['samba']['winssrv'] = $_POST['winssrv'];
+ $freenas_config['samba']['hidemount'] = $_POST['hidemount'];
+ $freenas_config['samba']['timesrv'] = $_POST['timesrv'];
+ $freenas_config['samba']['doscharset'] = $_POST['doscharset'];
+ $freenas_config['samba']['unixcharset'] = $_POST['unixcharset'];
+ $freenas_config['samba']['loglevel'] = $_POST['loglevel'];
+ $freenas_config['samba']['sndbuf'] = $_POST['sndbuf'];
+ $freenas_config['samba']['rcvbuf'] = $_POST['rcvbuf'];
+ $freenas_config['samba']['recyclebin'] = $_POST['recyclebin'] ? true : false;
+ $freenas_config['samba']['enable'] = $_POST['enable'] ? true : false;
+
+ write_config();
+
+ $retval = 0;
+ if (!file_exists($d_sysrebootreqd_path)) {
+ /* nuke the cache file */
+ config_lock();
+ services_samba_configure();
+ services_mdnsresponder_configure();
+ config_unlock();
+ }
+ $savemsg = get_std_save_message($retval);
+ }
+}
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+
+$jscriptstr = <<<EOD
+<script type="text/javascript">
+<!--
+function enable_change(enable_change) {
+ var endis;
+
+ endis = !(document.iform.enable.checked || enable_change);
+ endis ? color = '#D4D0C8' : color = '#FFFFFF';
+
+ document.iform.netbiosname.disabled = endis;
+ document.iform.workgroup.disabled = endis;
+ document.iform.localmaster.disabled = endis;
+ document.iform.winssrv.disabled = endis;
+ document.iform.timesrv.disabled = endis;
+ document.iform.serverdesc.disabled = endis;
+ document.iform.doscharset.disabled = endis;
+ document.iform.unixcharset.disabled = endis;
+ document.iform.loglevel.disabled = endis;
+ document.iform.sndbuf.disabled = endis;
+ document.iform.rcvbuf.disabled = endis;
+ document.iform.recyclebin.disabled = endis;
+ document.iform.security.disabled = endis;
+ /* color adjustments */
+ document.iform.netbiosname.style.backgroundColor = color;
+ document.iform.workgroup.style.backgroundColor = color;
+ document.iform.localmaster.style.backgroundColor = color;
+ document.iform.winssrv.style.backgroundColor = color;
+ document.iform.timesrv.style.backgroundColor = color;
+ document.iform.serverdesc.style.backgroundColor = color;
+ document.iform.doscharset.style.backgroundColor = color;
+ document.iform.unixcharset.style.backgroundColor = color;
+ document.iform.loglevel.style.backgroundColor = color;
+ document.iform.sndbuf.style.backgroundColor = color;
+ document.iform.rcvbuf.style.backgroundColor = color;
+ document.iform.recyclebin.style.backgroundColor = color;
+ document.iform.security.style.backgroundColor = color;
+}
+//-->
+</script>
+
+EOD;
+
+$pfSenseHead->addScript($jscriptstr);
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="services_samba.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="100%" valign="middle" class="listtopic" colspan="2">
+ <span style="vertical-align: middle; position: relative; left: 0px;"><?=gettext("CIFS share");?></span>
+ <span style="vertical-align: middle; position: relative; left: 84%;">
+ <input name="enable" type="checkbox" value="yes" <?php if ($pconfig['enable']) echo "checked=\"checked\""; ?> onClick="enable_change(false)" />&nbsp;<?= gettext("Enable"); ?>
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Authentication");?></td>
+ <td width="78%" class="vtable">
+ <select name="security" class="formselect" id="security">
+ <?php
+ $types = explode(",", "Anonymous,Local User,Domain");
+ $vals = explode(" ", "share user domain");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['security']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("NetBios name");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="netbiosname" type="text" class="formfld unknown" id="netbiosname" size="20" value="<?=htmlspecialchars($pconfig['netbiosname']);?>" />
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("Workgroup");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="workgroup" type="text" class="formfld unknown" id="workgroup" size="20" value="<?=htmlspecialchars($pconfig['workgroup']);?>" />
+ <br />
+ <?= gettext("Workgroup to be member of.");?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="serverdesc" type="text" class="formfld unknown" id="serverdesc" size="30" value="<?=htmlspecialchars($pconfig['serverdesc']);?>" />
+ <br />
+ <?= gettext("Server description. This can usually be left blank.");?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Dos charset");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <select name="doscharset" class="formselect" id="doscharset">
+ <?php
+ $types = explode(",", "CP850,CP852,CP437,ASCII");
+ $vals = explode(" ", "CP850 CP852 CP437 ASCII");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['doscharset']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Unix charset");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <select name="unixcharset" class="formselect" id="unixcharset">
+ <?php
+ $types = explode(",", "UTF-8,iso-8859-1,iso-8859-15,gb2312,ASCII");
+ $vals = explode(" ", "UTF-8 iso-8859-1 iso-8859-15 gb2312 ASCII");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['unixcharset']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Log level");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <select name="loglevel" class="formselect" id="loglevel">
+ <?php
+ $types = explode(",", "Minimum,Normal,Full,Debug");
+ $vals = explode(" ", "1 2 3 10");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['loglevel']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Local Master Browser");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <select name="localmaster" class="formselect" id="localmaster">
+ <?php
+ $types = explode(",", "Yes,No");
+ $vals = explode(" ", "yes no");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['localmaster']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ <br />
+ <?= gettext("Allows FreeNAS to try and become a local master browser."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Time Server");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <select name="timesrv" class="formselect" id="timesrv">
+ <?php
+ $types = explode(",", "Yes,No");
+ $vals = explode(" ", "yes no");
+ $j = 0;
+
+ for ($j = 0; $j < count($vals); $j++):
+ ?>
+ <option value="<?=$vals[$j];?>" <?php if ($vals[$j] == $pconfig['timesrv']) echo "selected=\"selected\"";?>>
+ <?=htmlspecialchars($types[$j]);?>
+ </option>
+ <?php endfor; ?>
+ </select>
+ <br />
+ <?= gettext("FreeNAS advertises itself as a time server to Windows clients."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("WINS server");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="winssrv" type="text" class="formfld host" id="winssrv" size="30" value="<?=htmlspecialchars($pconfig['winssrv']);?>" />
+ <br />
+ <?= gettext("WINS Server IP address."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Recycle Bin");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="recyclebin" type="checkbox" id="recyclebin" value="yes" <?php if ($pconfig['recyclebin']) echo "checked=\"checked\""; ?> />
+ <?= gettext("Enable Recycle bin"); ?><br />
+ <?= gettext("This will create a recycle bin on the CIFS shares"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Share to hide.");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <?
+ $i=0;
+ foreach ($a_mount as $mountv) {
+ echo "<input name='hidemount[]' id='$i' type='checkbox' value='$mountv[sharename]'".
+ ((is_array($pconfig['hidemount']) && in_array($mountv['sharename'],$pconfig['hidemount'])) ? " checked=\"checked\"" : "") .
+ " />$mountv[sharename] <br />\n";
+ $i++;
+ }
+ ?>
+ <br />
+ <?= gettext("Select the CIFS share to hide from browsing."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Send Buffer Size");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="sndbuf" type="text" class="formfld unknown" id="sndbuf" size="30" value="<?=htmlspecialchars($pconfig['sndbuf']);?>" />
+ <br />
+ <?= gettext("Size of send buffer (16384 by default)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell"><?=gettext("Receive Buffer Size");?></td>
+ <td width="78%" class="vtable" align="left" valign="middle">
+ <input name="rcvbuf" type="text" class="formfld unknown" id="rcvbuf" size="30" value="<?=htmlspecialchars($pconfig['rcvbuf']);?>" />
+ <br />
+ <?= gettext("Size of receive buffer (16384 by default)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input id="submit" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>
diff --git a/packages/freenas/www/status_disks.php b/packages/freenas/www/status_disks.php
new file mode 100644
index 00000000..478d2e89
--- /dev/null
+++ b/packages/freenas/www/status_disks.php
@@ -0,0 +1,119 @@
+<?php
+/* $Id$ */
+/*
+ disks_manage_edit.php
+ part of FreeNAS (http://www.freenas.org)
+ Copyright (C) 2005-2006 Olivier Cochard-Labbé <olivier@freenas.org>.
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+*/
+
+$pgtitle = array(gettext("Status"),
+ gettext("Disks"));
+
+require_once("guiconfig.inc");
+require_once("freenas_guiconfig.inc");
+require_once("freenas_functions.inc");
+
+if (!is_array($freenas_config['disks']['disk']))
+ $freenas_config['disks']['disk'] = array();
+
+disks_sort();
+
+$raidstatus=get_sraid_disks_list();
+
+$a_disk_conf = &$freenas_config['disks']['disk'];
+
+include("head.inc");
+/* put your custom HTML head content here */
+/* using some of the $pfSenseHead function calls */
+echo $pfSenseHead->getHTML();
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if ($input_errors) print_input_errors($input_errors); ?>
+<?php if ($savemsg) print_info_box($savemsg); ?>
+ <div id="inputerrors"></div>
+ <form id="iform" name="iform" action="status_disks.php" method="post">
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="5%" class="listhdrr">Disk</td>
+ <td width="5%" class="listhdrr">Size</td>
+ <td width="60%" class="listhdrr">Description</td>
+ <td width="10%" class="listhdr">Status</td>
+ </tr>
+ <?php foreach ($a_disk_conf as $disk): ?>
+ <tr>
+ <td class="listr">
+ <?=htmlspecialchars($disk['name']);?>
+ </td>
+ <td class="listr">
+ <?=htmlspecialchars($disk['size']);?>
+ </td>
+ <td class="listr">
+ <?=htmlspecialchars($disk['desc']);?>&nbsp;
+ </td>
+ <td class="listr">
+ <?php
+ $stat=disks_status($disk);
+ echo $stat;?>&nbsp;
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ <?php if (isset($raidstatus)): ?>
+ <?php foreach ($raidstatus as $diskk => $diskv): ?>
+ <tr>
+ <td class="listr">
+ <?=htmlspecialchars($diskk);?>
+ </td>
+ <td class="listr">
+ <?=htmlspecialchars($diskv['size']);?>
+ </td>
+ <td class="listr">
+
+ <?=htmlspecialchars("Software RAID volume");?>&nbsp;
+ </td>
+ <td class="listr">
+ <?=htmlspecialchars($diskv['desc']);?>&nbsp;
+ </td>
+ </tr>
+ <?php endforeach; ?>
+ <?php endif; ?>
+ </table>
+ </form>
+<?php include("fend.inc"); ?>
+<?= checkForInputErrors(); ?>
+<script type="text/javascript">
+<!--
+enable_change(false);
+//-->
+</script>
+</body>
+</html>