_("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(); function volumes_startelement($parser, $name, $attrs) { global $volumes_id, $volumes_name, $volumes_mountpoint, $volumes_vg; 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"]); } } 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); $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); if (($HTTP_POST_VARS["action"] == "Delete") && (strlen(trim($volume)) > 0)) { $volume = strtolower($volume); $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 /dev/openfiler/" . $volume); exec("/usr/bin/sudo /sbin/lvremove -f /dev/openfiler/" . $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 " . $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; } else if ($HTTP_POST_VARS["action"] == "Edit") { header("Location: ./volumes_edit.html?volume=" . $volume); 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("

Block storage statistics for VG \"" . $vginfo[0] . "\"

\n"); print("
\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\n"); print("\n"); print("\t\n"); print("\t\n"); print("\n"); print("
Total Space" . $vginfo[11] . " bytes (" . ($vginfo[11] / 1024) . " MB)
Used Space" . ($vginfo[14] * ($vginfo[12] / 2)) . " bytes (" . (($vginfo[14] * ($vginfo[12] / 2)) / 1024) . " MB)
Free Space" . ($vginfo[15] * ($vginfo[12] / 2)) . " bytes (" . (($vginfo[15] * ($vginfo[12] / 2)) / 1024) . " MB)
\n"); print("
\n"); print("

 

\n"); print("

Volumes in \"" . $vginfo[0] . "\" VG

\n"); if (count($volumes_id) > 0) { print("
\n"); print("\n"); print("\n"); $colcount = 0; $usedsize = (($vginfo[14] * ($vginfo[12] / 2)) / 1024); $totalsize = ($vginfo[11] / 1024); $freesize = $totalsize - $usedsize; for ($j = 0; $j < count($volumes_id); $j++) { if ($volumes_vg[$j] != $vginfo[0]) continue; if ($colcount > 1) { $colcount = 0; print("\n"); print("\n"); } $lvname = "/dev/" . $vginfo[0] . "/" . $volumes_id[$j]; $lvp = popen("/usr/bin/sudo /sbin/lvdisplay -c " . $lvname, "r"); $i = 0; while (!feof($lvp)) $lvs[$i++] = fgets($lvp, 4096); pclose($lvp); $lvinfo = explode(":", trim($lvs[0], " ")); $size = $lvinfo[6] / (2.0 * 1024); $othervolumessize = $usedsize - $size; print("\t\n"); $colcount++; } print("\n"); print("
\n"); print("

" . $volumes_id[$j] . " (" . $size . " MB / " . $totalsize . " MB)

\n"); print("

\n"); print("
\n"); print("\n"); print("

\n"); print("   \n"); print("

\n"); print("
\n"); print("\t
\n"); print("
\n"); } else { print("

No existing volumes were found.

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