Silence warning about "Invalid argument supplied for foreach()" in a way that still works with reference

This commit is contained in:
nathangray 2018-12-18 11:19:13 -07:00
parent d40a282f0d
commit 996ce52b1a

View File

@ -1368,13 +1368,16 @@ class mail_compose
} }
// set filemode icons for all attachments // set filemode icons for all attachments
foreach((array)$content['attachments'] as &$attach) if($content['attachments'] && is_array($content['attachments']))
{ {
$attach['is_dir'] = is_dir($attach['file']); foreach($content['attachments'] as &$attach)
$attach['filemode_icon'] = !is_dir($attach['file']) && {
($content['filemode'] == Vfs\Sharing::READONLY || $content['filemode'] == Vfs\Sharing::WRITABLE) $attach['is_dir'] = is_dir($attach['file']);
? Vfs\Sharing::LINK : $content['filemode']; $attach['filemode_icon'] = !is_dir($attach['file']) &&
$attach['filemode_title'] = lang(Vfs\Sharing::$modes[$attach['filemode_icon']]['label']); ($content['filemode'] == Vfs\Sharing::READONLY || $content['filemode'] == Vfs\Sharing::WRITABLE)
? Vfs\Sharing::LINK : $content['filemode'];
$attach['filemode_title'] = lang(Vfs\Sharing::$modes[$attach['filemode_icon']]['label']);
}
} }
$content['to'] = self::resolveEmailAddressList($content['to']); $content['to'] = self::resolveEmailAddressList($content['to']);