Beispiel #1
0
function external_storage_usb_list()
{
    $sock = new sockets();
    $datas = $sock->getfile('smb_scan');
    $finalHash = computer_list();
    $list = "\n\t\n\t<table style='width:100%'><tr>";
    $tb = explode("\n", $datas);
    if (is_array($tb)) {
        $count = 0;
        while (list($uid, $line) = each($tb)) {
            if (preg_match("#^([0-9\\.]+)\\s+(.+?)\\s+.+?\\[(.+?)\\]#", $line, $re)) {
                $finalHash[strtolower($re[2])] = $re[1];
            }
        }
    }
    if (is_array($finalHash)) {
        while (list($uid, $line) = each($finalHash)) {
            if ($count == 3) {
                $list = $list . "</tr><tr>";
                $count = 0;
            }
            $list = $list . "<td>" . Paragraphe32("noacco:{$uid}", $line, "Loadjs('ComputerBrowse.php?&computer={$uid}&field={$_GET["set-field"]}&format-artica=yes');", "32-network-server.png", 150) . "</td>";
            $count = $count + 1;
        }
    }
    $list = $list . "</tr>\t</table>";
    $html = $list;
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html, "dar.index.php");
}
Beispiel #2
0
function index_old()
{
    $tpl = new templates();
    if (isset($_GET["show-title"])) {
        $title = $tpl->_ENGINE_parse_body('{browse_computers}') . "::";
    }
    if ($_GET["mode"] == "dansguardian-ip-group") {
        $title_add = " - {APP_DANSGUARDIAN}";
    }
    if ($_GET["mode"] == "selection") {
        $title_add = " - {select}";
    }
    $menus_right = menus_right();
    $list = computer_list();
    $html = "\n\t<div style='float:right'>" . imgtootltip('32-refresh.png', '{refresh}', 'BrowsComputersRefresh()') . "</div>\n\t<H3 style='border-bottom:1px solid #005447'>{$title}{$title_add}</H3>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width='90%'>\n\t\t\t<div style='width:100%;height:350px;overflow:auto' id='computerlist'>" . $list . "</div>\n\t\t\t<div style='text-align:right;padding:4px;width:100%'><hr>" . button('{delete_all}', "DeleteAllComputers()") . "</div>\n\t\t</td>\n\t\t<td valign='top'>\n\t\t\t{$menus_right}\n\t\t</td>\n\t</tr>\n\t</table>\n\t<div id='progress-computers'></div>";
    echo $tpl->_ENGINE_parse_body($html);
}
include_once 'ressources/class.templates.inc';
include_once 'ressources/class.ldap.inc';
include_once 'ressources/class.users.menus.inc';
include_once 'ressources/class.user.inc';
include_once 'ressources/class.computers.inc';
if (!Isright()) {
    $tpl = new templates();
    echo "alert('" . $tpl->javascript_parse_text('{ERROR_NO_PRIVS}') . "');";
    die;
}
if (isset($_GET["add-computer"])) {
    computer_add();
    exit;
}
if (isset($_GET["generate-list"])) {
    computer_list();
    exit;
}
page();
function page()
{
    $page = CurrentPageName();
    $add = Paragraphe("computer-64-add.png", "{add_user_computer}", "{add_user_computer_text}", "javascript:AddComputerToUser()");
    $html = "\n\t<div style='width:100%;background-color:white;color:black'>\n\t<H1>{$_GET["userid"]}:: {computers}</H1>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top'>{$add}</td>\n\t\t<td valign='top'><div id='computers-list'></div></td>\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\t\tfunction AddComputerToUser(){\n\t\t\tLoadjs('computer-browse.php?mode=selection&callback=AddComputerToUserSelect');\n\t\t}\n\t\t\n\tvar x_AddComputerToUserSelect= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\tYahooLogWatcherHide();\n\t\tLoadComputerList();\n\t\t\n\t}\t\t\n\t\t\n\t\tfunction AddComputerToUserSelect(uid){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('add-computer',uid);\n\t\t\tXHR.appendData('userid','{$_GET["userid"]}');\n\t\t \tdocument.getElementById('computers-list').innerHTML='<div style=\"width:100%\"><center style=\"margin:20px;padding:20px\"><img src=\"img/wait_verybig.gif\"></center></div>';\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_AddComputerToUserSelect); \n\t\t}\n\t\t\n\t\tfunction LoadComputerList(){\n\t\t\tLoadAjax('computers-list','{$page}?generate-list=yes&userid={$_GET["userid"]}');\n\t\t}\n\t\t\n\tLoadComputerList();\t\n\t</script>\n\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
function computer_add()
{
    $userid = $_GET["userid"];
    $computer = new computers($_GET["add-computer"]);