aboutsummaryrefslogtreecommitdiff
path: root/mod/externalpages/start.php
blob: 33bd7e189b6d84dfb1a988a1391717ffaf53b1cc (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
	/**
	 * Elgg Simple editing of external pages frontpage/about/term/contact and privacy
	 * 
	 * @package ElggExPages
	 */

	function expages_init() {
		
		global $CONFIG;
		
		// Register a page handler, so we can have nice URLs
		register_page_handler('expages','expages_page_handler');
		
		// Register a URL handler for external pages
		register_entity_url_handler('expages_url','object','expages');
		
		// extend views
		elgg_extend_view('footer/links', 'expages/footer_menu');
		elgg_extend_view('index/righthandside', 'expages/front_right');
		elgg_extend_view('index/lefthandside', 'expages/front_left');
		
	}
	
	/**
	 * Page setup. Adds admin controls to the admin panel.
	 *
	 */
	function expages_pagesetup()
	{
		if (get_context() == 'admin' && isadminloggedin()) {
			global $CONFIG;
			add_submenu_item(elgg_echo('expages'), $CONFIG->wwwroot . 'pg/expages/');
		}
	}
	
	function expages_url($expage) {
			
			global $CONFIG;
			return $CONFIG->url . "pg/expages/";
			
	}
	
	
	function expages_page_handler($page) 
	{
		global $CONFIG;
		
		if ($page[0])
		{
			switch ($page[0])
			{
				case "read":		set_input('expages',$page[1]);
										include(dirname(__FILE__) . "/read.php");
										break;
				default : include($CONFIG->pluginspath . "externalpages/index.php"); 
			}
		}
		else
			include($CONFIG->pluginspath . "externalpages/index.php"); 
	}
	
	// Initialise log browser
	register_elgg_event_handler('init','system','expages_init');
	register_elgg_event_handler('pagesetup','system','expages_pagesetup');
	
	// Register actions
		global $CONFIG;
		register_action("expages/add",false,$CONFIG->pluginspath . "externalpages/actions/add.php");
		register_action("expages/addfront",false,$CONFIG->pluginspath . "externalpages/actions/addfront.php");
		register_action("expages/edit",false,$CONFIG->pluginspath . "externalpages/actions/edit.php");
		register_action("expages/delete",false,$CONFIG->pluginspath . "externalpages/actions/delete.php");
			
?>