aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/search.php
blob: 01ba7b907d1987cfed5dbadebf26beafbf82c185 (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
<?php
	/**
	 * Elgg search helper functions.
	 * 
	 * @package Elgg
	 * @subpackage Core
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Curverider Ltd <info@elgg.com>
	 * @copyright Curverider Ltd 2008-2009
	 * @link http://elgg.org/
	 */

	/**
	 * Initialise search helper functions.
	 *
	 */
	function search_init()
	{
		register_page_handler('search','search_page_handler');
	}
	
	/**
	 * Page handler for search
	 *
	 * @param array $page Page elements from pain page handler
	 */
	function search_page_handler($page) 
	{
		global $CONFIG;
		
		if (isset($page[0])) {
			switch ($page[0]) {
				case 'user' :
				case 'users' : include_once($CONFIG->path . "search/users.php"); break;
				
				case 'group' :
				case 'groups' : include_once($CONFIG->path . "search/groups.php"); break;
				
				default: include_once($CONFIG->path . "search/index.php");
			}
		}
		else
			include_once($CONFIG->path . "search/index.php");
	}

	/** Register init system event **/
	register_elgg_event_handler('init','system','search_init');
?>