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. server: a string with the hostname of the sphinx server.
port: an integer with the port number 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 sms
--- ---

View File

@ -122,7 +122,7 @@ class EmailsettingsAction extends AccountSettingsAction
} }
$this->elementEnd('fieldset'); $this->elementEnd('fieldset');
if ($user->email) { if (common_config('emailpost', 'enabled') && $user->email) {
$this->elementStart('fieldset', array('id' => 'settings_email_incoming')); $this->elementStart('fieldset', array('id' => 'settings_email_incoming'));
$this->element('legend',_('Incoming email')); $this->element('legend',_('Incoming email'));
if ($user->incomingemail) { if ($user->incomingemail) {
@ -173,11 +173,13 @@ class EmailsettingsAction extends AccountSettingsAction
_('Allow friends to nudge me and send me an email.'), _('Allow friends to nudge me and send me an email.'),
$user->emailnotifynudge); $user->emailnotifynudge);
$this->elementEnd('li'); $this->elementEnd('li');
$this->elementStart('li'); if (common_config('emailpost', 'enabled')) {
$this->checkbox('emailpost', $this->elementStart('li');
_('I want to post notices by email.'), $this->checkbox('emailpost',
$user->emailpost); _('I want to post notices by email.'),
$this->elementEnd('li'); $user->emailpost);
$this->elementEnd('li');
}
$this->elementStart('li'); $this->elementStart('li');
$this->checkbox('emailmicroid', $this->checkbox('emailmicroid',
_('Publish a MicroID for my email address.'), _('Publish a MicroID for my email address.'),

View File

@ -164,6 +164,9 @@ $config['sphinx']['port'] = 3312;
// $config['memcached']['server'] = 'localhost'; // $config['memcached']['server'] = 'localhost';
// $config['memcached']['port'] = 11211; // $config['memcached']['port'] = 11211;
// Disable post-by-email
// $config['emailpost']['enabled'] = false;
// Disable SMS // Disable SMS
// $config['sms']['enabled'] = false; // $config['sms']['enabled'] = false;

View File

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

View File

@ -385,5 +385,7 @@ class MailerDaemon
} }
} }
$md = new MailerDaemon(); if (common_config('emailpost', 'enabled')) {
$md->handle_message('php://stdin'); $md = new MailerDaemon();
$md->handle_message('php://stdin');
}