From aea4659c22b2fd497bfe5b7329533e9c051323c1 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Sun, 6 Sep 2009 18:05:27 +0200 Subject: [PATCH] Use hash to configure Horde_Mime_Mail ctor. --- ansel/img/ecard.php | 2 +- ansel/lib/Report/mail.php | 7 ++++--- folks/lib/Folks.php | 2 +- folks/lib/Notification/mail.php | 7 ++++--- kronolith/lib/Kronolith.php | 15 +++++++++------ kronolith/scripts/agenda.php | 9 ++++----- news/mail.php | 2 +- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/ansel/img/ecard.php b/ansel/img/ecard.php index 9cbc58776..80714a5ca 100644 --- a/ansel/img/ecard.php +++ b/ansel/img/ecard.php @@ -78,7 +78,7 @@ case 'send': $alternative->addPart($related); /* Add them to the mail message */ - $alt = new Horde_Mime_Mail(_("Ecard - ") . Horde_Util::getFormData('image_desc'), null, $to, $from, $charset); + $alt = new Horde_Mime_Mail(array('subject' => _("Ecard - ") . Horde_Util::getFormData('image_desc'), 'to' => $to, 'from' => $from, 'charset' => $charset)); $alt->setBasePart($alternative); /* Send. */ diff --git a/ansel/lib/Report/mail.php b/ansel/lib/Report/mail.php index 7b1b360a7..853a91617 100644 --- a/ansel/lib/Report/mail.php +++ b/ansel/lib/Report/mail.php @@ -29,9 +29,10 @@ class Ansel_Report_mail extends Ansel_Report { * Needed for the Horde 4 mime library - use autoload everywhere we can * when this is *really* refactored for horde 4 */ - $mail = new Horde_Mime_Mail($this->getTitle(), - $this->getMessage($message), $to, - $this->getUserEmail()); + $mail = new Horde_Mime_Mail(array('subject' => $this->getTitle(), + 'body' => $this->getMessage($message), + 'to' => $to, + 'from' => $this->getUserEmail())); //FIXME: This address should be configurable $mail->addHeader('Sender', diff --git a/folks/lib/Folks.php b/folks/lib/Folks.php index 3389575fa..294dab5fe 100644 --- a/folks/lib/Folks.php +++ b/folks/lib/Folks.php @@ -235,7 +235,7 @@ class Folks { */ static public function sendMail($to, $subject, $body, $attaches = array()) { - $mail = new Horde_Mime_Mail($subject, $body, $to, $GLOBALS['conf']['support'], Horde_Nls::getCharset()); + $mail = new Horde_Mime_Mail(array('subject' => $subject, 'body' => $body, 'to' => $to, 'from' => $GLOBALS['conf']['support'], 'charset' => Horde_Nls::getCharset())); $mail->addHeader('User-Agent', 'Folks ' . $GLOBALS['registry']->getVersion()); $mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']); diff --git a/folks/lib/Notification/mail.php b/folks/lib/Notification/mail.php index 20b9f7fe5..c1f0c0243 100644 --- a/folks/lib/Notification/mail.php +++ b/folks/lib/Notification/mail.php @@ -56,9 +56,10 @@ class Folks_Notification_mail extends Folks_Notification { list($mail_driver, $mail_params) = Horde::getMailerConfig(); - $mail = new Horde_Mime_Mail($subject, $body, null, - $this->_params['from_addr'], - Horde_Nls::getCharset()); + $mail = new Horde_Mime_Mail(array('subject' => $subject, + 'body' => $body, + 'from' => $this->_params['from_addr'], + 'charset' => Horde_Nls::getCharset())); $mail->addHeader('User-Agent', 'Folks ' . $GLOBALS['registry']->getVersion()); $mail->addHeader('X-Originating-IP', $_SERVER['REMOTE_ADDR']); diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 39bb89df2..063af7536 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -1357,7 +1357,11 @@ class Kronolith $ics->setCharset(Horde_Nls::getCharset()); $recipient = empty($status['name']) ? $email : Horde_Mime_Address::trimAddress($status['name'] . ' <' . $email . '>'); - $mail = new Horde_Mime_Mail($subject, $message, $recipient, $from, Horde_Nls::getCharset()); + $mail = new Horde_Mime_Mail(array('subject' => $subject, + 'body' => $message, + 'to' => $recipient, + 'from' => $from, + 'charset' => Horde_Nls::getCharset())); $mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion()); $mail->addMimePart($ics); @@ -1483,11 +1487,10 @@ class Kronolith $event->start->strftime($tf ? '%R' : '%I:%M%p')) . "\n\n" . $event->getDescription(); - $mime_mail = new Horde_Mime_Mail($subject . ' ' . $event->title, - null, - implode(',', $df_recipients), - $from, - Horde_Nls::getCharset()); + $mime_mail = new Horde_Mime_Mail(array('subject' => $subject . ' ' . $event->title, + 'to' => implode(',', $df_recipients), + 'from' => $from, + 'charset' => Horde_Nls::getCharset())); $mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion()); $mime_mail->setBody($message, Horde_Nls::getCharset(), true); Horde::logMessage(sprintf('Sending event notifications for %s to %s', $event->title, implode(', ', $df_recipients)), __FILE__, __LINE__, PEAR_LOG_DEBUG); diff --git a/kronolith/scripts/agenda.php b/kronolith/scripts/agenda.php index ff0da1a11..8f3a669a1 100755 --- a/kronolith/scripts/agenda.php +++ b/kronolith/scripts/agenda.php @@ -142,11 +142,10 @@ function send_agendas() $twentyFour = $prefs->getValue('twentyFour'); $dateFormat = $prefs->getValue('date_format'); Horde_Nls::setLanguageEnvironment($lang); - $mime_mail = new Horde_Mime_Mail(sprintf(_("Your daily agenda for %s"), strftime($dateFormat, $runtime)), - null, - $email, - $GLOBALS['conf']['reminder']['from_addr'], - Horde_Nls::getCharset()); + $mime_mail = new Horde_Mime_Mail(array('subject' => sprintf(_("Your daily agenda for %s"), strftime($dateFormat, $runtime)), + 'to' => $email, + 'from' => $GLOBALS['conf']['reminder']['from_addr'], + 'charset' => Horde_Nls::getCharset())); $mime_mail->addHeader('User-Agent', 'Kronolith ' . $registry->getVersion()); $pad = max(Horde_String::length(_("All day")) + 2, $twentyFour ? 6 : 8); diff --git a/news/mail.php b/news/mail.php index 8703862b2..a51a28119 100644 --- a/news/mail.php +++ b/news/mail.php @@ -53,7 +53,7 @@ $body = sprintf(_("%s would you like to invite you to read the news\n Title: %s\ $row['publish'], News::getUrlFor('news', $id, true, -1)); -$mail = new Horde_Mime_Mail($row['title'], $body, $to, $from, Horde_Nls::getCharset()); +$mail = new Horde_Mime_Mail(array('subject' => $row['title'], 'body' => $body, 'to' => $to, 'from' => $from, 'charset' => Horde_Nls::getCharset())); $result = $mail->send($conf['mailer']['type'], $conf['mailer']['params']); if ($result instanceof PEAR_Error) { $notification->push($result); -- 2.11.0