]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Removed unneeded url_encode()s for links.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 10 Nov 2009 04:03:11 +0000 (04:03 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Tue, 10 Nov 2009 04:03:11 +0000 (04:03 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3655 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/search/index.php
mod/search/start.php

index 2927e66166eb13db9d62f95713a5c88a0fa84676..d62e3be72c4fbcc847b25a27dfd42c5423e6b0e6 100644 (file)
@@ -37,14 +37,14 @@ $custom_types = trigger_plugin_hook('search_types', 'get_types', $params, array(
 
 // add submenu items for all and native types
 // @todo should these maintain any existing type / subtype filters or reset?
-$data = http_build_query(array(
-       'q' => urlencode($query),
-       'entity_subtype' => urlencode($subtype),
-       'entity_type' => urlencode($type),
-       'owner_guid' => urlencode($owner_guid),
+$data = htmlspecialchars(http_build_query(array(
+       'q' => $query,
+       'entity_subtype' => $subtype,
+       'entity_type' => $type,
+       'owner_guid' => $owner_guid,
        'search_type' => 'all',
        'friends' => $friends
-));
+)));
 $url = "{$CONFIG->wwwroot}pg/search/?$data";
 add_submenu_item(elgg_echo('all'), $url);
 
@@ -54,14 +54,14 @@ foreach ($types as $type => $subtypes) {
                foreach ($subtypes as $subtype) {
                        $label = "item:$type:$subtype";
 
-                       $data = http_build_query(array(
-                               'q' => urlencode($query),
-                               'entity_subtype' => urlencode($subtype),
-                               'entity_type' => urlencode($type),
-                               'owner_guid' => urlencode($owner_guid),
+                       $data = htmlspecialchars(http_build_query(array(
+                               'q' => $query,
+                               'entity_subtype' => $subtype,
+                               'entity_type' => $type,
+                               'owner_guid' => $owner_guid,
                                'search_type' => 'entities',
                                'friends' => $friends
-                       ));
+                       )));
 
                        $url = "{$CONFIG->wwwroot}pg/search/?$data";
 
@@ -70,13 +70,13 @@ foreach ($types as $type => $subtypes) {
        } else {
                $label = "item:$type";
 
-               $data = http_build_query(array(
-                       'q' => urlencode($query),
-                       'entity_type' => urlencode($type),
-                       'owner_guid' => urlencode($owner_guid),
+               $data = htmlspecialchars(http_build_query(array(
+                       'q' => $query,
+                       'entity_type' => $type,
+                       'owner_guid' => $owner_guid,
                        'search_type' => 'entities',
                        'friends' => $friends
-               ));
+               )));
 
                $url = "{$CONFIG->wwwroot}pg/search/?$data";
 
index 14299b7c6c6ce9290cb762f5271dacee14dc7c62..314aa4710fe7fe34e0f73010297a781e4cb70e14 100644 (file)
@@ -88,7 +88,7 @@ function search_page_handler($page) {
  */
 function search_get_highlighted_relevant_substrings($haystack, $needle, $min_match_context = 15, $max_length = 500) {
        global $CONFIG;
-       $haystack = urldecode(strip_tags($haystack));
+       $haystack = strip_tags($haystack);
        $haystack_lc = strtolower($haystack);
 //
 //     $haystack = "Like merge sort, quicksort can also be easily parallelized due to its "
@@ -100,7 +100,6 @@ function search_get_highlighted_relevant_substrings($haystack, $needle, $min_mat
 
        // for now don't worry about "s or boolean operators
        $needle = str_replace(array('"', '-', '+', '~'), '', stripslashes(strip_tags($needle)));
-       $needle = urldecode($needle);
        $words = explode(' ', $needle);
 
        $min_chars = $CONFIG->search_info['min_chars'];