From 4a2a33d4aef454cd9083ba0ef12b8de6e8e0f383 Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 23 Apr 2010 10:16:33 +0000 Subject: The start of a new walled garden index page git-svn-id: http://code.elgg.org/elgg/trunk@5856 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/walledgarden/start.php | 98 +++++++++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 41 deletions(-) (limited to 'mod/walledgarden/start.php') 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 @@ 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'); -- cgit v1.2.3