Fix compatibility with chwala-0.4 (Bifrost#T31552)

This commit is contained in:
Aleksander Machniak 2017-05-16 10:57:50 +02:00
parent e5d2934e31
commit fdcb5c0c58

View file

@ -1435,28 +1435,29 @@ class kolab_files_engine
if (array_key_exists($type, $this->mimetypes)) {
$mimetypes = $this->mimetypes[$type];
}
// fallback to static definition if old Chwala is used
else if ($type == 'edit') {
$mimetypes = array(
'text/plain' => 'txt',
'text/html' => 'html',
);
if (!empty($_SESSION['kolab_files_caps']['MANTICORE'])) {
$mimetypes = array_merge(array('application/vnd.oasis.opendocument.text' => 'odt'), $mimetypes);
}
foreach (array_keys($mimetypes) as $type) {
list ($app, $label) = explode('/', $type);
$label = preg_replace('/[^a-z]/', '', $label);
$mimetypes[$type] = array(
'ext' => $mimetypes[$type],
'label' => $this->plugin->gettext('type.' . $label),
);
}
}
else {
$mimetypes = $this->mimetypes;
}
}
// fallback to static definition if old Chwala is used
if ($type == 'edit' && empty($mimetypes)) {
$mimetypes = array(
'application/vnd.oasis.opendocument.text' => 'odt',
'text/plain' => 'txt',
'text/html' => 'html',
);
foreach (array_keys($mimetypes) as $type) {
list ($app, $label) = explode('/', $type);
$label = preg_replace('/[^a-z]/', '', $label);
$mimetypes[$type] = array(
'ext' => $mimetypes[$type],
'label' => $this->plugin->gettext('type.' . $label),
);
}
}
}
catch (Exception $e) {
rcube::raise_error(array(