Просмотр файла yahoo/index.php

Размер файла: 8.21Kb
<?

  /*

  Разработчик ПО:

   osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

*  Copyright (c) 2005 osCommerce

*  Released under the GNU General Public License

* Animated Collapsible DIV- © Dynamic Drive DHTML code library (www.pokazuha.tv)

* Additinal MODs and by www.pokazuha.tv (2006)

* Last Update	: Tuesday, November 13 2005

 RUS: Все бесплатные копии не подлежат обновлениям и тех. поддержке!
 Контакты: [email protected]
 Last Update info: 20.06.2008

 Продажа данного ПО запрещена!

*/

  include("includes/main_inc.php");
  include("includes/classes/settings_class.php");
  include("includes/classes/pager_class.php");
  include("includes/ads.php");

  db_connect();
  $_settings = new Settings();
  $search_cats = array('web'=>'Веб','news'=>'Новости','images'=>'Картинки','video'=>'Видео','audio'=>'Аудио','shopping'=>'Товары');

//array('web'=>'Web','news'=>'News','images'=>'Pictures','video'=>'Video','audio'=>'Audio','shopping'=>'Shopping');

  $type = isset($_GET['type']) ? $_GET['type'] : 'web';
  $keywords = isset($_GET['search']) ? $_GET['search'] : '';
  $parsed_keywords = htmlspecialchars(chop($keywords));
  $prepared_keywords = str_replace(" ","+",chop($keywords));

  $tabs = "";
  if ($type == 'compare')
  {
    $old_type = $type;
    $type = 'shopping';
  }
  else
    $old_type = $type;

  foreach($search_cats as $search_type=>$display_name)
  {
    if ($search_type == $type)
    {
       $tabs .= '<B><A class=tabOn href="?type='.$search_type.'&search='.$parsed_keywords.'">'.$display_name.'</A></B><SPAN class=tabSpace></SPAN>';
    }
    else
    {
      $tabs .= '<A class=tabOff href="?type='.$search_type.'&search='.$parsed_keywords.'">'.$display_name.'</A><SPAN class=tabSpace></SPAN>';
    }
  }

  if ((strlen(chop($keywords)) == 0))
  {
    $content = '
    <form method="get">
    <table width="100%" cellSpacing=0 cellPadding=0>
    <tr><td align="center">
    '.$tabs.'
    </td></tr></table>
    <DIV class="searchBar2">
<TABLE cellSpacing=0 cellPadding=0 border=0 width="100%" height="70">
  <TR>
    <TD align=center>
     <SPAN class=query>
     <INPUT maxLength=200 size=40 name=search>
     <INPUT type=submit value=" Найти ">
     <INPUT type=hidden value="'.$type.'" name="type">
      </SPAN>
    </TD>
  </TR>
</TABLE>
   </DIV>
   </form>
 ';
  }
  else
  {
    $from_cache = FALSE;
    add_stat_to_db($prepared_keywords,$type);
    if ($_settings->is_cache_used())
    {
       $result = check_chache($_SERVER['QUERY_STRING'],$_settings->get_cache_time());
    }
    else
       $result = TRUE;

    $type = $old_type;
    if (($_settings->is_cache_used() && ($result === FALSE)) || ($result === TRUE))
    {
          switch ($type)
          {
            case 'web':
            {
              include("includes/classes/web_search_class.php");
              $results = new WebSearch($_settings,$prepared_keywords);
              $results_html = $results->get_results();
              $total_found_string = $results->m_total_found_string;
            }break;
            case 'news':
            {
              include("includes/classes/news_search_class.php");
              $results = new NewsSearch($_settings,$prepared_keywords);
              $results_html = $results->get_results();
              $total_found_string = $results->m_total_found_string;
            }break;
            case 'images':
            {
              include("includes/classes/images_search_class.php");
              $results = new ImagesSearch($_settings,$prepared_keywords);
              $results_html = $results->get_results();
              $total_found_string = $results->m_total_found_string;
            }break;
            case 'video':
            {
              include("includes/classes/video_search_class.php");
              $results = new VideoSearch($_settings,$prepared_keywords);
              $results_html = $results->get_results();
              $total_found_string = $results->m_total_found_string;
            }break;
            case 'audio':
            {
              include("includes/classes/audio_search_class.php");
              $results = new AudioSearch($_settings,$prepared_keywords);
              $results_html = $results->get_results();
              $total_found_string = $results->m_total_found_string;
            }break;
            case 'shopping':
            {
              include("includes/classes/shopping_search_class.php");
              $results = new ShoppingSearch($_settings,$prepared_keywords);
              $results_html = $results->get_results();
              $total_found_string = $results->m_total_found_string;
            }break;
            case 'compare':
            {
              include("includes/classes/compare_shopping_search_class.php");
              $results = new CompareShoppingSearch($_settings,$prepared_keywords);
              $results_html = $results->get_results();
              $total_found_string = $results->m_total_found_string;
            }break;
          }
          $adsp = isset($_GET['pos']) ? $_GET['pos'] : 1;
          $top_ads = get_ads('top',$prepared_keywords,$adsp);
          $side_ads = get_ads('side',$prepared_keywords,$adsp);
          $bottom_ads = get_ads('bottom',$prepared_keywords,$adsp);
          if ($type == 'compare')
            $type = 'shopping';
          $content = '
          <form method="get">
            <table width="100%" cellSpacing=0 cellPadding=0 border=0>
            <tr><td align="center">
            '.$tabs.'
            </td></tr></table>
            <DIV class="searchBar2">
        <TABLE cellSpacing=0 cellPadding=0 border=0 width="100%" height="40">
          <TR>
            <TD align=center>
             <SPAN class=query>
             <INPUT maxLength=200 size=40 name=search value="'.$parsed_keywords.'">
             <INPUT type=submit value=" Найти ">
             <INPUT type=hidden value="'.$type.'" name="type">
              </SPAN>
            </TD>
          </TR>
        </TABLE>
           </DIV>
           </form>
              <DIV class=resultHeading>
        <TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
          <TR>
            <TD class=inf align="right">
              '.$total_found_string.'
            </TD>
          </TR>
          </TABLE>
          </DIV>
          <table width="100%" border="0">
          <tr>
           <!--top_ads-->
            <td align="left" colspan="2">
            '.$top_ads.'
            </td>
            <!--top_ads_eof-->
          </tr>
          <tr>
            <td valign="top" width="80%">
            <!--Search_results-->
              '.$results_html.'
            <!--Search_results_eof-->
            </td>
            <!--side_ads-->
            <td valign="top">
            '.$side_ads.'
            </td>
            <!--side_ads_eof-->
          </tr>
          <tr>
           <!--bottom_ads-->
            <td align="left" colspan="2">
            '.$bottom_ads.'
            </td>
            <!--bottom_ads_eof-->
          </tr>
          </table>
          <br>
          <form method="get">
          <DIV class="searchBarbottom">
          <TABLE cellSpacing=0 cellPadding=0 border=0 width="100%" height="40">
          <TR>
            <TD align=center>
             <SPAN class=query>
             <INPUT maxLength=200 size=40 name=search value="'.$parsed_keywords.'">
             <INPUT type=submit value=" Найти ">
             <INPUT type=hidden value="'.$type.'" name="type">
              </SPAN>
            </TD>
          </TR>
        </TABLE>
        </div>
        </form>
          ';
          if ($_settings->is_cache_used() && ($result === FALSE))
          {
            add_data_to_cache($_SERVER['QUERY_STRING'],$content,$_settings->get_cache_time(),$_settings->get_cache_size());
          }
        }
        else
        {
          $content = $result;
        }
  }

  echo $_settings->get_header();
  echo $content;
  echo $_settings->get_footer();
?>