* eMail: supporting deprecated text/directory mimetype (if filename extension is of type text/vcard) for opening in addressbook edit dialog.

handle jet another representation of hyphen, as it does not translate
This commit is contained in:
Klaus Leithoff 2012-04-05 09:07:33 +00:00
parent ffc4a60bec
commit 5450945136

View File

@ -545,7 +545,6 @@
$this->t->set_var('mimetype',mime_magic::mime2label($value['mimeType']));
$this->t->set_var('size',egw_vfs::hsize($value['size']));
$this->t->set_var('attachment_number',$key);
switch(strtoupper($value['mimeType']))
{
case 'MESSAGE/RFC822':
@ -567,9 +566,21 @@
case 'APPLICATION/PDF':
case 'TEXT/PLAIN':
case 'TEXT/HTML':
case 'TEXT/CALENDAR':
case 'TEXT/DIRECTORY':
$sfxMimeType = $value['mimeType'];
$buff = explode('.',$value['name']);
$suffix = '';
if (is_array($buff)) $suffix = array_pop($buff); // take the last extension to check with ext2mime
if (!empty($suffix)) $sfxMimeType = mime_magic::ext2mime($suffix);
if (strtoupper($sfxMimeType) == 'TEXT/VCARD' || strtoupper($sfxMimeType) == 'TEXT/X-VCARD')
{
$attachments[$key]['mimeType'] = $sfxMimeType;
$value['mimeType'] = strtoupper($sfxMimeType);
}
case 'TEXT/X-VCARD':
case 'TEXT/VCARD':
case 'TEXT/CALENDAR':
case 'TEXT/X-VCALENDAR':
$linkData = array
(
'menuaction' => 'felamimail.uidisplay.getAttachment',
@ -857,10 +868,21 @@ blockquote[type=cite] {
case 'APPLICATION/PDF':
case 'TEXT/PLAIN':
case 'TEXT/HTML':
case 'TEXT/CALENDAR':
case 'TEXT/X-VCALENDAR':
case 'TEXT/DIRECTORY':
$sfxMimeType = $value['mimeType'];
$buff = explode('.',$value['name']);
$suffix = '';
if (is_array($buff)) $suffix = array_pop($buff); // take the last extension to check with ext2mime
if (!empty($suffix)) $sfxMimeType = mime_magic::ext2mime($suffix);
if (strtoupper($sfxMimeType) == 'TEXT/VCARD' || strtoupper($sfxMimeType) == 'TEXT/X-VCARD')
{
$attachments[$key]['mimeType'] = $sfxMimeType;
$value['mimeType'] = strtoupper($sfxMimeType);
}
case 'TEXT/X-VCARD':
case 'TEXT/VCARD':
case 'TEXT/CALENDAR':
case 'TEXT/X-VCALENDAR':
$linkData = array
(
'menuaction' => 'felamimail.uidisplay.getAttachment',
@ -1317,6 +1339,16 @@ blockquote[type=cite] {
$GLOBALS['egw']->session->commit_session();
if ($_GET['mode'] != "save")
{
if (strtoupper($attachment['type']) == 'TEXT/DIRECTORY')
{
$sfxMimeType = $attachment['type'];
$buff = explode('.',$attachment['filename']);
$suffix = '';
if (is_array($buff)) $suffix = array_pop($buff); // take the last extension to check with ext2mime
if (!empty($suffix)) $sfxMimeType = mime_magic::ext2mime($suffix);
$attachment['type'] = $sfxMimeType;
if (strtoupper($sfxMimeType) == 'TEXT/VCARD' || strtoupper($sfxMimeType) == 'TEXT/X-VCARD') $attachment['type'] = strtoupper($sfxMimeType);
}
//error_log(__METHOD__.print_r($attachment,true));
if (strtoupper($attachment['type']) == 'TEXT/CALENDAR' || strtoupper($attachment['type']) == 'TEXT/X-VCALENDAR')
{
@ -1413,7 +1445,7 @@ blockquote[type=cite] {
// some characterreplacements, as they fail to translate
$sar = array(
'@(\x84|\x93|\x94)@',
'@(\x96|\x97)@',
'@(\x96|\x97|\x1a)@',
'@(\x82|\x91|\x92)@',
'@(\x85)@',
'@(\x86)@',