Version 2.2.0 RC-1
This commit is contained in:
1 parent
f73f8bff6d
commit
22f1b963ee
1034 files changed
+178610
-70897
No files matched your search
@@ -2,28 +2,18 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-01-05 11:02:13 +0000 (Thu, 05 Jan 2006) $
|
||||
| > $Revision: 114 $
|
||||
| > $Author: matt $
|
||||
| > $Date: 2006-09-26 23:00:20 +0100 (Tue, 26 Sep 2006) $
|
||||
| > $Revision: 576 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
| > Searching procedures
|
||||
@@ -38,40 +28,43 @@
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
class search {
|
||||
|
||||
var $output = "";
|
||||
var $page_title = "";
|
||||
var $nav = array();
|
||||
var $html = "";
|
||||
var $output = "";
|
||||
var $page_title = "";
|
||||
var $nav = array();
|
||||
var $html = "";
|
||||
|
||||
var $first = 0;
|
||||
var $first = 0;
|
||||
var $row_count = 0;
|
||||
|
||||
var $search_type = 'posts';
|
||||
var $sort_order = 'desc';
|
||||
var $sort_key = 'last_post';
|
||||
var $search_in = 'posts';
|
||||
var $prune = '0';
|
||||
var $st_time = array();
|
||||
var $end_time = array();
|
||||
var $st_stamp = "";
|
||||
var $end_stamp = "";
|
||||
var $result_type = "topics";
|
||||
var $parser = "";
|
||||
var $load_lib = 'search_mysql_man';
|
||||
var $lib = "";
|
||||
var $search_type = 'posts';
|
||||
var $sort_order = 'desc';
|
||||
var $sort_key = 'last_post';
|
||||
var $search_in = 'posts';
|
||||
var $topic_search_only = "";
|
||||
var $prune = '0';
|
||||
var $st_time = array();
|
||||
var $end_time = array();
|
||||
var $st_stamp = "";
|
||||
var $end_stamp = "";
|
||||
var $result_type = "topics";
|
||||
var $parser = "";
|
||||
var $load_lib = 'search_mysql_man';
|
||||
var $lib = "";
|
||||
var $read_array = array();
|
||||
|
||||
var $mysql_version = "";
|
||||
var $true_version = "";
|
||||
var $mysql_version = "";
|
||||
var $true_version = "";
|
||||
|
||||
// max number of results
|
||||
|
||||
var $resultlimit = 1000;
|
||||
var $xml_out = 0;
|
||||
var $resultlimit = 1000;
|
||||
var $xml_out = 0;
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Auto run
|
||||
@@ -79,30 +72,56 @@ class search {
|
||||
|
||||
function auto_run()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Using XML?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->xml_out = isset($_REQUEST['xml']) ? intval( $_REQUEST['xml'] ) : 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Require the HTML and language modules
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->load_language('lang_search');
|
||||
$this->ipsclass->load_language('lang_forum' );
|
||||
$this->ipsclass->load_template('skin_search');
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if (! $this->ipsclass->vars['allow_search'])
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'search_off') );
|
||||
if ( $this->xml_out )
|
||||
{
|
||||
@header( "Content-type: text/html;charset={$this->ipsclass->vars['gb_char_set']}" );
|
||||
print $this->ipsclass->lang['search_off'];
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_off') );
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->ipsclass->member['g_use_search'] != 1)
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission' ) );
|
||||
}
|
||||
if (! isset($this->ipsclass->member['g_use_search']) OR !$this->ipsclass->member['g_use_search'] )
|
||||
{
|
||||
if ( $this->xml_out )
|
||||
{
|
||||
@header( "Content-type: text/html;charset={$this->ipsclass->vars['gb_char_set']}" );
|
||||
print $this->ipsclass->lang['no_xml_permission'];
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_permission') );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $read = $this->ipsclass->my_getcookie('topicsread') )
|
||||
{
|
||||
$this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Using XML?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->xml_out = intval( $_REQUEST['xml'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Forum jump
|
||||
@@ -130,14 +149,6 @@ class search {
|
||||
|
||||
require ( ROOT_PATH."sources/lib/".$this->load_lib );
|
||||
|
||||
//-----------------------------------------
|
||||
// Require the HTML and language modules
|
||||
//-----------------------------------------
|
||||
|
||||
$this->ipsclass->load_language('lang_search');
|
||||
$this->ipsclass->load_language('lang_forum' );
|
||||
$this->ipsclass->load_template('skin_search');
|
||||
|
||||
$this->base_url = $this->ipsclass->base_url;
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -147,17 +158,12 @@ class search {
|
||||
$this->lib = new search_lib($this);
|
||||
$this->lib->ipsclass =& $this->ipsclass;
|
||||
|
||||
$this->first = intval($this->ipsclass->input['st']);
|
||||
$this->first = intval($this->ipsclass->input['st']) >=0 ? intval($this->ipsclass->input['st']) : 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// What to do?
|
||||
//-----------------------------------------
|
||||
|
||||
if (! isset($this->ipsclass->member['g_use_search']) )
|
||||
{
|
||||
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'cant_use_feature') );
|
||||
}
|
||||
|
||||
switch($this->ipsclass->input['CODE']) {
|
||||
case '01':
|
||||
$this->do_search();
|
||||
@@ -201,7 +207,7 @@ class search {
|
||||
// If we have any HTML to print, do so...
|
||||
|
||||
$this->ipsclass->print->add_output("$this->output");
|
||||
$this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, NAV => $this->nav ) );
|
||||
$this->ipsclass->print->do_output( array( 'TITLE' => $this->page_title, 'JS' => 0, 'NAV' => $this->nav ) );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -467,24 +473,29 @@ class search {
|
||||
$last_time = $this->ipsclass->member['members_markers']['board'];
|
||||
}
|
||||
|
||||
$this->ipsclass->input['nav'] = 'lv';
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we getting 'active topics'?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['active'] )
|
||||
$this->ipsclass->input['lastdate'] = isset($this->ipsclass->input['lastdate']) ? intval($this->ipsclass->input['lastdate']) : 0;
|
||||
|
||||
if ( isset($this->ipsclass->input['active']) AND $this->ipsclass->input['active'] )
|
||||
{
|
||||
if ( $this->ipsclass->input['lastdate'] )
|
||||
{
|
||||
$last_time = time() - intval($this->ipsclass->input['lastdate']);
|
||||
$last_time = time() - $this->ipsclass->input['lastdate'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$last_time = time() - 86400;
|
||||
}
|
||||
|
||||
$this->ipsclass->input['nav'] = 'at';
|
||||
}
|
||||
|
||||
$this->ipsclass->input['forums'] = 'all';
|
||||
$this->ipsclass->input['nav'] = 'lv';
|
||||
|
||||
$forums = $this->get_searchable_forums();
|
||||
|
||||
@@ -548,7 +559,7 @@ class search {
|
||||
'query_cache' => $query_to_cache
|
||||
) );
|
||||
|
||||
$this->ipsclass->boink_it( $this->ipsclass->base_url."act=Search&nav=lv&CODE=show&searchid=$unique_id&search_in=topics&result_type=topics&lastdate={$this->ipsclass->input['lastdate']}" );
|
||||
$this->ipsclass->boink_it( $this->ipsclass->base_url."act=Search&nav={$this->ipsclass->input['nav']}&CODE=show&searchid=$unique_id&search_in=topics&result_type=topics&lastdate={$this->ipsclass->input['lastdate']}" );
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -717,7 +728,7 @@ class search {
|
||||
'ip_address' => $this->ipsclass->input['IP_ADDRESS'],
|
||||
) );
|
||||
|
||||
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['search_redirect'] , "act=Search&nav=gr&CODE=show&searchid=$unique_id&search_in=posts&result_type=topics" );
|
||||
$this->ipsclass->print->redirect_screen( $this->ipsclass->lang['search_redirect'] , "act=Search&nav=gr&CODE=show&searchid=$unique_id&search_in=posts&result_type=topics" );
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -737,11 +748,8 @@ class search {
|
||||
function show_form()
|
||||
{
|
||||
$the_html = $this->ipsclass->forums->forums_forum_jump(1, 1);
|
||||
|
||||
if ( ! $this->ipsclass->input['f'] )
|
||||
{
|
||||
$init_sel = ' selected="selected"';
|
||||
}
|
||||
|
||||
$init_sel = !$this->ipsclass->input['f'] ? ' selected="selected"' : '';
|
||||
|
||||
$forums = "<select name='forums[]' class='forminput' size='10' multiple='multiple'>\n"
|
||||
."<option value='all'".$init_sel.">".$this->ipsclass->lang['all_forums']."</option>"
|
||||
@@ -814,13 +822,13 @@ class search {
|
||||
//-----------------------------------------
|
||||
// Un-urlencode first
|
||||
//-----------------------------------------
|
||||
if( $this->ipsclass->input['xml'] )
|
||||
if( isset($this->ipsclass->input['xml']) AND $this->ipsclass->input['xml'] )
|
||||
{
|
||||
require_once (ROOT_PATH."sources/action_public/xmlout.php");
|
||||
$xml_convert = new xmlout();
|
||||
require (ROOT_PATH."sources/classes/class_ajax.php");
|
||||
$xml_convert = new class_ajax();
|
||||
$xml_convert->ipsclass =& $this->ipsclass;
|
||||
|
||||
$this->ipsclass->input['keywords'] = $xml_convert->convert_unicode($this->ipsclass->input['keywords']);
|
||||
$this->ipsclass->input['keywords'] = $xml_convert->convert_html_entities( $xml_convert->convert_unicode($this->ipsclass->input['keywords']) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -842,6 +850,7 @@ class search {
|
||||
{
|
||||
if ( $this->xml_out )
|
||||
{
|
||||
@header( "Content-type: text/html;charset={$this->ipsclass->vars['gb_char_set']}" );
|
||||
print sprintf( $this->ipsclass->lang['xml_flood'], $this->ipsclass->member['g_search_flood'] );
|
||||
exit();
|
||||
}
|
||||
@@ -866,6 +875,7 @@ class search {
|
||||
{
|
||||
if ( $this->xml_out )
|
||||
{
|
||||
@header( "Content-type: text/html;charset={$this->ipsclass->vars['gb_char_set']}" );
|
||||
print sprintf( $this->ipsclass->lang['xml_nomatches'], $result['keywords'] );
|
||||
exit();
|
||||
}
|
||||
@@ -880,7 +890,7 @@ class search {
|
||||
//-----------------------------------------
|
||||
|
||||
$unique_id = md5(uniqid(microtime(),1));
|
||||
$url = "act=Search&CODE=show&searchid=$unique_id&search_in=".$this->search_in."&result_type=".$this->result_type."&highlite=".urlencode(trim($result['keywords']));
|
||||
$url = "act=Search&CODE=show&searchid=".$unique_id."&search_in=".$this->search_in."&result_type=".$this->result_type."&highlite=".urlencode(trim($result['keywords']));
|
||||
|
||||
$this->ipsclass->DB->do_insert( 'search_results', array (
|
||||
'id' => $unique_id,
|
||||
@@ -900,6 +910,7 @@ class search {
|
||||
{
|
||||
$result['post_max'] = $result['post_max'] < 1 ? 1 : $result['post_max'];
|
||||
|
||||
@header( "Content-type: text/html;charset={$this->ipsclass->vars['gb_char_set']}" );
|
||||
print sprintf( $this->ipsclass->lang['xml_matches'], preg_replace( "#^[\+\-]#", "", $result['keywords'] ), $result['post_max'], $this->ipsclass->base_url.$url );
|
||||
exit();
|
||||
}
|
||||
@@ -966,11 +977,6 @@ class search {
|
||||
{
|
||||
$this->cached_query = $sr['query_cache'];
|
||||
$this->cached_matches = $sr['post_max'];
|
||||
|
||||
$this->ipsclass->DB->cur_query = $this->cached_query;
|
||||
$this->ipsclass->DB->simple_limit_with_check($this->first, "25");
|
||||
$this->cached_query = $this->ipsclass->DB->cur_query;
|
||||
$this->ipsclass->DB->flush_query();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1001,7 +1007,7 @@ class search {
|
||||
$post_array[ $t ] = $t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Anything left to show?
|
||||
//-----------------------------------------
|
||||
@@ -1012,10 +1018,10 @@ class search {
|
||||
}
|
||||
}
|
||||
|
||||
$url_words = $this->convert_highlite_words($this->ipsclass->input['highlite']);
|
||||
$url_words = $this->convert_highlite_words( (isset($this->ipsclass->input['highlite']) AND $this->ipsclass->input['highlite']) ? $this->ipsclass->input['highlite'] : '' );
|
||||
|
||||
if ($this->result_type == 'topics')
|
||||
{
|
||||
if ( $this->result_type == 'topics' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// CACHED QUERY?
|
||||
//-----------------------------------------
|
||||
@@ -1024,8 +1030,13 @@ class search {
|
||||
{
|
||||
$this->output .= $this->start_page($this->cached_matches);
|
||||
|
||||
$this->ipsclass->DB->cur_query = $this->cached_query;
|
||||
$this->ipsclass->DB->simple_limit_with_check($this->first, "25");
|
||||
$this->cached_query = $this->ipsclass->DB->cur_query;
|
||||
$this->ipsclass->DB->flush_query();
|
||||
|
||||
$this->ipsclass->DB->prefix_changed = 1;
|
||||
$this->ipsclass->DB->query( $this->cached_query );
|
||||
$outer = $this->ipsclass->DB->query( $this->cached_query );
|
||||
$this->ipsclass->DB->prefix_changed = 0;
|
||||
}
|
||||
//-----------------------------------------
|
||||
@@ -1034,6 +1045,20 @@ class search {
|
||||
|
||||
else if ($this->search_in == 'titles')
|
||||
{
|
||||
if ($posts AND !$topics)
|
||||
{
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'topic_id', 'from' => 'posts', 'where' => "pid IN({$posts})" ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $pr = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$topic_array[ $pr['topic_id'] ] = $pr['topic_id'];
|
||||
}
|
||||
|
||||
$topics = implode( ",", $topic_array );
|
||||
$topic_max_hits = count( $topic_array );
|
||||
}
|
||||
|
||||
if ( ! $topics )
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
|
||||
@@ -1047,7 +1072,7 @@ class search {
|
||||
'order' => "t.pinned DESC, t.".$this->sort_key." ".$this->sort_order,
|
||||
'limit' => array( $this->first, 25 )
|
||||
) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
$outer = $this->ipsclass->DB->simple_exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1077,20 +1102,47 @@ class search {
|
||||
'order' => "t.pinned DESC, t.".$this->sort_key." ".$this->sort_order,
|
||||
'limit' => array( $this->first, 25 )
|
||||
) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
$outer = $this->ipsclass->DB->simple_exec();
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// PRINT: Any returned rows?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->DB->get_num_rows() )
|
||||
if ( $this->ipsclass->DB->get_num_rows($outer) )
|
||||
{
|
||||
while ( $row = $this->ipsclass->DB->fetch_row() )
|
||||
$topic_ids = array();
|
||||
$the_topics = array();
|
||||
|
||||
while ( $row = $this->ipsclass->DB->fetch_row($outer) )
|
||||
{
|
||||
$row['keywords'] = $url_words;
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_search']->RenderRow( $this->parse_entry($row) );
|
||||
|
||||
$the_topics[$row['tid']] = $row;
|
||||
$topic_ids[] = $row['tid'];
|
||||
}
|
||||
|
||||
if ( ($this->ipsclass->vars['show_user_posted'] == 1) and ($this->ipsclass->member['id']) and ( count($topic_ids) ) )
|
||||
{
|
||||
$this->ipsclass->DB->build_query( array( 'select' => 'author_id, topic_id',
|
||||
'from' => 'posts',
|
||||
'where' => "author_id=".$this->ipsclass->member['id']." AND topic_id IN(".implode( ",", $topic_ids ).")",
|
||||
) );
|
||||
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while( $p = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
if ( is_array( $the_topics[ $p['topic_id'] ] ) )
|
||||
{
|
||||
$the_topics[ $p['topic_id'] ]['author_id'] = $p['author_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $the_topics as $row )
|
||||
{
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_search']->RenderRow( $this->parse_entry($row) );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1125,8 +1177,10 @@ class search {
|
||||
require_once( ROOT_PATH.'sources/action_public/topics.php' );
|
||||
$this->topics = new topics();
|
||||
$this->topics->ipsclass =& $this->ipsclass;
|
||||
$this->topics->topic['tid'] = 0;
|
||||
$this->topics->topic['forum_id'] = 0;
|
||||
$this->topics->topic_init();
|
||||
|
||||
|
||||
$attach_pids = array();
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -1137,6 +1191,11 @@ class search {
|
||||
{
|
||||
$this->output .= $this->start_page($this->cached_matches, 1);
|
||||
|
||||
$this->ipsclass->DB->cur_query = $this->cached_query;
|
||||
$this->ipsclass->DB->simple_limit_with_check($this->first, "25");
|
||||
$this->cached_query = $this->ipsclass->DB->cur_query;
|
||||
$this->ipsclass->DB->flush_query();
|
||||
|
||||
$this->ipsclass->DB->query( $this->cached_query );
|
||||
}
|
||||
//-----------------------------------------
|
||||
@@ -1151,6 +1210,20 @@ class search {
|
||||
|
||||
if ($this->search_in == 'titles')
|
||||
{
|
||||
if ($posts AND !$topics)
|
||||
{
|
||||
$this->ipsclass->DB->simple_construct( array( 'select' => 'topic_id', 'from' => 'posts', 'where' => "pid IN({$posts})" ) );
|
||||
$this->ipsclass->DB->simple_exec();
|
||||
|
||||
while ( $pr = $this->ipsclass->DB->fetch_row() )
|
||||
{
|
||||
$topic_array[ $pr['topic_id'] ] = $pr['topic_id'];
|
||||
}
|
||||
|
||||
$topics = implode( ",", $topic_array );
|
||||
$topic_max_hits = count( $topic_array );
|
||||
}
|
||||
|
||||
if ( ! $topics )
|
||||
{
|
||||
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
|
||||
@@ -1193,10 +1266,20 @@ class search {
|
||||
$row['keywords'] = $url_words;
|
||||
$row['post_date'] = $this->ipsclass->get_date( $row['post_date'],'LONG' );
|
||||
|
||||
if ( $row['queued'] or ($row['topic_firstpost'] == $row['pid'] and $row['approved'] != 1) )
|
||||
{
|
||||
$row['post_css'] = $this->row_count % 2 ? 'post1shaded' : 'post2shaded';
|
||||
}
|
||||
else
|
||||
{
|
||||
$row['post_css'] = $this->row_count % 2 ? 'post1' : 'post2';
|
||||
}
|
||||
//-----------------------------------------
|
||||
// Parse HTML tag on the fly
|
||||
//-----------------------------------------
|
||||
|
||||
$row['post_htmlstate'] = isset($row['post_htmlstate']) ? $row['post_htmlstate'] : 0;
|
||||
|
||||
$this->topics->parser->parse_html = ( $this->ipsclass->forums->forum_by_id[$row['forum_id']]['use_html'] and $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
|
||||
$this->topics->parser->parse_wordwrap = $this->ipsclass->vars['post_wordwrap'];
|
||||
$this->topics->parser->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
|
||||
@@ -1207,7 +1290,7 @@ class search {
|
||||
// Attachments?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( strstr( $row['post'], '[attachmentid=' ) )
|
||||
if ( strstr( $row['post'], '[attachment=' ) )
|
||||
{
|
||||
$attach_pids[] = $row['pid'];
|
||||
}
|
||||
@@ -1217,13 +1300,29 @@ class search {
|
||||
//-----------------------------------------
|
||||
|
||||
$member = $this->topics->parse_member( $row );
|
||||
$post = $this->parse_entry($row, 1);
|
||||
|
||||
//-----------------------------------------
|
||||
// Do word wrap?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_search']->RenderPostRow( $this->parse_entry($row, 1), $member );
|
||||
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_search']->RenderPostRow( $post, $member );
|
||||
|
||||
//-----------------------------------------
|
||||
// Ignoring member?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->member['ignored_users'] )
|
||||
{
|
||||
if ( strstr( $this->ipsclass->member['ignored_users'], ','.$member['id'].',' ) and $this->ipsclass->input['p'] != $row['pid'] )
|
||||
{
|
||||
if ( ! strstr( $this->ipsclass->vars['cannot_ignore_groups'], ','.$member['mgroup'].',' ) )
|
||||
{
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_search']->render_row_hidden( $post, $member );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -1232,7 +1331,21 @@ class search {
|
||||
|
||||
if ( count( $attach_pids ) )
|
||||
{
|
||||
$this->output = $this->topics->parse_attachments( $this->output, $attach_pids );
|
||||
if ( ! is_object( $this->class_attach ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Grab render attach class
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH . 'sources/classes/attach/class_attach.php' );
|
||||
$this->class_attach = new class_attach();
|
||||
$this->class_attach->ipsclass =& $this->ipsclass;
|
||||
|
||||
$this->class_attach->type = 'post';
|
||||
$this->class_attach->init();
|
||||
}
|
||||
|
||||
$this->output = $this->class_attach->render_attachments( $this->output, $attach_pids );
|
||||
}
|
||||
|
||||
$this->output .= $this->ipsclass->compiled_templates['skin_search']->end_results_table(array( 'SHOW_PAGES' => $this->links ), 1 );
|
||||
@@ -1255,16 +1368,31 @@ class search {
|
||||
{
|
||||
$this->nav = array( $this->ipsclass->lang['nav_lt'] );
|
||||
}
|
||||
else if ( $this->ipsclass->input['nav'] == 'at' )
|
||||
{
|
||||
$this->nav = array( $this->ipsclass->lang['nav_at'] );
|
||||
}
|
||||
else if ( $this->ipsclass->input['nav'] == 'au' )
|
||||
{
|
||||
if( $this->ipsclass->input['result_type'] == 'topics' )
|
||||
{
|
||||
$this->nav = array( $this->ipsclass->lang['nav_aut'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->nav = array( $this->ipsclass->lang['nav_au'] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->nav = array( "<a href='{$this->base_url}&act=Search'>{$this->ipsclass->lang['search_form']}</a>", $this->ipsclass->lang['search_title'] );
|
||||
$this->nav = array( "<a href='{$this->base_url}act=Search'>{$this->ipsclass->lang['search_form']}</a>", $this->ipsclass->lang['search_title'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Active topics fing?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->input['lastdate'] )
|
||||
if ( isset($this->ipsclass->input['lastdate']) )
|
||||
{
|
||||
$this->output = preg_replace( "#(value=[\"']".intval($this->ipsclass->input['lastdate'])."[\"'])#i", "\\1 selected='selected'", $this->output );
|
||||
}
|
||||
@@ -1276,7 +1404,7 @@ class search {
|
||||
|
||||
function start_page($amount, $is_post = 0)
|
||||
{
|
||||
$url_words = $this->convert_highlite_words($this->ipsclass->input['highlite']);
|
||||
$url_words = $this->convert_highlite_words( (isset($this->ipsclass->input['highlite']) AND $this->ipsclass->input['highlite']) ? $this->ipsclass->input['highlite'] : '' );
|
||||
$extra = $this->more_results ? str_replace( '%num', $this->resultlimit, $this->ipsclass->lang['too_many_children_for_santa'] ) : "";
|
||||
|
||||
$this->links = $this->ipsclass->build_pagelinks( array( 'TOTAL_POSS' => $amount,
|
||||
@@ -1284,7 +1412,7 @@ class search {
|
||||
'CUR_ST_VAL' => $this->first,
|
||||
'L_SINGLE' => "",
|
||||
'L_MULTI' => $this->ipsclass->lang['search_pages'],
|
||||
'BASE_URL' => $this->base_url."act=Search&nav=".$this->ipsclass->input['nav']."&CODE=show&searchid=".$this->unique_id."&search_in=".$this->search_in."&result_type=".$this->result_type."&hl=".$url_words,
|
||||
'BASE_URL' => $this->base_url."act=Search&nav=".$this->ipsclass->input['nav']."&CODE=show&searchid=".$this->unique_id."&search_in=".$this->search_in."&result_type=".$this->result_type."&hl=".$url_words,
|
||||
) );
|
||||
|
||||
if ($is_post == 0)
|
||||
@@ -1303,21 +1431,24 @@ class search {
|
||||
|
||||
function parse_entry($topic, $view_as_post=0)
|
||||
{
|
||||
$this->ipsclass->input['last_visit'] = $this->ipsclass->forum_read[ $topic['forum_id'] ] > $this->ipsclass->input['last_visit']
|
||||
? $this->ipsclass->forum_read[ $topic['forum_id'] ] : $this->ipsclass->input['last_visit'];
|
||||
$this->ipsclass->forum_read[ $topic['forum_id'] ] = isset( $this->ipsclass->forum_read[ $topic['forum_id'] ] ) ? $this->ipsclass->forum_read[ $topic['forum_id'] ] : 0;
|
||||
$this->ipsclass->forum_read[0] = isset( $this->ipsclass->forum_read[0] ) ? $this->ipsclass->forum_read[0] : 0;
|
||||
|
||||
$this->ipsclass->input['last_visit'] = ( $this->ipsclass->forum_read[ $topic['forum_id'] ] > $this->ipsclass->input['last_visit'] )
|
||||
? $this->ipsclass->forum_read[ $topic['forum_id'] ] : $this->ipsclass->input['last_visit'];
|
||||
|
||||
if ( $this->ipsclass->member['members_markers']['board'] > $this->ipsclass->input['last_visit'] )
|
||||
|
||||
|
||||
if ( isset($this->ipsclass->member['members_markers']['board']) AND $this->ipsclass->member['members_markers']['board'] > $this->ipsclass->input['last_visit'] )
|
||||
{
|
||||
$this->ipsclass->input['last_visit'] = $this->ipsclass->member['members_markers']['board'];
|
||||
}
|
||||
|
||||
//echo "<pre>";print $this->ipsclass->input['last_visit']; print_r($topic);echo "</pre>";exit;
|
||||
|
||||
//-----------------------------------------
|
||||
// Over ride with 'master' cookie?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->ipsclass->forum_read[0] > $this->ipsclass->forum_read[ $topic['forum_id'] ] )
|
||||
if ( $this->ipsclass->forum_read[ $topic['forum_id'] ] AND $this->ipsclass->forum_read[0] > $this->ipsclass->forum_read[ $topic['forum_id'] ] )
|
||||
{
|
||||
$this->ipsclass->forum_read[ $topic['forum_id'] ] = $this->ipsclass->forum_read[0];
|
||||
}
|
||||
@@ -1335,11 +1466,13 @@ class search {
|
||||
// Stop search from marking forum as read
|
||||
//-----------------------------------------
|
||||
|
||||
$topic['db_read'] = isset($topic['db_read']) ? $topic['db_read'] : 0;
|
||||
|
||||
if ( is_array( $this->read_array ) )
|
||||
{
|
||||
if ( array_key_exists( $topic['tid'], $this->read_array ) )
|
||||
{
|
||||
if( !$topic['db_read'] OR $this->read_array[$topic['tid']] > $topic['db_read'] )
|
||||
if ( ! $topic['db_read'] OR $this->read_array[$topic['tid']] > $topic['db_read'] )
|
||||
{
|
||||
$topic['db_read'] = $this->read_array[$topic['tid']];
|
||||
}
|
||||
@@ -1348,9 +1481,7 @@ class search {
|
||||
|
||||
$this->forums->new_posts = 1;
|
||||
|
||||
$topic = $this->forums->parse_data( $topic );
|
||||
|
||||
$this->ipsclass->vars['db_topic_read_cutoff'] = $tmp;
|
||||
$topic = $this->forums->parse_data( $topic, 0 );
|
||||
|
||||
if ($topic['pinned'] == 1)
|
||||
{
|
||||
@@ -1358,11 +1489,29 @@ class search {
|
||||
$topic['topic_icon'] = "<{B_PIN}>";
|
||||
}
|
||||
|
||||
$topic['class1'] = "row2";
|
||||
$topic['class2'] = "row1";
|
||||
$topic['classposts'] = "row2";
|
||||
|
||||
if ( isset($this->ipsclass->member['is_mod']) AND $this->ipsclass->member['is_mod'] )
|
||||
{
|
||||
if ( ! $topic['approved'] )
|
||||
{
|
||||
$topic['class1'] = 'row4shaded';
|
||||
$topic['class2'] = 'row2shaded';
|
||||
$topic['classposts'] = 'row4shaded';
|
||||
}
|
||||
else if ( isset($topic['_hasqueued']) AND $topic['_hasqueued'] )
|
||||
{
|
||||
$topic['classposts'] = 'row4shaded';
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Remove potential [attachmentid= tag in title
|
||||
//-----------------------------------------
|
||||
|
||||
$topic['topic_title'] = str_replace( '[attachmentid=', '[attachmentid=', $topic['topic_title'] );
|
||||
$topic['title'] = str_replace( '[attachmentid=', '[attachmentid=', $topic['title'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Extra processing for posts..
|
||||
@@ -1372,7 +1521,8 @@ class search {
|
||||
{
|
||||
if ( $this->ipsclass->vars['search_post_cut'] )
|
||||
{
|
||||
$topic['post'] = substr( $topic['post'], 0, $this->ipsclass->vars['search_post_cut']) . '...';
|
||||
//$topic['post'] = substr( strip_tags($topic['post']), 0, $this->ipsclass->vars['search_post_cut']) . '...';
|
||||
$topic['post'] = $this->ipsclass->txt_mbsubstr( strip_tags($topic['post']), 0, $this->ipsclass->vars['search_post_cut'] ).'...';
|
||||
$topic['post'] = str_replace( "\n", "<br />", $topic['post'] );
|
||||
}
|
||||
|
||||
@@ -1453,11 +1603,22 @@ class search {
|
||||
$topic['forum_name'] = $topic['forum_full_name'];
|
||||
}
|
||||
|
||||
//$this->parser->parse_html = ( $this->ipsclass->forums->forum_by_id[ $topic['forum_id'] ]['use_html'] and $this->ipsclass->cache['group_cache'][ $this->ipsclass->member['mgroup'] ]['g_dohtml'] and $topic['post_htmlstate'] ) ? 1 : 0;
|
||||
//$this->parser->parse_wordwrap = $this->ipsclass->vars['post_wordwrap'];
|
||||
//$this->parser->parse_nl2br = $topic['post_htmlstate'] == 2 ? 1 : 0;
|
||||
|
||||
//$topic['post'] = $this->parser->pre_display_parse( $topic['post'] );
|
||||
if( $this->ipsclass->forums->forum_by_id[ $topic['forum_id'] ]['forum_allow_rating'] )
|
||||
{
|
||||
if ( $topic['topic_rating_total'] )
|
||||
{
|
||||
$topic['_rate_int'] = round( $topic['topic_rating_total'] / $topic['topic_rating_hits'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Show image?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( $topic['topic_rating_hits'] >= $this->ipsclass->vars['topic_rating_needed'] ) AND ( $topic['_rate_int'] ) )
|
||||
{
|
||||
$topic['_rate_img'] = $this->ipsclass->compiled_templates['skin_search']->topic_rating_image( $topic['_rate_int'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $topic;
|
||||
}
|
||||
@@ -1469,7 +1630,7 @@ class search {
|
||||
function filter_keywords($words="", $name=0)
|
||||
{
|
||||
// force to lowercase and swop % into a safer version
|
||||
$words = trim( str_replace( "%", "\\%", $words) );
|
||||
$words = trim( str_replace( "%", "", $words) );
|
||||
|
||||
// Remove trailing boolean operators
|
||||
|
||||
@@ -1480,7 +1641,10 @@ class search {
|
||||
|
||||
// Make safe underscores
|
||||
|
||||
$words = str_replace( "_", "\\_", $words );
|
||||
if( $name == 0 )
|
||||
{
|
||||
$words = str_replace( "_", "\\_", $words );
|
||||
}
|
||||
|
||||
$words = str_replace( '|', "|", $words );
|
||||
|
||||
@@ -1554,7 +1718,7 @@ class search {
|
||||
|
||||
// this ~that +this -me
|
||||
|
||||
$words = preg_replace( "/~/", "", $words );
|
||||
$words = str_replace( "~", "", $words );
|
||||
|
||||
// this that +this -me
|
||||
|
||||
@@ -1592,7 +1756,7 @@ class search {
|
||||
// Check for an array
|
||||
//-----------------------------------------
|
||||
|
||||
if ( is_array( $_POST['forums'] ) )
|
||||
if ( isset($_POST['forums']) AND is_array( $_POST['forums'] ) )
|
||||
{
|
||||
|
||||
if ( in_array( 'all', $_POST['forums'] ) )
|
||||
@@ -1601,7 +1765,7 @@ class search {
|
||||
// Searching all forums..
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( $this->ipsclass->forums->forum_by_id as $id => $data )
|
||||
foreach( $this->ipsclass->forums->forum_by_id as $data )
|
||||
{
|
||||
$forumids[] = $data['id'];
|
||||
}
|
||||
@@ -1626,13 +1790,16 @@ class search {
|
||||
|
||||
if ( count( $forumids ) )
|
||||
{
|
||||
foreach( $forumids as $f )
|
||||
{
|
||||
$children = $this->ipsclass->forums->forums_get_children( $f );
|
||||
|
||||
if ( is_array($children) and count($children) )
|
||||
if ( $this->ipsclass->input['searchsubs'] == 1 )
|
||||
{
|
||||
foreach( $forumids as $f )
|
||||
{
|
||||
$forumids = array_merge( $forumids , $children );
|
||||
$children = $this->ipsclass->forums->forums_get_children( $f );
|
||||
|
||||
if ( is_array($children) and count($children) )
|
||||
{
|
||||
$forumids = array_merge( $forumids , $children );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1654,7 +1821,7 @@ class search {
|
||||
|
||||
if ( $this->ipsclass->input['forums'] == 'all' )
|
||||
{
|
||||
foreach( $this->ipsclass->forums->forum_by_id as $id => $data )
|
||||
foreach( $this->ipsclass->forums->forum_by_id as $data )
|
||||
{
|
||||
$forumids[] = $data['id'];
|
||||
}
|
||||
@@ -1691,6 +1858,8 @@ class search {
|
||||
|
||||
foreach( $forumids as $f )
|
||||
{
|
||||
$f = intval($f);
|
||||
|
||||
if ( $this->check_access($this->ipsclass->forums->forum_by_id[ $f ] ) == TRUE )
|
||||
{
|
||||
$final[] = $f;
|
||||
@@ -1712,7 +1881,7 @@ class search {
|
||||
$tmp = $final;
|
||||
$final = array();
|
||||
|
||||
foreach( $tmp as $internal => $id )
|
||||
foreach( $tmp as $id )
|
||||
{
|
||||
if ( in_array( $id, $block_forums ) )
|
||||
{
|
||||
@@ -1742,6 +1911,8 @@ class search {
|
||||
{
|
||||
$can_read = FALSE;
|
||||
|
||||
$i['read_perms'] = isset($i['read_perms']) ? $i['read_perms'] : NULL;
|
||||
|
||||
if ( $this->ipsclass->check_perms( $i['read_perms'] ) == TRUE )
|
||||
{
|
||||
$can_read = TRUE;
|
||||
@@ -1751,6 +1922,8 @@ class search {
|
||||
$can_read = FALSE;
|
||||
}
|
||||
|
||||
$i['password'] = isset($i['password']) ? $i['password'] : NULL;
|
||||
|
||||
if ( $i['password'] != "" and $can_read == TRUE )
|
||||
{
|
||||
if ( $this->ipsclass->forums->forums_compare_password( $i['id'] ) == TRUE )
|
||||
|
||||
Reference in new issue
Block a user