]> git.wh0rd.org - tt-rss.git/blobdiff - plugins/mail/init.php
added a personalized email template. if the file:
[tt-rss.git] / plugins / mail / init.php
index 2897068aa5635598f85c75428cefe9b392be784e..3b1582081d885d82097a2eb630f90a88c1a97e25 100644 (file)
@@ -50,13 +50,16 @@ class Mail extends Plugin {
                $tpl = new MiniTemplator;
                $tpl_t = new MiniTemplator;
 
-               $tpl->readTemplateFromFile("templates/email_article_template.txt");
+               $templ_name = "templates/email_article_template.txt";
+               if(file_exists("templates/my_email_article_template.txt"))
+                       $templ_name = "templates/my_email_article_template.txt";
+               $tpl->readTemplateFromFile($templ_name);
 
                $tpl->setVariable('USER_NAME', $_SESSION["name"], true);
                $tpl->setVariable('USER_EMAIL', $user_email, true);
                $tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
 
-               $result = db_query("SELECT link, content, title
+               $result = db_query("SELECT link, content, title, note 
                        FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
                        id IN ($param) AND owner_uid = " . $_SESSION["uid"]);
 
@@ -70,6 +73,11 @@ class Mail extends Plugin {
                                $subject = __("[Forwarded]") . " " . htmlspecialchars($line["title"]);
 
                        $tpl->setVariable('ARTICLE_TITLE', strip_tags($line["title"]));
+                       $tnote = strip_tags($line["note"]);
+                       if( $tnote != ''){
+                               $tpl->setVariable('ARTICLE_NOTE', $tnote, true);
+                               $tpl->addBlock('note');
+                       }
                        $tpl->setVariable('ARTICLE_URL', strip_tags($line["link"]));
 
                        $tpl->addBlock('article');
@@ -136,7 +144,10 @@ class Mail extends Plugin {
 
                $mail->From = strip_tags($_REQUEST['from_email']);
                $mail->FromName = strip_tags($_REQUEST['from_name']);
-               $mail->AddAddress($_REQUEST['destination']);
+               //$mail->AddAddress($_REQUEST['destination']);
+               $addresses = explode(';', $_REQUEST['destination']);
+               foreach($addresses as $nextaddr)
+                       $mail->AddAddress($nextaddr);
 
                $mail->IsHTML(false);
                $mail->Subject = $_REQUEST['subject'];
@@ -168,6 +179,9 @@ class Mail extends Plugin {
                print "</ul>";
        }
 
+       function api_version() {
+               return 2;
+       }
 
 }
 ?>