[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> advanced_search.php (source)

   1  <?php
   2  /*

   3  $Id: advanced_search.php 3 2006-05-27 04:59:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13  // Most of this file is changed or moved to BTS - Basic Template System - format.

  14  // For adding in contribution or modification - parts of this file has been moved to: catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  15  //       catalog\templates\fallback\contents\<filename>.tpl.php as a default (sub 'fallback' with your current template to see if there is a template specife change).

  16  // (Sub 'fallback' with your current template to see if there is a template specific file.)

  17  
  18    require ('includes/application_top.php');
  19  
  20    require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ADVANCED_SEARCH);
  21  
  22  // Search enhancement mod start

  23  
  24  if(isset($_GET['keywords']) && $_GET['keywords'] != ''){
  25      if(!isset($_GET['s'])){
  26            $pwstr_check = strtolower(substr($_GET['keywords'], strlen($_GET['keywords'])-1, strlen($_GET['keywords'])));
  27            if($pwstr_check == 's'){
  28                    $pwstr_replace = substr($_GET['keywords'], 0, strlen($_GET['keywords'])-1);
  29                    header('location: ' . tep_href_link( FILENAME_ADVANCED_SEARCH_RESULT , 'search_in_description=1&s=1&keywords=' . urlencode($pwstr_replace) . '' ));
  30                    exit;
  31            }
  32          } 
  33  
  34         $pw_keywords = explode(' ',stripslashes(strtolower($_GET['keywords'])));
  35         $pw_boldwords = $pw_keywords;
  36         $sql_words = tep_db_query("SELECT * FROM searchword_swap");
  37         $pw_replacement = '';
  38         while ($sql_words_result = tep_db_fetch_array($sql_words)) {
  39                if(stripslashes(strtolower($_GET['keywords'])) == stripslashes(strtolower($sql_words_result['sws_word']))){
  40                    $pw_replacement = stripslashes($sql_words_result['sws_replacement']);
  41                    $pw_link_text = '<b><i>' . stripslashes($sql_words_result['sws_replacement']) . '</i></b>';
  42                    $pw_phrase = 1;
  43                    $pw_mispell = 1;
  44                    break;
  45                }
  46             for($i=0; $i<sizeof($pw_keywords); $i++){
  47                 if($pw_keywords[$i]  == stripslashes(strtolower($sql_words_result['sws_word']))){
  48                     $pw_keywords[$i]  = stripslashes($sql_words_result['sws_replacement']);
  49                     $pw_boldwords[$i] = '<b><i>' . stripslashes($sql_words_result['sws_replacement']) . '</i></b>';
  50                     $pw_mispell = 1;
  51                     break;
  52                 }
  53             }    
  54         }
  55         if(!isset($pw_phrase)){
  56             for($i=0; $i<sizeof($pw_keywords); $i++){
  57                 $pw_replacement .= $pw_keywords[$i]. ' ';
  58                    $pw_link_text   .= $pw_boldwords[$i]. ' ';    
  59             }
  60         }
  61         
  62         $pw_replacement = trim($pw_replacement);
  63         $pw_link_text   = trim($pw_link_text);
  64         $pw_string      = '<br><span class="main"><font color="red">' . TEXT_REPLACEMENT_SUGGESTION . '</font><a href="' . tep_href_link( FILENAME_ADVANCED_SEARCH_RESULT , 'keywords=' . urlencode($pw_replacement) . '&search_in_description=1' ) . '">' . $pw_link_text . '</a></span><br><br>';
  65  }
  66  // Search enhancement mod end

  67  
  68  // Search enhancement mod start

  69                  $search_enhancements_keywords = $_GET['keywords'];
  70                  $search_enhancements_keywords = strip_tags($search_enhancements_keywords);
  71                  $search_enhancements_keywords = addslashes($search_enhancements_keywords);                
  72            
  73                  if ($search_enhancements_keywords != $last_search_insert) {
  74                          tep_db_query("insert into search_queries (search_text)  values ('" .  $search_enhancements_keywords . "')");
  75                          tep_session_register('last_search_insert');
  76                          $last_search_insert = $search_enhancements_keywords;
  77                  }
  78  // Search enhancement mod end

  79    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));
  80  
  81    $content = CONTENT_ADVANCED_SEARCH;
  82    $javascript = $content . '.js.php';
  83  
  84    include (bts_select('main', $content_template)); // BTSv1.5

  85  
  86    require (DIR_WS_INCLUDES . 'application_bottom.php');
  87  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7