From: Evan Prodromou Date: Fri, 3 Apr 2009 18:00:52 +0000 (-0400) Subject: redirect FOAF file on non-canonical nickname X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5f79653acb56867b6e31fd56f2d16cbc77622fbc;p=quix0rs-gnu-social.git redirect FOAF file on non-canonical nickname --- diff --git a/actions/foaf.php b/actions/foaf.php index 3a99835b4a..aa78b91c3e 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);