Joomla!
http://forum.joomla.org/

Error with com_search ???
http://forum.joomla.org/viewtopic.php?f=267&t=227388
Page 1 of 1

Author:  thegioiphatminh [ Sat Oct 27, 2007 7:14 am ]
Post subject:  Error with com_search ???

Error with com_search when you search string

"string++string" or "string+++string" (replace + by blank character). Example:

Code:
"a  a"


http://www.joomla.org/index.php?option= ... rd=a++a....

Image

[RussW] Removed hidden link to site....  Please do not hide promotional links to your own website in post/images.....

Flood ???

Joomla 1.5 RC3 or Joomla 1.0.13

Firefox 2.0.0.8 (addon: NoScript) or IE 7.0 (No Javascript)

Author:  thegioiphatminh [ Sun Oct 28, 2007 5:37 am ]
Post subject:  Re: Error with com_search ???

SOLUTION:

http://physicist.phpnet.us/2007/05/28/j ... ch-glitch/

et’s come on a site joomla.org and click on the Search menu item. Now we enter text “test  test” for search (with three spaces between words!). As a result of the search the huge document with a lot of “” is received.

To get rid of this glitch, it is necessary in a file /components/com_search/search.php after a line

$searchword = strval( mosGetParam( $_REQUEST, 'searchword', '' ) );

(or, in older versions

$searchword = $database->getEscaped( trim( $searchword ) );

) add

$searchword = preg_replace( '/\s{2,}/s', ' ', $searchword );

It will allow to remove a series of spaces from the search query.

Author:  thegioiphatminh [ Tue Oct 30, 2007 6:45 am ]
Post subject:  FLOOD any Joomla sitte!

Search Website Joomla! (1.0.x and 1.5) by "a a" or "a a a" or "a a a a" ...

Because this code (about line 177 in com_search/search.php)

Code:
<?php
foreach ($searchwords as $hlword) {
   $text = preg_replace( '/' . preg_quote( $hlword, '/' ) . '/i',
       '<span class="highlight">\0</span>', $text );
}

Author:  jcisio [ Tue Oct 30, 2007 3:54 pm ]
Post subject:  Re: Error with com_search ???

Firstly, this problem has no way degrading the performance of Joomla! as PHP/MySQL doesn't work harder.

Second, I think I have a short solution. Modification of components/com_search/search.php:

At about line 74, after
Code:
$searchword = strval( mosGetParam( $_REQUEST, 'searchword', '' ) );

add
Code:
$searchword = preg_replace('/[\s\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|]+/', ' ', $searchword);


At about line 185, replace
Code:
foreach ($searchwords as $hlword) {
      $text = preg_replace( '/' . preg_quote( $hlword, '/' ) . '/i', '<span class="highlight">\0</span>', $text );
}

with
Code:
$text = preg_replace('!(' . implode($searchwords, '|') . ')!i', '<span class="highlight">\1</span>', $text);


The first one remove dirty space (which returns indesirable results), the second avoid looped "
It works for me (http://thongtincongnghe.com).

The com_search of Joomla is far from perfection.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/