diff options
author | Evan Prodromou <evan@status.net> | 2009-11-02 18:13:04 -0500 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2009-11-02 18:13:04 -0500 |
commit | a2b830392597d88c435baf54ad0df4ecda02dc41 (patch) | |
tree | 08f8ddcbcab63de9117ccf82e5477fa0d565bdc6 /classes/User.php | |
parent | 61419038e5747886357964a7eb3f814761482891 (diff) | |
parent | 15d0055c6f2e3b7007a82df40502e15cf5c32a13 (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Conflicts:
classes/User.php
Diffstat (limited to 'classes/User.php')
-rw-r--r-- | classes/User.php | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/classes/User.php b/classes/User.php index f060b57a8..96a64ccb2 100644 --- a/classes/User.php +++ b/classes/User.php @@ -117,13 +117,23 @@ 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'); - $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) |