Beispiel #1
0
function AJAX_COMPUTER_TAB()
{
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    $tpl = new templates();
    $page = CurrentPageName();
    $as_connected_user = false;
    $cmp = new computers($_GET["userid"]);
    if ($_GET["section"] == null) {
        $_GET["section"] = "computer";
    }
    $arr["computer"] = "{computer}";
    $arr["material"] = "{materialos}";
    if ($users->BIND9_INSTALLED) {
        $arr["computer_aliases"] = "{alias}";
    }
    if ($users->OCSI_INSTALLED) {
        $ocs = new ocs();
        if ($ocs->GET_HARDWARE_ID_FROM_MAC($cmp->ComputerMacAddress) > 0) {
            $arr["ocs"] = "{APP_OCSI}";
        }
    }
    $arr["openports"] = "{openports}";
    $arr["applications"] = "{services}";
    $arr["ressources"] = "{netressources}";
    $arr["groups"] = "{groups}";
    if ($_GET["userid"] == 'newcomputer$') {
        unset($arr);
        $arr["computer"] = "{computer}";
    }
    while (list($num, $ligne) = each($arr)) {
        if ($num == "applications") {
            $toolbox[] = "<li><a href=\"computer.infos.php?popup-services=yes&uid={$_GET["userid"]}\"><span>{$ligne}</span></a></li>";
            continue;
        }
        $toolbox[] = "<li><a href=\"{$page}?userid={$_GET["userid"]}&ajaxmode=yes&section={$num}\"><span>{$ligne}</span></a></li>";
    }
    $html = "<div id='container-computer-tabs' style='width:99%;margin:0px;background-color:white'>\n\t\t\t<ul>\n\t\t\t\t" . implode("\n\t", $toolbox) . "\n\t\t\t</ul>\n\t\t</div>\n\t\t<script>\n\t\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#container-computer-tabs').tabs({\n\t\t\t\t    load: function(event, ui) {\n\t\t\t\t        \$('a', ui.panel).click(function() {\n\t\t\t\t            \$(ui.panel).load(this.href);\n\t\t\t\t            return false;\n\t\t\t\t        });\n\t\t\t\t    }\n\t\t\t\t});\n\t\t\t\n\t\t\t});\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t</script>";
    return $tpl->_ENGINE_parse_body($html);
}
function AJAX_COMPUTER_TAB()
{
    $users = new usersMenus();
    $users->LoadModulesEnabled();
    $tpl = new templates();
    $page = CurrentPageName();
    $as_connected_user = false;
    $sock = new sockets();
    $cmp = new computers($_GET["userid"]);
    if ($_GET["section"] == null) {
        $_GET["section"] = "computer";
    }
    $arr["computer"] = "{computer}";
    if ($users->BIND9_INSTALLED) {
        $arr["computer_aliases"] = "{alias}";
    }
    if ($users->OCSI_INSTALLED) {
        $ocs = new ocs();
        if ($ocs->GET_HARDWARE_ID_FROM_MAC($cmp->ComputerMacAddress) > 0) {
            $arr["ocs"] = "{APP_OCSI}";
            unset($arr["material"]);
        }
    } else {
    }
    if ($users->dhcp_installed) {
        $EnableDHCPServer = intval($sock->GET_INFO('EnableDHCPServer'));
        if ($EnableDHCPServer == 1) {
            if (IsPhysicalAddress($cmp->ComputerMacAddress)) {
                $arr["DHCP"] = "DHCP";
            }
        }
    }
    if ($users->SQUID_INSTALLED) {
        $SQUIDEnable = $sock->GET_INFO("SQUIDEnable");
        if (!is_numeric($SQUIDEnable)) {
            $SQUIDEnable = 1;
        }
        if ($SQUIDEnable == 1) {
            $AS_SQUID = true;
            $q = new mysql_squid_builder();
            $date = date("Ym");
            $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT MAC FROM {$date}_maccess WHERE MAC='{$cmp->ComputerMacAddress}' LIMIT 0,1"));
            $arr["SQUIDBLK"] = "{internet_access}";
            if ($ligne["MAC"] != null) {
                $arr["SQUIDSTATS"] = "{internet_activity}";
            }
        }
    }
    //$arr["applications"]="{services}";
    $arr["ressources"] = "{netressources}";
    if (!$AS_SQUID) {
        $arr["activity"] = "{activity}";
    }
    $arr["openports"] = "{openports}";
    $arr["groups"] = "{groups2}";
    if ($_GET["userid"] == 'newcomputer$') {
        unset($arr);
        $arr["computer"] = "{computer}";
    }
    $fontsize = "12px";
    if (count($arr) < 9) {
        $fontsize = "14px";
    }
    if (count($arr) < 8) {
        $fontsize = "18px";
    }
    $uidenc = urlencode($_GET["userid"]);
    $ComputerMacAddressEnc = urlencode($cmp->ComputerMacAddress);
    while (list($num, $ligne) = each($arr)) {
        if ($num == "applications") {
            $toolbox[] = "<li><a href=\"computer.infos.php?popup-services=yes&uid={$uidenc}&t={$_GET["t"]}\"><span style='font-size:{$fontsize}'>{$ligne}</span></a></li>";
            continue;
        }
        if ($num == "DHCP") {
            $link = "dhcpd.fixed.hosts.php?modify-dhcpd-settings-popup=yes&mac={$ComputerMacAddressEnc}&t={$_GET["t"]}&increment=";
            $toolbox[] = "<li><a href=\"{$link}\"><span style='font-size:{$fontsize}'>{$ligne}</span></a></li>";
            continue;
        }
        if ($num == "SQUIDSTATS") {
            $link = "squid.users-stats.currentmonth.php?tabs=yes&field=MAC&value={$ComputerMacAddressEnc}";
            $toolbox[] = "<li><a href=\"{$link}\"><span style='font-size:{$fontsize}'>{$ligne}</span></a></li>";
            continue;
        }
        if ($num == "SQUIDBLK") {
            $link = "squid.computer.access.php?mac={$ComputerMacAddressEnc}&t={$_GET["t"]}&increment=";
            $toolbox[] = "<li><a href=\"{$link}\"><span style='font-size:{$fontsize}'>{$ligne}</span></a></li>";
            continue;
        }
        if ($num == "activity") {
            $toolbox[] = "<li><a href=\"computer.activity.php?uid={$uidenc}&t={$_GET["t"]}\"><span style='font-size:{$fontsize}'>{$ligne}</span></a></li>";
            continue;
        }
        $toolbox[] = "<li><a href=\"{$page}?userid={$uidenc}&ajaxmode=yes&section={$num}&t={$_GET["t"]}\"><span style='font-size:{$fontsize}'>{$ligne}</span></a></li>";
    }
    echo build_artica_tabs($toolbox, "container-computer-tabs");
}
Beispiel #3
0
function popup_ocs_softs_list()
{
    $uid = $_GET["uid"];
    $page = CurrentPageName();
    $ocs = new ocs();
    $tpl = new templates();
    $PUBLISHER = $_GET["PUBLISHER"];
    $HARDWARE_ID = $_GET["HARDWARE_ID"];
    if ($HARDWARE_ID < 1) {
        $comp = new computers($uid);
        $HARDWARE_ID = $ocs->GET_HARDWARE_ID_FROM_MAC($comp->ComputerMacAddress);
    }
    $sql = "SELECT NAME,VERSION FROM softwares WHERE HARDWARE_ID={$HARDWARE_ID} AND PUBLISHER='{$PUBLISHER}'";
    if ($PUBLISHER == null) {
        $sql = "SELECT NAME,VERSION FROM softwares WHERE HARDWARE_ID={$HARDWARE_ID} LIMIT 0,50";
    }
    $html = "\n\t<table class=tableView style='width:95%'>\n\t\t<thead class=thead>\n\t\t\t<tr>\n\t\t\t\t<th width=1% nowrap colspan=2>{software}:</td>\n\t\t\t\t<th width=1% nowrap>{version}:</td>\n\t\t\t</tr>\n\t\t</thead>";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "ocsweb");
    if (!$q->ok) {
        $html = "<code style='color:#d32d2d'>{$q->mysql_error}<br>{$sql}</code>";
    }
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($cl == "oddRow") {
            $cl = null;
        } else {
            $cl = "oddRow";
        }
        $ligne["NAME"] = utf8_encode($ligne["NAME"]);
        $html = $html . "\n\t\t<tr class={$cl}> \n\t\t\t<td valign='middle' width=1%><img src='img/fw_bold.gif'></td>\n\t\t\t<td><strong style='font-size:12px'>{$ligne["NAME"]}</td>\n\t\t\t<td valign='middle' width=1% nowrap><strong>{$ligne["VERSION"]}</td>\n\t\t</tr>";
    }
    $html = $html . "</table>";
    echo $tpl->_ENGINE_parse_body($html);
}