Version 2.2.0 RC-1

This commit is contained in:
Neo committed 2025-12-19 00:22:37 -08:00
1 parent f73f8bff6d
commit 22f1b963ee
1034 files changed
+178610 -70897

No files matched your search

+69 -69
View File
@@ -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-02-02 17:23:13 +0000 (Thu, 02 Feb 2006) $
| > $Revision: 133 $
| > $Author: bfarber $
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
| > $Revision: 567 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > MySQL FULL TEXT Search Library
@@ -34,6 +24,11 @@
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
class search_lib extends Search
{
@@ -114,8 +109,6 @@ class search_lib extends Search
}
}
//print $check_keywords; exit();
//-----------------------------------------
// Get forums...
//-----------------------------------------
@@ -153,11 +146,16 @@ class search_lib extends Search
// How many results?
//-----------------------------------------
$this->ipsclass->DB->query("SELECT COUNT(*) as dracula
FROM ".SQL_PREFIX."posts p
LEFT JOIN ".SQL_PREFIX."topics t ON (t.tid=p.topic_id)
WHERE t.forum_id IN ($myforums) {$topics_name} {$approved}
AND MATCH(p.post) AGAINST ('$check_keywords' $boolean)");
$this->ipsclass->DB->build_query( array( 'select' => 'COUNT(*) as dracula',
'from' => array( 'posts' => 'p' ),
'add_join' => array( 1 => array( 'type' => 'left',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id',
) ),
'where' => "t.forum_id IN ({$myforums}) {$topics_name} {$approved}
AND MATCH(p.post) AGAINST ('{$check_keywords}' {$boolean})"
) );
$this->ipsclass->DB->exec_query();
$count = $this->ipsclass->DB->fetch_row();
@@ -172,8 +170,8 @@ class search_lib extends Search
// Store it daddy-o!
//-----------------------------------------
$cache = "SELECT MATCH(post) AGAINST ('$check_keywords' $boolean) as score, t.tid, t.posts as topic_posts, t.title as topic_title, t.views, t.forum_id,
p.post, p.author_id, p.author_name, p.post_date, p.pid, p.post_htmlstate,m.*, me.*
$cache = "SELECT MATCH(post) AGAINST ('$check_keywords' $boolean) as score, t.approved, t.tid, t.posts as topic_posts, t.title as topic_title, t.views, t.forum_id,
p.post, p.author_id, p.author_name, p.post_date, p.queued, p.pid, p.post_htmlstate,m.*, me.*
FROM ".SQL_PREFIX."posts p
LEFT JOIN ".SQL_PREFIX."topics t on (p.topic_id=t.tid)
LEFT JOIN ".SQL_PREFIX."members m on (m.id=p.author_id)
@@ -188,19 +186,18 @@ class search_lib extends Search
$unique_id = md5(uniqid(microtime(),1));
$str = $this->ipsclass->DB->compile_db_insert_string( array (
'id' => $unique_id,
'search_date'=> time(),
'topic_id' => '00',
'topic_max' => $count['dracula'],
'member_id' => $this->ipsclass->member['id'],
'ip_address' => $this->ipsclass->input['IP_ADDRESS'],
'post_id' => '00',
'query_cache'=> $cache,
) );
$str = array (
'id' => $unique_id,
'search_date'=> time(),
'topic_id' => '00',
'topic_max' => $count['dracula'],
'member_id' => $this->ipsclass->member['id'],
'ip_address' => $this->ipsclass->input['IP_ADDRESS'],
'post_id' => '00',
'query_cache'=> $cache,
);
$this->ipsclass->DB->query("INSERT INTO ibf_search_results ({$str['FIELD_NAMES']}) VALUES ({$str['FIELD_VALUES']})");
$this->ipsclass->DB->do_insert( "search_results", $str );
$hilight = str_replace( '&quot;', '', $this->ipsclass->input['keywords'] );
$hilight = urlencode(trim(str_replace( '&amp;', '&', $hilight)));
@@ -231,7 +228,8 @@ class search_lib extends Search
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'no_search_results' ) );
}
$this->ipsclass->DB->query("SELECT * FROM ibf_search_results WHERE id='{$this->unique_id}'");
$this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'search_results', 'where' => "id='".$this->unique_id."'" ) );
$this->ipsclass->DB->exec_query();
if ( ! $sr = $this->ipsclass->DB->fetch_row() )
{
@@ -310,7 +308,7 @@ class search_lib extends Search
// Link member's name
if ($row['author_id'])
if ( $row['author_id'] )
{
$row['author_name'] = "<a href='{$this->ipsclass->base_url}act=Profile&amp;MID={$row['author_id']}'>{$row['author_name']}</a>";
}
@@ -328,11 +326,14 @@ class search_lib extends Search
// Fix up quotes..
//-----------------------------------------
$row['class1'] = "row2";
$row['class2'] = "row1";
$row['classposts'] = "row2";
$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;
$row['post'] = $this->topics->parser->pre_db_parse( $this->topics->parser->pre_edit_parse( $row['post'] ) );
$row['post'] = $this->topics->parser->pre_display_parse( $row['post'] );
$keywords_array = explode( " ", str_replace( "+", " ", $this->ipsclass->input['highlite'] ) );
@@ -396,7 +397,7 @@ class search_lib extends Search
if( is_array($this->ipsclass->cache['moderators']) AND count($this->ipsclass->cache['moderators']) )
{
foreach( $this->ipsclass->cache['moderators'] as $k => $v )
foreach( $this->ipsclass->cache['moderators'] as $v )
{
if( $v['member_id'] == $this->ipsclass->member['id'] AND $v['post_q'] )
{
@@ -425,17 +426,9 @@ class search_lib extends Search
// Do we have any input?
//-----------------------------------------
//-----------------------------------------
// USING FULL TEXT - Wooohoo!!
//-----------------------------------------
if ($this->ipsclass->input['namesearch'] != "")
{
$name_filter = $this->is->filter_keywords($this->ipsclass->input['namesearch'], 1);
}
$name_filter = (isset($this->ipsclass->input['namesearch']) AND $this->ipsclass->input['namesearch'] != "") ? $this->is->filter_keywords($this->ipsclass->input['namesearch'], 1) : '';
if ($this->ipsclass->input['useridsearch'] != "")
if (isset($this->ipsclass->input['useridsearch']) AND $this->ipsclass->input['useridsearch'] != "")
{
$keywords = $this->is->filter_keywords($this->ipsclass->input['useridsearch']);
$this->is->search_type = 'userid';
@@ -446,6 +439,8 @@ class search_lib extends Search
$this->is->search_type = 'posts';
}
$type = "postonly";
if ( $name_filter != "" AND $this->ipsclass->input['keywords'] != "" )
{
$type = 'joined';
@@ -459,6 +454,8 @@ class search_lib extends Search
$type='nameonly';
}
//-----------------------------------------
// USING FULL TEXT - Wooohoo!!
//-----------------------------------------
if ( $this->is->mysql_version >= 40010 )
@@ -530,7 +527,7 @@ class search_lib extends Search
}
//-----------------------------------------
if ($this->ipsclass->input['search_in'] == 'titles')
{
$this->is->search_in = 'titles';
@@ -588,6 +585,12 @@ class search_lib extends Search
$this->ipsclass->vars['min_search_word'] = 4;
}
$topics_datecut = "";
$posts_datecut = "";
$posts_name = "";
$topics_name = "";
//-----------------------------------------
// Add on the prune days
//-----------------------------------------
@@ -635,13 +638,13 @@ class search_lib extends Search
$name_filter = str_replace( '|', "&#124;", $name_filter );
if ($this->ipsclass->input['exactname'] == 1)
if (isset($this->ipsclass->input['exactname']) AND $this->ipsclass->input['exactname'] == 1)
{
$sql_query = "SELECT id from ibf_members WHERE LOWER(members_display_name)='".$name_filter."'";
$sql_query = "SELECT id from ".SQL_PREFIX."members WHERE members_l_display_name='".$name_filter."'";
}
else
{
$sql_query = "SELECT id from ibf_members WHERE members_display_name like '%".$name_filter."%'";
$sql_query = "SELECT id from ".SQL_PREFIX."members WHERE members_display_name like '%".$name_filter."%'";
}
@@ -673,7 +676,7 @@ class search_lib extends Search
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $this->ipsclass->vars['min_search_word']) );
}
}
$unique_id = md5(uniqid(microtime(),1));
if ($type != 'nameonly')
@@ -681,16 +684,15 @@ class search_lib extends Search
if ( ! $this->is->topic_search_only )
{
$topics_query = "SELECT t.tid, t.approved, t.forum_id
FROM ibf_topics t
FROM ".SQL_PREFIX."topics t
WHERE $topics_datecut t.forum_id IN ($forums)
$topics_name AND t.approved=1 AND MATCH(title) AGAINST ('".trim($keywords)."' $boolean)";
$topics_name AND MATCH(title) AGAINST ('".trim($keywords)."' $boolean)";
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
FROM ibf_posts p
LEFT JOIN ibf_topics t ON ( p.topic_id=t.tid )
FROM ".SQL_PREFIX."posts p
LEFT JOIN ".SQL_PREFIX."topics t ON ( p.topic_id=t.tid )
WHERE $posts_datecut t.forum_id IN ($forums)
AND p.queued=0
$posts_name AND MATCH(post) AGAINST ('".trim($keywords)."' $boolean)";
}
else
@@ -700,12 +702,11 @@ class search_lib extends Search
//-----------------------------------------
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
FROM ibf_posts p
LEFT JOIN ibf_topics t ON ( p.topic_id=t.tid )
FROM ".SQL_PREFIX."posts p
LEFT JOIN ".SQL_PREFIX."topics t ON ( p.topic_id=t.tid )
WHERE
p.topic_id={$this->is->topic_id}
AND $posts_datecut t.forum_id IN ($forums)
AND p.queued=0
$posts_name AND MATCH(post) AGAINST ('".trim($keywords)."' $boolean)";
}
}
@@ -713,15 +714,14 @@ class search_lib extends Search
{
$topics_query = "SELECT t.tid, t.approved, t.forum_id
FROM ibf_topics t
FROM ".SQL_PREFIX."topics t
WHERE $topics_datecut t.forum_id IN ($forums)
$topics_name AND t.approved=1";
$topics_name";
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
FROM ibf_posts p
LEFT JOIN ibf_topics t ON ( p.topic_id=t.tid )
FROM ".SQL_PREFIX."posts p
LEFT JOIN ".SQL_PREFIX."topics t ON ( p.topic_id=t.tid )
WHERE $posts_datecut t.forum_id IN ($forums)
AND p.queued=0
$posts_name";
}
//print $topics_query."<br />".$posts_query; exit();
@@ -860,7 +860,7 @@ class search_lib extends Search
{
$this->output .= $this->ipsclass->compiled_templates['skin_search']->search_error_page($this->ipsclass->input['keywords']);
$this->ipsclass->print->add_output( $this->output );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->lang['g_simple_title'], 'JS' => 0, NAV => array( $this->ipsclass->lang['g_simple_title'] ) ) );
$this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->lang['g_simple_title'], 'JS' => 0, 'NAV' => array( $this->ipsclass->lang['g_simple_title'] ) ) );
}
}