]> git.mjollnir.org Git - s9y.git/commitdiff
support multiple recipients (per-entry)
authorgarvinhicking <garvinhicking>
Wed, 21 Dec 2005 01:17:50 +0000 (01:17 +0000)
committergarvinhicking <garvinhicking>
Wed, 21 Dec 2005 01:17:50 +0000 (01:17 +0000)
docs/NEWS
plugins/serendipity_event_mailer/UTF-8/lang_de.inc.php
plugins/serendipity_event_mailer/lang_de.inc.php
plugins/serendipity_event_mailer/lang_en.inc.php
plugins/serendipity_event_mailer/serendipity_event_mailer.php

index 3ea3faaab245ae8e2dbf6119afcd58237e20ae9f..2adbd6ccbe6b854c91357df20b632b55e0a6c974 100644 (file)
--- 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)
 ------------------------------------------------------------------------
 
index f2e484c2bbbb3f7b648a25c03e15a8a046dba849..0182fcc3515499fac15037e2d063c72105380343 100644 (file)
@@ -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)');
index 7d7cb68128af31e58900504376782704d5dc686b..d8e0ad972dc670e686502ead001129af221b2821 100644 (file)
@@ -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)');
index db62711b201078baaf3fbaea10782edee9c735a7..a42164db5fc30cbbad5fd6675f7fd86c1db86b06 100644 (file)
@@ -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)');
 
 ?>
index 7673eb7a359e62b2ad9a9fdb52a5b3a03908d942..c8603689ea05edbde5b79315aba8e287fa95b642 100644 (file)
@@ -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');
+                    }
+
+?>
+                    <fieldset style="margin: 5px">
+                        <legend><?php echo PLUGIN_EVENT_MAILER_NAME; ?></legend>
+                            <label title="<?php echo PLUGIN_EVENT_MAILER_RECIPIENT; ?>" for="properties_mailto">&nbsp;<?php echo PLUGIN_EVENT_MAILER_RECIPIENTS; ?>&nbsp;&nbsp;</label>&nbsp;
+                            <input type="text" name="serendipity[properties][mailto]" id="properties_mailto" value="<?php echo htmlspecialchars($mailto); ?>" />
+                    </fieldset>
+<?php
+                    break;
+
                 case 'backend_publish':
+                    $mails = explode(' ', $this->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('</p>', "</p>\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) . '...<br />';
+                        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 : */
-?>