diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-28 15:23:58 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-05-28 15:23:58 +0000 |
commit | b7ae2062b48055b23176000691fe454f6f67f5e9 (patch) | |
tree | 4b56a55030c141b883b021f5df21c0625f0f662c | |
parent | 39dfeae3037782f8bd3dc2b5aa6e2da8ff65c63b (diff) | |
download | elgg-b7ae2062b48055b23176000691fe454f6f67f5e9.tar.gz elgg-b7ae2062b48055b23176000691fe454f6f67f5e9.tar.bz2 |
Refs #965: Search now correctly using page handler to make it easier to replace.
git-svn-id: https://code.elgg.org/elgg/trunk@3308 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | engine/lib/entities.php | 17 | ||||
-rw-r--r-- | engine/lib/search.php | 48 | ||||
-rw-r--r-- | search/index.php | 4 | ||||
-rw-r--r-- | version.php | 2 |
4 files changed, 53 insertions, 18 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index d0935adf2..c8457ca39 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -2352,19 +2352,6 @@ }
}
-/**
- * Page handler for search
- *
- * @param array $page Page elements from pain page handler
- */
- function search_page_handler($page) {
- if (isset($page[0])) {
- global $CONFIG;
- set_input('tag',$page[0]);
- include_once($CONFIG->path . "search/index.php");
- }
- }
-
/**
* Returns a viewable list of entities based on the registered types
*
@@ -2771,9 +2758,9 @@ * Entities init function; establishes the page handler
*
*/
- function entities_init() {
+ function entities_init() + {
register_page_handler('view','entities_page_handler');
- register_page_handler('search','search_page_handler');
// Allow a permission override for recursive entity deletion
// TODO: Can this be done better?
diff --git a/engine/lib/search.php b/engine/lib/search.php new file mode 100644 index 000000000..01ba7b907 --- /dev/null +++ b/engine/lib/search.php @@ -0,0 +1,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'); +?>
\ No newline at end of file diff --git a/search/index.php b/search/index.php index a0deac413..768224c2a 100644 --- a/search/index.php +++ b/search/index.php @@ -54,10 +54,10 @@ $label = 'item:' . $object_type;
if (!empty($object_subtype)) $label .= ':' . $object_subtype;
global $CONFIG;
- add_submenu_item(elgg_echo($label), $CONFIG->wwwroot . "search/?tag=". urlencode($tag) ."&subtype=" . $object_subtype . "&object=". urlencode($object_type) ."&tagtype=" . urlencode($md_type) . "&owner_guid=" . urlencode($owner_guid));
+ add_submenu_item(elgg_echo($label), $CONFIG->wwwroot . "pg/search/?tag=". urlencode($tag) ."&subtype=" . $object_subtype . "&object=". urlencode($object_type) ."&tagtype=" . urlencode($md_type) . "&owner_guid=" . urlencode($owner_guid));
}
}
- add_submenu_item(elgg_echo('all'), $CONFIG->wwwroot . "search/?tag=". urlencode($tag) ."&owner_guid=" . urlencode($owner_guid));
+ add_submenu_item(elgg_echo('all'), $CONFIG->wwwroot . "pg/search/?tag=". urlencode($tag) ."&owner_guid=" . urlencode($owner_guid));
}
diff --git a/version.php b/version.php index e78d618fa..c9466556b 100644 --- a/version.php +++ b/version.php @@ -13,7 +13,7 @@ * @link http://elgg.org/
*/
- $version = 2009052701; // YYYYMMDD = Elgg Date + $version = 2009052801; // YYYYMMDD = Elgg Date // XX = Interim incrementer
$release = '1.5'; // Human-friendly version name
|