diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php
index 0eeae274a0..ef1f147912 100644
--- a/admin/inc/class.admin_ui.inc.php
+++ b/admin/inc/class.admin_ui.inc.php
@@ -204,7 +204,7 @@ class admin_ui
$item['id'] = substr($item['extradata'], 11);
unset($item['extradata']);
$matches = null;
- if ($item['options'] && preg_match('/(egw_openWindowCentered2?|window.open)\([^)]+,(\d+),(\d+).*(title="([^"]+)")?/', $item['options'], $matches))
+ if (!empty($item['options']) && preg_match('/(egw_openWindowCentered2?|window.open)\([^)]+,(\d+),(\d+).*(title="([^"]+)")?/', $item['options'], $matches))
{
$item['popup'] = $matches[2].'x'.$matches[3];
if (isset($matches[5])) $item['tooltip'] = $matches[5];
@@ -213,7 +213,7 @@ class admin_ui
}
if (empty($item['icon'])) $item['icon'] = $app.'/navbar';
if (empty($item['group'])) $item['group'] = $group;
- if (empty($item['onExecute'])) $item['onExecute'] = $item['popup'] ?
+ if (empty($item['onExecute'])) $item['onExecute'] = !empty($item['popup']) ?
'javaScript:nm_action' : 'javaScript:app.admin.iframe_location';
if (!isset($item['allowOnMultiple'])) $item['allowOnMultiple'] = false;
@@ -297,7 +297,7 @@ class admin_ui
$item['id'] = substr($item['extradata'], 11);
unset($item['extradata']);
$matches = null;
- if ($item['options'] && preg_match('/(egw_openWindowCentered2?|window.open)\([^)]+,(\d+),(\d+).*(title="([^"]+)")?/', $item['options'], $matches))
+ if (!empty($item['options']) && preg_match('/(egw_openWindowCentered2?|window.open)\([^)]+,(\d+),(\d+).*(title="([^"]+)")?/', $item['options'], $matches))
{
$item['popup'] = $matches[2].'x'.$matches[3];
$item['onExecute'] = 'javaScript:nm_action';
@@ -326,7 +326,7 @@ class admin_ui
public static function get_users(array $query, array &$rows=null)
{
$params = array(
- 'type' => (int)$query['filter'] ? (int)$query['filter'] : 'accounts',
+ 'type' => (int)($query['filter'] ?? 0) ?: 'accounts',
'start' => $query['start'],
'offset' => $query['num_rows'],
'order' => $query['order'],
@@ -334,7 +334,7 @@ class admin_ui
'active' => !empty($query['active']) ? $query['active'] : false,
);
// Make sure active filter give status what it needs
- switch($query['filter2'])
+ switch($query['filter2'] ?? '')
{
case 'disabled':
case 'expired':
@@ -356,12 +356,12 @@ class admin_ui
break;
}
- if ($query['searchletter'])
+ if (!empty($query['searchletter']))
{
$params['query'] = $query['searchletter'];
$params['query_type'] = 'start';
}
- elseif($query['search'])
+ elseif(!empty($query['search']))
{
$params['query'] = $query['search'];
$params['query_type'] = 'all';
@@ -377,7 +377,7 @@ class admin_ui
foreach($rows as $key => &$row)
{
// Filter by status
- if ($need_status_filter && !static::filter_status($need_status_filter, $row))
+ if (!empty($need_status_filter) && !static::filter_status($need_status_filter, $row))
{
unset($rows[$key]);
$total--;
@@ -391,8 +391,8 @@ class admin_ui
if (!self::$accounts->is_active($row)) $row['status_class'] = 'adminAccountInactive';
}
- // finally limit query, if status filter was used
- if ($need_status_filter)
+ // finally, limit query, if status filter was used
+ if (!empty($need_status_filter))
{
$rows = array_values(array_slice($rows, (int)$query['start'], $query['num_rows'] ?: count($rows)));
}
@@ -436,9 +436,9 @@ class admin_ui
{
$groups = $GLOBALS['egw']->accounts->search(array(
'type' => 'groups',
- 'query' => $query['search'],
- 'order' => $query['order'],
- 'sort' => $query['sort'],
+ 'query' => $query['search'] ?? null,
+ 'order' => $query['order'] ?? null,
+ 'sort' => $query['sort'] ?? null,
'start' => (int)$query['start'],
'offset' => (int)$query['num_rows']
));
@@ -463,7 +463,7 @@ class admin_ui
$run_rights = $GLOBALS['egw']->acl->get_user_applications($group['account_id'], false, false);
foreach($apps as $app)
{
- if((boolean)$run_rights[$app])
+ if(!empty($run_rights[$app]))
{
$group['apps'][] = $app;
}
@@ -537,7 +537,7 @@ class admin_ui
if (!empty($data['icon']))
{
$icon = Etemplate\Widget\Tree::imagePath($data['icon']);
- if ($data['child'] || $data[Tree::CHILDREN])
+ if (!empty($data['child']) || !empty($data[Tree::CHILDREN]))
{
$data[Tree::IMAGE_FOLDER_OPEN] = $data[Tree::IMAGE_FOLDER_CLOSED] = $icon;
}
diff --git a/api/src/Accounts.php b/api/src/Accounts.php
index 76e80b4035..889f6c1907 100644
--- a/api/src/Accounts.php
+++ b/api/src/Accounts.php
@@ -223,7 +223,7 @@ class Accounts
if (!empty($param['offset']) && !isset($param['start'])) $param['start'] = 0;
// Check for lang(Group) in search - if there, we search all groups
- $group_index = array_search(strtolower(lang('Group')), array_map('strtolower', $query = explode(' ',$param['query'])));
+ $group_index = array_search(strtolower(lang('Group')), array_map('strtolower', $query = explode(' ',$param['query'] ?? '')));
if($group_index !== FALSE && !(
in_array($param['type'], array('accounts', 'groupmembers')) || is_int($param['type'])
))
@@ -595,12 +595,12 @@ class Accounts
/**
* Return formatted username for a given account_id
*
- * @param string $account_id =null account id
- * @return string full name of user or "#$accountid" if user not found
+ * @param int $account_id account id
+ * @return string full name of user or "#$account_id" if user not found
*/
- static function username($account_id=null)
+ static function username(int $account_id)
{
- if ($account_id && !($account = self::cache_read((int)$account_id)))
+ if (!($account = self::cache_read($account_id)))
{
return '#'.$account_id;
}
diff --git a/api/src/Etemplate/Widget/Box.php b/api/src/Etemplate/Widget/Box.php
index 3a1bb39b1b..de3a379091 100644
--- a/api/src/Etemplate/Widget/Box.php
+++ b/api/src/Etemplate/Widget/Box.php
@@ -50,12 +50,12 @@ class Box extends Etemplate\Widget
$old_expand = $params[1];
if ($this->id && $this->type != 'groupbox') $cname = self::form_name($cname, $this->id, $params[1]);
- if ($expand['cname'] !== $cname && trim($cname) != '')
+ if (!empty($expand['cname']) && $expand['cname'] !== $cname && trim($cname))
{
$expand['cont'] =& self::get_array(self::$request->content, $cname);
$expand['cname'] = $cname;
}
- if ($respect_disabled && ($disabled = $this->attrs['disabled'] && self::check_disabled($this->attrs['disabled'], $expand)))
+ if ($respect_disabled && isset($this->attrs['disabled']) && self::check_disabled($this->attrs['disabled'], $expand))
{
//error_log(__METHOD__."('$method_name', ".array2string($params).', '.array2string($respect_disabled).") $this disabled='{$this->attrs['disabled']}'=".array2string($disabled).": NOT running");
return;
@@ -73,7 +73,7 @@ class Box extends Etemplate\Widget
// Expand children
$columns_disabled = null;
- if($this->id && $this->children[0] && strpos($this->children[0]->id, '$') !== false)
+ if($this->id && isset($this->children[0]) && strpos($this->children[0]->id, '$') !== false)
{
// Need to set this so the first child can repeat
$expand['row'] = 0;
diff --git a/api/src/Etemplate/Widget/Date.php b/api/src/Etemplate/Widget/Date.php
index 8e7defe63c..e93a4efb9c 100644
--- a/api/src/Etemplate/Widget/Date.php
+++ b/api/src/Etemplate/Widget/Date.php
@@ -111,7 +111,7 @@ class Date extends Transformer
{
$date = Api\DateTime::server2user($value);
}
- elseif ($this->attrs['data_format'] && $this->attrs['data_format'] !== 'object')
+ elseif (!empty($this->attrs['data_format']) && $this->attrs['data_format'] !== 'object')
{
$date = Api\DateTime::createFromFormat($this->attrs['data_format'], $value, Api\DateTime::$user_timezone);
}
diff --git a/api/src/Etemplate/Widget/Grid.php b/api/src/Etemplate/Widget/Grid.php
index 7a1ca0c84c..17433ba3e1 100644
--- a/api/src/Etemplate/Widget/Grid.php
+++ b/api/src/Etemplate/Widget/Grid.php
@@ -80,7 +80,7 @@ class Grid extends Box
$columns_disabled = array();
}
- if ($respect_disabled && ($disabled = $this->attrs['disabled'] && self::check_disabled($this->attrs['disabled'], $expand)))
+ if ($respect_disabled && isset($this->attrs['disabled']) && self::check_disabled($this->attrs['disabled'], $expand))
{
//error_log(__METHOD__."('$method_name', ".array2string($params).', '.array2string($respect_disabled).") $this disabled='{$this->attrs['disabled']}'=".array2string($disabled).": NOT running");
$params[0] = $old_cname;
@@ -89,7 +89,7 @@ class Grid extends Box
}
if ($this->id && $this->type !== 'row') $cname = self::form_name($cname, $this->id, $expand);
- if ($expand['cname'] !== $cname && $cname)
+ if (!empty($expand['cname']) && $expand['cname'] !== $cname && $cname)
{
$expand['cont'] =& self::get_array(self::$request->content, $cname);
$expand['cname'] = $cname;
diff --git a/api/src/Framework.php b/api/src/Framework.php
index a2fc76daa5..2a57a1f33b 100644
--- a/api/src/Framework.php
+++ b/api/src/Framework.php
@@ -495,17 +495,10 @@ abstract class Framework extends Framework\Extra
{
$lang_code = $GLOBALS['egw_info']['user']['preferences']['common']['lang'];
}
- // IE specific fixes
- if (Header\UserAgent::type() == 'msie')
- {
- // tell IE to use it's own mode, not old compatibility modes (set eg. via group policy for all intranet sites)
- // has to be before any other header tags, but meta and title!!!
- $pngfix = ''."\n";
- }
$app = $GLOBALS['egw_info']['flags']['currentapp'];
$app_title = isset($GLOBALS['egw_info']['apps'][$app]) ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app);
- $app_header = $GLOBALS['egw_info']['flags']['app_header'] ? $GLOBALS['egw_info']['flags']['app_header'] : $app_title;
+ $app_header = $GLOBALS['egw_info']['flags']['app_header'] ?? $app_title;
$site_title = strip_tags($GLOBALS['egw_info']['server']['site_title'].' ['.($app_header ? $app_header : $app_title).']');
// send appheader to clientside
@@ -515,7 +508,7 @@ abstract class Framework extends Framework\Extra
$var['favicon_file'] = self::get_login_logo_or_bg_url('favicon_file', 'favicon.ico');
- if ($GLOBALS['egw_info']['flags']['include_wz_tooltip'] &&
+ if (!empty($GLOBALS['egw_info']['flags']['include_wz_tooltip']) &&
file_exists(EGW_SERVER_ROOT.($wz_tooltip = '/phpgwapi/js/wz_tooltip/wz_tooltip.js')))
{
$include_wz_tooltip = '