[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/ -> advanced_search_result.php (source)

   1  <?php
   2  /*

   3  $Id: advanced_search_result.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    $error = false;
  23  
  24    if ( (isset($HTTP_GET_VARS['keywords']) && empty($HTTP_GET_VARS['keywords'])) &&
  25         (isset($HTTP_GET_VARS['dfrom']) && (empty($HTTP_GET_VARS['dfrom']) || ($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING))) &&
  26         (isset($HTTP_GET_VARS['dto']) && (empty($HTTP_GET_VARS['dto']) || ($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING))) &&
  27         (isset($HTTP_GET_VARS['pfrom']) && !is_numeric($HTTP_GET_VARS['pfrom'])) &&
  28         (isset($HTTP_GET_VARS['pto']) && !is_numeric($HTTP_GET_VARS['pto'])) ) {
  29      $error = true;
  30  
  31      $messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);
  32    } else {
  33      $dfrom = '';
  34      $dto = '';
  35      $pfrom = '';
  36      $pto = '';
  37      $keywords = '';
  38  
  39      if (isset($HTTP_GET_VARS['dfrom'])) {
  40        $dfrom = (($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dfrom']);
  41      }
  42  
  43      if (isset($HTTP_GET_VARS['dto'])) {
  44        $dto = (($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dto']);
  45      }
  46  
  47      if (isset($HTTP_GET_VARS['pfrom'])) {
  48        $pfrom = $HTTP_GET_VARS['pfrom'];
  49      }
  50  
  51      if (isset($HTTP_GET_VARS['pto'])) {
  52        $pto = $HTTP_GET_VARS['pto'];
  53      }
  54  
  55      if (isset($HTTP_GET_VARS['keywords'])) {
  56        $keywords = $HTTP_GET_VARS['keywords'];
  57      }
  58  
  59      $date_check_error = false;
  60      if (tep_not_null($dfrom)) {
  61        if (!tep_checkdate($dfrom, DOB_FORMAT_STRING, $dfrom_array)) {
  62          $error = true;
  63          $date_check_error = true;
  64  
  65          $messageStack->add_session('search', ERROR_INVALID_FROM_DATE);
  66        }
  67      }
  68  
  69      if (tep_not_null($dto)) {
  70        if (!tep_checkdate($dto, DOB_FORMAT_STRING, $dto_array)) {
  71          $error = true;
  72          $date_check_error = true;
  73  
  74          $messageStack->add_session('search', ERROR_INVALID_TO_DATE);
  75        }
  76      }
  77  
  78      if (($date_check_error == false) && tep_not_null($dfrom) && tep_not_null($dto)) {
  79        if (mktime(0, 0, 0, $dfrom_array[1], $dfrom_array[2], $dfrom_array[0]) > mktime(0, 0, 0, $dto_array[1], $dto_array[2], $dto_array[0])) {
  80          $error = true;
  81  
  82          $messageStack->add_session('search', ERROR_TO_DATE_LESS_THAN_FROM_DATE);
  83        }
  84      }
  85  
  86      $price_check_error = false;
  87      if (tep_not_null($pfrom)) {
  88        if (!settype($pfrom, 'double')) {
  89          $error = true;
  90          $price_check_error = true;
  91  
  92          $messageStack->add_session('search', ERROR_PRICE_FROM_MUST_BE_NUM);
  93        }
  94      }
  95  
  96      if (tep_not_null($pto)) {
  97        if (!settype($pto, 'double')) {
  98          $error = true;
  99          $price_check_error = true;
 100  
 101          $messageStack->add_session('search', ERROR_PRICE_TO_MUST_BE_NUM);
 102        }
 103      }
 104  
 105      if (($price_check_error == false) && is_float($pfrom) && is_float($pto)) {
 106        if ($pfrom >= $pto) {
 107          $error = true;
 108  
 109          $messageStack->add_session('search', ERROR_PRICE_TO_LESS_THAN_PRICE_FROM);
 110        }
 111      }
 112  
 113      if (tep_not_null($keywords)) {
 114        if (!tep_parse_search_string(stripslashes($keywords), $search_keywords)) {    
 115          $error = true;
 116  
 117          $messageStack->add_session('search', ERROR_INVALID_KEYWORDS);
 118        }
 119      }
 120    }
 121  
 122    if (empty($dfrom) && empty($dto) && empty($pfrom) && empty($pto) && empty($keywords)) {
 123      $error = true;
 124  
 125      $messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);
 126    }
 127  
 128    if ($error == true) {
 129      tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false));
 130    }
 131  
 132    $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));
 133    $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, tep_get_all_get_params(), 'NONSSL', true, false));
 134  
 135    $content = CONTENT_ADVANCED_SEARCH_RESULT;
 136  
 137    include (bts_select('main', $content_template)); // BTSv1.5

 138  
 139    require (DIR_WS_INCLUDES . 'application_bottom.php');
 140  ?>


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