diff options
Diffstat (limited to 'actions')
-rw-r--r-- | actions/apidirectmessagenew.php | 2 | ||||
-rw-r--r-- | actions/apifavoritecreate.php | 2 | ||||
-rw-r--r-- | actions/apigroupcreate.php | 9 | ||||
-rw-r--r-- | actions/editgroup.php | 5 | ||||
-rw-r--r-- | actions/facebooksettings.php | 11 | ||||
-rw-r--r-- | actions/groupbyid.php | 5 | ||||
-rw-r--r-- | actions/groupdesignsettings.php | 5 | ||||
-rw-r--r-- | actions/grouplogo.php | 5 | ||||
-rw-r--r-- | actions/grouprss.php | 5 | ||||
-rw-r--r-- | actions/joingroup.php | 5 | ||||
-rw-r--r-- | actions/leavegroup.php | 5 | ||||
-rw-r--r-- | actions/newgroup.php | 5 | ||||
-rw-r--r-- | actions/showgroup.php | 5 | ||||
-rw-r--r-- | actions/showstream.php | 366 |
14 files changed, 240 insertions, 195 deletions
diff --git a/actions/apidirectmessagenew.php b/actions/apidirectmessagenew.php index fa6cafbe8..ca1ee70dd 100644 --- a/actions/apidirectmessagenew.php +++ b/actions/apidirectmessagenew.php @@ -157,7 +157,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction // Note: sending msgs to yourself is allowed by Twitter $errmsg = 'Don\'t send a message to yourself; ' . - 'just say it to yourself quietly instead.' + 'just say it to yourself quietly instead.'; $this->clientError(_($errmsg), 403, $this->format); return; diff --git a/actions/apifavoritecreate.php b/actions/apifavoritecreate.php index a80a6492e..436739770 100644 --- a/actions/apifavoritecreate.php +++ b/actions/apifavoritecreate.php @@ -127,7 +127,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction if (empty($fave)) { $this->clientError( - _('Could not create favorite.') + _('Could not create favorite.'), 403, $this->format ); diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php index cdb2afb5b..f66e83073 100644 --- a/actions/apigroupcreate.php +++ b/actions/apigroupcreate.php @@ -99,15 +99,6 @@ class ApiGroupCreateAction extends ApiAuthAction { parent::handle($args); - if (!common_config('inboxes', 'enabled')) { - $this->serverError( - _('Inboxes must be enabled for groups to work'), - 400, - $this->format - ); - return false; - } - if ($_SERVER['REQUEST_METHOD'] != 'POST') { $this->clientError( _('This method requires a POST.'), diff --git a/actions/editgroup.php b/actions/editgroup.php index 5dd039f8a..cf1608035 100644 --- a/actions/editgroup.php +++ b/actions/editgroup.php @@ -64,11 +64,6 @@ class EditgroupAction extends GroupDesignAction { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - if (!common_logged_in()) { $this->clientError(_('You must be logged in to create a group.')); return false; diff --git a/actions/facebooksettings.php b/actions/facebooksettings.php index 84bdde910..b2b1d6807 100644 --- a/actions/facebooksettings.php +++ b/actions/facebooksettings.php @@ -58,8 +58,15 @@ class FacebooksettingsAction extends FacebookAction $this->flink->set_flags($noticesync, $replysync, false, false); $result = $this->flink->update($original); + if ($prefix == '' || $prefix == '0') { + // Facebook bug: saving empty strings to prefs now fails + // http://bugs.developers.facebook.com/show_bug.cgi?id=7110 + $trimmed = $prefix . ' '; + } else { + $trimmed = substr($prefix, 0, 128); + } $this->facebook->api_client->data_setUserPreference(FACEBOOK_NOTICE_PREFIX, - substr($prefix, 0, 128)); + $trimmed); if ($result === false) { $this->showForm(_('There was a problem saving your sync preferences!')); @@ -101,7 +108,7 @@ class FacebooksettingsAction extends FacebookAction $this->elementStart('li'); - $prefix = $this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX); + $prefix = trim($this->facebook->api_client->data_getUserPreference(FACEBOOK_NOTICE_PREFIX)); $this->input('prefix', _('Prefix'), ($prefix) ? $prefix : null, diff --git a/actions/groupbyid.php b/actions/groupbyid.php index 52cfaddfc..f65bf511a 100644 --- a/actions/groupbyid.php +++ b/actions/groupbyid.php @@ -68,11 +68,6 @@ class GroupbyidAction extends Action { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - $id = $this->arg('id'); if (!$id) { diff --git a/actions/groupdesignsettings.php b/actions/groupdesignsettings.php index cd86e3b05..b87b7d156 100644 --- a/actions/groupdesignsettings.php +++ b/actions/groupdesignsettings.php @@ -64,11 +64,6 @@ class GroupDesignSettingsAction extends DesignSettingsAction { parent::prepare($args); - if (!common_config('inboxes', 'enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - if (!common_logged_in()) { $this->clientError(_('You must be logged in to edit a group.')); return false; diff --git a/actions/grouplogo.php b/actions/grouplogo.php index 63ba769c7..a9dc7eb1d 100644 --- a/actions/grouplogo.php +++ b/actions/grouplogo.php @@ -66,11 +66,6 @@ class GrouplogoAction extends GroupDesignAction { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - if (!common_logged_in()) { $this->clientError(_('You must be logged in to create a group.')); return false; diff --git a/actions/grouprss.php b/actions/grouprss.php index 6a6b55e78..50e48a67e 100644 --- a/actions/grouprss.php +++ b/actions/grouprss.php @@ -76,11 +76,6 @@ class groupRssAction extends Rss10Action { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - $nickname_arg = $this->arg('nickname'); $nickname = common_canonical_nickname($nickname_arg); diff --git a/actions/joingroup.php b/actions/joingroup.php index 0209dd43f..bf69b2ad1 100644 --- a/actions/joingroup.php +++ b/actions/joingroup.php @@ -56,11 +56,6 @@ class JoingroupAction extends Action { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - if (!common_logged_in()) { $this->clientError(_('You must be logged in to join a group.')); return false; diff --git a/actions/leavegroup.php b/actions/leavegroup.php index 60b22e147..08fce1509 100644 --- a/actions/leavegroup.php +++ b/actions/leavegroup.php @@ -56,11 +56,6 @@ class LeavegroupAction extends Action { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work.')); - return false; - } - if (!common_logged_in()) { $this->clientError(_('You must be logged in to leave a group.')); return false; diff --git a/actions/newgroup.php b/actions/newgroup.php index a2cf72528..80da9861a 100644 --- a/actions/newgroup.php +++ b/actions/newgroup.php @@ -61,11 +61,6 @@ class NewgroupAction extends Action { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - if (!common_logged_in()) { $this->clientError(_('You must be logged in to create a group.')); return false; diff --git a/actions/showgroup.php b/actions/showgroup.php index a67765ce5..bfe45ddad 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -101,11 +101,6 @@ class ShowgroupAction extends GroupDesignAction { parent::prepare($args); - if (!common_config('inboxes','enabled')) { - $this->serverError(_('Inboxes must be enabled for groups to work')); - return false; - } - $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1; $nickname_arg = $this->arg('nickname'); diff --git a/actions/showstream.php b/actions/showstream.php index cdac4f47b..b3a9b1f05 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -115,11 +115,11 @@ class ShowstreamAction extends ProfileAction { if (!empty($this->tag)) { return array(new Feed(Feed::RSS1, - common_local_url('userrss', - array('nickname' => $this->user->nickname, - 'tag' => $this->tag)), - sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'), - $this->user->nickname, $this->tag))); + common_local_url('userrss', + array('nickname' => $this->user->nickname, + 'tag' => $this->tag)), + sprintf(_('Notice feed for %s tagged %s (RSS 1.0)'), + $this->user->nickname, $this->tag))); } return array(new Feed(Feed::RSS1, @@ -181,159 +181,251 @@ class ShowstreamAction extends ProfileAction function showProfile() { - $this->elementStart('div', 'entity_profile vcard author'); - $this->element('h2', null, _('User profile')); - - $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); - $this->elementStart('dl', 'entity_depiction'); - $this->element('dt', null, _('Photo')); - $this->elementStart('dd'); - $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), - 'class' => 'photo avatar', - 'width' => AVATAR_PROFILE_SIZE, - 'height' => AVATAR_PROFILE_SIZE, - 'alt' => $this->profile->nickname)); - $this->elementEnd('dd'); - - $user = User::staticGet('id', $this->profile->id); - $cur = common_current_user(); - if ($cur && $cur->id == $user->id) { - $this->elementStart('dd'); - $this->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar')); - $this->elementEnd('dd'); + $this->showProfileData(); + $this->showEntityActions(); + } + + function showProfileData() + { + if (Event::handle('StartProfilePageProfileSection', array(&$this, $this->profile))) { + + $this->elementStart('div', 'entity_profile vcard author'); + $this->element('h2', null, _('User profile')); + + if (Event::handle('StartProfilePageProfileElements', array(&$this, $this->profile))) { + + $this->showAvatar(); + $this->showNickname(); + $this->showFullName(); + $this->showLocation(); + $this->showHomepage(); + $this->showBio(); + $this->showProfileTags(); + + Event::handle('EndProfilePageProfileElements', array(&$this, $this->profile)); + } + + $this->elementEnd('div'); + Event::handle('EndProfilePageProfileSection', array(&$this, $this->profile)); } + } + + function showAvatar() + { + if (Event::handle('StartProfilePageAvatar', array($this, $this->profile))) { + + $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); - $this->elementEnd('dl'); - - $this->elementStart('dl', 'entity_nickname'); - $this->element('dt', null, _('Nickname')); - $this->elementStart('dd'); - $hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid'; - $this->element('a', array('href' => $this->profile->profileurl, - 'rel' => 'me', 'class' => $hasFN), - $this->profile->nickname); - $this->elementEnd('dd'); - $this->elementEnd('dl'); - - if ($this->profile->fullname) { - $this->elementStart('dl', 'entity_fn'); - $this->element('dt', null, _('Full name')); + $this->elementStart('dl', 'entity_depiction'); + $this->element('dt', null, _('Photo')); $this->elementStart('dd'); - $this->element('span', 'fn', $this->profile->fullname); + $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE), + 'class' => 'photo avatar', + 'width' => AVATAR_PROFILE_SIZE, + 'height' => AVATAR_PROFILE_SIZE, + 'alt' => $this->profile->nickname)); $this->elementEnd('dd'); - $this->elementEnd('dl'); - } - if ($this->profile->location) { - $this->elementStart('dl', 'entity_location'); - $this->element('dt', null, _('Location')); - $this->element('dd', 'label', $this->profile->location); + $user = User::staticGet('id', $this->profile->id); + + $cur = common_current_user(); + if ($cur && $cur->id == $user->id) { + $this->elementStart('dd'); + $this->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar')); + $this->elementEnd('dd'); + } + $this->elementEnd('dl'); + + Event::handle('EndProfilePageAvatar', array($this, $this->profile)); } + } + + function showNickname() + { + if (Event::handle('StartProfilePageNickname', array($this, $this->profile))) { - if ($this->profile->homepage) { - $this->elementStart('dl', 'entity_url'); - $this->element('dt', null, _('URL')); + $this->elementStart('dl', 'entity_nickname'); + $this->element('dt', null, _('Nickname')); $this->elementStart('dd'); - $this->element('a', array('href' => $this->profile->homepage, - 'rel' => 'me', 'class' => 'url'), - $this->profile->homepage); + $hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid'; + $this->element('a', array('href' => $this->profile->profileurl, + 'rel' => 'me', 'class' => $hasFN), + $this->profile->nickname); $this->elementEnd('dd'); $this->elementEnd('dl'); + + Event::handle('EndProfilePageNickname', array($this, $this->profile)); } + } - if ($this->profile->bio) { - $this->elementStart('dl', 'entity_note'); - $this->element('dt', null, _('Note')); - $this->element('dd', 'note', $this->profile->bio); - $this->elementEnd('dl'); + function showFullName() + { + if (Event::handle('StartProfilePageFullName', array($this, $this->profile))) { + if ($this->profile->fullname) { + $this->elementStart('dl', 'entity_fn'); + $this->element('dt', null, _('Full name')); + $this->elementStart('dd'); + $this->element('span', 'fn', $this->profile->fullname); + $this->elementEnd('dd'); + $this->elementEnd('dl'); + } + Event::handle('EndProfilePageFullName', array($this, $this->profile)); } + } - $tags = Profile_tag::getTags($this->profile->id, $this->profile->id); - if (count($tags) > 0) { - $this->elementStart('dl', 'entity_tags'); - $this->element('dt', null, _('Tags')); - $this->elementStart('dd'); - $this->elementStart('ul', 'tags xoxo'); - foreach ($tags as $tag) { - $this->elementStart('li'); - // Avoid space by using raw output. - $pt = '<span class="mark_hash">#</span><a rel="tag" href="' . - common_local_url('peopletag', array('tag' => $tag)) . - '">' . $tag . '</a>'; - $this->raw($pt); - $this->elementEnd('li'); + function showLocation() + { + if (Event::handle('StartProfilePageLocation', array($this, $this->profile))) { + if ($this->profile->location) { + $this->elementStart('dl', 'entity_location'); + $this->element('dt', null, _('Location')); + $this->element('dd', 'label', $this->profile->location); + $this->elementEnd('dl'); } - $this->elementEnd('ul'); - $this->elementEnd('dd'); - $this->elementEnd('dl'); + Event::handle('EndProfilePageLocation', array($this, $this->profile)); } - $this->elementEnd('div'); + } - $this->elementStart('div', 'entity_actions'); - $this->element('h2', null, _('User actions')); - $this->elementStart('ul'); - $cur = common_current_user(); - - if ($cur && $cur->id == $this->profile->id) { - $this->elementStart('li', 'entity_edit'); - $this->element('a', array('href' => common_local_url('profilesettings'), - 'title' => _('Edit profile settings')), - _('Edit')); - $this->elementEnd('li'); + function showHomepage() + { + if (Event::handle('StartProfilePageHomepage', array($this, $this->profile))) { + if ($this->profile->homepage) { + $this->elementStart('dl', 'entity_url'); + $this->element('dt', null, _('URL')); + $this->elementStart('dd'); + $this->element('a', array('href' => $this->profile->homepage, + 'rel' => 'me', 'class' => 'url'), + $this->profile->homepage); + $this->elementEnd('dd'); + $this->elementEnd('dl'); + } + Event::handle('EndProfilePageHomepage', array($this, $this->profile)); } + } - if ($cur) { - if ($cur->id != $this->profile->id) { - $this->elementStart('li', 'entity_subscribe'); - if ($cur->isSubscribed($this->profile)) { - $usf = new UnsubscribeForm($this, $this->profile); - $usf->show(); - } else { - $sf = new SubscribeForm($this, $this->profile); - $sf->show(); - } - $this->elementEnd('li'); + function showBio() + { + if (Event::handle('StartProfilePageBio', array($this, $this->profile))) { + if ($this->profile->bio) { + $this->elementStart('dl', 'entity_note'); + $this->element('dt', null, _('Note')); + $this->element('dd', 'note', $this->profile->bio); + $this->elementEnd('dl'); } - } else { - $this->elementStart('li', 'entity_subscribe'); - $this->showRemoteSubscribeLink(); - $this->elementEnd('li'); + Event::handle('EndProfilePageBio', array($this, $this->profile)); } + } - if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) { - $this->elementStart('li', 'entity_send-a-message'); - $this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)), - 'title' => _('Send a direct message to this user')), - _('Message')); - $this->elementEnd('li'); - - if ($user->email && $user->emailnotifynudge) { - $this->elementStart('li', 'entity_nudge'); - $nf = new NudgeForm($this, $user); - $nf->show(); - $this->elementEnd('li'); + function showProfileTags() + { + if (Event::handle('StartProfilePageProfileTags', array($this, $this->profile))) { + $tags = Profile_tag::getTags($this->profile->id, $this->profile->id); + + if (count($tags) > 0) { + $this->elementStart('dl', 'entity_tags'); + $this->element('dt', null, _('Tags')); + $this->elementStart('dd'); + $this->elementStart('ul', 'tags xoxo'); + foreach ($tags as $tag) { + $this->elementStart('li'); + // Avoid space by using raw output. + $pt = '<span class="mark_hash">#</span><a rel="tag" href="' . + common_local_url('peopletag', array('tag' => $tag)) . + '">' . $tag . '</a>'; + $this->raw($pt); + $this->elementEnd('li'); + } + $this->elementEnd('ul'); + $this->elementEnd('dd'); + $this->elementEnd('dl'); } + Event::handle('EndProfilePageProfileTags', array($this, $this->profile)); } + } - if ($cur && $cur->id != $this->profile->id) { - $blocked = $cur->hasBlocked($this->profile); - $this->elementStart('li', 'entity_block'); - if ($blocked) { - $ubf = new UnblockForm($this, $this->profile, - array('action' => 'showstream', - 'nickname' => $this->profile->nickname)); - $ubf->show(); - } else { - $bf = new BlockForm($this, $this->profile, - array('action' => 'showstream', - 'nickname' => $this->profile->nickname)); - $bf->show(); + function showEntityActions() + { + if (Event::handle('StartProfilePageActionsSection', array(&$this, $this->profile))) { + + $this->elementStart('div', 'entity_actions'); + $this->element('h2', null, _('User actions')); + $this->elementStart('ul'); + + if (Event::handle('StartProfilePageActionsElements', array(&$this, $this->profile))) { + if (empty($cur)) { // not logged in + $this->elementStart('li', 'entity_subscribe'); + $this->showRemoteSubscribeLink(); + $this->elementEnd('li'); + } else { + if ($cur->id == $this->profile->id) { // your own page + $this->elementStart('li', 'entity_edit'); + $this->element('a', array('href' => common_local_url('profilesettings'), + 'title' => _('Edit profile settings')), + _('Edit')); + $this->elementEnd('li'); + } else { // someone else's page + + // subscribe/unsubscribe button + + $this->elementStart('li', 'entity_subscribe'); + + if ($cur->isSubscribed($this->profile)) { + $usf = new UnsubscribeForm($this, $this->profile); + $usf->show(); + } else { + $sf = new SubscribeForm($this, $this->profile); + $sf->show(); + } + $this->elementEnd('li'); + + if ($cur->mutuallySubscribed($user)) { + + // message + + $this->elementStart('li', 'entity_send-a-message'); + $this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)), + 'title' => _('Send a direct message to this user')), + _('Message')); + $this->elementEnd('li'); + + // nudge + + if ($user->email && $user->emailnotifynudge) { + $this->elementStart('li', 'entity_nudge'); + $nf = new NudgeForm($this, $user); + $nf->show(); + $this->elementEnd('li'); + } + } + + // block/unblock + + $blocked = $cur->hasBlocked($this->profile); + $this->elementStart('li', 'entity_block'); + if ($blocked) { + $ubf = new UnblockForm($this, $this->profile, + array('action' => 'showstream', + 'nickname' => $this->profile->nickname)); + $ubf->show(); + } else { + $bf = new BlockForm($this, $this->profile, + array('action' => 'showstream', + 'nickname' => $this->profile->nickname)); + $bf->show(); + } + $this->elementEnd('li'); + } + } + + Event::handle('EndProfilePageActionsElements', array(&$this, $this->profile)); } - $this->elementEnd('li'); + + $this->elementEnd('ul'); + $this->elementEnd('div'); + + Event::handle('EndProfilePageActionsSection', array(&$this, $this->profile)); } - $this->elementEnd('ul'); - $this->elementEnd('div'); } function showRemoteSubscribeLink() @@ -369,7 +461,7 @@ class ShowstreamAction extends ProfileAction function showNotices() { $notice = empty($this->tag) - ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) + ? $this->user->getNotices(($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) : $this->user->getTaggedNotices($this->tag, ($this->page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null); $pnl = new ProfileNoticeList($notice, $this); @@ -391,14 +483,14 @@ class ShowstreamAction extends ProfileAction { if (!(common_config('site','closed') || common_config('site','inviteonly'))) { $m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [StatusNet](http://status.net/) tool. ' . - '[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'), - $this->user->nickname, $this->user->nickname); + 'based on the Free Software [StatusNet](http://status.net/) tool. ' . + '[Join now](%%%%action.register%%%%) to follow **%s**\'s notices and many more! ([Read more](%%%%doc.help%%%%))'), + $this->user->nickname, $this->user->nickname); } else { $m = sprintf(_('**%s** has an account on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' . - 'based on the Free Software [StatusNet](http://status.net/) tool. '), - $this->user->nickname, $this->user->nickname); - } + 'based on the Free Software [StatusNet](http://status.net/) tool. '), + $this->user->nickname, $this->user->nickname); + } $this->elementStart('div', array('id' => 'anon_notice')); $this->raw(common_markup_to_html($m)); $this->elementEnd('div'); |