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

@@ -1,309 +0,0 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Profile View
* Last Updated: $Date: 2010-07-01 18:13:46 -0400 (Thu, 01 Jul 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Members
* @link http://www.invisionpower.com
* @since 20th February 2002
* @version $Revision: 6596 $
*
*/
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'] )
{
default:
die('');
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()
{
/* Security Check */
if ( $this->request['secure_key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'usercp_forums_bad_key', 103999, null, null, 403 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// Try it. You might like it.
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'members' ) . '/sources/comments.php', 'profileCommentsLib', 'members' );
$comment_lib = new $classToLoad( $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()
{
//-----------------------------------------
// Check form hash
//-----------------------------------------
$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( 'usercp_forums_bad_key', 1023222 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// Try it. You might like it.
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'members' ) . '/sources/comments.php', 'profileCommentsLib', 'members' );
$comment_lib = new $classToLoad( $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 );
}
/**
* Save the new comment
*
* @access private
* @return void
*/
private function _doAddComment()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
$comment = $this->request['comment_text'];
$md5check = IPSText::md5Clean( $this->request['auth_key'] );
/* Check member has */
if ( $md5check != $this->member->form_hash )
{
$this->registry->output->showError( $this->lang->words['no_permission'], 10233 );
}
/* Add Comment */
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'members' ) . '/sources/comments.php', 'profileCommentsLib', 'members' );
$comment_lib = new $classToLoad( $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 );
}
}
}
@@ -1,32 +1,14 @@
<?php
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Define the default profile section
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* </pre>
*
* @author $Author: bfarber $
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/community/board/license.html
* @package IP.Board
* @subpackage Members
* @link http://www.invisionpower.com
* @file defaultSection.php Define the default section for the 'profile' module
*~TERABYTE_DOC_READY~
* $Copyright: (c) 2001 - 2011 Invision Power Services, Inc.$
* $License: This is NULLED!
* $Author: ips_terabyte $
* @since 20th February 2002
* @version $Rev: 5713 $
*
* $LastChangedDate: 2011-05-05 12:40:49 -0400 (Thu, 05 May 2011) $
* @version v3.2.3
* $Revision: 8655 $
*/
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';
$DEFAULT_SECTION = 'view';
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Profile View
* Last Updated: $Date: 2010-06-10 06:36:42 -0400 (Thu, 10 Jun 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: danc $
* @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: 6502 $
* @version $Revision: 8644 $
*
*/
@@ -30,9 +30,8 @@ class public_members_profile_dname extends ipsCommand
/**
* 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 )
{
@@ -55,7 +54,7 @@ class public_members_profile_dname extends ipsCommand
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'dname_profiles_off', 10233, null, null, 403 );
$this->registry->output->showError( 'dname_profiles_off', 10233.22, null, null, 403 );
}
if ( ! $this->settings['auth_allow_dnames'] )
@@ -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();
}
}
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Ignore a user
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
* </pre>
*
* @author $Author: bfarber $
* @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: 5713 $
* @version $Revision: 8644 $
*
*/
@@ -30,9 +30,8 @@ class public_members_profile_ignore extends ipsCommand
/**
* 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 )
{
@@ -69,7 +68,6 @@ class public_members_profile_ignore extends ipsCommand
/**
* Ignore a member's topics
*
* @access public
* @param integer Member ID to ignore
* @param string Column to update
* @return array Array of info
@@ -169,7 +167,6 @@ class public_members_profile_ignore extends ipsCommand
/**
* 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
@@ -5,6 +5,6 @@
<hr>
You have reached this page in error, please use your back button to return to the forum.
<hr>
<a href="http://www.invisionboard.com/">IP.Board</a>
<a href="http://www.invisionpower.com">IP.Board</a>
</body>
</html>
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* Profile View
* Last Updated: $Date: 2010-06-10 06:36:42 -0400 (Thu, 10 Jun 2010) $
* IP.Board v3.2.3
* Ignore a user
* Last Updated: $Date: 2011-09-08 11:58:29 -0400 (Thu, 08 Sep 2011) $
* </pre>
*
* @author $Author: danc $
* @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: 6502 $
* @version $Revision: 9467 $
*
*/
@@ -30,50 +30,132 @@ class public_members_profile_photo extends ipsCommand
/**
* 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 )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval( $this->request['id'] );
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
/* Load lang file */
$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, null, null, 403 );
}
/* Load library */
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo' );
$this->photo = new $classToLoad( $registry );
if( !$id )
switch( $this->request['do'] )
{
$this->registry->output->showError( 'photos_no_id', 10243, null, null, 404 );
case 'save':
$this->_save();
break;
default:
case 'show':
$output = $this->_show();
break;
case 'remove':
$this->_remove();
break;
}
$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'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->getClass('output')->popUpWindow( $html );
}
/* Got anything to show? */
if ( $output )
{
$this->registry->output->addContent( $output );
$this->registry->output->setTitle( $this->lang->words['pe_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
$this->registry->output->addNavigation( $this->lang->words['pe_title'], '' );
$this->registry->output->sendOutput();
}
}
/**
* Removes pics
*
* @return @e void [HTML]
*/
protected function _remove()
{
$this->photo->remove( $this->memberData['member_id'] );
/* redirect to show */
$this->registry->output->redirectScreen( $this->lang->words['pp_photo_edited'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
}
/**
* Saves data
*
* @return @e void [HTML]
*/
protected function _save()
{
$getJson = intval( $this->request['getJson'] );
$photoType = $this->request['photoType'];
$gravatar = $this->request['gravatar'];
if ( $getJson )
{
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classAjax.php', 'classAjax' );
$ajax = new $classToLoad();
}
/* Do it */
try
{
$photo = $this->photo->save( $this->memberData, $photoType, $gravatar );
if ( is_array( $photo ) )
{
if ( $getJson )
{
$photo['oldThumb'] = $this->memberData['pp_small_photo'];
return $ajax->returnJsonArray( $photo, false, 'text/html' );
}
else
{
/* redirect to show */
$this->registry->output->redirectScreen( $this->lang->words['pp_photo_edited'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
}
}
}
catch( Exception $error )
{
$msg = $error->getMessage();
switch ( $msg )
{
default:
if ( $getJson )
{
$msg = ( ! empty( $this->lang->words[ 'pp_' . $msg ] ) ) ? $this->lang->words[ 'pp_' . $msg ] : $this->lang->words[ 'pp_generic_error' ];
$ajax->returnJsonError( $msg, 'text/html' );
exit();
}
else
{
$this->registry->getClass('output')->showError( $this->lang->words[ 'pp_' . $msg ], 1027, null, null, 403 );
}
break;
case 'PROFILE_DISABLED':
if ( $getJson )
{
$ajax->returnJsonError( 'member_profile_disabled', 'text/html' );
exit();
}
else
{
$this->registry->getClass('output')->showError( $this->lang->words['member_profile_disabled'], 1027, null, null, 403 );
}
break;
}
}
}
/**
* Display the photo editor
*
* @return @e void [HTML]
*/
protected function _show()
{
return $this->photo->getEditorHtml( $this->memberData );
}
}
@@ -3,19 +3,19 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.1.4
* IP.Board v3.2.3
* Allow user to change their status
* Last Updated: $Date: 2010-06-10 06:36:42 -0400 (Thu, 10 Jun 2010) $
* Last Updated: $Date: 2011-08-25 07:46:38 -0400 (Thu, 25 Aug 2011) $
* </pre>
*
* @author $Author: danc $
* @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 Tuesday 1st March 2005 (11:52)
* @version $Revision: 6502 $
* @version $Revision: 9413 $
*
*/
@@ -30,9 +30,8 @@ class public_members_profile_status extends ipsCommand
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
* @return @e void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
@@ -91,9 +90,8 @@ class public_members_profile_status extends ipsCommand
/**
* Lock a status
*
* @access private
*/
private function _lockStatus()
protected function _lockStatus()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
@@ -133,9 +131,8 @@ class public_members_profile_status extends ipsCommand
/**
* Lock a status
*
* @access private
*/
private function _unlockStatus()
protected function _unlockStatus()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
@@ -175,25 +172,27 @@ class public_members_profile_status extends ipsCommand
/**
* Delete a status reply
*
* @access private
*/
private function _list()
protected function _list()
{
/* INIT */
$filters = array( 'limit' => 15 );
$filters = array( 'offset' => intval( $this->request['st'] ), 'limit' => 15, 'getCount' => true );
/* Add to the filters */
if ( $this->request['member_id'] )
{
$filters['member_id'] = intval( $this->request['member_id'] );
$filters['relatedTo'] = intval( $this->request['member_id'] );
$filters['isApproved'] = true;
}
else if ( $this->request['status_id'] )
{
$filters['status_id'] = intval( $this->request['status_id'] );
$filters['type'] = 'all';
}
else if ( $this->request['type'] == 'friends' )
{
$filters['friends_only'] = 1;
$filters['type'] = 'all';
}
/* Fetch last 20 */
@@ -201,11 +200,17 @@ class public_members_profile_status extends ipsCommand
/* Fetch */
$statuses = $this->registry->getClass('memberStatus')->fetch( $this->memberData, $filters );
$count = $this->registry->getClass('memberStatus')->getStatusCount();
/* Fetch actions */
$actions = $this->registry->getClass('memberStatus')->fetchActions( $this->memberData, array( 'limit' => 30, 'not_theirs' => 1, 'custom' => 0 ) );
$pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $count,
'itemsPerPage' => 15,
'currentStartValue' => $this->request['st'],
'seoTitle' => true,
'seoTemplate' => 'members_status_all',
'showNumbers' => false,
'baseUrl' => "app=members&amp;module=profile&amp;section=status&amp;type={$this->request['type']}&amp;member_id={$this->request['member_id']}" ) );
$content = $this->registry->getClass('output')->getTemplate('profile')->statusUpdatesPage( $statuses, $actions );
$content = $this->registry->getClass('output')->getTemplate('profile')->statusUpdatesPage( $statuses, $pages );
$this->registry->output->addContent( $content );
$this->registry->output->setTitle( $this->lang->words['status_updates_title'] . ' - ' . ipsRegistry::$settings['board_name'] );
@@ -217,9 +222,8 @@ class public_members_profile_status extends ipsCommand
/**
* Delete a status reply
*
* @access private
*/
private function _deleteReply()
protected function _deleteReply()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
@@ -261,9 +265,8 @@ class public_members_profile_status extends ipsCommand
/**
* Delete a status
*
* @access private
*/
private function _deleteStatus()
protected function _deleteStatus()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
@@ -280,11 +283,14 @@ class public_members_profile_status extends ipsCommand
/* Set Data */
$this->registry->getClass('memberStatus')->setStatusData( $status_id );
/* Can we reply? */
/* Can we delete? */
if ( ! $this->registry->getClass('memberStatus')->canDeleteStatus() )
{
$this->registry->output->showError( 'status_off', 10279, null, null, 403 );
}
/* Get info */
$status = $this->registry->getClass('memberStatus')->getStatusData();
/* Update */
$this->registry->getClass('memberStatus')->deleteStatus();
@@ -296,16 +302,17 @@ class public_members_profile_status extends ipsCommand
}
else
{
$this->registry->output->redirectScreen( $this->lang->words['status_deleted'], $this->settings['base_url'] . 'showuser=' . $this->memberData['member_id'], $this->memberData['members_seo_name'] );
$_text = ( $status['status_member_id'] == $status['status_author_id'] ) ? $this->lang->words['status_deleted'] : $this->lang->words['comment_was_deleted'];
$this->registry->output->redirectScreen( $_text, $this->settings['base_url'] . 'showuser=' . $status['status_member_id'] . '&amp;tab=status', $status['members_seo_name'] );
}
}
/**
* Add a reply statussesses
*
* @access private
*/
private function _reply()
protected function _reply()
{
/* INIT */
$status_id = intval( $this->request['status_id'] );
@@ -350,13 +357,13 @@ class public_members_profile_status extends ipsCommand
/**
* Add a new statussesses
*
* @access private
*/
private function _new()
protected function _new()
{
$id = intval( $this->memberData['member_id'] );
$su_Twitter = intval( $this->request['su_Twitter'] );
$su_Facebook = intval( $this->request['su_Facebook'] );
$forMemberId = intval( $this->request['forMemberId'] );
/* Set Author */
$this->registry->getClass('memberStatus')->setAuthor( $this->memberData );
@@ -370,8 +377,24 @@ class public_members_profile_status extends ipsCommand
$this->registry->output->showError( 'status_off', 10268, null, null, 403 );
}
/* Set post outs */
$this->registry->getClass('memberStatus')->setExternalUpdates( array( 'twitter' => $su_Twitter, 'facebook' => $su_Facebook ) );
/* Update or comment? */
if ( $forMemberId && $forMemberId != $this->memberData['member_id'] )
{
$owner = IPSMember::load( $forMemberId );
if ( ! $owner['pp_setting_count_comments'] )
{
$this->registry->output->showError( 'status_off', 10268, null, null, 403 );
}
/* Set owner */
$this->registry->getClass('memberStatus')->setStatusOwner( $owner );
}
else
{
/* Set post outs */
$this->registry->getClass('memberStatus')->setExternalUpdates( array( 'twitter' => $su_Twitter, 'facebook' => $su_Facebook ) );
}
/* Update */
$this->registry->getClass('memberStatus')->create();
@@ -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 );
}