Merge branch 'twitter-bridge-fixes' into testing

* twitter-bridge-fixes:
  Make sure the session token gets output no matter what (whoops)
  Move submit (connect) button to the very bottom
  Move license checkbox to the end of the form
  Don't allow Twitter registration if site is invite only
  Fix reference to constant
  problem with remote subscription on groups in OStatus
  show correct favorites link
  Don't try to verify URL if the user has left it out when making a new event
  Fix undefined variable
  Change time format to work with older PHP (before 5.3)
  move OMB-specific remote login button to OMB Plugin
  use correct redirect on logout of single-user site
This commit is contained in:
Zach Copley 2011-09-17 16:33:52 -07:00
commit fc827af94f
7 changed files with 100 additions and 78 deletions

View File

@ -73,9 +73,15 @@ class LogoutAction extends Action
}
Event::handle('EndLogout', array($this));
if (common_config('singleuser', 'enabled')) {
$user = User::singleUser();
common_redirect(common_local_url('showstream',
array('nickname' => $user->nickname)));
} else {
common_redirect(common_local_url('public'), 303);
}
}
}
function logout()
{

View File

@ -138,9 +138,6 @@ class AccountProfileBlock extends ProfileBlock
if (Event::handle('StartProfilePageActionsElements', array($this->out, $this->profile))) {
if (empty($cur)) { // not logged in
if (Event::handle('StartProfileRemoteSubscribe', array($this->out, $this->profile))) {
$this->out->elementStart('li', 'entity_subscribe');
$this->showRemoteSubscribeLink();
$this->out->elementEnd('li');
Event::handle('EndProfileRemoteSubscribe', array($this->out, $this->profile));
}
} else {
@ -298,16 +295,6 @@ class AccountProfileBlock extends ProfileBlock
$this->out->elementEnd('li');
}
function showRemoteSubscribeLink()
{
$url = common_local_url('remotesubscribe',
array('nickname' => $this->profile->nickname));
$this->out->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
// TRANS: Link text for link that will subscribe to a remote profile.
_m('BUTTON','Subscribe'));
}
function show()
{
$this->out->elementStart('div', 'profile_block account_profile_block section');

View File

@ -69,6 +69,12 @@ class PopularNoticeSection extends NoticeSection
function moreUrl()
{
if (common_config('singleuser', 'enabled')) {
$user = User::singleUser();
common_local_url('showfavorites', array('nickname' =>
$user->nickname));
} else {
return common_local_url('favorited');
}
}
}

View File

@ -377,6 +377,20 @@ class OMBPlugin extends Plugin
return true;
}
function onStartProfileRemoteSubscribe($out, $profile)
{
$out->elementStart('li', 'entity_subscribe');
$url = common_local_url('remotesubscribe',
array('nickname' => $this->profile->nickname));
$out->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
// TRANS: Link text for link that will subscribe to a remote profile.
_m('BUTTON','Subscribe'));
$out->elementEnd('li');
return false;
}
/**
* Plugin version info
*

View File

@ -246,7 +246,7 @@ class OStatusPlugin extends Plugin
$cur = common_current_user();
if (empty($cur)) {
$output->elementStart('li', 'entity_subscribe');
$widget->out->elementStart('li', 'entity_subscribe');
$profile = $peopletag->getTagger();
$url = common_local_url('ostatusinit',
array('group' => $group->nickname));
@ -255,7 +255,7 @@ class OStatusPlugin extends Plugin
// TRANS: Link to subscribe to a remote entity.
_m('Subscribe'));
$output->elementEnd('li');
$widget->out->elementEnd('li');
return false;
}

View File

@ -188,7 +188,7 @@ class RealtimePlugin extends Plugin
// Add to the public timeline
if ($notice->is_local == Notice::LOCAL_PUBLIC ||
($notice->is_local == Notice::REMOTE_OMB && !common_config('public', 'localonly'))) {
($notice->is_local == Notice::REMOTE && !common_config('public', 'localonly'))) {
$paths[] = array('public', null, null);
}

View File

@ -357,36 +357,17 @@ class TwitterauthorizationAction extends Action
$this->elementStart('fieldset', array('id' => 'settings_twitter_connect_options'));
// TRANS: Fieldset legend.
$this->element('legend', null, _m('Connection options'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->element('input', array('type' => 'checkbox',
'id' => 'license',
'class' => 'checkbox',
'name' => 'license',
'value' => 'true'));
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
// TRANS: Text for license agreement checkbox.
// TRANS: %s is the license as configured for the StatusNet site.
$message = _m('My text and files are available under %s ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
$link = '<a href="' .
htmlspecialchars(common_config('license', 'url')) .
'">' .
htmlspecialchars(common_config('license', 'title')) .
'</a>';
$this->raw(sprintf(htmlspecialchars($message), $link));
$this->elementEnd('label');
$this->elementEnd('li');
$this->elementEnd('ul');
$this->hidden('access_token_key', $this->access_token->key);
$this->hidden('access_token_secret', $this->access_token->secret);
$this->hidden('twuid', $this->twuid);
$this->hidden('tw_fields_screen_name', $this->tw_fields['screen_name']);
$this->hidden('tw_fields_name', $this->tw_fields['fullname']);
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
// Don't allow new account creation if site is flagged as invite only
if (common_config('site', 'inviteonly') == false) {
$this->elementStart('fieldset');
$this->element('legend', null,
// TRANS: Fieldset legend.
_m('Create new account'));
@ -420,6 +401,7 @@ class TwitterauthorizationAction extends Action
// TRANS: Button text for creating a new StatusNet account in the Twitter connect page.
$this->submit('create', _m('BUTTON','Create'));
$this->elementEnd('fieldset');
}
$this->elementStart('fieldset');
$this->element('legend', null,
@ -438,10 +420,37 @@ class TwitterauthorizationAction extends Action
$this->password('password', _m('Password'));
$this->elementEnd('li');
$this->elementEnd('ul');
// TRANS: Button text for connecting an existing StatusNet account in the Twitter connect page..
$this->submit('connect', _m('BUTTON','Connect'));
$this->elementEnd('fieldset');
$this->elementStart('fieldset');
$this->element('legend', null,
// TRANS: Fieldset legend.
_m('License'));
$this->elementStart('ul', 'form_data');
$this->elementStart('li');
$this->element('input', array('type' => 'checkbox',
'id' => 'license',
'class' => 'checkbox',
'name' => 'license',
'value' => 'true'));
$this->elementStart('label', array('class' => 'checkbox', 'for' => 'license'));
// TRANS: Text for license agreement checkbox.
// TRANS: %s is the license as configured for the StatusNet site.
$message = _m('My text and files are available under %s ' .
'except this private data: password, ' .
'email address, IM address, and phone number.');
$link = '<a href="' .
htmlspecialchars(common_config('license', 'url')) .
'">' .
htmlspecialchars(common_config('license', 'title')) .
'</a>';
$this->raw(sprintf(htmlspecialchars($message), $link));
$this->elementEnd('label');
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('fieldset');
// TRANS: Button text for connecting an existing StatusNet account in the Twitter connect page..
$this->submit('connect', _m('BUTTON','Connect'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
}