/[drupal]/contributions/modules/serapi/serapi.module
ViewVC logotype

Diff of /contributions/modules/serapi/serapi.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1, Wed Nov 5 00:03:40 2008 UTC revision 1.2, Wed Nov 5 09:00:03 2008 UTC
# Line 1  Line 1 
1  <?php  <?php
2  // $Id$  // $Id: serapi.module,v 1.1 2008/11/05 00:03:40 yaph Exp $
3  error_reporting(E_ALL);  error_reporting(E_ALL);
4  serapi_test();  serapi_test();
5    
# Line 11  function serapi_get_search($referer = '' Line 11  function serapi_get_search($referer = ''
11    if (!$referer) {    if (!$referer) {
12      $referer = $_SERVER['HTTP_REFERER'];      $referer = $_SERVER['HTTP_REFERER'];
13    }    }
14    
15      if (!valid_url($referer)) {
16        return false;
17      }
18    
19    $engines = array(    $engines = array(
20      'google' => array(      'google' => array(
21        'host_pattern' => 'www.google',        'host_pattern' => 'www.google.',
22        'query_param' => 'q'        'query_param' => 'q'
23      ),      ),
24      'yahoo' => array(      'yahoo' => array(
# Line 41  function serapi_get_search($referer = '' Line 45  function serapi_get_search($referer = ''
45          $param = $prop['query_param'];          $param = $prop['query_param'];
46          // check that the query contains the search parameter          // check that the query contains the search parameter
47          if (false !== strpos($query, $param)) {          if (false !== strpos($query, $param)) {
48              #@todo use http://php.net/parse_str
49            if (preg_match("%" . $param . "=([^&]+)%", $query, $match)) {            if (preg_match("%" . $param . "=([^&]+)%", $query, $match)) {
50              $search = array();              $search = array();
51              $search_string = $match[1];              $search_string = $match[1];

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.2