Firefox PHP

Module: Search Spelling

Posted by Maurice Makaay 
All files from this thread

File Name File Size   Posted by Date  
search_spelling-1.0.2.tar.gz 6.4 KB open | download Maurice Makaay 01/09/2011 Read message 12.1 KB open | download Maurice Makaay 01/09/2011 Read message
Module: Search Spelling
October 22, 2007 02:05PM
This module queries Google's search engine for each search request to implement a "Did you mean ...?" function for the Phorum search pages. This will suggest alternative spellings for words that are possibly misspelled in the search query.

To be able to query the Google web site, PHP must be configured to allow opening of URLs for file reading commands. This means that the php.ini option "allow_url_fopen" must be set to 1. If this option is disabled, then this module will not work.


2011-01-09 v1.0.2

    - Fixed the module to work with the latest Google pages.

    - Switched to using the HTTP GET Phorum API code for better compatibility.

    - Added new German language files. Thanks to Oliver Riesen!

2007-10-22 v1.0.1

    - Fixed a small bug which sneaked into the v1.0.0 code right before
      releasing it. This bug killed the search arguments in the
      search_action hook, causing the regular search to fail.

2007-10-17 v1.0.0

    - Initial release

Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce

Edited 2 time(s). Last edit at 01/09/2011 09:02PM by Maurice Makaay.
open | download - search_spelling-1.0.2.tar.gz (6.4 KB)
open | download - (12.1 KB)
Re: Module: Search Spelling
May 31, 2010 03:09PM
Hi Maurice,

current version 1.0.1 doesn't work any longer. Goggle changed his markup and delivers now in utf-8.

I did the following changes to get it work:

settings.php (just an additional space in search pattern):

Language: PHP
19c19 < if (preg_match_all('/<option value=\"lang_(\w+)\">([^<>]+)/', $page, $m)) { --- > if (preg_match_all('/<option value=\"lang_(\w+)\" >([^<>]+)/', $page, $m)) {

<     $page = file_get_contents($url);
>     $page = utf8_encode(file_get_contents($url));
<     if (preg_match('/: *<\/font><a href=[^>]+&spell=1[^>]*>(.+?)<\/a>/i', $page, $m)) {
>     if (preg_match('/: *<\/span><a href=[^>]+&amp;spell=1[^>]*>(.+?)<\/a>/i', $page, $m)) {


Using Phorum since 7/2000: (actual version 5.2.20)
Modules "Made in Germany" for version 5.2: Author_as_Sender, CarCost, Close_Topic, Conceal_Message_Timestamp,
Format_Email, Index_Structure, Mailing_List, Pervasive_Forum, Spritmonitor, Terms_of_Service and German_Language_Files_Package.
Sorry, only registered users may post in this forum.

Click here to login