From 9eed6dd3675357feb4bdaeb11487e4b999e000c9 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Thu, 19 Aug 2004 22:12:10 +0000 Subject: Added separate publish for iCal and Mozilla. Added French. --- calendars/publish.ical.php | 150 +++++++++++++++++++++++++++++++++++ calendars/publish.mozilla.php | 180 ++++++++++++++++++++++++++++++++++++++++++ calendars/publish.php | 180 ------------------------------------------ 3 files changed, 330 insertions(+), 180 deletions(-) create mode 100644 calendars/publish.ical.php create mode 100644 calendars/publish.mozilla.php delete mode 100644 calendars/publish.php (limited to 'calendars') diff --git a/calendars/publish.ical.php b/calendars/publish.ical.php new file mode 100644 index 0000000..68856bd --- /dev/null +++ b/calendars/publish.ical.php @@ -0,0 +1,150 @@ + $v) + { + if(strstr($v,'X-WR-CALNAME:')) + { + $arr = explode(':',$v); + $calendar_name = trim($arr[1]); + break; + } + } + + $calendar_name = isset($calendar_name) ? $calendar_name : 'default'; + + // write to file + if($fp = fopen($calendar_path.$calendar_name.'.ics','w+')) + { + fputs($fp, $data, strlen($data) ); + @fclose($fp); + } + else + { + logmsg( 'couldnt open file '.$calendar_path.$calendar_name.'.ics' ); + } + } + } +} + +// for logging +function logmsg($str){ + if(defined('PHPICALENDAR_LOG_PUBLISHING') && PHPICALENDAR_LOG_PUBLISHING == 1) + { + if($fp = fopen('publish_log.txt','a+')) + { + $str .= "\n"; + fputs($fp, $str, strlen($str) ); + fclose($fp); + } + } +} +?> diff --git a/calendars/publish.mozilla.php b/calendars/publish.mozilla.php new file mode 100644 index 0000000..5910a1c --- /dev/null +++ b/calendars/publish.mozilla.php @@ -0,0 +1,180 @@ + $v) { + if(strstr($v,'X-WR-CALNAME:')) { + $arr = explode(':',$v); + $calendar_name = trim($arr[1]); + break; + } + } + + $calendar_name = isset($calendar_name) ? $calendar_name : 'default'; + + if (isset($_SERVER['PATH_INFO'])) { + preg_match("/\/([ A-Za-z0-9.]*).ics/i",$_SERVER['PATH_INFO'],$matches); + $calendar_name = $matches[1]; + } + + // write to file + if($fp = fopen($calendar_path.$calendar_name.'.ics','w+')) { + + fputs($fp, $data, strlen($data) ); + @fclose($fp); + } + else { + logmsg( 'couldnt open file '.$calendar_path.$calendar_name.'.ics' ); + } + } + } + if ($_SERVER['REQUEST_METHOD'] == 'GET') { + if (isset($_SERVER['PATH_INFO'])) { + preg_match("/\/([ A-Za-z0-9._]*).ics/i",$_SERVER['PATH_INFO'],$matches); + $icsfile = $matches[1]; + // get calendar data + if (file_exists($calendar_path . $icsfile . '.ics') && + is_readable($calendar_path . $icsfile . '.ics') && + is_file($calendar_path . $icsfile . '.ics') + ) { + echo file_get_contents($calendar_path . $icsfile . '.ics'); + } else { + + } + } + } + } +} +// for logging +function logmsg($str){ + if(defined('PHPICALENDAR_LOG_PUBLISHING') && + PHPICALENDAR_LOG_PUBLISHING == 1) { + if($fp = fopen('publish_log.txt','a+')) { + $str .= "\n"; + fputs($fp, $str, strlen($str) ); + fclose($fp); + } + } +} +?> \ No newline at end of file diff --git a/calendars/publish.php b/calendars/publish.php deleted file mode 100644 index 5910a1c..0000000 --- a/calendars/publish.php +++ /dev/null @@ -1,180 +0,0 @@ - $v) { - if(strstr($v,'X-WR-CALNAME:')) { - $arr = explode(':',$v); - $calendar_name = trim($arr[1]); - break; - } - } - - $calendar_name = isset($calendar_name) ? $calendar_name : 'default'; - - if (isset($_SERVER['PATH_INFO'])) { - preg_match("/\/([ A-Za-z0-9.]*).ics/i",$_SERVER['PATH_INFO'],$matches); - $calendar_name = $matches[1]; - } - - // write to file - if($fp = fopen($calendar_path.$calendar_name.'.ics','w+')) { - - fputs($fp, $data, strlen($data) ); - @fclose($fp); - } - else { - logmsg( 'couldnt open file '.$calendar_path.$calendar_name.'.ics' ); - } - } - } - if ($_SERVER['REQUEST_METHOD'] == 'GET') { - if (isset($_SERVER['PATH_INFO'])) { - preg_match("/\/([ A-Za-z0-9._]*).ics/i",$_SERVER['PATH_INFO'],$matches); - $icsfile = $matches[1]; - // get calendar data - if (file_exists($calendar_path . $icsfile . '.ics') && - is_readable($calendar_path . $icsfile . '.ics') && - is_file($calendar_path . $icsfile . '.ics') - ) { - echo file_get_contents($calendar_path . $icsfile . '.ics'); - } else { - - } - } - } - } -} -// for logging -function logmsg($str){ - if(defined('PHPICALENDAR_LOG_PUBLISHING') && - PHPICALENDAR_LOG_PUBLISHING == 1) { - if($fp = fopen('publish_log.txt','a+')) { - $str .= "\n"; - fputs($fp, $str, strlen($str) ); - fclose($fp); - } - } -} -?> \ No newline at end of file -- cgit v1.2.3