diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-08-04 11:13:47 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-08-04 11:13:47 -0400 |
commit | abffaebebd89736a043671d7518c3c6e3b9a9224 (patch) | |
tree | 4a95e2a0cb484a72180cb8d15c87e179f78e3835 /index.php | |
parent | c378cc976f2fc2afd3b9e1a6d7a9536cb94dc77d (diff) |
event for determining if an action is a login action
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -105,6 +105,20 @@ function checkMirror($action_obj) } } +function isLoginAction($action) +{ + static $loginActions = array('login', 'openidlogin', 'finishopenidlogin', + 'recoverpassword', 'api', 'doc', 'register'); + + $login = null; + + if (Event::handle('LoginAction', array($action, &$login))) { + $login = in_array($action, $loginActions); + } + + return $login; +} + function main() { // quick check for fancy URL auto-detection support in installer. @@ -164,8 +178,7 @@ function main() // parts of the site, redirect to login if (!$user && common_config('site', 'private') && - !in_array($action, array('login', 'openidlogin', 'finishopenidlogin', - 'recoverpassword', 'api', 'doc', 'register')) && + !isLoginAction($action) && !preg_match('/rss$/', $action)) { common_redirect(common_local_url('login')); return; |