Exemple #1
0
function infos()
{
    $dev = $_GET["dev"];
    $master_dev = substr($dev, 0, strlen($dev) - 1);
    $users = new usersMenus();
    $tpl = new templates();
    $sock = new sockets();
    if (!is_file('ressources/usb.scan.inc')) {
        $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    }
    include_once 'ressources/usb.scan.inc';
    if (!isset($_GLOBAL["disks_list"][$master_dev])) {
        echo $tpl->_ENGINE_parse_body("<center><H2>{UNABLE_TO_OBTAIN_INFORMATIONS_FROM}:{$dev}</H2></center>");
    }
    $partArray = $_GLOBAL["disks_list"][$master_dev]["PARTITIONS"][$dev];
    $usb = new usb();
    $devser = urlencode($dev);
    $array = unserialize(base64_decode($_GET["dev-infos"]));
    while (list($num, $ligne) = each($array)) {
        $length = strlen($ligne);
        if ($length > 36) {
            $ligne = substr($ligne, 0, 33) . "...";
        }
        $tr = $tr . "\n\t\t<tr>\n\t\t\t<td class=legend>{{$num}}:</td>\n\t\t\t<td style='font-size:12px;font-weight:bold'>{$ligne}</td>\n\t\t</tr>\t\n\t\t";
    }
    $html = "\n\t<div style='font-size:16px;font-weight:bold;'>{$dev} ({$partArray["ID_FS_LABEL"]})</div>\n\t<div><i style='font-size:12px;font-weight:bold;margin-bottom:10px'>{mounted}:&nbsp;{$partArray["MOUNTED"]} {$partArray["ID_FS_TYPE"]}</i></div>\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=1%><img src='img/partition-infos-128.png'></td>\n\t\t<td valign='top' width=99%>\n\t\t\t<table style='width:100%' class=form>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{type}:</td>\n\t\t\t\t<td style='font-size:12px;font-weight:bold'>{$usb->getPartypename($partArray["TYPE"])} ({$partArray["TYPE"]})</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend>{size}:</td>\n\t\t\t\t<td style='font-size:12px;font-weight:bold'>{$partArray["SIZE"]}</td>\n\t\t\t</tr>\t\t\t\n\t\t\t{$tr}\n\t</table>\n\t</td>\n\t</tr>\n\t</table>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function dev($return = 0)
{
    $dev = $_GET["dev"];
    if ($dev == null) {
        return;
    }
    $sock = new sockets();
    $sys = new usb();
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?parted-print={$dev}")));
    $mapper = $sock->getFrameWork("cmd.php?lvs-mapper={$dev}");
    $mount_point = $sys->isMounted($mapper);
    if ($mount_point != null) {
        $img = $sock->getFrameWork("cmd.php?philesize-img-path={$mount_point}");
        if ($img != null) {
            $img = "<img src='{$img}' WIDTH=450 HEIGHT=450>";
        }
    }
    $delete_vg = Paragraphe("gd-delete-64.png", '{UNLINK_VOLUME}', '{UNLINK_VOLUME_TEXT}', "javascript:HD_OU_DELETE('{$dev}');");
    $html = "\n\t<H3>" . basename($dev) . "</H3>\n\t<table class=table_form>";
    while (list($num, $ligne) = each($datas)) {
        $ligne = str_replace($mapper, "", $ligne);
        if (preg_match("#(.+?):(.+)#", $ligne, $re)) {
            $html = $html . "<tr><td class=legend nowrap>{$re[1]}:</td><td><strong>{$re[2]}</strong></td></tr>";
        }
    }
    if ($mount_point) {
        $browse = Paragraphe("64-share.png", "{browse}", "{browse_disk_text}", "javascript:Loadjs('SambaBrowse.php?jdisk={$mapper}&mounted={$mount_point}&t=&homeDirectory=&no-shares=yes&field=&protocol=');");
        $html = $html . "<tr><td class=legend nowrap>{mounted}:</td><td><strong>{yes}</strong></td></tr>";
    } else {
        $html = $html . "<tr><td class=legend nowrap>{mounted}:</td><td><strong>{No}</strong></td></tr>";
    }
    $html = $html . "<tr><td class=legend nowrap>mapper:</td><td><strong>{$mapper}</strong></td></tr>";
    $html = $html . "</table>";
    $page = "<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>\n\t\t\t{$html}\n\t\t\t<hr>\n\t\t\t<div style='background-color:white'>\n\t\t\t{$img}\n\t\t\t</div>\n\t\t</td>\n\t\t<td valign='top'>\n\t\t\t<table style='width:100%'>\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td>{$browse}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>{$delete_vg}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\n\t</table>\n\t\n\t";
    $tpl = new templates();
    if ($return == 1) {
        return $tpl->_ENGINE_parse_body($page);
    }
    echo $tpl->_ENGINE_parse_body($page);
}
Exemple #3
0
function popup_resource_usb()
{
    $usb = new usb();
    $hash = $usb->HASH_UUID_LIST();
    $hash[null] = '{select}';
    $select = Field_array_Hash($hash, "UUID", $_SESSION["WIZARD"]["W_RESOURCE"], null, null, 0, "font-size:14px;padding:5px;");
    $html = "\n\t<H3 style='color:rgb(194, 51, 2);font-size:16px'>{usb_external_drive}</H3>\n\t<div class=explain>{WIZARD_BACKUP_USB_STORAGE_EXPLAIN}</div>\n\t{$select}\n\t<div style='text-align:right;width:100%'>" . button("{refresh}", "WizardRessourceShow()") . "</center>\n<hr>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td width=50%>" . button("{back}", "WizardBackupLoad()") . "</td>\n\t\t\t<td width=50% align='right'>" . button("{next}", "WizardUSBSaveRessource()") . "</td>\n\t\t</tr>\n\t</table>\t\n\t";
    return $html;
}
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);
}
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);
}
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);
}
Exemple #7
0
function rows_table()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_blackbox();
    $nodeid = $_GET["nodeid"];
    $mountedon = $tpl->_ENGINE_parse_body("{mounted}");
    $search = '%';
    $table = "harddrives";
    $page = 1;
    $ORDER = "ORDER BY path desc";
    $total = 0;
    if ($q->COUNT_ROWS($table) == 0) {
        $data['page'] = $page;
        $data['total'] = $total;
        $data['rows'] = array();
        echo json_encode($data);
        return;
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($_POST["query"] != null) {
        $_POST["query"] = "*" . $_POST["query"] . "*";
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("*", "%", $_POST["query"]);
        $search = $_POST["query"];
        $searchstring = "AND ((`{$_POST["qtype"]}` LIKE '{$search}' AND nodeid={$nodeid}) OR (`mac` LIKE '{$search}' AND nodeid={$nodeid}))";
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE nodeid={$nodeid}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM `{$table}` WHERE nodeid={$nodeid} {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (!$q->ok) {
        $data['rows'][] = array('id' => $ligne[time() + 1], 'cell' => array($q->mysql_error, "", "", ""));
        $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", ""));
        echo json_encode($data);
        return;
    }
    //if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));}
    $usb = new usb();
    while ($ligne = mysql_fetch_assoc($results)) {
        $model = $ligne["ID_MODEL_1"] . " " . $ligne["ID_MODEL_2"] . " " . $ligne["ID_VENDOR"] . " " . $ligne["ID_FS_LABEL"];
        $partitions = unserialize(base64_decode($ligne["PARTITIONS"]));
        $ppp = array();
        if (count($partitions) > 0) {
            while (list($num, $line) = each($partitions)) {
                $MOUNTED = $line["MOUNTED"];
                $free_size = explode(";", $line["free_size"]);
                $bigsize = $free_size[0];
                $used = $free_size[1];
                $free = $free_size[2];
                $pourcent = $free_size[3];
                $perc = pourcentage($pourcent);
                if ($used == null) {
                    $line["USED"] = 0;
                }
                if ($bigsize == null) {
                    $bigsize = 0;
                }
                if ($line["TYPE"] == 5) {
                    $perc = "-";
                }
                if ($line["TYPE"] == 82) {
                    $perc = "-";
                }
                $ppp[] = "<tr style='border:0px'>\n\t\t\t\t\t<td  style='border:0px'><span style='font-size:12px'>" . basename($num) . "&nbsp;{$label}</td>\n\t\t\t\t\t<td valign='middle' style='width:99%'>{$perc}\n\t\t\t\t\t<div style='margin-top:-10px'>{$used}/{$bigsize} <span style='font-size:12px' >{$usb->getPartypename($line["TYPE"])} ({$line["TYPE"]}) {$mountedon} {$MOUNTED}</div>\n\t\t\t\t\t\n\t\t\t\t\t</td>\n\t\t\t\t\t\n\t\t\t\t\t";
            }
        }
        $ligne["size"] = FormatBytes($ligne["size"] * 1000);
        $data['rows'][] = array('id' => $ligne['mac'], 'cell' => array("<img src='img/disk-64.png'>", "<span style='font-size:16px'>{$ligne["path"]}</span>", "<span style='font-size:16px'>{$ligne["size"]}</span>", "<span style='font-size:16px'>{$model}</span>", "<table style='border:0px'>" . @implode("", $ppp) . "</table>"));
    }
    echo json_encode($data);
}