fix a ton of Undefined warnings filling up eSync logs

This commit is contained in:
ralf 2024-02-06 21:46:43 +02:00
parent d472c267b2
commit 7c50457e2c
4 changed files with 22 additions and 22 deletions

View File

@ -129,7 +129,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
if (!isset($abs) || !$return_all_in_one)
{
if ($return_all_in_one && ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'] ?? null))
if ($return_all_in_one && !empty($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one']))
{
$abs = array(
$GLOBALS['egw_info']['user']['account_id'] => lang('All'),
@ -289,7 +289,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
$filter = array('owner' => $user);
// handle all-in-one addressbook
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'] &&
if (!empty($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one']) &&
$user == $GLOBALS['egw_info']['user']['account_id'])
{
$filter['owner'] = array_keys($this->get_addressbooks(null,false)); // false = return all selected abs
@ -397,7 +397,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
$message->categories[] = Api\Categories::id2name($cat_id);
}
// for all addressbooks in one, add addressbook name itself as category
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'])
if (!empty($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one']))
{
$message->categories[] = $this->get_addressbooks($contact['owner'].($contact['private']?'p':''), false, true);
}
@ -557,7 +557,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
case 'cat_id':
// for existing entries in all-in-one addressbook, remove addressbook name as category
if ($contact && $GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'] && is_array($message->$key) &&
if ($contact && !empty($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one']) && is_array($message->$key) &&
($k=array_search($this->get_addressbooks($contact['owner'].($contact['private']?'p':''), false, true),$message->$key)))
{
unset($message->categories[$k]);
@ -604,13 +604,13 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
// for all-in-one addressbook, account is meaningless and wrong!
// Api\Contacts::save() keeps the owner or sets an appropriate one if none given
if (!isset($contact['private'])) $contact['private'] = (int)$is_private;
if (!$GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'])
if (empty($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one']))
{
$contact['owner'] = $account;
$contact['private'] = (int)$is_private;
}
// if default addressbook for new contacts is NOT synced --> use personal addressbook
elseif($GLOBALS['egw_info']['user']['preferences']['addressbook']['add_default'] &&
elseif(!empty($GLOBALS['egw_info']['user']['preferences']['addressbook']['add_default']) &&
!in_array($GLOBALS['egw_info']['user']['preferences']['addressbook']['add_default'],
array_keys($this->get_addressbooks(null,false))))
{
@ -645,7 +645,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
public function MoveMessage($folderid, $id, $newfolderid, $contentParameters)
{
unset($contentParameters); // not used, but required by function signature
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'])
if (!empty($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one']))
{
ZLog::Write(LOGLEVEL_DEBUG, __METHOD__."('$folderid', $id, $newfolderid) NOT allowed for an all-in-one addressbook --> returning false");
return false;
@ -737,7 +737,7 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se
if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts();
// handle all-in-one addressbook
if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'] &&
if (!empty($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one']) &&
$owner == $GLOBALS['egw_info']['user']['account_id'])
{
$prefs_abs = $GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-abs'];

View File

@ -304,7 +304,7 @@ class Base
$check_already_included = !empty($this->timestamps);
foreach($this->table_def['fd'] as $name => $data)
{
if (($data['type'] === 'timestamp' || $data['meta'] === 'timestamp') && (!$check_already_included || !in_array($name,$this->timestamps)))
if (($data['type'] === 'timestamp' || ($data['meta']??null) === 'timestamp') && (!$check_already_included || !in_array($name,$this->timestamps)))
{
$this->timestamps[] = $this->db_cols[$name] ?? $name;
}
@ -528,7 +528,7 @@ class Base
{
foreach($this->db_data_cols as $db_col => $col)
{
if ($this->data[$col] != '')
if (($this->data[$col] ?? null) != '')
{
$query[$db_col] = $this->data[$col];
}
@ -620,7 +620,7 @@ class Base
if ((int) $this->debug >= 4) { echo "so_sql::save(".print_r($keys,true).") autoinc_id='$this->autoinc_id', data="; _debug_array($this->data); }
if ($this->autoinc_id && !$this->data[$this->db_key_cols[$this->autoinc_id]]) // insert with auto id
if ($this->autoinc_id && empty($this->data[$this->db_key_cols[$this->autoinc_id]])) // insert with auto id
{
foreach($this->db_cols as $db_col => $col)
{
@ -635,7 +635,7 @@ class Base
if ($this->table_def['fd'][$db_col]['type'] == 'varchar' && is_string($this->data[$col]) &&
strlen($this->data[$col]) > $this->table_def['fd'][$db_col]['precision'])
{
// truncate the field to mamimum length, if upper layers didn't care
// truncate the field to maximum length, if upper layers didn't care
$data[$db_col] = substr($this->data[$col],0,$this->table_def['fd'][$db_col]['precision']);
}
else
@ -1418,15 +1418,15 @@ class Base
$token = strtok($break);
}
if($criteria['NOT'])
if (!empty($criteria['NOT']))
{
$filter[] = 'NOT (' . implode(' OR ', $criteria['NOT']) . ') ';
}
if($criteria['AND'])
if (!empty($criteria['AND']))
{
$filter[] = implode(' AND ', $criteria['AND']) . ' ';
}
if($criteria['OR'])
if (!empty($criteria['OR']))
{
$filter[] = '(' . implode(' OR ', $criteria['OR']) . ') ';
}

View File

@ -1292,7 +1292,7 @@ class calendar_bo
if ($info)
{
$info['type'] = $uid[0];
if (!$info['email'] && $info['responsible'])
if (empty($info['email']) && $info['responsible'])
{
$info['email'] = $GLOBALS['egw']->accounts->id2name($info['responsible'],'account_email');
}
@ -1382,7 +1382,7 @@ class calendar_bo
$grant |= self::ACL_FREEBUSY | Acl::READ | Acl::PRIVAT;
break;
}
elseif ($grants[$uid] & Acl::READ)
elseif (isset($grants[$uid]) && ($grants[$uid] & Acl::READ))
{
// if we have a READ grant from a participant, we dont give an implicit privat grant too
$grant |= self::ACL_FREEBUSY | Acl::READ;
@ -1406,7 +1406,7 @@ class calendar_bo
else
{
$access = $user == $owner || $grant & $needed
&& ($needed == self::ACL_FREEBUSY || !$private || $grant & Acl::PRIVAT);
&& ($needed == self::ACL_FREEBUSY || empty($private) || $grant & Acl::PRIVAT);
}
// do NOT allow users to purge deleted events, if we dont have 'userpurge' enabled
if ($access && $needed == Acl::DELETE && $event['deleted'] &&

View File

@ -223,7 +223,7 @@ class infolog_bo
);
if (($config_data = Api\Config::read('infolog')))
{
$this->allow_past_due_date = $config_data['allow_past_due_date'] === null ? 1 : $config_data['allow_past_due_date'];
$this->allow_past_due_date = !isset($config_data['allow_past_due_date']) ? 1 : $config_data['allow_past_due_date'];
if (isset($config_data['status']) && is_array($config_data['status']))
{
foreach(array_keys($config_data['status']) as $key)
@ -242,7 +242,7 @@ class infolog_bo
$this->enums['type'] += $config_data['types'];
//echo "types:<pre>"; print_r($this->enums['type']); echo "</pre>\n";
}
if ($config_data['group_owners']) $this->group_owners = $config_data['group_owners'];
if (!empty($config_data['group_owners'])) $this->group_owners = $config_data['group_owners'];
$this->customfields = Api\Storage\Customfields::get('infolog');
if ($this->customfields)
@ -280,7 +280,7 @@ class infolog_bo
{
$this->sub_excludefields = array_merge($this->sub_excludefields,$this->default_sub_excludefields);
}
if ($config_data['implicit_rights'] == 'edit')
if (isset($config_data['implicit_rights']) && $config_data['implicit_rights'] === 'edit')
{
$this->implicit_rights = 'edit';
}
@ -460,7 +460,7 @@ class infolog_bo
return False;
}
// if link is a project and no other project selected, also add as project
if ($app == 'projectmanager' && $id && !$info['pm_id'])
if ($app == 'projectmanager' && $id && empty($info['pm_id']))
{
$info['old_pm_id'] = $info['pm_id'] = $id;
}