fixing IDE warnings

This commit is contained in:
Ralf Becker 2015-01-14 13:52:34 +00:00
parent 31fe89849e
commit 83ca579700

View File

@ -7,7 +7,7 @@
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @author Christian Binder <christian-AT-jaytraxx.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
* @version $Id$
*/
@ -142,7 +142,7 @@ class calendar_so
*/
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']))
{
$minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'];
@ -152,8 +152,6 @@ class calendar_so
$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[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);
@ -350,6 +348,7 @@ class calendar_so
$types = array();
foreach((array)$users as $uid)
{
$type = $id = null;
self::split_user($uid, $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
* @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);
@ -535,7 +534,10 @@ class calendar_so
$cal_table_def = $this->db->get_table_definitions('calendar',$this->cal_table);
// only users can be owners, no need to add groups
$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));
}
}
@ -662,7 +664,7 @@ class calendar_so
'cols' => $cols,
'where' => $where,
'app' => 'calendar',
'append'=> $params['append'].' '.$group_by,
'append'=> $params['append'],
);
if ($params['enum_recuring']) // dates table join only needed to enum recuring events
{
@ -910,7 +912,7 @@ class calendar_so
'filter'=> $filter,
'query' => $query,
));
foreach(self::$integration_data as $app => $data)
foreach(self::$integration_data as $data)
{
if (is_array($data['selects']))
{
@ -950,6 +952,7 @@ class calendar_so
$return_cols = array();
foreach(is_array($required) ? $required : explode(',',$required) as $cols)
{
$matches = null;
if (substr($cols,-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
*
* @param array $event event with optional 'cal_' prefix in keys
* @param array $_event event with optional 'cal_' prefix in keys
* @param array &$alarm
* @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;
}
$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);
foreach ($rrule as $time)
{
@ -1561,6 +1564,7 @@ ORDER BY cal_user_type, cal_usre_id
$quantity = 1;
$role = 'REQ-PARTICIPANT';
//error_log(__METHOD__.__LINE__.array2string($status));
$matches = null;
if (is_string($status) && strlen($status) > 1 && preg_match('/^.([0-9]*)(.*)$/',$status,$matches))
{
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 $start
* @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 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)
{
@ -1826,6 +1830,7 @@ ORDER BY cal_user_type, cal_usre_id
$type = '';
$id = null;
self::split_user($uid,$type,$id);
$quantity = $role = null;
self::split_status($status,$quantity,$role);
$this->db->insert($this->user_table,array(
'cal_status' => $status,
@ -1934,7 +1939,7 @@ ORDER BY cal_user_type, cal_usre_id
if (!isset(self::$alarm_cache) && is_array($cal_id))
{
self::$alarm_cache = array();
if ($jobs = $this->async->read('cal:%'))
if (($jobs = $this->async->read('cal:%')))
{
foreach($jobs as $id => $job)
{
@ -1984,7 +1989,7 @@ ORDER BY cal_user_type, cal_usre_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)
{
@ -2011,9 +2016,9 @@ ORDER BY cal_user_type, cal_usre_id
{
return False;
}
list($id,$job) = each($jobs);
list($alarm_id,$job) = each($jobs);
$alarm = $job['data']; // text, enabled
$alarm['id'] = $id;
$alarm['id'] = $alarm_id;
$alarm['time'] = $job['next'];
//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());
if (($alarms = $this->read_alarms($cal_id)))
{
foreach($alarms as $id => $alarm)
foreach(array_keys($alarms) as $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 int $new_user =null
*/
function deleteaccount($old_user, $newuser=null)
function deleteaccount($old_user, $new_user=null)
{
if (is_array($old_user))
{
@ -2204,19 +2209,20 @@ ORDER BY cal_user_type, cal_usre_id
if (is_null($uid)) return $participant_status;
$user_type = $user_id = null;
self::split_user($uid, $user_type, $user_id);
$where = array(
$where2 = array(
'cal_id' => $cal_id,
'cal_user_type' => $user_type ? $user_type : 'u',
'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) $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)$start . ')';
if ($start == 0 && $end != 0) $where2[] = '(cal_recur_date = 0 OR cal_recur_date <= ' . (int)$end . ')';
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 . '))';
}
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)
{
$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)
{
static $recurrence_zero;
static $cached_id;
static $user;
static $recurrence_zero=null;
static $cached_id=null;
static $user=null;
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']];
}
$start = new egw_time($event['start'],egw_time::$server_timezone);
$start->setTimezone($timezone);
$end = new egw_time($event['end'],egw_time::$server_timezone);
$end->setTimezone($timezone);
$start_time = new egw_time($event['start'],egw_time::$server_timezone);
$start_time->setTimezone($timezone);
$end_time = new egw_time($event['end'],egw_time::$server_timezone);
$end_time->setTimezone($timezone);
//error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
// '(): ' . $start . '-' . $end);
$start = egw_time::to($start,'array');
$end = egw_time::to($end,'array');
$start = egw_time::to($start_time,'array');
$end = egw_time::to($end_time,'array');
return !$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59;