Version 2.3.6

This commit is contained in:
Neo committed 2025-12-19 00:26:08 -08:00
1 parent a3bb603c96
commit 19b38c7c74
764 files changed
+143731 -118164

No files matched your search

+105 -89
View File
@@ -2,25 +2,17 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.2.2
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Monday 05th of March 2007 10:10:54 PM
| Release: e3790216629e5a2aaf37070b32237f06
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2006-11-22 12:58:39 -0600 (Wed, 22 Nov 2006) $
| > $Revision: 739 $
| > $Date: 2007-12-28 17:06:51 -0500 (Fri, 28 Dec 2007) $
| > $Revision: 1152 $
| > $Author: bfarber $
+---------------------------------------------------------------------------
|
@@ -32,16 +24,14 @@
+--------------------------------------------------------------------------
*/
if ( ! defined( 'IN_ACP' ) )
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
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
{
var $parser = "";
var $is = "";
var $resultlimit = "";
@@ -93,7 +83,7 @@ class search_lib extends Search
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_short', 'EXTRA' => $this->ipsclass->vars['min_search_word']) );
}
else if ( strlen(trim($keywords)) > 100 )
else if ( $this->ipsclass->txt_mb_strlen(trim($keywords)) > 100 )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'search_word_long', 'EXTRA' => 100) );
}
@@ -155,6 +145,12 @@ class search_lib extends Search
{
$approved = 'and p.queued IN (0,1)';
}
//-----------------------------------------
// bad magic quotes - bad
//-----------------------------------------
$check_keywords = $this->ipsclass->DB->add_slashes( $check_keywords );
//-----------------------------------------
// How many results?
@@ -196,7 +192,7 @@ class search_lib extends Search
if ( $this->ipsclass->input['sortby'] != "relevant" )
{
$cache .= " ORDER BY p.post_date DESC";
$cache .= " ORDER BY p.post_date {$this->is->sort_order}";
}
$unique_id = md5(uniqid(microtime(),1));
@@ -351,12 +347,6 @@ class search_lib extends Search
$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_display_parse( $row['post'] );
if ( $this->ipsclass->input['highlite'] )
{
$row['post'] = $this->ipsclass->content_search_highlight( $row['post'], $this->ipsclass->input['highlite'] );
@@ -365,15 +355,15 @@ class search_lib extends Search
$row['forum_name'] = $this->ipsclass->forums->forum_by_id[ $row['forum_id'] ]['name'];
$this->output .= $this->ipsclass->compiled_templates['skin_search']->RenderPostRow($row, $member);
//-----------------------------------------
// Add in attachments?
//-----------------------------------------
// Add in attachments?
// Sucks we have to do this inside the loop
// however we have to check forum view perms
//-----------------------------------------
if ( count( $attach_pids ) )
{
//-----------------------------------------
if ( count( $attach_pids ) )
{
if ( ! is_object( $this->class_attach ) )
{
//-----------------------------------------
@@ -396,8 +386,8 @@ class search_lib extends Search
$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 );
$this->output .= $this->ipsclass->compiled_templates['skin_search']->end_results_table( array( 'SHOW_PAGES' => $this->links ), 1 );
$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'] ) ) );
@@ -414,6 +404,10 @@ class search_lib extends Search
function do_main_search()
{
//-----------------------------------------
$forums = $this->is->get_searchable_forums();
//-----------------------------------------
// Invisible topic-approval permissions?
//-----------------------------------------
@@ -427,24 +421,36 @@ class search_lib extends Search
{
if( $v['member_id'] == $this->ipsclass->member['id'] AND $v['post_q'] )
{
$my_invisible_forums_p[] = $v['forum_id'];
if( in_array( $v['forum_id'], $this->is->searchable_forums ) )
{
$my_invisible_forums_p[] = $v['forum_id'];
}
}
if( $v['member_id'] == $this->ipsclass->member['id'] AND $v['topic_q'] )
{
$my_invisible_forums_t[] = $v['forum_id'];
if( in_array( $v['forum_id'], $this->is->searchable_forums ) )
{
$my_invisible_forums_t[] = $v['forum_id'];
}
}
if( $v['is_group'] && ( $v['group_id'] == $this->ipsclass->member['mgroup']
OR in_array( $v['group_id'], explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) ) ) ) && $v['post_q'] )
{
$my_invisible_forums_p[] = $v['forum_id'];
if( in_array( $v['forum_id'], $this->is->searchable_forums ) )
{
$my_invisible_forums_p[] = $v['forum_id'];
}
}
if( $v['is_group'] && ( $v['group_id'] == $this->ipsclass->member['mgroup']
OR in_array( $v['group_id'], explode( ",", $this->ipsclass->clean_perm_string( $this->ipsclass->member['mgroup_others'] ) ) ) ) && $v['topic_q'] )
{
$my_invisible_forums_t[] = $v['forum_id'];
if( in_array( $v['forum_id'], $this->is->searchable_forums ) )
{
$my_invisible_forums_t[] = $v['forum_id'];
}
}
}
}
@@ -571,10 +577,6 @@ class search_lib extends Search
$this->is->search_in = 'titles';
}
//-----------------------------------------
$forums = $this->is->get_searchable_forums();
//-----------------------------------------
// Do we have any forums to search in?
//-----------------------------------------
@@ -719,7 +721,7 @@ class search_lib extends Search
$t_forum_query = $this->ipsclass->member['g_is_supmod'] ? "t.forum_id IN ($forums)" :
( count($my_invisible_forums_t) ? "( (t.forum_id IN ($forums) AND t.approved=1) OR t.forum_id IN(" . implode( ",", $my_invisible_forums_t ) . ") )" :
"t.forum_id IN ($forums)" );
"t.forum_id IN ($forums) AND t.approved=1" );
if( $this->ipsclass->member['g_is_supmod'] )
{
@@ -756,6 +758,12 @@ class search_lib extends Search
{
$p_forum_query = "(t.forum_id IN ($forums) AND t.approved=1 AND p.queued=0)";
}
//-----------------------------------------
// bad magic quotes - bad
//-----------------------------------------
$keywords = $this->ipsclass->DB->add_slashes( $keywords );
if ($type != 'nameonly')
{
@@ -765,6 +773,7 @@ class search_lib extends Search
FROM ".SQL_PREFIX."topics t
WHERE $topics_datecut $t_forum_query
$topics_name AND MATCH(title) AGAINST ('".trim($keywords)."' $boolean)
ORDER BY t.last_post {$this->is->sort_order}
LIMIT {$this->resultlimit}";
@@ -773,6 +782,7 @@ class search_lib extends Search
LEFT JOIN ".SQL_PREFIX."topics t ON ( p.topic_id=t.tid )
WHERE $posts_datecut $p_forum_query
$posts_name AND MATCH(post) AGAINST ('".trim($keywords)."' $boolean)
ORDER BY p.post_date {$this->is->sort_order}
LIMIT {$this->resultlimit}";
}
else
@@ -788,6 +798,7 @@ class search_lib extends Search
p.topic_id={$this->is->topic_id}
AND $posts_datecut $p_forum_query
$posts_name AND MATCH(post) AGAINST ('".trim($keywords)."' $boolean)
ORDER BY p.post_date {$this->is->sort_order}
LIMIT {$this->resultlimit}";
}
}
@@ -798,6 +809,7 @@ class search_lib extends Search
FROM ".SQL_PREFIX."topics t
WHERE $topics_datecut $t_forum_query
$topics_name
ORDER BY t.last_post {$this->is->sort_order}
LIMIT {$this->resultlimit}";
$posts_query = "SELECT p.pid, p.queued, t.approved, t.forum_id
@@ -805,6 +817,7 @@ class search_lib extends Search
LEFT JOIN ".SQL_PREFIX."topics t ON ( p.topic_id=t.tid )
WHERE $posts_datecut $p_forum_query
$posts_name
ORDER BY p.post_date {$this->is->sort_order}
LIMIT {$this->resultlimit}";
}
//print $topics_query."<br />".$posts_query; exit();
@@ -830,7 +843,7 @@ class search_lib extends Search
if ( ! $this->is->topic_search_only )
{
$this->ipsclass->DB->query($topics_query);
$total_t = $this->ipsclass->DB->get_num_rows();
while ($row = $this->ipsclass->DB->fetch_row() )
@@ -881,63 +894,66 @@ class search_lib extends Search
// PID: Get 'em
//-----------------------------------------
$this->ipsclass->DB->query($posts_query);
$total_p = $this->ipsclass->DB->get_num_rows();
while ($row = $this->ipsclass->DB->fetch_row() )
if( $this->is->search_in != 'titles' )
{
/*if( $row['queued'] )
$this->ipsclass->DB->query($posts_query);
$total_p = $this->ipsclass->DB->get_num_rows();
while ($row = $this->ipsclass->DB->fetch_row() )
{
if( !$this->ipsclass->member['g_is_supmod'] )
/*if( $row['queued'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_p ) )
if( !$this->ipsclass->member['g_is_supmod'] )
{
continue;
if( !in_array( $row['forum_id'], $my_invisible_forums_p ) )
{
continue;
}
}
}
if( !$row['approved'] )
{
if( !$this->ipsclass->member['g_is_supmod'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_t ) )
{
continue;
}
}
}*/
//$post_tmp[ $row['pid'] ] = $row['pid'];
$post_array[ $row['pid'] ] = $row['pid'];
}
if( !$row['approved'] )
{
if( !$this->ipsclass->member['g_is_supmod'] )
{
if( !in_array( $row['forum_id'], $my_invisible_forums_t ) )
{
continue;
}
}
}*/
//$post_tmp[ $row['pid'] ] = $row['pid'];
$post_array[ $row['pid'] ] = $row['pid'];
}
$this->ipsclass->DB->free_result();
if( $total_p == $this->resultlimit )
{
$more = 1;
}
//-----------------------------------------
// PID Sort 'em
//-----------------------------------------
/*krsort( $post_tmp );
foreach( $post_tmp as $id => $pid )
{
$p_cnt++;
if ( $p_cnt > $this->resultlimit )
$this->ipsclass->DB->free_result();
if( $total_p == $this->resultlimit )
{
$more = 1;
break;
}
$post_array[ $pid ] = $pid;
}*/
//-----------------------------------------
// PID Sort 'em
//-----------------------------------------
/*krsort( $post_tmp );
foreach( $post_tmp as $id => $pid )
{
$p_cnt++;
if ( $p_cnt > $this->resultlimit )
{
$more = 1;
break;
}
$post_array[ $pid ] = $pid;
}*/
}
//-----------------------------------------
@@ -974,7 +990,7 @@ class search_lib extends Search
'post_id' => $posts,
'topic_max' => intval( count( $topic_array ) ),
'post_max' => intval( count( $post_array ) ),
'keywords' => str_replace( '"', "", $keywords ),
'keywords' => str_replace( '"', "", str_replace( '\\\\', '\\', $keywords ) ),
'query_cache' => $more,
);