[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_handlers/search/ -> search_news.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_handlers/search/search_news.php,v $
  14  |     $Revision: 1.14 $
  15  |     $Date: 2005/12/28 14:50:24 $
  16  |     $Author: sweetas $
  17  +----------------------------------------------------------------------------+
  18  */
  19  
  20  if (!defined('e107_INIT')) { exit; }
  21  
  22  // advanced 
  23  $advanced_where = "";
  24  if (isset($_GET['cat']) && $_GET['cat'] != 'all') {
  25      $advanced_where .= " c.category_id='".intval($_GET['cat'])."' AND";
  26  }
  27  
  28  if (isset($_GET['time']) && is_numeric($_GET['time'])) {
  29      $advanced_where .= " n.news_datestamp ".($_GET['on'] == 'new' ? '>=' : '<=')." '".(time() - $_GET['time'])."' AND";
  30  }
  31  
  32  if (isset($_GET['match']) && $_GET['match']) {
  33      $search_fields = array('news_title');
  34  } else {
  35      $search_fields = array('news_title', 'news_body', 'news_extended');
  36  }
  37  
  38  // basic
  39  $return_fields = 'n.news_id, n.news_title, n.news_body, n.news_extended, n.news_allow_comments, n.news_datestamp, n.news_category, c.category_name';
  40  $weights = array('1.2', '0.6', '0.6');
  41  $no_results = LAN_198;
  42  $time = time();
  43  
  44  $where = "(news_start < ".$time.") AND (news_end=0 OR news_end > ".$time.") AND news_class IN (".USERCLASS_LIST.") AND".$advanced_where;
  45  $order = array('news_datestamp' => DESC);
  46  $table = "news AS n LEFT JOIN #news_category AS c ON n.news_category = c.category_id";
  47  
  48  $ps = $sch -> parsesearch($table, $return_fields, $search_fields, $weights, 'search_news', $no_results, $where, $order);
  49  $text .= $ps['text'];
  50  $results = $ps['results'];
  51  
  52  function search_news($row) {
  53      global $con;
  54      $res['link'] = $row['news_allow_comments'] ? "news.php?item.".$row['news_id'] : "comment.php?comment.news.".$row['news_id'];
  55      $res['pre_title'] = $row['category_name']." | ";
  56      $res['title'] = $row['news_title'];
  57      $res['summary'] = $row['news_body'].' '.$row['news_extended'];
  58      $res['detail'] = LAN_SEARCH_3.$con -> convert_date($row['news_datestamp'], "long");
  59      return $res;
  60  }
  61  
  62  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7