Пример #1
0
function meta_server_status()
{
    include_once 'ressources/class.mysql-meta.inc';
    $page = CurrentPageName();
    $ini = new Bs_IniHandler();
    $users = new usersMenus();
    $tpl = new templates();
    $sock = new sockets();
    $icon = "disks-128-ok.png";
    $GotoMeta = "GoToMeta()";
    if (!$users->AsArticaMetaAdmin) {
        $GotoMeta = "blur();";
    }
    $c = 0;
    $q = new mysql_meta();
    $results = $q->QUERY_SQL("SELECT * FROM metahosts");
    if (!$q->ok) {
        $err[] = proxy_status_warning("MySQL Error !!!", "{$q->mysql_error}", "blur();");
    }
    $ArticaMetaPooling = intval($sock->GET_INFO("ArticaMetaPooling"));
    $ArticaMetaUseSendClient = intval($sock->GET_INFO("ArticaMetaUseSendClient"));
    $ArticaLinkAutoconnect = intval($sock->GET_INFO("ArticaLinkAutoconnect"));
    $MetaUfdbArticaVer = intval($sock->GET_INFO("MetaUfdbArticaVer"));
    if ($ArticaMetaPooling == 0) {
        $ArticaMetaPooling = 15;
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $load = $ligne["load"];
        $uuid = $ligne["uuid"];
        $PROXYEMERG = $ligne["PROXYEMERG"];
        $hostname = $ligne["hostname"];
        if (strpos($hostname, ".") > 0) {
            $xtr = explode(".", $hostname);
            $hostname = $xtr[0];
        }
        $CPU_NUMBER_MAX = $ligne["CPU_NUMBER"] + 1.5;
        $updated = $ligne["updated"];
        $mem_perc = $ligne["mem_perc"];
        $WINDOWSAD = $ligne["WINDOWSAD"];
        $ADEMERG = intval($ligne["ADEMERG"]);
        if ($load > $CPU_NUMBER_MAX) {
            $err[] = proxy_status_warning("{$hostname}: {overloaded} {$load}", "{$hostname}", "Loadjs('artica-meta.cpustats.php?js=yes&uuid={$uuid}');");
        }
        if ($PROXYEMERG == 1) {
            $err[] = proxy_status_warning("{$hostname}: {proxy_in_emergency_mode}", "{$hostname}", "Loadjs('artica-meta.urgency.php?uuid={$uuid}');");
        }
        if ($WINDOWSAD == 1) {
            if ($ADEMERG == 1) {
                $err[] = proxy_status_warning("{$hostname}: {activedirectory_emergency_mode}", "{$hostname}", "Loadjs('artica-meta.menus.php?activedirectory-emergency-disable-js=yes&uuid={$uuid}&gpid=0');");
            }
        }
        if ($mem_perc > 80) {
            $mem_total = FormatBytes($ligne["mem_total"]);
            $alerts[] = status_important_event("{$hostname}: {memory_exceed_80} «{$mem_perc}%/{$mem_total}»", "{$hostname}", "Loadjs('artica-meta.cpustats.php?js=yes&uuid={$uuid}');");
        }
        $xtime = strtotime($updated);
        $diff = time_diff_min($xtime);
        $Difftext = distanceOfTimeInWords($xtime, time(), true);
        if ($diff > $ArticaMetaPooling * 4) {
            $err[] = proxy_status_warning("{$hostname}: {did_not_talk_with_meta}", "{since} {$Difftext}", "Loadjs('artica-meta.cpustats.php?js=yes&uuid={$uuid}');");
        }
        $c++;
    }
    if (count($alerts) > 0) {
        $icon = "disks-128-warn.png";
    }
    if (count($err) > 0) {
        $icon = "disks-128-red.png";
    }
    $master_version = @file_get_contents("VERSION");
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t<td valign='top' style='width:128px' >\n\t<img src='img/{$icon}'>\n\t</td>\n\t<td>\n\t<table style='width:100%'>\n\t<tr>\n\t<td style='font-size:30px'>\n\t" . $tpl->_ENGINE_parse_body(texttooltip("Artica Meta", "Artica Meta", "{$GotoMeta}")) . "\n\t<div style='width:100%;text-align:right'><span style='font-size:16px'>{version}:{$master_version}</div>\n\t</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2>&nbsp;</td>\n\t</tR>\n\t<tr>\n\t\t<td style='font-size:26px'>\n\t\t\t<a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:{$GotoMeta}\"\n\t\t\tstyle='text-decoration:underline'>{servers}: " . FormatNumber($c) . "</a>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t" . @implode("", $err) . "\n\t" . @implode("", $alerts) . "\n\t</table>\n</td>\n</tr>\n</table>\n";
    $html = $tpl->_ENGINE_parse_body($html);
    return $html;
}
Пример #2
0
function search()
{
    $MyPage = CurrentPageName();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_meta();
    $ArticaMetaPooling = intval($sock->GET_INFO("ArticaMetaPooling"));
    $ArticaMetaUseSendClient = intval($sock->GET_INFO("ArticaMetaUseSendClient"));
    $ArticaLinkAutoconnect = intval($sock->GET_INFO("ArticaLinkAutoconnect"));
    $MetaUfdbArticaVer = intval($sock->GET_INFO("MetaUfdbArticaVer"));
    if ($ArticaMetaPooling == 0) {
        $ArticaMetaPooling = 15;
    }
    $switch = intval($_GET["switch"]);
    $table = "metahosts";
    if (isset($_POST["qtype"])) {
        if (preg_match("#prxy([0-9\\.]+)#", $_POST["qtype"], $re)) {
            $_POST["query"] = $re[1];
            $_POST["qtype"] = "squidver";
        }
        if (preg_match("#^([0-9\\.]+)#", $_POST["qtype"])) {
            $_POST["query"] = $_POST["qtype"];
            $_POST["qtype"] = "version";
        }
    }
    $searchstring = string_to_flexquery();
    $page = 1;
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($searchstring != null) {
        $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1);
        }
        $total = $ligne["tcount"];
    } else {
        $total = $q->COUNT_ROWS($table);
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} ";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        if ($q->mysql_error != null) {
            json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1);
        }
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data", 1);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $fontsize = "18";
    if ($switch == 1) {
        $fontsize = 12;
    }
    $style = "<span style='font-size:{$fontsize}px'>";
    $free_text = $tpl->javascript_parse_text("{free}");
    $computers = $tpl->javascript_parse_text("{computers}");
    $overloaded_text = $tpl->javascript_parse_text("{overloaded}");
    $orders_text = $tpl->javascript_parse_text("{orders}");
    $policies_text = $tpl->javascript_parse_text("{policies}");
    $directories_monitor = $tpl->javascript_parse_text("{directories_monitor}");
    $proxy_statistics = $tpl->javascript_parse_text("{SQUID_STATS1}");
    $cache_rate = $tpl->javascript_parse_text("{cache_rate}");
    $clone_of_text = $tpl->javascript_parse_text("{clone_of}");
    $proxy_in_emergency_mode = $tpl->javascript_parse_text("{proxy_in_emergency_mode}");
    $webfiltering = $tpl->javascript_parse_text("{webfiltering}");
    $activedirectory_emergency_mode = $tpl->javascript_parse_text("{activedirectory_emergency_mode}");
    $NeCommuniquePlus_text = "<br><span style='font-size:14px;font-weight:bold;color:d32d2d'>" . $tpl->_ENGINE_parse_body("{did_not_talk_with_meta}") . "</span>";
    $memory_exceed_80 = $tpl->javascript_parse_text("{memory_exceed_80}");
    $memory_exceed_90 = $tpl->javascript_parse_text("{memory_exceed_90}");
    while ($ligne = mysql_fetch_assoc($results)) {
        $LOGSWHY = array();
        $overloaded = null;
        $cloneFrom = $ligne["cloneFrom"];
        $loadcolor = "black";
        $StatHourColor = "black";
        $uuid = $ligne["uuid"];
        $hostname = $ligne["hostname"];
        $public_ip = $ligne["public_ip"];
        $updated = $ligne["updated"];
        $version = $ligne["version"];
        $ColorTime = "black";
        $CPU_NUMBER = $ligne["CPU_NUMBER"];
        $CPU_NUMBER_MAX = $ligne["CPU_NUMBER"] + 1.5;
        $load = $ligne["load"];
        $mem_perc = $ligne["mem_perc"];
        $mem_total = FormatBytes($ligne["mem_total"]);
        $proxyversion = null;
        $CountdeComputers_text = null;
        $policies_text_line = null;
        $CountdeComputers = $q->network_hosts_count($uuid);
        $icon_warning_32 = "warning32.png";
        $icon_red_32 = "32-red.png";
        $icon = "ok-32.png";
        $icon_panneau_32 = "warning-panneau-32.png";
        $BANDWIDTH = $ligne["BANDWIDTH"];
        $TaskPercent = intval($ligne["TaskPercent"]);
        $BANDWIDTH_text = null;
        $hostag_switch = null;
        $uuidenc = urlencode($uuid);
        $PING_URI_SWITCH = null;
        $PROXY_PERFS = null;
        $END_PROXY = null;
        $PROXY_LINE = null;
        $PROXYEMERG = $ligne["PROXYEMERG"];
        $webfiltering_version = null;
        $UFDBARTICA = intval($ligne["UFDBARTICA"]);
        $UFDB_ENABLED = intval($ligne["UFDB_ENABLED"]);
        $WINDOWSAD = intval($ligne["WINDOWSAD"]);
        $ADEMERG = intval($ligne["ADEMERG"]);
        $PROXYEMERG_ICON = 0;
        $link_ip = null;
        $secondincon = null;
        $NeCommuniquePlus = null;
        $MemoryColor = null;
        $Loadbr = "<br>";
        $StyleLoad = "font-size:30px;font-weight:bold";
        if (preg_match("#^([0-9\\.]+)-#", $ligne["squidver"], $rz)) {
            $ligne["squidver"] = $rz[1];
        }
        if ($ArticaMetaUseSendClient == 1) {
            $PING_URI = "&nbsp;<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('artica-meta.menus.php?send-ping-js=yes&uuid={$uuidenc}&gpid=0');\"\n\t\t\tstyle='font-size:12px;text-decoration:underline;color:#0021C6'\n\t\t\t>Ping</a>";
        }
        if ($UFDB_ENABLED == 1) {
            if ($UFDBARTICA > 0) {
                $UFDBARTICAT = date("Y-m-d H:i:s", $UFDBARTICA);
                $webfiltering_version = "<br>{$webfiltering} {$UFDBARTICAT}";
            }
        }
        if ($BANDWIDTH > 0) {
            $BANDWIDTH_text = " (" . FormatBytes($BANDWIDTH / 1024) . ")";
        }
        if ($switch == 1) {
            $icon_warning_32 = "22-warn.png";
            $icon_red_32 = "22-red.png";
            $icon = "ok22.png";
            $icon_panneau_32 = "warning-panneau-24.png";
            $StyleLoad = "font-size:14px;";
            $Loadbr = null;
        }
        if ($load > $CPU_NUMBER_MAX) {
            $overloaded = "<br><strong style='color:#d32d2d'>{$overloaded_text}</strong>";
            $icon = $icon_warning_32;
            $loadcolor = "#d32d2d";
            $LOGSWHY[] = "{$overloaded_text} {$load}>{$CPU_NUMBER_MAX}";
        }
        $xtime = strtotime($updated);
        $diff = time_diff_min($xtime);
        $Difftext = distanceOfTimeInWords($xtime, time(), true);
        if ($diff > $ArticaMetaPooling * 1.5) {
            $icon = $icon_warning_32;
            $ColorTime = "#d32d2d";
            $LOGSWHY[] = $Difftext . "/{$ArticaMetaPooling}Mn";
            $loadcolor = $ColorTime;
        }
        if ($diff > $ArticaMetaPooling * 4) {
            $icon = $icon_red_32;
            $ColorTime = "#d32d2d";
            $LOGSWHY[] = $Difftext . "/{$ArticaMetaPooling}Mn";
            $NeCommuniquePlus = $NeCommuniquePlus_text;
        }
        if ($PROXYEMERG == 1) {
            $icon = $icon_panneau_32;
            $ColorTime = "#d32d2d";
            $loadcolor = $ColorTime;
            $LOGSWHY[] = "<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('artica-meta.urgency.php?uuid={$uuid}');\" style='color:{$ColorTime};text-decoration:underline'>{$proxy_in_emergency_mode}</a>";
        }
        if ($WINDOWSAD == 1) {
            $secondincon = "windows-server-32.png";
            if ($ADEMERG == 1) {
                $icon = $icon_warning_32;
                $ColorTime = "#d32d2d";
                $secondincon = "windows-server-32-red.png";
                $LOGSWHY[] = $activedirectory_emergency_mode;
                $loadcolor = $ColorTime;
            }
        }
        if ($MetaUfdbArticaVer > 0) {
            if ($UFDB_ENABLED == 1) {
                if ($UFDBARTICA < $MetaUfdbArticaVer) {
                    $LOGSWHY[] = "{$webfiltering} < " . date("Y-m-d H:i:s", $MetaUfdbArticaVer);
                }
            }
        }
        if ($mem_perc > 80) {
            $MemoryColor = "#f59c44";
            $icon = $icon_panneau_32;
            $LOGSWHY[] = "<span style='color:{$MemoryColor}'>{$memory_exceed_80}</span>";
        }
        if ($mem_perc > 90) {
            $icon = $icon_red_32;
            $MemoryColor = "#d32d2d";
            $icon = $icon_panneau_32;
            $LOGSWHY[] = "{$memory_exceed_90}";
        }
        $disks = unserialize($ligne["disks"]);
        $SIZE = 0;
        $USED = 0;
        $infodisk = null;
        $DISKS_TEXT = array();
        $squid_db = "squid_{$uuid}";
        if ($q->DATABASE_EXISTS($squid_db)) {
            $DISKS_TEXT[] = "<ul><li><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.hosts.squid.stats.php?uuid={$uuid}')\"\n\t\t\tstyle='font-size:14px;font-weight:bold;text-decoration:underline'>{$proxy_statistics}</a></li>";
        }
        if ($q->philesight_count($uuid) > 0) {
            if (count($DISKS_TEXT) == 0) {
                $DISKS_TEXT[] = "<ul>";
            }
            $DISKS_TEXT[] = "<li><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.hosts.philesight.php?uuid={$uuid}')\"\n\t\t\tstyle='font-size:14px;font-weight:bold;text-decoration:underline'>{$directories_monitor}</a></li>";
        }
        if (count($DISKS_TEXT) > 0) {
            $DISKS_TEXT[] = "</ul>";
        }
        // -------------------------------------------- DISKS INFOS
        if (is_array($disks)) {
            if (count($disks) > 0) {
                $DISKS_TEXT[] = "<ul>";
                while (@(list($disks, $mainarray) = each($disks))) {
                    $SIZE = FormatBytes(intval($mainarray["SIZE"]) / 1024);
                    $DISKS_TEXT[] = "<li style='font-weight:bold;font-size:14px'>{$disks} {$SIZE}</li>";
                    $DISKS_TEXT[] = "<ul>";
                    while (list($part, $partArray) = each($mainarray["PARTS"])) {
                        $color_disk = "black";
                        $POURC = $partArray["POURC"];
                        if ($POURC > 95) {
                            $color_disk = "red";
                            $icon = $icon_red_32;
                            $LOGSWHY[] = "{$part} {used}:{$POURC}%";
                        }
                        $TOT = FormatBytes($partArray["TOT"] / 1024);
                        $AIV = FormatBytes($partArray["AIV"] / 1024);
                        $DISKS_TEXT[] = "<li style='color:{$color_disk}'>{$part} {$TOT} - {used}:{$POURC}% {free}: {$AIV}</li>";
                    }
                    $DISKS_TEXT[] = "</ul>";
                }
                $DISKS_TEXT[] = "</ul>";
                $infodisk = $tpl->_ENGINE_parse_body(@implode("", $DISKS_TEXT));
            }
        }
        // --------------------------------------------	--------------------------------------------------------------------
        if ($switch == 1) {
            $infodisk = null;
        }
        $info = $tpl->_ENGINE_parse_body("<br>{last_status}:&nbsp;<span style='color:{$ColorTime}'>{$Difftext}</span><br><span style='font-size:12px'>{$CPU_NUMBER} CPU(s), {memory}:{$mem_total}{$overloaded}</span>");
        $cell = array();
        $linkver = "<a href=\"javascript:Loadjs('artica-meta.update.artica.php?uuid={$uuid}');\" \n\t\tstyle='text-decoration:underline'>";
        if ($q->isOrder($uuid, "UPDATE_ARTICA")) {
            $version = "<center style='margin:10px'><img src='img/preloader.gif'></center>";
        }
        if ($ligne["PROXY"] == 1) {
            $proxyuri = "<br><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.squid.watchdog-events.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='text-decoration:underline'>";
            $proxyversion = "<br><span style='font-size:12px'>{$proxyuri}Proxy: {$ligne["squidver"]}</a>{$webfiltering_version} {$BANDWIDTH_text}</span>";
            $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM squid_perfs_gb WHERE uuid='{$uuid}'"));
            $client_http_hits = $ligne2["client_http_hits"];
            $client_http_requests = round($ligne2["client_http_requests"], 2);
            $client_http_kbytes_out = round($ligne2["client_http_kbytes_out"]);
            $TOTALS_NOT_CACHED = $ligne2["TOTALS_NOT_CACHED"];
            $TOTALS_CACHED = $ligne2["TOTALS_CACHED"];
            $TOTALS_CACHED_AVG = round($ligne2["TOTALS_CACHED_AVG"], 2);
            $END_PROXY = "</span><br>";
            if ($ligne2["uuid"] != null) {
                $PROXY_PERFS = "<br><span style='font-size:12px'>{$client_http_requests}Req/s, {$client_http_kbytes_out}KB/s\n\t\t\t\t<br>{$cache_rate}: {$TOTALS_CACHED_AVG}%";
                $PROXY_LINE = "<span style='font-size:12px'>{$client_http_requests}Req/s&nbsp;|&nbsp;{$client_http_kbytes_out}KB/s&nbsp;|&nbsp;{$cache_rate}: {$TOTALS_CACHED_AVG}%</span>";
            }
        }
        if ($CountdeComputers > 0) {
            $CountdeComputers = FormatNumber($CountdeComputers);
            $CountdeComputers_uri = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.networks.hosts.php?js=yes&uuid={$uuid}');\"\n\t\t\tstyle='text-decoration:underline'>";
            $CountdeComputers_text = "<br><span style='font-size:12px'>{$CountdeComputers_uri}{$computers}: <strong>{$CountdeComputers}</strong></a></span>";
        }
        $OrdersText = null;
        $ligneOrders = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(orderid) as tcount FROM `metaorders` WHERE `uuid`='{$uuid}'"));
        $OrdersCount = $ligneOrders["tcount"];
        if ($OrdersCount > 0) {
            $OrdersText = "<br><a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('artica-meta.hosts.orders.php?uuid={$uuid}');\">\n\t\t\t<strong style='text-decoration:underline;color:#E48407'>{$orders_text}:{$OrdersCount} ({$TaskPercent}%)</strong>";
        }
        $ligneOrders = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(uuid) as tcount FROM `policies_storage` WHERE `uuid`='{$uuid}'"));
        $OrdersCount = $ligneOrders["tcount"];
        if ($OrdersCount > 0) {
            $policies_text_line = "<br><strong style='text-decoration:underline;color:#E48407'>{$policies_text}:{$OrdersCount}</strong>";
        }
        $events = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.events.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='float:right'><img src='css/images-flexigrid/magnifier.png'></a>";
        $cpus = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.cpustats.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='text-decoration:underline'>";
        $hostsCommands = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.menus.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='text-decoration:underline'>";
        $hostag = utf8_encode($ligne["hostag"]);
        if ($hostag != null) {
            $hostag = "<br><i style='font-size:12px'>{$hostag}</i>";
        }
        if ($cloneFrom != null) {
            $cloneFrom = "<br><i style='font-weight:bold;font-size:12px'>{$clone_of_text}:&nbsp;" . $q->uuid_to_host($cloneFrom) . "</i>";
        }
        if ($secondincon != null) {
            $secondincon = "<br><img src='img/{$secondincon}' style='margin-top:10px'>";
        }
        $LicenseJs = "OnClick=\"javascript:Loadjs('artica-meta.host.license.php?uuid={$uuid}')\"";
        $LicenseInfos = $q->LicenseInfos($uuid);
        $LICT = "Community Edition";
        if ($LicenseInfos["CORP_LICENSE"]) {
            $LICT = "Entreprise Edition";
        }
        if ($LicenseInfos["ExpiresSoon"] > 0) {
            if ($LicenseInfos["ExpiresSoon"] < 31) {
                $LICT = "<span style='color:red'>{trial_mode}</span>";
            }
        }
        $LicenseText = "<br><a href=\"javascript:blur();\" {$LicenseJs} style='font-size:12px;text-decoration:underline'>" . $tpl->_ENGINE_parse_body($LICT) . "</a>";
        if ($switch == 1) {
            $info = null;
            $secondincon = null;
            $hostag = null;
            $cloneFrom = null;
            $proxyversion = null;
            $CountdeComputers_text = null;
            $events = null;
            $hostag_switch = utf8_encode($ligne["hostag"]);
            $PING_URI_SWITCH = $PING_URI;
            $PING_URI = null;
            $PROXY_PERFS = null;
            $END_PROXY = null;
            $LicenseText = null;
            if (count($LOGSWHY) > 0) {
                $infodisk = $tpl->_ENGINE_parse_body("<span style='color:#d32d2d;font-size:14px'>" . @implode("<br>", $LOGSWHY) . "</span>");
            }
        } else {
            $GroupsList = GetGroups($uuid);
            $PROXY_LINE = null;
            if (count($LOGSWHY) > 0) {
                $infodisk = $tpl->_ENGINE_parse_body("<span style='color:#d32d2d;font-size:14px'>" . @implode("<br>", $LOGSWHY) . "</span>") . "<hr>" . $infodisk;
            }
        }
        $cell = array();
        if ($ArticaMetaUseSendClient == 1) {
            $uriAdd = null;
            if ($ArticaLinkAutoconnect == 1) {
                if ($ligne["system_adm"] != null) {
                    $uriAdd = "/logon.php?autologmeta=" . md5($ligne["system_adm"] . $ligne["system_password"]);
                }
            }
            $link_ip = "<a href=\"https://{$public_ip}:9000{$uriAdd}\" style='text-decoration:underline;color:{$loadcolor}' target=_new>";
        }
        if ($MemoryColor == null) {
            $MemoryColor = $loadcolor;
        }
        $cell[] = "{$Loadbr}<center><img src=\"img/{$icon}\">{$secondincon}</center>";
        $cell[] = "{$style}{$hostsCommands}{$hostname}{$hostag}</a>{$LicenseText}{$NeCommuniquePlus}{$cloneFrom}{$PING_URI_SWITCH}{$events} </span>{$info}\n\t\t{$proxyversion}{$PROXY_PERFS}{$END_PROXY}\n\t\t{$CountdeComputers_text}{$OrdersText}{$policies_text_line}";
        $cell[] = "<span style='color:{$loadcolor};{$StyleLoad}'>{$Loadbr}{$load}</span></span>";
        $cell[] = "{$style}{$cpus}<span style='{$StyleLoad};color:{$MemoryColor}'>{$Loadbr}{$mem_perc}%</a></span>";
        $cell[] = $hostag_switch . "&nbsp;" . $infodisk . $PROXY_LINE;
        $cell[] = "{$style}<span style='color:{$loadcolor} !important'>{$link_ip}{$public_ip}</span></a>{$PING_URI}</span>{$GroupsList}";
        $cell[] = "{$style}{$ligne["squidver"]}</span>";
        $cell[] = "{$style}{$linkver}{$version}</a></span>";
        $data['rows'][] = array('id' => $ligne['uuid'], 'cell' => $cell);
    }
    echo json_encode($data);
}
Пример #3
0
function search()
{
    $MyPage = CurrentPageName();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_meta();
    $ArticaMetaPooling = intval($sock->GET_INFO("ArticaMetaPooling"));
    $ArticaMetaUseSendClient = intval($sock->GET_INFO("ArticaMetaUseSendClient"));
    if ($ArticaMetaPooling == 0) {
        $ArticaMetaPooling = 15;
    }
    $switch = intval($_GET["switch"]);
    $table = "metahosts";
    $searchstring = string_to_flexquery();
    $page = 1;
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($searchstring != null) {
        $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1);
        }
        $total = $ligne["tcount"];
    } else {
        $total = $q->COUNT_ROWS($table);
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} ";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        if ($q->mysql_error != null) {
            json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1);
        }
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data", 1);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $fontsize = "18";
    if ($switch == 1) {
        $fontsize = 12;
    }
    $style = "<span style='font-size:{$fontsize}px'>";
    $free_text = $tpl->javascript_parse_text("{free}");
    $computers = $tpl->javascript_parse_text("{computers}");
    $overloaded_text = $tpl->javascript_parse_text("{overloaded}");
    $orders_text = $tpl->javascript_parse_text("{orders}");
    $policies_text = $tpl->javascript_parse_text("{policies}");
    $directories_monitor = $tpl->javascript_parse_text("{directories_monitor}");
    while ($ligne = mysql_fetch_assoc($results)) {
        $LOGSWHY = array();
        $overloaded = null;
        $loadcolor = "black";
        $StatHourColor = "black";
        $uuid = $ligne["uuid"];
        $hostname = $ligne["hostname"];
        $public_ip = $ligne["public_ip"];
        $updated = $ligne["updated"];
        $version = $ligne["version"];
        $ColorTime = "black";
        $CPU_NUMBER = $ligne["CPU_NUMBER"];
        $CPU_NUMBER_MAX = $ligne["CPU_NUMBER"] + 1.5;
        $load = $ligne["load"];
        $mem_perc = $ligne["mem_perc"];
        $mem_total = FormatBytes($ligne["mem_total"]);
        $proxyversion = null;
        $CountdeComputers_text = null;
        $policies_text_line = null;
        $CountdeComputers = $q->network_hosts_count($uuid);
        $icon_warning_32 = "warning32.png";
        $icon_red_32 = "32-red.png";
        $icon = "ok-32.png";
        $BANDWIDTH = $ligne["BANDWIDTH"];
        $BANDWIDTH_text = null;
        $hostag_switch = null;
        $uuidenc = urlencode($uuid);
        $PING_URI_SWITCH = null;
        if ($ArticaMetaUseSendClient == 1) {
            $PING_URI = "&nbsp;<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('artica-meta.menus.php?send-ping-js=yes&uuid={$uuidenc}&gpid=0');\"\n\t\t\tstyle='font-size:12px;text-decoration:underline;color:#0021C6'\n\t\t\t>Ping</a>";
        }
        if ($BANDWIDTH > 0) {
            $BANDWIDTH_text = " (" . FormatBytes($BANDWIDTH / 1024) . ")";
        }
        if ($switch == 1) {
            $icon_warning_32 = "22-warn.png";
            $icon_red_32 = "22-red.png";
            $icon = "ok22.png";
        }
        if ($load > $CPU_NUMBER_MAX) {
            $overloaded = "<br><strong style='color:red'>{$overloaded_text}</strong>";
            $icon = $icon_warning_32;
            $loadcolor = "#CC0000";
            $LOGSWHY[] = "{$overloaded_text} {$load}>{$CPU_NUMBER_MAX}";
        }
        $xtime = strtotime($updated);
        $diff = time_diff_min($xtime);
        $Difftext = distanceOfTimeInWords($xtime, time(), true);
        if ($diff > $ArticaMetaPooling) {
            $icon = $icon_warning_32;
            $ColorTime = "#CC0000";
            $LOGSWHY[] = $Difftext . "/{$ArticaMetaPooling}Mn";
        }
        if ($diff > $ArticaMetaPooling * 4) {
            $icon = $icon_red_32;
            $ColorTime = "#CC0000";
            $LOGSWHY[] = $Difftext . "/{$ArticaMetaPooling}Mn";
        }
        $disks = unserialize($ligne["disks"]);
        $SIZE = 0;
        $USED = 0;
        $infodisk = null;
        $DISKS_TEXT = array();
        if ($q->philesight_count($uuid) > 0) {
            $DISKS_TEXT[] = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.hosts.philesight.php?uuid={$uuid}')\"\n\t\t\tstyle='font-size:14px;font-weight:bold;text-decoration:underline'>{$directories_monitor}</a><hr style='margin-bottom:15px;border:0px;'>";
        }
        if (is_array($disks)) {
            $DISKS_TEXT[] = "<ul>";
            while (list($disks, $mainarray) = each($disks)) {
                $SIZE = FormatBytes(intval($mainarray["SIZE"]) / 1024);
                $DISKS_TEXT[] = "<li style='font-weight:bold;font-size:14px'>{$disks} {$SIZE}</li>";
                $DISKS_TEXT[] = "<ul>";
                while (list($part, $partArray) = each($mainarray["PARTS"])) {
                    $color_disk = "black";
                    $POURC = $partArray["POURC"];
                    if ($POURC > 95) {
                        $color_disk = "red";
                        $icon = $icon_red_32;
                        $LOGSWHY[] = "{$part} {used}:{$POURC}%";
                    }
                    $TOT = FormatBytes($partArray["TOT"] / 1024);
                    $AIV = FormatBytes($partArray["AIV"] / 1024);
                    $DISKS_TEXT[] = "<li style='color:{$color_disk}'>{$part} {$TOT} - {used}:{$POURC}% {free}: {$AIV}</li>";
                }
                $DISKS_TEXT[] = "</ul>";
            }
            $DISKS_TEXT[] = "</ul>";
            $infodisk = $tpl->_ENGINE_parse_body(@implode("", $DISKS_TEXT));
        }
        if ($switch == 1) {
            $infodisk = null;
        }
        $info = $tpl->_ENGINE_parse_body("<br>{last_status}:&nbsp;<span style='color:{$ColorTime}'>{$Difftext}</span><br><span style='font-size:12px'>{$CPU_NUMBER} CPU(s), {memory}:{$mem_total}{$overloaded}</span>");
        $cell = array();
        $linkver = "<a href=\"javascript:Loadjs('artica-meta.update.artica.php?uuid={$uuid}');\" \n\t\tstyle='text-decoration:underline'>";
        if ($q->isOrder($uuid, "UPDATE_ARTICA")) {
            $version = "<center style='margin:10px'><img src='img/preloader.gif'></center>";
        }
        if ($ligne["PROXY"] == 1) {
            $proxyuri = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.squid.watchdog-events.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='text-decoration:underline'>";
            $proxyversion = "<br><span style='font-size:12px'>{$proxyuri}Proxy: {$ligne["squidver"]}</a> {$BANDWIDTH_text}</span>";
        }
        if ($CountdeComputers > 0) {
            $CountdeComputers = FormatNumber($CountdeComputers);
            $CountdeComputers_uri = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.networks.hosts.php?js=yes&uuid={$uuid}');\"\n\t\t\tstyle='text-decoration:underline'>";
            $CountdeComputers_text = "<br><span style='font-size:12px'>{$CountdeComputers_uri}{$computers}: <strong>{$CountdeComputers}</strong></a></span>";
        }
        $OrdersText = null;
        $ligneOrders = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(orderid) as tcount FROM `metaorders` WHERE `uuid`='{$uuid}'"));
        $OrdersCount = $ligneOrders["tcount"];
        if ($OrdersCount > 0) {
            $OrdersText = "<br><a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('artica-meta.hosts.orders.php?uuid={$uuid}');\">\n\t\t\t<strong style='text-decoration:underline;color:#E48407'>{$orders_text}:{$OrdersCount}</strong>";
        }
        $ligneOrders = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(uuid) as tcount FROM `policies_storage` WHERE `uuid`='{$uuid}'"));
        $OrdersCount = $ligneOrders["tcount"];
        if ($OrdersCount > 0) {
            $policies_text_line = "<br><strong style='text-decoration:underline;color:#E48407'>{$policies_text}:{$OrdersCount}</strong>";
        }
        $events = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.events.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='float:right'><img src='css/images-flexigrid/magnifier.png'></a>";
        $cpus = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.cpustats.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='text-decoration:underline'>";
        $hostsCommands = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.menus.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='text-decoration:underline'>";
        $hostag = utf8_encode($ligne["hostag"]);
        if ($hostag != null) {
            $hostag = "<br><i style='font-size:12px'>{$hostag}</i>";
        }
        if ($switch == 1) {
            $info = null;
            $hostag = null;
            $proxyversion = null;
            $CountdeComputers_text = null;
            $events = null;
            $hostag_switch = utf8_encode($ligne["hostag"]);
            $PING_URI_SWITCH = $PING_URI;
            $PING_URI = null;
            if (count($LOGSWHY) > 0) {
                $infodisk = $tpl->_ENGINE_parse_body("<span style='color:red;font-size:12px'>" . @implode(", ", $LOGSWHY) . "</span>");
            }
        }
        $cell = array();
        $link_ip = "<a href=\"https://{$public_ip}:9000\" style='text-decoration:underline' target=_new>";
        $cell[] = "<img src=\"img/{$icon}\">";
        $cell[] = "{$style}{$hostsCommands}{$hostname}{$hostag}</a>{$PING_URI_SWITCH}{$events} </span>{$info}{$proxyversion}{$CountdeComputers_text}{$OrdersText}{$policies_text_line}";
        $cell[] = "{$style}<span style='color:{$loadcolor}'>{$load}</span></span>";
        $cell[] = "{$style}{$cpus}{$mem_perc}%</a></span>";
        $cell[] = $hostag_switch . "&nbsp;" . $infodisk;
        $cell[] = "{$style}{$link_ip}{$public_ip}</a>{$PING_URI}</span>";
        $cell[] = "{$style}{$linkver}{$version}</a></span>";
        $data['rows'][] = array('id' => $ligne['uuid'], 'cell' => $cell);
    }
    echo json_encode($data);
}
Пример #4
0
 protected function checkbrute($user_id)
 {
     $where_array = array('user_id' => $user_id, 'status_key' => 'acc_status');
     $this->db->select('status_value, time');
     $this->db->from('ing_user_status');
     $this->db->where($where_array);
     $query = $this->db->get();
     $row = $query->row();
     $status_value = $row->status_value;
     $time = $row->time;
     if ($status_value == 'locked') {
         $diff = time_diff_min($time);
         if ($diff > 5) {
             // update the account status to 'active'
             $update_data = array('status_value' => 'active', 'time' => db_time());
             $where_data = array('user_id' => $user_id, 'status_key' => 'acc_status');
             $this->db->where($where_data);
             $this->db->update('ing_user_status', $update_data);
             // delete the attempr table's user content
             $this->db->where('user_id', $user_id);
             $this->db->delete('ing_user_login_attempts');
             return FALSE;
         } else {
             return TRUE;
         }
     }
     // Get timestamp of current time
     $now = curTime();
     // All login attempts are counted from the past 2 hours
     $valid_attempts = $now - 2 * 60 * 60;
     $where_array = array('user_id' => $user_id, 'time >' => $valid_attempts);
     $this->db->select('time');
     $this->db->from('ing_user_login_attempts');
     $this->db->where($where_array);
     $query = $this->db->get();
     //$query = $this->db->query('SELECT time FROM ing_admin_login_attempts WHERE user_id = '.$this->db->escape($user_id).' AND time > '.$valid_attempts);
     if ($query->num_rows() > 5) {
         // set the account status to 'locked'
         $update_data = array('status_value' => 'locked', 'time' => db_time());
         $where_data = array('user_id' => $user_id, 'status_key' => 'acc_status');
         $this->db->where($where_data);
         $this->db->update('ing_user_status', $update_data);
         return TRUE;
     } else {
         return FALSE;
     }
 }
Пример #5
0
 protected function checkBrute($user_ip_browser, $setLock = FALSE)
 {
     if ($setLock) {
         // Get timestamp of current time
         $tNow = curTime();
         // All login attempts are counted from the past 2 hours
         $tValidAttempts = $tNow - 2 * 60 * 60;
         $bSQL = $this->DB->query("SELECT `time` FROM `user_login_attempts` WHERE `user_ip_browser` = '{$user_ip_browser}' AND `time` > '{$tValidAttempts}'");
         if ($this->DB->num_rows($bSQL) > 5) {
             // set the account status to 'locked'
             $bSQL = $this->DB->query("UPDATE `users` SET `status` = 'locked', `status_time` = '" . db_time() . "' WHERE `user_id` = '{$this->iUserId}'");
             return $bSQL ? TRUE : FALSE;
         } else {
             return FALSE;
         }
     }
     $tDiff = time_diff_min($this->tUserStatusTime);
     if ($tDiff > 5) {
         // update the account status to 'verified'
         $bSQL = $this->DB->query("UPDATE `users` SET `status` = 'verified', `status_time` = '" . db_time() . "' WHERE `user_id` = '{$this->iUserId}'");
         return $bSQL ? $this->DB->query("DELETE FROM `user_login_attempts` WHERE `user_ip_browser` = '{$user_ip_browser}'") ? TRUE : FALSE : FALSE;
     } else {
         return FALSE;
     }
     return FALSE;
 }
Пример #6
0
 protected function checkBrute($iUserId)
 {
     $sSQL = "\n\t\t\tSELECT `status_value`, `time`\n\t\t\tFROM `user_status`\n\t\t\tWHERE `user_id` = '{$iUserId}' AND `status_key` = '{acc_status}'\n\t\t\tLIMIT 1\n\t\t";
     $aStatus = $this->DB->query($sSQL);
     $aStatus = $this->DB->fetch_array($aStatus);
     $sStatusValue = $aStatus['status_value'];
     $tTime = $aStatus['time'];
     if ($sStatusValue == 'locked') {
         $tDiff = time_diff_min($tTime);
         if ($tDiff > 5) {
             // update the account status to 'active'
             $sSQL = "\n\t\t\t\t\tUPDATE `user_status`\n\t\t\t\t\tSET `status_value` = 'active', `time` = {db_time()}\n\t\t\t\t\tWHERE `user_id` = '{$iUserId}' AND `status_key` = 'acc_status'\n\t\t\t\t\tLIMIT 1\n\t\t\t\t";
             $this->DB->query($sSQL);
             // delete the attempt table's user content
             $sSQL = "\n\t\t\t\t\tDELETE FROM `user_login_attempts`\n\t\t\t\t\tWHERE `user_id` = {$iUserId}\n\t\t\t\t";
             $this->DB->query($sSQL);
             return FALSE;
         } else {
             return TRUE;
         }
     }
     // Get timestamp of current time
     $tNow = curTime();
     // All login attempts are counted from the past 2 hours
     $tValidAttempts = $tNow - 2 * 60 * 60;
     $sSQL = "\n\t\t\t\n\t\t";
     $where_array = array('user_id' => $user_id, 'time >' => $valid_attempts);
     $this->db->select('time');
     $this->db->from('ing_user_login_attempts');
     $this->db->where($where_array);
     $query = $this->db->get();
     //$query = $this->db->query('SELECT time FROM ing_admin_login_attempts WHERE user_id = '.$this->db->escape($user_id).' AND time > '.$valid_attempts);
     if ($query->num_rows() > 5) {
         // set the account status to 'locked'
         $update_data = array('status_value' => 'locked', 'time' => db_time());
         $where_data = array('user_id' => $user_id, 'status_key' => 'acc_status');
         $this->db->where($where_data);
         $this->db->update('ing_user_status', $update_data);
         return TRUE;
     } else {
         return FALSE;
     }
 }
Пример #7
0
function search()
{
    $MyPage = CurrentPageName();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_meta();
    $ArticaMetaPooling = intval($sock->GET_INFO("ArticaMetaPooling"));
    $ArticaMetaUseSendClient = intval($sock->GET_INFO("ArticaMetaUseSendClient"));
    $ArticaLinkAutoconnect = intval($sock->GET_INFO("ArticaLinkAutoconnect"));
    $MetaUfdbArticaVer = intval($sock->GET_INFO("MetaUfdbArticaVer"));
    if ($ArticaMetaPooling == 0) {
        $ArticaMetaPooling = 15;
    }
    $table = "metahosts";
    if (isset($_POST["qtype"])) {
        if (preg_match("#prxy([0-9\\.]+)#", $_POST["qtype"], $re)) {
            $_POST["query"] = $re[1];
            $_POST["qtype"] = "squidver";
        }
        if (preg_match("#^([0-9\\.]+)#", $_POST["qtype"])) {
            $_POST["query"] = $_POST["qtype"];
            $_POST["qtype"] = "version";
        }
    }
    $searchstring = string_to_flexquery();
    $page = 1;
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($searchstring != null) {
        $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1);
        }
        $total = $ligne["tcount"];
    } else {
        $total = $q->COUNT_ROWS($table);
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} ";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        if ($q->mysql_error != null) {
            json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1);
        }
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data", 1);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $fontsize = "18";
    if ($switch == 1) {
        $fontsize = 12;
    }
    $style = "<span style='font-size:18px'>";
    $free_text = $tpl->javascript_parse_text("{free}");
    $computers = $tpl->javascript_parse_text("{computers}");
    $overloaded_text = $tpl->javascript_parse_text("{overloaded}");
    $orders_text = $tpl->javascript_parse_text("{orders}");
    $policies_text = $tpl->javascript_parse_text("{policies}");
    $directories_monitor = $tpl->javascript_parse_text("{directories_monitor}");
    $proxy_statistics = $tpl->javascript_parse_text("{SQUID_STATS1}");
    $cache_rate = $tpl->javascript_parse_text("{cache_rate}");
    $clone_of_text = $tpl->javascript_parse_text("{clone_of}");
    $proxy_in_emergency_mode = $tpl->javascript_parse_text("{proxy_in_emergency_mode}");
    $webfiltering = $tpl->javascript_parse_text("{webfiltering}");
    $activedirectory_emergency_mode = $tpl->javascript_parse_text("{activedirectory_emergency_mode}");
    while ($ligne = mysql_fetch_assoc($results)) {
        $LOGSWHY = array();
        $overloaded = null;
        $cloneFrom = $ligne["cloneFrom"];
        $loadcolor = "black";
        $StatHourColor = "black";
        $uuid = $ligne["uuid"];
        $hostname = $ligne["hostname"];
        $public_ip = $ligne["public_ip"];
        $updated = $ligne["updated"];
        $version = $ligne["version"];
        $ColorTime = "black";
        $CPU_NUMBER = $ligne["CPU_NUMBER"];
        $CPU_NUMBER_MAX = $ligne["CPU_NUMBER"] + 1.5;
        $load = $ligne["load"];
        $mem_perc = $ligne["mem_perc"];
        $mem_total = FormatBytes($ligne["mem_total"]);
        $proxyversion = null;
        $CountdeComputers_text = null;
        $policies_text_line = null;
        $BANDWIDTH = $ligne["BANDWIDTH"];
        $TaskPercent = intval($ligne["TaskPercent"]);
        $BANDWIDTH_text = null;
        $hostag_switch = null;
        $uuidenc = urlencode($uuid);
        $PING_URI_SWITCH = null;
        $PROXY_PERFS = null;
        $END_PROXY = null;
        $PROXY_LINE = null;
        $PROXYEMERG = $ligne["PROXYEMERG"];
        $webfiltering_version = null;
        $UFDBARTICA = intval($ligne["UFDBARTICA"]);
        $UFDB_ENABLED = intval($ligne["UFDB_ENABLED"]);
        $WINDOWSAD = intval($ligne["WINDOWSAD"]);
        $ADEMERG = intval($ligne["ADEMERG"]);
        $PROXYEMERG_ICON = 0;
        $link_ip = null;
        $secondincon = null;
        $icon_warning_32 = "22-warn.png";
        $icon_red_32 = "22-red.png";
        $icon = "ok22.png";
        $icon_panneau_32 = "warning-panneau-24.png";
        $icon_performance = $icon;
        $icon_activedirectory = "ok22-grey.png";
        $icon_ufdb = "ok22-grey.png";
        $icon_disk = $icon;
        if (preg_match("#^([0-9\\.]+)-#", $ligne["squidver"], $rz)) {
            $ligne["squidver"] = $rz[1];
        }
        if ($ArticaMetaUseSendClient == 1) {
            $PING_URI = "&nbsp;<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:Loadjs('artica-meta.menus.php?send-ping-js=yes&uuid={$uuidenc}&gpid=0');\"\n\t\t\tstyle='font-size:18px;text-decoration:underline;color:#0021C6'\n\t\t\t>Ping</a>";
        }
        if ($UFDB_ENABLED == 1) {
            if ($UFDBARTICA > 0) {
                $UFDBARTICAT = date("Y-m-d H:i:s", $UFDBARTICA);
                $webfiltering_version = "<br>{$webfiltering} {$UFDBARTICAT}";
            }
        }
        if ($BANDWIDTH > 0) {
            $BANDWIDTH_text = " (" . FormatBytes($BANDWIDTH / 1024) . ")";
        }
        if ($load > $CPU_NUMBER_MAX) {
            $icon_performance = $icon_red_32;
        }
        $xtime = strtotime($updated);
        $diff = time_diff_min($xtime);
        $Difftext = distanceOfTimeInWords($xtime, time(), true);
        if ($diff > $ArticaMetaPooling * 1.5) {
            $icon = $icon_warning_32;
            $ColorTime = "#CC0000";
            $LOGSWHY[] = $Difftext . "/{$ArticaMetaPooling}Mn";
        }
        if ($diff > $ArticaMetaPooling * 4) {
            $icon = $icon_red_32;
            $ColorTime = "#CC0000";
        }
        if ($PROXYEMERG == 1) {
            $icon = $icon_panneau_32;
        }
        if ($WINDOWSAD == 1) {
            $icon_activedirectory = $icon;
            if ($ADEMERG == 1) {
                $icon_activedirectory = $icon_warning_32;
                $ColorTime = "#CC0000";
            }
        }
        if ($UFDB_ENABLED == 1) {
            $icon_ufdb = $icon;
            if ($UFDBARTICA < $MetaUfdbArticaVer) {
                $icon_ufdb = $icon_warning_32;
            }
        }
        $disks = unserialize($ligne["disks"]);
        // -------------------------------------------- DISKS INFOS
        if (is_array($disks)) {
            while (@(list($disks, $mainarray) = each($disks))) {
                $SIZE = FormatBytes(intval($mainarray["SIZE"]) / 1024);
                while (list($part, $partArray) = each($mainarray["PARTS"])) {
                    $POURC = $partArray["POURC"];
                    if ($POURC > 95) {
                        $color_disk = "red";
                        $icon = $icon_red_32;
                        $icon_disk = $icon_red_32;
                    }
                }
            }
        }
        // --------------------------------------------	--------------------------------------------------------------------
        $cell = array();
        $linkver = "<a href=\"javascript:Loadjs('artica-meta.update.artica.php?uuid={$uuid}');\" \n\t\tstyle='text-decoration:underline'>";
        $events = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.events.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='float:right'><img src='css/images-flexigrid/magnifier.png'></a>";
        $cpus = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.cpustats.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='text-decoration:underline'>";
        $hostsCommands = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('artica-meta.menus.php?js=yes&uuid={$uuid}');\"\n\t\tstyle='text-decoration:underline'>";
        $hostag = utf8_encode($ligne["hostag"]);
        if ($hostag != null) {
            $hostag = "<br><i style='font-size:12px'>{$hostag}</i>";
        }
        $cell = array();
        if ($ArticaMetaUseSendClient == 1) {
            $uriAdd = null;
            if ($ArticaLinkAutoconnect == 1) {
                if ($ligne["system_adm"] != null) {
                    $uriAdd = "/logon.php?autologmeta=" . md5($ligne["system_adm"] . $ligne["system_password"]);
                }
            }
            $link_ip = "<a href=\"https://{$public_ip}:9000{$uriAdd}\" style='text-decoration:underline;font-size:18px;color:black !important' target=_new>";
        }
        $cell[] = "<center><img src=\"img/{$icon}\"></center>";
        $cell[] = "{$style}{$hostname}{$hostag}</a></span>";
        $cell[] = "{$link_ip}{$public_ip}</a></span>";
        $cell[] = "<center>" . imgsimple($icon_performance, null, null) . "</center>";
        $cell[] = "<center>" . imgsimple($icon_disk, null, null) . "</center>";
        $cell[] = "<center>" . imgsimple($icon_activedirectory, null, null) . "</center>";
        $cell[] = "<center>" . imgsimple($icon_ufdb, null, null) . "</center>";
        $cell[] = "{$style}{$ligne["squidver"]}</span>";
        $cell[] = "{$style}{$linkver}{$version}</a></span>";
        $data['rows'][] = array('id' => $ligne['uuid'], 'cell' => $cell);
    }
    echo json_encode($data);
}