Example #1
0
function HyperCacheLogs()
{
    HyperCacheSizeLog("/usr/share/squid3/HyperCacheSizeLog.db");
    $q = new mysql_squid_builder();
    $unix = new unix();
    $files = $unix->DirFiles("/usr/share/squid3", "[0-9]+_HyperCacheSizeLog\\.db");
    while (list($num, $filename) = each($files)) {
        $filepath = "/usr/share/squid3/{$filename}";
        if (!is_file($filepath)) {
            continue;
        }
        $time = $q->TIME_FROM_DAY_TABLE($filename);
        echo "{$filepath} {$time} " . date("Y-m-d") . "\n";
    }
}
function CONDENSED_perform($sourcetable)
{
    $q = new mysql_squid_builder();
    $xtime = $q->TIME_FROM_DAY_TABLE($sourcetable);
    $zDate = date("Y-m-d", $xtime);
    echo "{$sourcetable} = {$zDate}\n";
    $sql = "SELECT SUM(size) as size,SUM(hits) AS `hits`, familysite FROM {$sourcetable} GROUP BY familysite";
    $results = $q->QUERY_SQL($sql);
    $prefix = "INSERT IGNORE INTO FamilyCondensed (zMD5,zDate,size,hits,familysite) VALUES ";
    $f = array();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $md5 = md5(serialize($ligne) . $zDate);
        $familysite = mysql_escape_string2($ligne["familysite"]);
        $size = $ligne["size"];
        $hits = $ligne["hits"];
        $f[] = "('{$md5}','{$zDate}','{$size}','{$hits}','{$familysite}')";
        if (count($f) > 500) {
            $q->QUERY_SQL($prefix . @implode(",", $f));
            if (!$q->ok) {
                return false;
            }
            $f = array();
        }
    }
    if (count($f) > 0) {
        $q->QUERY_SQL($prefix . @implode(",", $f));
        if (!$q->ok) {
            return false;
        }
        $f = array();
    }
    return true;
}
function access_dbmonth()
{
    $q = new mysql_squid_builder();
    $array = $q->LIST_TABLES_ACCESSDB_DAY();
    $current = date("Ymd") . "_daccess";
    while (list($tablename, $none) = each($array)) {
        if ($tablename == $current) {
            continue;
        }
        $time = $q->TIME_FROM_DAY_TABLE($tablename);
        $day = date("Y-m-d", $time);
        $month = date("Ym", $time);
        echo "{$tablename} -{$day} -{$month}\n";
        $monthtable = "{$month}_maccess";
        //zDate      | familysite                  | category | hits | size       | hour | uid               | ipaddr        | MAC
        if (_access_dbmonth($tablename, $monthtable)) {
            $q->QUERY_SQL("DROP TABLE {$tablename}");
        }
    }
}
function section_blocked_form()
{
    $boot = new boostrap_form();
    $q = new mysql_squid_builder();
    $ARRAYTABLES = $q->LIST_TABLES_BLOCKED();
    while (list($tablename, $none) = each($ARRAYTABLES)) {
        $time = $q->TIME_FROM_DAY_TABLE($tablename);
        $days[$time] = time_to_date($time);
    }
    $BLOCKED_CATEGORY_LIMITS[50] = 50;
    $BLOCKED_CATEGORY_LIMITS[250] = 250;
    $BLOCKED_CATEGORY_LIMITS[500] = 250;
    $BLOCKED_CATEGORY_LIMITS[1000] = 1000;
    $BLOCKED_CATEGORY_LIMITS[2000] = 2000;
    krsort($days);
    $boot->set_list("QUERY_BLOCKED_DATE", "{date}", $days, $_SESSION["QUERY_BLOCKED_DATE"]);
    $boot->set_field("QUERY_BLOCKED_UID", "{member}", $_SESSION["QUERY_BLOCKED_UID"]);
    $boot->set_field("QUERY_BLOCKED_CATEGORY", "{category}", $_SESSION["QUERY_BLOCKED_CATEGORY"]);
    $boot->set_list("BLOCKED_CATEGORY_LIMIT", "{rows}", $BLOCKED_CATEGORY_LIMITS, $_SESSION["BLOCKED_CATEGORY_LIMIT"]);
    $boot->set_button("{search}");
    $boot->set_CloseYahoo("YahooWin2");
    $boot->set_formdescription("{advanced_search_explain}");
    $boot->set_RefreshSearchs();
    echo $boot->Compile();
}
Example #5
0
function where_popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $field = $_GET["field"];
    $value = $_GET["value"];
    $month_table = "quotamonth_" . date("Ym");
    $month_text = date("{F}");
    $q = new mysql_squid_builder();
    if (isset($_GET["table"])) {
        $xtime = $q->TIME_FROM_DAY_TABLE($_GET["table"]);
        $month_table = "quotamonth_" . date("Ym", $xtime);
        $month_text = date("{F}", $xtime);
    }
    if ($q->COUNT_ROWS($month_table) == 0) {
        $month_text = date("{F}", strtotime('first day of previous month'));
        $month_table = "quotamonth_" . date("Ym", strtotime('first day of previous month'));
    }
    $title = $tpl->_ENGINE_parse_body("{where} ? »»{{$field}}::{$value} {$title_add}");
    $t = time();
    $sitename = $tpl->_ENGINE_parse_body("{sitename}");
    $category = $tpl->_ENGINE_parse_body("{category}");
    $hits = $tpl->_ENGINE_parse_body("{hits}");
    $size = $tpl->_ENGINE_parse_body("{size}");
    $sitename = $tpl->_ENGINE_parse_body("{sitename}");
    $ipaddr = $tpl->_ENGINE_parse_body("{ipaddr}");
    $members = $tpl->_ENGINE_parse_body("{members}");
    $hostname = $tpl->_ENGINE_parse_body("{hostname}");
    $mac = $tpl->_ENGINE_parse_body("{MAC}");
    $week = $tpl->_ENGINE_parse_body("{week}");
    $month = $tpl->_ENGINE_parse_body("{month}");
    $TB_WIDTH = 550;
    $t = time();
    $buttons = "\n\tbuttons : [\n\t{name: '<b>{$day}</b>', bclass: 'Calendar', onpress : ChangeDay{$t}},\n\t{name: '<b>{$week}</b>', bclass: 'Calendar', onpress : ChangeWeek{$t}},\n\t{name: '<b>{$month}</b>', bclass: 'Calendar', onpress : ChangeMonth{$t}},\n\t\n\t\t],";
    $buttons = null;
    $html = "\n\t<table class='{$t}' style='display: none' id='{$t}' style='width:99%'></table>\n\n<script>\n\n\$(document).ready(function(){\n\$('#{$t}').flexigrid({\n\turl: '{$page}?where-content=yes&field={$field}&value=" . urlencode($value) . "&table={$month_table}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: '{$sitename}', name : 'familysite', width : 181, sortable : true, align: 'left'},\n\t\t{display: '{$size}', name : 'size', width : 109, sortable : true, align: 'left'},\n\n\t\t\n\t\t\n\t],{$buttons}\n\tsearchitems : [\n\t\t{display: '{$sitename}', name : 'familysite'},\n\t\t\n\t\t],\n\tsortname: 'size',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$title}',\n\tuseRp: true,\n\trp: 15,\n\tshowTableToggleBtn: false,\n\twidth: 793,\n\theight: 450,\n\tsingleSelect: true\n\t\n\t});\n});\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}