summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/accessadminpanel.php24
-rw-r--r--actions/all.php10
-rw-r--r--actions/apiaccountupdateprofile.php4
-rw-r--r--actions/apigroupshow.php29
-rw-r--r--actions/apimediaupload.php141
-rw-r--r--actions/apioauthauthorize.php4
-rw-r--r--actions/apistatusesupdate.php16
-rw-r--r--actions/apistatusnetconfig.php24
-rw-r--r--actions/apitimelinefavorites.php36
-rw-r--r--actions/apitimelinefriends.php39
-rw-r--r--actions/apitimelinegroup.php17
-rw-r--r--actions/apitimelinehome.php39
-rw-r--r--actions/apitimelinementions.php34
-rw-r--r--actions/apitimelinepublic.php25
-rw-r--r--actions/apitimelinetag.php38
-rw-r--r--actions/apitimelineuser.php25
-rw-r--r--actions/avatarsettings.php4
-rw-r--r--actions/confirmaddress.php2
-rw-r--r--actions/deleteuser.php10
-rw-r--r--actions/foaf.php4
-rw-r--r--actions/foafgroup.php6
-rw-r--r--actions/invite.php3
-rw-r--r--actions/othersettings.php2
-rw-r--r--actions/public.php1
-rw-r--r--actions/recoverpassword.php29
-rw-r--r--actions/replies.php1
-rw-r--r--actions/showfavorites.php1
-rw-r--r--actions/shownotice.php20
-rw-r--r--actions/siteadminpanel.php4
-rw-r--r--actions/sitenoticeadminpanel.php2
-rw-r--r--actions/tag.php1
-rw-r--r--actions/useradminpanel.php3
-rw-r--r--actions/version.php3
33 files changed, 387 insertions, 214 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 6be0c00e3..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 {
@@ -166,8 +174,10 @@ class AllAction extends ProfileAction
{
$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/apiaccountupdateprofile.php b/actions/apiaccountupdateprofile.php
index fd4384a25..9b371ea95 100644
--- a/actions/apiaccountupdateprofile.php
+++ b/actions/apiaccountupdateprofile.php
@@ -115,11 +115,11 @@ class ApiAccountUpdateProfileAction extends ApiAuthAction
$original = clone($profile);
- if (empty($this->name)) {
+ if (!empty($this->name)) {
$profile->fullname = $this->name;
}
- if (empty($this->url)) {
+ if (!empty($this->url)) {
$profile->homepage = $this->url;
}
diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php
index 95d6f95af..5745a81f4 100644
--- a/actions/apigroupshow.php
+++ b/actions/apigroupshow.php
@@ -45,6 +45,7 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php';
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Zach Copley <zach@status.net>
+ * @author Michele <macno@macno.org>
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
* @link http://status.net/
*/
@@ -68,6 +69,24 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
$this->group = $this->getTargetGroup($this->arg('id'));
+ if (empty($this->group)) {
+ $alias = Group_alias::staticGet(
+ 'alias',
+ common_canonical_nickname($this->arg('id'))
+ );
+ if (!empty($alias)) {
+ $args = array('id' => $alias->group_id, 'format' => $this->format);
+ common_redirect(common_local_url('ApiGroupShow', $args), 301);
+ } else {
+ $this->clientError(
+ _('Group not found!'),
+ 404,
+ $this->format
+ );
+ }
+ return;
+ }
+
return true;
}
@@ -85,15 +104,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
{
parent::handle($args);
- if (empty($this->group)) {
- $this->clientError(
- _('Group not found!'),
- 404,
- $this->format
- );
- return;
- }
-
switch($this->format) {
case 'xml':
$this->showSingleXmlGroup($this->group);
@@ -105,7 +115,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction
$this->clientError(_('API method not found.'), 404, $this->format);
break;
}
-
}
/**
diff --git a/actions/apimediaupload.php b/actions/apimediaupload.php
new file mode 100644
index 000000000..ec316edc8
--- /dev/null
+++ b/actions/apimediaupload.php
@@ -0,0 +1,141 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Upload an image via the API
+ *
+ * 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 API
+ * @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 . '/lib/apiauth.php';
+require_once INSTALLDIR . '/lib/mediafile.php';
+
+/**
+ * Upload an image via the API. Returns a shortened URL for the image
+ * to the user.
+ *
+ * @category API
+ * @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 ApiMediaUploadAction extends ApiAuthAction
+{
+ /**
+ * Handle the request
+ *
+ * Grab the file from the 'media' param, then store, and shorten
+ *
+ * @todo Upload throttle!
+ *
+ * @param array $args $_REQUEST data (unused)
+ *
+ * @return void
+ */
+
+ function handle($args)
+ {
+ parent::handle($args);
+
+ if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+ $this->clientError(
+ _('This method requires a POST.'),
+ 400, $this->format
+ );
+ return;
+ }
+
+ // Workaround for PHP returning empty $_POST and $_FILES when POST
+ // length > post_max_size in php.ini
+
+ if (empty($_FILES)
+ && empty($_POST)
+ && ($_SERVER['CONTENT_LENGTH'] > 0)
+ ) {
+ $msg = _('The server was unable to handle that much POST ' .
+ 'data (%s bytes) due to its current configuration.');
+
+ $this->clientError(sprintf($msg, $_SERVER['CONTENT_LENGTH']));
+ return;
+ }
+
+ $upload = null;
+
+ try {
+ $upload = MediaFile::fromUpload('media', $this->auth_user);
+ } catch (ClientException $ce) {
+ $this->clientError($ce->getMessage());
+ return;
+ }
+
+ if (isset($upload)) {
+ $this->showResponse($upload);
+ } else {
+ $this->clientError('Upload failed.');
+ return;
+ }
+ }
+
+ /**
+ * Show a Twitpic-like response with the ID of the media file
+ * and a (hopefully) shortened URL for it.
+ *
+ * @param File $upload the uploaded file
+ *
+ * @return void
+ */
+ function showResponse($upload)
+ {
+ $this->initDocument();
+ $this->elementStart('rsp', array('stat' => 'ok'));
+ $this->element('mediaid', null, $upload->fileRecord->id);
+ $this->element('mediaurl', null, $upload->shortUrl());
+ $this->elementEnd('rsp');
+ $this->endDocument();
+ }
+
+ /**
+ * Overrided clientError to show a more Twitpic-like error
+ *
+ * @param String $msg an error message
+ *
+ */
+ function clientError($msg)
+ {
+ $this->initDocument();
+ $this->elementStart('rsp', array('stat' => 'fail'));
+
+ // @todo add in error code
+ $errAttr = array('msg' => $msg);
+
+ $this->element('err', $errAttr, null);
+ $this->elementEnd('rsp');
+ $this->endDocument();
+ }
+
+}
diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php
index 2caa8d20b..e7c6f3761 100644
--- a/actions/apioauthauthorize.php
+++ b/actions/apioauthauthorize.php
@@ -156,7 +156,7 @@ class ApiOauthAuthorizeAction extends ApiOauthAction
if (!$result) {
common_log_db_error($appUser, 'DELETE', __FILE__);
- throw new ServerException(_('DB error deleting OAuth app user.'));
+ throw new ServerException(_('Database error deleting OAuth application user.'));
return;
}
}
@@ -182,7 +182,7 @@ class ApiOauthAuthorizeAction extends ApiOauthAction
if (!$result) {
common_log_db_error($appUser, 'INSERT', __FILE__);
- throw new ServerException(_('DB error inserting OAuth app user.'));
+ throw new ServerException(_('Database error inserting OAuth application user.'));
return;
}
diff --git a/actions/apistatusesupdate.php b/actions/apistatusesupdate.php
index bf367e1e1..1956c8586 100644
--- a/actions/apistatusesupdate.php
+++ b/actions/apistatusesupdate.php
@@ -244,11 +244,17 @@ class ApiStatusesUpdateAction extends ApiAuthAction
$options = array_merge($options, $locOptions);
}
- $this->notice =
- Notice::saveNew($this->auth_user->id,
- $content,
- $this->source,
- $options);
+ try {
+ $this->notice = Notice::saveNew(
+ $this->auth_user->id,
+ $content,
+ $this->source,
+ $options
+ );
+ } catch (Exception $e) {
+ $this->clientError($e->getMessage());
+ return;
+ }
if (isset($upload)) {
$upload->attachToNotice($this->notice);
diff --git a/actions/apistatusnetconfig.php b/actions/apistatusnetconfig.php
index 51400dfc9..66b23c02d 100644
--- a/actions/apistatusnetconfig.php
+++ b/actions/apistatusnetconfig.php
@@ -50,13 +50,17 @@ if (!defined('STATUSNET')) {
class ApiStatusnetConfigAction extends ApiAction
{
var $keys = array(
- 'site' => array('name', 'server', 'theme', 'path', 'fancy', 'language',
- 'email', 'broughtby', 'broughtbyurl', 'closed',
- 'inviteonly', 'private','textlimit'),
- 'license' => array('url', 'title', 'image'),
+ 'site' => array('name', 'server', 'theme', 'path', 'logo', 'fancy', 'language',
+ 'email', 'broughtby', 'broughtbyurl', 'timezone', 'closed',
+ 'inviteonly', 'private', 'textlimit', 'ssl', 'sslserver', 'shorturllength'),
+ 'license' => array('type', 'owner', 'url', 'title', 'image'),
'nickname' => array('featured'),
+ 'profile' => array('biolimit'),
+ 'group' => array('desclimit'),
+ 'notice' => array('contentlimit'),
'throttle' => array('enabled', 'count', 'timespan'),
- 'xmpp' => array('enabled', 'server', 'user')
+ 'xmpp' => array('enabled', 'server', 'port', 'user'),
+ 'integration' => array('source')
);
/**
@@ -93,8 +97,6 @@ class ApiStatusnetConfigAction extends ApiAction
// XXX: check that all sections and settings are legal XML elements
- common_debug(var_export($this->keys, true));
-
foreach ($this->keys as $section => $settings) {
$this->elementStart($section);
foreach ($settings as $setting) {
@@ -106,6 +108,14 @@ class ApiStatusnetConfigAction extends ApiAction
} else if ($value === true) {
$value = 'true';
}
+
+ // return theme logo if there's no site specific one
+ if (empty($value)) {
+ if ($section == 'site' && $setting == 'logo') {
+ $value = Theme::path('logo.png');
+ }
+ }
+
$this->element($setting, null, $value);
}
$this->elementEnd($section);
diff --git a/actions/apitimelinefavorites.php b/actions/apitimelinefavorites.php
index c89d02247..8cb2e808d 100644
--- a/actions/apitimelinefavorites.php
+++ b/actions/apitimelinefavorites.php
@@ -23,7 +23,8 @@
* @package StatusNet
* @author Craig Andrews <candrews@integralblue.com>
* @author Evan Prodromou <evan@status.net>
- * @author Zach Copley <zach@status.net> * @copyright 2009 StatusNet, Inc.
+ * @author Zach Copley <zach@status.net>
+ * @copyright 2009-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/
*/
@@ -123,22 +124,26 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
? $avatar->displayUrl()
: Avatar::defaultImage(AVATAR_PROFILE_SIZE);
+ $link = common_local_url(
+ 'showfavorites',
+ array('nickname' => $this->user->nickname)
+ );
+
+ $self = $this->getSelfUri();
+
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
- $link = common_local_url(
- 'showfavorites',
- array('nickname' => $this->user->nickname)
- );
$this->showRssTimeline(
$this->notices,
$title,
$link,
$subtitle,
null,
- $logo
+ $logo,
+ $self
);
break;
case 'atom':
@@ -153,23 +158,8 @@ class ApiTimelineFavoritesAction extends ApiBareAuthAction
$atom->setLogo($logo);
$atom->setUpdated('now');
- $atom->addLink(
- common_local_url(
- 'showfavorites',
- array('nickname' => $this->user->nickname)
- )
- );
-
- $id = $this->arg('id');
- $aargs = array('format' => 'atom');
- if (!empty($id)) {
- $aargs['id'] = $id;
- }
-
- $atom->addLink(
- $this->getSelfUri('ApiTimelineFavorites', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
+ $atom->addLink($link);
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
diff --git a/actions/apitimelinefriends.php b/actions/apitimelinefriends.php
index 9ef3ace60..ac350ab1b 100644
--- a/actions/apitimelinefriends.php
+++ b/actions/apitimelinefriends.php
@@ -117,9 +117,17 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
$subtitle = sprintf(
_('Updates from %1$s and friends on %2$s!'),
- $this->user->nickname, $sitename
+ $this->user->nickname,
+ $sitename
);
+ $link = common_local_url(
+ 'all',
+ array('nickname' => $this->user->nickname)
+ );
+
+ $self = $this->getSelfUri();
+
$logo = (!empty($avatar))
? $avatar->displayUrl()
: Avatar::defaultImage(AVATAR_PROFILE_SIZE);
@@ -130,19 +138,14 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
break;
case 'rss':
- $link = common_local_url(
- 'all', array(
- 'nickname' => $this->user->nickname
- )
- );
-
$this->showRssTimeline(
$this->notices,
$title,
$link,
$subtitle,
null,
- $logo
+ $logo,
+ $self
);
break;
case 'atom':
@@ -156,24 +159,8 @@ class ApiTimelineFriendsAction extends ApiBareAuthAction
$atom->setSubtitle($subtitle);
$atom->setLogo($logo);
$atom->setUpdated('now');
-
- $atom->addLink(
- common_local_url(
- 'all',
- array('nickname' => $this->user->nickname)
- )
- );
-
- $id = $this->arg('id');
- $aargs = array('format' => 'atom');
- if (!empty($id)) {
- $aargs['id'] = $id;
- }
-
- $atom->addLink(
- $this->getSelfUri('ApiTimelineFriends', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
+ $atom->addLink($link);
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
diff --git a/actions/apitimelinegroup.php b/actions/apitimelinegroup.php
index 8f971392b..da816c40a 100644
--- a/actions/apitimelinegroup.php
+++ b/actions/apitimelinegroup.php
@@ -107,6 +107,8 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
// We'll pull common formatting out of this for other formats
$atom = new AtomGroupNoticeFeed($this->group);
+ $self = $this->getSelfUri();
+
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
@@ -118,7 +120,8 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
$this->group->homeUrl(),
$atom->subtitle,
null,
- $atom->logo
+ $atom->logo,
+ $self
);
break;
case 'atom':
@@ -126,24 +129,12 @@ class ApiTimelineGroupAction extends ApiPrivateAuthAction
header('Content-Type: application/atom+xml; charset=utf-8');
try {
-
$atom->addAuthorRaw($this->group->asAtomAuthor());
$atom->setActivitySubject($this->group->asActivitySubject());
-
- $id = $this->arg('id');
- $aargs = array('format' => 'atom');
- if (!empty($id)) {
- $aargs['id'] = $id;
- }
- $self = $this->getSelfUri('ApiTimelineGroup', $aargs);
-
$atom->setId($self);
$atom->setSelfLink($self);
-
$atom->addEntryFromNotices($this->notices);
-
$this->raw($atom->getString());
-
} catch (Atom10FeedException $e) {
$this->serverError(
'Could not generate feed for group - ' . $e->getMessage()
diff --git a/actions/apitimelinehome.php b/actions/apitimelinehome.php
index abd387786..1618c9923 100644
--- a/actions/apitimelinehome.php
+++ b/actions/apitimelinehome.php
@@ -72,7 +72,7 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
function prepare($args)
{
parent::prepare($args);
- common_debug("api home_timeline");
+
$this->user = $this->getTargetUser($this->arg('id'));
if (empty($this->user)) {
@@ -121,8 +121,15 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$this->user->nickname, $sitename
);
- $logo = (!empty($avatar))
- ? $avatar->displayUrl()
+ $link = common_local_url(
+ 'all',
+ array('nickname' => $this->user->nickname)
+ );
+
+ $self = $this->getSelfUri();
+
+ $logo = (!empty($avatar))
+ ? $avatar->displayUrl()
: Avatar::defaultImage(AVATAR_PROFILE_SIZE);
switch($this->format) {
@@ -130,17 +137,14 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$this->showXmlTimeline($this->notices);
break;
case 'rss':
- $link = common_local_url(
- 'all',
- array('nickname' => $this->user->nickname)
- );
$this->showRssTimeline(
$this->notices,
$title,
$link,
$subtitle,
null,
- $logo
+ $logo,
+ $self
);
break;
case 'atom':
@@ -155,23 +159,8 @@ class ApiTimelineHomeAction extends ApiBareAuthAction
$atom->setLogo($logo);
$atom->setUpdated('now');
- $atom->addLink(
- common_local_url(
- 'all',
- array('nickname' => $this->user->nickname)
- )
- );
-
- $id = $this->arg('id');
- $aargs = array('format' => 'atom');
- if (!empty($id)) {
- $aargs['id'] = $id;
- }
-
- $atom->addLink(
- $this->getSelfUri('ApiTimelineHome', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
+ $atom->addLink($link);
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
diff --git a/actions/apitimelinementions.php b/actions/apitimelinementions.php
index 31627ab7b..c3aec7c5a 100644
--- a/actions/apitimelinementions.php
+++ b/actions/apitimelinementions.php
@@ -123,6 +123,9 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
'replies',
array('nickname' => $this->user->nickname)
);
+
+ $self = $this->getSelfUri();
+
$subtitle = sprintf(
_('%1$s updates that reply to updates from %2$s / %3$s.'),
$sitename, $this->user->nickname, $profile->getBestName()
@@ -134,10 +137,20 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$this->showXmlTimeline($this->notices);
break;
case 'rss':
- $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo);
+ $this->showRssTimeline(
+ $this->notices,
+ $title,
+ $link,
+ $subtitle,
+ null,
+ $logo,
+ $self
+ );
break;
case 'atom':
+ header('Content-Type: application/atom+xml; charset=utf-8');
+
$atom = new AtomNoticeFeed();
$atom->setId($id);
@@ -146,23 +159,8 @@ class ApiTimelineMentionsAction extends ApiBareAuthAction
$atom->setLogo($logo);
$atom->setUpdated('now');
- $atom->addLink(
- common_local_url(
- 'replies',
- array('nickname' => $this->user->nickname)
- )
- );
-
- $id = $this->arg('id');
- $aargs = array('format' => 'atom');
- if (!empty($id)) {
- $aargs['id'] = $id;
- }
-
- $atom->addLink(
- $this->getSelfUri('ApiTimelineMentions', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
+ $atom->addLink($link);
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
diff --git a/actions/apitimelinepublic.php b/actions/apitimelinepublic.php
index 3e4dad690..903461425 100644
--- a/actions/apitimelinepublic.php
+++ b/actions/apitimelinepublic.php
@@ -107,7 +107,8 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
$title = sprintf(_("%s public timeline"), $sitename);
$taguribase = TagURI::base();
$id = "tag:$taguribase:PublicTimeline";
- $link = common_root_url();
+ $link = common_local_url('public');
+ $self = $this->getSelfUri();
$subtitle = sprintf(_("%s updates from everyone!"), $sitename);
switch($this->format) {
@@ -115,10 +116,20 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
$this->showXmlTimeline($this->notices);
break;
case 'rss':
- $this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo);
+ $this->showRssTimeline(
+ $this->notices,
+ $title,
+ $link,
+ $subtitle,
+ null,
+ $sitelogo,
+ $self
+ );
break;
case 'atom':
+ header('Content-Type: application/atom+xml; charset=utf-8');
+
$atom = new AtomNoticeFeed();
$atom->setId($id);
@@ -126,16 +137,8 @@ class ApiTimelinePublicAction extends ApiPrivateAuthAction
$atom->setSubtitle($subtitle);
$atom->setLogo($sitelogo);
$atom->setUpdated('now');
-
$atom->addLink(common_local_url('public'));
-
- $atom->addLink(
- $this->getSelfUri(
- 'ApiTimelinePublic', array('format' => 'atom')
- ),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
-
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
diff --git a/actions/apitimelinetag.php b/actions/apitimelinetag.php
index a29061fcc..fed1437ea 100644
--- a/actions/apitimelinetag.php
+++ b/actions/apitimelinetag.php
@@ -25,7 +25,7 @@
* @author Evan Prodromou <evan@status.net>
* @author Jeffery To <jeffery.to@gmail.com>
* @author Zach Copley <zach@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009-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/
*/
@@ -67,6 +67,8 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
{
parent::prepare($args);
+ common_debug("apitimelinetag prepare()");
+
$this->tag = $this->arg('tag');
$this->notices = $this->getNotices();
@@ -108,22 +110,28 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
$taguribase = TagURI::base();
$id = "tag:$taguribase:TagTimeline:".$tag;
+ $link = common_local_url(
+ 'tag',
+ array('tag' => $this->tag)
+ );
+
+ $self = $this->getSelfUri();
+
+ common_debug("self link is: $self");
+
switch($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
- $link = common_local_url(
- 'tag',
- array('tag' => $this->tag)
- );
$this->showRssTimeline(
$this->notices,
$title,
$link,
$subtitle,
null,
- $sitelogo
+ $sitelogo,
+ $self
);
break;
case 'atom':
@@ -138,22 +146,8 @@ class ApiTimelineTagAction extends ApiPrivateAuthAction
$atom->setLogo($logo);
$atom->setUpdated('now');
- $atom->addLink(
- common_local_url(
- 'tag',
- array('tag' => $this->tag)
- )
- );
-
- $aargs = array('format' => 'atom');
- if (!empty($this->tag)) {
- $aargs['tag'] = $this->tag;
- }
-
- $atom->addLink(
- $this->getSelfUri('ApiTimelineTag', $aargs),
- array('rel' => 'self', 'type' => 'application/atom+xml')
- );
+ $atom->addLink($link);
+ $atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
diff --git a/actions/apitimelineuser.php b/actions/apitimelineuser.php
index 2d0047c04..11431a82c 100644
--- a/actions/apitimelineuser.php
+++ b/actions/apitimelineuser.php
@@ -116,13 +116,13 @@ class ApiTimelineUserAction extends ApiBareAuthAction
// 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(
+
+ $link = common_local_url(
'showstream',
array('nickname' => $this->user->nickname)
);
- $subtitle = $atom->subtitle;
- $logo = $atom->logo;
+
+ $self = $this->getSelfUri();
// FriendFeed's SUP protocol
// Also added RSS and Atom feeds
@@ -136,25 +136,22 @@ class ApiTimelineUserAction extends ApiBareAuthAction
break;
case 'rss':
$this->showRssTimeline(
- $this->notices, $title, $link,
- $subtitle, $suplink, $logo
+ $this->notices,
+ $atom->title,
+ $link,
+ $atom->subtitle,
+ $suplink,
+ $atom->logo,
+ $self
);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
- $id = $this->arg('id');
- $aargs = array('format' => 'atom');
- if (!empty($id)) {
- $aargs['id'] = $id;
- }
- $self = $this->getSelfUri('ApiTimelineUser', $aargs);
$atom->setId($self);
$atom->setSelfLink($self);
-
$atom->addEntryFromNotices($this->notices);
-
$this->raw($atom->getString());
break;
diff --git a/actions/avatarsettings.php b/actions/avatarsettings.php
index 6a7398746..d4ea11cb7 100644
--- a/actions/avatarsettings.php
+++ b/actions/avatarsettings.php
@@ -301,6 +301,10 @@ class AvatarsettingsAction extends AccountSettingsAction
$this->showForm($e->getMessage());
return;
}
+ if ($imagefile === null) {
+ $this->showForm(_('No file uploaded.'));
+ return;
+ }
$cur = common_current_user();
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index 6fd74f3ff..cc8351d8d 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -141,7 +141,7 @@ class ConfirmaddressAction extends Action
function title()
{
- return _('Confirm Address');
+ return _('Confirm address');
}
/**
diff --git a/actions/deleteuser.php b/actions/deleteuser.php
index c4f84fad2..4e6b27395 100644
--- a/actions/deleteuser.php
+++ b/actions/deleteuser.php
@@ -162,7 +162,15 @@ class DeleteuserAction extends ProfileFormAction
function handlePost()
{
if (Event::handle('StartDeleteUser', array($this, $this->user))) {
- $this->user->delete();
+ // Mark the account as deleted and shove low-level deletion tasks
+ // to background queues. Removing a lot of posts can take a while...
+ if (!$this->user->hasRole(Profile_role::DELETED)) {
+ $this->user->grantRole(Profile_role::DELETED);
+ }
+
+ $qm = QueueManager::get();
+ $qm->enqueue($this->user, 'deluser');
+
Event::handle('EndDeleteUser', array($this, $this->user));
}
}
diff --git a/actions/foaf.php b/actions/foaf.php
index e9f67b7f2..fc2ec9b12 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -251,7 +251,7 @@ class FoafAction extends Action
}
// Their account
- $this->elementStart('holdsAccount');
+ $this->elementStart('account');
$this->elementStart('OnlineAccount', $attr);
if ($service) {
$this->element('accountServiceHomepage', array('rdf:resource' =>
@@ -306,7 +306,7 @@ class FoafAction extends Action
}
$this->elementEnd('OnlineAccount');
- $this->elementEnd('holdsAccount');
+ $this->elementEnd('account');
return $person;
}
diff --git a/actions/foafgroup.php b/actions/foafgroup.php
index ebdf1cee2..d685554ac 100644
--- a/actions/foafgroup.php
+++ b/actions/foafgroup.php
@@ -146,7 +146,7 @@ class FoafGroupAction extends Action
{
$this->elementStart('Agent', array('rdf:about' => $uri));
$this->element('nick', null, $details['nickname']);
- $this->elementStart('holdsAccount');
+ $this->elementStart('account');
$this->elementStart('sioc:User', array('rdf:about'=>$uri.'#acct'));
$this->elementStart('sioc:has_function');
$this->elementStart('statusnet:GroupAdminRole');
@@ -154,7 +154,7 @@ class FoafGroupAction extends Action
$this->elementEnd('statusnet:GroupAdminRole');
$this->elementEnd('sioc:has_function');
$this->elementEnd('sioc:User');
- $this->elementEnd('holdsAccount');
+ $this->elementEnd('account');
$this->elementEnd('Agent');
}
else
@@ -177,4 +177,4 @@ class FoafGroupAction extends Action
$this->elementEnd('Document');
}
-} \ 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/othersettings.php b/actions/othersettings.php
index 0de7cd908..10e9873b3 100644
--- a/actions/othersettings.php
+++ b/actions/othersettings.php
@@ -57,7 +57,7 @@ class OthersettingsAction extends AccountSettingsAction
function title()
{
- return _('Other Settings');
+ return _('Other settings');
}
/**
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..f9956897f 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
{
@@ -262,10 +262,20 @@ class RecoverpasswordAction extends Action
# See if it's an unconfirmed email address
if (!$user) {
- $confirm_email = Confirm_address::staticGet('address', common_canonical_email($nore));
- if ($confirm_email && $confirm_email->address_type == 'email') {
+ // Warning: it may actually be legit to have multiple folks
+ // who have claimed, but not yet confirmed, the same address.
+ // We'll only send to the first one that comes up.
+ $confirm_email = new Confirm_address();
+ $confirm_email->address = common_canonical_email($nore);
+ $confirm_email->address_type = 'email';
+ $confirm_email->find();
+ if ($confirm_email->fetch()) {
$user = User::staticGet($confirm_email->user_id);
+ } else {
+ $confirm_email = null;
}
+ } else {
+ $confirm_email = null;
}
if (!$user) {
@@ -276,9 +286,11 @@ class RecoverpasswordAction extends Action
# Try to get an unconfirmed email address if they used a user name
if (!$user->email && !$confirm_email) {
- $confirm_email = Confirm_address::staticGet('user_id', $user->id);
- if ($confirm_email && $confirm_email->address_type != 'email') {
- # Skip non-email confirmations
+ $confirm_email = new Confirm_address();
+ $confirm_email->user_id = $user->id;
+ $confirm_email->address_type = 'email';
+ $confirm_email->find();
+ if (!$confirm_email->fetch()) {
$confirm_email = null;
}
}
@@ -294,7 +306,7 @@ class RecoverpasswordAction extends Action
$confirm->code = common_confirmation_code(128);
$confirm->address_type = 'recover';
$confirm->user_id = $user->id;
- $confirm->address = (isset($user->email)) ? $user->email : $confirm_email->address;
+ $confirm->address = (!empty($user->email)) ? $user->email : $confirm_email->address;
if (!$confirm->insert()) {
common_log_db_error($confirm, 'INSERT', __FILE__);
@@ -319,7 +331,8 @@ class RecoverpasswordAction extends Action
$body .= common_config('site', 'name');
$body .= "\n";
- mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
+ $headers = _mail_prepare_headers('recoverpassword', $user->nickname, $user->nickname);
+ mail_to_user($user, _('Password recovery requested'), $body, $headers, $confirm->address);
$this->mode = 'sent';
$this->msg = _('Instructions for recovering your password ' .
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/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/shownotice.php b/actions/shownotice.php
index d09100f67..a23027f7c 100644
--- a/actions/shownotice.php
+++ b/actions/shownotice.php
@@ -103,11 +103,6 @@ class ShownoticeAction extends OwnerDesignAction
$this->user = User::staticGet('id', $this->profile->id);
- if ($this->notice->is_local == Notice::REMOTE_OMB) {
- common_redirect($this->notice->uri);
- return false;
- }
-
$this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
return true;
@@ -198,13 +193,20 @@ class ShownoticeAction extends OwnerDesignAction
if ($this->notice->is_local == Notice::REMOTE_OMB) {
if (!empty($this->notice->url)) {
- common_redirect($this->notice->url, 301);
+ $target = $this->notice->url;
} else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) {
- common_redirect($this->notice->uri, 301);
+ // Old OMB posts saved the remote URL only into the URI field.
+ $target = $this->notice->uri;
+ } else {
+ // Shouldn't happen.
+ $target = false;
+ }
+ if ($target && $target != $this->selfUrl()) {
+ common_redirect($target, 301);
+ return false;
}
- } else {
- $this->showPage();
}
+ $this->showPage();
}
/**
diff --git a/actions/siteadminpanel.php b/actions/siteadminpanel.php
index cb3c2e8fd..e5482987f 100644
--- a/actions/siteadminpanel.php
+++ b/actions/siteadminpanel.php
@@ -161,8 +161,8 @@ class SiteadminpanelAction extends AdminPanelAction
// Validate text limit
- if (!Validate::number($values['site']['textlimit'], array('min' => 140))) {
- $this->clientError(_("Minimum text limit is 140 characters."));
+ if (!Validate::number($values['site']['textlimit'], array('min' => 0))) {
+ $this->clientError(_("Minimum text limit is 0 (unlimited)."));
}
// Validate dupe limit
diff --git a/actions/sitenoticeadminpanel.php b/actions/sitenoticeadminpanel.php
index 3931aa982..a68cc699c 100644
--- a/actions/sitenoticeadminpanel.php
+++ b/actions/sitenoticeadminpanel.php
@@ -93,7 +93,7 @@ class SitenoticeadminpanelAction extends AdminPanelAction
// assert(all values are valid);
// This throws an exception on validation errors
- $this->validate(&$siteNotice);
+ $this->validate($siteNotice);
$config = new Config();
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/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/version.php b/actions/version.php
index c1f673c45..b6593e5ed 100644
--- a/actions/version.php
+++ b/actions/version.php
@@ -266,5 +266,6 @@ class VersionAction extends Action
'Craig Andrews',
'mEDI',
'Brett Taylor',
- 'Brigitte Schuster');
+ 'Brigitte Schuster',
+ 'Brion Vibber');
}