_("Your account"))); dual_begin(array()); 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; } $mdp = popen("/usr/bin/sudo /sbin/mdadm --examine --brief --scan --config=partitions", "r"); $i = 0; while (!feof($mdp)) { $mdstr = trim(fgets($mdp, 4096)); $mdresult[$i++] = $mdstr; } pclose($mdp); $i = 0; $md_devices = array(); while ($i < count($mdresult)) { if (substr($mdresult[$i], 0, 6) == "ARRAY ") { $mdarray = explode(" ", $mdresult[$i]); $mdlevel = -1; switch($mdarray[2]) { case "level=raid0": $mdlevel = 0; break; case "level=raid1": $mdlevel = 1; break; case "level=raid5": $mdlevel = 5; break; default: $mdlevel = -1; break; } array_push($md_devices, array("device" => $mdarray[1], "level" => $mdlevel)); } $i++; } $disksp = popen("/usr/bin/sudo /opt/openfiler/sbin/list-disks.pl", "r"); $i = 0; while (!feof($disksp)) { $dstr = trim(fgets($disksp, 4096)); // $dresult[$i++] = substr($dstr, 0, strlen($dstr) - 1); $dresult[$i++] = $dstr; } pclose($disksp); $of_disks = array(); if ($dresult[0] == "OPENFILER") { $i = 1; while ($i < count($dresult)) { if ($dresult[$i] == "DISK") { $p = $i; $i = $i + 8; $parts = array(); while (($dresult[$i] == "PARTITION") && ($i < count($dresult))) { array_push($parts, array("device" => $dresult[$i + 1], "type" => $dresult[$i + 2], "number" => $dresult[$i + 3], "start" => $dresult[$i + 4], "end" => $dresult[$i + 5], "blocks" => $dresult[$i + 6], "extended" => $dresult[$i + 7])); $i = $i + 8; } array_push($of_disks, array("device" => $dresult[$p + 1], "type" => $dresult[$p + 2], "description" => $dresult[$p + 3], "blocksize" => ($dresult[$p + 4] * 2), "cylinders" => $dresult[$p + 5], "heads" => $dresult[$p + 6], "sectors" => $dresult[$p + 7], "partitions" => $parts)); } else break; } } generic_header(array("title" => _("Administration Section"))); single_begin(array()); print("Welcome Administrator. The following are various system information and preferences, arranged into tabs. Please click on a tab to open up that category.
Physical Storage Management\n"); for ($i = 0; $i < count($of_disks); $i++) { $rand_id = sha1($of_disks[$i]["device"]); $dcolor = 0; print("Device | \n"); print("\tType | \n"); print("\tNumber | \n"); print("\tSize | \n"); print("\tUsed In | \n"); print("
" . $of_disks[$i]["partitions"][$j]["device"] . " | \n"); print("\t" . $ptype_str . " | \n"); print("\t" . $of_disks[$i]["partitions"][$j]["number"] . " | \n"); print("\t" . $part_size_string . " | \n"); print("\tTBD | \n"); print("
\n"); print("
Edit Disk | \n"); print("\tType | \n"); print("\tDescription | \n"); print("\tSize | \n"); print("\tPartitions | \n"); print("
" . $of_disks[$i]["device"] . " | \n"); print("\t" . strtoupper($of_disks[$i]["type"]) . " | \n"); print("\t" . $of_disks[$i]["description"] . " | \n"); $disk_size = ($of_disks[$i]["blocksize"] * $of_disks[$i]["cylinders"] * $of_disks[$i]["heads"] * $of_disks[$i]["sectors"]); if ($disk_size > (1024 * 1024 * 1024)) $disk_size_string = sprintf("%.02f GB", ($disk_size / (1024 * 1024 * 1024.0))); else if ($disk_size > (1024 * 1024)) $disk_size_string = sprintf("%.02f MB", ($disk_size / (1024 * 1024.0))); else if ($disk_size > (1024)) $disk_size_string = sprintf("%.02f KB", ($disk_size / (1024.0))); else $disk_size_string = $disk_size . " bytes"; print("\t" . $disk_size_string . " | \n"); print("\t" . count($of_disks[$i]["partitions"]) . " (view) | \n"); print("
\n"); nested_tab_end(); single_end(array()); generic_footer(array()); ?>