function filter_disk($array) { return array_filter($array, function ($diskv) { if (0 != strcmp($diskv['size'], "NA") && 1 != disks_exists($diskv['devicespecialfile'])) { return $diskv; } }); }
<td class="vtable"> <select name="disk" class="formfld" id="disk"> <option value=""><?php echo gettext("Must choose one"); ?> </option> <?php foreach ($a_disk as $diskv) { ?> <?php if (0 == strcmp($diskv['size'], "NA")) { continue; } ?> <?php if (1 == disks_exists($diskv['devicespecialfile'])) { continue; } ?> <?php if (!isset($diskv['smart'])) { continue; } ?> <option value="<?php echo $diskv['devicespecialfile']; ?> " <?php if ($diskv['devicespecialfile'] === $pconfig['devicespecialfile']) { echo "selected=\"selected\""; }
foreach ($a_disk_conf as $disk) { ?> <?php $notificationmode = updatenotify_get_mode("device", $disk['uuid']); switch ($notificationmode) { case UPDATENOTIFY_MODE_NEW: $status = gettext("Initializing"); break; case UPDATENOTIFY_MODE_MODIFIED: $status = gettext("Modifying"); break; case UPDATENOTIFY_MODE_DIRTY: $status = gettext("Deleting"); break; default: $status = 0 == disks_exists($disk['devicespecialfile']) ? gettext("ONLINE") : gettext("MISSING"); break; } ?> <tr> <td class="listlr"><?php echo htmlspecialchars($disk['name']); ?> </td> <td class="listr"><?php echo htmlspecialchars($disk['size']); ?> </td> <td class="listr"><?php echo htmlspecialchars($disk['desc']); ?>
<?php $notificationmode = updatenotify_get_mode("device", $disk['uuid']); switch ($notificationmode) { case UPDATENOTIFY_MODE_NEW: $status = gettext("Initializing"); break; case UPDATENOTIFY_MODE_MODIFIED: $status = gettext("Modifying"); break; case UPDATENOTIFY_MODE_DIRTY: $status = gettext("Deleting"); break; default: if ($disk['type'] == 'HAST') { $role = $a_phy_disk[$disk['name']]['role']; $status = sprintf("%s (%s)", 0 == disks_exists($disk['devicespecialfile']) ? gettext("ONLINE") : gettext("MISSING"), $role); $disk['size'] = $a_phy_disk[$disk['name']]['size']; } else { switch ($verify_errors[$disk['name']]['error']) { case 1: $status = sprintf("%s : %s", gettext('MOVED TO'), $verify_errors[$disk['name']]['new_devicespecialfile']); break; case 2: if (empty($verify_errors[$disk['name']]['old_serial']) === FALSE) { $old_serial = htmlspecialchars($verify_errors[$disk['name']]['old_serial']); } else { $old_serial = htmlspecialchars(gettext("n/a")); } if (empty($verify_errors[$disk['name']]['new_serial']) === FALSE) { $new_serial = htmlspecialchars($verify_errors[$disk['name']]['new_serial']); } else {
?> </td> <td class="listbg"> <?php if (updatenotify_exists("geli")) { $status = gettext("Configuring"); $notificationmode = updatenotify_get_mode("geli", $geli['uuid']); switch ($notificationmode) { case UPDATENOTIFY_MODE_DIRTY: $status = gettext("Deleting"); break; } echo htmlspecialchars($status); } else { $notificationmode = UPDATENOTIFY_MODE_UNKNOWN; if (disks_exists($geli['devicespecialfile'])) { echo "<a href=\"disks_crypt_tools.php?disk={$geli['devicespecialfile']}&action=attach\">" . htmlspecialchars(gettext("Not attached")) . "</a>"; } else { echo htmlspecialchars(gettext("Attached")); } } ?> </td> <?php if (UPDATENOTIFY_MODE_DIRTY != $notificationmode) { ?> <td valign="middle" nowrap="nowrap" class="list"> <a href="disks_crypt_tools.php?disk=<?php echo $geli['devicespecialfile']; ?>
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; }