From 8dca4d221330276309517108cde2b4d3b4cac38a Mon Sep 17 00:00:00 2001 From: pdontthink Date: Tue, 29 Jan 2008 23:36:14 +0000 Subject: [PATCH] Don't let more general attachment plugins override changes made by specific ones; also judge by changes to the defaultlink in addition to added links. Thanks to Thierry Godefroy. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12903 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/functions/mime.php b/functions/mime.php index 735115d9..ee66d81e 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -561,6 +561,9 @@ function buildAttachmentArray($message, $exclude_id, $mailbox, $id) { * for a more generic type. Finally, a hook for ALL attachment * types is run as well. */ + // First remember the default link. + $defaultlink_orig = $defaultlink; + /* 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 @@ -569,7 +572,7 @@ function buildAttachmentArray($message, $exclude_id, $mailbox, $id) { $temp = array(&$links, &$startMessage, &$id, &$urlMailbox, &$ent, &$defaultlink, &$display_filename, &$where, &$what); do_hook("attachment $type0/$type1", $temp); - if(count($links) <= 1) { + 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 @@ -586,6 +589,12 @@ function buildAttachmentArray($message, $exclude_id, $mailbox, $id) { 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 */*", $temp); $this_attachment = array(); -- 2.25.1