Version 3.2.3

This commit is contained in:
Neo committed 2025-12-19 00:34:03 -08:00
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
* Profile View
* Last Updated: $Date: 2010-10-21 07:08:38 -0400 (Thu, 21 Oct 2010) $
* Last Updated: $Date: 2011-08-01 07:12:21 -0400 (Mon, 01 Aug 2011) $
* </pre>
*
* @author $Author: ips_terabyte $
* @author $Author: mmecham $
* @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 Members
* @link http://www.invisionpower.com
* @link http://hatynka.in
* @since 20th February 2002
* @version $Revision: 7007 $
* @version $Revision: 9338 $
*/
if ( ! defined( 'IN_IPB' ) )
@@ -50,7 +50,7 @@ class public_members_profile_view extends ipsCommand
* Class entry point
*
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -81,11 +81,133 @@ class public_members_profile_view extends ipsCommand
$this->registry->output->addNavigation( $this->lang->words['page_title_pp'] . ': ' . $this->member_name, '' );
$this->registry->output->sendOutput();
}
/**
* Get 12 random friends
*
* @param array $member Member data
* @return @e array
*/
protected function _getRandomFriends( $member )
{
# Get random number from member's friend cache... grab 10 random. array_rand( array, no.)
# also fall back on last 10 if no cache
$_member_ids = array();
$friends = array();
if ( $member['pp_setting_count_friends'] > 0 && $this->settings['friends_enabled'] )
{
$member['_cache'] = IPSMember::unpackMemberCache( $member['members_cache'] );
if ( is_array( $member['_cache']['friends'] ) AND count( $member['_cache']['friends'] ) )
{
foreach( $member['_cache']['friends'] as $id => $approved )
{
$id = intval( $id );
if ( $approved AND $id )
{
$_member_ids[] = $id;
}
}
$member['_total_approved_friends'] = count( $_member_ids );
if ( is_array( $_member_ids ) AND $member['_total_approved_friends'] )
{
$_max = $member['_total_approved_friends'] > 12 ? 12 : $member['_total_approved_friends'];
$_rand = array_rand( $_member_ids, $_max );
$_final = array();
# If viewing member is in list, let's show em
if( in_array( $this->memberData['member_id'], $_member_ids ) )
{
$_final[] = $this->memberData['member_id'];
$new_mids = array();
foreach( $_member_ids as $mid )
{
if( $mid == $this->memberData['member_id'] )
{
continue;
}
$new_mids[] = $mid;
}
$_member_ids = $new_mids;
unset( $new_mids );
if( is_array( $_rand ) )
{
if( count( $_rand ) >= 12 )
{
array_pop( $_rand );
}
}
}
if ( is_array( $_rand ) AND count( $_rand ) )
{
foreach( $_rand as $_id )
{
$_final[] = $_member_ids[ $_id ];
}
}
if ( count( $_final ) )
{
$sql_extra = ' AND friends_friend_id IN (' . IPSText::cleanPermString( implode( ',', $_final ) ) . ')';
}
}
}
/* Fetch friends */
$_memberIds = array();
$_members = array();
$_friends = array();
$this->DB->build( array('select' => '*',
'from' => 'profile_friends',
'where' => 'friends_member_id=' . $member['member_id'] . ' AND friends_approved=1' . $sql_extra,
'limit' => array( 0, 12 ),
'order' => 'friends_approved DESC' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$_memberIds[] = $row['friends_friend_id'];
$_friends[] = $row;
}
/* Got members? */
$_members = IPSMember::load( $_memberIds, 'core,extendedProfile' );
foreach( $_friends as $row )
{
if( ! isset( $_members[ $row['friends_friend_id'] ] ) )
{
continue;
}
$row = array_merge( $row, $_members[ $row['friends_friend_id'] ] );
$row['_friends_added'] = ipsRegistry::getClass('class_localization')->getDate( $row['friends_added'], 'SHORT' );
$row = IPSMember::buildProfilePhoto( $row );
$friends[] = $row;
}
}
return $friends;
}
/**
* Modern profile
*
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
protected function _viewModern()
{
@@ -94,12 +216,15 @@ class public_members_profile_view extends ipsCommand
//-----------------------------------------
$member_id = intval( $this->request['id'] ) ? intval( $this->request['id'] ) : intval( $this->request['MID'] );
$member_id = $member_id ? $member_id : $this->memberData['member_id'];
if( !$member_id )
{
$this->registry->output->showError( 'profiles_no_member', 10246.0, null, null, 404 );
}
$tab = substr( IPSText::alphanumericalClean( str_replace( '..', '', trim( $this->request['tab'] ) ) ), 0, 20 );
$firsttab = '';
$member = array();
$comments = array();
$comments_html = "";
$friends = array();
$visitors = array();
$comment_perpage = 5;
@@ -118,15 +243,6 @@ class public_members_profile_view extends ipsCommand
$time_adjust = $this->settings['time_adjust'] == "" ? 0 : $this->settings['time_adjust'];
$board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
$seenFiles = array();
//-----------------------------------------
// Check input..
//-----------------------------------------
if ( ! $member_id )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] );
}
/* Removing customization? */
if ( $_rCustom AND ( $member_id == $this->memberData['member_id'] OR $this->memberData['g_is_supmod'] ) AND $this->request['secure_key'] == $this->member->form_hash )
@@ -139,91 +255,91 @@ class public_members_profile_view extends ipsCommand
{
IPSMember::save( $member_id, array( 'core' => array( 'bw_disable_customization' => 1 ) ) );
}
//-----------------------------------------
// Configure tabs
//-----------------------------------------
foreach( ipsRegistry::$applications as $app )
{
/* Skip if disabled */
if( ! $app['app_enabled'] )
{
continue;
}
/* Path to tabs */
$custom_path = IPSLib::getAppDir( $app['app_directory'] ) . '/extensions/profileTabs';
if ( is_dir( $custom_path ) )
{
foreach( new DirectoryIterator( $custom_path ) as $f )
{
if ( ! $f->isDot() && ! $f->isDir() )
{
$file = $f->getFileName();
if( $file[0] == '.' )
{
continue;
}
if ( preg_match( "#\.conf\.php$#i", $file ) )
{
$classname = str_replace( ".conf.php", "", $file );
$CONFIG = array();
require( $custom_path . '/' . $file );
//-------------------------------
// Allowed to use?
//-------------------------------
if ( $CONFIG['plugin_enabled'] )
{
$CONFIG['app'] = $app['app_directory'];
$_position = $this->_getTabPosition( $_positions, $CONFIG['plugin_order'] );
$_tabs[ $_position ] = $CONFIG;
$_positions[] = $_position;
}
}
}
}
}
}
ksort( $_tabs );
foreach( $_tabs as $_pos => $data )
{
if( !$firsttab )
{
$firsttab = $data['plugin_key'];
}
$data['_lang'] = isset($this->lang->words[ $data['plugin_lang_bit'] ]) ? $this->lang->words[ $data['plugin_lang_bit'] ] : $data['plugin_name'];
$tabs[ $data['plugin_key'] ] = $data;
}
if ( ! $tab OR ( $tab != 'comments' AND $tab != 'settings' AND ! @file_exists( IPSLib::getAppDir( $tabs[ $tab ]['app'] ) . '/extensions/profileTabs/' . $tab . '.php' ) ) )
{
$tab = $firsttab;
$default_tab = $tabs[ $tab ]['app'] . ':' . $tab;
}
//-----------------------------------------
// Grab all data...
//-----------------------------------------
$member = IPSMember::load( $member_id, 'profile_portal,pfields_content,sessions,groups', 'id' );
$member = IPSMember::load( $member_id, 'profile_portal,pfields_content,sessions,groups', 'id' );
if ( !$member['member_id'] )
if ( ! $member['member_id'] )
{
$this->registry->output->showError( 'profiles_no_member', 10246, null, null, 404 );
}
// Cycle redirect on member profile for ID FURL Fix
//-----------------------------------------
// Configure tabs
//-----------------------------------------
foreach( IPSLib::getEnabledApplications() as $appDir => $app )
{
/* Path to tabs */
$custom_path = IPSLib::getAppDir( $appDir ) . '/extensions/profileTabs';
if ( is_dir( $custom_path ) )
{
foreach( new DirectoryIterator( $custom_path ) as $f )
{
if ( ! $f->isDot() && ! $f->isDir() )
{
$file = $f->getFileName();
if( $file[0] == '.' )
{
continue;
}
if ( preg_match( '#\.conf\.php$#i', $file ) )
{
$classname = str_replace( ".conf.php", "", $file );
$CONFIG = array();
require( $custom_path . '/' . $file );/*noLibHook*/
//-------------------------------
// Allowed to use?
//-------------------------------
if ( $CONFIG['plugin_enabled'] )
{
/* Block friends tab if we have disabled friends or friends feature is shut off */
if( $CONFIG['plugin_key'] == 'friends' AND ( !$member['pp_setting_count_friends'] OR !$this->settings['friends_enabled'] ) )
{
continue;
}
$CONFIG['app'] = $appDir;
$_position = $this->_getTabPosition( $_positions, $CONFIG['plugin_order'] );
$_tabs[ $_position ] = $CONFIG;
$_positions[] = $_position;
}
}
}
}
}
}
ksort( $_tabs );
foreach( $_tabs as $_pos => $data )
{
$data['_lang'] = isset($this->lang->words[ $data['plugin_lang_bit'] ]) ? $this->lang->words[ $data['plugin_lang_bit'] ] : $data['plugin_name'];
$tabs[ $data['plugin_key'] ] = $data;
}
if ( $tab && @is_file( IPSLib::getAppDir( $tabs[ $tab ]['app'] ) . '/extensions/profileTabs/' . $tab . '.php' ) )
{
$default_tab = $tabs[ $tab ]['app'] . ':' . $tab;
}
else
{
$default_tab = 'core:info';
}
$friends = $this->_getRandomFriends( $member );
/* Cycle redirect on member profile for ID FURL Fix */
if ( IPB_USE_ONLY_ID_FURL )
{
$member['members_seo_name'] = $member['member_id'];
@@ -281,7 +397,7 @@ class public_members_profile_view extends ipsCommand
}
$member['_local_time'] = $member['time_offset'] != "" ? gmstrftime( $this->settings['clock_long'], time() + ($member['time_offset']*3600) + ($time_adjust * 60) ) : '';
$member['g_title'] = IPSLib::makeNameFormatted( $member['g_title'], $member['g_id'], $member['prefix'], $member['suffix'] );
$member['g_title'] = IPSMember::makeNameFormatted( $member['g_title'], $member['g_id'], $member['prefix'], $member['suffix'] );
$member['_posts_day'] = 0;
$member['_total_pct'] = 0;
$member['_bday_month'] = $member['bday_month'] ? $this->lang->words['M_' . $member['bday_month'] ] : 0;
@@ -346,17 +462,6 @@ class public_members_profile_view extends ipsCommand
}
}
//-----------------------------------------
// Comments
//-----------------------------------------
if( $member['pp_setting_count_comments'] )
{
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'members' ) . '/sources/comments.php', 'profileCommentsLib', 'members' );
$comment_lib = new $classToLoad( $this->registry );
$comment_html = $comment_lib->buildComments( $member );
}
//-----------------------------------------
// Visitors
//-----------------------------------------
@@ -365,8 +470,7 @@ class public_members_profile_view extends ipsCommand
{
$_pp_last_visitors = unserialize( $member['pp_last_visitors'] );
$_visitor_info = array();
$_count = 1;
if ( is_array( $_pp_last_visitors ) )
{
krsort( $_pp_last_visitors );
@@ -375,152 +479,27 @@ class public_members_profile_view extends ipsCommand
foreach( $_members as $_id => $_member )
{
$_visitor_info[ $_id ] = IPSMember::buildDisplayData( $_member, array( 'reputation' => 0, 'avatar' => 0, 'warn' => 0 ) );
$_visitor_info[ $_id ] = IPSMember::buildDisplayData( $_member, array( 'reputation' => 0, 'warn' => 0 ) );
}
foreach( $_pp_last_visitors as $_time => $_id )
{
if ( $_count > $member['pp_setting_count_visitors'] )
if ( !$_visitor_info[ $_id ]['members_display_name_short'] )
{
break;
}
$_count++;
if( !$_visitor_info[ $_id ]['members_display_name_short'] )
{
$_visitor_info[ $_id ] = IPSMember::buildDisplayData( IPSMember::setUpGuest(), array( 'reputation' => 0, 'avatar' => 0, 'warn' => 0 ) );
$_visitor_info[ $_id ] = IPSMember::buildDisplayData( IPSMember::setUpGuest(), array( 'reputation' => 0, 'warn' => 0 ) );
}
$_visitor_info[ $_id ]['_visited_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $_time, 'TINY' );
$_visitor_info[ $_id ]['members_display_name_short'] = $_visitor_info[ $_id ]['members_display_name_short'] ? $_visitor_info[ $_id ]['members_display_name_short'] : $this->lang->words['global_guestname'];
$visitors[] = $_visitor_info[ $_id ];
}
}
}
//-----------------------------------------
// Friends
//-----------------------------------------
# Get random number from member's friend cache... grab 10 random. array_rand( array, no.)
# also fall back on last 10 if no cache
if ( $member['pp_setting_count_friends'] > 0 && $this->settings['friends_enabled'] )
{
$member['_cache'] = IPSMember::unpackMemberCache( $member['members_cache'] );
if ( is_array( $member['_cache']['friends'] ) AND count( $member['_cache']['friends'] ) )
{
foreach( $member['_cache']['friends'] as $id => $approved )
{
$id = intval( $id );
if ( $approved AND $id )
{
$_member_ids[] = $id;
}
}
$member['_total_approved_friends'] = count( $_member_ids );
$member['_showing_friend_count'] = $member['_total_approved_friends'] > 50 ? 50 : $member['_total_approved_friends'];
if ( is_array( $_member_ids ) AND $member['_total_approved_friends'] )
{
$_max = $member['_total_approved_friends'] > 50 ? 50 : $member['_total_approved_friends'];
$_rand = array_rand( $_member_ids, $_max );
$_final = array();
# If viewing member is in list, let's show em
if( in_array( $this->memberData[ 'member_id' ], $_member_ids ) )
{
$_final[] = $this->memberData[ 'member_id' ];
$new_mids = array();
foreach( $_member_ids as $mid )
{
if( $mid == $this->memberData[ 'member_id' ] )
{
continue;
}
$new_mids[] = $mid;
}
$_member_ids = $new_mids;
unset( $new_mids );
if( is_array( $_rand ) )
{
if( count( $_rand ) >= 50 )
{
array_pop( $_rand );
}
}
}
if ( is_array( $_rand ) AND count( $_rand ) )
if ( count($visitors) == 5 )
{
foreach( $_rand as $_id )
{
$_final[] = $_member_ids[ $_id ];
}
}
if ( count( $_final ) )
{
$sql_extra = ' AND friends_friend_id IN (' . IPSText::cleanPermString( implode( ',', $_final ) ) . ')';
break;
}
}
}
/* Fetch friends */
$_memberIds = array();
$_members = array();
$_friends = array();
$this->DB->build( array('select' => '*',
'from' => 'profile_friends',
'where' => 'friends_member_id=' . $member_id . ' AND friends_approved=1' . $sql_extra,
'limit' => array( 0, 50 ),
'order' => 'friends_approved DESC' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$_memberIds[] = $row['friends_friend_id'];
$_friends[] = $row;
}
/* Got members? */
$_members = IPSMember::load( $_memberIds, 'core,extendedProfile' );
$member['_total_displayed_friends'] = 0;
foreach( $_friends as $row )
{
if( ! isset( $_members[ $row['friends_friend_id'] ] ) )
{
continue;
}
if ( $row['friends_friend_id'] && isset( $_members[ $row['friends_friend_id'] ] ) )
{
$row = array_merge( $row, $_members[ $row['friends_friend_id'] ] );
}
$row['_friends_added'] = ipsRegistry::getClass( 'class_localization')->getDate( $row['friends_added'], 'SHORT' );
$row = IPSMember::buildProfilePhoto( $row );
$row['members_display_name_short'] = IPSText::truncate( $row['members_display_name'], 13 );
$friends[] = $row;
$member['_total_displayed_friends']++;
}
}
//-----------------------------------------
@@ -541,11 +520,11 @@ class public_members_profile_view extends ipsCommand
$tab_html = '';
if ( $tab != 'comments' AND $tab != 'settings' )
if ( $tab )
{
if( file_exists( IPSLib::getAppDir( $tabs[ $tab ]['app'] ) . '/extensions/profileTabs/' . $tab . '.php' ) )
if( is_file( IPSLib::getAppDir( $tabs[ $tab ]['app'] ) . '/extensions/profileTabs/' . $tab . '.php' ) )
{
require( IPSLib::getAppDir( 'members' ) . '/sources/tabs/pluginParentClass.php' );
require( IPSLib::getAppDir( 'members' ) . '/sources/tabs/pluginParentClass.php' );/*noLibHook*/
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( $tabs[ $tab ]['app'] ) . '/extensions/profileTabs/' . $tab . '.php', 'profile_' . $tab, $tabs[ $tab ]['app'] );
$plugin = new $classToLoad( $this->registry );
$tab_html = $plugin->return_html_block( $member );
@@ -560,7 +539,7 @@ class public_members_profile_view extends ipsCommand
if ( $_desc )
{
$this->registry->output->addMetaTag( 'description', $member['members_display_name'] . ': ' . IPSText::getTextClass('bbcode')->stripAllTags( $_desc ) );
$this->registry->output->addMetaTag( 'description', $member['members_display_name'] . ': ' . IPSText::xssMakeJavascriptSafe( IPSText::getTextClass('bbcode')->stripAllTags( $_desc ) ) );
}
/* Reputation */
@@ -599,13 +578,65 @@ class public_members_profile_view extends ipsCommand
}
}
}
//-----------------------------------------
// Format signature
//-----------------------------------------
if( $member['signature'] )
{
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parse_smilies = 0;
IPSText::getTextClass('bbcode')->parse_html = $member['g_dohtml'];
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'signatures';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $member['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $member['mgroup_others'];
$member['signature'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $member['signature'] );
$member['signature'] = $this->registry->getClass('output')->getTemplate('global')->signature_separator( $member['signature'] );
}
//-----------------------------------------
// Format 'About me'
//-----------------------------------------
if( $member['pp_about_me'] )
{
IPSText::getTextClass( 'bbcode' )->parse_html = $member['g_dohtml'];
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'aboutme';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $member['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $member['mgroup_others'];
$member['pp_about_me'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $member['pp_about_me'] );
}
/* final data */
if ( $default_tab == 'core:info' )
{
/* Load status class */
if ( ! $this->registry->isClassLoaded( 'memberStatus' ) )
{
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/member/status.php', 'memberStatus' );
$this->registry->setClass( 'memberStatus', new $classToLoad( ipsRegistry::instance() ) );
}
/* Fetch */
$status = $this->registry->getClass('memberStatus')->fetchMemberLatest( $member['member_id'] );
}
//-----------------------------------------
// Add to output
//-----------------------------------------
$this->request['member_id'] = intval( $this->request['showuser'] );
$this->member_name = $member['members_display_name'];
$this->output = $this->registry->getClass('output')->getTemplate('profile')->profileModern( $tabs, $member, $comment_html, $friends, $visitors, $default_tab, $tab_html );
$this->output = $this->registry->getClass('output')->getTemplate('profile')->profileModern( $tabs, $member, $visitors, $default_tab, $tab_html, $friends, $status );
}
/**
@@ -668,7 +699,7 @@ class public_members_profile_view extends ipsCommand
{
if ( $_id == $member_id_to_add )
{
$found = 1;
$found = 1;
continue;
}
else
@@ -687,7 +718,7 @@ class public_members_profile_view extends ipsCommand
if ( ! $found )
{
if ( count( $recent_visitors ) > 10 )
if ( count( $recent_visitors ) > 5 )
{
$_tmp = array_pop( $recent_visitors );
}