* * By default (if you do not edit this file), events for the public * calendar will be loaded for either: * - the next 30 days * - the next 10 events * * Input parameters: * You can override settings by changing the URL parameters: * - days: number of days ahead to look for events * - cat_id: specify a category id to filter on * - user: login name of calendar to display (instead of public * user), if allowed by System Settings. You must have the * following System Settings configured for this: * Allow viewing other user's calendars: Yes * Public access can view others: Yes * * Security: * TBD */ include "includes/config.php"; include "includes/php-dbi.php"; include "includes/functions.php"; include "includes/$user_inc"; include "includes/connect.php"; load_global_settings (); /* * * Configurable settings for this file. You may change the settings * below to change the default settings. * This settings will likely move into the System Settings in the * web admin interface in a future release. * */ // Change this to false if you still want to access this page even // though you do not have public access enabled. $public_must_be_enabled = true; // Do we include a link to view the event? If so, what target // should we use. $display_link = true; $link_target = '_top'; // Default time window of events to load // Can override with "upcoming.php?days=60" $numDays = 30; // Max number of events to display $maxEvents = 10; // Login of calendar user to use // '__public__' is the login name for the public user $username = '__public__'; // Allow the URL to override the user setting such as // "upcoming.php?user=craig" $allow_user_override = false; // Load layers $load_layers = true; // Load just a specified category (by its id) // Leave blank to not filter on category (unless specified in URL) // Can override in URL with "upcoming.php?cat_id=4" $cat_id = ''; // End configurable settings... // Set for use elsewhere as a global $login = $username; // Load user preferences for DISPLAY_UNAPPROVED load_user_preferences (); $get_unapproved = ! empty ( $DISPLAY_UNAPPROVED ) && $DISPLAY_UNAPPROVED == 'Y'; include "includes/translate.php"; if ( $public_must_be_enabled && $public_access != 'Y' ) { $error = translate ( "You are not authorized" ) . "."; } if ( $allow_user_override ) { $u = getValue ( "user", "[A-Za-z0-9_\.=@,\-]+", true ); if ( ! empty ( $u ) ) { $username = $u; $login = $u; // We also set $login since some functions assume that it is set. } } $cat_id = ''; if ( $categories_enabled == 'Y' ) { $x = getIntValue ( "cat_id", true ); if ( ! empty ( $x ) ) { $cat_id = $x; } } if ( $load_layers ) { load_user_layers ( $username ); } //load_user_categories (); // Calculate date range $date = getIntValue ( "date", true ); if ( empty ( $date ) || strlen ( $date ) != 8 ) { // If no date specified, start with today $date = date ( "Ymd" ); } $thisyear = substr ( $date, 0, 4 ); $thismonth = substr ( $date, 4, 2 ); $thisday = substr ( $date, 6, 2 ); $startTime = mktime ( 3, 0, 0, $thismonth, $thisday, $thisyear ); $x = getIntValue ( "days", true ); if ( ! empty ( $x ) ) { $numDays = $x; } // Don't let a malicious user specify more than 365 days if ( $numDays > 365 ) { $numDays = 365; } $endTime = mktime ( 3, 0, 0, $thismonth, $thisday + $numDays, $thisyear ); $endDate = date ( "Ymd", $endTime ); /* Pre-Load the repeated events for quckier access */ $repeated_events = read_repeated_events ( $username, $cat_id, $date ); /* Pre-load the non-repeating events for quicker access */ $events = read_events ( $username, $date, $endDate, $cat_id ); // Print header without custom header and no style sheet if ( ! empty ( $LANGUAGE ) ) { $charset = translate ( "charset" ); $lang = languageToAbbrev ( ( $LANGUAGE == "Browser-defined" || $LANGUAGE == "none" )? $lang : $LANGUAGE ); if ( $charset != "charset" ) { echo "\n" . "\n" . "\n" . "
\n" . "\n"; } else { echo "\n" . "\n" . "\n" . "\n"; } } else { echo "\n"; $charset = "iso-8859-1"; } echo "