コード例 #1
0
	SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

	The views and conclusions contained in the software and documentation are those
	of the authors and should not be interpreted as representing official policies,
	either expressed or implied, of the NAS4Free Project.
*/
require "auth.inc";
require "guiconfig.inc";
$pgtitle = array(gettext("Disks"), gettext("Encryption"), gettext("Add"));
if (!isset($config['geli']['vdisk']) || !is_array($config['geli']['vdisk'])) {
    $config['geli']['vdisk'] = array();
}
array_sort_key($config['geli']['vdisk'], "devicespecialfile");
$a_geli =& $config['geli']['vdisk'];
// Get list of all configured disks (physical and virtual).
$a_alldisk = get_conf_all_disks_list_filtered();
// Check whether there are disks configured, othersie display a error message.
if (!count($a_alldisk)) {
    $nodisks_error = gettext("You must add disks first.");
}
// Check if protocol is HTTPS, otherwise display a warning message.
if ("http" === $config['system']['webgui']['protocol']) {
    $nohttps_error = gettext("You should use HTTPS as WebGUI protocol for sending passphrase.");
}
if ($_POST) {
    unset($input_errors);
    unset($errormsg);
    $pconfig = $_POST;
    if (isset($_POST['Cancel']) && $_POST['Cancel']) {
        header("Location: disks_crypt.php");
        exit;
コード例 #2
0
function get_all_scsi_device($a_extent, $uuid)
{
    $a = array();
    $a[''] = gettext("Must choose one");
    foreach (get_conf_all_disks_list_filtered() as $diskv) {
        $file = $diskv['devicespecialfile'];
        $size = $diskv['size'];
        $name = $diskv['name'];
        $desc = $diskv['desc'];
        if (strcmp($size, "NA") == 0) {
            continue;
        }
        if (disks_exists($file) == 1) {
            continue;
        }
        $index = array_search_ex($file, $a_extent, "path");
        if (FALSE !== $index) {
            if (!isset($uuid)) {
                continue;
            }
            if ($a_extent[$index]['uuid'] != $uuid) {
                continue;
            }
        }
        if (!preg_match("/^(da|cd|sa|ch)[0-9]/", $name)) {
            continue;
        }
        $a[$file] = htmlspecialchars("{$name}: {$size} ({$desc})");
    }
    return $a;
}