]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
allowed_nickname blocks top level url router names
authorCraig Andrews <candrews@integralblue.com>
Mon, 2 Nov 2009 20:18:04 +0000 (15:18 -0500)
committerCraig Andrews <candrews@integralblue.com>
Mon, 2 Nov 2009 20:18:56 +0000 (15:18 -0500)
classes/User.php

index 3fa9cc15262420f9b6a05721eac472f90c2829b4..530ece1ba4ee3762e1ad80470e7731e77e080d04 100644 (file)
@@ -118,7 +118,7 @@ class User extends Memcached_DataObject
     {
         // XXX: should already be validated for size, content, etc.
 
-        $blacklist = array();
+        $blacklist = common_config('nickname', 'blacklist');
 
         //all directory and file names should be blacklisted
         $d = dir(INSTALLDIR);
@@ -126,8 +126,15 @@ class User extends Memcached_DataObject
             $blacklist[]=$entry;
         }
         $d->close();
-        $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
-        return !in_array($nickname, $merged);
+
+        //all top level names in the router should be blacklisted
+        $router = Router::get();
+        foreach(array_keys($router->m->getPaths()) as $path){
+            if(preg_match('/^\/(.*?)[\/\?]/',$path,$matches)){
+                $blacklist[]=$matches[1];
+            }
+        }
+        return !in_array($nickname, $blacklist);
     }
 
     function getCurrentNotice($dt=null)