function build_calendar() { $t = $_GET["t"]; if (!is_numeric($t)) { $t = time(); } $page = CurrentPageName(); $obj_cal = new classe_calendrier("calendar-{$t}"); $obj_cal->USLink = true; if (!isset($_GET["month"])) { if (isset($_COOKIE["NavCalendar-month"])) { $_GET["month"] = $_COOKIE["NavCalendar-month"]; } } if (!isset($_GET["year"])) { if (isset($_COOKIE["NavCalendar-year"])) { $_GET["year"] = $_COOKIE["NavCalendar-year"]; } } if (!isset($_GET["month"])) { $_GET["month"] = date("m"); } if (!isset($_GET["year"])) { $_GET["year"] = date("Y"); } if (!isset($_GET["day"])) { $_GET["day"] = date("d"); } $obj_cal->afficheMois(); $obj_cal->afficheSemaines(true); $obj_cal->afficheJours(true); $obj_cal->afficheNavigMois(true); $obj_cal->activeLienMois(); $obj_cal->activeLiensSemaines(); $obj_cal->activeJoursPasses(); $obj_cal->activeJourPresent(); $obj_cal->activeJoursFuturs(); $obj_cal->activeJoursEvenements(); $obj_cal->SetLienJoursJS("FormatQuery{$t}"); $sql = "SELECT DAY(zDate) as tday,\n\tDATE_FORMAT(zDate,'%Y%m%d') as tprefix,\n\tMONTH(zDate) as tmonth,YEAR(zDate) as tyear,totalsize as size,requests as hits\n\tFROM tables_day WHERE MONTH(zDate)={$_GET["month"]} AND YEAR(zDate)={$_GET["year"]} ORDER BY DAY(zDate)"; $q = new mysql_squid_builder(); $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "{$q->mysql_error}.<hr>{$sql}</hr>"; } $month = $_GET["month"]; if (strlen($month) == 1) { $month = "0{$month}"; } $tpl = new templates(); $ERR = array(); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $table_work = "{$ligne["tprefix"]}_hour"; $ligne["size"] = $ligne["size"] / 1024; $ligne["size"] = round($ligne["size"] / 1024); if (strlen($ligne["tday"]) == 1) { $ligne["tday"] = "0" . $ligne["tday"]; } $tr[] = "{$_GET["year"]}-{$month}-{$ligne["tday"]} - size:{$ligne["size"]}"; $TableTime = strtotime("{$_GET["year"]}-{$month}-{$ligne["tday"]} 00:00:00"); if (!$q->TABLE_EXISTS($table_work)) { $REPAIR[] = $tpl->_ENGINE_parse_body("\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'></td>\n\t\t\t\t\t<td><a href=\"javascript:blur();\"\n\t\t\t\t\tOnClick=\"javascript:Loadjs('squid.stats.repair.day.php?time={$TableTime}');\">{repair}: {$_GET["year"]}-{$month}-{$ligne["tday"]}</td>\n\t\t\t\t\t</td>\n\t\t\t\t\t\t\n\t\t\t\t\t"); continue; } $obj_cal->ajouteEvenement("{$_GET["year"]}-{$month}-{$ligne["tday"]}", "Downloaded size:{$ligne["size"]}M | Hits Number: {$ligne["hits"]}"); } $obj_cal->setFormatLienMois("javascript:Blurz();\" OnClick=\"javascript:NavCalendar{$t}('%s','%s');"); $calendar = $obj_cal->makeCalendrier($_GET["year"], $_GET["month"]); if (isset($_GET["build-calendar"])) { echo $calendar; return; } $REPAIRTR = @implode("", $REPAIR); $html = "\n<div id='calendar-{$t}' class=form style='width:95%'>\n{$calendar}{$REPAIRTR}\n</div>\n\n<script>\n\nfunction FormatQuery{$t}(value){\n\tLoadjs('{$page}?FormatQuery=yes&'+value);\n}\n\nfunction NavCalendar{$t}(year,month){\n\tSet_Cookie('NavCalendar-month', month, '3600', '/', '', '');\n\tSet_Cookie('NavCalendar-year', year, '3600', '/', '', '');\n\tLoadAjax('calendar-{$t}','{$page}?build-calendar=yes&t={$t}&year='+year+'&month='+month);\n}\n</script>\n"; echo $html; }
function build_calendar() { $t = $_GET["t"]; if (!is_numeric($t)) { $t = time(); } $page = CurrentPageName(); $obj_cal = new classe_calendrier("calendar-{$t}"); $tpl = new templates(); $obj_cal->USLink = true; $size_text = $tpl->_ENGINE_parse_body("{size}"); $hits_text = $tpl->_ENGINE_parse_body("{hits}"); //$obj_cal->activeAjax($_GET["t"],"LoadCalendar"); if (!isset($_GET["month"])) { if (isset($_COOKIE["NavCalendar-month"])) { $_GET["month"] = $_COOKIE["NavCalendar-month"]; } } if (!isset($_GET["year"])) { if (isset($_COOKIE["NavCalendar-year"])) { $_GET["year"] = $_COOKIE["NavCalendar-year"]; } } if (!isset($_GET["month"])) { $_GET["month"] = date("m"); } if (!isset($_GET["year"])) { $_GET["year"] = date("Y"); } if (!isset($_GET["day"])) { $_GET["day"] = date("d"); } $obj_cal->afficheMois(); $obj_cal->afficheSemaines(true); $obj_cal->afficheJours(true); $obj_cal->afficheNavigMois(true); $obj_cal->activeLienMois(); $obj_cal->activeLiensSemaines(); $obj_cal->SetLienJoursJS("ChangeDay{$t}"); $obj_cal->activeJoursPasses(); $obj_cal->activeJourPresent(); $obj_cal->activeJoursFuturs(); $obj_cal->activeJoursEvenements(); $obj_cal->StyleMoisSize = 18; $obj_cal->StyleJoursSize = 18; $obj_cal->StyleHeight = 50; $obj_cal->InsideEvents = true; $sql = "SELECT DAY(zDate) as tday,\n\tDATE_FORMAT(zDate,'%Y%m%d') as tprefix,\n\tMONTH(zDate) as tmonth,YEAR(zDate) as tyear,totalsize as size,requests as hits\n\tFROM tables_day WHERE MONTH(zDate)={$_GET["month"]} AND YEAR(zDate)={$_GET["year"]} ORDER BY DAY(zDate)"; $q = new mysql_squid_builder(); $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "{$q->mysql_error}.<hr>{$sql}</hr>"; } $month = $_GET["month"]; if (strlen($month) == 1) { $month = "0{$month}"; } $tpl = new templates(); $ERR = array(); while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $table_work = "{$ligne["tprefix"]}_hour"; if ($ligne["tprefix"] == date('Ymd')) { continue; } $ligne["size"] = $ligne["size"] / 1024; $ligne["size"] = FormatBytes($ligne["size"]); if (strlen($ligne["tday"]) == 1) { $ligne["tday"] = "0" . $ligne["tday"]; } $tr[] = "{$_GET["year"]}-{$month}-{$ligne["tday"]} - size:{$ligne["size"]}"; $TableTime = strtotime("{$_GET["year"]}-{$month}-{$ligne["tday"]} 00:00:00"); $ligne["hits"] = FormatNumber($ligne["hits"]); if (!$q->TABLE_EXISTS($table_work)) { $obj_cal->ajouteEvenement("{$_GET["year"]}-{$month}-{$ligne["tday"]}", $tpl->_ENGINE_parse_body("<center><table style='width:5%;border:0px'><tr><td width=1% style='border:0px'><img src='img/status_warning.png'></td><td nowrap width=99% style='border:0px'><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.stats.repair.day.php?time={$TableTime}');\">{repair}</td></td></tr></table></center>")); continue; } $obj_cal->ajouteEvenement("{$_GET["year"]}-{$month}-{$ligne["tday"]}", "<li>{$size_text}:{$ligne["size"]}</li>"); $obj_cal->ajouteEvenement("{$_GET["year"]}-{$month}-{$ligne["tday"]}", "<li>{$hits_text}:{$ligne["hits"]}</li>"); } $obj_cal->setFormatLienMois("javascript:Blurz();\" OnClick=\"javascript:NavCalendar{$t}('%s','%s');"); $calendar = $obj_cal->makeCalendrier($_GET["year"], $_GET["month"]); if (isset($_GET["build-calendar"])) { echo $calendar; return; } $html = "\n\t<div id='calendar-{$t}' style='width:95%;margin-top:35px' class=form>\n\t{$calendar}\n\t</div>\n\t<script>\n\t\tfunction NavCalendar{$t}(year,month){\n\t\t\tSet_Cookie('NavCalendar-month', month, '3600', '/', '', '');\n\t\t\tSet_Cookie('NavCalendar-year', year, '3600', '/', '', '');\n\t\t\tLoadAjax('calendar-{$t}','{$page}?build-calendar=yes&t={$t}&year='+year+'&month='+month);\n\t\t}\n\t\t\n\t\tfunction ChangeDay{$t}(url){\n\t\t\tdocument.location.href='miniadm.webstats.php?t={$t}&'+url;\n\t\t}\n\t\t\n\t</script>\n\t"; echo $html; }