X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=functions%2Fmime.php;h=b8c79f539b98dd2d2453b294a7f5663f66770025;hp=2f48c8b42782201e9b4989d8d8e56655de9c3114;hb=97c20b2f587c8569167eaaef5179cf16f58d892f;hpb=b7910e12e76a7976ec5bdd722d4a51ed73b4e941 diff --git a/functions/mime.php b/functions/mime.php index 2f48c8b4..b8c79f53 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -6,7 +6,7 @@ * This contains the functions necessary to detect and decode MIME * messages. * - * @copyright © 1999-2009 The SquirrelMail Project Team + * @copyright 1999-2012 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -575,9 +575,9 @@ function buildAttachmentArray($message, $exclude_id, $mailbox, $id) { } /* This executes the attachment hook with a specific MIME-type. - * If that doesn't have results, it tries if there's a rule - * for a more generic type. Finally, a hook for ALL attachment - * types is run as well. + * It also allows plugins to run if there's a rule for a more + * generic type. Finally, a hook for ALL attachment types is + * run as well. */ // First remember the default link. $defaultlink_orig = $defaultlink; @@ -587,19 +587,23 @@ function buildAttachmentArray($message, $exclude_id, $mailbox, $id) { argument, and arguments are passed by reference, so instead of returning any changes, changes should simply be made to the original arguments themselves. */ - $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, + $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, &$defaultlink, &$display_filename, &$where, &$what); do_hook("attachment $type0/$type1", $temp); - if(count($links) <= 1 && $defaultlink == $defaultlink_orig) { - /* The API for this hook has changed as of 1.5.2 so that all plugin - arguments are passed in an array instead of each their own plugin - argument, and arguments are passed by reference, so instead of - returning any changes, changes should simply be made to the original - arguments themselves. */ - $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, - &$defaultlink, &$display_filename, &$where, &$what); - do_hook("attachment $type0/*", $temp); + /* The API for this hook has changed as of 1.5.2 so that all plugin + arguments are passed in an array instead of each their own plugin + argument, and arguments are passed by reference, so instead of + returning any changes, changes should simply be made to the original + arguments themselves. */ + $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, + &$defaultlink, &$display_filename, &$where, &$what); + // Do not let a generic plugin change the default link if a more + // specialized one already did it... + if ($defaultlink != $defaultlink_orig) { + $dummy = ''; + $temp[5] = &$dummy; } + do_hook("attachment $type0/*", $temp); /* The API for this hook has changed as of 1.5.2 so that all plugin arguments are passed in an array instead of each their own plugin argument, and arguments are passed by reference, so instead of @@ -958,6 +962,7 @@ function encodeHeader ($string) { for($i = 0; $i < $j; ++$i) { switch($string{$i}) { + case '"': case '=': case '<': case '>': @@ -2006,7 +2011,7 @@ function sq_fix_url($attname, &$attvalue, $message, $id, $mailbox,$sQuote = '"') break; } } else { - if (!(isset($aUrl['path']) && $aUrl['path'] == $secremoveimg)) { + if (!isset($aUrl['path']) || $aUrl['path'] != $secremoveimg) { // parse_url did not lead to satisfying result $attvalue = $sQuote . SM_PATH . 'images/blank.png' . $sQuote; } @@ -2345,6 +2350,17 @@ function sq_sanitize($body, list($free_content, $curpos) = sq_fixstyle($body, $gt+1, $message, $id, $mailbox); if ($free_content != FALSE){ + if ( !empty($attary) ) { + $attary = sq_fixatts($tagname, + $attary, + $rm_attnames, + $bad_attvals, + $add_attr_to_tag, + $message, + $id, + $mailbox + ); + } $trusted .= sq_tagprint($tagname, $attary, $tagtype); $trusted .= $free_content; $trusted .= sq_tagprint($tagname, false, 2); @@ -2734,7 +2750,7 @@ function SendDownloadHeaders($type0, $type1, $filename, $force, $filesize=0) { $filename = call_user_func($languages[$squirrelmail_language]['XTRA_CODE'] . '_downloadfilename', $filename, $HTTP_USER_AGENT); } else { - $filename = preg_replace('/[\\\/:*?"<>|;]/', '_', str_replace(' ', ' ', $filename)); + $filename = preg_replace('/[\\\\\/:*?"<>|;]/', '_', str_replace(' ', ' ', $filename)); } // A Pox on Microsoft and it's Internet Explorer!