diff options
Diffstat (limited to 'mod/walledgarden/start.php')
-rw-r--r-- | mod/walledgarden/start.php | 98 |
1 files changed, 57 insertions, 41 deletions
diff --git a/mod/walledgarden/start.php b/mod/walledgarden/start.php index c64ca8b5b..260a8c1e4 100644 --- a/mod/walledgarden/start.php +++ b/mod/walledgarden/start.php @@ -1,55 +1,71 @@ <?php - /** - * Walled garden support. - * - * @package ElggWalledGarden - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ +/** + * Walled garden support. + */ - function walledgarden_init() - { - global $CONFIG; +function walledgarden_init(){ + global $CONFIG; - $CONFIG->disable_registration = true; + $CONFIG->disable_registration = true; - // elgg_set_viewtype('default'); - elgg_extend_view('pageshells/pageshell', 'walledgarden/walledgarden'); - elgg_extend_view('css','walledgarden/css'); - - register_plugin_hook('new_twitter_user', 'twitter_service', 'walledgarden_new_twitter_user'); - } + // elgg_set_viewtype('default'); + elgg_extend_view('pageshells/pageshell', 'walledgarden/walledgarden'); + elgg_extend_view('css','walledgarden/css'); + + register_plugin_hook('new_twitter_user', 'twitter_service', 'walledgarden_new_twitter_user'); - function walledgarden_pagesetup() { + if(!isloggedin()) + register_plugin_hook('index','system','walledgarden_index'); +} + +function walledgarden_pagesetup() { - global $CONFIG; - if (current_page_url() != $CONFIG->url - && !defined('externalpage') - && !isloggedin()) { - forward(); - exit; - } + global $CONFIG; + if (current_page_url() != $CONFIG->url + && !defined('externalpage') + && !isloggedin()) { + forward(); + exit; + } - } +} - function walledgarden_index() { +function walledgarden_index() { - if (!include_once(dirname(dirname(__FILE__))) . "/walledgarden/index.php") { - return false; - } - return true; + if (!include_once(dirname(dirname(__FILE__))) . "/walledgarden/index.php") { + return false; + } + return true; - } +} + +function walledgarden_new_twitter_user($hook, $entity_type, $returnvalue, $params) { + // do not allow new users to be created within the walled-garden + register_error(elgg_echo('walledgarden:new_user:fail')); + return FALSE; +} + +/** + * This is so the homepage can have its own pageshell + **/ + +function page_draw_walledgarden($title, $body, $sidebar = "") { + + // Draw the page + $output = elgg_view('page_shells/walled_garden_index', array( + 'title' => $title, + 'body' => $body, + 'sidebar' => $sidebar, + 'sysmessages' => system_messages(null,"") + ) + ); + $split_output = str_split($output, 1024); - function walledgarden_new_twitter_user($hook, $entity_type, $returnvalue, $params) { - // do not allow new users to be created within the walled-garden - register_error(elgg_echo('walledgarden:new_user:fail')); - return FALSE; + foreach($split_output as $chunk) { + echo $chunk; } +} - register_elgg_event_handler('init','system','walledgarden_init'); - register_elgg_event_handler('pagesetup','system','walledgarden_pagesetup'); -?> +register_elgg_event_handler('init','system','walledgarden_init'); +register_elgg_event_handler('pagesetup','system','walledgarden_pagesetup'); |