function tabs() { $boot = new boostrap_form(); $page = CurrentPageName(); $tpl = new templates(); if (!is_numeric($_GET["xtime"])) { $_GET["xtime"] = strtotime("{$_GET["year"]}-{$_GET["month"]}-{$_GET["day"]} 00:00:00"); } $dateT = time_to_date($_GET["xtime"]); if (isset($_GET["xtime"])) { $_GET["year"] = date("Y", $_GET["xtime"]); $_GET["month"] = date("m", $_GET["xtime"]); $_GET["day"] = date("d", $_GET["xtime"]); $_GET["tablename"] = date("Ymd", $_GET["xtime"]) . "_members"; } $q = new mysql_squid_builder(); if (!$q->TABLE_EXISTS($_GET["tablename"])) { senderror("{table_does_not_exists} {$_GET["tablename"]} {use_the_tools_section}"); } $t = $_GET["t"]; $display_members_for_this_day = $tpl->javascript_parse_text("{$dateT}: {display_members_for_this_day}"); $subtitle = "<a href=\"javascript:blur();\" OnClick=\"Loadjs(\\'miniadm.webstats.php?calendar-js=yes&div=tab-{$t}&prefix=tabs=yes&t={$t}&source-page={$page}\\')\">{$display_members_for_this_day}</a>"; $title = "<script>\n\t\t\tdocument.getElementById('MembersSubtitlePage').innerHTML='{$subtitle}';\n\t\t</script>"; if (isset($_GET["title"])) { $title = "<H3>{$display_members_for_this_day}</H3>"; } $array["{uid}"] = "{$page}?webstats-middle=yes&t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}&tablename={$_GET["tablename"]}&xtime={$_GET["xtime"]}&FILTER=uid');"; $array["{ipaddr}"] = "{$page}?webstats-middle=yes&t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}&tablename={$_GET["tablename"]}&xtime={$_GET["xtime"]}&FILTER=client');"; $array["{MAC}"] = "{$page}?webstats-middle=yes&t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}&tablename={$_GET["tablename"]}&xtime={$_GET["xtime"]}&FILTER=MAC');"; $array["{hostname}"] = "{$page}?webstats-middle=yes&t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}&tablename={$_GET["tablename"]}&xtime={$_GET["xtime"]}&FILTER=hostname');"; echo $title . $boot->build_tab($array); }
function members_table_js() { header("content-type: application/x-javascript"); $tpl = new templates(); $page = CurrentPageName(); $xtime = $_GET["members-table-js"]; $day = time_to_date($xtime); $ask = $tpl->javascript_parse_text("{squidstats_gen_members_table} {$day} ?"); $t = time(); $html = "\n\tvar xf{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>2){alert(results);return;}\n\t\t }\t\t\n\n\t\n\t\tfunction f{$t}(){\n\t\t\tif(!confirm('{$ask}')){return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('members-table-perform','{$xtime}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xf{$t});\n\t\t}\n\t\t\t\n\t\tf{$t}();\t\n\t"; echo $html; }
function tabs() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $title = $tpl->_ENGINE_parse_body("{member}:{$_GET["uid"]}, {category} {$_GET["category"]}, " . time_to_date($_GET["xtime"])); $_GET["uid"] = urlencode($_GET["uid"]); $fsite = urlencode($_GET["category"]); $array["{graphs}"] = "{$page}?www-graĥs=yes&category={$fsite}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; $array["{values}"] = "{$page}?www-table=yes&category={$fsite}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; echo "<H3>{$title}</H3>" . $boot->build_tab($array); }
function tabs() { $page = CurrentPageName(); $boot = new boostrap_form(); $tpl = new templates(); $title = time_to_date($_GET["xtime"]) . ": {websites} «{not_categorized}»"; $array["{websites}"] = "{$page}?section=yes&groupby=sitename&xtime={$_GET["xtime"]}"; $array["{familysites}"] = "{$page}?section=yes&groupby=familysite&xtime={$_GET["xtime"]}"; $array["{status}"] = "{$page}?status=yes&groupby=familysite&xtime={$_GET["xtime"]}"; $array["{events}"] = "{$page}?events=yes&groupby=familysite&xtime={$_GET["xtime"]}"; $title = $tpl->_ENGINE_parse_body("<h4>{$title}</H4>\n\t<div class=text-info>{not_categorized_day_explain}</div>"); echo "\n\t{$title}\n\t" . $boot->build_tab($array); }
function tabs() { //$table=date("Ymd",$_GET["xtime"])."_hour"; $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $title = $tpl->_ENGINE_parse_body("{$date} {member}: {$_GET["uid"]} {website} {$_GET["familysite"]}"); $suffix = suffix(); $array["{flow}"] = "{$page}?flow-graĥs=yes{$suffix}"; $array["{websites}"] = "{$page}?websites-section=yes{$suffix}"; echo "<H3>" . $title . "</H3>" . $boot->build_tab($array); }
function tabs() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $dateT = $tpl->javascript_parse_text("{$date} {$_GET["hour"]}H"); $title = $tpl->_ENGINE_parse_body("{member}:{$_GET["uid"]}, {$dateT}"); $_GET["uid"] = urlencode($_GET["uid"]); $array["{websites}"] = "{$page}?www-graĥs=yes&hour={$_GET["hour"]}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; $array["{categories}"] = "{$page}?www-categories=yes&hour={$_GET["hour"]}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; $array["{websites} {values}"] = "{$page}?www-requests=yes&hour={$_GET["hour"]}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; echo "<H3>" . $title . "</H3>" . $boot->build_tab($array); }
function tabs() { call_user_func(BECALL); $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $title = $tpl->_ENGINE_parse_body("{member}:{$_GET["uid"]}, {videos}: {$date}"); $_GET["uid"] = urlencode($_GET["uid"]); $fsite = urlencode($_GET["familysite"]); $array["{graphs}"] = "{$page}?www-graĥs=yes&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; $array["{videos}"] = "{$page}?www-table=yes&familysite={$fsite}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; echo "<H3>" . $title . "</H3>" . $boot->build_tab($array); }
function tabs() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $title = $tpl->_ENGINE_parse_body("{member}:{$_GET["uid"]}, {website}:{$_GET["familysite"]} {$date}"); $_GET["uid"] = urlencode($_GET["uid"]); $fsite = urlencode($_GET["familysite"]); $array["{graphs}"] = "{$page}?www-graĥs=yes&familysite={$fsite}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; $array["{websites}"] = "{$page}?www-table=yes&familysite={$fsite}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; $array["{requests}"] = "{$page}?www-requests=yes&familysite={$fsite}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; $array[$_GET["familysite"]] = "miniadm.webstats.website.infos.php?familysite={$fsite}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; echo "<H3>" . $title . "</H3>" . $boot->build_tab($array); }
function content() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $month = $_GET["month"]; $day = $_GET["day"]; if (strlen($day) == 1) { $day = "0{$day}"; } $year = $_GET["year"]; $xtime = strtotime("{$year}-{$month}-{$day} 00:00:00"); $title = time_to_date($xtime); $jsadd = "LoadAjax('statistics-{$t}','{$page}?webstats-stats=yes&t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}&week={$_GET["week"]}');"; $html = "\n\t<div class=BodyContent>\n\t\t<div style='font-size:14px'><a href=\"miniadm.index.php\">{myaccount}</a>\n\t\t » <a href=\"miniadm.webstats-start.php?t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}\">{web_statistics}</a>\n\t\t » <a href='miniadm.webstats.Bydays.php'>{statistics_by_date}</a>\n\t\t » {$title}\n\t\t</div>\n\t\t<H1 id='TitleOfMainPage'>{$title}</H1>\n\t\t<p>{statistics_by_date_text}</p>\n\t\t<div id='statistics-{$t}'></div>\n\t</div>\t\n\t<p>\n\t<div id='webstats-left'></div>\n\t</p>\n\t<script>\n\t\tLoadAjax('webstats-left','{$page}?tabs=yes&t={$t}&year={$_GET["year"]}&month={$_GET["month"]}&day={$_GET["day"]}&week={$_GET["week"]}&xtime={$xtime}');\n\t\t\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function list_nets() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql(); $t = $_GET["t"]; $search = '%'; $table = "dhcpd_leases"; $database = 'artica_backup'; $page = 1; $FORCE_FILTER = ""; $ORDER = "ORDER BY hostname"; if (!$q->TABLE_EXISTS($table, $database)) { throw new Exception("{$table}, No such table...", 500); } if ($q->COUNT_ROWS($table, 'artica_backup') == 0) { throw new Exception("No data...", 500); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $searchstring = string_to_flexquery("search-records"); $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql, 'artica_backup'); if (!$q->ok) { senderror($q->mysql_error); } if (mysql_num_rows($results) == 0) { senderror("no data"); } $sock = new sockets(); $cmp = new computers(); $boot = new boostrap_form(); while ($ligne = mysql_fetch_assoc($results)) { $id = md5(serialize($ligne)); $ligne["hostname"] = trim($ligne["hostname"]); if ($ligne["mac"] == null) { continue; } $ligne["starts"] = time_to_date(strtotime($ligne["starts"]), true); $ligne["ends"] = time_to_date(strtotime($ligne["ends"]), true); $ligne["cltt"] = time_to_date(strtotime($ligne["cltt"]), true); $ligne["tstp"] = time_to_date(strtotime($ligne["tstp"]), true); $tooltip = "<ul style=font-size:11px><li>start {$ligne["starts"]}</li>\n\t\t<li>cltt:{$ligne["cltt"]}</li> \n\t\t<li>tstp:{$ligne["tstp"]}</li></ul>"; $js = "zBlur();"; $href = null; $uid = null; $uid = $cmp->ComputerIDFromMAC($ligne["mac"]); if ($uid != null) { $js = MEMBER_JS($uid, 1, 1); $href = "<a href=\"javascript:blur()\" OnClick=\"javascript:{$js}\" style='font-size:12px;text-decoration:underline'>"; $uid = "<div style='font-size:12px'><i>({$uid})</i></div>"; } if ($ligne["hostname"] == null) { $ligne["hostname"] = " "; } if ($ligne["ipaddr"] == null) { $ligne["ipaddr"] = " "; } if ($ligne["mac"] == null) { $ligne["mac"] = " "; } $link = $boot->trswitch($js); $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$link}><i class='icon-globe'></i> {$ligne["hostname"]}</a>{$uid}{$tooltip}</td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i> {$ligne["ipaddr"]}</td>\n\t\t<td {$link} nowrap><i class='icon-star'></i> {$ligne["mac"]}</td>\n\t\t<td {$link} nowrap><i class='icon-time'></i> {$ligne["starts"]}</td>\n\t\t<td {$link} nowrap><i class='icon-time'></i> {$ligne["ends"]}</td>\n\t\t\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{hostname}</th>\n\t\t\t\t\t<th>{ipaddr}</th>\n\t\t\t\t\t<th>{ComputerMacAddress}</th>\n\t\t\t\t\t<th>Starts</th>\n\t\t\t\t\t<th>END</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t\t</table>\n\t\t\t\t"; }
function table_sites_search() { $t = $_GET["t"]; $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $users = new usersMenus(); $sock = new sockets(); $boot = new boostrap_form(); $database = "squidlogs"; $search = '%'; $table = "generic_categories"; $rp = 250; $page = 1; $FORCE_FILTER = null; $ORDER = "ORDER BY size DESC"; if (!$q->TABLE_EXISTS($table, $database)) { senderror("{$table} doesn't exists..."); } if ($q->COUNT_ROWS($table, $database) == 0) { senderror("No data"); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $search = string_to_flexquery("category-search"); if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $category = mysql_escape_string2($_GET["category"]); $sql = "SELECT SUM( size ) AS size,SUM(hits) as hits, zDate, category FROM generic_categories GROUP BY category,zDate\n\tHAVING category='{$_GET["category"]}' ORDER BY zDate"; $results = $q->QUERY_SQL($sql); $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { senderror($q->mysql_error . "<br>{$sql}"); } while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " "); $ligne["size"] = FormatBytes($ligne["size"] / 1024); $xtime = strtotime($ligne["zDate"] . " 00:00:00"); $dateText = time_to_date($xtime); $catz = urlencode($_GET["category"]); $jsSitename = $boot->trswitch("Loadjs('miniadm.webstats.websites.ByDayByCategory.php?category={$catz}&xtime={$xtime}')"); $tr[] = "\n\t\t\t\t<tr {$jsSitename}>\n\t\t\t\t\t<td><i class='icon-time'></i> {$dateText}</a></td>\n\t\t\t\t\t<td><i class='icon-info-sign'></i> {$ligne["size"]}</td>\n\t\t\t\t\t<td><i class='icon-info-sign'></i> {$ligne["hits"]}</td>\n\t\t\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{day}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function webstats_middle() { $page = CurrentPageName(); $tpl = new templates(); $t = $_GET["t"]; $ff = time(); $boot = new boostrap_form(); call_user_func(BECALL); $title = null; $suffix = suffix(); if (isset($_GET["title"])) { $dateT = time_to_date($_GET["xtime"]); $title = $tpl->_ENGINE_parse_body("<H4>«{$dateT}» {youtube_videos}</H4>\n\t\t<p>{display_youtube_for_this_day}</p>"); } $_GET["uid"] = urlencode($_GET["uid"]); $fsite = urlencode($_GET["familysite"]); $array["{graphs}"] = "{$page}?www-graĥs=yes{$suffix}"; $array["{videos}"] = "{$page}?www-table=yes{$suffix}"; $array["{hits}"] = "{$page}?www-hits=yes{$suffix}"; echo $title . $boot->build_tab($array); }
function logs() { $MyPage = CurrentPageName(); $sock = new sockets(); $logfile = "/usr/share/artica-postfix/ressources/logs/web/cyrus.log"; $searchstring = urlencode(string_to_flexregex()); if (!isset($_POST["rp"])) { $_POST["rp"] = 100; } $sock->getFrameWork("cyrus.php?cyrus-events=yes&rp={$_POST["rp"]}&search={$searchstring}"); $tpl = new templates(); $results = explode("\n", @file_get_contents($logfile)); @unlink($logfile); if (count($results) == 0) { json_error_show("no data"); } $data = array(); $data['page'] = 1; $data['total'] = count($results); $data['rows'] = array(); $q = new mysql_squid_builder(); krsort($results); $c = 0; while (list($num, $line) = each($results)) { $line = trim($line); if ($line == null) { continue; } $color = "black"; if ($GLOBALS["VERBOSE"]) { echo "{$line}<hr>"; } if (preg_match("#(.*?)\\s+([0-9]+)\\s+([0-9\\:]+)\\s+.*?cyrus\\/(.*?)\\[.*?\\]:\\s+(.*)#", $line, $re)) { $date = strtotime("{$re[1]} {$re[2]} {$re[3]}"); $datetext = time_to_date($date, true); if ($GLOBALS["VERBOSE"]) { print_r($re); } $service = $re[4]; $line = trim($re[5]); } if ($GLOBALS["VERBOSE"]) { echo "{$line}<hr>"; } $mkey = md5($line); $c++; $data['rows'][] = array('id' => "{$mkey}", 'cell' => array("<span style='font-size:12px;font-weight:normal;color:{$color}'>{$datetext}</span>", "<span style='font-size:12px;font-weight:normal;color:{$color}'>{$service}</span>", "<span style='font-size:12px;font-weight:normal;color:{$color}'>{$line}</center>")); } if (count($c) == 0) { json_error_show("no data"); } echo json_encode($data); }
function search_websites() { $q = new mysql_squid_builder(); $tpl = new templates(); $searchstring = string_to_flexquery("search-websites"); $Params = url_decode_special_tool($_GET["Params"]); $table = "notcategorized"; $boot = new boostrap_form(); $ORDER = $boot->TableOrder(array("hits" => "DESC")); $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,30"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<hr><code>{$sql}</code></p>"; } while ($ligne = mysql_fetch_assoc($results)) { $id = md5($ligne["sitename"]); $ligne["size"] = FormatBytes($ligne["size"] / 1024); $ligne["hits"] = FormatNumber($ligne["hits"]); $dates = unserialize($ligne["seen"]); $trg = array(); if (is_array($dates)) { while (list($none, $xtime) = each($dates)) { $trg[] = time_to_date($xtime); } } $params = BuildDiv($ligne["sitename"]); $link = $boot->trswitch($params[2]); $content = $params[0]; $js[] = $params[1]; $tr[] = "\n\t<tr id='{$id}'>\n\t<td {$link}><i class='icon-globe'></i> {$ligne["sitename"]}{$content}<br><i style='font-size:10px'>" . @implode(", ", $trg) . "</td>\n\t<td {$link} nowrap><i class='icon-globe'></i> {$ligne["familysite"]}</td>\n\t<td {$link} nowrap><i class='icon-globe'></i> {$ligne["country"]}</td>\n\t<td {$link} nowrap><i class='icon-globe'></i> {$ligne["size"]}</td>\n\t<td {$link} nowrap><i class='icon-star'></i> {$ligne["hits"]}</td>\n\t</tr>"; } echo $boot->TableCompile(array("sitename" => "{website}", "familysite" => "{familysite}", "country" => "{country}", "size" => "{size}", "hits" => "{hits}"), $tr) . "\n\t\t\t<script>" . @implode("\n", $js) . "</script>\t\n\t\t\t\t\t\n\t\t\t"; }
function tabs() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $q = new mysql_squid_builder(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $dateT = $tpl->javascript_parse_text("{$date} {$_GET["hour"]}H"); $sitename = $_GET["sitename"]; $familysite = $q->GetFamilySites($sitename); $sitenameenc = urlencode($sitename); $title = $tpl->_ENGINE_parse_body("{member}:{$_GET["uid"]}, {$dateT} «{$sitename}»"); $_GET["uid"] = urlencode($_GET["uid"]); $array["{requests}"] = "{$page}?www-requests=yes&sitename={$sitenameenc}&hour={$_GET["hour"]}&uid={$_GET["uid"]}&xtime={$_GET["xtime"]}"; $array[$familysite] = "miniadm.webstats.website.infos.php?familysite={$familysite}"; echo "<H3>" . $title . "</H3>" . $boot->build_tab($array); }
function generate_graph() { include_once 'ressources/class.artica.graphs.inc'; $q = new mysql_squid_builder(); $page = CurrentPageName(); $tpl = new templates(); $t = $_GET["t"]; $ff = time(); $boot = new boostrap_form(); $sql = "SELECT zDate,not_categorized FROM tables_day WHERE not_categorized>0"; $c = 0; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>"; } if (mysql_num_rows($results) > 0) { $nb_events = mysql_num_rows($results); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $xdata[] = $ligne["zDate"]; $ydata[] = $ligne["not_categorized"]; $c++; $timeDate = strtotime($ligne["zDate"] . " 00:00:00"); $timeText = time_to_date($timeDate); $js = $boot->trswitch("Loadjs('squid.visited.php?day={$ligne["zDate"]}&onlyNot=yes')"); $jsrecat = $boot->trswitch("Loadjs('squid.visited.php?recategorize-day-js={$ligne["zDate"]}&href={$page}')"); $BIGTABLE[] = "\n\t\t<tr>\n\t\t\t<td {$js}>{$timeText}</td>\n\t\t\t<td {$js}><strong style='font-size:18px'>{$ligne["not_categorized"]}</strong></td>\n\t\t\t<td {$jsrecat} width=1% nowrap><img src='img/loupe-32.png'></td>\n\t\t</tr>\n\t\t"; } $Main = array($xdata, $ydata); $Main = urlencode(base64_encode(serialize($Main))); $t = time(); echo "<center>\n\t\t\t<div style='font-size:18px;margin-bottom:10px'>" . $tpl->_ENGINE_parse_body("{not_categorized}/{days}") . "</div>\n\t\t\t<div id='{$ff}-graph' style='width:940px;height:450px'><center><img src='img/wait_verybig_mini_red.gif'></center></div>\n\t\t\t</center>"; } $BIGTABLE_COMPILED = $tpl->_ENGINE_parse_body("\n\t\t<table class='table table-bordered table-hover'>\n\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{date}</th>\n\t\t\t\t\t<th colspan=2>{websites}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $BIGTABLE) . "</tbody></table>"; echo "<center>\n\t\t<div style='margin:8px;float-right;width:100%'>" . $tpl->_ENGINE_parse_body(button("{analyze}", "NoCategorizedAnalyze()", 18)) . "</div>\n\t\t</center>\n\t\t{$BIGTABLE_COMPILED}\n\t\n\t\t<script>\n\t\tfunction NoCategorizedAnalyze(){\n\t\t\n\t\t}\n\t\t\n\tvar x_NoCategorizedAnalyze= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t \twindow.location.href = '{$page}';\n\t\t}\t\n\n\t\tfunction NoCategorizedAnalyze(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('NoCategorizedAnalyze','yes');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_NoCategorizedAnalyze);\n\t\t}\n\t\t\n\t\tLoadjs('{$page}?graphjs=yes&container={$ff}-graph&data={$Main}');\n\t\t\n\t</script>"; }
function tabs() { $page = CurrentPageName(); $tpl = new templates(); $t = $_GET["t"]; $ff = time(); $boot = new boostrap_form(); call_user_func(BECALL); $title = null; $suffix = suffix(); $dateT = time_to_date($_GET["xtime"]); $title = $tpl->_ENGINE_parse_body("<H3>«{$dateT} {$_GET["hour"]}h» {youtube_videos}</H3>"); if ($_GET["youtubeid"] != null) { $array["{graphs}"] = "{$page}?www-video=yes{$suffix}"; } $array["{graphs}"] = "{$page}?www-graĥs=yes{$suffix}"; $array["{videos}"] = "{$page}?www-table=yes{$suffix}"; $array["{members}"] = "{$page}?www-members=yes{$suffix}"; echo $title . $boot->build_tab($array); }
function search_database_popup() { $boot = new boostrap_form(); $q = new mysql_storelogs(); if (!isset($_SESSION["QUERY_SYSLOG_HOST_DAY_FIELDY"])) { $sql = "SELECT DATE_FORMAT(filetime,'%Y-%m-%d') as filetime FROM files_info GROUP BY filetime ORDER BY filetime DESC"; $results = $q->QUERY_SQL($sql); $dayz[null] = "{select}"; while ($ligne = mysql_fetch_assoc($results)) { $time = time_to_date(strtotime($ligne["filetime"] . " 00:00:00")); $dayz[$ligne["filetime"]] = $time; } $_SESSION["QUERY_SYSLOG_HOST_DAY_FIELDY"] = serialize($dayz); } if (!isset($_SESSION["QUERY_SYSLOG_HOST_FIELDZ"])) { $sql = "SELECT hostname FROM files_info GROUP BY hostname ORDER BY hostname ASC"; $results = $q->QUERY_SQL($sql); $hostz[null] = "{select}"; while ($ligne = mysql_fetch_assoc($results)) { $hostz[$ligne["hostname"]] = $ligne["hostname"]; } $_SESSION["QUERY_SYSLOG_HOST_FIELDZ"] = serialize($hostz); } $LIMITS[50] = 50; $LIMITS[250] = 250; $LIMITS[500] = 250; $LIMITS[1000] = 1000; $LIMITS[2000] = 2000; if (!isset($_SESSION["QUERY_SYSLOG_LIMIT"])) { $_SESSION["QUERY_SYSLOG_LIMIT"] = 250; } if (!is_numeric($_GET["xtime"])) { $boot->set_list("QUERY_SYSLOG_DATE", "{date}", unserialize($_SESSION["QUERY_SYSLOG_HOST_DAY_FIELDY"]), $_SESSION["QUERY_SYSLOG_DATE"]); } $boot->set_list("QUERY_SYSLOG_HOST", "{hostname}", unserialize($_SESSION["QUERY_SYSLOG_HOST_FIELDZ"]), $_SESSION["QUERY_SYSLOG_HOST"]); $boot->set_field("QUERY_SYSLOG_FILE", "{filename}", $_SESSION["QUERY_SYSLOG_FILE"]); $boot->set_list("QUERY_SYSLOG_LIMIT", "{rows}", $LIMITS, $_SESSION["QUERY_SYSLOG_LIMIT"]); $boot->set_button("{search}"); $boot->set_CloseYahoo("YahooWin2"); $boot->set_formdescription("{advanced_search_explain}"); $boot->set_RefreshSearchs(); echo $boot->Compile(); }
function tabs() { //$table=date("Ymd",$_GET["xtime"])."_hour"; $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $title = $tpl->_ENGINE_parse_body("{$date} {website} {$_GET["familysite"]}"); $suffix = suffix(); $array["{graphs} {websites}"] = "{$page}?www-graĥs=yes{$suffix}"; $array["{graphs} {members}"] = "{$page}?www-graĥs-members=yes{$suffix}"; $array["{members}"] = "{$page}?www-members=yes{$suffix}"; $array[$_GET["familysite"]] = "miniadm.webstats.website.infos.php?familysite={$_GET["familysite"]}"; echo "<H3>" . $title . "</H3>" . $boot->build_tab($array); }
function categories_table() { $page = CurrentPageName(); $tpl = new templates(); $boot = new boostrap_form(); $q = new mysql_squid_builder(); $unknown = $tpl->_ENGINE_parse_body("{unknown}"); $uidtable = $q->uid_to_tablename($_GET["member-value"]); $users = new usersMenus(); $uidenc = urlencode($_GET["member-value"]); $xtime = $_GET["xtime"]; if (!$q->TABLE_EXISTS("`www_{$uidtable}`")) { echo "<p class=text-error>No table «`www_{$uidtable}`» for {$_GET["member-value"]}</p>"; return; } $curdate = date("Y-m-d", $xtime); $curdateT = time_to_date($xtime); $sql = "SELECT SUM(hits) as hits,SUM(size) as size,category,zDate FROM `www_{$uidtable}`\n\tGROUP BY category,zDate HAVING zDate='{$curdate}' ORDER BY size DESC,hits DESC"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}</p>"; return; } $_GET["member-value"] = urlencode($_GET["member-value"]); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = FormatBytes($ligne["size"] / 1024); $hits = FormatNumber($ligne["hits"]); $category = $ligne["category"]; $category_text = $ligne["category"]; if (trim($ligne["category"]) == null) { $category_text = $unknown; } $categoryenc = urlencode($ligne["category"]); $js = "Loadjs('miniadm.webstats.ByMember.ByCategory.ByDay.php?uid={$_GET["member-value"]}&category={$categoryenc}&xtime={$xtime}')"; $link = $boot->trswitch($js); $tr[] = "\n\t\t<tr>\n\t\t<td {$link}><i class='icon-tag'></i> {$category_text}</a></td>\n\t\t<td {$link}><i class='icon-info-sign'></i> {$size}</td>\n\t\t<td {$link}><i class='icon-info-sign'></i> {$hits}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\t\t<H3>{$_GET["member-value"]} {categories} {$curdateT}</H3>\n\t\t\t<table class='table table-bordered table-hover'>\n\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{category}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t\t") . @implode("", $tr) . "</tbody></table>\n\t\t\t<div style='text-align:right;margin-top:10px'>{$bt}</div>"; }
function webstats_middle() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $dateT = time_to_date($_GET["xtime"]); if (isset($_GET["title"])) { $title = $tpl->_ENGINE_parse_body("{$dateT}: {display_blocked_events}"); } $suffix = suffix(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $array["{graphs}"] = "{$page}?www-graĥs=yes{$suffix}"; $array["{websites}"] = "{$page}?www-table=yes{$suffix}"; $array["{members}"] = "{$page}?www-members=yes{$suffix}"; echo "<H3>" . $title . "</H3>" . $boot->build_tab($array); }
function www_search() { $page = CurrentPageName(); $tpl = new templates(); $boot = new boostrap_form(); $familysite = $_GET["familysite"]; $q = new mysql_squid_builder(); $uidtable = $q->uid_to_tablename($_GET["member-value"]); if (!$q->TABLE_EXISTS("`visited_sites_days`")) { echo "<p class=text-error>No table «`visited_sites_days`» for {$familysite}</p>"; return; } $search = string_to_flexquery("www-search"); $sql = "SELECT SUM(hits) as hits,SUM(size) as size,`zDate`,familysite FROM `visited_sites_days` GROUP BY\n\tfamilysite,`zDate` HAVING `familysite`='{$familysite}' {$search} ORDER BY `zDate` DESC"; $results = $q->QUERY_SQL($sql); $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<br>{$sql}</p>"; return; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = FormatBytes($ligne["size"] / 1024); $date = strtotime($ligne["zDate"] . "00:00:00"); $hits = FormatNumber($ligne["hits"]); $fsite = urlencode($ligne["familysite"]); $jslink = "Loadjs('miniadm.webstats.websites.ByDayByFamilySite.php?familysite={$fsite}&xtime={$date}')"; $zdate = time_to_date($date); $link = $boot->trswitch($jslink); $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$link}><i class='icon-time'></i> {$zdate}</a></td>\n\t\t<td {$link}><i class='icon-info-sign'></i> {$size}</td>\n\t\t<td {$link}><i class='icon-info-sign'></i> {$hits}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\n\t\t\t<table class='table table-bordered table-hover'>\n\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{date}</th>\n\t\t\t\t\t<th>{size}</th>\n\t\t\t\t\t<th>{hits}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function table_blocked() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $dt = strtotime("{$_GET["zday"]} 00:00:00"); if (isset($_SESSION["QUERY_BLOCKED_DATE"])) { $dt = $_SESSION["QUERY_BLOCKED_DATE"]; } $zday = date('Ymd', $dt); $title_date = time_to_date($dt); $MAIN_QUERY = $_GET["query-blocked"]; $search = '%'; $table = $zday . "_blocked"; if (!$q->TABLE_EXISTS($table)) { senderrors("{no_such_table}:{$table}"); } $main_query = $_GET["query-blocked"]; $QUERY_BLOCKED_UID = $_SESSION["QUERY_BLOCKED_UID"]; $QUERY_BLOCKED_CATEGORY = $_SESSION["QUERY_BLOCKED_CATEGORY"]; $BLOCKED_CATEGORY_LIMIT = $_SESSION["BLOCKED_CATEGORY_LIMIT"]; if (!is_numeric($BLOCKED_CATEGORY_LIMIT)) { $BLOCKED_CATEGORY_LIMIT = 250; } if ($QUERY_BLOCKED_UID != null) { $title_members = " {and} {member}:{$QUERY_BLOCKED_UID}"; $QUERY_BLOCKED_UID_OP = " = "; if (preg_match("#not.*?:(.+)#i", $QUERY_BLOCKED_UID, $re)) { $neg = true; $QUERY_BLOCKED_UID = trim($re[1]); } if ($neg) { $QUERY_BLOCKED_UID_OP = " != "; } $QUERY_BLOCKED_UID = str_replace("*", "%", $QUERY_BLOCKED_UID); if (strpos(" {$QUERY_BLOCKED_UID}", "%") > 0) { $QUERY_BLOCKED_UID_OP = " LIKE "; if ($neg) { $QUERY_BLOCKED_UID_OP = " NOT LIKE "; } } $QUERY_BLOCKED_UID_SQL = " AND (\n\t\t\t(`client` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}') \n\t\t\tOR (`hostname` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}')\n\t\t\tOR (`uid` {$QUERY_BLOCKED_UID_OP}'{$QUERY_BLOCKED_UID}')\n\t\t\t)\n\t\t"; } $neg = false; if ($QUERY_BLOCKED_CATEGORY != null) { $title_cat = " {and} {category}:{$QUERY_BLOCKED_CATEGORY}"; if (preg_match("#not.*?:(.+)#i", $QUERY_BLOCKED_CATEGORY, $re)) { $neg = true; $QUERY_BLOCKED_CATEGORY = trim($re[1]); } $QUERY_BLOCKED_CATEGORY = str_replace("*", "%", $QUERY_BLOCKED_CATEGORY); $QUERY_BLOCKED_CATEGORY_OP = " = "; if ($neg) { $QUERY_BLOCKED_CATEGORY_OP = " != "; } if (strpos(" {$QUERY_BLOCKED_CATEGORY}", "%") > 0) { $QUERY_BLOCKED_CATEGORY_OP = " LIKE "; if ($neg) { $QUERY_BLOCKED_CATEGORY_OP = " NOT LIKE "; } } $QUERY_BLOCKED_CATEGORY_SQL = " AND `category`{$QUERY_BLOCKED_CATEGORY_OP}'{$QUERY_BLOCKED_CATEGORY}'"; } $neg = false; if ($MAIN_QUERY != null) { $title_cat = " {and} {website}:{$MAIN_QUERY}"; if (preg_match("#not.*?:(.+)#i", $MAIN_QUERY, $re)) { $neg = true; $MAIN_QUERY = trim($re[1]); } $MAIN_QUERY = str_replace("*", "%", $MAIN_QUERY); $MAIN_QUERY_OP = " = "; if ($neg) { $MAIN_QUERY_OP = " != "; } if (strpos(" {$MAIN_QUERY}", "%") > 0) { $MAIN_QUERY_OP = " LIKE "; if ($neg) { $MAIN_QUERY_OP = " NOT LIKE "; } } $MAIN_QUERY_SQL = " AND `website`{$MAIN_QUERY_OP}'{$MAIN_QUERY}'"; } $sql = "SELECT * FROM `{$table}` WHERE 1 {$MAIN_QUERY_SQL}{$QUERY_BLOCKED_UID_SQL}{$QUERY_BLOCKED_CATEGORY_SQL} ORDER BY zDate LIMIT 0,{$BLOCKED_CATEGORY_LIMIT}"; $results = $q->QUERY_SQL($sql, 'artica_events'); $boot = new boostrap_form(); $UnBlockWebSiteExplain = $tpl->javascript_parse_text("{UnBlockWebSiteExplain}"); $today = date('Y-m-d'); if (!$q->ok) { sendserrors($q->mysql_error . "<br>{$sql}"); } $t = time(); $q2 = new mysql(); while ($ligne = mysql_fetch_assoc($results)) { $member = $ligne["client"]; if ($ligne["hostname"] != null) { $member = $ligne["hostname"]; } if ($ligne["uid"] != null) { $member = $ligne["uid"]; } $js = "Loadjs('squid.categories.php?category={$ligne["category"]}&website={$ligne["website"]}',true)"; $link = $boot->trswitch($js); $unblock = imgsimple("whitelist-24.png", null, "UnBlockWebSite{$t}('{$ligne["website"]}')"); $ligne3 = mysql_fetch_array($q2->QUERY_SQL("SELECT items FROM urlrewriteaccessdeny WHERE items='{$ligne["website"]}'", "artica_backup")); if (!$q->ok) { $unblock = "<img src='img/icon_err.gif'><br>{$q->mysql_error}"; } else { if ($ligne3["items"] != null) { $unblock = imgsimple("20-check.png", null, null); } } if ($ligne["blocktype"] != null) { $blocktype = "<div><i style='font-size:10px'>{$ligne["blocktype"]}</i></div>"; } $tr[] = "\n\t\t<tr>\n\t\t<td nowrap><i class='icon-time'></i> {$ligne["zDate"]}</td>\n\t\t<td {$link}><i class='icon-user'></i> {$member}</td>\n\t\t<td {$link}><i class='icon-globe'></i> {$ligne["website"]}{$blocktype}</td>\n\t\t<td {$link}><i class='icon-info'></i> {$ligne["category"]}</td>\n\t\t<td {$link}><i class='icon-info'></i> {$ligne["rulename"]}</td>\n\t\t<td>{$unblock}</td>\n\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\t\t\n\t\t<p>{search}:{$title_date}{$title_members}{$title_cat}</p>\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{zDate} </th>\n\t\t\t\t\t<th>{member}</th>\n\t\t\t\t\t<th>{website}</th>\n\t\t\t\t\t<th>{category}</th>\n\t\t\t\t\t<th>{rule}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t</table>\n\t\t<script>\n\tvar x_UnBlockWebSite{$t}=function(obj){\n\t var tempvalue=obj.responseText;\n\t if(tempvalue.length>3){alert(tempvalue);}\n\t \n\t}\t\n\nfunction UnBlockWebSite{$t}(domain){\n\tif(confirm('{$UnBlockWebSiteExplain}:'+domain+' ?')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('unlock',domain);\n\t\tXHR.sendAndLoad('squid.blocked.events.php', 'POST',x_UnBlockWebSite{$t});\n\t}\n\n}\n</script>\t\t\t\t\t\n"; }
function logs(){ $MyPage=CurrentPageName(); $sock=new sockets(); $logfile="/usr/share/artica-postfix/ressources/logs/web/iptables.log"; $searchstring=urlencode(string_to_flexregex()); if(!isset($_POST["rp"])){$_POST["rp"]=100;} $sock->getFrameWork("network.php?iptables-events=yesð={$_GET["eth"]}&rp={$_POST["rp"]}&search=$searchstring"); $tpl=new templates(); $results=explode("\n",@file_get_contents($logfile)); @unlink($logfile); if(count($results)==0){json_error_show("no data");} $data = array(); $data['page'] = 1; $data['total'] = count($results); $data['rows'] = array(); $q=new mysql_squid_builder(); krsort($results); $c=0; while (list ($num, $line) = each ($results)){ $line=trim($line); if($line==null){continue;} $MACIN="-"; $MACOUT="-"; $SRC="-"; $color="black"; if($GLOBALS["VERBOSE"]){echo "$line<hr>";} if(preg_match("#(.+?)\s+([0-9]+)\s+([0-9\:]+)\s+.*?\](.*)#",$line,$re)){ $date=strtotime("{$re[1]} {$re[2]} {$re[3]}"); $datetext=time_to_date($date,true); if($GLOBALS["VERBOSE"]){print_r($re);} $line=trim($re[4]); } if($GLOBALS["VERBOSE"]){echo "$line<hr>";} // ARTICA-FW-ID-8:IN= OUT=br1 SRC=192.168.1.1 DST=192.168.1.135 //LEN=52 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=TCP SPT=8080 DPT=51484 WINDOW=14600 //RES=0x00 ACK SYN URGP=0", $subject)) $lineZ=explode(" ",$line); while (list ($a, $b) = each ($lineZ)){ if(!preg_match("#(.+)=(.*)#", $b,$re)){continue;} $MAIN[$re[1]]=$re[2]; } $IN=$MAIN["IN"]; $OUT=$MAIN["OUT"]; $PHYSIN=$MAIN["PHYSIN"]; $PHYSOUT=$MAIN["PHYSOUT"]; $MAC=$MAIN["MAC"]; $SRC=$MAIN["SRC"]; $DST=$MAIN["DST"]; $SPT=$MAIN["SPT"]; $DPT=$MAIN["DPT"]; $PROTO=$MAIN["PROTO"]; $TABLE=$MAIN["TABLE"]; $ACTION=$MAIN["ACTION"]; $AID=$MAIN["AID"]; if($AID<>null){ $AID_TABLE=explode("/",$AID); if($GLOBALS["VERBOSE"]){echo "<hr>".print_r($AID_TABLE)."<hr>";} $RULE_ID=$AID_TABLE[0]; if(preg_match("#([0-9]+)#", $RULE_ID,$rz)){$RULE_ID=$rz[1];} $ACTION=$AID_TABLE[2]; $ACTION_SOURCE=$ACTION; $TABLE=$AID_TABLE[1]; $MAIN["ID"]=$RULE_ID; $MAIN["ACTION"]=$ACTION_SOURCE; $MAIN["TABLE"]=$TABLE; } if($TABLE==null){$TABLE="none";} if($ACTION==null){$ACTION="none";} $TABLE=$tpl->javascript_parse_text("{{$TABLE}}"); $ACTION=$tpl->javascript_parse_text("{{$ACTION}}"); //Aug 13 15:30:49 router kernel: [1918085.984702] ARTICA-FW-ID-1:IN=br1 OUT= PHYSIN=eth0 MAC=01:00:5e:00:00:01:00:17:33:f6:95:f4:08:00 SRC=172.16.255.254 DST=224.0.0.1 LEN=28 TOS=0x10 PREC=0x80 TTL=1 ID=37754 PROTO=2 if($IN==null){$IN="-";} if($OUT==null){$OUT="-";} if($PHYSIN==null){$PHYSIN="-";} if($MACIN==null){$MACIN="-";} if($MACOUT==null){$MACOUT="-";} if($SRC==null){$SRC="-";} if($PHYSOUT==null){$PHYSOUT="-";} if($SPT==null){$SPT="-";} if($DPT==null){$DPT="-";} if(preg_match("#(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?)#", $MAC,$ri)){ $MACIN="{$ri[1]}:{$ri[2]}:{$ri[3]}:{$ri[4]}:{$ri[5]}:{$ri[6]}"; $MACOUT="{$ri[7]}:{$ri[8]}:{$ri[9]}:{$ri[10]}:{$ri[11]}:{$ri[12]}"; } $MAIN["MAC - IN"]=$MACIN; $MAIN["MAC - OUT"]=$MACOUT; $ICONS["LOG"]="22-logs.png"; $ICONS["REJECT"]="22-red.png"; $ICONS["DROP"]="22-red.png"; $ICONS["RETURN"]="ok22.png"; $ICONS["ACCEPT"]="ok22.png"; $ICONS["DROP"]="22-red.png"; $ICONS["MARK"]="22-red.png"; $ICONS["FORWARD"]="forwd_22.png"; $image=$ICONS[$ACTION_SOURCE]; if(is_numeric($PROTO)){$color="#D11C2F";$image="22-warn.png";} $uri=urlencode(base64_encode(serialize($MAIN))); $javascript="href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('$MyPage?zoom-js=$uri');\" style='font-size:12px;font-weight:normal;color:$color;text-decoration:underline'"; $mkey=md5($line); $c++; $data['rows'][] = array( 'id' => "$mkey", 'cell' => array( "<span style='font-size:12px;font-weight:normal;color:$color'>$datetext</span>", "<center style='font-size:12px;font-weight:normal;color:$color'><img src=img/$image></center>", "<a $javascript>$TABLE</a>", "<span style='font-size:12px;font-weight:normal;color:$color'>$RULE_ID</span>", "<a $javascript>$IN/$PHYSIN</a>", "<span style='font-size:12px;font-weight:normal;color:$color'>$SRC:$SPT/$MACIN</span>", "<span style='font-size:12px;font-weight:normal;color:$color'>$OUT/$PHYSOUT</span>", "<a $javascript>$DST:$DPT/$MACOUT</span>", "<span style='font-size:12px;font-weight:normal;color:$color'>$PROTO</span>", ) ); } if(count($c)==0){json_error_show("no data");} echo json_encode($data); }
function tabs() { //$table=date("Ymd",$_GET["xtime"])."_hour"; $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $title = $tpl->_ENGINE_parse_body("{$date} {category} {$_GET["category"]}"); $category = urlencode($_GET["category"]); $array["{graphs} {websites}"] = "{$page}?www-graĥs=yes&category={$category}&xtime={$_GET["xtime"]}"; $array["{graphs} {members}"] = "{$page}?www-graĥs-members=yes&category={$category}&xtime={$_GET["xtime"]}"; $array["{websites}"] = "{$page}?www-table=yes&category={$category}&xtime={$_GET["xtime"]}"; $array["{members}"] = "{$page}?www-members=yes&category={$category}&xtime={$_GET["xtime"]}"; echo "<H3>" . $title . "</H3>" . $boot->build_tab($array); }
function youtube_search() { $page = CurrentPageName(); $tpl = new templates(); $boot = new boostrap_form(); $q = new mysql_squid_builder(); $uidtable = $q->uid_to_tablename($_GET["member-value"]); if (!$q->TABLE_EXISTS("`youtube_{$uidtable}`")) { echo "<p class=text-error>No table «`youtube_{$uidtable}`» for {$_GET["member-value"]}</p>"; return; } $search = string_to_flexquery("youtube-search"); $sql = "SELECT * FROM (SELECT COUNT(youtubeid) as hits ,zDate FROM(SELECT youtubeid,zDate FROM `youtube_{$uidtable}` GROUP BY zDate,youtubeid ORDER BY zDate)as t GROUP BY zDate) as i WHERE 1 {$search}"; $results = $q->QUERY_SQL($sql); $_GET["member-value"] = urlencode($_GET["member-value"]); if (!$q->ok) { echo "<p class=text-error>{$q->mysql_error}<br>{$sql}</p>"; return; } $sock = new sockets(); $PerMembersYoutubeDetails = $sock->GET_INFO("PerMembersYoutubeDetails"); if (!is_numeric($PerMembersYoutubeDetails)) { $PerMembersYoutubeDetails = 0; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $size = FormatBytes($ligne["size"] / 1024); $xtime = strtotime($ligne["zDate"] . "00:00:00"); $hits = FormatNumber($ligne["hits"]); $dateT = time_to_date($xtime); $jslink = null; if ($PerMembersYoutubeDetails == 1) { $jslink = "Loadjs('miniadm.webstats.ByMember.youtube.Byday.php?xtime={$xtime}&member-value={$_GET["member-value"]}&by={$_GET["by"]}')"; } $link = $boot->trswitch($jslink); $tr[] = "\n\t\t\t<tr>\n\t\t\t\t<td {$link}><i class='icon-time'></i> {$dateT}</a></td>\n\t\t\t\t<td {$link}><i class='icon-info-sign'></i> {$hits}</td>\n\t\t\t</tr>"; } echo $tpl->_ENGINE_parse_body("\n\t\n\t\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{date}</th>\n\t\t\t\t\t<th>{videos}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>"; }
function table_all_videos_search_popup() { $boot = new boostrap_form(); $q = new mysql_squid_builder(); if (isset($_SESSION["QUERY_YOUTUBE_CATZ"])) { $testCatz = unserialize($_SESSION["QUERY_YOUTUBE_CATZ"]); if (!is_array($testCatz)) { unset($_SESSION["QUERY_YOUTUBE_CATZ"]); } } if (!isset($_SESSION["QUERY_YOUTUBE_CATZ"])) { $sql = "SELECT category FROM youtube_objects GROUP BY category"; $results = $q->QUERY_SQL($sql); $dayz[null] = "{select}"; while ($ligne = mysql_fetch_assoc($results)) { $time = time_to_date(strtotime($ligne["filetime"] . " 00:00:00")); $dayz[$ligne["category"]] = $ligne["category"]; } $_SESSION["QUERY_YOUTUBE_CATZ"] = serialize($dayz); } $LIMITS[50] = 50; $LIMITS[250] = 250; $LIMITS[500] = 250; $LIMITS[1000] = 1000; $LIMITS[2000] = 2000; if (!isset($_SESSION["QUERY_YOUTUBE_LIMIT"])) { $_SESSION["QUERY_YOUTUBE_LIMIT"] = 250; } $boot->set_list("QUERY_YOUTUBE_CATE", "{category}", unserialize($_SESSION["QUERY_YOUTUBE_CATZ"]), $_SESSION["QUERY_YOUTUBE_CATE"]); $boot->set_list("QUERY_YOUTUBE_LIMIT", "{rows}", $LIMITS, $_SESSION["QUERY_YOUTUBE_LIMIT"]); $boot->set_button("{search}"); $boot->set_CloseYahoo("YahooWin2"); $boot->set_formdescription("{advanced_search_explain}"); $boot->set_RefreshSearchs(); echo $boot->Compile(); }
function tabs() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $boot = new boostrap_form(); $date = time_to_date($_GET["xtime"]); $dateT = $tpl->javascript_parse_text("{$date}"); $title = $tpl->_ENGINE_parse_body("{member}:{$_GET["filterBy"]} {$_GET["value"]}, {$dateT}"); $suffix = suffix(); $value = urlencode($_GET["value"]); $q = new mysql_squid_builder(); $hourtable = "youtubeday_" . date("Ymd", $_GET["xtime"]); $sql = "SELECT COUNT(youtubeid) as tcount,`{$_GET["filterBy"]}` FROM {$hourtable} GROUP BY `{$_GET["filterBy"]}` HAVING `{$_GET["filterBy"]}`='{$_GET["value"]}'"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { senderror($q->mysql_error . "<br>{$sql}"); } if ($_GET["youtubeid"] != null) { $youtube = new YoutubeStats(); $videotitle = "<H4>" . $youtube->youtube_title($_GET["youtubeid"]) . "</h4>"; $array["{hits}"] = "{$page}?www-hits=yes{$suffix}"; } $array["{$_GET["value"]} <strong>{$ligne["tcount"]}</strong> {videos}"] = "{$page}?www-allhits=yes{$suffix}"; echo "<H3>" . $title . "</H3>{$videotitle}" . $boot->build_tab($array); }