~ubuntu-gr-webteam/ubuntu-gr-website/drupal6-site

« back to all changes in this revision

Viewing changes to sites/all/modules/date/date_api_ical.inc

  • Committer: Thanos Lefteris
  • Date: 2009-07-29 17:46:54 UTC
  • Revision ID: alefteris@gmail.com-20090729174654-pgfr1vtqw8ikvo5r
* Upgraded calendar module
* Upgraded commentrss module
* Upgraded date module
* Upgraded webfm module

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
/* $Id: date_api_ical.inc,v 1.35.4.26 2009/02/21 12:53:25 karens Exp $ */
 
2
/* $Id: date_api_ical.inc,v 1.35.4.28 2009/05/10 12:44:14 karens Exp $ */
3
3
/**
4
4
 * @file
5
5
 * Parse iCal data.
557
557
function date_ical_date($ical_date, $to_tz = FALSE) {
558
558
  // If the ical date has no timezone, must assume it is stateless
559
559
  // so treat it as a local date.
560
 
  if (empty($ical_date['tz'])) {
 
560
  if (empty($ical_date['datetime'])) {
 
561
    return NULL;
 
562
  }
 
563
  elseif (empty($ical_date['tz'])) {
561
564
    $from_tz = date_default_timezone_name();
562
565
  }
563
566
  else {
582
585
 */
583
586
function date_ical_escape_text($text) {
584
587
  //$text = strip_tags($text);
585
 
  $text = str_replace('"', '\"', $text);
 
588
  // TODO Per #38130 the iCal specs don't want : and " escaped
 
589
  // but there was some reason for adding this in. Need to watch
 
590
  // this and see if anything breaks.
 
591
  //$text = str_replace('"', '\"', $text);
 
592
  //$text = str_replace(":", "\:", $text);
586
593
  $text = str_replace("\\", "\\\\", $text);
587
594
  $text = str_replace(",", "\,", $text);
588
 
  $text = str_replace(":", "\:", $text);
589
595
  $text = str_replace(";", "\;", $text);
590
596
  $text = str_replace("\n", "\n ", $text);
591
597
  return trim($text);
649
655
    $RRULE .= ';BYMONTHDAY='. $BYMONTHDAY;
650
656
  }
651
657
  // The UNTIL date is supposed to always be expressed in UTC.
652
 
  if (array_key_exists('UNTIL', $form_values) && array_key_exists('datetime', $form_values['UNTIL'])) {
 
658
  if (array_key_exists('UNTIL', $form_values) && array_key_exists('datetime', $form_values['UNTIL']) && !empty($form_values['UNTIL']['datetime'])) {
653
659
    $until = date_ical_date($form_values['UNTIL'], 'UTC');
654
660
    $RRULE .= ';UNTIL='. date_format($until, DATE_FORMAT_ICAL) .'Z';
655
661
  }