Ejemplo n.º 1
0
function usblist()
{
    $sock = new sockets();
    $tpl = new templates();
    $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 "ressources/usb.scan.inc";
    $os = new os_system();
    $count = 0;
    $table = "<table style='width:99%'><tr>";
    while (list($num, $usb_data_array) = each($_GLOBAL["usb_list"])) {
        $uiid = $num;
        $datas = $os->usb_parse_array($usb_data_array, false);
        if ($datas == null) {
            continue;
        }
        $count = $count + 1;
        if ($count > 2) {
            $table = $table . "<tr></tr>";
            $count = 0;
        }
        $table = $table . "<td>";
        $table = $table . $datas;
        $table = $table . "</td>";
    }
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($table);
}
Ejemplo n.º 2
0
function external_storage_usb_list()
{
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?usb-scan-write=yes");
    $tpl = new templates();
    if (!file_exists('ressources/usb.scan.inc')) {
        return $tpl->_ENGINE_parse_body("<H3 style=color:#d32d2d'>{error_no_socks}</H3>");
    }
    include "ressources/usb.scan.inc";
    include_once "ressources/class.os.system.tools.inc";
    $html = "<table style='width:100%'><tr>";
    $count = 0;
    $os = new os_system();
    while (list($uid, $array) = each($_GLOBAL["usb_list"])) {
        if (preg_match('#swap#', $array["TYPE"])) {
            continue;
        }
        if (trim($array["mounted"]) == '/') {
            continue;
        }
        $start = null;
        $end = null;
        if ($count == 2) {
            $start = "<tr>";
            $end = "</tr>";
            $count = 0;
        }
        $VENDOR = $array["ID_VENDOR"];
        if (strtoupper($VENDOR) == "TANDBERG") {
            $img = "tandberg-64.png";
        } else {
            $img = "64-external-drive.png";
        }
        if ($mounted == "/") {
            return "disk-64.png";
        }
        if ($TYPE == "swap") {
            return "disk-64.png";
        }
        $html = $html . $start;
        $html = $html . "<td valign='top'>";
        $html = $html . RoundedLightWhite("\n\t\t\t\t<table style='width:280px;margin:5px;background-image:url(img/{$img});background-repeat:no-repeat'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td valign='top'><div style='width:36px'>&nbsp;</div></td>\n\t\t\t\t\t<td valign='top'>" . $os->usb_parse_array($array) . "</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2 align='right'><input type='button' OnClick=\"javascript:BrowseUsbSelect('{$uid}');\" value='{select} {this_device}&nbsp;&raquo;'></td>\n\t\t\t\t</tr>\n\t\t\t</table>");
        $html = $html . "</td>";
        $html = $html . $stop;
        $count = $count + 1;
    }
    $html = $html . "</tr>\n\t</table>";
    return $tpl->_ENGINE_parse_body($html, "dar.index.php");
}
Ejemplo n.º 3
0
function format_popup()
{
    include_once "ressources/class.os.system.tools.inc";
    $array = ArrayUsbBYDev($_GET["format-index-popup"]);
    $od = new os_system();
    $table = $od->usb_parse_array($array);
    $format_table = array("ext2" => "ext2 (linux)", "ext3" => "ext3 (linux)", "vfat" => "fat32 (linux & Windows)");
    $field = Field_array_Hash($format_table, 'format_type', 'ext2');
    $form = "\n\t<table class=form>\n\t<tr>\n\t\t<td class=legend>{file_system}:</td>\n\t\t<td>{$field}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><input type='button' OnClick=\"javascript:LauchUsbFormat();\" value='{formatdevice}&nbsp;&raquo;'></td>\n\t</tr>\n\t</table>\n\t\n\t";
    $html = "<H1>{formatdevice} {$_GET["format-index-popup"]}</H1>\n\t<div id='formatdiv'>\n\t<p class=caption>{format_device_explain}</p>\n\t<form name='ffmformat'>\n\t<input type='hidden' value='{$_GET["format-index-popup"]}' id='dev' name='dev'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td valign='top'>{$table}</td>\n\t\t<td valign='top'>{$form}</td>\n\t</tr>\n\t</table>\n\t</div>\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
Ejemplo n.º 4
0
function main_select_disk()
{
    $disk = "/dev/{$_GET["disk"]}";
    $regex_pattern = "#\\/dev\\/{$_GET["disk"]}#";
    $sock = new sockets();
    $tpl = new templates();
    $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";
    include_once "ressources/class.os.system.tools.inc";
    //64-usb-disk-add.png
    //found the right usb device
    while (list($num, $val) = each($_GLOBAL["usb_list"])) {
        if (preg_match($regex_pattern, $val["PATH"])) {
            $uiid = $num;
            $main_array = $val;
            break;
        }
    }
    $os = new os_system();
    $infos = $os->usb_parse_array($main_array);
    $img = RoundedLightWhite("<center>" . imgtootltip("64-usb-disk-add.png", '{add}', "disk_add('{$uiid}')") . "</center>");
    $text = "{add_has_backup}";
    $html = "\n\t<input type='hidden' id='disk_add_caption' value='{disk_add_caption}'>\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' width=1%>{$img}<br><center><strong>{$text}</strong></center></td>\n\t<td valign='top' width=99%>{$infos}</td>\n\t</tr>\n\t</table>\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}