summaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-10-09 08:06:12 +0000
committerPaul 'flowerysong' Arthur <flowerysong00@yahoo.com>2010-10-09 08:06:12 +0000
commitf82f5454f9832303ef5075b73e5017549c3a19ae (patch)
tree71805afd7285d8d1829ec593ca787140eaea7c4e /admin
parentb18ff601386b5f59c264b554e7ded04890c4283e (diff)
downloadampache-f82f5454f9832303ef5075b73e5017549c3a19ae.tar.gz
ampache-f82f5454f9832303ef5075b73e5017549c3a19ae.tar.bz2
ampache-f82f5454f9832303ef5075b73e5017549c3a19ae.zip
Refactor mail handling a bit and make registration use the same method as the
other places that send mail.
Diffstat (limited to 'admin')
-rw-r--r--admin/mail.php50
1 files changed, 19 insertions, 31 deletions
diff --git a/admin/mail.php b/admin/mail.php
index 18bcb100..b0bc55cc 100644
--- a/admin/mail.php
+++ b/admin/mail.php
@@ -43,43 +43,31 @@ switch ($_REQUEST['action']) {
mb_language("uni");
}
- $clients = AmpacheMail::get_users($_REQUEST['to']);
-
- foreach ($clients as $client) {
- if(function_exists('mb_encode_mimeheader')) {
- $recipient .= mb_encode_mimeheader($client['fullname']) ." <" . $client['email'] . ">, ";
- } else {
- $recipient .= $client['fullname'] ." <" . $client['email'] . ">, ";
- }
- }
-
- // Remove the last , from the recipient
- $recipient = rtrim($recipient,", ");
+ $mailer = new AmpacheMail();
// Set the vars on the object
- AmpacheMail::$recipient = $recipient;
- if(function_exists('mb_encode_mimeheader')) {
- AmpacheMail::$fullname = mb_encode_mimeheader($GLOBALS['user']->fullname);
- } else {
- AmpacheMail::$fullname = $GLOBALS['user']->fullname;
+ $mailer->subject = scrub_in($_REQUEST['subject']);
+ $mailer->message = scrub_in($_REQUEST['message']);
+
+ if ($_REQUEST['from'] == 'system') {
+ $mailer->set_default_sender();
}
- AmpacheMail::$to = $GLOBALS['user']->email;
- AmpacheMail::$subject = scrub_in($_REQUEST['subject']);
- if(function_exists('mb_eregi_replace')) {
- AmpacheMail::$message = mb_eregi_replace("\r\n", "\n", scrub_in($_REQUEST['message']));
- } else {
- AmpacheMail::$message = scrub_in($_REQUEST['message']);
+ else {
+ $mailer->sender = $GLOBALS['user']->email;
+ $mailer->sender_name = $GLOBALS['user']->fullname;
}
- AmpacheMail::$sender = $GLOBALS['user']->email;
-
- AmpacheMail::$fromname = $fullname;
- AmpacheMail::send();
- /* Confirmation Send */
- $url = Config::get('web_path') . '/admin/mail.php';
- $title = _('E-mail Sent');
- $body = _('Your E-mail was successfully sent.');
+ if($mailer->send_to_group($_REQUEST['to'])) {
+ $title = _('E-mail Sent');
+ $body = _('Your E-mail was successfully sent.');
+ }
+ else {
+ $title = _('E-mail Not Sent');
+ $body = _('Your E-mail was not sent.');
+ }
+ $url = Config::get('web_path') . '/admin/mail.php';
show_confirmation($title,$body,$url);
+
break;
default:
require_once Config::get('prefix') . '/templates/show_mail_users.inc.php';