From: <par...@us...> - 2009-05-27 16:07:07
|
Update of /cvsroot/phpicalendar/phpicalendar/functions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10000/functions Modified Files: ical_parser.php Log Message: Handle attendee/organizer parsing better Index: ical_parser.php =================================================================== RCS file: /cvsroot/phpicalendar/phpicalendar/functions/ical_parser.php,v retrieving revision 1.248 retrieving revision 1.249 diff -C2 -d -r1.248 -r1.249 *** ical_parser.php 20 May 2009 17:59:12 -0000 1.248 --- ical_parser.php 27 May 2009 16:06:58 -0000 1.249 *************** *** 426,438 **** break; case 'ATTENDEE': ! $attendee[] = array ('name' => ereg_replace(".*;CN=([^;]*).*", "\\1", $field), ! 'email' => str_replace ("mailto:", "", $data), ! 'RSVP' => ereg_replace(".*;RSVP=([^;]*).*", "\\1", $field), ! 'PARTSTAT' => ereg_replace(".*;PARTSTAT=([^;]*).*", "\\1", $field), ! 'ROLE' => ereg_replace(".*;ROLE=([^;]*).*", "\\1", $field)); break; case 'ORGANIZER': ! $field = ereg_replace(".*;CN=([^;]*).*", "\\1", $field); ! $data = str_replace ("mailto:", "", $data); $organizer[] = array ('name' => stripslashes($field), 'email' => stripslashes($data)); break; --- 426,451 ---- break; case 'ATTENDEE': ! $name = preg_match("/CN=([^;]*)/i", $field, $matches1); ! $email = str_replace("mailto:", "", $data); ! $rsvp = preg_match("/RSVP=([^;]*)/i", $field, $matches2); ! $partstat = preg_match("/PARTSTAT=([^;]*)/i", $field, $matches3); ! $role = preg_match("/ROLE=([^;]*)/i", $field, $matches4); ! ! $name = ($name ? $matches1[1] : $email); ! $rsvp = ($rsvp ? $matches2[1] : ''); ! $partstat = ($partstat ? $matches3[1] : ''); ! $role = ($role ? $matches4[1] : ''); ! ! $attendee[] = array ('name' => stripslashes($name), ! 'email' => stripslashes($email), ! 'RSVP' => stripslashes($rsvp), ! 'PARTSTAT' => stripslashes($partstat), ! 'ROLE' => stripslashes($role) ! ); break; case 'ORGANIZER': ! $data = str_replace ("mailto:", "", $data); ! $field = preg_match("/CN=([^;]*)/i", $field, $matches); ! $field = ($field ? $matches[1] : $data); $organizer[] = array ('name' => stripslashes($field), 'email' => stripslashes($data)); break; |