function date_build_calendar()
{
    $t = $_GET["t"];
    $page = CurrentPageName();
    $obj_cal = new classe_calendrier("calendar-{$t}");
    //$obj_cal->activeAjax($_GET["t"],"LoadCalendar");
    if (!isset($_GET["month"])) {
        if (isset($_COOKIE["android-NavCalendar-month"])) {
            $_GET["month"] = $_COOKIE["android-NavCalendar-month"];
        }
    }
    if (!isset($_GET["year"])) {
        if (isset($_COOKIE["android-NavCalendar-year"])) {
            $_GET["year"] = $_COOKIE["android-NavCalendar-year"];
        }
    }
    if (!isset($_GET["month"])) {
        $_GET["month"] = date("m");
    }
    if (!isset($_GET["year"])) {
        $_GET["year"] = date("Y");
    }
    $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();
    $sql = "SELECT DAY(zDate) as tday,MONTH(zDate) as tmonth,YEAR(zDate) as tyear,SUM(QuerySize) as size,SUM(hits) as hits,{$_GET["field"]} \n\tFROM UserAuthDays GROUP BY \n\ttday,tmonth,tyear,{$_GET["field"]}\n\tHAVING {$_GET["field"]}='{$_GET["value"]}' \n\tAND tmonth={$_GET["month"]} AND tyear={$_GET["year"]} ORDER BY tday";
    $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}";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $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"]}";
        $obj_cal->ajouteEvenement("{$_GET["year"]}-{$month}-{$ligne["tday"]}", "Downloaded size:{$ligne["size"]}M&nbsp;|&nbsp;Hits Number: {$ligne["hits"]}");
    }
    //$obj_cal->activeAjax("ajax_calendrier","calendrier.php");
    //makeCalendrier($a_annee,$a_mois)
    $obj_cal->setFormatLienMois("javascript:Blurz();\" OnClick=\"javascript:NavCalendar{$t}('%s','%s');");
    $calendar = $obj_cal->makeCalendrier($_GET["year"], $_GET["month"]);
    $html = "{$calendar}\n\t<script>\n\t\tfunction NavCalendar{$t}(year,month){\n\t\t\tSet_Cookie('android-NavCalendar-month', month, '3600', '/', '', '');\n\t\t\tSet_Cookie('android-NavCalendar-year', year, '3600', '/', '', '');\n\t\t\tLoadAjax('{$t}','{$page}?build-calendar=yes&t={$t}&field={$_GET["field"]}&value={$_GET["value"]}&year='+year+'&month='+month);\n\t\t}\n\t\t\n\t\tfunction ChangeLabelsText(){\n\t\t\tLoadjs('{$page}?ChangeLabelsText=yes&month={$month}&year={$_GET["year"]}');\n\t\t\n\t\t}\n\t\tChangeLabelsText();\n\t</script>\n\t";
    echo $html;
}
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&nbsp;|&nbsp;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;
}
Beispiel #3
0
                $i++;
            }
        }
    }
} else {
    foreach ($entries as $k => $o) {
        $data = get_meta_raw_if_post($o->ID);
        $start = !empty($data['start']) ? date('Y-m-d', $data['start']) : NULL;
        $end = !empty($data['end']) ? date('Y-m-d', $data['end']) : NULL;
        $time = !empty($data['time']) ? $data['time'] : NULL;
        $title = $data['title'];
        if ($start !== $end) {
            $period = getAllDays($start, $end, $aslist = false);
            foreach ($period as $d) {
                $events[$i][$d] = $title;
            }
        } else {
            $events[$i][$start] = $title;
        }
        $i++;
    }
}
//add events to the calendar
if (isset($events) && $events) {
    foreach ($events as $k => $e) {
        foreach ($e as $day => $t) {
            $obj_cal->ajouteEvenement($day, $t . '<br />');
        }
    }
}
print $obj_cal->makeCalendrier(isset($_POST['annee']) ? $_POST['annee'] : date("Y"), isset($_POST['mois']) ? $_POST['mois'] : date("m"));
function calendar_build(){
	$t=$_GET["t"];
	$obj_cal = new classe_calendrier("calendar-$t");
	$obj_cal->USLink=true;
	$obj_cal->afficheMois();
	$obj_cal->afficheSemaines(false);
	$obj_cal->afficheJours(true);
	$obj_cal->afficheNavigMois(true);
	$obj_cal->activeJoursPasses();
	$obj_cal->activeJourPresent();
	
	
	$obj_cal->activeJoursEvenements();	
	
	$obj_cal->setFormatLienMois("javascript:Blurz();\" OnClick=\"javascript:NavCalendar$t('%s','%s');");
	$obj_cal->setFormatLienJours("javascript:Blurz();\" OnClick=\"javascript:NavCalendarJ$t('%s','%s','%s');");

	
	
	
	
	$q=new mysql_squid_builder();
	if(isset($_SESSION["LIST_TABLES_BLOCKED"])){$hash=$_SESSION["LIST_TABLES_BLOCKED"];}else{
	$hash=$q->LIST_TABLES_BLOCKED();
	$_SESSION["LIST_TABLES_BLOCKED"]=$q->LIST_TABLES_BLOCKED();
	}
	
	if(!isset($_SESSION["LIST_TABLES_BLOCKED_EV"])){
	while (list ($tablename,$none ) = each ($hash) ){
		$ct=$q->COUNT_ROWS($tablename);
		if($ct==0){continue;}
		if(!preg_match("#^([0-9]+)_blocked$#", $tablename,$re)){continue;}
		
		$intval=$re[1];
		$Cyear=substr($intval, 0,4);
		$CMonth=substr($intval,4,2);
		$CDay=substr($intval,6,2);
		$CDay=str_replace("_", "", $CDay);
		$time=strtotime("$Cyear-$CMonth-$CDay 00:00:00");		
		$year=date("Y",$time);
		$month=date("m",$time);
		$day=date("d",$time);
		$_SESSION["LIST_TABLES_BLOCKED_EV"]["$year-$month-$day"]="$ct Hits";
		
		$obj_cal->ajouteEvenement("$year-$month-$day","$ct Hits");
	}
	}else{
		$hash=$_SESSION["LIST_TABLES_BLOCKED_EV"];
		while (list ($d,$h ) = each ($hash) ){
			$obj_cal->ajouteEvenement($d,$h);
		}
	}
	
	$calendar=$obj_cal->makeCalendrier($_GET["year"],$_GET["month"]);
	echo $calendar;
	
}
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;
}