aboutsummaryrefslogtreecommitdiff
path: root/mod/walledgarden/start.php
blob: c64ca8b5b13d4bc46d2107b46a288d103fe04a34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?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/
	 */

	function walledgarden_init()
	{
		global $CONFIG;
		
		$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');
	}
	
	function walledgarden_pagesetup() {
		
		global $CONFIG;
		if (current_page_url() != $CONFIG->url
			&& !defined('externalpage')
			&& !isloggedin()) {
				forward();
				exit;
			}
		
	}
	
	 function walledgarden_index() {
			
			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;
	}
	
	register_elgg_event_handler('init','system','walledgarden_init');
	register_elgg_event_handler('pagesetup','system','walledgarden_pagesetup');
?>