aboutsummaryrefslogtreecommitdiff
path: root/mod/walledgarden/start.php
blob: 9d28a14189bbf43b39612093a1998668f801e7ea (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
56
57
58
<?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');
		
		// Replace the default index page if the custom index plugin does not exist
		if(!is_plugin_enabled("custom_index"))
			register_plugin_hook('index','system','walledgarden_index');
		// um...what is this doing here?
		// Turn off simple cache if enabled
		//if (function_exists('elgg_view_disable_simplecache')) {
		//	elgg_view_disable_simplecache();
		//}

	}
	
	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;
			
		}
	
	register_elgg_event_handler('init','system','walledgarden_init');
	register_elgg_event_handler('pagesetup','system','walledgarden_pagesetup');
?>