function table(){ $tpl=new templates(); $page=CurrentPageName(); $zdate=$tpl->javascript_parse_text("{time}"); $ipaddr=$tpl->javascript_parse_text("{ipaddr}"); $mac=$tpl->javascript_parse_text("{MAC}"); $familysite=$tpl->javascript_parse_text("{familysite}"); $uid=$tpl->javascript_parse_text("{uid}"); $size=$tpl->javascript_parse_text("{size}"); // ipaddr | familysite | servername | uid | MAC | size $t=time(); $servername=null; $uuid=urlencode($_GET["uuid"]); if($_GET["uuid"]<>null){ $q=new mysql_meta(); $servername=" ".$q->uuid_to_host($_GET["uuid"])." - ".$q->uuid_to_tag($_GET["uuid"]); } $title=$tpl->javascript_parse_text("{cached_websites}::{this_week}$servername"); $html=" <table class='flexRT$t' style='display:none' id='flexRT$t'></table> <script> function StartLogsSquidTable$t(){ $('#flexRT$t').flexigrid({ url: '$page?list=yes&uuid=$uuid', dataType: 'json', colModel : [ {display: '$familysite', name : 'familysite', width : 504, sortable : true, align: 'left'}, {display: '$size', name : 'size', width : 142, sortable : true, align: 'right'}, ], searchitems : [ {display: '$familysite', name : 'familysite'}, ], sortname: 'size', sortorder: 'desc', usepager: true, title: '<span style=font-size:20px>$title</span>', useRp: true, rp: 50, showTableToggleBtn: false, width: '99%', height: 450, singleSelect: true, rpOptions: [10, 20, 30, 50,100,200,500,1000,1500] }); } StartLogsSquidTable$t(); </script> "; echo $html; }
function js() { $page = CurrentPageName(); $tpl = new templates(); header("content-type: application/x-javascript"); $q = new mysql_meta(); $title = $tpl->_ENGINE_parse_body("{SQUID_STATS1}: " . $q->uuid_to_host($_GET["uuid"])); $html = "YahooWin4('990','{$page}?tabs=yes&uuid={$_GET["uuid"]}','{$title}');"; echo $html; }
function js() { header("content-type: application/x-javascript"); $tpl = new templates(); $page = CurrentPageName(); $meta = new mysql_meta(); $hostname = $meta->uuid_to_host($_GET["uuid"]); $title = $tpl->javascript_parse_text("{directories_monitor}"); echo "YahooWin(900,'{$page}?table=yes&uuid={$_GET["uuid"]}','{$hostname}:{$title}')"; }
function js() { header("content-type: application/x-javascript"); $tpl = new templates(); $title = $tpl->_ENGINE_parse_body("{services}"); $page = CurrentPageName(); $artica_meta = new mysql_meta(); $hostname = $artica_meta->uuid_to_host($_GET["uuid"]); echo "YahooWin3('990','{$page}?uuid=" . urlencode($_GET["uuid"]) . "','{$title}:{$hostname}')"; }
function js() { header("content-type: application/x-javascript"); $tpl = new templates(); $title = $tpl->_ENGINE_parse_body("{events}"); $page = CurrentPageName(); if ($_GET["uuid"] != null) { $meta = new mysql_meta(); $hostname = $meta->uuid_to_host($_GET["uuid"]); } echo "YahooWin3('1100','{$page}?uuid=" . urlencode($_GET["uuid"]) . "','{$title} {$hostname}')"; }
function popup() { $tpl = new templates(); $page = CurrentPageName(); $q = new mysql_meta(); $zdate = $tpl->javascript_parse_text("{time}"); $ipaddr = $tpl->javascript_parse_text("{ipaddr}"); $mac = $tpl->javascript_parse_text("{MAC}"); $familysite = $tpl->javascript_parse_text("{sitename}"); $uid = $tpl->javascript_parse_text("{members}"); $size = $tpl->javascript_parse_text("{size}"); $hits = $tpl->javascript_parse_text("{hits}"); $t = time(); $title = $tpl->javascript_parse_text("{this_day}:" . $q->uuid_to_host($_GET["uuid"])); if ($_GET["month"] == "yes") { $title = $tpl->javascript_parse_text("{this_month}:" . $q->uuid_to_host($_GET["uuid"])); } $suffix = suffix(); $html = "\n\t<table class='flexRT{$t}' style='display:none' id='flexRT{$t}'></table>\n\t<script>\n\tfunction StartLogsSquidTable{$t}(){\n\n\t\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?list=yes{$suffix}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$uid}', name : 'uid', width :112, sortable : true, align: 'left'},\n\t{display: '{$mac}', name : 'mac', width :142, sortable : true, align: 'left'},\n\t{display: '{$ipaddr}', name : 'ipaddr', width :142, sortable : true, align: 'left'},\n\t{display: '{$familysite}', name : 'sitename', width : 169, sortable : true, align: 'left'},\n\t{display: '{$hits}', name : 'hits', width : 66, sortable : true, align: 'right'},\n\t{display: '{$size}', name : 'size', width : 142, sortable : true, align: 'right'},\n\t],\n\n\tsearchitems : [\n\t{display: '{$uid}', name : 'uid'},\n\t{display: '{$mac}', name : 'mac'},\n\t{display: '{$ipaddr}', name : 'ipaddr'},\n\t{display: '{$familysite}', name : 'sitename'},\n\t],\n\tsortname: 'size',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<span style=font-size:18px>{$title}</span>',\n\tuseRp: true,\n\trp: 100,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 450,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200,500,1000,1500]\n\n});\n\n}\n\nStartLogsSquidTable{$t}();\n</script>\n"; echo $html; }
function js() { header("content-type: application/x-javascript"); $tpl = new templates(); $title = $tpl->_ENGINE_parse_body("{events}"); $page = CurrentPageName(); $artica_meta = new mysql_meta(); if (isset($_GET["uuid"])) { $hostname = $artica_meta->uuid_to_host($_GET["uuid"]); $tag = $artica_meta->uuid_to_tag($_GET["uuid"]); } echo "YahooWin4('770','{$page}?popup=yes&gpid={$_GET["gpid"]}&uuid=" . urlencode($_GET["uuid"]) . "','{$hostname} - {$tag}')"; }
function justbutton_js() { $tpl = new templates(); $artica_meta = new mysql_meta(); $uuid = $_GET["uuid"]; if (intval($_GET["gpid"]) == 0) { $hostname = $artica_meta->uuid_to_host($_GET["uuid"]); } else { $hostname = $tpl->javascript_parse_text("{computers}: ") . $artica_meta->gpid_to_name($_GET["gpid"]); } $title = $tpl->_ENGINE_parse_body("{$hostname}:{enable_emergency_mode}"); $page = CurrentPageName(); header("content-type: application/x-javascript"); echo "YahooWin6('700','{$page}?popup-justbutton=yes&uuid={$uuid}&gpid={$_GET["gpid"]}','{$title}');"; }
function unlink_host() { header("content-type: application/x-javascript"); $tpl = new templates(); $title = $tpl->javascript_parse_text("{unlink}"); $page = CurrentPageName(); $zmd5 = $_GET["unlink-js"]; $q = new mysql_meta(); $sql = "SELECT uuid FROM metagroups_link WHERE zmd5='{$zmd5}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $uuid = $ligne["uuid"]; $hostname = $q->uuid_to_host($uuid); $t = time(); echo "\nvar xLinkEdHosts{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){ alert(res); return; }\n\t\$('#ARTICA_META_GROUPHOSTS_TABLE').flexReload();\n\t\$('#ARTICA_META_GROUP_TABLE').flexReload();\n}\t\t\t\n\t\n\nfunction LinkEdHosts{$t}(){\n\tif(!confirm('{$title} {$hostname} ?')){return;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('unlink','{$zmd5}');\n\tXHR.sendAndLoad('{$page}', 'POST',xLinkEdHosts{$t});\n}\t\n\nLinkEdHosts{$t}();\n"; }
function table() { $tpl = new templates(); $page = CurrentPageName(); $zdate = $tpl->javascript_parse_text("{time}"); $ipaddr = $tpl->javascript_parse_text("{ipaddr}"); $mac = $tpl->javascript_parse_text("{MAC}"); $familysite = $tpl->javascript_parse_text("{familysite}"); $members = $tpl->javascript_parse_text("{members}"); $size = $tpl->javascript_parse_text("{size}"); // ipaddr | familysite | servername | uid | MAC | size $t = time(); $servername = null; $uuid = urlencode($_GET["uuid"]); if ($_GET["uuid"] != null) { $q = new mysql_meta(); $servername = " " . $q->uuid_to_host($_GET["uuid"]) . " - " . $q->uuid_to_tag($_GET["uuid"]); } $title = $tpl->javascript_parse_text("{downloaded_size}::{websites} {this_week}{$servername}"); $html = "\n<table class='flexRT{$t}' style='display:none' id='flexRT{$t}'></table>\n<script>\nfunction StartLogsSquidTable{$t}(){\n\t\n\t\$('#flexRT{$t}').flexigrid({\n\t\turl: '{$page}?list=yes&uuid={$uuid}',\n\t\tdataType: 'json',\n\t\tcolModel : [\n\t\t\t{display: '{$familysite}', name : 'familysite', width : 716, sortable : true, align: 'left'},\n\t\t\t{display: '{$members}', name : 'members', width : 143, sortable : true, align: 'right'},\n\t\t\t{display: '{$size}', name : 'size', width : 202, sortable : true, align: 'right'},\n\t\t\t],\n\t\n\t\tsearchitems : [\n\t\t\t\n\t\t\t{display: '{$familysite}', name : 'familysite'},\n\t\t\t\n\t\t\t],\n\t\tsortname: 'size',\n\t\tsortorder: 'desc',\n\t\tusepager: true,\n\t\ttitle: '{$title}',\n\t\tuseRp: true,\n\t\trp: 50,\n\t\tshowTableToggleBtn: false,\n\t\twidth: '99%',\n\t\theight: 450,\n\t\tsingleSelect: true,\n\t\trpOptions: [10, 20, 30, 50,100,200,500,1000,1500]\n\t\t\n\t\t}); \n\n}\n\nStartLogsSquidTable{$t}();\n</script>\t\t\t\n"; echo $html; }
function showlist() { $page = 1; $q = new mysql_meta(); $type = $_GET["type"]; if ($type == "hour") { $tablename = "metastats_size_" . date("YmdH"); $table = "(SELECT COUNT(zmd5) as hits,SUM(size) as size,uuid FROM `{$tablename}` GROUP BY `uuid` ) as t"; } if ($type == "day") { $tablename = "metastats_sized_" . date("Ymd"); $table = "(SELECT SUM(hits) as hits,SUM(size) as size,uuid FROM `{$tablename}` GROUP BY `uuid` ) as t"; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } 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}"; if (isset($_GET["verbose"])) { echo "<hr><code>{$sql}</code></hr>"; } $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show($q->mysql_error, 0); } if (mysql_num_rows($results) == 0) { if (!$q->TABLE_EXISTS($table)) { $add = " no table!"; } json_error_show("no data {$add} <i>{$sql}</i>", 1); } $data = array(); $data['page'] = 1; $data['total'] = mysql_num_rows($results); $data['rows'] = array(); while ($ligne = mysql_fetch_assoc($results)) { $ipaddr = $ligne["ipaddr"]; $uuid = $ligne["uuid"]; $hostname = $q->uuid_to_host($uuid); $tag = $q->uuid_to_tag($uuid); $size = FormatBytes($ligne["size"] / 1024); $hits = FormatNumber($ligne["hits"]); $ipaddr_enc = urlencode($ipaddr); $loupe_mac = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.access.log.php?js=yes&SearchString={$ipaddr}&data=&minsize=1')\">\n\t\t<img src='img/loupe-32.png' style='float:right'>\n\t\t</a>"; $data['rows'][] = array('id' => md5(serialize($ligne)), 'cell' => array("<span style='font-size:18px'>{$hostname}</span>", "<span style='font-size:18px'>{$tag}</a></span>", "<span style='font-size:18px'>{$hits}</a></span>", "<span style='font-size:18px'>{$size}</span>")); } echo json_encode($data); }
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 = " <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}: <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 | {$client_http_kbytes_out}KB/s | {$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}: " . $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 . " " . $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); }
function page() { $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $q = new mysql_meta(); $TB_HEIGHT = 400; $TB_WIDTH = 635; if ($_GET["uuid"] != null) { $uuid_enc = urlencode($_GET["uuid"]); $uuid_name = " " . $q->uuid_to_host($_GET["uuid"]); } $new_entry = $tpl->_ENGINE_parse_body("{new_computer}"); $t = time(); $hostname = $tpl->_ENGINE_parse_body("{hostname}"); $lastest_scan = $tpl->_ENGINE_parse_body("{latest_scan}"); $ipaddr = $tpl->_ENGINE_parse_body("{ipaddr}"); $directories = $tpl->_ENGINE_parse_body("{directories}"); $depth = $tpl->_ENGINE_parse_body("depth"); $OSNAME = $tpl->_ENGINE_parse_body("{OSNAME}"); $all = $tpl->_ENGINE_parse_body("{all}"); $import = $tpl->javascript_parse_text("{import_artica_computers}"); $computers = $tpl->javascript_parse_text("{computers}"); $username = $tpl->javascript_parse_text("{members}"); $buttons = "\n\tbuttons : [\n\t{name: '{$new_entry}', bclass: 'Add', onpress : AddComputer{$t}},\n\t{name: '{$all}', bclass: 'search', onpress : all_scan{$t}},\n\t\n\t\n\t\n\t],\t"; $uri = "{$page}?SearchComputers=yes&uuid={$uuid_enc}&t={$t}"; $html = "\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:99%'></table>\n<script>\nvar mem{$t}='';\n\$(document).ready(function(){\n\$('#flexRT{$t}').flexigrid({\n\turl: '{$uri}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$hostname}', name : 'hostname', width :264, sortable : true, align: 'left'},\n\t\t{display: '{$ipaddr}', name : 'IPINT', width :141, sortable : true, align: 'left'},\n\t\t{display: 'MAC', name : 'MAC', width :141, sortable : true, align: 'left'},\n\t\t{display: '{$OSNAME}', name : 'OSNAME', width :141, sortable : true, align: 'left'},\n\t\t{display: '{$username}', name : 'username', width :131, sortable : true, align: 'left'},\n\t\t{display: ' ', name : 'delete', width :51, sortable : false, align: 'center'},\n\t \t\n\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t\t{display: '{$hostname}', name : 'hostname'},\n\t\t{display: '{$ipaddr}', name : 'IPADDR'},\n\t\t{display: '{$username}', name : 'username'},\n\t\t{display: '{$OSNAME}', name : 'OSNAME'},\n\t\t{display: 'MAC', name : 'MAC'},\n\t],\n\tsortname: 'IPINT',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span style=font-size:18px>{$computers}{$uuid_name}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: {$TB_HEIGHT},\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200,500]\n\t\n\t}); \n});\n\nfunction AddComputer{$t}(){\n\tYahooUser(1051,'domains.edit.user.php?userid=newcomputer\$&ajaxmode=yes','New computer');\n}\n\nfunction lastest_scan{$t}(){\n\t\$('#flexRT{$t}').flexOptions({url: '{$uri}&latest-scan=yes'}).flexReload(); \n}\n\nfunction ImportComputer{$t}(){\n\tYahooWin3('450','{$page}?artica-importlist-popup=yes','{$import}');\n}\n\nfunction all_scan{$t}(){\n\t\$('#flexRT{$t}').flexOptions({url: '{$uri}'}).flexReload(); \n}\n</script>\n"; echo $html; }
function table() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $q = new mysql_meta(); if (!$q->TABLE_EXISTS("metaorders")) { $q->CheckTables(); } if (!$q->TABLE_EXISTS("metaorders")) { echo FATAL_ERROR_SHOW_128("Unable to stat metaorders table!"); die; } $disks = $tpl->javascript_parse_text("{disks}"); $ipaddr = $tpl->javascript_parse_text("{ipaddr}"); $memory = $tpl->javascript_parse_text("{memory}"); $load = $tpl->javascript_parse_text("{load}"); $package = $tpl->javascript_parse_text("{package}"); $servername = $tpl->javascript_parse_text("{servername2}"); $status = $tpl->javascript_parse_text("{status}"); $delete = "{display: 'delete', name : 'icon3', width : 35, sortable : false, align: 'left'},"; $upload = $tpl->javascript_parse_text("{upload}"); $title = $tpl->javascript_parse_text("{packages}"); if ($_GET["uuid"] != null) { $hostname = $q->uuid_to_host($_GET["uuid"]); $title = "Meta Client:{$hostname} - {$package}"; } if ($_GET["gpid"] > 0) { $hostname = $q->gpid_to_name($_GET["gpid"]); $title = "Meta Clients:{$hostname} - {$package}"; } $buttons = "\tbuttons : [\n\t{name: '{$upload}', bclass: 'export', onpress : Upload{$t}},\n\t],"; $html = "\n\t<table class='ARTICA_META_PACKAGE_TABLE' style='display: none' id='ARTICA_META_PACKAGE_TABLE'></table>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#ARTICA_META_PACKAGE_TABLE').flexigrid({\n\turl: '{$page}?search=yes&uuid={$_GET["uuid"]}&gpid={$_GET["gpid"]}&KEY=RELEASES',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$package}', name : 'version', width : 609, sortable : false, align: 'left'},\n\t\t{display: ' ', name : 'update', width : 50, sortable : false, align: 'center'},\n\t\t{display: ' ', name : 'delete', width : 50, sortable : false, align: 'center'},\n\t\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$package}', name : 'version'},\n\t],\n\tsortname: 'hostname',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<strong style=font-size:22px>{$title}</strong>',\n\tuseRp: true,\n\trpOptions: [10, 20, 30, 50,100,200],\n\trp:50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 400,\n\tsingleSelect: true\n\t\n\t});\n\t});\n\t\nfunction Upload{$t}(){\n\tLoadjs('artica-meta.packages.upload.php');\n} \nfunction Nightly{$t}(){\n\t\$('#ARTICA_META_UPDATEART_TABLE').flexOptions({url: '{$page}?search=yes&uuid={$_GET["uuid"]}&KEY=NIGHTLY'}).flexReload();\n} \t\n</script>"; echo $html; }
function page() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $new_group = $tpl->javascript_parse_text("{new_group}"); $groups = $tpl->javascript_parse_text("{groups2}"); $memory = $tpl->javascript_parse_text("{memory}"); $load = $tpl->javascript_parse_text("{load}"); $version = $tpl->javascript_parse_text("{version}"); $servername = $tpl->javascript_parse_text("{servername2}"); $status = $tpl->javascript_parse_text("{status}"); $events = $tpl->javascript_parse_text("{events}"); $global_whitelist = $tpl->javascript_parse_text("{whitelist} (Meta)"); $policies = $tpl->javascript_parse_text("{policies}"); $orders = $tpl->javascript_parse_text("{orders}"); $restore = $tpl->javascript_parse_text("{restore}"); $create_a_snapshot = $tpl->javascript_parse_text("{create_a_snapshot}"); $link_all_hosts = $tpl->javascript_parse_text("{link_all_hosts}"); $link_all_hosts_ask = $tpl->javascript_parse_text("{link_all_hosts_ask}"); $date = $tpl->javascript_parse_text("{date}"); $size = $tpl->javascript_parse_text("{size}"); $title = $tpl->javascript_parse_text("{snapshots}"); $hostag = $tpl->javascript_parse_text("{tag}"); $hostname = $tpl->javascript_parse_text("{hostname}"); $artica_meta = new mysql_meta(); if ($_GET["gpid"] == 0) { if ($_GET["uuid"] != null) { $subtitle = $tpl->javascript_parse_text("{host}: ") . $artica_meta->uuid_to_host($_GET["uuid"]); } } else { $subtitle = $tpl->javascript_parse_text("{group2}: ") . $artica_meta->gpid_to_name($_GET["gpid"]); } $t = time(); $delete = "{display: 'delete', name : 'icon3', width : 35, sortable : false, align: 'left'},"; $categorysize = 387; $tag = $tpl->javascript_parse_text("{tag}"); $q = new mysql_meta(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT policy_name,policy_type FROM policies WHERE ID='{$_GET["policy-id"]}'")); $groupname = $tpl->javascript_parse_text($ligne["policy_name"]); $buttons = "\n\tbuttons : [\n\t{name: '{$create_a_snapshot}', bclass: 'apply', onpress : run{$t}},\n\t\n\t],"; $buttons = null; $uuidenc = urlencode($_GET["uuid"]); $html = "\n\n\t<table class='ARTICA_META_SNAPSHOTS_BROWSE_TABLE' style='display: none' id='ARTICA_META_SNAPSHOTS_BROWSE_TABLE' style='width:100%'></table>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#ARTICA_META_SNAPSHOTS_BROWSE_TABLE').flexigrid({\n\turl: '{$page}?search=yes&uuid={$uuidenc}&gpid={$_GET["gpid"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$date}', name : 'zDate', width : 191, sortable : true, align: 'left'},\n\t{display: '{$hostname}', name : 'hostname', width : 150, sortable : true, align: 'right'},\n\t{display: '{$size}', name : 'size', width : 150, sortable : true, align: 'right'},\n\t\n\t{display: '{$restore}', name : 'delete', width : 70, sortable : true, align: 'center'},\n\t{display: ' ', name : 'delete', width : 70, sortable : true, align: 'center'},\n\t\n\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$date}', name : 'zDate'},\n\t{display: '{$hostname}', name : 'hostname'},\n\t{display: '{$hostag}', name : 'hostag'},\n\t],\n\tsortname: 'zDate',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<strong style=font-size:22px>{$subtitle} - {$title}</strong>',\n\tuseRp: true,\n\trpOptions: [10, 20, 30, 50,100,200],\n\trp:50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 400,\n\tsingleSelect: true\n\n});\n});\n\nfunction run{$t}(){\n\tLoadjs('snapshots.progress.php');\n}\n\nvar xLinkEdHosts{$t}= function (obj) {\n\tvar res=obj.responseText;\n\tif (res.length>3){ alert(res); return; }\n\t\$('#ARTICA_META_POLICYHOSTS_TABLE').flexReload();\n\t\$('#ARTICA_META_GROUP_TABLE').flexReload();\n}\t\t\t\n\t\n\nfunction LinkEdHosts{$t}(uuid){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('link-host',uuid);\n\tXHR.appendData('gpid','{$_GET["ID"]}');\n\tXHR.sendAndLoad('{$page}', 'POST',xLinkEdHosts{$t});\n}\n\nfunction LinkHostsAll{$t}(){\n\tif(!confirm('{$link_all_hosts_ask}')){return;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('link-all','{$_GET["ID"]}');\n\tXHR.sendAndLoad('{$page}', 'POST',xLinkEdHosts{$t});\n}\n\nfunction Orders{$t}(){\n\tLoadjs('artica-meta.menus.php?gpid={$_GET["ID"]}');\n}\n\n</script>"; echo $html; }
function manager_password_popup() { $page = CurrentPageName(); $tpl = new templates(); $artica_meta = new mysql_meta(); $t = time(); $global_admin_confirm = $tpl->javascript_parse_text("{global_admin_confirm}"); if ($_GET["gpid"] == 0) { $hostname = $artica_meta->uuid_to_host($_GET["uuid"]); } else { $hostname = $tpl->javascript_parse_text("{computers}: ") . $artica_meta->gpid_to_name($_GET["gpid"]); } $html = "\n<div id='ChangePasswordDivNOtifiy' style='width:98%' class=form>\n<table style='width:100%'>\n\t<tr>\n\t\t<td colspan=2 style='border-bottom:1px solid #CCCCCC;padding-top:4px;margin-bottom:20px'>\n\t\t\t<strong style='font-size:32px;'>{global_admin_account}: {$hostname}</strong>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 > </td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' class=legend nowrap style='font-size:22px'>{username}:</strong></td>\n\t\t<td align='left'>" . Field_text("change_admin-{$t}", null, 'width:99%;font-size:22px;padding:3px', "script:ChangeGlobalAdminPasswordCheck{$t}(event)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td align='right' class=legend nowrap class=legend style='font-size:22px'>{password}:</strong></td>\n\t\t<td align='left'>" . Field_password("change_password-{$t}", null, "width:90%;font-size:22px;padding:3px", "script:ChangeGlobalAdminPasswordCheck{$t}(event)") . "</td>\n\t</tr>\n\t" . Field_button_table_autonome("{apply}", "ChangeGlobalAdminPassword{$t}", 26) . "\n</table>\n</div>\n<script>\n\t\nfunction ChangeGlobalAdminPasswordCheck{$t}(e){\n\tif(checkEnter(e)){ChangeGlobalAdminPassword{$t}();}\n}\n\nvar xChangeGlobalAdminPassword{$t}= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\t\$('#ARTICA_META_MAIN_TABLE').flexReload();\n\tYahooWin4Hide();\n}\n\nfunction ChangeGlobalAdminPassword{$t}(){\n\t\n\tif(!confirm('{$global_admin_confirm}')){return;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('change_admin',document.getElementById('change_admin-{$t}').value);\n\tXHR.appendData('uuid','{$_GET["uuid"]}');\n\tXHR.appendData('gpid','{$_GET["gpid"]}');\n\tvar password=encodeURIComponent(document.getElementById('change_password-{$t}').value);\n\tXHR.appendData('change_password',password);\n\tXHR.appendData('manager-password','yes');\n\tXHR.sendAndLoad('{$page}', 'POST',xChangeGlobalAdminPassword{$t});\n}\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function receive_generic_file() { if ($GLOBALS["UUID"] != null) { $uuid = $GLOBALS["UUID"]; } if ($uuid == null) { die; } $meta = new mysql_meta(); $sock = new sockets(); writelogs_meta("{$uuid}: Receive PUSH_FILE_CMD: {$_POST["PUSH_FILE_CMD"]} ", __FUNCTION__, __FILE__, __LINE__); //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SYSLOG") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/syslog"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $name_file = $meta->uuid_to_host($uuid) . ".{$name_file}"; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $target_file = "{$UploadedDir}/{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-syslog-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "PSAUX") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $target_file = "{$UploadedDir}/{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-psaux-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "PHILESIGHT") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $target_file = "{$UploadedDir}/{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-philesight-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "META_EVENTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/META_EVENTS"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-metaevents-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SYS_ALERTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SYS_ALERTS"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-sysalerts-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SMTP_NOTIF") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SMTP_NOTIF"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-smtp-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SNAPSHOT") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SNAPSHOT"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-snapshot-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "ARTICA_DAEMONS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/ARTICA_DAEMONS"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-articadaemons-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "CLIENT_META_EVENTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/CLIENT_META_EVENTS"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-metaclientevents-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SQUID_QUOTASIZE") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SQUID_QUOTASIZE"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; writelogs_meta("{$uuid}: Receive name_file={$name_file} on {$tmp_file}; type_file={$type_file}", __FUNCTION__, __FILE__, __LINE__); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $sock = new sockets(); $sock->getFrameWork("services.php?folders-security=yes&force=true"); if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } } $sock->getFrameWork("artica.php?meta-metaclientquotasize-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** }
function add_node() { $sock = new sockets(); $ArticaMetaAddNewServ = unserialize($sock->GET_INFO("ArticaMetaAddNewServ")); $ArticaMetaHost = $ArticaMetaAddNewServ["ArticaMetaHost"]; $ArticaMetaPort = $ArticaMetaAddNewServ["ArticaMetaPort"]; $ArticaMetaUsername = $ArticaMetaAddNewServ["ArticaMetaUsername"]; $ArticaMetaPassword = $ArticaMetaAddNewServ["ArticaMetaPassword"]; $change_uuid = $ArticaMetaAddNewServ["change_uuid"]; echo "ArticaMetaHost.........: {$ArticaMetaHost}\n"; echo "ArticaMetaPort.........: {$ArticaMetaPort}\n"; echo "ArticaMetaUsername.....: {$ArticaMetaUsername}\n"; echo "Testing authentication...\n"; add_node_progress("Authenticate to {$ArticaMetaHost}:{$ArticaMetaPort}", 10); $array["username"] = $ArticaMetaUsername; $array["password"] = $ArticaMetaPassword; $ident = urlencode(base64_encode(serialize($array))); $curl = new ccurl("https://{$ArticaMetaHost}:{$ArticaMetaPort}/artica.meta.listener.php?test-local-ident={$ident}"); $curl->NoHTTP_POST = true; $curl->NoLocalProxy(); $curl->Timeout = 120; if (!$curl->get()) { echo @implode("\n", $curl->errors); add_node_progress("{$curl->error}", 110); die; } if (!preg_match("#<ARTICA_META>(.+?)</ARTICA_META>#is", $curl->data, $re)) { echo "Expected <ARTICA_META>Someting...</ARTICA_META>"; add_node_progress("Communication: {failed}", 110); die; } if ($re[1] != "SUCCESS") { add_node_progress("Authenticate: {failed}", 110); die; } echo "Testing authentication - success -...\n"; if ($change_uuid == 1) { echo "Ask to remote server to change UUID...\n"; add_node_progress("{change_uuid}", 20); $curl = new ccurl("https://{$ArticaMetaHost}:{$ArticaMetaPort}/artica.meta.listener.php?local-ident={$ident}&chuuid=yes"); $curl->NoHTTP_POST = true; $curl->NoLocalProxy(); $curl->Timeout = 120; if (!$curl->get()) { echo @implode("\n", $curl->errors); add_node_progress("{$curl->error}", 110); die; } if (!preg_match("#<ARTICA_META>(.+?):(.+?)</ARTICA_META>#is", $curl->data, $re)) { add_node_progress("{change_uuid}: Communication: {failed}", 110); die; } add_node_progress("{change_uuid}:{$re[2]} {success}", 25); echo "Ask to remote server to change UUID - success -...\n"; } echo "Ask UUID to remote server...\n"; add_node_progress("{uuid}:", 30); $curl = new ccurl("https://{$ArticaMetaHost}:{$ArticaMetaPort}/artica.meta.listener.php?local-ident={$ident}&GetYourUUID=yes"); $curl->NoHTTP_POST = true; $curl->NoLocalProxy(); $curl->Timeout = 120; if (!$curl->get()) { echo @implode("\n", $curl->errors); add_node_progress("{$curl->error}", 110); die; } if (!preg_match("#<ARTICA_META>(.+?):(.+?)</ARTICA_META>#is", $curl->data, $re)) { add_node_progress("{uuid}: Communication: {failed}", 110); die; } $RESULT = $re[1]; $uuid = $re[2]; echo "UUID results:\n---------------------------------------------\n{$uuid}\n{$RESULT}\n---------------------------------------------\n"; if ($RESULT == "SUCCESS") { add_node_progress("{uuid}: {$uuid} {success}", 35); } else { add_node_progress("{uuid}: {failed}", 110); return; } echo "Ask to remote server to register to Artica Meta server ...\n"; add_node_progress("{order}: -> {register}", 50); $ArticaMetaServerUsername = $sock->GET_INFO("ArticaMetaServerUsername"); $ArticaMetaServerPassword = $sock->GET_INFO("ArticaMetaServerPassword"); $ArticaMetaAddNewServ["ArticaMetaUsername"] = $ArticaMetaServerUsername; $ArticaMetaAddNewServ["ArticaMetaPassword"] = $ArticaMetaServerPassword; if ($GLOBALS["VERBOSE"]) { $verbosed = "&verbose=yes"; } $ArticaMetaAddNewServ_enc = urlencode(base64_encode(serialize($ArticaMetaAddNewServ))); $curl = new ccurl("https://{$ArticaMetaHost}:{$ArticaMetaPort}/artica.meta.listener.php?local-ident={$ident}®isterby={$ArticaMetaAddNewServ_enc}{$verbosed}"); $curl->NoHTTP_POST = true; $curl->NoLocalProxy(); $curl->Timeout = 120; if (!$curl->get()) { echo @implode("\n", $curl->errors); add_node_progress("{$curl->error}", 110); die; } if ($GLOBALS["VERBOSE"]) { echo "***********************************\n{$curl->data}\n***********************************\n"; } if (!preg_match("#<ARTICA_META>(.+?):(.+?)</ARTICA_META>#is", $curl->data, $re)) { add_node_progress("{register}: Communication: {failed}", 110); die; } $RESULT = $re[1]; $DATA = $re[2]; echo $DATA; echo "Register results:\n---------------------------------------------\n{$DATA}\n{$RESULT}\n---------------------------------------------\n"; if ($RESULT == "SUCCESS") { add_node_progress("{register}: {success}", 99); } else { add_node_progress("{register}: {failed}", 110); return; } $artica_meta = new mysql_meta(); add_node_progress("{waiting}: {$ArticaMetaHost} {to_return_back}", 79); for ($i = 0; $i < 20; $i++) { if ($artica_meta->isExists($uuid)) { break; } echo "Waiting {$ArticaMetaHost} {$uuid} to register to Artica Meta...{$i}/20 second\n"; $prc = 79 + $i; add_node_progress("{waiting}: {$ArticaMetaHost} {to_return_back}", $prc); sleep(1); } if ($artica_meta->isExists($uuid)) { $hostname = $artica_meta->uuid_to_host($uuid); add_node_progress("{register}: {success} `{$hostname}`", 100); return; } add_node_progress("{register}: {failed}", 110); }
function receive_generic_file() { if ($GLOBALS["UUID"] != null) { $uuid = $GLOBALS["UUID"]; } if ($uuid == null) { die; } $meta = new mysql_meta(); $sock = new sockets(); //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SYSLOG") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/syslog"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $name_file = $meta->uuid_to_host($uuid) . ".{$name_file}"; $target_file = "{$UploadedDir}/{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$tmp_file}", __FUNCTION__, __FILE__, __LINE__); writelogs_meta("{$uuid}: Error Unable to Move File To: {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-syslog-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "PSAUX") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $target_file = "{$UploadedDir}/{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-psaux-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "PHILESIGHT") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $target_file = "{$UploadedDir}/{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-philesight-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "META_EVENTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/META_EVENTS"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaevents-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SYS_ALERTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SYS_ALERTS"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-sysalerts-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SMTP_NOTIF") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SMTP_NOTIF"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-smtp-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SNAPSHOT") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SNAPSHOT"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { echo "SNAPSHOT: {$uuid}: Error Unable to create {$UploadedDir}\n"; return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $filesize = $arrayF['size']; $tmp_file = $arrayF['tmp_name']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { $errorZ = error_get_last(); $error_type = $errorZ["type"]; $error_message = $errorZ["message"]; echo "SNAPSHOT: {$uuid}: Error {$error_type} ({$error_message}) Unable to Move File : {$target_file}\n"; writelogs_meta("SNAPSHOT: {$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); writelogs_meta("SNAPSHOT: {$uuid}: Source file was {$tmp_file}", __FUNCTION__, __FILE__, __LINE__); writelogs_meta("SNAPSHOT: {$uuid}: System error {$error_type} {$error_message}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-snapshot-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "ARTICA_DAEMONS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; writelogs_meta("{$uuid}: ARTICA_DAEMONS -> {$uuid},{$name_file},{$filesize}", __FUNCTION__, __FILE__, __LINE__); logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/ARTICA_DAEMONS.gz"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}:ARTICA_DAEMONS Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } $target_file_size = FormatBytes(@filesize($target_file) / 1024); writelogs_meta("{$uuid}: ARTICA_DAEMONS -> {$target_file} ({$target_file_size})", __FUNCTION__, __FILE__, __LINE__); } $sock->getFrameWork("artica.php?meta-metaclient-scan-upload-dirs=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "CLIENT_META_EVENTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/CLIENT_META_EVENTS"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclientevents-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SQUID_QUOTASIZE") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SQUID_QUOTASIZE"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclientquotasize-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SQUID_PERFS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/SQUID_PERFS.gz"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclient-scan-upload-dirs=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["INTERFACE_CACHE"] == "SQUID_PERFS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/INTERFACE_CACHE.gz"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclient-scan-upload-dirs=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "EVENT_NOTIFY_MASTER") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/EVENT_NOTIFY_MASTER"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclienteventsmaster-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "SQUID_RELATIME_EVENTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}/SQUID_RELATIME_EVENTS"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$uuid}-{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclientSquidRealtimeev-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "PROXY_PORTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/{$uuid}-{$t}-{$name_file}"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclient-dumpsql-uuid=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "TABLE_NICS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/TABLE_NICS.gz"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclient-scan-upload-dirs=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "HOTSPOT_SESSSIONS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/HOTSPOT_SESSSIONS.gz"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } if (HOTSPOT_SESSSIONS($target_file, $uuid)) { @unlink($target_file); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; } return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "PROXY_CATEGORIES") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/PROXY_CATEGORIES.gz"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclient-scan-upload-dirs=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** if ($_POST["PUSH_FILE_CMD"] == "META_CLIENT_EVENTS") { $UploadedDir = "{$GLOBALS["HOSTS_PATH"]}/uploaded/{$uuid}"; @mkdir($UploadedDir, 0755, true); if (!is_dir($UploadedDir)) { return false; } while (list($key, $arrayF) = each($_FILES)) { $type_file = $arrayF['type']; $name_file = $arrayF['name']; $tmp_file = $arrayF['tmp_name']; $filesize = $arrayF['size']; logsize($uuid, $name_file, $filesize); $t = time(); $target_file = "{$UploadedDir}/META_CLIENT_EVENTS.gz"; if (file_exists($target_file)) { @unlink($target_file); } if (!move_uploaded_file($tmp_file, $target_file)) { echo "{$uuid}: Error Unable to Move File : {$target_file}\n"; writelogs_meta("{$uuid}: Error Unable to Move File : {$target_file}", __FUNCTION__, __FILE__, __LINE__); return; } } $sock->getFrameWork("artica.php?meta-metaclient-scan-upload-dirs=yes&uuid={$uuid}"); echo "\n<ARTICAMETA>OK</ARTICAMETA>\n"; return; } //****************************************************************************************************************** }