Version 3.0.5

This commit is contained in:
Neo committed 2025-12-19 00:31:03 -08:00
1 parent 19b38c7c74
commit 1d4720f3e2
3755 files changed
+508378 -664541

No files matched your search

@@ -0,0 +1,408 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-05-18 22:05:12 -0400 (Mon, 18 May 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4668 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_comments extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'comments_profiles', 10231 );
}
switch( $this->request['do'] )
{
case 'view':
default:
$this->_viewComments();
break;
case 'save':
$this->_saveComment();
break;
case 'delete':
$this->_deleteComment();
break;
case 'approve':
$this->_approveComment();
break;
case 'add_new_comment':
$this->_doAddComment();
break;
}
}
/**
* Approve a comment on member's profile
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _approveComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// Try it. You might like it.
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$comment_lib = new profileCommentsLib( $this->registry );
$result = $comment_lib->approveComment( $member_id, $comment_id );
/* Check for error */
if( $result )
{
$this->registry->output->showError( $result, 10232 );
}
else
{
$member = IPSMember::load( $member_id );
$this->registry->output->redirectScreen( $this->lang->words['comment_was_approved'], $this->settings['base_url'] . 'showuser=' . $member_id, $member['members_seo_name'] );
}
}
/**
* Deletes a comment on member's profile
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _deleteComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// Try it. You might like it.
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$comment_lib = new profileCommentsLib( $this->registry );
$result = $comment_lib->deleteComment( $member_id, $comment_id );
/* Check for error */
if( $result )
{
$this->registry->output->showError( $result, 10232 );
}
else
{
$member = IPSMember::load( $member_id );
$this->registry->output->redirectScreen( $this->lang->words['comment_was_deleted'], $this->settings['base_url'] . 'showuser=' . $member_id, $member['members_seo_name'] );
}
}
/**
* Updates the comments
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-15
*/
private function _saveComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$content = '';
$comment_ids = array();
$final_ids = '';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
die( '' );
}
//-----------------------------------------
// My tab?
//-----------------------------------------
if ( $member_id != $this->memberData['member_id'] AND !$this->memberData['g_is_supmod'] )
{
die( '' );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
die( '' );
}
//-----------------------------------------
// Grab comment_ids
//-----------------------------------------
if ( is_array( $this->request['pp-checked'] ) AND count( $this->request['pp-checked'] ) )
{
foreach( $this->request['pp-checked'] as $key => $value )
{
$key = intval( $key );
if ( $value )
{
$comment_ids[ $key ] = $key;
}
}
}
//-----------------------------------------
// Update the database...
//-----------------------------------------
if ( is_array( $comment_ids ) AND count( $comment_ids ) )
{
$final_ids = implode( ',', $comment_ids );
//-----------------------------------------
// Now update...
//-----------------------------------------
switch( $this->request['pp-moderation'] )
{
case 'approve':
$this->DB->update( 'profile_comments', array( 'comment_approved' => 1 ), 'comment_id IN(' . $final_ids . ')' );
break;
case 'unapprove':
$this->DB->update( 'profile_comments', array( 'comment_approved' => 0 ), 'comment_id IN(' . $final_ids . ')' );
break;
case 'delete':
$this->DB->delete( 'profile_comments', 'comment_id IN(' . $final_ids . ')' );
break;
}
}
//-----------------------------------------
// Bounce...
//-----------------------------------------
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'app=members&section=comments&module=profile&member_id=' . $member_id . '&do=list&_saved=1&___msg=pp_comments_updated&md5check=' . $this->member->form_hash );
}
/**
* Loads the content for the comments tab
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _viewComments()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$content = '';
$comment_perpage = 10;
$pages = '';
$start = intval( $this->request['st'] );
$sql_extra = '';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
die( '' );
}
//-----------------------------------------
// Not my tab? So no moderation...
//-----------------------------------------
if ( ( $member_id != $this->memberData['member_id'] ) AND ( ! $this->memberData['g_is_supmod'] ) )
{
$sql_extra = ' AND comment_approved=1';
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
die( '' );
}
//-----------------------------------------
// How many comments must a man write down
// before he is considered a spammer?
//-----------------------------------------
$comment_count = $this->DB->buildAndFetch( array( 'select' => 'count(*) as count_comment',
'from' => 'profile_comments',
'where' => 'comment_for_member_id=' . $member_id . $sql_extra
) );
//-----------------------------------------
// Pages
//-----------------------------------------
$pages = $this->registry->output->generatePagination( array( 'totalItems' => intval( $comment_count['count_comment'] ),
'itemsPerPage' => $comment_perpage,
'currentStartValue' => $start,
'baseUrl' => $this->settings['base_url'] . 'app=members&amp;section=comments&amp;module=profile&amp;member_id=' . $member_id . '&amp;do=view&amp;md5check=' . $this->member->form_hash,
) );
//-----------------------------------------
// Regenerate comments...
//-----------------------------------------
$this->DB->build( array( 'select' => 'pc.*',
'from' => array( 'profile_comments' => 'pc' ),
'where' => 'pc.comment_for_member_id='.$member_id . $sql_extra,
'order' => 'pc.comment_date DESC',
'limit' => array( $start, $comment_perpage ),
'add_join' => array(
0 => array(
'select' => 'm.members_display_name, m.login_anonymous',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=pc.comment_by_member_id',
'type' => 'left'
),
1 => array(
'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=m.member_id',
'type' => 'left'
),
)
) );
$o = $this->DB->execute();
while( $row = $this->DB->fetch($o) )
{
$row['comment_content'] = IPSText::wordwrap( $row['comment_content'], '19', ' ' );
$row = IPSMember::buildDisplayData( $row, 0 );
if( !$row['members_display_name_short'] )
{
$row = array_merge( $row, IPSMember::setUpGuest() );
}
$comments[] = $row;
}
//-----------------------------------------
// Ok.. show the settings
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->showIframeComments( $member, $comments, $pages );
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] );
$this->registry->getClass('output')->popUpWindow( $content );
}
/**
* Save the new comment
*
* @access private
* @return void
*/
private function _doAddComment()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
$comment = $this->request['comment_text'];
/* Add Comment */
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$comment_lib = new profileCommentsLib( $this->registry );
$result = $comment_lib->addCommentToDB( $member_id, $comment );
/* Check for error */
if( $result AND $result != 'pp_comment_added_mod' )
{
$this->registry->output->showError( $result, 10232 );
}
else if ( $result == 'pp_comment_added_mod' )
{
$this->registry->output->redirectScreen( $this->lang->words[ $result ], $this->settings['base_url'] . 'showuser=' . $member_id );
}
else
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'showuser=' . $member_id );
}
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default profile section
* Last Updated: $Date: 2009-07-28 20:26:37 -0400 (Tue, 28 Jul 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Rev: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
/**
* Very simply returns the default section if one is not
* passed in the URL
*/
$DEFAULT_SECTION = 'view';
@@ -0,0 +1,107 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-03-04 07:36:56 -0500 (Wed, 04 Mar 2009) $
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4135 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_dname extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->request['id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'dname_profiles_off', 10233 );
}
if ( ! $this->settings['auth_allow_dnames'] )
{
$this->registry->output->showError( 'dnames_off', 10234 );
}
if( !$id )
{
$this->registry->output->showError( 'dnames_no_id', 10235 );
}
$member = IPSMember::load( $id );
//-----------------------------------------
// Get Dname history
//-----------------------------------------
$this->DB->build( array( 'select' => 'd.*',
'from' => array( 'dnames_change' => 'd' ),
'where' => 'dname_member_id='.$id,
'add_join' => array( 0 => array( 'select' => 'm.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=d.dname_member_id',
'type' => 'inner' ) ),
'order' => 'dname_date DESC'
) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$records[] = $row;
}
//-----------------------------------------
// Print the pop-up window
//-----------------------------------------
$html = $this->registry->getClass('output')->getTemplate('profile')->dnameWrapper( $member['members_display_name'], $records );
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->registry->getClass('output')->setTitle( $this->lang->words['dname_title'] );
$this->registry->getClass('output')->addNavigation( $this->lang->words['dname_title'], '' );
$this->registry->getClass('output')->addContent( $html );
$this->registry->output->sendOutput();
}
}
@@ -0,0 +1,718 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-09-22 10:21:17 -0400 (Tue, 22 Sep 2009) $
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 5138 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_friends extends ipsCommand
{
/**
* Friend's library
*
* @access private
* @var object
*/
private $friend_lib;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* Friends enabled? */
if( ! $this->settings['friends_enabled'] )
{
$this->registry->getClass('output')->showError( 'friends_not_enabled', 10236 );
}
/* Friend Library */
require_once( IPSLib::getAppDir( 'members' ) . '/sources/friends.php' );
$this->friend_lib = new profileFriendsLib( $this->registry );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
switch( $this->request['do'] )
{
case 'list':
default:
$this->_viewList();
break;
case 'add':
$this->_addFriend();
break;
case 'remove':
$this->_removeFriend();
break;
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 );
}
//-----------------------------------------
// 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, 0 );
}
//-----------------------------------------
// Ok.. show the friends
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->friendsIframe( $member, $friends, true );
$this->registry->getClass('output')->setTitle( $this->settings['board_name'] );
$this->registry->getClass('output')->addContent( $content );
$this->registry->getClass('output')->sendOutput();
}
/**
* Remove a friend
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-09
*/
private function _removeFriend()
{
/* INIT */
$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'];
if( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'nopermission', 10274 );
}
/* Remove the friend */
$result = $this->friend_lib->removeFriend( $friend_id );
/* Remove from other user as well */
$result2 = $this->friend_lib->removeFriend( $this->memberData['member_id'], $member_id );
if( $result )
{
$this->registry->output->showError( $result, 10237 );
}
else
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'showuser=' . $friend_id );
}
}
/**
* Moderate pending friends
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-09
*/
private function _moderation()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$friends = array();
$friend_ids = array();
$friend_member_ids = array();
$_friend_ids = array();
$friends_already = array();
$friends_update = array();
$member = array();
$pp_option = $this->request['pp_option'] == 'delete' ? 'delete' : 'add_reciprocal';//trim( $this->request['pp_option'] );
$message = '';
$subject = '';
$msg = 'pp_friend_approved';
//-----------------------------------------
// MD5 check
//-----------------------------------------
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();
}
//-----------------------------------------
// Get friends...
//-----------------------------------------
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();
}
//-----------------------------------------
// Figure IDs
//-----------------------------------------
foreach( $this->request['pp_friend_id'] as $key => $value )
{
$_key = intval( $key );
if ( $_key )
{
$_friend_ids[ $_key ] = $_key;
}
}
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() )
{
$friend_ids[ $row['friends_id'] ] = $row['friends_id'];
$friend_member_ids[ $row['friends_member_id'] ] = $row['friends_member_id'];
}
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 = IPSMember::load( $this->memberData['member_id'] );
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! is_array( $friends ) OR ! count( $friends ) OR ! $member['member_id'] )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . '&app=members&section=friends&module=profile&do=list&___msg=error&tab=pending' );
exit();
}
//-----------------------------------------
// What to do?
//-----------------------------------------
if ( $pp_option == 'delete' )
{
//-----------------------------------------
// Ok.. delete them in the DB.
//-----------------------------------------
$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 );
}
$msg = 'pp_friend_removed';
}
else
{
//-----------------------------------------
// Ok.. approve them in the DB.
//-----------------------------------------
$this->DB->update( 'profile_friends', array( 'friends_approved' => 1 ), 'friends_id IN(' . implode( ',', $friend_ids ) . ')' );
//-----------------------------------------
// And make sure they're added in reverse
//-----------------------------------------
foreach( $friend_member_ids as $friend_id )
{
$this->friend_lib->addFriend( $this->memberData['member_id'], $friend_id, true );
}
//-----------------------------------------
// Reciprocal mode?
//-----------------------------------------
if ( $pp_option == 'add_reciprocal' )
{
//-----------------------------------------
// Find out who isn't already on your list...
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'profile_friends',
'where' => 'friends_member_id=' . $this->memberData['member_id'] . ' AND friends_approved=1 AND friends_friend_id IN (' . implode( ',', $_friend_ids ) . ')' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$friends_already[ $row['friends_friend_id'] ] = $row['friends_friend_id'];
}
//-----------------------------------------
// Check which aren't already members...
//-----------------------------------------
foreach( $friend_member_ids as $id => $_id )
{
if ( in_array( $id, $friends_already ) )
{
continue;
}
$friends_update[ $id ] = $id;
}
//-----------------------------------------
// Gonna do it?
//-----------------------------------------
if ( is_array( $friends_update ) AND count( $friends_update ) )
{
foreach( $friends_update as $id => $_id )
{
$this->DB->insert( 'profile_friends', array( 'friends_member_id' => $member['member_id'],
'friends_friend_id' => $id,
'friends_approved' => 1,
'friends_added' => time() ) );
}
}
}
//-----------------------------------------
// Send out message...
//-----------------------------------------
foreach( $friends as $friend )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$message = '';
$subject = '';
if ( $friend['pp_setting_notify_friend'] )
{
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' ) );
$message = IPSText::getTextClass( 'email' )->message;
$subject = IPSText::getTextClass( 'email' )->subject;
$return_msg = '';
}
//-----------------------------------------
// Got anything to send?
//-----------------------------------------
if ( $message AND $subject )
{
//-----------------------------------------
// Email?
//-----------------------------------------
if ( $friend['pp_setting_notify_friend'] == 'email' OR $friend['members_disable_pm'] )
{
IPSText::getTextClass( 'email' )->subject = $subject;
IPSText::getTextClass( 'email' )->message = $message;
IPSText::getTextClass( 'email' )->to = $friend['email'];
IPSText::getTextClass( 'email' )->sendMail();
}
//-----------------------------------------
// PM?
//-----------------------------------------
else
{
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$this->messengerFunctions = new messengerFunctions( $this->registry );
try
{
$this->messengerFunctions->sendNewPersonalTopic( $friend['member_id'],
$member['member_id'],
array(),
$subject,
IPSText::getTextClass( 'editor' )->method == 'rte' ? nl2br($message) : $message,
array( 'origMsgID' => 0,
'fromMsgID' => 0,
'postKey' => md5(microtime()),
'trackMsg' => 0,
'addToSentFolder' => 0,
'hideCCUser' => 0,
'forcePm' => 1,
'isSystem' => 1,
)
);
}
catch( Exception $error )
{
$msg = $error->getMessage();
$toMember = IPSMember::load( $toMemberID, 'core', 'displayname' );
if ( strstr( $msg, 'BBCODE_' ) )
{
$msg = str_replace( 'BBCODE_', '', $msg );
$this->registry->output->showError( $msg, 10238 );
}
else if ( isset($this->lang->words[ 'err_' . $msg ]) )
{
$this->lang->words[ 'err_' . $msg ] = $this->lang->words[ 'err_' . $msg ];
$this->lang->words[ 'err_' . $msg ] = str_replace( '#NAMES#' , implode( ",", $this->messengerFunctions->exceptionData ), $this->lang->words[ 'err_' . $msg ] );
$this->lang->words[ 'err_' . $msg ] = str_replace( '#TONAME#' , $toMember['members_display_name'] , $this->lang->words[ 'err_' . $msg ] );
$this->lang->words[ 'err_' . $msg ] = str_replace( '#FROMNAME#', $this->memberData['members_display_name'], $this->lang->words[ 'err_' . $msg ] );
$this->registry->output->showError( 'err_' . $msg, 10239 );
}
else
{
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
$this->registry->output->showError( 'err_UNKNOWN', 10240 );
}
}
}
}
}
$this->friend_lib->recacheFriends( $friend );
}
//-----------------------------------------
// Recache..
//-----------------------------------------
$this->friend_lib->recacheFriends( $member );
//-----------------------------------------
// Return
//-----------------------------------------
$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]
* @since IPB 2.2.0.2006-08-09
*/
private function _addFriend()
{
/* INIT */
$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'];
if( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'nopermission', 10273 );
}
/* Add the friend */
$result = $this->friend_lib->addFriend( $friend_id );
/* Add to other user as well, but only if not pending */
if( !$this->friends->pendingApproval )
{
$result2 = $this->friend_lib->addFriend( $this->memberData['member_id'], $friend_id, true );
}
if( $result )
{
$this->registry->output->showError( $result, 10241 );
}
else
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . 'showuser=' . $friend_id );
}
}
/**
* List all current friends.
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-08
*/
private 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 );
$query = '';
$join_field = '';
$time_limit = time() - $this->settings['au_cutoff'] * 60;
$per_page = 25;
$start = intval( $this->request['st'] );
//-----------------------------------------
// Check we're a member
//-----------------------------------------
if ( ! $member_id )
{
$this->lang->loadLanguageFile( array( 'public_error' ), 'core' );
$this->registry->output->showError( $this->lang->words['no_friend_mid'], 10267 );
}
//-----------------------------------------
// To what are we doing to whom?
//-----------------------------------------
if ( $tab == 'pending' )
{
$query = 'f.friends_friend_id=' . $member_id . ' AND f.friends_approved=0';
$join_field = 'f.friends_member_id';
}
else if ( $tab == 'mutual' AND $friends_filter == 'added' )
{
$query = 'f.friends_friend_id=' . $member_id . ' AND f.friends_approved=1';
$join_field = 'f.friends_member_id';
}
else if ( $tab == 'mutual' )
{
# My friends...
$this->DB->build( array( 'select' => '*',
'from' => 'profile_friends',
'where' => 'friends_member_id=' . $member_id . ' AND friends_approved=1' ) );
$this->DB->execute();
while( $row = $this->DB->fetch() )
{
$_mutual_ids[] = $row['friends_friend_id'];
}
$query = 'f.friends_member_id IN (' . implode( ',', $_mutual_ids ) . ') AND f.friends_friend_id=' . $member_id . ' AND f.friends_approved=1';
$join_field = 'f.friends_member_id';
}
else
{
$query = 'f.friends_member_id=' . $member_id;
$join_field = '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(
'select' => 'COUNT(*) as count',
'from' => array( 'profile_friends' => 'f' ),
'where' => $query,
'add_join' => array( array(
'select' => '',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=' . $join_field,
'type' => 'inner'
) )
) );
//-----------------------------------------
// Pages...
//-----------------------------------------
$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,
) );
//-----------------------------------------
// 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=' . $join_field,
'type' => 'left'
),
array(
'select' => 'm.*',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=' . $join_field,
'type' => 'left'
)
)
) );
$q = $this->DB->execute();
//-----------------------------------------
// Get and store...
//-----------------------------------------
while( $row = $this->DB->fetch( $q ) )
{
$row = IPSMember::buildDisplayData( $row );
$friends[] = $row;
}
//-----------------------------------------
// Show...
//-----------------------------------------
$content = $this->registry->getClass('output')->getTemplate('profile')->friendsList( $friends, $pages );
$this->registry->output->setTitle( $this->lang->words['m_title_friends'] );
$this->registry->output->addNavigation( $this->lang->words['m_title_friends'], '' );
$this->registry->getClass('output')->addContent( $content );
$this->registry->getClass('output')->sendOutput( $content );
}
}
@@ -0,0 +1,247 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Ignore a user
* Last Updated: $Date: 2009-04-07 08:23:29 -0400 (Tue, 07 Apr 2009) $
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4414 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_ignore extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
switch( $this->request['do'] )
{
default:
case 'add':
$result = $this->ignoreMember( $this->request['memberID'], 'topics' );
break;
case 'remove':
$result = $this->stopIgnoringMember( $this->request['memberID'], 'topics' );
break;
case 'addPM':
$result = $this->ignoreMember( $this->request['memberID'], 'messages' );
break;
case 'removePM':
$result = $this->stopIgnoringMember( $this->request['memberID'], 'messages' );
break;
}
if( $result['error'] )
{
$this->registry->output->showError( $result['error'], 10266 );
}
else
{
$this->registry->output->redirectScreen( $result['message'], $this->settings['base_url'] . 'showuser=' . $this->request['memberID'] );
}
}
/**
* Ignore a member's topics
*
* @access public
* @param integer Member ID to ignore
* @param string Column to update
* @return array Array of info
*/
public function ignoreMember( $ignoreId, $type='topics' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->lang->loadLanguageFile( array( 'public_usercp' ), 'core' );
$ignoreId = intval( $ignoreId );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$antiType = $type == 'topics' ? 'messages' : 'topics';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if( !$ignoreId )
{
return array( 'error' => $this->lang->words['ignoreuser_noid'] );
}
if ( $md5check != $this->member->form_hash )
{
return array( 'error' => $this->lang->words['securehash_not_secure'] );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $ignoreId, 'core' );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
return array( 'error' => $this->lang->words['ignoreuser_noid'] );
}
//-----------------------------------------
// Can we ignore them?
//-----------------------------------------
if ( $member['_canBeIgnored'] !== TRUE )
{
return array( 0 => $this->lang->words['ignoreuser_cannot'] );
}
//-----------------------------------------
// Already ignoring?
//-----------------------------------------
$ignoreMe = $this->DB->buildAndFetch( array(
'select' => '*',
'from' => 'ignored_users',
'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']
) );
if ( $ignoreMe['ignore_id'] )
{
if( $ignoreMe['ignore_' . $type ] )
{
return array( 'error' => $this->lang->words['ignoreuser_already'] );
}
else
{
$this->DB->update( 'ignored_users', array( 'ignore_' . $type => 1 ), 'ignore_id=' . $ignoreMe['ignore_id'] );
return array( 'message' => $this->lang->words['ignoreuser_success'] );
}
}
//-----------------------------------------
// Add it
//-----------------------------------------
$this->DB->insert( 'ignored_users', array(
'ignore_owner_id' => $this->memberData['member_id'],
'ignore_ignore_id' => $member['member_id'],
'ignore_' . $antiType => 0,
'ignore_' . $type => 1,
)
);
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
return array( 'message' => $this->lang->words['ignoreuser_success'] );
}
/**
* Stop ignoring the user's topics
*
* @access public
* @param integer Member ID to stop ignoring
* @param string Column to update
* @return array Array of info
*/
public function stopIgnoringMember( $ignoreId, $type='topics' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->lang->loadLanguageFile( array( 'public_usercp' ), 'core' );
$ignoreId = intval( $ignoreId );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$antiType = $type == 'topics' ? 'messages' : 'topics';
//-----------------------------------------
// MD5 check
//-----------------------------------------
if( !$ignoreId )
{
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
}
if ( $md5check != $this->member->form_hash )
{
return array( 'error' => $this->lang->words['securehash_not_secure'] );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $ignoreId, 'core' );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
}
//-----------------------------------------
// Already ignoring?
//-----------------------------------------
$ignoreMe = $this->DB->buildAndFetch( array(
'select' => '*',
'from' => 'ignored_users',
'where' => 'ignore_owner_id=' . $this->memberData['member_id'] . ' AND ignore_ignore_id=' . $member['member_id']
) );
if ( $ignoreMe['ignore_id'] )
{
if( !$ignoreMe['ignore_' . $antiType ] )
{
$this->DB->delete( 'ignored_users', 'ignore_id=' . $ignoreMe['ignore_id'] );
}
else
{
$this->DB->update( 'ignored_users', array( 'ignore_' . $type => 0 ), 'ignore_id=' . $ignoreMe['ignore_id'] );
}
/* Rebuild cache */
IPSMember::rebuildIgnoredUsersCache( $this->memberData );
return array( 'message' => $this->lang->words['noignoreuser_success'] );
}
else
{
return array( 'error' => $this->lang->words['noignoreuser_noid'] );
}
}
}
@@ -0,0 +1 @@
<html>␍<head><title>IP.Board - Bulletin Board System</title></head>␍<body>␍<h1>403: IP.Board -> Forbidden</h1>␍<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>␍</body>␍</html>␍
@@ -0,0 +1,77 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-03-04 07:36:56 -0500 (Wed, 04 Mar 2009) $
*
* @author $Author: matt $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 4135 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_photo extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->request['id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'photos_profiles_off', 10242 );
}
if( !$id )
{
$this->registry->output->showError( 'photos_no_id', 10243 );
}
$member = IPSMember::load( $id );
$member = IPSMember::buildDisplayData( $member );
$html = $this->registry->getClass('output')->getTemplate('profile')->showPhoto( $member );
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->registry->getClass('output')->setTitle( $this->lang->words['photo_title'] );
$this->registry->getClass('output')->popUpWindow( $html );
}
}
@@ -0,0 +1,78 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Allow user to change their status
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4239 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_status extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Security check
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 20314 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->memberData['member_id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'status_off', 10268 );
}
if( !$id )
{
$this->registry->output->showError( 'status_off', 10269 );
}
$newStatus = trim( IPSText::getTextClass('bbcode')->stripBadWords( $this->request['new_status'] ) );
IPSMember::save( $id, array( 'extendedProfile' => array( 'pp_status' => $newStatus, 'pp_status_update' => time() ) ) );
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . 'showuser=' . $id, $this->memberData['members_seo_name'] );
}
}
@@ -0,0 +1,86 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Allow user to change their status
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_status extends ipsCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Security check
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 20314 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->memberData['member_id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( ! $this->memberData['g_mem_info'] OR $this->memberData['gbw_no_status_update'] )
{
$this->registry->output->showError( 'status_off', 10268 );
}
if( !$id )
{
$this->registry->output->showError( 'status_off', 10269 );
}
$newStatus = trim( IPSText::getTextClass('bbcode')->stripBadWords( $this->request['new_status'] ) );
IPSMember::save( $id, array( 'extendedProfile' => array( 'pp_status' => $newStatus, 'pp_status_update' => time() ) ) );
/* Got a return URL? */
if ( $this->request['rurl'] )
{
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . base64_decode( $this->request['rurl'] ) );
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['status_was_changed'], $this->settings['base_url'] . 'showuser=' . $id, $this->memberData['members_seo_name'] );
}
}
}
@@ -0,0 +1,676 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile View
* Last Updated: $Date: 2009-11-09 21:06:29 -0500 (Mon, 09 Nov 2009) $
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.iinvisionpower.com/community/board/license.html
* @package Invision Power Board
* @subpackage Members
* @link http://www.iinvisionpower.com
* @since 20th February 2002
* @version $Revision: 5342 $
*
*/
if ( ! defined( 'IN_IPB' ) )
{
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
exit();
}
class public_members_profile_view extends ipsCommand
{
/**
* Custom fields object
*
* @access public
* @var object
*/
public $custom_fields;
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
/**
* Member name
*
* @access public
* @var string
*/
private $member_name;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
$this->registry->class_localization->loadLanguageFile( array( 'public_online' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'profiles_off', 10245 );
}
$this->_viewModern();
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->registry->output->addContent( $this->output );
$this->registry->output->setTitle( $this->member_name . ' - ' . $this->lang->words['page_title_pp'] );
$this->registry->output->addNavigation( $this->lang->words['page_title_pp'], '' );
$this->registry->output->sendOutput();
}
/**
* Modern profile
*
* @access private
* @return void [Outputs to screen]
*/
private function _viewModern()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['id'] ) ? intval( $this->request['id'] ) : intval( $this->request['MID'] );
$member_id = $member_id ? $member_id : $this->memberData['member_id'];
$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;
$pips = 0;
$tabs = array();
$_tabs = array();
$_positions = array( 0 => 0 );
$custom_path = IPSLib::getAppDir( 'members' ) . '/sources/tabs';
$_member_ids = array();
$sql_extra = '';
$pass = 0;
$mod = 0;
$_todays_date = getdate();
$time_adjust = $this->settings['time_adjust'] == "" ? 0 : $this->settings['time_adjust'];
$board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
//-----------------------------------------
// Check input..
//-----------------------------------------
if ( ! $member_id )
{
$this->registry->output->silentRedirect( $this->settings['base_url'] );
}
//-----------------------------------------
// Configure tabs
//-----------------------------------------
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 );
require( $custom_path . '/' . $file );
//-------------------------------
// Allowed to use?
//-------------------------------
if ( $CONFIG['plugin_enabled'] )
{
if( in_array( $this->settings['search_method'], array( 'traditional', 'sphinx' ) ) && $CONFIG['plugin_key'] == 'recentActivity' )
{
continue;
}
$_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 != 'comments' AND $tab != 'settings' AND !file_exists( $custom_path . '/' . $tab . '.php' ) )
{
$tab = $firsttab;
}
//-----------------------------------------
// Grab all data...
//-----------------------------------------
$member = IPSMember::load( $member_id, 'profile_portal,pfields_content,sessions,groups', 'id' );
if ( !$member['member_id'] )
{
$this->registry->output->showError( 'profiles_no_member', 10246 );
}
// Cycle redirect on member profile for ID FURL Fix
if ( IPB_USE_ONLY_ID_FURL )
{
$member['members_seo_name'] = $member['member_id'];
}
else
{
$member['members_seo_name'] = ( $member['members_seo_name'] ) ? $member['members_seo_name'] : IPSText::makeSeoTitle( $member['members_display_name'] );
}
/* Check USER permalink... */
$this->registry->getClass('output')->checkPermalink( $member['members_seo_name'] );
/* Build data */
$member = IPSMember::buildDisplayData( $member, array( 'customFields' => 1, 'cfSkinGroup' => 'profile', 'checkFormat' => 1, 'cfGetGroupData' => 1, 'signature' => 1, 'spamStatus' => 1 ) );
//-----------------------------------------
// Recent visitor?
//-----------------------------------------
if ( $member['member_id'] != $this->memberData['member_id'] )
{
list( $be_anon, $loggedin ) = explode( '&', $this->memberData['login_anonymous'] );
if ( ! $be_anon )
{
$this->_addRecentVisitor( $member, $this->memberData['member_id'] );
}
}
//-----------------------------------------
// DST?
//-----------------------------------------
if ( $member['dst_in_use'] == 1 )
{
$member['time_offset'] += 1;
}
//-----------------------------------------
// Format extra user data
//-----------------------------------------
$member['_age'] = ( $member['bday_year'] ) ? date( 'Y' ) - $member['bday_year'] : 0;
if( $member['bday_month'] > date( 'n' ) )
{
$member['_age'] -= 1;
}
else if( $member['bday_month'] == date( 'n' ) )
{
if( $member['bday_day'] > date( 'j' ) )
{
$member['_age'] -= 1;
}
}
$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['_posts_day'] = 0;
$member['_total_pct'] = 0;
$member['_bday_month'] = $member['bday_month'] ? $this->lang->words['M_' . $member['bday_month'] ] : 0;
//-----------------------------------------
// BIO
// Not used/displayed anymore?
//-----------------------------------------
//$member['pp_bio_content'] = IPSText::getTextClass('bbcode')->stripBadWords( $member['pp_bio_content'] );
//$member['pp_bio_content'] = IPSText::wordwrap( $member['pp_bio_content'], '25', ' ' );
$posts = $this->DB->buildAndFetch( array(
'select' => "COUNT(*) as total_posts",
'from' => "posts",
'where' => "author_id=" . $member['member_id'],
) );
$member['posts'] = $posts['total_posts'];
//-----------------------------------------
// Total posts
//-----------------------------------------
if ( $member['posts'] and $board_posts )
{
$member['_posts_day'] = round( $member['posts'] / ( ( time() - $member['joined']) / 86400 ), 2 );
# Fix the issue when there is less than one day
$member['_posts_day'] = ( $member['_posts_day'] > $member['posts'] ) ? $member['posts'] : $member['_posts_day'];
$member['_total_pct'] = sprintf( '%.2f', ( $member['posts'] / $board_posts * 100 ) );
}
$member['_posts_day'] = floatval($member['_posts_day']);
if( ! $this->settings['disable_profile_stats'] )
{
//-----------------------------------------
// Most active in
//-----------------------------------------
/* Get list of good forum IDs */
$forumIdsOk = $this->registry->class_forums->fetchSearchableForumIds();
$faves = array();
$top = 0;
if( is_array($forumIdsOk) AND count($forumIdsOk) )
{
$favorite = $this->DB->buildAndFetch( array('select' => 'COUNT(p.author_id) as f_posts',
'from' => array( 'posts' => 'p' ),
'where' => 'p.author_id=' . $member['member_id'] . ' AND t.forum_id IN (' . implode( ",", $forumIdsOk ) . ") ",
'group' => 't.forum_id',
'order' => 'f_posts DESC',
'limit' => array( 0, 1 ),
'add_join' => array( array( 'select' => 't.forum_id',
'from' => array( 'topics' => 't' ),
'where' => 't.tid=p.topic_id' ) ) ) );
}
else
{
$favorite = array( 'forum_id' => 0, 'f_posts' => 0 );
}
$member['favorite_id'] = $favorite['forum_id'];
$member['_fav_posts'] = $favorite['f_posts'];
if( $member['posts'] )
{
$member['_fav_percent'] = round( $favorite['f_posts'] / $member['posts'] * 100 );
}
}
//-----------------------------------------
// Comments
//-----------------------------------------
if( $member['pp_setting_count_comments'] )
{
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$comment_lib = new profileCommentsLib( $this->registry );
$comment_html = $comment_lib->buildComments( $member );
}
//-----------------------------------------
// Visitors
//-----------------------------------------
if ( $member['pp_setting_count_visitors'] )
{
$_pp_last_visitors = unserialize( $member['pp_last_visitors'] );
$_visitor_info = array();
$_count = 1;
if ( is_array( $_pp_last_visitors ) )
{
krsort( $_pp_last_visitors );
$_members = IPSMember::load( array_values( $_pp_last_visitors ), 'extendedProfile' );
foreach( $_members as $_id => $_member )
{
$_visitor_info[ $_id ] = IPSMember::buildDisplayData( $_member, 0 );
}
foreach( $_pp_last_visitors as $_time => $_id )
{
if ( $_count > $member['pp_setting_count_visitors'] )
{
break;
}
$_count++;
if( !$_visitor_info[ $_id ]['members_display_name_short'] )
{
$_visitor_info[ $_id ] = IPSMember::setUpGuest();
}
$_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 );
if ( is_array( $_member_ids ) AND count( $_member_ids ) )
{
$_max = count( $_member_ids ) > 50 ? 50 : count( $_member_ids );
$_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 ) )
{
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_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['_location'] = $row['location'] ? $row['location'] : $this->lang->words['no_info'];
$row = IPSMember::buildProfilePhoto( $row );
$row['members_display_name_short'] = IPSText::truncate( $row['members_display_name'], 13 );
$friends[] = $row;
$member['_total_displayed_friends']++;
}
}
//-----------------------------------------
// Online location
//-----------------------------------------
$member = IPSMember::getLocation( $member );
//-----------------------------------------
// Add profile view
//-----------------------------------------
$this->DB->insert( 'profile_portal_views', array( 'views_member_id' => $member['member_id'] ), true );
//-----------------------------------------
// Grab default tab...
//-----------------------------------------
$tab_html = '';
if ( $tab != 'comments' AND $tab != 'settings' )
{
if( file_exists( $custom_path . '/' . $tab . '.php' ) )
{
require( $custom_path . '/pluginParentClass.php' );
require( $custom_path . '/' . $tab . '.php' );
$_func_name = 'profile_' . $tab;
$plugin = new $_func_name( $this->registry );
$tab_html = $plugin->return_html_block( $member );
}
}
//-----------------------------------------
// Set description tag
//-----------------------------------------
$_desc = ( $member['pp_about_me'] ) ? $member['pp_about_me'] : $member['signature'];
if ( $_desc )
{
$this->registry->output->addMetaTag( 'description', $member['members_display_name'] . ': ' . IPSText::getTextClass('bbcode')->stripAllTags( $_desc ) );
}
//-----------------------------------------
// Add to output
//-----------------------------------------
$this->member_name = $member['members_display_name'];
$this->output = $this->registry->getClass('output')->getTemplate('profile')->profileModern( $tabs, $member, $comment_html, $friends, $visitors, $tab, $tab_html, $fields );
}
/**
* Determines where to put custom profile tabs
*
* @access private
* @param array $takenPositions Array of positions that have been used
* @param integer $requestedPosition Position to check
* @return integer
*/
private function _getTabPosition( $takenPositions, $requestedPosition )
{
if( in_array( $requestedPosition, $takenPositions ) )
{
$requestedPosition++;
$this->_getTabPosition( $takenPositions, $requestedPosition );
}
return $requestedPosition;
}
/**
* Adds a recent visitor to ones profile
*
* @access private
* @param array Member information
* @param integer Member id to add
* @return boolean
* @since IPB 2.2.0.2006-7-31
*/
private function _addRecentVisitor( $member=array(), $member_id_to_add=0 )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id_to_add = intval( $member_id_to_add );
$found = 0;
$_recent_visitors = array();
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! $member_id_to_add )
{
return false;
}
//-----------------------------------------
// Sort out data...
//-----------------------------------------
$recent_visitors = unserialize( $member['pp_last_visitors'] );
if ( ! is_array( $recent_visitors ) OR ! count( $recent_visitors ) )
{
$recent_visitors = array();
}
foreach( $recent_visitors as $_time => $_id )
{
if ( $_id == $member_id_to_add )
{
$found = 1;
continue;
}
else
{
$_recent_visitors[ $_time ] = $_id;
}
}
$recent_visitors = $_recent_visitors;
krsort( $recent_visitors );
//-----------------------------------------
// No more than 10
//-----------------------------------------
if ( ! $found )
{
if ( count( $recent_visitors ) > 10 )
{
$_tmp = array_pop( $recent_visitors );
}
}
//-----------------------------------------
// Add the visit
//-----------------------------------------
$recent_visitors[ time() ] = $member_id_to_add;
krsort( $recent_visitors );
//-----------------------------------------
// Update profile...
//-----------------------------------------
if ( $member['pp_member_id'] )
{
$this->DB->update( 'profile_portal ', array( 'pp_last_visitors' => serialize( $recent_visitors ) ), 'pp_member_id=' . $member['member_id'], true );
}
else
{
$this->DB->insert( 'profile_portal ', array( 'pp_member_id' => $member['member_id'],
'pp_profile_update' => time(),
'pp_last_visitors' => serialize( $recent_visitors )
), true );
}
return true;
}
}