You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(5) |
Feb
(25) |
Mar
(18) |
Apr
|
May
(26) |
Jun
(14) |
Jul
(1) |
Aug
(5) |
Sep
(82) |
Oct
(3) |
Nov
(130) |
Dec
(9) |
2004 |
Jan
(4) |
Feb
(62) |
Mar
|
Apr
(3) |
May
(100) |
Jun
|
Jul
(6) |
Aug
(49) |
Sep
(33) |
Oct
(47) |
Nov
(2) |
Dec
(1) |
2005 |
Jan
|
Feb
(4) |
Mar
(1) |
Apr
(8) |
May
(17) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(26) |
Oct
(18) |
Nov
(37) |
Dec
(14) |
2006 |
Jan
(2) |
Feb
(18) |
Mar
(34) |
Apr
(52) |
May
(7) |
Jun
(3) |
Jul
(2) |
Aug
(10) |
Sep
|
Oct
|
Nov
(18) |
Dec
(4) |
2007 |
Jan
|
Feb
(7) |
Mar
(7) |
Apr
(6) |
May
(52) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(15) |
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(250) |
2009 |
Jan
(35) |
Feb
(45) |
Mar
|
Apr
(4) |
May
(35) |
Jun
(13) |
Jul
(49) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(11) |
2010 |
Jan
(3) |
Feb
(30) |
Mar
|
Apr
(35) |
May
(12) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
From: <ji...@us...> - 2006-07-25 00:57:23
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31518/phpicalendar/functions Modified Files: ical_parser.php Log Message: change ical_parser year increment Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -d -r1.213 -r1.214 *** ical_parser.php 3 May 2006 04:26:25 -0000 1.213 --- ical_parser.php 25 Jul 2006 00:57:19 -0000 1.214 *************** *** 301,304 **** --- 301,305 ---- } // 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)) { *************** *** 701,705 **** // Make sure the month & year used is within the start/end_range. if ($month < date('m', $next_range_time)) { ! $year = date('Y', strtotime('+1 years', $next_range_time)); } else { $year = date('Y', $next_range_time); --- 702,706 ---- // 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); |
From: <ji...@us...> - 2006-06-28 23:43:34
|
Update of /cvsroot/phpicalendar/phpicalendar/templates/default In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14903/phpicalendar/templates/default Modified Files: search_box.tpl Log Message: fix method GET to get for HTML validation Index: search_box.tpl =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/templates/default/search_box.tpl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** search_box.tpl 8 Feb 2006 08:07:54 -0000 1.2 --- search_box.tpl 28 Jun 2006 23:43:32 -0000 1.3 *************** *** 1,5 **** <hr /> <div class = 'G10BOLD'>{L_SEARCH}:</div> ! <form action="search.php" method="GET"> <input type="hidden" name="cpath" value="{CPATH}"/> <input type="hidden" name="cal" value="{CAL}"/> --- 1,5 ---- <hr /> <div class = 'G10BOLD'>{L_SEARCH}:</div> ! <form action="search.php" method="get"> <input type="hidden" name="cpath" value="{CPATH}"/> <input type="hidden" name="cal" value="{CAL}"/> |
From: <ji...@us...> - 2006-06-28 23:43:34
|
Update of /cvsroot/phpicalendar/phpicalendar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14903/phpicalendar Modified Files: search.php Log Message: fix method GET to get for HTML validation Index: search.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/search.php,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** search.php 10 Apr 2006 02:21:07 -0000 1.40 --- search.php 28 Jun 2006 23:43:32 -0000 1.41 *************** *** 23,27 **** $search_box = ''; $search_box .= ! '<form action="search.php" method="GET">'."\n". '<input type="hidden" name="cpath" value="'.$cpath.'">'."\n". '<input type="hidden" name="cal" value="'.$cal.'">'."\n". --- 23,27 ---- $search_box = ''; $search_box .= ! '<form action="search.php" method="get">'."\n". '<input type="hidden" name="cpath" value="'.$cpath.'">'."\n". '<input type="hidden" name="cal" value="'.$cal.'">'."\n". |
From: <ji...@us...> - 2006-06-28 23:30:53
|
Update of /cvsroot/phpicalendar/phpicalendar/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9077/phpicalendar/includes Modified Files: event.php Log Message: minor modification to event.php - comment out unneeded POST var Index: event.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/includes/event.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** event.php 5 Apr 2006 04:43:59 -0000 1.38 --- event.php 28 Jun 2006 23:30:47 -0000 1.39 *************** *** 1,5 **** <?php define('BASE', '../'); ! $getdate = $_POST['date']; include_once(BASE.'functions/init.inc.php'); #include_once(BASE.'functions/ical_parser.php'); --- 1,5 ---- <?php define('BASE', '../'); ! #$getdate = $_POST['date']; include_once(BASE.'functions/init.inc.php'); #include_once(BASE.'functions/ical_parser.php'); |
From: <dan...@us...> - 2006-05-09 09:33:37
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1-new.sourceforge.net:/tmp/cvs-serv436/functions Modified Files: overlapping_events.php Log Message: Fix the #1469443 bug. Events are now displayed in the right column.\nLast commit didn't work ??? Index: overlapping_events.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/overlapping_events.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** overlapping_events.php 16 Mar 2006 00:28:54 -0000 1.14 --- overlapping_events.php 9 May 2006 09:33:25 -0000 1.15 *************** *** 91,94 **** --- 91,95 ---- if ($new_block['blockEnd'] < $loop_block['blockEnd']) $ol_blocks[$new_block_key]['blockEnd'] = $loop_block['blockEnd']; $ol_blocks[$new_block_key]['events'] = array_merge($new_block['events'], $loop_block['events']); + $new_block['events'] = $ol_blocks[$new_block_key]['events']; foreach ($loop_block['overlapRanges'] as $ol_range) { $new_block['overlapRanges'] = merge_range($new_block['overlapRanges'], $ol_range['start'], $ol_range['end'], $ol_range['count']); |
From: <dan...@us...> - 2006-05-04 09:45:46
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1-new.sourceforge.net:/tmp/cvs-serv5550/functions Modified Files: overlapping_events.php Log Message: Fix the #1469443 bug. Events are now displayed in the right column. Index: overlapping_events.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/overlapping_events.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** overlapping_events.php 16 Mar 2006 00:28:54 -0000 1.14 --- overlapping_events.php 4 May 2006 09:45:38 -0000 1.15 *************** *** 91,94 **** --- 91,95 ---- if ($new_block['blockEnd'] < $loop_block['blockEnd']) $ol_blocks[$new_block_key]['blockEnd'] = $loop_block['blockEnd']; $ol_blocks[$new_block_key]['events'] = array_merge($new_block['events'], $loop_block['events']); + $new_block['events'] = $ol_blocks[$new_block_key]['events']; foreach ($loop_block['overlapRanges'] as $ol_range) { $new_block['overlapRanges'] = merge_range($new_block['overlapRanges'], $ol_range['start'], $ol_range['end'], $ol_range['count']); |
From: <ji...@us...> - 2006-05-03 04:29:51
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5672/phpicalendar/functions Modified Files: init.inc.php Log Message: allow default_cal to be a comma delimited list of cals Index: init.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** init.inc.php 3 May 2006 04:28:17 -0000 1.99 --- init.inc.php 3 May 2006 04:29:47 -0000 1.100 *************** *** 116,120 **** $calcheckopen = @fopen($calcheck, "r"); if ($calcheckopen == FALSE) { ! $cal_filenames[0] = $default_cal; } else { $cal_filenames[0] = $default_cal_check; --- 116,120 ---- $calcheckopen = @fopen($calcheck, "r"); if ($calcheckopen == FALSE) { ! $cal_filenames = explode(',',$default_cal); } else { $cal_filenames[0] = $default_cal_check; *************** *** 124,128 **** } } else { ! $cal_filenames[0] = $default_cal; } } --- 124,128 ---- } } else { ! $cal_filenames = explode(',',$default_cal); } } |
From: <ji...@us...> - 2006-05-03 04:28:20
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4811/phpicalendar/functions Modified Files: init.inc.php Log Message: remove requirement for subdirs in tmp when useing cpath Index: init.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** init.inc.php 3 May 2006 04:27:14 -0000 1.98 --- init.inc.php 3 May 2006 04:28:17 -0000 1.99 *************** *** 41,45 **** $cpath = str_replace('..','',$default_cpath_check); $calendar_path .= "/$cpath"; ! $tmp_dir .= "/$cpath"; } #these need cpath to be set --- 41,45 ---- $cpath = str_replace('..','',$default_cpath_check); $calendar_path .= "/$cpath"; ! # $tmp_dir .= "/$cpath"; } #these need cpath to be set |
From: <ji...@us...> - 2006-05-03 04:27:19
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4136/phpicalendar/functions Modified Files: init.inc.php Log Message: remove requirement for subdirs in tmp when useing cpath Index: init.inc.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/init.inc.php,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** init.inc.php 10 Apr 2006 02:21:07 -0000 1.97 --- init.inc.php 3 May 2006 04:27:14 -0000 1.98 *************** *** 37,41 **** $cpath = str_replace('..','',$_REQUEST['cpath']); $calendar_path .= "/$cpath"; ! $tmp_dir .= "/$cpath"; }elseif(isset($default_cpath_check) && $default_cpath_check !='' ){ $cpath = str_replace('..','',$default_cpath_check); --- 37,41 ---- $cpath = str_replace('..','',$_REQUEST['cpath']); $calendar_path .= "/$cpath"; ! # $tmp_dir .= "/$cpath"; }elseif(isset($default_cpath_check) && $default_cpath_check !='' ){ $cpath = str_replace('..','',$default_cpath_check); |
From: <ji...@us...> - 2006-05-03 04:26:32
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3533/phpicalendar/functions Modified Files: ical_parser.php Log Message: remove requirement for subdirs in tmp when useing cpath Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -d -r1.212 -r1.213 *** ical_parser.php 10 Apr 2006 04:17:19 -0000 1.212 --- ical_parser.php 3 May 2006 04:26:25 -0000 1.213 *************** *** 36,40 **** if ($save_parsed_cals == 'yes') { if (sizeof ($cal_filelist) > 1) { ! $parsedcal = $tmp_dir.'/parsedcal-'.urlencode($cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { $fd = fopen($parsedcal, 'r'); --- 36,40 ---- if ($save_parsed_cals == 'yes') { if (sizeof ($cal_filelist) > 1) { ! $parsedcal = $tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { $fd = fopen($parsedcal, 'r'); *************** *** 76,80 **** foreach ($cal_filelist as $filename) { $realcal_mtime = filemtime($filename); ! $parsedcal = $tmp_dir.'/parsedcal-'.urlencode($cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { $parsedcal_mtime = filemtime($parsedcal); --- 76,80 ---- foreach ($cal_filelist as $filename) { $realcal_mtime = filemtime($filename); ! $parsedcal = $tmp_dir.'/parsedcal-'.urlencode($cpath.'::'.$cal_filename).'-'.$this_year; if (file_exists($parsedcal)) { $parsedcal_mtime = filemtime($parsedcal); |
From: <ji...@us...> - 2006-05-03 04:21:21
|
Update of /cvsroot/phpicalendar/phpicalendar/rss In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32581/phpicalendar/rss Modified Files: rss.php Log Message: fix some problems with php 5 date calcs Index: rss.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/rss/rss.php,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** rss.php 10 Apr 2006 00:52:24 -0000 1.42 --- rss.php 3 May 2006 04:21:14 -0000 1.43 *************** *** 49,53 **** case 'week': $fromdate = dateOfWeek($getdate, 'Sunday'); ! $todate = $fromdate + 6; $theview = $lang['l_week']." of ".date('n/d/Y',strtotime($fromdate)); break; --- 49,53 ---- case 'week': $fromdate = dateOfWeek($getdate, 'Sunday'); ! $todate = date("Ymd", strtotime($fromdate) + 6*24*60*60); $theview = $lang['l_week']." of ".date('n/d/Y',strtotime($fromdate)); break; *************** *** 90,94 **** #default to week $fromdate = dateOfWeek($getdate, 'Sunday'); ! $todate = $fromdate + 6; $theview = ""; --- 90,94 ---- #default to week $fromdate = dateOfWeek($getdate, 'Sunday'); ! $todate = date("Ymd", strtotime($fromdate) + 6*24*60*60); $theview = ""; *************** *** 132,147 **** $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; ! ! /* Use 1.0 and strip encoding, use rss_language */ ! $rss .= '<rdf:RDF ! xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ! xmlns:ev="http://purl.org/rss/1.0/modules/event/" ! xmlns:dc="http://purl.org/dc/elements/1.1/" ! xmlns="http://purl.org/rss/1.0/">'."\n"; ! ! $rss .= '<channel rdf:about="'.$default_path.'/rss/rss.php/'; ! if (isset($cpath) && $cpath !='') $rss_link.="?cpath=$cpath"; ! $rss .='">'."\n"; ! $rss .= '<title>'.$cal_displayname; if ($theview !=""){$rss .= ' - '.$theview;} --- 132,138 ---- $rss = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"."\n"; ! $rss .= '<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">'."\n"; ! $rss .= '<rss version="0.91">'."\n"; ! $rss .= '<channel>'."\n"; $rss .= '<title>'.$cal_displayname; if ($theview !=""){$rss .= ' - '.$theview;} *************** *** 153,158 **** $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; ! $rss .= '<language>'.$language.'</language>'."\n"; ! $rss .= '<copyright>Copyright '.date('Y').', '.htmlspecialchars ("$default_path").'</copyright>'."\n"; //generate the items --- 144,149 ---- $rss .= '<description>'.$cal_displayname.' '.$lang['l_calendar'].' - '.$theview.'</description>'."\n"; ! $rss .= '<language>'.$rss_language.'</language>'."\n"; ! $rss .= '<copyright>Copyright '.date(Y).', '.htmlspecialchars ("$default_path").'</copyright>'."\n"; //generate the items *************** *** 232,236 **** $rss .= '</item>'."\n"; } ! $thisdate++; $i++; } while ($i <= $numdays); --- 223,227 ---- $rss .= '</item>'."\n"; } ! $thisdate = date("Ymd", strtotime($thisdate)+60*60*24); $i++; } while ($i <= $numdays); |
From: <ja...@us...> - 2006-04-23 20:09:56
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8771/lib/HTTP/CalDAV/Tools Modified Files: ICalendarParser.php Log Message: * Fixed "value" syntax problem * Fixed start offset problem * Some code tidying Index: ICalendarParser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Tools/ICalendarParser.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ICalendarParser.php 22 Apr 2006 22:50:24 -0000 1.2 --- ICalendarParser.php 23 Apr 2006 20:09:50 -0000 1.3 *************** *** 51,54 **** --- 51,70 ---- /** + * Line of input + * + * @var string + * @access private + */ + var $_line; + + /** + * Offset of line + * + * @var int + * @access private + */ + var $_offset; + + /** * Success state flag * *************** *** 56,60 **** * @access public */ ! var $success = false; /** --- 72,76 ---- * @access public */ ! var $success = true; /** *************** *** 83,92 **** /** ! * Begin offset stack for tracking begin offsets of nested components * * @var array * @access private */ ! var $_beginOffsetStack = array(); /** --- 99,108 ---- /** ! * Begin offset stack for tracking start offsets of nested components * * @var array * @access private */ ! var $_startOffsetStack = array(); /** *************** *** 116,119 **** --- 132,150 ---- /** + * Parse RFC2445 date-time + * + * May eventually get moved someplace more appropriate + * TODO Timezone support + * + * @param string RFC2445 date-time + * @return int timestamp + * @access public + */ + function datetime_to_timestamp($datetime) + { + return gmmktime(substr($datetime, 9, 2), substr($datetime, 11, 2), substr($datetime, 13, 2), substr($datetime, 4, 2), substr($datetime, 6, 2), substr($datetime, 0, 4)); + } + + /** * Constructor * *************** *** 124,136 **** { $this->_handle = $handle; - $this->success = true; $this->_offsetStack[] = $offsets; ! $this->_valueStack[] = $value; $this->_filterStack[] = $filters; while ($this->success && ! ($offset = ftell($this->_handle)) !== false && ! ($line = fgets($this->_handle, 4096)) !== false) { if (is_array($this->_offsetStack[count($this->_offsetStack) - 1]['offsets'])) { ! if ($offset > $this->_offsetStack[count($this->_offsetStack) - 1]['offsets'][0][1]) { if (array_shift($this->_offsetStack[count($this->_offsetStack) - 1]['offsets']) !== null) { if (fseek($this->_offsetStack[count($this->_offsetStack) - 1]['offsets'][0][0])) { --- 155,168 ---- { $this->_handle = $handle; $this->_offsetStack[] = $offsets; ! ! // FIXME Separate comps & props stacks? ! $this->_valueStack[] = array('comps' => $value); $this->_filterStack[] = $filters; while ($this->success && ! ($this->_offset = ftell($this->_handle)) !== false && ! ($this->_line = fgets($this->_handle, 4096)) !== false) { if (is_array($this->_offsetStack[count($this->_offsetStack) - 1]['offsets'])) { ! if ($this->_offset > $this->_offsetStack[count($this->_offsetStack) - 1]['offsets'][0][1]) { if (array_shift($this->_offsetStack[count($this->_offsetStack) - 1]['offsets']) !== null) { if (fseek($this->_offsetStack[count($this->_offsetStack) - 1]['offsets'][0][0])) { *************** *** 158,165 **** } ! $line = explode(':', trim($line)); if ($line[0] == 'BEGIN') { ! $this->_beginComp($line[1]); continue; } --- 190,197 ---- } ! $line = explode(':', trim($this->_line)); if ($line[0] == 'BEGIN') { ! $this->_startComp($line[1]); continue; } *************** *** 188,192 **** } ! function _beginComp($name) { if (is_array($this->_valueStack[count($this->_valueStack) - 1]['comps']) && --- 220,224 ---- } ! function _startComp($name) { if (is_array($this->_valueStack[count($this->_valueStack) - 1]['comps']) && *************** *** 219,223 **** $this->_compStack[] = new $class; ! $this->_beginOffsetStack[] = $offset; $this->_offsetStack[] = $this->_offsetStack[count($this->_offsetStack) - 1]['comps'][$name]; $this->_valueStack[] = $this->_valueStack[count($this->_valueStack) - 1]['comps'][$name]; --- 251,255 ---- $this->_compStack[] = new $class; ! $this->_startOffsetStack[] = $this->_offset; $this->_offsetStack[] = $this->_offsetStack[count($this->_offsetStack) - 1]['comps'][$name]; $this->_valueStack[] = $this->_valueStack[count($this->_valueStack) - 1]['comps'][$name]; *************** *** 237,241 **** if ($filter['value']['start'] > $this->_compStack[count($this->_compStack) - 1]->properties['DTEND'][0]->value || $filter['value']['end'] < $this->_compStack[count($this->_compStack) - 1]->properties['DTSTART'][0]->value) { array_pop($this->_compStack); ! array_pop($this->_beginOffsetStack); array_pop($this->_offsetStack); array_pop($this->_valueStack); --- 269,273 ---- if ($filter['value']['start'] > $this->_compStack[count($this->_compStack) - 1]->properties['DTEND'][0]->value || $filter['value']['end'] < $this->_compStack[count($this->_compStack) - 1]->properties['DTSTART'][0]->value) { array_pop($this->_compStack); ! array_pop($this->_startOffsetStack); array_pop($this->_offsetStack); array_pop($this->_valueStack); *************** *** 258,262 **** $this->comps[] = array_pop($this->_compStack); ! $this->offsets[] = array(array_pop($this->_beginOffsetStack), $offset); array_pop($this->_offsetStack); array_pop($this->_valueStack); --- 290,294 ---- $this->comps[] = array_pop($this->_compStack); ! $this->offsets[] = array(array_pop($this->_startOffsetStack), $offset); array_pop($this->_offsetStack); array_pop($this->_valueStack); |
From: <ja...@us...> - 2006-04-23 20:09:53
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/bennu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8771/lib/bennu Modified Files: iCalendar_components.php iCalendar_parameters.php iCalendar_properties.php Log Message: * Fixed "value" syntax problem * Fixed start offset problem * Some code tidying Index: iCalendar_components.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/bennu/iCalendar_components.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** iCalendar_components.php 13 Apr 2006 21:14:17 -0000 1.2 --- iCalendar_components.php 23 Apr 2006 20:09:50 -0000 1.3 *************** *** 206,210 **** return $string; } - } --- 206,209 ---- *************** *** 228,232 **** parent::construct(); } - } --- 227,230 ---- *************** *** 307,311 **** return true; } - } --- 305,308 ---- *************** *** 389,393 **** parent::construct(); } - } --- 386,389 ---- Index: iCalendar_parameters.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/bennu/iCalendar_parameters.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iCalendar_parameters.php 13 Apr 2006 05:10:24 -0000 1.1 --- iCalendar_parameters.php 23 Apr 2006 20:09:50 -0000 1.2 *************** *** 235,239 **** function undo_value_formatting($parameter, $value) { } - } --- 235,238 ---- Index: iCalendar_properties.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/bennu/iCalendar_properties.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iCalendar_properties.php 13 Apr 2006 05:10:24 -0000 1.1 --- iCalendar_properties.php 23 Apr 2006 20:09:50 -0000 1.2 *************** *** 283,287 **** return($value === '2.0' || $value === 2.0); } - } --- 283,286 ---- *************** *** 431,435 **** return false; } - } --- 430,433 ---- *************** *** 467,471 **** return ($value >= 0 && $value <= 100); } - } --- 465,468 ---- *************** *** 534,538 **** } - } --- 531,534 ---- *************** *** 819,823 **** return false; } - } --- 815,818 ---- *************** *** 903,907 **** return true; } - } --- 898,901 ---- *************** *** 980,984 **** return true; } - } --- 974,977 ---- *************** *** 1022,1026 **** return true; } - } --- 1015,1018 ---- *************** *** 1278,1282 **** return false; } - } --- 1270,1273 ---- |
From: <ja...@us...> - 2006-04-22 22:50:29
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27088/lib/HTTP/CalDAV/Tools Modified Files: ICalendarParser.php Log Message: * More work on iCalendar parser * Current offsets support is non-sensical - hopefully something intelligent will emerge Index: ICalendarParser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Tools/ICalendarParser.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ICalendarParser.php 18 Apr 2006 03:22:12 -0000 1.1 --- ICalendarParser.php 22 Apr 2006 22:50:24 -0000 1.2 *************** *** 43,46 **** --- 43,54 ---- { /** + * Input stream handle + * + * @var resource + * @access private + */ + var $_handle; + + /** * Success state flag * *************** *** 67,70 **** --- 75,119 ---- /** + * Component stack for parsing nested components + * + * @var array + * @access private + */ + var $_compStack = array(); + + /** + * Begin offset stack for tracking begin offsets of nested components + * + * @var array + * @access private + */ + var $_beginOffsetStack = array(); + + /** + * Offsets stack for parsing within specific ranges + * + * @var array + * @access private + */ + var $_offsetStack = array(); + + /** + * Value stack for parsing only specific components & properties + * + * @var array + * @access private + */ + var $_valueStack = array(); + + /** + * Filter stack for parsing only components & properties which match + * specific filters + * + * @var array + * @access private + */ + var $_filterStack = array(); + + /** * Constructor * *************** *** 72,183 **** * @access public */ ! function ICalendarParser($handle, $beginOffset=null, $endOffset=null, ! $value=null, $filters=null) { ! $comps = array(); ! $beginOffsets = array(); ! $compValues = array($value); ! $compFilters = array($filters); $this->success = true; ! while (($offset = ftell($handle)) !== false && ! ($line = fgets($handle, 4096)) !== false) { ! if (isset($endOffset) && $offset > $endOffset) { ! return; ! } ! ! $line = explode(':', trim($line)); ! if ($line[0] == 'END') { ! if ($line[1] != $comps[count($comps) - 1]->name) { ! $this->success = false; ! return; ! } ! if (is_array($compFilters[count($compFilters) - 1]['filters'])) { ! foreach ($compFilters[count($compFilters) - 1]['filters'] as $filter) { ! if ($filter['name'] == 'time-range') { ! if ($filter['value']['start'] > $comps[count($comps) - 1]->properties['DTEND'][0]->value || $filter['value']['end'] < $comps[count($comps) - 1]->properties['DTSTART'][0]->value) { ! array_pop($compValues); ! array_pop($compFilters); ! continue; } } } - } - if (count($comps) > 1 && - !$comps[count($comps) - 2]->add_component($comps[count( - $comps) - 1])) { - $this->success = false; return; } ! if (($offset = ftell($handle)) === false) { ! $this->success = false; ! return; ! } ! $this->comps[] = array_pop($comps); ! $this->offsets[] = array(array_pop($beginOffsets), $offset); ! array_pop($compValues); ! array_pop($compFilters); continue; } ! if ($line[0] == 'BEGIN') { ! $compName = $line[1]; ! if (is_array($compValues[count($compValues) - 1]['comps']) && ! !isset($compValues[count($compValues) - 1]['comps'][$compName])) { ! while (($line = fgets($handle, 4096)) !== false) { ! if (trim($line) == "END:$compName") { ! continue (2); ! } ! } ! $this->success = false; return; } ! $className = 'iCalendar_' . ltrim(strtolower($compName), 'v'); ! if ($line[1] == 'VCALENDAR') { ! $className = 'iCalendar'; ! } ! if (!class_exists($className)) { ! while (($line = fgets($handle, 4096)) !== false) { ! if (trim($line) == "END:$compName") { ! continue (2); ! } ! } ! $this->success = false; return; } - - $comps[] = new $className; - $beginOffsets[] = $offset; - $compValues[] = $compValues[count($compValues) - 1]['comps'][$compName]; - $compFilters[] = $compFilters[count($compFilters) - 1]['comps'][$compName]; - continue; } ! $line[0] = explode(';=', $line[0]); ! $propName = array_shift($line[0]); ! if (is_array($compValues[count($compValues) - 1]['props']) && ! !in_array($propName, ! $compValues[count($compValues) - 1]['props'])) { ! continue; ! } ! $params = array(); ! while (!empty($line[0])) { ! $params[array_shift($line[0])] = array_shift($line[0]); } - $comps[count($comps) - 1]->add_property($propName, $line[1], $params); } ! if (!feof($handle)) { $this->success = false; } } } --- 121,265 ---- * @access public */ ! function ICalendarParser($handle, $offsets=null, $value=null, $filters=null) { ! $this->_handle = $handle; $this->success = true; ! $this->_offsetStack[] = $offsets; ! $this->_valueStack[] = $value; ! $this->_filterStack[] = $filters; ! while ($this->success && ! ($offset = ftell($this->_handle)) !== false && ! ($line = fgets($this->_handle, 4096)) !== false) { ! if (is_array($this->_offsetStack[count($this->_offsetStack) - 1]['offsets'])) { ! if ($offset > $this->_offsetStack[count($this->_offsetStack) - 1]['offsets'][0][1]) { ! if (array_shift($this->_offsetStack[count($this->_offsetStack) - 1]['offsets']) !== null) { ! if (fseek($this->_offsetStack[count($this->_offsetStack) - 1]['offsets'][0][0])) { ! $this->success = false; ! return; ! } ! continue; ! } ! if (!empty($this->_compStack)) { ! $name = $this->_compStack[count($this->_compStack) - 1]->name; ! while (($line = fgets($this->_handle, 4096)) !== false) { ! if (trim($line) == "END:$name") { ! return; } } + + $this->_endComp($name); + continue; } return; } + } ! $line = explode(':', trim($line)); ! if ($line[0] == 'BEGIN') { ! $this->_beginComp($line[1]); continue; } ! if ($line[0] == 'END') { ! $this->_endComp($line[1]); ! continue; ! } ! $line[0] = explode(';=', $line[0]); ! $name = array_shift($line[0]); ! if (is_array($this->_valueStack[count($this->_valueStack) - 1]['props']) && !in_array($name, $this->_valueStack[count($this->_valueStack) - 1]['props'])) { ! continue; ! } ! ! $params = array(); ! while (!empty($line[0])) { ! $params[array_shift($line[0])] = array_shift($line[0]); ! } ! $this->_compStack[count($this->_compStack) - 1]->add_property($name, $line[1], $params); ! } ! ! if (!feof($this->_handle)) { ! $this->success = false; ! } ! } ! ! function _beginComp($name) ! { ! if (is_array($this->_valueStack[count($this->_valueStack) - 1]['comps']) && ! !isset($this->_valueStack[count($this->_valueStack) - 1]['comps'][$name])) { ! while (($line = fgets($this->_handle, 4096)) !== false) { ! if (trim($line) == "END:$name") { return; } + } ! $this->success = false; ! return; ! } ! $class = 'iCalendar_' . ltrim(strtolower($name), 'v'); ! if ($name == 'VCALENDAR') { ! $class = 'iCalendar'; ! } ! if (!class_exists($class)) { ! while (($line = fgets($this->_handle, 4096)) !== false) { ! if (trim($line) == "END:$name") { return; } } ! $this->success = false; ! return; ! } ! $this->_compStack[] = new $class; ! $this->_beginOffsetStack[] = $offset; ! $this->_offsetStack[] = $this->_offsetStack[count($this->_offsetStack) - 1]['comps'][$name]; ! $this->_valueStack[] = $this->_valueStack[count($this->_valueStack) - 1]['comps'][$name]; ! $this->_filterStack[] = $this->_filterStack[count($this->_filterStack) - 1]['comps'][$name]; ! } ! ! function _endComp($name) ! { ! if ($name != $this->_compStack[count($this->_compStack) - 1]->name) { ! $this->success = false; ! return; ! } ! ! if (is_array($this->_filterStack[count($this->_filterStack) - 1]['filters'])) { ! foreach ($this->_filterStack[count($this->_filterStack) - 1]['filters'] as $filter) { ! if ($filter['name'] == 'time-range') { ! if ($filter['value']['start'] > $this->_compStack[count($this->_compStack) - 1]->properties['DTEND'][0]->value || $filter['value']['end'] < $this->_compStack[count($this->_compStack) - 1]->properties['DTSTART'][0]->value) { ! array_pop($this->_compStack); ! array_pop($this->_beginOffsetStack); ! array_pop($this->_offsetStack); ! array_pop($this->_valueStack); ! array_pop($this->_filterStack); ! return; ! } ! } } } ! if (count($this->_compStack) > 1 && !$this->_compStack[count($this->_compStack) - 2]->add_component($this->_compStack[count($this->_compStack) - 1])) { ! $this->success = false; ! return; ! } ! ! if (($offset = ftell($this->_handle)) === false) { $this->success = false; + return; } + + $this->comps[] = array_pop($this->_compStack); + $this->offsets[] = array(array_pop($this->_beginOffsetStack), $offset); + array_pop($this->_offsetStack); + array_pop($this->_valueStack); + array_pop($this->_filterStack); } } |
From: <ja...@us...> - 2006-04-22 22:50:29
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27088/lib/HTTP/CalDAV Modified Files: Server.php Log Message: * More work on iCalendar parser * Current offsets support is non-sensical - hopefully something intelligent will emerge Index: Server.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Server.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Server.php 18 Apr 2006 03:22:12 -0000 1.5 --- Server.php 22 Apr 2006 22:50:24 -0000 1.6 *************** *** 172,177 **** } ! $parser = new ICalendarParser($handle, null, null, ! $reqprop['value'], $filters); if (!$parser->success) { return $this->calDavProp('calendar-data', null, --- 172,177 ---- } ! $parser = new ICalendarParser($handle, null, $reqprop['value'], ! $filters); if (!$parser->success) { return $this->calDavProp('calendar-data', null, |
From: <ja...@us...> - 2006-04-18 03:22:18
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12568/lib/HTTP/CalDAV/Tools Modified Files: ReportParser.php Added Files: ICalendarParser.php Log Message: * Moved iCalendar parsing function into it's own class, complete with offsets support * Fixed bug with $depth < 'infinity' * TODO If this parser works & has all necessary features, add documentation --- NEW FILE: ICalendarParser.php --- <?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Helper for parsing iCalendar format * * Long description for file (if any)... * * PHP versions 4 & 5 * * LICENSE: This source file is subject to version 3.0 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_0.txt. If you did not receive a copy of * the PHP License & are unable to obtain it through the web, please * send a note to li...@ph... so we can mail you a copy immediately * * @category HTTP * @package HTTP_CalDAV_Server * @author Jack Bates <ms...@fr...> * @copyright 2006 The PHP Group * @license PHP License 3.0 http://www.php.net/license/3_0.txt * @version CVS: $Id: ICalendarParser.php,v 1.1 2006/04/18 03:22:12 jablko Exp $ * @link http://pear.php.net/package/HTTP_CalDAV_Server * @see HTTP_WebDAV_Server */ /** * Helper for parsing iCalendar format * * Long description * * @category HTTP * @package HTTP_CalDAV_Server * @author Jack Bates <ms...@fr...> * @copyright 2006 The PHP Group * @license PHP License 3.0 http://www.php.net/license/3_0.txt * @version CVS: $Id: ICalendarParser.php,v 1.1 2006/04/18 03:22:12 jablko Exp $ * @link http://pear.php.net/package/HTTP_CalDAV_Server * @see HTTP_WebDAV_Server */ class ICalendarParser { /** * Success state flag * * @var bool * @access public */ var $success = false; /** * Parsed components are collected here in post-order * * @var array * @access public */ var $comps = array(); /** * Parsed components' offsets are collected here in post-order * * @var array * @access public */ var $offsets = array(); /** * Constructor * * @param resource input stream handle * @access public */ function ICalendarParser($handle, $beginOffset=null, $endOffset=null, $value=null, $filters=null) { $comps = array(); $beginOffsets = array(); $compValues = array($value); $compFilters = array($filters); $this->success = true; while (($offset = ftell($handle)) !== false && ($line = fgets($handle, 4096)) !== false) { if (isset($endOffset) && $offset > $endOffset) { return; } $line = explode(':', trim($line)); if ($line[0] == 'END') { if ($line[1] != $comps[count($comps) - 1]->name) { $this->success = false; return; } if (is_array($compFilters[count($compFilters) - 1]['filters'])) { foreach ($compFilters[count($compFilters) - 1]['filters'] as $filter) { if ($filter['name'] == 'time-range') { if ($filter['value']['start'] > $comps[count($comps) - 1]->properties['DTEND'][0]->value || $filter['value']['end'] < $comps[count($comps) - 1]->properties['DTSTART'][0]->value) { array_pop($compValues); array_pop($compFilters); continue; } } } } if (count($comps) > 1 && !$comps[count($comps) - 2]->add_component($comps[count( $comps) - 1])) { $this->success = false; return; } if (($offset = ftell($handle)) === false) { $this->success = false; return; } $this->comps[] = array_pop($comps); $this->offsets[] = array(array_pop($beginOffsets), $offset); array_pop($compValues); array_pop($compFilters); continue; } if ($line[0] == 'BEGIN') { $compName = $line[1]; if (is_array($compValues[count($compValues) - 1]['comps']) && !isset($compValues[count($compValues) - 1]['comps'][$compName])) { while (($line = fgets($handle, 4096)) !== false) { if (trim($line) == "END:$compName") { continue (2); } } $this->success = false; return; } $className = 'iCalendar_' . ltrim(strtolower($compName), 'v'); if ($line[1] == 'VCALENDAR') { $className = 'iCalendar'; } if (!class_exists($className)) { while (($line = fgets($handle, 4096)) !== false) { if (trim($line) == "END:$compName") { continue (2); } } $this->success = false; return; } $comps[] = new $className; $beginOffsets[] = $offset; $compValues[] = $compValues[count($compValues) - 1]['comps'][$compName]; $compFilters[] = $compFilters[count($compFilters) - 1]['comps'][$compName]; continue; } $line[0] = explode(';=', $line[0]); $propName = array_shift($line[0]); if (is_array($compValues[count($compValues) - 1]['props']) && !in_array($propName, $compValues[count($compValues) - 1]['props'])) { continue; } $params = array(); while (!empty($line[0])) { $params[array_shift($line[0])] = array_shift($line[0]); } $comps[count($comps) - 1]->add_property($propName, $line[1], $params); } if (!feof($handle)) { $this->success = false; } } } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * c-handling-comment-ender-p: nil * End: */ ?> Index: ReportParser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Tools/ReportParser.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReportParser.php 13 Apr 2006 22:33:13 -0000 1.3 --- ReportParser.php 18 Apr 2006 03:22:12 -0000 1.4 *************** *** 98,101 **** --- 98,102 ---- function ReportParser($input) { + // FIXME Take a handle, not a path $handle = fopen($input, 'r'); if (!$handle) { |
From: <ja...@us...> - 2006-04-18 03:22:17
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12568/lib/HTTP/CalDAV Modified Files: Server.php Log Message: * Moved iCalendar parsing function into it's own class, complete with offsets support * Fixed bug with $depth < 'infinity' * TODO If this parser works & has all necessary features, add documentation Index: Server.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Server.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Server.php 13 Apr 2006 22:33:13 -0000 1.4 --- Server.php 18 Apr 2006 03:22:12 -0000 1.5 *************** *** 27,30 **** --- 27,31 ---- require_once 'Tools/ReportParser.php'; + require_once 'Tools/ICalendarParser.php'; /** *************** *** 70,74 **** $options['path'] = $this->path; ! $options['depth'] = 'infinity'; if (isset($_SERVER['HTTP_DEPTH'])) { $options['depth'] = $_SERVER['HTTP_DEPTH']; --- 71,77 ---- $options['path'] = $this->path; ! /* The request MAY include a Depth header. If no Depth header is ! included, Depth:0 is assumed. */ ! $options['depth'] = 0; if (isset($_SERVER['HTTP_DEPTH'])) { $options['depth'] = $_SERVER['HTTP_DEPTH']; *************** *** 148,152 **** $status = $this->get($options); if (empty($status)) { ! $status = '403 Forbidden'; } --- 151,155 ---- $status = $this->get($options); if (empty($status)) { ! $status = '404 Not Found'; } *************** *** 156,160 **** if ($options['mimetype'] != 'text/calendar') { ! return $this->calDavProp('calendar-data', null, '404 Not Found'); } --- 159,164 ---- if ($options['mimetype'] != 'text/calendar') { ! return $this->calDavProp('calendar-data', null, ! '404 Not Found'); } *************** *** 164,175 **** // What about data? } else { ! return $this->calDavProp('calendar-data', null, '404 Not Found'); } ! if (!($value = $this->_parseComponent($handle, $reqprop['value'], $filters))) { ! return $this->calDavProp('calendar-data', null, '404 Not Found'); } ! return HTTP_CalDAV_Server::calDavProp('calendar-data', $value); } --- 168,184 ---- // What about data? } else { ! return $this->calDavProp('calendar-data', null, ! '404 Not Found'); } ! $parser = new ICalendarParser($handle, null, null, ! $reqprop['value'], $filters); ! if (!$parser->success) { ! return $this->calDavProp('calendar-data', null, ! '404 Not Found'); } ! return HTTP_CalDAV_Server::calDavProp('calendar-data', ! $parser->comps[count($parser->comps) - 1]); } *************** *** 180,273 **** } - function _parseComponent($handle, $value=null, $filters=null) - { - $comps = array(); - $compValues = array($value); - $compFilters = array($filters); - while (($line = fgets($handle, 4096)) !== false) { - $line = explode(':', trim($line)); - - if ($line[0] == 'END') { - if ($line[1] != $comps[count($comps) - 1]->name) { - return; - } - - if (is_array($compFilters[count($compFilters) - 1]['filters'])) { - foreach ($compFilters[count($compFilters) - 1]['filters'] as $filter) { - if ($filter['name'] == 'time-range') { - if ($filter['value']['start'] > $comps[count($comps) - 1]->properties['DTEND'][0]->value || $filter['value']['end'] < $comps[count($comps) - 1]->properties['DTSTART'][0]->value) { - array_pop($compValues); - array_pop($compFilters); - continue; - } - } - } - } - - // If we're about to pop the root component, we ignore the rest - // of our input - if (count($comps) == 1) { - return array_pop($comps); - } - - if (!$comps[count($comps) - 2]->add_component(array_pop($comps))) { - return; - } - - array_pop($compValues); - array_pop($compFilters); - continue; - } - - if ($line[0] == 'BEGIN') { - $compName = $line[1]; - if (is_array($compValues[count($compValues) - 1]['comps']) && - !isset($compValues[count($compValues) - 1]['comps'][$compName])) { - while (($line = fgets($handle, 4096)) !== false) { - if (trim($line) == "END:$compName") { - continue (2); - } - } - - return; - } - - $className = 'iCalendar_' . ltrim(strtolower($compName), 'v'); - if ($line[1] == 'VCALENDAR') { - $className = 'iCalendar'; - } - - if (!class_exists($className)) { - while (($line = fgets($handle, 4096)) !== false) { - if (trim($line) == "END:$compName") { - continue (2); - } - } - - return; - } - - $comps[] = new $className; - $compValues[] = $compValues[count($compValues) - 1]['comps'][$compName]; - $compFilters[] = $compFilters[count($compFilters) - 1]['comps'][$compName]; - continue; - } - - $line[0] = explode(';=', $line[0]); - $propName = array_shift($line[0]); - if (is_array($compValues[count($compValues) - 1]['props']) && - !in_array($propName, - $compValues[count($compValues) - 1]['props'])) { - continue; - } - - $params = array(); - while (!empty($line[0])) { - $params[array_shift($line[0])] = array_shift($line[0]); - } - $comps[count($comps) - 1]->add_property($propName, $line[1], $params); - } - } - function _multistatus($responses) { --- 189,192 ---- |
From: <ja...@us...> - 2006-04-18 03:22:17
|
Update of /cvsroot/phpicalendar/phpicalendar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12568 Modified Files: caldav.php Log Message: * Moved iCalendar parsing function into it's own class, complete with offsets support * Fixed bug with $depth < 'infinity' * TODO If this parser works & has all necessary features, add documentation Index: caldav.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/caldav.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** caldav.php 14 Apr 2006 02:50:09 -0000 1.3 --- caldav.php 18 Apr 2006 03:22:12 -0000 1.4 *************** *** 169,173 **** $file['props'][] = $this->mkprop('resourcetype', 'collection'); ! if ($depth < $options['depth']) { $handle = opendir($absolutePath); if (!$handle) { --- 169,174 ---- $file['props'][] = $this->mkprop('resourcetype', 'collection'); ! if ($depth < $options['depth'] || ! $options['depth'] == 'infinity') { $handle = opendir($absolutePath); if (!$handle) { *************** *** 231,235 **** $file['props'][] = $this->mkprop('resourcetype', 'collection'); ! if ($depth < $options['depth']) { $handle = opendir($absolutePath); if (!$handle) { --- 232,237 ---- $file['props'][] = $this->mkprop('resourcetype', 'collection'); ! if ($depth < $options['depth'] || ! $options['depth'] == 'infinity') { $handle = opendir($absolutePath); if (!$handle) { |
From: <ja...@us...> - 2006-04-14 02:50:14
|
Update of /cvsroot/phpicalendar/phpicalendar In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4581 Modified Files: caldav.php Log Message: * Depth: header support * Committing current WebDAV library Index: caldav.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/caldav.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** caldav.php 13 Apr 2006 05:10:24 -0000 1.2 --- caldav.php 14 Apr 2006 02:50:09 -0000 1.3 *************** *** 149,159 **** } - // FIXME Handle depth // FIXME Use file_exists function propfind($options, &$files) { $files = array(); ! $paths = array(); ! $path = $options['path']; ! while (isset($path)) { $file = array(); $file['path'] = $path; --- 149,159 ---- } // FIXME Use file_exists function propfind($options, &$files) { $files = array(); ! $paths = array(array($options['path'], 0)); ! while (!empty($paths)) { ! list ($path, $depth) = array_pop($paths); ! $file = array(); $file['path'] = $path; *************** *** 169,184 **** $file['props'][] = $this->mkprop('resourcetype', 'collection'); ! $handle = opendir($absolutePath); ! if (!$handle) { ! return; ! } ! while (($pathComponent = readdir($handle)) !== false) { ! if ($pathComponent != '.' && $pathComponent != '..') { ! $paths[] = $path != '' ? "$path/$pathComponent" : ! $pathComponent; } } - closedir($handle); } else { $file['props'][] = $this->mkprop('getcontentlength', --- 169,187 ---- $file['props'][] = $this->mkprop('resourcetype', 'collection'); ! if ($depth < $options['depth']) { ! $handle = opendir($absolutePath); ! if (!$handle) { ! return; ! } ! while (($pathComponent = readdir($handle)) !== false) { ! if ($pathComponent != '.' && $pathComponent != '..') { ! $paths[] = array($path != '' ? ! "$path/$pathComponent" : $pathComponent, ! $depth + 1); ! } } + closedir($handle); } } else { $file['props'][] = $this->mkprop('getcontentlength', *************** *** 188,192 **** $files[] = $file; - $path = array_pop($paths); } --- 191,194 ---- *************** *** 212,218 **** function report($options, &$files) { $files = array(); ! $paths = array(); ! $path = $options['path']; ! while (isset($path)) { $file = array(); $file['path'] = $path; --- 214,221 ---- function report($options, &$files) { $files = array(); ! $paths = array(array($options['path'], 0)); ! while (!empty($paths)) { ! list ($path, $depth) = array_pop($paths); ! $file = array(); $file['path'] = $path; *************** *** 228,243 **** $file['props'][] = $this->mkprop('resourcetype', 'collection'); ! $handle = opendir($absolutePath); ! if (!$handle) { ! return; ! } ! while (($pathComponent = readdir($handle)) !== false) { ! if ($pathComponent != '.' && $pathComponent != '..') { ! $paths[] = $path != '' ? "$path/$pathComponent" : ! $pathComponent; } } - closedir($handle); } else { $file['props'][] = $this->mkprop('getcontentlength', --- 231,249 ---- $file['props'][] = $this->mkprop('resourcetype', 'collection'); ! if ($depth < $options['depth']) { ! $handle = opendir($absolutePath); ! if (!$handle) { ! return; ! } ! while (($pathComponent = readdir($handle)) !== false) { ! if ($pathComponent != '.' && $pathComponent != '..') { ! $paths[] = array($path != '' ? ! "$path/$pathComponent" : $pathComponent, ! $depth + 1); ! } } + closedir($handle); } } else { $file['props'][] = $this->mkprop('getcontentlength', *************** *** 247,251 **** $files[] = $file; - $path = array_pop($paths); } --- 253,256 ---- |
From: <ja...@us...> - 2006-04-14 02:50:14
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/WebDAV In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4581/lib/HTTP/WebDAV Modified Files: Server.php Log Message: * Depth: header support * Committing current WebDAV library Index: Server.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/WebDAV/Server.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Server.php 9 Apr 2006 19:27:12 -0000 1.1.1.1 --- Server.php 14 Apr 2006 02:50:09 -0000 1.2 *************** *** 151,156 **** $wrapper = $method . '_wrapper'; ! // activate HEAD emulation by GET if no HEAD method found ! if ($method == 'head' && !method_exists($this, 'head')) { $method = 'get'; } --- 151,157 ---- $wrapper = $method . '_wrapper'; ! // emulate HEAD using GET if no HEAD method found ! if ($wrapper == 'head_wrapper' && ! !method_exists($this, 'head')) { $method = 'get'; } *************** *** 463,482 **** $options['path'] = $this->path; ! // search depth from header (default is 'infinity') if (isset($_SERVER['HTTP_DEPTH'])) { $options['depth'] = $_SERVER['HTTP_DEPTH']; - } else { - $options['depth'] = 'infinity'; } // analyze request payload ! $propinfo = new _parse_propfind('php://input'); ! ! if (!$propinfo->success) { $this->http_status('400 Bad Request'); return; } ! $options['props'] = $propinfo->props; return true; --- 464,481 ---- $options['path'] = $this->path; ! // get depth from header (default is 'infinity') ! $options['depth'] = 'infinity'; if (isset($_SERVER['HTTP_DEPTH'])) { $options['depth'] = $_SERVER['HTTP_DEPTH']; } // analyze request payload ! $parser = new _parse_propfind('php://input'); ! if (!$parser->success) { $this->http_status('400 Bad Request'); return; } ! $options['props'] = $parser->props; return true; *************** *** 500,503 **** --- 499,508 ---- // now loop over all returned files foreach ($files as $file) { + + // collect namespaces here + // Microsoft need this special namespace for date and time values + $ns_hash = array( + 'urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882' => 'ns0'); + $response = array(); *************** *** 509,569 **** $response['propstat'] = array(); ! // collect namespaces here ! $ns_hash = array(); ! ! // Microsoft need this special namespace for date and time values ! $ns_hash['urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882'] = 'ns0'; ! ! // nothing to do if no properties were returend ! if (isset($file['props']) && is_array($file['props'])) { ! // now loop over all returned properties ! foreach ($file['props'] as $prop) { $status = '200 OK'; ! // as a convenience feature we do not require user handlers ! // restrict returned properties to the requested ones ! // here we ignore unrequested entries ! switch ($options['props']) { ! case 'names': ! ! // only names of all existing properties were requested ! // so remove values ! unset($prop['val']); ! ! case 'all': ! if (isset($prop['status'])) { ! $status = $prop['status']; ! } ! ! if (!isset($response['propstat'][$status])) { ! $response['propstat'][$status] = array(); ! } ! ! $response['propstat'][$status][] = $prop; ! break; ! ! default: ! ! // search property name in requested properties ! foreach($options['props'] as $reqprop) { ! if ($reqprop['name'] == $prop['name'] && ! $reqprop['xmlns'] == $prop['ns']) { ! if (isset($prop['status'])) { ! $status = $prop['status']; ! } ! ! if (!isset($response['propstat'][$status])) { ! $response['propstat'][$status] = array(); ! } ! ! $response['propstat'][$status][] = $prop; ! break(2); ! } ! } ! continue(2); } // namespace handling if (empty($prop['ns']) || // empty namespace --- 514,534 ---- $response['propstat'] = array(); ! if (is_array($options['props'])) { ! // loop over all requested properties ! foreach ($options['props'] as $reqprop) { $status = '200 OK'; + $prop = $this->getProp($reqprop, $file, $options); ! if (isset($prop['status'])) { ! $status = $prop['status']; ! } ! if (!isset($response['propstat'][$status])) { ! $response['propstat'][$status] = array(); } + $response['propstat'][$status][] = $prop; + // namespace handling if (empty($prop['ns']) || // empty namespace *************** *** 576,610 **** $ns_hash[$prop['ns']] = 'ns' . count($ns_hash); } ! } ! ! // also need empty entries for properties requested ! // but for which no values where returned ! if (isset($options['props']) && is_array($options['props'])) { ! ! // now loop over all requested properties ! foreach ($options['props'] as $reqprop) { ! $status = '404 Not Found'; ! ! // check if property exists in result ! foreach ($file['props'] as $prop) { ! if ($reqprop['name'] == $prop['name'] && ! $reqprop['xmlns'] == $prop['ns']) { ! continue(2); ! } ! } ! ! if ($reqprop['name'] == 'lockdiscovery' && ! $reqprop['xmlns'] == 'DAV:' && ! method_exists($this, 'getLocks')) { ! $status = '200 OK'; ! if (!isset($response['propstat'][$status])) { ! $response['propstat'][$status] = array(); ! } ! $response['propstat'][$status][] = ! $this->mkprop('DAV:', 'lockdiscovery', ! $this->getLocks($file['path'])); ! continue; } --- 541,552 ---- $ns_hash[$prop['ns']] = 'ns' . count($ns_hash); } ! } else if (is_array($file['props'])) { ! // loop over all returned properties ! foreach ($file['props'] as $prop) { ! $status = '200 OK'; ! if (isset($prop['status'])) { ! $status = $prop['status']; } *************** *** 613,630 **** } ! // add empty value for this property ! $response['propstat'][$status][] = ! $this->mkprop($reqprop['xmlns'], $reqprop['name'], ! null); // namespace handling ! if (empty($reqprop['xmlns']) || // empty namespace ! $reqprop['xmlns'] == 'DAV:' || // default namespace ! isset($ns_hash[$reqprop['xmlns']])) { // already known continue; } // register namespace ! $ns_hash[$reqprop['xmlns']] = 'ns' . count($ns_hash); } } --- 555,577 ---- } ! if ($options['props'] == 'propname') { ! ! // only names of all existing properties were requested ! // so remove values ! unset($prop['value']); ! } ! ! $response['propstat'][$status][] = $prop; ! unset($prop['value']); // namespace handling ! if (empty($prop['ns']) || // empty namespace ! $prop['ns'] == 'DAV:' || // default namespace ! isset($ns_hash[$prop['ns']])) { // already known continue; } // register namespace ! $ns_hash[$prop['ns']] = 'ns' . count($ns_hash); } } *************** *** 677,682 **** // empty properties (cannot use empty for check as '0' // is a legal value here) ! if (!isset($prop['val']) || empty($prop['val']) && ! $prop['val'] !== 0) { if ($prop['ns'] == 'DAV:') { echo " <D:$prop[name]/>\n"; --- 624,629 ---- // empty properties (cannot use empty for check as '0' // is a legal value here) ! if (!isset($prop['value']) || empty($prop['value']) && ! $prop['value'] !== 0) { if ($prop['ns'] == 'DAV:') { echo " <D:$prop[name]/>\n"; *************** *** 701,705 **** case 'creationdate': echo " <D:creationdate ns0:dt=\"dateTime.tz\">\n"; ! echo ' ' . gmdate('Y-m-d\TH:i:s\Z', $prop['val']) . "\n"; echo " </D:creationdate>\n"; break; --- 648,652 ---- case 'creationdate': echo " <D:creationdate ns0:dt=\"dateTime.tz\">\n"; ! echo ' ' . gmdate('Y-m-d\TH:i:s\Z', $prop['value']) . "\n"; echo " </D:creationdate>\n"; break; *************** *** 707,711 **** case 'getlastmodified': echo " <D:getlastmodified ns0:dt=\"dateTime.rfc1123\">\n"; ! echo ' ' . gmdate('D, d M Y H:i:s', $prop['val']) . " GMT\n"; echo " </D:getlastmodified>\n"; break; --- 654,658 ---- case 'getlastmodified': echo " <D:getlastmodified ns0:dt=\"dateTime.rfc1123\">\n"; ! echo ' ' . gmdate('D, d M Y H:i:s', $prop['value']) . " GMT\n"; echo " </D:getlastmodified>\n"; break; *************** *** 713,717 **** case 'resourcetype': echo " <D:resourcetype>\n"; ! echo " <D:$prop[val]/>\n"; echo " </D:resourcetype>\n"; break; --- 660,664 ---- case 'resourcetype': echo " <D:resourcetype>\n"; ! echo " <D:$prop[value]/>\n"; echo " </D:resourcetype>\n"; break; *************** *** 719,727 **** case 'supportedlock': ! if (is_array($prop[val])) { ! $prop[val] = $this->_lockentries($prop[val]); } echo " <D:supportedlock>\n"; ! echo " $prop[val]\n"; echo " </D:supportedlock>\n"; break; --- 666,674 ---- case 'supportedlock': ! if (is_array($prop[value])) { ! $prop[value] = $this->_lockentries($prop[value]); } echo " <D:supportedlock>\n"; ! echo " $prop[value]\n"; echo " </D:supportedlock>\n"; break; *************** *** 729,737 **** case 'lockdiscovery': ! if (is_array($prop[val])) { ! $prop[val] = $this->_activelocks($prop[val]); } echo " <D:lockdiscovery>\n"; ! echo " $prop[val]\n"; echo " </D:lockdiscovery>\n"; break; --- 676,684 ---- case 'lockdiscovery': ! if (is_array($prop[value])) { ! $prop[value] = $this->_activelocks($prop[value]); } echo " <D:lockdiscovery>\n"; ! echo " $prop[value]\n"; echo " </D:lockdiscovery>\n"; break; *************** *** 739,743 **** default: echo " <D:$prop[name]>\n"; ! echo ' ' . $this->_prop_encode(htmlspecialchars($prop['val'])) . "\n"; echo " </D:$prop[name]>\n"; } --- 686,690 ---- default: echo " <D:$prop[name]>\n"; ! echo ' ' . $this->_prop_encode(htmlspecialchars($prop['value'])) . "\n"; echo " </D:$prop[name]>\n"; } *************** *** 748,752 **** if (!empty($prop['ns'])) { echo ' <' . $response['ns_hash'][$prop['ns']] . ":$prop[name]>\n"; ! echo ' ' . $this->_prop_encode(htmlspecialchars($prop['val'])) . "\n"; echo ' </' . $response['ns_hash'][$prop['ns']] . ":$prop[name]>\n"; --- 695,699 ---- if (!empty($prop['ns'])) { echo ' <' . $response['ns_hash'][$prop['ns']] . ":$prop[name]>\n"; ! echo ' ' . $this->_prop_encode(htmlspecialchars($prop['value'])) . "\n"; echo ' </' . $response['ns_hash'][$prop['ns']] . ":$prop[name]>\n"; *************** *** 755,759 **** echo " <$prop[name] xmlns=\"\">\n"; ! echo ' ' . $this->_prop_encode(htmlspecialchars($prop['val'])) . "\n"; echo " </$prop[name]>\n"; } --- 702,706 ---- echo " <$prop[name] xmlns=\"\">\n"; ! echo ' ' . $this->_prop_encode(htmlspecialchars($prop['value'])) . "\n"; echo " </$prop[name]>\n"; } *************** *** 962,965 **** --- 909,939 ---- } + /** + * parse HTTP Range: header + * + * @param array options array to store result in + * @return void + */ + function _get_ranges(&$options) + { + // process Range: header if present + if (isset($_SERVER['HTTP_RANGE'])) { + + // we only support standard 'bytes' range specifications for now + if (ereg('bytes[[:space:]]*=[[:space:]]*(.+)', $_SERVER['HTTP_RANGE'], $matches)) { + $options['ranges'] = array(); + + // ranges are comma separated + foreach (explode(',', $matches[1]) as $range) { + // ranges are either from-to pairs or just end positions + list($start, $end) = explode('-', $range); + $options['ranges'][] = ($start === '') + ? array('last' => $end) + : array('start' => $start, 'end' => $end); + } + } + } + } + // }}} *************** *** 976,980 **** { if (empty($status)) { ! $status('404 Not Found'); } --- 950,954 ---- { if (empty($status)) { ! $status = '404 Not Found'; } *************** *** 996,1000 **** } ! if (isset($options['stream'])) { // GET handler returned a stream --- 970,974 ---- } ! if ($options['stream']) { // GET handler returned a stream *************** *** 1083,1137 **** } - // }}} - - // {{{ get_wrapper - - /** - * GET method wrapper - * - * @param void - * @return void - */ - function get_wrapper() - { - // perpare data-structure from GET request - if (!$this->get_request_helper($options)) { - return; - } - - // call user handler - $status = $this->get($options); - - // format GET response - $this->get_response_helper($options, $status); - } - - /** - * parse HTTP Range: header - * - * @param array options array to store result in - * @return void - */ - function _get_ranges(&$options) - { - // process Range: header if present - if (isset($_SERVER['HTTP_RANGE'])) { - - // we only support standard 'bytes' range specifications for now - if (ereg('bytes[[:space:]]*=[[:space:]]*(.+)', $_SERVER['HTTP_RANGE'], $matches)) { - $options['ranges'] = array(); - - // ranges are comma separated - foreach (explode(',', $matches[1]) as $range) { - // ranges are either from-to pairs or just end positions - list($start, $end) = explode('-', $range); - $options['ranges'][] = ($start === '') - ? array('last' => $end) - : array('start' => $start, 'end' => $end); - } - } - } - } - /** * generate separator headers for multipart response --- 1057,1060 ---- *************** *** 1180,1183 **** --- 1103,1238 ---- // }}} + // {{{ get_wrapper + + /** + * GET method wrapper + * + * @param void + * @return void + */ + function get_wrapper() + { + // perpare data-structure from GET request + if (!$this->get_request_helper($options)) { + return; + } + + // call user handler + $status = $this->get($options); + + // format GET response + $this->get_response_helper($options, $status); + } + + // }}} + + // {{{ head_response_helper + + /** + * HEAD response helper - format HEAD response + * + * @param options + * @param status + * @return void + */ + function head_response_helper($options, $status) + { + if (empty($status)) { + $status('404 Not Found'); + } + + // set headers before we start printing + $this->http_status($status); + + if ($status !== true) { + return; + } + + if (!isset($options['mimetype'])) { + $options['mimetype'] = 'application/octet-stream'; + } + header("Content-Type: $options[mimetype]"); + + if (isset($options['mtime'])) { + header('Last-Modified:' . + gmdate('D, d M Y H:i:s', $options['mtime']) . 'GMT'); + } + + if (isset($options['stream'])) { + // GET handler returned a stream + + if (!empty($options['ranges']) && + (fseek($options['stream'], 0, SEEK_SET) === 0)) { + // partial request and stream is seekable + + if (count($options['ranges']) === 1) { + $range = $options['ranges'][0]; + + if (isset($range['start'])) { + fseek($options['stream'], $range['start'], SEEK_SET); + if (feof($options['stream'])) { + $this->http_status('416 Requested Range Not Satisfiable'); + return; + } + + if (isset($range['end'])) { + $size = $range['end'] - $range['start'] + 1; + $this->http_status('206 Partial'); + header("Content-Length: $size"); + header("Content-Range: $range[start]-$range[end]/" . + (isset($options['size']) ? $options['size'] : '*')); + } else { + $this->http_status('206 Partial'); + if (isset($options['size'])) { + header("Content-Length: " . + ($options['size'] - $range['start'])); + header("Content-Range: $start-$end/" . + (isset($options['size']) ? $options['size'] : '*')); + } + } + } else { + header("Content-Length: $range[last]"); + fseek($options['stream'], -$range['last'], SEEK_END); + } + } else { + $this->_multipart_byterange_header(); // init multipart + foreach ($options['ranges'] as $range) { + + // TODO what if size unknown? 500? + if (isset($range['start'])) { + $from = $range['start']; + $to = !empty($range['end']) ? $range['end'] : + $options['size'] - 1; + } else { + $from = $options['size'] - $range['last'] - 1; + $to = $options['size'] - 1; + } + $total = isset($options['size']) ? $options['size'] : + '*'; + $size = $to - $from + 1; + $this->_multipart_byterange_header($options['mimetype'], + $from, $to, $total); + + fseek($options['stream'], $start, SEEK_SET); + } + $this->_multipart_byterange_header(); // end multipart + } + } else { + // normal request or stream isn't seekable, return full content + if (isset($options['size'])) { + header("Content-Length: $options[size]"); + } + } + } else if (isset($options['data'])) { + if (is_array($options['data'])) { + // reply to partial request + } else { + header("Content-Length: " . strlen($options['data'])); + } + } + } + + // }}} + // {{{ head_wrapper *************** *** 1193,1199 **** $options['path'] = $this->path; ! if (method_exists($this, 'HEAD')) { $status = $this->head($options); ! } else if (method_exists($this, 'GET')) { ob_start(); $status = $this->get($options); --- 1248,1257 ---- $options['path'] = $this->path; ! // call user handler ! if (method_exists($this, 'head')) { $status = $this->head($options); ! } else { ! ! // can emulate HEAD using GET ob_start(); $status = $this->get($options); *************** *** 1201,1208 **** } ! if (empty($status)) { ! $status = '404 Not Found'; ! } ! $this->http_status($status); } --- 1259,1264 ---- } ! // format HEAD response ! $this->head_response_helper($options, $status); } *************** *** 1244,1248 **** // does not understand or implement and MUST return a 501 // (Not Implemented) response in such cases. ! foreach ($_SERVER as $key => $val) { if (strncmp($key, 'HTTP_CONTENT', 11)) continue; switch ($key) { --- 1300,1304 ---- // does not understand or implement and MUST return a 501 // (Not Implemented) response in such cases. ! foreach ($_SERVER as $key => $value) { if (strncmp($key, 'HTTP_CONTENT', 11)) continue; switch ($key) { *************** *** 1251,1255 **** // TODO support this if ext/zlib filters are available $this->http_status('501 Not Implemented'); ! echo "The service does not support '$val' content encoding"; return; --- 1307,1311 ---- // TODO support this if ext/zlib filters are available $this->http_status('501 Not Implemented'); ! echo "The service does not support '$value' content encoding"; return; *************** *** 1764,1767 **** --- 1820,1847 ---- } + function getProp($reqprop, $file, $options) + { + // check if property exists in response + foreach ($file['props'] as $prop) { + if ($reqprop['name'] == $prop['name'] && + $reqprop['ns'] == $prop['ns']) { + return $prop; + } + } + + if ($reqprop['name'] == 'lockdiscovery' && + $reqprop['ns'] == 'DAV:' && + method_exists($this, 'getLocks')) { + + return $this->mkprop('DAV:', 'lockdiscovery', + $this->getLocks($file['path'])); + } + + // incase the requested property had a value, like calendar-data + unset($reqprop['value']); + $reqprop['status'] = '404 Not Found'; + return $reqprop; + } + function getDescendentsLocks($path) { *************** *** 1802,1808 **** //if (!strncmp('_wrapper', $method, -8)) { if (!strcmp(substr($method, -8), '_wrapper')) { ! $method = strtoupper(substr($method, 0, -8)); if (method_exists($this, $method) && ! ($method != 'LOCK' && $method != 'UNLOCK' || method_exists($this, 'getLocks'))) { $allow[] = $method; --- 1882,1888 ---- //if (!strncmp('_wrapper', $method, -8)) { if (!strcmp(substr($method, -8), '_wrapper')) { ! $method = strtolower(substr($method, 0, -8)); if (method_exists($this, $method) && ! ($method != 'lock' && $method != 'unlock' || method_exists($this, 'getLocks'))) { $allow[] = $method; *************** *** 1834,1846 **** { $args = func_get_args(); ! if (count($args) == 3) { ! return array('ns' => $args[0], ! 'name' => $args[1], ! 'val' => $args[2]); } ! return array('ns' => 'DAV:', ! 'name' => $args[0], ! 'val' => $args[1]); } --- 1914,1929 ---- { $args = func_get_args(); ! ! $prop = array(); ! $prop['ns'] = 'DAV:'; ! if (count($args) > 2) { ! $prop['ns'] = array_shift($args); } ! $prop['name'] = array_shift($args); ! $prop['value'] = array_shift($args); ! $prop['status'] = array_shift($args); ! ! return $prop; } *************** *** 2059,2064 **** if (is_array($uris[$uri])) { $uris[$uri] = array_merge($uris[$uri], $list); ! continue; ! } $uris[$uri] = $list; } --- 2142,2147 ---- if (is_array($uris[$uri])) { $uris[$uri] = array_merge($uris[$uri], $list); ! continue; ! } $uris[$uri] = $list; } *************** *** 2104,2108 **** if (!$this->_check_uri_condition($uri, $condition)) { ! continue(2); } } --- 2187,2191 ---- if (!$this->_check_uri_condition($uri, $condition)) { ! continue (2); } } |
From: <ja...@us...> - 2006-04-14 02:50:14
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/WebDAV/Tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4581/lib/HTTP/WebDAV/Tools Modified Files: _parse_lockinfo.php _parse_propfind.php _parse_proppatch.php Log Message: * Depth: header support * Committing current WebDAV library Index: _parse_propfind.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/WebDAV/Tools/_parse_propfind.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** _parse_propfind.php 9 Apr 2006 19:27:12 -0000 1.1.1.1 --- _parse_propfind.php 14 Apr 2006 02:50:10 -0000 1.2 *************** *** 1,4 **** <?php - // // +----------------------------------------------------------------------+ // | PHP Version 4 | --- 1,3 ---- *************** *** 19,23 **** // // $Id$ - // /** --- 18,21 ---- *************** *** 30,173 **** class _parse_propfind { ! /** ! * success state flag ! * ! * @var bool ! * @access public ! */ ! var $success = false; ! ! /** ! * found properties are collected here ! * ! * @var array ! * @access public ! */ ! var $props = false; ! /** ! * internal tag nesting depth counter ! * ! * @var int ! * @access private ! */ ! var $depth = 0; ! /** ! * constructor ! * ! * @access public ! */ ! function _parse_propfind($path) ! { ! // success state flag ! $this->success = true; ! // property storage array ! $this->props = array(); ! // internal tag depth counter ! $this->depth = 0; ! // remember if any input was parsed ! $had_input = false; ! // open input stream ! $f_in = fopen($path, 'r'); ! if (!$f_in) { ! $this->success = false; ! return; ! } ! // create XML parser ! $xml_parser = xml_parser_create_ns('UTF-8', ' '); ! // set tag and data handlers ! xml_set_element_handler($xml_parser, ! array(&$this, '_startElement'), ! array(&$this, '_endElement')); ! // we want a case sensitive parser ! xml_parser_set_option($xml_parser, ! XML_OPTION_CASE_FOLDING, false); ! // parse input ! while($this->success && !feof($f_in)) { ! $line = fgets($f_in); ! if (is_string($line)) { ! $had_input = true; ! $this->success &= xml_parse($xml_parser, $line, false); ! } ! } ! // finish parsing ! if($had_input) { ! $this->success &= xml_parse($xml_parser, '', true); ! } ! // free parser ! xml_parser_free($xml_parser); ! // close input stream ! fclose($f_in); ! // if no input was parsed it was a request ! if(!count($this->props)) $this->props = 'all'; // default ! } ! /** ! * start tag handler ! * ! * @access private ! * @param resource parser ! * @param string tag name ! * @param array tag attributes ! */ ! function _startElement($parser, $name, $attrs) ! { ! // name space handling ! if (strstr($name, ' ')) { ! list($ns, $tag) = explode(' ', $name); ! if ($ns == '') ! $this->success = false; ! } else { ! $ns = ''; ! $tag = $name; ! } ! // special tags at level 1: <allprop> and <propname> ! if ($this->depth == 1) { ! if ($tag == 'allprop') ! $this->props = 'all'; ! if ($tag == 'propname') ! $this->props = 'names'; ! } ! // requested properties are found at level 2 ! if ($this->depth == 2) { ! $prop = array('name' => $tag); ! if ($ns) ! $prop['xmlns'] = $ns; ! $this->props[] = $prop; ! } ! // increment depth count ! $this->depth++; ! } ! /** ! * end tag handler ! * ! * @access private ! * @param resource parser ! * @param string tag name ! */ ! function _endElement($parser, $name) ! { ! // here we only need to decrement the depth count ! $this->depth--; ! } } - ?> --- 28,167 ---- class _parse_propfind { ! /** ! * success state flag ! * ! * @var bool ! * @access public ! */ ! var $success = false; ! /** ! * found properties are collected here ! * ! * @var array ! * @access public ! */ ! var $props = false; ! /** ! * internal tag nesting depth counter ! * ! * @var int ! * @access private ! */ ! var $depth = 0; ! /** ! * constructor ! * ! * @access public ! */ ! function _parse_propfind($input) ! { ! // success state flag ! $this->success = true; ! // property storage array ! $this->props = array(); ! // internal tag depth counter ! $this->depth = 0; ! // remember if any input was parsed ! $had_input = false; ! // open input stream ! $handle = fopen($input, 'r'); ! if (!$handle) { ! $this->success = false; ! return; ! } ! // create XML parser ! $parser = xml_parser_create_ns('UTF-8', ' '); ! // set tag and data handlers ! xml_set_element_handler($parser, array(&$this, '_startElement'), ! array(&$this, '_endElement')); ! // we want a case sensitive parser ! xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false); ! // parse input ! while ($this->success && !feof($handle)) { ! $line = fgets($handle); ! if (is_string($line)) { ! $had_input = true; ! $this->success &= xml_parse($parser, $line, false); ! } ! } ! // finish parsing ! if ($had_input) { ! $this->success &= xml_parse($parser, '', true); ! } ! // free parser ! xml_parser_free($parser); ! // close input stream ! fclose($handle); ! // if no input was parsed it was a request ! if (empty($this->props)) { ! $this->props = 'allprop'; ! } ! } ! /** ! * start tag handler ! * ! * @access private ! * @param resource parser ! * @param string tag name ! * @param array tag attributes ! */ ! function _startElement($parser, $name, $attrs) ! { ! // name space handling ! if (strstr($name, ' ')) { ! list ($ns, $name) = explode(' ', $name); ! if (!$ns) { ! $this->success = false; ! } ! } ! // special tags at level 1: <allprop> and <propname> ! if ($this->depth == 1) { ! if ($name == 'allprop' || $name == 'propname') { ! $this->props = $name; ! } ! } ! // requested properties are found at level 2 ! if ($this->depth == 2) { ! $prop = array('name' => $name); ! if ($ns) { ! $prop['ns'] = $ns; ! } ! $this->props[] = $prop; ! } ! // increment depth count ! $this->depth++; ! } ! /** ! * end tag handler ! * ! * @access private ! * @param resource parser ! * @param string tag name ! */ ! function _endElement($parser, $name) ! { ! // here we only need to decrement the depth count ! $this->depth--; ! } } ?> |
From: <ja...@us...> - 2006-04-13 22:33:21
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12006/lib/HTTP/CalDAV/Tools Modified Files: ReportParser.php Log Message: * Working filter support for REPORT responses - at least time-range * TODO Move _parseComponent into separate file Index: ReportParser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Tools/ReportParser.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ReportParser.php 13 Apr 2006 21:14:17 -0000 1.2 --- ReportParser.php 13 Apr 2006 22:33:13 -0000 1.3 *************** *** 167,175 **** if (count($this->_names) == 2 && end($this->_names) == 'prop') { ! $prop = array('name' => $name); ! ! if ($ns) { ! $prop['ns'] = $ns; ! } if ($name == 'calendar-data') { --- 167,171 ---- if (count($this->_names) == 2 && end($this->_names) == 'prop') { ! $prop = array('name' => $name, 'ns' => $ns); if ($name == 'calendar-data') { *************** *** 184,198 **** if ($name == 'comp') { ! end($this->_comps); ! ! // Gross - end returns a copy of the last value ! $comp =& $this->_comps[key($this->_comps)]; ! ! if (!is_array($comp['comps'])) { ! $comp['comps'] = array(); } ! $comp['comps'][$attrs['name']] = array(); ! $this->_comps[] =& $comp['comps'][$attrs['name']]; $this->_names[] = $name; return; --- 180,191 ---- if ($name == 'comp') { ! if (!is_array($this->_comps[count($this->_comps) - 1]['comps'])) { ! $this->_comps[count($this->_comps) - 1]['comps'] = array(); } ! $this->_comps[count($this->_comps) - 1]['comps'][$attrs['name']] = ! array(); ! $this->_comps[] =& $this->_comps[count($this->_comps) - 1]['comps'] ! [$attrs['name']]; $this->_names[] = $name; return; *************** *** 200,213 **** if (end($this->_names) == 'comp' && $name == 'prop') { ! end($this->_comps); ! ! // Gross - end returns a copy of the last value ! $comp =& $this->_comps[key($this->_comps)]; ! ! if (!is_array($comp['props'])) { ! $comp['props'] = array(); } ! $comp['props'][] = $attrs['name']; $this->_names[] = $name; return; --- 193,201 ---- if (end($this->_names) == 'comp' && $name == 'prop') { ! if (!is_array($this->_comps[count($this->_comps) - 1]['props'])) { ! $this->_comps[count($this->_comps) - 1]['props'] = array(); } ! $this->_comps[count($this->_comps) - 1]['props'][] = $attrs['name']; $this->_names[] = $name; return; *************** *** 221,235 **** if ($name == 'comp-filter') { ! end($this->_comps); ! ! // Gross - end returns a copy of the last value ! $comp =& $this->_comps[key($this->_comps)]; ! ! if (!is_array($comp['comps'])) { ! $comp['comps'] = array(); } ! $comp['comps'][$attrs['name']] = array(); ! $this->_comps[] =& $comp['comps'][$attrs['name']]; $this->_names[] = $name; return; --- 209,220 ---- if ($name == 'comp-filter') { ! if (!is_array($this->_comps[count($this->_comps) - 1]['comps'])) { ! $this->_comps[count($this->_comps) - 1]['comps'] = array(); } ! $this->_comps[count($this->_comps) - 1]['comps'][$attrs['name']] = ! array(); ! $this->_comps[] =& $this->_comps[count($this->_comps) - 1]['comps'] ! [$attrs['name']]; $this->_names[] = $name; return; *************** *** 237,252 **** if (end($this->_names) == 'comp-filter') { ! end($this->_comps); ! ! // Gross - end returns a copy of the last value ! $comp =& $this->_comps[key($this->_comps)]; ! ! if (!is_array($comp['filters'])) { ! $comp['filters'] = array(); } ! $filter = array('name' => $name, 'value' => $attrs); ! ! $comp['filters'][] = $filter; $this->_names[] = $name; return; --- 222,231 ---- if (end($this->_names) == 'comp-filter') { ! if (!is_array($this->_comps[count($this->_comps) - 1]['filters'])) { ! $this->_comps[count($this->_comps) - 1]['filters'] = array(); } ! $this->_comps[count($this->_comps) - 1]['filters'][] = ! array('name' => $name, 'value' => $attrs); $this->_names[] = $name; return; |
From: <ja...@us...> - 2006-04-13 22:33:21
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12006/lib/HTTP/CalDAV Modified Files: Server.php Log Message: * Working filter support for REPORT responses - at least time-range * TODO Move _parseComponent into separate file Index: Server.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Server.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Server.php 13 Apr 2006 21:14:17 -0000 1.3 --- Server.php 13 Apr 2006 22:33:13 -0000 1.4 *************** *** 88,262 **** /** - * REPORT response helper - format REPORT response - * - * @param options - * @return void - * @access public - */ - function report_response_helper($options, $files) - { - $responses = array(); - - // now loop over all returned files - foreach ($files as $file) { - - // collect namespaces here - $ns_hash = array('urn:ietf:params:xml:ns:caldav' => 'C'); - - $response = array(); - - $response['href'] = $this->getHref($file['path']); - if (isset($file['href'])) { - $response['href'] = $file['href']; - } - - $response['propstat'] = array(); - - // nothing to do if no properties were returend - if (isset($file['props']) && is_array($file['props'])) { - - // now loop over all returned properties - foreach ($file['props'] as $prop) { - $status = '200 OK'; - - // as a convenience feature we do not require user handlers - // restrict returned properties to the requested ones - // here we ignore unrequested entries - switch ($options['props']) { - case 'propname': - - // only names of all existing properties were requested - // so remove values - unset($prop['value']); - - case 'allprop': - if (isset($prop['status'])) { - $status = $prop['status']; - } - - if (!isset($response['propstat'][$status])) { - $response['propstat'][$status] = array(); - } - - $response['propstat'][$status][] = $prop; - break; - - default: - - // search property name in requested properties - foreach($options['props'] as $reqprop) { - if ($reqprop['name'] == $prop['name'] && - $reqprop['ns'] == $prop['ns']) { - if (isset($prop['status'])) { - $status = $prop['status']; - } - - if (!isset($response['propstat'][$status])) { - $response['propstat'][$status] = array(); - } - - $response['propstat'][$status][] = $prop; - break (2); - } - } - - continue (2); - } - - // namespace handling - if (empty($prop['ns']) || // empty namespace - $prop['ns'] == 'DAV:' || // default namespace - isset($ns_hash[$prop['ns']])) { // already known - continue; - } - - // register namespace - $ns_hash[$prop['ns']] = 'ns' . count($ns_hash); - } - } - - // also need empty entries for properties requested - // but for which no values where returned - if (isset($options['props']) && is_array($options['props'])) { - - // now loop over all requested properties - foreach ($options['props'] as $reqprop) { - $status = '404 Not Found'; - - // check if property exists in result - foreach ($file['props'] as $prop) { - if ($reqprop['name'] == $prop['name'] && - $reqprop['ns'] == $prop['ns']) { - continue (2); - } - } - - if ($reqprop['name'] == 'lockdiscovery' && - $reqprop['ns'] == 'DAV:' && - method_exists($this, 'getLocks')) { - - $status = '200 OK'; - if (!isset($response['propstat'][$status])) { - $response['propstat'][$status] = array(); - } - - $response['propstat'][$status][] = - $this->mkprop('DAV:', 'lockdiscovery', - $this->getLocks($file['path'])); - continue; - } - - if ($reqprop['name'] == 'calendar-data' && - $reqprop['ns'] == 'urn:ietf:params:xml:ns:caldav' && - method_exists($this, 'get')) { - - $prop = $this->_calendarData($reqprop, $file, $options); - if (isset($prop)) { - $status = '200 OK'; - if (isset($prop['status'])) { - $status = $prop['status']; - } - } else { - $prop = HTTP_CalDAV_Server::calDavProp( - 'calendar-data'); - } - - if (!isset($response['propstat'][$status])) { - $response['propstat'][$status] = array(); - } - - $response['propstat'][$status][] = $prop; - continue; - } - - if (!isset($response['propstat'][$status])) { - $response['propstat'][$status] = array(); - } - - // add empty value for this property - $response['propstat'][$status][] = - $this->mkprop($reqprop['ns'], $reqprop['name'], - null); - - // namespace handling - if (empty($reqprop['ns']) || // empty namespace - $reqprop['ns'] == 'DAV:' || // default namespace - isset($ns_hash[$reqprop['ns']])) { // already known - continue; - } - - // register namespace - $ns_hash[$reqprop['ns']] = 'ns' . count($ns_hash); - } - } - - $response['ns_hash'] = $ns_hash; - $responses[] = $response; - } - - $this->_multistatus($responses); - } - - /** * REPORT method wrapper * --- 88,91 ---- *************** *** 286,332 **** /* Format REPORT response */ ! $this->report_response_helper($options, $files); } ! function _calendarData($reqprop, $file, $options) { ! $filters = $options['filters']; ! ! $options = array(); ! $options['path'] = $file['path']; ! ! $status = $this->get($options); ! if (empty($status)) { ! $status = '403 Forbidden'; } ! if ($status !== true) { ! return HTTP_CalDAV_Server::calDavProp('calendar-data', null, ! $status); } ! if ($options['mimetype'] != 'text/calendar') { ! return; ! } ! if ($options['stream']) { ! $handle = $options['stream']; ! } else if ($options['data']) { ! // What about data? ! } else { ! return; ! } ! if (!($value = HTTP_CalDAV_Server::_parseComponent($handle, ! $reqprop['value'], $filters))) { ! return; } ! return HTTP_CalDAV_Server::calDavProp('calendar-data', $value); } function _parseComponent($handle, $value=null, $filters=null) { ! $components = array(); $compValues = array($value); $compFilters = array($filters); --- 115,186 ---- /* Format REPORT response */ ! ! // TODO Make ns_hash a class variable so we can prettify C: ! // Or make getNsName so we can return C: ! $this->propfind_response_helper($options, $files); } ! function getProp($reqprop, $file, $options) { ! // check if property exists in response ! foreach ($file['props'] as $prop) { ! if ($reqprop['name'] == $prop['name'] && ! $reqprop['ns'] == $prop['ns']) { ! return $prop; ! } } ! if ($reqprop['name'] == 'lockdiscovery' && ! $reqprop['ns'] == 'DAV:' && ! method_exists($this, 'getLocks')) { ! return $this->mkprop('DAV:', 'lockdiscovery', ! $this->getLocks($file['path'])); } ! if ($reqprop['name'] == 'calendar-data' && ! $reqprop['ns'] == 'urn:ietf:params:xml:ns:caldav' && ! method_exists($this, 'get')) { ! $filters = $options['filters']; ! $options = array(); ! $options['path'] = $file['path']; ! $status = $this->get($options); ! if (empty($status)) { ! $status = '403 Forbidden'; ! } ! ! if ($status !== true) { ! return $this->calDavProp('calendar-data', null, $status); ! } ! ! if ($options['mimetype'] != 'text/calendar') { ! return $this->calDavProp('calendar-data', null, '404 Not Found'); ! } ! ! if ($options['stream']) { ! $handle = $options['stream']; ! } else if ($options['data']) { ! // What about data? ! } else { ! return $this->calDavProp('calendar-data', null, '404 Not Found'); ! } ! ! if (!($value = $this->_parseComponent($handle, $reqprop['value'], $filters))) { ! return $this->calDavProp('calendar-data', null, '404 Not Found'); ! } ! ! return HTTP_CalDAV_Server::calDavProp('calendar-data', $value); } ! // incase the requested property had a value, like calendar-data ! unset($reqprop['value']); ! $reqprop['status'] = '404 Not Found'; ! return $reqprop; } function _parseComponent($handle, $value=null, $filters=null) { ! $comps = array(); $compValues = array($value); $compFilters = array($filters); *************** *** 335,347 **** if ($line[0] == 'END') { ! if ($line[1] != $components[key($components)]->name) { return; } ! if (is_array($compFilters[key($compFilters)]['filters'])) { ! foreach ($compFilters[key($compFilters)]['filters'] as $filter) { ! print $filter['name']; if ($filter['name'] == 'time-range') { ! if ($filter['value']['start'] > $components[key($components)]->properties['DTEND'][0]->value || $filter['value']['end'] < $components[key($components)]->properties['DTSTART'][0]->value) { array_pop($compValues); array_pop($compFilters); --- 189,200 ---- if ($line[0] == 'END') { ! if ($line[1] != $comps[count($comps) - 1]->name) { return; } ! if (is_array($compFilters[count($compFilters) - 1]['filters'])) { ! foreach ($compFilters[count($compFilters) - 1]['filters'] as $filter) { if ($filter['name'] == 'time-range') { ! if ($filter['value']['start'] > $comps[count($comps) - 1]->properties['DTEND'][0]->value || $filter['value']['end'] < $comps[count($comps) - 1]->properties['DTSTART'][0]->value) { array_pop($compValues); array_pop($compFilters); *************** *** 354,362 **** // If we're about to pop the root component, we ignore the rest // of our input ! if (count($components) == 1) { ! return array_pop($components); } ! if (!$components[key($components)]->add_component(array_pop($components))) { return; } --- 207,215 ---- // If we're about to pop the root component, we ignore the rest // of our input ! if (count($comps) == 1) { ! return array_pop($comps); } ! if (!$comps[count($comps) - 2]->add_component(array_pop($comps))) { return; } *************** *** 369,377 **** if ($line[0] == 'BEGIN') { $compName = $line[1]; ! var_dump($compName); ! var_dump($compValues); ! var_dump($compValues[key($compValues)]); ! if (is_array($compValues[key($compValues)]['comps']) && ! !isset($compValues[key($compValues)]['comps'][$compName])) { while (($line = fgets($handle, 4096)) !== false) { if (trim($line) == "END:$compName") { --- 222,227 ---- if ($line[0] == 'BEGIN') { $compName = $line[1]; ! if (is_array($compValues[count($compValues) - 1]['comps']) && ! !isset($compValues[count($compValues) - 1]['comps'][$compName])) { while (($line = fgets($handle, 4096)) !== false) { if (trim($line) == "END:$compName") { *************** *** 398,407 **** } ! $components[] = new $className; ! end($components); ! $compValues[] = $compValues[key($compValues)]['comps'][$compName]; ! end($components); ! $compFilters[] = $compFilters[key($compFilters)]['comps'][$compName]; ! end($components); continue; } --- 248,254 ---- } ! $comps[] = new $className; ! $compValues[] = $compValues[count($compValues) - 1]['comps'][$compName]; ! $compFilters[] = $compFilters[count($compFilters) - 1]['comps'][$compName]; continue; } *************** *** 409,414 **** $line[0] = explode(';=', $line[0]); $propName = array_shift($line[0]); ! if (is_array($data['props']) && ! !in_array($propName, $data['props'])) { continue; } --- 256,262 ---- $line[0] = explode(';=', $line[0]); $propName = array_shift($line[0]); ! if (is_array($compValues[count($compValues) - 1]['props']) && ! !in_array($propName, ! $compValues[count($compValues) - 1]['props'])) { continue; } *************** *** 418,422 **** $params[array_shift($line[0])] = array_shift($line[0]); } ! $components[key($components)]->add_property($propName, $line[1], $params); } } --- 266,270 ---- $params[array_shift($line[0])] = array_shift($line[0]); } ! $comps[count($comps) - 1]->add_property($propName, $line[1], $params); } } |
From: <ja...@us...> - 2006-04-13 21:14:29
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/bennu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18717/lib/bennu Modified Files: iCalendar_components.php Log Message: * Half way through filter support for calendar-query REPORTs * About to normalize report_response_helper with propfind_response_helper Index: iCalendar_components.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/bennu/iCalendar_components.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** iCalendar_components.php 13 Apr 2006 05:10:24 -0000 1.1 --- iCalendar_components.php 13 Apr 2006 21:14:17 -0000 1.2 *************** *** 180,196 **** function serialize() { - // Check for validity of the object - if(!$this->is_valid()) { - return false; - } - - // Maybe the object is valid, but there are some required properties that - // have not been given explicit values. In that case, set them to defaults. - foreach($this->valid_properties as $property => $propdata) { - if(($propdata & RFC2445_REQUIRED) && empty($this->properties[$property])) { - $this->add_property($property); - } - } - // Start tag $string = rfc2445_fold('BEGIN:'.$this->name) . RFC2445_CRLF; --- 180,183 ---- *************** *** 408,410 **** // REMINDER: DUE must be later than DTSTART for all components which support both ! ?> \ No newline at end of file --- 395,397 ---- // REMINDER: DUE must be later than DTSTART for all components which support both ! ?> |
From: <ja...@us...> - 2006-04-13 21:14:20
|
Update of /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18717/lib/HTTP/CalDAV Modified Files: Server.php Log Message: * Half way through filter support for calendar-query REPORTs * About to normalize report_response_helper with propfind_response_helper Index: Server.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/lib/HTTP/CalDAV/Server.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Server.php 13 Apr 2006 05:10:24 -0000 1.2 --- Server.php 13 Apr 2006 21:14:17 -0000 1.3 *************** *** 82,85 **** --- 82,86 ---- $options['props'] = $parser->props; + $options['filters'] = $parser->filters; return true; *************** *** 210,215 **** method_exists($this, 'get')) { ! $prop = $this->_calendarData($file['path'], ! $reqprop['value']); if (isset($prop)) { $status = '200 OK'; --- 211,215 ---- method_exists($this, 'get')) { ! $prop = $this->_calendarData($reqprop, $file, $options); if (isset($prop)) { $status = '200 OK'; *************** *** 289,301 **** } ! function _calendarData($path, $data=null, $filter=null) { ! if (is_array($data['comps']) && ! !isset($data['comps']['VCALENDAR'])) { ! return HTTP_CalDAV_Server::calDavProp('calendar-data'); ! } $options = array(); ! $options['path'] = $path; $status = $this->get($options); --- 289,298 ---- } ! function _calendarData($reqprop, $file, $options) { ! $filters = $options['filters']; $options = array(); ! $options['path'] = $file['path']; $status = $this->get($options); *************** *** 310,315 **** if ($options['mimetype'] != 'text/calendar') { ! return HTTP_CalDAV_Server::calDavProp('calendar-data', null, ! '403 Forbidden'); } --- 307,311 ---- if ($options['mimetype'] != 'text/calendar') { ! return; } *************** *** 322,336 **** } - if (($line = fgets($handle, 4096)) === false) { - return; - } - - if (trim($line) != 'BEGIN:VCALENDAR') { - return; - } - if (!($value = HTTP_CalDAV_Server::_parseComponent($handle, ! 'VCALENDAR', is_array($data['comps']) ? ! $data['comps']['VCALENDAR'] : null))) { return; } --- 318,323 ---- } if (!($value = HTTP_CalDAV_Server::_parseComponent($handle, ! $reqprop['value'], $filters))) { return; } *************** *** 339,370 **** } ! function _parseComponent($handle, $name, $data=null, $filter=null) { ! $className = 'iCalendar_' . ltrim(strtolower($name), 'v'); ! if ($name == 'VCALENDAR') { ! $className = 'iCalendar'; ! } ! ! if (!class_exists($className)) { ! return; ! } ! $component = new $className; ! while (($line = fgets($handle, 4096)) !== false) { $line = explode(':', trim($line)); if ($line[0] == 'END') { ! if ($line[1] != $name) { return; } ! return $component; } if ($line[0] == 'BEGIN') { ! if (is_array($data['comps']) && ! !isset($data['comps'][$line[1]])) { ! while (($l = fgets($handle, 4096)) !== false) { ! if (trim($l) == "END:$line[1]") { continue (2); } --- 326,379 ---- } ! function _parseComponent($handle, $value=null, $filters=null) { ! $components = array(); ! $compValues = array($value); ! $compFilters = array($filters); while (($line = fgets($handle, 4096)) !== false) { $line = explode(':', trim($line)); if ($line[0] == 'END') { ! if ($line[1] != $components[key($components)]->name) { return; } ! if (is_array($compFilters[key($compFilters)]['filters'])) { ! foreach ($compFilters[key($compFilters)]['filters'] as $filter) { ! print $filter['name']; ! if ($filter['name'] == 'time-range') { ! if ($filter['value']['start'] > $components[key($components)]->properties['DTEND'][0]->value || $filter['value']['end'] < $components[key($components)]->properties['DTSTART'][0]->value) { ! array_pop($compValues); ! array_pop($compFilters); ! continue; ! } ! } ! } ! } ! ! // If we're about to pop the root component, we ignore the rest ! // of our input ! if (count($components) == 1) { ! return array_pop($components); ! } ! ! if (!$components[key($components)]->add_component(array_pop($components))) { ! return; ! } ! ! array_pop($compValues); ! array_pop($compFilters); ! continue; } if ($line[0] == 'BEGIN') { ! $compName = $line[1]; ! var_dump($compName); ! var_dump($compValues); ! var_dump($compValues[key($compValues)]); ! if (is_array($compValues[key($compValues)]['comps']) && ! !isset($compValues[key($compValues)]['comps'][$compName])) { ! while (($line = fgets($handle, 4096)) !== false) { ! if (trim($line) == "END:$compName") { continue (2); } *************** *** 374,382 **** } ! if (!($childComponent = HTTP_CalDAV_Server::_parseComponent( ! $handle, $line[1], is_array($data['comps']) ? ! $data['comps'][$line[1]] : null))) { ! while (($l = fgets($handle, 4096)) !== false) { ! if (trim($l) == "END:$line[1]") { continue (2); } --- 383,394 ---- } ! $className = 'iCalendar_' . ltrim(strtolower($compName), 'v'); ! if ($line[1] == 'VCALENDAR') { ! $className = 'iCalendar'; ! } ! ! if (!class_exists($className)) { ! while (($line = fgets($handle, 4096)) !== false) { ! if (trim($line) == "END:$compName") { continue (2); } *************** *** 386,409 **** } ! if (!$component->add_component($childComponent)) { ! return; ! } ! continue; } $line[0] = explode(';=', $line[0]); ! $prop_name = array_shift($line[0]); if (is_array($data['props']) && ! !in_array($prop_name, $data['props'])) { continue; } $params = array(); ! while (($param_name = array_shift($line[0])) && ! ($param_value = array_shift($line[0]))) { ! $params[$param_name] = $param_value; } ! $component->add_property($prop_name, $line[1], $params); } } --- 398,422 ---- } ! $components[] = new $className; ! end($components); ! $compValues[] = $compValues[key($compValues)]['comps'][$compName]; ! end($components); ! $compFilters[] = $compFilters[key($compFilters)]['comps'][$compName]; ! end($components); continue; } $line[0] = explode(';=', $line[0]); ! $propName = array_shift($line[0]); if (is_array($data['props']) && ! !in_array($propName, $data['props'])) { continue; } $params = array(); ! while (!empty($line[0])) { ! $params[array_shift($line[0])] = array_shift($line[0]); } ! $components[key($components)]->add_property($propName, $line[1], $params); } } |