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