summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-09-01 23:19:43 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-09-01 23:19:43 -0700
commit04f6646b0637d9cb221159b4931b184449a4dc1d (patch)
treeb81aac924c347b64103c547ac51db28de965470e
parent1f621d9827040d9730946a5804dd3d7269198ccc (diff)
Hopefully the third and final patch for #1216. Set the default from and reply-to addresses to an empty string. The first time the user model is saved, set the sendmail from and reply-to addresses. Requires an update to gallery version 38.
-rw-r--r--modules/gallery/helpers/gallery_event.php11
-rw-r--r--modules/gallery/helpers/gallery_installer.php20
-rw-r--r--modules/gallery/libraries/Sendmail.php7
-rw-r--r--modules/gallery/module.info2
4 files changed, 28 insertions, 12 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 66b250e9..8344c11c 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -550,10 +550,13 @@ class gallery_event_Core {
}
- static function user_change_email_form_completed($user, $form) {
- if ($user->admin) {
- module::set_var("gallery", "email_from", $user->email);
- module::set_var("gallery", "email_reply_to", $user->email);
+ static function user_updated($original_user, $updated_user) {
+ if ($updated_user->admin) {
+ $email = module::get_var("gallery", "email_from", "");
+ if (empty($email)) {
+ module::set_var("gallery", "email_from", $updated_user->email);
+ module::set_var("gallery", "email_reply_to", $updated_user->email);
+ }
}
}
}
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index d5264fcc..c6f19ad0 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -304,12 +304,12 @@ class gallery_installer {
module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");
// Sendmail configuration
- module::set_var("gallery", "email_from", "admin@example.com");
- module::set_var("gallery", "email_reply_to", "public@example.com");
+ module::set_var("gallery", "email_from", "");
+ module::set_var("gallery", "email_reply_to", "");
module::set_var("gallery", "email_line_length", 70);
module::set_var("gallery", "email_header_separator", serialize("\n"));
- module::set_version("gallery", 37);
+ module::set_version("gallery", 38);
}
static function upgrade($version) {
@@ -611,6 +611,20 @@ class gallery_installer {
module::set_var("gallery", "email_header_separator", serialize("\n"));
module::set_version("gallery", $version = 37);
}
+
+ // Changed our minds and decided that the initial value should be empty
+ // But don't just reset it blindly, only do it if the value is version 37 default
+ if ($version == 37) {
+ $email = module::get_var("gallery", "email_from", "");
+ if ($email == "admin@example.com") {
+ module::set_var("gallery", "email_from", "");
+ }
+ $email = module::get_var("gallery", "email_reply_to", "");
+ if ($email == "admin@example.com") {
+ module::set_var("gallery", "email_reply_to", "");
+ }
+ module::set_version("gallery", $version = 38);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/libraries/Sendmail.php b/modules/gallery/libraries/Sendmail.php
index 0fa554b4..a93be736 100644
--- a/modules/gallery/libraries/Sendmail.php
+++ b/modules/gallery/libraries/Sendmail.php
@@ -35,12 +35,11 @@ class Sendmail_Core {
public function __construct() {
$this->headers = array();
- $domain = Input::instance()->server("HTTP_HOST");
- $this->from(module::get_var("gallery", "email_from", "admin@$domain"));
- $this->reply_to(module::get_var("gallery", "email_reply_to", "public@$domain"));
+ $this->from(module::get_var("gallery", "email_from", ""));
+ $this->reply_to(module::get_var("gallery", "email_reply_to", ""));
$this->line_length(module::get_var("gallery", "email_line_length", 70));
$separator = module::get_var("gallery", "email_header_separator", null);
- $this->header_separator(empty($separator) ? "\n" : deserialize($separator));
+ $this->header_separator(empty($separator) ? "\n" : unserialize($separator));
}
public function __get($key) {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 901158b5..cc3b2723 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 37
+version = 38