summaryrefslogtreecommitdiff
path: root/roundcubemail/program/lib/Mail/mime.php
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-09-25 17:20:40 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-09-25 17:20:40 +0000
commita5ca47ea937eff7e3b82ddad1e5bc479b0380a82 (patch)
tree8ee4b49c8b8fbaf1539a2e0483f4bc8468182a4b /roundcubemail/program/lib/Mail/mime.php
parentf370c21ae6e3c6e4e8cf4af8c6cd33a021cc1ffe (diff)
- Fix problem with non-ascii attachment names in Mail_mime (#1485267, #1485096)
git-svn-id: https://svn.roundcube.net/trunk@1893 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/lib/Mail/mime.php')
-rw-r--r--roundcubemail/program/lib/Mail/mime.php21
1 files changed, 18 insertions, 3 deletions
diff --git a/roundcubemail/program/lib/Mail/mime.php b/roundcubemail/program/lib/Mail/mime.php
index 92c797b28..7641b0c9b 100644
--- a/roundcubemail/program/lib/Mail/mime.php
+++ b/roundcubemail/program/lib/Mail/mime.php
@@ -350,7 +350,7 @@ class Mail_mime
$err = PEAR::raiseError($msg);
return $err;
}
- $filename = substr('s_'.basename($filename), 2);
+ $filename = $this->_basename($filename);
if (PEAR::isError($filedata)) {
return $filedata;
}
@@ -667,7 +667,7 @@ class Mail_mime
$this->_htmlbody = preg_replace($regex, $rep, $this->_htmlbody);
$this->_html_images[$key]['name'] =
- substr(basename('s_'.$this->_html_images[$key]['name']), 2);
+ $this->_basename($this->_html_images[$key]['name']);
}
}
@@ -1114,6 +1114,21 @@ class Mail_mime
}
}
-
+ /**
+ * Get file's basename (locale independent)
+ *
+ * @param string Filename
+ *
+ * @return string Basename
+ * @access private
+ */
+ function _basename($filename)
+ {
+ // basename() is not unicode safe and locale dependent
+ if (stristr(PHP_OS, 'win') || stristr(PHP_OS, 'netware'))
+ return preg_replace('/^.*[\\\\\\/]/', '', $filename);
+ else
+ return preg_replace('/^.*[\/]/', '', $filename);
+ }
} // End of class