summaryrefslogtreecommitdiff
path: root/classes/User.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/User.php')
-rw-r--r--classes/User.php24
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)