X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=plugins%2Fmail%2Finit.php;h=21b58d73721b298c27d368705e1d62e10d9e98c1;hb=6d194d85415dee671c0afa2e734292743920f1a2;hp=3b1582081d885d82097a2eb630f90a88c1a97e25;hpb=1f5e9d9ab0541fbd25570d9be05bd4a487163807;p=tt-rss.git diff --git a/plugins/mail/init.php b/plugins/mail/init.php index 3b158208..21b58d73 100644 --- a/plugins/mail/init.php +++ b/plugins/mail/init.php @@ -13,12 +13,61 @@ class Mail extends Plugin { $this->host = $host; $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); + $host->add_hook($host::HOOK_PREFS_TAB, $this); } function get_js() { return file_get_contents(dirname(__FILE__) . "/mail.js"); } + function save() { + $addresslist = db_escape_string($_POST["addresslist"]); + + $this->host->set($this, "addresslist", $addresslist); + + echo __("Mail addresses saved."); + } + + function hook_prefs_tab($args) { + if ($args != "prefPrefs") return; + + print "
"; + + print "

" . __("You can set predefined email addressed here (comma-separated list):") . "

"; + + print "
"; + + print ""; + + print ""; + print ""; + print ""; + + $addresslist = $this->host->get($this, "addresslist"); + + print ""; + + print "

"; + + print "

"; + + print "
"; + } + function hook_article_button($line) { return "readTemplateFromFile($templ_name); + $tpl->readTemplateFromFile("templates/email_article_template.txt"); $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, note + $result = db_query("SELECT DISTINCT link, content, title, note FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND id IN ($param) AND owner_uid = " . $_SESSION["uid"]); @@ -90,25 +135,20 @@ class Mail extends Plugin { print "
"; - print __('From:'); - - print ""; - - print "\">"; - - print "
"; + $addresslist = explode(",", $this->host->get($this, "addresslist")); print __('To:'); print ""; - print ""; + name=\"destination\" id=\"emailArticleDlg_destination\">"; */ + + print_select("destination", "", $addresslist, 'style="width: 30em" dojoType="dijit.form.FilteringSelect"'); - print "
"; +/* print "
"; */ print "
"; @@ -142,8 +182,7 @@ class Mail extends Plugin { $mail = new ttrssMailer(); - $mail->From = strip_tags($_REQUEST['from_email']); - $mail->FromName = strip_tags($_REQUEST['from_name']); + $mail->AddReplyTo(strip_tags($_REQUEST['from_email'], $_REQUEST['from_name'])); //$mail->AddAddress($_REQUEST['destination']); $addresses = explode(';', $_REQUEST['destination']); foreach($addresses as $nextaddr) @@ -158,14 +197,14 @@ class Mail extends Plugin { if (!$rc) { $reply['error'] = $mail->ErrorInfo; } else { - save_email_address(db_escape_string($destination)); + //save_email_address(db_escape_string($destination)); $reply['message'] = "UPDATE_COUNTERS"; } print json_encode($reply); } - function completeEmails() { + /* function completeEmails() { $search = db_escape_string($_REQUEST["search"]); print "
    "; @@ -177,7 +216,7 @@ class Mail extends Plugin { } print "
"; - } + } */ function api_version() { return 2;