Support ⇒ Troubleshootings ⇒ BUG (not) - Forum search ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexTroubleshootings

BUG (not) - Forum search Reply to topic


Hi,

A few days ago, I adapted some elements of the latest version of the file search.php (http://dragonflycms.org/cvs/html/modules/Forums/search.php) and found a small problem in the code. Being a adptación did not execute the code as such, but by testing, I think the problem is not with my code but in the original.
The problem is in the code between lines 383 and 513 (The following code fragment contains only the parts involved in the problem):
382. if ( $total_match_count ) { 383. if ( $show_results == 'topics' || $show_results == 'forums') { 384. # This one is a beast, try to seperate it a bit (workaround for connection timeouts) 385. $search_id_chunks = array(); ... 463. $total_match_count = sizeof($search_ids); 464. } else if ( $search_author != '' || $search_time || $auth_sql != '' ) { 465. $search_id_chunks = array(); ... 512. $total_match_count = count($search_ids); 513. } 514. } else if ( $search_id == 'unanswered' ) { ...

In the case of an user who has full access to all forums, if you try to display a search result like a messages filter, will not enter into the first if (line 383) because $show_results is equal to 'posts' and neither enter the second condition (line 464) because he's not looking for author or by time and most importantly, the variable $auth_sql is an empty string.

The solution we found for this case is to eliminate this second conditional (line 464), and replaced by a simple else, as in the following example:
382. if ( $total_match_count ) { 383. if ( $show_results == 'topics' || $show_results == 'forums') { 384. # This one is a beast, try to seperate it a bit (workaround for connection timeouts) 385. $search_id_chunks = array(); ... 463. $total_match_count = sizeof($search_ids); 464. } else { 465. $search_id_chunks = array(); ... 512. $total_match_count = count($search_ids); 513. } 514. } else if ( $search_id == 'unanswered' ) { ...

I think with this code solves the problem and have found no case in which it is believed a conflict.

Hope this helps to keep improving.

until the next (Bye),

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Dragonfly 9.2 (PHP5.2)


I couldn't find issues on this website using dragonflycms.org/Forums/search.html
Do you have a good example which fails?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


As a side note, the last v9 is hosted at googlecode, code.google.com/p/drag.../?name=v9, CVS is outdated and should only be used for historical purposes.

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


DJ Maze wrote
I couldn't find issues on this website using dragonflycms.org/Forums/search.html
Do you have a good example which fails?


In the test case I made the problem appeared when the user performing the search has no security restriction, so $auth_sql variable is an empty string and the search is performed with default search condition and indicating results as messages.

until the next (Bye),

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Dragonfly 9.2 (PHP5.2)


I've checked the code through and i can't find a problem in that part of the code as it works as it should.

} else if ($search_author || $search_time || $auth_sql) {
This part is used to filter out $search_ids that should not be in the result.
When removing, it just executes another X queries to find the same $search_ids

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial


Are you purely analyzing the code or there is an issue when you search?

If there is an issue:
2. Does it happen with the original files set?
1. What is the issue?

.:: I met php the 03 December 2003 :: Unforgettable day! ::.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
CloudLinux / Apache 2.4 LSAPI / MySQLi 5.6 / PHP 5.6 / DCVS


I apologize for not responding sooner. I have not had time to analyze the code correctly. The problem is the adaptation that I made improvements to my code. Sorry for the inconvenience.

until the next (Bye),

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Dragonfly 9.2 (PHP5.2)


No problem, if it was in the code you at least reported it.
That's better then doing nothing Wink

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

All times are UTC


Jump to: