Exemplo n.º 1
0
function hd_partinfos_status(){
	$dev=$_GET["dev"];
	$users=new usersMenus();
	$tpl=new templates();
	if(!is_file('ressources/usb.scan.inc')){
		$sock=new sockets();
		$sock->getFrameWork("cmd.php?usb-scan-write=yes");
	}
	
	$sock=new sockets();
	$lvmdisks=unserialize(base64_decode($sock->getFrameWork('cmd.php?lvmdiskscan=yes')));

include_once 'ressources/usb.scan.inc';
$array=$_GLOBAL["disks_list"][$dev];

$usb=new usb();

	if(is_array($lvm_dev["$dev"])){
		
		$lvm_dev["$dev"]["PSize"]=intval($lvm_dev["$dev"]["PSize"]);
		$lvm_dev["$dev"]["PFree"]=intval($lvm_dev["$dev"]["PFree"]);
		$used=$lvm_dev["$dev"]["PSize"]-$lvm_dev["$dev"]["PFree"];
		if($lvm_dev["$dev"]["PSize"]-$lvm_dev["$dev"]["PFree"]>0){
			$lvmreste=$lvm_dev["$dev"]["PSize"]-$lvm_dev["$dev"]["PFree"];
			
			$pourcent=round($lvmreste/$lvm_dev["$dev"]["PSize"],1)*100;
		}else{
			$pourcent=0;
		}
		$array["PARTITIONS"]=array("$dev"=>array(
					"TYPE"=>"LVM",
					"MOUNTED"=>"",
					"ID_FS_LABEL"=>"",
					"ID_FS_TYPE"=>"lvm2",
					"free_size"=>"{$lvm_dev["$dev"]["PSize"]};$used;{$lvm_dev["$dev"]["PFree"]};$pourcent",
					"SIZE"=>"{$lvm_dev["$dev"]["PSize"]} GB"));
		
	}
	
		$ID_MODEL=$array["ID_MODEL_1"];
		if($ID_MODEL==null){$ID_MODEL=$array["ID_MODEL_2"];}
		$SIZE=$array["SIZE"];
		$ID_BUS=$array["ID_BUS"];
		$ID_FS_LABEL=$array["ID_FS_LABEL"];
		$ID_VENDOR=$array["ID_VENDOR"];	
		
		$mounted=$_GLOBAL["disks_list"][$dev]["PARTITIONS"]["{$dev}1"]["MOUNTED"];	
		
//$img=hd_partinfos_graphic($dev);
$array=hd_partitions_scan($array["PARTITIONS"]);
// 119=0% et 0=100%
if(is_array($array)){
	$partitions="<table style='width:100%'>
		<tr>
		<th width=1%>&nbsp;</th>
		<th><strong style='font-size:12px'>{partition}</th>
		<th><strong style='font-size:12px' valign='middle'>&nbsp;</th>
		<th><strong style='font-size:12px' width=1% nowrap>{used}</th>
		<th><strong style='font-size:12px' width=1% nowrap>{size}</th>
		<th width=1% nowrap><strong style='font-size:12px' >{mounted}</th>
		<th><strong style='font-size:12px' width=1% nowrap>{type}</th>
		</tr>";
	
	while (list ($num, $line) = each ($array)){
		if($num==null){continue;}
		$label=null;
		$perc=pourcentage($line["POURC"]);
		
		$MOUNTED=$line["MOUNTED"];
		if($line["USED"]==null){$line["USED"]=0;}
		if($line["SIZE"]==null){$line["SIZE"]=0;}
		if($line["TYPE"]==5){
			$perc="-";
		}
		if($line["TYPE"]==82){
			$perc="-";
		}	
		
		$js="Loadjs('system.internal.partition.php?dev=$num');";
		
		$mounted_align="left";	
		
		$icon="<img src='img/partition-settings-48-grey.png'>";
		
		if($users->LVM_INSTALLED){
		
				if($lvmdisks[$num]<>null){
					$line["SIZE"]=$lvmdisks[$num];
					//$MOUNTED=imgtootltip("35/format-lvm.png","{APP_LVM}","PartInfos('$num')");
					$icon=imgtootltip("partition-settings-lvm-48.png","{partition_infos}","$js");
					$mounted_align="center";
				}else{
					if($line["TYPE"]=="8e"){
						//$MOUNTED=imgtootltip("35/format-lvm.png","{APP_LVM}","PartInfos('$num')");
						$icon=imgtootltip("48-hd.png","{partition_infos}","$js");
						$mounted_align="center";
					}
				}
				
				if(is_numeric($line["TYPE"])){
					//$MOUNTED=imgtootltip("35/format-lvm.png","{APP_LVM}","PartInfos('$num')");
					$icon=imgtootltip("partition-settings-48.png","{partition_infos}","$js");
					$mounted_align="center";
					
				}
				
				if($line["TYPE"]==5){
					$icon="<img src='img/partition-settings-48-grey.png'>";
					$MOUNTED="&nbsp;";
				}
		
		}
		
		
		if($line["CHANGE_LABEL"]){
			if($line["ID_FS_LABEL"]==null){$line["ID_FS_LABEL"]="{unknown}";}
			$label=texttooltip("{label}:{$line["ID_FS_LABEL"]}","{edit}: {label}",$line["CHANGE_LABEL_JS"]);
		}
		
		$partitions=$partitions . "
		
		<tr>
		<td width=1%>$icon</td>
		<td><strong style='font-size:12px'>". basename($num)."&nbsp;$label</td>
		<td valign='middle'><strong style='font-size:12px' >$perc</td>
		<td width=1%  nowrap align='right'><strong style='font-size:12px' >{$line["USED"]}</td>
		<td width=1% nowrap align='right'><strong style='font-size:12px' >{$line["SIZE"]}</td>
		<td width=1% nowrap align='$mounted_align'><strong style='font-size:12px' >$MOUNTED</td>
		<td width=1% nowrap><strong style='font-size:12px' >{$usb->getPartypename($line["TYPE"])} ({$line["TYPE"]})</td>
		</tr>
		<tr>
			<td colspan=7><hr></td>
		</tr>
		
		";
		
	}
	$partitions=$partitions."</table>";
	
}

if($SIZE==null){
	$sock=new sockets();
	$fdisk=unserialize(base64_decode($sock->getFrameWork("cmd.php?fdiskl=yes")));
	$SIZE=$fdisk["$dev"];
}

if($ID_BUS==NULL){$ID_BUS=0;}
if($ID_MODEL==NULL){$ID_MODEL="unknown";}
$page=CurrentPageName();
if($ID_FS_LABEL==null){$ID_FS_LABEL=$dev;}

$title="
<div style='font-size:16px;font-weight:bold'>{partitions}:$ID_FS_LABEL ($SIZE) <i style='font-size:12px'>{model}:$ID_BUS:: $ID_MODEL ($ID_VENDOR)</i></div>
<div id='partitions'>$partitions</div>
";
$html="$title";
echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 2
0
function hd_partinfos_status()
{
    $dev = $_GET["dev"];
    $users = new usersMenus();
    $tpl = new templates();
    if (!is_file('ressources/usb.scan.inc')) {
        $sock = new sockets();
        $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    }
    $sock = new sockets();
    $lvmdisks = unserialize(base64_decode($sock->getFrameWork('cmd.php?lvmdiskscan=yes')));
    include_once 'ressources/usb.scan.inc';
    $array = $_GLOBAL["disks_list"][$dev];
    $usb = new usb();
    if (is_array($lvm_dev["{$dev}"])) {
        $lvm_dev["{$dev}"]["PSize"] = intval($lvm_dev["{$dev}"]["PSize"]);
        $lvm_dev["{$dev}"]["PFree"] = intval($lvm_dev["{$dev}"]["PFree"]);
        $used = $lvm_dev["{$dev}"]["PSize"] - $lvm_dev["{$dev}"]["PFree"];
        if ($lvm_dev["{$dev}"]["PSize"] - $lvm_dev["{$dev}"]["PFree"] > 0) {
            $lvmreste = $lvm_dev["{$dev}"]["PSize"] - $lvm_dev["{$dev}"]["PFree"];
            $pourcent = round($lvmreste / $lvm_dev["{$dev}"]["PSize"], 1) * 100;
        } else {
            $pourcent = 0;
        }
        $array["PARTITIONS"] = array("{$dev}" => array("TYPE" => "LVM", "MOUNTED" => "", "ID_FS_LABEL" => "", "ID_FS_TYPE" => "lvm2", "free_size" => "{$lvm_dev["{$dev}"]["PSize"]};{$used};{$lvm_dev["{$dev}"]["PFree"]};{$pourcent}", "SIZE" => "{$lvm_dev["{$dev}"]["PSize"]} GB"));
    }
    $ID_MODEL = $array["ID_MODEL_1"];
    if ($ID_MODEL == null) {
        $ID_MODEL = $array["ID_MODEL_2"];
    }
    $SIZE = $array["SIZE"];
    $ID_BUS = $array["ID_BUS"];
    $ID_FS_LABEL = $array["ID_FS_LABEL"];
    $ID_VENDOR = $array["ID_VENDOR"];
    $mounted = $_GLOBAL["disks_list"][$dev]["PARTITIONS"]["{$dev}1"]["MOUNTED"];
    //$img=hd_partinfos_graphic($dev);
    $array = hd_partitions_scan($array["PARTITIONS"]);
    // 119=0% et 0=100%
    if (is_array($array)) {
        $partitions = "<table style='width:100%'>\n\t\t<tr>\n\t\t<th width=1%>&nbsp;</th>\n\t\t<th><strong style='font-size:12px'>{partition}</th>\n\t\t<th><strong style='font-size:12px' valign='middle'>&nbsp;</th>\n\t\t\n\t\t</tr>";
        while (list($num, $line) = each($array)) {
            if ($num == null) {
                continue;
            }
            $label = null;
            $perc = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td style='font-size:12px'>" . pourcentage($line["POURC"]) . "\n\t\t\t<div style='font-size:12px;font-weight:bold;text-transform:capitalize'>{used}: {$line["USED"]}/{$line["SIZE"]}</div>\t\t\n\t\t\t\t\t\n\t\t\t</td>\n\t\t\t\n\t\t</tr>\n\t\t\n\t\t</table>\n\t\t";
            $arrayPART = unserialize(base64_decode($sock->getFrameWork("system.php?tune2fs-values=" . base64_encode($num))));
            $INODES = "\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td style='font-size:12px'>" . pourcentage($arrayPART["INODES_POURC"]) . "\n\t\t\t<div style='font-size:12px;font-weight:bold;text-transform:capitalize'>{used}:<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('system.internal.partition.inodes.php?dev={$num}');\" style='text-decoration:underline;font-weight:bold'>{$arrayPART["INODES_USED"]}/{$arrayPART["INODES_MAX"]}&nbsp;{files}</a></div>\t\t\n\t\t\t\n\t\t</tr>\n\n\t\t</table>\n\t\t";
            $MOUNTED = $line["MOUNTED"];
            if ($line["USED"] == null) {
                $line["USED"] = 0;
            }
            if ($line["SIZE"] == null) {
                $line["SIZE"] = 0;
            }
            if ($line["TYPE"] == 5) {
                $perc = "-";
            }
            if ($line["TYPE"] == 82) {
                $perc = "-";
            }
            $js = "Loadjs('system.internal.partition.php?dev={$num}');";
            $mounted_align = "left";
            $icon = "<img src='img/partition-settings-48-grey.png'>";
            if ($users->LVM_INSTALLED) {
                if ($lvmdisks[$num] != null) {
                    $line["SIZE"] = $lvmdisks[$num];
                    //$MOUNTED=imgtootltip("35/format-lvm.png","{APP_LVM}","PartInfos('$num')");
                    $icon = imgtootltip("partition-settings-lvm-48.png", "{partition_infos}", "{$js}");
                    $mounted_align = "center";
                } else {
                    if ($line["TYPE"] == "8e") {
                        //$MOUNTED=imgtootltip("35/format-lvm.png","{APP_LVM}","PartInfos('$num')");
                        $icon = imgtootltip("48-hd.png", "{partition_infos}", "{$js}");
                        $mounted_align = "center";
                    }
                }
                if (is_numeric($line["TYPE"])) {
                    //$MOUNTED=imgtootltip("35/format-lvm.png","{APP_LVM}","PartInfos('$num')");
                    $icon = imgtootltip("partition-settings-48.png", "{partition_infos}", "{$js}");
                    $mounted_align = "center";
                }
                if ($line["TYPE"] == 5) {
                    $icon = "<img src='img/partition-settings-48-grey.png'>";
                    $MOUNTED = "&nbsp;";
                }
            }
            if ($line["CHANGE_LABEL"]) {
                if ($line["ID_FS_LABEL"] == null) {
                    $line["ID_FS_LABEL"] = "{unknown}";
                }
                $label = texttooltip("{label}:{$line["ID_FS_LABEL"]}", "{apply}: {label}", $line["CHANGE_LABEL_JS"]);
            }
            $partitions = $partitions . "\n\t\t\n\t\t<tr>\n\t\t<td width=1%>{$icon}</td>\n\t\t<td><strong style='font-size:12px'>" . basename($num) . "&nbsp;{$label}</td>\n\t\t<td valign='middle'><strong style='font-size:14px' >{mounted}: &laquo;{$MOUNTED}&raquo;\n\t\t<div style='text-align:right;float:right'>\n\t\t\t<i style='font-size:11px'>{$usb->getPartypename($line["TYPE"])} ({$line["TYPE"]})</i></div>\n\t\n\t\t\t\t{$perc}\n\t\t\t\t{$INODES}\n\t\t</strong></td>\n\t\t\n\t\t\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=7><hr></td>\n\t\t</tr>\n\t\t\n\t\t";
        }
        $partitions = $partitions . "</table>";
    }
    if ($SIZE == null) {
        $sock = new sockets();
        $fdisk = unserialize(base64_decode($sock->getFrameWork("cmd.php?fdiskl=yes")));
        $SIZE = $fdisk["{$dev}"];
    }
    if ($ID_BUS == NULL) {
        $ID_BUS = 0;
    }
    if ($ID_MODEL == NULL) {
        $ID_MODEL = "unknown";
    }
    $page = CurrentPageName();
    if ($ID_FS_LABEL == null) {
        $ID_FS_LABEL = $dev;
    }
    $title = "\n<div style='float:right;margin-bottom:15px'>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshTab('partinfosdiv')") . "</div><div style='font-size:16px;font-weight:bold'>{partitions}:{$ID_FS_LABEL} ({$SIZE}) <i style='font-size:12px'>{model}:{$ID_BUS}:: {$ID_MODEL} ({$ID_VENDOR})</i></div>\n\n<div id='partitions'>{$partitions}</div>\n";
    $html = "{$title}";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 3
0
function hd_partinfos_status()
{
    $dev = $_GET["dev"];
    $users = new usersMenus();
    $tpl = new templates();
    if (!is_file('ressources/usb.scan.inc')) {
        $sock = new sockets();
        $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    }
    $sock = new sockets();
    $lvmdisks = unserialize(base64_decode($sock->getFrameWork('cmd.php?lvmdiskscan=yes')));
    include_once 'ressources/usb.scan.inc';
    $array = $_GLOBAL["disks_list"][$dev];
    $usb = new usb();
    if (is_array($lvm_dev["{$dev}"])) {
        $lvm_dev["{$dev}"]["PSize"] = intval($lvm_dev["{$dev}"]["PSize"]);
        $lvm_dev["{$dev}"]["PFree"] = intval($lvm_dev["{$dev}"]["PFree"]);
        $used = $lvm_dev["{$dev}"]["PSize"] - $lvm_dev["{$dev}"]["PFree"];
        if ($lvm_dev["{$dev}"]["PSize"] - $lvm_dev["{$dev}"]["PFree"] > 0) {
            $lvmreste = $lvm_dev["{$dev}"]["PSize"] - $lvm_dev["{$dev}"]["PFree"];
            $pourcent = round($lvmreste / $lvm_dev["{$dev}"]["PSize"], 1) * 100;
        } else {
            $pourcent = 0;
        }
        $array["PARTITIONS"] = array("{$dev}" => array("TYPE" => "LVM", "MOUNTED" => "", "ID_FS_LABEL" => "", "ID_FS_TYPE" => "lvm2", "free_size" => "{$lvm_dev["{$dev}"]["PSize"]};{$used};{$lvm_dev["{$dev}"]["PFree"]};{$pourcent}", "SIZE" => "{$lvm_dev["{$dev}"]["PSize"]} GB"));
    }
    $ID_MODEL = $array["ID_MODEL_1"];
    if ($ID_MODEL == null) {
        $ID_MODEL = $array["ID_MODEL_2"];
    }
    $SIZE = $array["SIZE"];
    $ID_BUS = $array["ID_BUS"];
    $ID_FS_LABEL = $array["ID_FS_LABEL"];
    $ID_VENDOR = $array["ID_VENDOR"];
    $mounted = $_GLOBAL["disks_list"][$dev]["PARTITIONS"]["{$dev}1"]["MOUNTED"];
    //$img=hd_partinfos_graphic($dev);
    $array = hd_partitions_scan($array["PARTITIONS"]);
    // 119=0% et 0=100%
    if (is_array($array)) {
        $partitions = "<table style='width:100%'>\n\t\t<tr>\n\t\t<th width=1%>&nbsp;</th>\n\t\t<th><strong style='font-size:12px'>{disk}</th>\n\t\t<th><strong style='font-size:12px' valign='middle'>&nbsp;</th>\n\t\t<th><strong style='font-size:12px' width=1% nowrap>{used}</th>\n\t\t<th><strong style='font-size:12px' width=1% nowrap>{size}</th>\n\t\t<th width=1% nowrap><strong style='font-size:12px' >{mounted}</th>\n\t\t<th><strong style='font-size:12px' width=1% nowrap>{type}</th>\n\t\t</tr>";
        while (list($num, $line) = each($array)) {
            if ($num == null) {
                continue;
            }
            $label = null;
            $perc = pourcentage($line["POURC"]);
            $MOUNTED = $line["MOUNTED"];
            if ($line["USED"] == null) {
                $line["USED"] = 0;
            }
            if ($line["SIZE"] == null) {
                $line["SIZE"] = 0;
            }
            if ($line["TYPE"] == 5) {
                $perc = "-";
            }
            if ($line["TYPE"] == 82) {
                $perc = "-";
            }
            $mounted_align = "left";
            $icon = "<img src='img/48-hd.png'>";
            if ($users->LVM_INSTALLED) {
                if ($lvmdisks[$num] != null) {
                    $line["SIZE"] = $lvmdisks[$num];
                    $MOUNTED = imgtootltip("35/format-lvm.png", "{APP_LVM}", "PartInfos('{$num}')");
                    $icon = imgtootltip("48-hd.png", "{partition_infos}", "PartInfos('{$num}')");
                    $mounted_align = "center";
                } else {
                    if ($line["TYPE"] == "8e") {
                        $MOUNTED = imgtootltip("35/format-lvm.png", "{APP_LVM}", "PartInfos('{$num}')");
                        $icon = imgtootltip("48-hd.png", "{partition_infos}", "PartInfos('{$num}')");
                        $mounted_align = "center";
                    }
                }
                if ($MOUNTED == null && $line["TYPE"] == 83 && $line["USED"] == 0) {
                    $MOUNTED = imgtootltip("35/format-lvm.png", "{APP_LVM}", "PartInfos('{$num}')");
                    $icon = imgtootltip("48-hd.png", "{partition_infos}", "PartInfos('{$num}')");
                    $mounted_align = "center";
                }
                if ($line["TYPE"] == 5) {
                    $icon = "<img src='img/48-hd.png'>";
                    $MOUNTED = "&nbsp;";
                }
            }
            if ($line["CHANGE_LABEL"]) {
                if ($line["ID_FS_LABEL"] == null) {
                    $line["ID_FS_LABEL"] = "{unknown}";
                }
                $label = texttooltip("{label}:{$line["ID_FS_LABEL"]}", "{edit}: {label}", $line["CHANGE_LABEL_JS"]);
            }
            $partitions = $partitions . "\n\t\t\n\t\t<tr>\n\t\t<td width=1%>{$icon}</td>\n\t\t<td><strong style='font-size:12px'>" . basename($num) . "&nbsp;{$label}</td>\n\t\t<td valign='middle'><strong style='font-size:12px' >{$perc}</td>\n\t\t<td width=1%  nowrap align='right'><strong style='font-size:12px' >{$line["USED"]}</td>\n\t\t<td width=1% nowrap align='right'><strong style='font-size:12px' >{$line["SIZE"]}</td>\n\t\t<td width=1% nowrap align='{$mounted_align}'><strong style='font-size:12px' >{$MOUNTED}</td>\n\t\t<td width=1% nowrap><strong style='font-size:12px' >{$usb->getPartypename($line["TYPE"])} ({$line["TYPE"]})</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=7><hr></td>\n\t\t</tr>\n\t\t\n\t\t";
        }
        $partitions = $partitions . "</table>";
    }
    if ($SIZE == null) {
        $sock = new sockets();
        $fdisk = unserialize(base64_decode($sock->getFrameWork("cmd.php?fdiskl=yes")));
        $SIZE = $fdisk["{$dev}"];
    }
    if ($ID_BUS == NULL) {
        $ID_BUS = 0;
    }
    if ($ID_MODEL == NULL) {
        $ID_MODEL = "unknown";
    }
    $page = CurrentPageName();
    if ($ID_FS_LABEL == null) {
        $ID_FS_LABEL = $dev;
    }
    $title = "<H1>{partitions}:{$ID_FS_LABEL} ({$SIZE})</H1>\n<div style='text-align:right;margin-top:-10px'><strong style='font-size:14px'>{model}:{$ID_BUS}:: {$ID_MODEL} ({$ID_VENDOR})</strong></div>\n<table style='width:100%'>\n<tr>\n\t<td valign='top'>\n\t\t\t<div id='toolbar-disks'></div>\n\t\t</td>\n</tr>\n\t<tr>\n\t\t<td valign='top'>\n\t\t\t<div id='partitions'>\n\t\t\t{$partitions}\n\t\t\t</div>\n\t\t</td>\n\t\t\n\t</tr>\n</table>\n<script>\n\tLoadAjax('toolbar-disks','{$page}?disk-toolbar-for={$dev}');\n</script>\n";
    $html = "{$title}";
    echo $tpl->_ENGINE_parse_body($html);
}