From b80b0d6520b0488cde309d18da34604cd05b5664 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 17 Sep 2011 15:08:04 -0400 Subject: [PATCH 01/12] use correct redirect on logout of single-user site --- actions/logout.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/actions/logout.php b/actions/logout.php index 567d808cd1..4e51271d43 100644 --- a/actions/logout.php +++ b/actions/logout.php @@ -73,7 +73,13 @@ class LogoutAction extends Action } Event::handle('EndLogout', array($this)); - common_redirect(common_local_url('public'), 303); + 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); + } } } From 467b840c446c0a2760e1d6985c88b02111b9b9f2 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 17 Sep 2011 15:08:38 -0400 Subject: [PATCH 02/12] move OMB-specific remote login button to OMB Plugin --- lib/accountprofileblock.php | 13 ------------- plugins/OMB/OMBPlugin.php | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/accountprofileblock.php b/lib/accountprofileblock.php index 59c2777601..4eca000c9e 100644 --- a/lib/accountprofileblock.php +++ b/lib/accountprofileblock.php @@ -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'); diff --git a/plugins/OMB/OMBPlugin.php b/plugins/OMB/OMBPlugin.php index c532c4c894..de0088cc8e 100644 --- a/plugins/OMB/OMBPlugin.php +++ b/plugins/OMB/OMBPlugin.php @@ -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 * From baa17381c0320d8b75da52bde556dfe17eba937c Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 13:27:14 -0700 Subject: [PATCH 03/12] Change time format to work with older PHP (before 5.3) --- plugins/Event/eventform.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Event/eventform.php b/plugins/Event/eventform.php index f62571ce63..8100e5903b 100644 --- a/plugins/Event/eventform.php +++ b/plugins/Event/eventform.php @@ -124,7 +124,7 @@ class EventForm extends Form $this->li(); $times = EventTimeList::getTimes($today->format('m/d/Y 12:00') . ' am ' . $today->format('T')); - $start = EventTimeList::nearestHalfHour('@' . $today->getTimestamp()); + $start = EventTimeList::nearestHalfHour($today->format('c')); $start->setTimezone(new DateTimeZone(common_timezone())); $this->out->dropdown( @@ -160,7 +160,7 @@ class EventForm extends Form 'event-endtime', // TRANS: Field label on event form. _m('LABEL','End time'), - EventTimeList::getTimes('@' . $start->getTimestamp(), true), + EventTimeList::getTimes($start->format('c'), true), // TRANS: Field title on event form. _m('Time the event ends.'), false, From 2d6b4497a4e20014ec98b90bf878364b398ce0fd Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Wed, 14 Sep 2011 16:25:50 -0700 Subject: [PATCH 04/12] Fix undefined variable --- lib/groupprofileblock.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/groupprofileblock.php b/lib/groupprofileblock.php index df383f0696..fc0679247b 100644 --- a/lib/groupprofileblock.php +++ b/lib/groupprofileblock.php @@ -117,7 +117,7 @@ class GroupProfileBlock extends ProfileBlock array('nickname' => $this->group->nickname)), // TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators. // TRANS: %s is the nickname of the group. - 'title' => sprintf(_m('TOOLTIP','Edit %s group properties'), $nickname)), + 'title' => sprintf(_m('TOOLTIP','Edit %s group properties'), $this->group->nickname)), // TRANS: Link text for link on user profile. _m('BUTTON','Edit')); $this->out->elementEnd('li'); @@ -126,7 +126,7 @@ class GroupProfileBlock extends ProfileBlock array('nickname' => $this->group->nickname)), // TRANS: Tooltip for menu item in the group navigation page. Only shown for group administrators. // TRANS: %s is the nickname of the group. - 'title' => sprintf(_m('TOOLTIP','Add or edit %s logo'), $nickname)), + 'title' => sprintf(_m('TOOLTIP','Add or edit %s logo'), $this->group->nickname)), // TRANS: Link text for link on user profile. _m('MENU','Logo')); $this->out->elementEnd('li'); From b34812152d0a4f9bc9f86cd96ab7c3c98939619e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 13:36:05 -0700 Subject: [PATCH 05/12] Don't try to verify URL if the user has left it out when making a new event --- plugins/Event/newevent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Event/newevent.php b/plugins/Event/newevent.php index 34e83cd7e0..4c2157e01e 100644 --- a/plugins/Event/newevent.php +++ b/plugins/Event/newevent.php @@ -206,7 +206,7 @@ class NeweventAction extends Action throw new ClientException(_m('Event must have an end time.')); } - if (isset($this->url) && Validate::uri($this->url) === false) { + if (!empty($this->url) && Validate::uri($this->url) === false) { // TRANS: Client exception thrown when trying to post an event with an invalid URL. throw new ClientException(_m('URL must be valid.')); } From 945bdf649be19962dc9f578036dcc83fe334ee9c Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 17 Sep 2011 17:00:30 -0400 Subject: [PATCH 06/12] show correct favorites link --- lib/popularnoticesection.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/popularnoticesection.php b/lib/popularnoticesection.php index f6f27c6878..e66df8f423 100644 --- a/lib/popularnoticesection.php +++ b/lib/popularnoticesection.php @@ -69,6 +69,12 @@ class PopularNoticeSection extends NoticeSection function moreUrl() { - return common_local_url('favorited'); + if (common_config('singleuser', 'enabled')) { + $user = User::singleUser(); + common_local_url('showfavorites', array('nickname' => + $user->nickname)); + } else { + return common_local_url('favorited'); + } } } From f52d33753e1382b598763d617e762b328b6b4aff Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 17 Sep 2011 17:28:01 -0400 Subject: [PATCH 07/12] problem with remote subscription on groups in OStatus --- plugins/OStatus/OStatusPlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 360aaa0c0a..15d0abaa51 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -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; } From 4467615021fad00ab92df0a79a9a792cbcb7280e Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 14:38:47 -0700 Subject: [PATCH 08/12] Fix reference to constant --- plugins/Realtime/RealtimePlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index d2172dcf8d..3d6302c4e4 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -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); } From 6c43967e8c2bad93e00e1ac98aa2cf4f2ef978b5 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 14:47:35 -0700 Subject: [PATCH 09/12] Don't allow Twitter registration if site is invite only --- .../TwitterBridge/twitterauthorization.php | 65 ++++++++++--------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index 22d7a7fbdc..410f10ff90 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -385,41 +385,44 @@ class TwitterauthorizationAction extends Action $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()); - $this->element('legend', null, - // TRANS: Fieldset legend. - _m('Create new account')); - $this->element('p', null, - // TRANS: Sub form introduction text. - _m('Create a new user with this nickname.')); - $this->elementStart('ul', 'form_data'); + // Don't allow new account creation if site is flagged as invite only + if (common_config('site', 'inviteonly') == false) { + $this->elementStart('fieldset'); + $this->hidden('token', common_session_token()); + $this->element('legend', null, + // TRANS: Fieldset legend. + _m('Create new account')); + $this->element('p', null, + // TRANS: Sub form introduction text. + _m('Create a new user with this nickname.')); + $this->elementStart('ul', 'form_data'); - // Hook point for captcha etc - Event::handle('StartRegistrationFormData', array($this)); + // Hook point for captcha etc + Event::handle('StartRegistrationFormData', array($this)); - $this->elementStart('li'); - // TRANS: Field label. - $this->input('newname', _m('New nickname'), - ($this->username) ? $this->username : '', - // TRANS: Field title for nickname field. - _m('1-64 lowercase letters or numbers, no punctuation or spaces.')); - $this->elementEnd('li'); - $this->elementStart('li'); - // TRANS: Field label. - $this->input('email', _m('LABEL','Email'), $this->getEmail(), - // TRANS: Field title for e-mail address field. - _m('Used only for updates, announcements, '. - 'and password recovery')); - $this->elementEnd('li'); + $this->elementStart('li'); + // TRANS: Field label. + $this->input('newname', _m('New nickname'), + ($this->username) ? $this->username : '', + // TRANS: Field title for nickname field. + _m('1-64 lowercase letters or numbers, no punctuation or spaces.')); + $this->elementEnd('li'); + $this->elementStart('li'); + // TRANS: Field label. + $this->input('email', _m('LABEL','Email'), $this->getEmail(), + // TRANS: Field title for e-mail address field. + _m('Used only for updates, announcements, '. + 'and password recovery')); + $this->elementEnd('li'); - // Hook point for captcha etc - Event::handle('EndRegistrationFormData', array($this)); + // Hook point for captcha etc + Event::handle('EndRegistrationFormData', array($this)); - $this->elementEnd('ul'); - // TRANS: Button text for creating a new StatusNet account in the Twitter connect page. - $this->submit('create', _m('BUTTON','Create')); - $this->elementEnd('fieldset'); + $this->elementEnd('ul'); + // 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, From be95dcf008c40d27f8bf34d18b56a8e25bc93d9d Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 15:43:21 -0700 Subject: [PATCH 10/12] Move license checkbox to the end of the form --- .../TwitterBridge/twitterauthorization.php | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index 410f10ff90..7a07e4690b 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -357,28 +357,7 @@ 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 = '' . - htmlspecialchars(common_config('license', 'title')) . - ''; - $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); @@ -445,6 +424,34 @@ class TwitterauthorizationAction extends Action $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 = '' . + htmlspecialchars(common_config('license', 'title')) . + ''; + $this->raw(sprintf(htmlspecialchars($message), $link)); + $this->elementEnd('label'); + $this->elementEnd('li'); + $this->elementEnd('ul'); + $this->elementEnd('fieldset'); + $this->elementEnd('fieldset'); $this->elementEnd('form'); } From 2df2d4fd1d3dd32d6040e254e041316e986fefe6 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 15:45:55 -0700 Subject: [PATCH 11/12] Move submit (connect) button to the very bottom --- plugins/TwitterBridge/twitterauthorization.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index 7a07e4690b..baaf4a1af7 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -420,8 +420,6 @@ 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'); @@ -451,7 +449,8 @@ class TwitterauthorizationAction extends Action $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'); } From d4ed6db1d87a8109529554bca1f39417907ffe0f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 17 Sep 2011 15:50:13 -0700 Subject: [PATCH 12/12] Make sure the session token gets output no matter what (whoops) --- plugins/TwitterBridge/twitterauthorization.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php index baaf4a1af7..1a7234214e 100644 --- a/plugins/TwitterBridge/twitterauthorization.php +++ b/plugins/TwitterBridge/twitterauthorization.php @@ -363,11 +363,11 @@ class TwitterauthorizationAction extends Action $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->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->hidden('token', common_session_token()); $this->element('legend', null, // TRANS: Fieldset legend. _m('Create new account'));