Merge branch '0.9.x' of gitorious.org:statusnet/mainline into 1.0.x
Conflicts: actions/hostmeta.php actions/imsettings.php classes/User.php lib/adminpanelaction.php lib/channel.php lib/default.php lib/router.php lib/util.php
This commit is contained in:
commit
59119482ca
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -25,3 +25,4 @@ good-config.php
|
||||||
lac08.log
|
lac08.log
|
||||||
php.log
|
php.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
nbproject
|
||||||
|
|
54
EVENTS.txt
54
EVENTS.txt
|
@ -258,10 +258,28 @@ EndShowExportData: just after showing the <div> with export data (feeds)
|
||||||
- $action: action object being shown
|
- $action: action object being shown
|
||||||
|
|
||||||
StartShowNoticeItem: just before showing the notice item
|
StartShowNoticeItem: just before showing the notice item
|
||||||
- $action: action object being shown
|
- $item: The NoticeListItem object being shown
|
||||||
|
|
||||||
EndShowNoticeItem: just after showing the notice item
|
EndShowNoticeItem: just after showing the notice item
|
||||||
- $action: action object being shown
|
- $item: the NoticeListItem object being shown
|
||||||
|
|
||||||
|
StartShowNoticeInfo: just before showing notice info
|
||||||
|
- $item: The NoticeListItem object being shown
|
||||||
|
|
||||||
|
EndShowNoticeInfo: just after showing notice info
|
||||||
|
- $item: The NoticeListItem object being shown
|
||||||
|
|
||||||
|
StartShowNoticeOptions: just before showing notice options like fave, repeat, etc.
|
||||||
|
- $item: the NoticeListItem object being shown
|
||||||
|
|
||||||
|
EndShowNoticeOptions: just after showing notice options like fave, repeat, etc.
|
||||||
|
- $item: the NoticeListItem object being shown
|
||||||
|
|
||||||
|
StartShowFaveForm: just before showing the fave form
|
||||||
|
- $item: the NoticeListItem object being shown
|
||||||
|
|
||||||
|
EndShowFaveForm: just after showing the fave form
|
||||||
|
- $item: the NoticeListItem object being shown
|
||||||
|
|
||||||
StartShowPageNotice: just before showing the page notice (instructions or error)
|
StartShowPageNotice: just before showing the page notice (instructions or error)
|
||||||
- $action: action object being shown
|
- $action: action object being shown
|
||||||
|
@ -780,6 +798,22 @@ EndDisfavorNotice: After saving a notice as a favorite
|
||||||
- $profile: profile of the person faving (can be remote!)
|
- $profile: profile of the person faving (can be remote!)
|
||||||
- $notice: notice being faved
|
- $notice: notice being faved
|
||||||
|
|
||||||
|
StartFavorNoticeForm: starting the data in the form for favoring a notice
|
||||||
|
- $FavorForm: the favor form being shown
|
||||||
|
- $notice: notice being favored
|
||||||
|
|
||||||
|
EndFavorNoticeForm: Ending the data in the form for favoring a notice
|
||||||
|
- $FavorForm: the favor form being shown
|
||||||
|
- $notice: notice being favored
|
||||||
|
|
||||||
|
StartDisFavorNoticeForm: starting the data in the form for disfavoring a notice
|
||||||
|
- $DisfavorForm: the disfavor form being shown
|
||||||
|
- $notice: notice being difavored
|
||||||
|
|
||||||
|
EndDisFavorNoticeForm: Ending the data in the form for disfavoring a notice
|
||||||
|
- $DisfavorForm: the disfavor form being shown
|
||||||
|
- $notice: notice being disfavored
|
||||||
|
|
||||||
StartFindMentions: start finding mentions in a block of text
|
StartFindMentions: start finding mentions in a block of text
|
||||||
- $sender: sender profile
|
- $sender: sender profile
|
||||||
- $text: plain text version of the notice
|
- $text: plain text version of the notice
|
||||||
|
@ -1110,3 +1144,19 @@ StartDeleteOwnNotice: when a user starts to delete their own notice
|
||||||
EndDeleteOwnNotice: when a user has deleted their own notice
|
EndDeleteOwnNotice: when a user has deleted their own notice
|
||||||
- $user: the user doing the delete
|
- $user: the user doing the delete
|
||||||
- $notice: the notice being deleted
|
- $notice: the notice being deleted
|
||||||
|
|
||||||
|
StartShowFeedLinkList: before showing the feed list in the sidebar
|
||||||
|
- $action: action being executed
|
||||||
|
- $feeds: list of feeds to show
|
||||||
|
|
||||||
|
EndShowFeedLinkList: after showing the feed list in the sidebar
|
||||||
|
- $action: action being executed
|
||||||
|
- $feeds: list of feeds shown
|
||||||
|
|
||||||
|
StartShowFeedLink: before showing an individual feed item
|
||||||
|
- $action: action being executed
|
||||||
|
- $feed: feed to show
|
||||||
|
|
||||||
|
EndShowFeedLink: after showing an individual feed
|
||||||
|
- $action: action being executed
|
||||||
|
- $feed: feed to show
|
||||||
|
|
|
@ -83,6 +83,7 @@ class ApiAccountUpdateDeliveryDeviceAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error message. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400, $this->format
|
400, $this->format
|
||||||
);
|
);
|
||||||
|
|
|
@ -86,6 +86,7 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400, $this->format
|
400, $this->format
|
||||||
);
|
);
|
||||||
|
|
|
@ -83,6 +83,7 @@ class ApiAccountUpdateProfileBackgroundImageAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400, $this->format
|
400, $this->format
|
||||||
);
|
);
|
||||||
|
|
|
@ -107,6 +107,7 @@ class ApiAccountUpdateProfileColorsAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400, $this->format
|
400, $this->format
|
||||||
);
|
);
|
||||||
|
|
|
@ -81,6 +81,7 @@ class ApiAccountUpdateProfileImageAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400, $this->format
|
400, $this->format
|
||||||
);
|
);
|
||||||
|
|
|
@ -86,6 +86,7 @@ class ApiBlockCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -85,6 +85,7 @@ class ApiBlockDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -357,6 +357,7 @@ class ApiDirectMessageAction extends ApiAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
strtotime($this->messages[0]->created),
|
strtotime($this->messages[0]->created),
|
||||||
strtotime($this->messages[$last]->created)
|
strtotime($this->messages[$last]->created)
|
||||||
|
|
|
@ -106,6 +106,7 @@ class ApiDirectMessageNewAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -88,6 +88,7 @@ class ApiFavoriteCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -89,6 +89,7 @@ class ApiFavoriteDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -88,6 +88,7 @@ class ApiFriendshipsCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -88,6 +88,7 @@ class ApiFriendshipsDestroyAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -102,6 +102,7 @@ class ApiGroupCreateAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -89,6 +89,7 @@ class ApiGroupJoinAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -89,6 +89,7 @@ class ApiGroupLeaveAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -213,6 +213,7 @@ class ApiGroupListAction extends ApiBareAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
strtotime($this->groups[0]->created),
|
strtotime($this->groups[0]->created),
|
||||||
|
|
|
@ -204,6 +204,7 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
strtotime($this->groups[0]->created),
|
strtotime($this->groups[0]->created),
|
||||||
strtotime($this->groups[$last]->created))
|
strtotime($this->groups[$last]->created))
|
||||||
|
|
|
@ -183,6 +183,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->group->id,
|
$this->group->id,
|
||||||
strtotime($this->profiles[0]->created),
|
strtotime($this->profiles[0]->created),
|
||||||
|
|
|
@ -149,6 +149,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->group->id,
|
$this->group->id,
|
||||||
strtotime($this->group->modified))
|
strtotime($this->group->modified))
|
||||||
|
|
|
@ -64,6 +64,7 @@ class ApiMediaUploadAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400, $this->format
|
400, $this->format
|
||||||
);
|
);
|
||||||
|
|
|
@ -270,7 +270,7 @@ class ApiOauthAuthorizeAction extends ApiOauthAction
|
||||||
$this->elementStart('form', array('method' => 'post',
|
$this->elementStart('form', array('method' => 'post',
|
||||||
'id' => 'form_apioauthauthorize',
|
'id' => 'form_apioauthauthorize',
|
||||||
'class' => 'form_settings',
|
'class' => 'form_settings',
|
||||||
'action' => common_local_url('apioauthauthorize')));
|
'action' => common_local_url('ApiOauthAuthorize')));
|
||||||
$this->elementStart('fieldset');
|
$this->elementStart('fieldset');
|
||||||
$this->element('legend', array('id' => 'apioauthauthorize_allowdeny'),
|
$this->element('legend', array('id' => 'apioauthauthorize_allowdeny'),
|
||||||
_('Allow or deny access'));
|
_('Allow or deny access'));
|
||||||
|
|
|
@ -62,6 +62,7 @@ class ApiStatusesRetweetAction extends ApiAuthAction
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
$this->clientError(_('This method requires a POST.'),
|
$this->clientError(_('This method requires a POST.'),
|
||||||
400, $this->format);
|
400, $this->format);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -194,6 +194,7 @@ class ApiStatusesShowAction extends ApiPrivateAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->notice->id,
|
$this->notice->id,
|
||||||
strtotime($this->notice->created))
|
strtotime($this->notice->created))
|
||||||
|
|
|
@ -195,6 +195,7 @@ class ApiStatusesUpdateAction extends ApiAuthAction
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||||
$this->clientError(
|
$this->clientError(
|
||||||
|
// TRANS: Client error. POST is a HTTP command. It should not be translated.
|
||||||
_('This method requires a POST.'),
|
_('This method requires a POST.'),
|
||||||
400,
|
400,
|
||||||
$this->format
|
$this->format
|
||||||
|
|
|
@ -181,6 +181,7 @@ class ApiSubscriptionsAction extends ApiBareAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
isset($this->ids_only) ? 'IDs' : 'Profiles',
|
isset($this->ids_only) ? 'IDs' : 'Profiles',
|
||||||
|
|
|
@ -259,6 +259,7 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
strtotime($this->notices[0]->created),
|
strtotime($this->notices[0]->created),
|
||||||
|
|
|
@ -346,6 +346,7 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
strtotime($this->notices[0]->created),
|
strtotime($this->notices[0]->created),
|
||||||
|
|
|
@ -229,6 +229,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->group->id,
|
$this->group->id,
|
||||||
strtotime($this->notices[0]->created),
|
strtotime($this->notices[0]->created),
|
||||||
|
|
|
@ -254,6 +254,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
strtotime($this->notices[0]->created),
|
strtotime($this->notices[0]->created),
|
||||||
|
|
|
@ -244,6 +244,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
strtotime($this->notices[0]->created),
|
strtotime($this->notices[0]->created),
|
||||||
|
|
|
@ -311,6 +311,7 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
strtotime($this->notices[0]->created),
|
strtotime($this->notices[0]->created),
|
||||||
strtotime($this->notices[$last]->created))
|
strtotime($this->notices[$last]->created))
|
||||||
|
|
|
@ -232,6 +232,7 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->tag,
|
$this->tag,
|
||||||
strtotime($this->notices[0]->created),
|
strtotime($this->notices[0]->created),
|
||||||
|
|
|
@ -234,6 +234,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
|
||||||
return '"' . implode(
|
return '"' . implode(
|
||||||
':',
|
':',
|
||||||
array($this->arg('action'),
|
array($this->arg('action'),
|
||||||
|
common_user_cache_hash($this->auth_user),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->user->id,
|
$this->user->id,
|
||||||
strtotime($this->notices[0]->created),
|
strtotime($this->notices[0]->created),
|
||||||
|
|
|
@ -71,7 +71,7 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
return _('Design settings for this StatusNet site.');
|
return _('Design settings for this StatusNet site');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,9 +154,22 @@ class DesignadminpanelAction extends AdminPanelAction
|
||||||
|
|
||||||
$config->query('BEGIN');
|
$config->query('BEGIN');
|
||||||
|
|
||||||
// Only update colors if the theme has not changed.
|
if ($themeChanged) {
|
||||||
|
// If the theme has changed, reset custom colors and let them pick
|
||||||
|
// up the new theme's defaults.
|
||||||
|
$colors = array('background', 'content', 'sidebar', 'text', 'link');
|
||||||
|
foreach ($colors as $colorKey) {
|
||||||
|
// Clear from global config so we see defaults on this page...
|
||||||
|
$GLOBALS['config']['design'][$colorKey . 'color'] = false;
|
||||||
|
|
||||||
if (!$themeChanged) {
|
// And remove old settings from DB...
|
||||||
|
$this->deleteSetting('design', $colorKey . 'color');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Only save colors from the form if the theme has not changed.
|
||||||
|
//
|
||||||
|
// @fixme a future more ajaxy form should allow theme switch
|
||||||
|
// and color customization in one step.
|
||||||
|
|
||||||
$bgcolor = new WebColor($this->trimmed('design_background'));
|
$bgcolor = new WebColor($this->trimmed('design_background'));
|
||||||
$ccolor = new WebColor($this->trimmed('design_content'));
|
$ccolor = new WebColor($this->trimmed('design_content'));
|
||||||
|
|
|
@ -188,7 +188,7 @@ class EditApplicationAction extends OwnerDesignAction
|
||||||
} elseif (Oauth_application::descriptionTooLong($description)) {
|
} elseif (Oauth_application::descriptionTooLong($description)) {
|
||||||
$this->showForm(sprintf(
|
$this->showForm(sprintf(
|
||||||
_('Description is too long (max %d chars).'),
|
_('Description is too long (max %d chars).'),
|
||||||
Oauth_application::maxDescription()));
|
Oauth_application::maxDesc()));
|
||||||
return;
|
return;
|
||||||
} elseif (mb_strlen($source_url) > 255) {
|
} elseif (mb_strlen($source_url) > 255) {
|
||||||
$this->showForm(_('Source URL is too long.'));
|
$this->showForm(_('Source URL is too long.'));
|
||||||
|
@ -253,7 +253,10 @@ class EditApplicationAction extends OwnerDesignAction
|
||||||
|
|
||||||
$result = $this->app->update($orig);
|
$result = $this->app->update($orig);
|
||||||
|
|
||||||
if (!$result) {
|
// Note: 0 means no rows changed, which can happen if the only
|
||||||
|
// thing we changed was the icon, since it's not altered until
|
||||||
|
// the next step.
|
||||||
|
if ($result === false) {
|
||||||
common_log_db_error($this->app, 'UPDATE', __FILE__);
|
common_log_db_error($this->app, 'UPDATE', __FILE__);
|
||||||
$this->serverError(_('Could not update application.'));
|
$this->serverError(_('Could not update application.'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,11 @@ class EmailsettingsAction extends AccountSettingsAction
|
||||||
// TRANS: Field label for e-mail address input in e-mail settings form.
|
// TRANS: Field label for e-mail address input in e-mail settings form.
|
||||||
$this->input('email', _('Email address'),
|
$this->input('email', _('Email address'),
|
||||||
($this->arg('email')) ? $this->arg('email') : null,
|
($this->arg('email')) ? $this->arg('email') : null,
|
||||||
// TRANS: Instructions for e-mail address input form.
|
// TRANS: Instructions for e-mail address input form. Do not translate
|
||||||
|
// TRANS: "example.org". It is one of the domain names reserved for
|
||||||
|
// TRANS: use in examples by http://www.rfc-editor.org/rfc/rfc2606.txt.
|
||||||
|
// TRANS: Any other domain may be owned by a legitimate person or
|
||||||
|
// TRANS: organization.
|
||||||
_('Email address, like "UserName@example.org"'));
|
_('Email address, like "UserName@example.org"'));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
$this->elementEnd('ul');
|
$this->elementEnd('ul');
|
||||||
|
|
|
@ -97,9 +97,13 @@ class GroupmembersAction extends GroupDesignAction
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
if ($this->page == 1) {
|
if ($this->page == 1) {
|
||||||
|
// TRANS: Title of the page showing group members.
|
||||||
|
// TRANS: %s is the name of the group.
|
||||||
return sprintf(_('%s group members'),
|
return sprintf(_('%s group members'),
|
||||||
$this->group->nickname);
|
$this->group->nickname);
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Title of the page showing group members.
|
||||||
|
// TRANS: %1$s is the name of the group, %2$d is the page number of the members list.
|
||||||
return sprintf(_('%1$s group members, page %2$d'),
|
return sprintf(_('%1$s group members, page %2$d'),
|
||||||
$this->group->nickname,
|
$this->group->nickname,
|
||||||
$this->page);
|
$this->page);
|
||||||
|
@ -389,7 +393,14 @@ class GroupBlockForm extends Form
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit', _('Block'), 'submit', null, _('Block this user'));
|
$this->out->submit(
|
||||||
|
'submit',
|
||||||
|
// TRANS: Button text for the form that will block a user from a group.
|
||||||
|
_m('BUTTON','Block'),
|
||||||
|
'submit',
|
||||||
|
null,
|
||||||
|
// TRANS: Submit button title.
|
||||||
|
_m('TOOLTIP', 'Block this user'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,6 +527,13 @@ class MakeAdminForm extends Form
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit', _('Make Admin'), 'submit', null, _('Make this user an admin'));
|
$this->out->submit(
|
||||||
|
'submit',
|
||||||
|
// TRANS: Button text for the form that will make a user administrator.
|
||||||
|
_m('BUTTON','Make Admin'),
|
||||||
|
'submit',
|
||||||
|
null,
|
||||||
|
// TRANS: Submit button title.
|
||||||
|
_m('TOOLTIP','Make this user an admin'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
322
actions/licenseadminpanel.php
Normal file
322
actions/licenseadminpanel.php
Normal file
|
@ -0,0 +1,322 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
|
*
|
||||||
|
* License administration panel
|
||||||
|
*
|
||||||
|
* PHP version 5
|
||||||
|
*
|
||||||
|
* LICENCE: This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* @category Settings
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Zach Copley <zach@status.net>
|
||||||
|
* @copyright 2010 StatusNet, Inc.
|
||||||
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
|
* @link http://status.net/
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!defined('STATUSNET')) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* License settings
|
||||||
|
*
|
||||||
|
* @category Admin
|
||||||
|
* @package StatusNet
|
||||||
|
* @author Zach Copley <zach@status.net>
|
||||||
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
|
* @link http://status.net/
|
||||||
|
*/
|
||||||
|
|
||||||
|
class LicenseadminpanelAction extends AdminPanelAction
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the page title
|
||||||
|
*
|
||||||
|
* @return string page title
|
||||||
|
*/
|
||||||
|
|
||||||
|
function title()
|
||||||
|
{
|
||||||
|
// TRANS: User admin panel title
|
||||||
|
return _m('TITLE', 'License');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instructions for using this form.
|
||||||
|
*
|
||||||
|
* @return string instructions
|
||||||
|
*/
|
||||||
|
|
||||||
|
function getInstructions()
|
||||||
|
{
|
||||||
|
return _('License for this StatusNet site');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the site admin panel form
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
function showForm()
|
||||||
|
{
|
||||||
|
$form = new LicenseAdminPanelForm($this);
|
||||||
|
$form->show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save settings from the form
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
function saveSettings()
|
||||||
|
{
|
||||||
|
static $settings = array(
|
||||||
|
'license' => array('type', 'owner', 'url', 'title', 'image')
|
||||||
|
);
|
||||||
|
|
||||||
|
$values = array();
|
||||||
|
|
||||||
|
foreach ($settings as $section => $parts) {
|
||||||
|
foreach ($parts as $setting) {
|
||||||
|
$values[$section][$setting] = $this->trimmed($setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This throws an exception on validation errors
|
||||||
|
|
||||||
|
$this->validate($values);
|
||||||
|
|
||||||
|
// assert(all values are valid);
|
||||||
|
|
||||||
|
$config = new Config();
|
||||||
|
|
||||||
|
$config->query('BEGIN');
|
||||||
|
|
||||||
|
foreach ($settings as $section => $parts) {
|
||||||
|
foreach ($parts as $setting) {
|
||||||
|
Config::save($section, $setting, $values[$section][$setting]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$config->query('COMMIT');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate License admin form values
|
||||||
|
*
|
||||||
|
* @param array &$values from the form
|
||||||
|
*
|
||||||
|
* @return nothing
|
||||||
|
*/
|
||||||
|
|
||||||
|
function validate(&$values)
|
||||||
|
{
|
||||||
|
// Validate license type (shouldn't have to do it, but just in case)
|
||||||
|
|
||||||
|
$types = array('private', 'allrightsreserved', 'cc');
|
||||||
|
|
||||||
|
if (!in_array($values['license']['type'], $types)) {
|
||||||
|
$this->clientError(_("Invalid license selection."));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the user has set an owner if the site has a private
|
||||||
|
// license
|
||||||
|
|
||||||
|
if ($values['license']['type'] == 'allrightsreserved'
|
||||||
|
&& empty($values['license']['owner'])
|
||||||
|
) {
|
||||||
|
$this->clientError(
|
||||||
|
_("You must specify the owner of the content when using the All Rights Reserved license.")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure the license title is not too long
|
||||||
|
if (mb_strlen($values['license']['type']) > 255) {
|
||||||
|
$this->clientError(
|
||||||
|
_("Invalid license title. Max length is 255 characters.")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure the license URL and license image URL are valid URLs
|
||||||
|
|
||||||
|
$options = array('allowed_schemes' => array('http', 'https'));
|
||||||
|
|
||||||
|
// URLs should be set for cc license
|
||||||
|
|
||||||
|
if ($values['license']['type'] == 'cc') {
|
||||||
|
if (!Validate::uri($values['license']['url'], $options)) {
|
||||||
|
$this->clientError(_("Invalid license URL."));
|
||||||
|
}
|
||||||
|
if (!Validate::uri($values['license']['image'], $options)) {
|
||||||
|
$this->clientError(_("Invalid license image URL."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// can be either blank or a valid URL for private & allrightsreserved
|
||||||
|
|
||||||
|
if (!empty($values['license']['url'])) {
|
||||||
|
if (!Validate::uri($values['license']['url'], $options)) {
|
||||||
|
$this->clientError(_("License URL must be blank or a valid URL."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// can be either blank or a valid URL for private & allrightsreserved
|
||||||
|
|
||||||
|
if (!empty($values['license']['image'])) {
|
||||||
|
if (!Validate::uri($values['license']['image'], $options)) {
|
||||||
|
$this->clientError(_("License image must be blank or valid URL."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LicenseAdminPanelForm extends AdminForm
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* ID of the form
|
||||||
|
*
|
||||||
|
* @return int ID of the form
|
||||||
|
*/
|
||||||
|
|
||||||
|
function id()
|
||||||
|
{
|
||||||
|
return 'licenseadminpanel';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* class of the form
|
||||||
|
*
|
||||||
|
* @return string class of the form
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formClass()
|
||||||
|
{
|
||||||
|
return 'form_settings';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action of the form
|
||||||
|
*
|
||||||
|
* @return string URL of the action
|
||||||
|
*/
|
||||||
|
|
||||||
|
function action()
|
||||||
|
{
|
||||||
|
return common_local_url('licenseadminpanel');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data elements of the form
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formData()
|
||||||
|
{
|
||||||
|
$this->out->elementStart(
|
||||||
|
'fieldset', array('id' => 'settings_license-selection')
|
||||||
|
);
|
||||||
|
$this->out->element('legend', null, _('License selection'));
|
||||||
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
|
$this->li();
|
||||||
|
|
||||||
|
$types = array(
|
||||||
|
'private' => _('Private'),
|
||||||
|
'allrightsreserved' => _('All Rights Reserved'),
|
||||||
|
'cc' => _('Creative Commons')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->out->dropdown(
|
||||||
|
'type',
|
||||||
|
_('Type'),
|
||||||
|
$types,
|
||||||
|
_('Select license'),
|
||||||
|
false,
|
||||||
|
$this->value('type', 'license')
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->unli();
|
||||||
|
|
||||||
|
$this->out->elementEnd('ul');
|
||||||
|
$this->out->elementEnd('fieldset');
|
||||||
|
|
||||||
|
$this->out->elementStart(
|
||||||
|
'fieldset',
|
||||||
|
array('id' => 'settings_license-details')
|
||||||
|
);
|
||||||
|
$this->out->element('legend', null, _('License details'));
|
||||||
|
$this->out->elementStart('ul', 'form_data');
|
||||||
|
|
||||||
|
$this->li();
|
||||||
|
$this->input(
|
||||||
|
'owner',
|
||||||
|
_('Owner'),
|
||||||
|
_('Name of the owner of the site\'s content (if applicable).'),
|
||||||
|
'license'
|
||||||
|
);
|
||||||
|
$this->unli();
|
||||||
|
|
||||||
|
$this->li();
|
||||||
|
$this->input(
|
||||||
|
'title',
|
||||||
|
_('License Title'),
|
||||||
|
_('The title of the license.'),
|
||||||
|
'license'
|
||||||
|
);
|
||||||
|
$this->unli();
|
||||||
|
|
||||||
|
$this->li();
|
||||||
|
$this->input(
|
||||||
|
'url',
|
||||||
|
_('License URL'),
|
||||||
|
_('URL for more information about the license.'),
|
||||||
|
'license'
|
||||||
|
);
|
||||||
|
$this->unli();
|
||||||
|
|
||||||
|
$this->li();
|
||||||
|
$this->input(
|
||||||
|
'image', _('License Image URL'),
|
||||||
|
_('URL for an image to display with the license.'),
|
||||||
|
'license'
|
||||||
|
);
|
||||||
|
$this->unli();
|
||||||
|
|
||||||
|
$this->out->elementEnd('ul');
|
||||||
|
$this->out->elementEnd('fieldset');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action elements
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
|
||||||
|
function formActions()
|
||||||
|
{
|
||||||
|
$this->out->submit(
|
||||||
|
'submit', _('Save'), 'submit', null, _('Save license settings')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -170,7 +170,7 @@ class NewApplicationAction extends OwnerDesignAction
|
||||||
} elseif (Oauth_application::descriptionTooLong($description)) {
|
} elseif (Oauth_application::descriptionTooLong($description)) {
|
||||||
$this->showForm(sprintf(
|
$this->showForm(sprintf(
|
||||||
_('Description is too long (max %d chars).'),
|
_('Description is too long (max %d chars).'),
|
||||||
Oauth_application::maxDescription()));
|
Oauth_application::maxDesc()));
|
||||||
return;
|
return;
|
||||||
} elseif (empty($source_url)) {
|
} elseif (empty($source_url)) {
|
||||||
$this->showForm(_('Source URL is required.'));
|
$this->showForm(_('Source URL is required.'));
|
||||||
|
|
|
@ -80,7 +80,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
return _('You have allowed the following applications to access you account.');
|
return _('You have allowed the following applications to access your account.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -67,7 +67,7 @@ class PathsadminpanelAction extends AdminPanelAction
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
return _('Path and server settings for this StatusNet site.');
|
return _('Path and server settings for this StatusNet site');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,7 +62,7 @@ class SessionsadminpanelAction extends AdminPanelAction
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
return _('Session settings for this StatusNet site.');
|
return _('Session settings for this StatusNet site');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -271,17 +271,17 @@ class ShowApplicationAction extends OwnerDesignAction
|
||||||
|
|
||||||
$this->elementStart('dl', 'entity_request_token_url');
|
$this->elementStart('dl', 'entity_request_token_url');
|
||||||
$this->element('dt', null, _('Request token URL'));
|
$this->element('dt', null, _('Request token URL'));
|
||||||
$this->element('dd', null, common_local_url('apioauthrequesttoken'));
|
$this->element('dd', null, common_local_url('ApiOauthRequestToken'));
|
||||||
$this->elementEnd('dl');
|
$this->elementEnd('dl');
|
||||||
|
|
||||||
$this->elementStart('dl', 'entity_access_token_url');
|
$this->elementStart('dl', 'entity_access_token_url');
|
||||||
$this->element('dt', null, _('Access token URL'));
|
$this->element('dt', null, _('Access token URL'));
|
||||||
$this->element('dd', null, common_local_url('apioauthaccesstoken'));
|
$this->element('dd', null, common_local_url('ApiOauthAccessToken'));
|
||||||
$this->elementEnd('dl');
|
$this->elementEnd('dl');
|
||||||
|
|
||||||
$this->elementStart('dl', 'entity_authorize_url');
|
$this->elementStart('dl', 'entity_authorize_url');
|
||||||
$this->element('dt', null, _('Authorize URL'));
|
$this->element('dt', null, _('Authorize URL'));
|
||||||
$this->element('dd', null, common_local_url('apioauthauthorize'));
|
$this->element('dd', null, common_local_url('ApiOauthAuthorize'));
|
||||||
$this->elementEnd('dl');
|
$this->elementEnd('dl');
|
||||||
|
|
||||||
$this->element('p', 'note',
|
$this->element('p', 'note',
|
||||||
|
|
|
@ -151,6 +151,7 @@ class ShownoticeAction extends OwnerDesignAction
|
||||||
strtotime($this->avatar->modified) : 0;
|
strtotime($this->avatar->modified) : 0;
|
||||||
|
|
||||||
return 'W/"' . implode(':', array($this->arg('action'),
|
return 'W/"' . implode(':', array($this->arg('action'),
|
||||||
|
common_user_cache_hash(),
|
||||||
common_language(),
|
common_language(),
|
||||||
$this->notice->id,
|
$this->notice->id,
|
||||||
strtotime($this->notice->created),
|
strtotime($this->notice->created),
|
||||||
|
@ -291,6 +292,16 @@ class ShownoticeAction extends OwnerDesignAction
|
||||||
array(),
|
array(),
|
||||||
array('format'=>'xml','url'=>$this->notice->uri)),
|
array('format'=>'xml','url'=>$this->notice->uri)),
|
||||||
'title'=>'oEmbed'),null);
|
'title'=>'oEmbed'),null);
|
||||||
|
|
||||||
|
// Extras to aid in sharing notices to Facebook
|
||||||
|
$avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
|
||||||
|
$avatarUrl = ($avatar) ?
|
||||||
|
$avatar->displayUrl() :
|
||||||
|
Avatar::defaultImage($avatar_size);
|
||||||
|
$this->element('meta', array('property' => 'og:image',
|
||||||
|
'content' => $avatarUrl));
|
||||||
|
$this->element('meta', array('property' => 'og:description',
|
||||||
|
'content' => $this->notice->content));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,10 +318,14 @@ class SingleNoticeItem extends NoticeListItem
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$this->showStart();
|
$this->showStart();
|
||||||
$this->showNotice();
|
if (Event::handle('StartShowNoticeItem', array($this))) {
|
||||||
$this->showNoticeAttachments();
|
$this->showNotice();
|
||||||
$this->showNoticeInfo();
|
$this->showNoticeAttachments();
|
||||||
$this->showNoticeOptions();
|
$this->showNoticeInfo();
|
||||||
|
$this->showNoticeOptions();
|
||||||
|
Event::handle('EndShowNoticeItem', array($this));
|
||||||
|
}
|
||||||
|
|
||||||
$this->showEnd();
|
$this->showEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
*
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
* @author Zach Copley <zach@status.net>
|
* @author Zach Copley <zach@status.net>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @copyright 2008-2009 StatusNet, Inc.
|
* @copyright 2008-2010 StatusNet, Inc.
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
@ -67,7 +68,7 @@ class UseradminpanelAction extends AdminPanelAction
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
return _('User settings for this StatusNet site.');
|
return _('User settings for this StatusNet site');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -291,6 +292,6 @@ class UserAdminPanelForm extends AdminForm
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
$this->out->submit('submit', _('Save'), 'submit', null, _('Save site settings'));
|
$this->out->submit('submit', _('Save'), 'submit', null, _('Save user settings'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,8 +42,9 @@ class Avatar extends Memcached_DataObject
|
||||||
return Memcached_DataObject::pkeyGet('Avatar', $kv);
|
return Memcached_DataObject::pkeyGet('Avatar', $kv);
|
||||||
}
|
}
|
||||||
|
|
||||||
// where should the avatar go for this user?
|
/**
|
||||||
|
* Where should the avatar go for this user?
|
||||||
|
*/
|
||||||
static function filename($id, $extension, $size=null, $extra=null)
|
static function filename($id, $extension, $size=null, $extra=null)
|
||||||
{
|
{
|
||||||
if ($size) {
|
if ($size) {
|
||||||
|
|
|
@ -65,5 +65,4 @@ class Consumer extends Memcached_DataObject
|
||||||
$nonce->consumer_key = $this->consumer_key;
|
$nonce->consumer_key = $this->consumer_key;
|
||||||
$nonce->delete();
|
$nonce->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,4 @@ class Conversation extends Memcached_DataObject
|
||||||
|
|
||||||
return $conv;
|
return $conv;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -129,4 +129,32 @@ class Fave extends Memcached_DataObject
|
||||||
|
|
||||||
return $ids;
|
return $ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function asActivity()
|
||||||
|
{
|
||||||
|
$notice = Notice::staticGet('id', $this->notice_id);
|
||||||
|
$profile = Profile::staticGet('id', $this->user_id);
|
||||||
|
|
||||||
|
$act = new Activity();
|
||||||
|
|
||||||
|
$act->verb = ActivityVerb::FAVORITE;
|
||||||
|
$act->id = TagURI::mint('favor:%d:%d:%s',
|
||||||
|
$profile->id,
|
||||||
|
$notice->id,
|
||||||
|
common_date_iso8601($this->modified));
|
||||||
|
|
||||||
|
$act->time = strtotime($this->modified);
|
||||||
|
// TRANS: Activity title when marking a notice as favorite.
|
||||||
|
$act->title = _("Favor");
|
||||||
|
// TRANS: Ntofication given when a user marks a notice as favorite.
|
||||||
|
// TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
|
||||||
|
$act->content = sprintf(_("%1$s marked notice %2$s as a favorite."),
|
||||||
|
$profile->getBestName(),
|
||||||
|
$notice->uri);
|
||||||
|
|
||||||
|
$act->actor = ActivityObject::fromProfile($profile);
|
||||||
|
$act->objects[] = ActivityObject::fromNotice($notice);
|
||||||
|
|
||||||
|
return $act;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ require_once INSTALLDIR.'/classes/File_to_post.php';
|
||||||
/**
|
/**
|
||||||
* Table Definition for file
|
* Table Definition for file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class File extends Memcached_DataObject
|
class File extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
|
|
|
@ -131,4 +131,3 @@ class File_oembed extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,4 +311,3 @@ class File_redirection extends Memcached_DataObject
|
||||||
$file_redir->insert();
|
$file_redir->insert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,4 +57,3 @@ class File_thumbnail extends Memcached_DataObject
|
||||||
$tn->insert();
|
$tn->insert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,4 +67,3 @@ class File_to_post extends Memcached_DataObject
|
||||||
return Memcached_DataObject::pkeyGet('File_to_post', $kv);
|
return Memcached_DataObject::pkeyGet('File_to_post', $kv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ class Foreign_link extends Memcached_DataObject
|
||||||
$result = $flink->find(true);
|
$result = $flink->find(true);
|
||||||
|
|
||||||
return empty($result) ? null : $flink;
|
return empty($result) ? null : $flink;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getByForeignID($foreign_id, $service)
|
static function getByForeignID($foreign_id, $service)
|
||||||
|
@ -129,5 +128,4 @@ class Foreign_link extends Memcached_DataObject
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,5 +83,4 @@ class Foreign_user extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,5 +111,4 @@ class Group_block extends Memcached_DataObject
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table Definition for group_inbox
|
* Table Definition for group_inbox
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Group_inbox extends Memcached_DataObject
|
class Group_inbox extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
###START_AUTOCODE
|
###START_AUTOCODE
|
||||||
|
|
|
@ -65,4 +65,59 @@ class Group_member extends Memcached_DataObject
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMember()
|
||||||
|
{
|
||||||
|
$member = Profile::staticGet('id', $this->profile_id);
|
||||||
|
|
||||||
|
if (empty($member)) {
|
||||||
|
// TRANS: Exception thrown providing an invalid profile ID.
|
||||||
|
// TRANS: %s is the invalid profile ID.
|
||||||
|
throw new Exception(sprintf(_("Profile ID %s is invalid."),$this->profile_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $member;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGroup()
|
||||||
|
{
|
||||||
|
$group = User_group::staticGet('id', $this->group_id);
|
||||||
|
|
||||||
|
if (empty($group)) {
|
||||||
|
// TRANS: Exception thrown providing an invalid group ID.
|
||||||
|
// TRANS: %s is the invalid group ID.
|
||||||
|
throw new Exception(sprintf(_("Group ID %s is invalid."),$this->group_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $group;
|
||||||
|
}
|
||||||
|
|
||||||
|
function asActivity()
|
||||||
|
{
|
||||||
|
$member = $this->getMember();
|
||||||
|
$group = $this->getGroup();
|
||||||
|
|
||||||
|
$act = new Activity();
|
||||||
|
|
||||||
|
$act->id = TagURI::mint('join:%d:%d:%s',
|
||||||
|
$member->id,
|
||||||
|
$group->id,
|
||||||
|
common_date_iso8601($this->created));
|
||||||
|
|
||||||
|
$act->actor = ActivityObject::fromProfile($member);
|
||||||
|
$act->verb = ActivityVerb::JOIN;
|
||||||
|
$act->objects[] = ActivityObject::fromGroup($group);
|
||||||
|
|
||||||
|
$act->time = strtotime($this->created);
|
||||||
|
// TRANS: Activity title.
|
||||||
|
$act->title = _("Join");
|
||||||
|
|
||||||
|
// TRANS: Success message for subscribe to group attempt through OStatus.
|
||||||
|
// TRANS: %1$s is the member name, %2$s is the subscribed group's name.
|
||||||
|
$act->content = sprintf(_('%1$s has joined group %2$s.'),
|
||||||
|
$member->getBestName(),
|
||||||
|
$group->getBestName());
|
||||||
|
|
||||||
|
return $act;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ class Inbox extends Memcached_DataObject
|
||||||
/**
|
/**
|
||||||
* Create a new inbox from existing Notice_inbox stuff
|
* Create a new inbox from existing Notice_inbox stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function initialize($user_id)
|
static function initialize($user_id)
|
||||||
{
|
{
|
||||||
$inbox = Inbox::fromNoticeInbox($user_id);
|
$inbox = Inbox::fromNoticeInbox($user_id);
|
||||||
|
@ -115,10 +114,10 @@ class Inbox extends Memcached_DataObject
|
||||||
*/
|
*/
|
||||||
static function insertNotice($user_id, $notice_id)
|
static function insertNotice($user_id, $notice_id)
|
||||||
{
|
{
|
||||||
// Going straight to the DB rather than trusting our caching
|
// Going straight to the DB rather than trusting our caching
|
||||||
// during an update. Note: not using DB_DataObject::staticGet,
|
// during an update. Note: not using DB_DataObject::staticGet,
|
||||||
// which is unsafe to use directly (in-process caching causes
|
// which is unsafe to use directly (in-process caching causes
|
||||||
// memory leaks, which accumulate in queue processes).
|
// memory leaks, which accumulate in queue processes).
|
||||||
$inbox = new Inbox();
|
$inbox = new Inbox();
|
||||||
if (!$inbox->get('user_id', $user_id)) {
|
if (!$inbox->get('user_id', $user_id)) {
|
||||||
$inbox = Inbox::initialize($user_id);
|
$inbox = Inbox::initialize($user_id);
|
||||||
|
|
|
@ -189,11 +189,11 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
str_replace("\n", " ", $e->getTraceAsString()));
|
str_replace("\n", " ", $e->getTraceAsString()));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$keys = $this->_allCacheKeys();
|
$keys = $this->_allCacheKeys();
|
||||||
|
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$c->set($key, $this);
|
$c->set($key, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,4 +637,3 @@ class Memcached_DataObject extends Safe_DataObject
|
||||||
return $vstr;
|
return $vstr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,6 @@ class Message extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function saveNew($from, $to, $content, $source) {
|
static function saveNew($from, $to, $content, $source) {
|
||||||
|
|
||||||
$sender = Profile::staticGet('id', $from);
|
$sender = Profile::staticGet('id', $from);
|
||||||
|
|
||||||
if (!$sender->hasRight(Right::NEWMESSAGE)) {
|
if (!$sender->hasRight(Right::NEWMESSAGE)) {
|
||||||
|
|
|
@ -36,5 +36,4 @@ class Nonce extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
return array('consumer_key,token' => 'token:consumer_key,token');
|
return array('consumer_key,token' => 'token:consumer_key,token');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -745,6 +745,7 @@ class Notice extends Memcached_DataObject
|
||||||
1,
|
1,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($conversation->N > 0) {
|
if ($conversation->N > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -753,8 +754,15 @@ class Notice extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $groups array of Group *objects*
|
* Pull up a full list of local recipients who will be getting
|
||||||
* @param $recipients array of profile *ids*
|
* this notice in their inbox. Results will be cached, so don't
|
||||||
|
* change the input data wily-nilly!
|
||||||
|
*
|
||||||
|
* @param array $groups optional list of Group objects;
|
||||||
|
* if left empty, will be loaded from group_inbox records
|
||||||
|
* @param array $recipient optional list of reply profile ids
|
||||||
|
* if left empty, will be loaded from reply records
|
||||||
|
* @return array associating recipient user IDs with an inbox source constant
|
||||||
*/
|
*/
|
||||||
function whoGets($groups=null, $recipients=null)
|
function whoGets($groups=null, $recipients=null)
|
||||||
{
|
{
|
||||||
|
@ -787,27 +795,27 @@ class Notice extends Memcached_DataObject
|
||||||
$ni[$id] = NOTICE_INBOX_SOURCE_SUB;
|
$ni[$id] = NOTICE_INBOX_SOURCE_SUB;
|
||||||
}
|
}
|
||||||
|
|
||||||
$profile = $this->getProfile();
|
|
||||||
|
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$users = $group->getUserMembers();
|
$users = $group->getUserMembers();
|
||||||
foreach ($users as $id) {
|
foreach ($users as $id) {
|
||||||
if (!array_key_exists($id, $ni)) {
|
if (!array_key_exists($id, $ni)) {
|
||||||
$user = User::staticGet('id', $id);
|
$ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
|
||||||
if (!$user->hasBlocked($profile)) {
|
|
||||||
$ni[$id] = NOTICE_INBOX_SOURCE_GROUP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($recipients as $recipient) {
|
foreach ($recipients as $recipient) {
|
||||||
|
|
||||||
if (!array_key_exists($recipient, $ni)) {
|
if (!array_key_exists($recipient, $ni)) {
|
||||||
$recipientUser = User::staticGet('id', $recipient);
|
$ni[$recipient] = NOTICE_INBOX_SOURCE_REPLY;
|
||||||
if (!empty($recipientUser)) {
|
}
|
||||||
$ni[$recipient] = NOTICE_INBOX_SOURCE_REPLY;
|
}
|
||||||
}
|
|
||||||
|
// Exclude any deleted, non-local, or blocking recipients.
|
||||||
|
$profile = $this->getProfile();
|
||||||
|
foreach ($ni as $id => $source) {
|
||||||
|
$user = User::staticGet('id', $id);
|
||||||
|
if (empty($user) || $user->hasBlocked($profile)) {
|
||||||
|
unset($ni[$id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1212,6 +1220,64 @@ class Notice extends Memcached_DataObject
|
||||||
return $groups;
|
return $groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function asActivity()
|
||||||
|
{
|
||||||
|
$profile = $this->getProfile();
|
||||||
|
|
||||||
|
$act = new Activity();
|
||||||
|
|
||||||
|
$act->actor = ActivityObject::fromProfile($profile);
|
||||||
|
$act->verb = ActivityVerb::POST;
|
||||||
|
$act->objects[] = ActivityObject::fromNotice($this);
|
||||||
|
|
||||||
|
$act->time = strtotime($this->created);
|
||||||
|
$act->link = $this->bestUrl();
|
||||||
|
|
||||||
|
$act->content = common_xml_safe_str($this->rendered);
|
||||||
|
$act->id = $this->uri;
|
||||||
|
$act->title = common_xml_safe_str($this->content);
|
||||||
|
|
||||||
|
$ctx = new ActivityContext();
|
||||||
|
|
||||||
|
if (!empty($this->reply_to)) {
|
||||||
|
$reply = Notice::staticGet('id', $this->reply_to);
|
||||||
|
if (!empty($reply)) {
|
||||||
|
$ctx->replyToID = $reply->uri;
|
||||||
|
$ctx->replyToUrl = $reply->bestUrl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ctx->location = $this->getLocation();
|
||||||
|
|
||||||
|
$conv = null;
|
||||||
|
|
||||||
|
if (!empty($this->conversation)) {
|
||||||
|
$conv = Conversation::staticGet('id', $this->conversation);
|
||||||
|
if (!empty($conv)) {
|
||||||
|
$ctx->conversation = $conv->uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$reply_ids = $this->getReplies();
|
||||||
|
|
||||||
|
foreach ($reply_ids as $id) {
|
||||||
|
$profile = Profile::staticGet('id', $id);
|
||||||
|
if (!empty($profile)) {
|
||||||
|
$ctx->attention[] = $profile->getUri();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$groups = $this->getGroups();
|
||||||
|
|
||||||
|
foreach ($groups as $group) {
|
||||||
|
$ctx->attention[] = $group->uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
$act->context = $ctx;
|
||||||
|
|
||||||
|
return $act;
|
||||||
|
}
|
||||||
|
|
||||||
// This has gotten way too long. Needs to be sliced up into functional bits
|
// This has gotten way too long. Needs to be sliced up into functional bits
|
||||||
// or ideally exported to a utility class.
|
// or ideally exported to a utility class.
|
||||||
|
|
||||||
|
@ -1240,13 +1306,10 @@ class Notice extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Event::handle('StartActivitySource', array(&$this, &$xs))) {
|
if (Event::handle('StartActivitySource', array(&$this, &$xs))) {
|
||||||
|
|
||||||
if ($source) {
|
if ($source) {
|
||||||
|
|
||||||
$atom_feed = $profile->getAtomFeed();
|
$atom_feed = $profile->getAtomFeed();
|
||||||
|
|
||||||
if (!empty($atom_feed)) {
|
if (!empty($atom_feed)) {
|
||||||
|
|
||||||
$xs->elementStart('source');
|
$xs->elementStart('source');
|
||||||
|
|
||||||
// XXX: we should store the actual feed ID
|
// XXX: we should store the actual feed ID
|
||||||
|
@ -1834,7 +1897,6 @@ class Notice extends Memcached_DataObject
|
||||||
$options = array();
|
$options = array();
|
||||||
|
|
||||||
if (!empty($location_id) && !empty($location_ns)) {
|
if (!empty($location_id) && !empty($location_ns)) {
|
||||||
|
|
||||||
$options['location_id'] = $location_id;
|
$options['location_id'] = $location_id;
|
||||||
$options['location_ns'] = $location_ns;
|
$options['location_ns'] = $location_ns;
|
||||||
|
|
||||||
|
@ -1846,7 +1908,6 @@ class Notice extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!empty($lat) && !empty($lon)) {
|
} else if (!empty($lat) && !empty($lon)) {
|
||||||
|
|
||||||
$options['lat'] = $lat;
|
$options['lat'] = $lat;
|
||||||
$options['lon'] = $lon;
|
$options['lon'] = $lon;
|
||||||
|
|
||||||
|
@ -1857,7 +1918,6 @@ class Notice extends Memcached_DataObject
|
||||||
$options['location_ns'] = $location->location_ns;
|
$options['location_ns'] = $location->location_ns;
|
||||||
}
|
}
|
||||||
} else if (!empty($profile)) {
|
} else if (!empty($profile)) {
|
||||||
|
|
||||||
if (isset($profile->lat) && isset($profile->lon)) {
|
if (isset($profile->lat) && isset($profile->lon)) {
|
||||||
$options['lat'] = $profile->lat;
|
$options['lat'] = $profile->lat;
|
||||||
$options['lon'] = $profile->lon;
|
$options['lon'] = $profile->lon;
|
||||||
|
@ -1974,6 +2034,7 @@ class Notice extends Memcached_DataObject
|
||||||
{
|
{
|
||||||
// We always insert for the author so they don't
|
// We always insert for the author so they don't
|
||||||
// have to wait
|
// have to wait
|
||||||
|
Event::handle('StartNoticeDistribute', array($this));
|
||||||
|
|
||||||
$user = User::staticGet('id', $this->profile_id);
|
$user = User::staticGet('id', $this->profile_id);
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
|
|
|
@ -110,7 +110,6 @@ class Oauth_application extends Memcached_DataObject
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function uploadLogo()
|
function uploadLogo()
|
||||||
{
|
{
|
||||||
if ($_FILES['app_icon']['error'] ==
|
if ($_FILES['app_icon']['error'] ==
|
||||||
|
@ -153,5 +152,4 @@ class Oauth_application extends Memcached_DataObject
|
||||||
$oauser->application_id = $this->id;
|
$oauser->application_id = $this->id;
|
||||||
$oauser->delete();
|
$oauser->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,5 +40,4 @@ class Oauth_application_user extends Memcached_DataObject
|
||||||
|
|
||||||
return empty($result) ? null : $oau;
|
return empty($result) ? null : $oau;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,6 @@ class Profile extends Memcached_DataObject
|
||||||
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
|
foreach (array(AVATAR_PROFILE_SIZE, AVATAR_STREAM_SIZE, AVATAR_MINI_SIZE) as $size) {
|
||||||
# We don't do a scaled one if original is our scaled size
|
# We don't do a scaled one if original is our scaled size
|
||||||
if (!($avatar->width == $size && $avatar->height == $size)) {
|
if (!($avatar->width == $size && $avatar->height == $size)) {
|
||||||
|
|
||||||
$scaled_filename = $imagefile->resize($size);
|
$scaled_filename = $imagefile->resize($size);
|
||||||
|
|
||||||
//$scaled = DB_DataObject::factory('avatar');
|
//$scaled = DB_DataObject::factory('avatar');
|
||||||
|
@ -474,6 +473,41 @@ class Profile extends Memcached_DataObject
|
||||||
return $cnt;
|
return $cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasFave($notice)
|
||||||
|
{
|
||||||
|
$cache = Cache::instance();
|
||||||
|
|
||||||
|
// XXX: Kind of a hack.
|
||||||
|
|
||||||
|
if (!empty($cache)) {
|
||||||
|
// This is the stream of favorite notices, in rev chron
|
||||||
|
// order. This forces it into cache.
|
||||||
|
|
||||||
|
$ids = Fave::stream($this->id, 0, NOTICE_CACHE_WINDOW);
|
||||||
|
|
||||||
|
// If it's in the list, then it's a fave
|
||||||
|
|
||||||
|
if (in_array($notice->id, $ids)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're not past the end of the cache window,
|
||||||
|
// then the cache has all available faves, so this one
|
||||||
|
// is not a fave.
|
||||||
|
|
||||||
|
if (count($ids) < NOTICE_CACHE_WINDOW) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, cache doesn't have all faves;
|
||||||
|
// fall through to the default
|
||||||
|
}
|
||||||
|
|
||||||
|
$fave = Fave::pkeyGet(array('user_id' => $this->id,
|
||||||
|
'notice_id' => $notice->id));
|
||||||
|
return ((is_null($fave)) ? false : true);
|
||||||
|
}
|
||||||
|
|
||||||
function faveCount()
|
function faveCount()
|
||||||
{
|
{
|
||||||
$c = Cache::instance();
|
$c = Cache::instance();
|
||||||
|
@ -517,6 +551,20 @@ class Profile extends Memcached_DataObject
|
||||||
return $cnt;
|
return $cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function blowFavesCache()
|
||||||
|
{
|
||||||
|
$cache = common_memcache();
|
||||||
|
if ($cache) {
|
||||||
|
// Faves don't happen chronologically, so we need to blow
|
||||||
|
// ;last cache, too
|
||||||
|
$cache->delete(common_cache_key('fave:ids_by_user:'.$this->id));
|
||||||
|
$cache->delete(common_cache_key('fave:ids_by_user:'.$this->id.';last'));
|
||||||
|
$cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id));
|
||||||
|
$cache->delete(common_cache_key('fave:ids_by_user_own:'.$this->id.';last'));
|
||||||
|
}
|
||||||
|
$this->blowFaveCount();
|
||||||
|
}
|
||||||
|
|
||||||
function blowSubscriberCount()
|
function blowSubscriberCount()
|
||||||
{
|
{
|
||||||
$c = Cache::instance();
|
$c = Cache::instance();
|
||||||
|
@ -790,13 +838,14 @@ class Profile extends Memcached_DataObject
|
||||||
* @param $right string Name of the right, usually a constant in class Right
|
* @param $right string Name of the right, usually a constant in class Right
|
||||||
* @return boolean whether the user has the right in question
|
* @return boolean whether the user has the right in question
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function hasRight($right)
|
function hasRight($right)
|
||||||
{
|
{
|
||||||
$result = false;
|
$result = false;
|
||||||
|
|
||||||
if ($this->hasRole(Profile_role::DELETED)) {
|
if ($this->hasRole(Profile_role::DELETED)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Event::handle('UserRightsCheck', array($this, $right, &$result))) {
|
if (Event::handle('UserRightsCheck', array($this, $right, &$result))) {
|
||||||
switch ($right)
|
switch ($right)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,6 @@ class Profile_tag extends Memcached_DataObject
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
static function getTags($tagger, $tagged) {
|
static function getTags($tagger, $tagged) {
|
||||||
|
|
||||||
$tags = array();
|
$tags = array();
|
||||||
|
|
||||||
# XXX: store this in memcached
|
# XXX: store this in memcached
|
||||||
|
@ -44,7 +43,6 @@ class Profile_tag extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function setTags($tagger, $tagged, $newtags) {
|
static function setTags($tagger, $tagged, $newtags) {
|
||||||
|
|
||||||
$newtags = array_unique($newtags);
|
$newtags = array_unique($newtags);
|
||||||
$oldtags = Profile_tag::getTags($tagger, $tagged);
|
$oldtags = Profile_tag::getTags($tagger, $tagged);
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,15 @@ class Remember_me extends Memcached_DataObject
|
||||||
|
|
||||||
/* Static get */
|
/* Static get */
|
||||||
function staticGet($k,$v=null)
|
function staticGet($k,$v=null)
|
||||||
{ return Memcached_DataObject::staticGet('Remember_me',$k,$v); }
|
{
|
||||||
|
return Memcached_DataObject::staticGet('Remember_me',$k,$v);
|
||||||
|
}
|
||||||
|
|
||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
function sequenceKey()
|
function sequenceKey()
|
||||||
{ return array(false, false); }
|
{
|
||||||
|
return array(false, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,4 +287,3 @@ class Safe_DataObject extends DB_DataObject
|
||||||
return Safe_DataObject::$iniCache[$key];
|
return Safe_DataObject::$iniCache[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,9 +167,8 @@ class Status_network extends Safe_DataObject
|
||||||
' WHERE nickname = ' . $this->_quote($this->nickname);
|
' WHERE nickname = ' . $this->_quote($this->nickname);
|
||||||
$orig->decache();
|
$orig->decache();
|
||||||
$result = $this->query($qry);
|
$result = $this->query($qry);
|
||||||
if ($result) {
|
$this->decache();
|
||||||
$this->encache();
|
|
||||||
}
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,4 +235,33 @@ class Subscription extends Memcached_DataObject
|
||||||
'subscribed' => $other->id));
|
'subscribed' => $other->id));
|
||||||
return (empty($sub)) ? false : true;
|
return (empty($sub)) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function asActivity()
|
||||||
|
{
|
||||||
|
$subscriber = Profile::staticGet('id', $this->subscriber);
|
||||||
|
$subscribed = Profile::staticGet('id', $this->subscribed);
|
||||||
|
|
||||||
|
$act = new Activity();
|
||||||
|
|
||||||
|
$act->verb = ActivityVerb::FOLLOW;
|
||||||
|
|
||||||
|
$act->id = TagURI::mint('follow:%d:%d:%s',
|
||||||
|
$subscriber->id,
|
||||||
|
$subscribed->id,
|
||||||
|
common_date_iso8601($this->created));
|
||||||
|
|
||||||
|
$act->time = strtotime($this->created);
|
||||||
|
// TRANS: Activity tile when subscribing to another person.
|
||||||
|
$act->title = _("Follow");
|
||||||
|
// TRANS: Notification given when one person starts following another.
|
||||||
|
// TRANS: %1$s is the subscriber, %2$s is the subscribed.
|
||||||
|
$act->content = sprintf(_("%1$s is now following %2$s."),
|
||||||
|
$subscriber->getBestName(),
|
||||||
|
$subscribed->getBestName());
|
||||||
|
|
||||||
|
$act->actor = ActivityObject::fromProfile($subscriber);
|
||||||
|
$act->objects[] = ActivityObject::fromProfile($subscribed);
|
||||||
|
|
||||||
|
return $act;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,6 +250,19 @@ class User extends Memcached_DataObject
|
||||||
|
|
||||||
$user->inboxed = 1;
|
$user->inboxed = 1;
|
||||||
|
|
||||||
|
// Set default-on options here, otherwise they'll be disabled
|
||||||
|
// initially for sites using caching, since the initial encache
|
||||||
|
// doesn't know about the defaults in the database.
|
||||||
|
$user->emailnotifysub = 1;
|
||||||
|
$user->emailnotifyfav = 1;
|
||||||
|
$user->emailnotifynudge = 1;
|
||||||
|
$user->emailnotifymsg = 1;
|
||||||
|
$user->emailnotifyattn = 1;
|
||||||
|
$user->emailmicroid = 1;
|
||||||
|
$user->emailpost = 1;
|
||||||
|
$user->jabbermicroid = 1;
|
||||||
|
$user->viewdesigns = 1;
|
||||||
|
|
||||||
$user->created = common_sql_now();
|
$user->created = common_sql_now();
|
||||||
|
|
||||||
if (Event::handle('StartUserRegister', array(&$user, &$profile))) {
|
if (Event::handle('StartUserRegister', array(&$user, &$profile))) {
|
||||||
|
@ -264,7 +277,13 @@ class User extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->id = $id;
|
$user->id = $id;
|
||||||
$user->uri = common_user_uri($user);
|
|
||||||
|
if (!empty($uri)) {
|
||||||
|
$user->uri = $uri;
|
||||||
|
} else {
|
||||||
|
$user->uri = common_user_uri($user);
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($password)) { // may not have a password for OpenID users
|
if (!empty($password)) { // may not have a password for OpenID users
|
||||||
$user->password = common_munge_password($password, $id);
|
$user->password = common_munge_password($password, $id);
|
||||||
}
|
}
|
||||||
|
@ -388,37 +407,8 @@ class User extends Memcached_DataObject
|
||||||
|
|
||||||
function hasFave($notice)
|
function hasFave($notice)
|
||||||
{
|
{
|
||||||
$cache = Cache::instance();
|
$profile = $this->getProfile();
|
||||||
|
return $profile->hasFave($notice);
|
||||||
// XXX: Kind of a hack.
|
|
||||||
|
|
||||||
if ($cache) {
|
|
||||||
// This is the stream of favorite notices, in rev chron
|
|
||||||
// order. This forces it into cache.
|
|
||||||
|
|
||||||
$ids = Fave::stream($this->id, 0, NOTICE_CACHE_WINDOW);
|
|
||||||
|
|
||||||
// If it's in the list, then it's a fave
|
|
||||||
|
|
||||||
if (in_array($notice->id, $ids)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we're not past the end of the cache window,
|
|
||||||
// then the cache has all available faves, so this one
|
|
||||||
// is not a fave.
|
|
||||||
|
|
||||||
if (count($ids) < NOTICE_CACHE_WINDOW) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise, cache doesn't have all faves;
|
|
||||||
// fall through to the default
|
|
||||||
}
|
|
||||||
|
|
||||||
$fave = Fave::pkeyGet(array('user_id' => $this->id,
|
|
||||||
'notice_id' => $notice->id));
|
|
||||||
return ((is_null($fave)) ? false : true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function mutuallySubscribed($other)
|
function mutuallySubscribed($other)
|
||||||
|
@ -487,17 +477,8 @@ class User extends Memcached_DataObject
|
||||||
|
|
||||||
function blowFavesCache()
|
function blowFavesCache()
|
||||||
{
|
{
|
||||||
$cache = Cache::instance();
|
|
||||||
if ($cache) {
|
|
||||||
// Faves don't happen chronologically, so we need to blow
|
|
||||||
// ;last cache, too
|
|
||||||
$cache->delete(Cache::key('fave:ids_by_user:'.$this->id));
|
|
||||||
$cache->delete(Cache::key('fave:ids_by_user:'.$this->id.';last'));
|
|
||||||
$cache->delete(Cache::key('fave:ids_by_user_own:'.$this->id));
|
|
||||||
$cache->delete(Cache::key('fave:ids_by_user_own:'.$this->id.';last'));
|
|
||||||
}
|
|
||||||
$profile = $this->getProfile();
|
$profile = $this->getProfile();
|
||||||
$profile->blowFaveCount();
|
$profile->blowFavesCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelfTags()
|
function getSelfTags()
|
||||||
|
@ -547,6 +528,9 @@ class User extends Memcached_DataObject
|
||||||
if (Subscription::exists($other, $self)) {
|
if (Subscription::exists($other, $self)) {
|
||||||
Subscription::cancel($other, $self);
|
Subscription::cancel($other, $self);
|
||||||
}
|
}
|
||||||
|
if (Subscription::exists($self, $other)) {
|
||||||
|
Subscription::cancel($self, $other);
|
||||||
|
}
|
||||||
|
|
||||||
$block->query('COMMIT');
|
$block->query('COMMIT');
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,6 @@ class User_group extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function register($fields) {
|
static function register($fields) {
|
||||||
|
|
||||||
// MAGICALLY put fields into current scope
|
// MAGICALLY put fields into current scope
|
||||||
|
|
||||||
extract($fields);
|
extract($fields);
|
||||||
|
|
|
@ -18,7 +18,9 @@ class User_username extends Memcached_DataObject
|
||||||
|
|
||||||
/* Static get */
|
/* Static get */
|
||||||
function staticGet($k,$v=null)
|
function staticGet($k,$v=null)
|
||||||
{ return Memcached_DataObject::staticGet('User_username',$k,$v); }
|
{
|
||||||
|
return Memcached_DataObject::staticGet('User_username',$k,$v);
|
||||||
|
}
|
||||||
|
|
||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
@ -37,6 +39,7 @@ class User_username extends Memcached_DataObject
|
||||||
$user_username->provider_name = $provider_name;
|
$user_username->provider_name = $provider_name;
|
||||||
$user_username->username = $username;
|
$user_username->username = $username;
|
||||||
$user_username->created = DB_DataObject_Cast::dateTime();
|
$user_username->created = DB_DataObject_Cast::dateTime();
|
||||||
|
|
||||||
if($user_username->insert()){
|
if($user_username->insert()){
|
||||||
return $user_username;
|
return $user_username;
|
||||||
}else{
|
}else{
|
||||||
|
@ -57,5 +60,4 @@ class User_username extends Memcached_DataObject
|
||||||
function keys() {
|
function keys() {
|
||||||
return array('provider_name' => 'K', 'username' => 'K');
|
return array('provider_name' => 'K', 'username' => 'K');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,10 @@ VALUES
|
||||||
('socialoomphBfD4pMqz31', 'SocialOomph', 'http://www.socialoomph.com/', now()),
|
('socialoomphBfD4pMqz31', 'SocialOomph', 'http://www.socialoomph.com/', now()),
|
||||||
('spaz','Spaz','http://funkatron.com/spaz', now()),
|
('spaz','Spaz','http://funkatron.com/spaz', now()),
|
||||||
('StatusNet Desktop', 'StatusNet Desktop', 'http://status.net/desktop', now()),
|
('StatusNet Desktop', 'StatusNet Desktop', 'http://status.net/desktop', now()),
|
||||||
|
('StatusNet Mobile', 'StatusNet Mobile', 'http://status.net/mobile', now()),
|
||||||
|
('StatusNet iPhone', 'iPhone', 'http://status.net/iphone', now()),
|
||||||
|
('StatusNet Android', 'Android', 'http://status.net/android', now()),
|
||||||
|
('StatusNet Blackberry', 'Blackberry', 'http://status.net/blackberry', now()),
|
||||||
('tarpipe','tarpipe','http://tarpipe.com/', now()),
|
('tarpipe','tarpipe','http://tarpipe.com/', now()),
|
||||||
('tjunar','Tjunar','http://nederflash.nl/boek/titels/tjunar-air', now()),
|
('tjunar','Tjunar','http://nederflash.nl/boek/titels/tjunar-air', now()),
|
||||||
('tr.im','tr.im','http://tr.im/', now()),
|
('tr.im','tr.im','http://tr.im/', now()),
|
||||||
|
|
|
@ -44,7 +44,6 @@ require_once INSTALLDIR.'/lib/settingsaction.php';
|
||||||
*
|
*
|
||||||
* @see Widget
|
* @see Widget
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AccountSettingsAction extends SettingsAction
|
class AccountSettingsAction extends SettingsAction
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +53,6 @@ class AccountSettingsAction extends SettingsAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showLocalNav()
|
function showLocalNav()
|
||||||
{
|
{
|
||||||
$menu = new AccountSettingsNav($this);
|
$menu = new AccountSettingsNav($this);
|
||||||
|
@ -73,7 +71,6 @@ class AccountSettingsAction extends SettingsAction
|
||||||
*
|
*
|
||||||
* @see HTMLOutputter
|
* @see HTMLOutputter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AccountSettingsNav extends Widget
|
class AccountSettingsNav extends Widget
|
||||||
{
|
{
|
||||||
var $action = null;
|
var $action = null;
|
||||||
|
@ -83,7 +80,6 @@ class AccountSettingsNav extends Widget
|
||||||
*
|
*
|
||||||
* @param Action $action current action, used for output
|
* @param Action $action current action, used for output
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($action=null)
|
function __construct($action=null)
|
||||||
{
|
{
|
||||||
parent::__construct($action);
|
parent::__construct($action);
|
||||||
|
@ -95,7 +91,6 @@ class AccountSettingsNav extends Widget
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$action_name = $this->action->trimmed('action');
|
$action_name = $this->action->trimmed('action');
|
||||||
|
|
|
@ -314,7 +314,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showFeeds()
|
function showFeeds()
|
||||||
{
|
{
|
||||||
$feeds = $this->getFeeds();
|
$feeds = $this->getFeeds();
|
||||||
|
@ -710,19 +709,18 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showAside()
|
function showAside()
|
||||||
{
|
{
|
||||||
$this->elementStart('div', array('id' => 'aside_primary',
|
$this->elementStart('div', array('id' => 'aside_primary',
|
||||||
'class' => 'aside'));
|
'class' => 'aside'));
|
||||||
if (Event::handle('StartShowExportData', array($this))) {
|
|
||||||
$this->showExportData();
|
|
||||||
Event::handle('EndShowExportData', array($this));
|
|
||||||
}
|
|
||||||
if (Event::handle('StartShowSections', array($this))) {
|
if (Event::handle('StartShowSections', array($this))) {
|
||||||
$this->showSections();
|
$this->showSections();
|
||||||
Event::handle('EndShowSections', array($this));
|
Event::handle('EndShowSections', array($this));
|
||||||
}
|
}
|
||||||
|
if (Event::handle('StartShowExportData', array($this))) {
|
||||||
|
$this->showExportData();
|
||||||
|
Event::handle('EndShowExportData', array($this));
|
||||||
|
}
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -731,7 +729,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showExportData()
|
function showExportData()
|
||||||
{
|
{
|
||||||
$feeds = $this->getFeeds();
|
$feeds = $this->getFeeds();
|
||||||
|
@ -807,6 +804,7 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
// TRANS: Secondary navigation menu option leading to contact information on the StatusNet site.
|
// TRANS: Secondary navigation menu option leading to contact information on the StatusNet site.
|
||||||
_('Contact'));
|
_('Contact'));
|
||||||
$this->menuItem(common_local_url('doc', array('title' => 'badge')),
|
$this->menuItem(common_local_url('doc', array('title' => 'badge')),
|
||||||
|
// TRANS: Secondary navigation menu option.
|
||||||
_('Badge'));
|
_('Badge'));
|
||||||
Event::handle('EndSecondaryNav', array($this));
|
Event::handle('EndSecondaryNav', array($this));
|
||||||
}
|
}
|
||||||
|
@ -840,6 +838,9 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
$this->elementStart('dd', null);
|
$this->elementStart('dd', null);
|
||||||
if (common_config('site', 'broughtby')) {
|
if (common_config('site', 'broughtby')) {
|
||||||
// TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is set.
|
// TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is set.
|
||||||
|
// TRANS: Text between [] is a link description, text between () is the link itself.
|
||||||
|
// TRANS: Make sure there is no whitespace between "]" and "(".
|
||||||
|
// TRANS: "%%site.broughtby%%" is the value of the variable site.broughtby
|
||||||
$instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%).');
|
$instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%).');
|
||||||
} else {
|
} else {
|
||||||
// TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is not set.
|
// TRANS: First sentence of the StatusNet site license. Used if 'broughtby' is not set.
|
||||||
|
@ -847,6 +848,9 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
}
|
}
|
||||||
$instr .= ' ';
|
$instr .= ' ';
|
||||||
// TRANS: Second sentence of the StatusNet site license. Mentions the StatusNet source code license.
|
// TRANS: Second sentence of the StatusNet site license. Mentions the StatusNet source code license.
|
||||||
|
// TRANS: Make sure there is no whitespace between "]" and "(".
|
||||||
|
// TRANS: Text between [] is a link description, text between () is the link itself.
|
||||||
|
// TRANS: %s is the version of StatusNet that is being used.
|
||||||
$instr .= sprintf(_('It runs the [StatusNet](http://status.net/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), STATUSNET_VERSION);
|
$instr .= sprintf(_('It runs the [StatusNet](http://status.net/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), STATUSNET_VERSION);
|
||||||
$output = common_markup_to_html($instr);
|
$output = common_markup_to_html($instr);
|
||||||
$this->raw($output);
|
$this->raw($output);
|
||||||
|
@ -893,7 +897,8 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
'width' => '80',
|
'width' => '80',
|
||||||
'height' => '15'));
|
'height' => '15'));
|
||||||
$this->text(' ');
|
$this->text(' ');
|
||||||
// TRANS: license message in footer. %1$s is the site name, %2$s is a link to the license URL, with a licence name set in configuration.
|
// TRANS: license message in footer.
|
||||||
|
// TRANS: %1$s is the site name, %2$s is a link to the license URL, with a licence name set in configuration.
|
||||||
$notice = _('All %1$s content and data are available under the %2$s license.');
|
$notice = _('All %1$s content and data are available under the %2$s license.');
|
||||||
$link = "<a class=\"license\" rel=\"external license\" href=\"" .
|
$link = "<a class=\"license\" rel=\"external license\" href=\"" .
|
||||||
htmlspecialchars(common_config('license', 'url')) .
|
htmlspecialchars(common_config('license', 'url')) .
|
||||||
|
@ -947,7 +952,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -1011,17 +1015,22 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$checked = false;
|
||||||
if ($etag) {
|
if ($etag) {
|
||||||
$if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ?
|
$if_none_match = (array_key_exists('HTTP_IF_NONE_MATCH', $_SERVER)) ?
|
||||||
$_SERVER['HTTP_IF_NONE_MATCH'] : null;
|
$_SERVER['HTTP_IF_NONE_MATCH'] : null;
|
||||||
if ($if_none_match && $this->_hasEtag($etag, $if_none_match)) {
|
if ($if_none_match) {
|
||||||
header('HTTP/1.1 304 Not Modified');
|
// If this check fails, ignore the if-modified-since below.
|
||||||
// Better way to do this?
|
$checked = true;
|
||||||
exit(0);
|
if ($this->_hasEtag($etag, $if_none_match)) {
|
||||||
|
header('HTTP/1.1 304 Not Modified');
|
||||||
|
// Better way to do this?
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($lm && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
|
if (!$checked && $lm && array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER)) {
|
||||||
$if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
$if_modified_since = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
||||||
$ims = strtotime($if_modified_since);
|
$ims = strtotime($if_modified_since);
|
||||||
if ($lm <= $ims) {
|
if ($lm <= $ims) {
|
||||||
|
@ -1041,7 +1050,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return boolean is read only action?
|
* @return boolean is read only action?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isCacheable()
|
function isCacheable()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -1055,7 +1063,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function _hasEtag($etag, $if_none_match)
|
function _hasEtag($etag, $if_none_match)
|
||||||
{
|
{
|
||||||
$etags = explode(',', $if_none_match);
|
$etags = explode(',', $if_none_match);
|
||||||
|
@ -1095,7 +1102,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return integer integer value
|
* @return integer integer value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function int($key, $defValue=null, $maxValue=null, $minValue=null)
|
function int($key, $defValue=null, $maxValue=null, $minValue=null)
|
||||||
{
|
{
|
||||||
$arg = strtolower($this->trimmed($key));
|
$arg = strtolower($this->trimmed($key));
|
||||||
|
@ -1123,7 +1129,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function serverError($msg, $code=500)
|
function serverError($msg, $code=500)
|
||||||
{
|
{
|
||||||
$action = $this->trimmed('action');
|
$action = $this->trimmed('action');
|
||||||
|
@ -1139,7 +1144,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function clientError($msg, $code=400)
|
function clientError($msg, $code=400)
|
||||||
{
|
{
|
||||||
$action = $this->trimmed('action');
|
$action = $this->trimmed('action');
|
||||||
|
@ -1152,7 +1156,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return string current URL
|
* @return string current URL
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function selfUrl()
|
function selfUrl()
|
||||||
{
|
{
|
||||||
list($action, $args) = $this->returnToArgs();
|
list($action, $args) = $this->returnToArgs();
|
||||||
|
@ -1164,7 +1167,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return array two elements: action, other args
|
* @return array two elements: action, other args
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function returnToArgs()
|
function returnToArgs()
|
||||||
{
|
{
|
||||||
$action = $this->trimmed('action');
|
$action = $this->trimmed('action');
|
||||||
|
@ -1271,7 +1273,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return array Feed object to show in head and links
|
* @return array Feed object to show in head and links
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getFeeds()
|
function getFeeds()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -1282,7 +1283,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return Design a design object to use
|
* @return Design a design object to use
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getDesign()
|
function getDesign()
|
||||||
{
|
{
|
||||||
return Design::siteDesign();
|
return Design::siteDesign();
|
||||||
|
@ -1296,7 +1296,6 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// XXX: Finding this type of check with the same message about 50 times.
|
// XXX: Finding this type of check with the same message about 50 times.
|
||||||
// Possible to refactor?
|
// Possible to refactor?
|
||||||
function checkSessionToken()
|
function checkSessionToken()
|
||||||
|
@ -1304,6 +1303,7 @@ class Action extends HTMLOutputter // lawsuit
|
||||||
// CSRF protection
|
// CSRF protection
|
||||||
$token = $this->trimmed('token');
|
$token = $this->trimmed('token');
|
||||||
if (empty($token) || $token != common_session_token()) {
|
if (empty($token) || $token != common_session_token()) {
|
||||||
|
// TRANS: Client error text when there is a problem with the session token.
|
||||||
$this->clientError(_('There was a problem with your session token.'));
|
$this->clientError(_('There was a problem with your session token.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Activity
|
class Activity
|
||||||
{
|
{
|
||||||
const SPEC = 'http://activitystrea.ms/spec/1.0/';
|
const SPEC = 'http://activitystrea.ms/spec/1.0/';
|
||||||
|
@ -108,7 +107,6 @@ class Activity
|
||||||
* @param DOMElement $entry Atom entry to poke at
|
* @param DOMElement $entry Atom entry to poke at
|
||||||
* @param DOMElement $feed Atom feed, for context
|
* @param DOMElement $feed Atom feed, for context
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($entry = null, $feed = null)
|
function __construct($entry = null, $feed = null)
|
||||||
{
|
{
|
||||||
if (is_null($entry)) {
|
if (is_null($entry)) {
|
||||||
|
@ -133,6 +131,7 @@ class Activity
|
||||||
$entry->localName == 'item') {
|
$entry->localName == 'item') {
|
||||||
$this->_fromRssItem($entry, $feed);
|
$this->_fromRssItem($entry, $feed);
|
||||||
} else {
|
} else {
|
||||||
|
// Low level exception. No need for i18n.
|
||||||
throw new Exception("Unknown DOM element: {$entry->namespaceURI} {$entry->localName}");
|
throw new Exception("Unknown DOM element: {$entry->namespaceURI} {$entry->localName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -313,13 +312,12 @@ class Activity
|
||||||
*
|
*
|
||||||
* @return DOMElement Atom entry
|
* @return DOMElement Atom entry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function toAtomEntry()
|
function toAtomEntry()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function asString($namespace=false)
|
function asString($namespace=false, $author=true)
|
||||||
{
|
{
|
||||||
$xs = new XMLStringer(true);
|
$xs = new XMLStringer(true);
|
||||||
|
|
||||||
|
@ -338,7 +336,7 @@ class Activity
|
||||||
|
|
||||||
$xs->element('id', null, $this->id);
|
$xs->element('id', null, $this->id);
|
||||||
$xs->element('title', null, $this->title);
|
$xs->element('title', null, $this->title);
|
||||||
$xs->element('published', null, common_date_iso8601($this->time));
|
$xs->element('published', null, self::iso8601Date($this->time));
|
||||||
$xs->element('content', array('type' => 'html'), $this->content);
|
$xs->element('content', array('type' => 'html'), $this->content);
|
||||||
|
|
||||||
if (!empty($this->summary)) {
|
if (!empty($this->summary)) {
|
||||||
|
@ -353,13 +351,15 @@ class Activity
|
||||||
|
|
||||||
// XXX: add context
|
// XXX: add context
|
||||||
|
|
||||||
$xs->elementStart('author');
|
if ($author) {
|
||||||
$xs->element('uri', array(), $this->actor->id);
|
$xs->elementStart('author');
|
||||||
if ($this->actor->title) {
|
$xs->element('uri', array(), $this->actor->id);
|
||||||
$xs->element('name', array(), $this->actor->title);
|
if ($this->actor->title) {
|
||||||
|
$xs->element('name', array(), $this->actor->title);
|
||||||
|
}
|
||||||
|
$xs->elementEnd('author');
|
||||||
|
$xs->raw($this->actor->asString('activity:actor'));
|
||||||
}
|
}
|
||||||
$xs->elementEnd('author');
|
|
||||||
$xs->raw($this->actor->asString('activity:actor'));
|
|
||||||
|
|
||||||
$xs->element('activity:verb', null, $this->verb);
|
$xs->element('activity:verb', null, $this->verb);
|
||||||
|
|
||||||
|
@ -386,5 +386,12 @@ class Activity
|
||||||
{
|
{
|
||||||
return ActivityUtils::child($element, $tag, $namespace);
|
return ActivityUtils::child($element, $tag, $namespace);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
static function iso8601Date($tm)
|
||||||
|
{
|
||||||
|
$dateStr = date('d F Y H:i:s', $tm);
|
||||||
|
$d = new DateTime($dateStr, new DateTimeZone('UTC'));
|
||||||
|
$d->setTimezone(new DateTimeZone(common_timezone()));
|
||||||
|
return $d->format('c');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -54,8 +54,12 @@ class ActivityContext
|
||||||
const MENTIONED = 'mentioned';
|
const MENTIONED = 'mentioned';
|
||||||
const CONVERSATION = 'ostatus:conversation';
|
const CONVERSATION = 'ostatus:conversation';
|
||||||
|
|
||||||
function __construct($element)
|
function __construct($element = null)
|
||||||
{
|
{
|
||||||
|
if (empty($element)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$replyToEl = ActivityUtils::child($element, self::INREPLYTO, self::THR);
|
$replyToEl = ActivityUtils::child($element, self::INREPLYTO, self::THR);
|
||||||
|
|
||||||
if (!empty($replyToEl)) {
|
if (!empty($replyToEl)) {
|
||||||
|
@ -73,7 +77,6 @@ class ActivityContext
|
||||||
|
|
||||||
$attention = array();
|
$attention = array();
|
||||||
for ($i = 0; $i < $links->length; $i++) {
|
for ($i = 0; $i < $links->length; $i++) {
|
||||||
|
|
||||||
$link = $links->item($i);
|
$link = $links->item($i);
|
||||||
|
|
||||||
$linkRel = $link->getAttribute(ActivityUtils::REL);
|
$linkRel = $link->getAttribute(ActivityUtils::REL);
|
||||||
|
|
|
@ -49,7 +49,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ActivityObject
|
class ActivityObject
|
||||||
{
|
{
|
||||||
const ARTICLE = 'http://activitystrea.ms/schema/1.0/article';
|
const ARTICLE = 'http://activitystrea.ms/schema/1.0/article';
|
||||||
|
@ -116,7 +115,6 @@ class ActivityObject
|
||||||
*
|
*
|
||||||
* @param DOMElement $element DOM thing to turn into an Activity thing
|
* @param DOMElement $element DOM thing to turn into an Activity thing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($element = null)
|
function __construct($element = null)
|
||||||
{
|
{
|
||||||
if (empty($element)) {
|
if (empty($element)) {
|
||||||
|
@ -168,7 +166,6 @@ class ActivityObject
|
||||||
ActivityObject::MEDIA_DESCRIPTION,
|
ActivityObject::MEDIA_DESCRIPTION,
|
||||||
Activity::MEDIA
|
Activity::MEDIA
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +201,7 @@ class ActivityObject
|
||||||
|
|
||||||
$title = ActivityUtils::childHtmlContent($element, self::TITLE);
|
$title = ActivityUtils::childHtmlContent($element, self::TITLE);
|
||||||
|
|
||||||
$this->title = html_entity_decode(strip_tags($title));
|
$this->title = html_entity_decode(strip_tags($title), ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
$this->source = $this->_getSource($element);
|
$this->source = $this->_getSource($element);
|
||||||
|
|
||||||
|
@ -217,8 +214,7 @@ class ActivityObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @fixme rationalize with Activity::_fromRssItem()
|
// @todo FIXME: rationalize with Activity::_fromRssItem()
|
||||||
|
|
||||||
private function _fromRssItem($item)
|
private function _fromRssItem($item)
|
||||||
{
|
{
|
||||||
$this->title = ActivityUtils::childContent($item, ActivityObject::TITLE, Activity::RSS);
|
$this->title = ActivityUtils::childContent($item, ActivityObject::TITLE, Activity::RSS);
|
||||||
|
@ -418,7 +414,6 @@ class ActivityObject
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($sizes as $size) {
|
foreach ($sizes as $size) {
|
||||||
|
|
||||||
$alink = null;
|
$alink = null;
|
||||||
$avatar = $profile->getAvatar($size);
|
$avatar = $profile->getAvatar($size);
|
||||||
|
|
||||||
|
@ -430,6 +425,17 @@ class ActivityObject
|
||||||
$alink->height = $size;
|
$alink->height = $size;
|
||||||
$alink->width = $size;
|
$alink->width = $size;
|
||||||
$alink->url = Avatar::defaultImage($size);
|
$alink->url = Avatar::defaultImage($size);
|
||||||
|
|
||||||
|
if ($size == AVATAR_PROFILE_SIZE) {
|
||||||
|
// Hack for Twitter import: we don't have a 96x96 image,
|
||||||
|
// but we do have a 73x73 image. For now, fake it with that.
|
||||||
|
$avatar = $profile->getAvatar(73);
|
||||||
|
if ($avatar) {
|
||||||
|
$alink = AvatarLink::fromAvatar($avatar);
|
||||||
|
$alink->height= $size;
|
||||||
|
$alink->width = $size;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$object->avatarLinks[] = $alink;
|
$object->avatarLinks[] = $alink;
|
||||||
|
|
|
@ -46,7 +46,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ActivityUtils
|
class ActivityUtils
|
||||||
{
|
{
|
||||||
const ATOM = 'http://www.w3.org/2005/Atom';
|
const ATOM = 'http://www.w3.org/2005/Atom';
|
||||||
|
@ -66,7 +65,6 @@ class ActivityUtils
|
||||||
*
|
*
|
||||||
* @return string related link, if any
|
* @return string related link, if any
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getPermalink($element)
|
static function getPermalink($element)
|
||||||
{
|
{
|
||||||
return self::getLink($element, 'alternate', 'text/html');
|
return self::getLink($element, 'alternate', 'text/html');
|
||||||
|
@ -79,19 +77,16 @@ class ActivityUtils
|
||||||
*
|
*
|
||||||
* @return string related link, if any
|
* @return string related link, if any
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getLink(DOMNode $element, $rel, $type=null)
|
static function getLink(DOMNode $element, $rel, $type=null)
|
||||||
{
|
{
|
||||||
$els = $element->childNodes;
|
$els = $element->childNodes;
|
||||||
|
|
||||||
foreach ($els as $link) {
|
foreach ($els as $link) {
|
||||||
|
|
||||||
if (!($link instanceof DOMElement)) {
|
if (!($link instanceof DOMElement)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
|
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
|
||||||
|
|
||||||
$linkRel = $link->getAttribute(self::REL);
|
$linkRel = $link->getAttribute(self::REL);
|
||||||
$linkType = $link->getAttribute(self::TYPE);
|
$linkType = $link->getAttribute(self::TYPE);
|
||||||
|
|
||||||
|
@ -112,7 +107,6 @@ class ActivityUtils
|
||||||
|
|
||||||
foreach ($els as $link) {
|
foreach ($els as $link) {
|
||||||
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
|
if ($link->localName == self::LINK && $link->namespaceURI == self::ATOM) {
|
||||||
|
|
||||||
$linkRel = $link->getAttribute(self::REL);
|
$linkRel = $link->getAttribute(self::REL);
|
||||||
$linkType = $link->getAttribute(self::TYPE);
|
$linkType = $link->getAttribute(self::TYPE);
|
||||||
|
|
||||||
|
@ -135,7 +129,6 @@ class ActivityUtils
|
||||||
*
|
*
|
||||||
* @return DOMElement found element or null
|
* @return DOMElement found element or null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function child(DOMNode $element, $tag, $namespace=self::ATOM)
|
static function child(DOMNode $element, $tag, $namespace=self::ATOM)
|
||||||
{
|
{
|
||||||
$els = $element->childNodes;
|
$els = $element->childNodes;
|
||||||
|
@ -160,7 +153,6 @@ class ActivityUtils
|
||||||
*
|
*
|
||||||
* @return string content of the child
|
* @return string content of the child
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function childContent(DOMNode $element, $tag, $namespace=self::ATOM)
|
static function childContent(DOMNode $element, $tag, $namespace=self::ATOM)
|
||||||
{
|
{
|
||||||
$el = self::child($element, $tag, $namespace);
|
$el = self::child($element, $tag, $namespace);
|
||||||
|
@ -194,7 +186,6 @@ class ActivityUtils
|
||||||
* @todo handle embedded XML mime types
|
* @todo handle embedded XML mime types
|
||||||
* @todo handle base64-encoded non-XML and non-text mime types
|
* @todo handle base64-encoded non-XML and non-text mime types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static function getContent($element)
|
static function getContent($element)
|
||||||
{
|
{
|
||||||
return self::childHtmlContent($element, self::CONTENT, self::ATOM);
|
return self::childHtmlContent($element, self::CONTENT, self::ATOM);
|
||||||
|
@ -205,6 +196,7 @@ class ActivityUtils
|
||||||
$src = $el->getAttribute(self::SRC);
|
$src = $el->getAttribute(self::SRC);
|
||||||
|
|
||||||
if (!empty($src)) {
|
if (!empty($src)) {
|
||||||
|
// TRANS: Client exception thrown when there is no source attribute.
|
||||||
throw new ClientException(_("Can't handle remote content yet."));
|
throw new ClientException(_("Can't handle remote content yet."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,10 +233,12 @@ class ActivityUtils
|
||||||
return trim($text);
|
return trim($text);
|
||||||
} else if (in_array($type, array('text/xml', 'application/xml')) ||
|
} else if (in_array($type, array('text/xml', 'application/xml')) ||
|
||||||
preg_match('#(+|/)xml$#', $type)) {
|
preg_match('#(+|/)xml$#', $type)) {
|
||||||
|
// TRANS: Client exception thrown when there embedded XML content is found that cannot be processed yet.
|
||||||
throw new ClientException(_("Can't handle embedded XML content yet."));
|
throw new ClientException(_("Can't handle embedded XML content yet."));
|
||||||
} else if (strncasecmp($type, 'text/', 5)) {
|
} else if (strncasecmp($type, 'text/', 5)) {
|
||||||
return $el->textContent;
|
return $el->textContent;
|
||||||
} else {
|
} else {
|
||||||
|
// TRANS: Client exception thrown when base64 encoded content is found that cannot be processed yet.
|
||||||
throw new ClientException(_("Can't handle embedded Base64 content yet."));
|
throw new ClientException(_("Can't handle embedded Base64 content yet."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ if (!defined('STATUSNET')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ActivityVerb
|
class ActivityVerb
|
||||||
{
|
{
|
||||||
const POST = 'http://activitystrea.ms/schema/1.0/post';
|
const POST = 'http://activitystrea.ms/schema/1.0/post';
|
||||||
|
|
|
@ -45,7 +45,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
*
|
*
|
||||||
* @see Form
|
* @see Form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AdminForm extends Form
|
class AdminForm extends Form
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +58,6 @@ class AdminForm extends Form
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function input($setting, $title, $instructions, $section='site')
|
function input($setting, $title, $instructions, $section='site')
|
||||||
{
|
{
|
||||||
$this->out->input($setting, $title, $this->value($setting, $section), $instructions);
|
$this->out->input($setting, $title, $this->value($setting, $section), $instructions);
|
||||||
|
@ -73,7 +71,6 @@ class AdminForm extends Form
|
||||||
*
|
*
|
||||||
* @return string param value if posted, or current config value
|
* @return string param value if posted, or current config value
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function value($setting, $main='site')
|
function value($setting, $main='site')
|
||||||
{
|
{
|
||||||
$value = $this->out->trimmed($setting);
|
$value = $this->out->trimmed($setting);
|
||||||
|
@ -82,5 +79,4 @@ class AdminForm extends Form
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ if (!defined('STATUSNET')) {
|
||||||
*
|
*
|
||||||
* @todo Find some commonalities with SettingsAction and combine
|
* @todo Find some commonalities with SettingsAction and combine
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AdminPanelAction extends Action
|
class AdminPanelAction extends Action
|
||||||
{
|
{
|
||||||
var $success = true;
|
var $success = true;
|
||||||
|
@ -61,7 +60,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -124,7 +122,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
@ -155,7 +152,6 @@ class AdminPanelAction extends Action
|
||||||
* @return void
|
* @return void
|
||||||
* @see AdminPanelNav
|
* @see AdminPanelNav
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showLocalNav()
|
function showLocalNav()
|
||||||
{
|
{
|
||||||
$nav = new AdminPanelNav($this);
|
$nav = new AdminPanelNav($this);
|
||||||
|
@ -169,7 +165,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void.
|
* @return void.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showContent()
|
function showContent()
|
||||||
{
|
{
|
||||||
$this->showForm();
|
$this->showForm();
|
||||||
|
@ -199,7 +194,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showPageNotice()
|
function showPageNotice()
|
||||||
{
|
{
|
||||||
if ($this->msg) {
|
if ($this->msg) {
|
||||||
|
@ -222,7 +216,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showForm()
|
function showForm()
|
||||||
{
|
{
|
||||||
// TRANS: Client error message.
|
// TRANS: Client error message.
|
||||||
|
@ -239,7 +232,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getInstructions()
|
function getInstructions()
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
|
@ -252,7 +244,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function saveSettings()
|
function saveSettings()
|
||||||
{
|
{
|
||||||
// TRANS: Client error message
|
// TRANS: Client error message
|
||||||
|
@ -267,7 +258,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @return mixed $result false if something didn't work
|
* @return mixed $result false if something didn't work
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function deleteSetting($section, $setting)
|
function deleteSetting($section, $setting)
|
||||||
{
|
{
|
||||||
$config = new Config();
|
$config = new Config();
|
||||||
|
@ -314,7 +304,6 @@ class AdminPanelAction extends Action
|
||||||
*
|
*
|
||||||
* @see Widget
|
* @see Widget
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AdminPanelNav extends Widget
|
class AdminPanelNav extends Widget
|
||||||
{
|
{
|
||||||
var $action = null;
|
var $action = null;
|
||||||
|
@ -324,7 +313,6 @@ class AdminPanelNav extends Widget
|
||||||
*
|
*
|
||||||
* @param Action $action current action, used for output
|
* @param Action $action current action, used for output
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($action=null)
|
function __construct($action=null)
|
||||||
{
|
{
|
||||||
parent::__construct($action);
|
parent::__construct($action);
|
||||||
|
@ -336,7 +324,6 @@ class AdminPanelNav extends Widget
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$action_name = $this->action->trimmed('action');
|
$action_name = $this->action->trimmed('action');
|
||||||
|
@ -409,6 +396,14 @@ class AdminPanelNav extends Widget
|
||||||
$menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
|
$menu_title, $action_name == 'snapshotadminpanel', 'nav_snapshot_admin_panel');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (AdminPanelAction::canAdmin('license')) {
|
||||||
|
// TRANS: Menu item title/tooltip
|
||||||
|
$menu_title = _('Set site license');
|
||||||
|
// TRANS: Menu item for site administration
|
||||||
|
$this->out->menuItem(common_local_url('licenseadminpanel'), _('License'),
|
||||||
|
$menu_title, $action_name == 'licenseadminpanel', 'nav_license_admin_panel');
|
||||||
|
}
|
||||||
|
|
||||||
if (AdminPanelAction::canAdmin('plugins')) {
|
if (AdminPanelAction::canAdmin('plugins')) {
|
||||||
// TRANS: Menu item title/tooltip
|
// TRANS: Menu item title/tooltip
|
||||||
$menu_title = _('Plugins configuration');
|
$menu_title = _('Plugins configuration');
|
||||||
|
@ -421,5 +416,4 @@ class AdminPanelNav extends Widget
|
||||||
}
|
}
|
||||||
$this->action->elementEnd('ul');
|
$this->action->elementEnd('ul');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,6 @@ class ApiValidationException extends Exception { }
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiAction extends Action
|
class ApiAction extends Action
|
||||||
{
|
{
|
||||||
const READ_ONLY = 1;
|
const READ_ONLY = 1;
|
||||||
|
@ -141,7 +140,6 @@ class ApiAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean false if user doesn't exist
|
* @return boolean false if user doesn't exist
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
StatusNet::setApi(true); // reduce exception reports to aid in debugging
|
StatusNet::setApi(true); // reduce exception reports to aid in debugging
|
||||||
|
@ -174,7 +172,6 @@ class ApiAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
@ -467,7 +464,6 @@ class ApiAction extends Action
|
||||||
$entry = array();
|
$entry = array();
|
||||||
|
|
||||||
if (Event::handle('StartRssEntryArray', array($notice, &$entry))) {
|
if (Event::handle('StartRssEntryArray', array($notice, &$entry))) {
|
||||||
|
|
||||||
$profile = $notice->getProfile();
|
$profile = $notice->getProfile();
|
||||||
|
|
||||||
// We trim() to avoid extraneous whitespace in the output
|
// We trim() to avoid extraneous whitespace in the output
|
||||||
|
@ -557,7 +553,6 @@ class ApiAction extends Action
|
||||||
$notifications = false;
|
$notifications = false;
|
||||||
|
|
||||||
if ($source->isSubscribed($target)) {
|
if ($source->isSubscribed($target)) {
|
||||||
|
|
||||||
$sub = Subscription::pkeyGet(array('subscriber' =>
|
$sub = Subscription::pkeyGet(array('subscriber' =>
|
||||||
$source->id, 'subscribed' => $target->id));
|
$source->id, 'subscribed' => $target->id));
|
||||||
|
|
||||||
|
@ -743,7 +738,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showXmlTimeline($notice)
|
function showXmlTimeline($notice)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('xml');
|
$this->initDocument('xml');
|
||||||
$this->elementStart('statuses', array('type' => 'array',
|
$this->elementStart('statuses', array('type' => 'array',
|
||||||
'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
|
'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
|
||||||
|
@ -768,7 +762,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showRssTimeline($notice, $title, $link, $subtitle, $suplink = null, $logo = null, $self = null)
|
function showRssTimeline($notice, $title, $link, $subtitle, $suplink = null, $logo = null, $self = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('rss');
|
$this->initDocument('rss');
|
||||||
|
|
||||||
$this->element('title', null, $title);
|
$this->element('title', null, $title);
|
||||||
|
@ -824,7 +817,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showAtomTimeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null, $logo=null)
|
function showAtomTimeline($notice, $title, $id, $link, $subtitle=null, $suplink=null, $selfuri=null, $logo=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('atom');
|
$this->initDocument('atom');
|
||||||
|
|
||||||
$this->element('title', null, $title);
|
$this->element('title', null, $title);
|
||||||
|
@ -864,12 +856,10 @@ class ApiAction extends Action
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->endDocument('atom');
|
$this->endDocument('atom');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showRssGroups($group, $title, $link, $subtitle)
|
function showRssGroups($group, $title, $link, $subtitle)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('rss');
|
$this->initDocument('rss');
|
||||||
|
|
||||||
$this->element('title', null, $title);
|
$this->element('title', null, $title);
|
||||||
|
@ -1017,7 +1007,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showAtomGroups($group, $title, $id, $link, $subtitle=null, $selfuri=null)
|
function showAtomGroups($group, $title, $id, $link, $subtitle=null, $selfuri=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('atom');
|
$this->initDocument('atom');
|
||||||
|
|
||||||
$this->element('title', null, common_xml_safe_str($title));
|
$this->element('title', null, common_xml_safe_str($title));
|
||||||
|
@ -1048,7 +1037,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showJsonTimeline($notice)
|
function showJsonTimeline($notice)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('json');
|
$this->initDocument('json');
|
||||||
|
|
||||||
$statuses = array();
|
$statuses = array();
|
||||||
|
@ -1074,7 +1062,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showJsonGroups($group)
|
function showJsonGroups($group)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('json');
|
$this->initDocument('json');
|
||||||
|
|
||||||
$groups = array();
|
$groups = array();
|
||||||
|
@ -1120,7 +1107,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showTwitterXmlUsers($user)
|
function showTwitterXmlUsers($user)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('xml');
|
$this->initDocument('xml');
|
||||||
$this->elementStart('users', array('type' => 'array',
|
$this->elementStart('users', array('type' => 'array',
|
||||||
'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
|
'xmlns:statusnet' => 'http://status.net/schema/api/1/'));
|
||||||
|
@ -1143,7 +1129,6 @@ class ApiAction extends Action
|
||||||
|
|
||||||
function showJsonUsers($user)
|
function showJsonUsers($user)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initDocument('json');
|
$this->initDocument('json');
|
||||||
|
|
||||||
$users = array();
|
$users = array();
|
||||||
|
@ -1228,7 +1213,6 @@ class ApiAction extends Action
|
||||||
$this->endXML();
|
$this->endXML();
|
||||||
break;
|
break;
|
||||||
case 'json':
|
case 'json':
|
||||||
|
|
||||||
// Check for JSONP callback
|
// Check for JSONP callback
|
||||||
if (isset($this->callback)) {
|
if (isset($this->callback)) {
|
||||||
print ')';
|
print ')';
|
||||||
|
@ -1374,7 +1358,6 @@ class ApiAction extends Action
|
||||||
function getTargetUser($id)
|
function getTargetUser($id)
|
||||||
{
|
{
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
|
|
||||||
// Twitter supports these other ways of passing the user ID
|
// Twitter supports these other ways of passing the user ID
|
||||||
if (is_numeric($this->arg('id'))) {
|
if (is_numeric($this->arg('id'))) {
|
||||||
return User::staticGet($this->arg('id'));
|
return User::staticGet($this->arg('id'));
|
||||||
|
@ -1485,7 +1468,6 @@ class ApiAction extends Action
|
||||||
*/
|
*/
|
||||||
function arg($key, $def=null)
|
function arg($key, $def=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
// XXX: Do even more input validation/scrubbing?
|
// XXX: Do even more input validation/scrubbing?
|
||||||
|
|
||||||
if (array_key_exists($key, $this->args)) {
|
if (array_key_exists($key, $this->args)) {
|
||||||
|
@ -1552,5 +1534,4 @@ class ApiAction extends Action
|
||||||
|
|
||||||
return $uri;
|
return $uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,6 @@ require_once INSTALLDIR . '/lib/apioauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiAuthAction extends ApiAction
|
class ApiAuthAction extends ApiAction
|
||||||
{
|
{
|
||||||
var $auth_user_nickname = null;
|
var $auth_user_nickname = null;
|
||||||
|
@ -83,7 +82,6 @@ class ApiAuthAction extends ApiAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -126,7 +124,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return mixed the OAuthRequest or false
|
* @return mixed the OAuthRequest or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getOAuthRequest()
|
function getOAuthRequest()
|
||||||
{
|
{
|
||||||
ApiOauthAction::cleanRequest();
|
ApiOauthAction::cleanRequest();
|
||||||
|
@ -154,7 +151,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return nothing
|
* @return nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function checkOAuthRequest($request)
|
function checkOAuthRequest($request)
|
||||||
{
|
{
|
||||||
$datastore = new ApiStatusNetOAuthDataStore();
|
$datastore = new ApiStatusNetOAuthDataStore();
|
||||||
|
@ -164,7 +160,6 @@ class ApiAuthAction extends ApiAction
|
||||||
$server->add_signature_method($hmac_method);
|
$server->add_signature_method($hmac_method);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$server->verify_request($request);
|
$server->verify_request($request);
|
||||||
|
|
||||||
$consumer = $request->get_parameter('oauth_consumer_key');
|
$consumer = $request->get_parameter('oauth_consumer_key');
|
||||||
|
@ -176,7 +171,8 @@ class ApiAuthAction extends ApiAction
|
||||||
common_log(LOG_WARNING,
|
common_log(LOG_WARNING,
|
||||||
'Couldn\'t find the OAuth app for consumer key: ' .
|
'Couldn\'t find the OAuth app for consumer key: ' .
|
||||||
$consumer);
|
$consumer);
|
||||||
throw new OAuthException('No application for that consumer key.');
|
// TRANS: OAuth exception thrown when no application is found for a given consumer key.
|
||||||
|
throw new OAuthException(_('No application for that consumer key.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the source attr
|
// set the source attr
|
||||||
|
@ -186,19 +182,15 @@ class ApiAuthAction extends ApiAction
|
||||||
$appUser = Oauth_application_user::staticGet('token', $access_token);
|
$appUser = Oauth_application_user::staticGet('token', $access_token);
|
||||||
|
|
||||||
if (!empty($appUser)) {
|
if (!empty($appUser)) {
|
||||||
|
|
||||||
// If access_type == 0 we have either a request token
|
// If access_type == 0 we have either a request token
|
||||||
// or a bad / revoked access token
|
// or a bad / revoked access token
|
||||||
|
|
||||||
if ($appUser->access_type != 0) {
|
if ($appUser->access_type != 0) {
|
||||||
|
|
||||||
// Set the access level for the api call
|
// Set the access level for the api call
|
||||||
|
|
||||||
$this->access = ($appUser->access_type & Oauth_application::$writeAccess)
|
$this->access = ($appUser->access_type & Oauth_application::$writeAccess)
|
||||||
? self::READ_WRITE : self::READ_ONLY;
|
? self::READ_WRITE : self::READ_ONLY;
|
||||||
|
|
||||||
// Set the auth user
|
// Set the auth user
|
||||||
|
|
||||||
if (Event::handle('StartSetApiUser', array(&$user))) {
|
if (Event::handle('StartSetApiUser', array(&$user))) {
|
||||||
$this->auth_user = User::staticGet('id', $appUser->profile_id);
|
$this->auth_user = User::staticGet('id', $appUser->profile_id);
|
||||||
Event::handle('EndSetApiUser', array($user));
|
Event::handle('EndSetApiUser', array($user));
|
||||||
|
@ -216,13 +208,13 @@ class ApiAuthAction extends ApiAction
|
||||||
'read-write' : 'read-only'
|
'read-write' : 'read-only'
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
throw new OAuthException('Bad access token.');
|
// TRANS: OAuth exception given when an incorrect access token was given for a user.
|
||||||
|
throw new OAuthException(_('Bad access token.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Also should not happen
|
// Also should not happen
|
||||||
|
// TRANS: OAuth exception given when no user was found for a given token (no token was found).
|
||||||
throw new OAuthException('No user for that token.');
|
throw new OAuthException(_('No user for that token.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (OAuthException $e) {
|
} catch (OAuthException $e) {
|
||||||
|
@ -237,7 +229,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return boolean true
|
* @return boolean true
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function requiresAuth()
|
function requiresAuth()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -249,7 +240,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function checkBasicAuthUser($required = true)
|
function checkBasicAuthUser($required = true)
|
||||||
{
|
{
|
||||||
$this->basicAuthProcessHeader();
|
$this->basicAuthProcessHeader();
|
||||||
|
@ -264,8 +254,8 @@ class ApiAuthAction extends ApiAction
|
||||||
header('WWW-Authenticate: Basic realm="' . $realm . '"');
|
header('WWW-Authenticate: Basic realm="' . $realm . '"');
|
||||||
|
|
||||||
// show error if the user clicks 'cancel'
|
// show error if the user clicks 'cancel'
|
||||||
|
// TRANS: Client error thrown when authentication fails becaus a user clicked "Cancel".
|
||||||
$this->clientError("Could not authenticate you.", 401, $this->format);
|
$this->clientError(_("Could not authenticate you."), 401, $this->format);
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -283,13 +273,11 @@ class ApiAuthAction extends ApiAction
|
||||||
}
|
}
|
||||||
|
|
||||||
// By default, basic auth users have rw access
|
// By default, basic auth users have rw access
|
||||||
|
|
||||||
$this->access = self::READ_WRITE;
|
$this->access = self::READ_WRITE;
|
||||||
|
|
||||||
if (empty($this->auth_user) && ($required || isset($_SERVER['PHP_AUTH_USER']))) {
|
if (empty($this->auth_user) && ($required || isset($_SERVER['PHP_AUTH_USER']))) {
|
||||||
|
|
||||||
// basic authentication failed
|
// basic authentication failed
|
||||||
|
|
||||||
list($proxy, $ip) = common_client_ip();
|
list($proxy, $ip) = common_client_ip();
|
||||||
|
|
||||||
$msg = sprintf( 'Failed API auth attempt, nickname = %1$s, ' .
|
$msg = sprintf( 'Failed API auth attempt, nickname = %1$s, ' .
|
||||||
|
@ -298,7 +286,8 @@ class ApiAuthAction extends ApiAction
|
||||||
$proxy,
|
$proxy,
|
||||||
$ip);
|
$ip);
|
||||||
common_log(LOG_WARNING, $msg);
|
common_log(LOG_WARNING, $msg);
|
||||||
$this->clientError("Could not authenticate you.", 401, $this->format);
|
// TRANS: Client error thrown when authentication fails.
|
||||||
|
$this->clientError(_("Could not authenticate you."), 401, $this->format);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,7 +299,6 @@ class ApiAuthAction extends ApiAction
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function basicAuthProcessHeader()
|
function basicAuthProcessHeader()
|
||||||
{
|
{
|
||||||
$authHeaders = array('AUTHORIZATION',
|
$authHeaders = array('AUTHORIZATION',
|
||||||
|
@ -332,7 +320,6 @@ class ApiAuthAction extends ApiAction
|
||||||
|
|
||||||
// Decode the HTTP_AUTHORIZATION header on php-cgi server self
|
// Decode the HTTP_AUTHORIZATION header on php-cgi server self
|
||||||
// on fcgid server the header name is AUTHORIZATION
|
// on fcgid server the header name is AUTHORIZATION
|
||||||
|
|
||||||
$auth_hash = base64_decode(substr($authorization_header, 6));
|
$auth_hash = base64_decode(substr($authorization_header, 6));
|
||||||
list($this->auth_user_nickname,
|
list($this->auth_user_nickname,
|
||||||
$this->auth_user_password) = explode(':', $auth_hash);
|
$this->auth_user_password) = explode(':', $auth_hash);
|
||||||
|
|
|
@ -60,10 +60,8 @@ require_once INSTALLDIR.'/lib/apiauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiBareAuthAction extends ApiAuthAction
|
class ApiBareAuthAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take arguments for running
|
* Take arguments for running
|
||||||
*
|
*
|
||||||
|
@ -72,7 +70,6 @@ class ApiBareAuthAction extends ApiAuthAction
|
||||||
* @return boolean success flag
|
* @return boolean success flag
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function prepare($args)
|
function prepare($args)
|
||||||
{
|
{
|
||||||
parent::prepare($args);
|
parent::prepare($args);
|
||||||
|
@ -84,18 +81,15 @@ class ApiBareAuthAction extends ApiAuthAction
|
||||||
*
|
*
|
||||||
* @return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function requiresAuth()
|
function requiresAuth()
|
||||||
{
|
{
|
||||||
// If the site is "private", all API methods except statusnet/config
|
// If the site is "private", all API methods except statusnet/config
|
||||||
// need authentication
|
// need authentication
|
||||||
|
|
||||||
if (common_config('site', 'private')) {
|
if (common_config('site', 'private')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether a user has been specified somehow
|
// check whether a user has been specified somehow
|
||||||
|
|
||||||
$id = $this->arg('id');
|
$id = $this->arg('id');
|
||||||
$user_id = $this->arg('user_id');
|
$user_id = $this->arg('user_id');
|
||||||
$screen_name = $this->arg('screen_name');
|
$screen_name = $this->arg('screen_name');
|
||||||
|
@ -106,5 +100,4 @@ class ApiBareAuthAction extends ApiAuthAction
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,6 @@ require_once INSTALLDIR . '/lib/apioauthstore.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiOauthAction extends Action
|
class ApiOauthAction extends Action
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +51,6 @@ class ApiOauthAction extends Action
|
||||||
*
|
*
|
||||||
* @return boolean false
|
* @return boolean false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function isReadOnly($args)
|
function isReadOnly($args)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -73,7 +71,6 @@ class ApiOauthAction extends Action
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function handle($args)
|
function handle($args)
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
@ -83,7 +80,6 @@ class ApiOauthAction extends Action
|
||||||
static function cleanRequest()
|
static function cleanRequest()
|
||||||
{
|
{
|
||||||
// kill evil effects of magical slashing
|
// kill evil effects of magical slashing
|
||||||
|
|
||||||
if (get_magic_quotes_gpc() == 1) {
|
if (get_magic_quotes_gpc() == 1) {
|
||||||
$_POST = array_map('stripslashes', $_POST);
|
$_POST = array_map('stripslashes', $_POST);
|
||||||
$_GET = array_map('stripslashes', $_GET);
|
$_GET = array_map('stripslashes', $_GET);
|
||||||
|
@ -93,7 +89,6 @@ class ApiOauthAction extends Action
|
||||||
|
|
||||||
// XXX: should we strip anything else? Or alternatively
|
// XXX: should we strip anything else? Or alternatively
|
||||||
// only allow a known list of params?
|
// only allow a known list of params?
|
||||||
|
|
||||||
unset($_GET['p']);
|
unset($_GET['p']);
|
||||||
unset($_POST['p']);
|
unset($_POST['p']);
|
||||||
}
|
}
|
||||||
|
@ -118,5 +113,4 @@ class ApiOauthAction extends Action
|
||||||
return ($url . '&' . $k . '=' . $v);
|
return ($url . '&' . $k . '=' . $v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ require_once INSTALLDIR . '/lib/oauthstore.php';
|
||||||
|
|
||||||
class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
|
class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
|
||||||
{
|
{
|
||||||
|
|
||||||
function lookup_consumer($consumer_key)
|
function lookup_consumer($consumer_key)
|
||||||
{
|
{
|
||||||
$con = Consumer::staticGet('consumer_key', $consumer_key);
|
$con = Consumer::staticGet('consumer_key', $consumer_key);
|
||||||
|
@ -39,7 +38,6 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
|
||||||
function getAppByRequestToken($token_key)
|
function getAppByRequestToken($token_key)
|
||||||
{
|
{
|
||||||
// Look up the full req tokenx
|
// Look up the full req tokenx
|
||||||
|
|
||||||
$req_token = $this->lookup_token(null,
|
$req_token = $this->lookup_token(null,
|
||||||
'request',
|
'request',
|
||||||
$token_key);
|
$token_key);
|
||||||
|
@ -50,7 +48,6 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look up the full Token
|
// Look up the full Token
|
||||||
|
|
||||||
$token = new Token();
|
$token = new Token();
|
||||||
$token->tok = $req_token->key;
|
$token->tok = $req_token->key;
|
||||||
$result = $token->find(true);
|
$result = $token->find(true);
|
||||||
|
@ -150,10 +147,8 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
|
||||||
}
|
}
|
||||||
|
|
||||||
// Okay, good
|
// Okay, good
|
||||||
|
|
||||||
return new OAuthToken($at->tok, $at->secret);
|
return new OAuthToken($at->tok, $at->secret);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -172,19 +167,20 @@ class ApiStatusNetOAuthDataStore extends StatusNetOAuthDataStore
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function revoke_token($token_key, $type = 0) {
|
public function revoke_token($token_key, $type = 0) {
|
||||||
$rt = new Token();
|
$rt = new Token();
|
||||||
$rt->tok = $token_key;
|
$rt->tok = $token_key;
|
||||||
$rt->type = $type;
|
$rt->type = $type;
|
||||||
$rt->state = 0;
|
$rt->state = 0;
|
||||||
|
|
||||||
if (!$rt->find(true)) {
|
if (!$rt->find(true)) {
|
||||||
throw new Exception('Tried to revoke unknown token');
|
// TRANS: Exception thrown when an attempt is made to revoke an unknown token.
|
||||||
|
throw new Exception(_('Tried to revoke unknown token.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$rt->delete()) {
|
if (!$rt->delete()) {
|
||||||
throw new Exception('Failed to delete revoked token');
|
// TRANS: Exception thrown when an attempt is made to remove a revoked token.
|
||||||
|
throw new Exception(_('Failed to delete revoked token.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,26 +58,21 @@ require_once INSTALLDIR.'/lib/apiauth.php';
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApiPrivateAuthAction extends ApiAuthAction
|
class ApiPrivateAuthAction extends ApiAuthAction
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does this API resource require authentication?
|
* Does this API resource require authentication?
|
||||||
*
|
*
|
||||||
* @return boolean true or false
|
* @return boolean true or false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function requiresAuth()
|
function requiresAuth()
|
||||||
{
|
{
|
||||||
// If the site is "private", all API methods except statusnet/config
|
// If the site is "private", all API methods except statusnet/config
|
||||||
// need authentication
|
// need authentication
|
||||||
|
|
||||||
if (common_config('site', 'private')) {
|
if (common_config('site', 'private')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,13 +43,11 @@ require_once INSTALLDIR . '/lib/form.php';
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApplicationEditForm extends Form
|
class ApplicationEditForm extends Form
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* group for user to join
|
* group for user to join
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $application = null;
|
var $application = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,7 +56,6 @@ class ApplicationEditForm extends Form
|
||||||
* @param Action $out output channel
|
* @param Action $out output channel
|
||||||
* @param User_group $group group to join
|
* @param User_group $group group to join
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($out=null, $application=null)
|
function __construct($out=null, $application=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
|
@ -71,7 +68,6 @@ class ApplicationEditForm extends Form
|
||||||
*
|
*
|
||||||
* @return string ID of the form
|
* @return string ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
if ($this->application) {
|
if ($this->application) {
|
||||||
|
@ -89,7 +85,6 @@ class ApplicationEditForm extends Form
|
||||||
*
|
*
|
||||||
* @return string the method to use for submitting
|
* @return string the method to use for submitting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function method()
|
function method()
|
||||||
{
|
{
|
||||||
$this->enctype = 'multipart/form-data';
|
$this->enctype = 'multipart/form-data';
|
||||||
|
@ -101,7 +96,6 @@ class ApplicationEditForm extends Form
|
||||||
*
|
*
|
||||||
* @return string of the form class
|
* @return string of the form class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formClass()
|
function formClass()
|
||||||
{
|
{
|
||||||
return 'form_settings';
|
return 'form_settings';
|
||||||
|
@ -112,7 +106,6 @@ class ApplicationEditForm extends Form
|
||||||
*
|
*
|
||||||
* @return string URL of the action
|
* @return string URL of the action
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
$cur = common_current_user();
|
$cur = common_current_user();
|
||||||
|
@ -130,7 +123,6 @@ class ApplicationEditForm extends Form
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formLegend()
|
function formLegend()
|
||||||
{
|
{
|
||||||
// TRANS: Form legend.
|
// TRANS: Form legend.
|
||||||
|
@ -142,7 +134,6 @@ class ApplicationEditForm extends Form
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
if ($this->application) {
|
if ($this->application) {
|
||||||
|
@ -206,7 +197,8 @@ class ApplicationEditForm extends Form
|
||||||
$maxDesc = Oauth_application::maxDesc();
|
$maxDesc = Oauth_application::maxDesc();
|
||||||
if ($maxDesc > 0) {
|
if ($maxDesc > 0) {
|
||||||
// TRANS: Form input field instructions.
|
// TRANS: Form input field instructions.
|
||||||
$descInstr = sprintf(_('Describe your application in %d characters'),
|
// TRANS: %d is the number of available characters for the description.
|
||||||
|
$descInstr = sprintf(ngettext('Describe your application in %d character','Describe your application in %d characters',$maxDesc),
|
||||||
$maxDesc);
|
$maxDesc);
|
||||||
} else {
|
} else {
|
||||||
// TRANS: Form input field instructions.
|
// TRANS: Form input field instructions.
|
||||||
|
@ -265,8 +257,9 @@ class ApplicationEditForm extends Form
|
||||||
|
|
||||||
// Default to Browser
|
// Default to Browser
|
||||||
|
|
||||||
if ($this->application->type == Oauth_application::$browser
|
if (empty($this->application)
|
||||||
|| empty($this->application->type)) {
|
|| empty($this->application->type)
|
||||||
|
|| $this->application->type == Oauth_application::$browser) {
|
||||||
$attrs['checked'] = 'checked';
|
$attrs['checked'] = 'checked';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +276,7 @@ class ApplicationEditForm extends Form
|
||||||
'class' => 'radio',
|
'class' => 'radio',
|
||||||
'value' => Oauth_application::$desktop);
|
'value' => Oauth_application::$desktop);
|
||||||
|
|
||||||
if ($this->application->type == Oauth_application::$desktop) {
|
if (!empty($this->application) && $this->application->type == Oauth_application::$desktop) {
|
||||||
$attrs['checked'] = 'checked';
|
$attrs['checked'] = 'checked';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,8 +300,9 @@ class ApplicationEditForm extends Form
|
||||||
|
|
||||||
// default to read-only access
|
// default to read-only access
|
||||||
|
|
||||||
if ($this->application->access_type & Oauth_application::$readAccess
|
if (empty($this->application)
|
||||||
|| empty($this->application->access_type)) {
|
|| empty($this->application->access_type)
|
||||||
|
|| $this->application->access_type & Oauth_application::$readAccess) {
|
||||||
$attrs['checked'] = 'checked';
|
$attrs['checked'] = 'checked';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +319,8 @@ class ApplicationEditForm extends Form
|
||||||
'class' => 'radio',
|
'class' => 'radio',
|
||||||
'value' => 'rw');
|
'value' => 'rw');
|
||||||
|
|
||||||
if ($this->application->access_type & Oauth_application::$readAccess
|
if (!empty($this->application)
|
||||||
|
&& $this->application->access_type & Oauth_application::$readAccess
|
||||||
&& $this->application->access_type & Oauth_application::$writeAccess
|
&& $this->application->access_type & Oauth_application::$writeAccess
|
||||||
) {
|
) {
|
||||||
$attrs['checked'] = 'checked';
|
$attrs['checked'] = 'checked';
|
||||||
|
@ -350,16 +345,15 @@ class ApplicationEditForm extends Form
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function formActions()
|
function formActions()
|
||||||
{
|
{
|
||||||
// TRANS: Button label
|
// TRANS: Button label in the "Edit application" form.
|
||||||
$this->out->submit('cancel', _m('BUTTON','Cancel'), 'submit form_action-primary',
|
$this->out->submit('cancel', _m('BUTTON','Cancel'), 'submit form_action-primary',
|
||||||
// TRANS: Submit button title
|
// TRANS: Submit button title.
|
||||||
'cancel', _('Cancel'));
|
'cancel', _('Cancel'));
|
||||||
// TRANS: Button label
|
// TRANS: Button label in the "Edit application" form.
|
||||||
$this->out->submit('save', _m('BUTTON','Save'), 'submit form_action-secondary',
|
$this->out->submit('save', _m('BUTTON','Save'), 'submit form_action-secondary',
|
||||||
// TRANS: Submit button title
|
// TRANS: Submit button title.
|
||||||
'save', _('Save'));
|
'save', _('Save'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StatusNet, the distributed open-source microblogging tool
|
* StatusNet, the distributed open-source microblogging tool
|
||||||
*
|
*
|
||||||
|
@ -45,7 +44,6 @@ define('APPS_PER_PAGE', 20);
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ApplicationList extends Widget
|
class ApplicationList extends Widget
|
||||||
{
|
{
|
||||||
/** Current application, application query */
|
/** Current application, application query */
|
||||||
|
@ -140,7 +138,7 @@ class ApplicationList extends Widget
|
||||||
$access = ($this->application->access_type & Oauth_application::$writeAccess)
|
$access = ($this->application->access_type & Oauth_application::$writeAccess)
|
||||||
? $readWriteText : $readOnlyText;
|
? $readWriteText : $readOnlyText;
|
||||||
$modifiedDate = common_date_string($appUser->modified);
|
$modifiedDate = common_date_string($appUser->modified);
|
||||||
// TRANS: Used in application list. %1$s is a modified date, %2$s is access type (read-write or read-only)
|
// TRANS: Used in application list. %1$s is a modified date, %2$s is access type ("read-write" or "read-only")
|
||||||
$txt = sprintf(_('Approved %1$s - "%2$s" access.'),$modifiedDate,$access);
|
$txt = sprintf(_('Approved %1$s - "%2$s" access.'),$modifiedDate,$access);
|
||||||
|
|
||||||
$this->out->raw($txt);
|
$this->out->raw($txt);
|
||||||
|
@ -164,10 +162,8 @@ class ApplicationList extends Widget
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override this in subclasses. */
|
/* Override this in subclasses. */
|
||||||
|
|
||||||
function showOwnerControls()
|
function showOwnerControls()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ class Atom10Feed extends XMLStringer
|
||||||
$xs->element('name', null, $name);
|
$xs->element('name', null, $name);
|
||||||
} else {
|
} else {
|
||||||
throw new Atom10FeedException(
|
throw new Atom10FeedException(
|
||||||
'author element must contain a name element.'
|
_('author element must contain a name element.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,5 +323,4 @@ class Atom10Feed extends XMLStringer
|
||||||
|
|
||||||
array_push($this->links, $attrs);
|
array_push($this->links, $attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ if (!defined('STATUSNET'))
|
||||||
*/
|
*/
|
||||||
class AtomUserNoticeFeed extends AtomNoticeFeed
|
class AtomUserNoticeFeed extends AtomNoticeFeed
|
||||||
{
|
{
|
||||||
private $user;
|
protected $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -55,7 +55,6 @@ class AtomUserNoticeFeed extends AtomNoticeFeed
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($user, $cur = null, $indent = true) {
|
function __construct($user, $cur = null, $indent = true) {
|
||||||
parent::__construct($cur, $indent);
|
parent::__construct($cur, $indent);
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
|
@ -49,7 +49,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
* @see NoticeListItem
|
* @see NoticeListItem
|
||||||
* @see ProfileNoticeList
|
* @see ProfileNoticeList
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AttachmentList extends Widget
|
class AttachmentList extends Widget
|
||||||
{
|
{
|
||||||
/** the current stream of notices being displayed. */
|
/** the current stream of notices being displayed. */
|
||||||
|
@ -61,7 +60,6 @@ class AttachmentList extends Widget
|
||||||
*
|
*
|
||||||
* @param Notice $notice stream of notices from DB_DataObject
|
* @param Notice $notice stream of notices from DB_DataObject
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($notice, $out=null)
|
function __construct($notice, $out=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
|
@ -76,7 +74,6 @@ class AttachmentList extends Widget
|
||||||
*
|
*
|
||||||
* @return int count of notices listed.
|
* @return int count of notices listed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$atts = new File;
|
$atts = new File;
|
||||||
|
@ -111,7 +108,6 @@ class AttachmentList extends Widget
|
||||||
*
|
*
|
||||||
* @return NoticeListItem a list item for displaying the notice
|
* @return NoticeListItem a list item for displaying the notice
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function newListItem($attachment)
|
function newListItem($attachment)
|
||||||
{
|
{
|
||||||
return new AttachmentListItem($attachment, $this->out);
|
return new AttachmentListItem($attachment, $this->out);
|
||||||
|
@ -135,7 +131,6 @@ class AttachmentList extends Widget
|
||||||
* @see NoticeList
|
* @see NoticeList
|
||||||
* @see ProfileNoticeListItem
|
* @see ProfileNoticeListItem
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AttachmentListItem extends Widget
|
class AttachmentListItem extends Widget
|
||||||
{
|
{
|
||||||
/** The attachment this item will show. */
|
/** The attachment this item will show. */
|
||||||
|
@ -151,7 +146,6 @@ class AttachmentListItem extends Widget
|
||||||
*
|
*
|
||||||
* @param Notice $notice The notice we'll display
|
* @param Notice $notice The notice we'll display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function __construct($attachment, $out=null)
|
function __construct($attachment, $out=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
|
@ -185,7 +179,6 @@ class AttachmentListItem extends Widget
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function show()
|
function show()
|
||||||
{
|
{
|
||||||
$this->showStart();
|
$this->showStart();
|
||||||
|
@ -221,7 +214,6 @@ class AttachmentListItem extends Widget
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showStart()
|
function showStart()
|
||||||
{
|
{
|
||||||
// XXX: RDFa
|
// XXX: RDFa
|
||||||
|
@ -236,7 +228,6 @@ class AttachmentListItem extends Widget
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function showEnd()
|
function showEnd()
|
||||||
{
|
{
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
|
@ -438,4 +429,3 @@ class Attachment extends AttachmentListItem
|
||||||
$this->out->raw('<script>window.location = ' . json_encode($this->attachment->url) . ';</script>');
|
$this->out->raw('<script>window.location = ' . json_encode($this->attachment->url) . ';</script>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
|
||||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AttachmentNoticeSection extends NoticeSection
|
class AttachmentNoticeSection extends NoticeSection
|
||||||
{
|
{
|
||||||
function showContent() {
|
function showContent() {
|
||||||
|
@ -64,6 +63,7 @@ class AttachmentNoticeSection extends NoticeSection
|
||||||
|
|
||||||
function title()
|
function title()
|
||||||
{
|
{
|
||||||
|
// TRANS: Title.
|
||||||
return _('Notices where this attachment appears');
|
return _('Notices where this attachment appears');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,4 +72,3 @@ class AttachmentNoticeSection extends NoticeSection
|
||||||
return 'popular_notices';
|
return 'popular_notices';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user