mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-15 18:00:15 +01:00
cosmetic cleanups and annotations to match what I've committed to HEAD
This commit is contained in:
parent
29afd4fa32
commit
99b3a59493
@ -29,6 +29,7 @@
|
|||||||
define('ROOM',8);
|
define('ROOM',8);
|
||||||
define('UNKNOWN',16);
|
define('UNKNOWN',16);
|
||||||
|
|
||||||
|
/* event status */
|
||||||
define('NEEDS_ACTION',0);
|
define('NEEDS_ACTION',0);
|
||||||
define('ACCEPTED',1);
|
define('ACCEPTED',1);
|
||||||
define('DECLINED',2);
|
define('DECLINED',2);
|
||||||
@ -37,22 +38,16 @@
|
|||||||
define('COMPLETED',5);
|
define('COMPLETED',5);
|
||||||
define('IN_PROCESS',6);
|
define('IN_PROCESS',6);
|
||||||
|
|
||||||
/*
|
/* class */
|
||||||
* Class
|
|
||||||
*/
|
|
||||||
define('PRIVATE',0);
|
define('PRIVATE',0);
|
||||||
define('PUBLIC',1);
|
define('PUBLIC',1);
|
||||||
define('CONFIDENTIAL',3);
|
define('CONFIDENTIAL',3);
|
||||||
|
|
||||||
/*
|
/* transparency */
|
||||||
* Transparency
|
|
||||||
*/
|
|
||||||
define('TRANSPARENT',0);
|
define('TRANSPARENT',0);
|
||||||
define('OPAQUE',1);
|
define('OPAQUE',1);
|
||||||
|
|
||||||
/*
|
/* frequency */
|
||||||
* Frequency
|
|
||||||
*/
|
|
||||||
define('SECONDLY',1);
|
define('SECONDLY',1);
|
||||||
define('MINUTELY',2);
|
define('MINUTELY',2);
|
||||||
define('HOURLY',3);
|
define('HOURLY',3);
|
||||||
@ -602,23 +597,23 @@
|
|||||||
'to_text' => False,
|
'to_text' => False,
|
||||||
'daylight' => Array(
|
'daylight' => Array(
|
||||||
'state' => 'optional',
|
'state' => 'optional',
|
||||||
'multiples' => True
|
'multiples' => False
|
||||||
),
|
),
|
||||||
'standard' => Array(
|
'standard' => Array(
|
||||||
'state' => 'optional',
|
'state' => 'optional',
|
||||||
'multiples' => True
|
'multiples' => False
|
||||||
),
|
),
|
||||||
'vevent' => Array(
|
'vevent' => Array(
|
||||||
'state' => 'optional',
|
'state' => 'optional',
|
||||||
'multiples' => True
|
'multiples' => False
|
||||||
),
|
),
|
||||||
'vtodo' => Array(
|
'vtodo' => Array(
|
||||||
'state' => 'optional',
|
'state' => 'optional',
|
||||||
'multiples' => True
|
'multiples' => False
|
||||||
),
|
),
|
||||||
'vjournal' => Array(
|
'vjournal' => Array(
|
||||||
'state' => 'optional',
|
'state' => 'optional',
|
||||||
'multiples' => True
|
'multiples' => False
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'sequence' => Array(
|
'sequence' => Array(
|
||||||
@ -966,7 +961,7 @@
|
|||||||
'dtstart' => True
|
'dtstart' => True
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'encoding' => Array( // was enocding ???
|
'encoding' => Array(
|
||||||
'type' => 'function',
|
'type' => 'function',
|
||||||
'function' => 'switch_encoding',
|
'function' => 'switch_encoding',
|
||||||
'quoted' => False,
|
'quoted' => False,
|
||||||
@ -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
|
else
|
||||||
{
|
{
|
||||||
@ -2602,7 +2575,6 @@
|
|||||||
|
|
||||||
if($majortype == 'duration')
|
if($majortype == 'duration')
|
||||||
{
|
{
|
||||||
// Unset dur var
|
|
||||||
unset($dur);
|
unset($dur);
|
||||||
|
|
||||||
// Split «DURATION»
|
// Split «DURATION»
|
||||||
@ -2611,15 +2583,13 @@
|
|||||||
/* Datecode */
|
/* Datecode */
|
||||||
if(isset($_f_['day_raw']) OR $_f_['day_raw'])
|
if(isset($_f_['day_raw']) OR $_f_['day_raw'])
|
||||||
{
|
{
|
||||||
// Days
|
/* Days */
|
||||||
// if(ereg('D', $_f_['day_raw']))
|
|
||||||
if(strstr($_f_['day_raw'],'D'))
|
if(strstr($_f_['day_raw'],'D'))
|
||||||
{
|
{
|
||||||
$dur['days'] = eregi_replace("([0-9]+)D(.*)", "\\1", $_f_['day_raw']);
|
$dur['days'] = eregi_replace("([0-9]+)D(.*)", "\\1", $_f_['day_raw']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Weeks
|
/* Weeks */
|
||||||
// if(ereg("W", $_f_["day_raw"]))
|
|
||||||
if(strstr($_f_['day_raw'],'W'))
|
if(strstr($_f_['day_raw'],'W'))
|
||||||
{
|
{
|
||||||
$dur['weeks'] = eregi_replace("([^|.*]+D)?([0-9]+)W", "\\2", $_f_['day_raw']);
|
$dur['weeks'] = eregi_replace("([^|.*]+D)?([0-9]+)W", "\\2", $_f_['day_raw']);
|
||||||
@ -2629,24 +2599,19 @@
|
|||||||
/* Timecode */
|
/* Timecode */
|
||||||
if(isset($_f_['time_raw']) OR $_f_['time_raw'])
|
if(isset($_f_['time_raw']) OR $_f_['time_raw'])
|
||||||
{
|
{
|
||||||
// Hours
|
/* Hours */
|
||||||
// if(ereg("H", $_f_["time_raw"]))
|
|
||||||
if(strstr($_f_['time_raw'],'H'))
|
if(strstr($_f_['time_raw'],'H'))
|
||||||
{
|
{
|
||||||
$dur['hours'] = eregi_replace("([0-9]+)H(.*)", "\\1", $_f_['time_raw']);
|
$dur['hours'] = eregi_replace("([0-9]+)H(.*)", "\\1", $_f_['time_raw']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minutes
|
/* Minutes */
|
||||||
/* If you find better, contact me very quickly :) */
|
|
||||||
// if(ereg("M", $_f_["time_raw"]))
|
|
||||||
if(strstr($_f_['time_raw'],'M'))
|
if(strstr($_f_['time_raw'],'M'))
|
||||||
{
|
{
|
||||||
$dur['minutes'] = eregi_replace("([^|.*]+H)?([0-9]+)M(.*)", "\\2", $_f_['time_raw']);
|
$dur['minutes'] = eregi_replace("([^|.*]+H)?([0-9]+)M(.*)", "\\2", $_f_['time_raw']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seconds
|
/* Seconds */
|
||||||
/* Same comment :) */
|
|
||||||
// if(ereg("S", $_f_["time_raw"]) )
|
|
||||||
if(strstr($_f_['time_raw'],'S'))
|
if(strstr($_f_['time_raw'],'S'))
|
||||||
{
|
{
|
||||||
$dur['seconds'] = eregi_replace("([^|.*]+M)?([0-9]+)S(.*)", "\\2", $_f_['time_raw']);
|
$dur['seconds'] = eregi_replace("([^|.*]+M)?([0-9]+)S(.*)", "\\2", $_f_['time_raw']);
|
||||||
@ -2658,7 +2623,7 @@
|
|||||||
'datecode' => $_f_['day_raw'],
|
'datecode' => $_f_['day_raw'],
|
||||||
'all' => $value
|
'all' => $value
|
||||||
);
|
);
|
||||||
// Add new parameters in Event
|
/* Add new parameters in Event */
|
||||||
$this->set_var($event, $majortype, $dur);
|
$this->set_var($event, $majortype, $dur);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2985,9 +2950,11 @@
|
|||||||
$mime_msg = fread($fp, filesize($filename));
|
$mime_msg = fread($fp, filesize($filename));
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
unlink($filename);
|
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("/(\r\n|\r)/", "\n", $mime_msg); /* dos2unix */
|
||||||
$mime_msg = preg_replace("/\n\n+/", "\n", $mime_msg); /* strip duplicate newlines */
|
$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)
|
elseif(!$mime_msg)
|
||||||
{
|
{
|
||||||
@ -3032,7 +2999,7 @@
|
|||||||
's' => 'sec'
|
's' => 'sec'
|
||||||
);
|
);
|
||||||
|
|
||||||
// time limit should be controlled elsewhere
|
/* time limit should be controlled elsewhere */
|
||||||
@set_time_limit(0);
|
@set_time_limit(0);
|
||||||
|
|
||||||
$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->create_email_preferences();
|
$GLOBALS['phpgw_info']['user']['preferences'] = $GLOBALS['phpgw']->preferences->create_email_preferences();
|
||||||
@ -3066,7 +3033,6 @@
|
|||||||
$this->check_owner($event,$ical['event'][$i],$so_event);
|
$this->check_owner($event,$ical['event'][$i],$so_event);
|
||||||
$event = $so_event->get_cached_event();
|
$event = $so_event->get_cached_event();
|
||||||
$so_event->add_entry($event);
|
$so_event->add_entry($event);
|
||||||
// $event = $so_event->get_cached_event();
|
|
||||||
}
|
}
|
||||||
else
|
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);
|
$cat_id_nums[] = $cats->name2id($cat);
|
||||||
}
|
}
|
||||||
@reset($cat_id_nums);
|
@reset($cat_id_nums);
|
||||||
@ -3165,10 +3128,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//rrule
|
/* rrule */
|
||||||
if(isset($ical['event'][$i]['rrule']) OR isset($ical['event'][$i]['duration']) )
|
if(isset($ical['event'][$i]['rrule']) || isset($ical['event'][$i]['duration']))
|
||||||
{
|
{
|
||||||
// recur_enddate
|
/* recur_enddate */
|
||||||
if(isset($ical['event'][$i]['rrule']['until']))
|
if(isset($ical['event'][$i]['rrule']['until']))
|
||||||
{
|
{
|
||||||
$recur_enddate['year'] = (int)($ical['event'][$i]['rrule']['until']['year']);
|
$recur_enddate['year'] = (int)($ical['event'][$i]['rrule']['until']['year']);
|
||||||
@ -3177,46 +3140,37 @@
|
|||||||
}
|
}
|
||||||
elseif( isset($ical['event'][$i]['duration']) )
|
elseif( isset($ical['event'][$i]['duration']) )
|
||||||
{
|
{
|
||||||
// Create timecode for strtotime
|
/* Create timecode for strtotime */
|
||||||
$ptimer = mktime($ical['event'][$i]['dtstart']['hour'],
|
$ptimer = mktime($ical['event'][$i]['dtstart']['hour'],
|
||||||
$ical['event'][$i]['dtstart']['min'],
|
$ical['event'][$i]['dtstart']['min'],
|
||||||
$ical['event'][$i]['dtstart']['sec'],
|
$ical['event'][$i]['dtstart']['sec'],
|
||||||
$ical['event'][$i]['dtstart']['month'],
|
$ical['event'][$i]['dtstart']['month'],
|
||||||
$ical['event'][$i]['dtstart']['mday'],
|
$ical['event'][$i]['dtstart']['mday'],
|
||||||
$ical['event'][$i]['dtstart']['year']
|
$ical['event'][$i]['dtstart']['year']);
|
||||||
);
|
|
||||||
|
|
||||||
/* -- Fixbug --
|
/*
|
||||||
* if "DURATION" has 1 day (for example).
|
* Subtract 1 second so we don't overlap with the beginning of
|
||||||
* Event takes places between the first date
|
* another event.
|
||||||
* (this define in "start" tag) and next day :(
|
|
||||||
* This "fix" destroy one day and set hours as "23" and minutes as "59"
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Weeks::Day--
|
/* handle events with duration in weeks */
|
||||||
if( $ical['event'][$i]['duration']['weeks']
|
if ($ical['event'][$i]['duration']['weeks'] &&
|
||||||
AND
|
($ical['event'][$i]['duration']['hours'] == 0) &&
|
||||||
( $ical['event'][$i]['duration']['hours'] == 0 )
|
($ical['event'][$i]['duration']['minutes'] == 0))
|
||||||
AND
|
|
||||||
( $ical['event'][$i]['duration']['minutes'] == 0 )
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$ical['event'][$i]['duration']['days'] = (
|
$ical['event'][$i]['duration']['days'] =
|
||||||
$ical['event'][$i]['duration']['days'] +
|
($ical['event'][$i]['duration']['days'] +
|
||||||
($ical['event'][$i]['duration']['weeks']*7)) - 1;
|
($ical['event'][$i]['duration']['weeks']*7)) - 1;
|
||||||
|
|
||||||
unset($ical['event'][$i]['duration']['weeks']);
|
unset($ical['event'][$i]['duration']['weeks']);
|
||||||
|
|
||||||
$ical['event'][$i]['duration']['hours'] = "23";
|
$ical['event'][$i]['duration']['hours'] = "23";
|
||||||
$ical['event'][$i]['duration']['minutes'] = "59";
|
$ical['event'][$i]['duration']['minutes'] = "59";
|
||||||
$ical['event'][$i]['duration']['seconds'] = "59";
|
$ical['event'][$i]['duration']['seconds'] = "59";
|
||||||
}
|
}
|
||||||
// Days::Day--
|
/* handle events with duration in days */
|
||||||
if(
|
if(($ical['event'][$i]['duration']['days'] && $ical['event'][$i]['duration']['hours'] == 0) &&
|
||||||
$ical['event'][$i]['duration']['days']
|
($ical['event'][$i]['duration']['minutes'] == 0))
|
||||||
AND
|
|
||||||
( $ical['event'][$i]['duration']['hours'] == 0 )
|
|
||||||
AND
|
|
||||||
( $ical['event'][$i]['duration']['minutes'] == 0 )
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
$ical['event'][$i]['duration']['days']--;
|
$ical['event'][$i]['duration']['days']--;
|
||||||
$ical['event'][$i]['duration']['hours'] = "23";
|
$ical['event'][$i]['duration']['hours'] = "23";
|
||||||
@ -3224,35 +3178,43 @@
|
|||||||
$ical['event'][$i]['duration']['seconds'] = "59";
|
$ical['event'][$i]['duration']['seconds'] = "59";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create string contains datetime for strtotime
|
/* Create string contains datetime for strtotime */
|
||||||
$pdate = "+";
|
$pdate = "+";
|
||||||
if(isset($ical['event'][$i]['duration']['weeks']))
|
if(isset($ical['event'][$i]['duration']['weeks']))
|
||||||
$pdate .= $ical['event'][$i]['duration']['weeks'] . " 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 ";
|
$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 ";
|
$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 ";
|
$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 ";
|
$pdate .= $ical['event'][$i]['duration']['seconds'] . " seconds ";
|
||||||
|
|
||||||
// What is datetime in 2192 ?
|
/* What is datetime in 2192? */
|
||||||
$enddate = strtotime($pdate, $ptimer);
|
$enddate = strtotime($pdate, $ptimer);
|
||||||
list( $recur_enddate['year'],
|
list(
|
||||||
|
$recur_enddate['year'],
|
||||||
$recur_enddate['month'],
|
$recur_enddate['month'],
|
||||||
$recur_enddate['mday'],
|
$recur_enddate['mday'],
|
||||||
$recur_enddate['hour'],
|
$recur_enddate['hour'],
|
||||||
$recur_enddate['min'],
|
$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
|
/* Set End of event */
|
||||||
$so_event->set_end( $recur_enddate['year'],
|
$so_event->set_end(
|
||||||
|
$recur_enddate['year'],
|
||||||
$recur_enddate['month'],
|
$recur_enddate['month'],
|
||||||
$recur_enddate['mday'],
|
$recur_enddate['mday'],
|
||||||
$recur_enddate['hour'],
|
$recur_enddate['hour'],
|
||||||
$recur_enddate['min'],
|
$recur_enddate['min'],
|
||||||
$recur_enddate['sec']);
|
$recur_enddate['sec']
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3262,7 +3224,7 @@
|
|||||||
$recur_enddate['mday'] = 0;
|
$recur_enddate['mday'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// recur_data
|
/* recur_data */
|
||||||
$recur_data = 0;
|
$recur_data = 0;
|
||||||
if(isset($ical['event'][$i]['rrule']['byday']))
|
if(isset($ical['event'][$i]['rrule']['byday']))
|
||||||
{
|
{
|
||||||
@ -3285,7 +3247,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// interval
|
/* interval */
|
||||||
if(!isset($ical['event'][$i]['rrule']['interval']))
|
if(!isset($ical['event'][$i]['rrule']['interval']))
|
||||||
{
|
{
|
||||||
$interval = 1;
|
$interval = 1;
|
||||||
@ -3325,7 +3287,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if the original organizer is an egroupware user, add the original user as an event participant */
|
/* 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)
|
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']));
|
$so_event->add_attribute('participants','A',(int)$GLOBALS['phpgw']->accounts->name2id($ical['event'][$i]['organizer']['mailto']['user']));
|
||||||
|
Loading…
Reference in New Issue
Block a user