function page() { $q = new mysql_squid_builder(); $timekey = date('Ymd'); $timekeyMonth = date("Ym"); $time = time(); $page = CurrentPageName(); $tpl = new templates(); $q = new mysql_squid_builder(); $tpl = new templates(); $t = time(); $per["1m"] = "{minute}"; $per["5m"] = "5 {minutes}"; $per["10m"] = "10 {minutes}"; $per["1h"] = "{hour}"; $per["1d"] = "{day}"; $members["MAC"] = "{MAC}"; $members["USERID"] = "{uid}"; $members["IPADDR"] = "{ipaddr}"; if (!isset($_SESSION["SQUID_STATS_MEM_DATE1"])) { $_SESSION["SQUID_STATS_MEM_DATE1"] = date("Y-m-d"); } if (!isset($_SESSION["SQUID_STATS_MEM_TIME1"])) { $_SESSION["SQUID_STATS_MEM_TIME1"] = "00:00"; } if (!isset($_SESSION["SQUID_STATS_MEM_DATE2"])) { $_SESSION["SQUID_STATS_MEM_DATE2"] = date("Y-m-d"); } if (!isset($_SESSION["SQUID_STATS_MEM_TIME2"])) { $_SESSION["SQUID_STATS_MEM_TIME2"] = "23:00"; } $html = "\n\t<div style='width:98%;margin-bottom:20px' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='vertical-align:top;font-size:18px' class=legend>{interval}:</td>\n\t\t<td style='vertical-align:top;font-size:18px;'>" . Field_array_Hash($per, "interval-{$t}", "10m", "blur()", null, 0, "font-size:18px;") . "</td>\n\t\t<td style='vertical-align:top;font-size:18px' class=legend nowrap>{from_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("from-date-{$t}", $_SESSION["SQUID_STATS_MEM_DATE1"], ";font-size:18px;width:160px") . "</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . Field_text("from-time-{$t}", $_SESSION["SQUID_STATS_MEM_TIME1"], ";font-size:18px;width:82px") . "</td>\n\t\t<td style='vertical-align:top;font-size:18px' class=legend nowrap>{to_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("to-date-{$t}", $_SESSION["SQUID_STATS_MEM_DATE2"], ";font-size:18px;width:160px") . "</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . Field_text("to-time-{$t}", $_SESSION["SQUID_STATS_MEM_TIME2"], ";font-size:18px;width:82px") . "</td>\n\t\t<td style='vertical-align:top;font-size:18px;;width:400px'>" . button("Go", "Run{$t}()", 18) . "</td>\n\t\t</tr>\n\t\t</table>\n\t</div>\n\t<div style='font-size:32px'>{proxy_memory_service_status}</div>\n\t<div style='width:1280px;height:550px;margin-bottom:10px' id='graph-{$t}'></div>\n\t<div style='font-size:32px'>{server_memory_consumption}</div>\n\t<div style='width:1280px;height:550px;margin-bottom:10px' id='memstats-{$t}'></div>\n\t\n\t\n\t\n\t\n\t\n\t\n<script>\n\nfunction Run{$t}(){\n\tvar date1=document.getElementById('from-date-{$t}').value;\n\tvar time1=document.getElementById('from-time-{$t}').value;\n\tvar date2=document.getElementById('to-date-{$t}').value\n\tvar time2=document.getElementById('to-time-{$t}').value;\n\tvar interval=document.getElementById('interval-{$t}').value;\n\tLoadjs('{$page}?query=yes&container=graph-{$t}&date1='+date1+'&time1='+time1+'&date2='+date2+'&time2='+time2+'&interval='+interval);\n\tLoadjs('{$page}?memstats=yes&container=memstats-{$t}&date1='+date1+'&time1='+time1+'&date2='+date2+'&time2='+time2+'&interval='+interval);\n\n}\nRun{$t}();\n</script>\t\n"; echo $tpl->_ENGINE_parse_body($html); }
function change_day_popup() { $q = new mysql_squid_builder(); $tpl = new templates(); $t = $_GET["t"]; $page = CurrentPageName(); $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $mindate = $ligne["tdate"]; $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate = date('Y-m-d'); $html = "\n\t<table style='width:99%' class=form>\n\t\t<tbody>\n\t\t<tr>\n\t\t\t<td class=legend nowrap>{from_date}:</td>\n\t\t\t<td>" . field_date("sdate{$t}", $_GET["day"], "font-size:16px;padding:3px;width:95px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\t\n\t\t\t<td>" . button("{go}", "ChangeDay{$t}()", 18) . "</td>\n\t\t</tr>\n\t\t</tbody>\n\t</table>\t\n\t<script>\n\t\tfunction ChangeDay{$t}(){\n\t\t\tvar zday=document.getElementById('sdate{$t}').value;\n\t\t\tdocument.getElementById('daycache{$t}').value=zday;\n\t\t\t\$('#flexRT{$t}').flexOptions({url: '{$page}?search=yes&day='+zday+'&MAC={$_GET["MAC"]}&ipaddr={$_GET["ipaddr"]}'}).flexReload(); \n\t\t\n\t\t}\n\t\tdocument.getElementById('sdate{$t}').value=document.getElementById('daycache{$t}').value;\n\t\t\n\t\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function change_day_popup() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql_squid_builder(); $t = $_GET["t"]; $members = $tpl->_ENGINE_parse_body("{members}»"); $day = $tpl->_ENGINE_parse_body("{day}"); $sql = "SELECT DATE_FORMAT(date,'%Y-%m-%d') as tdate FROM trafficSummaries ORDER BY date LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $mindate = $ligne["tdate"]; $sql = "SELECT DATE_FORMAT(date,'%Y-%m-%d') as tdate FROM trafficSummaries ORDER BY date DESC LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate = date('Y-m-d'); $html = "\n\t<table style='width:99%' class=form>\n\t<tbody>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:16px'>{from_date}:</td>\n\t\t<td>" . field_date("SdateMember-{$t}", $_GET["day"], "font-size:16px;padding:3px;width:95px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t\t<td>" . button("{go}", "DayMemberChangeDate{$t}()", 16) . "</td>\n\t\t</tr>\n\t\t</tbody>\n\t\t</table>\n\n\t\t<script>\n\t\tfunction DayMemberChangeDate{$t}(){\n\t\tvar xday=document.getElementById('SdateMember-{$t}').value;\n\t\t\$('.ftitle').html('{$members}»{$day}:'+xday);\n\t\t\$('#{$t}').flexOptions({url: '{$page}?rows=yes&day='+xday,title:'{$members}'+xday}).flexReload();\n\n}\n\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function setting_field_render($setting_id) { $CI =& get_instance(); $row = $CI->db->get_where('settings', array('id' => $setting_id))->row(); if (!$row || empty($row)) { return FALSE; } $html = NULL; switch ($row->type) { case 'text': $html .= field_text($row->key, empty($row->value) ? $row->default_value : $row->value); break; case 'textarea': $html .= field_textarea($row->key, empty($row->value) ? $row->default_value : $row->value); break; case 'date': $html .= field_date($row->key, empty($row->value) ? $row->default_value : $row->value); break; case 'select': $options = array(); if (!empty($row->options)) { $rows = unserialize($row->options); if (isset($rows['value']) && is_array($rows['value']) && count($rows['value'])) { foreach ($rows['value'] as $key => $value) { $options[$value] = isset($rows['title'][$key]) ? $rows['title'][$key] : ''; } } } $html .= field_select($row->key, $options, empty($row->value) ? $row->default_value : $row->value, 'class="input-block-level form-control"'); break; case 'boolen': $options = array(); if (!empty($row->options)) { $rows = unserialize($row->options); if (isset($rows['value']) && is_array($rows['value']) && count($rows['value'])) { foreach ($rows['value'] as $key => $value) { $options[$value] = isset($rows['title'][$key]) ? $rows['title'][$key] : ''; } } } $html .= field_select($row->key, $options, empty($row->value) ? $row->default_value : $row->value, 'class="input-block-level form-control"'); break; } return $html; }
function requeteur_popup() { $page = CurrentPageName(); $tpl = new templates(); squid_stats_default_values(); $t = $_GET["t"]; $per["1m"] = "{minute}"; $per["5m"] = "5 {minutes}"; $per["10m"] = "10 {minutes}"; $per["1h"] = "{hour}"; $per["1d"] = "{day}"; $members["frommail"] = "{sender}"; $members["tomail"] = "{recipient}"; $q = new postgres_sql(); $Selectore = $q->fieldSelectore(); $html = "<div style='width:98%;margin-bottom:20px' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t\t\n\t\t<td style='vertical-align:top;font-size:18px' class=legend>{members}:</td>\n\t\t<td style='vertical-align:top;font-size:18px;'>" . Field_array_Hash($members, "members-{$t}", $_SESSION["SQUID_STATS_MEMBER"], "blur()", null, 0, "font-size:18px;") . "</td>\n\t</tr>\n\t<tr>\t\t\t\n\t\n\t\t<td style='vertical-align:top;font-size:18px' class=legend>{from_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("from-date-{$t}", $_SESSION["SQUID_STATS_DATE1"], ";font-size:18px;width:160px", $Selectore) . "\n\t\t " . Field_text("from-time-{$t}", $_SESSION["SQUID_STATS_TIME1"], ";font-size:18px;width:82px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td style='vertical-align:top;font-size:18px' class=legend>{to_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("to-date-{$t}", $_SESSION["SQUID_STATS_DATE2"], ";font-size:18px;width:160px", $Selectore) . "\n\t\t " . Field_text("to-time-{$t}", $_SESSION["SQUID_STATS_TIME2"], ";font-size:18px;width:82px") . "</td>\n\t\t\n\t</tr>\n\t<tr>\n\t\t<td style='vertical-align:middle;font-size:18px' class=legend>{search}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . Field_text("search-{$t}", $_SESSION["SQUID_STATS_MEMBER_SEARCH"], ";font-size:18px;width:98%") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td style='vertical-align:top;font-size:18px;' colspan=2 align='right'><hr>" . button("{generate_statistics}", "Run{$t}()", 18) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n<script>\nfunction Run{$t}(){\n\tvar date1=document.getElementById('from-date-{$t}').value;\n\tvar time1=document.getElementById('from-time-{$t}').value;\n\tvar date2=document.getElementById('to-date-{$t}').value\n\tvar time2=document.getElementById('to-time-{$t}').value;\n\tvar user=document.getElementById('members-{$t}').value;\n\tvar search=encodeURIComponent(document.getElementById('search-{$t}').value);\n\tvar interval=0;\n\t\n\n\t\n\tLoadjs('{$page}?query-js=yes&t={$t}&container=graph-{$t}&date1='+date1+'&time1='+time1+'&date2='+date2+'&time2='+time2+'&interval='+interval+'&user='******'&search='+search);\n\t\n}\n</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function popup() { $page = CurrentPageName(); $tpl = new templates(); $t = time(); $members["MAC"] = "{MAC}"; $members["USERID"] = "{uid}"; $members["IPADDR"] = "{ipaddr}"; $q = new postgres_sql(); $Selectore = $q->fieldSelectore(); $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT params,title,report_type FROM reports_cache WHERE `zmd5`='{$_GET["zmd5"]}'")); if (!$q->ok) { echo $q->mysql_error_html(); } $params = unserialize($ligne["params"]); $FROM_DATE = date("Y-m-d", $params["FROM"]); $FROM_TIME = date("H:i", $params["FROM"]); $TO_DATE = date("Y-m-d", $params["TO"]); $TO_TIME = date("H:i", $params["TO"]); $USER = $params["USER"]; $searchsites = $params["searchsites"]; $searchuser = $params["searchuser"]; if ($ligne["report_type"] == "WEBSITES") { $nextFunction = "LoadAjax('WEBSITES_STATS_MAIN_GRAPH','squid.statistics.websites.php?main=yes&zmd5={$_GET["zmd5"]}&t={$_GET["t"]}');"; } if ($ligne["report_type"] == "FLOW") { $nextFunction = "LoadAjax('WEBSITES_STATS_MAIN_GRAPH','squid.statistics.flow.php?graph1=yes&t={$_GET["t"]}&container=graph-{$t}&zmd5={$_GET["zmd5"]}&t={$_GET["t"]}');"; } if ($ligne["report_type"] == "CATEGORIES") { $nextFunction = "LoadAjax('CATEGORIES_STATS_MAIN_GRAPH','squid.statistics.categories.php?main=yes&zmd5={$_GET["zmd5"]}&t={$_GET["t"]}');"; } if ($ligne["report_type"] == "WEBFILTERING") { $nextFunction = "LoadAjax('WEBFILTERING_STATS_MAIN_GRAPH','squid.statistics.webfiltering.php?main=yes&zmd5={$_GET["zmd5"]}&t={$_GET["t"]}');"; } $nextFunction_encoded = urlencode(base64_encode($nextFunction)); $stylelegend = "style='vertical-align:top;font-size:18px;padding-top:5px' nowrap"; $html = "<div style='width:98%;margin-bottom:20px' class=form>\n<table style='width:100%'>\n<tr style='height:50px'>\n\t<td style='vertical-align:middle;font-size:18px;' class=legend>{type}:</td>\n\t<td style='vertical-align:middle;font-size:18px;font-weight:bold'>{$ligne["report_type"]}</td>\n</tr>\n<tr>\n\t<td {$stylelegend} class=legend>{title2}:</td>\n\t<td style='vertical-align:top;font-size:18px'>" . Field_text("title-{$t}", utf8_encode($ligne["title"]), ";font-size:18px;width:710px") . "</td>\n</tr>\n\n<tr>\n\t<td {$stylelegend} class=legend>{from_date}:</td>\n\t<td style='vertical-align:top;font-size:18px'>" . field_date("from-date-{$t}", $FROM_DATE, ";font-size:18px;width:160px", $Selectore) . "\n\t " . Field_text("from-time-{$t}", $FROM_TIME, ";font-size:18px;width:82px") . "</td>\n</tr>\n<tr>\t\n\t<td {$stylelegend} class=legend>{to_date}:</td>\n\t<td style='vertical-align:top;font-size:18px'>" . field_date("to-date-{$t}", $TO_DATE, ";font-size:18px;width:160px", $Selectore) . "\n\t " . Field_text("to-time-{$t}", $TO_TIME, ";font-size:18px;width:82px") . "</td>\n</tr>\n\n<tr>\n\t<td {$stylelegend} class=legend>{members}:</td>\n\t<td style='vertical-align:top;font-size:18px;'>" . Field_array_Hash($members, "members-{$t}", $USER, "blur()", null, 0, "font-size:18px;") . "</td>\n</tr>\n<tr>\n\t<td {$stylelegend} class=legend>{members} {search}:</td>\n\t<td style='vertical-align:top;font-size:18px;'>" . Field_text("members-search-{$t}", "{$searchuser}", "font-size:18px;width:350px") . "</td>\n</tr>\n<tr>\n\t<td {$stylelegend} class=legend>{websites} {search}:</td>\n\t<td style='vertical-align:top;font-size:18px;'>" . Field_text("websites-search-{$t}", "{$searchsites}", "font-size:18px;width:350px") . "</td>\n</tr>\n<tr style='height:50px'>\n\t<td style='vertical-align:top;font-size:18px;' colspan=2 align='right'>" . button("{apply}", "Run{$t}()", 36) . "</td>\n</tr>\n</table>\n</div>\n<script>\nvar xRun{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n\tLoadjs('squid.statistics.progress.php?zmd5={$_GET["zmd5"]}&NextFunction={$nextFunction_encoded}&t={$t}');\n}\n\nfunction Run{$t}(){\n\tvar date1=document.getElementById('from-date-{$t}').value;\n\tvar time1=document.getElementById('from-time-{$t}').value;\n\tvar date2=document.getElementById('to-date-{$t}').value\n\tvar time2=document.getElementById('to-time-{$t}').value;\n\tvar user=document.getElementById('members-{$t}').value;\n\tvar searchuser=encodeURIComponent(document.getElementById('members-search-{$t}').value);\n\tvar searchsites=encodeURIComponent(document.getElementById('websites-search-{$t}').value);\n\tvar title=encodeURIComponent(document.getElementById('title-{$t}').value);\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('zmd5','{$_GET["zmd5"]}');\n\tXHR.appendData('date1',date1+' '+time1+':00');\n\tXHR.appendData('USER',user);\n\tXHR.appendData('date2',date2+' '+time2+':00');\n\tXHR.appendData('searchuser',searchuser);\n\tXHR.appendData('searchsites',searchsites);\n\tXHR.appendData('title',title);\n\tXHR.sendAndLoad('{$page}', 'POST',xRun{$t});\n\n}\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function purge_bydate(){ $page=CurrentPageName(); $tpl=new templates(); $q=new mysql_squid_builder(); $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $mindate=$ligne["tdate"]; $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate=date('Y-m-d'); $t=time(); $html=" <div style='width:98%' class=form> <table style='width:100%' > <tbody> <tr> <td class=legend nowrap style='font-size:22px;vertical-align:top'>{from_date}:</td> <td>". field_date("date1-$t",$mindate,"font-size:18px;padding:3px;width:120px","mindate:$mindate;maxdate:$maxdate")."</td> <td class=legend nowrap style='font-size:22px;vertical-align:top'>{to_date}:</td> <td>". field_date("date2-$t",$maxdate,"font-size:18px;padding:3px;width:120px","mindate:$mindate;maxdate:$maxdate")."</td> </tr> <tr> <td colspan=4 align='right'><hr>". button("{purge}", "Save$t()",22)."</td> </tr> </tbody> </table> </div> <div style='width:98%' class=form> <div style='font-size:22px'>{empty_database}</div> <div class=text-info style='font-size:16px'>{empty_database_explain}</div> <div style='text-align:right'><hr>". button("{empty_database}", "Loadjs('$page?remove-db-js=yes',true)",22)."</div> </div> <div style='width:98%' class=form> <div style='font-size:22px'>{backup_database}</div> <div class=text-info style='font-size:16px'>{backup_database_explain}</div> <div style='text-align:right'><hr>". button("{backup_database}", "Loadjs('$page?backup-db-js=yes',true)",22)."</div> </div> <script> function SquidFlowDaySizeQuery(type){ if(!type){ if(document.getElementById('squid-stats-day-hide-type')){type=document.getElementById('squid-stats-day-hide-type').value;} } if(!type){type='size';} var sdate=document.getElementById('sdate').value; LoadAjax('days-right-infos','$page?day-right-tabs=yes&day='+sdate+'&type='+type); } </script>"; echo $tpl->_ENGINE_parse_body($html); }
function left() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql_squid_builder(); $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $mindate = $ligne["tdate"]; $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate = date('Y-m-d'); $html = "\n\t\t<table style='width:99%' class=form>\n\t<tbody>\n\t<tr>\n\t\t<td class=legend nowrap>{from_date}:</td>\n\t\t<td>" . field_date('sWeekDate', $_GET["day"], "font-size:16px;padding:3px;width:95px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\t\n\t\t<td>" . button("{go}", "SquidFlowWeekQuery()") . "</td>\n\t</tr>\n\t\t\n\t</tbody>\n\t</table>\n\t\n\t<div id='statistics-week-left-status'></div>\n\t\n<script>\n\t\tfunction SquidFlowWeekQuery(){\n\t\t\tvar sdate=document.getElementById('sWeekDate').value;\n\t\t\tLoadAjax('week-right-infos','{$page}?week-right-infos=yes&day='+sdate);\n\t\t}\n\t\t\n\t\tvar sdate=document.getElementById('sWeekDate').value;\n\t\tLoadAjax('statistics-week-left-status','{$page}?left-status=yes&day='+sdate);\n\t\t\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function day_menu_left(){ $page=CurrentPageName(); $tpl=new templates(); $q=new mysql_squid_builder(); $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $mindate=$ligne["tdate"]; $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate=date('Y-m-d'); $html=" <table style='width:99%' class=form> <tbody> <tr> <td class=legend nowrap>{from_date}:</td> <td>". field_date('SdateMember',$_GET["day"],"font-size:16px;padding:3px;width:95px","mindate:$mindate;maxdate:$maxdate")."</td> <td>". button("{go}","DayMemberChangeDate()")."</td> </tr> </tbody> </table> <table style='width:99%;' class=form> <tbody> <tr> <td class=legend>{members}:</td> <td>". Field_text("day-members-query",null,"font-size:14px",$_COOKIE["SquidStatsSearchUsersDay"],null,null,false,"SquidStatsSearchUsersDayCheck(event)")."</td> </tr> </tbody> </table> <script> function DayMemberChangeDate(){ LoadAjax('day_graphs_for_members','$page?day-graphs-perform=yes&day='+document.getElementById('SdateMember').value); } function SquidStatsSearchUsersDayCheck(e){ if(checkEnter(e)){SquidStatsSearchUsersDay();} } function SquidStatsSearchUsersDay(){ var se=document.getElementById('day-members-query').value; if(se.length>0){Set_Cookie('SquidStatsSearchUsersDay', se, '3600', '/', '', '');}else{ se=Get_Cookie('SquidStatsSearchUsersDay'); document.getElementById('day-members-query').value=se; } var search=escape(se); LoadAjax('members-day-list','$page?day-users-search=yes&day='+document.getElementById('SdateMember').value+'&search='+search); } SquidStatsSearchUsersDay(); </script> "; echo $tpl->_ENGINE_parse_body($html); }
function general_status_graphs() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql_squid_builder(); $t = time(); if (isset($_GET["from"])) { $filter = "zDate>='{$_GET["from"]}' AND zDate<='{$_GET["to"]}'"; $selected_date = "{from_date} {$_GET["from"]} - {to_date} {$_GET["to"]}"; $default_from_date = $_GET["from"]; $default_to_date = $_GET["to"]; $file_prefix = "{$default_from_date}-{$default_to_date}"; } if ($_GET["type"] != null) { $type = $_GET["type"]; if ($_GET["type"] == "req") { $field = "requests as totalsize"; $prefix_title = "{requests}"; $hasSize = false; } } if ($default_from_date == null) { $sql = "SELECT DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 DAY),'%Y-%m-%d') as tdate"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $default_from_date = $ligne["tdate"]; } if ($default_to_date == null) { $sql = "SELECT DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d') as tdate"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $default_to_date = $ligne["tdate"]; } $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $mindate = $ligne["tdate"]; $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate = $ligne["tdate"]; $html = "<div id='{$t}-1' style='height:350px'><center><img src='img/wait-clock.gif'></center></div>\n\t\t<table style='margin-top:10px' class=form>\n\t<tbody>\n\t<tr>\n\t\t<td class=legend nowrap>{from_date}:</td>\n\t\t<td>" . field_date('from_date1', $default_from_date, "font-size:16px;padding:3px;width:95px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t\t\n\t\t<td class=legend nowrap>{to_date}:</td>\n\t\t<td>" . field_date('to_date1', $default_to_date, "font-size:16px;padding:3px;width:95px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t\t<td width=1%>" . button("{apply}", "SquidFlowSizeQuery('{$type}')") . "</td>\n\t</tr>\n\t</table>\n\t\n\t\n\t\n\t\n\t<script>\n\t\tfunction SquidFlowSizeQuery(type){\n\t\t\tif(!type){type='';}\n\t\t\tvar from=document.getElementById('from_date1').value;\n\t\t\tvar to=document.getElementById('to_date1').value;\n\t\t\tLoadAjax('squid-status-graphs','{$page}?squid-status-graphs=yes&from='+from+'&to='+to+'&type='+type);\n\t\t\n\t\t}\n\t\n\t\n\t\tfunction StartGraph1{$t}(){\n\t\t\tLoadjs('{$page}?status-graph-flow=yes&id={$t}-1&from={$_GET["from"]}&to={$_GET["to"]}&type={$_GET["type"]}');\n\t\t\tsetTimeout(\"StartGraph2{$t}()\",2000);\n\t\t}\n\t\t\n\n\t\tStartGraph1{$t}();\n\t\t\n\t</script>\n\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function requeteur_popup() { $page = CurrentPageName(); $tpl = new templates(); squid_stats_default_values(); $t = $_GET["t"]; $per["1h"] = "1 {hour}"; $per["1d"] = "1 {day}"; $per["1w"] = "1 {week}"; $per["30d"] = "1 {month}"; $members["MAC"] = "{MAC}"; $members["USERID"] = "{uid}"; $members["IPADDR"] = "{ipaddr}"; $q = new influx(); $date_start = date("Y-m-d", intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/DATE_START"))); $date_end = date("Y-m-d", intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/DATE_END"))); $Selectore = "mindate:{$date_start};maxdate:{$date_end}"; $stylelegend = "style='vertical-align:top;font-size:18px;padding-top:5px' nowrap"; $html = "<div style='width:98%;margin-bottom:20px' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td {$stylelegend} class=legend>{interval}:</td>\n\t\t<td style='vertical-align:top;font-size:18px;'>" . Field_array_Hash($per, "interval-{$t}", "10m", "blur()", null, 0, "font-size:18px;") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td {$stylelegend} class=legend>{members}:</td>\n\t\t<td style='vertical-align:top;font-size:18px;'>" . Field_array_Hash($members, "members-{$t}", $_SESSION["SQUID_STATS_MEMBER"], "blur()", null, 0, "font-size:18px;") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td {$stylelegend} class=legend>{from_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("from-date-{$t}", $_SESSION["SQUID_STATS_DATE1"], ";font-size:18px;width:160px", $Selectore) . "\n\t\t " . Field_text("from-time-{$t}", $_SESSION["SQUID_STATS_TIME1"], ";font-size:18px;width:82px") . "</td>\n\t\t\n\t</tr>\n\t\t<td {$stylelegend} class=legend>{to_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("to-date-{$t}", $_SESSION["SQUID_STATS_DATE2"], ";font-size:18px;width:160px", $Selectore) . "\n\t\t " . Field_text("to-time-{$t}", $_SESSION["SQUID_STATS_TIME2"], ";font-size:18px;width:82px") . "</td>\n\t</tr>\n\t<tr>\t\n\t\t<td style='vertical-align:top;font-size:18px;' colspan=2 align='right'>" . button("{generate_statistics}", "Run{$t}()", 18) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n<script>\nfunction Run{$t}(){\n\tvar date1=document.getElementById('from-date-{$t}').value;\n\tvar time1=document.getElementById('from-time-{$t}').value;\n\tvar date2=document.getElementById('to-date-{$t}').value\n\tvar time2=document.getElementById('to-time-{$t}').value;\n\tvar user=document.getElementById('members-{$t}').value;\n\tvar interval=document.getElementById('interval-{$t}').value;\n\tLoadjs('{$page}?query-js=yes&t={$t}&container=graph-{$t}&date1='+date1+'&time1='+time1+'&date2='+date2+'&time2='+time2+'&interval='+interval+'&user='+user);\n\n}\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function requeteur_popup() { $page = CurrentPageName(); $tpl = new templates(); squid_stats_default_values(); $t = time(); $per["1m"] = "{minute}"; $per["5m"] = "5 {minutes}"; $per["10m"] = "10 {minutes}"; $per["1h"] = "{hour}"; $per["1d"] = "{day}"; $Maxlines[50] = 50; $Maxlines[100] = 100; $Maxlines[150] = 150; $Maxlines[200] = 200; $q = new influx(); $date_start = date("Y-m-d", intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/DATE_START"))); $date_end = date("Y-m-d", intval(@file_get_contents("{$GLOBALS["BASEDIR"]}/DATE_END"))); $Selectore = "mindate:{$date_start};maxdate:{$date_end}"; $members["MAC"] = "{MAC}"; $members["USERID"] = "{uid}"; $members["IPADDR"] = "{ipaddr}"; $stylelegend = "style='vertical-align:top;font-size:18px;padding-top:5px' nowrap"; $html = "<div style='width:98%;margin-bottom:20px' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t\t\t\t\n\t\t<td {$stylelegend} class=legend>{members}:</td>\n\t\t<td style='vertical-align:top;font-size:18px;'>" . Field_array_Hash($members, "members-{$t}", $_SESSION["SQUID_STATS_MEMBER"], "blur()", null, 0, "font-size:18px;") . "</td>\t\t\n\t</tr>\n\t<tr>\t\n\t\t<td {$stylelegend} class=legend>{max_lines}:</td>\n\t\t<td style='vertical-align:top;font-size:18px;'>" . Field_array_Hash($Maxlines, "Maxlines-{$t}", $_SESSION["SQUID_STATS_MAX_LINES"], "blur()", null, 0, "font-size:18px;") . "</td>\t\t\t\t\n\t</tr>\n\t<tr>\t\t\t\t\t\n\t\t<td {$stylelegend} class=legend nowrap>{from_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("from-date-{$t}", $_SESSION["SQUID_STATS_DATE1"], ";font-size:18px;width:160px", $Selectore) . "\n\t\t " . Field_text("from-time-{$t}", $_SESSION["SQUID_STATS_TIME1"], ";font-size:18px;width:82px") . "</td>\n\t</tr>\n\t<tr>\t\t\n\t\t\n\t\t<td {$stylelegend} class=legend nowrap>{to_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("to-date-{$t}", $_SESSION["SQUID_STATS_DATE2"], ";font-size:18px;width:160px", $Selectore) . "\n\t\t " . Field_text("to-time-{$t}", $_SESSION["SQUID_STATS_TIME2"], ";font-size:18px;width:82px") . "</td>\n\t</tr>\n\t<tr>\n\t</tr>\n\t<tr>\n\t\t<td {$stylelegend} class=legend>{search}:</td>\n\t\t<td colspan=2 style='vertical-align:top;font-size:18px'>" . Field_text("search-{$t}", $_SESSION["SQUID_STATS_MEMBER_SEARCH"], ";font-size:18px;width:99%") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td style='vertical-align:top;font-size:18px;text-align:right' colspan=2>" . button("{search}", "Run{$t}()", 26) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n<script>\nfunction Run{$t}(){\n\tvar date1=document.getElementById('from-date-{$t}').value;\n\tvar time1=document.getElementById('from-time-{$t}').value;\n\tvar date2=document.getElementById('to-date-{$t}').value\n\tvar time2=document.getElementById('to-time-{$t}').value;\n\tvar user=document.getElementById('members-{$t}').value;\n\tvar Maxlines=document.getElementById('Maxlines-{$t}').value;\n\tvar search=encodeURIComponent(document.getElementById('search-{$t}').value);\n\tvar interval=0;\n\t\n\tLoadAjax('table-squid-stats-requests','{$page}?query-js=yes&container=graph-{$t}&Maxlines='+Maxlines+'&date1='+date1+'&time1='+time1+'&date2='+date2+'&time2='+time2+'&interval='+interval+'&user='******'&search='+search);\n\t\n\t\n}\n</script>\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n"; echo $tpl->_ENGINE_parse_body($html); }
function general_status_graphs() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql_squid_builder(); $selected_date = "{last_30days}"; $filter = "zDate>DATE_SUB(NOW(),INTERVAL 30 DAY) AND zDate<DATE_SUB(NOW(),INTERVAL 1 DAY)"; $file_prefix = "default"; $type = 'size'; $field = "totalsize"; $prefix_title = "{downloaded_flow} (MB)"; $hasSize = true; if (isset($_GET["from"])) { $filter = "zDate>='{$_GET["from"]}' AND zDate<='{$_GET["to"]}'"; $selected_date = "{from_date} {$_GET["from"]} - {to_date} {$_GET["to"]}"; $default_from_date = $_GET["from"]; $default_to_date = $_GET["to"]; $file_prefix = "{$default_from_date}-{$default_to_date}"; } if ($_GET["type"] != null) { $type = $_GET["type"]; if ($_GET["type"] == "req") { $field = "requests as totalsize"; $prefix_title = "{requests}"; $hasSize = false; } } $sql = "SELECT {$field},DATE_FORMAT(zDate,'%d') as tdate FROM tables_day WHERE {$filter} ORDER BY zDate"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>"; } while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $xdata[] = $ligne["tdate"]; if ($hasSize) { $ydata[] = round($ligne["totalsize"] / 1024 / 1000); } else { $ydata[] = $ligne["totalsize"]; } } $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$file_prefix}.{$type}.png"; $gp = new artica_graphs(); $gp->width = 550; $gp->height = 350; $gp->filename = "{$targetedfile}"; $gp->xdata = $xdata; $gp->ydata = $ydata; $gp->y_title = null; $gp->x_title = $tpl->_ENGINE_parse_body("{days}"); $gp->title = null; $gp->margin0 = true; $gp->Fillcolor = "blue@0.9"; $gp->color = "146497"; $gp->line_green(); if (!is_file($targetedfile)) { writelogs("Fatal \"{$targetedfile}\" no such file!", __FUNCTION__, __FILE__, __LINE__); $targetedfile = "img/kas-graph-no-datas.png"; } if ($default_from_date == null) { $sql = "SELECT DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 DAY),'%Y-%m-%d') as tdate"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $default_from_date = $ligne["tdate"]; } if ($default_to_date == null) { $sql = "SELECT DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d') as tdate"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $default_to_date = $ligne["tdate"]; } $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $mindate = $ligne["tdate"]; $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate = $ligne["tdate"]; echo $tpl->_ENGINE_parse_body("<div ><h3> {$prefix_title}/{days} - {$selected_date}</h3>\n\t<center>\n\t<img src='{$targetedfile}'>\n\t</center>\n\t</div>\n\t<table style='margin-top:10px' class=form>\n\t<tbody>\n\t<tr>\n\t\t<td class=legend nowrap>{from_date}:</td>\n\t\t<td>" . field_date('from_date1', $default_from_date, "font-size:16px;padding:3px;width:95px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t\t\n\t\t<td class=legend nowrap>{to_date}:</td>\n\t\t<td>" . field_date('to_date1', $default_to_date, "font-size:16px;padding:3px;width:95px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t\t<td width=1%>" . button("{apply}", "SquidFlowSizeQuery('{$type}')") . "</td>\n\t</tr>\n\t</table>\n\t<p> </p>\n\t<div id='squid-cache-flow-performance'></div>\n\t\n\t<script>\n\t\tfunction SquidFlowSizeQuery(type){\n\t\t\tif(!type){type='';}\n\t\t\tvar from=document.getElementById('from_date1').value;\n\t\t\tvar to=document.getElementById('to_date1').value;\n\t\t\tLoadAjax('squid-status-graphs','{$page}?squid-status-graphs=yes&from='+from+'&to='+to+'&type='+type);\n\t\t\n\t\t}\n\t\t\n\t\tLoadAjax('squid-cache-flow-performance','{$page}?squid-cache-flow-performance=yes&from={$default_from_date}&to={$default_to_date}&type={$type}');\n\t\t\n\t</script>\n\t\n\t"); }
function left(){ $page=CurrentPageName(); $tpl=new templates(); $q=new mysql_squid_builder(); $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $mindate=$ligne["tdate"]; $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate=date('Y-m-d'); $old="<tr> <td class=legend nowrap>{select}</td> <td valign='top' style='font-size:14px' nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:SquidFlowDaySizeQuery('size')\"$stylehref>{downloaded_flow}</a></td> </tr> <tr> <td class=legend nowrap>{select}</td> <td valign='top' style='font-size:14px' nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:SquidFlowDaySizeQuery('req')\"$stylehref>{requests}</a></td> </tr> "; $html=" <table style='width:97%' class=form> <tbody> <tr> <td class=legend nowrap>{day}:</td> <td>". field_date('sdate',$_GET["day"],"font-size:14px;padding:3px;width:85px","mindate:$mindate;maxdate:$maxdate")."</td> <td>". button("{go}","SquidFlowDaySizeQuery()")."</td> </tr> </tbody> </table> <div id='statistics-days-left-status'></div> <script> function SquidFlowDaySizeQuery(type){ if(!type){ if(document.getElementById('squid-stats-day-hide-type')){type=document.getElementById('squid-stats-day-hide-type').value;} } if(!type){type='size';} var sdate=document.getElementById('sdate').value; LoadAjax('days-right-infos','$page?day-right-tabs=yes&day='+sdate+'&type='+type); } </script> "; echo $tpl->_ENGINE_parse_body($html); }
function report_main() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql_squid_builder(); $dans = new dansguardian_rules(); $cats = $dans->LoadBlackListes(); while (list($num, $ligne) = each($cats)) { $newcat[$num] = $num; } $newcat[null] = "{none}"; $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql)); $mindate = $ligne2["tdate"]; $sql = "SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate = $ligne2["tdate"]; $ID = $_GET["ID"]; $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM `squid_reports` WHERE ID='{$ID}'")); $t = time(); $report_days[0] = "{date_range}"; $report_days[2] = "2 {days}"; $report_days[7] = "1 {week}"; $report_days[15] = "2 {weeks}"; $report_days[-1] = "{current_month}"; $report_days[30] = "1 {month}"; $report_days[60] = "2 {months}"; $report_days[90] = "3 {months}"; $report_days[180] = "6 {months}"; $report_days[365] = "1 {year}"; $report_build_time_start = $ligne["report_build_time_start"]; $report_build_time_end = $ligne["report_build_time_end"]; if ($report_build_time_start == 0) { $report_build_time_start = $mindate; } else { $report_build_time_start = date("Y-m-d", $report_build_time_start); } if ($report_build_time_end == 0) { $report_build_time_end = $maxdate; } else { $report_build_time_end = date("Y-m-d", $report_build_time_end); } if ($ligne["report_name"] == null) { $ligne["report_name"] = "New report"; } $html = "<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t" . Field_text_table("report_name-{$t}", "{report}", utf8_encode($ligne["report_name"]), 18, null, 350) . Field_text_table("description-{$t}", "{description}", utf8_encode($ligne["description"]), 18, null, 350) . Field_list_table("report_type-{$t}", "{type}", $ligne["report_type"], 18, $q->report_types) . Field_list_table("report_days-{$t}", "{from_the_last_time}", $ligne["report_days"], 18, $report_days, "ReportDaysCheck()") . "<tr>\n\t\t<td style='font-size:18px' class=legend>{from_date}:</td>\n\t\t<td>" . field_date("report_build_time_start-{$t}", $report_build_time_start, "font-size:18px;padding:3px;width:120px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t</tr>\n<tr>\n\t\t<td style='font-size:18px' class=legend>{to_date}:</td>\n\t\t<td>" . field_date("report_build_time_end-{$t}", $report_build_time_end, "font-size:18px;padding:3px;width:120px", "mindate:{$mindate};maxdate:{$maxdate}") . "</td>\n\t</tr>\t\t" . Field_checkbox_table("recategorize-{$t}", "{recategorize}", $ligne["recategorize"], 18) . Field_checkbox_table("categorize-{$t}", "{categorize}", $ligne["categorize"], 18) . Field_checkbox_table("report_not_categorized-{$t}", "{report_not_categorized}", $ligne["report_not_categorized"], 18) . Field_button_table_autonome("{apply}", "Save{$t}", 26) . "</table>\n\t</div>\t\n<script>\n\n\tvar xSave{$t}= function (obj) {\n\t\tvar res=obj.responseText;\n\t\t\n\t\tif (res.length>3){\n\t\t\talert(res);\n\t\t\treturn;\n\t\t}\n\t\t\$('#SQUID_MAIN_REPORTS').flexReload();\n\t\tRefreshTab('report_single_tab');\n\t}\t\n\t\n\tfunction ReportDaysCheck(){\n\t\tdocument.getElementById('report_build_time_start-{$t}').disabled=true;\n\t\tdocument.getElementById('report_build_time_end-{$t}').disabled=true;\n\t\tvar report_days=document.getElementById('report_days-{$t}').value;\n\t\tif(report_days==0){\n\t\t\tdocument.getElementById('report_build_time_start-{$t}').disabled=false;\n\t\t\tdocument.getElementById('report_build_time_end-{$t}').disabled=false;\t\t\n\t\t}\n\t}\n\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\t\n\t\tXHR.appendData('ID',{$ID});\n\t\tXHR.appendData('report_name',encodeURIComponent(document.getElementById('report_name-{$t}').value));\n\t\tXHR.appendData('description',encodeURIComponent(document.getElementById('description-{$t}').value));\n\t\t\n\t\tXHR.appendData('report_build_time_start',document.getElementById('report_build_time_start-{$t}').value);\n\t\tXHR.appendData('report_build_time_end',document.getElementById('report_build_time_end-{$t}').value);\n\t\t\n\t\tXHR.appendData('report_type',document.getElementById('report_type-{$t}').value);\n\t\tXHR.appendData('report_days',document.getElementById('report_days-{$t}').value);\n\t\tif(document.getElementById('recategorize-{$t}').checked){XHR.appendData('recategorize',1);}else{XHR.appendData('recategorize',0);}\n\t\tif(document.getElementById('categorize-{$t}').checked){XHR.appendData('categorize',1);}else{XHR.appendData('categorize',0);}\n\t\tif(document.getElementById('report_not_categorized-{$t}').checked){XHR.appendData('report_not_categorized',1);}else{XHR.appendData('report_not_categorized',0);}\n\t\t\n\t\t\n\t\t\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\t\nReportDaysCheck();\n</script>\n\t\t\t\n\t\t\t\n\t"; echo $tpl->_ENGINE_parse_body($html); }
function left(){ $page=CurrentPageName(); $tpl=new templates(); $q=new mysql_squid_builder(); $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $mindate=$ligne["tdate"]; $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate=date('Y-m-d'); $cooky=__FILE__.__FUNCTION__; if(!is_numeric($_COOKIE[$cooky])){$_COOKIE[$cooky]=0;} $html=" <input type='hidden' id='ShowTableBlockedDay' value='{$_COOKIE[$cooky]}'> <table style='width:99%' class=form> <tbody> <tr> <td class=legend nowrap>{from_date}:</td> <td>". field_date('sdate',$_GET["day"],"font-size:16px;padding:3px;width:95px","mindate:$mindate;maxdate:$maxdate")."</td> <td>". button("{go}","SquidFlowDaySizeQuery()")."</td> </tr> </tbody> </table> <div id='statistics-days-left-status'></div> <table style='width:99%' class=form> <tbody> <tr> <td width=1%>". imgtootltip("table-show-32.png","{show_table}","ShowTableBlockedSite(1)")."</td> <td><a href=\"javascript:blur();\" OnClick=\"javascript:ShowTableBlockedSite(1)\" style='text-decoration:unerline;font-size:14px'>{show_table}</td> </tr> <tr> <td width=1%>". imgtootltip("graphs-32.png","{show_graphs}","ShowTableBlockedSite(0)")."</td> <td><a href=\"javascript:blur();\" OnClick=\"javascript:ShowTableBlockedSite(0)\" style='text-decoration:unerline;font-size:14px'>{show_graphs}</td> </tr> </tbody> </table> <script> function ShowTableBlockedSite(val){ document.getElementById('ShowTableBlockedDay').value=val; Set_Cookie('$cooky', val, '3600', '/', '', ''); SquidFlowDaySizeQuery(); } function SquidFlowDaySizeQuery(type){ if(!type){ if(document.getElementById('squid-stats-day-hide-type')){type=document.getElementById('squid-stats-day-hide-type').value;} } if(!type){type='size';} var sdate=document.getElementById('sdate').value; var ShowTable=document.getElementById('ShowTableBlockedDay').value; LoadAjax('days-right-infos','$page?day-right-infos=yes&day='+sdate+'&type='+type+'&ShowTable='+ShowTable); } SquidFlowDaySizeQuery(); </script> "; echo $tpl->_ENGINE_parse_body($html); }
function requeteur_popup() { $page = CurrentPageName(); $tpl = new templates(); squid_stats_default_values(); $t = $_GET["t"]; $per["10m"] = "10 {minutes}"; $per["1h"] = "1 {hour}"; $per["1d"] = "1 {day}"; $per["1w"] = "1 {week}"; $per["30d"] = "1 {month}"; $members["MAC"] = "{MAC}"; $members["USERID"] = "{uid}"; $members["IPADDR"] = "{ipaddr}"; $q = new postgres_sql(); $Selectore = $q->fieldSelectore(); $stylelegend = "style='vertical-align:top;font-size:18px;padding-top:5px' nowrap"; $html = "<div style='width:98%;margin-bottom:20px' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td {$stylelegend} class=legend>{from_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("from-date-{$t}", $_SESSION["SQUID_STATS_DATE1"], ";font-size:18px;width:160px", $Selectore) . "\n\t\t " . Field_text("from-time-{$t}", $_SESSION["SQUID_STATS_TIME1"], ";font-size:18px;width:82px") . "</td>\n\t\t\n\t</tr>\n\t\t<td {$stylelegend} class=legend>{to_date}:</td>\n\t\t<td style='vertical-align:top;font-size:18px'>" . field_date("to-date-{$t}", $_SESSION["SQUID_STATS_DATE2"], ";font-size:18px;width:160px", $Selectore) . "\n\t\t " . Field_text("to-time-{$t}", $_SESSION["SQUID_STATS_TIME2"], ";font-size:18px;width:82px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td {$stylelegend} class=legend>{interval}:</td>\n\t\t<td style='vertical-align:top;font-size:18px;'>" . Field_array_Hash($per, "interval-{$t}", "10m", "blur()", null, 0, "font-size:18px;") . "</td>\n\t</tr>\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td {$stylelegend} class=legend>{member}:</td>\n\t\t<td style='vertical-align:top;font-size:18px;'>" . Field_text("members-search-{$t}", "*", "font-size:18px;") . "</td>\n\t</tr>\t\t\t\t\n\t<tr style='height:50px'>\t\n\t\t<td style='vertical-align:top;font-size:18px;' colspan=2 align='right'>" . button("{generate_statistics}", "Run{$t}()", 22) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n<script>\nfunction Run{$t}(){\n\tvar date1=document.getElementById('from-date-{$t}').value;\n\tvar time1=document.getElementById('from-time-{$t}').value;\n\tvar date2=document.getElementById('to-date-{$t}').value\n\tvar time2=document.getElementById('to-time-{$t}').value;\n\tvar user='';\n\tvar interval=document.getElementById('interval-{$t}').value;\n\tvar searchuser=encodeURIComponent(document.getElementById('members-search-{$t}').value);\n\tvar categories='';\n\tLoadjs('{$page}?query-js=yes&t={$t}&container=graph-{$t}&categories='+categories+'&searchuser='******'&date1='+date1+'&time1='+time1+'&date2='+date2+'&time2='+time2+'&interval='+interval+'&user='+user);\n\n}\n</script>\n"; echo $tpl->_ENGINE_parse_body($html); }
function general_status_graphs(){ $page=CurrentPageName(); $tpl=new templates(); $q=new mysql_squid_builder(); $selected_date="{last_30days}"; $filter="zDate>DATE_SUB(NOW(),INTERVAL 30 DAY) AND zDate<DATE_SUB(NOW(),INTERVAL 1 DAY)"; $file_prefix="default"; $type='hits'; $field="totalBlocked"; $prefix_title="{blocked} ({hits})"; $hasSize=false; if(isset($_GET["from"])){ $filter="zDate>='{$_GET["from"]}' AND zDate<='{$_GET["to"]}'"; $selected_date="{from_date} {$_GET["from"]} - {to_date} {$_GET["to"]}"; $default_from_date=$_GET["from"]; $default_to_date=$_GET["to"]; $file_prefix="$default_from_date-$default_to_date"; } $sql="SELECT $field,DATE_FORMAT(zDate,'%d') as tdate FROM tables_day WHERE $filter ORDER BY zDate"; $results=$q->QUERY_SQL($sql); if(!$q->ok){echo "<H2>$q->mysql_error</H2><center style='font-size:11px'><code>$sql</code></center>";} while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){ $xdata[]=$ligne["tdate"]; if($hasSize){$ydata[]=round(($ligne[$field]/1024)/1000);}else{$ydata[]=$ligne[$field];} } $targetedfile="ressources/logs/".basename(__FILE__).".".__FUNCTION__.".blocked.$file_prefix.$type.png"; $gp=new artica_graphs(); $gp->width=540; $gp->height=350; $gp->filename="$targetedfile"; $gp->xdata=$xdata; $gp->ydata=$ydata; $gp->y_title=null; $gp->x_title=$tpl->_ENGINE_parse_body("{days}"); $gp->title=null; $gp->margin0=true; $gp->Fillcolor="blue@0.9"; $gp->color="146497"; $gp->line_green(); if(!is_file($targetedfile)){writelogs("Fatal \"$targetedfile\" no such file!",__FUNCTION__,__FILE__,__LINE__);$targetedfile="img/kas-graph-no-datas.png";} if($default_from_date==null){ $sql="SELECT DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 30 DAY),'%Y-%m-%d') as tdate"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $default_from_date=$ligne["tdate"]; } if($default_to_date==null){ $sql="SELECT DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 DAY),'%Y-%m-%d') as tdate"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $default_to_date=$ligne["tdate"]; } $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $mindate=$ligne["tdate"]; $sql="SELECT DATE_FORMAT(zDate,'%Y-%m-%d') as tdate FROM tables_day ORDER BY zDate DESC LIMIT 0,1"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $maxdate=$ligne["tdate"]; echo $tpl->_ENGINE_parse_body("<div ><h3 style='margin-bottom:10px;color:black'> $prefix_title/{days} - $selected_date</h3> <center> <img src='$targetedfile'> </center> </div> <table style='margin-top:10px' class=form> <tbody> <tr> <td class=legend nowrap>{from_date}:</td> <td>". field_date('from_date1',$default_from_date,"font-size:16px;padding:3px;width:95px","mindate:$mindate;maxdate:$maxdate")."</td> <td class=legend nowrap>{to_date}:</td> <td>". field_date('to_date1',$default_to_date,"font-size:16px;padding:3px;width:95px","mindate:$mindate;maxdate:$maxdate")."</td> <td width=1%>". button("{apply}","SquidFlowSizeQuery('$type')")."</td> </tr> </table> <p> </p> <div id='squid-cache-flow-performance'></div> <script> function SquidFlowSizeQuery(type){ if(!type){type='';} var from=document.getElementById('from_date1').value; var to=document.getElementById('to_date1').value; LoadAjax('squid-status-graphs','$page?squid-status-graphs=yes&from='+from+'&to='+to+'&type='+type); } LoadAjax('squid-cache-flow-performance','$page?squid-cache-flow-performance=yes&from=$default_from_date&to=$default_to_date&type=$type'); </script> "); }