summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffery To <jeffery.to@gmail.com>2009-08-07 01:55:31 +0800
committerJeffery To <jeffery.to@gmail.com>2009-08-07 01:55:31 +0800
commit5f293f0e2fd0561caa940c9799fad623ce953a60 (patch)
tree264fe223837d2235f8c64570e1b57922685ab950
parentc261a645a16fc0498e338cef4144b276a481646c (diff)
Added configuration option to disable post-by-email.
This hides the relevant settings from the email settings page and prevents maildaemon.php from processing email if the option is disabled.
-rw-r--r--README8
-rw-r--r--actions/emailsettings.php14
-rw-r--r--config.php.sample3
-rw-r--r--lib/common.php2
-rwxr-xr-xscripts/maildaemon.php6
5 files changed, 25 insertions, 8 deletions
diff --git a/README b/README
index e4cae0e49..12c465869 100644
--- a/README
+++ b/README
@@ -1228,6 +1228,14 @@ enabled: Set to true to enable. Default false.
server: a string with the hostname of the sphinx server.
port: an integer with the port number of the sphinx server.
+emailpost
+---------
+
+For post-by-email.
+
+enabled: Whether to enable post-by-email. Defaults to true. You will
+ also need to set up maildaemon.php.
+
sms
---
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index 634388fdd..cdd092829 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -122,7 +122,7 @@ class EmailsettingsAction extends AccountSettingsAction
}
$this->elementEnd('fieldset');
- if ($user->email) {
+ if (common_config('emailpost', 'enabled') && $user->email) {
$this->elementStart('fieldset', array('id' => 'settings_email_incoming'));
$this->element('legend',_('Incoming email'));
if ($user->incomingemail) {
@@ -173,11 +173,13 @@ class EmailsettingsAction extends AccountSettingsAction
_('Allow friends to nudge me and send me an email.'),
$user->emailnotifynudge);
$this->elementEnd('li');
- $this->elementStart('li');
- $this->checkbox('emailpost',
- _('I want to post notices by email.'),
- $user->emailpost);
- $this->elementEnd('li');
+ if (common_config('emailpost', 'enabled')) {
+ $this->elementStart('li');
+ $this->checkbox('emailpost',
+ _('I want to post notices by email.'),
+ $user->emailpost);
+ $this->elementEnd('li');
+ }
$this->elementStart('li');
$this->checkbox('emailmicroid',
_('Publish a MicroID for my email address.'),
diff --git a/config.php.sample b/config.php.sample
index 91be39f48..21b6865e1 100644
--- a/config.php.sample
+++ b/config.php.sample
@@ -164,6 +164,9 @@ $config['sphinx']['port'] = 3312;
// $config['memcached']['server'] = 'localhost';
// $config['memcached']['port'] = 11211;
+// Disable post-by-email
+// $config['emailpost']['enabled'] = false;
+
// Disable SMS
// $config['sms']['enabled'] = false;
diff --git a/lib/common.php b/lib/common.php
index 12a7ac449..6d20534ae 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -183,6 +183,8 @@ $config =
array('piddir' => '/var/run',
'user' => false,
'group' => false),
+ 'emailpost' =>
+ array('enabled' => true),
'sms' =>
array('enabled' => false),
'twitter' =>
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 3ef4d0638..91c257adb 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -385,5 +385,7 @@ class MailerDaemon
}
}
-$md = new MailerDaemon();
-$md->handle_message('php://stdin');
+if (common_config('emailpost', 'enabled')) {
+ $md = new MailerDaemon();
+ $md->handle_message('php://stdin');
+}