summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/accessadminpanel.php24
-rw-r--r--actions/all.php32
-rw-r--r--actions/allrss.php2
-rw-r--r--actions/apidirectmessage.php5
-rw-r--r--actions/apigroupcreate.php8
-rw-r--r--actions/apigrouplist.php3
-rw-r--r--actions/apigrouplistall.php10
-rw-r--r--actions/apigroupmembership.php3
-rw-r--r--actions/apistatusnetconfig.php2
-rw-r--r--actions/apitimelinefriends.php4
-rw-r--r--actions/apitimelinegroup.php58
-rw-r--r--actions/apitimelinehome.php4
-rw-r--r--actions/apitimelinementions.php2
-rw-r--r--actions/apitimelinepublic.php4
-rw-r--r--actions/apitimelineuser.php64
-rw-r--r--actions/blockedfromgroup.php9
-rw-r--r--actions/deleteuser.php31
-rw-r--r--actions/editgroup.php17
-rw-r--r--actions/foafgroup.php17
-rw-r--r--actions/grantrole.php99
-rw-r--r--actions/groupdesignsettings.php5
-rw-r--r--actions/grouplogo.php5
-rw-r--r--actions/groupmembers.php9
-rw-r--r--actions/grouprss.php9
-rw-r--r--actions/groups.php18
-rw-r--r--actions/hcard.php120
-rw-r--r--actions/invite.php3
-rw-r--r--actions/joingroup.php32
-rw-r--r--actions/leavegroup.php32
-rw-r--r--actions/newgroup.php10
-rw-r--r--actions/newnotice.php3
-rw-r--r--actions/oauthconnectionssettings.php4
-rw-r--r--actions/postnotice.php11
-rw-r--r--actions/public.php1
-rw-r--r--actions/recoverpassword.php2
-rw-r--r--actions/replies.php1
-rw-r--r--actions/revokerole.php99
-rw-r--r--actions/showfavorites.php1
-rw-r--r--actions/showgroup.php33
-rw-r--r--actions/siteadminpanel.php60
-rw-r--r--actions/sitenoticeadminpanel.php201
-rw-r--r--actions/snapshotadminpanel.php251
-rw-r--r--actions/subscribe.php2
-rw-r--r--actions/subscribers.php9
-rw-r--r--actions/tag.php1
-rw-r--r--actions/tagrss.php1
-rw-r--r--actions/twitapisearchatom.php2
-rw-r--r--actions/twitapisearchjson.php1
-rw-r--r--actions/twitapitrends.php2
-rw-r--r--actions/updateprofile.php10
-rw-r--r--actions/useradminpanel.php3
-rw-r--r--actions/usergroups.php30
-rw-r--r--actions/userrss.php37
53 files changed, 1097 insertions, 309 deletions
diff --git a/actions/accessadminpanel.php b/actions/accessadminpanel.php
index 4768e2faf..73354e97a 100644
--- a/actions/accessadminpanel.php
+++ b/actions/accessadminpanel.php
@@ -51,6 +51,7 @@ class AccessadminpanelAction extends AdminPanelAction
function title()
{
+ // TRANS: Page title
return _('Access');
}
@@ -62,6 +63,7 @@ class AccessadminpanelAction extends AdminPanelAction
function getInstructions()
{
+ // TRANS: Page notice
return _('Site access settings');
}
@@ -155,24 +157,34 @@ class AccessAdminPanelForm extends AdminForm
function formData()
{
$this->out->elementStart('fieldset', array('id' => 'settings_admin_access'));
+ // TRANS: Form legend for registration form.
$this->out->element('legend', null, _('Registration'));
$this->out->elementStart('ul', 'form_data');
$this->li();
- $this->out->checkbox('private', _('Private'),
+ // TRANS: Checkbox instructions for admin setting "Private"
+ $instructions = _('Prohibit anonymous users (not logged in) from viewing site?');
+ // TRANS: Checkbox label for prohibiting anonymous users from viewing site.
+ $this->out->checkbox('private', _m('LABEL', 'Private'),
(bool) $this->value('private'),
- _('Prohibit anonymous users (not logged in) from viewing site?'));
+ $instructions);
$this->unli();
$this->li();
+ // TRANS: Checkbox instructions for admin setting "Invite only"
+ $instructions = _('Make registration invitation only.');
+ // TRANS: Checkbox label for configuring site as invite only.
$this->out->checkbox('inviteonly', _('Invite only'),
(bool) $this->value('inviteonly'),
- _('Make registration invitation only.'));
+ $instructions);
$this->unli();
$this->li();
+ // TRANS: Checkbox instructions for admin setting "Closed" (no new registrations)
+ $instructions = _('Disable new registrations.');
+ // TRANS: Checkbox label for disabling new user registrations.
$this->out->checkbox('closed', _('Closed'),
(bool) $this->value('closed'),
- _('Disable new registrations.'));
+ $instructions);
$this->unli();
$this->out->elementEnd('ul');
$this->out->elementEnd('fieldset');
@@ -186,7 +198,9 @@ class AccessAdminPanelForm extends AdminForm
function formActions()
{
- $this->out->submit('submit', _('Save'), 'submit', null, _('Save access settings'));
+ // TRANS: Title / tooltip for button to save access settings in site admin panel
+ $title = _('Save access settings');
+ $this->out->submit('submit', _m('BUTTON', 'Save'), 'submit', null, $title);
}
}
diff --git a/actions/all.php b/actions/all.php
index 3eb185214..8c22e6f5f 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -60,6 +60,7 @@ class AllAction extends ProfileAction
}
if ($this->page > 1 && $this->notice->N == 0) {
+ // TRANS: Server error when page not found (404)
$this->serverError(_('No such page'), $code = 404);
}
@@ -81,8 +82,10 @@ class AllAction extends ProfileAction
function title()
{
if ($this->page > 1) {
+ // TRANS: Page title. %1$s is user nickname, %2$d is page number
return sprintf(_('%1$s and friends, page %2$d'), $this->user->nickname, $this->page);
} else {
+ // TRANS: Page title. %1$s is user nickname
return sprintf(_("%s and friends"), $this->user->nickname);
}
}
@@ -96,6 +99,7 @@ class AllAction extends ProfileAction
'nickname' =>
$this->user->nickname)
),
+ // TRANS: %1$s is user nickname
sprintf(_('Feed for friends of %s (RSS 1.0)'), $this->user->nickname)),
new Feed(Feed::RSS2,
common_local_url(
@@ -104,6 +108,7 @@ class AllAction extends ProfileAction
'id' => $this->user->nickname
)
),
+ // TRANS: %1$s is user nickname
sprintf(_('Feed for friends of %s (RSS 2.0)'), $this->user->nickname)),
new Feed(Feed::ATOM,
common_local_url(
@@ -112,6 +117,7 @@ class AllAction extends ProfileAction
'id' => $this->user->nickname
)
),
+ // TRANS: %1$s is user nickname
sprintf(_('Feed for friends of %s (Atom)'), $this->user->nickname))
);
}
@@ -124,6 +130,7 @@ class AllAction extends ProfileAction
function showEmptyListMessage()
{
+ // TRANS: %1$s is user nickname
$message = sprintf(_('This is the timeline for %s and friends but no one has posted anything yet.'), $this->user->nickname) . ' ';
if (common_logged_in()) {
@@ -131,6 +138,7 @@ class AllAction extends ProfileAction
if ($this->user->id === $current_user->id) {
$message .= _('Try subscribing to more people, [join a group](%%action.groups%%) or post something yourself.');
} else {
+ // TRANS: %1$s is user nickname, %2$s is user nickname, %2$s is user nickname prefixed with "@"
$message .= sprintf(_('You can try to [nudge %1$s](../%2$s) from his profile or [post something to his or her attention](%%%%action.newnotice%%%%?status_textarea=%3$s).'), $this->user->nickname, $this->user->nickname, '@' . $this->user->nickname);
}
} else {
@@ -144,26 +152,32 @@ class AllAction extends ProfileAction
function showContent()
{
- $nl = new NoticeList($this->notice, $this);
+ if (Event::handle('StartShowAllContent', array($this))) {
+ $nl = new NoticeList($this->notice, $this);
- $cnt = $nl->show();
+ $cnt = $nl->show();
- if (0 == $cnt) {
- $this->showEmptyListMessage();
- }
+ if (0 == $cnt) {
+ $this->showEmptyListMessage();
+ }
- $this->pagination(
- $this->page > 1, $cnt > NOTICES_PER_PAGE,
- $this->page, 'all', array('nickname' => $this->user->nickname)
- );
+ $this->pagination(
+ $this->page > 1, $cnt > NOTICES_PER_PAGE,
+ $this->page, 'all', array('nickname' => $this->user->nickname)
+ );
+
+ Event::handle('EndShowAllContent', array($this));
+ }
}
function showPageTitle()
{
$user = common_current_user();
if ($user && ($user->id == $this->user->id)) {
+ // TRANS: H1 text
$this->element('h1', null, _("You and friends"));
} else {
+ // TRANS: H1 text. %1$s is user nickname
$this->element('h1', null, sprintf(_('%s and friends'), $this->user->nickname));
}
}
diff --git a/actions/allrss.php b/actions/allrss.php
index 28b1be27d..01e737ad7 100644
--- a/actions/allrss.php
+++ b/actions/allrss.php
@@ -83,6 +83,7 @@ class AllrssAction extends Rss10Action
function getNotices($limit=0)
{
$cur = common_current_user();
+ $user = $this->user;
if (!empty($cur) && $cur->id == $user->id) {
$notice = $this->user->noticeInbox(0, $limit);
@@ -90,7 +91,6 @@ class AllrssAction extends Rss10Action
$notice = $this->user->noticesWithFriends(0, $limit);
}
- $user = $this->user;
$notice = $user->noticesWithFriends(0, $limit);
$notices = array();
diff --git a/actions/apidirectmessage.php b/actions/apidirectmessage.php
index 5355acf82..53da9e0c6 100644
--- a/actions/apidirectmessage.php
+++ b/actions/apidirectmessage.php
@@ -182,11 +182,6 @@ class ApiDirectMessageAction extends ApiAuthAction
$message->whereAdd('id > ' . $this->since_id);
}
- if (!empty($since)) {
- $d = date('Y-m-d H:i:s', $this->since);
- $message->whereAdd("created > '$d'");
- }
-
$message->orderBy('created DESC, id DESC');
$message->limit((($this->page - 1) * $this->count), $this->count);
$message->find();
diff --git a/actions/apigroupcreate.php b/actions/apigroupcreate.php
index 028d76a78..145806356 100644
--- a/actions/apigroupcreate.php
+++ b/actions/apigroupcreate.php
@@ -123,7 +123,9 @@ class ApiGroupCreateAction extends ApiAuthAction
'description' => $this->description,
'location' => $this->location,
'aliases' => $this->aliases,
- 'userid' => $this->user->id));
+ 'userid' => $this->user->id,
+ 'local' => true));
+
switch($this->format) {
case 'xml':
$this->showSingleXmlGroup($group);
@@ -306,9 +308,9 @@ class ApiGroupCreateAction extends ApiAuthAction
function groupNicknameExists($nickname)
{
- $group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
- if (!empty($group)) {
+ if (!empty($local)) {
return true;
}
diff --git a/actions/apigrouplist.php b/actions/apigrouplist.php
index 605b38232..98fdb0497 100644
--- a/actions/apigrouplist.php
+++ b/actions/apigrouplist.php
@@ -152,8 +152,7 @@ class ApiGroupListAction extends ApiBareAuthAction
($this->page - 1) * $this->count,
$this->count,
$this->since_id,
- $this->max_id,
- $this->since
+ $this->max_id
);
while ($group->fetch()) {
diff --git a/actions/apigrouplistall.php b/actions/apigrouplistall.php
index d2ef2978a..e1b54a832 100644
--- a/actions/apigrouplistall.php
+++ b/actions/apigrouplistall.php
@@ -134,13 +134,13 @@ class ApiGroupListAllAction extends ApiPrivateAuthAction
function getGroups()
{
- $groups = array();
-
- // XXX: Use the $page, $count, $max_id, $since_id, and $since parameters
+ $qry = 'SELECT user_group.* '.
+ 'from user_group join local_group on user_group.id = local_group.group_id '.
+ 'order by created desc ';
$group = new User_group();
- $group->orderBy('created DESC');
- $group->find();
+
+ $group->query($qry);
while ($group->fetch()) {
$groups[] = clone($group);
diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php
index 3c7c8e883..9f72b527c 100644
--- a/actions/apigroupmembership.php
+++ b/actions/apigroupmembership.php
@@ -125,8 +125,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction
($this->page - 1) * $this->count,
$this->count,
$this->since_id,
- $this->max_id,
- $this->since
+ $this->max_id
);
while ($profile->fetch()) {
diff --git a/actions/apistatusnetconfig.php b/actions/apistatusnetconfig.php
index 0345a9bc0..bff8313b5 100644
--- a/actions/apistatusnetconfig.php
+++ b/actions/apistatusnetconfig.php
@@ -32,8 +32,6 @@ if (!defined('STATUSNET')) {
exit(1);
}
-require_once INSTALLDIR . '/lib/api.php';
-
/**
* Gives a full dump of configuration variables for this instance
* of StatusNet, minus variables that may be security-sensitive (like
diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php
index 2db76857e..9ef3ace60 100644
--- a/actions/apitimelinefriends.php
+++ b/actions/apitimelinefriends.php
@@ -202,11 +202,11 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
if (!empty($this->auth_user) && $this->auth_user->id == $this->user->id) {
$notice = $this->user->ownFriendsTimeline(($this->page-1) * $this->count,
$this->count, $this->since_id,
- $this->max_id, $this->since);
+ $this->max_id);
} else {
$notice = $this->user->friendsTimeline(($this->page-1) * $this->count,
$this->count, $this->since_id,
- $this->max_id, $this->since);
+ $this->max_id);
}
while ($notice->fetch()) {
diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php
index 0bb4860ea..8f971392b 100644
--- a/actions/apitimelinegroup.php
+++ b/actions/apitimelinegroup.php
@@ -104,32 +104,21 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
function showTimeline()
{
- $sitename = common_config('site', 'name');
- $avatar = $this->group->homepage_logo;
- $title = sprintf(_("%s timeline"), $this->group->nickname);
- $taguribase = TagURI::base();
- $id = "tag:$taguribase:GroupTimeline:" . $this->group->id;
-
- $subtitle = sprintf(
- _('Updates from %1$s on %2$s!'),
- $this->group->nickname,
- $sitename
- );
-
- $logo = ($avatar) ? $avatar : User_group::defaultLogo(AVATAR_PROFILE_SIZE);
+ // We'll pull common formatting out of this for other formats
+ $atom = new AtomGroupNoticeFeed($this->group);
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
- $this->showRssTimeline(
+ $this->showRssTimeline(
$this->notices,
- $title,
+ $atom->title,
$this->group->homeUrl(),
- $subtitle,
+ $atom->subtitle,
null,
- $logo
+ $atom->logo
);
break;
case 'atom':
@@ -138,46 +127,22 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
try {
- // If this was called using an integer ID, i.e.: using the canonical
- // URL for this group's feed, then pass the Group object into the feed,
- // so the OStatus plugin, and possibly other plugins, can access it.
- // Feels sorta hacky. -- Z
-
- $atom = null;
- $id = $this->arg('id');
-
- if (strval(intval($id)) === strval($id)) {
- $atom = new AtomGroupNoticeFeed($this->group);
- } else {
- $atom = new AtomGroupNoticeFeed();
- }
-
- $atom->setId($id);
- $atom->setTitle($title);
- $atom->setSubtitle($subtitle);
- $atom->setLogo($logo);
- $atom->setUpdated('now');
-
$atom->addAuthorRaw($this->group->asAtomAuthor());
$atom->setActivitySubject($this->group->asActivitySubject());
- $atom->addLink($this->group->homeUrl());
-
$id = $this->arg('id');
$aargs = array('format' => 'atom');
if (!empty($id)) {
$aargs['id'] = $id;
}
+ $self = $this->getSelfUri('ApiTimelineGroup', $aargs);
- $atom->addLink(
- $this->getSelfUri('ApiTimelineGroup', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
+ $atom->setId($self);
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
- //$this->raw($atom->getString());
- print $atom->getString(); // temp hack until PuSH feeds are redone cleanly
+ $this->raw($atom->getString());
} catch (Atom10FeedException $e) {
$this->serverError(
@@ -214,8 +179,7 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
($this->page-1) * $this->count,
$this->count,
$this->since_id,
- $this->max_id,
- $this->since
+ $this->max_id
);
while ($notice->fetch()) {
diff --git a/actions/apitimelinehome.php b/actions/apitimelinehome.php
index 0c72f4020..abd387786 100644
--- a/actions/apitimelinehome.php
+++ b/actions/apitimelinehome.php
@@ -200,13 +200,13 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$notice = $this->user->noticeInbox(
($this->page-1) * $this->count,
$this->count, $this->since_id,
- $this->max_id, $this->since
+ $this->max_id
);
} else {
$notice = $this->user->noticesWithFriends(
($this->page-1) * $this->count,
$this->count, $this->since_id,
- $this->max_id, $this->since
+ $this->max_id
);
}
diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php
index a39c63346..31627ab7b 100644
--- a/actions/apitimelinementions.php
+++ b/actions/apitimelinementions.php
@@ -189,7 +189,7 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$notice = $this->user->getReplies(
($this->page - 1) * $this->count, $this->count,
- $this->since_id, $this->max_id, $this->since
+ $this->since_id, $this->max_id
);
while ($notice->fetch()) {
diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php
index 1ff0fd261..3e4dad690 100644
--- a/actions/apitimelinepublic.php
+++ b/actions/apitimelinepublic.php
@@ -75,10 +75,6 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
$this->notices = $this->getNotices();
- if ($this->since) {
- throw new ServerException("since parameter is disabled for performance; use since_id", 403);
- }
-
return true;
}
diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php
index 3e849cc78..2d0047c04 100644
--- a/actions/apitimelineuser.php
+++ b/actions/apitimelineuser.php
@@ -112,21 +112,17 @@ class ApiTimelineUserAction extends ApiBareAuthAction
function showTimeline()
{
$profile = $this->user->getProfile();
- $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
- $sitename = common_config('site', 'name');
- $title = sprintf(_("%s timeline"), $this->user->nickname);
- $taguribase = TagURI::base();
- $id = "tag:$taguribase:UserTimeline:" . $this->user->id;
+ // We'll use the shared params from the Atom stub
+ // for other feed types.
+ $atom = new AtomUserNoticeFeed($this->user);
+ $title = $atom->title;
$link = common_local_url(
'showstream',
array('nickname' => $this->user->nickname)
);
- $subtitle = sprintf(
- _('Updates from %1$s on %2$s!'),
- $this->user->nickname, $sitename
- );
- $logo = ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
+ $subtitle = $atom->subtitle;
+ $logo = $atom->logo;
// FriendFeed's SUP protocol
// Also added RSS and Atom feeds
@@ -148,56 +144,18 @@ class ApiTimelineUserAction extends ApiBareAuthAction
header('Content-Type: application/atom+xml; charset=utf-8');
- // If this was called using an integer ID, i.e.: using the canonical
- // URL for this user's feed, then pass the User object into the feed,
- // so the OStatus plugin, and possibly other plugins, can access it.
- // Feels sorta hacky. -- Z
-
- $atom = null;
- $id = $this->arg('id');
-
- if (strval(intval($id)) === strval($id)) {
- $atom = new AtomUserNoticeFeed($this->user);
- } else {
- $atom = new AtomUserNoticeFeed();
- }
-
- $atom->setId($id);
- $atom->setTitle($title);
- $atom->setSubtitle($subtitle);
- $atom->setLogo($logo);
- $atom->setUpdated('now');
-
- $atom->addLink(
- common_local_url(
- 'showstream',
- array('nickname' => $this->user->nickname)
- )
- );
-
$id = $this->arg('id');
$aargs = array('format' => 'atom');
if (!empty($id)) {
$aargs['id'] = $id;
}
-
- $atom->addLink(
- $this->getSelfUri('ApiTimelineUser', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
-
- $atom->addLink(
- $suplink,
- array(
- 'rel' => 'http://api.friendfeed.com/2008/03#sup',
- 'type' => 'application/json'
- )
- );
+ $self = $this->getSelfUri('ApiTimelineUser', $aargs);
+ $atom->setId($self);
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
- #$this->raw($atom->getString());
- print $atom->getString(); // temporary for output buffering
+ $this->raw($atom->getString());
break;
case 'json':
@@ -222,7 +180,7 @@ class ApiTimelineUserAction extends ApiBareAuthAction
$notice = $this->user->getNotices(
($this->page-1) * $this->count, $this->count,
- $this->since_id, $this->max_id, $this->since
+ $this->since_id, $this->max_id
);
while ($notice->fetch()) {
diff --git a/actions/blockedfromgroup.php b/actions/blockedfromgroup.php
index 0b4caf5bf..a0598db27 100644
--- a/actions/blockedfromgroup.php
+++ b/actions/blockedfromgroup.php
@@ -74,7 +74,14 @@ class BlockedfromgroupAction extends GroupDesignAction
return false;
}
- $this->group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+
+ if (!$local) {
+ $this->clientError(_('No such group.'), 404);
+ return false;
+ }
+
+ $this->group = User_group::staticGet('id', $local->group_id);
if (!$this->group) {
$this->clientError(_('No such group.'), 404);
diff --git a/actions/deleteuser.php b/actions/deleteuser.php
index 32b703aa7..c4f84fad2 100644
--- a/actions/deleteuser.php
+++ b/actions/deleteuser.php
@@ -131,18 +131,21 @@ class DeleteuserAction extends ProfileFormAction
$this->elementStart('fieldset');
$this->hidden('token', common_session_token());
$this->element('legend', _('Delete user'));
- $this->element('p', null,
- _('Are you sure you want to delete this user? '.
- 'This will clear all data about the user from the '.
- 'database, without a backup.'));
- $this->element('input', array('id' => 'deleteuserto-' . $id,
- 'name' => 'profileid',
- 'type' => 'hidden',
- 'value' => $id));
- foreach ($this->args as $k => $v) {
- if (substr($k, 0, 9) == 'returnto-') {
- $this->hidden($k, $v);
+ if (Event::handle('StartDeleteUserForm', array($this, $this->user))) {
+ $this->element('p', null,
+ _('Are you sure you want to delete this user? '.
+ 'This will clear all data about the user from the '.
+ 'database, without a backup.'));
+ $this->element('input', array('id' => 'deleteuserto-' . $id,
+ 'name' => 'profileid',
+ 'type' => 'hidden',
+ 'value' => $id));
+ foreach ($this->args as $k => $v) {
+ if (substr($k, 0, 9) == 'returnto-') {
+ $this->hidden($k, $v);
+ }
}
+ Event::handle('EndDeleteUserForm', array($this, $this->user));
}
$this->submit('form_action-no', _('No'), 'submit form_action-primary', 'no', _("Do not block this user"));
$this->submit('form_action-yes', _('Yes'), 'submit form_action-secondary', 'yes', _('Delete this user'));
@@ -158,7 +161,9 @@ class DeleteuserAction extends ProfileFormAction
function handlePost()
{
- $this->user->delete();
+ if (Event::handle('StartDeleteUser', array($this, $this->user))) {
+ $this->user->delete();
+ Event::handle('EndDeleteUser', array($this, $this->user));
+ }
}
}
-
diff --git a/actions/editgroup.php b/actions/editgroup.php
index ad0b6e185..4b596cade 100644
--- a/actions/editgroup.php
+++ b/actions/editgroup.php
@@ -86,10 +86,14 @@ class EditgroupAction extends GroupDesignAction
}
$groupid = $this->trimmed('groupid');
+
if ($groupid) {
$this->group = User_group::staticGet('id', $groupid);
} else {
- $this->group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+ if ($local) {
+ $this->group = User_group::staticGet('id', $local->group_id);
+ }
}
if (!$this->group) {
@@ -245,6 +249,7 @@ class EditgroupAction extends GroupDesignAction
$this->group->homepage = $homepage;
$this->group->description = $description;
$this->group->location = $location;
+ $this->group->mainpage = common_local_url('showgroup', array('nickname' => $nickname));
$result = $this->group->update($orig);
@@ -259,6 +264,12 @@ class EditgroupAction extends GroupDesignAction
$this->serverError(_('Could not create aliases.'));
}
+ if ($nickname != $orig->nickname) {
+ common_log(LOG_INFO, "Saving local group info.");
+ $local = Local_group::staticGet('group_id', $this->group->id);
+ $local->setNickname($nickname);
+ }
+
$this->group->query('COMMIT');
if ($this->group->nickname != $orig->nickname) {
@@ -272,10 +283,10 @@ class EditgroupAction extends GroupDesignAction
function nicknameExists($nickname)
{
- $group = User_group::staticGet('nickname', $nickname);
+ $group = Local_group::staticGet('nickname', $nickname);
if (!empty($group) &&
- $group->id != $this->group->id) {
+ $group->group_id != $this->group->id) {
return true;
}
diff --git a/actions/foafgroup.php b/actions/foafgroup.php
index f5fd7fe88..ebdf1cee2 100644
--- a/actions/foafgroup.php
+++ b/actions/foafgroup.php
@@ -56,7 +56,14 @@ class FoafGroupAction extends Action
return false;
}
- $this->group = User_group::staticGet('nickname', $this->nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+
+ if (!$local) {
+ $this->clientError(_('No such group.'), 404);
+ return false;
+ }
+
+ $this->group = User_group::staticGet('id', $local->group_id);
if (!$this->group) {
$this->clientError(_('No such group.'), 404);
@@ -113,7 +120,7 @@ class FoafGroupAction extends Action
if ($this->group->homepage_logo) {
$this->element('depiction', array('rdf:resource' => $this->group->homepage_logo));
}
-
+
$members = $this->group->getMembers();
$member_details = array();
while ($members->fetch()) {
@@ -123,7 +130,7 @@ class FoafGroupAction extends Action
);
$this->element('member', array('rdf:resource' => $member_uri));
}
-
+
$admins = $this->group->getAdmins();
while ($admins->fetch()) {
$admin_uri = common_local_url('userbyid', array('id'=>$admins->id));
@@ -132,7 +139,7 @@ class FoafGroupAction extends Action
}
$this->elementEnd('Group');
-
+
ksort($member_details);
foreach ($member_details as $uri => $details) {
if ($details['is_admin'])
@@ -158,7 +165,7 @@ class FoafGroupAction extends Action
));
}
}
-
+
$this->elementEnd('rdf:RDF');
$this->endXML();
}
diff --git a/actions/grantrole.php b/actions/grantrole.php
new file mode 100644
index 000000000..cd6bd4d79
--- /dev/null
+++ b/actions/grantrole.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Action class to sandbox an abusive user
+ *
+ * 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 Action
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @copyright 2009 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);
+}
+
+/**
+ * Sandbox a user.
+ *
+ * @category Action
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://status.net/
+ */
+
+class GrantRoleAction extends ProfileFormAction
+{
+ /**
+ * Check parameters
+ *
+ * @param array $args action arguments (URL, GET, POST)
+ *
+ * @return boolean success flag
+ */
+
+ function prepare($args)
+ {
+ if (!parent::prepare($args)) {
+ return false;
+ }
+
+ $this->role = $this->arg('role');
+ if (!Profile_role::isValid($this->role)) {
+ $this->clientError(_("Invalid role."));
+ return false;
+ }
+ if (!Profile_role::isSettable($this->role)) {
+ $this->clientError(_("This role is reserved and cannot be set."));
+ return false;
+ }
+
+ $cur = common_current_user();
+
+ assert(!empty($cur)); // checked by parent
+
+ if (!$cur->hasRight(Right::GRANTROLE)) {
+ $this->clientError(_("You cannot grant user roles on this site."));
+ return false;
+ }
+
+ assert(!empty($this->profile)); // checked by parent
+
+ if ($this->profile->hasRole($this->role)) {
+ $this->clientError(_("User already has this role."));
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Sandbox a user.
+ *
+ * @return void
+ */
+
+ function handlePost()
+ {
+ $this->profile->grantRole($this->role);
+ }
+}
diff --git a/actions/groupdesignsettings.php b/actions/groupdesignsettings.php
index e290ba514..526226a28 100644
--- a/actions/groupdesignsettings.php
+++ b/actions/groupdesignsettings.php
@@ -90,7 +90,10 @@ class GroupDesignSettingsAction extends DesignSettingsAction
if ($groupid) {
$this->group = User_group::staticGet('id', $groupid);
} else {
- $this->group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+ if ($local) {
+ $this->group = User_group::staticGet('id', $local->group_id);
+ }
}
if (!$this->group) {
diff --git a/actions/grouplogo.php b/actions/grouplogo.php
index 3c9b56296..f414a23cc 100644
--- a/actions/grouplogo.php
+++ b/actions/grouplogo.php
@@ -92,7 +92,10 @@ class GrouplogoAction extends GroupDesignAction
if ($groupid) {
$this->group = User_group::staticGet('id', $groupid);
} else {
- $this->group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+ if ($local) {
+ $this->group = User_group::staticGet('id', $local->group_id);
+ }
}
if (!$this->group) {
diff --git a/actions/groupmembers.php b/actions/groupmembers.php
index f16e972a4..a16debd7b 100644
--- a/actions/groupmembers.php
+++ b/actions/groupmembers.php
@@ -77,7 +77,14 @@ class GroupmembersAction extends GroupDesignAction
return false;
}
- $this->group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+
+ if (!$local) {
+ $this->clientError(_('No such group.'), 404);
+ return false;
+ }
+
+ $this->group = User_group::staticGet('id', $local->group_id);
if (!$this->group) {
$this->clientError(_('No such group.'), 404);
diff --git a/actions/grouprss.php b/actions/grouprss.php
index 866fc66eb..490f6f945 100644
--- a/actions/grouprss.php
+++ b/actions/grouprss.php
@@ -92,7 +92,14 @@ class groupRssAction extends Rss10Action
return false;
}
- $this->group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
+
+ if (!$local) {
+ $this->clientError(_('No such group.'), 404);
+ return false;
+ }
+
+ $this->group = User_group::staticGet('id', $local->group_id);
if (!$this->group) {
$this->clientError(_('No such group.'), 404);
diff --git a/actions/groups.php b/actions/groups.php
index 10a1d5964..8aacff8b0 100644
--- a/actions/groups.php
+++ b/actions/groups.php
@@ -109,17 +109,21 @@ class GroupsAction extends Action
}
$offset = ($this->page-1) * GROUPS_PER_PAGE;
- $limit = GROUPS_PER_PAGE + 1;
+ $limit = GROUPS_PER_PAGE + 1;
+
+ $qry = 'SELECT user_group.* '.
+ 'from user_group join local_group on user_group.id = local_group.group_id '.
+ 'order by user_group.created desc '.
+ 'limit ' . $limit . ' offset ' . $offset;
$groups = new User_group();
- $groups->orderBy('created DESC');
- $groups->limit($offset, $limit);
$cnt = 0;
- if ($groups->find()) {
- $gl = new GroupList($groups, null, $this);
- $cnt = $gl->show();
- }
+
+ $groups->query($qry);
+
+ $gl = new GroupList($groups, null, $this);
+ $cnt = $gl->show();
$this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
$this->page, 'groups');
diff --git a/actions/hcard.php b/actions/hcard.php
new file mode 100644
index 000000000..55d0f65c8
--- /dev/null
+++ b/actions/hcard.php
@@ -0,0 +1,120 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Show the user's hcard
+ *
+ * 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 Personal
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @copyright 2010 StatusNet, Inc.
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET')) {
+ exit(1);
+}
+
+/**
+ * User profile page
+ *
+ * @category Personal
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
+ * @link http://status.net/
+ */
+
+class HcardAction extends Action
+{
+ var $user;
+ var $profile;
+
+ function prepare($args)
+ {
+ parent::prepare($args);
+
+ $nickname_arg = $this->arg('nickname');
+ $nickname = common_canonical_nickname($nickname_arg);
+
+ // Permanent redirect on non-canonical nickname
+
+ if ($nickname_arg != $nickname) {
+ $args = array('nickname' => $nickname);
+ common_redirect(common_local_url('hcard', $args), 301);
+ return false;
+ }
+
+ $this->user = User::staticGet('nickname', $nickname);
+
+ if (!$this->user) {
+ $this->clientError(_('No such user.'), 404);
+ return false;
+ }
+
+ $this->profile = $this->user->getProfile();
+
+ if (!$this->profile) {
+ $this->serverError(_('User has no profile.'));
+ return false;
+ }
+
+ return true;
+ }
+
+ function handle($args)
+ {
+ parent::handle($args);
+ $this->showPage();
+ }
+
+ function title()
+ {
+ return $this->profile->getBestName();
+ }
+
+ function showContent()
+ {
+ $up = new ShortUserProfile($this, $this->user, $this->profile);
+ $up->show();
+ }
+
+ function showHeader()
+ {
+ return;
+ }
+
+ function showAside()
+ {
+ return;
+ }
+
+ function showSecondaryNav()
+ {
+ return;
+ }
+}
+
+class ShortUserProfile extends UserProfile
+{
+ function showEntityActions()
+ {
+ return;
+ }
+} \ No newline at end of file
diff --git a/actions/invite.php b/actions/invite.php
index d0ed64ec9..54b2de62a 100644
--- a/actions/invite.php
+++ b/actions/invite.php
@@ -194,7 +194,8 @@ class InviteAction extends CurrentUserDesignAction
_('Optionally add a personal message to the invitation.'));
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('send', _('Send'));
+ // TRANS: Send button for inviting friends
+ $this->submit('send', _m('BUTTON', 'Send'));
$this->elementEnd('fieldset');
$this->elementEnd('form');
}
diff --git a/actions/joingroup.php b/actions/joingroup.php
index 235e5ab4c..f87e5dae2 100644
--- a/actions/joingroup.php
+++ b/actions/joingroup.php
@@ -62,23 +62,33 @@ class JoingroupAction extends Action
}
$nickname_arg = $this->trimmed('nickname');
- $nickname = common_canonical_nickname($nickname_arg);
+ $id = intval($this->arg('id'));
+ if ($id) {
+ $this->group = User_group::staticGet('id', $id);
+ } else if ($nickname_arg) {
+ $nickname = common_canonical_nickname($nickname_arg);
+
+ // Permanent redirect on non-canonical nickname
+
+ if ($nickname_arg != $nickname) {
+ $args = array('nickname' => $nickname);
+ common_redirect(common_local_url('leavegroup', $args), 301);
+ return false;
+ }
- // Permanent redirect on non-canonical nickname
+ $local = Local_group::staticGet('nickname', $nickname);
- if ($nickname_arg != $nickname) {
- $args = array('nickname' => $nickname);
- common_redirect(common_local_url('joingroup', $args), 301);
- return false;
- }
+ if (!$local) {
+ $this->clientError(_('No such group.'), 404);
+ return false;
+ }
- if (!$nickname) {
- $this->clientError(_('No nickname.'), 404);
+ $this->group = User_group::staticGet('id', $local->group_id);
+ } else {
+ $this->clientError(_('No nickname or ID.'), 404);
return false;
}
- $this->group = User_group::staticGet('nickname', $nickname);
-
if (!$this->group) {
$this->clientError(_('No such group.'), 404);
return false;
diff --git a/actions/leavegroup.php b/actions/leavegroup.php
index 9b9d83b6c..329b5aafe 100644
--- a/actions/leavegroup.php
+++ b/actions/leavegroup.php
@@ -62,23 +62,33 @@ class LeavegroupAction extends Action
}
$nickname_arg = $this->trimmed('nickname');
- $nickname = common_canonical_nickname($nickname_arg);
+ $id = intval($this->arg('id'));
+ if ($id) {
+ $this->group = User_group::staticGet('id', $id);
+ } else if ($nickname_arg) {
+ $nickname = common_canonical_nickname($nickname_arg);
+
+ // Permanent redirect on non-canonical nickname
+
+ if ($nickname_arg != $nickname) {
+ $args = array('nickname' => $nickname);
+ common_redirect(common_local_url('leavegroup', $args), 301);
+ return false;
+ }
- // Permanent redirect on non-canonical nickname
+ $local = Local_group::staticGet('nickname', $nickname);
- if ($nickname_arg != $nickname) {
- $args = array('nickname' => $nickname);
- common_redirect(common_local_url('leavegroup', $args), 301);
- return false;
- }
+ if (!$local) {
+ $this->clientError(_('No such group.'), 404);
+ return false;
+ }
- if (!$nickname) {
- $this->clientError(_('No nickname.'), 404);
+ $this->group = User_group::staticGet('id', $local->group_id);
+ } else {
+ $this->clientError(_('No nickname or ID.'), 404);
return false;
}
- $this->group = User_group::staticGet('nickname', $nickname);
-
if (!$this->group) {
$this->clientError(_('No such group.'), 404);
return false;
diff --git a/actions/newgroup.php b/actions/newgroup.php
index 25da7f8fc..75bc293ec 100644
--- a/actions/newgroup.php
+++ b/actions/newgroup.php
@@ -180,6 +180,8 @@ class NewgroupAction extends Action
}
}
+ $mainpage = common_local_url('showgroup', array('nickname' => $nickname));
+
$cur = common_current_user();
// Checked in prepare() above
@@ -192,16 +194,18 @@ class NewgroupAction extends Action
'description' => $description,
'location' => $location,
'aliases' => $aliases,
- 'userid' => $cur->id));
+ 'userid' => $cur->id,
+ 'mainpage' => $mainpage,
+ 'local' => true));
common_redirect($group->homeUrl(), 303);
}
function nicknameExists($nickname)
{
- $group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
- if (!empty($group)) {
+ if (!empty($local)) {
return true;
}
diff --git a/actions/newnotice.php b/actions/newnotice.php
index 78480abab..ed0fa1b2b 100644
--- a/actions/newnotice.php
+++ b/actions/newnotice.php
@@ -294,6 +294,9 @@ class NewnoticeAction extends Action
if ($profile) {
$content = '@' . $profile->nickname . ' ';
}
+ } else {
+ // @fixme most of these bits above aren't being passed on above
+ $inreplyto = null;
}
$notice_form = new NoticeForm($this, '', $content, null, $inreplyto);
diff --git a/actions/oauthconnectionssettings.php b/actions/oauthconnectionssettings.php
index b1467f0d0..f125f4c63 100644
--- a/actions/oauthconnectionssettings.php
+++ b/actions/oauthconnectionssettings.php
@@ -99,7 +99,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
$application = $profile->getApplications($offset, $limit);
- $cnt == 0;
+ $cnt = 0;
if (!empty($application)) {
$al = new ApplicationList($application, $user, $this, true);
@@ -112,7 +112,7 @@ class OauthconnectionssettingsAction extends ConnectSettingsAction
$this->pagination($this->page > 1, $cnt > APPS_PER_PAGE,
$this->page, 'connectionssettings',
- array('nickname' => $this->user->nickname));
+ array('nickname' => $user->nickname));
}
/**
diff --git a/actions/postnotice.php b/actions/postnotice.php
index fb0670376..b2f6f1bb9 100644
--- a/actions/postnotice.php
+++ b/actions/postnotice.php
@@ -54,7 +54,10 @@ class PostnoticeAction extends Action
*/
function prepare($argarray)
{
+ StatusNet::setApi(true); // Send smaller error pages
+
parent::prepare($argarray);
+
try {
$this->checkNotice();
} catch (Exception $e) {
@@ -71,6 +74,14 @@ class PostnoticeAction extends Action
$srv = new OMB_Service_Provider(null, omb_oauth_datastore(),
omb_oauth_server());
$srv->handlePostNotice();
+ } catch (OMB_RemoteServiceException $rse) {
+ $msg = $rse->getMessage();
+ if (preg_match('/Revoked accesstoken/', $msg) ||
+ preg_match('/No subscriber/', $msg)) {
+ $this->clientError($msg, 403);
+ } else {
+ $this->clientError($msg);
+ }
} catch (Exception $e) {
$this->serverError($e->getMessage());
return;
diff --git a/actions/public.php b/actions/public.php
index 50278bfce..0b3b5fde8 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -94,6 +94,7 @@ class PublicAction extends Action
}
if($this->page > 1 && $this->notice->N == 0){
+ // TRANS: Server error when page not found (404)
$this->serverError(_('No such page'),$code=404);
}
diff --git a/actions/recoverpassword.php b/actions/recoverpassword.php
index dcff35f6e..1e2775e7a 100644
--- a/actions/recoverpassword.php
+++ b/actions/recoverpassword.php
@@ -21,7 +21,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
# You have 24 hours to claim your password
-define(MAX_RECOVERY_TIME, 24 * 60 * 60);
+define('MAX_RECOVERY_TIME', 24 * 60 * 60);
class RecoverpasswordAction extends Action
{
diff --git a/actions/replies.php b/actions/replies.php
index 164c328db..4ff1b7a8d 100644
--- a/actions/replies.php
+++ b/actions/replies.php
@@ -89,6 +89,7 @@ class RepliesAction extends OwnerDesignAction
NOTICES_PER_PAGE + 1);
if($this->page > 1 && $this->notice->N == 0){
+ // TRANS: Server error when page not found (404)
$this->serverError(_('No such page'),$code=404);
}
diff --git a/actions/revokerole.php b/actions/revokerole.php
new file mode 100644
index 000000000..b78c1c25a
--- /dev/null
+++ b/actions/revokerole.php
@@ -0,0 +1,99 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Action class to sandbox an abusive user
+ *
+ * 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 Action
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @copyright 2009 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);
+}
+
+/**
+ * Sandbox a user.
+ *
+ * @category Action
+ * @package StatusNet
+ * @author Evan Prodromou <evan@status.net>
+ * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link http://status.net/
+ */
+
+class RevokeRoleAction extends ProfileFormAction
+{
+ /**
+ * Check parameters
+ *
+ * @param array $args action arguments (URL, GET, POST)
+ *
+ * @return boolean success flag
+ */
+
+ function prepare($args)
+ {
+ if (!parent::prepare($args)) {
+ return false;
+ }
+
+ $this->role = $this->arg('role');
+ if (!Profile_role::isValid($this->role)) {
+ $this->clientError(_("Invalid role."));
+ return false;
+ }
+ if (!Profile_role::isSettable($this->role)) {
+ $this->clientError(_("This role is reserved and cannot be set."));
+ return false;
+ }
+
+ $cur = common_current_user();
+
+ assert(!empty($cur)); // checked by parent
+
+ if (!$cur->hasRight(Right::REVOKEROLE)) {
+ $this->clientError(_("You cannot revoke user roles on this site."));
+ return false;
+ }
+
+ assert(!empty($this->profile)); // checked by parent
+
+ if (!$this->profile->hasRole($this->role)) {
+ $this->clientError(_("User doesn't have this role."));
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Sandbox a user.
+ *
+ * @return void
+ */
+
+ function handlePost()
+ {
+ $this->profile->revokeRole($this->role);
+ }
+}
diff --git a/actions/showfavorites.php b/actions/showfavorites.php
index f2d082293..5b85de683 100644
--- a/actions/showfavorites.php
+++ b/actions/showfavorites.php
@@ -134,6 +134,7 @@ class ShowfavoritesAction extends OwnerDesignAction
}
if($this->page > 1 && $this->notice->N == 0){
+ // TRANS: Server error when page not found (404)
$this->serverError(_('No such page'),$code=404);
}
diff --git a/actions/showgroup.php b/actions/showgroup.php
index eb1238902..5704b13d1 100644
--- a/actions/showgroup.php
+++ b/actions/showgroup.php
@@ -122,9 +122,9 @@ class ShowgroupAction extends GroupDesignAction
return false;
}
- $this->group = User_group::staticGet('nickname', $nickname);
+ $local = Local_group::staticGet('nickname', $nickname);
- if (!$this->group) {
+ if (!$local) {
$alias = Group_alias::staticGet('alias', $nickname);
if ($alias) {
$args = array('id' => $alias->group_id);
@@ -134,11 +134,19 @@ class ShowgroupAction extends GroupDesignAction
common_redirect(common_local_url('groupbyid', $args), 301);
return false;
} else {
+ common_log(LOG_NOTICE, "Couldn't find local group for nickname '$nickname'");
$this->clientError(_('No such group.'), 404);
return false;
}
}
+ $this->group = User_group::staticGet('id', $local->group_id);
+
+ if (!$this->group) {
+ $this->clientError(_('No such group.'), 404);
+ return false;
+ }
+
common_set_returnto($this->selfUrl());
return true;
@@ -293,19 +301,20 @@ class ShowgroupAction extends GroupDesignAction
$this->element('h2', null, _('Group actions'));
$this->elementStart('ul');
$this->elementStart('li', 'entity_subscribe');
- $cur = common_current_user();
- if ($cur) {
- if ($cur->isMember($this->group)) {
- $lf = new LeaveForm($this, $this->group);
- $lf->show();
- } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) {
- $jf = new JoinForm($this, $this->group);
- $jf->show();
+ if (Event::handle('StartGroupSubscribe', array($this, $this->group))) {
+ $cur = common_current_user();
+ if ($cur) {
+ if ($cur->isMember($this->group)) {
+ $lf = new LeaveForm($this, $this->group);
+ $lf->show();
+ } else if (!Group_block::isBlocked($this->group, $cur->getProfile())) {
+ $jf = new JoinForm($this, $this->group);
+ $jf->show();
+ }
}
+ Event::handle('EndGroupSubscribe', array($this, $this->group));
}
-
$this->elementEnd('li');
-
$this->elementEnd('ul');
$this->elementEnd('div');
}
diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php
index 8c8f8b374..cb3c2e8fd 100644
--- a/actions/siteadminpanel.php
+++ b/actions/siteadminpanel.php
@@ -66,7 +66,7 @@ class SiteadminpanelAction extends AdminPanelAction
function getInstructions()
{
- return _('Basic settings for this StatusNet site.');
+ return _('Basic settings for this StatusNet site');
}
/**
@@ -90,10 +90,11 @@ class SiteadminpanelAction extends AdminPanelAction
function saveSettings()
{
- static $settings = array('site' => array('name', 'broughtby', 'broughtbyurl',
- 'email', 'timezone', 'language',
- 'site', 'textlimit', 'dupelimit'),
- 'snapshot' => array('run', 'reporturl', 'frequency'));
+ static $settings = array(
+ 'site' => array('name', 'broughtby', 'broughtbyurl',
+ 'email', 'timezone', 'language',
+ 'site', 'textlimit', 'dupelimit'),
+ );
$values = array();
@@ -158,25 +159,6 @@ class SiteadminpanelAction extends AdminPanelAction
$this->clientError(sprintf(_('Unknown language "%s".'), $values['site']['language']));
}
- // Validate report URL
-
- if (!is_null($values['snapshot']['reporturl']) &&
- !Validate::uri($values['snapshot']['reporturl'], array('allowed_schemes' => array('http', 'https')))) {
- $this->clientError(_("Invalid snapshot report URL."));
- }
-
- // Validate snapshot run value
-
- if (!in_array($values['snapshot']['run'], array('web', 'cron', 'never'))) {
- $this->clientError(_("Invalid snapshot run value."));
- }
-
- // Validate snapshot run value
-
- if (!Validate::number($values['snapshot']['frequency'])) {
- $this->clientError(_("Snapshot frequency must be a number."));
- }
-
// Validate text limit
if (!Validate::number($values['site']['textlimit'], array('min' => 140))) {
@@ -277,40 +259,14 @@ class SiteAdminPanelForm extends AdminForm
$this->unli();
$this->li();
- $this->out->dropdown('language', _('Language'),
- get_nice_language_list(), _('Default site language'),
+ $this->out->dropdown('language', _('Default language'),
+ get_nice_language_list(), _('Site language when autodetection from browser settings is not available'),
false, $this->value('language'));
$this->unli();
$this->out->elementEnd('ul');
$this->out->elementEnd('fieldset');
- $this->out->elementStart('fieldset', array('id' => 'settings_admin_snapshots'));
- $this->out->element('legend', null, _('Snapshots'));
- $this->out->elementStart('ul', 'form_data');
- $this->li();
- $snapshot = array('web' => _('Randomly during Web hit'),
- 'cron' => _('In a scheduled job'),
- 'never' => _('Never'));
- $this->out->dropdown('run', _('Data snapshots'),
- $snapshot, _('When to send statistical data to status.net servers'),
- false, $this->value('run', 'snapshot'));
- $this->unli();
-
- $this->li();
- $this->input('frequency', _('Frequency'),
- _('Snapshots will be sent once every N web hits'),
- 'snapshot');
- $this->unli();
-
- $this->li();
- $this->input('reporturl', _('Report URL'),
- _('Snapshots will be sent to this URL'),
- 'snapshot');
- $this->unli();
- $this->out->elementEnd('ul');
- $this->out->elementEnd('fieldset');
-
$this->out->elementStart('fieldset', array('id' => 'settings_admin_limits'));
$this->out->element('legend', null, _('Limits'));
$this->out->elementStart('ul', 'form_data');
diff --git a/actions/sitenoticeadminpanel.php b/actions/sitenoticeadminpanel.php
new file mode 100644
index 000000000..3931aa982
--- /dev/null
+++ b/actions/sitenoticeadminpanel.php
@@ -0,0 +1,201 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Site notice 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);
+}
+
+require_once INSTALLDIR.'/extlib/htmLawed/htmLawed.php';
+
+/**
+ * Update the site-wide notice text
+ *
+ * @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 SitenoticeadminpanelAction extends AdminPanelAction
+{
+ /**
+ * Returns the page title
+ *
+ * @return string page title
+ */
+
+ function title()
+ {
+ return _('Site Notice');
+ }
+
+ /**
+ * Instructions for using this form.
+ *
+ * @return string instructions
+ */
+
+ function getInstructions()
+ {
+ return _('Edit site-wide message');
+ }
+
+ /**
+ * Show the site notice admin panel form
+ *
+ * @return void
+ */
+
+ function showForm()
+ {
+ $form = new SiteNoticeAdminPanelForm($this);
+ $form->show();
+ return;
+ }
+
+ /**
+ * Save settings from the form
+ *
+ * @return void
+ */
+
+ function saveSettings()
+ {
+ $siteNotice = $this->trimmed('site-notice');
+
+ // assert(all values are valid);
+ // This throws an exception on validation errors
+
+ $this->validate(&$siteNotice);
+
+ $config = new Config();
+
+ $result = Config::save('site', 'notice', $siteNotice);
+
+ if (!$result) {
+ $this->ServerError(_("Unable to save site notice."));
+ }
+ }
+
+ function validate(&$siteNotice)
+ {
+ // Validate notice text
+
+ if (mb_strlen($siteNotice) > 255) {
+ $this->clientError(
+ _('Max length for the site-wide notice is 255 chars')
+ );
+ }
+
+ // scrub HTML input
+
+ $config = array(
+ 'safe' => 1,
+ 'deny_attribute' => 'id,style,on*'
+ );
+
+ $siteNotice = htmLawed($siteNotice, $config);
+ }
+}
+
+class SiteNoticeAdminPanelForm extends AdminForm
+{
+ /**
+ * ID of the form
+ *
+ * @return int ID of the form
+ */
+
+ function id()
+ {
+ return 'form_site_notice_admin_panel';
+ }
+
+ /**
+ * 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('sitenoticeadminpanel');
+ }
+
+ /**
+ * Data elements of the form
+ *
+ * @return void
+ */
+
+ function formData()
+ {
+ $this->out->elementStart('ul', 'form_data');
+
+ $this->out->elementStart('li');
+ $this->out->textarea(
+ 'site-notice',
+ _('Site notice text'),
+ common_config('site', 'notice'),
+ _('Site-wide notice text (255 chars max; HTML okay)')
+ );
+ $this->out->elementEnd('li');
+
+ $this->out->elementEnd('ul');
+ }
+
+ /**
+ * Action elements
+ *
+ * @return void
+ */
+
+ function formActions()
+ {
+ $this->out->submit(
+ 'submit',
+ _('Save'),
+ 'submit',
+ null,
+ _('Save site notice')
+ );
+ }
+}
diff --git a/actions/snapshotadminpanel.php b/actions/snapshotadminpanel.php
new file mode 100644
index 000000000..a0c2315bc
--- /dev/null
+++ b/actions/snapshotadminpanel.php
@@ -0,0 +1,251 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Snapshots 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);
+}
+
+/**
+ * Manage snapshots
+ *
+ * @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 SnapshotadminpanelAction extends AdminPanelAction
+{
+ /**
+ * Returns the page title
+ *
+ * @return string page title
+ */
+
+ function title()
+ {
+ return _('Snapshots');
+ }
+
+ /**
+ * Instructions for using this form.
+ *
+ * @return string instructions
+ */
+
+ function getInstructions()
+ {
+ return _('Manage snapshot configuration');
+ }
+
+ /**
+ * Show the snapshots admin panel form
+ *
+ * @return void
+ */
+
+ function showForm()
+ {
+ $form = new SnapshotAdminPanelForm($this);
+ $form->show();
+ return;
+ }
+
+ /**
+ * Save settings from the form
+ *
+ * @return void
+ */
+
+ function saveSettings()
+ {
+ static $settings = array(
+ 'snapshot' => array('run', 'reporturl', 'frequency')
+ );
+
+ $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;
+ }
+
+ function validate(&$values)
+ {
+ // Validate snapshot run value
+
+ if (!in_array($values['snapshot']['run'], array('web', 'cron', 'never'))) {
+ $this->clientError(_("Invalid snapshot run value."));
+ }
+
+ // Validate snapshot frequency value
+
+ if (!Validate::number($values['snapshot']['frequency'])) {
+ $this->clientError(_("Snapshot frequency must be a number."));
+ }
+
+ // Validate report URL
+
+ if (!is_null($values['snapshot']['reporturl'])
+ && !Validate::uri(
+ $values['snapshot']['reporturl'],
+ array('allowed_schemes' => array('http', 'https')
+ )
+ )) {
+ $this->clientError(_("Invalid snapshot report URL."));
+ }
+ }
+}
+
+class SnapshotAdminPanelForm extends AdminForm
+{
+ /**
+ * ID of the form
+ *
+ * @return int ID of the form
+ */
+
+ function id()
+ {
+ return 'form_snapshot_admin_panel';
+ }
+
+ /**
+ * 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('snapshotadminpanel');
+ }
+
+ /**
+ * Data elements of the form
+ *
+ * @return void
+ */
+
+ function formData()
+ {
+ $this->out->elementStart(
+ 'fieldset',
+ array('id' => 'settings_admin_snapshots')
+ );
+ $this->out->element('legend', null, _('Snapshots'));
+ $this->out->elementStart('ul', 'form_data');
+ $this->li();
+ $snapshot = array(
+ 'web' => _('Randomly during Web hit'),
+ 'cron' => _('In a scheduled job'),
+ 'never' => _('Never')
+ );
+ $this->out->dropdown(
+ 'run',
+ _('Data snapshots'),
+ $snapshot,
+ _('When to send statistical data to status.net servers'),
+ false,
+ $this->value('run', 'snapshot')
+ );
+ $this->unli();
+
+ $this->li();
+ $this->input(
+ 'frequency',
+ _('Frequency'),
+ _('Snapshots will be sent once every N web hits'),
+ 'snapshot'
+ );
+ $this->unli();
+
+ $this->li();
+ $this->input(
+ 'reporturl',
+ _('Report URL'),
+ _('Snapshots will be sent to this URL'),
+ 'snapshot'
+ );
+ $this->unli();
+ $this->out->elementEnd('ul');
+ $this->out->elementEnd('fieldset');
+ }
+
+ /**
+ * Action elements
+ *
+ * @return void
+ */
+
+ function formActions()
+ {
+ $this->out->submit(
+ 'submit',
+ _('Save'),
+ 'submit',
+ null,
+ _('Save snapshot settings')
+ );
+ }
+}
diff --git a/actions/subscribe.php b/actions/subscribe.php
index 3745311b6..b1243f393 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -145,7 +145,7 @@ class SubscribeAction extends Action
$this->element('title', null, _('Subscribed'));
$this->elementEnd('head');
$this->elementStart('body');
- $unsubscribe = new UnsubscribeForm($this, $this->other->getProfile());
+ $unsubscribe = new UnsubscribeForm($this, $this->other);
$unsubscribe->show();
$this->elementEnd('body');
$this->elementEnd('html');
diff --git a/actions/subscribers.php b/actions/subscribers.php
index cd3e2ee5b..4bced6284 100644
--- a/actions/subscribers.php
+++ b/actions/subscribers.php
@@ -143,9 +143,12 @@ class SubscribersListItem extends SubscriptionListItem
function showActions()
{
$this->startActions();
- $this->showSubscribeButton();
- // Relevant code!
- $this->showBlockForm();
+ if (Event::handle('StartProfileListItemActionElements', array($this))) {
+ $this->showSubscribeButton();
+ // Relevant code!
+ $this->showBlockForm();
+ Event::handle('EndProfileListItemActionElements', array($this));
+ }
$this->endActions();
}
diff --git a/actions/tag.php b/actions/tag.php
index e91df6ea9..ee9617b66 100644
--- a/actions/tag.php
+++ b/actions/tag.php
@@ -48,6 +48,7 @@ class TagAction extends Action
$this->notice = Notice_tag::getStream($this->tag, (($this->page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
if($this->page > 1 && $this->notice->N == 0){
+ // TRANS: Server error when page not found (404)
$this->serverError(_('No such page'),$code=404);
}
diff --git a/actions/tagrss.php b/actions/tagrss.php
index 75cbfa274..467a64abe 100644
--- a/actions/tagrss.php
+++ b/actions/tagrss.php
@@ -35,6 +35,7 @@ class TagrssAction extends Rss10Action
$this->clientError(_('No such tag.'));
return false;
} else {
+ $this->notices = $this->getNotices($this->limit);
return true;
}
}
diff --git a/actions/twitapisearchatom.php b/actions/twitapisearchatom.php
index e389ddec8..24aa619bd 100644
--- a/actions/twitapisearchatom.php
+++ b/actions/twitapisearchatom.php
@@ -31,8 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
-require_once INSTALLDIR.'/lib/api.php';
-
/**
* Action for outputting search results in Twitter compatible Atom
* format.
diff --git a/actions/twitapisearchjson.php b/actions/twitapisearchjson.php
index 741ed78d6..b5c006aa7 100644
--- a/actions/twitapisearchjson.php
+++ b/actions/twitapisearchjson.php
@@ -31,7 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
-require_once INSTALLDIR.'/lib/api.php';
require_once INSTALLDIR.'/lib/jsonsearchresultslist.php';
/**
diff --git a/actions/twitapitrends.php b/actions/twitapitrends.php
index 779405e6d..5a04569a2 100644
--- a/actions/twitapitrends.php
+++ b/actions/twitapitrends.php
@@ -31,8 +31,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
exit(1);
}
-require_once INSTALLDIR.'/lib/api.php';
-
/**
* Returns the top ten queries that are currently trending
*
diff --git a/actions/updateprofile.php b/actions/updateprofile.php
index e416a6fa9..bae6108cc 100644
--- a/actions/updateprofile.php
+++ b/actions/updateprofile.php
@@ -55,6 +55,8 @@ class UpdateprofileAction extends Action
*/
function prepare($argarray)
{
+ StatusNet::setApi(true); // Send smaller error pages
+
parent::prepare($argarray);
$license = $_POST['omb_listenee_license'];
$site_license = common_config('license', 'url');
@@ -75,6 +77,14 @@ class UpdateprofileAction extends Action
$srv = new OMB_Service_Provider(null, omb_oauth_datastore(),
omb_oauth_server());
$srv->handleUpdateProfile();
+ } catch (OMB_RemoteServiceException $rse) {
+ $msg = $rse->getMessage();
+ if (preg_match('/Revoked accesstoken/', $msg) ||
+ preg_match('/No subscriber/', $msg)) {
+ $this->clientError($msg, 403);
+ } else {
+ $this->clientError($msg);
+ }
} catch (Exception $e) {
$this->serverError($e->getMessage());
return;
diff --git a/actions/useradminpanel.php b/actions/useradminpanel.php
index 6813222f5..ee9c23076 100644
--- a/actions/useradminpanel.php
+++ b/actions/useradminpanel.php
@@ -55,7 +55,8 @@ class UseradminpanelAction extends AdminPanelAction
function title()
{
- return _('User');
+ // TRANS: User admin panel title
+ return _m('TITLE', 'User');
}
/**
diff --git a/actions/usergroups.php b/actions/usergroups.php
index 97faabae6..29bda0a76 100644
--- a/actions/usergroups.php
+++ b/actions/usergroups.php
@@ -130,22 +130,26 @@ class UsergroupsAction extends OwnerDesignAction
_('Search for more groups'));
$this->elementEnd('p');
- $offset = ($this->page-1) * GROUPS_PER_PAGE;
- $limit = GROUPS_PER_PAGE + 1;
+ if (Event::handle('StartShowUserGroupsContent', array($this))) {
+ $offset = ($this->page-1) * GROUPS_PER_PAGE;
+ $limit = GROUPS_PER_PAGE + 1;
+
+ $groups = $this->user->getGroups($offset, $limit);
+
+ if ($groups) {
+ $gl = new GroupList($groups, $this->user, $this);
+ $cnt = $gl->show();
+ if (0 == $cnt) {
+ $this->showEmptyListMessage();
+ }
+ }
- $groups = $this->user->getGroups($offset, $limit);
+ $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
+ $this->page, 'usergroups',
+ array('nickname' => $this->user->nickname));
- if ($groups) {
- $gl = new GroupList($groups, $this->user, $this);
- $cnt = $gl->show();
- if (0 == $cnt) {
- $this->showEmptyListMessage();
- }
+ Event::handle('EndShowUserGroupsContent', array($this));
}
-
- $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
- $this->page, 'usergroups',
- array('nickname' => $this->user->nickname));
}
function showEmptyListMessage()
diff --git a/actions/userrss.php b/actions/userrss.php
index 19e610551..e03eb9356 100644
--- a/actions/userrss.php
+++ b/actions/userrss.php
@@ -29,6 +29,8 @@ class UserrssAction extends Rss10Action
function prepare($args)
{
+ common_debug("UserrssAction");
+
parent::prepare($args);
$nickname = $this->trimmed('nickname');
$this->user = User::staticGet('nickname', $nickname);
@@ -38,20 +40,24 @@ class UserrssAction extends Rss10Action
$this->clientError(_('No such user.'));
return false;
} else {
- $this->notices = $this->getNotices($this->limit);
+ if (!empty($this->tag)) {
+ $this->notices = $this->getTaggedNotices();
+ } else {
+ $this->notices = $this->getNotices();
+ }
return true;
}
}
- function getTaggedNotices($tag = null, $limit=0)
+ function getTaggedNotices()
{
- $user = $this->user;
-
- if (is_null($user)) {
- return null;
- }
-
- $notice = $user->getTaggedNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit, 0, 0, null, $tag);
+ $notice = $this->user->getTaggedNotices(
+ $this->tag,
+ 0,
+ ($this->limit == 0) ? NOTICES_PER_PAGE : $this->limit,
+ 0,
+ 0
+ );
$notices = array();
while ($notice->fetch()) {
@@ -62,15 +68,12 @@ class UserrssAction extends Rss10Action
}
- function getNotices($limit=0)
+ function getNotices()
{
- $user = $this->user;
-
- if (is_null($user)) {
- return null;
- }
-
- $notice = $user->getNotices(0, ($limit == 0) ? NOTICES_PER_PAGE : $limit);
+ $notice = $this->user->getNotices(
+ 0,
+ ($limit == 0) ? NOTICES_PER_PAGE : $limit
+ );
$notices = array();
while ($notice->fetch()) {