From: garvinhicking Date: Wed, 21 Dec 2005 01:17:50 +0000 (+0000) Subject: support multiple recipients (per-entry) X-Git-Tag: 1.0~219 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7e31a35260575c769f7770376f3b48bb9f85ffbf;p=s9y.git support multiple recipients (per-entry) --- diff --git a/docs/NEWS b/docs/NEWS index 3ea3faa..2adbd6c 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,9 @@ Version 1.0 () ------------------------------------------------------------------------ + * Entry mail plugin can now send mails to multiple recipients, and + define the list of recipients per-entry (garvinhicking) + * Trackback now uses PEAR HTTP::Request class to send trackbacks. This allows to use HTTP redirects of trackbacks, which seem to get more common nowadays (garvinhicking) @@ -32,7 +35,7 @@ Version 1.0 () * Added option to turn off referrer tracking (garvinhicking) - * Improved Smarty Plugin API so that a new function + * Improved Smarty Plugin API so that a new function serendipity_fetchPrintEntries() can be used within a template to print more entries, and abstracted _fetchEntries()/_printEntries() calls a bit more so that future plugins can easier modify the @@ -68,7 +71,7 @@ Version 0.9.2 () * Fix not being able to create users of the same userlevel when being admin [workaround was to first create user with lower userlevel - and then edit the user account, which lead to propper permission + and then edit the user account, which lead to propper permission checks] * Include a template's "config.inc.php" also when previewing an entry, @@ -84,7 +87,7 @@ Version 0.9.2 () * Fix bug #1371630: Write permissions to category are stored with input data of the 'Read permissions' author listing. - + Version 0.9.1 (November 23rd, 2005) ------------------------------------------------------------------------ diff --git a/plugins/serendipity_event_mailer/UTF-8/lang_de.inc.php b/plugins/serendipity_event_mailer/UTF-8/lang_de.inc.php index f2e484c..0182fcc 100644 --- a/plugins/serendipity_event_mailer/UTF-8/lang_de.inc.php +++ b/plugins/serendipity_event_mailer/UTF-8/lang_de.inc.php @@ -10,3 +10,4 @@ @define('PLUGIN_EVENT_MAILER_STRIPTAGSDESC', 'Entfernt HTML-Anweisungen aus der Mail.'); @define('PLUGIN_EVENT_MAILER_CONVERTP', 'HTML-Paragraphen in Leerzeilen wandeln?'); @define('PLUGIN_EVENT_MAILER_CONVERTPDESC', 'Fügt einen Zeilenumbruch nach jedem HTML-Paragraphen ein. Besonders hilfreich im Zusammenhang mit der Option "HTML Entfernen", damit der Eintrag später selbst dann Umbrüche enthält, wenn sie nicht manuell eingegeben wurden.'); + @define('PLUGIN_EVENT_MAILER_RECIPIENTS', 'Mail-Empfänger (mehrere Empfänger mit Leerzeichen trennen)'); diff --git a/plugins/serendipity_event_mailer/lang_de.inc.php b/plugins/serendipity_event_mailer/lang_de.inc.php index 7d7cb68..d8e0ad9 100644 --- a/plugins/serendipity_event_mailer/lang_de.inc.php +++ b/plugins/serendipity_event_mailer/lang_de.inc.php @@ -10,3 +10,4 @@ @define('PLUGIN_EVENT_MAILER_STRIPTAGSDESC', 'Entfernt HTML-Anweisungen aus der Mail.'); @define('PLUGIN_EVENT_MAILER_CONVERTP', 'HTML-Paragraphen in Leerzeilen wandeln?'); @define('PLUGIN_EVENT_MAILER_CONVERTPDESC', 'Fügt einen Zeilenumbruch nach jedem HTML-Paragraphen ein. Besonders hilfreich im Zusammenhang mit der Option "HTML Entfernen", damit der Eintrag später selbst dann Umbrüche enthält, wenn sie nicht manuell eingegeben wurden.'); + @define('PLUGIN_EVENT_MAILER_RECIPIENTS', 'Mail-Empfänger (mehrere Empfänger mit Leerzeichen trennen)'); diff --git a/plugins/serendipity_event_mailer/lang_en.inc.php b/plugins/serendipity_event_mailer/lang_en.inc.php index db62711..a42164d 100644 --- a/plugins/serendipity_event_mailer/lang_en.inc.php +++ b/plugins/serendipity_event_mailer/lang_en.inc.php @@ -16,5 +16,6 @@ @define('PLUGIN_EVENT_MAILER_STRIPTAGSDESC', 'Remove HTML-Tags from the mail.'); @define('PLUGIN_EVENT_MAILER_CONVERTP', 'Convert HTML-paragraphs to newlines?'); @define('PLUGIN_EVENT_MAILER_CONVERTPDESC', 'Adds a newline after each HTML paragraph. This is very useful if you enable HTML removing, so that your paragraphs can be kept if not manually entered.'); +@define('PLUGIN_EVENT_MAILER_RECIPIENTS', 'Mail recipient (seperate multiple recipients with a space)'); ?> diff --git a/plugins/serendipity_event_mailer/serendipity_event_mailer.php b/plugins/serendipity_event_mailer/serendipity_event_mailer.php index 7673eb7..c860368 100644 --- a/plugins/serendipity_event_mailer/serendipity_event_mailer.php +++ b/plugins/serendipity_event_mailer/serendipity_event_mailer.php @@ -19,15 +19,16 @@ class serendipity_event_mailer extends serendipity_event $propbag->add('name', PLUGIN_EVENT_MAILER_NAME); $propbag->add('description', PLUGIN_EVENT_MAILER_DESC); $propbag->add('stackable', false); - $propbag->add('author', 'Sebastian Nohn, Kristian Köhntopp, Garvin Hicking'); - $propbag->add('version', '1.3'); + $propbag->add('author', 'Sebastian Nohn, Kristian Koehntopp, Garvin Hicking'); + $propbag->add('version', '1.4'); $propbag->add('requirements', array( 'serendipity' => '0.8', 'smarty' => '2.6.7', 'php' => '4.1.0' )); $propbag->add('event_hooks', array( - 'backend_publish' => true + 'backend_publish' => true, + 'backend_display' => true, )); $propbag->add('groups', array('FRONTEND_ENTRY_RELATED')); @@ -83,15 +84,46 @@ class serendipity_event_mailer extends serendipity_event if (isset($hooks[$event])) { switch($event) { + case 'backend_display': + if (isset($serendipity['POST']['properties']['mailto'])) { + $mailto = $serendipity['POST']['properties']['mailto']; + } else { + $mailto = $this->get_config('mailto'); + } + +?> +
+ +   + +
+get_config('mailto')); + $to = array(); + foreach($mails AS $mailto) { + $to[] = trim($mailto); + } + $mail = array( - 'to' => $this->get_config('mailto'), 'subject' => $eventData['title'], 'body' => $eventData['body'] . $eventData['extended'], // 'from' => $serendipity['blogTitle'] . ' - ' . $eventData['author'] . ' <' . $serendipity['serendipityEmail'] . '>' 'from' => $serendipity['serendipityEmail'] ); + if (isset($serendipity['POST']['properties']['mailto'])) { + $mails = explode(' ', $serendipity['POST']['properties']['mailto']); + foreach($mails as $mailto) { + $mailto = trim($mailto); + if (!in_array($mailto, $to)) { + $to[] = $mailto; + } + } + } + if (serendipity_db_bool($this->get_config('convertp', false)) == true) { $mail['body'] = str_replace('

', "

\n", $mail['body']); } @@ -106,7 +138,10 @@ class serendipity_event_mailer extends serendipity_event $mail['body'] = serendipity_archiveURL($eventData['id'], $eventData['title'], 'baseURL', true, array('timestamp' => $eventData['timestamp'])) . "\n\n" . $mail['body']; } - serendipity_sendMail($mail['to'], $mail['subject'], $mail['body'], $mail['from']); + foreach($to AS $mailto) { + echo htmlspecialchars($mailto) . '...
'; + serendipity_sendMail($mailto, $mail['subject'], $mail['body'], $mail['from']); + } return true; break; @@ -121,4 +156,3 @@ class serendipity_event_mailer extends serendipity_event } /* vim: set sts=4 ts=4 expandtab : */ -?>