Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Config file
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Basic Forum Search
* Last Updated: $Date: 2012-06-29 18:12:03 -0400 (Fri, 29 Jun 2012) $
* Last Updated: $Date: 2013-04-29 20:59:30 -0400 (Mon, 29 Apr 2013) $
* </pre>
*
* @author $Author: AndyMillne $
* @author $Author: bfarber $
* @copyright © 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 11014 $
* @version $Rev: 12207 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -462,7 +462,7 @@ class search_engine_forums extends search_engine
}
}
return array( 'count' => count( $tids ), 'resultSet' => $tids );
return array( 'count' => count( $rows ), 'resultSet' => $tids );
}
}
}
@@ -613,10 +613,12 @@ class search_engine_forums extends search_engine
$this->sphinxClient->SetLimits( intval($start), intval($perPage) );
/* Get list of good forum IDs */
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'] );
$this->sphinxClient->SetFilter( 'forum_id', $forumIdsOk );
if( $this->memberData['member_id'] != $member['member_id'] )
{
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'] );
$this->sphinxClient->SetFilter( 'forum_id', $forumIdsOk );
}
/* what we doing? */
if ( IPSSearchRegistry::get('in.userMode') != 'title' )
{
@@ -960,22 +962,29 @@ class search_engine_forums extends search_engine
return array( 'count' => 0, 'resultSet' => array() );
}
$this->DB->build( array( 'select' => 'topic_id',
'from' => 'posts',
'where' => 'pid IN(' . implode( ',', $data['resultSet'] ) . ')' ) );
$this->DB->execute();
$_tmpTids = array();
while( $row = $this->DB->fetch() )
if( IPSSearchRegistry::get('set.returnType') == 'pids' )
{
$_tmpTids[] = $row['topic_id'];
$this->DB->build( array( 'select' => 'topic_id',
'from' => 'posts',
'where' => 'pid IN(' . implode( ',', $data['resultSet'] ) . ')' ) );
$this->DB->execute();
$_tmpTids = array();
while( $row = $this->DB->fetch() )
{
$_tmpTids[] = $row['topic_id'];
}
if ( count( $_tmpTids ) )
{
$where[] = "( tid IN(" . implode( ',', $_tmpTids ) . ')' . $_ffWhere . ' )';
}
}
if ( count( $_tmpTids ) )
else
{
$where[] = "( tid IN(" . implode( ',', $_tmpTids ) . ')' . $_ffWhere . ' )';
$where[] = "( tid IN(" . implode( ',', $data['resultSet'] ) . ')' . $_ffWhere . ' )';
}
}
@@ -2,18 +2,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Basic Forum Search
* Last Updated: $Date: 2012-07-05 11:04:28 -0400 (Thu, 05 Jul 2012) $
* Last Updated: $Date: 2013-05-21 20:51:17 -0400 (Tue, 21 May 2013) $
* </pre>
*
* @author $Author: mmecham $
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 11035 $
* @version $Rev: 12263 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -48,7 +48,7 @@ class search_engine_forums extends search_engine
}
/* Get live or archive */
$this->searchArchives = ( ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive'] == 'archive' ) ? true : false;
$this->searchArchives = ( isset(ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive']) && ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive'] == 'archive' ) ? true : false;
if ( $this->searchArchives )
{
@@ -173,6 +173,7 @@ class search_engine_forums extends search_engine
'where' => $this->_buildWhereStatement( $search_term, IPSSearchRegistry::searchTitleOnly(), '', null, ( IPSSearchRegistry::get('opt.searchType') == 'content' || IPSSearchRegistry::get('in.search_author') ) ? false : true ),
'limit' => array(0, IPSSearchRegistry::get('set.hardLimit') + 1),
'order' => $sortKey . ' ' . $sort_order,
'group' => ( $this->settings['forum_search_groupby'] AND IPSSearchRegistry::get('opt.noPostPreview') ) ? "p.topic_id" : '',
'add_join' => array( array( 'select' => 't.title, t.posts, t.views',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.'.$this->table['topic_id'],
@@ -180,6 +181,8 @@ class search_engine_forums extends search_engine
}
else
{
IPSSearchRegistry::set('set.returnType', 'tids' );
/* Do the search */
$this->DB->build( array(
'select' => "t.tid as id, t.tid as topic_id, t.title, t.posts, t.views, t.last_post",
@@ -228,12 +231,12 @@ class search_engine_forums extends search_engine
$_tagIds[] = $data['tag_meta_id'];
}
$this->DB->build( array('select' => "t.tid as id, t.tid as topic_id, t.title, t.posts, t.views, t.last_post",
$this->DB->build( array('select' => "t.tid as id, t.tid as topic_id, t.title, t.posts, t.views, t.last_post, t.topic_firstpost",
'from' => array( 'topics' => 't' ),
'where' => 't.tid IN (' . implode( ",", $_tagIds ) . ')',
'where' => 't.tid IN (' . implode( ",", $_tagIds ) . ') AND ' . $this->_buildWhereStatement( $search_term, IPSSearchRegistry::searchTitleOnly() ),
'limit' => array(0, IPSSearchRegistry::get('set.hardLimit') + 1),
'order' => 't.'.str_replace( 'post_date', 'topic_firstpost', $sortKey ) . ' ' . $sort_order,
'add_join' => array( array( 'select' => 'p.'.$this->table['pid'],
'order' => 't.'.str_replace( 'post_date', 'last_post', $sortKey ) . ' ' . $sort_order,
'add_join' => array( array( 'select' => 'p.' . $this->table['post_date'] . ', p.'.$this->table['pid'],
'from' => array( $this->table['_table_'] => 'p' ),
'where' => 'p.'.$this->table['pid'].'=t.topic_firstpost',
'type' => 'left' ) ) ) );
@@ -268,14 +271,14 @@ class search_engine_forums extends search_engine
}
/* Set vars */
IPSSearch::$ask = $sortKey;
IPSSearch::$ask = ( IPSSearchRegistry::get('set.returnType') == 'tids' ) ? 'last_post' : $this->table['post_date'];
IPSSearch::$aso = strtolower( $sort_order );
IPSSearch::$ast = $sortType;
/* Sort */
if ( count( $_rows ) )
{
usort( $_rows, array("IPSSearch", "usort") );
//usort( $_rows, array("IPSSearch", "usort") ); See http://community.invisionpower.com/resources/bugs.html/_/ip-board/incorrect-search-order-of-topic-list-r40835
/* Build result array */
foreach( $_rows as $r )
@@ -310,9 +313,10 @@ class search_engine_forums extends search_engine
* @return nothin'
*/
public function viewUserContent( $member )
{
{
$sort_by = IPSSearchRegistry::get('in.search_sort_by');
$sort_order = IPSSearchRegistry::get('in.search_sort_order');
$followedOnly = $this->memberData['member_id'] ? IPSSearchRegistry::get('in.vncFollowFilterOn' ) : false;
switch( IPSSearchRegistry::get('in.userMode') )
{
@@ -361,18 +365,60 @@ class search_engine_forums extends search_engine
$perPage = IPSSearchRegistry::get('opt.search_per_page');
/* Get list of good forum IDs */
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'] );
$forumIdsOk = array();
if( $this->memberData['member_id'] != $member['member_id'] )
{
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'] );
}
/* Only show VNC results from specified forums? */
if( is_array(IPSSearchRegistry::get('forums.vncForumFilters')) AND count(IPSSearchRegistry::get('forums.vncForumFilters')) )
{
$_newIdsOk = array();
foreach( IPSSearchRegistry::get('forums.vncForumFilters') as $forumId )
{
if( in_array( $forumId, $forumIdsOk ) )
{
$_newIdsOk[] = $forumId;
}
}
$forumIdsOk = $_newIdsOk;
}
/* Fetch forum rel ids */
if ( $followedOnly )
{
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
$like = classes_like::bootstrap( 'forums', 'topics' );
$followedTopics = $like->getDataByMemberIdAndArea( $this->memberData['member_id'] );
$followedTopics = ( $followedTopics === null ) ? array() : array_keys( $followedTopics );
if ( ! count( $followedTopics ) )
{
/* Return it */
return array( 'count' => 0, 'resultSet' => array() );
}
$topic_where[] = ( "t.tid IN (" . implode( ',', $followedTopics ) . ")" );
}
//-----------------------------------------
// No forums?
//-----------------------------------------
if( !count( $forumIdsOk ) )
{
return array( 'count' => 0, 'resultSet' => array() );
}
$topic_where[] = "t.forum_id IN (" . implode( ",", $forumIdsOk ) . ")";
if( $this->memberData['member_id'] != $member['member_id'] )
{
if( !count( $forumIdsOk ) )
{
return array( 'count' => 0, 'resultSet' => array() );
}
$topic_where[] = "t.forum_id IN (" . implode( ",", $forumIdsOk ) . ")";
}
if ( IPSSearchRegistry::get('in.userMode') != 'title' )
{
@@ -439,7 +485,13 @@ class search_engine_forums extends search_engine
/* Not archives */
$topic_where[] = $this->registry->class_forums->fetchTopicArchiveQuery( array('not', 'exclude' ), 't.' );
/* Searching by time period */
if ( IPSSearchRegistry::get('in.period_in_seconds') )
{
$topic_where[] = "t.last_post > " . ( IPS_UNIX_TIME_NOW - IPSSearchRegistry::get('in.period_in_seconds') );
}
/* Manual fetch if user content all */
if ( IPSSearchRegistry::get('in.userMode') == 'all' )
{
@@ -457,7 +509,7 @@ class search_engine_forums extends search_engine
{
$pids[ $t['tid'] ] = $t['last_post'];
}
$where = ( array_merge( (array) $where, (array) $topic_where ) );
$where = implode( " AND ", $where );
@@ -465,18 +517,20 @@ class search_engine_forums extends search_engine
$this->DB->build( array( 'select' => 'p.pid',
'from' => array('posts' => 'p' ),
'where' => $where,
'add_join' => array( array( 'select' => 't.tid, t.last_post, t.topic_firstpost',
'add_join' => array( array( 'select' => 't.tid, t.forum_id, t.last_post, t.topic_firstpost',
'from' => array( 'topics' => 't' ),
'where' => 'p.topic_id=t.tid',
'type' => 'left' ) ),
'order' => 'p.pid DESC',
'limit' => array( 0, 1000 ) ) );
'order' => 'p.post_date DESC',
'limit' => array( 0, 5000 ) ) );
$this->DB->execute();
while( $t = $this->DB->fetch() )
{
$pids[ $t['tid'] ] = $t['last_post'];
$pids[ $t['tid'] ] = $t['last_post'];
$tidsForFilter[ $t['tid'] ] = array( 'tid' => $t['tid'], 'forum_id' => $t['forum_id'], 'last_post' => $t['last_post'] );
}
$count = array( 'count' => count( $pids ) );
@@ -502,7 +556,7 @@ class search_engine_forums extends search_engine
/* Fetch the count */
if ( $count['count'] )
{
$this->DB->build( array( 'select' => 'tid',
$this->DB->build( array( 'select' => 'tid, forum_id, last_post',
'from' => 'topics t',
'where' => $where,
'order' => $sortKey . ' ' . $sort_order,
@@ -513,6 +567,7 @@ class search_engine_forums extends search_engine
while( $row = $this->DB->fetch( $inner ) )
{
$tids[ $row['tid'] ] = $row['tid'];
$tidsForFilter[ $row['tid'] ] = array( 'tid' => $row['tid'], 'forum_id' => $row['forum_id'], 'last_post' => $row['last_post'] );
}
}
}
@@ -532,7 +587,7 @@ class search_engine_forums extends search_engine
/* Fetch the count */
if ( $count['count'] )
{
$this->DB->build( array( 'select' => 'tid',
$this->DB->build( array( 'select' => 'tid, forum_id, last_post',
'from' => array('topics' => 't' ),
'where' => $where,
'add_join' => array( array( 'select' => 'p.pid',
@@ -541,15 +596,24 @@ class search_engine_forums extends search_engine
'type' => 'left' ) ),
'order' => $sortKey . ' ' . $sort_order,
'limit' => array( $start, $perPage ) ) );
$inner = $this->DB->execute();
while( $row = $this->DB->fetch( $inner ) )
{
$tids[ $row['pid'] ] = $row['pid'];
$tidsForFilter[ $row['tid'] ] = array( 'tid' => $row['tid'], 'forum_id' => $row['forum_id'], 'last_post' => $row['last_post'] );
}
}
}
/* Unread only? */
if( IPSSearchRegistry::get('in.period') == 'unread' )
{
$filter = $this->registry->class_forums->postProcessVncTids( $tidsForFilter );
$count['count'] = $filter['count'];
$tids = $filter['tids'];
}
/* Fix to 1000 results max */
$count['count'] = ( $count['count'] > 1000 ) ? 1000 : $count['count'];
@@ -573,6 +637,7 @@ class search_engine_forums extends search_engine
$forumIdsOk = array();
$where = array();
$_tidsOnly = array();
$noLimit = FALSE;
/* Loop through the forums and build a list of forums we're allowed access to */
$bvnp = explode( ',', $this->settings['vnp_block_forums'] );
@@ -588,7 +653,7 @@ class search_engine_forums extends search_engine
IPSSearchRegistry::set('in.search_sort_order' , 'desc' );
IPSSearchRegistry::set('opt.searchType' , 'titles' );
IPSSearchRegistry::set('opt.noPostPreview' , true );
//-----------------------------------------
// Only content we have participated in?
//-----------------------------------------
@@ -596,7 +661,7 @@ class search_engine_forums extends search_engine
if( IPSSearchRegistry::get('in.userMode') )
{
$_tempResults = $this->viewUserContent( $this->memberData );
if( $_tempResults['count'] )
{
$_tidsOnly = array_merge( $_tidsOnly, $_tempResults['resultSet'] );
@@ -640,7 +705,7 @@ class search_engine_forums extends search_engine
$like = classes_like::bootstrap( 'forums', 'topics' );
$followedTopics = $like->getDataByMemberIdAndArea( $this->memberData['member_id'] );
$followedTopics = $like->getDataByMemberIdAndArea( $this->memberData['member_id'], 5000 );
$followedTopics = ( $followedTopics === null ) ? array() : array_keys( $followedTopics );
}
@@ -752,7 +817,7 @@ class search_engine_forums extends search_engine
}
$where[] = $this->registry->class_forums->fetchTopicArchiveQuery( array('not', 'exclude' ) );
/* add perm */
$where[] = $permWhere;
$_ffWhere = '';
@@ -787,30 +852,31 @@ class search_engine_forums extends search_engine
else if( count($_tidsOnly) )
{
$where[] = "( tid IN(" . implode( ',', $_tidsOnly ) . ')' . $_ffWhere . ' )';
$noLimit = TRUE; // If we're here, we've already limited in $this->viewUserContent()
}
else if( count($followedTopics) )
{
$where[] = "( tid IN(" . implode( ',', $followedTopics ) . ')' . $_ffWhere . ' )';
}
$where = implode( " AND ", $where );
/* Fetch the count */
$count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count',
'from' => 'topics',
'where' => $where ) );
/* Fetch the count */
if ( $count['count'] )
{
$limit = ( IPSSearchRegistry::get('in.period') != 'unread' ) ? array( $start, $perPage ) : array( 0, 1200 );
$limit = $noLimit ? NULL : ( IPSSearchRegistry::get('in.period') != 'unread' ) ? array( $start, $perPage ) : array( 0, 1200 );
$this->DB->build( array( 'select' => 'tid, forum_id, last_post',
'from' => 'topics',
'where' => $where,
'order' => 'last_post DESC',
'limit' => $limit ) );
$inner = $this->DB->execute();
while( $row = $this->DB->fetch( $inner ) )
@@ -830,9 +896,9 @@ class search_engine_forums extends search_engine
}
else
{
$data = array( 'count' => $count['count'], 'resultSet' => array_keys( $rtids) );
$data = array( 'count' => ( ( isset( $_tempResults['count'] ) and $_tempResults['count'] > $count['count'] ) ? $_tempResults['count'] : $count['count'] ), 'resultSet' => array_keys( $rtids) ); // For explaination of why we check $_tempResults, see bug report 38178
}
/* Return it */
return $data;
}
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Returns HTML for the form (optional class, not required)
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-05-10 16:10:13 -0400 (Thu, 10 May 2012) $
* </pre>
*
* @author $author$
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 10721 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -2,9 +2,9 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Formats forum search results
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2013-05-17 19:05:15 -0400 (Fri, 17 May 2013) $
* </pre>
*
* @author $author$
@@ -13,7 +13,7 @@
* @package IP.Board
* @subpackage Forums
* @link http://www.invisionpower.com
* @version $Rev: 10914 $
* @version $Rev: 12259 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -118,7 +118,7 @@ class search_format_forums extends search_format
foreach( $results as $result )
{
$forums[ $result ] = $this->registry->class_forums->forumsFormatLastinfo( $this->registry->class_forums->forumsCalcChildren( $result, $this->registry->class_forums->getForumById( $result ) ) );
if( $forums[ $result ]['last_poster_id'] )
{
$member_ids[ $result ] = $forums[ $result ]['last_poster_id'];
@@ -185,10 +185,10 @@ class search_format_forums extends search_format
$data['_last_post'] = $data['last_post'];
$data['_longTitle'] = $data['content_title'];
$data['_shortTitle'] = ( IPSText::mbstrlen( strip_tags( $data['content_title'] ) ) > 60 ) ? IPSText::truncate( $data['content_title'], 60 ) : $data['content_title'];
$data['last_poster'] = $data['last_poster_id'] ? IPSMember::makeProfileLink( $data['last_poster_name'], $data['last_poster_id'], $data['seo_last_name'] ) : $this->settings['guest_name_pre'] . $data['last_poster_name'] . $this->settings['guest_name_suf'];
$data['last_poster'] = $data['last_poster_id'] ? IPSMember::buildDisplayData( $data['last_poster_id'] ) : IPSMember::buildDisplayData( IPSMember::setUpGuest( $this->settings['guest_name_pre'] . $data['last_poster_name'] . $this->settings['guest_name_suf'] ) );
$data['starter'] = $data['starter_id'] ? IPSMember::makeProfileLink( $data['starter_name'], $data['starter_id'], $data['seo_first_name'] ) : $this->settings['guest_name_pre'] . $data['starter_name'] . $this->settings['guest_name_suf'];
//$data['last_post'] = $this->registry->getClass( 'class_localization')->getDate( $data['last_post'], 'SHORT' );
if ( isset( $data['post_date'] ) )
{
$data['_post_date'] = $data['post_date'];
@@ -340,7 +340,7 @@ class search_format_forums extends search_format
if ( ! $is_read )
{
$data['_unreadUrl'] = $this->registry->output->buildSEOUrl( 'showtopic=' . $data['tid'] . '&amp;view=getnewpost', 'public', $data['title_seo'], 'showtopicunread' );
$data['_unreadUrl'] = $this->registry->output->buildSEOUrl( 'showtopic=' . $data['tid'] . '&amp;view=getnewpost', 'public', $data['title_seo'], 'showtopic' );
}
/* Icon */
@@ -618,7 +618,7 @@ class search_format_forums extends search_format
$row['tags'] = $this->registry->tags->formatCacheJoinData( $row );
}
$results[ $row['pid'] ] = $this->genericizeResults( $row );
$results[ ( $k == 'tid' ) ? $row['tid'] : $row['pid'] ] = $this->genericizeResults( $row );
}
}