. All rights reserved. Based on m0n0wall (http://m0n0.ch/wall) Copyright (C) 2003-2006 Manuel Kasper . 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("freenas_config.inc"); 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(); ?>
  " />
: