* patch from Seth E. Randall for getting the filename from attachments
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4417
7612ce4b-ef26-0410-bec9-
ea0150e637f0
echo '</body></html>';
exit;
}
echo '</body></html>';
exit;
}
if (count($flags)) {
foreach ($flags as $flag) {
$char = strtoupper($flag{1});
if (count($flags)) {
foreach ($flags as $flag) {
$char = strtoupper($flag{1});
* to mime_get_elements()
*/
* to mime_get_elements()
*/
-function mime_fetch_body($imap_stream, $id, $ent_id) {
+function mime_fetch_body($imap_stream, $id, $ent_id=1) {
global $uid_support;
/* Do a bit of error correction. If we couldn't find the entity id, just guess
* that it is the first one. That is usually the case anyway.
*/
if (!$ent_id) {
global $uid_support;
/* Do a bit of error correction. If we couldn't find the entity id, just guess
* that it is the first one. That is usually the case anyway.
*/
if (!$ent_id) {
+ $cmd = "FETCH $id BODY[]";
+ } else {
+ $cmd = "FETCH $id BODY[$ent_id]";
- $cmd = "FETCH $id BODY[$ent_id]";
$data = sqimap_run_command ($imap_stream, $cmd, true, $response, $message, $uid_support);
do {
$data = sqimap_run_command ($imap_stream, $cmd, true, $response, $message, $uid_support);
do {
-function mime_print_body_lines ($imap_stream, $id, $ent_id, $encoding) {
+function mime_print_body_lines ($imap_stream, $id, $ent_id=1, $encoding) {
- /* Do a bit of error correction. If we couldn't find the entity id, just guess
- * that it is the first one. That is usually the case anyway.
- */
- if (!$ent_id) {
- $ent_id = 1;
- }
$sid = sqimap_session_id($uid_support);
/* Don't kill the connection if the browser is over a dialup
* and it would take over 30 seconds to download it.
$sid = sqimap_session_id($uid_support);
/* Don't kill the connection if the browser is over a dialup
* and it would take over 30 seconds to download it.
if (trim($filename) == '') {
$name = decodeHeader($header->disposition->getProperty('name'));
if (trim($name) == '') {
if (trim($filename) == '') {
$name = decodeHeader($header->disposition->getProperty('name'));
if (trim($name) == '') {
- if (trim( $header->id ) == '') {
- $filename = 'untitled-[' . $ent . ']' ;
+ $name = decodeHeader($header->getParameter('name'));
+ if(trim($name) == '') {
+ if (trim( $header->id ) == '') {
+ $filename = 'untitled-[' . $ent . ']' ;
+ } else {
+ $filename = 'cid: ' . $header->id;
+ }
- $filename = 'cid: ' . $header->id;
}
} else {
$filename = $name;
}
} else {
$filename = $name;