. */ if (!defined('STATUSNET')) { exit(1); } /** * @package OStatusPlugin * @maintainer James Walker */ class UserxrdAction extends XrdAction { function prepare($args) { parent::prepare($args); global $config; if($config['site']['cors'] === true){ header('Access-Control-Allow-Origin: *'); } $this->uri = $this->trimmed('uri'); $this->uri = self::normalize($this->uri); if (self::isWebfinger($this->uri)) { $parts = explode('@', substr(urldecode($this->uri), 5)); if (count($parts) == 2) { list($nick, $domain) = $parts; // @fixme confirm the domain too // @fixme if domain checking is added, ensure that it will not // cause problems with sites that have changed domains! $nick = common_canonical_nickname($nick); $this->user = User::staticGet('nickname', $nick); } } else { $this->user = User::staticGet('uri', $this->uri); if (empty($this->user)) { // try and get it by profile url $profile = Profile::staticGet('profileurl', $this->uri); if (!empty($profile)) { $this->user = User::staticGet('id', $profile->id); } } } if (!$this->user) { // TRANS: Client error displayed when user not found for an action. $this->clientError(_('No such user.'), 404); return false; } return true; } }