Ejemplo n.º 1
0
function partitions_scan($array)
{
    if (!is_array($array)) {
        return null;
    }
    include_once "ressources/class.os.system.tools.inc";
    $os = new os_system();
    $users = new usersMenus();
    $sock = new sockets();
    $disk_type_array = $os->disk_type_array();
    if (!is_file('ressources/usb.scan.inc')) {
        $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    }
    include 'ressources/usb.scan.inc';
    while (list($num, $line) = each($array)) {
        $dev_path = $num;
        $TYPE = $disk_type_array[$line["TYPE"]];
        $MOUNTED = $line["MOUNTED"];
        $ID_FS_TYPE = $line["ID_FS_TYPE"];
        $TOTSIZE = $line["SIZE"];
        $free_size = explode(";", $line["free_size"]);
        $bigsize = $free_size[0];
        $used = $free_size[1];
        $free = $free_size[2];
        $pourcent = $free_size[3];
        $ID_FS_LABEL = $line["ID_FS_LABEL"];
        $PART_ARRAY = array();
        $text = "{$used}/{$bigsize} {$pourcent}% {used}";
        if (trim($pourcent) == null) {
            $pourcent = "0%";
            $text = null;
        }
        $first_div_size = $bigsize;
        $PART_ARRAY["{$dev_path}"]["TEXT_SIZE"] = $text;
        $PART_ARRAY["{$dev_path}"]["POURC"] = $pourcent;
        if ($line["TYPE"] != 5 and $line["TYPE"] != 82) {
            $PART_ARRAY["{$dev_path}"]["CHANGE_LABEL"] = true;
            $PART_ARRAY["{$dev_path}"]["CHANGE_LABEL_JS"] = "ChangeLabel('{$dev_path}')";
            $PART_ARRAY["{$dev_path}"]["SIZE"] = $TOTSIZE;
            if ($users->LVM_INSTALLED) {
                $PART_ARRAY["{$dev_path}"]["PVCREATE"] = true;
                $PART_ARRAY["{$dev_path}"]["PVCREATE_JS"] = "pvcreate_dev('{$dev_path}')";
                $partitions_options = "<table style='width:100%'><tr>";
                $init = "\n\t\t\t<tr>\n\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t<td " . CellRollOver("pvcreate_dev('{$dev_path}')") . ">{pvcreate_dev}</td>\n\t\t\t</tr>";
                if (is_array($lvm_dev[$dev_path])) {
                    $init = null;
                    if ($lvm_dev["{$dev_path}"]["GROUP"] == null) {
                        $create_group = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t\t\t<td " . CellRollOver("vgcreate_dev('{$dev_path}')") . ">{vgcreate_dev}</td>\n\t\t\t\t\t</tr>";
                    } else {
                        $create_group = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><hr><span style='font-size:14px'>{APP_LVM}</td></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr><td colspan=2>&nbsp;</td></tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/mailbox_hd.png'></td>\n\t\t\t\t\t<td " . CellRollOver("vg_refresh_list('{$lvm_dev["{$dev_path}"]["GROUP"]}')") . " style='font-size:13px'>{vgmanage}:{$lvm_dev["{$dev_path}"]["GROUP"]}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=2><div id='LIST_{$lvm_dev["{$dev_path}"]["GROUP"]}'>" . lv_groups_list($lvm_dev["{$dev_path}"]["GROUP"]) . "</div></td>\n\t\t\t\t\t</tr>";
                    }
                }
                $partitions_options = $partitions_options . $init . $create_group;
                $partitions_options = $partitions_options . "</table>";
            }
            $pourcent_pix = $pourcent * 3;
            $html = $html . "\n\t<table style='width:99%' class=form>\n\t\t<td valign='top'>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t<strong style='font-size:16px'>{$ID_FS_LABEL} {$MOUNTED}</strong><br>\n\t\t\t\t\t\t<span style='font-size:15px;font-weight:bold'>{$TYPE} - {$line["TYPE"]} ({$TOTSIZE})&nbsp;&laquo;&nbsp;{$dev_path}&nbsp;&raquo;</span>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<div style='width:300px;border:1px solid #CCCCCC;height:30px;background-color:#00E100'>\n\t\t\t\t\t\t\t\t<div style='float:right;color:white;padding:5px;font-size:13px;font-weight:bold'>{$text}</div>\n\t\t\t\t\t\t\t\t<div style='width:{$pourcent_pix};background-color:#D20B2A;height:30px'>&nbsp;</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t{$partitions_options}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t\t<td valign='top'>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t\t{$option_label}\n\t\t\t\t\t{$option_macro_create}\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n\t\n\t";
        }
        return $html;
    }
}