]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/OStatus/actions/userxrd.php
Merge branch '0.9.x' into 1.0.x
[quix0rs-gnu-social.git] / plugins / OStatus / actions / userxrd.php
index eb80a5ad46930d801be6e82735a04fb2a9866010..8179505a55d6b7ce108cb5d5c82c4a2949435651 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+if (!defined('STATUSNET')) { exit(1); }
+
 /**
  * @package OStatusPlugin
  * @maintainer James Walker <james@status.net>
  */
-
-if (!defined('STATUSNET')) { exit(1); }
-
 class UserxrdAction extends XrdAction
 {
-
     function prepare($args)
     {
         parent::prepare($args);
 
         $this->uri = $this->trimmed('uri');
         $this->uri = Discovery::normalize($this->uri);
-        
+
         if (Discovery::isWebfinger($this->uri)) {
-            list($nick, $domain) = explode('@', substr(urldecode($this->uri), 5));
-            $nick = common_canonical_nickname($nick);
-            $this->user = User::staticGet('nickname', $nick);
+            $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 (!$this->user) {
-            $this->clientError(_('No such user.'), 404);
+            $this->clientError(_m('No such user.'), 404);
             return false;
         }