[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_plugins/content/search/ -> search_parser.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_plugins/content/search/search_parser.php,v $
  14  |     $Revision: 1.4 $
  15  |     $Date: 2007/01/17 14:05:41 $
  16  |     $Author: lisa_ $
  17  +----------------------------------------------------------------------------+
  18  */
  19  
  20  if (!defined('e107_INIT')) { exit; }
  21  
  22  // advanced 
  23  $advanced_where = "";
  24  if (isset($_GET['cat']) && is_numeric($_GET['cat'])) {
  25      $advanced_where .= " content_parent='".$_GET['cat']."' AND";
  26  }
  27  
  28  if (isset($_GET['time']) && is_numeric($_GET['time'])) {
  29      $advanced_where .= " content_datestamp ".($_GET['on'] == 'new' ? '>=' : '<=')." '".(time() - $_GET['time'])."' AND";
  30  }
  31  
  32  if (isset($_GET['match']) && $_GET['match']) {
  33      $search_fields = array('content_heading');
  34  } else {
  35      $search_fields = array('content_heading', 'content_subheading', 'content_summary', 'content_text');
  36  }
  37  
  38  // basic
  39  $return_fields = 'content_id, content_heading, content_subheading, content_summary, content_text, content_datestamp, content_parent, content_author';
  40  $weights = array('1.2', '0.9', '0.6', '0.6');
  41  $no_results = LAN_198;
  42  $where = "content_class IN (".USERCLASS_LIST.") AND".$advanced_where;
  43  $order = array('content_datestamp' => DESC);
  44  
  45  $ps = $sch -> parsesearch('pcontent', $return_fields, $search_fields, $weights, 'search_content', $no_results, $where, $order);
  46  $text .= $ps['text'];
  47  $results = $ps['results'];
  48  
  49  
  50  function search_content($row) {
  51      global $con, $sql;
  52      $res['link'] = e_PLUGIN."content/content.php?content.".$row['content_id'];
  53      $res['pre_title'] = "";
  54      $res['title'] = $row['content_heading'];
  55      $res['summary'] = $row['content_summary'].' '.$row['content_text'];
  56      
  57      //get category heading
  58      if($row['content_parent'] == '0'){
  59          $qry = "
  60          SELECT c.content_heading
  61          FROM #pcontent as c
  62          WHERE c.content_id = '".$row['content_id']."' ";
  63      }elseif(strpos($row['content_parent'], "0.") !== FALSE){
  64          $tmp = explode(".", $row['content_parent']);
  65          $qry = "
  66          SELECT c.content_heading
  67          FROM #pcontent as c
  68          WHERE c.content_id = '".intval($tmp[1])."' ";
  69      }else{
  70          $qry = "
  71          SELECT c.*, p.*
  72          FROM #pcontent as c
  73          LEFT JOIN #pcontent as p ON p.content_id = c.content_parent
  74          WHERE c.content_id = '".$row['content_id']."' ";
  75      }
  76      
  77      $sql -> db_Select_gen($qry);
  78      $cat = $sql -> db_Fetch();
  79  
  80      $res['detail'] = LAN_SEARCH_3.$con -> convert_date($row['content_datestamp'], "long")." ".CONT_SCH_LAN_4." ".$cat['content_heading'];
  81      return $res;
  82  }
  83  
  84  ?>


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