forked from extern/egroupware
fixing IDE warnings
This commit is contained in:
parent
31fe89849e
commit
83ca579700
@ -7,7 +7,7 @@
|
|||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @author Christian Binder <christian-AT-jaytraxx.de>
|
* @author Christian Binder <christian-AT-jaytraxx.de>
|
||||||
* @author Joerg Lehrke <jlehrke@noc.de>
|
* @author Joerg Lehrke <jlehrke@noc.de>
|
||||||
* @copyright (c) 2005-14 by RalfBecker-At-outdoor-training.de
|
* @copyright (c) 2005-15 by RalfBecker-At-outdoor-training.de
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@ -142,7 +142,7 @@ class calendar_so
|
|||||||
*/
|
*/
|
||||||
function read($ids,$recur_date=0)
|
function read($ids,$recur_date=0)
|
||||||
{
|
{
|
||||||
//_debug_array(__METHOD__.__LINE__.'#'.$recur_date.'#'.function_backtrace());
|
//error_log(__METHOD__.'('.array2string($ids).",$recur_date) ".function_backtrace());
|
||||||
if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length']))
|
if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length']))
|
||||||
{
|
{
|
||||||
$minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'];
|
$minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'];
|
||||||
@ -152,8 +152,6 @@ class calendar_so
|
|||||||
$minimum_uid_length = 8;
|
$minimum_uid_length = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo "<p>socal::read(".print_r($ids,true).",$recur_date)<br />\n".function_backtrace()."<p>\n";
|
|
||||||
|
|
||||||
$cols = self::get_columns('calendar', $this->cal_table);
|
$cols = self::get_columns('calendar', $this->cal_table);
|
||||||
$cols[0] = $this->db->to_varchar($this->cal_table.'.cal_id');
|
$cols[0] = $this->db->to_varchar($this->cal_table.'.cal_id');
|
||||||
$cols = "$this->repeats_table.recur_type,$this->repeats_table.recur_interval,$this->repeats_table.recur_data,".implode(',',$cols);
|
$cols = "$this->repeats_table.recur_type,$this->repeats_table.recur_interval,$this->repeats_table.recur_data,".implode(',',$cols);
|
||||||
@ -350,6 +348,7 @@ class calendar_so
|
|||||||
$types = array();
|
$types = array();
|
||||||
foreach((array)$users as $uid)
|
foreach((array)$users as $uid)
|
||||||
{
|
{
|
||||||
|
$type = $id = null;
|
||||||
self::split_user($uid, $type, $id);
|
self::split_user($uid, $type, $id);
|
||||||
$types[$type][] = $id;
|
$types[$type][] = $id;
|
||||||
}
|
}
|
||||||
@ -397,7 +396,7 @@ class calendar_so
|
|||||||
* @param string|array $cols ='cal_id,cal_reference,cal_etag,cal_modified,cal_user_modified' cols to query
|
* @param string|array $cols ='cal_id,cal_reference,cal_etag,cal_modified,cal_user_modified' cols to query
|
||||||
* @return Iterator as egw_db::select
|
* @return Iterator as egw_db::select
|
||||||
*/
|
*/
|
||||||
function get_cal_data(array $query, $cols='cal_id,cal_reference,cal_etag,cal_modified,cal_user_modified', $include_user_modified=false)
|
function get_cal_data(array $query, $cols='cal_id,cal_reference,cal_etag,cal_modified,cal_user_modified')
|
||||||
{
|
{
|
||||||
if (!is_array($cols)) $cols = explode(',', $cols);
|
if (!is_array($cols)) $cols = explode(',', $cols);
|
||||||
|
|
||||||
@ -535,7 +534,10 @@ class calendar_so
|
|||||||
$cal_table_def = $this->db->get_table_definitions('calendar',$this->cal_table);
|
$cal_table_def = $this->db->get_table_definitions('calendar',$this->cal_table);
|
||||||
// only users can be owners, no need to add groups
|
// only users can be owners, no need to add groups
|
||||||
$user_ids = array();
|
$user_ids = array();
|
||||||
foreach($ids as $user_id) if ($GLOBALS['egw']->accounts->get_type($user_id) === 'u') $user_ids[] = $user_id;
|
foreach($ids as $user_id)
|
||||||
|
{
|
||||||
|
if ($GLOBALS['egw']->accounts->get_type($user_id) === 'u') $user_ids[] = $user_id;
|
||||||
|
}
|
||||||
$owner_or = $this->db->expression($cal_table_def,array('cal_owner' => $user_ids));
|
$owner_or = $this->db->expression($cal_table_def,array('cal_owner' => $user_ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -662,7 +664,7 @@ class calendar_so
|
|||||||
'cols' => $cols,
|
'cols' => $cols,
|
||||||
'where' => $where,
|
'where' => $where,
|
||||||
'app' => 'calendar',
|
'app' => 'calendar',
|
||||||
'append'=> $params['append'].' '.$group_by,
|
'append'=> $params['append'],
|
||||||
);
|
);
|
||||||
if ($params['enum_recuring']) // dates table join only needed to enum recuring events
|
if ($params['enum_recuring']) // dates table join only needed to enum recuring events
|
||||||
{
|
{
|
||||||
@ -910,7 +912,7 @@ class calendar_so
|
|||||||
'filter'=> $filter,
|
'filter'=> $filter,
|
||||||
'query' => $query,
|
'query' => $query,
|
||||||
));
|
));
|
||||||
foreach(self::$integration_data as $app => $data)
|
foreach(self::$integration_data as $data)
|
||||||
{
|
{
|
||||||
if (is_array($data['selects']))
|
if (is_array($data['selects']))
|
||||||
{
|
{
|
||||||
@ -950,6 +952,7 @@ class calendar_so
|
|||||||
$return_cols = array();
|
$return_cols = array();
|
||||||
foreach(is_array($required) ? $required : explode(',',$required) as $cols)
|
foreach(is_array($required) ? $required : explode(',',$required) as $cols)
|
||||||
{
|
{
|
||||||
|
$matches = null;
|
||||||
if (substr($cols,-2) == '.*')
|
if (substr($cols,-2) == '.*')
|
||||||
{
|
{
|
||||||
$cols = self::get_columns($required_app,substr($cols,0,-2));
|
$cols = self::get_columns($required_app,substr($cols,0,-2));
|
||||||
@ -1413,18 +1416,18 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
/**
|
/**
|
||||||
* Shift alarm on recurring events to next future recurrence
|
* Shift alarm on recurring events to next future recurrence
|
||||||
*
|
*
|
||||||
* @param array $event event with optional 'cal_' prefix in keys
|
* @param array $_event event with optional 'cal_' prefix in keys
|
||||||
* @param array &$alarm
|
* @param array &$alarm
|
||||||
* @return boolean true if alarm could be shifted, false if not
|
* @return boolean true if alarm could be shifted, false if not
|
||||||
*/
|
*/
|
||||||
public static function shift_alarm(array $event, array &$alarm)
|
public static function shift_alarm(array $_event, array &$alarm)
|
||||||
{
|
{
|
||||||
if ($event['recur_type'] == MCAL_RECUR_NONE)
|
if ($_event['recur_type'] == MCAL_RECUR_NONE)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$start = (int)time() + $alarm['offset'];
|
$start = (int)time() + $alarm['offset'];
|
||||||
$event = egw_db::strip_array_keys($event, 'cal_');
|
$event = egw_db::strip_array_keys($_event, 'cal_');
|
||||||
$rrule = calendar_rrule::event2rrule($event, false);
|
$rrule = calendar_rrule::event2rrule($event, false);
|
||||||
foreach ($rrule as $time)
|
foreach ($rrule as $time)
|
||||||
{
|
{
|
||||||
@ -1561,6 +1564,7 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
$quantity = 1;
|
$quantity = 1;
|
||||||
$role = 'REQ-PARTICIPANT';
|
$role = 'REQ-PARTICIPANT';
|
||||||
//error_log(__METHOD__.__LINE__.array2string($status));
|
//error_log(__METHOD__.__LINE__.array2string($status));
|
||||||
|
$matches = null;
|
||||||
if (is_string($status) && strlen($status) > 1 && preg_match('/^.([0-9]*)(.*)$/',$status,$matches))
|
if (is_string($status) && strlen($status) > 1 && preg_match('/^.([0-9]*)(.*)$/',$status,$matches))
|
||||||
{
|
{
|
||||||
if ((int)$matches[1] > 0) $quantity = (int)$matches[1];
|
if ((int)$matches[1] > 0) $quantity = (int)$matches[1];
|
||||||
@ -1799,8 +1803,8 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
* @param int $cal_id
|
* @param int $cal_id
|
||||||
* @param int $start
|
* @param int $start
|
||||||
* @param int $end
|
* @param int $end
|
||||||
* @param boolean $exception=null true or false to set recure_exception flag, null leave it unchanged (new are by default no exception)
|
|
||||||
* @param array $participants uid => status pairs
|
* @param array $participants uid => status pairs
|
||||||
|
* @param boolean $exception =null true or false to set recure_exception flag, null leave it unchanged (new are by default no exception)
|
||||||
*/
|
*/
|
||||||
function recurrence($cal_id,$start,$end,$participants,$exception=null)
|
function recurrence($cal_id,$start,$end,$participants,$exception=null)
|
||||||
{
|
{
|
||||||
@ -1826,6 +1830,7 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
$type = '';
|
$type = '';
|
||||||
$id = null;
|
$id = null;
|
||||||
self::split_user($uid,$type,$id);
|
self::split_user($uid,$type,$id);
|
||||||
|
$quantity = $role = null;
|
||||||
self::split_status($status,$quantity,$role);
|
self::split_status($status,$quantity,$role);
|
||||||
$this->db->insert($this->user_table,array(
|
$this->db->insert($this->user_table,array(
|
||||||
'cal_status' => $status,
|
'cal_status' => $status,
|
||||||
@ -1934,7 +1939,7 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
if (!isset(self::$alarm_cache) && is_array($cal_id))
|
if (!isset(self::$alarm_cache) && is_array($cal_id))
|
||||||
{
|
{
|
||||||
self::$alarm_cache = array();
|
self::$alarm_cache = array();
|
||||||
if ($jobs = $this->async->read('cal:%'))
|
if (($jobs = $this->async->read('cal:%')))
|
||||||
{
|
{
|
||||||
foreach($jobs as $id => $job)
|
foreach($jobs as $id => $job)
|
||||||
{
|
{
|
||||||
@ -1984,7 +1989,7 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
|
|
||||||
private function read_alarms_nocache($cal_id)
|
private function read_alarms_nocache($cal_id)
|
||||||
{
|
{
|
||||||
if ($jobs = $this->async->read('cal:'.(int)$cal_id.':%'))
|
if (($jobs = $this->async->read('cal:'.(int)$cal_id.':%')))
|
||||||
{
|
{
|
||||||
foreach($jobs as $id => $job)
|
foreach($jobs as $id => $job)
|
||||||
{
|
{
|
||||||
@ -2011,9 +2016,9 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
{
|
{
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
list($id,$job) = each($jobs);
|
list($alarm_id,$job) = each($jobs);
|
||||||
$alarm = $job['data']; // text, enabled
|
$alarm = $job['data']; // text, enabled
|
||||||
$alarm['id'] = $id;
|
$alarm['id'] = $alarm_id;
|
||||||
$alarm['time'] = $job['next'];
|
$alarm['time'] = $job['next'];
|
||||||
|
|
||||||
//echo "<p>read_alarm('$id')="; print_r($alarm); echo "</p>\n";
|
//echo "<p>read_alarm('$id')="; print_r($alarm); echo "</p>\n";
|
||||||
@ -2076,7 +2081,7 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
//error_log(__METHOD__."($cal_id) ".function_backtrace());
|
//error_log(__METHOD__."($cal_id) ".function_backtrace());
|
||||||
if (($alarms = $this->read_alarms($cal_id)))
|
if (($alarms = $this->read_alarms($cal_id)))
|
||||||
{
|
{
|
||||||
foreach($alarms as $id => $alarm)
|
foreach(array_keys($alarms) as $id)
|
||||||
{
|
{
|
||||||
$this->async->cancel_timer($id);
|
$this->async->cancel_timer($id);
|
||||||
}
|
}
|
||||||
@ -2115,7 +2120,7 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
* @param array|int $old_user integer old user or array with keys 'account_id' and 'new_owner' as the deleteaccount hook uses it
|
* @param array|int $old_user integer old user or array with keys 'account_id' and 'new_owner' as the deleteaccount hook uses it
|
||||||
* @param int $new_user =null
|
* @param int $new_user =null
|
||||||
*/
|
*/
|
||||||
function deleteaccount($old_user, $newuser=null)
|
function deleteaccount($old_user, $new_user=null)
|
||||||
{
|
{
|
||||||
if (is_array($old_user))
|
if (is_array($old_user))
|
||||||
{
|
{
|
||||||
@ -2204,19 +2209,20 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
if (is_null($uid)) return $participant_status;
|
if (is_null($uid)) return $participant_status;
|
||||||
$user_type = $user_id = null;
|
$user_type = $user_id = null;
|
||||||
self::split_user($uid, $user_type, $user_id);
|
self::split_user($uid, $user_type, $user_id);
|
||||||
$where = array(
|
|
||||||
|
$where2 = array(
|
||||||
'cal_id' => $cal_id,
|
'cal_id' => $cal_id,
|
||||||
'cal_user_type' => $user_type ? $user_type : 'u',
|
'cal_user_type' => $user_type ? $user_type : 'u',
|
||||||
'cal_user_id' => $user_id,
|
'cal_user_id' => $user_id,
|
||||||
);
|
);
|
||||||
if ($start != 0 && $end == 0) $where[] = '(cal_recur_date = 0 OR cal_recur_date >= ' . (int)$start . ')';
|
if ($start != 0 && $end == 0) $where2[] = '(cal_recur_date = 0 OR cal_recur_date >= ' . (int)$start . ')';
|
||||||
if ($start == 0 && $end != 0) $where[] = '(cal_recur_date = 0 OR cal_recur_date <= ' . (int)$end . ')';
|
if ($start == 0 && $end != 0) $where2[] = '(cal_recur_date = 0 OR cal_recur_date <= ' . (int)$end . ')';
|
||||||
if ($start != 0 && $end != 0)
|
if ($start != 0 && $end != 0)
|
||||||
{
|
{
|
||||||
$where[] = '(cal_recur_date = 0 OR (cal_recur_date >= ' . (int)$start .
|
$where2[] = '(cal_recur_date = 0 OR (cal_recur_date >= ' . (int)$start .
|
||||||
' AND cal_recur_date <= ' . (int)$end . '))';
|
' AND cal_recur_date <= ' . (int)$end . '))';
|
||||||
}
|
}
|
||||||
foreach ($this->db->select($this->user_table,'cal_recur_date,cal_status,cal_quantity,cal_role',$where,
|
foreach ($this->db->select($this->user_table,'cal_recur_date,cal_status,cal_quantity,cal_role',$where2,
|
||||||
__LINE__,__FILE__,false,'','calendar') as $row)
|
__LINE__,__FILE__,false,'','calendar') as $row)
|
||||||
{
|
{
|
||||||
$status = self::combine_status($row['cal_status'],$row['cal_quantity'],$row['cal_role']);
|
$status = self::combine_status($row['cal_status'],$row['cal_quantity'],$row['cal_role']);
|
||||||
@ -2456,9 +2462,9 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
*/
|
*/
|
||||||
function status_pseudo_exception($cal_id, $recur_date, $filter)
|
function status_pseudo_exception($cal_id, $recur_date, $filter)
|
||||||
{
|
{
|
||||||
static $recurrence_zero;
|
static $recurrence_zero=null;
|
||||||
static $cached_id;
|
static $cached_id=null;
|
||||||
static $user;
|
static $user=null;
|
||||||
|
|
||||||
if (!isset($cached_id) || $cached_id != $cal_id)
|
if (!isset($cached_id) || $cached_id != $cal_id)
|
||||||
{
|
{
|
||||||
@ -2587,14 +2593,14 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
}
|
}
|
||||||
$timezone = self::$tz_cache[$event['tzid']];
|
$timezone = self::$tz_cache[$event['tzid']];
|
||||||
}
|
}
|
||||||
$start = new egw_time($event['start'],egw_time::$server_timezone);
|
$start_time = new egw_time($event['start'],egw_time::$server_timezone);
|
||||||
$start->setTimezone($timezone);
|
$start_time->setTimezone($timezone);
|
||||||
$end = new egw_time($event['end'],egw_time::$server_timezone);
|
$end_time = new egw_time($event['end'],egw_time::$server_timezone);
|
||||||
$end->setTimezone($timezone);
|
$end_time->setTimezone($timezone);
|
||||||
//error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
//error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
||||||
// '(): ' . $start . '-' . $end);
|
// '(): ' . $start . '-' . $end);
|
||||||
$start = egw_time::to($start,'array');
|
$start = egw_time::to($start_time,'array');
|
||||||
$end = egw_time::to($end,'array');
|
$end = egw_time::to($end_time,'array');
|
||||||
|
|
||||||
|
|
||||||
return !$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59;
|
return !$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59;
|
||||||
|
Loading…
Reference in New Issue
Block a user