function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $t = time();
    $sql = "SELECT zDate,not_categorized FROM tables_day 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"];
        $ydata[] = $ligne["not_categorized"];
    }
    $targetedfile = "ressources/logs/" . basename(__FILE__) . "." . __FUNCTION__ . ".png";
    $gp = new artica_graphs();
    $gp->width = 880;
    $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";
    }
    $sql = "SELECT zDate,not_categorized FROM tables_day WHERE not_categorized>0 ORDER BY zDate DESC";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2><center style='font-size:11px'><code>{$sql}</code></center>";
    }
    $c = 0;
    $table = null;
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $c++;
        $table = $table . "<tr>\n\t\t\t<td style='font-size:14px' width=99%><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.visited.php?day={$ligne["zDate"]}&onlyNot=yes');\" style='font-size:14px;text-decoration:underline'>{$ligne["zDate"]}</a></td>\n\t\t\t<td style='font-size:14px' width=1%><strong>{$ligne["not_categorized"]}</strong></td>\n\t\t</tr>\n\t\t";
        if ($c > 10) {
            $c = 0;
            $tr[] = "<table style='width:20%' class=form><tbody>{$table}</tbody></table>";
            $table = null;
        }
    }
    if ($c > 0) {
        $tr[] = "<table style='width:20%' class=form><tbody>{$table}</tbody></table>";
    }
    $t = time();
    echo $tpl->_ENGINE_parse_body("\n\t<div id='{$t}'>\n\t<div style='font-size:18px'>{not_categorized}/{days}</div>\n\t\n\t<center>\n\t<div style='margin:8px;float-right;width:100%'>" . button("{analyze}", "NoCategorizedAnalyze()") . "</div>\n\t<img src='{$targetedfile}?t=" . time() . "'>\n\t</center>\n\t" . CompileTrGen($tr, 6) . "\n\t</div>\n\t</div>\n\t<script>\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\t\tif(document.getElementById('squid_stats_consumption')){\n\t    \t\tRefreshTab('squid_stats_consumption');\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('squid_stats_central')){\n\t    \t\tRefreshTab('squid_stats_central');\n\t\t\t}\t\t\t\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\tAnimateDiv('{$t}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_NoCategorizedAnalyze);\n\t\t}\n\t</script>\t\t\n\t\n\t");
}
function schedule_params()
{
    $tpl = new templates();
    $t = time();
    $ID = $_GET["ID"];
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_schedules WHERE ID={$ID}"));
    $page = CurrentPageName();
    for ($i = 0; $i < 60; $i++) {
        $def[] = $i;
    }
    for ($i = 0; $i < 24; $i++) {
        $def1[] = $i;
    }
    if (trim($ligne["TimeText"]) != null) {
        $tbl = explode(" ", $ligne["TimeText"]);
        if ($tbl[4] == '*') {
            $tbl[4] = "0,1,2,3,4,5,6";
        }
        $defaults_days = explode(",", $tbl[4]);
        while (list($num, $line) = each($defaults_days)) {
            $value_default_day[$line] = 1;
        }
        if ($tbl[0] == "*") {
            $tbl[0] = implode(",", $def);
        }
        if ($tbl[1] == "*") {
            $tbl[1] = implode(",", $def1);
        }
        $defaults_min = explode(",", $tbl[0]);
        while (list($num, $line) = each($defaults_min)) {
            $value_default_min[$line] = 1;
        }
        $defaults_hour = explode(",", $tbl[1]);
        while (list($num, $line) = each($defaults_hour)) {
            $value_default_hour[$line] = 1;
        }
    }
    $array_days = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday");
    $count = 0;
    for ($i = 0; $i < 60; $i++) {
        if ($i < 10) {
            $min_text = "0{$i}";
        } else {
            $min_text = $i;
        }
        $checked = null;
        $iconCK = null;
        if ($value_default_min[$i] == 1) {
            $checked = " checked";
            $iconCK = "<i class='icon-ok'></i>";
        }
        $mins[] = "\n\t\t<label class='checkbox'>\n\t\t<input type=\"checkbox\" id='min_{$i}'\n\t\tname=\"min_{$i}\" value=\"1\" OnClick=\"javascript:IconCz(this);\" {$checked}>&nbsp;{$min_text} <span id='min_{$i}-c'>{$iconCK}</span>\n\t\t</label>";
        //Field_checkbox("min_{$i}",1,$value_default_min[$i]);
        $scripts[] = "if(document.getElementById('min_{$i}').checked){XHR.appendData('min_{$i}',1);}else{XHR.appendData('min_{$i}',0);}";
        $UnselectAllMins[] = "document.getElementById('min_{$i}').checked=false;";
        $selectAllMins[] = "document.getElementById('min_{$i}').checked=true;";
        $count = $count + 1;
    }
    for ($i = 0; $i < 24; $i++) {
        if ($i < 10) {
            $hour_text = "0{$i}";
        } else {
            $hour_text = $i;
        }
        $scripts[] = "if(document.getElementById('hour_{$i}').checked){XHR.appendData('hour_{$i}',1);}else{XHR.appendData('hour_{$i}',0);}";
        $UnselectAllHours[] = "document.getElementById('hour_{$i}').checked=false;";
        $selectAllHours[] = "document.getElementById('hour_{$i}').checked=true;";
        $checked = null;
        $iconCK = null;
        if ($value_default_hour[$i] == 1) {
            $checked = " checked";
            $iconCK = "<i class='icon-ok'></i>";
        }
        $hours[] = "\n\t\t<label class='checkbox'>\n\t\t<input type=\"checkbox\" id='hour_{$i}'\n\t\tname=\"hour_{$i}\" value=\"1\" OnClick=\"javascript:IconCz(this);\"  {$checked}>&nbsp;{$hour_text} <span id='hour_{$i}-c'>{$iconCK}</span>\n\t\t</label>";
    }
    while (list($num, $line) = each($array_days)) {
        $checked = null;
        $iconCK = null;
        $line = $tpl->_ENGINE_parse_body("{{$line}}");
        if (intval($value_default_day[$num]) == 1) {
            $checked = " checked";
            $iconCK = "<i class='icon-ok'></i>";
        }
        $dayz[] = "\n\t\t<label class='checkbox'>\n\t\t<input type=\"checkbox\" id='day_{$num}'\n\t\tname=\"day_{$num}\" value=\"1\" OnClick=\"javascript:IconCz(this);\"  {$checked}>&nbsp;{$line} <span id='day_{$num}-c'>{$iconCK}</span>\n\t\t</label>";
        $UnselectAlljs[] = "document.getElementById('day_{$num}').checked=false;";
        $scripts[] = "if(document.getElementById('day_{$num}').checked){XHR.appendData('day_{$num}',1);}else{XHR.appendData('day_{$num}',0);}";
    }
    $minutes = CompileTrGen($mins, $tpl->_ENGINE_parse_body("<p>&nbsp;</p><strong style='font-size:16px;margin-top:5px'>{minutes}</strong><hr style='margin-top:1px'>"), 10);
    $hoursC = CompileTrGen($hours, $tpl->_ENGINE_parse_body("<p>&nbsp;</p><strong style='font-size:16px;margin-top:5px'>{hours}</strong><hr style='margin-top:1px'>"), 10);
    $DaysC = CompileTrGen($dayz, $tpl->_ENGINE_parse_body("<p>&nbsp;</p><strong style='font-size:16px;margin-top:5px'>{days}</strong><hr style='margin-top:1px'>"), 5);
    echo "<div id='{$t}'></div>" . $DaysC . $hoursC . $minutes . "\n\t\n\t<div style='text-align:right'><hr>" . button("{apply}", "SaveCronInfos{$t}()", 18) . "</div>\n\t\t\t\n\t<script>\n\t\tfunction IconCz(doc){\n\t\t\tdocument.getElementById(doc.id+'-c').innerHTML='';\n\t\t\tif(doc.checked){\n\t\t\t\tdocument.getElementById(doc.id+'-c').innerHTML='<i class=\"icon-ok\"></i>';\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\nvar xSaveCronInfos{$t} = function (obj) {\n\tvar results=obj.responseText;\n\tdocument.getElementById('{$t}').innerHTML='';\n\tif(results.length>2){\n\t\talert(results);\n\t}\n\t\n\tExecuteByClassName('SearchFunction');\n}\n\n\n\t\t\t\nvar x_save_cron= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>2){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('TimeText',results);\n\t\tXHR.appendData('ID','{$ID}');\n\t\tXHR.sendAndLoad('{$page}', 'GET',xSaveCronInfos{$t});\n\t}\n}\t\t\t\n\t\t\t\n\tfunction SaveCronInfos{$t}(){\n\t\tAnimateDiv('{$t}');\n\t\tvar XHR = new XHRConnection();\n\t\t" . @implode("\n", $scripts) . "\n\t\tXHR.sendAndLoad('cron.php', 'GET',x_save_cron);\n\t\n\t}\t\t\t\n\t\t\t\n\t</script>";
}