]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Blacklist all files and directories in the web root (INSTALLDIR). Much more elegant...
authorCraig Andrews <candrews@integralblue.com>
Fri, 18 Sep 2009 21:53:06 +0000 (17:53 -0400)
committerCraig Andrews <candrews@integralblue.com>
Fri, 18 Sep 2009 21:53:06 +0000 (17:53 -0400)
classes/User.php

index 14d3cf54fac608caf62f386f090b3d24eb77fdf0..8386f1e185bb7e41bbf4191e4a504bb195b9b848 100644 (file)
@@ -120,11 +120,15 @@ class User extends Memcached_DataObject
     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');
+
+        $blacklist = array();
+
+        //all directory and file names should be blacklisted
+        $d = dir(INSTALLDIR);
+        while (false !== ($entry = $d->read())) {
+            $blacklist[]=$entry;
+        }
+        $d->close();
         $merged = array_merge($blacklist, common_config('nickname', 'blacklist'));
         return !in_array($nickname, $merged);
     }