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.
This commit is contained in:
Jeffery To 2009-08-07 01:55:31 +08:00
parent c261a645a1
commit 5f293f0e2f
5 changed files with 25 additions and 8 deletions

8
README
View File

@ -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
---

View File

@ -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.'),

View File

@ -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;

View File

@ -183,6 +183,8 @@ $config =
array('piddir' => '/var/run',
'user' => false,
'group' => false),
'emailpost' =>
array('enabled' => true),
'sms' =>
array('enabled' => false),
'twitter' =>

View File

@ -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');
}