0 ) {
$login = $user = $webcalendar_login;
} else {
echo "Error: No calendar user specified.";
exit;
}
}
include "includes/config.php";
include "includes/php-dbi.php";
include "includes/functions.php";
include "includes/$user_inc";
include "includes/connect.php";
load_global_settings ();
load_user_preferences ();
load_user_layers ();
$view = "week";
include "includes/translate.php";
$today = time() + ($TZ_OFFSET * 60 * 60);
if ( ! empty ( $date ) && ! empty ( $date ) ) {
$thisyear = substr ( $date, 0, 4 );
$thismonth = substr ( $date, 4, 2 );
$thisday = substr ( $date, 6, 2 );
} else {
if ( empty ( $month ) || $month == 0 )
$thismonth = date("m", $today);
else
$thismonth = $month;
if ( empty ( $year ) || $year == 0 )
$thisyear = date("Y", $today);
else
$thisyear = $year;
if ( empty ( $day ) || $day == 0 )
$thisday = date("d", $today);
else
$thisday = $day;
}
$next = mktime ( 3, 0, 0, $thismonth, $thisday + 7, $thisyear );
$prev = mktime ( 3, 0, 0, $thismonth, $thisday - 7, $thisyear );
// We add 2 hours on to the time so that the switch to DST doesn't
// throw us off. So, all our dates are 2AM for that day.
if ( $WEEK_START == 1 )
$wkstart = get_monday_before ( $thisyear, $thismonth, $thisday );
else
$wkstart = get_sunday_before ( $thisyear, $thismonth, $thisday );
$wkend = $wkstart + ( 3600 * 24 * 6 );
$startdate = date ( "Ymd", $wkstart );
$enddate = date ( "Ymd", $wkend );
/* Pre-Load the repeated events for quckier access */
$repeated_events = read_repeated_events ( $login );
/* Pre-load the non-repeating events for quicker access */
$events = read_events ( $login, $startdate, $enddate );
for ( $i = 0; $i < 7; $i++ ) {
$days[$i] = $wkstart + ( 24 * 3600 ) * $i;
$weekdays[$i] = weekday_short_name ( ( $i + $WEEK_START ) % 7 );
$header[$i] = $weekdays[$i] . "
" .
month_short_name ( date ( "m", $days[$i] ) - 1 ) .
" " . date ( "d", $days[$i] );
}
?>
|
|