diff options
Diffstat (limited to 'packages/freenas/www/disks_manage_iscsi.php')
-rw-r--r-- | packages/freenas/www/disks_manage_iscsi.php | 133 |
1 files changed, 71 insertions, 62 deletions
diff --git a/packages/freenas/www/disks_manage_iscsi.php b/packages/freenas/www/disks_manage_iscsi.php index 96c8eb0d..5180fc1a 100644 --- a/packages/freenas/www/disks_manage_iscsi.php +++ b/packages/freenas/www/disks_manage_iscsi.php @@ -1,36 +1,44 @@ <?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. -*/ + disks_manage_iscsi.php + part of pfSense (http://www.pfSense.com) + Copyright (C) 2006 Daniel S. Haischt <me@daniel.stefan.haischt.name> + All rights reserved. + + Based on 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"), @@ -43,7 +51,7 @@ require_once("freenas_functions.inc"); if (! is_array($freenas_config['iscsi'])) { - $freenas_config['iscsi'] = array(); + $freenas_config['iscsi'] = array(); } $pconfig['enable'] = isset($freenas_config['iscsi']['enable']); @@ -56,23 +64,23 @@ if (! empty($_POST)) unset($error_bucket); /* simple error list */ unset($input_errors); - unset($do_format); - $pconfig = $_POST; + $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'])){ + 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"]; @@ -83,24 +91,24 @@ if (! empty($_POST)) 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); - } + 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"); @@ -145,7 +153,8 @@ echo $pfSenseHead->getHTML(); $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"); + $tab_array[2] = array(gettext("Tools"), false, "disks_manage_tools.php"); + $tab_array[3] = array(gettext("iSCSI Initiator"), true, "disks_manage_iscsi.php"); display_top_tabs($tab_array); ?> </td> |