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

@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Profile View
* Last Updated: $Date: 2010-11-16 11:26:43 -0500 (Tue, 16 Nov 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: mmecham $
* @author $Author: ips_terabyte $
* @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: 7195 $
* @version $Revision: 8644 $
*
*/
@@ -30,17 +30,15 @@ class public_members_profile_friends extends ipsCommand
/**
* Friend's library
*
* @access private
* @var object
*/
private $friend_lib;
protected $friend_lib;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -78,103 +76,23 @@ class public_members_profile_friends extends ipsCommand
case 'moderate':
$this->_moderation();
break;
case 'view':
$this->_iframeList();
break;
}
}
/**
* Loads the content for the friends tab
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-15
*/
private function _iframeList()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$content = '';
$friends = array();
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
$this->registry->output->showError( $this->lang->words['nofriendid'], 10270, null, null, 404 );
}
//-----------------------------------------
// Grab the friends
//-----------------------------------------
$this->DB->build( array( 'select' => 'f.*',
'from' => array( 'profile_friends' => 'f' ),
'where' => 'f.friends_member_id=' . $member_id . ' AND f.friends_approved=1',
'order' => 'm.members_display_name ASC',
'add_join' => array(
1 => array( 'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=f.friends_friend_id',
'type' => 'left' ),
2 => array( 'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=f.friends_friend_id',
'type' => 'left' )
)
) );
$outer = $this->DB->execute();
//-----------------------------------------
// Get and store...
//-----------------------------------------
while( $row = $this->DB->fetch($outer) )
{
$row['members_display_name_short'] = IPSText::truncate( $row['members_display_name'], 13 );
$friends[] = IPSMember::buildDisplayData( $row, array( 'avatar' => 0, 'warn' => 0 ) );
}
//-----------------------------------------
// Ok.. show the friends
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->friendsIframe( $member, $friends, true );
$this->registry->getClass('output')->setTitle( ipsRegistry::$settings['board_name'] );
$this->registry->getClass('output')->addContent( $content );
$this->registry->getClass('output')->sendOutput();
}
/**
* Remove a friend
*
* @access private
* @return void [Prints to screen]
* @return @e void [Prints to screen]
* @since IPB 2.2.0.2006-08-09
*/
private function _removeFriend()
protected function _removeFriend()
{
/* INIT */
$friend_id = intval( $this->request['member_id'] );
$friend_id = intval( $this->request['member_id'] );
/* Check the secure key */
$this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
$this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
if( $this->request['secure_key'] != $this->member->form_hash )
{
@@ -200,11 +118,10 @@ class public_members_profile_friends extends ipsCommand
/**
* Moderate pending friends
*
* @access private
* @return void [Prints to screen]
* @return @e void [Prints to screen]
* @since IPB 2.2.0.2006-08-09
*/
private function _moderation()
protected function _moderation()
{
//-----------------------------------------
// INIT
@@ -218,7 +135,7 @@ class public_members_profile_friends extends ipsCommand
$friends_already = array();
$friends_update = array();
$member = array();
$pp_option = $this->request['pp_option'] == 'delete' ? 'delete' : 'add_reciprocal';//trim( $this->request['pp_option'] );
$pp_option = $this->request['pp_option'] == 'delete' ? 'delete' : 'add';
$message = '';
$subject = '';
$msg = 'pp_friend_approved';
@@ -230,7 +147,6 @@ class public_members_profile_friends extends ipsCommand
if ( $md5check != $this->member->form_hash )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
@@ -240,7 +156,6 @@ class public_members_profile_friends extends ipsCommand
if ( ! is_array( $this->request['pp_friend_id'] ) OR ! count( $this->request['pp_friend_id'] ) )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
@@ -260,18 +175,15 @@ class public_members_profile_friends extends ipsCommand
if ( ! is_array( $_friend_ids ) OR ! count( $_friend_ids ) )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
// Check our friends are OK
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'profile_friends',
'where' => 'friends_friend_id=' . $this->memberData['member_id'] . ' AND friends_approved=0 AND friends_member_id IN (' . implode( ',', $_friend_ids ) . ')' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
@@ -283,29 +195,21 @@ class public_members_profile_friends extends ipsCommand
if ( ! is_array( $friend_ids ) OR ! count( $friend_ids ) )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
// Load friends...
//-----------------------------------------
$friends = IPSMember::load( $friend_member_ids );
//-----------------------------------------
// Get member...
//-----------------------------------------
$member = $this->memberData;
$friends = IPSMember::load( $friend_member_ids );
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! is_array( $friends ) OR ! count( $friends ) OR ! $member['member_id'] )
if ( ! is_array( $friends ) OR ! count( $friends ) OR ! $this->memberData['member_id'] )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
@@ -315,15 +219,9 @@ class public_members_profile_friends extends ipsCommand
if ( $pp_option == 'delete' )
{
//-----------------------------------------
// Ok.. delete them in the DB.
// Delete friends records
//-----------------------------------------
//$this->DB->delete( 'profile_friends', 'friends_id IN(' . implode( ',', $friend_ids ) . ')' );
//-----------------------------------------
// And make sure you are no longer their friend
//-----------------------------------------
foreach( $friend_member_ids as $friend_id )
{
$this->friend_lib->removeFriend( $this->memberData['member_id'], $friend_id );
@@ -346,14 +244,14 @@ class public_members_profile_friends extends ipsCommand
foreach( $friend_member_ids as $friend_id )
{
$this->friend_lib->addFriend( $this->memberData['member_id'], $friend_id, true );
$this->friend_lib->addFriend( $friend_id, $this->memberData['member_id'], true );
}
//-----------------------------------------
// Reciprocal mode?
// Catch all (should find any missing friends)
//-----------------------------------------
if ( $pp_option == 'add_reciprocal' )
if ( $pp_option == 'add' )
{
//-----------------------------------------
// Find out who isn't already on your list...
@@ -369,6 +267,7 @@ class public_members_profile_friends extends ipsCommand
{
$friends_already[ $row['friends_member_id'] ] = $row['friends_member_id'];
}
//-----------------------------------------
// Check which aren't already members...
//-----------------------------------------
@@ -389,10 +288,10 @@ class public_members_profile_friends extends ipsCommand
if ( is_array( $friends_update ) AND count( $friends_update ) )
{
foreach( $friends_update as $id => $_id )
foreach( $friends_update as $id )
{
$this->DB->insert( 'profile_friends', array( 'friends_member_id' => $id,
'friends_friend_id' => $member['member_id'],
'friends_friend_id' => $this->memberData['member_id'],
'friends_approved' => 1,
'friends_added' => time() ) );
}
@@ -406,47 +305,35 @@ class public_members_profile_friends extends ipsCommand
foreach( $friends as $friend )
{
//-----------------------------------------
// INIT
// Notifications library
//-----------------------------------------
$message = '';
$subject = '';
//if ( $friend['pp_setting_notify_friend'] )
//{
//-----------------------------------------
// Notifications library
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
$notifyLibrary = new $classToLoad( $this->registry );
IPSText::getTextClass( 'email' )->getTemplate( "new_friend_approved" );
IPSText::getTextClass( 'email' )->buildMessage( array( 'MEMBERS_DISPLAY_NAME' => $friend['members_display_name'],
'FRIEND_NAME' => $member['members_display_name'],
'LINK' => $this->settings['board_url'] . '/index.' . $this->settings['php_ext'] . '?app=members&amp;module=profile&amp;section=friends&amp;do=list' ) );
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
$notifyLibrary = new $classToLoad( $this->registry );
IPSText::getTextClass( 'email' )->getTemplate( "new_friend_approved" );
IPSText::getTextClass( 'email' )->buildMessage( array( 'MEMBERS_DISPLAY_NAME' => $friend['members_display_name'],
'FRIEND_NAME' => $this->memberData['members_display_name'],
'LINK' => $this->settings['board_url'] . '/index.' . $this->settings['php_ext'] . '?app=members&amp;module=profile&amp;section=friends&amp;do=list' ) );
IPSText::getTextClass('email')->subject = sprintf(
IPSText::getTextClass('email')->subject,
$this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ),
$member['members_display_name']
);
$notifyLibrary->setMember( $friend );
$notifyLibrary->setFrom( $member );
$notifyLibrary->setNotificationKey( 'friend_request_approve' );
$notifyLibrary->setNotificationUrl( $this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ) );
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
try
{
$notifyLibrary->sendNotification();
}
catch( Exception $e ){}
$return_msg = '';
//}
IPSText::getTextClass('email')->subject = sprintf(
IPSText::getTextClass('email')->subject,
$this->registry->output->buildSEOUrl( 'showuser=' . $this->memberData['member_id'], 'public', $this->memberData['members_seo_name'], 'showuser' ),
$this->memberData['members_display_name']
);
$notifyLibrary->setMember( $friend );
$notifyLibrary->setFrom( $this->memberData );
$notifyLibrary->setNotificationKey( 'friend_request_approve' );
$notifyLibrary->setNotificationUrl( $this->registry->output->buildSEOUrl( 'showuser=' . $this->memberData['member_id'], 'public', $this->memberData['members_seo_name'], 'showuser' ) );
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
try
{
$notifyLibrary->sendNotification();
}
catch( Exception $e ){}
}
$this->friend_lib->recacheFriends( $friend );
@@ -456,29 +343,29 @@ class public_members_profile_friends extends ipsCommand
// Recache..
//-----------------------------------------
$this->friend_lib->recacheFriends( $member );
$this->friend_lib->recacheFriends( $this->memberData );
//-----------------------------------------
// Return
//-----------------------------------------
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg='.$msg.'&tab=pending' );
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=' . $msg . '&tab=pending' );
}
/**
* Add a friend
*
* @access private
* @return void [Prints to screen]
* @return @e void [Prints to screen]
* @since IPB 2.2.0.2006-08-09
*/
private function _addFriend()
protected function _addFriend()
{
/* INIT */
$friend_id = intval( $this->request['member_id'] );
$friend_id = intval( $this->request['member_id'] );
$_friend = IPSMember::load( $friend_id, 'core' );
/* Check the secure key */
$this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
$this->request['secure_key'] = $this->request['secure_key'] ? $this->request['secure_key'] : $this->request['md5check'];
if( $this->request['secure_key'] != $this->member->form_hash )
{
@@ -500,30 +387,24 @@ class public_members_profile_friends extends ipsCommand
}
else
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'showuser=' . $friend_id );
$this->registry->output->redirectScreen( $this->lang->words['friend_added_ok'], $this->settings['base_url'] . 'showuser=' . $friend_id, 'showuser', $_friend['members_seo_name'] );
}
}
/**
* List all current friends.
*
* @access private
* @return void [Prints to screen]
* @return @e void [Prints to screen]
* @since IPB 2.2.0.2006-08-08
*/
private function _viewList()
protected function _viewList()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$content = '';
$member_id = intval( $this->memberData['member_id'] );
$friends = array();
$tab = substr( IPSText::alphanumericalClean( $this->request['tab'] ), 0, 20 );
$friends_filter = substr( IPSText::alphanumericalClean( $this->request['friends_filter'] ), 0, 20 );
$_mutual_ids = array( 0 => 0 );
$time_limit = time() - $this->settings['au_cutoff'] * 60;
$per_page = 25;
$start = intval( $this->request['st'] );
@@ -531,10 +412,9 @@ class public_members_profile_friends extends ipsCommand
// Check we're a member
//-----------------------------------------
if ( ! $member_id )
if ( !$this->memberData['member_id'] )
{
$this->lang->loadLanguageFile( array( 'public_error' ), 'core' );
$this->registry->output->showError( $this->lang->words['no_friend_mid'], 10267, null, null, 404 );
$this->registry->output->showError( 'no_friend_mid', 10267, null, null, 404 );
}
//-----------------------------------------
@@ -543,35 +423,20 @@ class public_members_profile_friends extends ipsCommand
if ( $tab == 'pending' )
{
$query = 'f.friends_friend_id=' . $member_id;
$query .= ' AND f.friends_approved=0';
$joinKey = 'f.friends_member_id';
$query = 'f.friends_approved=0 AND f.friends_friend_id=' . $this->memberData['member_id'];
$joinKey = 'f.friends_member_id';
}
else
{
$query = 'f.friends_member_id=' . $member_id;
$query .= ' AND f.friends_approved=1';
$joinKey = 'f.friends_friend_id';
$query = 'f.friends_approved=1 AND f.friends_member_id=' . $this->memberData['member_id'];
$joinKey = 'f.friends_friend_id';
}
//-----------------------------------------
// Filtered?
//-----------------------------------------
if ( $friends_filter == 'online' )
{
$query .= " AND ( ( m.last_visit > {$time_limit} OR m.last_activity > {$time_limit} ) AND m.login_anonymous='0&1' )";
}
else if ( $friends_filter == 'offline' )
{
$query .= " AND ( m.last_activity < {$time_limit} OR ( m.login_anonymous='0&0' OR m.login_anonymous='1&0' ) )";
}
//-----------------------------------------
// Get count...
//-----------------------------------------
$count = $this->DB->buildAndFetch( array(
$count = $this->DB->buildAndFetch( array(
'select' => 'COUNT(*) as count',
'from' => array( 'profile_friends' => 'f' ),
'where' => $query,
@@ -582,44 +447,45 @@ class public_members_profile_friends extends ipsCommand
'type' => 'inner'
) )
) );
//-----------------------------------------
// Pages...
//-----------------------------------------
$pages = $this->registry->output->generatePagination( array(
$pages = $this->registry->output->generatePagination( array(
'totalItems' => intval( $count['count'] ),
'noDropdown' => 1,
'itemsPerPage' => $per_page,
'currentStartValue' => $start,
'baseUrl' => 'app=members&amp;module=profile&amp;section=friends&amp;do=list&amp;tab='.$tab.'&amp;friends_filter=' . $friends_filter,
'baseUrl' => 'app=members&amp;module=profile&amp;section=friends&amp;do=list&amp;tab=' . $tab,
) );
//-----------------------------------------
// Get current friends...
//-----------------------------------------
$this->DB->build( array(
'select' => 'f.*',
'from' => array( 'profile_friends' => 'f' ),
'where' => $query,
'order' => 'm.members_l_display_name ASC',
'limit' => array( $start, $per_page ),
'add_join' => array(
array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=' . $joinKey,
'type' => 'left'
),
array(
'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=' . $joinKey,
'type' => 'left'
)
'select' => 'f.*',
'from' => array( 'profile_friends' => 'f' ),
'where' => $query,
'order' => 'm.members_l_display_name ASC',
'limit' => array( $start, $per_page ),
'add_join' => array(
array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=' . $joinKey,
'type' => 'left'
),
array(
'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=' . $joinKey,
'type' => 'left'
)
)
) );
$q = $this->DB->execute();
$q = $this->DB->execute();
//-----------------------------------------
// Get and store...
@@ -627,7 +493,7 @@ class public_members_profile_friends extends ipsCommand
while( $row = $this->DB->fetch( $q ) )
{
$row = IPSMember::buildDisplayData( $row, array( 'avatar' => 0, 'warn' => 0 ) );
$row = IPSMember::buildDisplayData( $row, array( 'warn' => 0 ) );
$friends[] = $row;
}
@@ -636,11 +502,12 @@ class public_members_profile_friends extends ipsCommand
// Show...
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->friendsList( $friends, $pages );
$content = $this->registry->getClass('output')->getTemplate('profile')->friendsList( $friends, $pages );
$this->registry->output->setTitle( $this->lang->words['m_title_friends'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addNavigation( $this->lang->words['m_title_friends'], '' );
$this->registry->getClass('output')->addContent( $content );
$this->registry->getClass('output')->sendOutput( $content );
$this->registry->getClass('output')->sendOutput();
}
}