mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-15 23:55:56 +00:00
add mail and share plugins
This commit is contained in:
@@ -563,78 +563,6 @@ class RPC extends Protected_Handler {
|
||||
print json_encode(array("message" => "UPDATE_COUNTERS"));
|
||||
}
|
||||
|
||||
function sendEmail() {
|
||||
$secretkey = $_REQUEST['secretkey'];
|
||||
|
||||
require_once 'lib/phpmailer/class.phpmailer.php';
|
||||
|
||||
$reply = array();
|
||||
|
||||
if ($_SESSION['email_secretkey'] &&
|
||||
$secretkey == $_SESSION['email_secretkey']) {
|
||||
|
||||
$_SESSION['email_secretkey'] = '';
|
||||
|
||||
$destination = $_REQUEST['destination'];
|
||||
$subject = $_REQUEST['subject'];
|
||||
$content = $_REQUEST['content'];
|
||||
|
||||
$replyto = strip_tags($_SESSION['email_replyto']);
|
||||
$fromname = strip_tags($_SESSION['email_fromname']);
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$mail->PluginDir = "lib/phpmailer/";
|
||||
$mail->SetLanguage("en", "lib/phpmailer/language/");
|
||||
|
||||
$mail->CharSet = "UTF-8";
|
||||
|
||||
$mail->From = $replyto;
|
||||
$mail->FromName = $fromname;
|
||||
$mail->AddAddress($destination);
|
||||
|
||||
if (SMTP_HOST) {
|
||||
$mail->Host = SMTP_HOST;
|
||||
$mail->Mailer = "smtp";
|
||||
$mail->SMTPAuth = SMTP_LOGIN != '';
|
||||
$mail->Username = SMTP_LOGIN;
|
||||
$mail->Password = SMTP_PASSWORD;
|
||||
}
|
||||
|
||||
$mail->IsHTML(false);
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $content;
|
||||
|
||||
$rc = $mail->Send();
|
||||
|
||||
if (!$rc) {
|
||||
$reply['error'] = $mail->ErrorInfo;
|
||||
} else {
|
||||
save_email_address($this->link, db_escape_string($destination));
|
||||
$reply['message'] = "UPDATE_COUNTERS";
|
||||
}
|
||||
|
||||
} else {
|
||||
$reply['error'] = "Not authorized.";
|
||||
}
|
||||
|
||||
print json_encode($reply);
|
||||
}
|
||||
|
||||
function completeEmails() {
|
||||
$search = db_escape_string($_REQUEST["search"]);
|
||||
|
||||
print "<ul>";
|
||||
|
||||
foreach ($_SESSION['stored_emails'] as $email) {
|
||||
if (strpos($email, $search) !== false) {
|
||||
print "<li>$email</li>";
|
||||
}
|
||||
}
|
||||
|
||||
print "</ul>";
|
||||
}
|
||||
|
||||
function quickAddCat() {
|
||||
$cat = db_escape_string($_REQUEST["cat"]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user