Merge commit 'jeff-themovie/invite-enabled' into 0.8.x

* commit 'jeff-themovie/invite-enabled':
  Adds $config['invite']['enabled'] to enable/disable invites.
This commit is contained in:
Zach Copley 2009-06-30 16:10:12 -07:00
commit b10dba2798
8 changed files with 38 additions and 18 deletions

7
README
View File

@ -1081,6 +1081,13 @@ debug: if turned on, this will make the XMPP library blurt out all of
public: an array of JIDs to send _all_ notices to. This is useful for public: an array of JIDs to send _all_ notices to. This is useful for
participating in third-party search and archiving services. participating in third-party search and archiving services.
invite
------
For configuring invites.
enabled: Whether to allow users to send invites. Default true.
tag tag
--- ---

View File

@ -35,7 +35,9 @@ class InviteAction extends CurrentUserDesignAction
function handle($args) function handle($args)
{ {
parent::handle($args); parent::handle($args);
if (!common_logged_in()) { if (!common_config('invite', 'enabled')) {
$this->clientError(_('Invites have been disabled.'));
} else if (!common_logged_in()) {
$this->clientError(sprintf(_('You must be logged in to invite other users to use %s'), $this->clientError(sprintf(_('You must be logged in to invite other users to use %s'),
common_config('site', 'name'))); common_config('site', 'name')));
return; return;

View File

@ -86,6 +86,9 @@ $config['sphinx']['port'] = 3312;
// $config['xmpp']['public'][] = 'someindexer@example.net'; // $config['xmpp']['public'][] = 'someindexer@example.net';
// $config['xmpp']['debug'] = false; // $config['xmpp']['debug'] = false;
// Turn off invites
// $config['invite']['enabled'] = false;
// Default locale info // Default locale info
// $config['site']['timezone'] = 'Pacific/Auckland'; // $config['site']['timezone'] = 'Pacific/Auckland';
// $config['site']['language'] = 'en_NZ'; // $config['site']['language'] = 'en_NZ';

View File

@ -422,11 +422,13 @@ class Action extends HTMLOutputter // lawsuit
$this->menuItem(common_local_url('smssettings'), $this->menuItem(common_local_url('smssettings'),
_('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect'); _('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect');
} }
if (common_config('invite', 'enabled')) {
$this->menuItem(common_local_url('invite'), $this->menuItem(common_local_url('invite'),
_('Invite'), _('Invite'),
sprintf(_('Invite friends and colleagues to join you on %s'), sprintf(_('Invite friends and colleagues to join you on %s'),
common_config('site', 'name')), common_config('site', 'name')),
false, 'nav_invitecontact'); false, 'nav_invitecontact');
}
$this->menuItem(common_local_url('logout'), $this->menuItem(common_local_url('logout'),
_('Logout'), _('Logout from the site'), false, 'nav_logout'); _('Logout'), _('Logout from the site'), false, 'nav_logout');
} }

View File

@ -175,6 +175,8 @@ $config =
'host' => null, # only set if != server 'host' => null, # only set if != server
'debug' => false, # print extra debug info 'debug' => false, # print extra debug info
'public' => array()), # JIDs of users who want to receive the public stream 'public' => array()), # JIDs of users who want to receive the public stream
'invite' =>
array('enabled' => true),
'sphinx' => 'sphinx' =>
array('enabled' => false, array('enabled' => false,
'server' => 'localhost', 'server' => 'localhost',

View File

@ -213,12 +213,14 @@ class FacebookAction extends Action
array('href' => 'index.php', 'title' => _('Home')), _('Home')); array('href' => 'index.php', 'title' => _('Home')), _('Home'));
$this->elementEnd('li'); $this->elementEnd('li');
if (common_config('invite', 'enabled')) {
$this->elementStart('li', $this->elementStart('li',
array('class' => array('class' =>
($this->action == 'facebookinvite') ? 'current' : 'facebook_invite')); ($this->action == 'facebookinvite') ? 'current' : 'facebook_invite'));
$this->element('a', $this->element('a',
array('href' => 'invite.php', 'title' => _('Invite')), _('Invite')); array('href' => 'invite.php', 'title' => _('Invite')), _('Invite'));
$this->elementEnd('li'); $this->elementEnd('li');
}
$this->elementStart('li', $this->elementStart('li',
array('class' => array('class' =>

View File

@ -100,7 +100,7 @@ class SubGroupNav extends Widget
$this->user->nickname), $this->user->nickname),
$action == 'usergroups', $action == 'usergroups',
'nav_usergroups'); 'nav_usergroups');
if (!is_null($cur) && $this->user->id === $cur->id) { if (common_config('invite', 'enabled') && !is_null($cur) && $this->user->id === $cur->id) {
$this->out->menuItem(common_local_url('invite'), $this->out->menuItem(common_local_url('invite'),
_('Invite'), _('Invite'),
sprintf(_('Invite friends and colleagues to join you on %s'), sprintf(_('Invite friends and colleagues to join you on %s'),

View File

@ -273,11 +273,13 @@ class FBConnectPlugin extends Plugin
$action->menuItem(common_local_url('smssettings'), $action->menuItem(common_local_url('smssettings'),
_('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect'); _('Connect'), _('Connect to SMS, Twitter'), false, 'nav_connect');
} }
if (common_config('invite', 'enabled')) {
$action->menuItem(common_local_url('invite'), $action->menuItem(common_local_url('invite'),
_('Invite'), _('Invite'),
sprintf(_('Invite friends and colleagues to join you on %s'), sprintf(_('Invite friends and colleagues to join you on %s'),
common_config('site', 'name')), common_config('site', 'name')),
false, 'nav_invitecontact'); false, 'nav_invitecontact');
}
// Need to override the Logout link to make it do FB stuff // Need to override the Logout link to make it do FB stuff
if (!empty($fbuid)) { if (!empty($fbuid)) {