summaryrefslogtreecommitdiff
path: root/plugins/OStatus/actions
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/OStatus/actions')
-rw-r--r--plugins/OStatus/actions/ostatusgroup.php2
-rw-r--r--plugins/OStatus/actions/ostatusinit.php14
-rw-r--r--plugins/OStatus/actions/ostatussub.php14
-rw-r--r--plugins/OStatus/actions/ownerxrd.php4
-rw-r--r--plugins/OStatus/actions/pushcallback.php15
-rw-r--r--plugins/OStatus/actions/pushhub.php11
-rw-r--r--plugins/OStatus/actions/userxrd.php2
7 files changed, 37 insertions, 25 deletions
diff --git a/plugins/OStatus/actions/ostatusgroup.php b/plugins/OStatus/actions/ostatusgroup.php
index 1b368de63..1861e866f 100644
--- a/plugins/OStatus/actions/ostatusgroup.php
+++ b/plugins/OStatus/actions/ostatusgroup.php
@@ -74,7 +74,7 @@ class OStatusGroupAction extends OStatusSubAction
$this->input('profile',
_m('Join group'),
$this->profile_uri,
- _m("OStatus group's address, like http://example.net/group/nickname"));
+ _m("OStatus group's address, like http://example.net/group/nickname."));
$this->elementEnd('li');
$this->elementEnd('ul');
diff --git a/plugins/OStatus/actions/ostatusinit.php b/plugins/OStatus/actions/ostatusinit.php
index 22aea9f70..0c991aba9 100644
--- a/plugins/OStatus/actions/ostatusinit.php
+++ b/plugins/OStatus/actions/ostatusinit.php
@@ -45,13 +45,13 @@ class OStatusInitAction extends Action
// Local user or group the remote wants to subscribe to
$this->nickname = $this->trimmed('nickname');
$this->group = $this->trimmed('group');
-
+
// Webfinger or profile URL of the remote user
$this->profile = $this->trimmed('profile');
return true;
}
-
+
function handle($args)
{
parent::handle($args);
@@ -69,7 +69,7 @@ class OStatusInitAction extends Action
$this->showForm();
}
}
-
+
function showForm($err = null)
{
$this->err = $err;
@@ -109,12 +109,12 @@ class OStatusInitAction extends Action
$this->elementStart('ul', 'form_data');
$this->elementStart('li', array('id' => 'ostatus_nickname'));
$this->input('nickname', _m('User nickname'), $this->nickname,
- _m('Nickname of the user you want to follow'));
+ _m('Nickname of the user you want to follow.'));
$this->hidden('group', $this->group); // pass-through for magic links
$this->elementEnd('li');
$this->elementStart('li', array('id' => 'ostatus_profile'));
$this->input('profile', _m('Profile Account'), $this->profile,
- _m('Your account id (i.e. user@identi.ca)'));
+ _m('Your account id (e.g. user@identi.ca).'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('submit', $submit);
@@ -199,7 +199,7 @@ class OStatusInitAction extends Action
function title()
{
- return _m('OStatus Connect');
+ return _m('OStatus Connect');
}
-
+
}
diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php
index 28714514f..4cbd7d034 100644
--- a/plugins/OStatus/actions/ostatussub.php
+++ b/plugins/OStatus/actions/ostatussub.php
@@ -64,11 +64,11 @@ class OStatusSubAction extends Action
$this->input('profile',
_m('Subscribe to'),
$this->profile_uri,
- _m("OStatus user's address, like nickname@example.com or http://example.net/nickname"));
+ _m("OStatus user's address, like nickname@example.com or http://example.net/nickname")); // @todo i18n FIXME: needs context/translator hint.
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('validate', _m('Continue'));
+ $this->submit('validate', _m('Continue')); // @todo i18n FIXME: needs context/translator hint.
$this->elementEnd('fieldset');
@@ -103,10 +103,10 @@ class OStatusSubAction extends Action
$this->hidden('profile', $this->profile_uri);
if ($this->oprofile->isGroup()) {
$this->submit('submit', _m('Join'), 'submit', null,
- _m('Join this group'));
+ _m('Join this group')); // @todo i18n FIXME: needs context/translator hint.
} else {
$this->submit('submit', _m('Confirm'), 'submit', null,
- _m('Subscribe to this user'));
+ _m('Subscribe to this user')); // @todo i18n FIXME: needs context/translator hint.
}
$this->elementEnd('fieldset');
$this->elementEnd('form');
@@ -244,13 +244,13 @@ class OStatusSubAction extends Action
} else if (Validate::uri($this->profile_uri)) {
$this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri);
} else {
- $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
+ $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug('Invalid address format.', __FILE__);
return false;
}
return true;
} catch (FeedSubBadURLException $e) {
- $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
+ $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug('Invalid URL or could not reach server.', __FILE__);
} catch (FeedSubBadResponseException $e) {
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
@@ -269,7 +269,7 @@ class OStatusSubAction extends Action
common_debug('Not a recognized feed type.', __FILE__);
} catch (Exception $e) {
// Any new ones we forgot about
- $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
+ $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug(sprintf('Bad feed URL: %s %s', get_class($e), $e->getMessage()), __FILE__);
}
diff --git a/plugins/OStatus/actions/ownerxrd.php b/plugins/OStatus/actions/ownerxrd.php
index 9c141d8c7..3fcb982b8 100644
--- a/plugins/OStatus/actions/ownerxrd.php
+++ b/plugins/OStatus/actions/ownerxrd.php
@@ -32,7 +32,7 @@ class OwnerxrdAction extends XrdAction
function prepare($args)
{
$this->user = User::siteOwner();
-
+
if (!$this->user) {
$this->clientError(_('No such user.'), 404);
return false;
@@ -40,7 +40,7 @@ class OwnerxrdAction extends XrdAction
$nick = common_canonical_nickname($this->user->nickname);
$acct = 'acct:' . $nick . '@' . common_config('site', 'server');
-
+
$this->xrd = new XRD();
// Check to see if a $config['webfinger']['owner'] has been set
diff --git a/plugins/OStatus/actions/pushcallback.php b/plugins/OStatus/actions/pushcallback.php
index 9a2067b8c..6c6978745 100644
--- a/plugins/OStatus/actions/pushcallback.php
+++ b/plugins/OStatus/actions/pushcallback.php
@@ -37,7 +37,7 @@ class PushCallbackAction extends Action
$this->handleGet();
}
}
-
+
/**
* Handler for POST content updates from the hub
*/
@@ -46,11 +46,12 @@ class PushCallbackAction extends Action
$feedid = $this->arg('feed');
common_log(LOG_INFO, "POST for feed id $feedid");
if (!$feedid) {
- throw new ServerException('Empty or invalid feed id', 400);
+ throw new ServerException('Empty or invalid feed id.', 400);
}
$feedsub = FeedSub::staticGet('id', $feedid);
if (!$feedsub) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ServerException('Unknown PuSH feed id ' . $feedid, 400);
}
@@ -70,7 +71,7 @@ class PushCallbackAction extends Action
$qm = QueueManager::get();
$qm->enqueue($data, 'pushin');
}
-
+
/**
* Handler for GET verification requests from the hub.
*/
@@ -88,20 +89,24 @@ class PushCallbackAction extends Action
$feedsub = FeedSub::staticGet('uri', $topic);
if (!$feedsub) {
- throw new ClientException("Bad hub.topic feed $topic", 404);
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
+ throw new ClientException("Bad hub.topic feed $topic.", 404);
}
if ($feedsub->verify_token !== $verify_token) {
- throw new ClientException("Bad hub.verify_token $token for $topic", 404);
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
+ throw new ClientException("Bad hub.verify_token $token for $topic.", 404);
}
if ($mode == 'subscribe') {
// We may get re-sub requests legitimately.
if ($feedsub->sub_state != 'subscribe' && $feedsub->sub_state != 'active') {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unexpected subscribe request for $topic.", 404);
}
} else {
if ($feedsub->sub_state != 'unsubscribe') {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unexpected unsubscribe request for $topic.", 404);
}
}
diff --git a/plugins/OStatus/actions/pushhub.php b/plugins/OStatus/actions/pushhub.php
index 842d65e7d..6909b8539 100644
--- a/plugins/OStatus/actions/pushhub.php
+++ b/plugins/OStatus/actions/pushhub.php
@@ -36,7 +36,6 @@ Things to consider...
*/
-
class PushHubAction extends Action
{
function arg($arg, $def=null)
@@ -63,8 +62,10 @@ class PushHubAction extends Action
$this->subunsub($mode);
break;
case "publish":
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Publishing outside feeds not supported.", 400);
default:
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unrecognized mode '$mode'.", 400);
}
}
@@ -84,16 +85,19 @@ class PushHubAction extends Action
$topic = $this->argUrl('hub.topic');
if (!$this->recognizedFeed($topic)) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unsupported hub.topic $topic; this hub only serves local user and group Atom feeds.");
}
$verify = $this->arg('hub.verify'); // @fixme may be multiple
if ($verify != 'sync' && $verify != 'async') {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.verify $verify; must be sync or async.");
}
$lease = $this->arg('hub.lease_seconds', null);
if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.lease $lease; must be empty or positive integer.");
}
@@ -101,6 +105,7 @@ class PushHubAction extends Action
$secret = $this->arg('hub.secret', null);
if ($secret != '' && strlen($secret) >= 200) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.secret $secret; must be under 200 bytes.");
}
@@ -152,6 +157,7 @@ class PushHubAction extends Action
if ($feed == $userFeed) {
$user = User::staticGet('id', $id);
if (!$user) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.topic $feed; user doesn't exist.");
} else {
return true;
@@ -160,6 +166,7 @@ class PushHubAction extends Action
if ($feed == $groupFeed) {
$user = User_group::staticGet('id', $id);
if (!$user) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.topic $feed; group doesn't exist.");
} else {
return true;
@@ -183,6 +190,7 @@ class PushHubAction extends Action
if (Validate::uri($url, $params)) {
return $url;
} else {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid URL passed for $arg: '$url'");
}
}
@@ -199,4 +207,3 @@ class PushHubAction extends Action
return HubSub::staticGet($feed, $callback);
}
}
-
diff --git a/plugins/OStatus/actions/userxrd.php b/plugins/OStatus/actions/userxrd.php
index 6a6886eb8..dd720568b 100644
--- a/plugins/OStatus/actions/userxrd.php
+++ b/plugins/OStatus/actions/userxrd.php
@@ -33,7 +33,7 @@ class UserxrdAction extends XrdAction
$this->uri = $this->trimmed('uri');
$this->uri = Discovery::normalize($this->uri);
-
+
if (Discovery::isWebfinger($this->uri)) {
$parts = explode('@', substr(urldecode($this->uri), 5));
if (count($parts) == 2) {