Example #1
0
function list_weeks()
{
    global $getdate, $this_year, $cal, $dateFormat_week_jump, $week_start_day;
    ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
    $this_day = $day_array2[3];
    $this_month = $day_array2[2];
    $this_year = $day_array2[1];
    $check_week = strtotime($getdate);
    $start_week_time = strtotime(dateOfWeek(date("Ymd", strtotime("{$this_year}-01-01")), $week_start_day));
    $end_week_time = $start_week_time + 6 * 25 * 60 * 60;
    do {
        $weekdate = date("Ymd", $start_week_time);
        $select_week1 = localizeDate($dateFormat_week_jump, $start_week_time);
        $select_week2 = localizeDate($dateFormat_week_jump, $end_week_time);
        if ($check_week >= $start_week_time && $check_week <= $end_week_time) {
            $return .= "<option value=\"week.php?cal={$cal}&amp;getdate={$weekdate}\" selected=\"selected\">{$select_week1} - {$select_week2}</option>\n";
        } else {
            $return .= "<option value=\"week.php?cal={$cal}&amp;getdate={$weekdate}\">{$select_week1} - {$select_week2}</option>\n";
        }
        $start_week_time = strtotime("+1 week", $start_week_time);
        $end_week_time = $start_week_time + 6 * 25 * 60 * 60;
    } while (date("Y", $start_week_time) <= $this_year);
    return $return;
}
function makeTitle($arr, $time)
{
    global $timeFormat, $dateFormat_week;
    $event_text = chopToWordCount(sanitizeForWeb(urldecode($arr["event_text"])), 20);
    if ($time == -1) {
        $start = localizeDate($dateFormat_week, $arr['start_unixtime']);
        $end = localizeDate($dateFormat_week, $arr['end_unixtime'] - 60);
        $title = $event_text;
        if ($start != $end) {
            $title .= "\n{$start} - {$end}";
        }
    } else {
        $start = date($timeFormat, $arr['start_unixtime']);
        $end = date($timeFormat, $arr['end_unixtime']);
        $title = "{$start}: {$event_text}";
        if ($start != $end) {
            $title = "{$event_text}\n{$start} - {$end}";
        }
    }
    if (!empty($arr['location'])) {
        $title .= "\nLocation: " . chopToWordCount(sanitizeForWeb(urldecode($arr['location'])), 20);
    }
    if (!empty($arr['description'])) {
        $title .= "\n\n" . chopToWordCount(sanitizeForWeb(urldecode($arr['description'])), 80);
    }
    $title = trim($title);
    return $title;
}
Example #3
0
define('BASE', '../');
include_once BASE . 'functions/init.inc.php';
require_once BASE . 'functions/date_functions.php';
require_once BASE . 'functions/template.php';
# information for the popup is sent via $_POST by a javascript snippet in
# in function openevent() from functions/date_functions.php
# character encoding has been problematic with popups.
$event = unserialize(stripslashes($_POST['event_data']));
$organizer = unserialize($event['organizer']);
$attendee = unserialize($event['attendee']);
$uid = stripslashes($_POST['uid']);
// Format event time
// All day
if ($_POST['time'] == -1) {
    $start = localizeDate($dateFormat_week, $event['start_unixtime']);
    $end = localizeDate($dateFormat_week, $event['end_unixtime'] - 60);
    $event_times = $lang['l_all_day'] . " {$start}";
    if ($start != $end) {
        $event_times = "{$start} - {$end}";
    }
} else {
    $start = date($timeFormat, $event['start_unixtime']);
    $end = date($timeFormat, $event['end_unixtime']);
    $event_times = "{$start}";
    if ($start != $end) {
        $event_times = "{$start} - {$end}";
    }
}
$event['event_text'] = sanitizeForWeb(urldecode($event['event_text']));
$event['description'] = sanitizeForWeb(urldecode($event['description']));
$event['location'] = sanitizeForWeb(urldecode($event['location']));
Example #4
0
<?php

ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$check_week = strtotime($getdate);
$start_week_time = strtotime(dateOfWeek(date("Ymd", strtotime("{$this_year}-01-01")), $week_start_day));
$end_week_time = $start_week_time + 6 * 25 * 60 * 60;
print "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value);\">\n";
// build the <option> tags
do {
    $weekdate = date("Ymd", $start_week_time);
    $select_week1 = localizeDate($dateFormat_week_jump, $start_week_time);
    $select_week2 = localizeDate($dateFormat_week_jump, $end_week_time);
    if ($check_week >= $start_week_time && $check_week <= $end_week_time) {
        print "<option value=\"week.php?cal={$cal}&amp;getdate={$weekdate}\" selected>{$select_week1} - {$select_week2}</option>\n";
    } else {
        print "<option value=\"week.php?cal={$cal}&amp;getdate={$weekdate}\">{$select_week1} - {$select_week2}</option>\n";
    }
    $start_week_time = strtotime("+1 week", $start_week_time);
    $end_week_time = $start_week_time + 6 * 25 * 60 * 60;
} while (date("Y", $start_week_time) <= $this_year);
// finish <select>
print "</select>";
Example #5
0
    }
    $thisdate = $thisdate + 25 * 60 * 60;
    $i++;
} while ($i < 7);
?>
										</tr>
										<?php 
// print out the day names here
echo "<tr>";
$thisdate = $start_week_time;
$i = 0;
echo "<td class=\"dateback\" width=\"60\"><img src=\"images/spacer.gif\" width=\"1\" height=\"12\" alt=\" \"></td>";
echo "<td class=\"dateback\" width=\"1\"></td>";
do {
    $thisday = date("Ymd", $thisdate);
    $thisday3 = localizeDate($dateFormat_week_list, $thisdate);
    echo "<td width=\"70\" colspan=\"" . $nbrGridCols[$thisday] . "\" valign=\"top\" align=\"center\" class=\"dateback\">\n";
    echo "<font class=\"V9\"><a class=\"psf\" href=\"day.php?cal={$cal}&amp;getdate={$thisday}\">{$thisday3}</a></font>\n";
    echo "</td>\n";
    $thisdate = $thisdate + 25 * 60 * 60;
    $i++;
} while ($i < 7);
echo "</tr>";
?>
										<tr>
											<td width="60"><img src="images/spacer.gif" width="60" height="1" alt=" "></td>
											<td width="1"></td>
											<?php 
$thisdate = $start_week_time;
$i = 0;
do {
Example #6
0
    $minical_view = 'day';
}
$starttime = '0500';
$weekstart = 1;
$unix_time = strtotime($getdate);
$today_today = date('Ymd', strtotime("now + {$second_offset} seconds"));
$tomorrows_date = date('Ymd', strtotime('+1 day', $unix_time));
$yesterdays_date = date('Ymd', strtotime('-1 day', $unix_time));
$display_date = localizeDate($dateFormat_day, $unix_time);
// For the side months
ereg('([0-9]{4})([0-9]{2})([0-9]{2})', $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$parse_month = date('Ym', $unix_time);
$thisday2 = localizeDate($dateFormat_week_list, $unix_time);
$start_week_time = strtotime(dateOfWeek($getdate, $week_start_day));
$dayborder = 0;
$nbrGridCols = 1;
if (isset($master_array[$getdate])) {
    foreach ($master_array[$getdate] as $ovlKey => $ovlValue) {
        if ($ovlKey != '-1') {
            foreach ($ovlValue as $ovl2Value) {
                $nbrGridCols = kgv($nbrGridCols, $ovl2Value['event_overlap'] + 1);
            }
        }
    }
}
include BASE . 'includes/header.inc.php';
?>
<center>
Example #7
0
<?php

define('BASE', './');
$current_view = 'year';
require_once BASE . 'functions/ical_parser.php';
require_once BASE . 'functions/list_functions.php';
require_once BASE . 'functions/template.php';
ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$next_year = strtotime("+1 year", strtotime($getdate));
$next_year = date("Ymd", $next_year);
$prev_year = strtotime("-1 year", strtotime($getdate));
$prev_year = date("Ymd", $prev_year);
$sidebar_date = localizeDate($dateFormat_week_list, strtotime($getdate));
// For the side months
ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
// select for calendars
$available = availableCalendars($username, $password, $phpiCal_config->ALL_CALENDARS_COMBINED);
$list_icals = display_ical_list($available);
$list_years = list_years();
$list_months = list_months();
$list_weeks = list_weeks();
$list_jumps = list_jumps();
$list_calcolors = '<img src="templates/' . $template . '/images/allday_dot.gif" alt=" " width="11" height="10" border="0" />' . $lang['l_all_day'] . '<br>
<img src="templates/' . $template . '/images/event_dot.gif" alt=" " width="11" height="10" border="0" />' . $lang['l_event'] . "<br>";
$list_icals_pick = display_ical_list($available, TRUE);
Example #8
0
 function monthbottom()
 {
     global $template, $getdate, $master_array, $this_year, $this_month, $cal, $timeFormat, $timeFormat_small, $dateFormat_week_list, $lang;
     preg_match("!<\\!-- loop showbottomevents_odd on -->(.*)<\\!-- loop showbottomevents_odd off -->!is", $this->page, $match1);
     preg_match("!<\\!-- loop showbottomevents_even on -->(.*)<\\!-- loop showbottomevents_even off -->!is", $this->page, $match2);
     $loop[0] = trim($match1[1]);
     $loop[1] = trim($match2[1]);
     $m_start = $this_year . $this_month . '01';
     $u_start = strtotime($m_start);
     $i = 0;
     do {
         if (isset($master_array[$m_start])) {
             foreach ($master_array[$m_start] as $cal_time => $event_times) {
                 $switch['CAL'] = $cal;
                 $switch['START_DATE'] = localizeDate($dateFormat_week_list, $u_start);
                 foreach ($event_times as $uid => $val) {
                     $switch['CALNAME'] = $val['calname'];
                     if (!isset($val['event_start'])) {
                         $switch['START_TIME'] = $lang['l_all_day'];
                         $switch['EVENT_TEXT'] = openevent($m_start, $cal_time, $uid, $val, $month_event_lines, 15, 'psf');
                         $switch['DESCRIPTION'] = urldecode($val['description']);
                     } else {
                         $event_start = $val['start_unixtime'];
                         $event_end = isset($val['display_end']) ? $val['display_end'] : $val["event_end"];
                         $event_start = date($timeFormat, $val['start_unixtime']);
                         $event_end = date($timeFormat, @strtotime($event_end));
                         $switch['START_TIME'] = $event_start . ' - ' . $event_end;
                         $switch['EVENT_TEXT'] = openevent($m_start, $cal_time, $uid, $val, 0, 15, 'psf');
                         $switch['DESCRIPTION'] = urldecode($val['description']);
                     }
                     if ($switch['EVENT_TEXT'] != '') {
                         $switch['DAYLINK'] = $m_start;
                         $temp = $loop[$i];
                         foreach ($switch as $tag => $data) {
                             $temp = str_replace('{' . $tag . '}', $data, $temp);
                         }
                         $middle .= $temp;
                         $i = $i == 1 ? 0 : 1;
                     }
                 }
             }
         }
         $u_start = strtotime("+1 day", $u_start);
         $m_start = date('Ymd', $u_start);
         $check_month = date('m', $u_start);
         unset($switch);
     } while ($this_month == $check_month);
     $this->page = preg_replace('!<\\!-- loop showbottomevents_odd on -->(.*)<\\!-- loop showbottomevents_even off -->!is', $middle, $this->page);
 }
Example #9
0
define('BASE', './');
$current_view = 'year';
require_once BASE . 'functions/ical_parser.php';
require_once BASE . 'functions/list_functions.php';
require_once BASE . 'functions/template.php';
header("Content-Type: text/html; charset={$charset}");
ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
$next_year = strtotime("+1 year", strtotime($getdate));
$next_year = date("Ymd", $next_year);
$prev_year = strtotime("-1 year", strtotime($getdate));
$prev_year = date("Ymd", $prev_year);
$sidebar_date = localizeDate($dateFormat_day, strtotime($getdate));
// For the side months
ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
$this_day = $day_array2[3];
$this_month = $day_array2[2];
$this_year = $day_array2[1];
// select for calendars
$list_icals = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED));
$list_years = list_years();
$list_months = list_months();
$list_weeks = list_weeks();
$list_jumps = list_jumps();
$list_calcolors = '<img src="templates/' . $template . '/images/allday_dot.gif" alt=" " width="11" height="10" border="0" />' . $lang['l_all_day'] . '<br>
<img src="templates/' . $template . '/images/event_dot.gif" alt=" " width="11" height="10" border="0" />' . $lang['l_event'] . "<br>";
$list_icals_pick = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED), TRUE);
// login/logout
Example #10
0
        if ($checkagain != $minical_month) {
            $whole_month = FALSE;
        }
    }
} while ($whole_month == TRUE);
?>
			</table>
			<img src="images/spacer.gif" width="1" height="3" alt=" "><br>
		</td>
	</tr>
</table>
<img src="images/spacer.gif" width="1" height="10" alt=" "><br>
<table width="170" border="0" cellpadding="3" cellspacing="0" class="calborder">
	<tr height="20">
		<td align="center" class="sideback"><font class="G10BOLD"><?php 
print localizeDate($dateFormat_month, strtotime("+1 month", strtotime($getdate)));
?>
</font></td>
	</tr>
	<tr>
		<td bgcolor="#FFFFFF" align="center">
			<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
				<?php 
$start_day = strtotime($week_start_day);
echo '<tr>';
for ($i = 0; $i < 7; $i++) {
    $day_num = date("w", $start_day);
    $day = $daysofweekreallyshort_lang[$day_num];
    echo '<td align="center" class="G10BOLD">' . $day . '</td>';
    $start_day = strtotime("+1 day", $start_day);
}
Example #11
0
		<td width="210" valign="top" align="left">
			<table border="0" width="210" cellspacing="0" cellpadding="0" class="calborder">
				<tr>
					<td colspan="7">
						<table border="0" width="210" cellspacing="0" cellpadding="0">
							<tr>
								<td width="1" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>
								<?php 
    $monthlink = date("Ym", $startYear);
    $monthlink = $monthlink . $this_day;
    ?>
								<td align="center" class="sideback"><?php 
    echo '<a class="ps3" href="month.php?cal=' . $cal . '&amp;getdate=' . $monthlink . '">';
    ?>
<font class="G10BOLD"><?php 
    print localizeDate($dateFormat_month, $startYear);
    ?>
</font></a></td>
								<td width="1" class="sideback"></td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
				<?php 
    $start_day = strtotime($week_start_day);
    for ($i = 0; $i < 7; $i++) {
        $day_num = date("w", $start_day);
        $day = $daysofweekshort_lang[$day_num];
        print '<td width="30" height="14" class="dateback" align="center"><font class="V9BOLD">' . $day . '</font></td>' . "\n";
        $start_day = strtotime("+1 day", $start_day);
Example #12
0
    $week_end = '';
} elseif ($printview == 'week') {
    $start_week = localizeDate($dateFormat_week, $start_week_time);
    $end_week = localizeDate($dateFormat_week, $end_week_time);
    $display_date = "{$start_week} - {$end_week}";
    $week_start = date("Ymd", $start_week_time);
    $week_end = date("Ymd", $end_week_time);
    $next = date("Ymd", strtotime("+1 week", $unix_time));
    $prev = date("Ymd", strtotime("-1 week", $unix_time));
} elseif ($printview == 'month') {
    $display_date = localizeDate($dateFormat_month, strtotime($getdate));
    $next = date("Ymd", strtotime("+1 month", $unix_time));
    $prev = date("Ymd", strtotime("-1 month", $unix_time));
    $week_start = '';
    $week_end = '';
} elseif ($printview == 'year') {
    $display_date = localizeDate($dateFormat_year, strtotime($getdate));
    $next = date("Ymd", strtotime("+1 year", $unix_time));
    $prev = date("Ymd", strtotime("-1 year", $unix_time));
    $week_start = '';
    $week_end = '';
}
require_once BASE . 'functions/ical_parser.php';
require_once BASE . 'functions/list_functions.php';
require_once BASE . 'functions/template.php';
header("Content-Type: text/html; charset={$phpiCal_config->charset}");
$page = new Page(BASE . 'templates/' . $template . '/print.tpl');
$page->replace_files(array('header' => BASE . 'templates/' . $phpiCal_config->template . '/header.tpl', 'footer' => BASE . 'templates/' . $phpiCal_config->template . '/footer.tpl', 'sidebar' => BASE . 'templates/' . $phpiCal_config->template . '/sidebar.tpl'));
$page->replace_tags(array('version' => $phpiCal_config->phpicalendar_version, 'event_js' => '', 'charset' => $phpiCal_config->charset, 'default_path' => $phpiCal_config->default_path, 'default_view' => $phpiCal_config->default_view, 'template' => $phpiCal_config->template, 'cpath' => $phpiCal_config->cpath, 'cal' => $cal, 'getdate' => $getdate, 'calendar_name' => $cal_displayname, 'current_view' => $current_view, 'printview' => $printview, 'display_date' => $display_date, 'sidebar_date' => @$sidebar_date, 'rss_powered' => $rss_powered, 'rss_available' => '', 'rss_valid' => '', 'show_search' => '', 'next_day' => @$next_day, 'prev_day' => @$prev_day, 'show_goto' => '', 'is_logged_in' => '', 'list_icals' => @$list_icals, 'list_years' => @$list_years, 'list_months' => @$list_months, 'list_weeks' => @$list_weeks, 'list_jumps' => @$list_jumps, 'legend' => @$list_calcolors, 'style_select' => @$style_select, 'l_time' => $lang['l_time'], 'l_summary' => $lang['l_summary'], 'l_description' => $lang['l_description'], 'l_calendar' => $lang['l_calendar'], 'l_view_calendars' => $lang['l_view_calendars'], 'l_day' => $lang['l_day'], 'l_week' => $lang['l_week'], 'l_month' => $lang['l_month'], 'l_year' => $lang['l_year'], 'l_location' => $lang['l_location'], 'l_subscribe' => $lang['l_subscribe'], 'l_download' => $lang['l_download'], 'l_no_results' => $lang['l_no_results'], 'l_powered_by' => $lang['l_powered_by'], 'l_this_site_is' => $lang['l_this_site_is']));
$page->draw_print($page);
$page->output();
Example #13
0
 function fetch_assoc()
 {
     $row = $this->resultSet->fetch_assoc();
     if (is_array($row) && isset($_SESSION['sessionTimeZone'])) {
         foreach ($row as $key => $value) {
             // check if value matches datetime format.  Convert to local timezone
             if (isDateTime($value)) {
                 $row[$key] = localizeDate($value, $_SESSION['sessionTimeZone']);
             }
         }
     }
     return $row;
 }
Example #14
0
define('BASE', './');
$current_view = 'day';
require_once BASE . 'functions/ical_parser.php';
require_once BASE . 'functions/list_functions.php';
require_once BASE . 'functions/template.php';
header("Content-Type: text/html; charset={$charset}");
if ($minical_view == 'current') {
    $minical_view = 'day';
}
$weekstart = 1;
$unix_time = strtotime($getdate);
$today_today = date('Ymd', time() + $second_offset);
$next_day = date('Ymd', strtotime("+1 day", $unix_time));
$prev_day = date('Ymd', strtotime("-1 day", $unix_time));
$display_date = localizeDate($dateFormat_day, $unix_time);
$sidebar_date = localizeDate($dateFormat_week_list, $unix_time);
$start_week_time = strtotime(dateOfWeek($getdate, $week_start_day));
// select for calendars
$list_icals = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED));
$list_years = list_years();
$list_months = list_months();
$list_weeks = list_weeks();
$list_jumps = list_jumps();
$list_calcolors = list_calcolors();
$list_icals_pick = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED), TRUE);
// login/logout
$is_logged_in = $username != '' && !$invalid_login ? true : false;
$show_user_login = !$is_logged_in && $allow_login == 'yes';
$login_querys = login_querys();
$logout_querys = logout_querys();
$page = new Page(BASE . 'templates/' . $template . '/day.tpl');
Example #15
0
function icalToArray($filename, $fromdate, $todate)
{
    //      $filename = "/var/www/phpicalendar/calendars/pepe.ics";
    $timezone = "America/Buenos_Aires";
    $tz_array['America/Buenos_Aires'] = array('-0300', '-0300');
    $master_array = array();
    $ifile = @fopen($filename, "r");
    if ($ifile == FALSE) {
        exit("Cant Open file: " . $filename . "\n");
    }
    $nextline = fgets($ifile, 1024);
    if (trim($nextline) != 'BEGIN:VCALENDAR') {
        exit("It is not a valid ical file: " . $filename . "\n");
    }
    //     $master_array['-4'] = Array ( Array  ( 'mtime' => 1182541233, 'filename'  => './calendars/pepe.ics','webcal' => 'no'));
    //     $master_array['-3'] = Array  ( 'pepe');
    // Set a value so we can check to make sure $master_array contains valid data
    $master_array['-1'] = 'valid cal file';
    // Set default calendar name - can be overridden by X-WR-CALNAME
    $calendar_name = $cal_filename;
    $master_array['calendar_name'] = $calendar_name;
    $overlap_array = array();
    // read file in line by line
    // XXX end line is skipped because of the 1-line readahead
    while (!feof($ifile)) {
        $line = $nextline;
        $nextline = fgets($ifile, 1024);
        $nextline = ereg_replace("[\r\n]", "", $nextline);
        #handle continuation lines that start with either a space or a tab (MS Outlook)
        while ($nextline[0] == " " || $nextline[0] == "\t") {
            $line = $line . substr($nextline, 1);
            $nextline = fgets($ifile, 1024);
            $nextline = ereg_replace("[\r\n]", "", $nextline);
        }
        $line = trim($line);
        switch ($line) {
            case 'BEGIN:VEVENT':
                // each of these vars were being set to an empty string
                unset($start_time, $end_time, $start_date, $end_date, $summary, $allday_start, $allday_end, $start, $end, $the_duration, $beginning, $rrule_array, $start_of_vevent, $description, $url, $valarm_description, $start_unixtime, $end_unixtime, $display_end_tmp, $end_time_tmp1, $recurrence_id, $uid, $class, $location, $rrule, $abs_until, $until_check, $until, $bymonth, $byday, $bymonthday, $byweek, $byweekno, $byminute, $byhour, $bysecond, $byyearday, $bysetpos, $wkst, $interval, $number);
                $except_dates = array();
                $except_times = array();
                $bymonth = array();
                $bymonthday = array();
                $first_duration = TRUE;
                $count = 1000000;
                $valarm_set = FALSE;
                $attendee = array();
                $organizer = array();
                break;
            case 'END:VEVENT':
                if (!isset($url)) {
                    $url = '';
                }
                if (!isset($type)) {
                    $type = '';
                }
                // Handle DURATION
                if (!isset($end_unixtime) && isset($the_duration)) {
                    $end_unixtime = $start_unixtime + $the_duration;
                    $end_time = date('Hi', $end_unixtime);
                }
                // CLASS support
                if (isset($class)) {
                    if ($class == 'PRIVATE') {
                        $summary = '**PRIVATE**';
                        $description = '**PRIVATE**';
                    } elseif ($class == 'CONFIDENTIAL') {
                        $summary = '**CONFIDENTIAL**';
                        $description = '**CONFIDENTIAL**';
                    }
                }
                // make sure we have some value for $uid
                if (!isset($uid)) {
                    $uid = $uid_counter;
                    $uid_counter++;
                    $uid_valid = false;
                } else {
                    $uid_valid = true;
                }
                if ($uid_valid && isset($processed[$uid]) && isset($recurrence_id['date'])) {
                    $old_start_date = $processed[$uid][0];
                    $old_start_time = $processed[$uid][1];
                    if ($recurrence_id['value'] == 'DATE') {
                        $old_start_time = '-1';
                    }
                    $start_date_tmp = $recurrence_id['date'];
                    if (!isset($start_date)) {
                        $start_date = $old_start_date;
                    }
                    if (!isset($start_time)) {
                        $start_time = $master_array[$old_start_date][$old_start_time][$uid]['event_start'];
                    }
                    if (!isset($start_unixtime)) {
                        $start_unixtime = $master_array[$old_start_date][$old_start_time][$uid]['start_unixtime'];
                    }
                    if (!isset($end_unixtime)) {
                        $end_unixtime = $master_array[$old_start_date][$old_start_time][$uid]['end_unixtime'];
                    }
                    if (!isset($end_time)) {
                        $end_time = $master_array[$old_start_date][$old_start_time][$uid]['event_end'];
                    }
                    if (!isset($summary)) {
                        $summary = $master_array[$old_start_date][$old_start_time][$uid]['event_text'];
                    }
                    if (!isset($length)) {
                        $length = $master_array[$old_start_date][$old_start_time][$uid]['event_length'];
                    }
                    if (!isset($description)) {
                        $description = $master_array[$old_start_date][$old_start_time][$uid]['description'];
                    }
                    if (!isset($location)) {
                        $location = $master_array[$old_start_date][$old_start_time][$uid]['location'];
                    }
                    if (!isset($organizer)) {
                        $organizer = $master_array[$old_start_date][$old_start_time][$uid]['organizer'];
                    }
                    if (!isset($status)) {
                        $status = $master_array[$old_start_date][$old_start_time][$uid]['status'];
                    }
                    if (!isset($attendee)) {
                        $attendee = $master_array[$old_start_date][$old_start_time][$uid]['attendee'];
                    }
                    if (!isset($url)) {
                        $url = $master_array[$old_start_date][$old_start_time][$uid]['url'];
                    }
                    removeOverlap($start_date_tmp, $old_start_time, $uid, $master_array, $overlap_array);
                    if (isset($master_array[$start_date_tmp][$old_start_time][$uid])) {
                        unset($master_array[$start_date_tmp][$old_start_time][$uid]);
                        // SJBO added $uid twice here
                        if (sizeof($master_array[$start_date_tmp][$old_start_time]) == 0) {
                            unset($master_array[$start_date_tmp][$old_start_time]);
                        }
                    }
                    $write_processed = false;
                } else {
                    $write_processed = true;
                }
                if (!isset($summary)) {
                    $summary = '';
                }
                if (!isset($description)) {
                    $description = '';
                }
                if (!isset($status)) {
                    $status = '';
                }
                if (!isset($class)) {
                    $class = '';
                }
                if (!isset($location)) {
                    $location = '';
                }
                $mArray_begin = mktime(0, 0, 0, 12, 21, $this_year - 1);
                $mArray_end = mktime(0, 0, 0, 1, 12, $this_year + 1);
                if (isset($start_time) && isset($end_time)) {
                    // Mozilla style all-day events or just really long events
                    if ($end_time - $start_time > 2345) {
                        $allday_start = $start_date;
                        $allday_end = $start_date + 1;
                    }
                }
                if (isset($start_unixtime, $end_unixtime) && date('Ymd', $start_unixtime) != date('Ymd', $end_unixtime)) {
                    $spans_day = true;
                    $bleed_check = $start_unixtime - $end_unixtime < 60 * 60 * 24 ? '-1' : '0';
                } else {
                    $spans_day = false;
                    $bleed_check = 0;
                }
                if (isset($start_time) && $start_time != '') {
                    preg_match('/([0-9]{2})([0-9]{2})/', $start_time, $time);
                    preg_match('/([0-9]{2})([0-9]{2})/', $end_time, $time2);
                    if (isset($start_unixtime) && isset($end_unixtime)) {
                        $length = $end_unixtime - $start_unixtime;
                    } else {
                        $length = $time2[1] * 60 + $time2[2] - ($time[1] * 60 + $time[2]);
                    }
                    $drawKey = drawEventTimes($start_time, $end_time);
                    preg_match('/([0-9]{2})([0-9]{2})/', $drawKey['draw_start'], $time3);
                    $hour = $time3[1];
                    $minute = $time3[2];
                }
                // RECURRENCE-ID Support
                if (isset($recurrence_d)) {
                    $recurrence_delete["{$recurrence_d}"]["{$recurrence_t}"] = $uid;
                }
                // handle single changes in recurring events
                // Maybe this is no longer need since done at bottom of parser? - CL 11/20/02
                if ($uid_valid && $write_processed) {
                    if (!isset($hour)) {
                        $hour = 00;
                    }
                    if (!isset($minute)) {
                        $minute = 00;
                    }
                    $processed[$uid] = array($start_date, $hour . $minute, $type);
                }
                // Handling of the all day events
                if (isset($allday_start) && $allday_start != '') {
                    $start = strtotime($allday_start);
                    if ($spans_day) {
                        $allday_end = date('Ymd', $end_unixtime);
                    }
                    if (isset($allday_end)) {
                        $end = strtotime($allday_end);
                    } else {
                        $end = strtotime('+1 day', $start);
                    }
                    // Changed for 1.0, basically write out the entire event if it starts while the array is written.
                    # while loop handles multi-day allday events to write separate master_array elements for each day.
                    if ($start < $mArray_end && $start < $end) {
                        while ($start != $end && $start < $mArray_end) {
                            $start_date2 = date('Ymd', $start);
                            $master_array[$start_date2]['-1'][$uid] = array('event_text' => $summary, 'description' => $description, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'status' => $status, 'class' => $class);
                            $start = strtotime('+1 day', $start);
                        }
                        if (!$write_processed) {
                            $master_array[$start_date]['-1'][$uid]['exception'] = true;
                        }
                    }
                }
                // Handling regular events
                if (isset($start_time) && $start_time != '' && (!isset($allday_start) || $allday_start == '')) {
                    if ($end_time >= $bleed_time && $bleed_check == '-1') {
                        $start_tmp = strtotime(date('Ymd', $start_unixtime));
                        $end_date_tmp = date('Ymd', $end_unixtime);
                        while ($start_tmp < $end_unixtime) {
                            $start_date_tmp = date('Ymd', $start_tmp);
                            if ($start_date_tmp == $start_date) {
                                $time_tmp = $hour . $minute;
                                $start_time_tmp = $start_time;
                            } else {
                                $time_tmp = '0000';
                                $start_time_tmp = '0000';
                            }
                            if ($start_date_tmp == $end_date_tmp) {
                                $end_time_tmp = $end_time;
                            } else {
                                $end_time_tmp = '2400';
                                $display_end_tmp = $end_time;
                            }
                            $master_array[$start_date_tmp][$time_tmp][$uid] = array('event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => true, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url);
                            if (isset($display_end_tmp)) {
                                $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp;
                            }
                            checkOverlap($start_date_tmp, $time_tmp, $uid, $master_array, $overlap_array);
                            $start_tmp = strtotime('+1 day', $start_tmp);
                        }
                        if (!$write_processed) {
                            $master_array[$start_date][$hour . $minute][$uid]['exception'] = true;
                        }
                    } else {
                        if ($bleed_check == '-1') {
                            $display_end_tmp = $end_time;
                            $end_time_tmp1 = '2400';
                        }
                        if (!isset($end_time_tmp1)) {
                            $end_time_tmp1 = $end_time;
                        }
                        // This if statement should prevent writing of an excluded date if its the first recurrance - CL
                        if (!in_array($start_date, $except_dates)) {
                            $master_array[$start_date][$hour . $minute][$uid] = array('event_start' => $start_time, 'event_end' => $end_time_tmp1, 'start_unixtime' => $start_unixtime, 'end_unixtime' => $end_unixtime, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => false, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url);
                            if (isset($display_end_tmp)) {
                                $master_array[$start_date][$hour . $minute][$uid]['display_end'] = $display_end_tmp;
                            }
                            checkOverlap($start_date, $hour . $minute, $uid, $master_array, $overlap_array);
                            if (!$write_processed) {
                                $master_array[$start_date][$hour . $minute][$uid]['exception'] = true;
                            }
                        }
                    }
                }
                // Handling of the recurring events, RRULE
                if (isset($rrule_array) && is_array($rrule_array)) {
                    if (isset($allday_start) && $allday_start != '') {
                        $hour = '-';
                        $minute = '1';
                        $rrule_array['START_DAY'] = $allday_start;
                        $rrule_array['END_DAY'] = $allday_end;
                        $rrule_array['END'] = 'end';
                        $recur_start = $allday_start;
                        $start_date = $allday_start;
                        if (isset($allday_end)) {
                            $diff_allday_days = dayCompare($allday_end, $allday_start);
                        } else {
                            $diff_allday_days = 1;
                        }
                    } else {
                        $rrule_array['START_DATE'] = $start_date;
                        $rrule_array['START_TIME'] = $start_time;
                        $rrule_array['END_TIME'] = $end_time;
                        $rrule_array['END'] = 'end';
                    }
                    $start_date_time = strtotime($start_date);
                    if (!isset($fromdate)) {
                        #this should happen if not in one of the rss views
                        /*						$this_month_start_time = strtotime($this_year.$this_month.'01');
                        						if ($current_view == 'year' || ($save_parsed_cals == 'yes' && !$is_webcal)|| $current_view == 'print' && $printview == 'year') {
                        							$start_range_time = strtotime($this_year.'-01-01 -2 weeks');
                        							$end_range_time = strtotime($this_year.'-12-31 +2 weeks');
                        						} else {
                        							$start_range_time = strtotime('-1 month -2 day', $this_month_start_time);
                        							$end_range_time = strtotime('+2 month +2 day', $this_month_start_time);
                        						}*/
                    } else {
                        $start_range_time = strtotime($fromdate);
                        $end_range_time = strtotime($todate) + 60 * 60 * 24;
                    }
                    foreach ($rrule_array as $key => $val) {
                        switch ($key) {
                            case 'FREQ':
                                switch ($val) {
                                    case 'YEARLY':
                                        $freq_type = 'year';
                                        break;
                                    case 'MONTHLY':
                                        $freq_type = 'month';
                                        break;
                                    case 'WEEKLY':
                                        $freq_type = 'week';
                                        break;
                                    case 'DAILY':
                                        $freq_type = 'day';
                                        break;
                                    case 'HOURLY':
                                        $freq_type = 'hour';
                                        break;
                                    case 'MINUTELY':
                                        $freq_type = 'minute';
                                        break;
                                    case 'SECONDLY':
                                        $freq_type = 'second';
                                        break;
                                }
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = strtolower($val);
                                break;
                            case 'COUNT':
                                $count = $val;
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $count;
                                break;
                            case 'UNTIL':
                                $until = str_replace('T', '', $val);
                                $until = str_replace('Z', '', $until);
                                if (strlen($until) == 8) {
                                    $until = $until . '235959';
                                }
                                $abs_until = $until;
                                ereg('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs);
                                $until = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = localizeDate($dateFormat_week, $until);
                                break;
                            case 'INTERVAL':
                                if ($val > 0) {
                                    $number = $val;
                                    $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $number;
                                }
                                break;
                            case 'BYSECOND':
                                $bysecond = $val;
                                $bysecond = split(',', $bysecond);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $bysecond;
                                break;
                            case 'BYMINUTE':
                                $byminute = $val;
                                $byminute = split(',', $byminute);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $byminute;
                                break;
                            case 'BYHOUR':
                                $byhour = $val;
                                $byhour = split(',', $byhour);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $byhour;
                                break;
                            case 'BYDAY':
                                $byday = $val;
                                $byday = split(',', $byday);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $byday;
                                break;
                            case 'BYMONTHDAY':
                                $bymonthday = $val;
                                $bymonthday = split(',', $bymonthday);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $bymonthday;
                                break;
                            case 'BYYEARDAY':
                                $byyearday = $val;
                                $byyearday = split(',', $byyearday);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $byyearday;
                                break;
                            case 'BYWEEKNO':
                                $byweekno = $val;
                                $byweekno = split(',', $byweekno);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $byweekno;
                                break;
                            case 'BYMONTH':
                                $bymonth = $val;
                                $bymonth = split(',', $bymonth);
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $bymonth;
                                break;
                            case 'BYSETPOS':
                                $bysetpos = $val;
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $bysetpos;
                                break;
                            case 'WKST':
                                $wkst = $val;
                                $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $wkst;
                                break;
                            case 'END':
                                $recur = $master_array[$start_date][$hour . $minute][$uid]['recur'];
                                // Modify the COUNT based on BYDAY
                                if (is_array($byday) && isset($count)) {
                                    $blah = sizeof($byday);
                                    $count = $count / $blah;
                                    unset($blah);
                                }
                                if (!isset($number)) {
                                    $number = 1;
                                }
                                // if $until isn't set yet, we set it to the end of our range we're looking at
                                if (!isset($until)) {
                                    $until = $end_range_time;
                                }
                                if (!isset($abs_until)) {
                                    $abs_until = date('YmdHis', $end_range_time);
                                }
                                $end_date_time = $until;
                                $start_range_time_tmp = $start_range_time;
                                $end_range_time_tmp = $end_range_time;
                                // echo date("Ymd",$until)." ".date("Ymd",$end_range_time)."<br>";
                                // echo date("Ymd",$end_range_time_tmp)." >= ".date("Ymd",$start_date_time)." && ".date("Ymd",$start_range_time_tmp)." <= ".date("Ymd",$end_date_time)."<br>";
                                // If the $end_range_time is less than the $start_date_time, or $start_range_time is greater
                                // than $end_date_time, we may as well forget the whole thing
                                // It doesn't do us any good to spend time adding data we aren't even looking at
                                // this will prevent the year view from taking way longer than it needs to
                                if ($end_range_time_tmp >= $start_date_time && $start_range_time_tmp <= $end_date_time) {
                                    // if the beginning of our range is less than the start of the item, we may as well set it equal to it
                                    if ($start_range_time_tmp < $start_date_time) {
                                        $start_range_time_tmp = $start_date_time;
                                    }
                                    if ($end_range_time_tmp > $end_date_time) {
                                        $end_range_time_tmp = $end_date_time;
                                    }
                                    // initialize the time we will increment
                                    $next_range_time = $start_range_time_tmp;
                                    // FIXME: This is a hack to fix repetitions with $interval > 1
                                    if ($count > 1 && $number > 1) {
                                        $count = 1 + ($count - 1) * $number;
                                    }
                                    $count_to = 0;
                                    // start at the $start_range and go until we hit the end of our range.
                                    if (!isset($wkst)) {
                                        $wkst = 'SU';
                                    }
                                    $wkst3char = two2threeCharDays($wkst);
                                    while ($next_range_time >= $start_range_time_tmp && $next_range_time <= $end_range_time_tmp && $count_to != $count) {
                                        $func = $freq_type . 'Compare';
                                        $diff = $func(date('Ymd', $next_range_time), $start_date);
                                        if ($diff < $count) {
                                            if ($diff % $number == 0) {
                                                $interval = $number;
                                                switch ($rrule_array['FREQ']) {
                                                    case 'DAILY':
                                                        $next_date_time = $next_range_time;
                                                        $recur_data[] = $next_date_time;
                                                        break;
                                                    case 'WEEKLY':
                                                        // Populate $byday with the default day if it's not set.
                                                        if (!isset($byday)) {
                                                            $byday[] = strtoupper(substr(date('D', $start_date_time), 0, 2));
                                                        }
                                                        if (is_array($byday)) {
                                                            foreach ($byday as $day) {
                                                                $day = two2threeCharDays($day);
                                                                #need to find the first day of the appropriate week.
                                                                #dateOfweek uses weekstartday as a global variable. This has to be changed to $wkst,
                                                                #but then needs to be reset for other functions
                                                                $week_start_day_tmp = $week_start_day;
                                                                $week_start_day = $wkst3char;
                                                                $the_sunday = dateOfWeek(date("Ymd", $next_range_time), $wkst3char);
                                                                $next_date_time = strtotime($day, strtotime($the_sunday)) + 12 * 60 * 60;
                                                                $week_start_day = $week_start_day_tmp;
                                                                #see above reset to global value
                                                                #reset $next_range_time to first instance in this week.
                                                                if ($next_date_time < $next_range_time) {
                                                                    $next_range_time = $next_date_time;
                                                                }
                                                                // Since this renders events from $next_range_time to $next_range_time + 1 week, I need to handle intervals
                                                                // as well. This checks to see if $next_date_time is after $day_start (i.e., "next week"), and thus
                                                                // if we need to add $interval weeks to $next_date_time.
                                                                if ($next_date_time > strtotime($week_start_day, $next_range_time) && $interval > 1) {
                                                                    #	$next_date_time = strtotime('+'.($interval - 1).' '.$freq_type, $next_date_time);
                                                                }
                                                                $recur_data[] = $next_date_time;
                                                            }
                                                        }
                                                        break;
                                                    case 'MONTHLY':
                                                        if (empty($bymonth)) {
                                                            $bymonth = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
                                                        }
                                                        $next_range_time = strtotime(date('Y-m-01', $next_range_time));
                                                        $next_date_time = $next_date_time;
                                                        if (isset($bysetpos)) {
                                                            /* bysetpos code from dustinbutler
                                                            			start on day 1 or last day. 
                                                            			if day matches any BYDAY the count is incremented. 
                                                            			SETPOS = 4, need 4th match 
                                                            			SETPOS = -1, need 1st match 
                                                            		 	*/
                                                            $year = date('Y', $next_range_time);
                                                            $month = date('m', $next_range_time);
                                                            if ($bysetpos > 0) {
                                                                $next_day = '+1 day';
                                                                $day = 1;
                                                            } else {
                                                                $next_day = '-1 day';
                                                                $day = $totalDays[$month];
                                                            }
                                                            $day = mktime(0, 0, 0, $month, $day, $year);
                                                            $countMatch = 0;
                                                            while ($countMatch != abs($bysetpos)) {
                                                                /* Does this day match a BYDAY value? */
                                                                $thisDay = $day;
                                                                $textDay = strtoupper(substr(date('D', $thisDay), 0, 2));
                                                                if (in_array($textDay, $byday)) {
                                                                    $countMatch++;
                                                                }
                                                                $day = strtotime($next_day, $thisDay);
                                                            }
                                                            $recur_data[] = $thisDay;
                                                        } elseif (isset($bymonthday) && !isset($byday)) {
                                                            foreach ($bymonthday as $day) {
                                                                if ($day < 0) {
                                                                    $day = date('t', $next_range_time) + $day + 1;
                                                                }
                                                                $year = date('Y', $next_range_time);
                                                                $month = date('m', $next_range_time);
                                                                if (checkdate($month, $day, $year)) {
                                                                    $next_date_time = mktime(0, 0, 0, $month, $day, $year);
                                                                    $recur_data[] = $next_date_time;
                                                                }
                                                            }
                                                        } elseif (is_array($byday)) {
                                                            foreach ($byday as $day) {
                                                                ereg('([-\\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr);
                                                                //Added for 2.0 when no modifier is set
                                                                if ($byday_arr[2] != '') {
                                                                    $nth = $byday_arr[2] - 1;
                                                                } else {
                                                                    $nth = 0;
                                                                }
                                                                $on_day = two2threeCharDays($byday_arr[3]);
                                                                $on_day_num = two2threeCharDays($byday_arr[3], false);
                                                                if (isset($byday_arr[1]) && $byday_arr[1] == '-') {
                                                                    $last_day_tmp = date('t', $next_range_time);
                                                                    $next_range_time = strtotime(date('Y-m-' . $last_day_tmp, $next_range_time));
                                                                    $last_tmp = date('w', $next_range_time) == $on_day_num ? '' : 'last ';
                                                                    $next_date_time = strtotime($last_tmp . $on_day, $next_range_time) - $nth * 604800;
                                                                    $month = date('m', $next_date_time);
                                                                    if (in_array($month, $bymonth)) {
                                                                        $recur_data[] = $next_date_time;
                                                                    }
                                                                    #reset next_range_time to start of month
                                                                    $next_range_time = strtotime(date('Y-m-' . '1', $next_range_time));
                                                                } elseif (isset($bymonthday) && !empty($bymonthday)) {
                                                                    // This supports MONTHLY where BYDAY and BYMONTH are both set
                                                                    foreach ($bymonthday as $day) {
                                                                        $year = date('Y', $next_range_time);
                                                                        $month = date('m', $next_range_time);
                                                                        if (checkdate($month, $day, $year)) {
                                                                            $next_date_time = mktime(0, 0, 0, $month, $day, $year);
                                                                            $daday = strtolower(strftime("%a", $next_date_time));
                                                                            if ($daday == $on_day && in_array($month, $bymonth)) {
                                                                                $recur_data[] = $next_date_time;
                                                                            }
                                                                        }
                                                                    }
                                                                } elseif (isset($byday_arr[1]) && $byday_arr[1] != '-') {
                                                                    $next_date_time = strtotime($on_day, $next_range_time) + $nth * 604800;
                                                                    $month = date('m', $next_date_time);
                                                                    if (in_array($month, $bymonth)) {
                                                                        $recur_data[] = $next_date_time;
                                                                    }
                                                                }
                                                                $next_date = date('Ymd', $next_date_time);
                                                            }
                                                        }
                                                        break;
                                                    case 'YEARLY':
                                                        if (!isset($bymonth) || sizeof($bymonth) == 0) {
                                                            $m = date('m', $start_date_time);
                                                            $bymonth = array("{$m}");
                                                        }
                                                        foreach ($bymonth as $month) {
                                                            // Make sure the month & year used is within the start/end_range.
                                                            if ($month < date('m', $next_range_time)) {
                                                                $year = date('Y', $next_range_time);
                                                            } else {
                                                                $year = date('Y', $next_range_time);
                                                            }
                                                            if (isset($bysetpos)) {
                                                                /* bysetpos code from dustinbutler
                                                                			start on day 1 or last day. 
                                                                			if day matches any BYDAY the count is incremented. 
                                                                			SETPOS = 4, need 4th match 
                                                                			SETPOS = -1, need 1st match 
                                                                			*/
                                                                if ($bysetpos > 0) {
                                                                    $next_day = '+1 day';
                                                                    $day = 1;
                                                                } else {
                                                                    $next_day = '-1 day';
                                                                    $day = date("t", $month);
                                                                }
                                                                $day = mktime(12, 0, 0, $month, $day, $year);
                                                                $countMatch = 0;
                                                                while ($countMatch != abs($bysetpos)) {
                                                                    /* Does this day match a BYDAY value? */
                                                                    $thisDay = $day;
                                                                    $textDay = strtoupper(substr(date('D', $thisDay), 0, 2));
                                                                    if (in_array($textDay, $byday)) {
                                                                        $countMatch++;
                                                                    }
                                                                    $day = strtotime($next_day, $thisDay);
                                                                }
                                                                $recur_data[] = $thisDay;
                                                            }
                                                            if (isset($byday) && is_array($byday)) {
                                                                $checkdate_time = mktime(0, 0, 0, $month, 1, $year);
                                                                foreach ($byday as $day) {
                                                                    ereg('([-\\+]{0,1})?([0-9]{1})?([A-Z]{2})', $day, $byday_arr);
                                                                    if ($byday_arr[2] != '') {
                                                                        $nth = $byday_arr[2] - 1;
                                                                    } else {
                                                                        $nth = 0;
                                                                    }
                                                                    $on_day = two2threeCharDays($byday_arr[3]);
                                                                    $on_day_num = two2threeCharDays($byday_arr[3], false);
                                                                    if ($byday_arr[1] == '-') {
                                                                        $last_day_tmp = date('t', $checkdate_time);
                                                                        $checkdate_time = strtotime(date('Y-m-' . $last_day_tmp, $checkdate_time));
                                                                        $last_tmp = date('w', $checkdate_time) == $on_day_num ? '' : 'last ';
                                                                        $next_date_time = strtotime($last_tmp . $on_day . ' -' . $nth . ' week', $checkdate_time);
                                                                    } else {
                                                                        $next_date_time = strtotime($on_day . ' +' . $nth . ' week', $checkdate_time);
                                                                    }
                                                                }
                                                            } else {
                                                                $day = date('d', $start_date_time);
                                                                $next_date_time = mktime(0, 0, 0, $month, $day, $year);
                                                                //echo date('Ymd',$next_date_time).$summary.'<br>';
                                                            }
                                                            $recur_data[] = $next_date_time;
                                                        }
                                                        if (isset($byyearday)) {
                                                            foreach ($byyearday as $yearday) {
                                                                ereg('([-\\+]{0,1})?([0-9]{1,3})', $yearday, $byyearday_arr);
                                                                if ($byyearday_arr[1] == '-') {
                                                                    $ydtime = mktime(0, 0, 0, 12, 31, $this_year);
                                                                    $yearnum = $byyearday_arr[2] - 1;
                                                                    $next_date_time = strtotime('-' . $yearnum . ' days', $ydtime);
                                                                } else {
                                                                    $ydtime = mktime(0, 0, 0, 1, 1, $this_year);
                                                                    $yearnum = $byyearday_arr[2] - 1;
                                                                    $next_date_time = strtotime('+' . $yearnum . ' days', $ydtime);
                                                                }
                                                                $recur_data[] = $next_date_time;
                                                            }
                                                        }
                                                        break;
                                                    default:
                                                        // anything else we need to end the loop
                                                        $next_range_time = $end_range_time_tmp + 100;
                                                        $count_to = $count;
                                                }
                                            } else {
                                                $interval = 1;
                                            }
                                            $next_range_time = strtotime('+' . $interval . ' ' . $freq_type, $next_range_time);
                                        } else {
                                            // end the loop because we aren't going to write this event anyway
                                            $count_to = $count;
                                        }
                                        // use the same code to write the data instead of always changing it 5 times
                                        if (isset($recur_data) && is_array($recur_data)) {
                                            $recur_data_hour = @substr($start_time, 0, 2);
                                            $recur_data_minute = @substr($start_time, 2, 2);
                                            foreach ($recur_data as $recur_data_time) {
                                                $recur_data_year = date('Y', $recur_data_time);
                                                $recur_data_month = date('m', $recur_data_time);
                                                $recur_data_day = date('d', $recur_data_time);
                                                $recur_data_date = $recur_data_year . $recur_data_month . $recur_data_day;
                                                if ($recur_data_time > $start_date_time && $recur_data_time <= $end_date_time && $count_to != $count && !in_array($recur_data_date, $except_dates)) {
                                                    if (isset($allday_start) && $allday_start != '') {
                                                        $start_time2 = $recur_data_time;
                                                        $end_time2 = strtotime('+' . $diff_allday_days . ' days', $recur_data_time);
                                                        while ($start_time2 < $end_time2) {
                                                            $start_date2 = date('Ymd', $start_time2);
                                                            $master_array[$start_date2]['-1'][$uid] = array('event_text' => $summary, 'description' => $description, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'status' => $status, 'class' => $class, 'recur' => $recur);
                                                            $start_time2 = strtotime('+1 day', $start_time2);
                                                        }
                                                    } else {
                                                        $start_unixtime_tmp = mktime($recur_data_hour, $recur_data_minute, 0, $recur_data_month, $recur_data_day, $recur_data_year);
                                                        $end_unixtime_tmp = $start_unixtime_tmp + $length;
                                                        if ($end_time >= $bleed_time && $bleed_check == '-1') {
                                                            $start_tmp = strtotime(date('Ymd', $start_unixtime_tmp));
                                                            $end_date_tmp = date('Ymd', $end_unixtime_tmp);
                                                            while ($start_tmp < $end_unixtime_tmp) {
                                                                $start_date_tmp = date('Ymd', $start_tmp);
                                                                if ($start_date_tmp == $recur_data_year . $recur_data_month . $recur_data_day) {
                                                                    $time_tmp = $hour . $minute;
                                                                    $start_time_tmp = $start_time;
                                                                } else {
                                                                    $time_tmp = '0000';
                                                                    $start_time_tmp = '0000';
                                                                }
                                                                if ($start_date_tmp == $end_date_tmp) {
                                                                    $end_time_tmp = $end_time;
                                                                } else {
                                                                    $end_time_tmp = '2400';
                                                                    $display_end_tmp = $end_time;
                                                                }
                                                                // Let's double check the until to not write past it
                                                                $until_check = $start_date_tmp . $time_tmp . '00';
                                                                if ($abs_until > $until_check) {
                                                                    $master_array[$start_date_tmp][$time_tmp][$uid] = array('event_start' => $start_time_tmp, 'event_end' => $end_time_tmp, 'start_unixtime' => $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => true, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'recur' => $recur);
                                                                    if (isset($display_end_tmp)) {
                                                                        $master_array[$start_date_tmp][$time_tmp][$uid]['display_end'] = $display_end_tmp;
                                                                    }
                                                                    checkOverlap($start_date_tmp, $time_tmp, $uid, $master_array, $overlap_array);
                                                                }
                                                                $start_tmp = strtotime('+1 day', $start_tmp);
                                                            }
                                                        } else {
                                                            if ($bleed_check == '-1') {
                                                                $display_end_tmp = $end_time;
                                                                $end_time_tmp1 = '2400';
                                                            }
                                                            if (!isset($end_time_tmp1)) {
                                                                $end_time_tmp1 = $end_time;
                                                            }
                                                            // Let's double check the until to not write past it
                                                            $until_check = $recur_data_date . $hour . $minute . '00';
                                                            if ($abs_until > $until_check) {
                                                                $master_array[$recur_data_date][$hour . $minute][$uid] = array('event_start' => $start_time, 'event_end' => $end_time_tmp1, 'start_unixtime' => $start_unixtime_tmp, 'end_unixtime' => $end_unixtime_tmp, 'event_text' => $summary, 'event_length' => $length, 'event_overlap' => 0, 'description' => $description, 'status' => $status, 'class' => $class, 'spans_day' => false, 'location' => $location, 'organizer' => serialize($organizer), 'attendee' => serialize($attendee), 'calnumber' => $calnumber, 'calname' => $actual_calname, 'url' => $url, 'recur' => $recur);
                                                                if (isset($display_end_tmp)) {
                                                                    $master_array[$recur_data_date][$hour . $minute][$uid]['display_end'] = $display_end_tmp;
                                                                }
                                                                checkOverlap($recur_data_date, $hour . $minute, $uid, $master_array, $overlap_array);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            unset($recur_data);
                                        }
                                    }
                                }
                        }
                    }
                }
                // This should remove any exdates that were missed.
                // Added for version 0.9.5 modified in 2.22 remove anything that doesn't have an event_start
                if (is_array($except_dates)) {
                    foreach ($except_dates as $key => $value) {
                        if (isset($master_array[$value])) {
                            foreach ($master_array[$value] as $time => $value2) {
                                if (!isset($value2[$uid]['event_start'])) {
                                    unset($master_array[$value][$time][$uid]);
                                }
                            }
                        }
                    }
                }
                // Clear event data now that it's been saved.
                unset($start_time, $start_time_tmp, $end_time, $end_time_tmp, $start_unixtime, $start_unixtime_tmp, $end_unixtime, $end_unixtime_tmp, $summary, $length, $description, $status, $class, $location, $organizer, $attendee);
                break;
            case 'END:VTODO':
                if (!$vtodo_priority && $status == 'COMPLETED') {
                    $vtodo_sort = 11;
                } elseif (!$vtodo_priority) {
                    $vtodo_sort = 10;
                } else {
                    $vtodo_sort = $vtodo_priority;
                }
                // CLASS support
                if (isset($class)) {
                    if ($class == 'PRIVATE') {
                        $summary = '**PRIVATE**';
                        $description = '**PRIVATE**';
                    } elseif ($class == 'CONFIDENTIAL') {
                        $summary = '**CONFIDENTIAL**';
                        $description = '**CONFIDENTIAL**';
                    }
                }
                $master_array['-2']["{$vtodo_sort}"]["{$uid}"] = array('start_date' => $start_date, 'start_time' => $start_time, 'vtodo_text' => $summary, 'due_date' => $due_date, 'due_time' => $due_time, 'completed_date' => $completed_date, 'completed_time' => $completed_time, 'priority' => $vtodo_priority, 'status' => $status, 'class' => $class, 'categories' => $vtodo_categories, 'description' => $description, 'calname' => $actual_calname);
                unset($start_date, $start_time, $due_date, $due_time, $completed_date, $completed_time, $vtodo_priority, $status, $class, $vtodo_categories, $summary, $description);
                $vtodo_set = FALSE;
                break;
            case 'BEGIN:VTODO':
                $vtodo_set = TRUE;
                break;
            case 'BEGIN:VALARM':
                $valarm_set = TRUE;
                break;
            case 'END:VALARM':
                $valarm_set = FALSE;
                break;
            default:
                unset($field, $data, $prop_pos, $property);
                if (ereg("([^:]+):(.*)", $line, $line)) {
                    $field = $line[1];
                    $data = $line[2];
                    $property = $field;
                    $prop_pos = strpos($property, ';');
                    if ($prop_pos !== false) {
                        $property = substr($property, 0, $prop_pos);
                    }
                    $property = strtoupper($property);
                    switch ($property) {
                        // Start VTODO Parsing
                        //
                        case 'DUE':
                            $datetime = extractDateTime($data, $property, $field, $tz_array);
                            $due_date = $datetime[1];
                            $due_time = $datetime[2];
                            break;
                        case 'COMPLETED':
                            $datetime = extractDateTime($data, $property, $field, $tz_array);
                            $completed_date = $datetime[1];
                            $completed_time = $datetime[2];
                            break;
                        case 'PRIORITY':
                            $vtodo_priority = "{$data}";
                            break;
                        case 'STATUS':
                            $status = "{$data}";
                            break;
                        case 'CLASS':
                            $class = "{$data}";
                            break;
                        case 'CATEGORIES':
                            $vtodo_categories = "{$data}";
                            break;
                            //
                            // End VTODO Parsing
                        //
                        // End VTODO Parsing
                        case 'DTSTART':
                            $datetime = extractDateTime($data, $property, $field, $tz_array);
                            $start_unixtime = $datetime[0];
                            $start_date = $datetime[1];
                            $start_time = $datetime[2];
                            $allday_start = $datetime[3];
                            break;
                        case 'DTEND':
                            $datetime = extractDateTime($data, $property, $field, $tz_array);
                            $end_unixtime = $datetime[0];
                            $end_date = $datetime[1];
                            $end_time = $datetime[2];
                            $allday_end = $datetime[3];
                            break;
                        case 'EXDATE':
                            $data = split(",", $data);
                            foreach ($data as $exdata) {
                                $exdata = str_replace('T', '', $exdata);
                                $exdata = str_replace('Z', '', $exdata);
                                preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})/', $exdata, $regs);
                                $except_dates[] = $regs[1] . $regs[2] . $regs[3];
                                // Added for Evolution, since they dont think they need to tell me which time to exclude.
                                if ($regs[4] == '' && $start_time != '') {
                                    $except_times[] = $start_time;
                                } else {
                                    $except_times[] = $regs[4] . $regs[5];
                                }
                            }
                            break;
                        case 'SUMMARY':
                            $data = str_replace("\\n", "<br />", $data);
                            $data = str_replace("\\t", "&nbsp;", $data);
                            $data = str_replace("\\r", "<br />", $data);
                            $data = str_replace('$', '&#36;', $data);
                            $data = stripslashes($data);
                            // 						$data = htmlentities(urlencode($data));
                            $data = htmlentities($data);
                            if ($valarm_set == FALSE) {
                                $summary = $data;
                            } else {
                                $valarm_summary = $data;
                            }
                            break;
                        case 'DESCRIPTION':
                            $data = str_replace("\\n", "<br />", $data);
                            $data = str_replace("\\t", "&nbsp;", $data);
                            $data = str_replace("\\r", "<br />", $data);
                            $data = str_replace('$', '&#36;', $data);
                            $data = stripslashes($data);
                            $data = htmlentities(urlencode($data));
                            if ($valarm_set == FALSE) {
                                $description = $data;
                            } else {
                                $valarm_description = $data;
                            }
                            break;
                        case 'RECURRENCE-ID':
                            $parts = explode(';', $field);
                            foreach ($parts as $part) {
                                $eachval = split('=', $part);
                                if ($eachval[0] == 'RECURRENCE-ID') {
                                    // do nothing
                                } elseif ($eachval[0] == 'TZID') {
                                    $recurrence_id['tzid'] = parse_tz($eachval[1]);
                                } elseif ($eachval[0] == 'RANGE') {
                                    $recurrence_id['range'] = $eachval[1];
                                } elseif ($eachval[0] == 'VALUE') {
                                    $recurrence_id['value'] = $eachval[1];
                                } else {
                                    $recurrence_id[] = $eachval[1];
                                }
                            }
                            unset($parts, $part, $eachval);
                            $data = str_replace('T', '', $data);
                            $data = str_replace('Z', '', $data);
                            ereg('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})', $data, $regs);
                            $recurrence_id['date'] = $regs[1] . $regs[2] . $regs[3];
                            $recurrence_id['time'] = $regs[4] . $regs[5];
                            $recur_unixtime = mktime($regs[4], $regs[5], 0, $regs[2], $regs[3], $regs[1]);
                            $dlst = date('I', $recur_unixtime);
                            $server_offset_tmp = chooseOffset($recur_unixtime, &$timezone, &$tz_array);
                            if (isset($recurrence_id['tzid'])) {
                                $tz_tmp = $recurrence_id['tzid'];
                                $offset_tmp = $tz_array[$tz_tmp][$dlst];
                            } elseif (isset($calendar_tz)) {
                                $offset_tmp = $tz_array[$calendar_tz][$dlst];
                            } else {
                                $offset_tmp = $server_offset_tmp;
                            }
                            $recur_unixtime = calcTime($offset_tmp, $server_offset_tmp, $recur_unixtime);
                            $recurrence_id['date'] = date('Ymd', $recur_unixtime);
                            $recurrence_id['time'] = date('Hi', $recur_unixtime);
                            $recurrence_d = date('Ymd', $recur_unixtime);
                            $recurrence_t = date('Hi', $recur_unixtime);
                            unset($server_offset_tmp);
                            break;
                        case 'UID':
                            $uid = $data;
                            break;
                        case 'X-WR-CALNAME':
                            $actual_calname = $data;
                            $master_array['calendar_name'] = $actual_calname;
                            $cal_displaynames[$cal_key] = $actual_calname;
                            #correct the default calname based on filename
                            break;
                        case 'X-WR-TIMEZONE':
                            $calendar_tz = parse_tz($data);
                            $master_array['calendar_tz'] = $calendar_tz;
                            break;
                        case 'DURATION':
                            if ($first_duration == TRUE && !stristr($field, '=DURATION')) {
                                ereg('^P([0-9]{1,2}[W])?([0-9]{1,2}[D])?([T]{0,1})?([0-9]{1,2}[H])?([0-9]{1,2}[M])?([0-9]{1,2}[S])?', $data, $duration);
                                $weeks = str_replace('W', '', $duration[1]);
                                $days = str_replace('D', '', $duration[2]);
                                $hours = str_replace('H', '', $duration[4]);
                                $minutes = str_replace('M', '', $duration[5]);
                                $seconds = str_replace('S', '', $duration[6]);
                                $the_duration = $weeks * 60 * 60 * 24 * 7 + $days * 60 * 60 * 24 + $hours * 60 * 60 + $minutes * 60 + $seconds;
                                $first_duration = FALSE;
                            }
                            break;
                        case 'RRULE':
                            $data = str_replace('RRULE:', '', $data);
                            $rrule = split(';', $data);
                            foreach ($rrule as $recur) {
                                ereg('(.*)=(.*)', $recur, $regs);
                                $rrule_array[$regs[1]] = $regs[2];
                            }
                            break;
                        case 'ATTENDEE':
                            $field = str_replace("ATTENDEE;CN=", "", $field);
                            $data = str_replace("mailto:", "", $data);
                            $attendee[] = array('name' => stripslashes($field), 'email' => stripslashes($data));
                            break;
                        case 'ORGANIZER':
                            $field = str_replace("ORGANIZER;CN=", "", $field);
                            $data = str_replace("mailto:", "", $data);
                            $organizer[] = array('name' => stripslashes($field), 'email' => stripslashes($data));
                            break;
                        case 'LOCATION':
                            $data = str_replace("\\n", "<br />", $data);
                            $data = str_replace("\\t", "&nbsp;", $data);
                            $data = str_replace("\\r", "<br />", $data);
                            $data = stripslashes($data);
                            $location = $data;
                            break;
                        case 'URL':
                            $url = $data;
                            break;
                    }
                }
        }
    }
    unset($master_array['calendar_name']);
    unset($master_array['-1']);
    unset($master_array['-3']);
    unset($master_array['-4']);
    // print_R($master_array);
    // print_R($overlap_array);
    return $master_array;
}
Example #16
0
									</table>
								</td>
							</tr>
						</table>	
					</td>
				</tr>
			</table>
		</td>
		<td width="1%" valign="top" align="left">
	<table cellpadding="0" cellspacing="0" border="0" width="160">
		<tr>
			<td valign="middle" align="center">
				<table width="160" border="0" cellpadding="3" cellspacing="0">
					<tr>
						<td align="center"><font class="G10BOLD"><?php 
print localizeDate($dateFormat_month, strtotime("+1 month", $fake_getdate_time));
?>
</font></td>
					</tr>
					<tr>
						<td bgcolor="#FFFFFF" align="center">
							<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
								<?php 
$start_day = strtotime($week_start_day);
echo '<tr>';
for ($i = 0; $i < 7; $i++) {
    $day_num = date("w", $start_day);
    $day = $daysofweekreallyshort_lang[$day_num];
    echo '<td align="center" class="G10BOLD">' . $day . '</td>';
    $start_day = strtotime("+1 day", $start_day);
}
Example #17
0
				<table border="0" cellspacing="0" cellpadding="0" width="100%">
					<tr>
						<td align="center" valign="top">
							<table width="100%" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td colspan="3" height="1"></td>
								</tr>
								<?php 
// Iterate the entire master array
foreach ($master_array as $key => $val) {
    // Pull out only this months
    ereg("([0-9]{6})([0-9]{2})", $key, $regs);
    if ($regs[1] == $parse_month && $printview == "month" || $key == $getdate && $printview == "day" || $key >= $week_start && $key <= $week_end && $printview == "week") {
        $events_week++;
        $dayofmonth = strtotime($key);
        $dayofmonth = localizeDate($dateFormat_day, $dayofmonth);
        echo "<tr><td width=\"10\"><img src=\"images/spacer.gif\" width=\"10\" height=\"1\" alt=\" \"></td>\n";
        echo "<td align=\"left\" colspan=\"2\"><font class=\"V12\"><b>{$dayofmonth}</b></font></td></tr>";
        echo "<tr><td colspan=\"3\"><img src=\"images/spacer.gif\" width=\"1\" height=\"5\" alt=\" \"></td></tr>\n";
        // Pull out each day
        foreach ($val as $new_val) {
            // Pull out each time
            foreach ($new_val as $new_key2 => $new_val2) {
                if ($new_val2["event_text"]) {
                    $event_text = stripslashes(urldecode($new_val2["event_text"]));
                    $description = stripslashes(urldecode($new_val2["description"]));
                    $event_start = $new_val2["event_start"];
                    $event_end = $new_val2["event_end"];
                    if (isset($new_val2["display_end"])) {
                        $event_end = $new_val2["display_end"];
                    }
Example #18
0
#$rss .= '<language>'.$rss_language.'</language>'."\n";
//generate the items
$numdays = round((strtotime($todate) - strtotime($fromdate)) / (60 * 60 * 24)) + 1;
$thisdate = $fromdate;
#	start at beginning of date range,
# 	note that usage of $thisdate is different from distribution
# 	I use it as a date, dist uses it as a time
$i = 1;
#day counter
$rss .= "<items>\n<rdf:Seq>\n";
$rss_items = '';
$uid_arr = array();
do {
    $thisdate = date('Ymd', strtotime($thisdate));
    #echo "Date: $thisdate<br>\n";
    $dayofweek = localizeDate("%a %b %e %Y", strtotime($thisdate));
    if (isset($master_array[$thisdate]) && sizeof($master_array[$thisdate]) > 0) {
        foreach ($master_array["{$thisdate}"] as $event_times) {
            foreach ($event_times as $uid => $val) {
                #handle multiday all day events
                if (!$val["event_start"]) {
                    if (isset($uid_arr[$uid])) {
                        $uid_arr[$uid] .= "+{$dayofweek}";
                        continue;
                    } else {
                        $uid_arr[$uid] = "{$dayofweek}";
                    }
                    $event_start = $lang['l_all_day'];
                } else {
                    $event_start = @$val["event_start"];
                    $event_start = date($timeFormat, @strtotime("{$event_start}"));
Example #19
0
     $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = strtolower($val);
     break;
 case 'COUNT':
     $count = $val;
     $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $count;
     break;
 case 'UNTIL':
     $until = str_replace('T', '', $val);
     $until = str_replace('Z', '', $until);
     if (strlen($until) == 8) {
         $until = $until . '235959';
     }
     $abs_until = $until;
     ereg('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs);
     $until = mktime($regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1]);
     $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = localizeDate($dateFormat_week, $until, $globals_local);
     break;
 case 'INTERVAL':
     if ($val > 0) {
         $number = $val;
         $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $number;
     }
     break;
 case 'BYSECOND':
     $bysecond = $val;
     $bysecond = split(',', $bysecond);
     $master_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $bysecond;
     break;
 case 'BYMINUTE':
     $byminute = $val;
     $byminute = split(',', $byminute);
Example #20
0
<?php

print "<select name=\"action\" class=\"query_style\" onChange=\"window.location=(this.options[this.selectedIndex].value);\">\n";
$month_time = strtotime("{$this_year}-01-01");
$getdate_month = date("m", strtotime($getdate));
// echo "$this_day, $this_year";
// build the <option> tags
for ($i = 0; $i < 12; $i++) {
    $monthdate = date("Ymd", $month_time);
    $month_month = date("m", $month_time);
    $select_month = localizeDate($dateFormat_month, $month_time);
    if ($month_month == $getdate_month) {
        print "<option value=\"month.php?cal={$cal}&amp;getdate={$monthdate}\" selected>{$select_month}</option>\n";
    } else {
        print "<option value=\"month.php?cal={$cal}&amp;getdate={$monthdate}\">{$select_month}</option>\n";
    }
    $month_time = strtotime("+1 month", $month_time);
}
// finish <select>
print "</select>";
Example #21
0
			<table width="737" border="0" cellspacing="0" cellpadding="3" class="calborder">
				<tr>
					<td colspan="3" align="center" class="sideback" nowrap><div style="height: 16px;" class="G10BOLD"><?php 
    echo "{$this_months_lang}";
    ?>
</div></td>
				</tr>
				<?php 
    $first_time = TRUE;
    // Iterate the entire master array
    foreach ($master_array as $key => $val) {
        // Pull out only this months
        ereg("([0-9]{6})([0-9]{2})", $key, $regs);
        if ($regs[1] == $parse_month) {
            $dayofmonth = strtotime($key);
            $dayofmonth = localizeDate($dateFormat_week_list, $dayofmonth);
            $i = 0;
            if ($today_today == $key) {
                $fontclass = "G10BOLD";
            } else {
                $fontclass = "G10B";
            }
            // Pull out each day
            foreach ($val as $new_val) {
                // Pull out each time
                foreach ($new_val as $new_key2 => $new_val2) {
                    $event_calno = $new_val2['calnumber'];
                    $event_calna = $new_val2['calname'];
                    $event_url = $new_val2['url'];
                    if ($new_val2["event_text"]) {
                        if (isset($new_val2["event_start"])) {
Example #22
0
<?php

define('BASE', '../');
include_once BASE . 'functions/init.inc.php';
include_once BASE . 'functions/date_functions.php';
$vtodo_array = unserialize(base64_decode($HTTP_GET_VARS['vtodo_array']));
// Set the variables from the array
$vtodo_text = isset($vtodo_array['vtodo_text']) ? $vtodo_array['vtodo_text'] : '';
$description = isset($vtodo_array['description']) ? $vtodo_array['description'] : '';
$completed_date = isset($vtodo_array['completed_date']) ? localizeDate($dateFormat_day, strtotime($vtodo_array['completed_date'])) : '';
$status = isset($vtodo_array['status']) ? $vtodo_array['status'] : '';
$calendar_name = isset($vtodo_array['cal']) ? $vtodo_array['cal'] : '';
$start_date = isset($vtodo_array['start_date']) ? localizeDate($dateFormat_day, strtotime($vtodo_array['start_date'])) : '';
$due_date = isset($vtodo_array['due_date']) ? localizeDate($dateFormat_day, strtotime($vtodo_array['due_date'])) : '';
$priority = isset($vtodo_array['priority']) ? $vtodo_array['priority'] : '';
$cal_title_full = $calendar_name . ' ' . $calendar_lang;
$description = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a target="_new" href="\\0">\\0</a>', $description);
$vtodo_text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a target="_new" href="\\0">\\0</a>', $vtodo_text);
$sheet_href = BASE . 'styles/' . $style_sheet . '/default.css';
if ((!isset($status) || $status == "COMPLETED") && isset($completed_date)) {
    $status = "{$completed_date_lang} {$completed_date}";
} else {
    if ($status == "COMPLETED") {
        $status = $completed_lang;
    } else {
        $status = $unfinished_lang;
    }
}
if ($priority >= 1 && $priority <= 4) {
    $priority = $priority_high_lang;
} else {
Example #23
0
         case 'SECONDLY':
             $freq_type = 'second';
             break;
     }
     $recur_array[$start_date][$hour . $minute][$uid]['recur'][$key] = strtolower($val);
     break;
 case 'COUNT':
     $count = $val;
     $recur_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $count;
     break;
 case 'UNTIL':
     # UNTIL must be in UTC
     $until = date("YmdHis", strtotime($val));
     ereg('([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})', $until, $regs);
     $until_unixtime = mktime($regs[4], @$regs[5], @$regs[6], $regs[2], $regs[3], $regs[1]);
     $recur_array[$start_date][$hour . $minute][$uid]['recur'][$key] = localizeDate($dateFormat_week, $until);
     break;
 case 'INTERVAL':
     if ($val > 0) {
         $interval = $val;
         $recur_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $interval;
     }
     break;
 case 'BYSECOND':
     $bysecond = split(',', $val);
     $recur_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $bysecond;
     break;
 case 'BYMINUTE':
     $byminute = split(',', $val);
     $recur_array[$start_date][$hour . $minute][$uid]['recur'][$key] = $byminute;
     break;
Example #24
0
            $rss .= '<title>' . $no_events_week_lang . '</title>' . "\n";
            $rss .= '<link>' . htmlspecialchars("{$default_path}") . '</link>' . "\n";
            $rss .= '</item>' . "\n";
        }
        $thisdate = $thisdate + 25 * 60 * 60;
        $i++;
    } while ($i < 7);
}
if ($rssview == "month") {
    foreach ($master_array as $key => $new_val2) {
        // Pull out only this months
        ereg("([0-9]{6})([0-9]{2})", $key, $regs);
        if ($regs[1] == $parse_month) {
            $getdate = $key;
            $dayofmonth = strtotime($getdate);
            $dayofmonth = localizeDate($rss_month_date, $dayofmonth);
            // Pull out each day
            foreach ($new_val2 as $new_val) {
                // Pull out each time
                foreach ($new_val as $new_key2 => $val) {
                    if ($val["event_text"]) {
                        $event_start = @$val["event_start"];
                        $event_start = date($timeFormat, @strtotime("{$event_start}"));
                        $event_text = stripslashes(urldecode($val["event_text"]));
                        $event_text = strip_tags($event_text, '<b><i><u>');
                        $event_text = word_wrap($event_text, 21, $tomorrows_events_lines);
                        $description = stripslashes(urldecode($val["description"]));
                        $description = strip_tags($description, '<b><i><u>');
                        $rss_title = htmlspecialchars("{$dayofmonth}: {$event_text}");
                        $rss_link = htmlspecialchars("{$default_path}/day.php?getdate={$getdate}&cal={$cal}");
                        $rss_description = htmlspecialchars("{$dayofmonth} {$event_start}: {$description}");
Example #25
0
 public function _phpicalendar($current_view)
 {
     $default_cal_alba = $this->archivo;
     //substr($this->archivo,0, -4);
     // 		$default_cal_alba = BASE.'calendars/'.'Home.ics';
     // 		echo substr($this->archivo,0, -4);
     // 		echo $this->archivo;
     // 		print_r( file($this->archivo));
     $context = sfContext::getInstance();
     require_once BASE . 'ical_parser.php';
     require_once BASE . 'list_functions.php';
     require_once BASE . 'template.php';
     $context->getResponse()->addStylesheet("cal/templates/{$template}/default", '', array());
     $context->getResponse()->addJavascript("cal/event");
     // 		if (isset($_GET['jumpto_day'])) {
     // 			$jumpto_day_time = strtotime($_GET['jumpto_day']);
     // 			if ($jumpto_day_time == -1) {
     // 			$getdate = date('Ymd', time() + $second_offset);
     // 			} else {
     // 			$getdate = date('Ymd', $jumpto_day_time);
     // 			}
     // 		}
     //datos para construir las urls
     $modulo = $context->getRequest()->getParameter('module');
     $action = $context->getRequest()->getParameter('action');
     //sacado de arriba para prueba
     if (!$this->date) {
         $getdate = date('Ymd', time() + $second_offset);
     } else {
         $getdate = $this->date;
     }
     // 		$current_view = 'day';
     // 		header("Content-Type: text/html; charset=$charset");
     if ($minical_view == 'current') {
         $minical_view = $current_view;
     }
     if ($current_view == 'month') {
         // from month.php
         ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
         $this_day = $day_array2[3];
         $this_month = $day_array2[2];
         $this_year = $day_array2[1];
         $unix_time = strtotime($getdate);
         $today_today = date('Ymd', time() + $second_offset);
         $tomorrows_date = date('Ymd', strtotime("+1 day", $unix_time));
         $yesterdays_date = date('Ymd', strtotime("-1 day", $unix_time));
         $sidebar_date = localizeDate($dateFormat_week_list, $unix_time, $globals_local);
         // find out next month
         $next_month_month = $this_month + 1 == '13' ? '1' : $this_month + 1;
         $next_month_day = $this_day;
         $next_month_year = $next_month_month == '1' ? $this_year + 1 : $this_year;
         while (!checkdate($next_month_month, $next_month_day, $next_month_year)) {
             $next_month_day--;
         }
         $next_month_time = mktime(0, 0, 0, $next_month_month, $next_month_day, $next_month_year);
         // find out last month
         $prev_month_month = $this_month - 1 == '0' ? '12' : $this_month - 1;
         $prev_month_day = $this_day;
         $prev_month_year = $prev_month_month == '12' ? $this_year - 1 : $this_year;
         while (!checkdate($prev_month_month, $prev_month_day, $prev_month_year)) {
             $prev_month_day--;
         }
         $prev_month_time = mktime(0, 0, 0, $prev_month_month, $prev_month_day, $prev_month_year);
         $next_month = date("Ymd", $next_month_time);
         $prev_month = date("Ymd", $prev_month_time);
         $display_date = localizeDate($dateFormat_month, $unix_time, $globals_local);
         $parse_month = date("Ym", $unix_time);
         $first_of_month = $this_year . $this_month . "01";
         $start_month_day = dateOfWeek($first_of_month, $week_start_day);
         $thisday2 = localizeDate($dateFormat_week_list, $unix_time, $globals_local);
         $num_of_events2 = 0;
         $list_icals = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED));
         $list_years = list_years();
         $list_months = list_months();
         $list_weeks = list_weeks();
         $list_jumps = list_jumps();
         $list_calcolors = list_calcolors();
         $list_icals_pick = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED), TRUE);
     } elseif ($current_view == 'year') {
         // from year.php
         ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
         $this_day = $day_array2[3];
         $this_month = $day_array2[2];
         $this_year = $day_array2[1];
         $next_year = strtotime("+1 year", strtotime($getdate));
         $next_year = date("Ymd", $next_year);
         $prev_year = strtotime("-1 year", strtotime($getdate));
         $prev_year = date("Ymd", $prev_year);
         $sidebar_date = localizeDate($dateFormat_day, strtotime($getdate), $globals_local);
         // For the side months
         ereg("([0-9]{4})([0-9]{2})([0-9]{2})", $getdate, $day_array2);
         $this_day = $day_array2[3];
         $this_month = $day_array2[2];
         $this_year = $day_array2[1];
     }
     $weekstart = 1;
     $unix_time = strtotime($getdate);
     $today_today = date('Ymd', time() + $second_offset);
     $next_day = date('Ymd', strtotime("+1 day", $unix_time));
     $prev_day = date('Ymd', strtotime("-1 day", $unix_time));
     //from week.php
     $next_week = date("Ymd", strtotime("+1 week", $unix_time));
     $prev_week = date("Ymd", strtotime("-1 week", $unix_time));
     // 		$globals_local = array();
     // 		$globals_local['daysofweek_lang'] = $daysofweek_lang;
     //  		$globals_local['daysofweekshort_lang'] = $daysofweekshort_lang; $globals_local['daysofweekreallyshort_lang'] = $daysofweekreallyshort_lang;
     // 		$globals_local['monthsofyear_lang'] = $monthsofyear_lang;
     // 		$globals_local['monthsofyearshort_lang'] = $monthsofyearshort_lang;
     //         $globals_local['monthsofyear_lang'] = $monthsofyear_lang;
     $sidebar_date = localizeDate($dateFormat_week_list, $unix_time, $globals_local);
     $start_week_time = strtotime(dateOfWeek($getdate, $week_start_day));
     $end_week_time = $start_week_time + ($week_length - 1) * 25 * 60 * 60;
     $start_week = localizeDate($dateFormat_week, $start_week_time, $globals_local);
     $end_week = localizeDate($dateFormat_week, $end_week_time, $globals_local);
     switch ($current_view) {
         case "week":
             $display_date = "{$start_week} - {$end_week}";
             break;
         case "day":
         case "month":
         default:
             $display_date = localizeDate($dateFormat_day, $unix_time, $globals_local);
     }
     // select for calendars
     /*
     $list_icals 	= display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED));
     $list_years 	= list_years();
     $list_months 	= list_months();
     $list_weeks 	= list_weeks();
     $list_jumps 	= list_jumps();
     $list_calcolors = list_calcolors();
     $list_icals_pick = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED), TRUE);
     */
     // login/logout
     /*
     $is_logged_in = ($username != '' && !$invalid_login) ? true : false;
     $show_user_login = (!$is_logged_in && $allow_login == 'yes');
     $login_querys = login_querys();
     $logout_querys = logout_querys();
     */
     //$template = "red";
     $page = new Page(BASE . 'templates/' . $template . "/{$current_view}.tpl");
     $page->cpath = $cpath;
     $page->template_started = $template_started;
     $page->enable_rss = $enable_rss;
     $page->php_started = $php_started;
     $page->daysofweekshort_lang = $daysofweekshort_lang;
     $page->dateFormat_week_list = $dateFormat_week_list;
     $page->daysofweekreallyshort_lang = $daysofweekreallyshort_lang;
     $page->month_event_lines = $month_event_lines;
     $page->minical_view = $minical_view;
     $page->current_view = $current_view;
     $page->dateFormat_month;
     //ver = $dateFormat_month //ver;
     $page->this_month = $this_month;
     $page->this_year = $this_year;
     $page->show_todos = $show_todos;
     $page->show_completed = $show_completed;
     $page->tomorrows_events_lines = $tomorrows_events_lines;
     $page->next_day = $next_day;
     $page->week_length = $week_length;
     $page->day_start = $day_start;
     $page->timeFormat_small = $timeFormat_small;
     $page->gridLength = $gridLength;
     $page->day_array = $day_array;
     $page->start_week_time = $start_week_time;
     $page->unique_colors = $unique_colors;
     $page->week_start_day = $week_start_day;
     $page->the_arr = $the_arr;
     $page->lang = $lang;
     $page->week_end = $week_end;
     $page->week_start = $week_start;
     $page->timeFormat = $timeFormat;
     $page->dateFormat_day = $dateFormat_day;
     $page->printview = $printview;
     $page->daysofweek_lang = $daysofweek_lang;
     $page->is_loged_in = $is_loged_in;
     $page->template = $template;
     $page->master_array = $master_array;
     //print_r ($master_array);echo "here";die;
     $page->getdate = $getdate;
     $page->cal = $cal;
     $page->ALL_CALENDARS_COMBINED = $ALL_CALENDARS_COMBINED;
     $page->subscribe_path = $subscribe_path;
     $page->download_filename = $download_filename;
     $page->globals = $globals_local;
     // 	foreach ($page as $key => &$var) {
     // 		echo $key .'=> ' .$var;
     // 		echo "<br/>";
     // 	}
     // 	die;
     $relativeUrlRoot = sfContext::getInstance()->getRequest()->getRelativeUrlRoot();
     // 	echo $relativeUrlRoot;die;
     // 		$page->replace_files(array(
     // 		'header'			=> BASE.'templates/'.$template.'/header.tpl',
     // 		'event_js'			=> BASE.'event.js',
     // 		'footer'			=> BASE.'templates/'.$template.'/footer.tpl',
     // 		'sidebar'           => BASE.'templates/'.$template.'/sidebar.tpl',
     // 		'search_box'        => BASE.'templates/'.$template.'/search_box.tpl'
     // 		));
     $url_nueva = sfContext::getInstance()->getRequest()->getUri();
     $url_nueva = str_replace("/view/" . $context->getRequest()->getParameter('view') . "/date/" . $getdate, "", $url_nueva);
     $page->replace_files(array('header' => '', 'event_js' => "", 'footer' => '', 'sidebar' => '', 'search_box' => '', 'calendar_nav' => ''));
     $prefixUri = sfContext::getInstance()->getRequest()->getUriPrefix();
     $globals = array("base" => $relativeUrlRoot . "/images/cal", 'day_view_action' => $url_nueva . '/' . $this->verPorDia, 'week_view_action' => $url_nueva . "/" . $this->verPorSemana, 'month_view_action' => $url_nueva . '/' . $this->verPorMes, 'year_view_action' => $url_nueva . '/' . $this->verPorAnio, 'version' => $phpicalendar_version, 'charset' => $charset, 'default_path' => '', 'template' => $template, 'cal' => $cal, 'getdate' => $getdate, 'getcpath' => "&cpath={$cpath}", 'cpath' => $cpath, 'calendar_name' => $cal_displayname, 'current_view' => $current_view, 'display_date' => $display_date, 'sidebar_date' => $sidebar_date, 'rss_powered' => $rss_powered, 'rss_available' => '', 'rss_valid' => '', 'show_search' => $show_search, 'next_day' => $next_day, 'prev_day' => $prev_day, 'show_goto' => '', 'show_user_login' => $show_user_login, 'invalid_login' => $invalid_login, 'login_querys' => $login_querys, 'is_logged_in' => $is_logged_in, 'username' => $username, 'logout_querys' => $logout_querys, 'list_icals' => $list_icals, 'list_icals_pick' => $list_icals_pick, 'list_years' => $list_years, 'list_months' => $list_months, 'list_weeks' => $list_weeks, 'list_jumps' => $list_jumps, 'legend' => $list_calcolors, 'style_select' => $style_select, 'l_goprint' => $lang['l_goprint'], 'l_preferences' => $lang['l_preferences'], 'l_calendar' => $lang['l_calendar'], 'l_legend' => $lang['l_legend'], 'l_tomorrows' => $lang['l_tomorrows'], 'l_jump' => $lang['l_jump'], 'l_todo' => $lang['l_todo'], 'l_day' => $lang['l_day'], 'l_week' => $lang['l_week'], 'l_month' => $lang['l_month'], 'l_year' => $lang['l_year'], 'l_pick_multiple' => $lang['l_pick_multiple'], 'l_powered_by' => $lang['l_powered_by'], 'l_subscribe' => $lang['l_subscribe'], 'l_download' => $lang['l_download'], 'l_search' => $lang['l_search'], 'l_this_site_is' => $lang['l_this_site_is']);
     if ($current_view == 'month') {
         $globals['next_month'] = $next_month;
         $globals['prev_month'] = $prev_month;
         $globals['l_this_months'] = $lang['l_this_months'];
     } elseif ($current_view == 'year') {
         $globals['next_year'] = $next_year;
         $globals['prev_year'] = $prev_year;
         $globals['l_this_year'] = $lang['l_this_year'];
     } elseif ($current_view == 'week') {
         $globals['next_week'] = $next_week;
         $globals['prev_week'] = $prev_week;
     }
     //print_r($globals);
     $page->replace_tags($globals);
     //echo $page->output(); die;
     if ($allow_preferences != 'yes') {
         $page->replace_tags(array('allow_preferences' => ''));
     }
     if ($allow_login == 'yes') {
         $page->replace_tags(array('l_invalid_login' => $lang['l_invalid_login'], 'l_password' => $lang['l_password'], 'l_username' => $lang['l_username'], 'l_login' => $lang['l_login'], 'l_logout' => $lang['l_logout']));
     }
     if ($show_search != 'yes') {
         $page->nosearch($page);
     }
     switch ($current_view) {
         case 'month':
             if ($this_months_events == 'yes') {
                 $page->monthbottom($page);
             } else {
                 $page->nomonthbottom($page);
             }
             break;
         case 'day':
             $page->draw_day($page);
             break;
         case 'week':
             $page->draw_week($page);
             break;
         case 'year':
             break;
     }
     $page->tomorrows_events($page);
     $page->get_vtodo($page);
     // 		$page->tomorrows_events($page);
     // 		$page->get_vtodo($page);
     $page->draw_subscribe($page);
     $this->output = $page->output();
 }