Пример #1
0
function main_disks_discover()
{
    $users = new usersMenus();
    $Disks = $users->disks_size;
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    if (!file_exists('ressources/usb.scan.inc')) {
        return $tpl->_ENGINE_parse_body("<H1>{error_no_socks}</H1>");
    }
    include_once "ressources/usb.scan.inc";
    if ($Disks != null) {
        $tbl = explode(";", $Disks);
        while (list($num, $val) = each($tbl)) {
            if (trim($val) != null) {
                $values = explode(",", $val);
                if (is_array($values)) {
                    $dc = $dc + 1;
                    $disk = $values[0];
                    $size = $values[1];
                    $occ = $values[2];
                    $disp = $values[3];
                    $pourc = $values[4];
                    $path = Get_mounted_path($disk, $_GLOBAL["usb_list"]);
                    $html = $html . "\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t<table style='width:220px;margin:3px'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%>\n\t\t\t\t\t\t" . imgtootltip('scan-disk-48.png', $disk, "Loadjs('TreeBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}');Loadjs('Tree.js');") . "</td>\n\t\t\t\t\t<td style='font-size:11px' valign='top'>\n\t\t\t\t\t\t{$disk} ({$pourc}% {used}).\n\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\t\n\t\t\t\t\t\n\t\t\t\t\t";
                }
            }
        }
    }
    $html = "<H5>{select_disk}</H5><br>" . RoundedLightGrey("\n\t<table style='width:100%'>\n\t{$html}\n\t</table>\n\t");
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
Пример #2
0
function main_disks_discover()
{
    $users = new usersMenus();
    $Disks = $users->disks_size;
    $page = CurrentPageName();
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    if (!file_exists('ressources/usb.scan.inc')) {
        return $tpl->_ENGINE_parse_body("<H1>{error_no_socks}</H1>");
    }
    $added_disks = $sock->GET_INFO('HiddenDisksList');
    $tbl = explode("\n", $added_disks);
    if (is_array($tbl)) {
        while (list($num, $line) = each($tbl)) {
            if ($line == null) {
                continue;
            }
            $added_array = explode(";", $line);
            $added_disks_array[$added_array[0]] = $added_array[1];
        }
    }
    include_once "ressources/usb.scan.inc";
    if ($Disks != null) {
        $tbl = explode(";", $Disks);
        while (list($num, $val) = each($tbl)) {
            if (trim($val) != null) {
                $values = explode(",", $val);
                if (is_array($values)) {
                    $dc = $dc + 1;
                    $disk = $values[0];
                    $size = $values[1];
                    $occ = $values[2];
                    $disp = $values[3];
                    $pourc = $values[4];
                    $path = Get_mounted_path($disk, $_GLOBAL["usb_list"]);
                    $arrayDisks[$disk] = array("POURC" => $pourc, "SIZE" => $size, "MOUNTED" => $path);
                }
            }
        }
    }
    if (is_array($_GLOBAL["disks_list"])) {
        while (list($num, $ARRAY) = each($_GLOBAL["disks_list"])) {
            $disk = basename($num);
            if ($ARRAY["MOUNTED"] != null) {
                $arrayDisks[$disk] = array("POURC" => "0", "SIZE" => $ARRAY["SIZE"], "MOUNTED" => $ARRAY["MOUNTED"]);
            }
            while (list($partition_dev, $ARRAY_PARTITIONS) = each($ARRAY["PARTITIONS"])) {
                if ($ARRAY_PARTITIONS["MOUNTED"] != null) {
                    $disk = basename($partition_dev);
                    $ARRAY_PARTITIONS["free_size"] = str_replace("%", '', $ARRAY_PARTITIONS["free_size"]);
                    $infos = explode(";", $ARRAY_PARTITIONS["free_size"]);
                    $arrayDisks[$disk] = array("POURC" => $infos[3], "SIZE" => $ARRAY_PARTITIONS["SIZE"], "MOUNTED" => $ARRAY_PARTITIONS["MOUNTED"]);
                }
            }
        }
    }
    $html = "<tr>";
    if (is_array($arrayDisks)) {
        $count = 0;
        $tr = null;
        while (list($disk, $ARRAY_FINAL) = each($arrayDisks)) {
            $path = $ARRAY_FINAL["MOUNTED"];
            $size = $ARRAY_FINAL["SIZE"];
            $pourc = $ARRAY_FINAL["POURC"];
            $js = "Loadjs('SambaBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}&homeDirectory={$_GET["homeDirectory"]}&no-shares={$_GET["no-shares"]}&field={$_GET["field"]}&protocol={$_GET["protocol"]}&no-hidden={$_GET["no-hidden"]}')";
            $disk_name = $disk;
            if (preg_match("#mapper\\/.+?\\-(.+)#", $disk_name, $re)) {
                $disk_name = $re[1];
            }
            $count = $count + 1;
            if ($count == 2) {
                $tr = "</tr><tr>";
                $count = 0;
            } else {
                $tr = null;
            }
            $html = $html . "\n\t\t\t\t\t{$tr}\n\t\t\t\t\t<td width=50% valign='top'>" . Paragraphe32("noacco:{$disk_name}", "({$size} - {$pourc}% {used})", $js, "48-hd.png") . "</td>\n\t\t\t\t\t";
        }
    }
    if (is_array($added_disks_array)) {
        while (list($disk, $path) = each($added_disks_array)) {
            $js = "Loadjs('SambaBrowse.php?jdisk={$disk}&mounted={$path}&t={$_GET["t"]}&homeDirectory={$_GET["homeDirectory"]}&no-shares={$_GET["no-shares"]}&field={$_GET["field"]}&protocol={$_GET["protocol"]}&no-hidden={$_GET["no-hidden"]}')";
            $delete = imgtootltip("ed_delete.gif", "{delete} {$disk}...", "DeleteHiddenDisk('{$disk}')");
            $count = $count + 1;
            if ($count == 2) {
                $tr = "</tr><tr>";
                $count = 0;
            } else {
                $tr = null;
            }
            $html = $html . "\n\t\t\t\t\t{$tr}\n\t\t\t\t\t<td width=50% valign='top'>\n\t\t\t\t\t\t<table style='width:150px'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='right' valign='top' width=1%>{$delete}</td>\n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t" . Paragraphe32("noacco:{$disk}", "{$disk}<br>", $js, "48-hd.png", 150) . "</td>\n\t\t\t\t\t\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</td>";
        }
    }
    $add_disk = Paragraphe("64-hd-plus.png", "{invisible_disk}", "{add_invisible_disk_text}", "javascript:Loadjs('{$page}?hidden-add=yes')");
    $html = "<H1>{select_disk}</H1><br>" . RoundedLightWhite("\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top'>\n\t\t<table style='width:100%'>\n\t\t\t\t{$html}\n\t\t\t</tr>\n\t\t</table>\n\t</td>\n\t<td valign='top'>{$add_disk}\n\t</td>\n\t</tr>\n\t</table>\n\t\n\t");
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html, 'fileshares.index.php');
}