mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
an other chunk of fixed PHP 8.0 Warnings
This commit is contained in:
parent
45f039da95
commit
91bd7c7aeb
@ -15,8 +15,7 @@
|
||||
namespace EGroupware\Api;
|
||||
|
||||
// allow to set an application depending authentication type (eg. for syncml, groupdav, ...)
|
||||
if (isset($GLOBALS['egw_info']['server']['auth_type_'.$GLOBALS['egw_info']['flags']['currentapp']]) &&
|
||||
$GLOBALS['egw_info']['server']['auth_type_'.$GLOBALS['egw_info']['flags']['currentapp']])
|
||||
if (!empty($GLOBALS['egw_info']['server']['auth_type_'.$GLOBALS['egw_info']['flags']['currentapp']]))
|
||||
{
|
||||
$GLOBALS['egw_info']['server']['auth_type'] = $GLOBALS['egw_info']['server']['auth_type_'.$GLOBALS['egw_info']['flags']['currentapp']];
|
||||
}
|
||||
@ -223,11 +222,11 @@ class Auth
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (is_null($passwordAgeBorder) && $GLOBALS['egw_info']['server']['change_pwd_every_x_days'])
|
||||
if (is_null($passwordAgeBorder) && !empty($GLOBALS['egw_info']['server']['change_pwd_every_x_days']))
|
||||
{
|
||||
$passwordAgeBorder = (DateTime::to('now','ts')-($GLOBALS['egw_info']['server']['change_pwd_every_x_days']*86400));
|
||||
}
|
||||
if (is_null($daysLeftUntilChangeReq) && $GLOBALS['egw_info']['server']['warn_about_upcoming_pwd_change'])
|
||||
if (is_null($daysLeftUntilChangeReq) && !empty($GLOBALS['egw_info']['server']['warn_about_upcoming_pwd_change']))
|
||||
{
|
||||
// maxage - passwordage = days left until change is required
|
||||
$daysLeftUntilChangeReq = ($GLOBALS['egw_info']['server']['change_pwd_every_x_days'] - ((DateTime::to('now','ts')-($alpwchange_val?$alpwchange_val:0))/86400));
|
||||
@ -235,9 +234,9 @@ class Auth
|
||||
if ($alpwchange_val == 0 || // admin requested password change
|
||||
$passwordAgeBorder > $alpwchange_val || // change password every N days policy requests change
|
||||
// user should be warned N days in advance about change and is not yet
|
||||
$GLOBALS['egw_info']['server']['change_pwd_every_x_days'] &&
|
||||
$GLOBALS['egw_info']['user']['apps']['preferences'] &&
|
||||
$GLOBALS['egw_info']['server']['warn_about_upcoming_pwd_change'] &&
|
||||
!empty($GLOBALS['egw_info']['server']['change_pwd_every_x_days']) &&
|
||||
!empty($GLOBALS['egw_info']['user']['apps']['preferences']) &&
|
||||
!empty($GLOBALS['egw_info']['server']['warn_about_upcoming_pwd_change']) &&
|
||||
$GLOBALS['egw_info']['server']['warn_about_upcoming_pwd_change'] > $daysLeftUntilChangeReq &&
|
||||
$UserKnowsAboutPwdChange !== true)
|
||||
{
|
||||
@ -255,8 +254,8 @@ class Auth
|
||||
else
|
||||
{
|
||||
// login page does not inform user about passwords about to expire
|
||||
if ($GLOBALS['egw_info']['flags']['currentapp'] != 'login' &&
|
||||
($GLOBALS['egw_info']['flags']['currentapp'] != 'home' ||
|
||||
if ($GLOBALS['egw_info']['flags']['currentapp'] !== 'login' &&
|
||||
($GLOBALS['egw_info']['flags']['currentapp'] !== 'home' ||
|
||||
strpos($_SERVER['SCRIPT_NAME'], '/home/') !== false))
|
||||
{
|
||||
$UserKnowsAboutPwdChange = true;
|
||||
|
@ -415,9 +415,9 @@ class Storage
|
||||
*/
|
||||
function allow_account_edit($user=null)
|
||||
{
|
||||
return $GLOBALS['egw_info']['server']['allow_account_edit'] &&
|
||||
return !empty($GLOBALS['egw_info']['server']['allow_account_edit']) &&
|
||||
array_intersect($GLOBALS['egw_info']['server']['allow_account_edit'],
|
||||
$GLOBALS['egw']->accounts->memberships($user ? $user : $this->user, true));
|
||||
$GLOBALS['egw']->accounts->memberships($user ?: $this->user, true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -591,7 +591,7 @@ class Db
|
||||
$this->setupType = $this->Type;
|
||||
$this->Type = 'mysql';
|
||||
}
|
||||
if ($new_connection)
|
||||
if (!empty($new_connection))
|
||||
{
|
||||
foreach(get_included_files() as $file)
|
||||
{
|
||||
@ -1599,7 +1599,7 @@ class Db
|
||||
{
|
||||
return $array;
|
||||
}
|
||||
if (!$column_definitions)
|
||||
if (empty($column_definitions))
|
||||
{
|
||||
$column_definitions = $this->column_definitions;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ class Pdo
|
||||
// Exception reveals password, so we ignore the exception and connect again without pw, to get the right exception without pw
|
||||
self::$pdo = new \PDO($dsn,$egw_db->User,'$egw_db->Password');
|
||||
}
|
||||
if ($query)
|
||||
if (!empty($query))
|
||||
{
|
||||
self::$pdo->exec($query);
|
||||
}
|
||||
|
@ -117,22 +117,22 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
|
||||
foreach(count(array_filter(array_keys($extras), 'is_int')) ? $extras : array($extras) as $extra)
|
||||
{
|
||||
if ($extra['data'] && is_array($extra['data']))
|
||||
if (!empty($extra['data']) && is_array($extra['data']))
|
||||
{
|
||||
$content = array_merge($content, $extra['data']);
|
||||
}
|
||||
|
||||
if ($extra['preserve'] && is_array($extra['preserve']))
|
||||
if (!empty($extra['preserve']) && is_array($extra['preserve']))
|
||||
{
|
||||
$preserv = array_merge($preserv, $extra['preserve']);
|
||||
}
|
||||
|
||||
if ($extra['readonlys'] && is_array($extra['readonlys']))
|
||||
if (!empty($extra['readonlys']) && is_array($extra['readonlys']))
|
||||
{
|
||||
$readonlys = array_merge($readonlys, $extra['readonlys']);
|
||||
}
|
||||
|
||||
if ($extra['sel_options'] && is_array($extra['sel_options']))
|
||||
if (!empty($extra['sel_options']) && is_array($extra['sel_options']))
|
||||
{
|
||||
$sel_options = array_merge($sel_options, $extra['sel_options']);
|
||||
}
|
||||
@ -177,7 +177,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
}
|
||||
|
||||
// some apps (eg. InfoLog) set app_header only in get_rows depending on filter settings
|
||||
self::$request->app_header = $GLOBALS['egw_info']['flags']['app_header'];
|
||||
self::$request->app_header = $GLOBALS['egw_info']['flags']['app_header'] ?? null;
|
||||
|
||||
// compile required translations translations
|
||||
$currentapp = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
@ -209,7 +209,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
'currentapp' => $currentapp,
|
||||
);
|
||||
|
||||
if($data['content']['nm']['rows'] && is_array($data['content']['nm']['rows']))
|
||||
if (!empty($data['content']['nm']['rows']) && is_array($data['content']['nm']['rows']))
|
||||
{
|
||||
// Deep copy rows so we don't lose them when request is set to null
|
||||
// (some content by reference)
|
||||
@ -420,7 +420,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
}
|
||||
|
||||
$tcontent = is_array($content) ? $content :
|
||||
self::complete_array_merge(self::$request->preserv, $validated);
|
||||
self::complete_array_merge(self::$request->preserv ?? [], $validated);
|
||||
|
||||
$hook_data = Hooks::process(
|
||||
array(
|
||||
|
@ -428,9 +428,9 @@ class Request
|
||||
* @param string $var
|
||||
* @param mixed $val
|
||||
*/
|
||||
public function __set($var,$val)
|
||||
public function __set($var, $val)
|
||||
{
|
||||
if ($this->data[$var] !== $val)
|
||||
if (!isset($this->data[$var]) || $this->data[$var] !== $val)
|
||||
{
|
||||
$this->data[$var] = $val;
|
||||
//error_log(__METHOD__."('$var', ...) data of id=$this->id changed ...");
|
||||
|
@ -98,7 +98,7 @@ class Customfields extends Transformer
|
||||
$form_name = self::form_name($cname, $this->id, $expand);
|
||||
|
||||
// Store properties at top level, so all customfield widgets can share
|
||||
if($this->attrs['app'])
|
||||
if (!empty($this->attrs['app']))
|
||||
{
|
||||
$app = $this->attrs['app'];
|
||||
}
|
||||
@ -141,12 +141,12 @@ class Customfields extends Transformer
|
||||
// app changed
|
||||
$customfields = Api\Storage\Customfields::get($app);
|
||||
}
|
||||
if($this->attrs['customfields'])
|
||||
if (!empty($this->attrs['customfields']))
|
||||
{
|
||||
$customfields = $this->attrs['customfields'];
|
||||
}
|
||||
// Filter fields
|
||||
if($this->attrs['field-names'])
|
||||
if (!empty($this->attrs['field-names']))
|
||||
{
|
||||
$fields_name = explode(',', $this->attrs['field-names']);
|
||||
foreach($fields_name as &$f)
|
||||
@ -162,8 +162,8 @@ class Customfields extends Transformer
|
||||
|
||||
$fields = $customfields;
|
||||
|
||||
$use_private = self::expand_name($this->attrs['use-private'],0,0,'','',self::$cont);
|
||||
$this->attrs['sub-type'] = self::expand_name($this->attrs['sub-type'],0,0,'','',self::$cont);
|
||||
$use_private = self::expand_name($this->attrs['use-private'] ?? null,0,0,'','',self::$cont);
|
||||
$this->attrs['sub-type'] = self::expand_name($this->attrs['sub-type'] ?? null,0,0,'','',self::$cont);
|
||||
|
||||
foreach((array)$fields as $key => $field)
|
||||
{
|
||||
@ -174,7 +174,7 @@ class Customfields extends Transformer
|
||||
}
|
||||
|
||||
// Remove filtered fields
|
||||
if($field_filters && in_array($key, $negate_fields) && in_array($key, $field_filters))
|
||||
if (!empty($field_filters) && in_array($key, $negate_fields) && in_array($key, $field_filters))
|
||||
{
|
||||
unset($fields[$key]);
|
||||
}
|
||||
@ -284,7 +284,7 @@ class Customfields extends Transformer
|
||||
|
||||
$type = $field['type'];
|
||||
// Link-tos needs to change from appname to link-to
|
||||
if($link_types[$field['type']])
|
||||
if (!empty($link_types[$field['type']]))
|
||||
{
|
||||
if($type == 'filemanager')
|
||||
{
|
||||
@ -314,8 +314,8 @@ class Customfields extends Transformer
|
||||
{
|
||||
$widget->attrs['data_format'] = $type == 'date' ? 'Y-m-d' : 'Y-m-d H:i:s';
|
||||
}
|
||||
if($field['values']['min']) $widget->attrs['min'] = $field['values']['min'];
|
||||
if($field['values']['max']) $widget->attrs['min'] = $field['values']['max'];
|
||||
if (isset($field['values']['min'])) $widget->attrs['min'] = $field['values']['min'];
|
||||
if (isset($field['values']['max'])) $widget->attrs['min'] = $field['values']['max'];
|
||||
break;
|
||||
|
||||
case 'vfs-upload':
|
||||
@ -355,7 +355,7 @@ class Customfields extends Transformer
|
||||
$field['values'] = Api\Storage\Customfields::get_options_from_file($field['values']['@']);
|
||||
}
|
||||
// keep extra values set by app code, eg. addressbook advanced search
|
||||
if (is_array(self::$request->sel_options[self::$prefix.$fname]))
|
||||
if (!empty(self::$request->sel_options[self::$prefix.$fname]) && is_array(self::$request->sel_options[self::$prefix.$fname]))
|
||||
{
|
||||
self::$request->sel_options[self::$prefix.$fname] += (array)$field['values'];
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class Description extends Etemplate\Widget
|
||||
*/
|
||||
public function beforeSendToClient($cname, array $expand=null)
|
||||
{
|
||||
if ($this->attrs['activate_links'])
|
||||
if (!empty($this->attrs['activate_links']))
|
||||
{
|
||||
$form_name = self::form_name($cname, $this->id, $expand);
|
||||
$value =& self::get_array(self::$request->content, $form_name);
|
||||
|
@ -36,17 +36,17 @@ class Image extends Etemplate\Widget
|
||||
|
||||
$image = $value != '' ? $value : $this->attrs['src'];
|
||||
|
||||
if (is_string($image)) list($app,$img) = explode('/',$image,2);
|
||||
if (!$app || !$img || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img,'/')!==false)
|
||||
if (is_string($image)) list($app,$img) = explode('/',$image,2)+[null,null];
|
||||
if (empty($app) || empty($img) || !is_dir(EGW_SERVER_ROOT.'/'.$app) || strpos($img,'/')!==false)
|
||||
{
|
||||
$img = $image;
|
||||
list($app) = explode('.',$form_name);
|
||||
}
|
||||
$src = Api\Image::find($app, $img);
|
||||
if(!$this->id)
|
||||
/*if(!$this->id)
|
||||
{
|
||||
// self::setElementAttribute($this->attrs['src'], 'id', $this->attrs['src']);
|
||||
}
|
||||
}*/
|
||||
self::setElementAttribute($this->attrs['src'], 'src', $src);
|
||||
}
|
||||
}
|
||||
|
@ -130,13 +130,13 @@ class Nextmatch extends Etemplate\Widget
|
||||
$send_value = $value;
|
||||
|
||||
list($app) = explode('.',$value['get_rows']);
|
||||
if(!$GLOBALS['egw_info']['apps'][$app])
|
||||
if (empty($GLOBALS['egw_info']['apps'][$app]))
|
||||
{
|
||||
list($app) = explode('.',$this->attrs['template']);
|
||||
}
|
||||
|
||||
// Check for a favorite in URL
|
||||
if($_GET['favorite'] && $value['favorites'])
|
||||
if (!empty($_GET['favorite']) && !empty($value['favorites']))
|
||||
{
|
||||
$safe_name = preg_replace('/[^A-Za-z0-9-_]/','_',strip_tags($_GET['favorite']));
|
||||
$pref_name = "favorite_" .$safe_name;
|
||||
@ -210,7 +210,7 @@ class Nextmatch extends Etemplate\Widget
|
||||
}
|
||||
|
||||
// Favorite group for admins
|
||||
if($GLOBALS['egw_info']['apps']['admin'] && $value['favorites'])
|
||||
if (!empty($GLOBALS['egw_info']['apps']['admin']) && !empty($value['favorites']))
|
||||
{
|
||||
self::$request->sel_options[$form_name]['favorite']['group'] = array('all' => lang('All users')) +
|
||||
Select::typeOptions('select-account',',groups');
|
||||
@ -894,7 +894,7 @@ class Nextmatch extends Etemplate\Widget
|
||||
if ($default_attrs) $action += $default_attrs;
|
||||
|
||||
// Add 'Select All' after first group
|
||||
if ($first_level && $group !== false && $action['group'] != $group && empty($egw_actions[$prefix.'select_all']))
|
||||
if ($first_level && $group !== false && ($action['group']??null) != $group && empty($egw_actions[$prefix.'select_all']))
|
||||
{
|
||||
|
||||
$egw_actions[$prefix.'select_all'] = array(
|
||||
|
@ -49,7 +49,8 @@ class Password extends Etemplate\Widget\Textbox
|
||||
{
|
||||
$form_name = self::form_name($cname, $this->id, $expand);
|
||||
$value =& self::get_array(self::$request->content, $form_name);
|
||||
$plaintext = !in_array(self::expand_name($this->attrs['plaintext'],$expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']),
|
||||
$plaintext = !empty($this->attrs['plaintext']) && !in_array(
|
||||
self::expand_name($this->attrs['plaintext'], $expand['c'] ?? null, $expand['row'] ?? null, $expand['c_'] ?? null, $expand['row_'] ?? null, $expand['cont']),
|
||||
['false', '0']);
|
||||
|
||||
if (!empty($value))
|
||||
|
@ -109,14 +109,14 @@ class Select extends Etemplate\Widget
|
||||
{
|
||||
parent::set_attrs($xml, $cloned);
|
||||
|
||||
if ($this->attrs['multiple'] !== 'dynamic')
|
||||
if (!isset($this->attrs['multiple']) || $this->attrs['multiple'] !== 'dynamic')
|
||||
{
|
||||
$this->attrs['multiple'] = !isset($this->attrs['multiple']) ? false :
|
||||
!(!$this->attrs['multiple'] || $this->attrs['multiple'] === 'false');
|
||||
}
|
||||
|
||||
// set attrs[multiple] from attrs[options], unset options only if it just contains number or rows
|
||||
if ($this->attrs['options'] > 1)
|
||||
if (isset($this->attrs['options']) && $this->attrs['options'] > 1)
|
||||
{
|
||||
$this->attrs['multiple'] = (int)$this->attrs['options'];
|
||||
if ((string)$this->attrs['multiple'] == $this->attrs['options'])
|
||||
@ -124,7 +124,7 @@ class Select extends Etemplate\Widget
|
||||
unset($this->attrs['options']);
|
||||
}
|
||||
}
|
||||
elseif($this->attrs['rows'] > 1)
|
||||
elseif(isset($this->attrs['rows']) && $this->attrs['rows'] > 1)
|
||||
{
|
||||
$this->attrs['multiple'] = true;
|
||||
}
|
||||
@ -311,8 +311,8 @@ class Select extends Etemplate\Widget
|
||||
{
|
||||
$form_name = self::form_name($cname, $this->id, $expand);
|
||||
}
|
||||
if (!is_array(self::$request->sel_options[$form_name])) self::$request->sel_options[$form_name] = array();
|
||||
$type = $this->attrs['type'] ? $this->attrs['type'] : $this->type;
|
||||
if (empty(self::$request->sel_options[$form_name]) || !is_array(self::$request->sel_options[$form_name])) self::$request->sel_options[$form_name] = [];
|
||||
$type = $this->attrs['type'] ?? $this->type;
|
||||
if ($type != 'select' && $type != 'menupopup')
|
||||
{
|
||||
// Check selection preference, we may be able to skip reading some data
|
||||
@ -335,8 +335,8 @@ class Select extends Etemplate\Widget
|
||||
if (!isset($form_names_done[$form_name]) &&
|
||||
($type_options = self::typeOptions($this,
|
||||
// typeOptions thinks # of rows is the first thing in options
|
||||
($this->attrs['rows'] && strpos($this->attrs['options'], $this->attrs['rows']) !== 0 ? $this->attrs['rows'].','.$this->attrs['options'] : $this->attrs['options']),
|
||||
$no_lang, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name), $form_name)))
|
||||
(!empty($this->attrs['rows']) && !empty($this->attrs['options']) && strpos($this->attrs['options'], $this->attrs['rows']) !== 0 ? $this->attrs['rows'].','.$this->attrs['options'] : $this->attrs['options']),
|
||||
$no_lang, $this->attrs['readonly'] ?? false, self::get_array(self::$request->content, $form_name), $form_name)))
|
||||
{
|
||||
self::fix_encoded_options($type_options);
|
||||
|
||||
@ -356,7 +356,7 @@ class Select extends Etemplate\Widget
|
||||
$options = (isset(self::$request->sel_options[$form_name]) ? $form_name : $this->id);
|
||||
if(is_array(self::$request->sel_options[$options]))
|
||||
{
|
||||
if(in_array($this->attrs['type'], self::$cached_types) && !isset($form_names_done[$options]))
|
||||
if (isset($this->attrs['type']) && in_array($this->attrs['type'], self::$cached_types) && !isset($form_names_done[$options]))
|
||||
{
|
||||
// Fix any custom options from application
|
||||
self::fix_encoded_options(self::$request->sel_options[$options],true);
|
||||
@ -561,7 +561,7 @@ class Select extends Etemplate\Widget
|
||||
$field = self::expand_name($field, 0, 0,'','',self::$cont);
|
||||
}
|
||||
|
||||
list($rows,$type,$type2,$type3,$type4,$type5) = $legacy_options;
|
||||
list($rows,$type,$type2,$type3,$type4,$type5) = $legacy_options+[null,null,null,null,null,null];
|
||||
$no_lang = false;
|
||||
$options = array();
|
||||
switch ($widget_type)
|
||||
@ -644,7 +644,7 @@ class Select extends Etemplate\Widget
|
||||
// These are extra info for easy dealing with categories
|
||||
// client side, without extra loading
|
||||
'main' => (int)$cat['main'],
|
||||
'children' => $cat['children'],
|
||||
'children' => $cat['children'] ?? null,
|
||||
//add different class per level to allow different styling for each category level:
|
||||
'class' => "cat_level". $cat['level']
|
||||
);
|
||||
|
@ -68,7 +68,7 @@ class Template extends Etemplate\Widget
|
||||
list($name) = explode('?', $_name); // remove optional cache-buster
|
||||
if (isset(self::$cache[$name]) || !($path = self::relPath($name, $template_set, $version, $load_via)))
|
||||
{
|
||||
if ((!$path || self::read($load_via, $template_set)) && isset(self::$cache[$name]))
|
||||
if ((empty($path) || self::read($load_via, $template_set)) && isset(self::$cache[$name]))
|
||||
{
|
||||
//error_log(__METHOD__."('$name', '$template_set', '$version', '$load_via') read from cache");
|
||||
return self::$cache[$name];
|
||||
@ -146,7 +146,7 @@ class Template extends Etemplate\Widget
|
||||
{
|
||||
static $prefixes = null;
|
||||
unset($version); // not used currently
|
||||
list($app, $rest) = explode('.', $load_via ?: $name, 2);
|
||||
list($app, $rest) = explode('.', $load_via ?: $name, 2)+[null,null];
|
||||
|
||||
if (empty($template_set))
|
||||
{
|
||||
@ -184,7 +184,7 @@ class Template extends Etemplate\Widget
|
||||
$path = $prefix.$path;
|
||||
}
|
||||
//error_log(__METHOD__."('$name', '$template_set') returning ".array2string($path));
|
||||
return $path;
|
||||
return $path ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -243,16 +243,16 @@ class Template extends Etemplate\Widget
|
||||
{
|
||||
$cname =& $params[0];
|
||||
$old_cname = $params[0];
|
||||
if ($this->attrs['content']) $cname = self::form_name($cname, $this->attrs['content'], $params[1]);
|
||||
if (!empty($this->attrs['content'])) $cname = self::form_name($cname, $this->attrs['content'], $params[1]);
|
||||
|
||||
// Check for template from content, and run over it
|
||||
// templates included via template tag have their name to load them from in attribute "template"
|
||||
$expand_name = self::expand_name($this->id ? $this->id : $this->attrs['template'], '','','','',self::$request->content);
|
||||
$expand_name = self::expand_name($this->id ?: $this->attrs['template'], '','','','',self::$request->content);
|
||||
if(!$expand_name && $this->id && $this->attrs['template'])
|
||||
{
|
||||
$expand_name = $this->attrs['template'];
|
||||
}
|
||||
if($this->original_name)
|
||||
if (!empty($this->original_name))
|
||||
{
|
||||
$expand_name = self::expand_name($this->original_name, '','','','',self::$request->content);
|
||||
}
|
||||
|
@ -62,14 +62,14 @@ class Textbox extends Etemplate\Widget
|
||||
parent::set_attrs($xml, $cloned);
|
||||
|
||||
// Legacy handling only
|
||||
// A negative size triggered the HTML readonly attibute, but not etemplate readonly,
|
||||
// A negative size triggered the HTML readonly attribute, but not etemplate readonly,
|
||||
// so you got an input element, but it was not editable.
|
||||
if ($this->attrs['size'] < 0)
|
||||
if (isset($this->attrs['size']) && $this->attrs['size'] < 0)
|
||||
{
|
||||
self::setElementAttribute($this->id, 'size', abs($this->attrs['size']));
|
||||
self::$request->readonlys[$this->id] = false;
|
||||
self::setElementAttribute($this->id, 'readonly', true);
|
||||
trigger_error("Using a negative size to set textbox readonly. " .$this, E_USER_DEPRECATED);
|
||||
//trigger_error("Using a negative size to set textbox readonly. " .$this, E_USER_DEPRECATED);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class Tree extends Etemplate\Widget
|
||||
parent::set_attrs($xml, $cloned);
|
||||
|
||||
// set attrs[multiple] from attrs[options]
|
||||
if ($this->attrs['options'] > 1)
|
||||
if (isset($this->attrs['options']) && (int)$this->attrs['options'] > 1)
|
||||
{
|
||||
self::setElementAttribute($this->id, 'multiple', true);
|
||||
}
|
||||
@ -297,21 +297,21 @@ class Tree extends Etemplate\Widget
|
||||
{
|
||||
$form_name = self::form_name($cname, $this->id);
|
||||
|
||||
if (($templated_path = self::templateImagePath($this->attrs['image_path'])) != $this->attrs['image_path'])
|
||||
if (!empty($this->attrs['image_path']) && ($templated_path = self::templateImagePath($this->attrs['image_path'])) != $this->attrs['image_path'])
|
||||
{
|
||||
self::setElementAttribute($form_name, 'image_path', $this->attrs['image_path'] = $templated_path);
|
||||
//error_log(__METHOD__."() setting templated image-path for $form_name: $templated_path");
|
||||
}
|
||||
|
||||
if (!is_array(self::$request->sel_options[$form_name])) self::$request->sel_options[$form_name] = array();
|
||||
if ($this->attrs['type'])
|
||||
if (empty(self::$request->sel_options[$form_name])) self::$request->sel_options[$form_name] = [];
|
||||
if (!empty($this->attrs['type']))
|
||||
{
|
||||
// += to keep further options set by app code
|
||||
self::$request->sel_options[$form_name] += self::typeOptions($this->attrs['type'], $this->attrs['options'],
|
||||
$no_lang, $this->attrs['readonly'], self::get_array(self::$request->content, $form_name), $form_name);
|
||||
self::$request->sel_options[$form_name] += self::typeOptions($this->attrs['type'], $this->attrs['options'] ?? null,
|
||||
$no_lang, $this->attrs['readonly'] ?? null, self::get_array(self::$request->content, $form_name), $form_name);
|
||||
|
||||
// if no_lang was modified, forward modification to the client
|
||||
if ($no_lang != $this->attr['no_lang'])
|
||||
if (!isset($this->attr['no_lang']) || $no_lang != $this->attr['no_lang'])
|
||||
{
|
||||
self::setElementAttribute($form_name, 'no_lang', $no_lang);
|
||||
}
|
||||
@ -440,7 +440,7 @@ class Tree extends Etemplate\Widget
|
||||
*/
|
||||
public static function typeOptions($widget_type, $legacy_options, &$no_lang=false, $readonly=false, $value=null, $form_name=null)
|
||||
{
|
||||
list($rows,$type,$type2,$type3) = explode(',',$legacy_options);
|
||||
list($rows,$type,$type2,$type3) = explode(',', $legacy_options)+[null,null,null,null];
|
||||
|
||||
$no_lang = false;
|
||||
$options = array();
|
||||
|
@ -37,10 +37,10 @@ class Vfs extends File
|
||||
*/
|
||||
public function beforeSendToClient($cname, $expand = array())
|
||||
{
|
||||
if($this->type == 'vfs-upload' || $this->attrs['type'] == 'vfs-upload')
|
||||
if ($this->type === 'vfs-upload' || !empty($this->attrs['type']) && $this->attrs['type'] === 'vfs-upload')
|
||||
{
|
||||
$form_name = self::form_name($cname, $this->id, $expand ? $expand : array('cont'=>self::$request->content));
|
||||
if($this->attrs['path'])
|
||||
if (!empty($this->attrs['path']))
|
||||
{
|
||||
$path = self::expand_name($this->attrs['path'],$expand['c'], $expand['row'], $expand['c_'], $expand['row_'], $expand['cont']);
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
/**
|
||||
* EGroupware - Framework for Ajax based templates: jdots & Pixelegg
|
||||
*
|
||||
* @link http://www.stylite.de
|
||||
* @link https://www.egroupware.org
|
||||
* @package api
|
||||
* @subpackage framework
|
||||
* @author Andreas Stöckel <as@stylite.de>
|
||||
* @author Ralf Becker <rb@stylite.de>
|
||||
* @author Nathan Gray <ng@stylite.de>
|
||||
* @author Andreas Stöckel
|
||||
* @author Ralf Becker <rb@egroupware.org>
|
||||
* @author Nathan Gray <ng@egroupware.org>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
*/
|
||||
|
||||
@ -16,7 +16,7 @@ namespace EGroupware\Api\Framework;
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Stylite jdots template
|
||||
* Framework for Ajax based templates
|
||||
*/
|
||||
abstract class Ajax extends Api\Framework
|
||||
{
|
||||
@ -88,13 +88,13 @@ abstract class Ajax extends Api\Framework
|
||||
$width = self::DEFAULT_SIDEBAR_WIDTH;
|
||||
|
||||
//Check whether the width had been stored explicitly for the jdots template, use that value
|
||||
if ($GLOBALS['egw_info']['user']['preferences'][$app]['jdotssideboxwidth'])
|
||||
if (!empty($GLOBALS['egw_info']['user']['preferences'][$app]['jdotssideboxwidth']))
|
||||
{
|
||||
$width = (int)$GLOBALS['egw_info']['user']['preferences'][$app]['jdotssideboxwidth'];
|
||||
// error_log(__METHOD__.__LINE__."($app):$width --> reading jdotssideboxwidth");
|
||||
}
|
||||
//Otherwise use the legacy "idotssideboxwidth" value
|
||||
else if ($GLOBALS['egw_info']['user']['preferences'][$app]['idotssideboxwidth'])
|
||||
elseif (!empty($GLOBALS['egw_info']['user']['preferences'][$app]['idotssideboxwidth']))
|
||||
{
|
||||
$width = (int)$GLOBALS['egw_info']['user']['preferences'][$app]['idotssideboxwidth'];
|
||||
// error_log(__METHOD__.__LINE__."($app):$width --> reading idotssideboxwidth");
|
||||
@ -249,7 +249,7 @@ abstract class Ajax extends Api\Framework
|
||||
{
|
||||
if (empty($GLOBALS['egw_info']['flags']['java_script'])) $GLOBALS['egw_info']['flags']['java_script']='';
|
||||
// eT2 sets $GLOBALS['egw_info']['flags']['nonavbar'] === 'popup' for popups, Etemplate::exec($outputmode === 2)
|
||||
$extra['check-framework'] = $_GET['cd'] !== 'no' && $GLOBALS['egw_info']['flags']['nonavbar'] !== 'popup';
|
||||
$extra['check-framework'] = (!isset($_GET['cd']) || $_GET['cd'] !== 'no') && $GLOBALS['egw_info']['flags']['nonavbar'] !== 'popup';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1047,16 +1047,16 @@ abstract class Ajax extends Api\Framework
|
||||
if (self::$footer_done) return; // prevent (multiple) footers
|
||||
self::$footer_done = true;
|
||||
|
||||
if (!isset($GLOBALS['egw_info']['flags']['nofooter']) || !$GLOBALS['egw_info']['flags']['nofooter'])
|
||||
if (empty($GLOBALS['egw_info']['flags']['nofooter']))
|
||||
{
|
||||
if ($no_framework && $GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time'])
|
||||
if ($no_framework && !empty($GLOBALS['egw_info']['user']['preferences']['common']['show_generation_time']))
|
||||
{
|
||||
$vars = $this->_get_footer();
|
||||
$footer = "\n".$vars['page_generation_time']."\n";
|
||||
}
|
||||
}
|
||||
return $footer.
|
||||
$GLOBALS['egw_info']['flags']['need_footer']."\n". // eg. javascript, which need to be at the end of the page
|
||||
return ($footer??'').
|
||||
($GLOBALS['egw_info']['flags']['need_footer']??'')."\n". // eg. javascript, which need to be at the end of the page
|
||||
"</body>\n</html>\n";
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,12 @@ class Bundle
|
||||
unset($GLOBALS['egw_info']['server']['debug_minify']);
|
||||
|
||||
$file2bundle = array();
|
||||
if ($GLOBALS['egw_info']['server']['debug_minify'] !== 'True')
|
||||
if (!isset($GLOBALS['egw_info']['server']['debug_minify']) || $GLOBALS['egw_info']['server']['debug_minify'] !== 'True')
|
||||
{
|
||||
// get used bundles and cache them on tree-level for 2h
|
||||
//$bundles = self::all(); Cache::setTree(__CLASS__, 'bundles', $bundles, 7200);
|
||||
$bundles = Cache::getTree(__CLASS__, 'bundles', array(__CLASS__, 'all'), array(), 7200);
|
||||
$bundles_ts = $bundles['.ts'];
|
||||
$bundles_ts = $bundles['.ts'] ?? null;
|
||||
unset($bundles['.ts']);
|
||||
foreach($bundles as $name => $files)
|
||||
{
|
||||
@ -83,7 +83,7 @@ class Bundle
|
||||
|
||||
if (!isset($to_include[$file]))
|
||||
{
|
||||
if (($bundle = $file2bundle[$file]))
|
||||
if (($bundle = $file2bundle[$file] ?? false))
|
||||
{
|
||||
//error_log(__METHOD__."() requiring bundle $bundle for $file");
|
||||
if (!in_array($bundle, $included_bundles))
|
||||
@ -108,10 +108,10 @@ class Bundle
|
||||
else
|
||||
{
|
||||
unset($query);
|
||||
list($path, $query) = explode('?', $file, 2);
|
||||
list($path, $query) = explode('?', $file, 2)+[null,null];
|
||||
$mod = filemtime(EGW_SERVER_ROOT.$path);
|
||||
// check if we have a more recent minified version of the file and use it
|
||||
if ($GLOBALS['egw_info']['server']['debug_minify'] !== 'True' &&
|
||||
if ((!isset($GLOBALS['egw_info']['server']['debug_minify']) || $GLOBALS['egw_info']['server']['debug_minify'] !== 'True') &&
|
||||
substr($path, -3) == '.js' && file_exists(EGW_SERVER_ROOT.($min_path = substr($path, 0, -3).'.min.js')) &&
|
||||
(($min_mod = filemtime(EGW_SERVER_ROOT.$min_path)) >= $mod))
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ class CssIncludes
|
||||
{
|
||||
foreach(self::resolve_css_includes($path) as $path)
|
||||
{
|
||||
list($file,$query) = explode('?',$path,2);
|
||||
list($file,$query) = explode('?',$path,2)+[null,null];
|
||||
if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod;
|
||||
|
||||
// do NOT include app.css or categories.php, as it changes from app to app
|
||||
|
@ -100,6 +100,7 @@ class Html
|
||||
// use preg_replace_callback as we experienced problems with links such as <www.example.tld/pfad/zu/einer/pdf-Datei.pdf>
|
||||
$result4 = preg_replace_callback( $Expr, function ($match) {
|
||||
//error_log(__METHOD__.__LINE__.array2string($match));
|
||||
$match += [null,null,null,null];
|
||||
if ($match[4]==';' && (strlen($match[3])-4) >=0 && strpos($match[3],'>',strlen($match[3])-4)!==false)
|
||||
{
|
||||
$match[3] = substr($match[3],0,strpos($match[3],'>',strlen($match[3])-4));
|
||||
@ -111,7 +112,7 @@ class Html
|
||||
$match[4] = ">";
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.array2string($match));
|
||||
return $match[1]."<a href=\"http://www".$match[2].$match[3]."\" target=\"_blank\">"."www".$match[2].$match[3]."</a>".$match[4];
|
||||
return $match[1]."<a href=\"https://www".$match[2].$match[3]."\" target=\"_blank\">"."www".$match[2].$match[3]."</a>".$match[4];
|
||||
}, $result3 );
|
||||
}
|
||||
return $result4;
|
||||
|
@ -127,7 +127,7 @@ class Storage
|
||||
{
|
||||
echo "<p>solink.get_links($app,".print_r($id,true).",$only_app,$order,$deleted)</p>\n";
|
||||
}
|
||||
if (($not_only = $only_app[0] == '!'))
|
||||
if (!empty($only_app) && ($not_only = $only_app[0] == '!'))
|
||||
{
|
||||
$only_app = substr($only_app,1);
|
||||
}
|
||||
@ -173,7 +173,7 @@ class Storage
|
||||
catch(Api\Db\Exception $e) {
|
||||
_egw_log_exception($e);
|
||||
}
|
||||
return is_array($id) ? $links : ($links[$id] ? $links[$id] : array());
|
||||
return is_array($id) ? $links : ($links[$id] ?? []);
|
||||
}
|
||||
|
||||
private static function _add2links($row,$left,$only_app,$not_only,array &$links)
|
||||
|
@ -3211,7 +3211,7 @@ class Mail
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.array2string($autoFolderObjects));
|
||||
if (!$isGoogleMail) {
|
||||
$folders = array_merge($inboxFolderObject,$autoFolderObjects,(array)$inboxSubFolderObjects,(array)$folders,(array)$typeFolderObject['others'] ?? [],(array)$typeFolderObject['shared'] ?? []);
|
||||
$folders = array_merge($inboxFolderObject,$autoFolderObjects,(array)$inboxSubFolderObjects,(array)$folders,(array)($typeFolderObject['others'] ?? []),(array)($typeFolderObject['shared'] ?? []));
|
||||
} else {
|
||||
// avoid calling sortByAutoFolder as it is not regarding subfolders
|
||||
$gAutoFolderObjectsTmp = $googleAutoFolderObjects;
|
||||
|
@ -549,7 +549,7 @@ class Account implements \ArrayAccess
|
||||
$row = array_merge($row, Credentials::from_session($row));
|
||||
}
|
||||
// fill an empty ident_realname or ident_email of current user with data from user account
|
||||
if ($replace_placeholders && (!isset($user) || $user == $GLOBALS['egw_info']['user']['acount_id']))
|
||||
if ($replace_placeholders && (!isset($user) || $user == $GLOBALS['egw_info']['user']['account_id']))
|
||||
{
|
||||
if (empty($row['ident_realname'])) $row['ident_realname'] = $GLOBALS['egw_info']['user']['account_fullname'];
|
||||
if (empty($row['ident_email'])) $row['ident_email'] = $GLOBALS['egw_info']['user']['account_email'];
|
||||
|
@ -169,7 +169,7 @@ class Html
|
||||
if ($addbracesforendtag === true )
|
||||
{
|
||||
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
|
||||
@ -495,7 +495,7 @@ class Html
|
||||
$html = preg_replace('/&(?!#?[a-zA-Z0-9]+;)/', '&', $html);
|
||||
|
||||
$dom = new \DOMDocument('1.0','UTF-8');
|
||||
if(!$dom->loadHTML(
|
||||
if (!@$dom->loadHTML(
|
||||
'<?xml encoding="UTF-8">'. Api\Translation::convert($html,preg_match('/<meta[^>]+content="[^>"]+charset=([^;"]+)/i', $html, $matches) ? $matches[1] : false, 'utf8'),
|
||||
LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD | LIBXML_NOBLANKS
|
||||
))
|
||||
|
@ -360,8 +360,8 @@ class Imap extends Horde_Imap_Client_Socket implements Imap\PushIface
|
||||
*/
|
||||
static function getTimeOut($_use='IMAP')
|
||||
{
|
||||
$timeout = $GLOBALS['egw_info']['user']['preferences']['mail']['connectionTimeout'];
|
||||
if (empty($timeout) || !($timeout > 0)) $timeout = $_use == 'SIEVE' ? 10 : 20; // this is the default value
|
||||
if (empty($timeout = $GLOBALS['egw_info']['user']['preferences']['mail']['connectionTimeout']) || !((int)$timeout > 0))
|
||||
$timeout = $_use == 'SIEVE' ? 10 : 20; // this is the default value
|
||||
return $timeout;
|
||||
}
|
||||
|
||||
@ -742,7 +742,7 @@ class Imap extends Horde_Imap_Client_Socket implements Imap\PushIface
|
||||
* @param string $returnAttributes true means return an assoc array containing mailbox names and mailbox attributes
|
||||
* false - the default - means return an array of mailboxes with only selected attributes like delimiter
|
||||
*
|
||||
* @return mixed array of mailboxes
|
||||
* @return ?array array of mailboxes or null
|
||||
*/
|
||||
function listSubscribedMailboxes($reference = '' , $restriction_search = 0, $returnAttributes = false)
|
||||
{
|
||||
@ -794,10 +794,10 @@ class Imap extends Horde_Imap_Client_Socket implements Imap\PushIface
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?$box['delimiter']:$this->getDelimiter('personal')),'SUBSCRIBED'=>true);
|
||||
$ret[$k]=array('MAILBOX'=>$k,'ATTRIBUTES'=>$box['attributes'],'delimiter'=>($box['delimiter']?:$this->getDelimiter('personal')),'SUBSCRIBED'=>true);
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
return $ret ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ class Notifications
|
||||
$account_specific = 0;
|
||||
foreach($rows as $row)
|
||||
{
|
||||
if ($row['account_id'])
|
||||
if (!empty($row['account_id']))
|
||||
{
|
||||
$account_specific = $row['account_id'];
|
||||
}
|
||||
@ -82,7 +82,7 @@ class Notifications
|
||||
{
|
||||
self::$cache[$acc_id][$row['account_id']][] = $row['notif_folder'];
|
||||
} // make sure set the account_specific correctly when notify_folder gets removed
|
||||
elseif (!$row['account_id'] && !is_array($account_id) && is_array($rows[$account_id]))
|
||||
elseif (empty($row['account_id']) && !is_array($account_id) && is_array($rows[$account_id]))
|
||||
{
|
||||
$account_specific = $account_id;
|
||||
}
|
||||
|
@ -150,10 +150,10 @@ class Script
|
||||
$rule['anyof'] = ($bits[8] & $anyofbit);
|
||||
$rule['keep'] = ($bits[8] & $keepbit);
|
||||
$rule['regexp'] = ($bits[8] & $regexbit);
|
||||
$rule['bodytransform'] = ($bits[12]);
|
||||
$rule['field_bodytransform'] = ($bits[13]);
|
||||
$rule['ctype'] = ($bits[14]);
|
||||
$rule['field_ctype_val'] = ($bits[15]);
|
||||
$rule['bodytransform'] = ($bits[12]??null);
|
||||
$rule['field_bodytransform'] = ($bits[13]??null);
|
||||
$rule['ctype'] = ($bits[14]??null);
|
||||
$rule['field_ctype_val'] = ($bits[15]??null);
|
||||
$rule['unconditional'] = 0;
|
||||
if (!$rule['from'] && !$rule['to'] && !$rule['subject'] &&
|
||||
!$rule['field'] && !$rule['size'] && $rule['action']) {
|
||||
@ -188,7 +188,7 @@ class Script
|
||||
}
|
||||
$vacation['addresses'] = &$vaddresses;
|
||||
|
||||
$vacation['forwards'] = $bits[5];
|
||||
$vacation['forwards'] = $bits[5]??null;
|
||||
}
|
||||
break;
|
||||
case "notify":
|
||||
|
@ -94,7 +94,7 @@ class Sql extends Mail\Smtp
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($this->debug) error_log(__METHOD__."('$_accountName') returning ".array2string($emailAddresses));
|
||||
if (!empty($this->debug)) error_log(__METHOD__."('$_accountName') returning ".array2string($emailAddresses));
|
||||
|
||||
return $emailAddresses;
|
||||
}
|
||||
@ -191,7 +191,7 @@ class Sql extends Mail\Smtp
|
||||
case self::TYPE_MAILBOX:
|
||||
$userData['mailMessageStore'] = $row['mail_value'];
|
||||
//error_log(__METHOD__."('$user') row=".array2string($row).', enabled[$row[account_id]]='.array2string($enabled[$row['account_id']]).', forwardOnly[$row[account_id]]='.array2string($forwardOnly[$row['account_id']]));
|
||||
if ($row['account_id'] > 0 && $enabled[$row['account_id']] && !$forwardOnly[$row['account_id']])
|
||||
if ($row['account_id'] > 0 && !empty($enabled[$row['account_id']]) && empty($forwardOnly[$row['account_id']]))
|
||||
{
|
||||
$userData['uid'][] = $this->accounts->id2name($row['account_id'], 'account_lid');
|
||||
$userData['mailbox'][] = $row['mail_value'];
|
||||
@ -218,7 +218,7 @@ class Sql extends Mail\Smtp
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($this->debug) error_log(__METHOD__."('$user') returning ".array2string($userData));
|
||||
if (!empty($this->debug)) error_log(__METHOD__."('$user') returning ".array2string($userData));
|
||||
|
||||
return $userData;
|
||||
}
|
||||
@ -240,7 +240,7 @@ class Sql extends Mail\Smtp
|
||||
function setUserData($_uidnumber, array $_mailAlternateAddress, array $_mailForwardingAddress, $_deliveryMode,
|
||||
$_accountStatus, $_mailLocalAddress, $_quota, $_forwarding_only=false, $_setMailbox=null)
|
||||
{
|
||||
if ($this->debug) error_log(__METHOD__."($_uidnumber, ".array2string($_mailAlternateAddress).', '.array2string($_mailForwardingAddress).", '$_deliveryMode', '$_accountStatus', '$_mailLocalAddress', $_quota, forwarding_only=".array2string($_forwarding_only).') '.function_backtrace());
|
||||
if (!empty($this->debug)) error_log(__METHOD__."($_uidnumber, ".array2string($_mailAlternateAddress).', '.array2string($_mailForwardingAddress).", '$_deliveryMode', '$_accountStatus', '$_mailLocalAddress', $_quota, forwarding_only=".array2string($_forwarding_only).') '.function_backtrace());
|
||||
|
||||
if (!$_forwarding_only && $this->accounts->id2name($_uidnumber, 'account_email') !== $_mailLocalAddress)
|
||||
{
|
||||
|
@ -564,7 +564,7 @@ class Mailer extends Horde_Mime_Mail
|
||||
if (!isset($flowed)) $flowed = $this->_body && !in_array($this->_body->getType(), array('multipart/encrypted', 'multipart/signed'));
|
||||
|
||||
// check if flowed is disabled in mail site configuration
|
||||
if (($config = Config::read('mail')) && $config['disable_rfc3676_flowed'])
|
||||
if (($config = Config::read('mail')) && !empty($config['disable_rfc3676_flowed']))
|
||||
{
|
||||
$flowed = false;
|
||||
}
|
||||
@ -616,7 +616,7 @@ class Mailer extends Horde_Mime_Mail
|
||||
}
|
||||
|
||||
// log mails to file specified in $GLOBALS['egw_info']['server']['log_mail'] or error_log for true
|
||||
if ($GLOBALS['egw_info']['server']['log_mail'])
|
||||
if (!empty($GLOBALS['egw_info']['server']['log_mail']))
|
||||
{
|
||||
$msg = $GLOBALS['egw_info']['server']['log_mail'] !== true ? date('Y-m-d H:i:s')."\n" : '';
|
||||
$msg .= (!isset($e) ? 'Mail send' : 'Mail NOT send').
|
||||
@ -732,7 +732,7 @@ class Mailer extends Horde_Mime_Mail
|
||||
$recipients->add($h->getAddressList());
|
||||
}
|
||||
}
|
||||
if ($this->_bcc) {
|
||||
if (!empty($this->_bcc)) {
|
||||
$recipients->add($this->_bcc);
|
||||
}
|
||||
|
||||
|
@ -1538,7 +1538,7 @@ class Session
|
||||
}
|
||||
|
||||
// check if the url already contains a query and ensure that vars is an array and all strings are in extravars
|
||||
if (strpos($ret_url=$url, '?') !== false) list($ret_url,$othervars) = explode('?', $url, 2)+[null,null];
|
||||
list($ret_url,$othervars) = explode('?', $url, 2)+[null,null];
|
||||
if ($extravars && is_array($extravars))
|
||||
{
|
||||
$vars += $extravars;
|
||||
|
@ -636,13 +636,13 @@ abstract class Tracking
|
||||
{
|
||||
//error_log(__METHOD__."() data[$this->assigned_field]=".print_r($data[$this->assigned_field],true).", old[$this->assigned_field]=".print_r($old[$this->assigned_field],true));
|
||||
$old_assignees = array();
|
||||
$assignees = $assigned ? $assigned : array();
|
||||
if ($data[$this->assigned_field]) // current assignments
|
||||
$assignees = $assigned ?? array();
|
||||
if (!empty($data[$this->assigned_field])) // current assignments
|
||||
{
|
||||
$assignees = is_array($data[$this->assigned_field]) ?
|
||||
$data[$this->assigned_field] : explode(',',$data[$this->assigned_field]);
|
||||
}
|
||||
if ($old && $old[$this->assigned_field])
|
||||
if ($old && !empty($old[$this->assigned_field]))
|
||||
{
|
||||
$old_assignees = is_array($old[$this->assigned_field]) ?
|
||||
$old[$this->assigned_field] : explode(',',$old[$this->assigned_field]);
|
||||
@ -1127,18 +1127,18 @@ abstract class Tracking
|
||||
//if ($modified) error_log("data[$name]=".print_r($data[$name],true).", old[$name]=".print_r($old[$name],true)." --> modified=".(int)$modified);
|
||||
if (empty($detail['value']) && !$modified) continue; // skip unchanged, empty values
|
||||
|
||||
$body .= $this->format_line($html_email,$detail['type'],$modified,
|
||||
$detail['label'] ? $detail['label'] : '', $detail['value']);
|
||||
$body .= $this->format_line($html_email, $detail['type'] ?? null, $modified,
|
||||
$detail['label'] ?? '', $detail['value']);
|
||||
}
|
||||
if ($html_email)
|
||||
{
|
||||
$body .= "</table>\n";
|
||||
}
|
||||
if(($sig = $this->get_signature($data,$old,$receiver)))
|
||||
if (($sig = $this->get_signature($data,$old,$receiver)))
|
||||
{
|
||||
$body .= ($html_email ? '<br />':'') . "\n$sig";
|
||||
}
|
||||
if (!$html_email && $data['tr_edit_mode'] == 'html')
|
||||
if (!$html_email && isset($data['tr_edit_mode']) && $data['tr_edit_mode'] === 'html')
|
||||
{
|
||||
$body = Api\Mail\Html::convertHTMLToText($body);
|
||||
}
|
||||
@ -1271,7 +1271,7 @@ abstract class Tracking
|
||||
$merge_class = $this->app.'_merge';
|
||||
$merge = new $merge_class();
|
||||
$error = null;
|
||||
$sig = $merge->merge_string($config['signature'], array($data[$this->id_field]), $error, 'text/html');
|
||||
$sig = $merge->merge_string($config['signature']??null, array($data[$this->id_field]), $error, 'text/html');
|
||||
if($error)
|
||||
{
|
||||
error_log($error);
|
||||
|
@ -335,21 +335,20 @@ class Base
|
||||
$url = str_replace($matches[0], $matches[1] . Vfs::concat($matches[2], substr($parts['path'], strlen($mounted))), $url);
|
||||
}
|
||||
|
||||
if($replace_user_pass_host)
|
||||
if ($replace_user_pass_host)
|
||||
{
|
||||
$url = str_replace(array('$user',
|
||||
'$pass',
|
||||
'$host',
|
||||
'$home'), array($parts['user'],
|
||||
$parts['pass'],
|
||||
$parts['host'],
|
||||
$parts['home']), $url);
|
||||
$url = strtr($url, [
|
||||
'$user' => $parts['user'],
|
||||
'$pass' => $parts['pass'],
|
||||
'$host' => $parts['host'],
|
||||
'$home' => $parts['home'],
|
||||
]);
|
||||
}
|
||||
if($parts['query'])
|
||||
if (isset($parts['query']))
|
||||
{
|
||||
$url .= '?' . $parts['query'];
|
||||
}
|
||||
if($parts['fragment'])
|
||||
if (isset($parts['fragment']))
|
||||
{
|
||||
$url .= '#' . $parts['fragment'];
|
||||
}
|
||||
@ -657,7 +656,7 @@ class Base
|
||||
return false;
|
||||
}
|
||||
$k = (string)Vfs::parse_url($url, PHP_URL_SCHEME);
|
||||
if(!(is_array($scheme2urls[$k])))
|
||||
if (!isset($scheme2urls[$k]))
|
||||
{
|
||||
$scheme2urls[$k] = array();
|
||||
}
|
||||
|
@ -798,11 +798,11 @@ class StreamWrapper extends Base implements StreamWrapperIface
|
||||
{
|
||||
$stat['url'] = $url;
|
||||
}
|
||||
if (($stat['mode'] & 0222) && self::url_is_readonly($stat['url']))
|
||||
if ($stat && ($stat['mode'] & 0222) && self::url_is_readonly($stat['url']))
|
||||
{
|
||||
$stat['mode'] &= ~0222;
|
||||
}
|
||||
if($stat['url'] && $query && strpos($stat['url'],'?'.$query)===false)
|
||||
if ($stat && $stat['url'] && $query && strpos($stat['url'],'?'.$query) === false)
|
||||
{
|
||||
$stat['url'] .= '?'.$query;
|
||||
}
|
||||
@ -998,7 +998,7 @@ class StreamWrapper extends Base implements StreamWrapperIface
|
||||
}
|
||||
else
|
||||
{
|
||||
$vfs_fstab = $GLOBALS['egw_info']['user']['preferences']['common']['vfs_fstab'];
|
||||
$vfs_fstab = $GLOBALS['egw_info']['user']['preferences']['common']['vfs_fstab'] ?? [];
|
||||
}
|
||||
if (!empty($vfs_fstab) && is_array($vfs_fstab))
|
||||
{
|
||||
|
@ -228,7 +228,7 @@ class infolog_bo
|
||||
{
|
||||
foreach(array_keys($config_data['status']) as $key)
|
||||
{
|
||||
if (!is_array($this->status[$key]))
|
||||
if (!isset($this->status[$key]) || !is_array($this->status[$key]))
|
||||
{
|
||||
$this->status[$key] = array();
|
||||
}
|
||||
@ -262,17 +262,17 @@ class infolog_bo
|
||||
$save_config = true;
|
||||
}
|
||||
}
|
||||
if ($save_config) Api\Config::save_value('customfields',$this->customfields,'infolog');
|
||||
if (!empty($save_config)) Api\Config::save_value('customfields',$this->customfields,'infolog');
|
||||
}
|
||||
if (is_array($config_data['responsible_edit']))
|
||||
if (isset($config_data['responsible_edit']) && is_array($config_data['responsible_edit']))
|
||||
{
|
||||
$this->responsible_edit = array_merge($this->responsible_edit,$config_data['responsible_edit']);
|
||||
}
|
||||
if (is_array($config_data['copy_excludefields']))
|
||||
if (isset($config_data['copy_excludefields']) && is_array($config_data['copy_excludefields']))
|
||||
{
|
||||
$this->copy_excludefields = array_merge($this->copy_excludefields,$config_data['copy_excludefields']);
|
||||
}
|
||||
if (is_array($config_data['sub_excludefields']) && $config_data['sub_excludefields'])
|
||||
if (!empty($config_data['sub_excludefields']) && is_array($config_data['sub_excludefields']))
|
||||
{
|
||||
$this->sub_excludefields = array_merge($this->sub_excludefields,$config_data['sub_excludefields']);
|
||||
}
|
||||
@ -286,7 +286,7 @@ class infolog_bo
|
||||
}
|
||||
$this->history = $config_data['history'];
|
||||
|
||||
$this->limit_modified_n_month = $config_data['limit_modified_n_month'];
|
||||
$this->limit_modified_n_month = $config_data['limit_modified_n_month'] ?? null;
|
||||
}
|
||||
// sort types by there translation
|
||||
foreach($this->enums['type'] as $key => $val)
|
||||
@ -629,12 +629,14 @@ class infolog_bo
|
||||
|
||||
if (!$info_id || ($data = $this->so->read($info_id)) === False)
|
||||
{
|
||||
return null;
|
||||
$null = null;
|
||||
return $null;
|
||||
}
|
||||
|
||||
if (!$ignore_acl && !$this->check_access($data,Acl::READ)) // check behind read, to prevent a double read
|
||||
{
|
||||
return False;
|
||||
$false = False;
|
||||
return $false;
|
||||
}
|
||||
|
||||
if ($data['info_subject'] == $this->subject_from_des($data['info_des']))
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - Infolog - importexport
|
||||
* EGroupware - InfoLog - importexport
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package infolog
|
||||
@ -8,13 +8,12 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @copyright Nathan Gray
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* class infolog_egw_record
|
||||
*
|
||||
* compability layer for iface_egw_record needet for importexport
|
||||
* compatibility layer for iface_egw_record needed for importexport
|
||||
*/
|
||||
class infolog_egw_record implements importexport_iface_egw_record
|
||||
{
|
||||
@ -53,7 +52,7 @@ class infolog_egw_record implements importexport_iface_egw_record
|
||||
* @param string $_attribute_name
|
||||
*/
|
||||
public function __get($_attribute_name) {
|
||||
return $this->record[$_attribute_name];
|
||||
return $this->record[$_attribute_name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,7 +138,7 @@ class infolog_merge extends Api\Storage\Merge
|
||||
// Set any missing custom fields, or the marker will stay
|
||||
foreach($this->bo->customfields as $name => $field)
|
||||
{
|
||||
if(!$array['#'.$name])
|
||||
if (empty($array['#'.$name]))
|
||||
{
|
||||
$array['#'.$name] = '';
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ class infolog_tracking extends Api\Storage\Tracking
|
||||
*/
|
||||
function get_subject($data, $old, $deleted = null, $receiver = null)
|
||||
{
|
||||
if ($data['prefix'])
|
||||
if (!empty($data['prefix']))
|
||||
{
|
||||
$prefix = $data['prefix']; // async notification
|
||||
}
|
||||
@ -172,7 +172,7 @@ class infolog_tracking extends Api\Storage\Tracking
|
||||
*/
|
||||
function get_message($data, $old, $receiver = null)
|
||||
{
|
||||
if ($data['message']) return $data['message']; // async notification
|
||||
if (!empty($data['message'])) return $data['message']; // async notification
|
||||
|
||||
if (!$old || $old['info_status'] == 'deleted')
|
||||
{
|
||||
@ -345,16 +345,16 @@ class infolog_tracking extends Api\Storage\Tracking
|
||||
return '';
|
||||
}
|
||||
// Per-type notification
|
||||
$type_config = $info_config[self::CUSTOM_NOTIFICATION][$data['info_type']];
|
||||
$type_config = $info_config[self::CUSTOM_NOTIFICATION][$data['info_type']] ?? null;
|
||||
$global = $info_config[self::CUSTOM_NOTIFICATION]['~global~'];
|
||||
|
||||
// Disabled
|
||||
if(!$type_config['use_custom'] && !$global['use_custom']) return '';
|
||||
if(empty($type_config['use_custom']) && empty($global['use_custom'])) return '';
|
||||
|
||||
// Type or globabl
|
||||
// Type or global
|
||||
$config = trim(strip_tags($type_config['message'])) != '' && $type_config['use_custom'] ? $type_config['message'] : $global['message'];
|
||||
break;
|
||||
}
|
||||
return $config;
|
||||
return $config ?? null;
|
||||
}
|
||||
}
|
||||
|
@ -1874,7 +1874,7 @@ class infolog_ui
|
||||
|
||||
$content['link_to']['to_app'] = 'infolog';
|
||||
$content['link_to']['to_id'] = $info_id;
|
||||
|
||||
/* $info_link_id is never defined
|
||||
if ($info_link_id && strpos($info_link_id,':') !== false) // updating info_link_id if necessary
|
||||
{
|
||||
list($app,$id) = explode(':',$info_link_id);
|
||||
@ -1903,7 +1903,7 @@ class infolog_ui
|
||||
// we need eg. the new modification date, for further updates
|
||||
$content = array_merge($content,$to_write);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Need to purge description history after encryption?
|
||||
if($content['clean_history'])
|
||||
@ -2115,7 +2115,7 @@ class infolog_ui
|
||||
// remove types owned by groups the user has no edit grant (current type is made readonly)
|
||||
foreach($this->bo->group_owners as $type => $group)
|
||||
{
|
||||
if (!($this->bo->grants[$group] & Acl::EDIT))
|
||||
if (!(($this->bo->grants[$group]??0) & Acl::EDIT))
|
||||
{
|
||||
if ($type == $content['info_type'])
|
||||
{
|
||||
@ -2172,7 +2172,7 @@ class infolog_ui
|
||||
$readonlys['action'] = true;
|
||||
}
|
||||
// ToDo: use the old status before the delete
|
||||
if ($info_id && $undelete)
|
||||
if ($info_id && !empty($undelete))
|
||||
{
|
||||
$content['info_status'] = $this->bo->status['defaults'][$content['info_type']];
|
||||
$this->tmpl->setElementAttribute('button[save]', 'label', 'Un-Delete');
|
||||
@ -2187,7 +2187,7 @@ class infolog_ui
|
||||
// use a typ-specific template (infolog.edit.xyz), if one exists, otherwise fall back to the generic one
|
||||
if (!$this->tmpl->read('infolog.edit.'.$content['info_type']))
|
||||
{
|
||||
$this->tmpl->read($print ? 'infolog.edit.print':'infolog.edit');
|
||||
$this->tmpl->read(!empty($print) ? 'infolog.edit.print' : 'infolog.edit');
|
||||
}
|
||||
if ($this->bo->has_customfields($content['info_type']))
|
||||
{
|
||||
@ -2252,7 +2252,7 @@ class infolog_ui
|
||||
$tracking = new infolog_tracking($this);
|
||||
foreach($tracking->field2history as $field => $history)
|
||||
{
|
||||
$history_stati[$history] = $tracking->field2label[$field];
|
||||
$history_stati[$history] = $tracking->field2label[$field] ?? null;
|
||||
}
|
||||
// Modified date removed from field2history, we don't need that in the history
|
||||
$history_stati['Mo'] = $tracking->field2label['info_datemodified'];
|
||||
@ -2276,20 +2276,20 @@ class infolog_ui
|
||||
'to_tracker' => array('label' => 'Tracker', 'title' => 'Convert to a ticket'),
|
||||
),
|
||||
);
|
||||
if ($GLOBALS['egw_info']['user']['apps']['calendar'])
|
||||
if (!empty($GLOBALS['egw_info']['user']['apps']['calendar']))
|
||||
{
|
||||
$sel_options['action']['schedule'] = array('label' => 'Schedule', 'title' => 'Schedule appointment');
|
||||
}
|
||||
if ($GLOBALS['egw_info']['user']['apps']['stylite'] && !$GLOBALS['egw_info']['server']['disable_pgp_encryption'])
|
||||
if (!empty($GLOBALS['egw_info']['user']['apps']['stylite']) && empty($GLOBALS['egw_info']['server']['disable_pgp_encryption']))
|
||||
{
|
||||
$content['encryption_ts'] = filemtime(EGW_SERVER_ROOT.'/stylite/js/app.js');
|
||||
}
|
||||
elseif ($GLOBALS['egw_info']['server']['disable_pgp_encryption'])
|
||||
elseif (!empty($GLOBALS['egw_info']['server']['disable_pgp_encryption']))
|
||||
{
|
||||
$readonlys['encrypt'] = true;
|
||||
}
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.
|
||||
($content['status_only'] ? lang('Edit Status') : lang('Edit'));
|
||||
(!empty($content['status_only']) ? lang('Edit Status') : lang('Edit'));
|
||||
$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd'));
|
||||
//error_log(substr($content['info_des'],1793,10));
|
||||
//$content['info_des'] = substr($content['info_des'],0,1793);
|
||||
|
@ -216,7 +216,7 @@ class mail_compose
|
||||
|
||||
);
|
||||
$acc_smime = Mail\Smime::get_acc_smime($content['mailaccount']);
|
||||
if ($acc_smime['acc_smime_password'])
|
||||
if ($acc_smime && !empty($acc_smime['acc_smime_password']))
|
||||
{
|
||||
$actions = array_merge($actions, array(
|
||||
'smime_sign' => array (
|
||||
@ -271,9 +271,9 @@ class mail_compose
|
||||
}
|
||||
unset($actions['pgp']);
|
||||
}
|
||||
if ($GLOBALS['egw_info']['server']['disable_pgp_encryption']) unset($actions['pgp']);
|
||||
if (!empty($GLOBALS['egw_info']['server']['disable_pgp_encryption'])) unset($actions['pgp']);
|
||||
// remove vfs actions if the user has no run access to filemanager
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['filemanager'])
|
||||
if (empty($GLOBALS['egw_info']['user']['apps']['filemanager']))
|
||||
{
|
||||
unset($actions['save2vfs']);
|
||||
unset($actions['selectFromVFSForCompose']);
|
||||
@ -1242,16 +1242,16 @@ class mail_compose
|
||||
// address stuff like from, to, cc, replyto
|
||||
$destinationRows = 0;
|
||||
foreach(self::$destinations as $destination) {
|
||||
if (!is_array($content[$destination]))
|
||||
if (!empty($content[$destination]) && !is_array($content[$destination]))
|
||||
{
|
||||
if (!empty($content[$destination])) $content[$destination] = (array)$content[$destination];
|
||||
$content[$destination] = (array)$content[$destination];
|
||||
}
|
||||
$addr_content = $content[strtolower($destination)];
|
||||
$addr_content = $content[strtolower($destination)] ?? [];
|
||||
// we clear the given address array and rebuild it
|
||||
unset($content[strtolower($destination)]);
|
||||
foreach((array)$addr_content as $key => $value) {
|
||||
if ($value=="NIL@NIL") continue;
|
||||
if ($destination=='replyto' && str_replace('"','',$value) ==
|
||||
foreach($addr_content as $value) {
|
||||
if ($value === "NIL@NIL") continue;
|
||||
if ($destination === 'replyto' && str_replace('"','',$value) ===
|
||||
str_replace('"','',$identities[$this->mail_bo->getDefaultIdentity()]))
|
||||
{
|
||||
// preserve/restore the value to content.
|
||||
@ -1261,7 +1261,7 @@ class mail_compose
|
||||
//error_log(__METHOD__.__LINE__.array2string(array('key'=>$key,'value'=>$value)));
|
||||
$value = str_replace("\"\"",'"', htmlspecialchars_decode($value, ENT_COMPAT));
|
||||
foreach(Mail::parseAddressList($value) as $addressObject) {
|
||||
if ($addressObject->host == '.SYNTAX-ERROR.') continue;
|
||||
if ($addressObject->host === '.SYNTAX-ERROR.') continue;
|
||||
$address = imap_rfc822_write_address($addressObject->mailbox,$addressObject->host,$addressObject->personal);
|
||||
//$address = Mail::htmlentities($address, $this->displayCharset);
|
||||
$content[strtolower($destination)][]=$address;
|
||||
@ -1289,7 +1289,7 @@ class mail_compose
|
||||
$content['mail_'.($content['mimeType'] == 'html'?'html':'plain').'text'] =$content['body'];
|
||||
$content['showtempname']=0;
|
||||
//if (is_array($content['attachments']))error_log(__METHOD__.__LINE__.'before merging content with uploadforCompose:'.array2string($content['attachments']));
|
||||
$content['attachments']=(is_array($content['attachments'])&&is_array($content['uploadForCompose'])?array_merge($content['attachments'],(!empty($content['uploadForCompose'])?$content['uploadForCompose']:array())):(is_array($content['uploadForCompose'])?$content['uploadForCompose']:(is_array($content['attachments'])?$content['attachments']:null)));
|
||||
$content['attachments'] = array_merge($content['attachments'] ?? [], $content['uploadForCompose'] ?? []);
|
||||
//if (is_array($content['attachments'])) foreach($content['attachments'] as $k => &$file) $file['delete['.$file['tmp_name'].']']=0;
|
||||
$content['no_griddata'] = empty($content['attachments']);
|
||||
$preserv['attachments'] = $content['attachments'];
|
||||
@ -1297,21 +1297,21 @@ class mail_compose
|
||||
|
||||
//if (is_array($content['attachments']))error_log(__METHOD__.__LINE__.' Attachments:'.array2string($content['attachments']));
|
||||
// if no filemanager -> no vfsFileSelector
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['filemanager'])
|
||||
if (empty($GLOBALS['egw_info']['user']['apps']['filemanager']))
|
||||
{
|
||||
$content['vfsNotAvailable'] = "mail_DisplayNone";
|
||||
}
|
||||
// if no infolog -> no save as infolog
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['infolog'])
|
||||
if (empty($GLOBALS['egw_info']['user']['apps']['infolog']))
|
||||
{
|
||||
$content['noInfologAvailable'] = "mail_DisplayNone";
|
||||
}
|
||||
// if no tracker -> no save as tracker
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['tracker'])
|
||||
if (empty($GLOBALS['egw_info']['user']['apps']['tracker']))
|
||||
{
|
||||
$content['noTrackerAvailable'] = "mail_DisplayNone";
|
||||
}
|
||||
if (!$GLOBALS['egw_info']['user']['apps']['infolog'] && !$GLOBALS['egw_info']['user']['apps']['tracker'])
|
||||
if (empty($GLOBALS['egw_info']['user']['apps']['infolog']) && empty($GLOBALS['egw_info']['user']['apps']['tracker']))
|
||||
{
|
||||
$content['noSaveAsAvailable'] = "mail_DisplayNone";
|
||||
}
|
||||
@ -1324,12 +1324,12 @@ class mail_compose
|
||||
$sel_options['mimeType'] = self::$mimeTypes;
|
||||
$sel_options['priority'] = self::$priorities;
|
||||
$sel_options['filemode'] = Vfs\Sharing::$modes;
|
||||
if (!isset($content['priority']) || empty($content['priority'])) $content['priority']=3;
|
||||
if (empty($content['priority'])) $content['priority']=3;
|
||||
//$GLOBALS['egw_info']['flags']['currentapp'] = 'mail';//should not be needed
|
||||
$etpl = new Etemplate('mail.compose');
|
||||
|
||||
$etpl->setElementAttribute('composeToolbar', 'actions', self::getToolbarActions($content));
|
||||
if ($content['mimeType']=='html')
|
||||
if ($content['mimeType'] === 'html')
|
||||
{
|
||||
//mode="$cont[rtfEditorFeatures]" validation_rules="$cont[validation_rules]" base_href="$cont[upload_dir]"
|
||||
$_htmlConfig = Mail::$htmLawed_config;
|
||||
@ -1340,7 +1340,7 @@ class mail_compose
|
||||
Mail::$htmLawed_config = $_htmlConfig;
|
||||
}
|
||||
|
||||
if (isset($content['composeID'])&&!empty($content['composeID']))
|
||||
if (!empty($content['composeID']))
|
||||
{
|
||||
$composeCache = $content;
|
||||
unset($composeCache['body']);
|
||||
@ -1348,23 +1348,23 @@ class mail_compose
|
||||
unset($composeCache['mail_plaintext']);
|
||||
Api\Cache::setCache(Api\Cache::SESSION,'mail','composeCache'.trim($GLOBALS['egw_info']['user']['account_id']).'_'.$this->composeID,$composeCache,$expiration=60*60*2);
|
||||
}
|
||||
if (!isset($_content['serverID'])||empty($_content['serverID']))
|
||||
if (empty($_content['serverID']))
|
||||
{
|
||||
$content['serverID'] = $this->mail_bo->profileID;
|
||||
}
|
||||
$preserv['serverID'] = $content['serverID'];
|
||||
$preserv['lastDrafted'] = $content['lastDrafted'];
|
||||
$preserv['processedmail_id'] = $content['processedmail_id'];
|
||||
$preserv['references'] = $content['references'];
|
||||
$preserv['in-reply-to'] = $content['in-reply-to'];
|
||||
$preserv['lastDrafted'] = $content['lastDrafted'] ?? null;
|
||||
$preserv['processedmail_id'] = $content['processedmail_id'] ?? null;
|
||||
$preserv['references'] = $content['references'] ?? null;
|
||||
$preserv['in-reply-to'] = $content['in-reply-to'] ?? null;
|
||||
// thread-topic is a proprietary microsoft header and deprecated with the current version
|
||||
// horde does not support the encoding of thread-topic, and probably will not no so in the future
|
||||
//$preserv['thread-topic'] = $content['thread-topic'];
|
||||
$preserv['thread-index'] = $content['thread-index'];
|
||||
$preserv['list-id'] = $content['list-id'];
|
||||
$preserv['mode'] = $content['mode'];
|
||||
$preserv['thread-index'] = $content['thread-index'] ?? null;
|
||||
$preserv['list-id'] = $content['list-id'] ?? null;
|
||||
$preserv['mode'] = $content['mode'] ?? null;
|
||||
// convert it back to checkbox expectations
|
||||
if($content['mimeType'] == 'html') {
|
||||
if($content['mimeType'] === 'html') {
|
||||
$content['mimeType']=1;
|
||||
} else {
|
||||
$content['mimeType']=0;
|
||||
@ -1391,11 +1391,11 @@ class mail_compose
|
||||
// Resolve distribution list before send content to client
|
||||
foreach(array('to', 'cc', 'bcc', 'replyto') as $f)
|
||||
{
|
||||
if (is_array($content[$f])) $content[$f]= self::resolveEmailAddressList ($content[$f]);
|
||||
if (isset($content[$f]) && is_array($content[$f])) $content[$f]= self::resolveEmailAddressList ($content[$f]);
|
||||
}
|
||||
|
||||
// set filemode icons for all attachments
|
||||
if($content['attachments'] && is_array($content['attachments']))
|
||||
if(!empty($content['attachments']))
|
||||
{
|
||||
foreach($content['attachments'] as &$attach)
|
||||
{
|
||||
@ -1407,9 +1407,9 @@ class mail_compose
|
||||
}
|
||||
}
|
||||
|
||||
$content['to'] = self::resolveEmailAddressList($content['to']);
|
||||
if (isset($content['to'])) $content['to'] = self::resolveEmailAddressList($content['to']);
|
||||
$content['html_toolbar'] = empty(Mail::$mailConfig['html_toolbar']) ?
|
||||
join(',', Etemplate\Widget\HtmlArea::$toolbar_default_list) : join(',', Mail::$mailConfig['html_toolbar']);
|
||||
implode(',', Etemplate\Widget\HtmlArea::$toolbar_default_list) : implode(',', Mail::$mailConfig['html_toolbar']);
|
||||
//error_log(__METHOD__.__LINE__.array2string($content));
|
||||
$etpl->exec('mail.mail_compose.compose',$content,$sel_options,array(),$preserv,2);
|
||||
}
|
||||
@ -2485,7 +2485,7 @@ class mail_compose
|
||||
if(!empty($_formData['list-id'])) {
|
||||
$_mailObject->addHeader('List-Id', $_formData['list-id']);
|
||||
}
|
||||
if($_formData['disposition']=='on') {
|
||||
if(isset($_formData['disposition']) && $_formData['disposition'] === 'on') {
|
||||
$_mailObject->addHeader('Disposition-Notification-To', $_identity['ident_email']);
|
||||
}
|
||||
|
||||
@ -2522,7 +2522,7 @@ class mail_compose
|
||||
if ($_formData['attachments'] && $_formData['filemode'] != Vfs\Sharing::ATTACH && !$_autosaving)
|
||||
{
|
||||
$attachment_links = $this->_getAttachmentLinks($_formData['attachments'], $_formData['filemode'],
|
||||
$_formData['mimeType'] == 'html',
|
||||
$_formData['mimeType'] === 'html',
|
||||
array_unique(array_merge((array)$_formData['to'], (array)$_formData['cc'], (array)$_formData['bcc'])),
|
||||
$_formData['expiration'], $_formData['password']);
|
||||
}
|
||||
@ -2530,7 +2530,7 @@ class mail_compose
|
||||
{
|
||||
case 'html':
|
||||
$body = $_formData['body'];
|
||||
if ($attachment_links)
|
||||
if (!empty($attachment_links))
|
||||
{
|
||||
if (strpos($body, '<!-- HTMLSIGBEGIN -->') !== false)
|
||||
{
|
||||
@ -2567,7 +2567,7 @@ class mail_compose
|
||||
default:
|
||||
$body = $this->convertHTMLToText($_formData['body'],false, false, true, true);
|
||||
|
||||
if ($attachment_links) $body .= $attachment_links;
|
||||
if (!empty($attachment_links)) $body .= $attachment_links;
|
||||
|
||||
#$_mailObject->Body = $_formData['body'];
|
||||
if(!empty($signature)) {
|
||||
@ -2653,7 +2653,7 @@ class mail_compose
|
||||
}
|
||||
if ($connection_opened) $mail_bo->closeConnection();
|
||||
}
|
||||
return is_array($inline_images)?$inline_images:array();
|
||||
return $inline_images ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2761,7 +2761,7 @@ class mail_compose
|
||||
$dmailbox = $dhA['folder'];
|
||||
// beware: do not delete the original mail as found in processedmail_id
|
||||
$pMuid='';
|
||||
if ($content['processedmail_id'])
|
||||
if (!empty($content['processedmail_id']))
|
||||
{
|
||||
$pMhA = mail_ui::splitRowID($content['processedmail_id']);
|
||||
$pMuid = $pMhA['msgUID'];
|
||||
@ -3021,7 +3021,7 @@ class mail_compose
|
||||
// create the messages and store inline images
|
||||
$inline_images = $this->createMessage($mail, $_formData, $identity);
|
||||
// remember the identity
|
||||
if ($_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on') $fromAddress = $mail->From;//$mail->FromName.($mail->FromName?' <':'').$mail->From.($mail->FromName?'>':'');
|
||||
if (!empty($mail->From) && ($_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on')) $fromAddress = $mail->From;//$mail->FromName.($mail->FromName?' <':'').$mail->From.($mail->FromName?'>':'');
|
||||
#print "<pre>". $mail->getMessageHeader() ."</pre><hr><br>";
|
||||
#print "<pre>". $mail->getMessageBody() ."</pre><hr><br>";
|
||||
#exit;
|
||||
@ -3317,14 +3317,14 @@ class mail_compose
|
||||
if (isset($lastDrafted['uid']) && !empty($lastDrafted['uid'])) $lastDrafted['uid']=trim($lastDrafted['uid']);
|
||||
// manually drafted, do not delete
|
||||
// will be handled later on IF mode was $_formData['mode']=='composefromdraft'
|
||||
if (isset($lastDrafted['uid']) && (empty($lastDrafted['uid']) || $lastDrafted['uid'] == $this->sessionData['uid'])) $lastDrafted=false;
|
||||
if (isset($lastDrafted['uid']) && (empty($lastDrafted['uid']) || $lastDrafted['uid'] == ($this->sessionData['uid']??null))) $lastDrafted=false;
|
||||
//error_log(__METHOD__.__LINE__.array2string($lastDrafted));
|
||||
}
|
||||
if ($lastDrafted && is_array($lastDrafted) && $mail_bo->isDraftFolder($lastDrafted['folder']))
|
||||
{
|
||||
try
|
||||
{
|
||||
if ($this->sessionData['lastDrafted'] != $this->sessionData['uid'] || !($_formData['mode']=='composefromdraft' &&
|
||||
if ($this->sessionData['lastDrafted'] != ($this->sessionData['uid']??null) || !($_formData['mode']=='composefromdraft' &&
|
||||
($_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on' || $_formData['to_calendar'] == 'on' )&&$this->sessionData['attachments']))
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__."#".$lastDrafted['uid'].'#'.$lastDrafted['folder'].array2string($_formData));
|
||||
@ -3399,7 +3399,7 @@ class mail_compose
|
||||
}
|
||||
if (is_array($this->sessionData['cc'])) $mailaddresses['cc'] = $this->sessionData['cc'];
|
||||
if (is_array($this->sessionData['bcc'])) $mailaddresses['bcc'] = $this->sessionData['bcc'];
|
||||
if (!empty($mailaddresses)) $mailaddresses['from'] = Mail\Html::decodeMailHeader($fromAddress);
|
||||
if (!empty($mailaddresses) && !empty($fromAddress)) $mailaddresses['from'] = Mail\Html::decodeMailHeader($fromAddress);
|
||||
|
||||
if ($_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on' || $_formData['to_calendar'] == 'on' )
|
||||
{
|
||||
@ -3407,7 +3407,7 @@ class mail_compose
|
||||
|
||||
foreach(array('to_infolog','to_tracker','to_calendar') as $app_key)
|
||||
{
|
||||
$entryid = $_formData['to_integrate_ids'][0][$app_key];
|
||||
$entryid = $_formData['to_integrate_ids'][0][$app_key] ?? null;
|
||||
if ($_formData[$app_key] == 'on')
|
||||
{
|
||||
$app_name = substr($app_key,3);
|
||||
|
@ -425,7 +425,7 @@ class mail_ui
|
||||
protected static function image_proxy()
|
||||
{
|
||||
$configs = Api\Config::read('mail');
|
||||
$image_proxy = $configs[self::IMAGE_PROXY_CONFIG] ?: self::DEFAULT_IMAGE_PROXY;
|
||||
$image_proxy = $configs[self::IMAGE_PROXY_CONFIG] ?? self::DEFAULT_IMAGE_PROXY;
|
||||
if (strpos(self::EGROUPWARE_IMAGE_PROXY, parse_url($image_proxy, PHP_URL_HOST)))
|
||||
{
|
||||
$image_proxy = self::EGROUPWARE_IMAGE_PROXY;
|
||||
@ -565,7 +565,7 @@ class mail_ui
|
||||
$etpl->setElementAttribute(self::$nm_index.'[foldertree]','actions', $this->get_tree_actions());
|
||||
|
||||
// sending preview toolbar actions
|
||||
if ($content['mailSplitter']) $etpl->setElementAttribute('mailPreview[toolbar]', 'actions', $this->get_toolbar_actions());
|
||||
if (!empty($content['mailSplitter'])) $etpl->setElementAttribute('mailPreview[toolbar]', 'actions', $this->get_toolbar_actions());
|
||||
|
||||
// We need to send toolbar actions to client-side because view template needs them
|
||||
if (Api\Header\UserAgent::mobile()) $sel_options['toolbar'] = $this->get_toolbar_actions();
|
||||
@ -1827,7 +1827,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
||||
// we have an own created rowID; prepend app=mail
|
||||
array_unshift($res,'mail');
|
||||
}
|
||||
return array('app'=>$res[0], 'accountID'=>$res[1], 'profileID'=>$res[2], 'folder'=>base64_decode($res[3]), 'msgUID'=>$res[4]);
|
||||
return array('app'=>$res[0], 'accountID'=>$res[1]??null, 'profileID'=>$res[2]??null, 'folder'=>base64_decode($res[3]??null), 'msgUID'=>$res[4]??null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ class notifications_popup implements notifications_iface {
|
||||
foreach ($rs as $notification) {
|
||||
$actions = null;
|
||||
$data = json_decode($notification['notify_data'], true);
|
||||
if ($data['appname'] && $data['data'])
|
||||
if (!empty($data['appname']) && !empty($data['data']))
|
||||
{
|
||||
$_actions = Api\Hooks::process (array(
|
||||
'location' => 'notifications_actions',
|
||||
@ -175,7 +175,7 @@ class notifications_popup implements notifications_iface {
|
||||
'created' => Api\DateTime::server2user($notification['notify_created']),
|
||||
'current' => new Api\DateTime('now'),
|
||||
'actions' => is_array($actions)?$actions:NULL,
|
||||
'extra_data' => ($data['data'] ? $data['data'] : array())
|
||||
'extra_data' => $data['data'] ?? [],
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -85,13 +85,13 @@ class pixelegg_framework extends Api\Framework\Ajax
|
||||
{
|
||||
$ret = parent::_get_css();
|
||||
// color to use
|
||||
$color = str_replace('custom',$GLOBALS['egw_info']['user']['preferences']['common']['template_custom_color'],
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['template_color']);
|
||||
$color = str_replace('custom', $GLOBALS['egw_info']['user']['preferences']['common']['template_custom_color'] ?? null,
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['template_color'] ?? null);
|
||||
|
||||
// Create a dark variant of the color
|
||||
$color_darker = empty($color) ? '' :$this->_color_shader($color, -30);
|
||||
|
||||
if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $GLOBALS['egw_info']['user']['preferences']['common']['sidebox_custom_color']))
|
||||
if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['sidebox_custom_color']) && preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $GLOBALS['egw_info']['user']['preferences']['common']['sidebox_custom_color']))
|
||||
{
|
||||
$sidebox_color_hover = $GLOBALS['egw_info']['user']['preferences']['common']['sidebox_custom_color'];
|
||||
$sidebox_color = $this->_color_shader($sidebox_color_hover, -30);
|
||||
@ -101,7 +101,7 @@ class pixelegg_framework extends Api\Framework\Ajax
|
||||
$sidebox_color_hover = $color;
|
||||
$sidebox_color = $color_darker;
|
||||
}
|
||||
if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color']))
|
||||
if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color']) && preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color']))
|
||||
{
|
||||
$loginbox_color = $GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color'];
|
||||
}
|
||||
@ -109,8 +109,8 @@ class pixelegg_framework extends Api\Framework\Ajax
|
||||
{
|
||||
$loginbox_color = $color_darker;
|
||||
}
|
||||
//alway set header logo used in sharing regardless of custom color being set
|
||||
$header = $GLOBALS['egw_info']['server']['login_logo_header'] ? Api\Framework::get_login_logo_or_bg_url('login_logo_header', 'logo')
|
||||
//always set header logo used in sharing regardless of custom color being set
|
||||
$header = !empty($GLOBALS['egw_info']['server']['login_logo_header']) ? Api\Framework::get_login_logo_or_bg_url('login_logo_header', 'logo')
|
||||
: Api\Framework::get_login_logo_or_bg_url('login_logo_file', 'logo');
|
||||
$ret['app_css'] .= "
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user