Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -2,19 +2,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Config file
|
||||
* Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
|
||||
* Last Updated: $Date: 2011-04-18 21:34:01 -0400 (Mon, 18 Apr 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5855 $
|
||||
**/
|
||||
* @link http://hatynka.in
|
||||
* @version $Rev: 8370 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
@@ -23,13 +23,20 @@ if ( ! defined( 'IN_IPB' ) )
|
||||
}
|
||||
|
||||
/* Can search with this app */
|
||||
$CONFIG['can_search'] = 1;
|
||||
$CONFIG['can_search'] = 1;
|
||||
|
||||
/* Can view new content with this app */
|
||||
$CONFIG['can_viewNewContent'] = 1;
|
||||
$CONFIG['can_viewNewContent'] = 1;
|
||||
|
||||
/* Can fetch active content with this app */
|
||||
$CONFIG['can_activeContent'] = 1;
|
||||
/* Can further filter VNC by removing non-followed 'categories' */
|
||||
$CONFIG['can_vnc_filter_by_followed'] = 1;
|
||||
$CONFIG['can_vnc_unread_content'] = 1;
|
||||
|
||||
/* Can fetch user generated content */
|
||||
$CONFIG['can_userContent'] = 1;
|
||||
$CONFIG['can_userContent'] = 1;
|
||||
|
||||
/* Can search tags */
|
||||
$CONFIG['can_searchTags'] = 1;
|
||||
|
||||
/* Content types for 'follow', default one first */
|
||||
$CONFIG['followContentTypes'] = array( 'topics', 'forums' );
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Basic Forum Search
|
||||
* Last Updated: $Date: 2010-02-23 12:38:11 +0000 (Tue, 23 Feb 2010) $
|
||||
* Last Updated: $Date: 2011-10-04 16:35:02 -0400 (Tue, 04 Oct 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: matt $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @author $Author: bfarber $
|
||||
* @copyright © 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5861 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Rev: 9580 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -24,10 +24,17 @@ if ( ! defined( 'IN_IPB' ) )
|
||||
|
||||
class search_engine_forums extends search_engine
|
||||
{
|
||||
/**
|
||||
* Forum ids to search - set in secondary methods
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $searchForumIds = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -39,6 +46,7 @@ class search_engine_forums extends search_engine
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
ipsRegistry::setClass( 'class_forums', new $classToLoad( ipsRegistry::instance() ) );
|
||||
ipsRegistry::getClass('class_forums')->strip_invisible = 1;
|
||||
ipsRegistry::getClass('class_forums')->forumsInit();
|
||||
}
|
||||
|
||||
@@ -61,8 +69,8 @@ class search_engine_forums extends search_engine
|
||||
$sort_by = IPSSearchRegistry::get('in.search_sort_by');
|
||||
$sort_order = IPSSearchRegistry::get('in.search_sort_order');
|
||||
$search_term = IPSSearchRegistry::get('in.clean_search_term');
|
||||
$content_title_only = IPSSearchRegistry::get('opt.searchTitleOnly');
|
||||
$post_search_only = IPSSearchRegistry::get('opt.onlySearchPosts');
|
||||
$search_type = IPSSearchRegistry::get('opt.searchType');
|
||||
$search_tags = IPSSearchRegistry::get('in.raw_search_tags');
|
||||
$search_ids = array();
|
||||
$groupby = false;
|
||||
$cType = IPSSearchRegistry::get('contextual.type');
|
||||
@@ -71,16 +79,21 @@ class search_engine_forums extends search_engine
|
||||
/* Contextual search */
|
||||
if ( $cType == 'topic' )
|
||||
{
|
||||
$content_title_only = false;
|
||||
$post_search_only = true;
|
||||
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly', false);
|
||||
IPSSearchRegistry::set('opt.onlySearchPosts', true);
|
||||
IPSSearchRegistry::set('display.onlyTitles', false);
|
||||
$search_type = 'content';
|
||||
IPSSearchRegistry::set('opt.searchType', 'content');
|
||||
IPSSearchRegistry::set('opt.noPostPreview', false);
|
||||
}
|
||||
|
||||
/* If searching tags, we don't show a preview */
|
||||
if( $search_tags )
|
||||
{
|
||||
IPSSearchRegistry::set('opt.noPostPreview', true);
|
||||
IPSSearchRegistry::set('opt.searchType', 'titles');
|
||||
$search_type = 'titles';
|
||||
}
|
||||
|
||||
/* Permissions */
|
||||
$permissions = array();
|
||||
$permissions['TopicSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedTopics( 0 );
|
||||
$permissions['canQueue'] = $this->registry->getClass('class_forums')->canQueuePosts( 0 );
|
||||
$permissions['PostSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( 0 );
|
||||
@@ -107,81 +120,86 @@ class search_engine_forums extends search_engine
|
||||
}
|
||||
|
||||
/* Limit Results */
|
||||
$this->sphinxClient->SetLimits( intval($start), intval($perPage) );
|
||||
$this->sphinxClient->SetLimits( intval($start), $perPage );
|
||||
|
||||
/* Loop through the forums and build a list of forums we're allowed access to */
|
||||
$forumIdsOk = array();
|
||||
$forumIdsBad = array();
|
||||
|
||||
if ( ! empty( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) AND count( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) )
|
||||
if( is_array($this->searchForumIds) AND count($this->searchForumIds) )
|
||||
{
|
||||
foreach( ipsRegistry::$request['search_app_filters']['forums']['forums'] as $forum_id )
|
||||
$forumIdsOk = $this->searchForumIds;
|
||||
}
|
||||
else
|
||||
{
|
||||
$forumIdsOk = array();
|
||||
$forumIdsBad = array();
|
||||
|
||||
if ( ! empty( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) AND count( ipsRegistry::$request['search_app_filters']['forums']['forums'] ) )
|
||||
{
|
||||
if( $forum_id )
|
||||
foreach( ipsRegistry::$request['search_app_filters']['forums']['forums'] as $forum_id )
|
||||
{
|
||||
$data = $this->registry->class_forums->forum_by_id[ $forum_id ];
|
||||
|
||||
/* Check for sub forums */
|
||||
$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
|
||||
|
||||
foreach( $children as $kid )
|
||||
if( $forum_id )
|
||||
{
|
||||
if( ! in_array( $kid, ipsRegistry::$request['search_app_filters']['forums']['forums'] ) )
|
||||
$data = $this->registry->class_forums->forum_by_id[ $forum_id ];
|
||||
|
||||
/* Check for sub forums */
|
||||
$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
|
||||
|
||||
foreach( $children as $kid )
|
||||
{
|
||||
if( ! $this->registry->permissions->check( 'read', $this->registry->class_forums->forum_by_id[ $kid ] ) )
|
||||
if( ! in_array( $kid, ipsRegistry::$request['search_app_filters']['forums']['forums'] ) )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
if( ! $this->registry->permissions->check( 'read', $this->registry->class_forums->forum_by_id[ $kid ] ) )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $kid, 0, 'forum', array(), true ) )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $this->registry->class_forums->forum_by_id[ $kid ]['sub_can_post'] OR ! $this->registry->class_forums->forum_by_id[ $kid ]['can_view_others'] )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
}
|
||||
|
||||
$forumIdsOk[] = $kid;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $kid, 0, 'forum', array(), true ) )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $this->registry->class_forums->forum_by_id[ $kid ]['sub_can_post'] OR ! $this->registry->class_forums->forum_by_id[ $kid ]['can_view_others'] )
|
||||
{
|
||||
$forumIdsBad[] = $kid;
|
||||
continue;
|
||||
}
|
||||
|
||||
$forumIdsOk[] = $kid;
|
||||
}
|
||||
|
||||
/* Can we read? */
|
||||
if ( ! $this->registry->permissions->check( 'view', $data ) )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $forum_id, 0, 'forum', array(), true ) )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $data['sub_can_post'] OR ! $data['can_view_others'] AND !$this->memberData['g_access_cp'] )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
$forumIdsOk[] = $forum_id;
|
||||
}
|
||||
|
||||
/* Can we read? */
|
||||
if ( ! $this->registry->permissions->check( 'view', $data ) )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Can read, but is it password protected, etc? */
|
||||
if ( ! $this->registry->class_forums->forumsCheckAccess( $forum_id, 0, 'forum', array(), true ) )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! $data['sub_can_post'] OR ! $data['can_view_others'] AND !$this->memberData['g_access_cp'] )
|
||||
{
|
||||
$forumIdsBad[] = $forum_id;
|
||||
continue;
|
||||
}
|
||||
|
||||
$forumIdsOk[] = $forum_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! count($forumIdsOk) )
|
||||
{
|
||||
$allowTrashCan = ( $cType == 'forum' ) ? true : false;
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( null, array(), $allowTrashCan );
|
||||
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds();
|
||||
}
|
||||
|
||||
/* Add allowed forums */
|
||||
@@ -204,7 +222,7 @@ class search_engine_forums extends search_engine
|
||||
}
|
||||
|
||||
/* Exclude some items */
|
||||
if ( ! $content_title_only )
|
||||
if ( $search_type != 'titles' )
|
||||
{
|
||||
if ( $permissions['SoftDeleteContent'] AND $permissions['PostSoftDeleteSee'] AND $permissions['canQueue'] )
|
||||
{
|
||||
@@ -265,7 +283,7 @@ class search_engine_forums extends search_engine
|
||||
$this->search_end_timestamp = time() + 100;
|
||||
}
|
||||
|
||||
if ( $content_title_only )
|
||||
if ( $search_type == 'titles' )
|
||||
{
|
||||
$this->sphinxClient->SetFilterRange( 'start_date', $this->search_begin_timestamp, $this->search_end_timestamp );
|
||||
}
|
||||
@@ -275,70 +293,117 @@ class search_engine_forums extends search_engine
|
||||
}
|
||||
}
|
||||
|
||||
if ( IPSSearchRegistry::get('opt.noPostPreview') OR IPSSearchRegistry::get('display.onlyTitles') )
|
||||
if ( IPSSearchRegistry::get('opt.noPostPreview') OR $search_type == 'titles' )
|
||||
{
|
||||
$groupby = true;
|
||||
}
|
||||
|
||||
if ( $content_title_only )
|
||||
|
||||
/* Check tags */
|
||||
$_tag = '';
|
||||
$tagIds = array();
|
||||
|
||||
if ( $search_tags && $this->settings['tags_enabled'] )
|
||||
{
|
||||
if ( $sort_order == 'asc' )
|
||||
$search_tags = explode( ",", $search_tags );
|
||||
|
||||
$this->DB->build( array( 'select' => 'tag_id',
|
||||
'from' => 'core_tags',
|
||||
'where' => 'tag_meta_app=\'forums\' AND tag_meta_area=\'topics\' AND (' . $this->DB->buildLikeChain( 'tag_text', $search_tags, false ) . ')',
|
||||
'limit' => array( 0, 500 ) ) );
|
||||
|
||||
$o = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $o ) )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_ASC, $sortKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, $sortKey );
|
||||
$tagIds[] = $row['tag_id'];
|
||||
}
|
||||
|
||||
if ( $groupby )
|
||||
if ( count( $tagIds ) )
|
||||
{
|
||||
$this->sphinxClient->SetGroupBy( 'last_post_group', SPH_GROUPBY_ATTR, '@group ' . $sort_order );
|
||||
$this->sphinxClient->SetFilter( 'tag_id', $tagIds );
|
||||
}
|
||||
|
||||
$_s = ( $search_term ) ? '@title ' . $search_term : '';
|
||||
|
||||
$result = $this->sphinxClient->Query( $_s, 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
|
||||
$this->logSphinxWarnings();
|
||||
}
|
||||
|
||||
/* Set sort order */
|
||||
if ( $sort_order == 'asc' )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_ASC, $sortKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $groupby )
|
||||
{
|
||||
$this->sphinxClient->SetGroupBy( 'last_post_group', SPH_GROUPBY_ATTR, '@group DESC');
|
||||
}
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, $sortKey );
|
||||
}
|
||||
|
||||
/* Generate sphinx search query */
|
||||
switch( $search_type )
|
||||
{
|
||||
case 'titles':
|
||||
/* Group by */
|
||||
if ( $groupby )
|
||||
{
|
||||
/* @link http://community.invisionpower.com/topic/335036-sphinx-vncactive-content-sorting/ */
|
||||
$this->sphinxClient->SetGroupDistinct ( "tid" );
|
||||
$this->sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, '@group ' . $sort_order );
|
||||
}
|
||||
|
||||
$_s = ( $search_term ) ? '@title ' . $search_term : '';
|
||||
break;
|
||||
|
||||
if ( $sort_order == 'asc' )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_ASC, $sortKeyPost );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, $sortKeyPost );
|
||||
}
|
||||
case 'content':
|
||||
/* Group by */
|
||||
if ( $groupby )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_EXTENDED, $sortKeyPost . ' DESC' );
|
||||
$this->sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, 'last_post ' . $sort_order );
|
||||
|
||||
IPSSearchRegistry::set('set.searchResultType', 'both' );
|
||||
}
|
||||
|
||||
|
||||
if ( $post_search_only )
|
||||
{
|
||||
$_s = ( $search_term ) ? '@post ' . $search_term : '';
|
||||
$result = $this->sphinxClient->Query( $_s, 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$_s = ( $search_term AND strstr( $search_term, '"' ) ) ? '@post ' . $search_term . ' | @title ' . $search_term : ( $search_term ? '@(post,title) ' . $search_term : '' );
|
||||
$result = $this->sphinxClient->Query( $_s, 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
}
|
||||
break;
|
||||
|
||||
$this->logSphinxWarnings();
|
||||
case 'both':
|
||||
default:
|
||||
/* Group by */
|
||||
if ( $groupby )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_EXTENDED, $sortKeyPost . ' DESC' );
|
||||
$this->sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, 'last_post ' . $sort_order );
|
||||
}
|
||||
|
||||
IPSSearchRegistry::set('set.searchResultType', 'both' );
|
||||
|
||||
$_s = ( $search_term AND strstr( $search_term, '"' ) ) ? '@post ' . $search_term . ' | @title ' . $search_term : ( $search_term ? '@(post,title) ' . $search_term : '' );
|
||||
break;
|
||||
}
|
||||
|
||||
/* Perform search */
|
||||
$result = $this->sphinxClient->Query( $_s . $_tag, $this->settings['sphinx_prefix'] . 'forums_search_posts_main, ' . $this->settings['sphinx_prefix'] . 'forums_search_posts_delta' );
|
||||
|
||||
/* Log errors */
|
||||
$this->logSphinxWarnings();
|
||||
|
||||
/* Get result ids */
|
||||
if ( is_array( $result['matches'] ) && count( $result['matches'] ) )
|
||||
{
|
||||
$c = 0;
|
||||
|
||||
foreach( $result['matches'] as $res )
|
||||
{
|
||||
$search_ids[] = ( $content_title_only ) ? $res['attrs']['tid'] : $res['attrs']['search_id'];
|
||||
$search_ids[] = ( $search_type == 'titles' && IPSSearchRegistry::get('set.searchResultType') != 'both' ) ? $res['attrs']['tid'] : $res['attrs']['search_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Set return type */
|
||||
if ( $search_type == 'titles' )
|
||||
{
|
||||
IPSSearchRegistry::set('set.returnType', 'tids' );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPSSearchRegistry::set('set.returnType', 'pids' );
|
||||
}
|
||||
|
||||
/* Return it */
|
||||
return array( 'count' => intval( $result['total_found'] ) > 1000 ? 1000 : $result['total_found'], 'resultSet' => $search_ids );
|
||||
@@ -352,38 +417,53 @@ class search_engine_forums extends search_engine
|
||||
*/
|
||||
public function viewUserContent( $member )
|
||||
{
|
||||
/* Ensure we limit by date */
|
||||
$this->settings['search_ucontent_days'] = ( $this->settings['search_ucontent_days'] ) ? $this->settings['search_ucontent_days'] : 365;
|
||||
|
||||
/* Bit of init */
|
||||
$time = time() - ( 86400 * intval( $this->settings['search_ucontent_days'] ) );
|
||||
$time = ( $member['last_post'] ? $member['last_post'] : time() ) - ( 86400 * intval( $this->settings['search_ucontent_days'] ) );
|
||||
$sort_by = IPSSearchRegistry::get('in.search_sort_by');
|
||||
$sort_order = IPSSearchRegistry::get('in.search_sort_order');
|
||||
|
||||
switch( IPSSearchRegistry::get('in.userMode') )
|
||||
{
|
||||
default:
|
||||
case 'all':
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly', false );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , true );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , false );
|
||||
IPSSearchRegistry::set('opt.searchType', 'both');
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , true );
|
||||
break;
|
||||
case 'title':
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly', true );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , true );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , false );
|
||||
IPSSearchRegistry::set('opt.searchType', 'titles');
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , true );
|
||||
break;
|
||||
case 'content':
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly', false );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , false );
|
||||
IPSSearchRegistry::set('opt.searchType', 'content');
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , false );
|
||||
break;
|
||||
}
|
||||
|
||||
/* Sorting */
|
||||
switch( $sort_by )
|
||||
{
|
||||
default:
|
||||
case 'date':
|
||||
$sortKey = 'last_post';
|
||||
$sortKeyPost = 'post_date';
|
||||
break;
|
||||
case 'title':
|
||||
$sortKeyPost = $sortKey = 'tordinal';
|
||||
break;
|
||||
case 'posts':
|
||||
$sortKeyPost = $sortKey = 'posts';
|
||||
break;
|
||||
case 'views':
|
||||
$sortKeyPost = $sortKey = 'views';
|
||||
break;
|
||||
}
|
||||
|
||||
/* Init */
|
||||
$start = IPSSearchRegistry::get('in.start');
|
||||
$perPage = IPSSearchRegistry::get('opt.search_per_page');
|
||||
|
||||
IPSSearchRegistry::set('in.search_sort_by' , 'date' );
|
||||
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
|
||||
|
||||
//IPSSearchRegistry::set('in.search_sort_by' , 'date' );
|
||||
//IPSSearchRegistry::set('in.search_sort_order', 'desc' );
|
||||
|
||||
/* Limit Results */
|
||||
$this->sphinxClient->SetLimits( intval($start), intval($perPage) );
|
||||
@@ -409,6 +489,7 @@ class search_engine_forums extends search_engine
|
||||
}
|
||||
|
||||
/* Set up perms */
|
||||
$permissions = array();
|
||||
$permissions['TopicSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedTopics( 0 );
|
||||
$permissions['canQueue'] = $this->registry->getClass('class_forums')->canQueuePosts( 0 );
|
||||
$permissions['PostSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( 0 );
|
||||
@@ -459,42 +540,72 @@ class search_engine_forums extends search_engine
|
||||
}
|
||||
}
|
||||
|
||||
if ( IPSSearchRegistry::get('in.userMode') == 'title' )
|
||||
/* Perform 'search' */
|
||||
/* We have to sort by topic last post date for 'both' otherwise the topics will appear in random order. Even though it's correctly ordering by YOUR post
|
||||
date, the user just sees the list of topics with random last post date ordering. In a future version it would be nice to change the last post column
|
||||
on 'view user content' to show something like "you last posted on x date" instead of showing the topic last poster and last post date.
|
||||
@link http://community.invisionpower.com/tracker/issue-33692-my-content-second-page */
|
||||
if ( IPSSearchRegistry::get('in.userMode') == 'title' OR IPSSearchRegistry::get('in.userMode') == 'all' )
|
||||
{
|
||||
/* Set return type */
|
||||
IPSSearchRegistry::set('set.returnType', 'tids' );
|
||||
|
||||
$this->sphinxClient->SetGroupDistinct ( "tid" );
|
||||
$this->sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, '@group DESC' );
|
||||
$this->sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, $sortKey . ' ' . $sort_order );
|
||||
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, 'last_post' );
|
||||
|
||||
$result = $this->sphinxClient->Query( '', 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
|
||||
$this->logSphinxWarnings();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( IPSSearchRegistry::get('in.userMode') == 'content' )
|
||||
if ( $sort_order == 'asc' )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, 'post_date' );
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_ASC, $sortKey );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, 'post_date' );
|
||||
$this->sphinxClient->SetGroupBy( 'last_post_group', SPH_GROUPBY_ATTR, '@group desc' );
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, $sortKey );
|
||||
}
|
||||
|
||||
$result = $this->sphinxClient->Query( '', 'forums_search_posts_main,forums_search_posts_delta' );
|
||||
|
||||
$this->logSphinxWarnings();
|
||||
$result = $this->sphinxClient->Query( '', $this->settings['sphinx_prefix'] . 'forums_search_posts_main,' . $this->settings['sphinx_prefix'] . 'forums_search_posts_delta' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set return type */
|
||||
if( IPSSearchRegistry::get('in.userMode') == 'all' )
|
||||
{
|
||||
IPSSearchRegistry::set('set.returnType', 'tids' );
|
||||
}
|
||||
else
|
||||
{
|
||||
IPSSearchRegistry::set('set.returnType', 'pids' );
|
||||
}
|
||||
|
||||
if ( $sort_order == 'asc' )
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_ASC, $sortKeyPost );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sphinxClient->SetSortMode( SPH_SORT_ATTR_DESC, $sortKeyPost );
|
||||
}
|
||||
|
||||
if ( IPSSearchRegistry::get('in.userMode') != 'content' )
|
||||
{
|
||||
$this->sphinxClient->SetGroupBy( 'tid', SPH_GROUPBY_ATTR, $sortKeyPost . ' ' . $sort_order );
|
||||
}
|
||||
|
||||
$result = $this->sphinxClient->Query( '', $this->settings['sphinx_prefix'] . 'forums_search_posts_main,' . $this->settings['sphinx_prefix'] . 'forums_search_posts_delta' );
|
||||
}
|
||||
|
||||
/* Log warnings */
|
||||
$this->logSphinxWarnings();
|
||||
|
||||
/* Get result ids */
|
||||
if ( is_array( $result['matches'] ) && count( $result['matches'] ) )
|
||||
{
|
||||
foreach( $result['matches'] as $res )
|
||||
{
|
||||
$search_ids[] = ( IPSSearchRegistry::get('opt.searchTitleOnly') ) ? $res['attrs']['tid'] : $res['attrs']['search_id'];
|
||||
$search_ids[] = ( IPSSearchRegistry::get('set.returnType') == 'tids' ) ? $res['attrs']['tid'] : $res['attrs']['search_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Return results */
|
||||
return array( 'count' => intval( $result['total_found'] ) > 1000 ? 1000 : $result['total_found'], 'resultSet' => $search_ids );
|
||||
}
|
||||
|
||||
@@ -507,50 +618,102 @@ class search_engine_forums extends search_engine
|
||||
*/
|
||||
public function viewNewContent()
|
||||
{
|
||||
$tids = $this->registry->getClass('classItemMarking')->fetchCookieData( 'forums', 'items' );
|
||||
$oldStamp = $this->registry->getClass('classItemMarking')->fetchOldestUnreadTimestamp( array(), 'forums' );
|
||||
$check = IPS_UNIX_TIME_NOW - ( 86400 * 90 );
|
||||
$forumIdsOk = array();
|
||||
$oldStamp = $this->registry->getClass('classItemMarking')->fetchOldestUnreadTimestamp( array(), 'forums' );
|
||||
$check = IPS_UNIX_TIME_NOW - ( 86400 * $this->settings['topic_marking_keep_days'] );
|
||||
$forumIdsOk = array();
|
||||
$start = IPSSearchRegistry::get('in.start');
|
||||
$perPage = IPSSearchRegistry::get('opt.search_per_page');
|
||||
$seconds = IPSSearchRegistry::get('in.period_in_seconds');
|
||||
$followedOnly = $this->memberData['member_id'] ? IPSSearchRegistry::get('in.vncFollowFilterOn' ) : false;
|
||||
$permissions = array();
|
||||
|
||||
/* Loop through the forums and build a list of forums we're allowed access to */
|
||||
$bvnp = explode( ',', $this->settings['vnp_block_forums'] );
|
||||
|
||||
IPSSearchRegistry::set('in.search_sort_by' , 'date' );
|
||||
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly' , true );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , true );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , true );
|
||||
IPSSearchRegistry::set('opt.searchType' , 'titles' );
|
||||
|
||||
$followedForums = array();
|
||||
$followedTopics = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Only content we have participated in?
|
||||
//-----------------------------------------
|
||||
|
||||
if( IPSSearchRegistry::get('in.userMode') )
|
||||
{
|
||||
$_tempResults = $this->viewUserContent( $this->memberData );
|
||||
|
||||
if( $_tempResults['count'] )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'tid', $_tempResults['resultSet'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
return array( 'count' => 0, 'resultSet' => array() );
|
||||
}
|
||||
|
||||
switch( IPSSearchRegistry::get('in.userMode') )
|
||||
{
|
||||
default:
|
||||
case 'all':
|
||||
case 'content':
|
||||
IPSSearchRegistry::set('opt.searchType', 'both' );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , true );
|
||||
break;
|
||||
case 'title':
|
||||
IPSSearchRegistry::set('opt.searchType', 'titles' );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set return type */
|
||||
IPSSearchRegistry::set('set.returnType', 'tids' );
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$_forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'], $bvnp );
|
||||
|
||||
if ( ! $this->memberData['bw_vnc_type'] )
|
||||
$_forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'], ( $followedOnly ) ? array() : $bvnp );
|
||||
|
||||
/* Fetch forum rel ids */
|
||||
if ( $followedOnly )
|
||||
{
|
||||
$oldStamp = IPSLib::fetchHighestNumber( array( intval( $this->memberData['_cache']['gb_mark__forums'] ), intval( $this->memberData['last_visit'] ) ) );
|
||||
$tids = array();
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/like/composite.php' );/*noLibHook*/
|
||||
|
||||
$forumIdsOk = $_forumIdsOk;
|
||||
/* @link http://community.invisionpower.com/tracker/issue-33284-view-new-content-just-items-i-follow */
|
||||
//$like = classes_like::bootstrap( 'forums', 'forums' );
|
||||
|
||||
//$followedForums = $like->getDataByMemberIdAndArea( $this->memberData['member_id'] );
|
||||
$followedForums = array(); //( $followedForums === null ) ? array() : array_keys( $followedForums );
|
||||
|
||||
$like = classes_like::bootstrap( 'forums', 'topics' );
|
||||
|
||||
$followedTopics = $like->getDataByMemberIdAndArea( $this->memberData['member_id'] );
|
||||
$followedTopics = ( $followedTopics === null ) ? array() : array_keys( $followedTopics );
|
||||
}
|
||||
|
||||
/* What type of date restriction? */
|
||||
if ( IPSSearchRegistry::get('in.period_in_seconds') !== false )
|
||||
{
|
||||
$oldStamp = ( time() - $seconds );
|
||||
$forumIdsOk = $_forumIdsOk;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( $_forumIdsOk as $id )
|
||||
{
|
||||
if ( $followedOnly && ! in_array( $id, $followedForums ) )
|
||||
{
|
||||
// We don't want to skip followed topics just because we don't follow the forum
|
||||
//continue;
|
||||
}
|
||||
|
||||
$lMarked = $this->registry->getClass('classItemMarking')->fetchTimeLastMarked( array( 'forumID' => $id ), 'forums' );
|
||||
$fData = $this->registry->getClass('class_forums')->forumsFetchData( $id );
|
||||
|
||||
if ( $fData['last_post'] > $lMarked )
|
||||
{
|
||||
/* Add to tids */
|
||||
$_tids = $this->registry->getClass('classItemMarking')->fetchReadIds( array( 'forumID' => $id ), 'forums', false );
|
||||
|
||||
if ( is_array( $_tids ) )
|
||||
{
|
||||
foreach( $_tids as $k => $v )
|
||||
{
|
||||
$tids[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$forumIdsOk[ $id ] = $id;
|
||||
}
|
||||
}
|
||||
@@ -580,86 +743,137 @@ class search_engine_forums extends search_engine
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/* Set the timestamps */
|
||||
$this->sphinxClient->SetFilterRange( 'last_post', $oldStamp, time() );
|
||||
$this->setDateRange( 0, 0 );
|
||||
|
||||
/* Force it into filter so that search can pick it up */
|
||||
ipsRegistry::$request['search_app_filters']['forums']['forums'] = $forumIdsOk;
|
||||
|
||||
/* Try and limit the TIDS */
|
||||
if ( is_array( $tids ) AND count( $tids ) )
|
||||
{
|
||||
if ( count( $tids ) > 300 )
|
||||
{
|
||||
/* Sort by last read date */
|
||||
arsort( $tids, SORT_NUMERIC );
|
||||
$tids = array_slice( $tids, 0, 300 );
|
||||
}
|
||||
|
||||
$this->DB->build( array( 'select' => 'tid, last_post',
|
||||
'from' => 'topics',
|
||||
'where' => "tid IN (" . implode( ",", array_keys( $tids ) ) . ')' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
/* Posted in since last read? */
|
||||
if ( $row['last_post'] > $tids[ $row['tid'] ] )
|
||||
{
|
||||
unset( $tids[ $row['tid'] ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $tids ) )
|
||||
{
|
||||
$tids = array_keys( $tids );
|
||||
}
|
||||
}
|
||||
|
||||
/* Set read tids */
|
||||
if ( count( $tids ) )
|
||||
{
|
||||
$this->sphinxClient->SetFilter( 'tid', $tids, TRUE );
|
||||
}
|
||||
$this->searchForumIds = $forumIdsOk;
|
||||
|
||||
/* Set up some vars */
|
||||
IPSSearchRegistry::set('set.resultCutToDate', $oldStamp );
|
||||
|
||||
return $this->search();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the search
|
||||
* Populates $this->_count and $this->_results
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function viewActiveContent()
|
||||
{
|
||||
$seconds = IPSSearchRegistry::get('in.period_in_seconds');
|
||||
/* Fetch first 300 results */
|
||||
IPSSearchRegistry::set('opt.search_per_page', 300);
|
||||
IPSSearchRegistry::set('in.start', 0);
|
||||
|
||||
/* Run search */
|
||||
$data = $this->search();
|
||||
|
||||
/* Loop through the forums and build a list of forums we're allowed access to */
|
||||
$bvnp = explode( ',', $this->settings['vnp_block_forums'] );
|
||||
/* Reset for display function */
|
||||
IPSSearchRegistry::set('in.start', $start);
|
||||
IPSSearchRegistry::set('opt.search_per_page', $perPage);
|
||||
|
||||
IPSSearchRegistry::set('in.search_sort_by' , 'date' );
|
||||
IPSSearchRegistry::set('in.search_sort_order', 'desc' );
|
||||
IPSSearchRegistry::set('opt.searchTitleOnly' , true );
|
||||
IPSSearchRegistry::set('display.onlyTitles' , true );
|
||||
IPSSearchRegistry::set('opt.noPostPreview' , true );
|
||||
$_ffWhere = '';
|
||||
|
||||
/* Get list of good forum IDs */
|
||||
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds( $this->memberData['member_id'], $bvnp );
|
||||
/* Followed topics only */
|
||||
if ( $followedOnly )
|
||||
{
|
||||
if ( ! count( $followedTopics ) && ! count( $followedForums ) )
|
||||
{
|
||||
return array( 'count' => 0, 'resultSet' => array() );
|
||||
}
|
||||
|
||||
if ( count( $followedForums ) )
|
||||
{
|
||||
/* @link http://community.invisionpower.com/tracker/issue-33284-view-new-content-just-items-i-follow */
|
||||
//$_ffWhere = ' OR forum_id IN (' . implode( ',', $followedForums ) . ') ';
|
||||
}
|
||||
}
|
||||
|
||||
/* This method allows us to have just one "tid IN()" clause, instead of two, depending on scenario */
|
||||
if ( count($followedTopics) )
|
||||
{
|
||||
$where[] = "( tid IN(" . implode( ',', $followedTopics ) . ')' . $_ffWhere . ' )';
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !count($data['resultSet']) )
|
||||
{
|
||||
return array( 'count' => 0, 'resultSet' => array() );
|
||||
}
|
||||
|
||||
/* Force it into filter so that search can pick it up */
|
||||
ipsRegistry::$request['search_app_filters']['forums']['forums'] = $forumIdsOk;
|
||||
$where[] = "( tid IN(" . implode( ',', $data['resultSet'] ) . ')' . $_ffWhere . ' )';
|
||||
}
|
||||
|
||||
/* Set the timestamps */
|
||||
$this->sphinxClient->SetFilterRange( 'last_post', intval( time() - $seconds ), time() );
|
||||
$this->setDateRange( 0, 0 );
|
||||
$permissions['TopicSoftDeleteSee'] = $this->registry->getClass('class_forums')->canSeeSoftDeletedTopics( 0 );
|
||||
$permissions['canQueue'] = $this->registry->getClass('class_forums')->canQueuePosts( 0 );
|
||||
|
||||
return $this->search();
|
||||
if ( $permissions['TopicSoftDeleteSee'] AND $permissions['canQueue'] )
|
||||
{
|
||||
$where[] = $this->registry->class_forums->fetchTopicHiddenQuery( array( 'visible', 'hidden', 'sdeleted' ) );
|
||||
}
|
||||
else if ( $permissions['TopicSoftDeleteSee'] )
|
||||
{
|
||||
$where[] = $this->registry->class_forums->fetchTopicHiddenQuery( array( 'visible', 'sdeleted' ) );
|
||||
}
|
||||
else if ( $permissions['canQueue'] )
|
||||
{
|
||||
$where[] = $this->registry->class_forums->fetchTopicHiddenQuery( array( 'visible', 'hidden' ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$where[] = $this->registry->class_forums->fetchTopicHiddenQuery( array( 'visible' ) );
|
||||
}
|
||||
|
||||
$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 );
|
||||
|
||||
$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 ) )
|
||||
{
|
||||
$rtids[ $row['tid'] ] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set up some vars */
|
||||
IPSSearchRegistry::set('set.resultCutToDate', $oldStamp );
|
||||
|
||||
if ( IPSSearchRegistry::get('in.period') == 'unread' )
|
||||
{
|
||||
$filter = $this->registry->class_forums->postProcessVncTids( $rtids, array( $start, $perPage ) );
|
||||
$data['count'] = $filter['count'];
|
||||
$data['resultSet'] = $filter['tids'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = array( 'count' => $count['count'], 'resultSet' => array_keys( $rtids) );
|
||||
}
|
||||
|
||||
/* Return it */
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -667,7 +881,7 @@ class search_engine_forums extends search_engine
|
||||
*
|
||||
* @param string $column sql table column for this condition
|
||||
* @return string column
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function remapColumn( $column )
|
||||
{
|
||||
@@ -681,7 +895,7 @@ class search_engine_forums extends search_engine
|
||||
/**
|
||||
* Returns an array used in the searchplugin's setCondition method
|
||||
*
|
||||
* @param array $data Array of forums to view
|
||||
* @param array $data Array of filters to apply
|
||||
* @return array Array with column, operator, and value keys, for use in the setCondition call
|
||||
*/
|
||||
public function buildFilterSQL( $data )
|
||||
@@ -691,7 +905,11 @@ class search_engine_forums extends search_engine
|
||||
|
||||
/* Set up some defaults */
|
||||
IPSSearchRegistry::set( 'opt.noPostPreview' , true );
|
||||
IPSSearchRegistry::set( 'opt.onlySearchPosts', false );
|
||||
|
||||
if ( ! IPSSearchRegistry::get('opt.searchType' ) )
|
||||
{
|
||||
IPSSearchRegistry::set( 'opt.searchType', 'both' );
|
||||
}
|
||||
|
||||
if( isset( $data ) && is_array( $data ) && count( $data ) )
|
||||
{
|
||||
@@ -703,12 +921,6 @@ class search_engine_forums extends search_engine
|
||||
IPSSearchRegistry::set( 'opt.noPostPreview', false );
|
||||
}
|
||||
|
||||
/* CONTENT ONLY */
|
||||
if ( $field == 'contentOnly' AND $_data['contentOnly'] == 1 )
|
||||
{
|
||||
IPSSearchRegistry::set( 'opt.onlySearchPosts', true );
|
||||
}
|
||||
|
||||
/* POST COUNT */
|
||||
if ( $field == 'pCount' AND intval( $_data['pCount'] ) > 0 )
|
||||
{
|
||||
@@ -726,7 +938,7 @@ class search_engine_forums extends search_engine
|
||||
}
|
||||
else
|
||||
{
|
||||
return '';
|
||||
return array();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Returns HTML for the form (optional class, not required)
|
||||
* Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
|
||||
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5855 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Rev: 8644 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -27,7 +27,7 @@ class search_form_forums
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Formats forum search results
|
||||
* Last Updated: $Date: 2010-02-19 01:29:54 +0000 (Fri, 19 Feb 2010) $
|
||||
* Last Updated: $Date: 2011-10-17 10:49:01 -0400 (Mon, 17 Oct 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $author$
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Forums
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 5855 $
|
||||
* @link http://hatynka.in
|
||||
* @version $Rev: 9629 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -27,7 +27,7 @@ class search_format_forums extends search_format
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -36,15 +36,85 @@ class search_format_forums extends search_format
|
||||
{
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums' );
|
||||
ipsRegistry::setClass( 'class_forums', new $classToLoad( ipsRegistry::instance() ) );
|
||||
ipsRegistry::getClass('class_forums')->strip_invisible = 1;
|
||||
ipsRegistry::getClass('class_forums')->forumsInit();
|
||||
}
|
||||
|
||||
/* Load tagging stuff */
|
||||
if ( ! $registry->isClassLoaded('tags') )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php' );/*noLibHook*/
|
||||
$registry->setClass( 'tags', classes_tags_bootstrap::run( 'forums', 'topics' ) );
|
||||
}
|
||||
|
||||
parent::__construct( $registry );
|
||||
|
||||
/* Set up wrapper */
|
||||
$this->templates = array( 'group' => 'search', 'template' => 'searchResultsAsForum' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the output for the followed content results
|
||||
*
|
||||
* @param array $results Array of results to show
|
||||
* @param array $followData Meta data from follow/like system
|
||||
* @return @e string
|
||||
*/
|
||||
public function parseFollowedContentOutput( $results, $followData )
|
||||
{
|
||||
/* Topics? */
|
||||
if( IPSSearchRegistry::get('in.followContentType') == 'topics' )
|
||||
{
|
||||
return $this->registry->output->getTemplate('search')->followedContentForumsWrapper( $this->parseAndFetchHtmlBlocks( $this->processFollowedResults( $results, $followData ) ) );
|
||||
}
|
||||
/* Or forums? */
|
||||
else
|
||||
{
|
||||
$forums = array();
|
||||
$member_ids = array();
|
||||
|
||||
if( count($results) )
|
||||
{
|
||||
/* Get forum data */
|
||||
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'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Merge in follow data */
|
||||
foreach( $followData as $_follow )
|
||||
{
|
||||
$forums[ $_follow['like_rel_id'] ]['_followData'] = $_follow;
|
||||
}
|
||||
|
||||
/* And get latest member info */
|
||||
if( count($member_ids) )
|
||||
{
|
||||
$_members = IPSMember::load( array_unique($member_ids), 'members,profile_portal' );
|
||||
|
||||
foreach( $member_ids as $forumId => $memberId )
|
||||
{
|
||||
$_member = $_members[ $memberId ];
|
||||
|
||||
if( $_member['member_id'] )
|
||||
{
|
||||
$_member = IPSMember::buildDisplayData( $_member, array( 'reputation' => 0, 'warn' => 0 ) );
|
||||
|
||||
$forums[ $forumId ] = array_merge( $_member, $forums[ $forumId ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->registry->output->getTemplate('search')->followedContentForumsWrapperForums( $forums );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse search results
|
||||
*
|
||||
@@ -57,13 +127,10 @@ class search_format_forums extends search_format
|
||||
$sub = false;
|
||||
$isVnc = false;
|
||||
$search_term = IPSSearchRegistry::get('in.clean_search_term');
|
||||
$onlyPosts = IPSSearchRegistry::get('opt.onlySearchPosts');
|
||||
$onlyTitles = IPSSearchRegistry::get('display.onlyTitles');
|
||||
$noPostPreview = IPSSearchRegistry::get('opt.noPostPreview');
|
||||
$results = array();
|
||||
$attachPids = array();
|
||||
$results = array();
|
||||
|
||||
|
||||
/* loop and process */
|
||||
foreach( $rows as $id => $data )
|
||||
{
|
||||
@@ -79,20 +146,25 @@ class search_format_forums extends search_format
|
||||
$data['_last_post'] = $data['last_post'];
|
||||
$data['_longTitle'] = $data['content_title'];
|
||||
$data['_shortTitle'] = IPSText::truncate( $data['content_title'], 60 );
|
||||
$data['last_poster'] = $data['last_poster_id'] ? IPSLib::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['starter'] = $data['starter_id'] ? IPSLib::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' );
|
||||
$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['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'];
|
||||
$data['post_date'] = $this->registry->getClass( 'class_localization')->getDate( $data['post_date'], 'SHORT' );
|
||||
//$data['post_date'] = $this->registry->getClass( 'class_localization')->getDate( $data['post_date'], 'SHORT' );
|
||||
}
|
||||
|
||||
if ( $this->memberData['is_mod'] )
|
||||
|
||||
if ( $this->registry->getClass('class_forums')->canQueuePosts( $forum['id'] ) )
|
||||
{
|
||||
$data['posts'] += intval($data['topic_queuedposts']);
|
||||
}
|
||||
|
||||
if( $this->registry->getClass('class_forums')->canSeeSoftDeletedPosts( $forum['id'] ) )
|
||||
{
|
||||
$data['posts'] += intval($data['topic_deleted_posts']);
|
||||
}
|
||||
|
||||
if ( $data['posts'])
|
||||
{
|
||||
@@ -118,36 +190,43 @@ class search_format_forums extends search_format
|
||||
{
|
||||
$data['pages'][] = array( 'last' => 1,
|
||||
'st' => ($pages - 1) * $this->settings['display_max_posts'],
|
||||
'page' => $pages );
|
||||
'page' => $pages,
|
||||
'total' => $pages);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['pages'][] = array( 'last' => 0,
|
||||
'st' => $real_no,
|
||||
'page' => $page_no );
|
||||
'page' => $page_no,
|
||||
'total' => $pages );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* For-matt some stuffs */
|
||||
if ( ! $data['cache_content'] )
|
||||
if ( IPSSearchRegistry::get('opt.noPostPreview') != true )
|
||||
{
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $data['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $forum['use_html'] and $this->caches['group_cache'][ $data['member_group_id'] ]['g_dohtml'] and $data['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $data['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $forum['use_ibc'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $data['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $data['mgroup_others'];
|
||||
if ( ! $data['cache_content'] )
|
||||
{
|
||||
IPSText::getTextClass( 'bbcode' )->parse_smilies = $data['use_emo'];
|
||||
IPSText::getTextClass( 'bbcode' )->parse_html = ( $forum['use_html'] and $this->caches['group_cache'][ $data['member_group_id'] ]['g_dohtml'] and $data['post_htmlstate'] ) ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_nl2br = $data['post_htmlstate'] == 2 ? 1 : 0;
|
||||
IPSText::getTextClass( 'bbcode' )->parse_bbcode = $forum['use_ibc'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_section = 'topics';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $data['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $data['mgroup_others'];
|
||||
|
||||
$data['post'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $data['post'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['post'] = '<!--cached-' . gmdate( 'r', $data['cache_updated'] ) . '-->' . $data['cache_content'];
|
||||
}
|
||||
|
||||
$data['post'] = IPSText::searchHighlight( $data['post'], $search_term );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['post'] = '<!--cached-' . gmdate( 'r', $data['cache_updated'] ) . '-->' . $data['cache_content'];
|
||||
}
|
||||
|
||||
$data['post'] = IPSText::searchHighlight( IPSText::getTextClass( 'bbcode' )->preDisplayParse( $data['post'] ), $search_term );
|
||||
|
||||
|
||||
/* Has attachments */
|
||||
if ( $data['topic_hasattach'] )
|
||||
{
|
||||
@@ -156,9 +235,9 @@ class search_format_forums extends search_format
|
||||
|
||||
$rows[ $id ] = $data;
|
||||
}
|
||||
|
||||
|
||||
/* Attachments */
|
||||
if ( count( $attachPids ) )
|
||||
if ( count( $attachPids ) AND IPSSearchRegistry::get('set.returnType') != 'tids' )
|
||||
{
|
||||
/* Load attachments class */
|
||||
if ( ! is_object( $this->class_attach ) )
|
||||
@@ -169,8 +248,8 @@ class search_format_forums extends search_format
|
||||
$this->class_attach->init();
|
||||
}
|
||||
|
||||
$attachHTML = $this->class_attach->renderAttachments( array( $data['pid'] => $data['post'] ), array_keys( $attachPids ) );
|
||||
|
||||
$attachHTML = $this->class_attach->renderAttachments( $attachPids, array_keys( $attachPids ) );
|
||||
|
||||
/* Now parse back in the rendered posts */
|
||||
if( is_array($attachHTML) AND count($attachHTML) )
|
||||
{
|
||||
@@ -181,7 +260,7 @@ class search_format_forums extends search_format
|
||||
{
|
||||
$_data['html'] = IPSText::stripAttachTag( $_data['html'] );
|
||||
}
|
||||
|
||||
|
||||
$rows[ $id ]['post'] = $_data['html'];
|
||||
$rows[ $id ]['attachmentHtml'] = $_data['attachmentHtml'];
|
||||
}
|
||||
@@ -194,7 +273,7 @@ class search_format_forums extends search_format
|
||||
/* Format content */
|
||||
list( $html, $sub ) = $this->formatContent( $data );
|
||||
|
||||
$results[ $id ] = array( 'html' => $html, 'app' => $data['app'], 'type' => $data['type'], 'sub' => $sub );
|
||||
$results[ $id ] = array( 'html' => $html, 'app' => $data['app'], 'type' => $data['type'], 'sub' => $sub, '_followData' => !empty($data['_followData']) ? $data['_followData'] : array() );
|
||||
}
|
||||
|
||||
return $results;
|
||||
@@ -208,8 +287,7 @@ class search_format_forums extends search_format
|
||||
*/
|
||||
public function formatContent( $data )
|
||||
{
|
||||
$onlyPosts = IPSSearchRegistry::get('opt.onlySearchPosts');
|
||||
$onlyTitles = IPSSearchRegistry::get('display.onlyTitles');
|
||||
$onlyTitles = IPSSearchRegistry::searchTitleOnly();
|
||||
$noPostPreview = IPSSearchRegistry::get('opt.noPostPreview');
|
||||
|
||||
/* Forum Breadcrum */
|
||||
@@ -221,10 +299,15 @@ class search_format_forums extends search_format
|
||||
/* Has posted dot */
|
||||
$show_dots = ( $this->settings['show_user_posted'] AND $this->memberData['member_id'] AND $data['_hasPosted'] ) ? 1 : 0;
|
||||
|
||||
if ( ! $is_read )
|
||||
{
|
||||
$data['_unreadUrl'] = $this->registry->output->buildSEOUrl( 'showtopic=' . $data['tid'] . '&view=getnewpost', 'public', $data['title_seo'], 'showtopicunread' );
|
||||
}
|
||||
|
||||
/* Icon */
|
||||
$data['_icon'] = $this->registry->getClass( 'class_forums' )->fetchTopicFolderIcon( $data, $show_dots, $is_read );
|
||||
$data['_isRead'] = $is_read;
|
||||
|
||||
|
||||
/* Display type */
|
||||
return array( $this->registry->getClass( 'output' )->getTemplate( 'search' )->topicPostSearchResultAsForum( $data, ( $onlyTitles || $noPostPreview ) ? 1 : 0 ), 0 );
|
||||
}
|
||||
@@ -233,17 +316,37 @@ class search_format_forums extends search_format
|
||||
* Formats / grabs extra data for results
|
||||
* Takes an array of IDS (can be IDs from anything) and returns an array of expanded data.
|
||||
*
|
||||
* @param array $ids Ids
|
||||
* @param array $followData Retrieve the follow meta data
|
||||
* @return array
|
||||
*/
|
||||
public function processResults( $ids )
|
||||
public function processFollowedResults( $ids, $followData=array() )
|
||||
{
|
||||
/* Topics? */
|
||||
if( IPSSearchRegistry::get('in.followContentType') == 'topics' )
|
||||
{
|
||||
IPSSearchRegistry::set('set.returnType', 'tids' );
|
||||
return $this->processResults( $ids, $followData );
|
||||
}
|
||||
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats / grabs extra data for results
|
||||
* Takes an array of IDS (can be IDs from anything) and returns an array of expanded data.
|
||||
*
|
||||
* @param array $ids Ids
|
||||
* @param array $followData Retrieve the follow meta data
|
||||
* @return array
|
||||
*/
|
||||
public function processResults( $ids, $followData=array() )
|
||||
{
|
||||
/* INIT */
|
||||
$sort_by = IPSSearchRegistry::get('in.search_sort_by');
|
||||
$sort_order = IPSSearchRegistry::get('in.search_sort_order');
|
||||
$search_term = IPSSearchRegistry::get('in.clean_search_term');
|
||||
$content_title_only = IPSSearchRegistry::get('opt.searchTitleOnly');
|
||||
$onlyPosts = IPSSearchRegistry::get('opt.onlySearchPosts');
|
||||
$order_dir = ( $sort_order == 'asc' ) ? 'asc' : 'desc';
|
||||
$content_title_only = IPSSearchRegistry::searchTitleOnly();
|
||||
$_post_joins = array();
|
||||
$members = array();
|
||||
$results = array();
|
||||
@@ -262,7 +365,7 @@ class search_format_forums extends search_format
|
||||
$permissions['SoftDeleteContent'] = $this->registry->getClass('class_forums')->canSeeSoftDeleteContent( 0 );
|
||||
$permissions['PostSoftDeleteRestore'] = $this->registry->getClass('class_forums')->can_Un_SoftDeletePosts( 0 );
|
||||
$permissions['TopicSoftDeleteRestore'] = $this->registry->getClass('class_forums')->can_Un_SoftDeleteTopics( 0 );
|
||||
|
||||
|
||||
/* Got some? */
|
||||
if ( count( $ids ) )
|
||||
{
|
||||
@@ -278,14 +381,16 @@ class search_format_forums extends search_format
|
||||
{
|
||||
$_post_joins[] = IPSContentCache::join( 'sig' , 'p.author_id', 'ccb', 'left', 'ccb.cache_content as cache_content_sig, ccb.cache_updated as cache_updated_sig' );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$_post_joins[] = $this->registry->tags->getCacheJoin( array( 'meta_id_field' => 't.tid' ) );
|
||||
|
||||
/* Sorting */
|
||||
switch( $sort_by )
|
||||
{
|
||||
default:
|
||||
case 'date':
|
||||
$sortKey = ( $content_title_only ) ? 'last_post' : 'post_date';
|
||||
$sortKey = ( IPSSearchRegistry::get('set.returnType') == 'tids' ) ? 'last_post' : 'post_date';
|
||||
$sortType = 'numerical';
|
||||
break;
|
||||
case 'title':
|
||||
@@ -304,14 +409,14 @@ class search_format_forums extends search_format
|
||||
|
||||
/* Set vars */
|
||||
IPSSearch::$ask = $sortKey;
|
||||
IPSSearch::$aso = strtolower( $order_dir );
|
||||
IPSSearch::$aso = strtolower( $sort_order );
|
||||
IPSSearch::$ast = $sortType;
|
||||
|
||||
|
||||
/* If we are search in titles only, then the ID array will be TIDs */
|
||||
if( $content_title_only )
|
||||
if ( IPSSearchRegistry::get('set.returnType') == 'tids' )
|
||||
{
|
||||
$k = 'tid';
|
||||
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => "t.*",
|
||||
'from' => array( 'topics' => 't' ),
|
||||
@@ -344,7 +449,7 @@ class search_format_forums extends search_format
|
||||
'type' => 'left' ) ), $_post_joins ) ) );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Grab data */
|
||||
$this->DB->execute();
|
||||
|
||||
@@ -354,6 +459,18 @@ class search_format_forums extends search_format
|
||||
$_rows[ $row[ $k ] ] = $row;
|
||||
}
|
||||
|
||||
/* Get the 'follow' meta data? */
|
||||
if( count($followData) )
|
||||
{
|
||||
$followData = classes_like_meta::get( $followData );
|
||||
|
||||
/* Merge the data from the follow class into the results */
|
||||
foreach( $followData as $_formatted )
|
||||
{
|
||||
$_rows[ $_formatted['like_rel_id'] ]['_followData'] = $_formatted;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sort */
|
||||
if ( count( $_rows ) )
|
||||
{
|
||||
@@ -364,10 +481,20 @@ class search_format_forums extends search_format
|
||||
/* Prevent member from stepping on it */
|
||||
$row['topic_title'] = $row['title'];
|
||||
|
||||
/* Got author but no member data? */
|
||||
if ( ! empty( $row['author_id'] ) )
|
||||
/* Get author data? */
|
||||
if( $k == 'tid' )
|
||||
{
|
||||
$members[ $row['author_id'] ] = $row['author_id'];
|
||||
if ( ! empty( $row['last_poster_id'] ) )
|
||||
{
|
||||
$members[ $row['last_poster_id'] ] = $row['last_poster_id'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! empty( $row['author_id'] ) )
|
||||
{
|
||||
$members[ $row['author_id'] ] = $row['author_id'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Topic ids? */
|
||||
@@ -394,7 +521,7 @@ class search_format_forums extends search_format
|
||||
}
|
||||
|
||||
$row['cleanSearchTerm'] = urlencode($search_term);
|
||||
$row['topicPrefix'] = $row['pinned'] ? $this->registry->getClass('output')->getTemplate('forum')->topicPrefixWrap( $this->settings['pre_pinned'] ) : '';
|
||||
$row['topicPrefix'] = $row['pinned'] ? $this->registry->getClass('output')->getTemplate('forum')->topicPrefixWrap( $this->lang->words['pre_pinned'] ) : '';
|
||||
|
||||
$row['_isVisible'] = ( $this->registry->getClass('class_forums')->fetchHiddenTopicType( $row ) == 'visible' ) ? true : false;
|
||||
$row['_isHidden'] = ( $this->registry->getClass('class_forums')->fetchHiddenTopicType( $row ) == 'hidden' ) ? true : false;
|
||||
@@ -442,7 +569,13 @@ class search_format_forums extends search_format
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Tags */
|
||||
if ( ! empty( $row['tag_cache_key'] ) )
|
||||
{
|
||||
$row['tags'] = $this->registry->tags->formatCacheJoinData( $row );
|
||||
}
|
||||
|
||||
$results[ $row['pid'] ] = $this->genericizeResults( $row );
|
||||
}
|
||||
}
|
||||
@@ -450,23 +583,26 @@ class search_format_forums extends search_format
|
||||
/* Need to load members? */
|
||||
if ( count( $members ) )
|
||||
{
|
||||
$mems = IPSMember::load( $members, 'all' );
|
||||
$mems = IPSMember::load( $members, 'all' );
|
||||
$mems[0] = array();
|
||||
|
||||
foreach( $results as $id => $r )
|
||||
{
|
||||
if ( ! empty( $r['author_id'] ) AND isset( $mems[ $r['author_id'] ] ) )
|
||||
$_memberIdColumn = ( IPSSearchRegistry::get('set.returnType') == 'tids' ) ? 'last_poster_id' : 'author_id';
|
||||
|
||||
if ( isset( $mems[ $r[ $_memberIdColumn ] ] ) )
|
||||
{
|
||||
$mems[ $r['author_id'] ]['m_posts'] = $mems[ $r['author_id'] ]['posts'];
|
||||
//unset( $mems[ $r['author_id'] ]['posts'] );
|
||||
unset( $mems[ $r['author_id'] ]['last_post'] );
|
||||
$mems[ $r[ $_memberIdColumn ] ]['m_posts'] = $mems[ $r[ $_memberIdColumn ] ]['posts'];
|
||||
|
||||
unset( $mems[ $r[ $_memberIdColumn ] ]['last_post'] );
|
||||
|
||||
if ( isset( $r['cache_content_sig'] ) )
|
||||
{
|
||||
$mems[ $r['author_id'] ]['cache_content'] = $r['cache_content_sig'];
|
||||
$mems[ $r['author_id'] ]['cache_updated'] = $r['cache_updated_sig'];
|
||||
$mems[ $r[ $_memberIdColumn ] ]['cache_content'] = $r['cache_content_sig'];
|
||||
$mems[ $r[ $_memberIdColumn ] ]['cache_updated'] = $r['cache_updated_sig'];
|
||||
}
|
||||
|
||||
$_mem = IPSMember::buildDisplayData( $mems[ $r['author_id'] ], array( 'signature' => 1 ) );
|
||||
$_mem = IPSMember::buildDisplayData( $mems[ $r[ $_memberIdColumn ] ], array( 'reputation' => 0, 'warn' => 0 ) );
|
||||
|
||||
unset( $_mem['cache_content'], $_mem['cache_updated'] );
|
||||
|
||||
@@ -476,13 +612,15 @@ class search_format_forums extends search_format
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Generate 'dot' folder icon */
|
||||
if ( $this->settings['show_user_posted'] AND count( $topicIds ) )
|
||||
{
|
||||
$_queued = $this->registry->class_forums->fetchPostHiddenQuery( array( 'visible' ), '' );
|
||||
|
||||
$this->DB->build( array( 'select' => 'author_id, topic_id',
|
||||
'from' => 'posts',
|
||||
'where' => 'queued=0 AND author_id=' . $this->memberData['member_id'] . ' AND topic_id IN(' . implode( ',', $topicIds ) . ')' ) );
|
||||
'where' => $_queued . ' AND author_id=' . $this->memberData['member_id'] . ' AND topic_id IN(' . implode( ',', $topicIds ) . ')' ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
@@ -557,7 +695,7 @@ class search_format_forums extends search_format
|
||||
$r['type_2'] = 'topic';
|
||||
$r['type_id_2'] = $r['tid'];
|
||||
$r['misc'] = $r['pid'];
|
||||
|
||||
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user