mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
another big chunk of PHP Warnings
This commit is contained in:
parent
5524c1fa15
commit
83a2729cf0
@ -399,7 +399,7 @@ class addressbook_hooks
|
||||
{
|
||||
// Add users / groups this contact is shared with
|
||||
$entry['shared_with'] = [];
|
||||
foreach((array)$entry['shared'] as $id => $share)
|
||||
foreach($entry['shared'] ?? [] as $share)
|
||||
{
|
||||
$entry['shared_with'][] = $share['shared_with'];
|
||||
}
|
||||
@ -412,7 +412,7 @@ class addressbook_hooks
|
||||
/**
|
||||
* Hook called to retrieve a app specific exportLimit
|
||||
*
|
||||
* @param array/string $location location and other parameters (not used)
|
||||
* @param array|string $location location and other parameters (not used)
|
||||
* @return the export_limit to be applied for the app, may be empty, int or string
|
||||
*/
|
||||
static function getAppExportLimit($location)
|
||||
|
@ -811,16 +811,16 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
|
||||
foreach($contacts as $contact)
|
||||
{
|
||||
//$item[SYNC_GAL_ALIAS] = $contact['contact_id'];
|
||||
$item[SYNC_GAL_LASTNAME] = $contact['n_family']?$contact['n_family']:$contact['org_name'];
|
||||
$item[SYNC_GAL_LASTNAME] = $contact['n_family'] ?? $contact['org_name'];
|
||||
$item[SYNC_GAL_FIRSTNAME] = $contact['n_given'];
|
||||
$item[SYNC_GAL_DISPLAYNAME] = $contact['n_fn'];
|
||||
if (!trim($item[SYNC_GAL_DISPLAYNAME])) $item[SYNC_GAL_DISPLAYNAME] = $contact['n_family']?$contact['n_family']:$contact['org_name'];
|
||||
$item[SYNC_GAL_EMAILADDRESS] = $contact['email'] ? $contact['email'] : (string)$contact['email_private'] ;
|
||||
if (!trim($item[SYNC_GAL_DISPLAYNAME])) $item[SYNC_GAL_DISPLAYNAME] = $contact['n_family'] ?: $contact['org_name'];
|
||||
$item[SYNC_GAL_EMAILADDRESS] = $contact['email'] ?? $contact['email_private'] ?? '';
|
||||
//$item['nameid'] = $searchquery;
|
||||
$item[SYNC_GAL_PHONE] = (string)$contact['tel_work'];
|
||||
$item[SYNC_GAL_HOMEPHONE] = (string)$contact['tel_home'];
|
||||
$item[SYNC_GAL_MOBILEPHONE] = (string)$contact['tel_cell'];
|
||||
$item[SYNC_GAL_COMPANY] = (string)$contact['org_name'];
|
||||
$item[SYNC_GAL_PHONE] = $contact['tel_work'] ?? '';
|
||||
$item[SYNC_GAL_HOMEPHONE] = $contact['tel_home'] ?? '';
|
||||
$item[SYNC_GAL_MOBILEPHONE] = $contact['tel_cell'] ?? '';
|
||||
$item[SYNC_GAL_COMPANY] = $contact['org_name'] ?? '';
|
||||
$item[SYNC_GAL_OFFICE] = $contact['room'];
|
||||
$item[SYNC_GAL_TITLE ] = $contact['title'];
|
||||
|
||||
|
@ -600,7 +600,7 @@ class Auth
|
||||
foreach(self::$crypt_params as $type => $params)
|
||||
{
|
||||
list(,$prefix, $random, $postfix) = $params;
|
||||
list(,$d) = explode('$', $prefix);
|
||||
list(,$d) = explode('$', $prefix)+[null,null];
|
||||
if ($dollar === $d || !$dollar && ($first[0] === $prefix[0] || $first[0] !== '_' && !$prefix))
|
||||
{
|
||||
$len = !$postfix ? strlen($prefix)+$random : strlen($prefix.$salt.$postfix);
|
||||
|
@ -91,7 +91,7 @@ class Ads implements Backend
|
||||
|
||||
if ($allValues && $allValues['count'] > 0)
|
||||
{
|
||||
if($GLOBALS['egw_info']['server']['case_sensitive_username'] == true)
|
||||
if(!empty($GLOBALS['egw_info']['server']['case_sensitive_username']))
|
||||
{
|
||||
if($allValues[0]['samaccountname'][0] != $username)
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ class Sql implements Backend
|
||||
$type != $this->type && in_array($type, explode(',',strtolower($GLOBALS['egw_info']['server']['pwd_migration_types']))))
|
||||
{
|
||||
// do we have to migrate an old password ?
|
||||
if($GLOBALS['egw_info']['server']['pwd_migration_allowed'] && !empty($GLOBALS['egw_info']['server']['pwd_migration_types']))
|
||||
if (!empty($GLOBALS['egw_info']['server']['pwd_migration_allowed']) && !empty($GLOBALS['egw_info']['server']['pwd_migration_types']))
|
||||
{
|
||||
if (!$match)
|
||||
{
|
||||
|
@ -923,7 +923,7 @@ class Categories
|
||||
{
|
||||
return !empty($cat['data']) ? json_php_unserialize($cat['data'], true) : array();
|
||||
}
|
||||
elseif ($cat[$item])
|
||||
elseif (!empty($cat[$item]))
|
||||
{
|
||||
return $cat[$item];
|
||||
}
|
||||
|
@ -450,7 +450,7 @@ class Contacts extends Contacts\Storage
|
||||
*/
|
||||
function fileas($contact,$type=null, $isUpdate=false)
|
||||
{
|
||||
if (is_null($type)) $type = $contact['fileas_type'];
|
||||
if (is_null($type)) $type = $contact['fileas_type'] ?? null;
|
||||
if (!$type) $type = $this->prefs['fileas_default'] ? $this->prefs['fileas_default'] : $this->fileas_types[0];
|
||||
|
||||
if (strpos($type,'n_fn') !== false) $contact['n_fn'] = $this->fullname($contact);
|
||||
@ -909,7 +909,7 @@ class Contacts extends Contacts\Storage
|
||||
if (!array_key_exists('photo_unchanged',$contact)) $contact['photo_unchanged'] = true;
|
||||
|
||||
// remember if we add or update a entry
|
||||
if (($isUpdate = $contact['id']))
|
||||
if (($isUpdate = $contact['id'] ?? null))
|
||||
{
|
||||
if (!isset($contact['owner']) || !isset($contact['private'])) // owner/private not set on update, eg. SyncML
|
||||
{
|
||||
@ -942,10 +942,10 @@ class Contacts extends Contacts\Storage
|
||||
$contact['owner'] = $this->default_addressbook ? $this->default_addressbook : $this->user;
|
||||
}
|
||||
// allow admins to import contacts with creator / created date set
|
||||
if (!$contact['creator'] || !$ignore_acl && !$this->is_admin($contact)) $contact['creator'] = $this->user;
|
||||
if (!$contact['created'] || !$ignore_acl && !$this->is_admin($contact)) $contact['created'] = $this->now_su;
|
||||
if (empty($contact['creator']) || !$ignore_acl && !$this->is_admin($contact)) $contact['creator'] = $this->user;
|
||||
if (empty($contact['created']) || !$ignore_acl && !$this->is_admin($contact)) $contact['created'] = $this->now_su;
|
||||
|
||||
if (!$contact['tid']) $contact['tid'] = 'n';
|
||||
if (empty($contact['tid'])) $contact['tid'] = 'n';
|
||||
$update_type = "add";
|
||||
}
|
||||
// ensure accounts and group addressbooks are never private!
|
||||
@ -964,9 +964,9 @@ class Contacts extends Contacts\Storage
|
||||
$contact['jpegphoto'] = $this->resize_photo($contact['jpegphoto']);
|
||||
}
|
||||
// convert categories
|
||||
if (is_array($contact['cat_id']))
|
||||
if (isset($contact['cat_id']) && is_array($contact['cat_id']))
|
||||
{
|
||||
$contact['cat_id'] = implode(',',$contact['cat_id']);
|
||||
$contact['cat_id'] = implode(',',$contact['cat_id']) ?: null;
|
||||
}
|
||||
|
||||
// Update country codes
|
||||
@ -983,7 +983,7 @@ class Contacts extends Contacts\Storage
|
||||
$contact[$c_prefix.'countrycode'] = null;
|
||||
}
|
||||
}
|
||||
if($contact[$c_prefix.'countrycode'] != null)
|
||||
if(isset($contact[$c_prefix.'countrycode']))
|
||||
{
|
||||
$contact[$c_prefix.'countryname'] = null;
|
||||
}
|
||||
@ -1030,7 +1030,7 @@ class Contacts extends Contacts\Storage
|
||||
|
||||
// IF THE OLD ENTRY IS A ACCOUNT, dont allow to change the owner/location
|
||||
// maybe we need that for id and account_id as well.
|
||||
if (is_array($old) && (!isset($old['owner']) || empty($old['owner'])))
|
||||
if (isset($old) && is_array($old) && (!isset($old['owner']) || empty($old['owner'])))
|
||||
{
|
||||
if (isset($to_write['owner']) && !empty($to_write['owner']))
|
||||
{
|
||||
@ -1057,7 +1057,7 @@ class Contacts extends Contacts\Storage
|
||||
}
|
||||
|
||||
// if contact is an account and account-relevant data got updated, handle it like account got updated
|
||||
if ($contact['account_id'] && $isUpdate &&
|
||||
if (!empty($contact['account_id']) && $isUpdate &&
|
||||
($old['email'] != $contact['email'] || $old['n_family'] != $contact['n_family'] || $old['n_given'] != $contact['n_given']))
|
||||
{
|
||||
// invalidate the cache of the accounts class
|
||||
@ -1076,17 +1076,17 @@ class Contacts extends Contacts\Storage
|
||||
}
|
||||
|
||||
// Check for restore of deleted contact, restore held links
|
||||
if($old && $old['tid'] == self::DELETED_TYPE && $contact['tid'] != self::DELETED_TYPE)
|
||||
if(isset($old) && $old['tid'] == self::DELETED_TYPE && $contact['tid'] != self::DELETED_TYPE)
|
||||
{
|
||||
Link::restore('addressbook', $contact['id']);
|
||||
}
|
||||
|
||||
// Record change history for sql - doesn't work for LDAP accounts
|
||||
$deleted = ($old['tid'] == self::DELETED_TYPE || $contact['tid'] == self::DELETED_TYPE);
|
||||
if(!$contact['account_id'] || $contact['account_id'] && $this->account_repository == 'sql')
|
||||
$deleted = (isset($old) && $old['tid'] == self::DELETED_TYPE || $contact['tid'] == self::DELETED_TYPE);
|
||||
if(empty($contact['account_id']) || $contact['account_id'] && $this->account_repository == 'sql')
|
||||
{
|
||||
if (!isset($this->tracking)) $this->tracking = new Contacts\Tracking($this);
|
||||
$this->tracking->track($to_write, $old ? $old : null, null, $deleted);
|
||||
$this->tracking->track($to_write, $old ?? null, null, $deleted);
|
||||
}
|
||||
|
||||
// Notify linked apps about changes in the contact data
|
||||
@ -1264,7 +1264,7 @@ class Contacts extends Contacts\Storage
|
||||
{
|
||||
$access = !!array_intersect($memberships,$GLOBALS['egw']->accounts->memberships($contact['account_id'],true));
|
||||
}
|
||||
else if ($contact['id'] && $GLOBALS['egw']->acl->check('A'.$contact['id'], $needed, 'addressbook'))
|
||||
elseif (!empty($contact['id']) && $GLOBALS['egw']->acl->check('A'.$contact['id'], $needed, 'addressbook'))
|
||||
{
|
||||
$access = true;
|
||||
}
|
||||
@ -2908,7 +2908,7 @@ class Contacts extends Contacts\Storage
|
||||
$phoneNumberUtil->format($number, \libphonenumber\PhoneNumberFormat::INTERNATIONAL), 3);
|
||||
$rest_without_space = preg_replace('/[^0-9]/', '', $rest);
|
||||
/** @var Contacts\Sql */
|
||||
$backend = $this->get_backend(null, $filter['owner']);
|
||||
$backend = $this->get_backend(null, $filter['owner'] ?? null);
|
||||
// SQL Backend supporting regexp_replace (MySQL 8.0+ or MariaDB 10.0+ or PostgreSQL)
|
||||
if (is_a($backend, Contacts\Sql::class) && $this->db->regexp_replace('test', '', '') !== 'test')
|
||||
{
|
||||
|
@ -564,7 +564,7 @@ class Sql extends Api\Storage
|
||||
$filter[] = "($this->table_name.contact_owner=".(int)$GLOBALS['egw_info']['user']['account_id'].
|
||||
" OR $shared_sql".
|
||||
" OR contact_private=0 AND $this->table_name.contact_owner IN (".
|
||||
implode(',',array_keys($this->grants)).") $groupmember_sql OR $this->table_name.contact_owner IS NULL)";
|
||||
implode(',',array_keys($this->grants)).") ".($groupmember_sql ?? '')." OR $this->table_name.contact_owner IS NULL)";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1193,7 +1193,7 @@ class Sql extends Api\Storage
|
||||
|
||||
if (is_array($keys) && count($keys)) $this->data_merge($keys);
|
||||
|
||||
$new_entry = !$this->data['id'];
|
||||
$new_entry = empty($this->data['id']);
|
||||
|
||||
if (isset($this->data['etag'])) // do we have an etag in the data to write
|
||||
{
|
||||
|
@ -542,7 +542,7 @@ class Storage
|
||||
function save(&$contact)
|
||||
{
|
||||
// save mainfields
|
||||
if ($contact['id'] && $this->contact_repository != $this->account_repository && is_object($this->so_accounts) &&
|
||||
if (!empty($contact['id']) && $this->contact_repository != $this->account_repository && is_object($this->so_accounts) &&
|
||||
($this->contact_repository == 'sql' && !is_numeric($contact['id']) ||
|
||||
$this->contact_repository == 'ldap' && is_numeric($contact['id'])))
|
||||
{
|
||||
@ -566,7 +566,7 @@ class Storage
|
||||
$contact['id'] = $this->somain->data['id'];
|
||||
$contact['uid'] = $this->somain->data['uid'];
|
||||
$contact['etag'] = $this->somain->data['etag'];
|
||||
$contact['files'] = $this->somain->data['files'];
|
||||
$contact['files'] = $this->somain->data['files'] ?? null;
|
||||
|
||||
if ($this->contact_repository == 'sql-ldap')
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ class Tracking extends Api\Storage\Tracking
|
||||
switch($name)
|
||||
{
|
||||
case 'copy':
|
||||
if ($data['is_contactform'])
|
||||
if (!empty($data['is_contactform']))
|
||||
{
|
||||
$copy = preg_split('/, ?/',$data['email_contactform']);
|
||||
if ($data['email_copytoreceiver']) $copy[] = $data['email'];
|
||||
@ -122,7 +122,7 @@ class Tracking extends Api\Storage\Tracking
|
||||
break;
|
||||
|
||||
case 'sender':
|
||||
if ($data['is_contactform'])
|
||||
if (!empty($data['is_contactform']))
|
||||
{
|
||||
return $data['email'] ? $data['n_given'].' '.$data['n_family'].' <'.$data['email'].'>' : null;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class DateTime extends \DateTime
|
||||
$time['day'] = (int)substr($time['full'],6,2);
|
||||
}
|
||||
if (isset($time['year'])) $this->setDate((int)$time['year'],(int)$time['month'],isset($time['day']) ? (int)$time['day'] : (int)$time['mday']);
|
||||
$this->setTime((int)$time['hour'],(int)$time['minute'],(int)$time['second']);
|
||||
$this->setTime((int)($time['hour'] ?? 0),(int)($time['minute'] ?? 0),(int)($time['second'] ?? 0));
|
||||
break;
|
||||
|
||||
case 'object':
|
||||
|
@ -1595,13 +1595,13 @@ class Mail
|
||||
} /*else $sent_not = "";*/
|
||||
//error_log(__METHOD__.' ('.__LINE__.') '.array2string($headerObject));
|
||||
$headerObject['DATE'] = $headerForPrio['DATE'];
|
||||
$headerObject['SUBJECT'] = (is_array($headerForPrio['SUBJECT'])?$headerForPrio['SUBJECT'][0]:$headerForPrio['SUBJECT']);
|
||||
$headerObject['FROM'] = (array)($headerForPrio['FROM']?$headerForPrio['FROM']:($headerForPrio['REPLY-TO']?$headerForPrio['REPLY-TO']:$headerForPrio['RETURN-PATH']));
|
||||
$headerObject['TO'] = (array)$headerForPrio['TO'];
|
||||
$headerObject['SUBJECT'] = is_array($headerForPrio['SUBJECT'] ?? null) ? $headerForPrio['SUBJECT'][0] : ($headerForPrio['SUBJECT']??null);
|
||||
$headerObject['FROM'] = (array)($headerForPrio['FROM']?:($headerForPrio['REPLY-TO']?:$headerForPrio['RETURN-PATH']));
|
||||
$headerObject['TO'] = (array)($headerForPrio['TO'] ?? []);
|
||||
$headerObject['CC'] = isset($headerForPrio['CC'])?(array)$headerForPrio['CC']:array();
|
||||
$headerObject['BCC'] = isset($headerForPrio['BCC'])?(array)$headerForPrio['BCC']:array();
|
||||
$headerObject['REPLY-TO'] = isset($headerForPrio['REPLY-TO'])?(array)$headerForPrio['REPLY-TO']:array();
|
||||
$headerObject['PRIORITY'] = isset($headerForPrio['X-PRIORITY'])?$headerForPrio['X-PRIORITY']:null;
|
||||
$headerObject['PRIORITY'] = $headerForPrio['X-PRIORITY']??null;
|
||||
foreach (array('FROM','TO','CC','BCC','REPLY-TO') as $key)
|
||||
{
|
||||
$address = array();
|
||||
|
@ -270,7 +270,7 @@ class Account implements \ArrayAccess
|
||||
$params += Notifications::read($params['acc_id'], $called_for ? array(0, $called_for) : $called_for);
|
||||
}
|
||||
if (!empty($params['acc_imap_logintype']) && empty($params['acc_imap_username']) &&
|
||||
$GLOBALS['egw_info']['user']['account_id'] &&
|
||||
!empty($GLOBALS['egw_info']['user']['account_id']) &&
|
||||
(!isset($called_for) || $called_for == $GLOBALS['egw_info']['user']['account_id']))
|
||||
{
|
||||
// get username/password from current user, let it overwrite credentials for all/no session
|
||||
@ -291,7 +291,7 @@ class Account implements \ArrayAccess
|
||||
unset($this->smtpServer);
|
||||
unset($this->smtpTransport);
|
||||
|
||||
$this->user = $called_for ? $called_for : $GLOBALS['egw_info']['user']['account_id'];
|
||||
$this->user = $called_for ?: $GLOBALS['egw_info']['user']['account_id'] ?? null;
|
||||
}
|
||||
|
||||
public static function ssl2secure($ssl)
|
||||
@ -1491,7 +1491,7 @@ class Account implements \ArrayAccess
|
||||
$where = array();
|
||||
if ($only_current_user !== false)
|
||||
{
|
||||
$account_id = $only_current_user === true ? $GLOBALS['egw_info']['user']['account_id'] : $only_current_user;
|
||||
$account_id = $only_current_user === true ? ($GLOBALS['egw_info']['user']['account_id']??null) : $only_current_user;
|
||||
// no account_id happens eg. for notifications during login
|
||||
if ($account_id && !is_numeric($account_id))
|
||||
{
|
||||
@ -1774,7 +1774,7 @@ class Account implements \ArrayAccess
|
||||
*/
|
||||
protected static function memberships($user=null)
|
||||
{
|
||||
if (!$user) $user = $GLOBALS['egw_info']['user']['account_id'];
|
||||
if (!$user) $user = $GLOBALS['egw_info']['user']['account_id'] ?? null;
|
||||
|
||||
$memberships = $GLOBALS['egw']->accounts->memberships($user, true);
|
||||
$memberships[] = $user;
|
||||
|
@ -178,7 +178,7 @@ class Credentials
|
||||
if (is_null($type)) $type = self::ALL;
|
||||
if (is_null($account_id))
|
||||
{
|
||||
$account_id = array(0, $GLOBALS['egw_info']['user']['account_id']);
|
||||
$account_id = array(0, $GLOBALS['egw_info']['user']['account_id'] ?? null);
|
||||
}
|
||||
|
||||
// check cache, if nothing found, query database
|
||||
@ -312,7 +312,7 @@ class Credentials
|
||||
public static function from_session(array $data, $set_identity=true)
|
||||
{
|
||||
// if the username contains non-ascii chars, try email address, as Dovecot does NOT deal with non-ascii usernames
|
||||
if (is_a($data['acc_imap_type'], Api\Mail\Imap\Dovecot::class, true) &&
|
||||
if (isset($data['acc_imap_type']) && is_a($data['acc_imap_type'], Api\Mail\Imap\Dovecot::class, true) &&
|
||||
in_array($data['acc_imap_logintype'], ['standard', 'vmailmgr']) &&
|
||||
preg_match('/[^\x20-\x7e]/', $GLOBALS['egw_info']['user']['account_lid']))
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ class Html
|
||||
if ($addbracesforendtag === false )
|
||||
{
|
||||
if (stripos($_body,'<'.$tag)!==false) $ct = preg_match_all('#<'.$tag.'(?:\s.*)?>(.+)'.$endtag.'#isU', $_body, $found);
|
||||
if ($ct>0)
|
||||
if (isset($ct) && $ct > 0)
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.array2string($found[0]));
|
||||
// only replace what we have found
|
||||
|
@ -56,7 +56,7 @@ class Notifications
|
||||
{
|
||||
if (is_null($account_id))
|
||||
{
|
||||
$account_id = array(0, $GLOBALS['egw_info']['user']['account_id']);
|
||||
$account_id = array(0, $GLOBALS['egw_info']['user']['account_id'] ?? null);
|
||||
}
|
||||
|
||||
// check cache, if nothing found, query database
|
||||
|
@ -1324,8 +1324,8 @@ class Session
|
||||
$session =& $_SESSION[self::EGW_SESSION_VAR];
|
||||
|
||||
// we need to restore the limits and if authenticated via token
|
||||
$this->limits = $session['session_limits'];
|
||||
$this->token_auth = $session['session_token_auth'];
|
||||
$this->limits = $session['session_limits'] ?? null;
|
||||
$this->token_auth = $session['session_token_auth'] ?? null;
|
||||
|
||||
if ($session['session_dla'] <= time() - $GLOBALS['egw_info']['server']['sessions_timeout'])
|
||||
{
|
||||
@ -1910,7 +1910,7 @@ class Session
|
||||
if ($egw_path[0] != '/') $egw_path = parse_url($egw_path,PHP_URL_PATH);
|
||||
if ($action == '/Microsoft-Server-ActiveSync')
|
||||
{
|
||||
$action .= '?Cmd='.$_GET['Cmd'].'&DeviceId='.$_GET['DeviceId'];
|
||||
$action .= '?Cmd='.($_GET['Cmd']??null).'&DeviceId='.($_GET['DeviceId']??null);
|
||||
}
|
||||
elseif ($egw_path)
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ class Translation
|
||||
|
||||
if ($load_translations)
|
||||
{
|
||||
if ($GLOBALS['egw_info']['user']['preferences']['common']['lang'])
|
||||
if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['lang']))
|
||||
{
|
||||
self::$userlang = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
|
||||
}
|
||||
@ -953,7 +953,7 @@ class Translation
|
||||
return utf8_decode($data);
|
||||
}
|
||||
try {
|
||||
if (self::$mbstring && !$prefer_iconv && ($data = @mb_convert_encoding($data, $to, $from)) != '')
|
||||
if (self::$mbstring && empty($prefer_iconv) && ($data = @mb_convert_encoding($data, $to, $from)) != '')
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
@ -1215,7 +1215,7 @@ class StreamWrapper extends Api\Db\Pdo implements Vfs\StreamWrapperIface
|
||||
static $max_subquery_depth=null;
|
||||
if (is_null($max_subquery_depth))
|
||||
{
|
||||
$max_subquery_depth = $GLOBALS['egw_info']['server']['max_subquery_depth'];
|
||||
$max_subquery_depth = $GLOBALS['egw_info']['server']['max_subquery_depth'] ?? null;
|
||||
if (!$max_subquery_depth) $max_subquery_depth = 7; // setting current default of 7, if nothing set
|
||||
}
|
||||
if (self::LOG_LEVEL > 1) error_log(__METHOD__."('$url',$flags)");
|
||||
|
@ -29,7 +29,7 @@ if (!function_exists('get_magic_quotes_gpc'))
|
||||
}
|
||||
|
||||
/**
|
||||
* applies stripslashes recursivly on each element of an array
|
||||
* applies stripslashes recursively on each element of an array
|
||||
*
|
||||
* @param array &$var
|
||||
* @return array
|
||||
@ -116,7 +116,7 @@ if (!function_exists('imap_rfc822_parse_adrlist'))
|
||||
foreach(explode(',', $address) as $part)
|
||||
{
|
||||
$trimmed = trim(($pending ? $pending.',' : '').$part);
|
||||
if (($trimmed[0] == '"' && substr($trimmed, -1) != '>')||strpos($part, '@')===false)
|
||||
if ((($trimmed[0]??null) == '"' && substr($trimmed, -1) != '>')||strpos($part, '@')===false)
|
||||
{
|
||||
$pending .= ($pending ? $pending.',' : '').$part;
|
||||
continue;
|
||||
@ -366,7 +366,7 @@ function function_backtrace($remove=0)
|
||||
{
|
||||
$ret[] = (isset($level['class'])?$level['class'].$level['type']:'').$level['function'].
|
||||
($n > 0 && isset($backtrace[$n-1]['line']) ? ':'.$backtrace[$n-1]['line'] : ''). // add line number of call
|
||||
(!$level['class'] && !is_object($level['args'][0]) && $level['function'] != 'unserialize' ?
|
||||
(empty($level['class']) && !is_object($level['args'][0]) && $level['function'] != 'unserialize' ?
|
||||
'('.substr(str_replace(EGW_SERVER_ROOT,'',(string)$level['args'][0]),0,64).')' : '');
|
||||
}
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ class calendar_bo
|
||||
$offset = isset($params['offset']) && $params['offset'] !== false ? (int) $params['offset'] : false;
|
||||
// socal::search() returns rejected group-invitations, as only the user not also the group is rejected
|
||||
// as we cant remove them efficiantly in SQL, we kick them out here, but only if just one user is displayed
|
||||
$users_in = (array)$params_in['users'];
|
||||
$users_in = (array)($params_in['users']??[]);
|
||||
$remove_rejected_by_user = !in_array($filter,array('all','rejected','everything')) &&
|
||||
count($users_in) == 1 && $users_in[0] > 0 ? $users_in[0] : null;
|
||||
//error_log(__METHOD__.'('.array2string($params_in).", $sql_filter) params[users]=".array2string($params['users']).' --> remove_rejected_by_user='.array2string($remove_rejected_by_user));
|
||||
@ -655,7 +655,7 @@ class calendar_bo
|
||||
}
|
||||
// date2ts(,true) converts to server time, db2data converts again to user-time
|
||||
$events =& $this->so->search(isset($start) ? $this->date2ts($start,true) : null,isset($end) ? $this->date2ts($end,true) : null,
|
||||
$users,$cat_id,$filter,$offset,(int)$params['num_rows'],$params,$remove_rejected_by_user);
|
||||
$users,$cat_id,$filter,$offset,(int)($params['num_rows']??0),$params,$remove_rejected_by_user);
|
||||
|
||||
if (isset($params['cols']))
|
||||
{
|
||||
@ -1091,7 +1091,7 @@ class calendar_bo
|
||||
{
|
||||
if (is_array($ids) || !isset(self::$cached_event['id']) || self::$cached_event['id'] != $ids ||
|
||||
self::$cached_event_date_format != $date_format || $read_recurrence ||
|
||||
self::$cached_event['recur_type'] != MCAL_RECUR_NONE && self::$cached_event_date != $date)
|
||||
!empty(self::$cached_event['recur_type']) && self::$cached_event_date != $date)
|
||||
{
|
||||
$events = $this->so->read($ids,$date ? $this->date2ts($date,true) : 0, $read_recurrence);
|
||||
|
||||
@ -1362,7 +1362,7 @@ class calendar_bo
|
||||
$owner = $event['owner'];
|
||||
$private = !$event['public'];
|
||||
}
|
||||
$grant = $grants[$owner];
|
||||
$grant = $grants[$owner] ?? null;
|
||||
|
||||
// now any ACL rights (but invite rights!) implicate FREEBUSY rights (at least READ has to include FREEBUSY)
|
||||
if ($grant & ~self::ACL_INVITE) $grant |= self::ACL_FREEBUSY;
|
||||
|
@ -698,8 +698,8 @@ class calendar_boupdate extends calendar_bo
|
||||
default:
|
||||
if (is_array($new_event) && is_array($old_event))
|
||||
{
|
||||
$diff = max(abs(self::date2ts($old_event['start'])-self::date2ts($new_event['start'])),
|
||||
abs(self::date2ts($old_event['end'])-self::date2ts($new_event['end'])));
|
||||
$diff = max(abs(self::date2ts($old_event['start']??null)-self::date2ts($new_event['start']??null)),
|
||||
abs(self::date2ts($old_event['end']??null)-self::date2ts($new_event['end']??null)));
|
||||
$check = $ru == 'time_change_4h' ? 4 * 60 * 60 - 1 : 0;
|
||||
if ($msg_type == MSG_MODIFIED && $diff > $check)
|
||||
{
|
||||
@ -707,7 +707,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
}
|
||||
case 'add_cancel':
|
||||
if ($msg_is_response && is_array($old_event) && ($old_event['owner'] == $userid || $role == 'CHAIR') ||
|
||||
if ($msg_is_response && is_array($old_event) && (isset($old_event['owner']) && $old_event['owner'] == $userid || $role == 'CHAIR') ||
|
||||
$msg_type == MSG_DELETED || $msg_type == MSG_ADDED || $msg_type == MSG_DISINVITE)
|
||||
{
|
||||
++$want_update;
|
||||
@ -1354,7 +1354,7 @@ class calendar_boupdate extends calendar_bo
|
||||
$ret = $this->_send_update(MSG_ALARM, $to_notify, $event, False, $alarm['owner'], $alarm);
|
||||
|
||||
// create a new alarm for recuring events for the next event, if one exists
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE && ($event = $this->read($alarm['cal_id'],$event_time_user+1)))
|
||||
if (!empty($event['recur_type']) && ($event = $this->read($alarm['cal_id'],$event_time_user+1)))
|
||||
{
|
||||
$alarm['time'] = $this->date2ts($event['start']) - $alarm['offset'];
|
||||
unset($alarm['times']);
|
||||
@ -1404,7 +1404,7 @@ class calendar_boupdate extends calendar_bo
|
||||
$this->check_reset_statuses($event, $old_event);
|
||||
|
||||
// set recur-enddate/range-end to real end-date of last recurrence
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'])
|
||||
if (!empty($event['recur_type']) && $event['recur_enddate'] && $event['start'])
|
||||
{
|
||||
$event['recur_enddate'] = new Api\DateTime($event['recur_enddate'], calendar_timezones::DateTimeZone($event['tzid']));
|
||||
$event['recur_enddate']->setTime(23,59,59);
|
||||
@ -1576,7 +1576,7 @@ class calendar_boupdate extends calendar_bo
|
||||
$set_recurrences = $old_event ? abs(Api\DateTime::to($event['recur_enddate'] ?? null, 'utc') - Api\DateTime::to($old_event['recur_enddate'] ?? null, 'utc')) > 1 ||
|
||||
count($old_event['recur_exception'] ?? []) != count($event['recur_exception'] ?? []) : false;
|
||||
$set_recurrences_start = 0;
|
||||
if (($cal_id = $this->so->save($event,$set_recurrences,$set_recurrences_start,0,$event['etag'])) && $set_recurrences && $event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (($cal_id = $this->so->save($event,$set_recurrences,$set_recurrences_start,0,$event['etag'])) && $set_recurrences && !empty($event['recur_type']))
|
||||
{
|
||||
$save_event['id'] = $cal_id;
|
||||
// unset participants to enforce the default stati for all added recurrences
|
||||
@ -1585,7 +1585,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
|
||||
// create links for new participants from addressbook, if configured
|
||||
if($cal_id && $GLOBALS['egw_info']['server']['link_contacts'] && !empty($save_event['participants']))
|
||||
if($cal_id && !empty($GLOBALS['egw_info']['server']['link_contacts']) && !empty($save_event['participants']))
|
||||
{
|
||||
foreach($save_event['participants'] as $uid => $status)
|
||||
{
|
||||
@ -1941,7 +1941,7 @@ class calendar_boupdate extends calendar_bo
|
||||
$this->send_update(MSG_DELETED, $to_notify, $event);
|
||||
}
|
||||
|
||||
if (!$recur_date || $event['recur_type'] == MCAL_RECUR_NONE)
|
||||
if (!$recur_date || empty($event['recur_type']))
|
||||
{
|
||||
$config = Api\Config::read('phpgwapi');
|
||||
if ($event['deleted'])
|
||||
@ -1969,7 +1969,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
|
||||
// delete or keep (with new uid) exceptions of a recurring event
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (!empty($event['recur_type']))
|
||||
{
|
||||
$exceptions_kept = 0;
|
||||
foreach ($this->so->get_related($event['uid']) as $id)
|
||||
@ -2190,7 +2190,7 @@ class calendar_boupdate extends calendar_bo
|
||||
// Repeated Events
|
||||
$var['recur_type'] = Array(
|
||||
'field' => lang('Repetition'),
|
||||
'data' => ($event['recur_type'] != MCAL_RECUR_NONE) ? $this->recure2string($event) : '',
|
||||
'data' => (!empty($event['recur_type'])) ? $this->recure2string($event) : '',
|
||||
);
|
||||
return $var;
|
||||
}
|
||||
@ -2259,7 +2259,7 @@ class calendar_boupdate extends calendar_bo
|
||||
|
||||
foreach($event['alarm'] as &$alarm)
|
||||
{
|
||||
if($event['recur_type'] != MCAL_RECUR_NONE && $instance_date)
|
||||
if(!empty($event['recur_type']) && $instance_date)
|
||||
{
|
||||
calendar_so::shift_alarm($event, $alarm, $instance_date);
|
||||
}
|
||||
@ -2425,7 +2425,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
elseif ($filter == 'exact')
|
||||
{
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (!empty($event['recur_type']))
|
||||
{
|
||||
$query[] = 'recur_type='.$event['recur_type'];
|
||||
}
|
||||
@ -2450,7 +2450,7 @@ class calendar_boupdate extends calendar_bo
|
||||
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
||||
'()[FOUND]:' . array2string($egwEvent)."\n",3,$this->logfile);
|
||||
}
|
||||
if ($egwEvent['recur_type'] != MCAL_RECUR_NONE &&
|
||||
if (!empty($egwEvent['recur_type']) &&
|
||||
(empty($event['uid']) || $event['uid'] == $egwEvent['uid']))
|
||||
{
|
||||
if ($filter == 'master')
|
||||
@ -2461,7 +2461,7 @@ class calendar_boupdate extends calendar_bo
|
||||
{
|
||||
$matchingEvents[] = $egwEvent['id']; // we found the event
|
||||
}
|
||||
elseif ($event['recur_type'] == MCAL_RECUR_NONE &&
|
||||
elseif (empty($event['recur_type']) &&
|
||||
$event['recurrence'] != 0)
|
||||
{
|
||||
$exceptions = $this->so->get_recurrence_exceptions($egwEvent, $event['tzid']);
|
||||
@ -2658,14 +2658,14 @@ class calendar_boupdate extends calendar_bo
|
||||
$egwstart->setTimezone(self::$tz_cache[$egwEvent['tzid']]);
|
||||
$dtstart = new Api\DateTime($event['start'], Api\DateTime::$server_timezone);
|
||||
$dtstart->setTimezone(self::$tz_cache[$event['tzid']]);
|
||||
if ($egwEvent['recur_type'] == MCAL_RECUR_NONE &&
|
||||
$event['recur_type'] == MCAL_RECUR_NONE ||
|
||||
$egwEvent['recur_type'] != MCAL_RECUR_NONE &&
|
||||
$event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (empty($egwEvent['recur_type']) &&
|
||||
empty($event['recur_type']) ||
|
||||
!empty($egwEvent['recur_type']) &&
|
||||
!empty($event['recur_type']))
|
||||
{
|
||||
if ($egwEvent['recur_type'] == MCAL_RECUR_NONE &&
|
||||
if (empty(egwEvent['recur_type']) &&
|
||||
$egwstart->format('Ymd') == $dtstart->format('Ymd') ||
|
||||
$egwEvent['recur_type'] != MCAL_RECUR_NONE)
|
||||
!empty($egwEvent['recur_type']))
|
||||
{
|
||||
// We found an exact match
|
||||
$matchingEvents = array($egwEvent['id']);
|
||||
@ -2684,8 +2684,8 @@ class calendar_boupdate extends calendar_bo
|
||||
$matchingEvents = array($egwEvent['id']);
|
||||
break;
|
||||
}
|
||||
if ($egwEvent['recur_type'] != MCAL_RECUR_NONE &&
|
||||
$event['recur_type'] == MCAL_RECUR_NONE &&
|
||||
if (!empty($egwEvent['recur_type']) &&
|
||||
empty($event['recur_type']) &&
|
||||
!$egwEvent['recurrence'] && $event['recurrence'])
|
||||
{
|
||||
$exceptions = $this->so->get_recurrence_exceptions($egwEvent, $event['tzid']);
|
||||
@ -2825,9 +2825,9 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
}
|
||||
|
||||
if ($event['recur_type'] == MCAL_RECUR_NONE)
|
||||
if (empty($event['recur_type']))
|
||||
{
|
||||
if ($egwEvent['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (!empty($egwEvent['recur_type']))
|
||||
{
|
||||
// We found a pseudo Exception
|
||||
$pseudos[] = $egwEvent['id'] . ':' . $event['start'];
|
||||
@ -2964,7 +2964,7 @@ class calendar_boupdate extends calendar_bo
|
||||
}
|
||||
}
|
||||
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (!empty($event['recur_type']))
|
||||
{
|
||||
$type = 'SERIES-MASTER';
|
||||
}
|
||||
|
@ -844,7 +844,7 @@ class calendar_rrule implements Iterator
|
||||
$end = is_a($event['end'],'DateTime') ? clone $event['end'] : new Api\DateTime($event['end'],$timestamp_tz);
|
||||
$end->setTimezone($enddate->getTimezone());
|
||||
$enddate->setTime($end->format('H'),$end->format('i'),0);
|
||||
if($event['whole_day'])
|
||||
if(!empty($event['whole_day']))
|
||||
{
|
||||
$enddate->setTime(23,59,59);
|
||||
}
|
||||
@ -856,7 +856,7 @@ class calendar_rrule implements Iterator
|
||||
$exceptions[] = is_a($exception,'DateTime') ? $exception : new Api\DateTime($exception,$timestamp_tz);
|
||||
}
|
||||
}
|
||||
return new calendar_rrule($time,$event['recur_type'],$event['recur_interval'],$enddate,$event['recur_data'],$exceptions);
|
||||
return new calendar_rrule($time,$event['recur_type'],$event['recur_interval'],$enddate??null,$event['recur_data'],$exceptions??null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -159,7 +159,7 @@ class calendar_so
|
||||
*/
|
||||
protected function cal_range_view($start, $end, array $_where=null, $deleted=false)
|
||||
{
|
||||
if ($GLOBALS['egw_info']['server']['no_timerange_views'] || !$start) // using view without start-date is slower!
|
||||
if (!empty($GLOBALS['egw_info']['server']['no_timerange_views']) || !$start) // using view without start-date is slower!
|
||||
{
|
||||
return $this->cal_table; // no need / use for a view
|
||||
}
|
||||
@ -424,7 +424,7 @@ class calendar_so
|
||||
$this->db->update($this->cal_table, array('cal_uid' => $event['uid']),
|
||||
array('cal_id' => $event['id']),__LINE__,__FILE__,'calendar');
|
||||
}
|
||||
if (!(int)$recur_date && $event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (!(int)$recur_date && !empty($event['recur_type']))
|
||||
{
|
||||
foreach($this->db->select($this->dates_table, 'cal_id,cal_start', array(
|
||||
'cal_id' => $ids,
|
||||
@ -436,7 +436,7 @@ class calendar_so
|
||||
break; // as above select read all exceptions (and I dont think too short uid problem still exists)
|
||||
}
|
||||
// make sure we fetch only real exceptions (deleted occurrences of a series should not show up)
|
||||
if (($recur_date && $event['recur_type'] != MCAL_RECUR_NONE))
|
||||
if (($recur_date && !empty($event['recur_type'])))
|
||||
{
|
||||
//_debug_array(__METHOD__.__LINE__.' recur_date:'.$recur_date.' check cal_start:'.$event['start']);
|
||||
foreach($this->db->select($this->dates_table, 'cal_id,cal_start', array(
|
||||
@ -468,7 +468,7 @@ class calendar_so
|
||||
}
|
||||
|
||||
// check if we have a real recurance, if not set $recur_date=0
|
||||
if (is_array($ids) || $events[(int)$ids]['recur_type'] == MCAL_RECUR_NONE)
|
||||
if (is_array($ids) || empty($events[(int)$ids]['recur_type']))
|
||||
{
|
||||
$recur_date = 0;
|
||||
}
|
||||
@ -955,7 +955,7 @@ class calendar_so
|
||||
|
||||
$u_join = "JOIN $this->user_table ON $this->cal_table.cal_id=$this->user_table.cal_id ".
|
||||
"LEFT JOIN $this->repeats_table ON $this->cal_table.cal_id=$this->repeats_table.cal_id ".
|
||||
$rejected_by_user_join;
|
||||
($rejected_by_user_join??'');
|
||||
// dates table join only needed to enum recuring events, we use a time-range limited view here too
|
||||
if ($params['enum_recuring'])
|
||||
{
|
||||
@ -1217,7 +1217,7 @@ class calendar_so
|
||||
{
|
||||
foreach($alarms as $id => $alarm)
|
||||
{
|
||||
$event_start = $alarm['time'] + $alarm['offset'];
|
||||
$event_start = $alarm['time'] + ($alarm['offset']??0);
|
||||
|
||||
if (isset($events[$cal_id])) // none recuring event
|
||||
{
|
||||
@ -1453,9 +1453,9 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
|
||||
$cal_id = (int)($event['id'] ?? 0);
|
||||
unset($event['id']);
|
||||
$set_recurrences = $set_recurrences || !$cal_id && $event['recur_type'] != MCAL_RECUR_NONE;
|
||||
$set_recurrences = $set_recurrences || !$cal_id && !empty($event['recur_type']);
|
||||
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE &&
|
||||
if (!empty($event['recur_type']) &&
|
||||
!(int)$event['recur_interval'])
|
||||
{
|
||||
$event['recur_interval'] = 1;
|
||||
@ -1474,7 +1474,7 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
if (isset($event['cal_start'])) $event['range_start'] = $event['cal_start'];
|
||||
if (isset($event['cal_end']))
|
||||
{
|
||||
$event['range_end'] = $event['recur_type'] == MCAL_RECUR_NONE ? $event['cal_end'] :
|
||||
$event['range_end'] = empty($event['recur_type']) ? $event['cal_end'] :
|
||||
($event['recur_enddate'] ? $event['recur_enddate'] : null);
|
||||
}
|
||||
// ensure that we find matching entries later on
|
||||
@ -1492,12 +1492,12 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
$event['cal_category'] = implode(',',$categories);
|
||||
|
||||
// make sure recurring events never reference to an other recurrent event
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE) $event['cal_reference'] = 0;
|
||||
if (!empty($event['recur_type'])) $event['cal_reference'] = 0;
|
||||
|
||||
if ($cal_id)
|
||||
{
|
||||
// query old recurrance information, before updating main table, where recur_endate is now stored
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (!empty($event['recur_type']))
|
||||
{
|
||||
$old_repeats = $this->db->select($this->repeats_table, "$this->repeats_table.*,range_end AS recur_enddate",
|
||||
"$this->repeats_table.cal_id=".(int)$cal_id, __LINE__, __FILE__,
|
||||
@ -1505,7 +1505,7 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
}
|
||||
$where = array('cal_id' => $cal_id);
|
||||
// read only timezone id, to check if it is changed
|
||||
if ($event['recur_type'] != MCAL_RECUR_NONE)
|
||||
if (!empty($event['recur_type']))
|
||||
{
|
||||
$old_tz_id = $this->db->select($this->cal_table,'tz_id',$where,__LINE__,__FILE__,'calendar')->fetchColumn();
|
||||
}
|
||||
@ -1552,7 +1552,7 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
$this->db->update($this->cal_table, $update, array('cal_id' => $cal_id),__LINE__,__FILE__,'calendar');
|
||||
}
|
||||
|
||||
if ($event['recur_type'] == MCAL_RECUR_NONE)
|
||||
if (empty($event['recur_type']))
|
||||
{
|
||||
$this->db->delete($this->dates_table,array(
|
||||
'cal_id' => $cal_id),
|
||||
@ -1764,7 +1764,7 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
}
|
||||
}
|
||||
// updating or saving the alarms; new alarms have a temporary numeric id!
|
||||
if (is_array($event['alarm']))
|
||||
if (!empty($event['alarm']) && is_array($event['alarm']))
|
||||
{
|
||||
foreach ($event['alarm'] as $id => $alarm)
|
||||
{
|
||||
@ -1812,7 +1812,7 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
*/
|
||||
public static function shift_alarm(array $_event, array &$alarm, $timestamp=null)
|
||||
{
|
||||
if ($_event['recur_type'] == MCAL_RECUR_NONE)
|
||||
if (empty($_event['recur_type']))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -2747,7 +2747,7 @@ ORDER BY cal_user_type, cal_usre_id
|
||||
$cal_id = (int) $event['id'];
|
||||
//error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
|
||||
// "($cal_id, $tz_id, $filter): " . $event['tzid']);
|
||||
if (!$cal_id || $event['recur_type'] == MCAL_RECUR_NONE) return false;
|
||||
if (!$cal_id || empty($event['recur_type'])) return false;
|
||||
|
||||
$days = array();
|
||||
|
||||
|
@ -125,7 +125,7 @@ class calendar_tracking extends Api\Storage\Tracking
|
||||
{
|
||||
// Don't try to track dates on recurring events.
|
||||
// It won't change for the base event, and any change to the time creates an exception
|
||||
if($data['recur_type'])
|
||||
if(!empty($data['recur_type']))
|
||||
{
|
||||
unset($data['start']); unset($data['end']);
|
||||
unset($old['start']); unset($old['end']);
|
||||
|
@ -187,7 +187,7 @@ class calendar_zpush implements activesync_plugin_write, activesync_plugin_meeti
|
||||
$type = $user = null;
|
||||
$this->backend->splitID($id,$type,$user);
|
||||
|
||||
if (!$cutoffdate) $cutoffdate = $this->bo->now - 100*24*3600; // default three month back -30 breaks all sync recurrences
|
||||
if (!$cutoffdate) $cutoffdate = time() - 100*24*3600; // default three month back -30 breaks all sync recurrences
|
||||
|
||||
$filter = array(
|
||||
'users' => $user,
|
||||
@ -783,7 +783,7 @@ class calendar_zpush implements activesync_plugin_write, activesync_plugin_meeti
|
||||
}
|
||||
// preserve all resource types not account, contact or email (eg. resources) for existing events
|
||||
// $account is also preserved, as AS does not add him as participant!
|
||||
foreach((array)$event['participant_types'] as $type => $parts)
|
||||
foreach($event['participant_types'] ?? [] as $type => $parts)
|
||||
{
|
||||
if (in_array($type,array('c','e'))) continue; // they are correctly representable in AS
|
||||
|
||||
@ -800,10 +800,10 @@ class calendar_zpush implements activesync_plugin_write, activesync_plugin_meeti
|
||||
}
|
||||
}
|
||||
// add calendar owner as participant, as otherwise event will NOT be in his calendar, in which it was posted
|
||||
if (!$event['id'] || !$participants || !isset($participants[$account]))
|
||||
if (empty($event['id']) || !$participants || !isset($participants[$account]))
|
||||
{
|
||||
$participants[$account] = calendar_so::combine_status($account == $GLOBALS['egw_info']['user']['account_id'] ?
|
||||
'A' : 'U',1,!$chair_set ? 'CHAIR' : 'REQ-PARTICIPANT');
|
||||
'A' : 'U',1,empty($chair_set) ? 'CHAIR' : 'REQ-PARTICIPANT');
|
||||
}
|
||||
$event['participants'] = $participants;
|
||||
|
||||
@ -1138,12 +1138,12 @@ class calendar_zpush implements activesync_plugin_write, activesync_plugin_meeti
|
||||
|
||||
if (!$info) continue;
|
||||
|
||||
if (!$info['email'] && $info['responsible'])
|
||||
if (empty($info['email']) && !empty($info['responsible']))
|
||||
{
|
||||
$info['email'] = $GLOBALS['egw']->accounts->id2name($info['responsible'], 'account_email', true);
|
||||
}
|
||||
$attendee->name = empty($info['cn']) ? $info['name'] : $info['cn'];
|
||||
$attendee->email = $info['email'];
|
||||
$attendee->email = $info['email'] ?? null;
|
||||
|
||||
// external organizer: make him AS organizer, to get correct notifications
|
||||
if ($role == 'CHAIR' && $uid[0] == 'e' && !empty($attendee->email))
|
||||
|
@ -61,7 +61,7 @@ class infolog_hooks
|
||||
),
|
||||
'add' => array(
|
||||
'menuaction' => 'infolog.infolog_ui.edit',
|
||||
'type' => $GLOBALS['egw_info']['user']['preferences']['preferred_type']
|
||||
'type' => $GLOBALS['egw_info']['user']['preferences']['preferred_type'] ?? '',
|
||||
),
|
||||
'add_app' => 'action',
|
||||
'add_id' => 'action_id',
|
||||
|
@ -306,7 +306,7 @@ class infolog_so
|
||||
{
|
||||
$vars = null;
|
||||
preg_match('/(done|open|offer|deleted|\+deleted)/',$_filter,$vars);
|
||||
$filter = $vars[1];
|
||||
$filter = $vars[1]??null;
|
||||
|
||||
switch ($filter)
|
||||
{
|
||||
@ -335,7 +335,7 @@ class infolog_so
|
||||
{
|
||||
$vars = null;
|
||||
preg_match('/(open-upcoming|upcoming|today|overdue|date|enddate)([-\\/.0-9]*)/',$_filter,$vars);
|
||||
$filter = $vars[1];
|
||||
$filter = $vars[1]??null;
|
||||
|
||||
if (isset($vars[2]) && !empty($vars[2]) && ($date = preg_split('/[-\\/.]/',$vars[2])))
|
||||
{
|
||||
@ -866,7 +866,7 @@ class infolog_so
|
||||
continue;
|
||||
}
|
||||
if ($col[0] != '#' && substr($col,0,5) != 'info_' && isset($table_def['fd']['info_'.$col])) $col = 'info_'.$col;
|
||||
if ((string)$data !== '' && preg_match('/^[a-z_0-9]+$/i',$col))
|
||||
if ((!empty($data) || (string)$data !== '') && preg_match('/^[a-z_0-9]+$/i',$col))
|
||||
{
|
||||
switch ($col)
|
||||
{
|
||||
@ -1034,12 +1034,12 @@ class infolog_so
|
||||
if (is_null($index_load_cfs) && !empty($query['col_filter']['info_type']))
|
||||
{
|
||||
$config_data = Api\Config::read('infolog');
|
||||
$index_load_cfs = $config_data['index_load_cfs'];
|
||||
$index_load_cfs = $config_data['index_load_cfs'] ?? [];
|
||||
if (!is_array($index_load_cfs)) $index_load_cfs = explode(',', $index_load_cfs);
|
||||
}
|
||||
// if no specific custom field is selected, show/query all custom fields
|
||||
if ($ids && ($query['custom_fields'] || $query['csv_export'] ||
|
||||
$index_load_cfs && $query['col_filter']['info_type'] && in_array($query['col_filter']['info_type'],$index_load_cfs)))
|
||||
if ($ids && (!empty($query['custom_fields']) || !empty($query['csv_export']) ||
|
||||
$index_load_cfs && !empty($query['col_filter']['info_type']) && in_array($query['col_filter']['info_type'],$index_load_cfs)))
|
||||
{
|
||||
$where = array('info_id' => array_keys($ids));
|
||||
if (!($query['csv_export'] || strchr(is_array($query['selectcols']) ? implode(',',$query['selectcols']):$query['selectcols'],'#') === false ||
|
||||
|
@ -242,7 +242,7 @@ class infolog_zpush implements activesync_plugin_write
|
||||
$mimesupport = $contentparameters->GetMimeSupport();
|
||||
$bodypreference = $contentparameters->GetBodyPreference(); /* fmbiete's contribution r1528, ZP-320 */
|
||||
|
||||
ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $id, truncsize=$truncsize, bodyprefence=$bodypreference, mimesupport=$mimesupport)");
|
||||
ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $id, truncsize=$truncsize, bodyprefence=".json_encode($bodypreference).", mimesupport=$mimesupport)");
|
||||
$type = $account = null;
|
||||
$this->backend->splitID($folderid, $type, $account);
|
||||
if ($type != 'infolog' || !($infolog = $this->infolog->read($id, true, 'server')))
|
||||
|
@ -424,9 +424,9 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
{
|
||||
$disableRuler = true;
|
||||
}
|
||||
$beforePlain = $beforeHtml = "";
|
||||
$beforeHtml = ($disableRuler ?' <br>':' <br><hr style="border:dotted 1px silver; width:90%; border:dotted 1px silver;">');
|
||||
$beforePlain = ($disableRuler ?"\r\n\r\n":"\r\n\r\n-- \r\n");
|
||||
|
||||
$beforeHtml = !empty($disableRuler) ? ' <br>' : ' <br><hr style="border:dotted 1px silver; width:90%; border:dotted 1px silver;">';
|
||||
$beforePlain = !empty($disableRuler) ?"\r\n\r\n" : "\r\n\r\n-- \r\n";
|
||||
$sigText = Mail::merge($signature,array($GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id')));
|
||||
if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' Signature to use:'.$sigText);
|
||||
$sigTextHtml = $beforeHtml.$sigText;
|
||||
@ -553,9 +553,9 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
$emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
|
||||
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' &&
|
||||
calendar_boupdate::email_update_requested($emailAddress, isset($cSMRMethod) ? $cSMRMethod : 'REQUEST',
|
||||
$organizer && !strcasecmp($emailAddress, $organizer) ? 'CHAIR' : ''))
|
||||
!empty($organizer) && !strcasecmp($emailAddress, $organizer) ? 'CHAIR' : ''))
|
||||
{
|
||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") skiping mail to organizer '$organizer', as it will be send by calendar app");
|
||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__."(".__LINE__.") skiping mail to organizer ".json_encode($organizer??null).", as it will be send by calendar app");
|
||||
continue;
|
||||
}
|
||||
$mailObject->AddAddress($emailAddress, $addressObject->personal);
|
||||
@ -563,7 +563,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
}
|
||||
}
|
||||
$ccCount = 0;
|
||||
foreach((array)$ccMailAddr as $address) {
|
||||
foreach($ccMailAddr ?? [] as $address) {
|
||||
foreach(Mail::parseAddressList((function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()?stripslashes($address):$address)) as $addressObject) {
|
||||
$emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
|
||||
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' && calendar_boupdate::email_update_requested($emailAddress)) continue;
|
||||
@ -572,7 +572,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
}
|
||||
}
|
||||
$bccCount = 0;
|
||||
foreach((array)$bccMailAddr as $address) {
|
||||
foreach($bccMailAddr ?? [] as $address) {
|
||||
foreach(Mail::parseAddressList((function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()?stripslashes($address):$address)) as $addressObject) {
|
||||
$emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
|
||||
if ($ClientSideMeetingRequest === true && $allowSendingInvitations == 'sendifnocalnotif' && calendar_boupdate::email_update_requested($emailAddress)) continue;
|
||||
@ -583,7 +583,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
// typical organizer reply will end here with nothing send --> return true, because we suppressed the send above
|
||||
if ($toCount+$ccCount+$bccCount == 0)
|
||||
{
|
||||
return $ClientSideMeetingRequest && $allowSendingInvitations === 'sendifnocalnotif' && $organizer ? true : 0; // noone to send mail to
|
||||
return $ClientSideMeetingRequest && $allowSendingInvitations === 'sendifnocalnotif' && !empty($organizer) ? true : 0; // noone to send mail to
|
||||
}
|
||||
if ($ClientSideMeetingRequest === true && $allowSendingInvitations===false) return true;
|
||||
// as we use our mailer (horde mailer) it is detecting / setting the mimetype by itself while creating the mail
|
||||
@ -797,7 +797,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
$asf = true;
|
||||
}
|
||||
if (count($folderArray) > 0) {
|
||||
foreach((array)$bccMailAddr as $address) {
|
||||
foreach($bccMailAddr ?? [] as $address) {
|
||||
foreach(Mail::parseAddressList((function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()?stripslashes($address):$address)) as $addressObject) {
|
||||
$emailAddress = $addressObject->mailbox. ($addressObject->host ? '@'.$addressObject->host : '');
|
||||
$mailAddr[] = array($emailAddress, $addressObject->personal);
|
||||
@ -1086,7 +1086,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
||||
$output->importance = $headers['priority'] > 3 ? 0 :
|
||||
($headers['priority'] < 3 ? 2 : 1) ;
|
||||
$output->datereceived = $this->mail->_strtotime($headers['date'], 'ts', false); // false = servertime
|
||||
$output->to = $headers['to_address'];
|
||||
$output->to = $headers['to_address'] ?? null;
|
||||
if (!empty($headers['to'])) $output->displayto = $headers['to_address']; //$headers['FETCHED_HEADER']['to_name']
|
||||
$output->from = $headers['sender_address'];
|
||||
if (!empty($headers['cc_addresses'])) $output->cc = $headers['cc_addresses'];
|
||||
|
Loading…
Reference in New Issue
Block a user