From: Michael M Slusarz Date: Tue, 7 Sep 2010 23:11:29 +0000 (-0600) Subject: Trailer generation now controlled entirely by 'trailer' hook X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1df094692c2695c161765c7e33484a5abf3f7290;p=horde.git Trailer generation now controlled entirely by 'trailer' hook --- diff --git a/imp/config/conf.xml b/imp/config/conf.xml index 99165a590..d4d99419f 100644 --- a/imp/config/conf.xml +++ b/imp/config/conf.xml @@ -132,12 +132,6 @@ - - true - - true diff --git a/imp/config/hooks.php.dist b/imp/config/hooks.php.dist index 926731dc9..771bdd034 100644 --- a/imp/config/hooks.php.dist +++ b/imp/config/hooks.php.dist @@ -231,29 +231,25 @@ class IMP_Hooks /** - * Dynamically set/alter the contents of the message trailer text. - * - * @param string $trailer The default trailer text. + * Dynamically create the contents of the message trailer text. * * @return string The trailer text to be used. */ -// public function trailer($trailer) +// public function trailer() // { -// // Example #1: Set the trailer from the system taglines file; the -// // string "%TAG%" (if present in a user's signature) will be replaced -// // by the content of the file "/usr/share/tagline" (generated by the -// // "TaRT" utility). -// if (preg_match('/%TAG%/', $trailer)) { -// $tag = `cat /usr/share/tagline`; -// $sig = preg_replace('|%TAG%|', $tag, $trailer); -// } +// // Example #1: Static trailer text. +// return "--------------------------------\n" . +// "This message was sent using IMP."; // -// return $trailer; +// +// // Example #2: Set the trailer from the system taglines file, +// // located at "/usr/share/tagline" (generated by the "TaRT" utility; +// // See: http://sourceforge.net/projects/linuxtart/). +// return file_get_contents('/usr/share/tagline'); // // -// // Example #2: Set the trailer using the LDAP directory for each -// // domain. This code replaces the current trailer with the data -// // in 'ispmanDomainSignature'. +// // Example #3: Set the trailer using the LDAP directory (entry +// // 'ispmanDomainSignature'). // $vdomain = Horde_String::lower(preg_replace('|^.*?\.|i', '', getenv('HTTP_HOST'))); // $ldapServer = 'localhost'; // $ldapPort = '389'; diff --git a/imp/config/trailer.txt.dist b/imp/config/trailer.txt.dist deleted file mode 100644 index 98efd7b0b..000000000 --- a/imp/config/trailer.txt.dist +++ /dev/null @@ -1,3 +0,0 @@ - ----------------------------------------------------------------- -This message was sent using IMP, the Internet Messaging Program. diff --git a/imp/docs/UPGRADING b/imp/docs/UPGRADING index 15e75178b..f28819773 100644 --- a/imp/docs/UPGRADING +++ b/imp/docs/UPGRADING @@ -53,8 +53,8 @@ hook. The 'max_from_chars' and 'max_subj_chars' configuration options for the minimal (mimp) display have been removed. -The 'cache_folders', 'limit_factor', 'prepend_header', and 'sort_limit' -configuration options have been removed. +The 'append_trailer', 'cache_folders', 'limit_factor', 'prepend_header', and +'sort_limit' configuration options have been removed. Preferences @@ -86,6 +86,7 @@ The following hooks have been renamed: * msglist_flags hook now used to dynamically set flags on messages * The headers.php configuration file has been removed; setting custom headers is now done via the 'pre_sent' hook. +* Setting message trailers is now done entirely within the 'trailer' hook. Fetchmail diff --git a/imp/lib/Compose.php b/imp/lib/Compose.php index d99ac634d..b68847a64 100644 --- a/imp/lib/Compose.php +++ b/imp/lib/Compose.php @@ -1052,29 +1052,16 @@ class IMP_Compose $body = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter($body, 'Html2text', array('wrap' => false, 'charset' => $charset)); } - /* Get trailer message (if any). */ - $trailer = $trailer_file = null; - if (empty($options['nofinal']) && - $GLOBALS['conf']['msg']['append_trailer']) { - if (empty($GLOBALS['conf']['vhosts'])) { - if (is_readable(IMP_BASE . '/config/trailer.txt')) { - $trailer_file = IMP_BASE . '/config/trailer.txt'; - } - } elseif (is_readable(IMP_BASE . '/config/trailer-' . $GLOBALS['conf']['server']['name'] . '.txt')) { - $trailer_file = IMP_BASE . '/config/trailer-' . $GLOBALS['conf']['server']['name'] . '.txt'; - } - - if (!empty($trailer_file)) { - $trailer = $GLOBALS['injector']->getInstance('Horde_Text_Filter')->filter("\n" . file_get_contents($trailer_file), 'environment'); - try { - $trailer = Horde::callHook('trailer', array($trailer), 'imp'); - } catch (Horde_Exception_HookNotSet $e) {} - - $body .= $trailer; - if (!empty($options['html'])) { - $body_html .= $this->text2html($trailer); + /* Get trailer text (if any). */ + if (empty($options['nofinal'])) { + try { + if ($trailer = Horde::callHook('trailer', array(), 'imp')) { + $body .= $trailer; + if (!empty($options['html'])) { + $body_html .= $this->text2html($trailer); + } } - } + } catch (Horde_Exception_HookNotSet $e) {} } /* Set up the body part now. */