function table() { $t = time(); $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); $sock = new sockets(); $t = time(); $websites = $tpl->_ENGINE_parse_body("{websites}"); $add_member = $tpl->_ENGINE_parse_body("{add_member}"); $delete = $tpl->javascript_parse_text("{delete}"); $aliases = $tpl->javascript_parse_text("{aliases}"); $about2 = $tpl->_ENGINE_parse_body("{about2}"); $new_report = $tpl->javascript_parse_text("{new_report}"); $report = $tpl->javascript_parse_text("{report}"); $title = $tpl->javascript_parse_text("{websites}: {not_categorized}"); $progress = $tpl->javascript_parse_text("{progress}"); $size = $tpl->javascript_parse_text("{size}"); $hits = $tpl->javascript_parse_text("{hits}"); $computers = $tpl->javascript_parse_text("{computers}"); $launch = $tpl->javascript_parse_text("{analyze}"); $export = $tpl->javascript_parse_text("{export}"); $q = new mysql_squid_builder(); $NOT_CATEGORIZED_TIME = intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/NOT_CATEGORIZED_TIME")); $lastscan = null; if ($NOT_CATEGORIZED_TIME > 0) { $lastscan = $tpl->javascript_parse_text("{last_scan} " . distanceOfTimeInWords($NOT_CATEGORIZED_TIME, time())); } //current_members $t = time(); $buttons = "\n\tbuttons : [\n\t\t{name: '<strong style=font-size:22px>{$launch}</strong>', bclass: 'link', onpress : Launch{$t}},\n\t\t{name: '<strong style=font-size:22px>{$export}</strong>', bclass: 'link', onpress : export{$t}},\n\t],"; $html = "\n\t<table class='SQUID_NOT_CATEGORIZED_TABLE' style='display: none' id='SQUID_NOT_CATEGORIZED_TABLE' style='width:100%'></table>\n\t<script>\n\t\$(document).ready(function(){\n\t\$('#SQUID_NOT_CATEGORIZED_TABLE').flexigrid({\n\turl: '{$page}?search=yes&ID={$_GET["ID"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '<strong style=font-size:18px>{$websites}</strong>', name : 'familysite', width : 418, sortable : true, align: 'left'},\n\t{display: '<strong style=font-size:18px>{$hits}</strong>', name : 'hits', width : 228, sortable : true, align: 'right'},\n\t{display: '<strong style=font-size:18px>{$size}</strong>', name : 'size', width : 228, sortable : false, align: 'right'},\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$websites}', name : 'familysite'},\n\t\n\t],\n\tsortname: 'size',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '<span style=font-size:30px>{$title} {$lastscan}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: '500',\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\n});\n});\n\n\nfunction Launch{$t}(){\n\tLoadjs('squid.statistics.not-categorized.progress.php');\n}\n\nfunction export{$t}(){\n\tLoadjs('{$page}?export=yes');\n}\n\nfunction GoToProxyAliases{$t}(){\n\tGoToProxyAliases();\n}\n\nfunction GotoNetworkBrowseComputers{$t}(){\n\tGotoNetworkBrowseComputers();\n}\n\nvar xAddcategory{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n\t\$('#SQUID_MAIN_REPORTS').flexReload();\n\t\$('#SQUID_MAIN_REPORTS_USERZ').flexReload();\n}\n\nfunction Addcategory{$t}(field,value){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('ID','{$_GET["ID"]}');\n\tXHR.appendData('field',field);\n\tXHR.appendData('value',value);\n\tXHR.sendAndLoad('{$page}', 'POST',xAddcategory{$t});\n}\n</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function popup() { $artica_meta = new mysql_meta(); $LicenseInfos = $artica_meta->LicenseInfos($_GET["uuid"]); $page = CurrentPageName(); $tpl = new templates(); $FINAL_TIME = 0; if (isset($LicenseInfos["FINAL_TIME"])) { $FINAL_TIME = intval($LicenseInfos["FINAL_TIME"]); } $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>"; } } if ($FINAL_TIME > 0) { $ExpiresSoon = intval(time_between_day_Web($FINAL_TIME)); if ($ExpiresSoon < 7) { $ExpiresSoon_text = "<strong style='color:red;font-size:16px'> {ExpiresSoon}</strong>"; } $licenseTime = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{expiredate}:</td>\n\t\t\t\t<td style='font-size:24px'>" . $tpl->time_to_date($FINAL_TIME) . " (" . distanceOfTimeInWords(time(), $FINAL_TIME) . "{$ExpiresSoon_text})</td>\n\t\t\t\t\t</tr>"; } if (is_numeric($LicenseInfos["TIME"])) { $tt = distanceOfTimeInWords($LicenseInfos["TIME"], time()); $last_access = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:24px'>{last_update}:</td>\n\t\t<td style='font-size:24px'>{since} {$tt}</td>\n\t\t</tr>"; } $html = "<div style='font-size:30px'>{$LICT}</div><div style='width:98%' class=form>\n<table style='width:100%'>\n\t</tr>\n\t{$last_access}\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{company}:</td>\n\t\t<td><span style='font-size:24px;font-weight:bold'>{$LicenseInfos["COMPANY"]}</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{your_email_address}:</td>\n\t\t\t\t<td><span style='font-size:24px;font-weight:bold'>{$LicenseInfos["EMAIL"]}</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{nb_employees}:</td>\n\t\t\t\t<td><span style='font-size:24px;font-weight:bold'>" . FormatNumber($LicenseInfos["EMPLOYEES"]) . "</span></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:24px'>{license_number}:</td>\n\t\t\t\t<td style='font-size:24px'>{$LicenseInfos["license_number"]}</td>\n\t\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px'>{license_status}:</td>\n\t\t\t<td style='font-size:24px;'>{$LicenseInfos["license_status"]}</td>\n\t\t</tr>\n\t\t{$licenseTime}\n\t</table>\n</td>\n</table></div>"; echo $tpl->_ENGINE_parse_body($html); }
function report() { if (!is_file("/usr/share/artica-postfix/ressources/logs/categorized.array")) { return; } $ARRAY = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/categorized.array")); $stats_sites = $ARRAY["stats_sites"]; $stats_categorized = $ARRAY["stats_categorized"]; $stats_not_categorized = $ARRAY["stats_not_categorized"]; $SumOflines = $ARRAY["SumOflines"]; $stats_ip = $ARRAY["stats_ip"]; $FIRSTTIME = $ARRAY["firsttime"]; $LASTTIME = $ARRAY["lasttime"]; $rate = $stats_categorized / $stats_sites; $rate = $rate * 100; $rate = round($rate, 2); $stats_not_categorized = FormatNumber($stats_not_categorized); $stats_categorized = FormatNumber($stats_categorized); $stats_sites = FormatNumber($stats_sites); $stats_ip = FormatNumber($stats_ip); $SumOflines = FormatNumber($SumOflines); if ($rate > 60) { $rate_color = "46a346"; } if ($rate < 60) { $rate_color = "d32d2d"; } $tpl = new templates(); $html = "<div style='width:98%' class=form>\n\t\n\t<div style='font-size:18px;margin-bottom:15px'>{from} " . $tpl->time_to_date($FIRSTTIME) . " {to} " . $tpl->time_to_date($LASTTIME) . " (" . distanceOfTimeInWords($FIRSTTIME, $LASTTIME) . ")</div>\n\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{rate}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong style='font-size:36px;color:{$rate_color}'>{$rate}%</strong></td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{duration}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$ARRAY["DURATION"]}</strong></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{lines}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$SumOflines}</strong></td>\n\t\t<td> </td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{not_categorized}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_not_categorized}</strong></td>\n\t\t<td><a href=\"ressources/logs/notcategorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{categorized}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_categorized}</strong></td>\n\t\t<td><a href=\"ressources/logs/categorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{ipaddresses}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_ip}</strong></td>\n\t\t<td><a href=\"ressources/logs/ipcategorized.csv\"><img src='img/csv-32.png'></a></td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{websites}:</td>\n\t\t<td style='font-size:22px;text-align:right'><strong>{$stats_sites}</strong></td>\n\t\t<td> </td>\n\t\t\n\t</tr>\t\n\t</table>\n\t</div>\t\t\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function events_search() { $page = CurrentPageName(); $tpl = new templates(); if (trim($_GET["search"]) != null) { $_GET["search"] = $_GET["search"] . "*"; $_GET["search"] = str_replace("**", "*", $_GET["search"]); $_GET["search"] = str_replace("*", "%", $_GET["search"]); $sql = "SELECT *,match(content) against('upd') as relevance FROM `kav4proxy_updates` ORDER BY relevance,zDate DESC LIMIT 0,50"; } else { $sql = "SELECT subject,zDate FROM `kav4proxy_updates` ORDER BY zDate DESC LIMIT 0,50"; } $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } $html = "<center>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1% colspan=2>{date}</th>\n\t\t<th colspan=2>{subject}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $distance = distanceOfTimeInWords(strtotime($ligne["zDate"]), time()); $js = "Kav4ProxyUpdateDetails('{$ligne["zDate"]}')"; $ahref = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$js}\" style='font-size:14px;text-decoration:underline'>"; $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1% nowrap style='font-size:11px'>{$ligne["zDate"]}</td>\n\t\t\t<td width=1% nowrap style='font-size:14px'>{$distance}</td>\n\t\t\t<td style='font-size:14px'>{$ahref}{$ligne["subject"]}</a></td>\n\t\t</tr>\n\t\t"; } $html = $html . "</table>"; echo $tpl->_ENGINE_parse_body($html); }
function ScanQueue() { $users = new usersMenus(); $GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED; $unix = new unix(); $path = "/var/log/artica-postfix/xapian"; $SartOn = time(); $files = $unix->DirFiles($path); if (count($files) == 0) { return; } cpulimitProcessName("omindex"); while (list($num, $file) = each($files)) { $toScan = "{$path}/{$file}"; if (ScanFile($toScan)) { @unlink($toScan); } } $SartOff = time(); $time = distanceOfTimeInWords($SartOn, $SartOff); $countdir = count($GLOBALS["DIRS"]); cpulimitProcessNameKill("omindex"); $echo = "InstantSearch {items}: {skipped}: {$GLOBALS["SKIPPED"]} {files}<br>{indexed}: {$GLOBALS["INDEXED"]} {files}<br>{duration}:{$time}"; if ($GLOBALS["INDEXED"] > 0) { @file_put_contents("/usr/share/artica-postfix/ressources/logs/xapian.results", $echo); @chmod("/usr/share/artica-postfix/ressources/logs/xapian.results", 0777); } echo $echo . "\n"; }
function slist() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $deleteTXT = $tpl->javascript_parse_text("{delete}"); $sql = "SELECT * FROM zarafa_orphaned ORDER BY size DESC LIMIT 0,100"; if ($_GET["search"] != null) { $_GET["search"] = str_replace("*", "%", $_GET["search"]); $sql = "SELECT * FROM zarafa_orphaned WHERE uid LIKE '{$_GET["search"]}' OR storeid LIKE '{$_GET["search"]}' ORDER BY size DESC LIMIT 0,100"; } $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2>"; } $html = "<center>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1% align='center'>" . imgtootltip("32-redo.png", "{analyze}", "OrphanReScan()") . "</th>\n\t\t<th width=1%>{date}</th>\n\t\t<th width=99%>{member}/{store}</th>\n\t\t<th>{link}</th>\n\t\t<th>{size}</th>\n\t\t<th> </th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $ligne["uid"] = trim($ligne["uid"]); $color = "black"; $THIS_USER_DOES_NOT_EXISTS = null; $delete = imgtootltip("delete-32.png", "{delete}:{$ligne["storeid"]}", "ZarafaStoreDelete('{$ligne["storeid"]}')"); $date = strtotime($ligne["zDate"]); $distanceOfTimeInWords = distanceOfTimeInWords($date, time()); $users = new user($ligne["uid"]); $relink = imgtootltip("32-backup.png", "{link}", "ZarafaStoreLink('{$ligne["storeid"]}','{$ligne["uid"]}')"); if ($users->mail == null) { $THIS_USER_DOES_NOT_EXISTS = "<div style='color:#891C1C;font-size:11px;font-weight:bold'><i>{THIS_USER_DOES_NOT_EXISTS}</i></div>"; $color = "#CCCCCC"; $relink = " "; } $ligne["size"] = FormatBytes($ligne["size"] / 1024); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t<td style='font-size:14px;color:{$color}' nowrap colspan=2>{$ligne["zDate"]}</a></td>\n\t\t<td style='font-size:14px;color:{$color}'><strong>{$ligne["uid"]}</strong></a>{$THIS_USER_DOES_NOT_EXISTS}<div style='font-size:11px'><i>{$ligne["storeid"]}<br>{$distanceOfTimeInWords}</i></td>\n\t\t<td style='font-size:14px;color:{$color}'>{$relink}</td>\n\t\t<td style='font-size:14px;color:{$color}'>{$ligne["size"]}</a></td>\n\t\t<td width=1%>{$delete}</td>\n\t\t</tr>\n\t\t\n\t\t"; } $html = $html . "</tbody></table>\n\t\t<script>\n\tvar x_ZarafaStoreDelete= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t \tZarafaOrphansShow();\n\t\t}\t\n\n\t\tfunction ZarafaStoreDelete(gpname){\n\t\t\tif(confirm('{$deleteTXT} '+gpname+' ?')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('ZarafaStoreDelete',gpname);\n\t\t\tAnimateDiv('zarafa-orhpans-list');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ZarafaStoreDelete);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction ZarafaStoreLink(storeid,uid){\n\t\t\tif(confirm(storeid+' --> '+uid+' ?')){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('ZarafaStoreLink',storeid);\n\t\t\tXHR.appendData('uid',uid);\n\t\t\tAnimateDiv('zarafa-orhpans-list');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ZarafaStoreDelete);\n\t\t\t}\n\t\t}\n\n\t\tfunction OrphanReScan(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('ZarafaStoreScan','yes');\n\t\t\tAnimateDiv('zarafa-orhpans-list');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ZarafaStoreDelete);\t\t\n\t\t}\n\t\t\n\t</script>"; echo $tpl->_ENGINE_parse_body($html); }
function page() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $ARRAY = unserialize(base64_decode($sock->GET_INFO("SquidSiegeConfig"))); if (!is_numeric($ARRAY["GRAB_URLS"])) { $ARRAY["GRAB_URLS"] = 0; } if (!is_numeric($ARRAY["USE_LOCAL_PROXY"])) { $ARRAY["USE_LOCAL_PROXY"] = 1; } if (!is_numeric($ARRAY["SESSIONS"])) { $ARRAY["SESSIONS"] = 150; } if (!is_numeric($ARRAY["MAX_TIME"])) { $ARRAY["MAX_TIME"] = 30; } $REPORT = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/siege.report.txt")); if (isset($REPORT["START_TIME"])) { $duration = distanceOfTimeInWords($REPORT["START_TIME"], $REPORT["STOP_TIME"]); $ttime = $tpl->time_to_date($REPORT["STOP_TIME"], true); unset($REPORT["START_TIME"]); unset($REPORT["STOP_TIME"]); $f[] = "<div style='width:98%' class=form><table style='width:100%'><tr><td style='font-size:26px' nowrap colsspan=2>{last_report}:</td></tr>"; $f[] = "\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{date}:</td>\n\t\t<td style='font-size:22px'>{$ttime}</td>\n\t\t</tr>"; $f[] = "\n\t\t\t\t\n\t\t<tr>\n\t\t<td class=legend style='font-size:22px' nowrap>{duration}:</td>\n\t\t<td style='font-size:22px'>{$duration}</td>\n\t\t</tr>"; while (list($num, $line) = each($REPORT)) { $f[] = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:22px' nowrap>{$num}:</td>\n\t\t\t\t<td style='font-size:22px'>{$line}</td>\n\t\t\t</tr>"; } $f[] = "\n\t\t<td style='font-size:26px' nowrap colspan=2 align='right'>" . imgtootltip("delete-42.png", "{delete}", "ReportDelete()") . "</td></tr>\t\t\n\t\t</table></div><p> </p>"; } if (count($f) > 0) { $report_text = @implode("\n", $f); } $t = time(); $html = "\n\t\t\t\n\t<div style='font-size:32px;margin-bottom:30px'>Stress Tool</div>\n\t<div style='font-size:18px;margin-bottom:30px' class=explain>{squid_siege_explain} </div>\n\t\t\t{$report_text}\n<div style='width:98%' class=form>\n\t\t\t\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px' nowrap>{get_url_from_lastlogs}:</td>\n\t\t\t<td>" . Field_checkbox_design("GRAB_URLS", 1, $ARRAY["GRAB_URLS"]) . "</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:22px'>{use_local_proxy}:</td>\n\t\t\t<td>" . Field_checkbox_design("USE_LOCAL_PROXY", 1, $ARRAY["USE_LOCAL_PROXY"], "USE_LOCAL_PROXY_CHECK()") . "</td>\n\t\t</tr>\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{remote_proxy}:</td>\n\t\t\t<td style='width:70%;vertical-align:middle;'>\n\t\t\t\t" . Field_text("REMOTE_PROXY", $ARRAY["REMOTE_PROXY"], "font-size:22px;width:300px;") . "\n\t\t\t</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{remote_port}:</td>\n\t\t\t<td style='width:70%;vertical-align:middle;'>\n\t\t\t\t" . Field_text("REMOTE_PROXY_PORT", $ARRAY["REMOTE_PROXY_PORT"], "font-size:22px;width:110px;") . "\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{username}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("USERNAME", $ARRAY["USERNAME"], "font-size:22px;width:300px") . "\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{password}:</td>\n\t\t\t<td >\n\t\t\t\t" . Field_password("PASSWORD", $ARRAY["PASSWORD"], "font-size:22px;width:300px;") . "\n\t\t\t</td>\n\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px'>{simulate}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("SESSIONS", $ARRAY["SESSIONS"], "font-size:22px;width:110px;") . " {members}\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td class=legend style='vertical-align:middle;font-size:22px' nowrap>{MaxExecutionTime}:</td>\n\t\t\t<td style='vertical-align:middle;font-size:22px'>\n\t\t\t\t" . Field_text("MAX_TIME", $ARRAY["MAX_TIME"], "font-size:22px;width:110px;") . " {seconds}\n\t\t\t</td>\n\t\t</tr>\t\n\t\t<tr>\n\t\t\t<td colspan=2 align='right' style='padding-top:20px;font-size:36px'>\n\t\t\t\t\t\t<hr>" . button("{launch_test}", "Submit{$t}(true)", 36) . " | " . button("{apply}", "Submit{$t}(false)", 36) . "</td>\n\t\t</tr>\n\t</table>\n\t</div>\n<div style='margin-bottom:50px'> </div>\n<script>\n\tvar xSubmit{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t}\n\tvar xSubmit2{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tLoadjs('squid.siege.progress.php');\n\t}\t\n\tvar xDelete{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tRefreshTab('debug_squid_config');\n\t}\t\n\t\n\tfunction ReportDelete(){\n\t\tvar XHR = new XHRConnection();\t\n\t\tXHR.appendData('report-delete','yes');\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t}\n\t\n\n\n\tfunction Submit{$t}(run){\n\t\tvar XHR = new XHRConnection();\t\n\t\t\n\t\tif(document.getElementById('GRAB_URLS').checked){XHR.appendData('GRAB_URLS',1);}else{XHR.appendData('GRAB_URLS',0);}\n\t\tif(document.getElementById('USE_LOCAL_PROXY').checked){XHR.appendData('USE_LOCAL_PROXY',1);}else{XHR.appendData('USE_LOCAL_PROXY',0);}\n\t\tXHR.appendData('REMOTE_PROXY',document.getElementById('REMOTE_PROXY').value);\n\t\tXHR.appendData('REMOTE_PROXY_PORT',document.getElementById('REMOTE_PROXY_PORT').value);\n\t\t\n\t\tXHR.appendData('USERNAME',encodeURIComponent(document.getElementById('USERNAME').value));\n\t\tXHR.appendData('PASSWORD',encodeURIComponent(document.getElementById('PASSWORD').value));\n\t\t\n\t\t\n\t\tXHR.appendData('SESSIONS',document.getElementById('SESSIONS').value);\n\t\tXHR.appendData('MAX_TIME',document.getElementById('MAX_TIME').value);\n\t\tif(!run){\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit{$t});\n\t\t}else{\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xSubmit2{$t});\n\t\t}\n\t}\n\t\n\t\n\tfunction USE_LOCAL_PROXY_CHECK(){\n\t\tdocument.getElementById('REMOTE_PROXY').disabled=true;\n\t\tdocument.getElementById('REMOTE_PROXY_PORT').disabled=true;\n\t\tif(!document.getElementById('USE_LOCAL_PROXY').checked){\n\t\t\tdocument.getElementById('REMOTE_PROXY').disabled=false;\n\t\t\tdocument.getElementById('REMOTE_PROXY_PORT').disabled=false;\t\t\n\t\t}\n\t\n\t}\n\tUSE_LOCAL_PROXY_CHECK();\n\tLoadAjax('request-{$t}','{$page}?request-tool-status=yes',true);\n</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function ScanQueue() { $unix = new unix(); $GLOBALS["omindex"] = $unix->find_program("omindex"); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = $unix->get_pid_from_file($pidfile); if ($unix->process_exists($pid)) { writelogs("Already instance executed pid:{$olpid}", __FUNCTION__, __FILE__, __LINE__); die; } @file_put_contents($pidfile, getmypid()); $users = new usersMenus(); $GLOBALS["SAMBA_INSTALLED"] = $users->SAMBA_INSTALLED; $path = "{$GLOBALS["ARTICALOGDIR"]}/xapian"; $SartOn = time(); $files = $unix->DirFiles($path); if (count($files) == 0) { return; } cpulimitProcessName("omindex"); while (list($num, $file) = each($files)) { $toScan = "{$path}/{$file}"; if (ScanFile($toScan)) { @unlink($toScan); } } $SartOff = time(); $time = distanceOfTimeInWords($SartOn, $SartOff); $countdir = count($GLOBALS["DIRS"]); cpulimitProcessNameKill("omindex"); $echo = "InstantSearch {items}: {skipped}: {$GLOBALS["SKIPPED"]} {files}<br>{indexed}: {$GLOBALS["INDEXED"]} {files}<br>{duration}:{$time}"; if ($GLOBALS["INDEXED"] > 0) { @file_put_contents("/usr/share/artica-postfix/ressources/logs/xapian.results", $echo); @chmod("/usr/share/artica-postfix/ressources/logs/xapian.results", 0777); } echo $echo . "\n"; }
function loggers_status() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $data = unserialize(base64_decode($sock->getFrameWork("squid.php?loggers-status=yes"))); if (!is_array($data)) { return; } while (list($PID, $ARRAY) = each($data)) { $timettl = $ARRAY["TTL"]; $PURGED = $ARRAY["PURGED"]; $COUNT_RQS = $ARRAY["COUNT_RQS"]; $PURGED = FormatNumber($PURGED); $COUNT_RQS = FormatNumber($COUNT_RQS); if ($ARRAY["LASTTIME"] > 0) { $Laststatus = distanceOfTimeInWords($ARRAY["LASTTIME"], time(), true); } else { $Laststatus = "-"; } $f[] = "\n\t\t<div style='width:550px;margin-bottom:20px' class=form>\n\t\t<table>\n\t\t<tr>\n\t\t\t<td style='min-width:68px;vertical-align:top'><img src='img/process-64.png'></td>\n\t\t\t<td style='min-width:482px;vertical-align:top'>\t\t\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{PID}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$PID}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{running_since}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$timettl}mn</td>\n\t\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{purged_events}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$PURGED}</td>\n\t\t\t\t\t</tr>\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{received_connections}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$COUNT_RQS}</td>\n\t\t\t\t\t</tr>\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px' class=legend>{last_status}:</td>\n\t\t\t\t\t\t<td valign='top' style='font-size:18px'>{$Laststatus}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t</div>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t"; } echo $tpl->_ENGINE_parse_body(CompileTr2($f) . "\n\t\t\t<div style='width:100%;height:160px'>\n\t\t\t <div style='float:right;margin-left:10px;'>" . button("{refresh}", "LoadAjax('logger-status','{$page}?logger-status=yes',true);", 26) . "</div>\n\t\t\t<div style='float:right'>" . button("{reload_proxy}", "Loadjs('squid.reload.php');", 26) . "</div></div>"); }
function popup_connected_search() { $ocs = new ocs(); $sql = $ocs->COMPUTER_SEARCH_QUERY($_GET["connected-search"]); $CONFIG = $ocs->GET_SERVER_SETTINGS(); $PROLOG_FREQ = $CONFIG["PROLOG_FREQ"] * 60; $q = new mysql(); $results = $q->QUERY_SQL($sql, "ocsweb"); if (!$q->ok) { echo "<p> </p><p style='font-size:15px'>{$q->mysql_error}<hr>{$sql}</p>"; return; } $html = "\n\t<table style='width:100%;'>\n\t<tr>\n\t\t<th colspan=2>{computer}</th>\n\t\t<th>{status}</th>\n\t\t<th>{ComputerMacAddress}</th>\n\t\t<th>{ip_address}</th>\n\t</tr>"; while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($ligne["IPADDRESS"] == "0.0.0.0") { continue; } if ($ligne["MACADDR"] == "00:00:00:00:00:00") { continue; } if ($already[$ligne["MACADDR"]]) { continue; } if ($already[$ligne["NAME"] . $ligne["IPSRC"]]) { continue; } $status = null; $already[$ligne["MACADDR"]] = true; $already[$ligne["NAME"] . $ligne["IPADDRESS"]] = true; $f = new computers(); $uid = $f->ComputerIDFromMAC($ligne["MACADDR"]); if (trim($uid) != null) { $already[$ligne["NAME"] . $ligne["IPSRC"]] = true; } $js = MEMBER_JS($uid, 1, 1); $last = distanceOfTimeInWords(strtotime($ligne["LASTCOME"]), time()); $mins = distanceMinStrings($ligne["LASTCOME"]); $js_text = "{$ligne["NAME"]}<hr>{last_com}:{$last}<hr>{$ligne["IPADDRESS"]}"; if ($mins > $PROLOG_FREQ) { $status = imgtootltip('status_service_removed.png', $last); $js_text = "{$ligne["NAME"]}<hr><span color:red>{last_com}:{$last}</span>"; } else { $status = imgtootltip('status_service_run.png', $last); } if ($uid == null) { $js = null; $status = imgtootltip("status_warning.gif", "{ocs_computer_is_not_in_ldap}", "AddComputerFromOCS('{$ligne["MACADDR"]}')", null, md5($ligne["MACADDR"]) . time()); $js_text = "{ocs_computer_is_not_in_ldap}"; } else { } if (trim($ligne["IPADDRESS"]) != null) { if (trim($ligne["IPSRC"]) != trim($ligne["IPADDRESS"])) { $ligne["IPSRC"] = $ligne["IPSRC"] . "/" . $ligne["IPADDRESS"]; } } $html = $html . "\n\t\t<tr " . CellRollOver($js, $js_text) . ">\n\t\t\t<td width=1%><img src='img/laptop-32.png'></td>\n\t\t\t<td style='font-size:13px'>{$ligne["NAME"]}</td>\n\t\t\t<td width=1% align='center' valign='middle'>{$status}</td>\n\t\t\t<td style='font-size:13px'>{$ligne["MACADDR"]}</td>\n\t\t\t<td style='font-size:12px'>{$ligne["IPSRC"]}</td>\n\t\t</tr>\n\t\t\n\t\t"; } $html = $html . "</table>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
} include_once dirname(__FILE__) . '/framework/class.unix.inc'; if ($GLOBALS["DEBUG_INCLUDES"]) { echo basename(__FILE__) . "::frame.class.inc\n"; } include_once dirname(__FILE__) . '/framework/frame.class.inc'; include_once dirname(__FILE__) . '/ressources/class.mysql.inc'; include_once dirname(__FILE__) . '/ressources/class.squid.acls.inc'; $unix = new unix(); $NICE = $unix->EXEC_NICE(); $GetCachesInsquidConf = $unix->SQUID_CACHE_FROM_SQUIDCONF(); $chown = $unix->find_program("chown"); $chmod = $unix->find_program("chmod"); $t = time(); $c = 0; while (list($CacheDirectory, $type) = each($GetCachesInsquidConf)) { if (trim($CacheDirectory) == null) { continue; } if (!is_dir($CacheDirectory)) { continue; } $c++; $F[] = $CacheDirectory; shell_exec("{$NICE} {$chown} -R squid:squid {$CacheDirectory}"); shell_exec("{$NICE} {$chmod} -R 0755 {$CacheDirectory}"); } if ($c > 0) { $took = distanceOfTimeInWords($t, time(), true); squid_admin_mysql(2, "Privileges was reset on {$c} caches directories took {$took}", @implode("\n", $F), __FILE__, __LINE__); }
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 section_webrules_search() { $q = new mysql_squid_builder(); $database = "squidlogs"; $sock = new sockets(); $tpl = new templates(); $search = '%'; $table = "websites_caches_params"; $searchstring = string_to_flexquery("search-webrules"); $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} ORDER BY sitename"; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { senderror($q->mysql_error); } $boot = new boostrap_form(); $t = time(); while ($ligne = mysql_fetch_assoc($results)) { $ID = md5($ligne["sitename"]); $delete = imgtootltip("delete-24.png", "{delete}", "DeleteWebsiteCached{$t}('{$ligne["sitename"]}','{$ID}')"); $select = "Loadjs('squid.miniwebsite.tasks.php?cache-params-js=yes&sitename={$ligne["sitename"]}&table-t={$_GET["t"]}');"; $ligne["MIN_AGE"] = $ligne["MIN_AGE"]; $ligne["MIN_AGE"] = $tpl->javascript_parse_text(distanceOfTimeInWords(time(), mktime() + $ligne["MIN_AGE"] * 60, true)); $ligne["MAX_AGE"] = $ligne["MAX_AGE"]; $ligne["MAX_AGE"] = $tpl->javascript_parse_text(distanceOfTimeInWords(time(), mktime() + $ligne["MAX_AGE"] * 60, true)); if (trim($ligne["sitename"]) == '.') { $ligne["sitename"] = $tpl->_ENGINE_parse_body("{all}"); } $link = $boot->trswitch($select); $tr[] = "\n\t\t<tr id='{$ID}'>\n\t\t<td {$link}><i class='icon-globe'></i> {$ligne["sitename"]}</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["MIN_AGE"]}</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["PERCENT"]}%</td>\n\t\t<td {$link} width=1% nowrap>{$ligne["MAX_AGE"]}</td>\n\t\t<td width=1% nowrap>{$delete}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{website}</th>\n\t\t\t<th>{expire_time}</th>\n\t\t\t<th>%</th>\n\t\t\t<th>{limit}</th>\n\t\t\t<th> </th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>\n<script>\nvar websiteMem{$t}='';\n\t\tvar x_DeleteWebsiteCached{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);return;}\n\t\t\t\$('#'+websiteMem{$t}).remove();\t\t\t\n\t\t\t\t\n\t\t}\t\n\n\t\tfunction DeleteWebsiteCached{$t}(domain,id){\n\t\t\twebsiteMem{$t}=id;\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('DELETE',domain);\n\t\t\tXHR.sendAndLoad('squid.caches32.caches-www.php', 'POST',x_DeleteWebsiteCached{$t});\n\t\t}\n</script>\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n"; }
function BuildReverse($ligne, $backupBefore = false) { $T1 = time(); $q = new mysql_squid_builder(); $unix = new unix(); $ligne["servername"] = trim($ligne["servername"]); $GLOBALS["IPADDRS"] = $unix->NETWORK_ALL_INTERFACES(true); $IPADDRS = $GLOBALS["IPADDRS"]; $DenyConf = $ligne["DenyConf"]; $ligne["servername"] = trim($ligne["servername"]); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: Nginx\n"; } if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] ************* {$ligne["servername"]}:{$ligne["port"]} / {$DenyConf} ************* \n"; } if ($ligne["port"] == 82) { echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] 82 port is an apache port, SKIP\n"; build_progress("Bad port {$ligne["servername"]}:82", 110); return; } if ($GLOBALS["REMOVE_LOCAL_ADDR"]) { if (isset($IPADDRS[$ligne["servername"]])) { build_progress("{$IPADDRS[$ligne["servername"]]} *** SKIPPED ***", 110); echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] {$ligne["servername"]} *** SKIPPED ***\n"; return; } } if ($DenyConf == 1) { build_progress("Denied config *** SKIPPED ***", 110); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] Local web site `{$ligne["servername"]}`, DenyConf = 1,skipped\n"; } return; } if (isset($ALREADYSET[$ligne["servername"]])) { build_progress("Already setup", 110); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: [" . __LINE__ . "] `{$ligne["servername"]}` Already defined, abort\n"; } return; } $ListenPort = $ligne["port"]; $SSL = $ligne["ssl"]; $certificate = $ligne["certificate"]; echo "Starting......: " . date("H:i:s") . " [INIT]: ListenPort..............:{$ListenPort}\n"; echo "Starting......: " . date("H:i:s") . " [INIT]: SSL.....................:{$SSL}\n"; echo "Starting......: " . date("H:i:s") . " [INIT]: Certificate.............:{$certificate}\n"; echo "Starting......: " . date("H:i:s") . " [INIT]: OWA.....................:{$ligne["owa"]}\n"; if ($ligne["owa"] == 1) { $GLOBALS["OUTPUT"] = true; $nginx_exchange = new nginx_exchange($ligne["servername"]); build_progress("{$ligne["servername"]}: {building} Microsoft Exchange Configuration", 50); $nginx_exchange->buildConfig(); build_progress("{$ligne["servername"]}: {building} Microsoft Exchange Configuration {done}", 70); $Took = distanceOfTimeInWords($T1, time(), true); nginx_admin_mysql(2, "Success build Microsoft Exchange Configuration configuration for {$ligne["servername"]} took: {$Took}", "Took: {$Took}", __FILE__, __LINE__); build_progress("{$ligne["servername"]}: Microsoft Exchange Configuration {done}", 80); return true; } build_progress("{$ligne["servername"]}:{$ListenPort} [SSL:{$SSL}]", 20); echo "Starting......: " . date("H:i:s") . " [INIT]: Protect remote web site `{$ligne["servername"]}:{$ListenPort} [SSL:{$SSL}]`\n"; if ($ligne["servername"] == null) { echo "Starting......: " . date("H:i:s") . " [INIT]: skip it...\n"; return; } $cache_peer_id = $ligne["cache_peer_id"]; if ($cache_peer_id > 0) { $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM `reverse_sources` WHERE `ID`='{$cache_peer_id}'")); } $host = new nginx($ligne["servername"]); if ($ListenPort == 80 && $SSL == 1) { build_progress("{$ligne["servername"]}: Building HTTP", 40); if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: HTTP/HTTPS Enabled [" . __LINE__ . "]...\n"; } $host->set_RedirectQueries($ligne["RedirectQueries"]); $host->set_forceddomain($ligne2["forceddomain"]); $host->set_ssl(0); $host->set_mixed_ssl(1); $host->set_proxy_port($ligne2["port"]); $host->set_listen_port(80); $host->set_poolid($ligne["poolid"]); $host->set_owa($ligne["owa"]); $host->set_storeid($ligne["cacheid"]); $host->set_cache_peer_id($cache_peer_id); $host->BackupBefore = $backupBefore; build_progress("{$ligne["servername"]}: HTTP/HTTPS Enabled", 50); $GLOBALS["NGINX_FATAL_ERRORS"] = array(); if (!$host->build_proxy()) { if ($GLOBALS["NGINX_FATAL_ERROR"] != null) { nginx_admin_mysql(0, "Fatal error on {$ligne["servername"]} <{$GLOBALS["NGINX_FATAL_ERROR"]}>", "{$GLOBALS["NGINX_FATAL_ERROR"]}\n" . @implode("\n", $GLOBALS["NGINX_FATAL_ERRORS"])); echo "*** ***\n"; echo "*** Fatal error {$GLOBALS["NGINX_FATAL_ERROR"]} ***\n"; echo "*** ***\n"; build_progress("{$ligne["servername"]}: {failed} {$GLOBALS["NGINX_FATAL_ERROR"]}", 110); return; } build_progress("{$ligne["servername"]}: {failed}", 110); return; } if (!$GLOBALS["NO_RELOAD"]) { build_progress("{$ligne["servername"]}: {done}", 80); return true; } } if ($ligne["ssl"] == 1) { echo "Starting......: " . date("H:i:s") . " [INIT]: SSL Enabled...\n"; $ligne2["ssl"] = 1; } if ($ligne["port"] == 443) { $ligne2["ssl"] = 1; } build_progress("{$ligne["servername"]}", 50); $host->BackupBefore = $backupBefore; $host->set_owa($ligne["owa"]); $host->set_RedirectQueries($ligne["RedirectQueries"]); $host->set_ssl_certificate($certificate); $host->set_ssl_certificate($ligne2["ssl_commname"]); $host->set_forceddomain($ligne2["forceddomain"]); $host->set_ssl($ligne2["ssl"]); $host->set_proxy_port($ligne2["port"]); $host->set_listen_port($ligne["port"]); $host->set_poolid($ligne["poolid"]); $host->set_owa($ligne["owa"]); $host->set_storeid($ligne["cacheid"]); $host->set_cache_peer_id($cache_peer_id); $host->build_proxy(); if ($GLOBALS["NGINX_FATAL_ERROR"] != null) { nginx_admin_mysql(0, "Fatal error on {$ligne["servername"]} <{$GLOBALS["NGINX_FATAL_ERROR"]}>", "{$GLOBALS["NGINX_FATAL_ERROR"]}\n" . @implode("\n", $GLOBALS["NGINX_FATAL_ERRORS"]), __FILE__, __LINE__); echo "*** Fatal error {$GLOBALS["NGINX_FATAL_ERROR"]} ***\n"; build_progress("{$ligne["servername"]}: {failed}", 110); return; } $Took = distanceOfTimeInWords($T1, time(), true); nginx_admin_mysql(2, "Success build configuration for {$ligne["servername"]} took: {$Took}", "Took: {$Took}", __FILE__, __LINE__); build_progress("{$ligne["servername"]}: {done}", 80); return true; }
function HyperCacheScanDownload($urikey, $TargetFile, $ID, $FileType) { if (!isset($GLOBALS["SIZE_DOWNLOADED"])) { $GLOBALS["SIZE_DOWNLOADED"] = 0; } if (!isset($GLOBALS["FAILED_DOWNLOADED"])) { $GLOBALS["FAILED_DOWNLOADED"] = 0; } if (!is_numeric($GLOBALS["SIZE_DOWNLOADED"])) { $GLOBALS["SIZE_DOWNLOADED"] = 0; } if (!is_numeric($GLOBALS["FAILED_DOWNLOADED"])) { $GLOBALS["FAILED_DOWNLOADED"] = 0; } $curl = new ccurl($urikey); $FullTarGetPath = $GLOBALS["HyperCacheStoragePath"] . "/" . $TargetFile; $GLOBALS["HITS"]++; $parse_url = parse_url($urikey); $hostname = $parse_url["host"]; $OriginalFile = basename($parse_url["path"]); $t = time(); events("{downloading} {$OriginalFile} {from} {$hostname}", $ID, 3, __LINE__); if (!$curl->GetFile($FullTarGetPath)) { events("HyperCacheScanDownload:: Download failed with error {$curl->error}", $ID, 2, __LINE__); $GLOBALS["FAILED_DOWNLOADED"]++; return false; } $size = @filesize($FullTarGetPath); $MD5File = md5_file($FullTarGetPath); $sizeLog = FormatBytes($size / 1024); events("{$hostname}: {$OriginalFile} ({$sizeLog}) {took}: " . distanceOfTimeInWords($t, time()), $ID, 2, __LINE__); $GLOBALS["SIZE_DOWNLOADED"] = $GLOBALS["SIZE_DOWNLOADED"] + $size; $path = HyperCacheMD5File_get($MD5File); if ($path != null) { if (!HyperCacheRetranslation_set($urikey, $MD5File, $FileType, $path)) { $GLOBALS["FAILED_DOWNLOADED"]++; return; } return; } if (!HyperCacheMD5File_set($MD5File, $TargetFile, $FileType, $size, $OriginalFile)) { $GLOBALS["FAILED_DOWNLOADED"]++; return; } if (!HyperCacheRetranslation_set($urikey, $MD5File, $FileType, $TargetFile)) { $GLOBALS["FAILED_DOWNLOADED"]++; return; } return true; }
$t1 = time(); file_put_contents($pidfile, $pid); events(basename(__FILE__) . ": running {$pid}"); events_tail("running {$pid}"); if (!is_dir("/var/log/artica-postfix/dansguardian-stats4")) { @mkdir("/var/log/artica-postfix/dansguardian-stats4", 660, true); } if (!is_dir("/var/log/artica-postfix/dansguardian-stats4-failed")) { @mkdir("/var/log/artica-postfix/dansguardian-stats4-failed", 660, true); } ParseLogsNew(); //ParseLogs(); ParseSitesInfos(); PaseUdfdbGuard(); $t2 = time(); $distanceOfTimeInWords = distanceOfTimeInWords($t1, $t2); events(basename(__FILE__) . ": finish in {$distanceOfTimeInWords}"); $mem = round(memory_get_usage() / 1024 / 1000, 2); events_tail("finish in {$distanceOfTimeInWords} {$mem}MB"); die; function ParseLogs() { $count = 0; events_tail("dansguardian-stats:: parsing /var/log/artica-postfix/dansguardian-stats"); foreach (glob("/var/log/artica-postfix/dansguardian-stats/*.sql") as $file) { $q = new mysql_squid_builder(); usleep(20000); $count = $count + 1; $sql = @file_get_contents($file); if (trim($sql) == null) { @unlink("{$file}");
function container_list() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $search = '%'; $table = "squid_storelogs"; $page = 1; $ORDER = "ORDER BY ID DESC"; $sock = new sockets(); $t = $_GET["t"]; if (!$q->TABLE_EXISTS($table)) { $q->CheckTables(); } $total = 0; if ($q->COUNT_ROWS($table, $database) == 0) { $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); echo json_encode($data); return; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); if (!$q->ok) { json_error_show($q->mysql_error); } $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); if (!$q->ok) { json_error_show($q->mysql_error); } $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; if ($OnlyEnabled) { $limitSql = null; } $sql = "SELECT `ID`,`filename`,`fileext`,`filesize`,`Compressedsize`,`filetime` FROM `{$table}` WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error); } while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $events = " "; $md5 = md5(serialize($ligne) . $t); $span = "<span style='font-size:16px'>"; $delete = imgtootltip("delete-24.png", "{delete} {$ligne['ID']}", "LogsCsvDelte{$t}('{$ligne['ID']}','{$md5}')"); $jsEdit = "Loadjs('{$MyPage}?Rotate-js=yes&ID={$ligne['taskid']}&t={$t}');"; $jstask = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$jsEdit}\"\r\n\t\t style='font-size:16px;font-weight:bold;color:{$color};text-decoration:underline'>"; $jslloop = "Loadjs('{$MyPage}?log-js=yes&filename={$ligne['filename']}&t={$t}&ID={$ligne['ID']}');"; $view = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$jslloop}\"\r\n\t\t style='font-size:16px;font-weight:bold;color:{$color};text-decoration:underline'>"; if ($ligne["filesize"] > 1024) { $ligne["filesize"] = FormatBytes($ligne["filesize"] / 1024); } else { $ligne["filesize"] = $ligne["filesize"] . " Bytes"; } if ($ligne["Compressedsize"] > 1024) { $ligne["Compressedsize"] = FormatBytes($ligne["Compressedsize"] / 1024); } else { $ligne["Compressedsize"] = $ligne["Compressedsize"] . " Bytes"; } $time = strtotime($ligne['filetime']); $distance = distanceOfTimeInWords($time, time(), false); $img = "ext/unknown_small.gif"; if (is_file("img/ext/{$ligne["fileext"]}_small.gif")) { $img = "ext/{$ligne["fileext"]}_small.gif"; } $distance = $tpl->javascript_parse_text($distance); $data['rows'][] = array('id' => $md5, 'cell' => array("{$span}{$view}{$ligne['filetime']}</a></span>", "{$span}{$view}{$distance}</a></span>", "{$span}{$view}{$ligne["filename"]}</a></span>", "<img src='img/{$img}'>", "{$span}{$ligne["filesize"]}</a></span>", "{$span}{$ligne["Compressedsize"]}</a></span>", $delete)); } echo json_encode($data); }
function popup_connected_search() { $ocs = new ocs(); $sql = $ocs->COMPUTER_SEARCH_QUERY($_GET["connected-search"]); $CONFIG = $ocs->GET_SERVER_SETTINGS(); $PROLOG_FREQ = $CONFIG["PROLOG_FREQ"] * 60; $q = new mysql(); $results = $q->QUERY_SQL($sql, "ocsweb"); if (!$q->ok) { echo "<p> </p><p style='font-size:15px'>{$q->mysql_error}<hr>{$sql}</p>"; return; } $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:99%'>\n<thead class='thead'>\n<tr>\n\t\t<th colspan=2>{computer}</th>\n\t\t<th>{status}</th>\n\t\t<th>{ComputerMacAddress}</th>\n\t\t<th>{ip_address}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>\t"; while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { if ($ligne["IPADDRESS"] == "0.0.0.0") { continue; } if ($ligne["MACADDR"] == "00:00:00:00:00:00") { continue; } if ($already[$ligne["MACADDR"]]) { continue; } if ($already[$ligne["NAME"] . $ligne["IPSRC"]]) { continue; } $status = null; $already[$ligne["MACADDR"]] = true; $already[$ligne["NAME"] . $ligne["IPADDRESS"]] = true; $f = new computers(); $uid = $f->ComputerIDFromMAC($ligne["MACADDR"]); if (trim($uid) != null) { $already[$ligne["NAME"] . $ligne["IPSRC"]] = true; } $js = MEMBER_JS($uid, 1, 1); $last = distanceOfTimeInWords(strtotime($ligne["LASTCOME"]), time()); $mins = distanceMinStrings($ligne["LASTCOME"]); $js_text = "{$ligne["NAME"]}<hr>{last_com}:{$last}<hr>{$ligne["IPADDRESS"]}/{$ligne["MACADDR"]}"; if ($mins > $PROLOG_FREQ) { $js_text = "{$ligne["NAME"]}<hr><span color:#d32d2d>{last_com}:{$last}</span>"; $status = imgtootltip('ok32-grey.png', $js_text); } else { $status = imgtootltip('ok32.png', "{$ligne["IPADDRESS"]}/{$ligne["MACADDR"]}<br>{$last}"); } if ($uid == null) { $js = null; $status = imgtootltip("warning-panneau-32.png", "{ocs_computer_is_not_in_ldap}", "AddComputerFromOCS('{$ligne["MACADDR"]}')", null, md5($ligne["MACADDR"]) . time()); $js_text = "{ocs_computer_is_not_in_ldap}"; } else { } if (trim($ligne["IPADDRESS"]) != null) { if (trim($ligne["IPSRC"]) != null) { if (trim($ligne["IPSRC"]) != trim($ligne["IPADDRESS"])) { $ligne["IPSRC"] = $ligne["IPSRC"] . "/" . $ligne["IPADDRESS"]; } } else { $ligne["IPSRC"] = $ligne["IPADDRESS"]; } } if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%>" . imgtootltip("laptop-32.png", $js_text, $js) . "</td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["NAME"]}</code></td>\n\t\t\t<td width=1% align='center' valign='middle'>{$status}</td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["MACADDR"]}</code></td>\n\t\t\t<td style='font-size:14px'><code style='font-size:14px'>{$ligne["IPSRC"]}</code></td>\n\t\t</tr>\n\t\t\n\t\t"; } $html = $html . "</table>\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
function squid_frontend_status() { $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $TITLE_REQUESTS = null; $SquidCacheLevel = $sock->GET_INFO("SquidCacheLevel"); if (!is_numeric($SquidCacheLevel)) { $SquidCacheLevel = 4; } $LogsWarninStop = $sock->GET_INFO("LogsWarninStop"); if ($LogsWarninStop == 1) { echo FATAL_ERROR_SHOW_128("<div style='font-size:20px'>{squid_logs_urgency}</div>\n\t\t\t\t<div style='text-align:right;font-size:22px;text-align:right;text-decoration:underline;margin-top:20px'>\n\t\t\t\t\t<a href=\"javascript:Loadjs('system.log.emergency.php')\">{squid_logs_urgency_section}</a>\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t\t"); } $squid5mn = unserialize(base64_decode($sock->getFrameWork("squid.php?5mncounter=yes"))); //$realMemory=unserialize(base64_decode($sock->getFrameWork("services.php?realMemory=yes"))); $CounterInfos = unserialize(base64_decode($sock->getFrameWork("squid.php?CounterInfos=yes"))); $StorageCapacity = unserialize(base64_decode($sock->getFrameWork("squid.php?StorageCapacity=yes"))); $SquidMonitorParms = unserialize(base64_decode($sock->GET_INFO("SquidMonitorParms"))); $t = time(); $server_all_kbytes_in = $SquidMonitorParms["server_all_kbytes_in"]; $server_all_kbytes_out = $SquidMonitorParms["server_all_kbytes_out"]; $HttpRequests = $SquidMonitorParms["HttpRequests"]; $ActiveRequests = $SquidMonitorParms["ActiveRequests"]; $TITLE_USERS = null; $TITLE_COMPUTERS = null; $EnableKerbAuth = intval($sock->GET_INFO("EnableKerbAuth")); if ($EnableKerbAuth == 1) { include_once dirname(__FILE__) . "/ressources/class.external.ad.inc"; $ldap = new external_ad_search(); $NET_RPC_INFOS = $ldap->NET_RPC_INFOS(); $NumBerOfUsers = intval($NET_RPC_INFOS["Num users"]); if ($NumBerOfUsers > 0) { $TITLE_USERS = " | <a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:AnimateDiv('BodyContent');LoadAjax('BodyContent','squid.adker.php?tabs=yes');\" \n\t\t\tstyle='text-decoration:underline'>{$NumBerOfUsers} {members}</a>"; } } $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(MAC) as tcount FROM (SELECT MAC FROM UserAutDB GROUP BY MAC) as t")); $Nodes = $ligne["tcount"]; if ($Nodes > 0) { $TITLE_COMPUTERS = " | <a href=\"javascript:blur();\"\n\t\tOnClick=\"Loadjs('squid.computer-browse.php')\"\n\t\tstyle='text-decoration:underline'>{$Nodes} {computers}</a>"; } $CACHES_RATES = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/TOTAL_CACHED")); $TOTALS_NOT_CACHED = intval($CACHES_RATES["TOTALS_NOT_CACHED"]); $TOTALS_CACHED = intval($CACHES_RATES["TOTALS_CACHED"]); $TOTALS_DOWNLOAD = $TOTALS_NOT_CACHED + $TOTALS_CACHED; $TOTALS_NOT_CACHED = intval(@file_get_contents("/usr/share/artica-postfix/ressources/logs/stats/NOT_CACHED")); if ($TOTALS_NOT_CACHED > 0) { $TOTALS_NOT_CACHED_TEXT = " | <a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('admin.index.loadvg.squid.notcached-week.php');\"\n\t\tstyle='text-decoration:underline;font-weight:bold'>{not_cached_this_week}: " . FormatBytes($TOTALS_NOT_CACHED / 1024) . "</a>"; } $Status_cache = " | {downloaded} " . FormatBytes($TOTALS_DOWNLOAD / 1024) . " | {cached}:" . FormatBytes($TOTALS_CACHED / 1024) . $TOTALS_NOT_CACHED_TEXT; $RATE = $TOTALS_CACHED / $TOTALS_DOWNLOAD * 100; $RATE = round($RATE, 1); $TITLE_RATE = " | {cache_rate} <strong>{$RATE}%</strong>"; if (!is_numeric($server_all_kbytes_in)) { $server_all_kbytes_in = 1000; } if (!is_numeric($server_all_kbytes_out)) { $server_all_kbytes_out = 250; } if (!is_numeric($HttpRequests)) { $HttpRequests = 150; } if (!is_numeric($ActiveRequests)) { $ActiveRequests = 150; } if (!isset($squid5mn["cpu_usage"])) { $squid5mn["cpu_usage"] = 0; } $squid5mn["cpu_usage"] = round($squid5mn["cpu_usage"], 2); $squid5mn["client_http.requests"] = round($squid5mn["client_http.requests"], 2); $squid5mn["server.all.kbytes_in"] = round($squid5mn["server.all.kbytes_in"], 2); $squid5mn["server.all.kbytes_out"] = round($squid5mn["server.all.kbytes_out"], 2); $ActiveRequestsR = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/active_requests.inc")); $ActiveRequestsNumber = count($ActiveRequestsR["CON"]); $ActiveRequestsIpaddr = count($ActiveRequestsR["IPS"]); $ActiveRequestsMembers = count($ActiveRequestsR["USERS"]); if ($ActiveRequestsNumber > 0) { $TITLE_REQUESTS = " | <a href=\"javascript:blur();\"\n\t\tOnClick=\"Loadjs('squid.active.requests.php')\"\n\t\tstyle='text-decoration:underline'>{$ActiveRequestsNumber} {active_requests}</a>"; } if (!is_numeric($ActiveRequestsNumber)) { $ActiveRequestsNumber = 0; } if (!is_numeric($ActiveRequestsIpaddr)) { $ActiveRequestsIpaddr = 0; } if (!is_numeric($ActiveRequestsMembers)) { $ActiveRequestsMembers = 0; } $server_all_kbytes_in_text = $tpl->javascript_parse_text("{server_all_kbytes_in}"); $server_all_kbytes_out_text = $tpl->javascript_parse_text("{server_all_kbytes_out}"); $active_requests = $tpl->javascript_parse_text("{active_requests}"); $proxy_status = $tpl->javascript_parse_text("{proxy_status}"); $second = $tpl->javascript_parse_text("{second}"); $requests = $tpl->javascript_parse_text("{requests}"); $countStorages = count($StorageCapacity); for ($i = 0; $i < $countStorages; $i++) { $tS[] = "<div id='squid-s{$i}-{$t}' style='width:160px; height:100px'>"; $js[] = " var s{$i} = new JustGage({\n\t\tid: 'squid-s{$i}-{$t}',\n\t\tvalue: {$StorageCapacity[$i]},\n\t\tmin: 0,\n\t\tmax: 100,\n\t\ttitle: 'Storage Capacity Kid " . ($i + 1) . "',\n\t\tlabel: '%',\n\t\tlevelColorsGradient: true\n\t}); "; } $storages = CompileTr4($tS, true, null, true); $ini = new Bs_IniHandler(); $color = "black"; $ini->loadFile("/usr/share/artica-postfix/ressources/databases/ALL_SQUID_STATUS"); if ($ini->_params["SQUID"]["running"] == 0) { $color = "#d32d2d"; $status = "{stopped}"; } else { if ($ini->_params["SQUID"]["master_time"]) { $status2 = " {running} {since} " . distanceOfTimeInWords($ini->_params["SQUID"]["master_time"], time()); } } $version = @file_get_contents("/usr/share/artica-postfix/ressources/databases/SQUID.version"); if ($version != null) { $version = " v.{$version}"; } if ($SquidCacheLevel == 0) { $nocache = " <span style='color:#d32d2d'>{no_cached_sites_warn}</span>"; } $squi1_text = $tpl->javascript_parse_text("{monitor}"); $squi1_onmouse = "OnMouseOver=\"javascript:AffBulle('{$squi1_text}');this.style.cursor='pointer'\" OnMouseOut=\"javascript:HideBulle();this.style.cursor='default'\""; $squi1_onClick = "OnClick=\"javascript:Loadjs('squid.task.monitor.php')\""; echo $tpl->_ENGINE_parse_body("\n<table style='width:99%' >\n\t<tr>\n\t\t<td colspan=4 style='font-size:22px'>\n\t\t\t<a href=\"javascript:blur();\" \n\t\t\tOnClick=\"javascript:LoadAjax('BodyContent','squid.caches.status.php?tabs=yes')\" \n\t\t\tstyle='text-decoration:underline;color:{$color}'>{$proxy_status} {$status} {$version}</a>\n\t\t\t{$TITLE_RATE}{$TITLE_USERS}{$TITLE_REQUESTS}{$TITLE_COMPUTERS}\n\t\t\t<br>\n\t\t\t<div style='font-size:11px'><i>{$status2}{$nocache}{$Status_cache}</i></div>\n\t\t</td>\n\t</tr>\n\t<tr>\n\t\t\t<td valign='top' width=25%>\n\t\t\t\t<div id='squid-1-{$t}' style='width:160px; height:100px' {$squi1_onmouse} {$squi1_onClick}></div>\n\t\t\t\n\t\t\t</td>\n\t\t\t<td valign='top' width=25%><div id='squid-2-{$t}' style='width:170px; height:100px'></div></td>\n\t\t\t<td valign='top' width=25%><div id='squid-3-{$t}' style='width:170px; height:100px'></div></td>\n\t\t\t<td valign='top' width=25%><div id='squid-4-{$t}' style='width:170px; height:100px'></div></td>\n\t</tr>\n\t\n</table>{$storages}\n\t\t\t\n" . "<div style='text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjaxTiny('squid-front-end-status','{$page}?squid-front-end-status=yes');") . "</div>\n<script>\nvar g = new JustGage({\n\tid: 'squid-1-{$t}',\n\tvalue: {$squid5mn["cpu_usage"]},\n\tmin: 0.1,\n\tmax: 100,\n\ttitle: 'Proxy CPU Usage',\n\tlabel: '%',\n\tlevelColorsGradient: true\n});\n\t\nvar g2 = new JustGage({\n\tid: 'squid-2-{$t}',\n\tvalue: {$squid5mn["client_http.requests"]},\n\tmin: 0.1,\n\tmax: {$HttpRequests},\n\ttitle: 'HTTP {$requests}/{$second}',\n\tlabel: 'RQ/s',\n\tlevelColorsGradient: true\n});\n\nvar g3 = new JustGage({\n\tid: 'squid-3-{$t}',\n\tvalue: {$squid5mn["server.all.kbytes_in"]},\n\tmin: 0,\n\tmax: {$server_all_kbytes_in},\n\ttitle: '{$server_all_kbytes_in_text}',\n\tlabel: 'KB',\n\tlevelColorsGradient: true\n\t});\nvar g4 = new JustGage({\n\tid: 'squid-4-{$t}',\n\tvalue: {$squid5mn["server.all.kbytes_out"]},\n\tmin: 0,\n\tmax: {$server_all_kbytes_out},\n\ttitle: '{$server_all_kbytes_out_text}',\n\tlabel: 'KB',\n\tlevelColorsGradient: true\n});\n" . @implode("\n", $js) . "\nif(document.getElementById('squid-rttrqs-status')){\n\tLoadAjaxSilent('squid-rttrqs-status','admin.index.loadavg.squidrtt.php');\n}\n\n\t</script>\n\t"); }
function BuildHeader($sql_query, $html_file = "last-100-mails.html", $maxmail, $subtitle = null) { $date_start = time(); $q = new mysql(); $results = $q->QUERY_SQL($sql_query, "artica_events"); if (!$q->ok) { RTMevents("Wrong sql query {$q->mysql_error}"); return null; } $count = 0; while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $count = $count + 1; $tr = $tr . format_line($ligne); } if ($_GET["COUNT_MAILS"] == null) { $sql = "SELECT count(*) as tcount FROM smtp_logs"; $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $count_table = $ligne["tcount"]; $count_table = number_format($count_table, 0, ',', ' '); $_GET["COUNT_MAILS"] = $count_table; } else { $count_table = $_GET["COUNT_MAILS"]; } if ($subtitle == null) { $subtitle = "{all}"; } $date_end = time(); $calculate = distanceOfTimeInWords($date_start, $date_end); RTMevents("{$calculate}"); $html = "\n<table style='width:100%'>\n<tr>\n\t<td><H3 style='font-weight:bold;border-bottom:1px solid #CCCCCC;margin-bottom:4px;'>{last_mails} ({$maxmail})</H3>\n\t\t<p class=caption>{filter}:<strong>{$subtitle} ({$calculate})</strong> - {$count_table} eMails {total}</p>\n\t</td>\n\t<td>\n\t\t<table style='width:100%'>\n\t\t<td>\n\t\t" . postfixlogger_progress() . "</td>\n\t\t</tr>\n\t\t</table>\n\t</td>\n</tr>\n</table>\n\t<div style='width:100%;height:300px;overflow:auto'>\n\t<table style='width:100%'>\n\t{$tr}\n\t</table>\n</div>\n"; RTMevents("BuildHeader():: Saving usr/share/artica-postfix/ressources/logs/{$html_file} ({$count})"); file_put_contents("/usr/share/artica-postfix/ressources/logs/{$html_file}", $tr); file_put_contents("/usr/share/artica-postfix/ressources/logs/" . str_replace("-", ".", $html_file), $html); @chmod("/usr/share/artica-postfix/ressources/logs/{$html_file}", 0755); @chmod("/usr/share/artica-postfix/ressources/logs/" . str_replace("-", ".", $html_file), 0755); }
function backup_copy($source_path, $dest_path, $ID = null) { $date_start = time(); $cmd = str_replace("{SRC_PATH}", $source_path, $GLOBALS["COMMANDLINECOPY"]); $GLOBALS["MOUNTED_PATH_FINAL"] = trim($GLOBALS["MOUNTED_PATH_FINAL"]); writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] #########################################", __FUNCTION__, __FILE__, __LINE__); if ($GLOBALS["PCOPY"]) { writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] Protocol used is a local copy (PCOPY = TRUE) ", __FUNCTION__, __FILE__, __LINE__); } writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] Starting point {$GLOBALS["MOUNTED_PATH_FINAL"]}", __FUNCTION__, __FILE__, __LINE__); writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] command line={$cmd}", __FUNCTION__, __FILE__, __LINE__); if ($GLOBALS["MOUNTED_PATH_FINAL"] != null) { $dest_path = str_replace($GLOBALS["MOUNTED_PATH_FINAL"], "", $dest_path); writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] dest_path=\"{$dest_path}\"", __FUNCTION__, __FILE__, __LINE__); } $final_path = "{$GLOBALS["MOUNTED_PATH_FINAL"]}/{$dest_path}"; $final_path = str_replace('//', '/', $final_path); writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] final_path=\"{$final_path}\"", __FUNCTION__, __FILE__, __LINE__); $cmd = str_replace("{NEXT}", $final_path, $cmd); writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] Copy directory {$source_path} to \"{$final_path}\"", __FUNCTION__, __FILE__, __LINE__); if ($GLOBALS["PCOPY"]) { if (is_dir($source_path)) { writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] {$source_path} is a directory...", __FUNCTION__, __FILE__, __LINE__); if (!is_dir($final_path)) { writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] testing {$final_path} no such directory create it", __FUNCTION__, __FILE__, __LINE__); try { mkdir($final_path, 0755, true); } catch (Exception $e) { $IOERROR = $e->getMessage(); } if (!is_dir($final_path)) { backup_events($ID, "Copy", "ERROR,Dir {$final_path} {$IOERROR}", __LINE__); return false; } } } if (is_file($source_path)) { writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] {$source_path} is a file...", __FUNCTION__, __FILE__, __LINE__); } } writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] FINAL COMMAND WAS \"{$cmd}\"", __FUNCTION__, __FILE__, __LINE__); writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] EXECUTE....", __FUNCTION__, __FILE__, __LINE__); events("{$cmd}", __FUNCTION__, __LINE__); exec($cmd . " 2>&1", $results); writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] Returning an array of " . count($results) . " rows", __FUNCTION__, __FILE__, __LINE__); if (!check_rsync_error($ID, $results)) { events("check_rsync_error() !", __FUNCTION__, __LINE__); if ($ID > 0) { backup_events($ID, "Copy", "ERROR,{$cmd}", __LINE__); } } else { if ($ID > 0) { backup_events($ID, "Copy", "INFO,{$cmd}", __LINE__); } } $date_end = time(); $calculate = distanceOfTimeInWords($date_start, $date_end); events("INFO, time: {$calculate} ({$source_path})", __FUNCTION__, __LINE__); backup_events($ID, "Copy", "INFO, time: {$calculate} ({$source_path})", __LINE__); writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}] #########################################", __FUNCTION__, __FILE__, __LINE__); return @implode("\n", $results); }
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> </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; }
function execute() { $nice = EXEC_NICE(); if (is_file(dirname(__FILE__) . "/exec.sarg.gilou.php")) { events("Executing exec.sarg.gilou.php instead..."); shell_exec($nice . LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.sarg.gilou.php --exec"); return; } $sock = new sockets(); $SargOutputDir = $sock->GET_INFO("SargOutputDir"); if ($SargOutputDir == null) { $SargOutputDir = "/var/www/html/squid-reports"; } $nice = EXEC_NICE(); $unix = new unix(); $today = date("d/m/Y"); $sarg_bin = $unix->find_program("sarg"); if (!is_file($sarg_bin)) { sarg_admin_events("Fatal, unable to locate sarg binary, aborting...", __FUNCTION__, __FILE__, __LINE__, "sarg"); return; } events("Building settings.."); buildconf(); $usersauth = false; $squid = new squidbee(); if ($squid->LDAP_AUTH == 1) { $usersauth = true; } if ($squid->LDAP_EXTERNAL_AUTH == 1) { $usersauth = true; } if (!is_file("/etc/squid/exclude_codes")) { @file_put_contents("/etc/squid/exclude_codes", "\nNONE/400\n"); } @mkdir("{$SargOutputDir}", 0755, true); $u = " -i "; $cmd = "{$nice}{$sarg_bin} -d {$today}-{$today} {$u}-f /etc/squid3/sarg.conf -l /var/log/squid/access.log -o \"{$SargOutputDir}\" -x -z 2>&1"; $t1 = time(); echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, {$cmd}\n"; sargevents("execute(): {$cmd}"); exec($cmd, $results); while (list($index, $line) = each($results)) { if (preg_match("#SARG: No records found#", $line)) { events("No records found"); $subject_add = "(No records found)"; } if (preg_match("#SARG:\\s+.+?mixed records format#", $line)) { send_email_events("SARG: Error, squid was reloaded", "It seems that there is a mixed log file format detected in squid\n\t\t\tThis reason is Artica change squid log format from orginial to http access mode.\n\t\t\tIn this case, the log will be moved and squid will be reloaded \n\t\t\tin order to build a full log file with only one log format.\n\t\t\t\n" . @implode("\n", $results), "proxy"); shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.squid.php --reconfigure"); shell_exec($unix->LOCATE_SQUID_BIN() . " -k rotate"); shell_exec("/etc/init.d/auth-tail restart >/dev/null 2>&1"); shell_exec("/etc/init.d/cache-tail restart >/dev/null 2>&1"); return; } if (preg_match("#SARG:\\s+.+?enregistrements de plusieurs formats#", $line)) { send_email_events("SARG: Error, squid was reloaded", "It seems that there is a mixed log file format detected in squid\n\t\t\tThis reason is Artica change squid log format from orginial to http access mode.\n\t\t\tIn this case, the log will be moved and squid will be reloaded \n\t\t\tin order to build a full log file with only one log format.\n\t\t\t\n" . @implode("\n", $results), "proxy"); shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.squid.php --reconfigure"); shell_exec($unix->LOCATE_SQUID_BIN() . " -k rotate"); shell_exec("/etc/init.d/auth-tail restart >/dev/null 2>&1"); shell_exec("/etc/init.d/cache-tail restart >/dev/null 2>&1"); return; } if (preg_match("#SARG.+?Unknown input log file format#", $line)) { send_email_events("SARG: \"Unknown input log file format\", squid was reloaded", "It seems that there is a input log file format log file format detected in squid\n\t\t\tThis reason is Artica change squid log format from orginial to log_fqn on, this will be disabled\n\t\t\tIn this case, the log will be moved and squid will be reloaded \n\t\t\tin order to build a full log file with only one log format.\n\t\t\t\n" . @implode("\n", $results), "proxy"); shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.squid.php --reconfigure"); shell_exec($unix->LOCATE_SQUID_BIN() . " -k rotate"); shell_exec("/etc/init.d/auth-tail restart >/dev/null 2>&1"); shell_exec("/etc/init.d/cache-tail restart >/dev/null 2>&1"); return; } } $NICE = EXEC_NICE(); $unix = new unix(); $lighttpd_user = $unix->APACHE_SRC_ACCOUNT(); $php = $unix->LOCATE_PHP5_BIN(); $nohup = $unix->find_program("nohup"); echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, lighttpd user: {$lighttpd_user}\n"; $chown = $unix->find_program("chown"); echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]},{$chown} -R {$lighttpd_user}:{$lighttpd_user} {$SargOutputDir}/*\n"; exec("{$chown} -R {$lighttpd_user}:{$lighttpd_user} {$SargOutputDir}/* >/dev/null 2>&1", $results2); echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]},\n" . @implode("\n" . $results2) . "\n"; shell_exec("{$nohup} {$php} " . __FILE__ . " --backup >/dev/null 2>&1 &"); $t2 = time(); $distanceOfTimeInWords = distanceOfTimeInWords($t1, $t2); echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, {$distanceOfTimeInWords}\n"; events("Statistics generated ({$distanceOfTimeInWords})"); if ($GLOBALS["VERBOSE"]) { echo "SARG: Statistics generated ({$distanceOfTimeInWords})\n\n"; echo @implode("\n", $results) . "\n"; } status(true); sarg_admin_events("SARG: Statistics generated ({$distanceOfTimeInWords}) {$subject_add}", "Command line:\n-----------\n{$cmd}\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "sarg"); }
function blacklist_events() { $tpl = new templates(); $page = CurrentPageName(); $html = "<center style='width:100%;height:450px;overflow:auto'>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshTab('squid_main_blacklists')") . "</th>\n\t\t<th>{date}</th>\n\t\t<th>{events}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>"; $sql = "SELECT ID,zDate,`text` FROM events WHERE `text` LIKE '%BlacklistsDB%' ORDER BY zDate DESC LIMIT 0,100"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { echo "<H2>Fatal error {$sql} {$q->mysql_error}</H2>"; } $num = mysql_num_rows($results); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $color = "black"; if (preg_match("#BlacklistsDB\\]\\s+(.+)#", $ligne["text"], $re)) { $ligne["text"] = $re[1]; } $time = strtotime($ligne["zDate"]); $distanceOfTimeInWord = distanceOfTimeInWords($time, time()); $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1% colspan=2 nowrap style='font-size:14px;font-weight:bold;color:{$color}'>\t<a href=\"javascript:blur();\" OnClick=\"javascript:articaShowEvent({$ligne["ID"]});\"\n\t\t\t\tstyle='text-decoration:underline'>{$ligne["zDate"]}</a></td>\n\t\t\t<td style='font-size:13px;font-normal;color:{$color}'>\n\t\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:articaShowEvent({$ligne["ID"]});\">{$ligne["text"]}</A><div><i style='font-size:11px'>{$distanceOfTimeInWord}</i></div></td>\t\n\t\t</tr>"; } $html = $html . "</table>\n\t<script>\n\tfunction articaShowEvent(ID){\n\t\t YahooWin6('750','artica.events.php?ShowID='+ID,'EV::'+ID);\n\t}\n\n\t</script>\n\t\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function SendStatus() { emergency(true); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $sock = new sockets(); $EnableSargGenerator = $sock->GET_INFO("EnableSargGenerator"); if (TestsCron($pidfile)) { $ArticaMetaPingEnable = $sock->GET_INFO("ArticaMetaPingEnable"); events("SendPing={$ArticaMetaPingEnable}", __FUNCTION__, __FILE__, __LINE__); if ($ArticaMetaPingEnable == 1) { SendPing(); } return true; } $ArticaMetaEnabled = $sock->GET_INFO("ArticaMetaEnabled"); if ($ArticaMetaEnabled != 1) { return; } $t1 = time(); if (!is_file("/usr/share/artica-postfix/ressources/logs/global.status.ini")) { events("Unable to stat /usr/share/artica-postfix/ressources/logs/global.status.ini", __FUNCTION__, __FILE__, __LINE__); return null; } $unix = new unix(); $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { $ptime = $unix->PROCESS_TTL($pid); if ($ptime > $GLOBALS["MAXTTL"]) { events("killing process {$pid} ttl:{$ptime} minutes", __FUNCTION__, __FILE__, __LINE__); unix_system_kill_force($pid); } else { events("Already executed, process {$pid}", __FUNCTION__, __FILE__, __LINE__); die; } } events("Running pid " . getmypid(), __FUNCTION__, __FILE__, __LINE__); @file_put_contents($pidfile, getmypid()); CheckNetwork(); $http = new httpget(); $meta = new artica_meta(); $filecache = "/etc/artica-postfix/artica-meta-files.cache"; events("My uuid=\"{$meta->uuid}\"", __FUNCTION__, __FILE__, __LINE__); $memCache = "/usr/share/artica-postfix/ressources/logs/status.memory.hash"; $cpu_graphs = "/opt/artica/share/www/system/rrd/01cpu-1day.png"; $server_status = "/usr/share/artica-postfix/ressources/logs/status.right.1.html"; $squid_realtime = "/etc/artica-postfix/squid-realtime.cache"; $datasToSend = base64_encode(serialize($meta->GLOBAL_ARRAY)); $ini = new Bs_IniHandler(); $ini->loadFile("/usr/share/artica-postfix/ressources/logs/global.status.ini"); $ArrayFileCache = unserialize(@file_get_contents($filecache)); if (is_file($memCache)) { $MEM_CACHE = base64_encode(@file_get_contents($memCache)); } else { include_once "ressources/class.os.system.tools.inc"; $os = new os_system(); $os->html_Memory_usage(); $MEM_CACHE = base64_encode(serialize($os->meta_array)); } if (is_file($cpu_graphs)) { if ($ArrayFileCache["STATS_DAY"] != filemtime($cpu_graphs)) { $http->uploads["STATS_DAY"] = $cpu_graphs; $ArrayFileCache["STATS_DAY"] = filemtime($cpu_graphs); @file_put_contents($filecache, serialize($ArrayFileCache)); } } if (is_file($server_status)) { if ($ArrayFileCache["SERVER_STATUS"] != filemtime($server_status)) { $http->uploads["SERVER_STATUS"] = $server_status; $ArrayFileCache["SERVER_STATUS"] = filemtime($server_status); @file_put_contents($filecache, serialize($ArrayFileCache)); } } if (is_file($squid_realtime)) { if ($ArrayFileCache["SQUID_REALTIME"] != filemtime($squid_realtime)) { $http->uploads["SQUID_REALTIME"] = $squid_realtime; $ArrayFileCache["SQUID_REALTIME"] = filemtime($squid_realtime); @file_put_contents($filecache, serialize($ArrayFileCache)); } } if ($EnableSargGenerator == 1) { $push_sarg = false; $sock = new sockets(); $SargOutputDir = $sock->GET_INFO("SargOutputDir"); if ($SargOutputDir == null) { $SargOutputDir = "/var/www/html/squid-reports"; } if (is_file("{$SargOutputDir}/index.html")) { if (!is_file("/etc/artica-postfix/sarg.tgz")) { shell_exec("cd {$SargOutputDir} && tar -cjf /etc/artica-postfix/sarg.tgz ./*"); $push_sarg = true; } else { if ($ArrayFileCache["SQUID_SARG"] != filemtime("{$SargOutputDir}/index.html")) { @unlink("/etc/artica-postfix/sarg.tgz"); shell_exec("cd {$SargOutputDir} && tar -cjf /etc/artica-postfix/sarg.tgz ./*"); $push_sarg = true; } } if ($push_sarg) { $http->uploads["SQUID_SARG"] = "/etc/artica-postfix/sarg.tgz"; } } } $users = new usersMenus(); $status = base64_encode(serialize($ini->_params)); $pasmoinsaux = pasmoinsaux(); if ($users->VMWARE_HOST) { $VMWARE_HOST = 1; } else { $VMWARE_HOST = 0; } shell_exec(LOCATE_PHP5_BIN2() . " " . dirname(__FILE__) . "/exec.dmidecode.php"); $dmidecode = base64_encode(@file_get_contents("/etc/artica-postfix/dmidecode.cache")); //SQUID if ($users->SQUID_INSTALLED) { $sock = new sockets(); $SQUIDEnable = $sock->GET_INFO("SQUIDEnable"); if (!is_numeric($SQUIDEnable)) { $SQUIDEnable = 1; } if ($SQUIDEnable == 1) { $SQUID_CACHES = base64_encode(serialize($unix->squid_get_cache_infos())); } if (is_array($SQUID_CACHES)) { $squid = new squidbee(); $cacheconf = $squid->cache_list; $cacheconf[$squid->CACHE_PATH]["cache_type"] = $squid->CACHE_TYPE; $cacheconf[$squid->CACHE_PATH]["cache_size"] = $squid->CACHE_SIZE; $cacheconf[$squid->CACHE_PATH]["cache_dir_level1"] = 16; $cacheconf[$squid->CACHE_PATH]["cache_dir_level2"] = 256; events("Caches: " . count($cacheconf), __FILE__, __LINE__); $SQUID_CACHES_CONFIG = base64_encode(serialize($cacheconf)); } } if ($users->SAMBA_INSTALLED) { _CheckSambaConfig(); } if ($users->ZARAFA_INSTALLED) { if (is_file("/etc/artica-postfix/settings/Daemons/ZarafaLicenseInfos")) { $ZARAFA_LICENSE = @file_get_contents("/etc/artica-postfix/settings/Daemons/ZarafaLicenseInfos"); } else { $ZARAFA_LICENSE = "Free edition"; } } if (is_file("/etc/artica-postfix/zarafa-export.db")) { $ZARAFA_DB = @file_get_contents("/etc/artica-postfix/zarafa-export.db"); } $body = $http->send("{$meta->ArticaMetaHostname}/lic.status.server.php", "post", array("DATAS" => $datasToSend, "STATUS" => $status, "MEMORIES" => $MEM_CACHE, "VERSION" => $users->ARTICA_VERSION, "DISTRI" => $users->LinuxDistriCode, "UPTIME" => getUptime(), "DISTRINAME" => $users->LinuxDistriFullName, "MAIN_PRODUCTS" => base64_encode(serialize(array("ZARAFA" => $users->ZARAFA_INSTALLED, "POSTFIX" => $users->POSTFIX_INSTALLED, "SQUID" => $users->SQUID_INSTALLED, "SAMBA" => $users->SAMBA_INSTALLED, "CYRUS" => $users->cyrus_imapd_installed, "OPENVPN" => $users->OPENVPN_INSTALLED))), "PROCESSES" => base64_encode($pasmoinsaux), "TOP_PROCESSES" => top10cpumem(), "NETS" => Networks(), "VMWARE_HOST" => $VMWARE_HOST, "SETTINGS_INC" => base64_encode(serialize(settings_inc())), "LOCAL_VERSIONS" => LocalVersions(), "VBOXGUESTS" => VirtualBoxList(), "APTCHECK" => APTCHECK(), "DMIDECODE" => $dmidecode, "SQUID_CACHES" => $SQUID_CACHES, "SQUID_CACHES_CONFIG" => $SQUID_CACHES_CONFIG, "OPENPORTS" => OpenPorts($meta->serial, $meta->uuid), "OPENVPN_CLIENTS_STATUS" => @file_get_contents("/usr/share/artica-postfix/ressources/logs/openvpn-clients.status"), "ZARAFA_DB" => $ZARAFA_DB, "ZARAFA_LICENSE" => $ZARAFA_LICENSE)); $EXEC_NICE = EXEC_NICE(); if (is_file("/usr/bin/nohup")) { $nohup = "/usr/bin/nohup "; } if (preg_match("#NOTIFY_DISCONNECT#is", $body)) { events("NOTIFY_DISCONNECT detected -> unregister_server()", __FUNCTION__, __FILE__, __LINE__); unregister_server(); return; } if (preg_match("#NOTIFY_EXPORT_USERS#is", $body)) { events("NOTIFY_EXPORT_USERS -> {$nohup}{$EXEC_NICE}exec.artica.meta.users.php --export-all", __FUNCTION__, __FILE__, __LINE__); shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all >/dev/null 2>&1 &"); } if (preg_match("#NOTIFY_EXPORT_DOMAINS#is", $body)) { events("NOTIFY_EXPORT_DOMAINS -> {$nohup}{$EXEC_NICE}exec.artica.meta.users.php --export-all-domains", __FUNCTION__, __FILE__, __LINE__); shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-domains >/dev/null 2>&1 &"); } if (preg_match("#NOTIFY_EXPORT_OU#is", $body)) { events("NOTIFY_EXPORT_OU -> {$nohup}{$EXEC_NICE}exec.artica.meta.users.php --export-all-ou", __FUNCTION__, __FILE__, __LINE__); shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-ou >/dev/null 2>&1 &"); } if (preg_match("#NOTIFY_EXPORT_GROUPS#is", $body)) { events("NOTIFY_EXPORT_GROUPS -> {$nohup}{$EXEC_NICE}exec.artica.meta.users.php --export-all-groups", __FUNCTION__, __FILE__, __LINE__); shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-groups >/dev/null 2>&1 &"); } if (preg_match("#NOTIFY_EXPORT_SETTINGS#is", $body)) { $cmd = $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-settings >/dev/null 2>&1 &"; events("NOTIFY_EXPORT_SETTINGS -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } if (preg_match("#NOTIFY_EXPORT_COMPUTERS#is", $body)) { $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-computers >/dev/null 2>&1 &"; events("NOTIFY_EXPORT_SETTINGS -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } if (preg_match("#NOTIFY_EXPORT_DNS_ENTRIES#is", $body)) { $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-dns >/dev/null 2>&1 &"; events("NOTIFY_EXPORT_DNS_ENTRIES -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } if (preg_match("#NOTIFY_EXPORT_GROUPWARES#is", $body)) { $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-groupwares >/dev/null 2>&1 &"; events("NOTIFY_EXPORT_GROUPWARES -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } if (preg_match("#NOTIFY_EXPORT_FETCHMAIL_RULES#is", $body)) { $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-fetchmail-rules >/dev/null 2>&1 &"; events("NOTIFY_EXPORT_FETCHMAIL_RULES -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } if (preg_match("#<TASKS>(.+?)</TASKS>#is", $body, $re)) { events("Save tasks to /etc/artica-postfix/artica-meta.tasks", __FUNCTION__, __FILE__, __LINE__); @file_put_contents("/etc/artica-postfix/artica-meta.tasks", $re[1]); $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.tasks.php >/dev/null 2>&1 &"; events("TASKS ->{$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } else { events("No tasks ordered for me...", __FUNCTION__, __FILE__, __LINE__); @unlink("/etc/artica-postfix/artica-meta.tasks"); } if (preg_match("#<HOST_CONF>(.+?)</HOST_CONF>#is", $body, $re)) { ParseMyConf($re[1]); } else { events("No configuration for me...", __FUNCTION__, __FILE__, __LINE__); } shell_exec($nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --socks >/dev/null 2>&1 &"); if (users_queue()) { $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --user-queue >/dev/null 2>&1 &"; events("users settings queue is not empty -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } if (computer_queue()) { $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --computer-queue >/dev/null 2>&1 &"; events("computer settings queue is not empty -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } if ($users->OPENVPN_INSTALLED) { $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-openvpn-logs >/dev/null 2>&1 &"; events("OpenVpn is installed -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); } $time_iptables = file_time_min("/etc/artica-postfix/artica.meta.iptables.time"); if ($time_iptables > 180) { $cmd = $nohup . $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --iptables >/dev/null 2>&1 &"; events("iptables -> {$cmd}", __FUNCTION__, __FILE__, __LINE__); shell_exec($cmd); $cmd = $EXEC_NICE . LOCATE_PHP5_BIN() . " " . dirname(__FILE__) . "/exec.artica.meta.users.php --export-all-settings >/dev/null 2>&1 &"; events("{$cmd}", __FUNCTION__, __FILE__, __LINE__); @unlink("/etc/artica-postfix/artica.meta.iptables.time"); @file_put_contents("/etc/artica-postfix/artica.meta.iptables.time", "#"); } $t2 = time(); $time_duration = distanceOfTimeInWords($t1, $t2); events("Send status to {$meta->ArticaMetaHostname} DONE ({$time_duration})", __FUNCTION__, __FILE__, __LINE__); }
function events_table() { //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string',''); $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $search = '%'; $table = "exports"; $page = 1; $ORDER = "ORDER BY zDate DESC"; if ($q->COUNT_ROWS($table, "artica_events") == 0) { $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); echo json_encode($data); return; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = "*" . $_POST["query"] . "*"; $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("**", "*", $_POST["query"]); $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events")); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; if ($OnlyEnabled) { $limitSql = null; } $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql, "artica_events"); if (!$q->ok) { } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { $data['rows'][] = array('id' => $ligne[time() + 1], 'cell' => array($q->mysql_error, "", "", "")); $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", "")); echo json_encode($data); return; } //if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));} while ($ligne = mysql_fetch_assoc($results)) { $original_date = $ligne["zDate"]; $ligne["zDate"] = str_replace($tt, '{today}', $ligne["zDate"]); $original_date = $ligne["zDate"]; $ligne["zDate"] = str_replace($tt, '{today}', $ligne["zDate"]); $time = strtotime($original_date); $distanceOfTimeInWords = distanceOfTimeInWords($time, time()); $link = "<a href=\"javascript:blur();\" OnClick=\"javascript:ZoomExport({$ligne["ID"]})\"\n\t\tstyle='font-size:13px;text-decoration:underline'>"; if (trim($ligne["description"]) == null) { $link = null; } $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array($ligne["zDate"], "{$link}{$ligne["subject"]}</a><div style='font-size:11px'>{$distanceOfTimeInWords}</div>")); } echo json_encode($data); }
function WEBSITES_LIST() { $q = new mysql(); if (isset($_GET["remove-all"])) { $sql = "TRUNCATE TABLE `squid_speed`"; $q->QUERY_SQL($sql, "artica_backup"); } if (isset($_GET["defaults"])) { WEBSITES_DEFAULTS(); } $page = CurrentPageName(); $sql = "SELECT * FROM `squid_speed` WHERE `domain` IS NOT NULL"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "{$q->mysql_error}"; } $html = "\n\t\n\t<hr>\n\t<div class=explain>{refresh_pattern_intro}</div>\n\t<div style='text-align:right'>\n\t<table style='width:99%'>\n\t<tr>\n\t<td width=99%> </td>\n\t\n\t<td align='right' width=1%>" . imgtootltip("proxy-delete-32.png", "{delete_all} & {add_default_settings}", "LoadAjax('cached_sites_infos','squid.cached.sitesinfos.php?sites-list=yes&defaults=yes&remove-all=yes');") . "</td>\n\t<td align='right' width=1%>" . imgtootltip("filter-add-32.png", "{add_default_settings}", "LoadAjax('cached_sites_infos','squid.cached.sitesinfos.php?sites-list=yes&defaults=yes');") . "</td>\n\t<td align='right' width=1%>" . imgtootltip("website-add-32.png", "{add_new_cached_web_site}", "Loadjs('{$page}?AddCachedSitelist-js=yes')") . "</td>\n\t</tr>\n\t</div>\n\t<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n\t<thead class='thead'>\n\t<tr>\n\t\t<th>{website}</th>\n\t\t<th>{expire_time}</th>\n\t\t<th>%</th>\n\t\t<th>{limit}</th>\n\t\t<th> </th>\n\t</tr>\n</thead>\n<tbody class='tbody'>\t"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($classtr == "oddRow") { $classtr = null; } else { $classtr = "oddRow"; } $select = "Loadjs('{$page}?AddCachedSitelist-js=yes&id={$ligne["ID"]}');"; $ligne["refresh_pattern_min"] = $ligne["refresh_pattern_min"]; $ligne["refresh_pattern_min"] = distanceOfTimeInWords(0, $ligne["refresh_pattern_min"], true); $ligne["refresh_pattern_min"] = str_replace("about", "", $ligne["refresh_pattern_min"]); $ligne["refresh_pattern_max"] = $ligne["refresh_pattern_max"]; $ligne["refresh_pattern_max"] = distanceOfTimeInWords(0, $ligne["refresh_pattern_max"], true); $ligne["refresh_pattern_max"] = str_replace("about", "", $ligne["refresh_pattern_max"]); $link = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$select}\" style='font-size:12px;font-weight:bold;text-decoration:underline'>"; if (trim($ligne["domain"]) == '.') { $ligne["domain"] = "{all}"; } $html = $html . "\n\t\t\t<tr class={$classtr}>\n\t\t\t\t<td align='left' >{$link}{$ligne["domain"]}</a></td>\n\t\t\t\t<td width=1% nowrap>{$link}{$ligne["refresh_pattern_min"]}</a></td>\n\t\t\t\t<td width=1% align='right'>{$link}{$ligne["refresh_pattern_perc"]}%</a></td>\n\t\t\t\t<td width=1% nowrap>{$link}{$ligne["refresh_pattern_max"]}</a></td>\n\t\t\t\t<td width=1%>" . imgtootltip("delete-32.png", "{delete}", "Loadjs('{$page}?AddCachedSitelist-delete={$ligne["ID"]}')") . "</td>\n\t\t\t</tr>\n\t\t\t"; } $html = $html . "</table>\n\t\n\t\n\t"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); }
private function GET_CATEGORIES_DB($sitename) { $pagename = CurrentPageName(); $t = time(); $qz = new mysql_catz(); $this->cloudlogs("{$pagename}: mysql_catz -> {$sitename}"); $catz = $qz->GET_CATEGORIES($sitename); if ($GLOBALS["VERBOSE"]) { $took = distanceOfTimeInWords($t, time(), true); echo "qz->GET_CATEGORIES_DB({$sitename}) = {$catz} took {$took}<br>\n"; } if ($catz == null) { return; } if (!isset($GLOBALS["ARTICADB"])) { $GLOBALS["ARTICADB"] = 0; } $GLOBALS["ARTICADB"]++; $GLOBALS["CATZWHY"] = "INTERNAL-CATZ"; return trim($catz); }
function accounts_popup() { $ID = $_GET["ID"]; $t = $_GET["t"]; $tt = $_GET["tt"]; $userid = $_GET["userid"]; $t = time(); $services["RDP"] = "RDP"; $services["VNC"] = "VNC"; $page = CurrentPageName(); $tpl = new templates(); $btname = "{add}"; $q = new mysql_squid_builder(); if ($ID > 0) { $btname = "{apply}"; $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM rdpproxy_items WHERE ID='{$ID}'")); } if (!is_numeric($ligne["alive"])) { $ligne["alive"] = 720000; } if (!is_numeric($ligne["is_rec"])) { $ligne["is_rec"] = 0; } if (!is_numeric($ligne["serviceport"])) { $ligne["serviceport"] = 3389; } $distance = time() + $ligne["alive"]; $dis = distanceOfTimeInWords(time(), $distance, true); $html = "<div id='anim-{$t}'></div>\n\t<div style='width:98%' class=form>\n\t<table style='width:99%'>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{hostname}:</td>\n\t\t<td>" . Field_text("service-{$t}", $ligne["service"], "font-size:22px;width:430px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{type}:</td>\n\t\t<td>" . Field_array_Hash($services, "servicetype-{$t}", $ligne["servicetype"], "style:font-size:22px") . "</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{ipaddr}:</td>\n\t\t<td>" . Field_text("rhost-{$t}", $ligne["rhost"], "font-size:22px;width:430px") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{listen_port}:</td>\n\t\t<td>" . Field_text("serviceport-{$t}", $ligne["serviceport"], "font-size:22px;width:430px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{username}:</td>\n\t\t<td>" . Field_text("username-{$t}", $ligne["username"], "font-size:22px;width:430px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{domain}:</td>\n\t\t<td>" . Field_text("domain-{$t}", $ligne["domain"], "font-size:22px;width:430px") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{password}:</td>\n\t\t<td>" . Field_password("password-{$t}", $ligne["password"], "font-size:22px;width:430px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{alive}:</td>\n\t\t<td style='font-size:16px'>" . Field_text("alive-{$t}", $ligne["alive"], "font-size:22px;width:160px") . " {seconds}</td>\n\t</tr>\t\n\t<tr><td colspan=2 align='right'><span style='font-size:16px'><i>{$dis}</i></span></td></tr>\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{record_session}:</td>\n\t\t<td style='font-size:22px'>" . Field_checkbox_design("is_rec-{$t}", 1, $ligne["is_rec"]) . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td colspan=2 align=right><hr>" . button("{$btname}", "Save{$t}()", 30) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n<script>\nvar x_Save{$t}= function (obj) {\n\tvar ID='{$ID}';\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);document.getElementById('{$t}').innerHTML='';return;}\n\tif(document.getElementById('{$t}')){document.getElementById('{$t}').innerHTML='';}\n\tif(document.getElementById('anim-{$t}')){document.getElementById('anim-{$t}').innerHTML='';}\n\tif(ID==0){YahooWin3Hide();}\n\t\$('#flexRT{$_GET["t"]}').flexReload();\n\t\$('#flexRT{$_GET["tt"]}').flexReload();\n}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tvar is_rec=0;\n\tif( document.getElementById('is_rec-{$t}').checked){is_rec=1;}\n\tXHR.appendData('username', encodeURIComponent(document.getElementById('username-{$t}').value));\n\tXHR.appendData('password', encodeURIComponent(document.getElementById('password-{$t}').value));\n\tXHR.appendData('rhost', encodeURIComponent(document.getElementById('rhost-{$t}').value));\n\tXHR.appendData('serviceport', encodeURIComponent(document.getElementById('serviceport-{$t}').value));\n\tXHR.appendData('username', encodeURIComponent(document.getElementById('username-{$t}').value));\n\tXHR.appendData('domain', encodeURIComponent(document.getElementById('domain-{$t}').value));\n\tXHR.appendData('service', encodeURIComponent(document.getElementById('service-{$t}').value));\n\tXHR.appendData('servicetype', encodeURIComponent(document.getElementById('servicetype-{$t}').value));\n\t\n\t\n\tXHR.appendData('alive', encodeURIComponent(document.getElementById('alive-{$t}').value));\n\tXHR.appendData('ID', '{$ID}');\n\tXHR.appendData('userid', '{$userid}');\n\tXHR.appendData('is_rec', is_rec);\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',x_Save{$t});\n}\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function status() { $tpl = new templates(); $page = CurrentPageName(); $users = new usersMenus(); $sock = new sockets(); if (!$users->ARTICADB_INSTALLED) { $html = FATAL_ERROR_SHOW_128("{ARTICADB_NOT_INSTALLED_EXPLAIN}") . "<center style='margin:80px'>\n\t\t<hr>" . button("{install_now}", "Loadjs('squid.blacklist.upd.php')", 16) . "</center>"; echo $tpl->_ENGINE_parse_body($html); return; } $date = $sock->getFrameWork("squid.php?articadb-version=yes"); $q = new mysql_catz(); $sock = new sockets(); $ini = new Bs_IniHandler(); $catz = $q->LIST_TABLES_CATEGORIES(); $ini->loadString(base64_decode($sock->getFrameWork('cmd.php?squid-ini-status=yes'))); $APP_ARTICADB = DAEMON_STATUS_ROUND("APP_ARTICADB", $ini, null, 1); $APP_SQUID_DB = DAEMON_STATUS_ROUND("APP_SQUID_DB", $ini, null, 1); $sql = "SHOW VARIABLES LIKE '%version%';"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}</p>"; } else { while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { if ($ligne["Variable_name"] == "slave_type_conversions") { continue; } $tt[] = "\t<tr>\n\t\t\t<td colspan=2><div style='font-size:14px'>{{$ligne["Variable_name"]}}: {$ligne["Value"]}</a></div></td>\n\t\t\t</tr>"; } } $arrayV = unserialize(base64_decode($sock->getFrameWork("squid.php?articadb-nextversion=yes"))); $REMOTE_VERSION = $arrayV["TIME"]; if ($REMOTE_VERSION > $date) { $updaebutton = "<div style='text-align:right'><hr>" . button("{update}:{version} {$REMOTE_VERSION} ", "Loadjs('squid.blacklist.upd.php')", 16) . "</div>"; } $nextcheck = $sock->getFrameWork("squid.php?articadb-nextcheck=yes"); $nextcheck = intval($nextcheck); if ($nextcheck > 0) { $nextcheck_text = "\n\t\t\t<tr>\n\t\t\t<td colspan=2><div style='font-size:16px'>{next_check_in}: {$nextcheck}Mn</div></td>\n\t\t\t</tr>"; } if ($nextcheck < 0) { $nextcheck = str_replace("-", "", $nextcheck); $nextcheckTime = time() - intval($nextcheck) * 60; $nextcheckTimeText = distanceOfTimeInWords($nextcheckTime, time()); $nextcheck_text = "\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=2><div style='font-size:16px'>{last_check}: {$nextcheckTimeText}</div></td>\n\t\t\t\t\t</tr>"; } $dbsize = $sock->getFrameWork("squid.php?articadbsize=yes"); $items = numberFormat($q->COUNT_CATEGORIES(), 0, "", " "); $html = "\n\t\t\t\t<table style='width:100%' class=TableRemove>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width=130px' ><img src='img/spider-database-128.png'></td>\n\t\t\t\t\t<td valign='top'>\n\t\t\t\t<table style='width:99%'>\n\t\t\t\t<tr>\n\t\t\t\t<td valign='top' style='width:320px'>{$APP_ARTICADB}{$APP_SQUID_DB}</td>\n\t\t\t\t<td valign='top' style='padding-left:10px'>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t<tbody>\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=2><div style='font-size:16px'>{pattern_database_version}: {$date} ({$dbsize})</div></td>\n\t\t\t\t</tr>\n\t\t\t\t{$nextcheck_text}\n\t\t\t\t<tr>\n\t\t\t\t<td colspan=2><div style='font-size:16px'>{categories}: <strong>" . count($catz) . "</strong></a></div></td>\n\t\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=2><div style='font-size:16px'>{categorized_websites}: <strong>{$items}</strong> </div></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=2><div style='font-size:16px;font-weight:bold;margin-top:10px'>{mysql_engine}:</div></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t" . @implode("", $tt) . "\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t{$updaebutton}\n\t\t</td>\n\t\t</tr>\n\t\t</table>\n\t\t"; echo $tpl->_ENGINE_parse_body($html); }