cosmetic cleanups and annotations to match what I've committed to HEAD

This commit is contained in:
mgalgoci 2004-10-15 18:18:43 +00:00
parent 29afd4fa32
commit 99b3a59493

View File

@ -29,6 +29,7 @@
define('ROOM',8);
define('UNKNOWN',16);
/* event status */
define('NEEDS_ACTION',0);
define('ACCEPTED',1);
define('DECLINED',2);
@ -37,22 +38,16 @@
define('COMPLETED',5);
define('IN_PROCESS',6);
/*
* Class
*/
/* class */
define('PRIVATE',0);
define('PUBLIC',1);
define('CONFIDENTIAL',3);
/*
* Transparency
*/
/* transparency */
define('TRANSPARENT',0);
define('OPAQUE',1);
/*
* Frequency
*/
/* frequency */
define('SECONDLY',1);
define('MINUTELY',2);
define('HOURLY',3);
@ -602,23 +597,23 @@
'to_text' => False,
'daylight' => Array(
'state' => 'optional',
'multiples' => True
'multiples' => False
),
'standard' => Array(
'state' => 'optional',
'multiples' => True
'multiples' => False
),
'vevent' => Array(
'state' => 'optional',
'multiples' => True
'multiples' => False
),
'vtodo' => Array(
'state' => 'optional',
'multiples' => True
'multiples' => False
),
'vjournal' => Array(
'state' => 'optional',
'multiples' => True
'multiples' => False
)
),
'sequence' => Array(
@ -966,7 +961,7 @@
'dtstart' => True
)
),
'encoding' => Array( // was enocding ???
'encoding' => Array(
'type' => 'function',
'function' => 'switch_encoding',
'quoted' => False,
@ -1185,7 +1180,7 @@
'last_modified' => True,
'sequence' => True,
'x_type' => True,
'request_status' => True
'request_status'=> True
)
),
'wkst' => Array(
@ -1247,7 +1242,7 @@
'last_modified' => True,
'sequence' => True,
'x_type' => True,
'request_status' => True
'request_status'=> True
)
)
);
@ -2023,28 +2018,6 @@
}
}
}
else
{
/*
* The time provided by the iCal is considered local time.
*
* The implementor will need to consider how to convert that time to UTC.
*/
// if($this->api)
// {
// $dtime['hour'] -= $GLOBALS['phpgw_info']['users']['common']['tz_offset'];
// if($dtime['hour'] < 0)
// {
// $dtime['mday'] -= 1;
// $dtime['hour'] = 24 - $dtime['hour'];
// }
// elseif($dtime['hour'] >= 24)
// {
// $dtime['mday'] += 1;
// $dtime['hour'] = $dtime['hour'] - 24;
// }
// }
}
}
else
{
@ -2602,7 +2575,6 @@
if($majortype == 'duration')
{
// Unset dur var
unset($dur);
// Split «DURATION»
@ -2611,15 +2583,13 @@
/* Datecode */
if(isset($_f_['day_raw']) OR $_f_['day_raw'])
{
// Days
// if(ereg('D', $_f_['day_raw']))
/* Days */
if(strstr($_f_['day_raw'],'D'))
{
$dur['days'] = eregi_replace("([0-9]+)D(.*)", "\\1", $_f_['day_raw']);
}
// Weeks
// if(ereg("W", $_f_["day_raw"]))
/* Weeks */
if(strstr($_f_['day_raw'],'W'))
{
$dur['weeks'] = eregi_replace("([^|.*]+D)?([0-9]+)W", "\\2", $_f_['day_raw']);
@ -2629,24 +2599,19 @@
/* Timecode */
if(isset($_f_['time_raw']) OR $_f_['time_raw'])
{
// Hours
// if(ereg("H", $_f_["time_raw"]))
/* Hours */
if(strstr($_f_['time_raw'],'H'))
{
$dur['hours'] = eregi_replace("([0-9]+)H(.*)", "\\1", $_f_['time_raw']);
}
// Minutes
/* If you find better, contact me very quickly :) */
// if(ereg("M", $_f_["time_raw"]))
/* Minutes */
if(strstr($_f_['time_raw'],'M'))
{
$dur['minutes'] = eregi_replace("([^|.*]+H)?([0-9]+)M(.*)", "\\2", $_f_['time_raw']);
}
// Seconds
/* Same comment :) */
// if(ereg("S", $_f_["time_raw"]) )
/* Seconds */
if(strstr($_f_['time_raw'],'S'))
{
$dur['seconds'] = eregi_replace("([^|.*]+M)?([0-9]+)S(.*)", "\\2", $_f_['time_raw']);
@ -2658,7 +2623,7 @@
'datecode' => $_f_['day_raw'],
'all' => $value
);
// Add new parameters in Event
/* Add new parameters in Event */
$this->set_var($event, $majortype, $dur);
}
@ -2985,9 +2950,11 @@
$mime_msg = fread($fp, filesize($filename));
fclose($fp);
unlink($filename);
/* explode can fail easily, so pre-chew the ical file */
$mime_msg = preg_replace("/(\r\n|\r)/", "\n", $mime_msg); /* dos2unix */
$mime_msg = preg_replace("/\n\n+/", "\n", $mime_msg); /* strip duplicate newlines */
$mime_msg = explode("\n",$mime_msg); /* explode the sanitized message itself */
$mime_msg = explode("\n",$mime_msg); /* explode the sanitized message into itself */
}
elseif(!$mime_msg)
{
@ -3032,7 +2999,7 @@
's' => 'sec'
);
// time limit should be controlled elsewhere
/* time limit should be controlled elsewhere */
@set_time_limit(0);
$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->create_email_preferences();
@ -3066,7 +3033,6 @@
$this->check_owner($event,$ical['event'][$i],$so_event);
$event = $so_event->get_cached_event();
$so_event->add_entry($event);
// $event = $so_event->get_cached_event();
}
else
{
@ -3149,9 +3115,6 @@
)
);
}
// $temp_id = $cats->name2id($cat);
// echo 'Category Name : '.$cat.' : Category ID :'.$temp_id."<br>\n";
// $cat_id_nums[] = $temp_id;
$cat_id_nums[] = $cats->name2id($cat);
}
@reset($cat_id_nums);
@ -3165,10 +3128,10 @@
}
}
//rrule
if(isset($ical['event'][$i]['rrule']) OR isset($ical['event'][$i]['duration']) )
/* rrule */
if(isset($ical['event'][$i]['rrule']) || isset($ical['event'][$i]['duration']))
{
// recur_enddate
/* recur_enddate */
if(isset($ical['event'][$i]['rrule']['until']))
{
$recur_enddate['year'] = (int)($ical['event'][$i]['rrule']['until']['year']);
@ -3177,46 +3140,37 @@
}
elseif( isset($ical['event'][$i]['duration']) )
{
// Create timecode for strtotime
/* Create timecode for strtotime */
$ptimer = mktime($ical['event'][$i]['dtstart']['hour'],
$ical['event'][$i]['dtstart']['min'],
$ical['event'][$i]['dtstart']['sec'],
$ical['event'][$i]['dtstart']['month'],
$ical['event'][$i]['dtstart']['mday'],
$ical['event'][$i]['dtstart']['year']
);
$ical['event'][$i]['dtstart']['year']);
/* -- Fixbug --
* if "DURATION" has 1 day (for example).
* Event takes places between the first date
* (this define in "start" tag) and next day :(
* This "fix" destroy one day and set hours as "23" and minutes as "59"
/*
* Subtract 1 second so we don't overlap with the beginning of
* another event.
*/
// Weeks::Day--
if( $ical['event'][$i]['duration']['weeks']
AND
( $ical['event'][$i]['duration']['hours'] == 0 )
AND
( $ical['event'][$i]['duration']['minutes'] == 0 )
)
/* handle events with duration in weeks */
if ($ical['event'][$i]['duration']['weeks'] &&
($ical['event'][$i]['duration']['hours'] == 0) &&
($ical['event'][$i]['duration']['minutes'] == 0))
{
$ical['event'][$i]['duration']['days'] = (
$ical['event'][$i]['duration']['days'] +
($ical['event'][$i]['duration']['weeks']*7))-1;
$ical['event'][$i]['duration']['days'] =
($ical['event'][$i]['duration']['days'] +
($ical['event'][$i]['duration']['weeks']*7)) - 1;
unset($ical['event'][$i]['duration']['weeks']);
$ical['event'][$i]['duration']['hours'] = "23";
$ical['event'][$i]['duration']['minutes'] = "59";
$ical['event'][$i]['duration']['seconds'] = "59";
}
// Days::Day--
if(
$ical['event'][$i]['duration']['days']
AND
( $ical['event'][$i]['duration']['hours'] == 0 )
AND
( $ical['event'][$i]['duration']['minutes'] == 0 )
)
/* handle events with duration in days */
if(($ical['event'][$i]['duration']['days'] && $ical['event'][$i]['duration']['hours'] == 0) &&
($ical['event'][$i]['duration']['minutes'] == 0))
{
$ical['event'][$i]['duration']['days']--;
$ical['event'][$i]['duration']['hours'] = "23";
@ -3224,35 +3178,43 @@
$ical['event'][$i]['duration']['seconds'] = "59";
}
// Create string contains datetime for strtotime
/* Create string contains datetime for strtotime */
$pdate = "+";
if( isset($ical['event'][$i]['duration']['weeks']) )
if(isset($ical['event'][$i]['duration']['weeks']))
$pdate .= $ical['event'][$i]['duration']['weeks'] . " weeks ";
if( isset($ical['event'][$i]['duration']['days']) )
if(isset($ical['event'][$i]['duration']['days']))
$pdate .= $ical['event'][$i]['duration']['days'] . " days ";
if( isset($ical['event'][$i]['duration']['hours']) )
if(isset($ical['event'][$i]['duration']['hours']))
$pdate .= $ical['event'][$i]['duration']['hours'] . " hours ";
if( isset($ical['event'][$i]['duration']['minutes']) )
if(isset($ical['event'][$i]['duration']['minutes']))
$pdate .= $ical['event'][$i]['duration']['minutes'] . " minutes ";
if( isset($ical['event'][$i]['duration']['seconds']) )
if(isset($ical['event'][$i]['duration']['seconds']))
$pdate .= $ical['event'][$i]['duration']['seconds'] . " seconds ";
// What is datetime in 2192 ?
/* What is datetime in 2192? */
$enddate = strtotime($pdate, $ptimer);
list( $recur_enddate['year'],
list(
$recur_enddate['year'],
$recur_enddate['month'],
$recur_enddate['mday'],
$recur_enddate['hour'],
$recur_enddate['min'],
$recur_enddate['sec'] ) = split(":", date("Y:m:d:H:i:s", $enddate));
$recur_enddate['sec']
) = split(":", date("Y:m:d:H:i:s", $enddate));
// Set End of event
$so_event->set_end( $recur_enddate['year'],
/* Set End of event */
$so_event->set_end(
$recur_enddate['year'],
$recur_enddate['month'],
$recur_enddate['mday'],
$recur_enddate['hour'],
$recur_enddate['min'],
$recur_enddate['sec']);
$recur_enddate['sec']
);
}
else
@ -3262,7 +3224,7 @@
$recur_enddate['mday'] = 0;
}
// recur_data
/* recur_data */
$recur_data = 0;
if(isset($ical['event'][$i]['rrule']['byday']))
{
@ -3285,7 +3247,7 @@
}
}
// interval
/* interval */
if(!isset($ical['event'][$i]['rrule']['interval']))
{
$interval = 1;
@ -3325,7 +3287,7 @@
}
/* if the original organizer is an egroupware user, add the original user as an event participant */
/* NB: ['mailto'] has two parts, ['user'], containing the username, and ['host'], containing the fqdn of the user's email address */
/* NB: ['mailto'] has two parts, ['user'], containing the username, and ['host'], containing the domain of the user's email address */
if (isset($ical['event'][$i]['organizer']['mailto']['user']) && $GLOBALS['phpgw']->accounts->exists($ical['event'][$i]['organizer']['mailto']['user']) == True)
{
$so_event->add_attribute('participants','A',(int)$GLOBALS['phpgw']->accounts->name2id($ical['event'][$i]['organizer']['mailto']['user']));