mirror of
https://github.com/e107inc/e107.git
synced 2025-01-18 05:09:05 +01:00
Bugtracker #4489 - exclude unapproved content from search
This commit is contained in:
parent
fd1244a31b
commit
7955ae64bd
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/search/search_parser.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2007-01-17 14:05:19 $
|
||||
| $Author: lisa_ $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2008-09-28 19:02:52 $
|
||||
| $Author: e107steved $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -21,17 +21,22 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
// advanced
|
||||
$advanced_where = "";
|
||||
if (isset($_GET['cat']) && is_numeric($_GET['cat'])) {
|
||||
if (isset($_GET['cat']) && is_numeric($_GET['cat']))
|
||||
{
|
||||
$advanced_where .= " content_parent='".$_GET['cat']."' AND";
|
||||
}
|
||||
|
||||
if (isset($_GET['time']) && is_numeric($_GET['time'])) {
|
||||
if (isset($_GET['time']) && is_numeric($_GET['time']))
|
||||
{
|
||||
$advanced_where .= " content_datestamp ".($_GET['on'] == 'new' ? '>=' : '<=')." '".(time() - $_GET['time'])."' AND";
|
||||
}
|
||||
|
||||
if (isset($_GET['match']) && $_GET['match']) {
|
||||
if (isset($_GET['match']) && $_GET['match'])
|
||||
{
|
||||
$search_fields = array('content_heading');
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$search_fields = array('content_heading', 'content_subheading', 'content_summary', 'content_text');
|
||||
}
|
||||
|
||||
@ -39,7 +44,7 @@ if (isset($_GET['match']) && $_GET['match']) {
|
||||
$return_fields = 'content_id, content_heading, content_subheading, content_summary, content_text, content_datestamp, content_parent, content_author';
|
||||
$weights = array('1.2', '0.9', '0.6', '0.6');
|
||||
$no_results = LAN_198;
|
||||
$where = "content_class IN (".USERCLASS_LIST.") AND".$advanced_where;
|
||||
$where = "content_class IN (".USERCLASS_LIST.") AND `content_refer`!='sa' AND".$advanced_where;
|
||||
$order = array('content_datestamp' => DESC);
|
||||
|
||||
$ps = $sch -> parsesearch('pcontent', $return_fields, $search_fields, $weights, 'search_content', $no_results, $where, $order);
|
||||
@ -47,7 +52,8 @@ $text .= $ps['text'];
|
||||
$results = $ps['results'];
|
||||
|
||||
|
||||
function search_content($row) {
|
||||
function search_content($row)
|
||||
{
|
||||
global $con, $sql;
|
||||
$res['link'] = e_PLUGIN."content/content.php?content.".$row['content_id'];
|
||||
$res['pre_title'] = "";
|
||||
@ -55,18 +61,23 @@ function search_content($row) {
|
||||
$res['summary'] = $row['content_summary'].' '.$row['content_text'];
|
||||
|
||||
//get category heading
|
||||
if($row['content_parent'] == '0'){
|
||||
if($row['content_parent'] == '0')
|
||||
{
|
||||
$qry = "
|
||||
SELECT c.content_heading
|
||||
FROM #pcontent as c
|
||||
WHERE c.content_id = '".$row['content_id']."' ";
|
||||
}elseif(strpos($row['content_parent'], "0.") !== FALSE){
|
||||
}
|
||||
elseif(strpos($row['content_parent'], "0.") !== FALSE)
|
||||
{
|
||||
$tmp = explode(".", $row['content_parent']);
|
||||
$qry = "
|
||||
SELECT c.content_heading
|
||||
FROM #pcontent as c
|
||||
WHERE c.content_id = '".intval($tmp[1])."' ";
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
$qry = "
|
||||
SELECT c.*, p.*
|
||||
FROM #pcontent as c
|
||||
|
Loading…
x
Reference in New Issue
Block a user