]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Merged previous to trunk.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 19 Apr 2010 18:26:38 +0000 (18:26 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 19 Apr 2010 18:26:38 +0000 (18:26 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@5803 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/search/index.php
mod/search/search_hooks.php

index 8ee44d9e7547a14d4ee22a6dbd0fee4ef0708c11..2a6b2ce62f9ead99239dfd02436cf553a48349f4 100644 (file)
@@ -8,7 +8,7 @@
  * @link http://elgg.org/
  */
 
-// Search supports RSS 
+// Search supports RSS
 global $autofeed;
 $autofeed = true;
 
@@ -27,6 +27,7 @@ $offset = ($search_type == 'all') ? 0 : get_input('offset', 0);
 $entity_type = get_input('entity_type', ELGG_ENTITIES_ANY_VALUE);
 $entity_subtype = get_input('entity_subtype', ELGG_ENTITIES_ANY_VALUE);
 $owner_guid = get_input('owner_guid', ELGG_ENTITIES_ANY_VALUE);
+$container_guid = get_input('container_guid', ELGG_ENTITIES_ANY_VALUE);
 $friends = get_input('friends', ELGG_ENTITIES_ANY_VALUE);
 $sort = get_input('sort');
 switch ($sort) {
@@ -59,6 +60,7 @@ $params = array(
        'subtype' => $entity_subtype,
 //     'tag_type' => $tag_type,
        'owner_guid' => $owner_guid,
+       'container_guid' => $container_guid,
 //     'friends' => $friends
        'pagination' => ($search_type == 'all') ? FALSE : TRUE
 );
index a2063dbc1e9f4d127fd799a3f9db978a69647405..86a6b452f5d356de2d2fde2ef8bdbeaa5e66fe12 100644 (file)
@@ -324,6 +324,11 @@ function search_comments_hook($hook, $type, $value, $params) {
        // available on metastrings (and boolean mode doesn't need it)
        $search_where = search_get_where_sql('msv', $fields, $params, FALSE);
 
+       $container_and = '';
+       if ($params['container_guid'] && $params['container_guid'] !== ELGG_ENTITIES_ANY_VALUE) {
+               $container_and = 'AND e.container_guid = ' . sanitise_string($params['container_guid']);
+       }
+
        $e_access = get_access_sql_suffix('e');
        $a_access = get_access_sql_suffix('a');
        // @todo this can probably be done through the api..
@@ -335,6 +340,7 @@ function search_comments_hook($hook, $type, $value, $params) {
                        AND ($search_where)
                        AND $e_access
                        AND $a_access
+                       $container_and
 
                LIMIT {$params['offset']}, {$params['limit']}
                ";
@@ -349,6 +355,7 @@ function search_comments_hook($hook, $type, $value, $params) {
                        AND ($search_where)
                        AND $e_access
                        AND $a_access
+                       $container_and
                ";
 
        $result = get_data($q);