summaryrefslogtreecommitdiff
path: root/actions/foaf.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-04-03 14:00:52 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-04-03 14:00:52 -0400
commit5f79653acb56867b6e31fd56f2d16cbc77622fbc (patch)
treeb95172b5d8974c13a5d5dfffd7411a3fc660ea7f /actions/foaf.php
parente2898db087c5ae43587235ce3c97b11fff5867a4 (diff)
redirect FOAF file on non-canonical nickname
Diffstat (limited to 'actions/foaf.php')
-rw-r--r--actions/foaf.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/actions/foaf.php b/actions/foaf.php
index 3a99835b4..aa78b91c3 100644
--- a/actions/foaf.php
+++ b/actions/foaf.php
@@ -33,7 +33,24 @@ class FoafAction extends Action
function prepare($args)
{
parent::prepare($args);
- $this->nickname = $this->trimmed('nickname');
+
+ $nickname_arg = $this->arg('nickname');
+
+ if (empty($nickname_arg)) {
+ $this->clientError(_('No such user.'), 404);
+ return false;
+ }
+
+ $this->nickname = common_canonical_nickname($nickname_arg);
+
+ // Permanent redirect on non-canonical nickname
+
+ if ($nickname_arg != $this->nickname) {
+ common_redirect(common_local_url('foaf',
+ array('nickname' => $this->nickname)),
+ 301);
+ return false;
+ }
$this->user = User::staticGet('nickname', $this->nickname);