mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
another chunk of fixed PHP Warning: Undefined array key or variable in api
This commit is contained in:
parent
917a833f89
commit
2d0de5f287
@ -272,14 +272,14 @@ class Accounts
|
|||||||
}
|
}
|
||||||
// no backend understands $param['app'], only sql understands type owngroups or groupmemember[+memberships]
|
// no backend understands $param['app'], only sql understands type owngroups or groupmemember[+memberships]
|
||||||
// --> do an full search first and then filter and limit that search
|
// --> do an full search first and then filter and limit that search
|
||||||
elseif($param['app'] || $this->config['account_repository'] != 'sql' &&
|
elseif(!empty($param['app']) || $this->config['account_repository'] != 'sql' &&
|
||||||
in_array($param['type'], array('owngroups','groupmembers','groupmembers+memberships')))
|
in_array($param['type'], array('owngroups','groupmembers','groupmembers+memberships')))
|
||||||
{
|
{
|
||||||
$app = $param['app'];
|
$app = $param['app'];
|
||||||
unset($param['app']);
|
unset($param['app']);
|
||||||
$start = $param['start'];
|
$start = $param['start'];
|
||||||
unset($param['start']);
|
unset($param['start']);
|
||||||
$offset = $param['offset'] ? $param['offset'] : $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
$offset = $param['offset'] ?: $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||||
unset($param['offset']);
|
unset($param['offset']);
|
||||||
$stop = $start + $offset;
|
$stop = $start + $offset;
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ class Sql
|
|||||||
if (!isset($GLOBALS['egw_setup']) || in_array(Api\Mail\Smtp\Sql::TABLE, $this->db->table_names(true)))
|
if (!isset($GLOBALS['egw_setup']) || in_array(Api\Mail\Smtp\Sql::TABLE, $this->db->table_names(true)))
|
||||||
{
|
{
|
||||||
$email_cols = array('coalesce('.$this->contacts_table.'.contact_email,'.Api\Mail\Smtp\Sql::TABLE.'.mail_value) as email');
|
$email_cols = array('coalesce('.$this->contacts_table.'.contact_email,'.Api\Mail\Smtp\Sql::TABLE.'.mail_value) as email');
|
||||||
if ($this->db->Type == 'mysql' && !preg_match('/[\x80-\xFF]/', $param['query']))
|
if ($this->db->Type == 'mysql' && !preg_match('/[\x80-\xFF]/', $param['query'] ?? ''))
|
||||||
{
|
{
|
||||||
$search_cols[] = Api\Mail\Smtp\Sql::TABLE.'.mail_value';
|
$search_cols[] = Api\Mail\Smtp\Sql::TABLE.'.mail_value';
|
||||||
}
|
}
|
||||||
@ -489,8 +489,8 @@ class Sql
|
|||||||
$filter[] = str_replace('UNIX_TIMESTAMP(NOW())',time(),Api\Contacts\Sql::ACOUNT_ACTIVE_FILTER);
|
$filter[] = str_replace('UNIX_TIMESTAMP(NOW())',time(),Api\Contacts\Sql::ACOUNT_ACTIVE_FILTER);
|
||||||
}
|
}
|
||||||
$criteria = array();
|
$criteria = array();
|
||||||
$wildcard = $param['query_type'] == 'start' || $param['query_type'] == 'exact' ? '' : '%';
|
$wildcard = in_array($param['query_type'] ?? '', ['start', 'exact']) ? '' : '%';
|
||||||
if (($query = $param['query']))
|
if (($query = $param['query'] ?? null))
|
||||||
{
|
{
|
||||||
switch($param['query_type'])
|
switch($param['query_type'])
|
||||||
{
|
{
|
||||||
@ -536,7 +536,7 @@ class Sql
|
|||||||
$order, "account_lid,account_type,account_status,account_expires,account_primary_group,account_description".
|
$order, "account_lid,account_type,account_status,account_expires,account_primary_group,account_description".
|
||||||
",account_lastlogin,account_lastloginfrom,account_lastpwd_change",
|
",account_lastlogin,account_lastloginfrom,account_lastpwd_change",
|
||||||
$wildcard,false,$query[0] == '!' ? 'AND' : 'OR',
|
$wildcard,false,$query[0] == '!' ? 'AND' : 'OR',
|
||||||
$param['offset'] ? array($param['start'], $param['offset']) : (is_null($param['start']) ? false : $param['start']),
|
!empty($param['offset']) ? array($param['start'], $param['offset']) : $param['start'] ?? false,
|
||||||
$filter,$join) as $contact)
|
$filter,$join) as $contact)
|
||||||
{
|
{
|
||||||
if ($contact)
|
if ($contact)
|
||||||
@ -607,7 +607,7 @@ class Sql
|
|||||||
$cols .= ',account_type';
|
$cols .= ',account_type';
|
||||||
$where[$which] = $name;
|
$where[$which] = $name;
|
||||||
// check if we need to treat username case-insensitive
|
// check if we need to treat username case-insensitive
|
||||||
if ($which == 'account_lid' && !$GLOBALS['egw_info']['server']['case_sensitive_username']) // = is case sensitiv eg. on postgres, but not on mysql!
|
if ($which === 'account_lid' && empty($GLOBALS['egw_info']['server']['case_sensitive_username'])) // = is case sensitiv eg. on postgres, but not on mysql!
|
||||||
{
|
{
|
||||||
$where[] = 'account_lid '.$this->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote($where['account_lid']);
|
$where[] = 'account_lid '.$this->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE].' '.$this->db->quote($where['account_lid']);
|
||||||
unset($where['account_lid']);
|
unset($where['account_lid']);
|
||||||
@ -665,4 +665,4 @@ class Sql
|
|||||||
|
|
||||||
return $previous_login;
|
return $previous_login;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -581,7 +581,7 @@ class Sql extends Api\Storage
|
|||||||
" OR $shared_sql".
|
" OR $shared_sql".
|
||||||
($this->grants ? " OR contact_private=0 AND $this->table_name.contact_owner IN (".
|
($this->grants ? " OR contact_private=0 AND $this->table_name.contact_owner IN (".
|
||||||
implode(',',array_keys($this->grants)).")" : '').
|
implode(',',array_keys($this->grants)).")" : '').
|
||||||
$groupmember_sql." OR $this->table_name.contact_owner IS NULL)";
|
($groupmember_sql??'')." OR $this->table_name.contact_owner IS NULL)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($filter['list']))
|
if (isset($filter['list']))
|
||||||
@ -1298,4 +1298,4 @@ class Sql extends Api\Storage
|
|||||||
{
|
{
|
||||||
$this->db->delete($this->extra_table,$data,__LINE__,__FILE__);
|
$this->db->delete($this->extra_table,$data,__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -685,8 +685,8 @@ class Storage
|
|||||||
{
|
{
|
||||||
unset($filter['tid']); // return all entries incl. deleted
|
unset($filter['tid']); // return all entries incl. deleted
|
||||||
}
|
}
|
||||||
$backend = $this->get_backend(null, isset($filter['list']) && $filter['list'] < 0 ? 0 : $filter['owner']);
|
$backend = $this->get_backend(null, isset($filter['list']) && $filter['list'] < 0 ? 0 : $filter['owner'] ?? null);
|
||||||
// single string to search for --> create so_sql conformant search criterial for the standard search columns
|
// single string to search for --> create so_sql conformant search criteria for the standard search columns
|
||||||
if ($criteria && !is_array($criteria))
|
if ($criteria && !is_array($criteria))
|
||||||
{
|
{
|
||||||
$op = 'OR';
|
$op = 'OR';
|
||||||
@ -1316,4 +1316,4 @@ class Storage
|
|||||||
|
|
||||||
return $this->somain->lists_ctag($owner);
|
return $this->somain->lists_ctag($owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -966,7 +966,7 @@ class Widget
|
|||||||
|
|
||||||
$readonly = $readonlys === true ||
|
$readonly = $readonlys === true ||
|
||||||
// exception to __ALL__ or readonly="true" attribute by setting $readonlys[$from_name] === false
|
// exception to __ALL__ or readonly="true" attribute by setting $readonlys[$from_name] === false
|
||||||
($this->attrs['readonly'] || isset(self::$request->readonlys['__ALL__'])) && $readonlys !== false;
|
(!empty($this->attrs['readonly']) || isset(self::$request->readonlys['__ALL__'])) && $readonlys !== false;
|
||||||
|
|
||||||
//error_log(__METHOD__."('$cname') this->id='$this->id' --> form_name='$form_name': attrs[readonly]=".array2string($this->attrs['readonly']).", readonlys['$form_name']=".array2string(self::$request->readonlys[$form_name]).", readonlys[$form_name]=".array2string(self::get_array(self::$request->readonlys,$form_name)).", readonlys['__ALL__']=".array2string(self::$request->readonlys['__ALL__'])." returning ".array2string($readonly));
|
//error_log(__METHOD__."('$cname') this->id='$this->id' --> form_name='$form_name': attrs[readonly]=".array2string($this->attrs['readonly']).", readonlys['$form_name']=".array2string(self::$request->readonlys[$form_name]).", readonlys[$form_name]=".array2string(self::get_array(self::$request->readonlys,$form_name)).", readonlys['__ALL__']=".array2string(self::$request->readonlys['__ALL__'])." returning ".array2string($readonly));
|
||||||
return $readonly;
|
return $readonly;
|
||||||
|
@ -370,7 +370,7 @@ class File extends Etemplate\Widget
|
|||||||
* Set default chunk_size attribute to (max_upload_size-1M)/2
|
* Set default chunk_size attribute to (max_upload_size-1M)/2
|
||||||
*
|
*
|
||||||
* Last chunk can be 2*chunk_size, therefore we can only set max_upload_size/2
|
* Last chunk can be 2*chunk_size, therefore we can only set max_upload_size/2
|
||||||
* minus "some" for other transfered fields.
|
* minus "some" for other transferred fields.
|
||||||
*
|
*
|
||||||
* @param string $cname
|
* @param string $cname
|
||||||
* @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
|
* @param array $expand values for keys 'c', 'row', 'c_', 'row_', 'cont'
|
||||||
@ -381,7 +381,8 @@ class File extends Etemplate\Widget
|
|||||||
|
|
||||||
$upload_max_filesize = ini_get('upload_max_filesize');
|
$upload_max_filesize = ini_get('upload_max_filesize');
|
||||||
$unit = strtolower(substr($upload_max_filesize, -1));
|
$unit = strtolower(substr($upload_max_filesize, -1));
|
||||||
if (!is_numeric($unit)) $upload_max_filesize *= $unit == 'm' ? 1024*1024 : 1024;
|
$upload_max_filesize = (float)$upload_max_filesize;
|
||||||
|
if (!is_numeric($unit)) $upload_max_filesize *= $unit === 'm' ? 1024*1024 : 1024;
|
||||||
if ($upload_max_filesize > 1024*1024)
|
if ($upload_max_filesize > 1024*1024)
|
||||||
{
|
{
|
||||||
self::setElementAttribute($form_name, 'chunk_size', ($upload_max_filesize-1024*1024)/2);
|
self::setElementAttribute($form_name, 'chunk_size', ($upload_max_filesize-1024*1024)/2);
|
||||||
|
@ -174,7 +174,7 @@ class Nextmatch extends Etemplate\Widget
|
|||||||
unset($send_value['favorite']);
|
unset($send_value['favorite']);
|
||||||
|
|
||||||
// Parse sort into something that get_rows functions are expecting: db_field in order, ASC/DESC in sort
|
// Parse sort into something that get_rows functions are expecting: db_field in order, ASC/DESC in sort
|
||||||
if(is_array($send_value['sort']))
|
if(!empty($send_value['sort']) && is_array($send_value['sort']))
|
||||||
{
|
{
|
||||||
$send_value['order'] = $send_value['sort']['id'];
|
$send_value['order'] = $send_value['sort']['id'];
|
||||||
$send_value['sort'] = $send_value['sort']['asc'] ? 'ASC' : 'DESC';
|
$send_value['sort'] = $send_value['sort']['asc'] ? 'ASC' : 'DESC';
|
||||||
@ -584,7 +584,7 @@ class Nextmatch extends Etemplate\Widget
|
|||||||
{
|
{
|
||||||
list($app,$class,$method) = explode('.',$value['get_rows']);
|
list($app,$class,$method) = explode('.',$value['get_rows']);
|
||||||
}
|
}
|
||||||
if ($class)
|
if (!empty($class))
|
||||||
{
|
{
|
||||||
if (!$app && !is_object($GLOBALS[$class]))
|
if (!$app && !is_object($GLOBALS[$class]))
|
||||||
{
|
{
|
||||||
@ -979,7 +979,7 @@ class Nextmatch extends Etemplate\Widget
|
|||||||
if (!empty($action['url']))
|
if (!empty($action['url']))
|
||||||
{
|
{
|
||||||
$action['url'] = Api\Framework::link('/index.php',str_replace('$action',$id,$action['url']));
|
$action['url'] = Api\Framework::link('/index.php',str_replace('$action',$id,$action['url']));
|
||||||
if ($action['popup'])
|
if (!empty($action['popup']))
|
||||||
{
|
{
|
||||||
list($action['data']['width'],$action['data']['height']) = explode('x',$action['popup']);
|
list($action['data']['width'],$action['data']['height']) = explode('x',$action['popup']);
|
||||||
unset($action['popup']);
|
unset($action['popup']);
|
||||||
@ -988,7 +988,7 @@ class Nextmatch extends Etemplate\Widget
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action['data']['nm_action'] = 'location';
|
$action['data']['nm_action'] = 'location';
|
||||||
if(!$action['target'] && strpos($action['url'],'menuaction') > 0)
|
if(empty($action['target']) && strpos($action['url'],'menuaction') > 0)
|
||||||
{
|
{
|
||||||
// It would be better if app set target, but we'll auto-detect if not
|
// It would be better if app set target, but we'll auto-detect if not
|
||||||
list(,$menuaction) = explode('=',$action['url']);
|
list(,$menuaction) = explode('=',$action['url']);
|
||||||
@ -1265,4 +1265,4 @@ class Nextmatch extends Etemplate\Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Registration needs to go here, otherwise customfields won't be loaded until some other cf shows up
|
// Registration needs to go here, otherwise customfields won't be loaded until some other cf shows up
|
||||||
Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Customfields', array('nextmatch-customfields'));
|
Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Customfields', array('nextmatch-customfields'));
|
@ -317,7 +317,8 @@ class Select extends Etemplate\Widget
|
|||||||
{
|
{
|
||||||
// Check selection preference, we may be able to skip reading some data
|
// Check selection preference, we may be able to skip reading some data
|
||||||
$select_pref = $GLOBALS['egw_info']['user']['preferences']['common']['account_selection'];
|
$select_pref = $GLOBALS['egw_info']['user']['preferences']['common']['account_selection'];
|
||||||
if($this->attrs['type'] == 'select-account' && empty($GLOBALS['egw_info']['user']['apps']['admin']) && $select_pref == 'none')
|
if(!empty($this->attrs['type']) && $this->attrs['type'] === 'select-account' &&
|
||||||
|
empty($GLOBALS['egw_info']['user']['apps']['admin']) && $select_pref === 'none')
|
||||||
{
|
{
|
||||||
// Preserve but do not send the value if preference is 'none'
|
// Preserve but do not send the value if preference is 'none'
|
||||||
self::$request->preserv[$this->id] = self::$request->content[$this->id] ?? null;
|
self::$request->preserv[$this->id] = self::$request->content[$this->id] ?? null;
|
||||||
|
@ -324,7 +324,7 @@ class Tree extends Etemplate\Widget
|
|||||||
{
|
{
|
||||||
$label = html_entity_decode($label, ENT_NOQUOTES,'utf-8');
|
$label = html_entity_decode($label, ENT_NOQUOTES,'utf-8');
|
||||||
}
|
}
|
||||||
elseif($label['label'])
|
elseif(!empty($label['label']))
|
||||||
{
|
{
|
||||||
$label['label'] = html_entity_decode($label['label'], ENT_NOQUOTES,'utf-8');
|
$label['label'] = html_entity_decode($label['label'], ENT_NOQUOTES,'utf-8');
|
||||||
}
|
}
|
||||||
@ -524,4 +524,4 @@ class Tree extends Etemplate\Widget
|
|||||||
//error_log(__METHOD__."('$widget_type', '$legacy_options', no_lang=".array2string($no_lang).', readonly='.array2string($readonly).", value=$value) returning ".array2string($options));
|
//error_log(__METHOD__."('$widget_type', '$legacy_options', no_lang=".array2string($no_lang).', readonly='.array2string($readonly).", value=$value) returning ".array2string($options));
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -901,11 +901,11 @@ abstract class Framework extends Framework\Extra
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Sort the applications accordingly to their user sort setting
|
//Sort the applications accordingly to their user sort setting
|
||||||
if ($GLOBALS['egw_info']['user']['preferences']['common']['user_apporder'])
|
if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['user_apporder']))
|
||||||
{
|
{
|
||||||
//Sort the application array using the user_apporder array as sort index
|
//Sort the application array using the user_apporder array as sort index
|
||||||
self::$user_apporder =
|
self::$user_apporder =
|
||||||
unserialize($GLOBALS['egw_info']['user']['preferences']['common']['user_apporder']);
|
unserialize($GLOBALS['egw_info']['user']['preferences']['common']['user_apporder'], ['allowed_classes' => false]);
|
||||||
uasort($apps, __CLASS__.'::_sort_apparray');
|
uasort($apps, __CLASS__.'::_sort_apparray');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ class Html
|
|||||||
$additionalQuote = """;
|
$additionalQuote = """;
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__.__LINE__.array2string($match));
|
//error_log(__METHOD__.__LINE__.array2string($match));
|
||||||
return "<a href=\"".($match[1]&&!$match[2]?$match[1]:'').($match[2]?$match[2]:'').$match[3].$match[4]."\" target=\"_blank\">".$match[3].$match[4]."</a>$additionalQuote";
|
return "<a href=\"".($match[1]&&!$match[2]?$match[1]:'').($match[2]?:'').$match[3].($match[4]??'')."\" target=\"_blank\">".$match[3].($match[4]??'')."</a>$additionalQuote";
|
||||||
}, $result2);
|
}, $result2);
|
||||||
|
|
||||||
// Now match things beginning with www.
|
// Now match things beginning with www.
|
||||||
@ -1391,4 +1391,4 @@ tinymce.init({
|
|||||||
{
|
{
|
||||||
return Html\HtmLawed::purify($html, $config, $spec, $_force);
|
return Html\HtmLawed::purify($html, $config, $spec, $_force);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -148,7 +148,7 @@ class HtmLawed
|
|||||||
// no need to do the extra routine
|
// no need to do the extra routine
|
||||||
$html = str_ireplace($newStyle[0],'',$html);
|
$html = str_ireplace($newStyle[0],'',$html);
|
||||||
}
|
}
|
||||||
if ($style2buffer)
|
if (!empty($style2buffer))
|
||||||
{
|
{
|
||||||
//error_log(__METHOD__.__LINE__.array2string($style2buffer));
|
//error_log(__METHOD__.__LINE__.array2string($style2buffer));
|
||||||
$test = json_encode($style2buffer);
|
$test = json_encode($style2buffer);
|
||||||
@ -161,7 +161,7 @@ class HtmLawed
|
|||||||
$style2buffer = utf8_encode($style2buffer);
|
$style2buffer = utf8_encode($style2buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$style = $style2buffer;
|
$style = $style2buffer ?? '';
|
||||||
// clean out comments and stuff
|
// clean out comments and stuff
|
||||||
$search = array(
|
$search = array(
|
||||||
'@url\(http:\/\/[^\)].*?\)@si', // url calls e.g. in style definitions
|
'@url\(http:\/\/[^\)].*?\)@si', // url calls e.g. in style definitions
|
||||||
@ -456,5 +456,4 @@ function hl_email_tag_transform($element, $attribute_array=0)
|
|||||||
// Return the opening tag with attributes
|
// Return the opening tag with attributes
|
||||||
static $empty_elements = array('area'=>1, 'br'=>1, 'col'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'param'=>1);
|
static $empty_elements = array('area'=>1, 'br'=>1, 'col'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'param'=>1);
|
||||||
return "<{$element}{$attributes}". (isset($empty_elements[$element]) ? ' /' : ''). '>';
|
return "<{$element}{$attributes}". (isset($empty_elements[$element]) ? ' /' : ''). '>';
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +109,7 @@ class Sharing
|
|||||||
$path_info = $matches[1];
|
$path_info = $matches[1];
|
||||||
}
|
}
|
||||||
$path_info = substr($path_info, strlen($_SERVER['SCRIPT_NAME']));
|
$path_info = substr($path_info, strlen($_SERVER['SCRIPT_NAME']));
|
||||||
list(, $token/*, $path*/) = preg_split('|[/?]|', $path_info, 3);
|
list(, $token/*, $path*/) = preg_split('|[/?]|', $path_info, 3)+[null,null,null];
|
||||||
|
|
||||||
list($token) = explode(':', $token);
|
list($token) = explode(':', $token);
|
||||||
return $token;
|
return $token;
|
||||||
|
@ -537,7 +537,7 @@ class Storage extends Storage\Base
|
|||||||
$extra_join_added = true;
|
$extra_join_added = true;
|
||||||
}
|
}
|
||||||
$extra_columns = $this->db->get_table_definitions($this->app, $this->extra_table);
|
$extra_columns = $this->db->get_table_definitions($this->app, $this->extra_table);
|
||||||
if(is_string($name) && $extra_columns['fd'][array_search($name, $this->db_cols)])
|
if(is_string($name) && $extra_columns['fd'][array_search($name, $this->db_cols)] ?? null)
|
||||||
{
|
{
|
||||||
$criteria[] = $this->db->expression($this->table_name,$this->table_name.'.',array(
|
$criteria[] = $this->db->expression($this->table_name,$this->table_name.'.',array(
|
||||||
array_search($name, $this->db_cols) => $val,
|
array_search($name, $this->db_cols) => $val,
|
||||||
@ -568,7 +568,7 @@ class Storage extends Storage\Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($cfcriteria && $op =='OR') $criteria[] = implode(' OR ',$cfcriteria);
|
if (!empty($cfcriteria) && $op === 'OR') $criteria[] = implode(' OR ', $cfcriteria);
|
||||||
}
|
}
|
||||||
if($only_keys === true)
|
if($only_keys === true)
|
||||||
{
|
{
|
||||||
@ -817,4 +817,4 @@ class Storage extends Storage\Base
|
|||||||
return $this->allow_multiple_values && in_array($this->customfields[$name]['type'],array('select','select-account')) &&
|
return $this->allow_multiple_values && in_array($this->customfields[$name]['type'],array('select','select-account')) &&
|
||||||
$this->customfields[$name]['rows'] > 1;
|
$this->customfields[$name]['rows'] > 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -23,7 +23,7 @@ use EGroupware\Api;
|
|||||||
* 2) by setting the following documented class-vars in a class derived from this one
|
* 2) by setting the following documented class-vars in a class derived from this one
|
||||||
* Of cause you can derive from the class and call the constructor with params.
|
* Of cause you can derive from the class and call the constructor with params.
|
||||||
*
|
*
|
||||||
* @todo modify search() to return an interator instead of an array
|
* @todo modify search() to return an iterator instead of an array
|
||||||
*/
|
*/
|
||||||
class Base
|
class Base
|
||||||
{
|
{
|
||||||
@ -495,7 +495,7 @@ class Base
|
|||||||
$query = [];
|
$query = [];
|
||||||
foreach ($this->db_key_cols as $db_col => $col)
|
foreach ($this->db_key_cols as $db_col => $col)
|
||||||
{
|
{
|
||||||
if ($this->data[$col] != '')
|
if ((string)($this->data[$col] ?? '') !== '')
|
||||||
{
|
{
|
||||||
$query[$db_col] = $this->data[$col];
|
$query[$db_col] = $this->data[$col];
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ class Base
|
|||||||
{
|
{
|
||||||
foreach($this->db_uni_cols as $db_col => $col)
|
foreach($this->db_uni_cols as $db_col => $col)
|
||||||
{
|
{
|
||||||
if (!is_array($col) && $this->data[$col] != '')
|
if (!is_array($col) && (string)($this->data[$col] ?? '') !== '')
|
||||||
{
|
{
|
||||||
$query[$db_col] = $this->data[$col];
|
$query[$db_col] = $this->data[$col];
|
||||||
}
|
}
|
||||||
@ -939,18 +939,17 @@ class Base
|
|||||||
if (($key = array_search('*', $colums)) !== false)
|
if (($key = array_search('*', $colums)) !== false)
|
||||||
{
|
{
|
||||||
unset($colums[$key]);
|
unset($colums[$key]);
|
||||||
// don't add colums already existing incl. aliased colums (AS $name)
|
// don't add columns already existing incl. aliased colums (AS $name)
|
||||||
$as_columns = array_map(function($col)
|
$as_columns = array_map(function($col)
|
||||||
{
|
{
|
||||||
$as = null;
|
list(, $as) = preg_split('/ +AS +/i', $col)+[null,null];
|
||||||
list(, $as) = preg_split('/ +AS +/i', $col);
|
|
||||||
return empty($as) ? $col : $as;
|
return empty($as) ? $col : $as;
|
||||||
}, $colums);
|
}, $colums);
|
||||||
foreach(array_keys($this->db_cols) as $col)
|
foreach(array_keys($this->db_cols) as $col)
|
||||||
{
|
{
|
||||||
if (!in_array($col, $colums) && !in_array($col, $as_columns))
|
if (!in_array($col, $colums) && !in_array($col, $as_columns))
|
||||||
{
|
{
|
||||||
// make sure column-name is not ambigous
|
// make sure column-name is not ambiguous
|
||||||
if ($join && strpos($join, $this->table_name.'.'.$col))
|
if ($join && strpos($join, $this->table_name.'.'.$col))
|
||||||
{
|
{
|
||||||
$col = $this->table_name.'.'.$col.' AS '.$col;
|
$col = $this->table_name.'.'.$col.' AS '.$col;
|
||||||
@ -1029,7 +1028,7 @@ class Base
|
|||||||
{
|
{
|
||||||
$this->total = $this->db->select($this->table_name,'COUNT(*)',$query,__LINE__,__FILE__,false,'',$this->app,0,$join)->fetchColumn();
|
$this->total = $this->db->select($this->table_name,'COUNT(*)',$query,__LINE__,__FILE__,false,'',$this->app,0,$join)->fetchColumn();
|
||||||
}
|
}
|
||||||
else // cant do a count, have to run the query without limit
|
else // can't do a count, have to run the query without limit
|
||||||
{
|
{
|
||||||
$this->total = $this->db->select($this->table_name,$colums,$query,__LINE__,__FILE__,false,$order_by,false,0,$join)->NumRows();
|
$this->total = $this->db->select($this->table_name,$colums,$query,__LINE__,__FILE__,false,$order_by,false,0,$join)->NumRows();
|
||||||
}
|
}
|
||||||
@ -1048,7 +1047,8 @@ class Base
|
|||||||
// ToDo: Implement that as an iterator, as $rs is also an interator and we could return one instead of an array
|
// ToDo: Implement that as an iterator, as $rs is also an interator and we could return one instead of an array
|
||||||
if ($this->search_return_iterator)
|
if ($this->search_return_iterator)
|
||||||
{
|
{
|
||||||
return new Db2DataIterator($this,$rs);
|
$ret = new Db2DataIterator($this,$rs);
|
||||||
|
return $ret;
|
||||||
}
|
}
|
||||||
$arr = array();
|
$arr = array();
|
||||||
$n = 0;
|
$n = 0;
|
||||||
@ -1057,7 +1057,7 @@ class Base
|
|||||||
$data = array();
|
$data = array();
|
||||||
foreach($cols as $db_col => $col)
|
foreach($cols as $db_col => $col)
|
||||||
{
|
{
|
||||||
$data[$col] = (isset($row[$db_col]) ? $row[$db_col] : $row[$col]);
|
$data[$col] = $row[$db_col] ?? $row[$col] ?? null;
|
||||||
}
|
}
|
||||||
$arr[] = $this->db2data($data);
|
$arr[] = $this->db2data($data);
|
||||||
$n++;
|
$n++;
|
||||||
@ -1721,4 +1721,4 @@ class Base
|
|||||||
}
|
}
|
||||||
return is_null($column) ? $comments : $comments[$column];
|
return is_null($column) ? $comments : $comments[$column];
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -140,7 +140,7 @@ class Customfields implements \IteratorAggregate
|
|||||||
public static function get($app, $account=false, $only_type2=null, Api\Db $db=null)
|
public static function get($app, $account=false, $only_type2=null, Api\Db $db=null)
|
||||||
{
|
{
|
||||||
$account_key = $account === true ? 'all' :
|
$account_key = $account === true ? 'all' :
|
||||||
($account === false ? $GLOBALS['egw_info']['user']['account_id'] :
|
($account === false ? ($GLOBALS['egw_info']['user']['account_id']??null) :
|
||||||
(int)$account);
|
(int)$account);
|
||||||
|
|
||||||
$cache_key = $app.':'.$account_key.':'.$only_type2;
|
$cache_key = $app.':'.$account_key.':'.$only_type2;
|
||||||
@ -598,4 +598,4 @@ class Customfields implements \IteratorAggregate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Customfields::init_static();
|
Customfields::init_static();
|
@ -702,7 +702,7 @@ abstract class Merge
|
|||||||
if(!array_key_exists($app, $exportLimitStore))
|
if(!array_key_exists($app, $exportLimitStore))
|
||||||
{
|
{
|
||||||
//error_log(__METHOD__.__LINE__.' -> '.$app_limit.' '.function_backtrace());
|
//error_log(__METHOD__.__LINE__.' -> '.$app_limit.' '.function_backtrace());
|
||||||
$exportLimitStore[$app] = $GLOBALS['egw_info']['server']['export_limit'];
|
$exportLimitStore[$app] = $GLOBALS['egw_info']['server']['export_limit'] ?? null;
|
||||||
if($app != 'common')
|
if($app != 'common')
|
||||||
{
|
{
|
||||||
$app_limit = Api\Hooks::single('export_limit', $app);
|
$app_limit = Api\Hooks::single('export_limit', $app);
|
||||||
@ -1272,7 +1272,7 @@ abstract class Merge
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($is_xml) // zip'ed xml document (eg. OO)
|
if (!empty($is_xml)) // zip'ed xml document (eg. OO)
|
||||||
{
|
{
|
||||||
// Numeric fields
|
// Numeric fields
|
||||||
$names = array();
|
$names = array();
|
||||||
@ -1598,7 +1598,7 @@ abstract class Merge
|
|||||||
{
|
{
|
||||||
$key = '$$' . $field . '$$';
|
$key = '$$' . $field . '$$';
|
||||||
$field = preg_quote($field, '/');
|
$field = preg_quote($field, '/');
|
||||||
if($values[$key])
|
if (!empty($values[$key]))
|
||||||
{
|
{
|
||||||
$date = Api\DateTime::createFromUserFormat($values[$key]);
|
$date = Api\DateTime::createFromUserFormat($values[$key]);
|
||||||
if($mimetype == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
if($mimetype == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' ||
|
||||||
@ -1901,21 +1901,21 @@ abstract class Merge
|
|||||||
*/
|
*/
|
||||||
private function replace_callback($param)
|
private function replace_callback($param)
|
||||||
{
|
{
|
||||||
if(array_key_exists('$$' . $param[4] . '$$', $this->replacements))
|
if(!empty($param[4]) && array_key_exists('$$' . $param[4] . '$$', $this->replacements))
|
||||||
{
|
{
|
||||||
$param[4] = $this->replacements['$$' . $param[4] . '$$'];
|
$param[4] = $this->replacements['$$' . $param[4] . '$$'];
|
||||||
}
|
}
|
||||||
if(array_key_exists('$$' . $param[3] . '$$', $this->replacements))
|
if(!empty($param[3]) && array_key_exists('$$' . $param[3] . '$$', $this->replacements))
|
||||||
{
|
{
|
||||||
$param[3] = $this->replacements['$$' . $param[3] . '$$'];
|
$param[3] = $this->replacements['$$' . $param[3] . '$$'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$pattern = '/' . preg_quote($param[2], '/') . '/';
|
$pattern = '/' . preg_quote($param[2]??'', '/') . '/';
|
||||||
if(strpos($param[0], '$$IF') === 0 && (trim($param[2]) == "EMPTY" || $param[2] === ''))
|
if(strpos($param[0], '$$IF') === 0 && (trim($param[2]) == "EMPTY" || $param[2] === ''))
|
||||||
{
|
{
|
||||||
$pattern = '/^$/';
|
$pattern = '/^$/';
|
||||||
}
|
}
|
||||||
$replace = preg_match($pattern, $this->replacements['$$' . $param[1] . '$$']) ? $param[3] : $param[4];
|
$replace = preg_match($pattern, $this->replacements['$$' . $param[1] . '$$'] ?? '') ? ($param[3]??null) : ($param[4]??null);
|
||||||
switch($this->mimetype)
|
switch($this->mimetype)
|
||||||
{
|
{
|
||||||
case 'application/vnd.oasis.opendocument.text': // open office
|
case 'application/vnd.oasis.opendocument.text': // open office
|
||||||
@ -1977,7 +1977,7 @@ abstract class Merge
|
|||||||
}
|
}
|
||||||
if(strpos($param[0], '$$NELF') === 0)
|
if(strpos($param[0], '$$NELF') === 0)
|
||||||
{ //sets a Pagebreak and value, only if the field has a value
|
{ //sets a Pagebreak and value, only if the field has a value
|
||||||
if($this->replacements['$$' . $param[1] . '$$'] != '')
|
if(!empty($this->replacements['$$' . $param[1] . '$$']))
|
||||||
{
|
{
|
||||||
$replace = $LF . $this->replacements['$$' . $param[1] . '$$'];
|
$replace = $LF . $this->replacements['$$' . $param[1] . '$$'];
|
||||||
}
|
}
|
||||||
@ -1995,7 +1995,7 @@ abstract class Merge
|
|||||||
$replaceprefix = explode(' ', substr($param[0], 21, -2));
|
$replaceprefix = explode(' ', substr($param[0], 21, -2));
|
||||||
foreach($replaceprefix as $nameprefix)
|
foreach($replaceprefix as $nameprefix)
|
||||||
{
|
{
|
||||||
if($this->replacements['$$' . $nameprefix . '$$'] != '')
|
if(!empty($this->replacements['$$' . $nameprefix . '$$']))
|
||||||
{
|
{
|
||||||
$replaceprefixsort[] = $this->replacements['$$' . $nameprefix . '$$'];
|
$replaceprefixsort[] = $this->replacements['$$' . $nameprefix . '$$'];
|
||||||
}
|
}
|
||||||
@ -3295,4 +3295,4 @@ abstract class Merge
|
|||||||
protected function show_replacements_hook(&$template_name, &$content, &$sel_options, &$readonlys)
|
protected function show_replacements_hook(&$template_name, &$content, &$sel_options, &$readonlys)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -335,7 +335,7 @@ class StreamWrapper extends Api\Db\Pdo implements Vfs\StreamWrapperIface
|
|||||||
// remember initial size and directory for adjustDirSize call in close
|
// remember initial size and directory for adjustDirSize call in close
|
||||||
if (is_resource($this->opened_stream))
|
if (is_resource($this->opened_stream))
|
||||||
{
|
{
|
||||||
$this->opened_size = empty($stat) ? $stat['size'] : 0;
|
$this->opened_size = !empty($stat) ? $stat['size'] : 0;
|
||||||
if (empty($dir_stat))
|
if (empty($dir_stat))
|
||||||
{
|
{
|
||||||
$dir_stat = $this->url_stat($dir,STREAM_URL_STAT_QUIET);
|
$dir_stat = $this->url_stat($dir,STREAM_URL_STAT_QUIET);
|
||||||
@ -2058,4 +2058,4 @@ GROUP BY A.fs_id';
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamWrapper::register();
|
StreamWrapper::register();
|
Loading…
Reference in New Issue
Block a user