diff --git a/cal.php b/cal.php index 143530323..365cae752 100644 --- a/cal.php +++ b/cal.php @@ -207,9 +207,8 @@ function date_for_recur($recur, $day, $bom, $eom) // Display a
for each of the events that are on a given day function display_events_for_day($day, $events) { - // For preservation of state in the links - global $PHP_SELF, $cm, $cy; + global $PHP_SELF, $cm, $cy, $COUNTRY; // For all events, try to find the events for this day foreach ($events as $event) { @@ -218,9 +217,12 @@ function display_events_for_day($day, $events) if (($event['type'] == 2 && $event['start'] <= $day && $event['end'] >= $day) || ($event['start'] == $day)) { echo '
', + ($COUNTRY == $event['country'] ? "" : ""), '', stripslashes(htmlentities($event['sdesc'])), - '
'; + '', + ($COUNTRY == $event['country'] ? "" : ""), + '
'; } } } @@ -327,7 +329,7 @@ function read_event($fp) // Put the array elements into variables list( - , , , , + $day, $month, $year, $country, $sdesc, $id, $ldesc, $url, $recur, $tipo, $sdato, $edato ) = $linearr; @@ -345,6 +347,7 @@ function read_event($fp) 'sdesc' => $sdesc, 'url' => $url, 'ldesc' => base64_decode($ldesc), + 'country' => $country, ); } diff --git a/include/layout.inc b/include/layout.inc index 680e7ae62..213716a4e 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -435,39 +435,80 @@ function display_errors($errors) echo ''; } -function display_event($event,$include_date=1) +// Displays an event. Used in event submission +// previews and event information displays +function display_event($event, $include_date = 1) { - for ($i = 1; $i <= 7; $i++) { - $days[$i] = strftime('%A',mktime(12,0,0,4,$i,2001)); - } + global $COUNTRIES; + + // Weekday names array + for ($i = 1; $i <= 7; $i++) { + $days[$i] = strftime('%A', mktime(12, 0, 0, 4, $i, 2001)); + } - $re = array(1=>'First',2=>'Second',3=>'Third',4=>'Fourth',-1=>'Last',-2=>'2nd Last',-3=>'3rd Last'); + // Recurring possibilities + $re = array( + 1 => 'First', + 2 => 'Second', + 3 => 'Third', + 4 => 'Fourth', + -1 => 'Last', + -2 => '2nd Last', + -3 => '3rd Last' + ); - $sday = $event['start'] ? strtotime($event['start']) - : mktime(0,0,1,$event['smonth'],$event['sday'],$event['syear']); - $eday = $event['end'] ? strtotime($event['end']) - : mktime(0,0,1,$event['emonth'],$event['eday'],$event['eyear']); + // Start and end day of this event + $sday = $event['start'] ? strtotime($event['start']) + : mktime(0, 0, 1, $event['smonth'], $event['sday'], $event['syear']); + $eday = $event['end'] ? strtotime($event['end']) + : mktime(0, 0, 1, $event['emonth'], $event['eday'], $event['eyear']); ?> + -
", date("F j, Y", $sday), "\n"; - if ($event['url']) echo ''; - echo "", stripslashes(htmlentities($event['sdesc'])), ""; - if ($event['url']) echo ""; - switch ($event['type']) { - case 2: - case 'multi': - echo " (", date("Y-m-d",$sday), " to ", date("Y-m-d",$eday), ")"; - break; - case 3: - case 'recur': - echo " (Every ", $re[$event['recur']], " ", $days[$event['recur_day']], " of the month)"; - break; - } + + // Print out date if needed + if ($include_date && ($event['start'] || $event['smonth'])) { + echo "", date("F j, Y", $sday), "\n"; + } + + // Print link in case we have one + if ($event['url']) { echo ''; } + // Print event description + echo "", stripslashes(htmlentities($event['sdesc'])), ""; + // End link + if ($event['url']) { echo ""; } + + // Print extra date info for recurring and multiday events + switch ($event['type']) { + case 2: + case 'multi': + echo " (", date("Y-m-d",$sday), " to ", date("Y-m-d",$eday), ")"; + break; + case 3: + case 'recur': + echo " (Every ", $re[$event['recur']], " ", + $days[$event['recur_day']], " of the month)"; + break; + } + + // Print out country information + echo ' (' , $COUNTRIES[$event['country']] , ')'; +?> +
+
", trim($event['ldesc'])); + // If we have an URL, print it out + if ($event['url']) { + echo '

URL: ', + '', + htmlentities($event['url']), ''; + } ?>

",trim($event['ldesc'])); if ($event['url']) {?>

URL: ',htmlentities($event['url']),''; }?>