]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
authorEvan Prodromou <evan@status.net>
Mon, 2 Nov 2009 23:13:04 +0000 (18:13 -0500)
committerEvan Prodromou <evan@status.net>
Mon, 2 Nov 2009 23:13:04 +0000 (18:13 -0500)
Conflicts:
classes/User.php

1  2 
classes/User.php

index f060b57a8cea1f84a9c0f82e0d5dbeff5bff556d,530ece1ba4ee3762e1ad80470e7731e77e080d04..96a64ccb29448cc4b898bc41aa5a4114b8cdf2c8
@@@ -117,13 -117,24 +117,23 @@@ class User extends Memcached_DataObjec
      function allowed_nickname($nickname)
      {
          // XXX: should already be validated for size, content, etc.
-         static $blacklist = array('rss', 'xrds', 'doc', 'main',
-                                   'settings', 'notice', 'user',
-                                   'search', 'avatar', 'tag', 'tags',
-                                   'api', 'message', 'group', 'groups',
-                                   'local');
-         $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
-         return !in_array($nickname, $merged);
 -
+         $blacklist = common_config('nickname', 'blacklist');
+         //all directory and file names should be blacklisted
+         $d = dir(INSTALLDIR);
+         while (false !== ($entry = $d->read())) {
+             $blacklist[]=$entry;
+         }
+         $d->close();
+         //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)