_("Your account"))); dual_begin(array()); print("

" . _("Home") . " / " . _("Your account") . "

\n"); print("

" . _("You have not authenticated yourself to the system yet with your") . " " . _("username") . " " . _("and") . " " . _("password") . ". " . _("You will not be able to use this section of the website without authenticating yourself first. So, please continue and login using the form on the right hand side.") . "

\n"); dual_middle(array()); show_account_details(array()); dual_end(array()); generic_footer(array()); exit; } $volumes_id = array(); $volumes_name = array(); $volumes_mountpoint = array(); $volumes_vg = array(); $volumes_fstype = array(); function volumes_startelement($parser, $name, $attrs) { global $volumes_id, $volumes_name, $volumes_mountpoint, $volumes_vg, $volumes_fstype; if ($name == "VOLUME") { array_push($volumes_id, $attrs["ID"]); array_push($volumes_name, $attrs["NAME"]); array_push($volumes_mountpoint, $attrs["MOUNTPOINT"]); array_push($volumes_vg, $attrs["VG"]); array_push($volumes_fstype, $attrs["FSTYPE"]); } } function volumes_endelement($parser, $name) { } $volumes_parser = xml_parser_create(); xml_set_element_handler($volumes_parser, "volumes_startelement", "volumes_endelement"); $volumes_fp = fopen("/opt/openfiler/etc/volumes.xml", "r"); while ($volumes_data = fread($volumes_fp, 4096)) xml_parse($volumes_parser, $volumes_data, feof($volumes_fp)); fclose($volumes_fp); xml_parser_free($volumes_parser); $snapshots_id = array(); $snapshots_lvname = array(); $snapshots_vgname = array(); $snapshots_shared = array(); $snapshots_rotateid = array(); function snapshots_startelement($parser, $name, $attrs) { global $snapshots_id, $snapshots_lvname, $snapshots_vgname, $snapshots_shared, $snapshots_rotateid; if ($name == "SNAPSHOT") { array_push($snapshots_id, $attrs["ID"]); array_push($snapshots_lvname, $attrs["LVNAME"]); array_push($snapshots_vgname, $attrs["VGNAME"]); array_push($snapshots_shared, $attrs["SHARED"]); array_push($snapshots_rotateid, $attrs["ROTATEID"]); } } function snapshots_endelement($parser, $name) { } $snapshots_parser = xml_parser_create(); xml_set_element_handler($snapshots_parser, "snapshots_startelement", "snapshots_endelement"); $snapshots_fp = fopen("/opt/openfiler/etc/snapshots.xml", "r"); while ($snapshots_data = fread($snapshots_fp, 4096)) xml_parse($snapshots_parser, $snapshots_data, feof($snapshots_fp)); fclose($snapshots_fp); xml_parser_free($snapshots_parser); $piecolors[0] = "#a2e54b"; $piecolors[1] = "#ff5d35"; $piecolors[2] = "#ddddee"; $piecolors[3] = "#00ffff"; $piecolors[4] = "#00ff00"; $piecolors[5] = "#ff00ff"; $piecolors[6] = "#7f0000"; $piecolors[7] = "#7f007f"; $piecolors[8] = "#00007f"; $piecolors[9] = "#007f7f"; $piecolors[10] = "#007f00"; $piecolors[11] = "#827f00"; $piecolors[12] = "#000000"; $piecolors[13] = "#191919"; $piecolors[14] = "#333333"; $piecolors[15] = "#767676"; $fstabp = popen("/usr/bin/sudo /bin/cat /etc/fstab", "r"); $i = 0; while (!feof($fstabp)) { $j = 0; $fstabstr = trim(fgets($fstabp, 4096)); if (strlen($fstabstr) <= 0) continue; if (substr($fstabstr, 0, 1) == "#") continue; $foo = explode(" ", $fstabstr); foreach ($foo as $fresultitem) { $fresultitem = trim($fresultitem); if (strlen($fresultitem) > 0) { $fstab[$i][$j] = $fresultitem; $j++; } } $i++; } $fstabcount = $i; pclose($fstabp); $dfp = popen("/usr/bin/sudo /bin/df -P -h -l", "r"); $dfstr = trim(fgets($dfp, 4096)); // Skip table header $i = 0; while (!feof($dfp)) { $j = 0; $dfstr = trim(fgets($dfp, 4096)); if (strlen($dfstr) <= 0) continue; $foo = explode(" ", $dfstr); foreach ($foo as $fresultitem) { $fresultitem = trim($fresultitem); if (strlen($fresultitem) > 0) { $df[$i][$j] = $fresultitem; $j++; } } $i++; } $dfcount = $i; pclose($dfp); if (($action == "Delete") && (strlen(trim($volume)) > 0)) { $volume = strtolower($volume); for ($i = 0; $i < count($snapshots_id); $i++) { if (($snapshots_lvname[$i] == $volume) && ($snapshots_vgname[$i] == "openfiler")) { header("Location: ./volumes.html"); exit; } } $smb = (strstr(exec("/usr/bin/sudo /sbin/service smb status"), "running") ? 1 : 0); $nfsv3 = (strstr(exec("/usr/bin/sudo /sbin/service nfs status"), "running") ? 1 : 0); $atalk = (strstr(exec("/usr/bin/sudo /sbin/service atalk status"), "running") ? 1 : 0); if ($smb) exec("/usr/bin/sudo /sbin/service smb stop"); if ($nfsv3) exec("/usr/bin/sudo /sbin/service nfs stop"); if ($atalk) exec("/usr/bin/sudo /sbin/service atalk stop"); exec("/usr/bin/sudo /bin/umount -f /dev/openfiler/" . escapeshellarg($volume), $umount_output, $umount_result); if ($umount_result != 0) { apply_configuration(); header("Location: ./volumes.html"); exit; } exec("/usr/bin/sudo /sbin/lvm lvremove -f /dev/openfiler/" . escapeshellarg($volume)); $volumesp = popen("/usr/bin/sudo /usr/bin/tee /opt/openfiler/etc/volumes.xml", "w"); fputs($volumesp, "\n"); fputs($volumesp, "\n"); for ($i = 0; $i < count($volumes_id); $i++) if ($volumes_id[$i] != $volume) fputs($volumesp, "\t\n"); else exec("/usr/bin/sudo /bin/rmdir --ignore-fail-on-non-empty " . escapeshellarg($volumes_mountpoint[$i])); fputs($volumesp, "\n"); pclose($volumesp); $fstabp = popen("/usr/bin/sudo /usr/bin/tee /etc/fstab", "w"); for ($i = 0; $i < $fstabcount; $i++) { $str = ""; if ($fstab[$i][0] == "/dev/openfiler/" . $volume) continue; for ($j = 0; $j < count($fstab[$i]); $j++) { if ($j > 0) $str .= " "; $str .= $fstab[$i][$j]; } fputs($fstabp, ($str . "\n")); } pclose($fstabp); apply_configuration(); header("Location: ./volumes.html"); exit; } generic_header(array("title" => _("Administration Section"))); single_begin(array()); print("

" . _("Home") . " / " . _("Administration Section") . "

\n"); ?>

Welcome Administrator. The following are various system information and preferences, arranged into tabs. Please click on a tab to open up that category.

0) printf("
\n"); print("

Volumes in volume group \"" . htmlentities($vginfo[0]) . "\" (" . ($vginfo[11] / 1024) . " MB)

\n"); if (count($volumes_id) > 0) { print("
\n"); $keyvaluestring = ""; for ($j = 0; $j < count($volumes_id); $j++) { if ($volumes_vg[$j] != $vginfo[0]) continue; $lvname = "/dev/" . $vginfo[0] . "/" . $volumes_id[$j]; $lvp = popen("/usr/bin/sudo /sbin/lvm lvdisplay -c " . escapeshellarg($lvname), "r"); $i = 0; while (!feof($lvp)) $lvs[$i++] = fgets($lvp, 4096); pclose($lvp); $lvinfo = explode(":", trim($lvs[0], " ")); $size = $lvinfo[6] / 2; $keyvaluestring .= "&value" . $j . "=" . $size; } $snapshots_size = 0; for ($d = 0; $d < count($snapshots_id); $d++) { $snapshot_dev = "/dev/mapper/" . $snapshots_vgname[$d] . "-of.snapshot." . $snapshots_lvname[$d] . "." . $snapshots_id[$d]; $snapshot_symlink_dev = "/dev/" . $snapshots_vgname[$d] . "/of.snapshot." . $snapshots_lvname[$d] . "." . $snapshots_id[$d]; if (!file_exists($snapshot_dev)) continue; $lvp = popen("/usr/bin/sudo /sbin/lvm lvdisplay -c " . $snapshot_symlink_dev, "r"); $j = 0; while (!feof($lvp)) $lvs[$j++] = fgets($lvp, 4096); pclose($lvp); $snapshot_info = explode(":", trim($lvs[0], " ")); $snapshots_size += ($snapshot_info[6] / 2); } $keyvaluestring .= "&value" . count($volumes_id) . "=" . $snapshots_size; print("\n"); print("
\n"); print("
\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); $dcolor = 0; $usedsize = (($vginfo[14] * ($vginfo[12])) / 1024); $totalsize = ($vginfo[11] / 1024); $freesize = $totalsize - $usedsize; for ($j = 0; $j < count($volumes_id); $j++) { if ($volumes_vg[$j] != $vginfo[0]) continue; if ($dcolor == 0) { $dcolor = 1; $dvalue = $GLOBALS["color_table_row1"]; } else { $dcolor = 0; $dvalue = $GLOBALS["color_table_row2"]; } $lvname = "/dev/" . $vginfo[0] . "/" . $volumes_id[$j]; $lvp = popen("/usr/bin/sudo /sbin/lvm lvdisplay -c " . escapeshellarg($lvname), "r"); $i = 0; while (!feof($lvp)) $lvs[$i++] = fgets($lvp, 4096); pclose($lvp); $lvinfo = explode(":", trim($lvs[0], " ")); $size = $lvinfo[6] / (1024 * 2); $rand_id = md5($volumes_id[$j] . rand()); $fs_size = "Not available"; $fs_used = "Not available"; $fs_free = "Not available"; for ($d = 0; $d < count($df); $d++) { if ($df[$d][5] == ("/mnt/" . $vginfo[0] . "/" . $volumes_id[$j])) { $fs_size = $df[$d][1]; $fs_used = $df[$d][2]; $fs_free = $df[$d][3]; } } for ($d = 0; $d < count($snapshots_id); $d++) { $snapshots_exist = false; if (($snapshots_lvname[$d] == $volumes_id[$j]) && ($snapshots_vgname[$d] == "openfiler")) { $snapshots_exist = true; break; } } $fs = 0; $fsfound = false; for ($fsi = 0; $fsi < count($fs_info); $fsi++) { if ($fs_info[$fsi]["type"] == $volumes_fstype[$j]) { $fs = $fsi; $fsfound = true; break; } } if ($fsfound == false) $fs = 0; print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); for ($d = 0; $d < count($snapshots_id); $d++) { $snap_string = "Create"; if (($snapshots_lvname[$d] == $volumes_id[$j]) && ($snapshots_vgname[$d] == "openfiler")) { $snap_string = "Manage"; break; } } print("\n"); print("\n"); $colcount++; } print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("\n"); print("
LegendVolume nameVolume descriptionVolume sizeFile system typeFile system sizeFS used spaceFS free spaceDeletePropertiesSnapshots
" . htmlentities($volumes_id[$j]) . "" . htmlentities($volumes_name[$j]) . "" . $size . " MB" . $fs_info[$fs]["name"] . "" . $fs_size . "" . $fs_used . "" . $fs_free . ""); if ($snapshots_exist) { print("Snapshots exist\n"); } else { print("
\n"); print("

Are you sure you want to delete
volume slice \"" . htmlentities($volumes_id[$j]) . "\"?

\n"); print("

Yes / NO DON'T DELETE ]

\n"); print("
\n"); print("Delete\n"); } print("
Edit" . ($snapshots_exist ? "Manage" : "Create") . "
" . ($snapshots_size / 1024) . " MB allocated to snapshots
" . (($vginfo[15] * ($vginfo[12])) / 1024) . " MB of free space left
\n"); print("
\n"); } else { print("

No existing volumes were found.

\n"); } } nested_tab_end(); single_end(array()); generic_footer(array()); ?>