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,83 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX hCard
* Last Updated: $Date: 2009-09-30 06:58:35 -0400 (Wed, 30 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 Tuesday 1st March 2005 (11:52)
* @version $Revision: 5180 $
*
*/
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_ajax_card extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
$this->registry->class_localization->loadLanguageFile( array( 'public_profile') );
/* INIT */
$member_id = intval( $this->request['mid'] );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->returnString( 'error' );
}
if( !$member_id )
{
$this->returnString( 'error' );
}
$member = IPSMember::load( $member_id, 'profile_portal,pfields_content,sessions,groups,basic', 'id' );
if( !$member['member_id'] )
{
$this->returnString( 'error' );
}
$this->registry->class_localization->loadLanguageFile( array( 'public_online' ), 'members' );
$member = IPSMember::buildDisplayData( $member, array( 'customFields' => 1, 'cfSkinGroup' => 'profile', 'spamStatus' => 1 ) );
$member = IPSMember::getLocation( $member );
$board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
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'] );
$this->returnHtml( $this->registry->getClass('output')->getTemplate('profile')->showCard( $member ) );
}
}
@@ -0,0 +1,232 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Comment Handler
* 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 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_ajax_comments extends ipsAjaxCommand
{
/**
* Comments library
*
* @access private
* @var object
*/
private $comments;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
require_once( IPSLib::getAppDir( 'members' ) . '/sources/comments.php' );
$this->comments = new profileCommentsLib( $this->registry );
switch( $this->request[ 'do' ] )
{
case 'view':
default:
$this->returnHtml( $this->comments->buildComments( IPSMember::load( intval( $this->request['member_id'] ) ) ) );
break;
case 'add':
$this->_addComment();
break;
case 'delete':
$this->_deleteComment();
break;
case 'approve':
$this->_approveComment();
break;
case 'reload':
$this->_reloadComment();
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'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Delete
//-----------------------------------------
$result = $this->comments->approveComment( $member_id, $comment_id );
/* Check for error */
if( $result )
{
$this->returnString( $result );
}
else
{
$this->returnHtml( $this->comments->buildComments( IPSMember::load( $member_id ) ) );
}
}
/**
* Reload comments
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-15
*/
private function _reloadComment()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( $this->request['member_id'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Regenerate comments...
//-----------------------------------------
$this->returnHtml( $this->comments->buildComments( $member ) );
}
/**
* 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'] );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$comment_id = intval( $this->request['comment_id'] );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Delete
//-----------------------------------------
$result = $this->comments->deleteComment( $member_id, $comment_id );
/* Check for error */
if( $result )
{
$this->returnString( $result );
}
else
{
$this->returnHtml( $this->comments->buildComments( IPSMember::load( $member_id ) ) );
}
}
/**
* Saves a comment on member's profile
*
* @access private
* @return void [Prints to screen]
* @since IPB 2.2.0.2006-08-02
*/
private function _addComment()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
$result = $this->comments->addCommentToDB( $member_id, IPSText::parseCleanValue( $_POST['comment'] ) );
/* Check for error */
if( $result AND $result != 'pp_comment_added_mod' )
{
$this->returnString( $result );
}
else
{
$this->returnHtml( $this->comments->buildComments( IPSMember::load( $member_id ), $new_id, $return_msg ) );
}
}
}
@@ -0,0 +1,102 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile display name history
*
* @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_ajax_dname extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
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->returnJsonError( $this->lang->words['dname_profiles_off'] );
}
if ( ! $this->settings['auth_allow_dnames'] )
{
$this->returnJsonError( $this->lang->words['dnames_off'] );
}
if( !$id )
{
$this->returnJsonError( $this->lang->words['dnames_no_id'] );
}
$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->returnHtml( $html );
}
}
@@ -0,0 +1,51 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member AJAX DST switcher
* Last Updated: $Date: 2009-09-29 17:59:02 -0400 (Tue, 29 Sep 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 Tuesday 1st March 2005 (11:52)
* @version $Revision: 5178 $
*
*/
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_ajax_dst extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
if( !$this->memberData['member_id'] )
{
$this->returnNull();
}
if( $this->memberData['members_auto_dst'] == 1 AND $this->settings['time_dst_auto_correction'] )
{
$newValue = $this->memberData['dst_in_use'] ? 0 : 1;
IPSMember::save( $this->memberData['member_id'], array( 'members' => array( 'dst_in_use' => $newValue ) ) );
}
$this->returnNull();
}
}
@@ -0,0 +1,202 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Comment Handler
* 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 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_ajax_friends extends ipsAjaxCommand
{
/**
* Friends library
*
* @access private
* @var object
*/
private $friends;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
/* Friends Enabled */
if( ! $this->settings['friends_enabled'] )
{
$this->registry->getClass('output')->showError( 'friends_not_enabled', 10220 );
}
/* Friends Library */
require_once( IPSLib::getAppDir( 'members' ) . '/sources/friends.php' );
$this->friends = new profileFriendsLib( $registry );
switch( $this->request['do'] )
{
case 'add':
$this->_addFriend();
break;
case 'remove':
$this->_removeFriend();
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->returnString( $this->lang->words['nofriendid'] );
}
//-----------------------------------------
// 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 );
$this->returnHtml( $content );
}
/**
* Add a friend
*
* @access private
* @return void
*/
private function _addFriend()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
/* Add friend */
$result = $this->friends->addFriend( $member_id );
/* Add to other user as well, but only if not pending */
if( !$this->friends->pendingApproval )
{
$result2 = $this->friends->addFriend( $this->memberData['member_id'], $member_id, true );
}
/* Check for error */
if( $result )
{
$this->returnString( $result );
}
else
{
$this->returnString( 'success' );
}
}
/**
* Removes a friend
*
* @access private
* @return void
*/
private function _removeFriend()
{
/* INIT */
$member_id = intval( $this->request['member_id'] );
/* Remove friend */
$result = $this->friends->removeFriend( $member_id );
/* Remove from other user as well */
$result2 = $this->friends->removeFriend( $this->memberData['member_id'], $member_id );
/* Check for error */
if( $result )
{
$this->returnString( $result );
}
else
{
$this->returnString( 'success' );
}
}
}
@@ -0,0 +1,64 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Ignore User
* 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 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_ajax_ignore extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
/* Get ignore user quick call file */
require_once( IPSLib::getAppDir( 'members' ) . '/modules_public/profile/ignore.php' );
$library = new public_members_profile_ignore( $registry );
$library->makeRegistryShortcuts( $registry );
switch( $this->request['do'] )
{
default:
case 'add':
$result = $library->ignoreMember( $this->request['memberID'], 'topics' );
break;
case 'remove':
$result = $library->stopIgnoringMember( $this->request['memberID'], 'topics' );
break;
case 'addPM':
$result = $library->ignoreMember( $this->request['memberID'], 'messages' );
break;
case 'removePM':
$result = $library->stopIgnoringMember( $this->request['memberID'], 'messages' );
break;
}
$this->returnJsonArray( $result );
}
}
@@ -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,113 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Tab Loader
* 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 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_ajax_load extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval( ipsRegistry::$request['member_id'] );
$tab = substr( IPSText::alphanumericalClean( str_replace( '..', '', trim( ipsRegistry::$request['tab'] ) ) ), 0, 20 );
$md5check = IPSText::md5Clean( $this->request['md5check'] );
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ), 'members' );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member['member_id'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load config
//-----------------------------------------
if( !file_exists( IPSLib::getAppDir( 'members' ) . '/sources/tabs/' . $tab . '.conf.php' ) )
{
$this->returnString( 'error' );
}
require( IPSLib::getAppDir( 'members' ) . '/sources/tabs/' . $tab . '.conf.php' );
//-----------------------------------------
// Active?
//-----------------------------------------
if ( ! $CONFIG['plugin_enabled'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load main class...
//-----------------------------------------
if( !file_exists( IPSLib::getAppDir( 'members' ) . '/sources/tabs/' . $tab . '.php' ) )
{
$this->returnString( 'error' );
}
require( IPSLib::getAppDir( 'members' ) . '/sources/tabs/pluginParentClass.php' );
require( IPSLib::getAppDir( 'members' ) . '/sources/tabs/' . $tab . '.php' );
$_func_name = 'profile_' . $tab;
$plugin = new $_func_name( $this->registry );
$html = $plugin->return_html_block( $member );
//-----------------------------------------
// Return it...
//-----------------------------------------
$this->returnHtml( $html );
}
}
@@ -0,0 +1,699 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Ignored User methods
* 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 Thursday 26th June 2008
* @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_ajax_messenger extends ipsAjaxCommand
{
/**
* Messenger library
*
* @access private
* @var object
*/
private $messengerFunctions;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Grab class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$this->messengerFunctions = new messengerFunctions( $registry );
switch( $this->request[ 'do' ] )
{
case 'addFolder':
$this->_addFolder();
break;
case 'removeFolder':
$this->_removeFolder();
break;
case 'renameFolder':
$this->_renameFolder();
break;
case 'emptyFolder':
$this->_emptyFolder();
break;
case 'getPMNotification':
$this->_getPMNotification();
break;
case 'showQuickForm':
$this->_showQuickForm();
break;
case 'PMSend':
$this->_PMSend();
break;
default:
break;
}
}
/**
* Sends the PM
*
* @access private
* @return string HTML to be returned via ajax
* @since IPB 3.0.0.2008-06-25
*/
private function _PMSend()
{
if( $this->messengerFunctions->checkHasHitMax() )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$toMemberID = intval( $this->request['toMemberID'] );
$msgContent = $this->convertHtmlEntities( $this->convertUnicode( $_POST['Post'] ) );
$msgTitle = IPSText::parseCleanValue( $this->convertHtmlEntities( $this->convertUnicode( $_POST['subject'] ) ) );
$this->request['Post'] = IPSText::parseCleanValue( $_POST['Post'] );
$_trackMsg = intval( $this->request['trackMsg'] );
$_addToSent = intval( $this->request['addToSent'] );
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if ( ! $this->memberData['g_use_pm'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
if ( $this->memberData['members_disable_pm'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
if ( ! $this->memberData['member_id'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
//-----------------------------------------
// Reset Classes
//-----------------------------------------
IPSText::resetTextClass('editor');
//-----------------------------------------
// Load lang file
//-----------------------------------------
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( "public_error" ), 'core' );
//-----------------------------------------
// Language
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_messaging' ), 'members' );
//-----------------------------------------
// Send .. or.. save...
//-----------------------------------------
try
{
$this->messengerFunctions->sendNewPersonalTopic( $toMemberID, $this->memberData['member_id'], array(), $msgTitle, $msgContent, array( 'origMsgID' => 0,
'fromMsgID' => 0,
'postKey' => md5(microtime()),
'trackMsg' => $_trackMsg,
'addToSentFolder' => $_addToSent,
'hideCCUser' => 0 ) );
return $this->returnJsonArray( array( 'status' => 'sent' ) );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$toMember = IPSMember::load( $toMemberID, 'core', 'displayname' );
if ( strstr( $msg, 'BBCODE_' ) )
{
$msg = str_replace( 'BBCODE_', '', $msg );
return $this->returnJsonArray( array( 'inlineError' => $this->lang->words[ $msg ] ) );
}
else if ( isset($this->lang->words[ 'err_' . $msg ]) )
{
$_msgString = $this->lang->words[ 'err_' . $msg ];
$_msgString = str_replace( '#NAMES#' , implode( ",", $this->messengerFunctions->exceptionData ), $_msgString );
$_msgString = str_replace( '#TONAME#' , $toMember['members_display_name'] , $_msgString );
$_msgString = str_replace( '#FROMNAME#', $this->memberData['members_display_name'], $_msgString );
}
else
{
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
}
return $this->returnJsonArray( array( 'inlineError' => $_msgString ) );
}
}
/**
* Shows the quick PM form
*
* @access private
* @return string HTML to be returned via ajax
* @since IPB 3.0.0.2008-06-25
*/
private function _showQuickForm()
{
if( $this->messengerFunctions->checkHasHitMax() )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$toMemberID = intval( $this->request['toMemberID'] );
//-----------------------------------------
// Load...
//-----------------------------------------
$toMemberData = IPSMember::load( $toMemberID, 'all' );
if ( ! $toMemberData['member_id'] )
{
$this->returnJsonError( 'noSuchToMember' );
}
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if ( ! $this->memberData['g_use_pm'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
if ( $this->memberData['members_disable_pm'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
if ( ! $this->memberData['member_id'] )
{
$this->returnJsonError( 'cannotUsePMSystem' );
}
//-----------------------------------------
// Stil here?
//-----------------------------------------
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_editors' ), 'core' );
return $this->returnJsonArray( array( 'success' => $this->registry->getClass('output')->getTemplate('messaging')->PMQuickForm( $toMemberData ) ) );
}
/**
* Returns PM notification
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _getPMNotification()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$limit = intval( $this->request['limit'] );
//-----------------------------------------
// INIT the parser
//-----------------------------------------
IPSText::resetTextClass('bbcode');
IPSText::getTextClass('bbcode')->allow_update_caches = 0;
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = 0;
IPSText::getTextClass('bbcode')->parsing_section = 'pms';
//-----------------------------------------
// Get last PM details
//-----------------------------------------
$msg = $this->DB->buildAndFetch( array( 'select' => 'mt.*',
'from' => array( 'message_topics' => 'mt' ),
'where' => "mt.mt_owner_id=" . $this->memberData['member_id'] . " AND mt.mt_vid_folder='in'",
'order' => 'mt.mt_date DESC',
'limit' => array( intval($limit), 1 ),
'add_join' => array(
array( 'select' => 'msg.*',
'from' => array( 'message_text' => 'msg' ),
'where' => 'msg.msg_id=mt.mt_msg_id',
'type' => 'left'
),
array( 'select' => 'm.member_id,m.name,m.member_group_id,m.mgroup_others,m.email,m.joined,m.posts, m.last_visit, m.last_activity, m.warn_level, m.warn_lastwarn, m.members_display_name',
'from' => array( 'members' => 'm' ),
'where' => 'm.member_id=mt.mt_from_id',
'type' => 'left'
),
array( 'select' => 'pp.*',
'from' => array( 'profile_portal' => 'pp' ),
'where' => 'pp.pp_member_id=mt.mt_from_id',
'type' => 'left'
),
array( 'select' => 'g.g_id, g.g_title, g.g_icon, g.g_dohtml',
'from' => array( 'groups' => 'g' ),
'where' => 'g.g_id=m.member_group_id',
'type' => 'left'
) ) ) );
//-----------------------------------------
// Check...
//-----------------------------------------
if ( ! $msg['msg_id'] and ! $msg['mt_id'] and ! $msg['id'] )
{
$this->returnJsonError( 'noMsg' );
}
//-----------------------------------------
// Strip and wrap
//-----------------------------------------
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $msg['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $msg['mgroup_others'];
$msg['msg_post'] = IPSText::getTextClass('bbcode')->stripAllTags( strip_tags( str_replace( '<br />', "\n", $msg['msg_post'] ) ) );
$msg['msg_post'] = IPSText::getTextClass('bbcode')->wordWrap( $msg['msg_post'], 50, "\n" );
if ( IPSText::mbstrlen( $msg['msg_post'] ) > 300 )
{
$msg['msg_post'] = IPSText::truncate( $msg['msg_post'], 350 ) ;
}
$msg['msg_post'] = nl2br($msg['msg_post']);
//-----------------------------------------
// Add attach icon
//-----------------------------------------
if ( $msg['mt_hasattach'] )
{
$msg['attach_img'] = '<{ATTACH_ICON}>&nbsp;';
}
//-----------------------------------------
// Date
//-----------------------------------------
$msg['msg_date'] = $this->registry->getClass('class_localization')->getDate( $msg['msg_date'], 'TINY' );
//-----------------------------------------
// Next / Total links
//-----------------------------------------
$msg['_cur_num'] = intval($limit) + 1;
$msg['_msg_count_total'] = intval($this->memberData['msg_count_new']) ? intval($this->memberData['msg_count_new']) : 1;
//-----------------------------------------
// Return loverly HTML
//-----------------------------------------
return $this->returnHtml( $this->registry->getClass('output')->getTemplate('messaging')->PMNotificationBox( $msg ) );
}
/**
* Empties a folder
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _emptyFolder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$folderID = IPSText::alphanumericalClean( $this->request['folderID'] );
$memberID = intval( $this->request['memberID'] );
$memberData = IPSMember::load( $memberID, 'extendedProfile' );
$status = 'ok';
$mtids = array();
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $memberData['member_id'] OR ! $folderID )
{
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// First off, get dir data
//-----------------------------------------
$folders = $this->messengerFunctions->explodeFolderData( $memberData['pconversation_filters'] );
//-----------------------------------------
// "New" folder?
//-----------------------------------------
if ( $folderID == 'new' )
{
/* Just mark them as read */
$this->DB->update( 'message_topic_user_map', array( 'map_has_unread' => 0 ), 'map_user_id=' . $memberID . " AND map_user_banned=0 AND map_user_active=1" );
}
else
{
/* Delete all PMs -you- sent regardless of which folder they're in */
$messages = $this->messengerFunctions->getPersonalTopicsList( $memberID, $folderID, array( 'offsetStart' => 0, 'offsetEnd' => 100000 ) );
/* Just grab IDs */
$mtids = array_keys( $messages );
//-----------------------------------------
// Got anything?
//-----------------------------------------
if ( ! count( $mtids ) )
{
$this->returnJsonError( 'nothingToRemove' );
}
//-----------------------------------------
// Delete the messages
//-----------------------------------------
try
{
$this->messengerFunctions->deleteTopics( $memberData['member_id'], $mtids );
}
catch( Exception $error )
{
$this->returnJsonError( $error->getMessage() );
}
}
//-----------------------------------------
// Reset total message count
//-----------------------------------------
$totalMsgs = $this->messengerFunctions->resetMembersTotalTopicCount( $memberData['member_id'] );
//-----------------------------------------
// Update directory counts
//-----------------------------------------
$newDirs = $this->messengerFunctions->resetMembersFolderCounts( $memberData['member_id'] );
$folders = $this->messengerFunctions->explodeFolderData( $newDirs );
$this->returnJsonArray( array( 'status' => $status, 'totalMsgs' => $totalMsgs, 'newDirs' => $newDirs, 'affectedDirCount' => $folders[ $folderID ]['count'] ) );
}
/**
* Renames a folder
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _renameFolder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$folderID = IPSText::alphanumericalClean( $this->request['folderID'] );
$memberID = intval( $this->request['memberID'] );
$memberData = IPSMember::load( $memberID, 'extendedProfile' );
// If we run through alpha clean, chars in other langs don't work properly of course
$name = IPSText::truncate( $this->convertAndMakeSafe($_POST['name']), 50 ); //IPSText::alphanumericalClean( $this->request['name'], ' ' );
$status = 'ok';
//-----------------------------------------
// First off, get dir data
//-----------------------------------------
$folders = $this->messengerFunctions->explodeFolderData( $memberData['pconversation_filters'] );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $memberData['member_id'] OR ! $folderID )
{
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// Now ensure we actually have that folder
//-----------------------------------------
if ( ! $folders[ $folderID ] )
{
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// ..and it is not a 'set' folder..
// 8.25.2008 - We should be able to rename these
// 10.10.2008 - No, we shouldn't now they are "magic"
//-----------------------------------------
/* Protected? */
if ( $folders[ $folderID ]['protected'] )
{
$this->returnJsonError( 'cannotDeleteUndeletable' );
}
//-----------------------------------------
// OK, rename it.
//-----------------------------------------
$folders[ $folderID ]['real'] = $name;
//-----------------------------------------
// Collapse
//-----------------------------------------
$newDirs = $this->messengerFunctions->implodeFolderData( $folders );
//-----------------------------------------
// Save...
//-----------------------------------------
IPSMember::save( $memberID, array( 'extendedProfile' => array( 'pconversation_filters' => $newDirs ) ) );
//-----------------------------------------
// Return...
//-----------------------------------------
$this->returnJsonArray( array( 'status' => $status, 'newDirs' => $newDirs, 'name' => $name ) );
}
/**
* Removes a folder
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _removeFolder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$folderID = IPSText::alphanumericalClean( $this->request['folderID'] );
$memberID = intval( $this->request['memberID'] );
$memberData = IPSMember::load( $memberID, 'extendedProfile' );
$status = 'ok';
IPSDebug::fireBug( 'info', array( 'Received folder id:' . $folderID ) );
IPSDebug::fireBug( 'info', array( 'Received member id:' . $memberID ) );
//-----------------------------------------
// First off, get dir data
//-----------------------------------------
$folders = $this->messengerFunctions->explodeFolderData( $memberData['pconversation_filters'] );
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $memberData['member_id'] OR ! $folderID )
{
IPSDebug::fireBug( 'error', array( 'Missing member id or folder id' ) );
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// Now ensure we actually have that folder
//-----------------------------------------
if ( ! $folders[ $folderID ] )
{
IPSDebug::fireBug( 'error', array( 'Specified folder does not exist' ) );
$this->returnJsonError( 'noSuchFolder' );
}
//-----------------------------------------
// Protected folder?
//-----------------------------------------
/* Protected? */
if ( $folders[ $folderID ]['protected'] )
{
$this->returnJsonError( 'cannotDeleteUndeletable' );
}
//-----------------------------------------
// .. and it has no messages
//-----------------------------------------
if ( $folders[ $folderID ]['count'] > 0 )
{
$this->returnJsonError( 'cannotDeleteHasMessages' );
}
//-----------------------------------------
// OK, remove it.
//-----------------------------------------
unset( $folders[ $folderID ] );
///-----------------------------------------
// Collapse
//-----------------------------------------
$newDirs = $this->messengerFunctions->implodeFolderData( $folders );
//-----------------------------------------
// Save...
//-----------------------------------------
IPSMember::save( $memberID, array( 'extendedProfile' => array( 'pconversation_filters' => $newDirs ) ) );
//-----------------------------------------
// Return...
//-----------------------------------------
$this->returnJsonArray( array( 'status' => $status, 'newDirs' => $newDirs ) );
}
/**
* Adds a folder
*
* @access private
* @return string JSON either error or status
* @since IPB 3.0.0.2008-06-25
*/
private function _addFolder()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$name = IPSText::truncate( $this->convertAndMakeSafe($_POST['name']), 50 );
$memberID = intval( $this->request['memberID'] );
$memberData = IPSMember::load( $memberID, 'extendedProfile' );
$status = 'ok';
$maxID = 0;
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $memberData['member_id'] OR ! $name )
{
$this->returnJsonError( 'invalidName' );
}
//-----------------------------------------
// Get vdir information
//-----------------------------------------
$folders = $this->messengerFunctions->explodeFolderData( $memberData['pconversation_filters'] );
foreach( $folders as $id => $folder )
{
if ( stristr( $folder['id'], 'dir_' ) )
{
$maxID = intval( str_replace( 'dir_', "", $folder['id'] ) ) + 1;
}
}
//-----------------------------------------
// Add a folder
//-----------------------------------------
$folders[ 'dir_' . $maxID ] = array( 'id' => 'dir_' . $maxID,
'real' => $name,
'protected' => 0,
'count' => 0 );
//-----------------------------------------
// If we have more than 50 folders, error
//-----------------------------------------
if ( count( $folders ) > 50 )
{
$this->returnJsonError( 'tooManyFolders' );
}
//-----------------------------------------
// Collapse
//-----------------------------------------
$newDirs = $this->messengerFunctions->implodeFolderData( $folders );
//-----------------------------------------
// Save...
//-----------------------------------------
IPSMember::save( $memberID, array( 'extendedProfile' => array( 'pconversation_filters' => $newDirs ) ) );
//-----------------------------------------
// Return...
//-----------------------------------------
$this->returnJsonArray( array( 'status' => $status, 'newDirs' => $newDirs, 'newID' => 'dir_' . $maxID ) );
}
}
@@ -0,0 +1,149 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Tab Loader
* Last Updated: $Date: 2009-09-22 17:31:43 -0400 (Tue, 22 Sep 2009) $
*
* @author $Author: josh $
* @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: 5141 $
*
*/
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_ajax_rate extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$rating_id = intval($this->request['rating']);
$rating_id = $rating_id > 5 ? 5 : $rating_id;
$rating_id = $rating_id < 0 ? 0 : $rating_id;
$member_id = intval($this->request['member_id']);
$member = array();
$type = 'new';
$md5_check = IPSText::md5Clean( $this->request['md5check'] );
$error = array();
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $this->settings['pp_allow_member_rate'] )
{
$error['error_key'] = 'user_rate_no_perm';
$this->returnJsonArray( $error );
}
if ( ! $member_id OR ! $this->memberData['member_id'] OR $member_id == $this->memberData['member_id'] )
{
$error['error_key'] = 'user_rate_no_perm';
$this->returnJsonArray( $error );
}
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5_check != $this->member->form_hash )
{
$error['error_key'] = 'user_rate_no_perm3';
$this->returnJsonArray( $error );
}
$member = IPSMember::load( $member_id, 'extendedProfile,groups' );
if ( ! $member['member_id'] )
{
$error['error_key'] = 'user_rate_no_perm4';
$this->returnJsonArray( $error );
}
//-----------------------------------------
// Have we already rated?
//-----------------------------------------
$rating = $this->DB->buildAndFetch( array( 'select' => '*',
'from' => 'profile_ratings',
'where' => "rating_for_member_id={$member_id} AND rating_by_member_id=" . $this->memberData['member_id'] ) );
//-----------------------------------------
// Already rated?
//-----------------------------------------
if ( $rating['rating_id'] )
{
//-----------------------------------------
// Do we allow re-ratings?
//-----------------------------------------
if ( $rating_id != $rating['rating_value'] )
{
$member['pp_rating_value'] = intval( $member['pp_rating_value'] );
$member['pp_rating_value'] = ( $member['pp_rating_value'] + $rating_id ) - $rating['rating_value'];
$this->DB->update( 'profile_ratings', array( 'rating_value' => $rating_id ), 'rating_id=' . $rating['rating_id'] );
$this->DB->update( 'profile_portal', array( 'pp_rating_value' => $member['pp_rating_value'],
'pp_rating_real' => round( $member['pp_rating_value'] / $member['pp_rating_hits'] ) ), 'pp_member_id=' . $member_id );
$type = 'update';
}
}
//-----------------------------------------
// NEW RATING!
//-----------------------------------------
else
{
$member['pp_rating_value'] = intval($member['pp_rating_value']) + $rating_id;
$member['pp_rating_hits'] = intval($member['pp_rating_hits']) + 1;
$this->DB->insert( 'profile_ratings', array( 'rating_for_member_id' => $member_id,
'rating_by_member_id' => $this->memberData['member_id'],
'rating_value' => $rating_id,
'rating_ip_address' => $this->member->ip_address ) );
$this->DB->update( 'profile_portal', array( 'pp_rating_hits' => intval($member['pp_rating_hits']),
'pp_rating_value' => intval($member['pp_rating_value']),
'pp_rating_real' => round( $member['pp_rating_value'] / $member['pp_rating_hits'] ) ), 'pp_member_id=' . $member_id );
}
$member['pp_rating_real'] = round( $member['pp_rating_value'] / $member['pp_rating_hits'] );
$return = array(
'rating' => $member['pp_rating_value'],
'total' => $member['pp_rating_real'],
'average' => $member['pp_rating_real'],
'rated' => $type
);
$this->returnJsonArray( $return );
//$this->returnString( $member['pp_rating_value'] . ',' . $member['pp_rating_hits'] . ',' . $member['pp_rating_real'] . ',' . $type );
}
}
@@ -0,0 +1,153 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Profile AJAX Tab Loader
* 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 Tuesday 1st March 2005 (11:52)
* @version $Revision: 4948 $
* @deprecated We no longer have AJAX setting changes in profile
*
*/
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_ajax_settings extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$member_id = intval($this->request['member_id']);
$member = array();
$command = trim( $this->request['cmd'] );
$value = $this->convertAndMakeSafe( $this->request['value'], 0 );
$md5_check = IPSText::md5Clean( $this->request['md5check'] );
$return_string = '';
$pp_b_day = intval( $this->request['pp_b_day'] );
$pp_b_month = intval( $this->request['pp_b_month'] );
$pp_b_year = intval( $this->request['pp_b_year'] );
//-----------------------------------------
// MD5 check
//-----------------------------------------
if ( $md5_check != $this->member->form_hash )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Check
//-----------------------------------------
if ( ! $member_id OR ! $this->memberData['member_id'] )
{
$this->returnString( 'error' );
}
if ( ! $this->memberData['g_edit_profile'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Load member
//-----------------------------------------
$member = IPSMember::load( $member_id, 'extendedProfile,groups' );
if ( ! $member['member_id'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Not the same member?
//-----------------------------------------
if ( !$this->memberData['g_is_supmod'] AND $member_id != $this->memberData['member_id'] )
{
$this->returnString( 'error' );
}
//-----------------------------------------
// Alright.. what are we doing?
//-----------------------------------------
switch( $command )
{
case 'birthdate':
$this->registry->class_localization->loadLanguageFile( array( 'public_profile' ) );
if( $pp_b_month OR $pp_b_day OR $pp_b_year )
{
if ( ! $pp_b_month or ! $pp_b_day )
{
$return_string = 'dateerror';
}
}
if ( ( $pp_b_month AND $pp_b_day AND $pp_b_year ) AND ! @checkdate( $pp_b_month, $pp_b_day, $pp_b_year ) )
{
$return_string = 'dateerror';
}
if( $return_string != 'dateerror' )
{
IPSMember::save( $member_id, array( 'core' => array( 'bday_month' => intval( $pp_b_month ), 'bday_day' => intval( $pp_b_day ), 'bday_year' => intval( $pp_b_year ) ) ) );
$_pp_b_month = '';
if( $pp_b_month > 0 AND $pp_b_month < 13 )
{
$_pp_b_month = $this->lang->words['M_' . $pp_b_month ];
}
$date_vars = array();
# Adding this to support birthdays that don't specify all 3 params
if( $_pp_b_month )
{
$date_vars[] = $_pp_b_month;
}
if( $pp_b_day )
{
$date_vars[] = $pp_b_day;
}
if( $pp_b_year )
{
$date_vars[] = $pp_b_year;
}
$return_string = ( count($date_vars) ) ? implode( '-', $date_vars ) : $this->lang->words['m_bday_unknown'];
}
}
$this->returnString( $return_string );
}
}
@@ -0,0 +1,71 @@
<?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_ajax_status extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// 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->returnJsonError( $this->lang->words['status_off'] );
}
if( !$id )
{
$this->returnJsonError( $this->lang->words['status_off'] );
}
$newStatus = trim( IPSText::getTextClass('bbcode')->stripBadWords( IPSText::parseCleanValue( $_POST['new_status'] ) ) );
IPSMember::save( $id, array( 'extendedProfile' => array( 'pp_status' => $newStatus, 'pp_status_update' => time() ) ) );
$this->returnJsonArray( array( 'status' => 'success', 'new_status' => $newStatus ) );
exit;
}
}
@@ -0,0 +1,76 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Retrieve member warn log
* 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 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_ajax_warn extends ipsAjaxCommand
{
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute( ipsRegistry $registry )
{
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ), 'forums' );
if ( ! $this->settings['warn_on'] )
{
$this->returnJsonError( $this->lang->words['ajax_no_warn'] );
}
switch( $this->request['do'] )
{
case 'view':
$this->_viewWarnLogs();
break;
}
}
/**
* Retieve warn logs and return them
*
* @access private
* @return void
*/
private function _viewWarnLogs()
{
require_once( IPSLib::getAppDir('members') . '/modules_public/warn/warn.php' );
$warn = new public_members_warn_warn( $this->registry );
$warn->makeRegistryShortcuts( $this->registry );
$warn->loadData();
$warnHTML = $warn->viewLog();
if ( !$warnHTML )
{
$this->returnJsonError( $this->lang->words['ajax_bad_html'] );
}
else
{
$this->returnHtml( $this->registry->getClass('output')->getTemplate('mod')->warnLogsAjaxWrapper( $warnHTML ) );
}
}
}
@@ -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,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default memberlist 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 @@
<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,522 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member list
* Last Updated: $Date: 2009-12-07 21:57:46 -0500 (Mon, 07 Dec 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: 5529 $
*
*/
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_list_view extends ipsCommand
{
/**
* Custom fields object
*
* @access public
* @var object
*/
public $custom_fields;
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
/**
* DB result start point
*
* @access private
* @var integer
*/
private $first = 0;
/**
* Maximum results per page
*
* @access private
* @var integer
*/
private $max_results = 20;
/**
* Key to sort on
*
* @access private
* @var string
*/
private $sort_key = 'members_display_name';
/**
* Sort order (desc or asc)
*
* @access private
* @var string
*/
private $sort_order = 'asc';
/**
* Filter
*
* @access private
* @var string
*/
private $filter = 'ALL';
/**
* Member titles
*
* @access private
* @var array
*/
private $mem_titles = array();
/**
* Member groups
*
* @access private
* @var array
*/
private $mem_groups = array();
/**
* 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_list' ), 'members' );
//-----------------------------------------
// Can we access?
//-----------------------------------------
if ( !$this->memberData['g_mem_info'] )
{
$this->registry->output->showError( 'cannot_view_memberlist', 10221 );
}
//-----------------------------------------
// Init variables
//-----------------------------------------
$see_groups = array();
$the_filter = array( 'ALL' => $this->lang->words['show_all'] );
$the_members = array();
$query = array();
$url = array();
$pp_rating_real = intval( $this->request['pp_rating_real'] );
$pp_gender = substr( trim( $this->request['pp_gender'] ), 0, 10 );
$this->first = intval($this->request['st']);
$this->max_results = ( $this->request['max_results'] ) ? $this->request['max_results'] : '20';
$this->sort_key = ( $this->request['sort_key'] ) ? $this->request['sort_key'] : 'members_display_name';
$this->sort_order = ( $this->request['sort_order'] ) ? $this->request['sort_order'] : 'asc';
$this->filter = ( $this->request['filter'] ) ? ( $this->request['filter'] == 'ALL' ? 'ALL' : intval( $this->request['filter'] ) ) : 'ALL';
$this->request['showall'] = intval( $this->request['showall'] );
$this->request['name_box'] = $this->request['name_box'] ? $this->request['name_box'] : '';
//-----------------------------------------
// Set some of the URL params
//-----------------------------------------
if ( $this->request['quickjump'] )
{
$this->request['name_box'] = 'begins';
$this->request['name'] = $this->request['quickjump'];
}
$url['showall'] = 'showall=' . $this->request['showall'];
$url['sort_key'] = "sort_key={$this->sort_key}";
$url['sort_order'] = "sort_order={$this->sort_order}";
$url['max_results'] = "max_results={$this->max_results}";
$url['app'] = "app=members&amp;section=view&amp;module=list";
$url['quickjump'] = "quickjump={$this->request['quickjump']}";
$url['name_box'] = 'name_box=' . $this->request['name_box'];
$url['name'] = "name={$this->request['name']}";
//-----------------------------------------
// Sort the member group info
//-----------------------------------------
foreach( $this->caches['group_cache'] as $row )
{
if ( $row['g_hide_from_list'] )
{
if ( ! ( $this->memberData['g_access_cp'] AND $this->request['showall'] ) )
{
$hide_ids[] = $row['g_id'];
continue;
}
}
$see_groups[] = $row['g_id'];
$this->mem_groups[ $row['g_id'] ] = array( 'TITLE' => $row['g_title'],
'ICON' => $row['g_icon'] );
if ( $row['g_id'] == $this->settings['guest_group'] )
{
continue;
}
$the_filter[ $row['g_id'] ] = $row['g_title'];
}
//-----------------------------------------
// Init some arrays
//-----------------------------------------
$the_sort_key = array(
'members_l_display_name' => 'sort_by_name',
'posts' => 'sort_by_posts',
'joined' => 'sort_by_joined',
'members_profile_views' => 'm_dd_views',
);
$the_max_results = array(
10 => '10',
20 => '20',
40 => '40',
60 => '60',
);
$the_sort_order = array(
'desc' => 'descending_order',
'asc' => 'ascending_order',
);
$dropdowns = array(
'filter' => $the_filter,
'sort_key' => $the_sort_key,
'sort_order' => $the_sort_order,
'max_results' => $the_max_results,
);
$defaults = array(
'filter' => $this->filter,
'sort_key' => $this->sort_key,
'sort_order' => $this->sort_order,
'max_results' => $this->max_results,
'photoonly' => $this->request['photoonly'] == 1 ? 1 : 0,
);
//-----------------------------------------
// Final vars for query
//-----------------------------------------
$this->sort_key = isset($the_sort_key[ $this->sort_key ]) ? $this->sort_key : 'members_l_display_name';
$this->sort_order = isset($the_sort_order[ $this->sort_order ]) ? $this->sort_order : 'asc';
$this->filter = isset($the_filter[ $this->filter ]) ? $this->filter : 'ALL';
$this->max_results = isset($the_max_results[ $this->max_results ]) ? $this->max_results : 20;
//-----------------------------------------
// Get custom profile information
//-----------------------------------------
require_once( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php' );
$this->custom_fields = new customProfileFields();
$this->custom_fields->initData( 'edit', 1 );
$this->custom_fields->parseToEdit();
//-----------------------------------------
// Member Groups...
//-----------------------------------------
if ( $this->filter != 'ALL' )
{
if ( ! in_array( $this->filter, $see_groups ) )
{
$query[] = 'm.member_group_id IN(' . implode( ',', $see_groups ) . ')';
}
else
{
$query[] = 'm.member_group_id=' . $this->filter;
}
$url['filter'] = 'filter='.$this->filter;
}
//-----------------------------------------
// NOT IN Member Groups...
//-----------------------------------------
if ( count( $hide_ids ) )
{
$query[] = "m.member_group_id NOT IN(" . implode( ",", $hide_ids ) . ")";
}
//-----------------------------------------
// Build query
//-----------------------------------------
$dates = array( 'lastpost', 'lastvisit', 'joined' );
$mapit = array( 'posts' => 'm.posts',
'joined' => 'm.joined',
'lastpost' => 'm.last_post',
'lastvisit' => 'm.last_visit',
'signature' => 'pp.signature',
'name' => 'm.members_display_name',
'photoonly' => 'pp.pp_main_photo',
);
//-----------------------------------------
// Do search
//-----------------------------------------
foreach( $mapit as $in => $tbl )
{
$this->request[$in] = $this->request[ $in ] ? $this->request[ $in ] : '';
$inbit = IPSText::parseCleanValue( trim( urldecode( IPSText::stripslashes( $this->request[ $in ] ) ) ) );
$url[ $in ] = $in . '=' . urlencode($this->request[ $in ]);
//-----------------------------------------
// Name...
//-----------------------------------------
if ( $in == 'name' and $inbit != "" )
{
if ( $this->request['name_box'] == 'begins' )
{
$query[] = "m.members_l_display_name LIKE '" . strtolower( $inbit ) . "%'";
}
else
{
$query[] = "m.members_l_display_name LIKE '%" . strtolower( $inbit ) . "%'";
}
}
else if ( $in == 'posts' and is_numeric($inbit) and intval($inbit) > -1 )
{
$ltmt = $this->request[ $in .'_ltmt' ] == 'lt' ? '<' : '>';
$query[] = $tbl . ' ' . $ltmt . ' ' . intval($inbit);
$url[ $in ] = $in . '_ltmt=' . $this->request[ $in .'_ltmt' ] . '&posts=' . intval($inbit);
}
else if ( in_array( $in, $dates ) and $inbit )
{
if( preg_match( "/\d{2}-\d{2}-\d{4}/", $this->request[ $in ] ) )
{
$_tmp = explode( '-', $this->request[ $in ] );
$time_int = mktime( 23, 59, 59, $_tmp[1], $_tmp[0], $_tmp[2] );
}
else
{
$time_int = strtotime( IPSText::monthNameRu2En($date) );
}
if( $time_int )
{
$ltmt = $this->request[ $in . '_ltmt' ] == 'lt' ? '<' : '>';
$query[] = $tbl . ' ' . $ltmt . ' ' . $time_int;
$url[ $in . '_ltmt' ] = $in . '_ltmt=' . $this->request[ $in . '_ltmt' ];
}
}
else if ( $in == 'photoonly' )
{
if ( $this->request['photoonly'] == 1 )
{
$query[] = $tbl . "<> ''";
$url[] = 'photoonly=1';
}
}
else if ( $inbit != "" AND $in != 'posts' )
{
$query[] = $tbl . " LIKE '%{$inbit}%'";
}
}
//-----------------------------------------
// Custom fields?
//-----------------------------------------
if ( count( $this->custom_fields->out_fields ) )
{
foreach( $this->custom_fields->out_fields as $id => $data )
{
if ( $this->request[ 'field_' . $id ] AND $this->request[ 'field_' . $id ] )
{
if( $this->custom_fields->cache_data[ $id ]['pf_type'] == 'drop' )
{
$query[] = "p.field_{$id}='" . $this->request[ 'field_' . $id ] . "'";
}
else
{
$query[] = "p.field_{$id} LIKE '" . $this->request[ 'field_' . $id ] . "%'";
}
$url[ $in ] = "field_{$id}=" . $this->request[ 'field_' . $id ];
}
}
}
//-----------------------------------------
// Rating..
//-----------------------------------------
if ( $pp_rating_real )
{
$query[] = "pp.pp_rating_real > " . $pp_rating_real;
$url['pp_rating_real'] = "pp_rating_real=" . $pp_rating_real;
}
//-----------------------------------------
// Finish query
//-----------------------------------------
//$query[] = "m.members_l_display_name != ''";
$joins = array();
$joins[] = array( 'from' => array( 'pfields_content' => 'p' ), 'where' => 'p.member_id=m.member_id', 'type' => 'left' );
$joins[] = array( 'from' => array( 'profile_portal' => 'pp' ), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left' );
//-----------------------------------------
// Reputation
//-----------------------------------------
if( ! ipsRegistry::isClassLoaded( 'repCache' ) )
{
require_once( IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php' );
ipsRegistry::setClass( 'repCache', new classReputationCache() );
}
//-----------------------------------------
// START THE LISTING
//-----------------------------------------
/* Get the count */
if ( count( $query ) > 1 OR $this->sort_key != 'members_l_display_name' OR $this->request['request_method'] == 'post' OR $this->request['st'] > 0 )
{
$_max = $this->DB->buildAndFetch( array( 'select' => 'COUNT( * ) as cnt',
'from' => array( 'members' => 'm' ),
'where' => implode( " AND ", $query ),
'add_join' => $joins ) );
$this->DB->build( array( 'select' =>' m.member_id',
'from' => array( 'members' => 'm' ),
'where' => implode( " AND ", $query ),
'order' => 'm.' . $this->sort_key . ' ' . $this->sort_order,
'limit' => array( $this->first, $this->max_results ),
'add_join' => $joins ) );
}
else
{
$_max = $this->DB->buildAndFetch( array( 'select' => 'COUNT( * ) as cnt',
'from' => 'members m',
'where' => implode( " AND ", $query ) ) );
$this->DB->build( array( 'select' => 'm.member_id',
'from' => array( 'members' => 'm' ),
'where' => implode( " AND ", $query ),
'order' => ( $this->sort_key == 'pp_profile_views' ? 'pp.' : 'm.' ) . $this->sort_key . ' ' . $this->sort_order,
'limit' => array( $this->first, $this->max_results ) ) );
}
/* Fetch IDs */
$mids = array();
$this->DB->execute();
while( $m = $this->DB->fetch() )
{
if( $m['member_id'] )
{
$mids[] = $m['member_id'];
}
}
if ( count( $mids ) )
{
$members = array();
$_members = IPSMember::load( $mids, 'all' );
/* Make sure that we keep the ordering from the query */
foreach( $mids as $id )
{
$members[$id] = $_members[$id];
}
}
$max = $_max['cnt'];
if( is_array($members) AND count($members) )
{
foreach( $members as $id => $member )
{
/* Damn SQL thing with member_id */
if ( ! $member['member_id'] )
{
$member['member_id'] = $member['member_table_id'];
}
$member['members_display_name'] = $member['members_display_name'] ? $member['members_display_name'] : $member['name'];
$member['members_seo_name'] = IPSMember::fetchSeoName( $member );
$member['group'] = $this->mem_groups[ $member['member_group_id'] ]['TITLE'];
$member = IPSMember::buildProfilePhoto( $member );
$member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
$member['author_reputation'] = ipsRegistry::getClass( 'repCache' )->getReputation( $member['pp_reputation_points'] );
$the_members[] = $member;
}
}
/* make sure URL doesn't contain empty params */
$_url = $url;
$url = array();
foreach( $_url as $key => $bit )
{
if ( strrpos( $bit, '=' ) + 1 == strlen( $bit ) )
{
continue;
}
$url[] = $bit;
}
$pages = $this->registry->output->generatePagination( array( 'totalItems' => $max,
'itemsPerPage' => $this->max_results,
'currentStartValue' => $this->first,
'baseUrl' => implode( '&amp;', $url ) ) );
//-----------------------------------------
// Print...
//-----------------------------------------
$this->output .= $this->registry->getClass('output')->getTemplate('mlist')->member_list_show( $the_members, $pages, $dropdowns, $defaults, $this->custom_fields, implode( '&amp;', $url ) );
//-----------------------------------------
// Push to print handler
//-----------------------------------------
$this->registry->output->addContent( $this->output );
$this->registry->output->setTitle( $this->lang->words['page_title'] );
$this->registry->output->addNavigation( $this->lang->words['page_title'], 'app=members&amp;module=list' );
$this->registry->output->sendOutput();
}
}
@@ -0,0 +1,417 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Contact Member Functions
* Last Updated: $Date: 2009-04-14 03:01:20 -0400 (Tue, 14 Apr 2009) $
*
* @author $Author $
* @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: 4453 $
*
*/
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_messaging_contact extends ipsCommand
{
/**
* Temporary HTML output
*
* @access public
* @var string
*/
public $output = "";
/**
* Temporary navigation items
*
* @access public
* @var array
*/
public $nav = array();
/**
* Temporary page title
*
* @access public
* @var string
*/
public $page_title = "";
/**
* Error
*
* @access private
* @var string
*/
private $int_error = "";
/**
* Extra info
*
* @access private
* @var string
*/
private $int_extra = "";
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
/* What to do? */
switch( $this->request['do'] )
{
case '01':
case '00':
case 'Mail':
$this->mailMember();
break;
case 'report':
if( $this->request['send'] != 1 )
{
$this->reportPostForm();
}
else
{
$this->reportPostSend();
}
break;
default:
$this->registry->output->showError( 'contact_what_action', 1034 );
break;
}
/* Navigation */
foreach( $this->nav as $nav )
{
$this->registry->output->addNavigation( $nav[0], $nav[1] );
}
/* Output */
$this->registry->output->setTitle( $this->page_title );
$this->registry->output->addContent( $this->output );
$this->registry->output->sendOutput();
}
/**
* Displays the report post form
*
* @access public
* @return void
* @deprecated Just redirects to report center now
*/
public function reportPostForm()
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "app=core&module=reports&rcom=post&tid={$this->request['t']}&pid={$this->request['p']}&st={$this->request['st']}" );
}
/**
* Sends the reported post
*
* @access public
* @return void
* @deprecated Just redirects to report center now
*/
public function reportPostSend()
{
$this->registry->output->silentRedirect( $this->settings['base_url'] . "app=core&module=reports&rcom=post&tid={$this->request['t']}&pid={$this->request['p']}&st={$this->request['st']}" );
}
/**
* Handles the routines called by clicking on the "email" button
*
* @access public
* @return void
*/
public function mailMember()
{
/* Load Language */
$this->registry->class_localization->loadLanguageFile( array( 'public_emails' ), 'core' );
if( empty( $this->memberData['member_id'] ) )
{
ipsRegistry::getClass('output')->showError( 'members_only_mail', 10313 );
}
/* Check email permission */
if( ! $this->memberData['g_email_friend'] )
{
ipsRegistry::getClass('output')->showError( 'no_member_mail', 10314 );
}
if( $this->request['do'] == '01' )
{
$this->mailMemberSend();
}
else
{
$this->mailMemberForm();
}
}
/**
* Displays the form for mailing a member
*
* @access public
* @param string Errors
* @param string Extra data
* @return void
*/
public function mailMemberForm( $errors="", $extra="" )
{
/* Check ID */
$id = intval( $this->request['MID'] );
if( ! $id )
{
$this->registry->output->showError( 'mail_member_no_mid', 10315 );
}
/* Query member information */
$member = IPSMember::load( $id );
/* Make sure we have a valid user */
if( ! $member['member_id'] )
{
$this->registry->output->showError( 'mail_member_no_member', 10316 );
}
/* Check email privacy */
if( $member['hide_email'] == 1 )
{
$this->registry->output->showError( 'mail_member_private', 10317 );
}
/* Show errors */
if ( $errors != "" )
{
$msg = $this->lang->words[$errors];
if ( $extra != "" )
{
$msg = sprintf( $msg, $extra );
}
$this->output .= $this->registry->output->getTemplate('emails')->errors( $msg );
}
/* Output */
$this->output .= $this->settings['use_mail_form']
? $this->registry->output->getTemplate('emails')->sendMailForm(
array(
'NAME' => $member['members_display_name'],
'TO' => $member['member_id'],
'subject'=> $this->request['subject'],
'content'=> stripslashes( htmlspecialchars( $_POST['message'] ) ),
)
)
: $this->registry->output->getTemplate('emails')->show_address(
array(
'NAME' => $member['members_display_name'],
'ADDRESS' => $member['email'],
)
);
$this->page_title = $this->lang->words['member_address_title'];
$this->nav[] = array( $this->lang->words['member_address_title'], '' );
}
/**
* Sends the email
*
* @access public
* @return void
*/
public function mailMemberSend()
{
//-----------------------------------------
// Check form key first
//-----------------------------------------
if ( $this->request['k'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'no_permission', 20313 );
}
$this->request['to'] = intval( $this->request['to'] );
if( $this->request['to'] == 0 )
{
$this->registry->output->showError( 'mail_member_no_mid', 10318 );
}
/* Query Member */
$member = IPSMember::load( $this->request['to'] );
/* Check for schtuff */
if( ! $member['member_id'] )
{
$this->registry->output->showError( 'mail_member_no_member', 10319 );
}
/* Check email privacy */
if( $member['hide_email'] == 1 )
{
$this->registry->output->showError( 'mail_member_private', 10320, true );
}
/* Check for blanks */
$check_array = array (
'message' => 'no_message',
'subject' => 'no_subject'
);
foreach( $check_array as $input => $msg )
{
if( empty( $this->request[$input] ) )
{
$this->request['MID'] = $this->request['to'];
$this->mailMemberForm( $msg );
return;
}
}
/* Check for spam / delays */
$email_check = $this->_allowToMail( $this->memberData['member_id'], $this->memberData['g_email_limit'] );
if( $email_check != TRUE )
{
$this->request['MID'] = $this->request['to'];
$this->mailMemberForm( $this->int_error, $this->int_extra );
return;
}
/**
* No check for injected headers in the message
* @link http://forums.invisionpower.com/index.php?app=tracker&showissue=13098
*/
if( preg_match("/(content-type:|content-transfer-encoding:|content-disposition:)/i", $this->request['message'] ) )
{
$this->registry->output->showError( 'bad_email_message', 5021, true );
}
/* Send the email */
IPSText::getTextClass( 'email' )->getTemplate( 'email_member' );
IPSText::getTextClass( 'email' )->buildMessage( array(
'MESSAGE' => str_replace( "<br>", "\n", str_replace( "\r", "", $this->request['message'] ) ),
'MEMBER_NAME' => $member['members_display_name'],
'FROM_NAME' => $this->memberData['members_display_name']
) );
IPSText::getTextClass( 'email' )->subject = $this->request['subject'];
IPSText::getTextClass( 'email' )->to = $member['email'];
IPSText::getTextClass( 'email' )->from = $this->memberData['email'];
IPSText::getTextClass( 'email' )->sendMail();
/* Store email in the database */
$this->DB->insert( 'email_logs', array(
'email_subject' => $this->request['subject'],
'email_content' => $this->request['message'],
'email_date' => time(),
'from_member_id' => $this->memberData['member_id'],
'from_email_address' => $this->memberData['email'],
'from_ip_address' => $this->member->ip_address,
'to_member_id' => $member['member_id'],
'to_email_address' => $member['email'],
) );
$this->output = $this->registry->output->getTemplate('emails')->sentScreen( $member['members_display_name'] );
$this->page_title = $this->lang->words['email_sent'];
$this->nav[] = array( $this->lang->words['email_sent'], '' );
}
/**
* Check Flood Limit
*
* @access private
* @param integer $member_id
* @param string $email_limit
* @return bool
**/
private function _allowToMail( $member_id, $email_limit )
{
$member_id = intval( $member_id );
if( ! $member_id )
{
$this->int_error = 'gen_error';
return FALSE;
}
list( $limit, $flood ) = explode( ':', $email_limit );
if ( ! $limit and ! $flood )
{
return TRUE;
}
//-----------------------------------------
// Get some stuff from the DB!
// 1) FLOOD?
//-----------------------------------------
if( $flood )
{
$this->DB->build( array(
'select' => '*',
'from' => 'email_logs',
'where' => "from_member_id=$member_id",
'order' => 'email_date DESC',
'limit' => array( 0, 1 ) ) );
$this->DB->execute();
$last_email = $this->DB->fetch();
if( $last_email['email_date'] + ( $flood * 60 ) > time() )
{
$this->int_error = 'exceeded_flood';
$this->int_extra = $flood;
return FALSE;
}
}
if( $limit )
{
$time_range = time() - 86400;
$this->DB->build( array(
'select' => 'count(email_id) as cnt',
'from' => 'email_logs',
'where' => "from_member_id=$member_id AND email_date > $time_range",
) );
$this->DB->execute();
$quota_sent = $this->DB->fetch();
if( $quota_sent['cnt'] + 1 > $limit )
{
$this->int_error = 'exceeded_quota';
$this->int_extra = limit;
return FALSE;
}
}
return TRUE; //<{%dyn.down.var.md5p2%}> If we get here...
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default messaging 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 @@
<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,218 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Online list
* Last Updated: $Date: 2009-07-08 17:04:40 -0400 (Wed, 08 Jul 2009) $
*
* @author $Author: josh $
* @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 12th March 2002
* @version $Revision: 4855 $
*
*/
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_messaging_search extends ipsCommand
{
/**
* Page title
*
* @access private
* @var string
*/
private $_title;
/**
* Navigation entries
*
* @access private
* @var array
*/
private $_navigation;
/**
* Messenger library
*
* @access public
* @var object
*/
public $messengerFunctions;
/**
* Error string
*
* @access private
* @var string
*/
public $_errorString = '';
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if ( ! $this->memberData['g_use_pm'] )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10226 );
}
if ( $this->memberData['members_disable_pm'] )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10227 );
}
if ( ! $this->memberData['member_id'] )
{
$this->registry->getClass('output')->showError( 'messenger_no_guests', 10228 );
}
if( ! IPSLib::moduleIsEnabled( 'messaging', 'members' ) )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10227 );
}
//-----------------------------------------
// Language
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( 'public_messaging' ), 'members' );
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ), 'forums' );
//-----------------------------------------
// Grab class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$this->messengerFunctions = new messengerFunctions( $registry );
/* Messenger Totals */
$totals = $this->messengerFunctions->buildMessageTotals();
//-----------------------------------------
// What to do?
//-----------------------------------------
switch( $this->request['do'] )
{
default:
case 'search':
$html = $this->_search();
break;
}
//-----------------------------------------
// If we have any HTML to print, do so...
//-----------------------------------------
$this->registry->output->addContent( $this->registry->getClass('output')->getTemplate('messaging')->messengerTemplate( $html, $this->messengerFunctions->_jumpMenu, $this->messengerFunctions->_dirData, $totals, $this->_topicParticipants, $this->_errorString ) );
$this->registry->output->setTitle( $this->_title );
$this->registry->output->addNavigation( $this->lang->words['messenger__nav'], 'app=members&amp;module=messaging' );
if ( is_array( $this->_navigation ) AND count( $this->_navigation ) )
{
foreach( $this->_navigation as $idx => $data )
{
$this->registry->output->addNavigation( $data[0], $data[1] );
}
}
$this->registry->output->sendOutput();
}
/**
* Search. Do it.
*
* @access private
* @param string Any error text
* @return string returns HTML
*/
private function _search( $error='' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$start = intval($this->request['st']);
$p_end = $this->settings['show_max_msg_list'] > 0 ? $this->settings['show_max_msg_list'] : 50;
$searchFor_TAINTED = IPSText::parseCleanValue( urldecode( $_REQUEST['searchFor'] ) );
$searchIn = '';
/* Got an error? */
if ( $error )
{
$this->_errorString = $error;
}
/* Search for owt? */
if( ! $searchFor_TAINTED )
{
$error = $this->lang->words['search_convo_no_keywords'];
}
else if( ( $this->settings['min_search_word'] && strlen( $searchFor_TAINTED ) < $this->settings['min_search_word'] ) )
{
$error = sprintf( $this->lang->words['search_term_short'], $this->settings['min_search_word'] );
}
/* Do the search */
else
{
$searchResults = $this->messengerFunctions->searchMessages( $this->memberData['member_id'], $searchFor_TAINTED, $start, $p_end, array() );
$totalMsg = $searchResults['totalMatches'];
$messages = $searchResults['results'];
/* Got anything? */
if ( ! $totalMsg OR ( ! count( $messages ) ) )
{
$error = $this->lang->words['search_convo_no_results'];
}
}
//-----------------------------------------
// Generate Pagination
//-----------------------------------------
$pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $totalMsg,
'itemsPerPage' => $p_end,
'currentStartValue' => $start,
'baseUrl' => "app=members&amp;module=messaging&amp;section=search&amp;do=search&amp;searchFor=" . urlencode( $searchFor_TAINTED ) ) );
//-----------------------------------------
// Set title
//-----------------------------------------
$this->_title = $this->lang->words['t_welcome'] . $this->lang->words['search_results_pt'];
//-----------------------------------------
// Set navigation
//-----------------------------------------
//$this->_navigation[] = array( $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['real'], $this->settings['base_url']."app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID=".$this->messengerFunctions->_currentFolderID."&amp;sort=".$this->request['sort'] );
//-----------------------------------------
// Done...
//-----------------------------------------
return $this->registry->getClass('output')->getTemplate('messaging')->showSearchResults( $messages, $pages, $error );
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,782 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Online list
* Last Updated: $Date: 2009-08-31 20:32:10 -0400 (Mon, 31 Aug 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 12th March 2002
* @version $Revision: 5066 $
*
*/
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_messaging_view extends ipsCommand
{
/**
* Page title
*
* @access private
* @var string
*/
private $_title;
/**
* Navigation
*
* @access private
* @var array[ 0 => [ title, url ] ]
*/
private $_navigation;
/**
* Folder totals
*
* @access private
* @var mixed
*/
private $_totals;
/**
* Contains topic participant data
*
* @access public
* @var array
*/
public $_topicParticipants;
/**
* Messenger library
*
* @access public
* @var object
*/
public $messengerFunctions;
/**
* Error string
*
* @access public
* @var string
*/
public $_errorString = '';
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Check viewing permissions, etc
//-----------------------------------------
if ( ! $this->memberData['g_use_pm'] )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10226 );
}
if ( $this->memberData['members_disable_pm'] )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10227 );
}
if ( ! $this->memberData['member_id'] )
{
$this->registry->getClass('output')->showError( 'messenger_no_guests', 10228 );
}
if( ! IPSLib::moduleIsEnabled( 'messaging', 'members' ) )
{
$this->registry->getClass('output')->showError( 'messenger_disabled', 10227 );
}
//-----------------------------------------
// Language
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile( array( "public_editors" ), 'core' );
$this->registry->class_localization->loadLanguageFile( array( 'public_messaging' ), 'members' );
$this->registry->class_localization->loadLanguageFile( array( 'public_topic' ), 'forums' );
//-----------------------------------------
// Grab class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$this->messengerFunctions = new messengerFunctions( $registry );
/* Messenger Totals */
$this->_totals = $this->messengerFunctions->buildMessageTotals();
/* Filtah */
if ( $this->request['folderFilter'] )
{
$this->messengerFunctions->addFolderFilter( $this->request['folderFilter'] );
}
//-----------------------------------------
// What to do?
//-----------------------------------------
switch( $this->request['do'] )
{
default:
case 'inbox':
case 'showFolder':
$html = $this->_showFolder();
break;
case 'showConversation':
case 'showMessage':
$html = $this->showConversation();
break;
case 'multiFile':
$html = $this->_multiFile();
break;
case 'findMessage':
$html = $this->_findMessage();
break;
case 'addParticipants':
$html = $this->_addParticipants();
break;
/*case 'leaveConversation':
$html = $this->_leaveConversation();
break;
case 'rejoinConversation':
$html = $this->_rejoinConversation();
break;*/
case 'deleteConversation':
$html = $this->_deleteConversation();
break;
case 'blockParticipant':
$html = $this->_blockParticipant();
break;
case 'unblockParticipant':
$html = $this->_unblockParticipant();
break;
case 'toggleNotifications':
$html = $this->_toggleNotifications();
break;
}
//-----------------------------------------
// If we have any HTML to print, do so...
//-----------------------------------------
$this->registry->output->addContent( $this->registry->getClass('output')->getTemplate('messaging')->messengerTemplate( $html, $this->messengerFunctions->_jumpMenu, $this->messengerFunctions->_dirData, $this->_totals, $this->_topicParticipants, $this->_errorString, $this->_deletedTopic ) );
$this->registry->output->setTitle( $this->_title );
$this->registry->output->addNavigation( $this->lang->words['messenger__nav'], 'app=members&amp;module=messaging' );
if ( is_array( $this->_navigation ) AND count( $this->_navigation ) )
{
foreach( $this->_navigation as $idx => $data )
{
$this->registry->output->addNavigation( $data[0], $data[1] );
}
}
$this->registry->output->sendOutput();
}
/**
* Block a participant
*
* @access private
* @return mixed void, or HTML
*/
private function _toggleNotifications()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$topicID = intval( $this->request['topicID'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->toggleNotificationStatus( $this->memberData['member_id'], array( $topicID ), 'toggle' );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$this->_errorString = $msg;
return $this->showConversation();
}
}
/**
* Block a participant
*
* @access private
* @return mixed void, or HTML
*/
private function _blockParticipant()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$memberID = intval( $this->request['memberID'] );
$topicID = intval( $this->request['topicID'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->toggleTopicBlock( $memberID, $this->memberData['member_id'], $topicID, TRUE );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$this->_errorString = $msg;
return $this->showConversation();
}
}
/**
* Leave a conversation (non topic starter)
*
* @access private
* @return mixed void, or HTML
*/
private function _unblockParticipant()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$memberID = intval( $this->request['memberID'] );
$topicID = intval( $this->request['topicID'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->toggleTopicBlock( $memberID, $this->memberData['member_id'], $topicID, FALSE );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$this->_errorString = $msg;
return $this->showConversation();
}
}
/**
* Leave a conversation (non topic starter)
*
* @access private
* @return mixed void, or HTML
*/
private function _deleteConversation()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$topicID = intval( $this->request['topicID'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->deleteTopics( $this->memberData['member_id'], array( $topicID ) );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging' );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$this->_errorString = $msg;
return $this->showConversation();
}
}
/**
* Deletes a reply
*
* @access private
* @return mixed void, or HTML
*/
private function _addParticipants()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$authKey = $this->request['authKey'];
$topicID = intval( $this->request['topicID'] );
$inviteUsers = array();
$start = intval( $this->request['st'] );
//-----------------------------------------
// Auth check
//-----------------------------------------
if ( $this->request['authKey'] != $this->member->form_hash )
{
$this->registry->getClass('output')->showError( 'messenger_bad_key', 2024 );
}
//-----------------------------------------
// Invite Users
//-----------------------------------------
if ( $this->memberData['g_max_mass_pm'] AND $this->request['inviteNames'] )
{
foreach( explode( ",", $this->request['inviteNames'] ) as $id => $name )
{
$name = trim( $name );
if ( $name )
{
$inviteUsers[] = $name;
}
}
}
//-----------------------------------------
// Do it
//-----------------------------------------
try
{
$this->messengerFunctions->addTopicParticipants( $topicID, $inviteUsers, $this->memberData['member_id'] );
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID . '&amp;st=' . $start );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$msg = $error->getMessage();
if ( isset($this->lang->words[ 'err_' . $msg ]) )
{
$_msgString = $this->lang->words[ 'err_' . $msg ];
$_msgString = str_replace( '#NAMES#' , implode( ",", $this->messengerFunctions->exceptionData ), $_msgString );
$_msgString = str_replace( '#TONAME#' , $toMember['members_display_name'] , $_msgString );
$_msgString = str_replace( '#FROMNAME#', $this->memberData['members_display_name'], $_msgString );
}
else
{
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
}
$this->_errorString = $_msgString;
return $this->showConversation();
}
}
/**
* Redirects the user to the correct page in a conversation based on the incoming msg ID
*
* @access private
* @return string returns HTML
*/
private function _findMessage()
{
$msgID = ( $this->request['msgID'] == '__firstUnread__' ) ? '__firstUnread__' : intval( $this->request['msgID'] );
$topicID = intval( $this->request['topicID'] );
/* Fetch topic data */
$topicData = $this->messengerFunctions->fetchTopicData( $topicID );
/* Figure out the MSG id */
if ( $msgID == '__firstUnread__' )
{
/* Grab mah 'pants */
$participants = $this->messengerFunctions->fetchTopicParticipants( $topicID );
if ( $participants[ $this->memberData['member_id'] ] )
{
$_msgID = $this->DB->buildAndFetch( array( 'select' => 'msg_id',
'from' => 'message_posts',
'where' => 'msg_topic_id=' . $topicID . ' AND msg_date > ' . intval( $participants[ $this->memberData['member_id'] ]['map_read_time'] ),
'order' => 'msg_date ASC',
'limit' => array( 0, 1 ) ) );
$msgID = $_msgID['msg_id'];
}
}
$msgID = ( $msgID ) ? $msgID : $topicData['mt_last_msg_id'];
/* Figure it out */
$replies = $topicData['mt_replies'] + 1;
$perPage = $this->messengerFunctions->messagesPerPage;
$page = 0;
$_count = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as count',
'from' => 'message_posts',
'where' => "msg_topic_id=" . $topicID . " AND msg_id <=" . intval( $msgID ) ) );
if ( (($_count['count']) % $perPage) == 0 )
{
$pages = ($_count['count']) / $perPage;
}
else
{
$pages = ceil( ( ( $_count['count'] ) / $perPage ) );
}
$st = ($pages - 1) * $perPage;
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=' . $topicID . '&amp;st=' . $st . '#msg' . $msgID );
}
/**
* Multi Files Messages
*
* @access private
* @return string returns HTML
*/
private function _multiFile()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$method = $this->request['method'];
$folderID = $this->request['folderID'];
$cfolderID = $this->request['cFolderID'];
$sort = $this->request['sort'];
$start = intval( $this->request['st'] );
$ids = array();
//-----------------------------------------
// Auth OK?
//-----------------------------------------
if ( $this->request['auth_key'] != $this->member->form_hash )
{
$this->messengerFunctions->_currentFolderID = $cfolderID;
return $this->_showFolder( $this->lang->words['err_auth'] );
}
//-----------------------------------------
// Grab IDs
//-----------------------------------------
if ( is_array( $_POST['msgid'] ) )
{
foreach( $_POST['msgid'] as $id => $value )
{
$id = intval( $id );
$ids[ $id ] = $id;
}
}
//-----------------------------------------
// What are we doing?
//-----------------------------------------
try
{
if ( $method == 'delete' )
{
$this->messengerFunctions->deleteTopics( $this->memberData['member_id'], $ids );
}
else if ( $method == 'move' )
{
$this->messengerFunctions->moveTopics( $this->memberData['member_id'], $ids, $folderID );
}
else if ( $method == 'markread' OR $method == 'markunread' )
{
$_method = ( $method == 'markread' ) ? TRUE : FALSE;
$this->messengerFunctions->toggleReadStatus( $this->memberData['member_id'], $ids, $_method );
}
else if ( $method == 'notifyon' OR $method == 'notifyoff' )
{
$_method = ( $method == 'notifyon' ) ? TRUE : FALSE;
$this->messengerFunctions->toggleNotificationStatus( $this->memberData['member_id'], $ids, $_method );
}
$this->registry->getClass('output')->silentRedirect( $this->settings['base_url'] . 'app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID=' . $cfolderID . '&amp;sort=' . $sort . '&amp;st=' . $start );
}
catch( Exception $error )
{
$msg = $error->getMessage();
$error = '';
switch( $msg )
{
default:
$error = $this->lang->words['err_unspecifed'];
break;
case 'NO_IDS_SELECTED':
$error = $this->lang->words['err_NO_IDS_SELECTED'];
break;
/* Move exceptions */
case 'NO_SUCH_FOLDER':
$error = $this->lang->words['err_NO_SUCH_FOLDER'];
break;
case 'NO_IDS_TO_MOVE':
$error = $this->lang->words['err_NO_IDS_TO_MOVE'];
break;
/* Delete exceptions */
case 'NO_IDS_TO_DELETE':
$error = $this->lang->words['err_NO_IDS_TO_DELETE'];
break;
}
$this->messengerFunctions->_currentFolderID = $cfolderID;
return $this->_showFolder( $error );
}
}
/**
* Show a message
*
* @access public
* @return string returns HTML
*/
public function showConversation()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$topicID = intval( $this->request['topicID'] );
$start = intval( $this->request['st'] );
$end = $this->messengerFunctions->messagesPerPage;
//-----------------------------------------
// Got a message ID?
//-----------------------------------------
if ( ! $topicID )
{
$this->registry->getClass('output')->showError( 'messenger_no_msgid', 10225 );
}
//-----------------------------------------
// Fetch the conversation
//-----------------------------------------
try
{
$conversationData = $this->messengerFunctions->fetchConversation( $topicID, $this->memberData['member_id'], array( 'offsetStart' => $start, 'offsetEnd' => $end ) );
}
catch( Exception $error )
{
$_msg = $error->getMessage();
if ( $_msg == 'NO_READ_PERMISSION' )
{
$this->registry->getClass('output')->showError( 'messenger_no_msgid', 10229 );
}
else if ( $_msg == 'YOU_ARE_BANNED' )
{
$this->registry->getClass('output')->showError( 'messenger_you_be_banned_yo', 99910229 );
}
}
//-----------------------------------------
// Add to the topic data...
//-----------------------------------------
$conversationData['topicData']['_canReply'] = $this->messengerFunctions->canReplyTopic( $this->memberData['member_id'], $conversationData['topicData'], $conversationData['memberData'] );
//-----------------------------------------
// Pages
//-----------------------------------------
$conversationData['topicData']['_pages'] = $this->registry->output->generatePagination( array( 'totalItems' => $conversationData['topicData']['mt_replies'] + 1,
'itemsPerPage' => $end,
'currentStartValue' => $start,
'baseUrl' => "app=members&amp;module=messaging&amp;section=view&amp;do=showConversation&amp;topicID=".$topicID."&amp;sort=".$this->request['sort'] ) );
//-----------------------------------------
// Show...
//-----------------------------------------
$html = $this->registry->getClass('output')->getTemplate('messaging')->showConversation( $conversationData['topicData'], $conversationData['replyData'], $conversationData['memberData'], $this->messengerFunctions->_jumpMenu );
/* Sort out topic participants */
$this->_topicParticipants = $conversationData['memberData'];
/* Deleted topic flag */
$this->_deletedTopic = $conversationData['topicData']['mt_is_deleted'];
/* Finish off... */
$_folder = $conversationData['memberData'][ $this->memberData['member_id'] ]['map_folder_id'];
$this->messengerFunctions->_currentFolderID = $_folder;
$this->_title = $conversationData['topicData']['mt_title'];
$this->_navigation[] = array( $this->messengerFunctions->_dirData[ $_folder ]['real'], "app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID=".$_folder."&amp;sort=".$this->request['sort'] );
$this->_navigation[] = array( $conversationData['topicData']['mt_title'], '' );
return $html;
}
/**
* Show the folder list
*
* @access private
* @param string Any error text
* @return string returns HTML
*/
private function _showFolder( $error='' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$sort = $this->request['sort'];
$start = intval($this->request['st']);
$p_end = $this->settings['show_max_msg_list'] > 0 ? $this->settings['show_max_msg_list'] : 50;
$sort_key = '';
/* Got an error? */
if ( $error )
{
$this->_errorString = $error;
}
//-----------------------------------------
// Get the number of messages in our curr folder.
//-----------------------------------------
$totalMsg = $this->messengerFunctions->getPersonalTopicsCount( $this->memberData['member_id'], $this->messengerFunctions->_currentFolderID );
/* Only update if we're not using a filter */
if ( ( ! $this->request['folderFilter'] ) AND $totalMsg != $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['count'] )
{
$this->messengerFunctions->rebuildFolderCount( $this->memberData['member_id'], array( $this->messengerFunctions->_currentFolderID => $totalMsg ) );
}
//-----------------------------------------
// Generate Pagination
//-----------------------------------------
if ( $start >= $totalMsg )
{
$start = 0;
}
$_baseURL = "app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID=".$this->messengerFunctions->_currentFolderID;
if ( $this->request['sort'] )
{
$_baseURL .= "&amp;sort=".$this->request['sort'];
}
if ( $this->request['folderFilter'] )
{
$_baseURL .= "&amp;folderFilter=".$this->request['folderFilter'];
}
$pages = $this->registry->getClass('output')->generatePagination( array( 'totalItems' => $totalMsg,
'itemsPerPage' => $p_end,
'currentStartValue' => $start,
'baseUrl' => $_baseURL ) );
//-----------------------------------------
// Get the PMs
//-----------------------------------------
$messages = $this->messengerFunctions->getPersonalTopicsList( $this->memberData['member_id'], $this->messengerFunctions->_currentFolderID, array( 'sort' => $sort, 'offsetStart' => $start, 'offsetEnd' => $p_end ) );
//-----------------------------------------
// Set title
//-----------------------------------------
$this->_title = $this->lang->words['t_welcome'];
//-----------------------------------------
// Set navigation
//-----------------------------------------
$this->_navigation[] = array( $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['real'], "app=members&amp;module=messaging&amp;section=view&amp;do=showFolder&amp;folderID={$this->messengerFunctions->_currentFolderID}" );
//-----------------------------------------
// Done...
//-----------------------------------------
return $this->registry->getClass('output')->getTemplate('messaging')->showFolder( $messages, $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['real'], $pages, $this->messengerFunctions->_currentFolderID, $this->messengerFunctions->_jumpMenu, $error );
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default online 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 = 'online';
@@ -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,290 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Online list
* Last Updated: $Date: 2009-09-28 13:36:50 -0400 (Mon, 28 Sep 2009) $
*
* @author $Author: josh $
* @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 12th March 2002
* @version $Revision: 5169 $
*
*/
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_online_online extends ipsCommand
{
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
/**
* DB result start point
*
* @access public
* @var integer
*/
public $first = 0;
/**
* DB number of rows to pull
*
* @access public
* @var integer
*/
public $perpage = 25;
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
//-----------------------------------------
// Are we allowed to see the online list?
//-----------------------------------------
if ( !$this->settings['allow_online_list'] )
{
$this->registry->output->showError( 'onlinelist_disabled', 10230 );
}
//-----------------------------------------
// Init, lang, html
//-----------------------------------------
$this->request['st'] = intval( $this->request['st'] >= 0 ? intval($this->request['st']) : 0 );
$this->registry->class_localization->loadLanguageFile( array( 'public_online' ), 'members' );
//-----------------------------------------
// What to do?
//-----------------------------------------
switch( $this->request['do'] )
{
case 'listall':
default:
$this->_listAll();
break;
}
//-----------------------------------------
// If we have any HTML to print, do so...
//-----------------------------------------
$this->registry->output->addContent( $this->output );
$this->registry->output->setTitle( $this->lang->words['page_title'] );
$this->registry->output->addNavigation( $this->lang->words['page_title'], '' );
$this->registry->output->sendOutput();
}
/**
* Show the online list
*
* @access private
* @return void [Stores HTML in $this->output]
*/
private function _listAll()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$this->first = intval($this->request['st']) > 0 ? intval($this->request['st']) : 0;
$final = array();
$modules = array();
$memberIDs = array();
if ( !$this->settings['au_cutoff'] )
{
$this->settings[ 'au_cutoff'] = 15 ;
}
$defaults = array(
'show_mem' => ( $this->request['show_mem'] AND in_array( $this->request['show_mem'], array( 'reg', 'guest', 'all' ) ) ) ? $this->request['show_mem'] : 'all',
'sort_order' => ( $this->request['sort_order'] AND in_array( $this->request['sort_order'], array( 'desc', 'asc' ) ) ) ? $this->request['sort_order'] : 'asc',
'sort_key' => ( $this->request['sort_key'] AND in_array( $this->request['sort_key'], array( 'click', 'name' ) ) ) ? $this->request['sort_key'] : 'click',
);
//-----------------------------------------
// Sort the db query
//-----------------------------------------
$cut_off = $this->settings['au_cutoff'] * 60;
$t_time = time() - $cut_off;
$db_order = $defaults['sort_order'] == 'asc' ? 'asc' : 'desc';
$db_key = $defaults['sort_key'] == 'click' ? 'running_time' : 'member_name';
$wheres = array( 'running_time > ' . $t_time );
switch ( $defaults['show_mem'] )
{
case 'reg':
$wheres[] = "member_id > 0";
$wheres[] = "member_group != " . $this->settings['guest_group'];
break;
case 'guest':
$wheres[] = "member_group = " . $this->settings['guest_group'];
break;
}
if ( $this->settings['spider_anon'] OR ! $this->settings['spider_active'] )
{
if ( ! $this->settings['spider_active'] OR ! $this->memberData['g_access_cp'] )
{
$wheres[] = $this->DB->buildRight( 'id', 8 ) . " != '_session'";
}
}
if ( ! $this->settings['disable_anonymous'] AND ! $this->memberData['g_access_cp'] OR $this->settings['disable_admin_anon'] )
{
$wheres[] = "login_type != 1";
}
//-----------------------------------------
// Grab all the current sessions.
//-----------------------------------------
$this->DB->build( array( 'select' => '*',
'from' => 'sessions',
'where' => implode( ' AND ', $wheres ),
'calcRows' => TRUE,
'order' => $db_key . ' ' . $db_order,
'limit' => array( $this->first, $this->perpage ) ) );
$outer = $this->DB->execute();
$max = $this->DB->fetchCalculatedRows();
if ( ! $this->DB->getTotalRows($outer) && $this->first > 0 )
{
// We are request page 2 - but there is no page 2 now...
$this->registry->output->silentRedirect( $this->settings['base_url']."app=members&amp;section=online&amp;module=online&amp;sortkey={$defaults['sort_key']}&amp;show_mem={$defaults['show_mem']}&amp;sort_order={$defaults['sort_order']}" );
}
//-----------------------------------------
// Put results into array
//-----------------------------------------
while( $r = $this->DB->fetch($outer) )
{
if ( strstr( $r['id'], '_session' ) )
{
$r['is_bot'] = 1;
}
$r['where_line'] = '';
$r['where_link'] = '';
//-----------------------------------------
// Sessions aren't updated until shutdown
// so reset our session now
//-----------------------------------------
if( $this->memberData['member_id'] AND $r['member_id'] == $this->memberData['member_id'] )
{
$r['current_appcomponent'] = 'members';
$r['current_module'] = 'online';
$r['current_section'] = 'online';
}
//-----------------------------------------
// Is this a member?
//-----------------------------------------
if ( $r['member_id'] )
{
$memberIDs[] = $r['member_id'];
}
$final[ $r['id'] ] = $r;
//-----------------------------------------
// Module?
//-----------------------------------------
$modules[ $r['current_section'] ] = array( 'app' => $r['current_appcomponent'] );
}
$links = $this->registry->output->generatePagination( array( 'totalItems' => $max,
'itemsPerPage' => $this->perpage,
'currentStartValue' => $this->first,
'baseUrl' => "app=members&amp;section=online&amp;module=online&amp;sort_key={$defaults['sort_key']}&amp;sort_order={$defaults['sort_order']}&amp;show_mem={$defaults['show_mem']}"
) );
//-----------------------------------------
// Pass off entries to modules..
//-----------------------------------------
if ( count( $modules ) )
{
foreach( $modules as $module_array )
{
$filename = IPSLib::getAppDir( IPSText::alphanumericalClean($module_array['app']) ) . '/extensions/coreExtensions.php';
if ( file_exists( $filename ) )
{
require_once( $filename );
$toload = 'publicSessions__' . IPSText::alphanumericalClean($module_array['app']);
$loader = new $toload;
if( method_exists( $loader, 'parseOnlineEntries' ) )
{
$final = $loader->parseOnlineEntries( $final );
}
}
}
}
//-----------------------------------------
// Finally, members...
//-----------------------------------------
if ( count( $memberIDs ) )
{
$members = IPSMember::load( $memberIDs, 'all' );
}
$newFinal = array();
foreach( $final as $id => $data )
{
if ( $data['member_id'] )
{
$newFinal[ 'member-' . $data['member_id'] ] = $data;
$newFinal[ 'member-' . $data['member_id'] ]['memberData'] = $members[ $data['member_id'] ];
$newFinal[ 'member-' . $data['member_id'] ]['_memberData'] = IPSMember::buildProfilePhoto( $members[ $data['member_id'] ] );
}
else
{
$newFinal[ $data['id'] ] = $data;
$newFinal[ $data['id'] ]['memberData'] = array();
$newFinal[ $data['id'] ]['_memberData'] = IPSMember::buildProfilePhoto( 0 );
}
}
$this->output .= $this->registry->getClass('output')->getTemplate('online')->showOnlineList( $newFinal, $links, $defaults );
}
}
@@ -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;
}
}
@@ -0,0 +1,30 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Define the default warn section
* Last Updated: $Date: 2008-12-22 18:10:25 -0500 (Mon, 22 Dec 2008) $
*
* @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: 3540 $
*
*/
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 = 'warn';
@@ -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,954 @@
<?php
/**
* Invision Power Services
* IP.Board v3.0.5
* Member warn functions
* Last Updated: $Date: 2009-06-24 23:14:22 -0400 (Wed, 24 Jun 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: 4818 $
*
* @todo [Future] Ability to require confirmation of a warning (feature)?
*/
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_warn_warn extends ipsCommand
{
/**
* Temporary stored output HTML
*
* @access public
* @var string
*/
public $output;
/**
* Forum information
*
* @access private
* @var array Array of forum details
*/
private $forum = array();
/**
* Topic information
*
* @access private
* @var array Array of topic details
*/
private $topic = array();
/**
* Topic ID
*
* @access private
* @var integer Topic id
*/
private $topic_id = 0;
/**
* Forum ID
*
* @access private
* @var integer Forum id
*/
private $forum_id = 0;
/**
* Moderator information
*
* @access private
* @var array Array of moderator details
*/
private $moderator = array();
/**
* Can ban member from warn panel
*
* @access private
* @var bool Can ban member
*/
private $canSuspend = 0;
/**
* Can mod queue member from warn panel
*
* @access private
* @var bool Can mod queue member
*/
private $canModQueue = 0;
/**
* Can remove posting rights from member from warn panel
*
* @access private
* @var bool Can remove posting for member
*/
private $canRemovePostAbility = 0;
/**
* Number of times per day member can be warned
*
* @access private
* @var integer Number of times per day member can be warned
*/
private $restrictWarnsPerDay = 0;
/**
* Type of member
*
* @access private
* @var string mod, supmod, or member
*/
private $type = 'mod';
/**
* Data for the member being warned
*
* @access private
* @var array Member being warned
*/
private $warn_member = array();
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen/redirects]
*/
public function doExecute( ipsRegistry $registry )
{
$this->loadData();
//-----------------------------------------
// Bouncy, bouncy!
//-----------------------------------------
switch ($this->request['do'])
{
case 'dowarn':
$this->_doWarn();
break;
case 'add_note':
$this->_checkAccess();
$this->_addNoteform();
break;
case 'save_note':
$this->_checkAccess();
$this->_saveNote();
break;
case 'view':
$this->_checkAccess();
$this->viewLog();
break;
case 'form':
default:
$this->_showForm();
break;
}
$this->registry->output->addNavigation( $this->lang->words['w_title'], '' );
$this->registry->output->addContent( $this->output );
if( $this->request['popup'] )
{
$this->registry->getClass('output')->popUpWindow( $this->output );
}
else
{
$this->registry->output->sendOutput();
}
}
/**
* Load all necessary properties
*
* @access public
* @param boolean Return false on error, instead of display
* @return void
*/
public function loadData( $returnOnError=false )
{
//-----------------------------------------
// Set up
//-----------------------------------------
$this->settings[ 'warn_min'] = $this->settings['warn_min'] ? $this->settings['warn_min'] : 0;
$this->settings[ 'warn_max'] = $this->settings['warn_max'] ? $this->settings['warn_max'] : 10;
//-----------------------------------------
// Load modules...
//-----------------------------------------
ipsRegistry::getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ), 'forums' );
if ( ! $this->settings['warn_on'] )
{
if( $returnOnError )
{
return false;
}
$this->registry->output->showError( 'warn_system_off', 10248 );
}
/* Need app_class_forums to setup moderator stuff */
require_once( IPS_ROOT_PATH . 'applications/forums/app_class_forums.php' );
$app_class_forums = new app_class_forums( $this->registry );
//-----------------------------------------
// Make sure we're a moderator...
//-----------------------------------------
$pass = 0;
if( $this->memberData['member_id'] )
{
if( $this->memberData['g_is_supmod'] == 1 )
{
$pass = 1;
$this->canSuspend = $this->settings['warn_gmod_ban'];
$this->canModQueue = $this->settings['warn_gmod_modq'];
$this->canRemovePostAbility = $this->settings['warn_gmod_post'];
$this->restrictWarnsPerDay = intval($this->settings['warn_gmod_day']);
$this->canApprovePosts = 1;
$this->canApproveTopics = 1;
$this->canDeletePosts = 1;
$this->canDeleteTopics = 1;
$this->type = 'supmod';
}
else if( $this->memberData['is_mod'] )
{
$other_mgroups = array();
if( $this->memberData['mgroup_others'] )
{
$other_mgroups = explode( ",", IPSText::cleanPermString( $this->memberData['mgroup_others'] ) );
}
$other_mgroups[] = $this->memberData['member_group_id'];
$this->DB->build( array(
'select' => '*',
'from' => 'moderators',
'where' => "(member_id='" . $this->memberData['member_id'] . "' OR (is_group=1 AND group_id IN(" . implode( ",", $other_mgroups ) . ")))"
) );
$this->DB->execute();
while ( $this->moderator = $this->DB->fetch() )
{
if ( $this->moderator['allow_warn'] )
{
$pass = 1;
$this->canSuspend = $this->settings['warn_mod_ban'];
$this->canModQueue = $this->settings['warn_mod_modq'];
$this->canRemovePostAbility = $this->settings['warn_mod_post'];
$this->restrictWarnsPerDay = intval($this->settings['warn_mod_day']);
$this->canApprovePosts = $this->moderator['post_q'];
$this->canApproveTopics = $this->moderator['topic_q'];
$this->canDeletePosts = $this->moderator['delete_post'];
$this->canDeleteTopics = $this->moderator['delete_topic'];
$this->type = 'mod';
}
}
}
else if( $this->settings['warn_show_own'] and $this->memberData['member_id'] == $this->request['mid'] )
{
$pass = 1;
$this->canSuspend = 0;
$this->canModQueue = 0;
$this->canRemovePostAbility = 0;
$this->restrictWarnsPerDay = 0;
$this->canApprovePosts = 0;
$this->canApproveTopics = 0;
$this->canDeletePosts = 0;
$this->canDeleteTopics = 0;
$this->type = 'member';
}
}
if ( $pass == 0 )
{
if( $returnOnError )
{
return false;
}
$this->registry->output->showError( 'warn_no_access', 2025 );
}
//-----------------------------------------
// Ensure we have a valid member
//-----------------------------------------
$mid = intval($this->request['mid']);
if ( $mid < 1 )
{
if( $returnOnError )
{
return false;
}
$this->registry->output->showError( 'warn_no_user', 10249 );
}
$this->warn_member = IPSMember::load( $mid, 'all' );
if ( ! $this->warn_member['member_id'] )
{
if( $returnOnError )
{
return false;
}
$this->registry->output->showError( 'warn_no_user', 10250 );
}
$this->registry->output->setTitle( $this->page_title ? $this->page_title : $this->lang->words['w_title'] );
}
/**
* Save a new note
*
* @access private
* @return void [Outputs to screen/redirects]
*/
private function _saveNote()
{
if ( $this->type == 'member' )
{
$this->registry->output->showError( 'warn_member_notes', 2026 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$content = '';
$note = trim( $this->request['note'] );
$save = array();
if ( $note )
{
//-----------------------------------------
// Ready to save?
//-----------------------------------------
$save['wlog_notes'] = "<content>{$note}</content>";
$save['wlog_notes'] .= "<mod></mod>";
$save['wlog_notes'] .= "<post></post>";
$save['wlog_notes'] .= "<susp></susp>";
$save['wlog_mid'] = $this->warn_member['member_id'];
$save['wlog_addedby'] = $this->memberData['member_id'];
$save['wlog_type'] = 'note';
$save['wlog_date'] = time();
//-----------------------------------------
// Enter into warn loggy poos (eeew - poo)
//-----------------------------------------
$this->DB->insert( 'warn_logs', $save );
}
//-----------------------------------------
// Done...
//-----------------------------------------
$popup = $this->request['popup'] ? '&amp;popup=1' : '';
$this->registry->output->silentRedirect( $this->settings['base_url']."app=members&amp;module=warn&amp;section=warn&amp;mid={$this->warn_member['member_id']}&amp;do=view" . $popup );
}
/**
* Form to add a new note
*
* @access private
* @return void [Outputs to screen/redirects]
*/
private function _addNoteForm()
{
if ( $this->type == 'member' )
{
$this->registry->output->showError( 'warn_member_notes', 2027 );
}
//-----------------------------------------
// INIT
//-----------------------------------------
$content = '';
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->warn_add_note_form( $this->warn_member['member_id'], $this->warn_member['members_display_name'], $this->warn_member['members_seo_name'] );
$this->registry->getClass('output')->setTitle( $this->lang->words['warn_popup_title'] );
$this->registry->getClass('output')->popUpWindow( $this->output );
}
/**
* View the warn logs
*
* @access public
* @return string HTML output
*/
public function viewLog()
{
$perpage = 50;
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
$row = $this->DB->buildAndFetch( array( 'select' => 'count(*) as cnt', 'from' => 'warn_logs', 'where' => "wlog_mid={$this->warn_member['member_id']}" ) );
$rows = array();
$links = $this->registry->output->generatePagination( array(
'totalItems' => $row['cnt'],
'itemsPerPage' => $perpage,
'currentStartValue' => $start,
'baseUrl' => "app=members&amp;module=warn&amp;section=warn&amp;do=view&amp;mid={$this->warn_member['member_id']}",
) );
if ( $row['cnt'] > 0 )
{
$this->DB->build( array(
'select' => 'l.*',
'from' => array( 'warn_logs' => 'l' ),
'where' => 'l.wlog_mid=' . $this->warn_member['member_id'],
'order' => 'l.wlog_date DESC ',
'limit' => array( $start, $perpage ),
'add_join' => array(
array(
'select' => 'p.member_id as punisher_id, p.members_display_name as punisher_name, p.members_seo_name, p.member_group_id, p.mgroup_others',
'from' => array( 'members' => 'p' ),
'where' => 'p.member_id=l.wlog_addedby',
'type' => 'left',
)
)
) );
$q =$this->DB->execute();
while ( $r = $this->DB->fetch( $q ) )
{
if ( strstr( $r['wlog_notes'], '<content>' ) )
{
$raw = preg_match( "#<content>(.+?)</content>#is", $r['wlog_notes'], $match );
}
else
{
$_array = unserialize( $r['wlog_notes'] );
if ( is_array( $_array ) AND $_array['content'] )
{
$match[1] = $_array['content'];
}
}
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'warn';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $r['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $r['mgroup_others'];
$r['content'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( $match[1] );
$rows[] = $r;
}
}
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->warn_view_log( $this->warn_member, $rows, $links );
$this->registry->getClass('output')->setTitle( $this->lang->words['warn_popup_title'] );
return $this->output;
}
/**
* Add a new arn entry
*
* @access private
* @return void [Outputs to screen/redirects]
*/
private function _doWarn()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$save = array();
$err = 0;
$topicPosts_type = trim( $this->request['topicPosts_type'] );
$topicPosts_topics = intval( $this->request['topicPosts_topics'] );
$topicPosts_replies = intval( $this->request['topicPosts_replies'] );
$topicPosts_lastx = intval( $this->request['topicPosts_lastx'] );
$topicPosts_lastxunits = trim( $this->request['topicPosts_lastxunits'] );
$level_custom = intval( $this->request['level_custom'] );
$ban_indef = intval( $this->request['ban_indef'] );
$member_banned = intval( $this->warn_member['member_banned'] );
$warn_level = intval( $this->warn_member['warn_level']) ;
//-----------------------------------------
// Load Mod Squad
//-----------------------------------------
require_once( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php' );
$moderatorLibrary = new moderatorLibrary( $this->registry );
//-----------------------------------------
// Security checks
//-----------------------------------------
if ( $this->type == 'member' )
{
$this->registry->output->showError( 'warn_member_notes', 2028 );
}
//-----------------------------------------
// Check security fang
//-----------------------------------------
if ( $this->request['key'] != $this->member->form_hash )
{
$this->registry->output->showError( 'warn_bad_key', 3020 );
}
//-----------------------------------------
// As Celine Dion once squawked, "Show me the reason"
//-----------------------------------------
if ( trim($this->request['reason']) == "" )
{
$this->_showForm( 'we_no_reason' );
return;
}
//-----------------------------------------
// Other checks
//-----------------------------------------
if ( ! $this->settings['warn_past_max'] && $this->request['level'] != 'nochange' )
{
if ( $this->request['level'] == 'custom' )
{
if ( $level_custom > $this->settings['warn_max'] )
{
$err = 1;
}
else if( $level_custom < $this->settings['warn_min'] )
{
$err = 2;
}
}
else if ( $this->request['level'] == 'add' )
{
if ( $warn_level >= $this->settings['warn_max'] )
{
$err = 1;
}
}
else
{
if ( $warn_level <= $this->settings['warn_min'] )
{
$err = 2;
}
}
if ( $err )
{
$this->registry->output->showError( $err == 1 ? 'warn_past_max_high' : 'warn_past_max_low', 10251 );
}
}
//-----------------------------------------
// Plussy - minussy?
//-----------------------------------------
if( $this->request['level'] == 'nochange' )
{
$save['wlog_type'] = 'nochan';
}
else
{
$save['wlog_type'] = ( $this->request['level'] == 'custom' ) ? 'custom' : ( ( $this->request['level'] == 'add' ) ? 'neg' : 'pos' );
}
$save['wlog_date'] = time();
//-----------------------------------------
// Contacting the member?
//-----------------------------------------
$test_content = trim( IPSText::br2nl( $_POST['contact'] ) ) ;
if ( $test_content != "" )
{
if ( trim($this->request['subject']) == "" )
{
$this->_showForm('we_no_subject');
return;
}
unset($test_content);
if ( IPSText::getTextClass('editor')->method == 'rte' )
{
$this->request['contact'] = IPSText::getTextClass('editor')->processRawPost( 'contact' );
}
IPSText::getTextClass( 'bbcode' )->parse_smilies = 1;
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'warn';
$save['wlog_contact'] = $this->request['contactmethod'];
$save['wlog_contact_content'] = "<subject>" . $this->request['subject'] . "</subject><content>" . $this->request['contact'] . "</content>";
$save['wlog_contact_content'] = IPSText::getTextClass( 'bbcode' )->preDbParse( $save['wlog_contact_content'] );
if ( $this->request['contactmethod'] == 'email' )
{
IPSText::getTextClass( 'bbcode' )->parse_smilies = 0;
IPSText::getTextClass( 'bbcode' )->parse_html = 1;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'warn';
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $this->memberData['member_group_id'];
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $this->memberData['mgroup_others'];
$this->request['contact'] = IPSText::getTextClass( 'bbcode' )->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse( $this->request['contact'] ) );
//-----------------------------------------
// Send the email
//-----------------------------------------
IPSText::getTextClass( 'email' )->getTemplate("email_member");
IPSText::getTextClass( 'email' )->buildMessage( array(
'MESSAGE' => IPSText::br2nl( $this->request['contact'] ),
'MEMBER_NAME' => $this->warn_member['members_display_name'],
'FROM_NAME' => $this->memberData['members_display_name']
)
);
IPSText::getTextClass( 'email' )->subject = $this->request['subject'];
IPSText::getTextClass( 'email' )->to = $this->warn_member['email'];
IPSText::getTextClass( 'email' )->from = $this->settings['email_out'];
IPSText::getTextClass( 'email' )->sendMail();
}
else
{
//-----------------------------------------
// Grab PM class
//-----------------------------------------
require_once( IPSLib::getAppDir( 'members' ) . '/sources/classes/messaging/messengerFunctions.php' );
$messengerFunctions = new messengerFunctions( $this->registry );
try
{
$messengerFunctions->sendNewPersonalTopic( $this->warn_member['member_id'],
$this->memberData['member_id'],
array(),
$this->request['subject'],
IPSText::getTextClass( 'editor' )->method == 'rte' ? nl2br($_POST['contact']) : $_POST['contact'],
array( 'origMsgID' => 0,
'fromMsgID' => 0,
'postKey' => md5(microtime()),
'trackMsg' => 0,
'addToSentFolder' => 0,
'hideCCUser' => 0,
'forcePm' => 1,
)
);
}
catch( Exception $error )
{
$msg = $error->getMessage();
$toMember = IPSMember::load( $this->warn_member['member_id'], 'core' );
if ( strstr( $msg, 'BBCODE_' ) )
{
$msg = str_replace( 'BBCODE_', '', $msg );
$this->registry->output->showError( $msg, 10252 );
}
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( ",", $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, 10253 );
}
else if( $msg != 'CANT_SEND_TO_SELF' )
{
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
$this->registry->output->showError( $_msgString, 10254 );
}
}
}
}
else
{
unset($test_content);
}
//-----------------------------------------
// Right - is we banned or wha?
//-----------------------------------------
$restrict_post = '';
$mod_queue = '';
$susp = '';
$_notes = array();
$_notes['content'] = $this->request['reason'];
$_notes['mod'] = $this->request['mod_value'];
$_notes['post'] = $this->request['post_value'];
$_notes['susp'] = $this->request['susp_value'];
$_notes['ban'] = $ban_indef;
$_notes['topicPosts_type'] = $topicPosts_type;
$_notes['topicPosts_topics'] = $topicPosts_topics;
$_notes['topicPosts_replies'] = $topicPosts_replies;
$_notes['topicPosts_lastx'] = $topicPosts_lastx;
$_notes['topicPosts_lastxunits'] = $topicPosts_lastxunits;
$save['wlog_notes'] = serialize( $_notes );
//-----------------------------------------
// Member Content
//-----------------------------------------
if ( $topicPosts_type == 'unapprove' OR $topicPosts_type == 'approve' )
{
$time = ( $topicPosts_lastxunits == 'd' ) ? ( $topicPosts_lastx * 24 ) : $topicPosts_lastx;
$approve = ( $topicPosts_type == 'approve' ) ? TRUE : FALSE;
if ( ( $topicPosts_topics AND $this->canApproveTopics ) AND ( $topicPosts_replies AND $this->canApprovePosts ) )
{
$moderatorLibrary->toggleApproveMemberContent( $this->warn_member['member_id'], $approve, 'all', $time );
}
else if ( $topicPosts_topics AND $this->canApproveTopics )
{
$moderatorLibrary->toggleApproveMemberContent( $this->warn_member['member_id'], $approve, 'topics', $time );
}
else if ( $topicPosts_replies AND $this->canApprovePosts )
{
$moderatorLibrary->toggleApproveMemberContent( $this->warn_member['member_id'], $approve, 'replies', $time );
}
}
else if ( $topicPosts_type == 'delete')
{
$time = ( $topicPosts_lastxunits == 'd' ) ? ( $topicPosts_lastx * 24 ) : $topicPosts_lastx;
if ( ( $topicPosts_topics AND $this->canDeleteTopics ) AND ( $topicPosts_replies AND $this->canDeletePosts ) )
{
$moderatorLibrary->deleteMemberContent( $this->warn_member['member_id'], 'all', $time );
}
else if ( $topicPosts_topics AND $this->canDeleteTopics )
{
$moderatorLibrary->deleteMemberContent( $this->warn_member['member_id'], 'topics', $time );
}
else if ( $topicPosts_replies AND $this->canDeletePosts )
{
$moderatorLibrary->deleteMemberContent( $this->warn_member['member_id'], 'replies', $time );
}
}
//-----------------------------------------
// Member Suspension
//-----------------------------------------
if ( $this->canModQueue )
{
if ( $this->request['mod_indef'] == 1 )
{
$mod_queue = 1;
}
elseif ( $this->request['mod_value'] > 0 )
{
$mod_queue = IPSMember::processBanEntry( array( 'timespan' => intval($this->request['mod_value']), 'unit' => $this->request['mod_unit'] ) );
}
}
if ( $this->canRemovePostAbility )
{
if ( $this->request['post_indef'] == 1 )
{
$restrict_post = 1;
}
elseif ( $this->request['post_value'] > 0 )
{
$restrict_post = IPSMember::processBanEntry( array( 'timespan' => intval($this->request['post_value']), 'unit' => $this->request['post_unit'] ) );
}
}
if ( $this->canSuspend )
{
if ( $ban_indef )
{
$member_banned = 1;
}
else if ( $this->request['susp_value'] > 0 )
{
$susp = IPSMember::processBanEntry( array( 'timespan' => intval($this->request['susp_value']), 'unit' => $this->request['susp_unit'] ) );
}
/* Were banned but now unticked? */
if ( ! $ban_indef AND $member_banned )
{
$member_banned = 0;
}
}
$save['wlog_mid'] = $this->warn_member['member_id'];
$save['wlog_addedby'] = $this->memberData['member_id'];
//-----------------------------------------
// Enter into warn loggy poos (eeew - poo)
//-----------------------------------------
$this->DB->insert( 'warn_logs', $save );
//-----------------------------------------
// Update member
//-----------------------------------------
if( $this->request['level'] != 'nochange' )
{
if ( $this->request['level'] == 'custom' )
{
$warn_level = $level_custom;
}
else if ( $this->request['level'] == 'add' )
{
$warn_level++;
}
else
{
$warn_level--;
}
if ( $warn_level > $this->settings['warn_max'] )
{
$warn_level = $this->settings['warn_max'];
}
if ( $warn_level < intval($this->settings['warn_min']) )
{
$warn_level = intval($this->settings['warn_min']);
}
}
IPSMember::save( $this->warn_member['member_id'], array( 'core' => array( 'mod_posts' => $mod_queue,
'restrict_post' => $restrict_post,
'temp_ban' => $susp,
'member_banned' => $member_banned,
'warn_level' => $warn_level,
'warn_lastwarn' => time() ) ) );
//-----------------------------------------
// Now what? Show success screen, that's what!!
//-----------------------------------------
$this->lang->words['w_done_te'] = sprintf( $this->lang->words['w_done_te'], $this->warn_member['members_display_name'] );
$tid = intval($this->request['t']);
$topic = array();
if ( $tid > 0 )
{
$topic = $this->DB->buildAndFetch( array(
'select' => 't.tid, t.title, t.title_seo',
'from' => array( 'topics' => 't' ),
'where' => "t.tid={$tid}",
'add_join' => array( array(
'select' => 'f.id, f.name, f.name_seo',
'from' => array( 'forums' => 'f' ),
'where' => 'f.id=t.forum_id',
'type' => 'left'
) )
) );
}
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->warn_success( $topic );
}
/**
* Show the add new warn form
*
* @access private
* @param mixed Empty | Error message language key
* @return void [Outputs to screen/redirects]
*/
private function _showForm( $errors="" )
{
if ( $this->type == 'member' )
{
$this->registry->output->showError( 'warn_member_notes', 10255 );
}
$this->warn_member['warn_level'] = intval($this->warn_member['warn_level']);
$this->request['contact'] = $this->request['contact'] ? IPSText::getTextClass( 'bbcode' )->preEditParse( $this->request['contact'] ) : '';
$this->output .= $this->registry->getClass('output')->getTemplate('mod')->warnForm( IPSMember::buildDisplayData( $this->warn_member, '__all__' ),
intval($this->request['t']),
intval($this->request['st']),
$errors ? $this->lang->words[$errors] : '',
$this->canModQueue,
$this->canRemovePostAbility,
$this->canSuspend,
IPSText::getTextClass( 'editor' )->showEditor( $this->request['contact'] ? $this->request['contact'] : '', 'contact' ) );
}
/**
* Checking method access
*
* @access private
* @return void [Displays error if appropriate]
*/
private function _checkAccess()
{
//-----------------------------------------
// Protected member? Really? o_O
//-----------------------------------------
if ( strstr( ',' . $this->settings['warn_protected'] . ',', ',' . $this->warn_member['member_group_id'] . ',' ) )
{
$this->registry->output->showError( 'warn_protected_member', 10256 );
}
//-----------------------------------------
// I've already warned you!!
//-----------------------------------------
if ( $this->restrictWarnsPerDay > 0 )
{
$time_to_check = time() - 86400;
$check = $this->DB->buildAndFetch( array( 'select' => 'COUNT(*) as warn_times', 'from' => 'warn_logs', 'where' => "wlog_mid={$this->warn_member['member_id']} AND wlog_date > $time_to_check" ) );
if ( $check['warn_times'] >= $this->restrictWarnsPerDay )
{
$this->registry->output->showError( 'warned_already', 10257 );
}
}
}
}