diff options
author | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-11 21:37:12 +0000 |
---|---|---|
committer | nickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-05-11 21:37:12 +0000 |
commit | 25c192e75d52f5bd7db4da22bb9213421fa36b4c (patch) | |
tree | e2ef3042e4b048714a08d273700a426ac6020b1a /engine/lib/sites.php | |
parent | e210f797ff2dda5785e64380234f1ee876bc5c12 (diff) | |
download | elgg-25c192e75d52f5bd7db4da22bb9213421fa36b4c.tar.gz elgg-25c192e75d52f5bd7db4da22bb9213421fa36b4c.tar.bz2 |
Do not display site pages when in Walled Garden mode, excepting system-defined whitelist.
git-svn-id: http://code.elgg.org/elgg/trunk@6004 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/sites.php')
-rw-r--r-- | engine/lib/sites.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 13521a257..c976384c2 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -243,6 +243,51 @@ class ElggSite extends ElggEntity { 'url', )); } + + public function check_walled_garden() { + global $CONFIG; + + if ($CONFIG->walled_garden && !isloggedin()) { + register_plugin_hook('index', 'system', 'elgg_walled_garden_index'); + + if (!$this->is_public_page()) { + register_error(elgg_echo('walled_garden:private_page') . current_page_url()); + forward(); + } + } + } + + public function is_public_page($url='') { + global $CONFIG; + + if (empty($url)) { + $url = current_page_url(); + + // do not check against URL queries + if ($pos = strpos($url, '?')) { + $url = substr($url, 0, $pos); + } + } + + // default public pages + $public = array( + $CONFIG->url, + "{$CONFIG->url}action/login", + "{$CONFIG->url}upgrade.php", + ); + + // include a hook for plugin authors to include public pages + + // lookup admin-specific public pages + + // allow public pages + if (in_array($url, $public)) { + return TRUE; + } + + // non-public page + return FALSE; + } } /** |