Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
@@ -0,0 +1,898 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* Library to facilitate ACP member management
|
||||
* Last Updated: $Date: 2011-09-01 17:55:10 -0400 (Thu, 01 Sep 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://hatynka.in
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 9441 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 adminMemberManagement
|
||||
{
|
||||
/**#@+
|
||||
* Registry objects
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
protected $lang;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object $registry Registry object
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete member(s)
|
||||
*
|
||||
* @param array Array of member ids
|
||||
* @param string Alternate language key to use
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function deleteMembers( $ids, $lang='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Filter if we cannot delete admins
|
||||
//-----------------------------------------
|
||||
|
||||
if( ! $this->registry->getClass('class_permissions')->checkPermission( 'member_delete_admin', 'members', 'members' ) )
|
||||
{
|
||||
$newIds = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id, member_group_id, mgroup_others', 'from' => 'members', 'where' => "member_id IN(" . implode( ",", $ids ) . ")" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $r['member_group_id'] ]['g_access_cp'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$other_mgroups = explode( ',', IPSText::cleanPermString( $r['mgroup_others'] ) );
|
||||
|
||||
if( count($other_mgroups) )
|
||||
{
|
||||
foreach( $other_mgroups as $other_mgroup )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $other_mgroup ]['g_access_cp'] )
|
||||
{
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$newIds[] = $r['member_id'];
|
||||
}
|
||||
|
||||
$ids = $newIds;
|
||||
}
|
||||
|
||||
IPSMember::remove( $ids );
|
||||
|
||||
$message = sprintf( $lang ? $this->lang->words[ $lang ] : $this->lang->words['t_memdeleted'], count($ids) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deny member(s) registrations
|
||||
*
|
||||
* @param array Array of member ids
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function denyMembers( $ids )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Get names for log, and filter out admins if
|
||||
// we do not have permission to delete them
|
||||
//-----------------------------------------
|
||||
|
||||
$denied = array();
|
||||
$newIds = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id, member_group_id, mgroup_others, members_display_name', 'from' => 'members', 'where' => "member_id IN(" . implode( ",", $ids ) . ")" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if( ! $this->registry->getClass('class_permissions')->checkPermission( 'member_delete_admin', 'members', 'members' ) )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $r['member_group_id'] ]['g_access_cp'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$other_mgroups = explode( ',', IPSText::cleanPermString( $r['mgroup_others'] ) );
|
||||
|
||||
if( count($other_mgroups) )
|
||||
{
|
||||
foreach( $other_mgroups as $other_mgroup )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $other_mgroup ]['g_access_cp'] )
|
||||
{
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$denied[] = $r['members_display_name'];
|
||||
$newIds[] = $r['member_id'];
|
||||
}
|
||||
|
||||
IPSMember::remove( $ids );
|
||||
|
||||
$message = sprintf( $this->lang->words['t_regdenied'], count($ids), implode( ", ", $denied ) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ban member(s)
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function banMembers( $ids )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Filter if we cannot delete admins
|
||||
//-----------------------------------------
|
||||
|
||||
if( ! $this->registry->getClass('class_permissions')->checkPermission( 'member_ban_admin', 'members', 'members' ) )
|
||||
{
|
||||
$newIds = array();
|
||||
|
||||
$this->DB->build( array( 'select' => 'member_id, member_group_id, mgroup_others', 'from' => 'members', 'where' => "member_id IN(" . implode( ",", $ids ) . ")" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $r['member_group_id'] ]['g_access_cp'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$other_mgroups = explode( ',', IPSText::cleanPermString( $r['mgroup_others'] ) );
|
||||
|
||||
if( count($other_mgroups) )
|
||||
{
|
||||
foreach( $other_mgroups as $other_mgroup )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $other_mgroup ]['g_access_cp'] )
|
||||
{
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$newIds[] = $r['member_id'];
|
||||
}
|
||||
|
||||
$ids = $newIds;
|
||||
}
|
||||
|
||||
if( count($ids) )
|
||||
{
|
||||
$this->DB->update( 'members', array( 'failed_logins' => '', 'failed_login_count' => 0, 'member_banned' => 1 ), "member_id IN (" . implode( ",", $ids ) . ")" );
|
||||
|
||||
$this->DB->delete( 'validating', "member_id IN(" . implode( ",", $ids ) . ")" );
|
||||
}
|
||||
|
||||
$message = sprintf( $this->lang->words['t_membanned'], count($ids) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unban member(s)
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function unbanMembers( $ids )
|
||||
{
|
||||
$members = IPSMember::load( $ids );
|
||||
|
||||
foreach( $members as $id => $data )
|
||||
{
|
||||
if( $data['member_group_id'] == $this->settings['banned_group'] )
|
||||
{
|
||||
$group = $this->settings['member_group'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$group = $data['member_group_id'];
|
||||
}
|
||||
|
||||
IPSMember::save( $id, array( 'core' => array( 'member_banned' => 0, 'member_group_id' => $group ) ) );
|
||||
}
|
||||
|
||||
$message = sprintf( $this->lang->words['t_memunbanned'], count($ids) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks member(s) as spam
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function markMembersAsSpam( $ids )
|
||||
{
|
||||
/* Grab members */
|
||||
$members = IPSMember::load( $ids );
|
||||
|
||||
/* Load moderator's library */
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
|
||||
$modLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
/* Load custom profile fields class */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields' );
|
||||
$fields = new $classToLoad();
|
||||
|
||||
/* Load language file */
|
||||
$this->registry->getClass( 'class_localization')->loadLanguageFile( array( 'public_mod' ), 'forums' );
|
||||
|
||||
foreach( $members as $member_id => $member )
|
||||
{
|
||||
$toSave = array( 'core' => array( 'bw_is_spammer' => 1, 'member_group_id' => $this->settings['member_group'] ) );
|
||||
|
||||
/* Protected group? */
|
||||
if ( strstr( ','.$this->settings['warn_protected'].',', ','.$member['member_group_id'].',' ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* What do to.. */
|
||||
if ( $this->settings['spm_option'] )
|
||||
{
|
||||
switch( $this->settings['spm_option'] )
|
||||
{
|
||||
case 'disable':
|
||||
$toSave['core']['restrict_post'] = 1;
|
||||
$toSave['core']['members_disable_pm'] = 2;
|
||||
break;
|
||||
case 'unapprove':
|
||||
$toSave['core']['restrict_post'] = 1;
|
||||
$toSave['core']['members_disable_pm'] = 2;
|
||||
/* Unapprove posts and topics */
|
||||
$modLibrary->toggleApproveMemberContent( $member_id, FALSE, 'all', intval( $this->settings['spm_post_days'] ) * 24 );
|
||||
break;
|
||||
case 'ban':
|
||||
/* Unapprove posts and topics */
|
||||
$modLibrary->toggleApproveMemberContent( $member_id, FALSE, 'all', intval( $this->settings['spm_post_days'] ) * 24 );
|
||||
|
||||
$toSave = array(
|
||||
'core' => array(
|
||||
'member_banned' => 1,
|
||||
'title' => '',
|
||||
'bw_is_spammer' => 1,
|
||||
),
|
||||
'extendedProfile' => array(
|
||||
'signature' => '',
|
||||
'pp_about_me' => '',
|
||||
)
|
||||
);
|
||||
|
||||
//-----------------------------------------
|
||||
// Photo
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/member/photo.php', 'classes_member_photo' );
|
||||
$photos = new $classToLoad( $this->registry );
|
||||
$photos->remove( $member['member_id'] );
|
||||
|
||||
//-----------------------------------------
|
||||
// Profile fields
|
||||
//-----------------------------------------
|
||||
|
||||
$fields->member_data = $member;
|
||||
$fields->initData( 'edit' );
|
||||
$fields->parseToSave( array() );
|
||||
|
||||
if ( count( $fields->out_fields ) )
|
||||
{
|
||||
$toSave['customFields'] = $fields->out_fields;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Update signature content cache
|
||||
//-----------------------------------------
|
||||
|
||||
IPSContentCache::update( $member['member_id'], 'sig', '' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send an email */
|
||||
if ( $this->settings['spm_notify'] AND ( $this->settings['email_in'] != $this->memberData['email'] ) )
|
||||
{
|
||||
IPSText::getTextClass('email')->getTemplate( 'possibleSpammer' );
|
||||
|
||||
IPSText::getTextClass('email')->buildMessage( array( 'DATE' => $this->registry->class_localization->getDate( $member['joined'], 'LONG', 1 ),
|
||||
'MEMBER_NAME' => $member['members_display_name'],
|
||||
'IP' => $member['ip_address'],
|
||||
'EMAIL' => $member['email'],
|
||||
'LINK' => $this->registry->getClass('output')->buildSEOUrl( "showuser=" . $member['member_id'], 'public', $member['members_seo_name'], 'showuser') ) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = $this->lang->words['new_registration_email_spammer'] . ' ' . $this->settings['board_name'];
|
||||
IPSText::getTextClass('email')->to = $this->settings['email_in'];
|
||||
IPSText::getTextClass('email')->sendMail();
|
||||
}
|
||||
|
||||
/* Flag them as a spammer */
|
||||
IPSMember::save( $member['member_id'], $toSave );
|
||||
|
||||
/* Send Spammer to Spam Service */
|
||||
if( $this->settings['spam_service_send_to_ips'] )
|
||||
{
|
||||
IPSMember::querySpamService( $member['email'], $member['ip_address'], 'markspam' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Remove validating rows */
|
||||
$this->DB->delete( 'validating', "member_id IN(" . implode( ",", $ids ) . ")" );
|
||||
|
||||
$message = sprintf( $this->lang->words['t_setasspammers'], count($ids) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmarks member(s) as spam
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @param bool Unmark posts additionally
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function unmarkMembersAsSpam( $ids, $unmarkPosts=false )
|
||||
{
|
||||
/* Load Member Data */
|
||||
$members = IPSMember::load( $ids );
|
||||
|
||||
foreach( $ids as $i )
|
||||
{
|
||||
IPSMember::save( $i, array( 'core' => array( 'bw_is_spammer' => 0, 'restrict_post' => 0, 'members_disable_pm' => 0 ) ) );
|
||||
|
||||
if( $this->settings['spam_service_send_to_ips'] )
|
||||
{
|
||||
IPSMember::querySpamService( $members[$i]['email'], $members[$i]['ip_address'], 'notspam' );
|
||||
}
|
||||
|
||||
$this->DB->update( 'validating', array( 'spam_flag' => 0 ), 'member_id=' . $i );
|
||||
}
|
||||
|
||||
if ( $unmarkPosts )
|
||||
{
|
||||
/* Toggle their content */
|
||||
$classToLoad = IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
|
||||
$modLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
foreach( $ids as $id )
|
||||
{
|
||||
$modLibrary->toggleApproveMemberContent( $id, TRUE, 'all', intval( $this->settings['spm_post_days'] ) * 24 );
|
||||
|
||||
/* Run member sync */
|
||||
IPSLib::runMemberSync( 'onUnSetAsSpammer', array( 'member_id' => $id ) );
|
||||
}
|
||||
}
|
||||
|
||||
$message = sprintf( $this->lang->words['t_memunspammed'], count($ids) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bans spammers and optionally blacklists their data
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @param bool Blacklist additionally
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function banSpammers( $ids, $blacklist=false )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load members
|
||||
//-----------------------------------------
|
||||
|
||||
$members = IPSMember::load( $ids );
|
||||
|
||||
foreach( $members as $i => $data )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Filter if we cannot delete admins
|
||||
//-----------------------------------------
|
||||
|
||||
if( ! $this->registry->getClass('class_permissions')->checkPermission( 'member_ban_admin', 'members', 'members' ) )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $data['member_group_id'] ]['g_access_cp'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$other_mgroups = explode( ',', IPSText::cleanPermString( $data['mgroup_others'] ) );
|
||||
|
||||
if( count($other_mgroups) )
|
||||
{
|
||||
foreach( $other_mgroups as $other_mgroup )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $other_mgroup ]['g_access_cp'] )
|
||||
{
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IPSMember::save( $i, array( 'core' => array( 'bw_is_spammer' => 0, 'member_banned' => 1 ) ) );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Are we blacklisting too?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $blacklist )
|
||||
{
|
||||
$ips = array();
|
||||
$email = array();
|
||||
$ban = array( 'ip' => array(), 'email' => array() );
|
||||
|
||||
if ( is_array( $members ) AND count( $members ) )
|
||||
{
|
||||
foreach( $members as $id => $data )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Filter if we cannot delete admins
|
||||
//-----------------------------------------
|
||||
|
||||
if( ! $this->registry->getClass('class_permissions')->checkPermission( 'member_ban_admin', 'members', 'members' ) )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $data['member_group_id'] ]['g_access_cp'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$other_mgroups = explode( ',', IPSText::cleanPermString( $data['mgroup_others'] ) );
|
||||
|
||||
if( count($other_mgroups) )
|
||||
{
|
||||
foreach( $other_mgroups as $other_mgroup )
|
||||
{
|
||||
if( $this->caches['group_cache'][ $other_mgroup ]['g_access_cp'] )
|
||||
{
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ips[ $data['ip_address'] ] = $data['ip_address'];
|
||||
$email[ $data['email'] ] = $data['email'];
|
||||
}
|
||||
|
||||
if ( count( $ips ) )
|
||||
{
|
||||
/* IPS: Check for duplicate */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'banfilters',
|
||||
'where' => "ban_content IN ('" . implode( "','", $ips ) . "') and ban_type='ip'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$ban['ip'][] = $row['ban_content'];
|
||||
}
|
||||
|
||||
/* Now insert.. */
|
||||
foreach( $ips as $i )
|
||||
{
|
||||
if ( ! in_array( $i, $ban['ip'] ) )
|
||||
{
|
||||
/* Insert the new ban filter */
|
||||
$this->DB->insert( 'banfilters', array( 'ban_type' => 'ip', 'ban_content' => $i, 'ban_date' => time() ) );
|
||||
|
||||
/* Prevent it adding a second time */
|
||||
$ban['ip'][] = $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( count( $email ) )
|
||||
{
|
||||
/* IPS: Check for duplicate */
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'banfilters',
|
||||
'where' => "ban_content IN ('" . implode( "','", $email ) . "') and ban_type='email'" ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch() )
|
||||
{
|
||||
$ban['email'][] = $row['ban_content'];
|
||||
}
|
||||
|
||||
/* Now insert.. */
|
||||
foreach( $email as $e )
|
||||
{
|
||||
if ( ! in_array( $e, $ban['email'] ) )
|
||||
{
|
||||
/* Insert the new ban filter */
|
||||
$this->DB->insert( 'banfilters', array( 'ban_type' => 'email', 'ban_content' => $e, 'ban_date' => time() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$message = sprintf( $this->lang->words['t_membanned'], count($ids) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlock member(s)
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function unlockMembers( $ids )
|
||||
{
|
||||
foreach( $ids as $_id )
|
||||
{
|
||||
IPSMember::save( $_id, array( 'core' => array( 'failed_logins' => '', 'failed_login_count' => 0 ) ) );
|
||||
}
|
||||
|
||||
$message = sprintf( $this->lang->words['t_memunlocked'], count($ids) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finalize member(s)
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function finalizeMembers( $ids )
|
||||
{
|
||||
$members = IPSMember::load( $ids, 'core' );
|
||||
$_total = 0;
|
||||
|
||||
foreach( $members as $member )
|
||||
{
|
||||
if( $member['name'] AND $member['members_display_name'] AND $member['email'] )
|
||||
{
|
||||
$this->DB->delete( 'members_partial', 'partial_member_id=' . $member['member_id'] );
|
||||
$_total++;
|
||||
}
|
||||
}
|
||||
|
||||
$message = sprintf( $this->lang->words['t_inc_finalized'], $_total );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unapprove member email change
|
||||
*
|
||||
* @param int Member ID
|
||||
* @return string Confirmation message
|
||||
* @throws NO_VALIDATING_MEMBER
|
||||
*/
|
||||
public function unapproveEmailChange( $id )
|
||||
{
|
||||
$member = $this->DB->buildAndFetch( array( 'select' => 'v.*',
|
||||
'from' => array( 'validating' => 'v' ),
|
||||
'where' => 'v.email_chg=1 AND v.member_id=' . intval($id),
|
||||
'add_join' => array( array( 'select' => 'm.member_group_id AS old_member_group',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=v.member_id',
|
||||
'type' => 'left' ) )
|
||||
) );
|
||||
|
||||
if( !$member['vid'] )
|
||||
{
|
||||
throw new Exception( "NO_VALIDATING_MEMBER" );
|
||||
}
|
||||
|
||||
$this->DB->delete( "validating", "vid='{$member['vid']}'" );
|
||||
|
||||
IPSMember::save( $member['member_id'], array( 'core' => array( 'email' => $member['prev_email'], 'member_group_id' => $member['real_group'] ) ) );
|
||||
|
||||
IPSLib::runMemberSync( 'onGroupChange', $member['member_id'], $member['real_group'], $member['old_member_group'] );
|
||||
|
||||
$message = sprintf( $this->lang->words['t_emailchangeun'], $member['member_id'] );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve member(s)
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function approveMembers( $ids )
|
||||
{
|
||||
IPSText::getTextClass('email')->getTemplate( "complete_reg" );
|
||||
|
||||
$approved = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get members
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'v.*',
|
||||
'from' => array( 'validating' => 'v' ),
|
||||
'where' => "m.member_id IN(" . implode( ",", $ids ) . ")",
|
||||
'add_join' => array(
|
||||
array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=v.member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
$main = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $main ) )
|
||||
{
|
||||
$approved[] = $row['name'];
|
||||
|
||||
//-----------------------------------------
|
||||
// Only approve if the user is validating
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $row['member_group_id'] != $this->settings['auth_group'] )
|
||||
{
|
||||
$row['real_group'] = $row['member_group_id'];
|
||||
// Let's still "validate", but leave them in the group they're in
|
||||
//continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Don't approve if no real_group set
|
||||
//-----------------------------------------
|
||||
|
||||
if ( !$row['real_group'] )
|
||||
{
|
||||
//$row['real_group'] = $this->settings['member_group'];
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// We don't approve lost pass requests
|
||||
//-----------------------------------------
|
||||
|
||||
if( $row['lost_pass'] == 1 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if( $row['real_group'] != $row['member_group_id'] )
|
||||
{
|
||||
IPSMember::save( $row['member_id'], array( 'core' => array( 'member_group_id' => $row['real_group'] ) ) );
|
||||
}
|
||||
|
||||
IPSText::getTextClass('email')->buildMessage( array() );
|
||||
|
||||
//-----------------------------------------
|
||||
// Using 'name' on purpose
|
||||
// @see http://forums.invisionpower.com/index.php?autocom=tracker&showissue=11564&view=findpost&p=45269
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf( $this->lang->words['subject__complete_reg'], $row['name'], $this->settings['board_name'] );
|
||||
IPSText::getTextClass('email')->to = $row['email'];
|
||||
IPSText::getTextClass('email')->sendMail();
|
||||
|
||||
IPSLib::runMemberSync( 'onCompleteAccount', $row );
|
||||
IPSLib::runMemberSync( 'onGroupChange', $row['member_id'], $row['real_group'], $row['member_group_id'] );
|
||||
}
|
||||
|
||||
$this->DB->delete( 'validating', "member_id IN(" . implode( ",", $ids ) . ")" );
|
||||
|
||||
//-----------------------------------------
|
||||
// Stats to Update?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->cache->rebuildCache( 'stats', 'global' );
|
||||
|
||||
$message = sprintf( $this->lang->words['t_memregapp2'], count($ids), implode( ", ", $approved ) );
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resend member validation emails
|
||||
*
|
||||
* @note Exceptions CAN bubble up, so you should still capture exceptions from calls to this method
|
||||
* @param array Array of member ids
|
||||
* @return string Confirmation message
|
||||
*/
|
||||
public function resendValidationEmails( $ids )
|
||||
{
|
||||
$reset = array();
|
||||
$cant = array();
|
||||
$main_msgs = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Get members
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array( 'select' => 'v.*',
|
||||
'from' => array( 'validating' => 'v' ),
|
||||
'where' => "m.member_id IN(" . implode( ",", $ids ) . ")",
|
||||
'add_join' => array( array( 'select' => 'm.member_id, m.members_display_name, m.email, m.member_group_id',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=v.member_id',
|
||||
'type' => 'left' ) )
|
||||
) );
|
||||
$main = $this->DB->execute();
|
||||
|
||||
while( $row = $this->DB->fetch( $main ) )
|
||||
{
|
||||
if ( $row['member_group_id'] != $this->settings['auth_group'] )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( $row['lost_pass'] )
|
||||
{
|
||||
IPSText::getTextClass('email')->getTemplate("lost_pass");
|
||||
|
||||
IPSText::getTextClass('email')->buildMessage( array(
|
||||
'NAME' => $row['members_display_name'],
|
||||
'THE_LINK' => $this->settings['board_url'] . "/index.php?app=core&module=global§ion=lostpass&do=sendform&uid=" . $row['member_id'] . "&aid=" . $row['vid'],
|
||||
'MAN_LINK' => $this->settings['board_url'] . "/index.php?app=core&module=global§ion=lostpass",
|
||||
'EMAIL' => $row['email'],
|
||||
'ID' => $row['member_id'],
|
||||
'CODE' => $row['vid'],
|
||||
'IP_ADDRESS' => $row['ip_address'],
|
||||
) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = $this->lang->words['t_passwordrec'] . $this->settings['board_name'];
|
||||
IPSText::getTextClass('email')->to = $row['email'];
|
||||
IPSText::getTextClass('email')->sendMail();
|
||||
}
|
||||
else if ( $row['new_reg'] )
|
||||
{
|
||||
if( $row['user_verified'] )
|
||||
{
|
||||
$cant[] = $row['members_display_name'];
|
||||
continue;
|
||||
}
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( "reg_validate" );
|
||||
|
||||
IPSText::getTextClass('email')->buildMessage( array(
|
||||
'THE_LINK' => $this->settings['board_url'] . "/index.php?app=core&module=global§ion=register&do=auto_validate&uid=" . $row['member_id'] . "&aid=" . $row['vid'],
|
||||
'NAME' => $row['members_display_name'],
|
||||
'MAN_LINK' => $this->settings['board_url'] . "/index.php?app=core&module=global§ion=register&do=05",
|
||||
'EMAIL' => $row['email'],
|
||||
'ID' => $row['member_id'],
|
||||
'CODE' => $row['vid'],
|
||||
) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf( $this->lang->words['t_regat'], $this->settings['board_name'] );
|
||||
IPSText::getTextClass('email')->to = $row['email'];
|
||||
IPSText::getTextClass('email')->sendMail();
|
||||
}
|
||||
else if ( $row['email_chg'] )
|
||||
{
|
||||
IPSText::getTextClass('email')->getTemplate("newemail");
|
||||
|
||||
IPSText::getTextClass('email')->buildMessage( array(
|
||||
'NAME' => $row['members_display_name'],
|
||||
'THE_LINK' => $this->settings['board_url'] . "/index.php?app=core&module=global§ion=register&do=auto_validate&type=newemail&uid=" . $row['member_id'] . "&aid=" . $row['vid'],
|
||||
'ID' => $row['member_id'],
|
||||
'MAN_LINK' => $this->settings['board_url'] . "/index.php?app=core&module=global§ion=register&do=user_validate",
|
||||
'CODE' => $row['vid'],
|
||||
) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf( $this->lang->words['t_emailchange'], $this->settings['board_name'] );
|
||||
IPSText::getTextClass('email')->to = $row['email'];
|
||||
IPSText::getTextClass('email')->sendMail();
|
||||
}
|
||||
|
||||
$resent[] = $row['members_display_name'];
|
||||
}
|
||||
|
||||
if( count($resent) )
|
||||
{
|
||||
$message = sprintf( $this->lang->words['tools_val_resent_log'], count($resent), implode( ", ", $resent ) );
|
||||
$main_msgs[] = $message;
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->saveAdminLog( $message );
|
||||
}
|
||||
|
||||
if( count($cant) )
|
||||
{
|
||||
$main_msgs[] = sprintf( $this->lang->words['t_valcannot'], implode( ", ", $cant ) );
|
||||
}
|
||||
|
||||
return count($main_msgs) ? implode( "\n", $main_msgs ) : '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,935 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.2.3
|
||||
* Library to facilitate ACP member searches
|
||||
* Last Updated: $Date: 2011-09-20 21:18:18 -0400 (Tue, 20 Sep 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://hatynka.in
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 9520 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 adminMemberSearch
|
||||
{
|
||||
/**#@+
|
||||
* Registry objects
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
protected $lang;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Data for HTML form
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $htmlPresets = array();
|
||||
|
||||
/**
|
||||
* Reset filters and pull all members
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $showAllMembers = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object $registry Registry object
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate context-menu filter boxes.
|
||||
* Pass &_nosave=1 to not store / read from a cookie
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @since IPB 3.0.0
|
||||
* @return array
|
||||
*/
|
||||
public function generateFilterBoxes()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
static $_return = array();
|
||||
|
||||
if( count($_return) )
|
||||
{
|
||||
return $_return;
|
||||
}
|
||||
|
||||
$form = array();
|
||||
$custom_field_data = array();
|
||||
$filters_preset = 0;
|
||||
|
||||
//-----------------------------------------
|
||||
// Custom filtering
|
||||
//-----------------------------------------
|
||||
|
||||
$member_string = $this->request['string'] ? trim( $this->request['string'] ) : '';
|
||||
$member_contains = $this->request['f_member_contains'] ? trim( $this->request['f_member_contains'] ) : '';
|
||||
$member_contains_type = $this->request['f_member_contains_type'] ? trim( $this->request['f_member_contains_type'] ) : '';
|
||||
$member_contains_text = $this->request['f_member_contains_text'] ? trim( $this->request['f_member_contains_text'] ) : '';
|
||||
|
||||
$_member_contains = array(
|
||||
0 => array( 'members_display_name' , $this->lang->words['m_f_display'] ),
|
||||
1 => array( 'name' , $this->lang->words['m_f_login'] ),
|
||||
2 => array( 'member_id' , $this->lang->words['m_f_id'] ),
|
||||
3 => array( 'email' , $this->lang->words['m_f_email'] ),
|
||||
4 => array( 'ip_address' , $this->lang->words['m_f_ip'] ),
|
||||
5 => array( 'signature' , $this->lang->words['m_f_sig'] )
|
||||
);
|
||||
|
||||
$_member_contains_type = array(
|
||||
0 => array( 'contains' , $this->lang->words['m_f_contains'] ),
|
||||
1 => array( 'equals' , $this->lang->words['m_f_equals'] ),
|
||||
2 => array( 'begins' , $this->lang->words['m_f_begins'] ),
|
||||
3 => array( 'ends' , $this->lang->words['m_f_ends'] )
|
||||
);
|
||||
|
||||
//-----------------------------------------
|
||||
// Order by
|
||||
//-----------------------------------------
|
||||
|
||||
$order_by = '';
|
||||
|
||||
$order_by = $this->request['order_by'] ? $this->request['order_by'] : 'joined';
|
||||
|
||||
$_order_by = array(
|
||||
0 => array( 'joined' , $this->lang->words['m_f_joined'] ),
|
||||
1 => array( 'members_l_username' , $this->lang->words['m_f_slogin'] ),
|
||||
2 => array( 'members_l_display_name', $this->lang->words['m_f_sdisplay'] ),
|
||||
3 => array( 'email' , $this->lang->words['m_f_email'] ),
|
||||
4 => array( 'posts' , $this->lang->words['m_f_posts'] ),
|
||||
);
|
||||
|
||||
$order_direction = $this->request['order_direction'] ? strtolower($this->request['order_direction']) : 'desc';
|
||||
|
||||
$_order_direction = array(
|
||||
0 => array( 'asc' , $this->lang->words['m_f_orderaz'] ),
|
||||
1 => array( 'desc' , $this->lang->words['m_f_orderza'] )
|
||||
);
|
||||
|
||||
//-----------------------------------------
|
||||
// Member status type
|
||||
//-----------------------------------------
|
||||
|
||||
$member_status = ( $this->request['type'] AND in_array( $this->request['type'], array( 'all', 'banned', 'spam', 'validating', 'incomplete', 'locked' ) ) ) ? $this->request['type'] : 'all';
|
||||
|
||||
$_member_status = array(
|
||||
0 => array( 'all', $this->lang->words['m_f_sall'] ),
|
||||
1 => array( 'banned', $this->lang->words['m_f_sbanned'] ),
|
||||
2 => array( 'spam', $this->lang->words['m_f_sspam'] ),
|
||||
3 => array( 'validating', $this->lang->words['m_f_svalidating'] ),
|
||||
4 => array( 'incomplete', $this->lang->words['m_f_simpcomplete'] ),
|
||||
5 => array( 'locked', $this->lang->words['m_f_slocked'] ),
|
||||
);
|
||||
|
||||
//-----------------------------------------
|
||||
// Search type
|
||||
//-----------------------------------------
|
||||
|
||||
$search_type = $this->request['f_search_type'] ? $this->request['f_search_type'] : 'normal';
|
||||
|
||||
$_search_type = array( 0 => array( 'normal', $this->lang->words['m_f_toedit'] ) );
|
||||
|
||||
if( $this->registry->getClass('class_permissions')->checkPermission( 'member_delete' ) )
|
||||
{
|
||||
$_search_type[1] = array( 'delete', $this->lang->words['m_f_todelete'] );
|
||||
}
|
||||
|
||||
if( $this->registry->getClass('class_permissions')->checkPermission( 'member_move' ) )
|
||||
{
|
||||
$_search_type[2] = array( 'move', $this->lang->words['m_f_tomove'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Date ranges
|
||||
//-----------------------------------------
|
||||
|
||||
$date_reg_from = $this->request['f_date_reg_from'] ? trim( $this->request['f_date_reg_from'] ) : '';
|
||||
$date_reg_to = $this->request['f_date_reg_to'] ? trim( $this->request['f_date_reg_to'] ) : '';
|
||||
|
||||
$date_post_from = $this->request['f_date_post_from'] ? trim( $this->request['f_date_post_from'] ) : '';
|
||||
$date_post_to = $this->request['f_date_post_to'] ? trim( $this->request['f_date_post_to'] ) : '';
|
||||
|
||||
$date_active_from = $this->request['f_date_active_from'] ? trim( $this->request['f_date_active_from'] ) : '';
|
||||
$date_active_to = $this->request['f_date_active_to'] ? trim( $this->request['f_date_active_to'] ) : '';
|
||||
|
||||
//-----------------------------------------
|
||||
// Groups
|
||||
//-----------------------------------------
|
||||
|
||||
$primary_group = $this->request['f_primary_group'] ? trim( $this->request['f_primary_group'] ) : 0;
|
||||
$secondary_group = $this->request['f_secondary_group'] ? trim( $this->request['f_secondary_group'] ) : 0;
|
||||
$include_secondary = $this->request['f_inc_secondary'] ? 1 : 0;
|
||||
|
||||
$_primary_group = array( 0 => array( '0', $this->lang->words['m_f_primany'] ) );
|
||||
$_secondary_group = array( 0 => array( '0', $this->lang->words['m_f_secany'] ) );
|
||||
|
||||
foreach( ipsRegistry::cache()->getCache('group_cache') as $_gdata )
|
||||
{
|
||||
$_primary_group[] = array( $_gdata['g_id'] , $_gdata['g_title'] );
|
||||
$_secondary_group[] = array( $_gdata['g_id'] , $_gdata['g_title'] );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Post counts
|
||||
//-----------------------------------------
|
||||
|
||||
$post_count = ( $this->request['f_post_count'] || $this->request['f_post_count'] == '0' ) ? trim( $this->request['f_post_count'] ) : '';
|
||||
$post_count_type = ( $this->request['f_post_count_type'] ) ? trim( $this->request['f_post_count_type'] ) : '';
|
||||
|
||||
$_post_count_types = array( 0 => array( 'lt' , $this->lang->words['pc_lt'] ),
|
||||
1 => array( 'gt' , $this->lang->words['pc_gt'] ),
|
||||
2 => array( 'eq' , $this->lang->words['pc_eq'] ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Reset filters if set to
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->request['reset_filters'] )
|
||||
{
|
||||
ipsRegistry::getClass('adminFunctions')->staffSaveCookie( 'memberFilter', array() );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Retrieve filter from "cookie"
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $this->request['__update'] AND ! $this->request['_nosave'] )
|
||||
{
|
||||
$_cookie_array = ipsRegistry::getClass('adminFunctions')->staffGetCookie( 'memberFilter' );
|
||||
|
||||
if ( is_array( $_cookie_array ) AND count ( $_cookie_array ) )
|
||||
{
|
||||
$member_contains = substr( $_cookie_array['c_member_contains'], 0,20 );
|
||||
$member_contains_type = substr( $_cookie_array['c_member_contains_type'], 0,20 );
|
||||
$member_contains_text = substr( $_cookie_array['c_member_contains_text'], 0,50 );
|
||||
$member_status = trim( IPSText::alphanumericalClean( $_cookie_array['c_member_status'] ) );
|
||||
$member_string = trim( $_cookie_array['c_member_string'] );
|
||||
$post_count = trim( IPSText::alphanumericalClean( $_cookie_array['c_post_count'] ) );
|
||||
$post_count_type = trim( IPSText::alphanumericalClean( $_cookie_array['c_post_count_type'] ) );
|
||||
$order_by = trim( IPSText::alphanumericalClean( $_cookie_array['c_order_by'] ) );
|
||||
$order_direction = trim( IPSText::alphanumericalClean( $_cookie_array['c_order_direction'] ) );
|
||||
$date_reg_from = trim( IPSText::alphanumericalClean( $_cookie_array['c_date_reg_from'], '/-' ) );
|
||||
$date_reg_to = trim( IPSText::alphanumericalClean( $_cookie_array['c_date_reg_to'], '/-' ) );
|
||||
$date_post_from = trim( IPSText::alphanumericalClean( $_cookie_array['c_date_post_from'], '/-' ) );
|
||||
$date_post_to = trim( IPSText::alphanumericalClean( $_cookie_array['c_date_post_to'], '/-' ) );
|
||||
$date_active_from = trim( IPSText::alphanumericalClean( $_cookie_array['c_date_active_from'], '/-' ) );
|
||||
$date_active_to = trim( IPSText::alphanumericalClean( $_cookie_array['c_date_active_to'], '/-' ) );
|
||||
$primary_group = trim( IPSText::alphanumericalClean( $_cookie_array['c_primary_group'], '/-' ) );
|
||||
$include_secondary = trim( IPSText::alphanumericalClean( $_cookie_array['c_include_secondary'], '/-' ) );
|
||||
$secondary_group = trim( IPSText::alphanumericalClean( $_cookie_array['c_secondary_group'], '/-' ) );
|
||||
$custom_field_cookie = explode( '||', $_cookie_array['c_custom_fields'] );
|
||||
|
||||
if(
|
||||
$member_contains || $member_contains_type || $member_contains_text || $order_by || $order_direction ||
|
||||
$date_reg_from || $date_reg_to || $date_post_from || $date_post_to || $date_active_from || $date_active_to || $primary_group ||
|
||||
$secondary_group || $post_count || $post_count_type || $include_secondary || $member_status || $member_string
|
||||
)
|
||||
{
|
||||
$filters_preset = 1;
|
||||
}
|
||||
|
||||
if( is_array( $custom_field_cookie ) AND count($custom_field_cookie) )
|
||||
{
|
||||
foreach( $custom_field_cookie as $field )
|
||||
{
|
||||
$data = explode( '==', $field );
|
||||
$custom_field_data[ 'field_' . $data[0] ] = $data[1];
|
||||
ipsRegistry::$request[ 'field_' . $data[0] ] = $data[1];
|
||||
|
||||
if( $data[1] )
|
||||
{
|
||||
$filters_preset = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get custom profile information
|
||||
//-----------------------------------------
|
||||
|
||||
$custom_field_data = count($custom_field_data) ? $custom_field_data : $_REQUEST;
|
||||
|
||||
foreach( $custom_field_data as $k => $v )
|
||||
{
|
||||
if( strpos( $k, 'ignore_field_' ) === 0 )
|
||||
{
|
||||
$key = substr( $k, 13 );
|
||||
|
||||
$custom_field_data[ 'field_' . $key ] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields' );
|
||||
$fields = new $classToLoad();
|
||||
|
||||
$fields->member_data = $custom_field_data;
|
||||
$fields->initData( 'edit', 1 );
|
||||
$fields->parseToEdit();
|
||||
|
||||
$custom_field_data_imploded = array();
|
||||
|
||||
foreach( $custom_field_data as $k => $v )
|
||||
{
|
||||
if( strpos( $k, 'field_' ) === 0 AND $v )
|
||||
{
|
||||
$custom_field_data_imploded[] = substr( $k, 6 ) . '==' . $v;
|
||||
}
|
||||
}
|
||||
|
||||
$custom_field_data_imploded = implode( '||', $custom_field_data_imploded );
|
||||
|
||||
//-----------------------------------------
|
||||
// Generate form data
|
||||
//-----------------------------------------
|
||||
|
||||
$form['_member_contains'] = $this->registry->output->formDropdown( 'f_member_contains' , $_member_contains, $member_contains );
|
||||
$form['_member_contains_type'] = $this->registry->output->formDropdown( 'f_member_contains_type' , $_member_contains_type, $member_contains_type );
|
||||
$form['_member_contains_text'] = $this->registry->output->formInput('f_member_contains_text' , $member_contains_text, 'f_member_contains_text', 15, '', ' no_width' );
|
||||
$form['_member_status'] = $this->registry->output->formDropdown( 'type' , $_member_status, $member_status );
|
||||
$form['_member_string'] = $this->registry->output->formSimpleInput('string' , $member_string, 15 );
|
||||
$form['_order_by'] = $this->registry->output->formDropdown( 'order_by' , $_order_by, preg_replace( "#.*\.(.*)$#", "\\1", $order_by ) );
|
||||
$form['_order_direction'] = $this->registry->output->formDropdown( 'order_direction' , $_order_direction, $order_direction );
|
||||
$form['_search_type'] = $this->registry->output->formDropdown( 'f_search_type' , $_search_type, $search_type );
|
||||
$form['_post_count'] = $this->registry->output->formSimpleInput('f_post_count' , $post_count, 10 );
|
||||
$form['_post_count_type'] = $this->registry->output->formDropdown( 'f_post_count_type' , $_post_count_types, $post_count_type );
|
||||
$form['_date_reg_from'] = $this->registry->output->formInput('f_date_reg_from' , $date_reg_from, 'f_date_reg_from', 15, 'text', '', ' no_width' );
|
||||
$form['_date_reg_to'] = $this->registry->output->formInput('f_date_reg_to' , $date_reg_to, 'f_date_reg_to', 15, 'text', '', ' no_width' );
|
||||
$form['_date_post_from'] = $this->registry->output->formInput('f_date_post_from' , $date_post_from, 'f_date_post_from', 15, 'text', '', ' no_width' );
|
||||
$form['_date_post_to'] = $this->registry->output->formInput('f_date_post_to' , $date_post_to, 'f_date_post_to', 15, 'text', '', ' no_width' );
|
||||
$form['_date_active_from'] = $this->registry->output->formInput('f_date_active_from' , $date_active_from, 'f_date_active_from', 15, 'text', '', ' no_width' );
|
||||
$form['_date_active_to'] = $this->registry->output->formInput('f_date_active_to' , $date_active_to, 'f_date_active_to', 15, 'text', '', ' no_width' );
|
||||
$form['_primary_group'] = $this->registry->output->formDropdown( 'f_primary_group' , $_primary_group, $primary_group );
|
||||
$form['_secondary_group'] = $this->registry->output->formDropdown( 'f_secondary_group' , $_secondary_group, $secondary_group );
|
||||
$form['_include_secondary'] = $this->registry->output->formCheckbox( 'f_inc_secondary' , $include_secondary );
|
||||
|
||||
//-----------------------------------------
|
||||
// Store the cooookie
|
||||
// @see http://community.invisionpower.com/tracker/issue-19031-acp-members-page-always-thinks-its-being-filtered/
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( $this->request['__update'] OR $this->request['f_search_type'] ) AND ! $this->request['_nosave'] )
|
||||
{
|
||||
$_cookie = array(
|
||||
'c_member_status' => $member_status,
|
||||
'c_member_string' => $member_string,
|
||||
'c_member_contains' => $member_contains,
|
||||
'c_member_contains_type' => $member_contains_type,
|
||||
'c_member_contains_text' => $member_contains_text,
|
||||
'c_order_by' => preg_replace( "#.*\.(.*)$#", "\\1", $order_by ),
|
||||
'c_order_direction' => $order_direction,
|
||||
'c_post_count' => $post_count,
|
||||
'c_post_count_type' => $post_count_type,
|
||||
'c_date_reg_from' => $date_reg_from,
|
||||
'c_date_reg_to' => $date_reg_to,
|
||||
'c_date_post_from' => $date_post_from,
|
||||
'c_date_post_to' => $date_post_to,
|
||||
'c_date_active_from' => $date_active_from,
|
||||
'c_date_active_to' => $date_active_to,
|
||||
'c_primary_group' => $primary_group,
|
||||
'c_secondary_group' => $secondary_group,
|
||||
'c_include_secondary' => $include_secondary,
|
||||
'c_custom_fields' => $custom_field_data_imploded
|
||||
);
|
||||
|
||||
ipsRegistry::getClass('adminFunctions')->staffSaveCookie( 'memberFilter', $_cookie );
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Create filter boxes
|
||||
//-----------------------------------------
|
||||
|
||||
$this->htmlPresets = array( 'form' => $form, 'fields' => $fields, 'presets' => $filters_preset );
|
||||
|
||||
//-----------------------------------------
|
||||
// Return data
|
||||
//-----------------------------------------
|
||||
|
||||
$_return['custom_fields'] = '';
|
||||
|
||||
if( is_array( $fields->out_fields ) AND count( $fields->out_fields ) )
|
||||
{
|
||||
foreach( $fields->out_fields as $id => $data )
|
||||
{
|
||||
$_return['custom_fields'][ $id ] = $fields->in_fields[ $id ];
|
||||
}
|
||||
}
|
||||
|
||||
foreach( array_keys( $form ) as $_key )
|
||||
{
|
||||
$__key = substr( $_key, 1 );
|
||||
|
||||
$_return[ $__key ] = ${ $__key };
|
||||
}
|
||||
|
||||
return $_return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML presets
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getHtmlPresets()
|
||||
{
|
||||
if( !count($this->htmlPresets) )
|
||||
{
|
||||
$this->generateFilterBoxes();
|
||||
}
|
||||
|
||||
return $this->htmlPresets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type of search performed
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSearchType()
|
||||
{
|
||||
$data = $this->generateFilterBoxes();
|
||||
|
||||
return $data['search_type'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get member search status type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMemberType()
|
||||
{
|
||||
$data = $this->generateFilterBoxes();
|
||||
|
||||
return $data['member_status'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset filters - pull all members with no WHERE clause
|
||||
*
|
||||
* @return @e void
|
||||
*/
|
||||
public function resetFilters()
|
||||
{
|
||||
$this->showAllMembers = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get search results count
|
||||
*
|
||||
* @param string [$extraQuery] Extra query where clause
|
||||
* @return int Number of search results
|
||||
*/
|
||||
public function getSearchResultsCount( $extraQuery='' )
|
||||
{
|
||||
$extra = $extraQuery ? " AND " . $extraQuery : '';
|
||||
$count = $this->DB->buildAndFetch( array(
|
||||
'select' => 'COUNT(*) as count',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => $this->getWhereClause() . $extra,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'from' => array( 'pfields_content' => 'p' ),
|
||||
'where' => 'p.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'from' => array( 'members_partial' => 'par' ),
|
||||
'where' => 'par.partial_member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'from' => array( 'validating' => 'val' ),
|
||||
'where' => 'val.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
) );
|
||||
|
||||
return intval($count['count']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get search results
|
||||
*
|
||||
* @param int $st Start offset
|
||||
* @param int $limit Results limit
|
||||
* @param string [$extraQuery] Extra query where clause
|
||||
* @param bool [$minimalInfo] Only return ids and names
|
||||
* @return array Array of search results, or an array with keys 'ids' and 'names' if $minimalInfo is true
|
||||
*/
|
||||
public function getSearchResults( $st, $limit, $extraQuery='', $minimalInfo=false )
|
||||
{
|
||||
$extra = $extraQuery ? " AND " . $extraQuery : '';
|
||||
$members = array();
|
||||
$ids = array();
|
||||
$names = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Build query
|
||||
//-----------------------------------------
|
||||
|
||||
$query = array(
|
||||
'select' => 'm.*, m.member_id as mem_id, m.ip_address as mem_ip',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => $this->getWhereClause() . $extra,
|
||||
'order' => $this->getOrderByClause(),
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'p.*',
|
||||
'from' => array( 'pfields_content' => 'p' ),
|
||||
'where' => 'p.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'par.*',
|
||||
'from' => array( 'members_partial' => 'par' ),
|
||||
'where' => 'par.partial_member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'val.*',
|
||||
'from' => array( 'validating' => 'val' ),
|
||||
'where' => 'val.member_id=m.member_id',
|
||||
'type' => 'left'
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if( $st OR $limit )
|
||||
{
|
||||
$query['limit'] = array( $st, $limit );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Execute query and return results
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( $query );
|
||||
$outer = $this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch($outer) )
|
||||
{
|
||||
if( $minimalInfo )
|
||||
{
|
||||
$ids[ $r['mem_id'] ] = $r['mem_id'];
|
||||
$names[ $r['members_display_name'] ] = $r['members_display_name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$r['member_id'] = $r['mem_id'];
|
||||
$r['ip_address'] = $r['mem_ip'];
|
||||
$r['_joined'] = $this->registry->class_localization->getDate( $r['joined'], 'JOINED' );
|
||||
$r['group_title'] = $this->caches['group_cache'][ $r['member_group_id'] ]['g_title'];
|
||||
|
||||
$members[ $r['member_id'] ] = IPSMember::buildDisplayData( $r );
|
||||
}
|
||||
}
|
||||
|
||||
return $minimalInfo ? array( 'ids' => $ids, 'names' => $names ) : $members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ORDER BY part of the SQL query
|
||||
*
|
||||
* @return string SQL ORDER BY string
|
||||
*/
|
||||
public function getOrderByClause()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Init
|
||||
//-----------------------------------------
|
||||
|
||||
$data = $this->generateFilterBoxes();
|
||||
|
||||
switch( $data['order_direction'] )
|
||||
{
|
||||
case 'asc':
|
||||
$order_direction = 'asc';
|
||||
break;
|
||||
default:
|
||||
case 'desc':
|
||||
$order_direction = 'desc';
|
||||
break;
|
||||
}
|
||||
|
||||
switch( $data['order_by'] )
|
||||
{
|
||||
default:
|
||||
case 'joined':
|
||||
$order_by = 'm.joined';
|
||||
break;
|
||||
case 'members_l_username':
|
||||
$order_by = 'm.members_l_username';
|
||||
break;
|
||||
case 'members_l_display_name':
|
||||
case 'members_display_name':
|
||||
$order_by = 'm.members_l_display_name';
|
||||
break;
|
||||
case 'email':
|
||||
$order_by = 'm.email';
|
||||
break;
|
||||
case 'posts':
|
||||
$order_by = 'm.posts';
|
||||
break;
|
||||
}
|
||||
|
||||
return $order_by . ' ' . $order_direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the WHERE part of the SQL query
|
||||
*
|
||||
* @return string SQL WHERE string
|
||||
*/
|
||||
public function getWhereClause()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Ignore filters?
|
||||
//-----------------------------------------
|
||||
|
||||
if( $this->showAllMembers )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Init
|
||||
//-----------------------------------------
|
||||
|
||||
$data = $this->generateFilterBoxes();
|
||||
$_sql = array();
|
||||
|
||||
//-----------------------------------------
|
||||
// Filters
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $data['member_contains_text'] )
|
||||
{
|
||||
$_field = '';
|
||||
$_text = $this->DB->addSlashes( $data['member_contains_text'] );
|
||||
|
||||
switch( $data['member_contains'] )
|
||||
{
|
||||
default:
|
||||
case 'member_id':
|
||||
$_field = 'm.member_id';
|
||||
break;
|
||||
|
||||
case 'name':
|
||||
$_field = 'm.members_l_username';
|
||||
$_text = strtolower( $_text );
|
||||
break;
|
||||
|
||||
case 'members_display_name':
|
||||
$_field = 'm.members_l_display_name';
|
||||
$_text = strtolower( $_text );
|
||||
break;
|
||||
case 'email':
|
||||
$_field = 'm.email';
|
||||
break;
|
||||
case 'ip_address':
|
||||
$_field = 'm.ip_address';
|
||||
break;
|
||||
case 'signature':
|
||||
$_field = 'pp.signature';
|
||||
break;
|
||||
}
|
||||
|
||||
switch( $data['member_contains_type'] )
|
||||
{
|
||||
default:
|
||||
case 'contains':
|
||||
$_sql[] = $this->DB->buildCast( $_field, 'VARCHAR' ) . " LIKE '%" . $_text . "%'";
|
||||
break;
|
||||
case 'begins':
|
||||
$_sql[] = $this->DB->buildCast( $_field, 'VARCHAR' ) . " LIKE '" . $_text . "%'";
|
||||
break;
|
||||
case 'ends':
|
||||
$_sql[] = $this->DB->buildCast( $_field, 'VARCHAR' ) . " LIKE '%" . $_text . "'";
|
||||
break;
|
||||
case 'equals':
|
||||
$_sql[] = $this->DB->buildCast( $_field, 'VARCHAR' ) . " = '" . $_text . "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// "Simple" all-in-one search
|
||||
//-----------------------------------------
|
||||
|
||||
if( $data['member_string'] AND strlen($data['member_string']) >= 3 )
|
||||
{
|
||||
$_text = $this->DB->addSlashes( $data['member_string'] );
|
||||
|
||||
$_sql[] = '(' . $this->DB->buildCast( 'm.name', 'VARCHAR' ) . " LIKE '%" . $_text . "%' OR " .
|
||||
$this->DB->buildCast( 'm.members_display_name', 'VARCHAR' ) . " LIKE '%" . $_text . "%' OR " .
|
||||
$this->DB->buildCast( 'm.email', 'VARCHAR' ) . " LIKE '%" . $_text . "%' OR " .
|
||||
$this->DB->buildCast( 'm.ip_address', 'VARCHAR' ) . " LIKE '%" . $_text . "%')";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Group limiting
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $data['primary_group'] )
|
||||
{
|
||||
if( $data['include_secondary'] )
|
||||
{
|
||||
$_sql[] = "( m.member_group_id=" . intval( $data['primary_group'] ) . " OR " .
|
||||
"m.mgroup_others LIKE '%," . intval( $data['primary_group'] ) . ",%' OR " .
|
||||
"m.mgroup_others LIKE '" . intval( $data['primary_group'] ) . ",%' OR " .
|
||||
"m.mgroup_others LIKE '%," . intval( $data['primary_group'] ) . "' OR " .
|
||||
"m.mgroup_others='" . intval( $data['primary_group'] ) . "' )";
|
||||
}
|
||||
else
|
||||
{
|
||||
$_sql[] = "m.member_group_id=" . intval( $data['primary_group'] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data['secondary_group'] )
|
||||
{
|
||||
$_sql[] = "( m.mgroup_others LIKE '%," . $data['secondary_group'] . ",%' OR " .
|
||||
"m.mgroup_others LIKE '" . $data['secondary_group'] . ",%' OR " .
|
||||
"m.mgroup_others LIKE '%," . $data['secondary_group'] . "' OR " .
|
||||
"m.mgroup_others='" . $data['secondary_group'] . "' )";
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Post count
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( $data['post_count'] OR $data['post_count'] == '0' ) AND $data['post_count_type'] )
|
||||
{
|
||||
$_type = '';
|
||||
|
||||
if( $data['post_count_type'] == 'gt' )
|
||||
{
|
||||
$_type = '>';
|
||||
}
|
||||
else if( $data['post_count_type'] == 'lt' )
|
||||
{
|
||||
$_type = '<';
|
||||
}
|
||||
else if( $data['post_count_type'] == 'eq' )
|
||||
{
|
||||
$_type = '=';
|
||||
}
|
||||
|
||||
if( $_type )
|
||||
{
|
||||
$_sql[] = "m.posts" . $_type . intval( $data['post_count'] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Date filters
|
||||
//-----------------------------------------
|
||||
|
||||
foreach( array( 'reg', 'post', 'active' ) as $_bit )
|
||||
{
|
||||
foreach( array( 'from', 'to' ) as $_when )
|
||||
{
|
||||
$bit = 'date_' . $_bit . '_' . $_when;
|
||||
|
||||
if ( $data[ $bit ] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// mm/dd/yyyy instead of mm-dd-yyyy
|
||||
//-----------------------------------------
|
||||
|
||||
$data[ $bit ] = str_replace( '/', '-', $data[ $bit ] );
|
||||
|
||||
list( $month, $day, $year ) = explode( '-', $data[ $bit ] );
|
||||
|
||||
if ( ! checkdate( $month, $day, $year ) )
|
||||
{
|
||||
$this->registry->output->global_message = sprintf($this->lang->words['m_daterange'], $month, $day, $year );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Bug #24067 */
|
||||
/* Original fix caused this bug: http://community.invisionpower.com/tracker/issue-24416-search-dates-invalid-acp/
|
||||
Changed to just verify the result is an int, as that is all that's needed to prevent DB error */
|
||||
$time_int = mktime( 0, 0, 0, $month, $day, $year );
|
||||
|
||||
if ( !is_int($time_int) )
|
||||
{
|
||||
$this->registry->output->global_message = sprintf($this->lang->words['m_daterange'], $month, $day, $year );
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( $_bit )
|
||||
{
|
||||
case 'reg':
|
||||
$field = 'joined';
|
||||
break;
|
||||
case 'post':
|
||||
$field = 'last_post';
|
||||
break;
|
||||
case 'active':
|
||||
$field = 'last_activity';
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $_when == 'from' )
|
||||
{
|
||||
$_sql[] = 'm.' . $field . ' > ' . $time_int;
|
||||
}
|
||||
else
|
||||
{
|
||||
$_sql[] = 'm.' . $field . ' < ' . $time_int;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Custom fields...
|
||||
//-----------------------------------------
|
||||
|
||||
if( is_array($data['custom_fields']) AND count($data['custom_fields']) )
|
||||
{
|
||||
foreach ( $data['custom_fields'] as $id => $value )
|
||||
{
|
||||
if ( $value )
|
||||
{
|
||||
if( $this->caches['profilefields'][ $id ]['pf_type'] == 'drop' )
|
||||
{
|
||||
$_sql[] = "p.field_{$id}='" . $this->DB->addSlashes( $value ) . "'";
|
||||
}
|
||||
else if( $this->caches['profilefields'][ $id ]['pf_type'] == 'cbox' )
|
||||
{
|
||||
if ( count( $value ) )
|
||||
{
|
||||
foreach ( $value as $k => $v )
|
||||
{
|
||||
$_sql[] = "p.field_{$id} LIKE '%|" . $this->DB->addSlashes( $k ) . "|%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$_sql[] = $this->caches['profilefields'][ $id ]['pf_search_type'] == 'loose' ? "p.field_{$id} LIKE '%" . $this->DB->addSlashes( $value ) . "%'" : "p.field_{$id} = '" . $this->DB->addSlashes( $value ) . "'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Search member status type
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $data['member_status'] )
|
||||
{
|
||||
switch( $data['member_status'] )
|
||||
{
|
||||
case 'banned':
|
||||
$_sql[] = "(m.member_banned=1 OR member_group_id=" . intval($this->settings['banned_group']) . ')';
|
||||
break;
|
||||
|
||||
case 'spam':
|
||||
$_sql[] = '(' . IPSBWOptions::sql( 'bw_is_spammer', 'm.members_bitoptions', 'members', 'global', 'has' ) . ' OR val.spam_flag=1)';
|
||||
break;
|
||||
|
||||
case 'validating':
|
||||
$_sql[] = "(val.lost_pass=0 AND val.vid " . $this->DB->buildIsNull( false ) . ")";
|
||||
break;
|
||||
|
||||
case 'incomplete':
|
||||
$_sql[] = "par.partial_member_id " . $this->DB->buildIsNull( false );
|
||||
break;
|
||||
|
||||
case 'locked':
|
||||
if( $this->settings['ipb_bruteforce_attempts'] > 0 )
|
||||
{
|
||||
$_sql[] = "m.failed_login_count >= " . intval($this->settings['ipb_bruteforce_attempts']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$_sql[] = "m.failed_login_count > 0";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
case 'all':
|
||||
//-----------------------------------------
|
||||
// Hide partial members if showing 'all', and
|
||||
// we did not explicitly search
|
||||
//-----------------------------------------
|
||||
|
||||
if( !count($_sql) )
|
||||
{
|
||||
$_sql[] = "par.partial_member_id " . $this->DB->buildIsNull();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Return search string
|
||||
//-----------------------------------------
|
||||
|
||||
return count($_sql) ? implode( " AND ", $_sql ) : '';
|
||||
}
|
||||
}
|
||||
@@ -3,28 +3,35 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Subscriptions Hooks Gateway "Handler"
|
||||
* Owner: Matt "Oh Lord, why did I get assigned this?" Mecham
|
||||
* Last Updated: $Date: 2010-07-15 21:31:17 -0400 (Thu, 15 Jul 2010) $
|
||||
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @link http://hatynka.in
|
||||
* @since 9th March 2005 11:03
|
||||
* @version $Revision: 6661 $
|
||||
* @version $Revision: 8644 $
|
||||
*/
|
||||
class members_hookGateway
|
||||
{
|
||||
/**#@+
|
||||
* Registry objects
|
||||
/**
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
* @var $registry
|
||||
* @var $DB
|
||||
* @var $settings
|
||||
* @var $request
|
||||
* @var $lang
|
||||
* @var $member
|
||||
* @var $memberData
|
||||
* @var $cache
|
||||
* @var $caches
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
@@ -34,14 +41,12 @@ class members_hookGateway
|
||||
protected $memberData;
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Method constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry Object
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -81,7 +86,7 @@ class members_hookGateway
|
||||
}
|
||||
|
||||
/* Fetch */
|
||||
$statuses = $this->registry->getClass('memberStatus')->fetch( $this->memberData, array( 'limit' => 10, 'status_is_latest' => 1 ) );
|
||||
$statuses = $this->registry->getClass('memberStatus')->fetch( $this->memberData, array( 'limit' => intval( $this->settings['status_sidebar_show_x'] ), 'status_is_latest' => 1, 'ownerOnly' => true ) );
|
||||
|
||||
return $this->registry->getClass('output')->getTemplate('boards')->hookBoardIndexStatusUpdates( $statuses );
|
||||
}
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
+218
-95
@@ -2,19 +2,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Comments library
|
||||
* Last Updated: $Date: 2010-10-21 09:25:51 -0400 (Thu, 21 Oct 2010) $
|
||||
* Last Updated: $Date: 2011-09-15 17:04:35 -0400 (Thu, 15 Sep 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: ips_terabyte $
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @link http://hatynka.in
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 7009 $
|
||||
* @version $Revision: 9495 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -95,8 +95,8 @@ class messengerFunctions
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param object Registry object
|
||||
* @return void
|
||||
* @param object $registry Registry object
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -252,7 +252,7 @@ class messengerFunctions
|
||||
* Mostly used for myconvo but added here for extensibility in the future
|
||||
*
|
||||
* @param string
|
||||
* @return void
|
||||
* @return @e void
|
||||
*/
|
||||
public function addFolderFilter( $filter )
|
||||
{
|
||||
@@ -382,7 +382,7 @@ class messengerFunctions
|
||||
|
||||
$file = IPSLib::getAppDir( 'members' ) . '/sql/messengerSearch_' . strtolower( $this->settings['sql_driver'] ) . '.php';
|
||||
|
||||
if ( ! file_exists( $file ) )
|
||||
if ( ! is_file( $file ) )
|
||||
{
|
||||
return $results;
|
||||
}
|
||||
@@ -420,11 +420,23 @@ class messengerFunctions
|
||||
$_members = IPSMember::load( array_keys( $_memberIDs ), 'all' );
|
||||
}
|
||||
|
||||
/* Let's sort out the ignore & photos at once for everyone */
|
||||
if( count($_members) )
|
||||
{
|
||||
foreach( $_members as $_mid => $_mdata )
|
||||
{
|
||||
$_mdata['_canBeBlocked'] = IPSMember::isIgnorable( $_mdata['member_group_id'], $_mdata['mgroup_others'], 'pm' );
|
||||
|
||||
$_members[ $_mid ] = IPSMember::buildProfilePhoto( $_mdata );
|
||||
}
|
||||
}
|
||||
|
||||
/* Final result parse */
|
||||
foreach( $_results as $mtID => $mtData )
|
||||
{
|
||||
$mtData['_starterMemberData'] = $_members[ $mtData['mt_starter_id'] ];
|
||||
$mtData['_toMemberData'] = $_members[ $mtData['mt_to_member_id'] ];
|
||||
$mtData['_starterMemberData'] = $_members[ $mtData['mt_starter_id'] ];
|
||||
$mtData['_toMemberData'] = $_members[ $mtData['mt_to_member_id'] ];
|
||||
$mtData['_lastMsgAuthor'] = $_members[ $mtData['msg_author_id'] ];
|
||||
|
||||
$mtData['_folderName'] = $this->_dirData[ $mtData['map_folder_id'] ]['real'];
|
||||
|
||||
@@ -441,7 +453,7 @@ class messengerFunctions
|
||||
* @param int Member ID who is attempting to block
|
||||
* @param int Topic ID to apply block to
|
||||
* @param boolean TRUE is block, FALSE is unblock
|
||||
* @return void
|
||||
* @return @e void
|
||||
*
|
||||
* <code>
|
||||
* Exception Codes:
|
||||
@@ -682,7 +694,7 @@ class messengerFunctions
|
||||
$topicData = $this->fetchTopicData( $topicID );
|
||||
$memberData = IPSMember::load( intval( $readingMemberID ), 'extendedProfile,groups' );
|
||||
$currentParticipants = $this->fetchTopicParticipants( $topicID );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Can access this topic?
|
||||
//-----------------------------------------
|
||||
@@ -696,7 +708,7 @@ class messengerFunctions
|
||||
// Build invited users
|
||||
//-----------------------------------------
|
||||
|
||||
$invitedUsersData = $this->checkAndReturnInvitedUsers( $invitedUsers, $memberData );
|
||||
$invitedUsersData = $this->checkAndReturnInvitedUsers( $invitedUsers, $memberData, count($currentParticipants) );
|
||||
|
||||
if ( isset($invitedUsersData[ $topicData['mt_starter_id'] ]) )
|
||||
{
|
||||
@@ -1468,26 +1480,25 @@ class messengerFunctions
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( "personal_convo_new_reply", $toMember['language'] );
|
||||
|
||||
IPSText::getTextClass('email')->buildMessage( array(
|
||||
'NAME' => $toMember['members_display_name'],
|
||||
'POSTER' => $fromMemberData['members_display_name'],
|
||||
'TITLE' => $topicData['mt_title'],
|
||||
'TEXT' => $msgContent,
|
||||
'LINK' => "?app=members&module=messaging§ion=view&do=findMessage&topicID={$topicID}&msgID=__firstUnread__" ) );
|
||||
IPSText::getTextClass('email')->buildMessage( array( 'NAME' => $toMember['members_display_name'],
|
||||
'POSTER' => $fromMemberData['members_display_name'],
|
||||
'TITLE' => $topicData['mt_title'],
|
||||
'TEXT' => $msgContent,
|
||||
'LINK' => "?app=members&module=messaging§ion=view&do=findMessage&topicID={$topicID}&msgID=__firstUnread__" ) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf(
|
||||
IPSText::getTextClass('email')->subject,
|
||||
IPSText::getTextClass('email')->subject = sprintf( IPSText::getTextClass('email')->subject,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $fromMemberData['member_id'], 'public', $fromMemberData['members_seo_name'], 'showuser' ),
|
||||
$fromMemberData['members_display_name'],
|
||||
$this->registry->output->buildUrl( "app=members&module=messaging§ion=view&do=findMessage&topicID={$topicID}&msgID=__firstUnread__", 'public' )
|
||||
);
|
||||
|
||||
$notifyLibrary->setMember( $toMember );
|
||||
$notifyLibrary->setFrom( $memberData );
|
||||
$notifyLibrary->setFrom( $fromMemberData );
|
||||
$notifyLibrary->setNotificationKey( 'reply_private_message' );
|
||||
$notifyLibrary->setNotificationUrl( $this->registry->output->buildUrl( "app=members&module=messaging§ion=view&do=findMessage&topicID={$topicID}&msgID=__firstUnread__", 'public' ) );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
$notifyLibrary->setMetaData( array( 'meta_area' => 'pm', 'meta_id' => $topicID, 'meta_app' => 'members' ) );
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1595,7 +1606,7 @@ class messengerFunctions
|
||||
throw new Exception( 'TO_USER_DOES_NOT_EXIST' );
|
||||
}
|
||||
|
||||
if ( ! $fromMemberData['member_id'] AND $this->forceMessageToSend !== TRUE )
|
||||
if ( empty( $fromMemberData['member_id'] ) AND $this->forceMessageToSend !== TRUE )
|
||||
{
|
||||
throw new Exception( 'FROM_USER_DOES_NOT_EXIST' );
|
||||
}
|
||||
@@ -1677,7 +1688,7 @@ class messengerFunctions
|
||||
// Is this simply a copy-to?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $isCopyTo === TRUE )
|
||||
if ( $isCopyTo === TRUE AND !$isDraft )
|
||||
{
|
||||
/* Send out the main one */
|
||||
$this->sendNewPersonalTopic( $toMemberID, $fromMemberID, array(), $msgTitle, $_originalMessageContent, array( 'postKey' => $options['postKey'] ) );
|
||||
@@ -1740,7 +1751,7 @@ class messengerFunctions
|
||||
throw new Exception( 'TOPIC_ID_NOT_EXISTS' );
|
||||
}
|
||||
|
||||
$this->DB->force_data_type = array( 'mt_title' => 'string' );
|
||||
$this->DB->setDataType( 'mt_title', 'string' );
|
||||
|
||||
/* First off, update message_topics and message_posts... */
|
||||
$this->DB->update( 'message_topics', array( 'mt_date' => time(),
|
||||
@@ -1751,7 +1762,7 @@ class messengerFunctions
|
||||
'mt_invited_members' => serialize( array_keys( $inviteUsersData ) ),
|
||||
'mt_to_count' => count( array_keys( $inviteUsersData ) ) + 1,
|
||||
'mt_to_member_id' => $toMemberData['member_id'],
|
||||
'mt_is_draft' => $isDraft ), 'mt_id=' . $_topicData['mt_id'] );
|
||||
'mt_is_draft' => intval( $isDraft ) ), 'mt_id=' . $_topicData['mt_id'] );
|
||||
|
||||
/* Now the posts ... */
|
||||
$this->DB->update( 'message_posts', array( 'msg_date' => time(),
|
||||
@@ -1774,7 +1785,7 @@ class messengerFunctions
|
||||
// Insert new...
|
||||
//-----------------------------------------
|
||||
else
|
||||
{
|
||||
{
|
||||
$_messageTopicData = array(
|
||||
'mt_date' => time(),
|
||||
'mt_title' => $msgTitle,
|
||||
@@ -1790,7 +1801,7 @@ class messengerFunctions
|
||||
);
|
||||
|
||||
/* Create topic entry */
|
||||
$this->DB->force_data_type = array( 'mt_title' => 'string' );
|
||||
$this->DB->setDataType( 'mt_title', 'string' );
|
||||
|
||||
/* Data Hook Location */
|
||||
IPSLib::doDataHooks( $_messageTopicData, 'messengerSendTopicData' );
|
||||
@@ -1816,7 +1827,7 @@ class messengerFunctions
|
||||
|
||||
$msg_id = $this->DB->getInsertId();
|
||||
|
||||
if( ! $isDraft )
|
||||
if ( ! $isDraft )
|
||||
{
|
||||
IPSMember::save( $toMemberData['member_id'], array( 'core' => array( 'msg_count_new' => 'plus:1' ) ) );
|
||||
}
|
||||
@@ -1910,9 +1921,9 @@ class messengerFunctions
|
||||
$notifyLibrary->setFrom( $fromMemberData );
|
||||
$notifyLibrary->setNotificationKey( 'new_private_message' );
|
||||
$notifyLibrary->setNotificationUrl( $this->registry->output->buildUrl( "app=members&module=messaging§ion=view&do=showConversation&topicID={$msg_topic_id}#msg{$msg_id}", 'public' ) );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->getPlainTextContent() );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
|
||||
$notifyLibrary->setMetaData( array( 'meta_area' => 'pm', 'meta_id' => $msg_topic_id, 'meta_app' => 'members' ) );
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
@@ -2136,6 +2147,7 @@ class messengerFunctions
|
||||
*
|
||||
* @param array Array of display names [ 'bob', 'joe', 'dave' ]
|
||||
* @param array Optional[ Array of member data (group + core only required) ]
|
||||
* @param int Number of existing participants
|
||||
* @return array Array of members, indexed by member_id
|
||||
*
|
||||
* <code>
|
||||
@@ -2145,18 +2157,19 @@ class messengerFunctions
|
||||
* INVITE_USERS_BLOCKED: Some invite users have been blocked (check $this->exceptionData for a list of names)
|
||||
* </code>
|
||||
*/
|
||||
public function checkAndReturnInvitedUsers( $names, $member=array() )
|
||||
public function checkAndReturnInvitedUsers( $names, $member=array(), $current=0 )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$finalArray = array();
|
||||
$inviteArrayByID = array();
|
||||
$inviteArrayByName = array();
|
||||
$member = ( $member['member_id'] ) ? $member : $this->member->fetchMemberData();
|
||||
$doesNotExist = array();
|
||||
$cannotUsePM = array();
|
||||
$finalArray = array();
|
||||
$inviteArrayByID = array();
|
||||
$inviteArrayByName = array();
|
||||
$member = ( $member['member_id'] ) ? $member : $this->member->fetchMemberData();
|
||||
$doesNotExist = array();
|
||||
$cannotUsePM = array();
|
||||
$current = intval($current);
|
||||
|
||||
if ( ! is_array( $names ) OR ! count( $names ) )
|
||||
{
|
||||
@@ -2184,8 +2197,9 @@ class messengerFunctions
|
||||
$inviteArrayByName[ mb_strtolower($_member['members_l_display_name']) ] = $_member['member_id'];
|
||||
|
||||
# Only allow the first X based on g_max_mass_pm
|
||||
if ( count( $inviteArrayByID ) > $member['g_max_mass_pm'] )
|
||||
if ( count( $inviteArrayByID ) + $current > $member['g_max_mass_pm'] )
|
||||
{
|
||||
throw new Exception( "MAX_USER_PM_LIMIT_HIT" );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2369,6 +2383,18 @@ class messengerFunctions
|
||||
return $finalString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets alert / count flag
|
||||
* @param mixed $memberID
|
||||
*/
|
||||
public function resetMembersAlertCounts( $memberID )
|
||||
{
|
||||
$memberData = ( is_numeric( $memberID ) ) ? IPSMember::load( $memberID, 'extendedProfile' ) : $memberID;
|
||||
|
||||
IPSMember::save( $memberData['member_id'], array( 'core' => array( 'msg_count_new' => 0 ) ) );
|
||||
IPSMember::setToMemberCache( $memberData, array( 'msgAlertReset' => IPS_UNIX_TIME_NOW ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all folder counts
|
||||
*
|
||||
@@ -2405,7 +2431,13 @@ class messengerFunctions
|
||||
/* Save */
|
||||
IPSMember::save( $memberData['member_id'], array( 'core' => array( 'msg_count_reset' => 0 ),
|
||||
'extendedProfile' => array( 'pconversation_filters' => $dirs ) ) );
|
||||
|
||||
|
||||
/* Reset our counter */
|
||||
if ( $memberID == $this->memberData['member_id'] )
|
||||
{
|
||||
$this->memberData['msg_count_reset'] = 0;
|
||||
}
|
||||
|
||||
return $dirs;
|
||||
}
|
||||
|
||||
@@ -2437,7 +2469,10 @@ class messengerFunctions
|
||||
|
||||
foreach( $members as $id => $data )
|
||||
{
|
||||
$count = intval( $this->getPersonalTopicsCount( $id, 'new') );
|
||||
$count = intval( $this->getPersonalTopicsCount( $id, 'new' ) );
|
||||
|
||||
$lastReset = intval( IPSMember::getFromMemberCache( $data, 'msgAlertReset' ) );
|
||||
$msgAlertCount = intval( $this->getPersonalTopicsCount( $id, 'new', $lastReset ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse folder data
|
||||
@@ -2449,13 +2484,15 @@ class messengerFunctions
|
||||
$msg_show_notification = ( $count ) ? $data['msg_show_notification'] : 0;
|
||||
|
||||
IPSMember::save( $id, array( 'extendedProfile' => array( 'pconversation_filters' => $this->implodeFolderData( $rebuild ) ),
|
||||
'core' => array( 'msg_count_new' => $count,
|
||||
'core' => array( 'msg_count_new' => $msgAlertCount,
|
||||
'msg_show_notification' => $msg_show_notification ) ) );
|
||||
|
||||
IPSMember::setToMemberCache( $data, array( 'msgAlertReset' => IPS_UNIX_TIME_NOW ) );
|
||||
|
||||
/* Reset our counter */
|
||||
if ( $id == $this->memberData['member_id'] )
|
||||
{
|
||||
$this->memberData['msg_count_new'] = $count;
|
||||
$this->memberData['msg_count_new'] = $msgAlertCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2496,11 +2533,18 @@ class messengerFunctions
|
||||
*
|
||||
* @param int Member ID
|
||||
* @param string Folder ID (eg: inbox, sent, etc) [ Optional, if omitted, all msg box counts are returned ]
|
||||
* @param int Timestamp to check from
|
||||
* @return mixed If folder ID: Number of messages, otherwise an array of folderID => count
|
||||
*/
|
||||
public function getPersonalTopicsCount( $memberID, $folderID='' )
|
||||
public function getPersonalTopicsCount( $memberID, $folderID='', $time=null )
|
||||
{
|
||||
$return = array();
|
||||
$where = '';
|
||||
|
||||
if ( is_numeric( $time ) )
|
||||
{
|
||||
$where = ( $folderID == 'drafts' ) ? ' AND mt_date > ' . $time : ' AND map_last_topic_reply > ' . $time;
|
||||
}
|
||||
|
||||
if ( $memberID and $folderID )
|
||||
{
|
||||
@@ -2509,7 +2553,7 @@ class messengerFunctions
|
||||
{
|
||||
$t = $this->DB->buildAndFetch( array ( 'select' => 'COUNT(*) as msg_total',
|
||||
'from' => 'message_topic_user_map',
|
||||
'where' => "map_user_active=1 AND map_user_id=" . intval( $memberID ) . " AND map_has_unread=1 AND map_ignore_notification=0" ) );
|
||||
'where' => "map_user_active=1 AND map_user_id=" . intval( $memberID ) . " AND map_has_unread=1" . $where ) );
|
||||
|
||||
return intval( $t['msg_total'] );
|
||||
}
|
||||
@@ -2518,7 +2562,7 @@ class messengerFunctions
|
||||
{
|
||||
$t = $this->DB->buildAndFetch( array ( 'select' => 'COUNT(*) as msg_total',
|
||||
'from' => 'message_topics',
|
||||
'where' => "mt_starter_id=" . intval( $memberID ) . " AND mt_is_draft=1 AND mt_is_deleted=0" ) );
|
||||
'where' => "mt_starter_id=" . intval( $memberID ) . " AND mt_is_draft=1 AND mt_is_deleted=0" . $where ) );
|
||||
|
||||
return intval( $t['msg_total'] );
|
||||
}
|
||||
@@ -2533,7 +2577,7 @@ class messengerFunctions
|
||||
{
|
||||
$t = $this->DB->buildAndFetch( array ( 'select' => 'COUNT(*) as msg_total',
|
||||
'from' => 'message_topic_user_map',
|
||||
'where' => "map_user_id=" . intval( $memberID ) . " AND map_user_active=1 AND map_folder_id='" . $_folder . "' AND map_is_starter=0" ) );
|
||||
'where' => "map_user_id=" . intval( $memberID ) . " AND map_user_active=1 AND map_folder_id='" . $_folder . "' AND map_is_starter=0" . $where ) );
|
||||
|
||||
return intval( $t['msg_total'] );
|
||||
}
|
||||
@@ -2541,7 +2585,7 @@ class messengerFunctions
|
||||
{
|
||||
$t = $this->DB->buildAndFetch( array ( 'select' => 'COUNT(*) as msg_total',
|
||||
'from' => 'message_topic_user_map',
|
||||
'where' => "map_user_id=" . intval( $memberID ) . " AND map_user_active=1 AND map_folder_id='" . $_folder . "' AND map_is_starter=1" ) );
|
||||
'where' => "map_user_id=" . intval( $memberID ) . " AND map_user_active=1 AND map_folder_id='" . $_folder . "' AND map_is_starter=1" . $where ) );
|
||||
|
||||
return intval( $t['msg_total'] );
|
||||
}
|
||||
@@ -2550,7 +2594,7 @@ class messengerFunctions
|
||||
{
|
||||
$t = $this->DB->buildAndFetch( array ( 'select' => 'COUNT(*) as msg_total',
|
||||
'from' => 'message_topic_user_map',
|
||||
'where' => "map_user_id=" . intval( $memberID ) . " AND map_user_active=1 AND map_folder_id='" . $_folder . "'" ) );
|
||||
'where' => "map_user_id=" . intval( $memberID ) . " AND map_user_active=1 AND map_folder_id='" . $_folder . "'" . $where ) );
|
||||
|
||||
return intval( $t['msg_total'] );
|
||||
}
|
||||
@@ -2560,7 +2604,7 @@ class messengerFunctions
|
||||
{
|
||||
$this->DB->build( array( 'select' => 'COUNT(*) as msg_total, map_folder_id',
|
||||
'from' => 'message_topic_user_map',
|
||||
'where' => "map_is_system=0 AND map_user_active=1 AND map_user_id=" . intval( $memberID ),
|
||||
'where' => "map_is_system=0 AND map_user_active=1 AND map_user_id=" . intval( $memberID ) . $where,
|
||||
'group' => 'map_folder_id' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
@@ -2650,7 +2694,7 @@ class messengerFunctions
|
||||
$where = " AND mm.map_user_active=1 AND mt.mt_is_draft=1";
|
||||
break;
|
||||
case 'new':
|
||||
$where = ' AND mm.map_user_active=1 AND mm.map_has_unread=1 AND map_ignore_notification=0';
|
||||
$where = ' AND mm.map_user_active=1 AND mm.map_has_unread=1';
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2679,10 +2723,7 @@ class messengerFunctions
|
||||
array( 'select' => 'mem.members_display_name',
|
||||
'from' => array( 'members' => 'mem' ),
|
||||
'where' => 'mt.mt_to_member_id=mem.member_id',
|
||||
'type' => 'left',
|
||||
)
|
||||
|
||||
) ) );
|
||||
'type' => 'left' ) ) ) );
|
||||
$this->DB->execute();
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -2754,27 +2795,38 @@ class messengerFunctions
|
||||
$messages[ $row['mt_id'] ] = $row;
|
||||
}
|
||||
|
||||
$members = array();
|
||||
|
||||
/* Got any members? */
|
||||
if ( count( $_memberIDs ) )
|
||||
{
|
||||
$members = IPSMember::load( $_memberIDs, 'core' );
|
||||
$members = IPSMember::load( $_memberIDs, 'all' );
|
||||
}
|
||||
|
||||
/* Let's sort out the ignore & photos at once for everyone */
|
||||
if( count($members) )
|
||||
{
|
||||
foreach( $members as $_mid => $_mdata )
|
||||
{
|
||||
$_mdata['_canBeBlocked'] = IPSMember::isIgnorable( $_mdata['member_group_id'], $_mdata['mgroup_others'], 'pm' );
|
||||
|
||||
$members[ $_mid ] = IPSMember::buildProfilePhoto( $_mdata );
|
||||
}
|
||||
}
|
||||
|
||||
$members[ 0 ] = IPSMember::buildProfilePhoto( array( 'members_display_name' => $this->lang->words['deleted_user'] ) );
|
||||
|
||||
/* Now merge (in turn!) */
|
||||
foreach( $messages as $id => $row )
|
||||
{
|
||||
/* From */
|
||||
$_member = $members[ $row['mt_starter_id'] ];
|
||||
$messages[ $id ]['_starterMemberData'] = $_member;
|
||||
$messages[ $id ]['_starterMemberData']['_canBeBlocked'] = IPSMember::isIgnorable( $_member['member_group_id'], $_member['mgroup_others'], 'pm' );
|
||||
$messages[ $id ]['_starterMemberData'] = $members[ $row['mt_starter_id'] ];
|
||||
|
||||
/* To */
|
||||
$_member = $members[ $row['mt_to_member_id'] ];
|
||||
$messages[ $id ]['_toMemberData'] = $_member;
|
||||
$messages[ $id ]['_toMemberData']['_canBeBlocked'] = IPSMember::isIgnorable( $_member['member_group_id'], $_member['mgroup_others'], 'pm' );
|
||||
$messages[ $id ]['_toMemberData'] = $members[ $row['mt_to_member_id'] ];
|
||||
|
||||
/* Last msg author */
|
||||
$messages[ $id ]['_lastMsgAuthor'] = $members[ $row['msg_author_id'] ];
|
||||
$messages[ $id ]['_lastMsgAuthor'] = $members[ $row['msg_author_id'] ];
|
||||
|
||||
/* Invitees */
|
||||
if ( is_array( $row['_invitedMembers'] ) AND count( $row['_invitedMembers'] ) )
|
||||
@@ -2933,9 +2985,26 @@ class messengerFunctions
|
||||
/* Member missing? */
|
||||
if ( ! isset($memberData[ $msg['msg_author_id'] ]) )
|
||||
{
|
||||
$missingMembers[ $msg['msg_author_id'] ] = $msg['msg_author_id'];
|
||||
if( !$msg['msg_author_id'] )
|
||||
{
|
||||
$memberData[0] = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$missingMembers[ $msg['msg_author_id'] ] = $msg['msg_author_id'];
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if ( ! empty( $memberData[ $msg['msg_author_id'] ]['signature'] ) )
|
||||
{
|
||||
if ( ! $this->memberData['view_sigs'] || ( $msg['msg_author_id'] && $this->memberData['member_id'] && ! empty( $this->member->ignored_users[ $msg['msg_author_id'] ]['ignore_signatures'] ) ) )
|
||||
{
|
||||
$memberData[ $msg['msg_author_id'] ]['signature'] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$replyData[ $msg['msg_id'] ] = $msg;
|
||||
}
|
||||
}
|
||||
@@ -2961,8 +3030,11 @@ class messengerFunctions
|
||||
|
||||
if ( $memberData[ $readingMemberID ]['map_has_unread'] )
|
||||
{
|
||||
$lastReset = intval( IPSMember::getFromMemberCache( $memberData[ $readingMemberID ], 'msgAlertReset' ) );
|
||||
$msgAlertCount = intval( $this->getPersonalTopicsCount( $readingMemberID, 'new', $lastReset ) );
|
||||
|
||||
$_pc = $this->rebuildFolderCount( $readingMemberID, array( 'new' => $_newMsgs ), TRUE );
|
||||
IPSMember::save( $readingMemberID, array( 'core' => array( 'msg_count_new' => $_newMsgs, 'msg_show_notification' => 0 ) ) );
|
||||
IPSMember::save( $readingMemberID, array( 'core' => array( 'msg_count_new' => $msgAlertCount, 'msg_show_notification' => 0 ) ) );
|
||||
|
||||
/* is this us? */
|
||||
if ( $readingMemberID == $this->memberData['member_id'] )
|
||||
@@ -2971,22 +3043,25 @@ class messengerFunctions
|
||||
$this->_dirData = $this->explodeFolderData( $_pc );
|
||||
|
||||
/* Reset global new count */
|
||||
$this->memberData['msg_count_new'] = $_newMsgs;
|
||||
$this->memberData['msg_count_new'] = $msgAlertCount;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up topic title */
|
||||
$topicData['mt_title'] = str_replace( '[attachmentid=', '[attachmentid=', $topicData['mt_title'] );
|
||||
|
||||
/* Flag externals as read */
|
||||
$this->_flagAsReadForExternals( array( $topicID ) );
|
||||
|
||||
/* Ensure our read time is updated */
|
||||
$memberData[ $readingMemberID ]['map_read_time'] = time();
|
||||
|
||||
/* Do we have a deleted user? */
|
||||
if ( isset( $memberData[0] ) AND $memberData[0]['member_id'] == 0 )
|
||||
{
|
||||
$memberData[0] = IPSMember::buildDisplayData(IPSMember::setUpGuest( $this->lang->words['deleted_member'] ), array( '__all__' => 1 ) );
|
||||
$memberData[0] = IPSMember::buildDisplayData(IPSMember::setUpGuest( $this->lang->words['deleted_user'] ), array( '__all__' => 1 ) );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Attachments?
|
||||
//-----------------------------------------
|
||||
@@ -3033,6 +3108,26 @@ class messengerFunctions
|
||||
}
|
||||
}
|
||||
|
||||
/* Check to make sure we're not the only one left with this topic */
|
||||
$active = 0;
|
||||
|
||||
foreach( $memberData as $id => $data )
|
||||
{
|
||||
if ( $id !== $readingMemberID )
|
||||
{
|
||||
if ( $data['map_user_active'] )
|
||||
{
|
||||
$active++;
|
||||
break; // 1 active is enough
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $active )
|
||||
{
|
||||
$topicData['_everyoneElseHasLeft'] = 1;
|
||||
}
|
||||
|
||||
/* Return */
|
||||
return array( 'topicData' => $topicData, 'replyData' => $replyData, 'memberData' => $memberData );
|
||||
}
|
||||
@@ -3307,7 +3402,7 @@ class messengerFunctions
|
||||
{
|
||||
foreach( $groups_id as $pid )
|
||||
{
|
||||
if ( ! isset($groupCache[ $pid ]['g_id']) OR ! $groupCache[ $pid ]['g_id'] )
|
||||
if ( empty($groupCache[ $pid ]['g_id']) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -3363,7 +3458,7 @@ class messengerFunctions
|
||||
|
||||
$totals['full_percent'] = $total['msg_total'] ? sprintf( "%.0f", ( ($total['msg_total'] / $this->memberData['g_max_messages']) * 100) ) : 0;
|
||||
$totals['full_percent'] = ( $totals['full_percent'] > 100 ) ? 100 : $totals['full_percent'];
|
||||
$totals['img_width'] = isset( $info['full_percent'] ) && $info['full_percent'] > 0 ? intval($info['full_percent']) * 2.4 : 1;
|
||||
$totals['img_width'] = !empty( $info['full_percent'] ) ? intval($info['full_percent']) * 2.4 : 1;
|
||||
|
||||
if ($totals['img_width'] > 300)
|
||||
{
|
||||
@@ -3508,6 +3603,30 @@ class messengerFunctions
|
||||
return $msgData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch Message Data by ID
|
||||
*
|
||||
* @param int Msg ID
|
||||
* @param boolean Load starter member data with it
|
||||
* @return array Message data
|
||||
*/
|
||||
public function fetchMessageDataById( $msgID, $loadMember=FALSE )
|
||||
{
|
||||
$msgData = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'message_posts',
|
||||
'where' => 'msg_id=' . intval( $msgID ) ) );
|
||||
|
||||
if ( $loadMember AND $msgData['msg_author_id'] )
|
||||
{
|
||||
$memberData = IPSMember::load( $msgData['msg_author_id'], 'all' );
|
||||
$memberData['_canBeBlocked'] = IPSMember::isIgnorable( $memberData['member_group_id'], $memberData['mgroup_others'], 'pm' );
|
||||
$memberData = IPSMember::buildDisplayData( $memberData, array( '__all__' => 1 ) );
|
||||
$msgData = array_merge( $msgData, $memberData );
|
||||
}
|
||||
|
||||
return $msgData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch topic Data with first message information
|
||||
*
|
||||
@@ -3670,12 +3789,12 @@ class messengerFunctions
|
||||
// Now we have safe HTML and bbcode
|
||||
//-----------------------------------------
|
||||
|
||||
$this->settings[ 'max_emos'] = 0 ;
|
||||
$this->settings['max_emos'] = 0 ;
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_html = $this->settings['msg_allow_html'];
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = $this->settings['msg_allow_code'];
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;//$this->caches['group_cache'][ $data['member_group_id'] ]['g_dohtml'];
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'pms';
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $data['member_group_id'];
|
||||
IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $data['mgroup_others'];
|
||||
@@ -3700,33 +3819,23 @@ class messengerFunctions
|
||||
public function _formatMessageForSaving( $msgContent )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Post process the editor
|
||||
// Now we have safe HTML and bbcode
|
||||
// Load editor
|
||||
//-----------------------------------------
|
||||
|
||||
if ( isset($_POST['_fastReplyUsed']) AND $_POST['_fastReplyUsed'] )
|
||||
{
|
||||
if ( IPSText::getTextClass( 'editor' )->method == 'rte' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Fast reply used.. and we've chosen the RTE
|
||||
// Convert STD to RTE first...
|
||||
//-----------------------------------------
|
||||
|
||||
$msgContent = IPSText::getTextClass( 'bbcode' )->convertStdToRte( $msgContent );
|
||||
}
|
||||
}
|
||||
|
||||
$msgContent = IPSText::getTextClass( 'editor' )->processRawPost( $msgContent );
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite' );
|
||||
$_editor = new $classToLoad();
|
||||
$_editor->setAllowHtml( $this->memberData['g_dohtml'] );
|
||||
|
||||
$msgContent = $_editor->process( $msgContent );
|
||||
|
||||
//-----------------------------------------
|
||||
// Parse post
|
||||
//-----------------------------------------
|
||||
|
||||
IPSText::getTextClass('bbcode')->parse_smilies = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
|
||||
IPSText::getTextClass('bbcode')->parse_html = $this->settings['msg_allow_html'];
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = $this->settings['msg_allow_code'];
|
||||
IPSText::getTextClass('bbcode')->parse_html = 0;//$this->memberData['g_dohtml'];
|
||||
IPSText::getTextClass('bbcode')->parse_bbcode = 1;
|
||||
IPSText::getTextClass('bbcode')->parsing_section = 'pms';
|
||||
|
||||
$msgContent = IPSText::getTextClass( 'bbcode' )->preDbParse( $msgContent );
|
||||
@@ -3846,6 +3955,20 @@ class messengerFunctions
|
||||
return intval( $return['count'] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag external stuff
|
||||
* @param array $data
|
||||
*/
|
||||
protected function _flagAsReadForExternals( array $data )
|
||||
{
|
||||
/* Notifications */
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
$notifyLibrary->setMember( $this->memberData );
|
||||
|
||||
$notifyLibrary->deleteNotificationsAsReadByMetaData( array( 'meta_app' => 'members', 'meta_area' => 'pm', 'meta_id' => $data, 'notify_type_key' => 'new_private_message' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Default folder for people won't don't have any
|
||||
*
|
||||
|
||||
@@ -1,526 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* Comments library
|
||||
* Last Updated: $Date: 2010-09-15 19:24:12 -0400 (Wed, 15 Sep 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 6882 $
|
||||
*
|
||||
*/
|
||||
|
||||
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 profileCommentsLib
|
||||
{
|
||||
/**
|
||||
* Registry object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $DB;
|
||||
|
||||
/**
|
||||
* Settings object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* Request object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* Language object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $lang;
|
||||
|
||||
/**
|
||||
* Member object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $member;
|
||||
|
||||
/**
|
||||
* Cache object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Cached parsed members
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $parsedMembers;
|
||||
|
||||
/**
|
||||
* Last inserted comment id
|
||||
*
|
||||
* @access public
|
||||
* @var int
|
||||
*/
|
||||
public $lastInsertId;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry object
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->lang = $this->registry->getClass('class_localization');
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
$this->lang->loadLanguageFile( array( 'public_profile' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new profile comment to the database
|
||||
*
|
||||
* @access public
|
||||
* @param integer $comment_for_id Member id that this comment is for
|
||||
* @param string $comment Text of the comment to create
|
||||
* @return string Error key on failure, blank on success
|
||||
*/
|
||||
public function addCommentToDB( $comment_for_id, $comment )
|
||||
{
|
||||
/* Load the member that this comment is for */
|
||||
$member = IPSMember::load( $comment_for_id );
|
||||
|
||||
/* Make sure we found a member */
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
return 'error';
|
||||
}
|
||||
|
||||
/* Are we allowed to comment? */
|
||||
if( ! $this->memberData['g_reply_other_topics'] )
|
||||
{
|
||||
return 'nopermission';
|
||||
}
|
||||
|
||||
if( $this->memberData['restrict_post'] )
|
||||
{
|
||||
if( $this->memberData['restrict_post'] == 1 )
|
||||
{
|
||||
return 'nopermission';
|
||||
}
|
||||
|
||||
$post_arr = IPSMember::processBanEntry( $this->memberData['restrict_post'] );
|
||||
|
||||
if( time() >= $post_arr['date_end'] )
|
||||
{
|
||||
/* Update this member's profile */
|
||||
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'restrict_post' => 0 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'nopermission';
|
||||
}
|
||||
}
|
||||
|
||||
/* Does this member have mod_posts enabled? */
|
||||
$comment_approved = 1;
|
||||
|
||||
if( $this->memberData['mod_posts'] )
|
||||
{
|
||||
if( $this->memberData['mod_posts'] == 1 )
|
||||
{
|
||||
$comment_approved = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$mod_arr = IPSMember::processBanEntry( $this->memberData['mod_posts'] );
|
||||
|
||||
if( time() >= $mod_arr['date_end'] )
|
||||
{
|
||||
/* Update this member's profile */
|
||||
IPSMember::save( $this->memberData['member_id'], array( 'core' => array( 'mod_posts' => 0 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$comment_approved = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Format the comment */
|
||||
$comment = IPSText::truncate( $comment, 400 );
|
||||
$comment = preg_replace( "#(\r\n|\r|\n|<br />|<br>){1,}#s", "\n", $comment );
|
||||
$comment = trim( IPSText::getTextClass('bbcode')->stripBadWords( $comment ) );
|
||||
|
||||
/* Make sure we still have a comment */
|
||||
if ( ! $comment )
|
||||
{
|
||||
return 'error-no-comment';
|
||||
}
|
||||
|
||||
/* Comment requires approval? */
|
||||
if( $member['pp_setting_moderate_comments'] AND $member['member_id'] != $this->memberData['member_id'] )
|
||||
{
|
||||
$comment_approved = 0;
|
||||
}
|
||||
|
||||
/* Member is ignoring you! */
|
||||
if( $comment_approved )
|
||||
{
|
||||
$_you_are_being_ignored = explode( ",", $member['ignored_users'] );
|
||||
|
||||
if( is_array( $_you_are_being_ignored ) and count( $_you_are_being_ignored ) )
|
||||
{
|
||||
if( in_array( $this->memberData['member_id'], $_you_are_being_ignored ) )
|
||||
{
|
||||
$comment_approved = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$_profileCommentData = array(
|
||||
'comment_for_member_id' => $comment_for_id,
|
||||
'comment_by_member_id' => $this->memberData['member_id'],
|
||||
'comment_date' => time(),
|
||||
'comment_ip_address' => $this->member->ip_address,
|
||||
'comment_approved' => $comment_approved,
|
||||
'comment_content' => nl2br( $comment )
|
||||
);
|
||||
|
||||
/* Data Hook Location */
|
||||
IPSLib::doDataHooks( $_profileCommentData, 'profileCommentNew' );
|
||||
|
||||
/* Add comment to the DB... */
|
||||
$this->DB->insert( 'profile_comments', $_profileCommentData );
|
||||
|
||||
$this->lastInsertId = $this->DB->getInsertId();
|
||||
|
||||
/* Send notifications.. */
|
||||
if( ! $comment_approved AND ( $member['member_id'] != $this->memberData['member_id'] ) )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Notifications library
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( "new_comment_request", $member['language'] );
|
||||
|
||||
IPSText::getTextClass( 'email' )->buildMessage( array(
|
||||
'MEMBERS_DISPLAY_NAME' => $member['members_display_name'],
|
||||
'COMMENT_NAME' => $this->memberData['members_display_name'],
|
||||
'LINK' => $this->settings['board_url'] . '/index.' . $this->settings['php_ext'] . '?showuser=' . $member['member_id']
|
||||
) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf(
|
||||
IPSText::getTextClass('email')->subject,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ) . '#comment_id_' . $this->lastInsertId,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $this->memberData['member_id'], 'public', $this->memberData['members_seo_name'], 'showuser' ),
|
||||
$this->memberData['members_display_name']
|
||||
);
|
||||
|
||||
$notifyLibrary->setMember( $member );
|
||||
$notifyLibrary->setFrom( $this->memberData );
|
||||
$notifyLibrary->setNotificationKey( 'profile_comment_pending' );
|
||||
$notifyLibrary->setNotificationUrl( $this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ) . '#comment_id_' . $this->lastInsertId );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
}
|
||||
catch( Exception $e ){}
|
||||
|
||||
$return_msg = 'pp_comment_added_mod';
|
||||
}
|
||||
else if( $member['member_id'] != $this->memberData['member_id'] )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Notifications library
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( "new_comment_added", $member['language'] );
|
||||
|
||||
IPSText::getTextClass( 'email' )->buildMessage( array(
|
||||
'MEMBERS_DISPLAY_NAME' => $member['members_display_name'],
|
||||
'COMMENT_NAME' => $this->memberData['members_display_name'],
|
||||
'LINK' => $this->settings['board_url'] . '/index.' . $this->settings['php_ext'] . '?showuser=' . $member['member_id']
|
||||
) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf(
|
||||
IPSText::getTextClass('email')->subject,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ) . '#comment_id_' . $this->lastInsertId,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $this->memberData['member_id'], 'public', $this->memberData['members_seo_name'], 'showuser' ),
|
||||
$this->memberData['members_display_name']
|
||||
);
|
||||
|
||||
$notifyLibrary->setMember( $member );
|
||||
$notifyLibrary->setFrom( $this->memberData );
|
||||
$notifyLibrary->setNotificationKey( 'profile_comment' );
|
||||
$notifyLibrary->setNotificationUrl( $this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ) . '#comment_id_' . $this->lastInsertId );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
}
|
||||
catch( Exception $e ){}
|
||||
|
||||
|
||||
$return_msg = '';
|
||||
}
|
||||
|
||||
return $return_msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Approve a comment
|
||||
*
|
||||
* @access public
|
||||
* @param int Member ID of user who is attempting to access
|
||||
* @param int Comment ID to approve
|
||||
* @return mixed Error string or nothing on success
|
||||
*/
|
||||
public function approveComment( $member_id, $comment_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( intval( $member_id ) );
|
||||
$comment_id = intval( $comment_id );
|
||||
|
||||
//-----------------------------------------
|
||||
// Load member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( $member_id );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
return 'nopermission';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get comment
|
||||
//-----------------------------------------
|
||||
|
||||
$comment = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'profile_comments',
|
||||
'where' => 'comment_id=' . $comment_id ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Can remove?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( $member['member_id'] == $this->memberData['member_id'] AND ( $member['member_id'] == $comment['comment_for_member_id'] ) ) OR $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$this->DB->update( 'profile_comments', array( 'comment_approved' => 1 ), 'comment_id=' . $comment_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'nopermission';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a comment
|
||||
*
|
||||
* @access public
|
||||
* @param int Member ID of user who is attempting to access
|
||||
* @param int Comment ID to remove
|
||||
* @return mixed Error string or nothing on success
|
||||
*/
|
||||
public function deleteComment( $member_id, $comment_id )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Load member
|
||||
//-----------------------------------------
|
||||
|
||||
$member = IPSMember::load( intval( $member_id ) );
|
||||
$comment_id = intval( $comment_id );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! $member['member_id'] )
|
||||
{
|
||||
return 'nopermission';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Get comment
|
||||
//-----------------------------------------
|
||||
|
||||
$comment = $this->DB->buildAndFetch( array( 'select' => '*',
|
||||
'from' => 'profile_comments',
|
||||
'where' => 'comment_id=' . $comment_id ) );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
// Can remove?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ( $member['member_id'] == $this->memberData['member_id'] AND ( $member['member_id'] == $comment['comment_for_member_id'] ) ) OR $this->memberData['g_is_supmod'] )
|
||||
{
|
||||
$this->DB->delete( 'profile_comments', 'comment_id=' . $comment_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'nopermission';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds comments
|
||||
*
|
||||
* @access public
|
||||
* @param array Member information
|
||||
* @param boolean Use a new id
|
||||
* @param string Message to display
|
||||
* @return string Comment HTML
|
||||
* @since IPB 2.2.0.2006-08-02
|
||||
*/
|
||||
public function buildComments( $member, $new_id=0, $return_msg='' )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$comments = array();
|
||||
$member_id = intval( $member['member_id'] );
|
||||
$comment_perpage = 15; //intval( $member['pp_setting_count_comments'] );
|
||||
$comment_html = 0;
|
||||
$comment_start = intval($this->request['st']);
|
||||
$comment_approved = ( $this->memberData['member_id'] == $member['member_id'] OR $this->memberData['g_is_supmod'] ) ? '' : ' AND ( pc.comment_approved=1 OR ( pc.comment_approved=0 AND pc.comment_by_member_id=' . $member_id . ') )';
|
||||
|
||||
//-----------------------------------------
|
||||
// Not showing comments?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $comment_perpage < 1 )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Regenerate comments...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->DB->build( array(
|
||||
'select' => 'pc.*',
|
||||
'from' => array( 'profile_comments' => 'pc' ),
|
||||
'where' => 'pc.comment_for_member_id=' . $member_id . $comment_approved,
|
||||
'order' => 'pc.comment_date DESC',
|
||||
'limit' => array( $comment_start, $comment_perpage ),
|
||||
'calcRows' => TRUE,
|
||||
'add_join' => array(
|
||||
array(
|
||||
'select' => 'm.members_display_name, m.members_seo_name, m.posts, m.last_activity, m.member_group_id, m.member_id, m.last_visit, m.warn_level',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=pc.comment_by_member_id',
|
||||
'type' => 'left'
|
||||
),
|
||||
array(
|
||||
'select' => 'pp.*',
|
||||
'from' => array( 'profile_portal' => 'pp' ),
|
||||
'where' => 'pp.pp_member_id=m.member_id',
|
||||
'type' => 'left' ),
|
||||
)
|
||||
) );
|
||||
$o = $this->DB->execute();
|
||||
$max = $this->DB->fetchCalculatedRows();
|
||||
|
||||
while( $row = $this->DB->fetch($o) )
|
||||
{
|
||||
$row['_comment_date'] = ipsRegistry::getClass( 'class_localization')->getDate( $row['comment_date'], 'TINY' );
|
||||
|
||||
$row = IPSMember::buildDisplayData( $row, array( 'reputation' => 0, 'avatar' => 0, 'warn' => 0 ) );
|
||||
|
||||
if( !$row['members_display_name_short'] )
|
||||
{
|
||||
$row = array_merge( $row, IPSMember::setUpGuest() );
|
||||
}
|
||||
|
||||
$comments[] = $row;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Pagination
|
||||
//-----------------------------------------
|
||||
|
||||
$links = $this->registry->output->generatePagination( array( 'totalItems' => $max,
|
||||
'itemsPerPage' => $comment_perpage,
|
||||
'currentStartValue' => $comment_start,
|
||||
'baseUrl' => "showuser={$member_id}",
|
||||
'seoTitle' => $member['members_seo_name'],
|
||||
) );
|
||||
|
||||
$comment_html = $this->registry->getClass('output')->getTemplate('profile')->showComments( $member, $comments, $new_id, $return_msg, $links );
|
||||
|
||||
//-----------------------------------------
|
||||
// Return it...
|
||||
//-----------------------------------------
|
||||
|
||||
return $comment_html;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,19 +3,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Friends library
|
||||
* Last Updated: $Date: 2010-09-15 19:24:12 -0400 (Wed, 15 Sep 2010) $
|
||||
* Last Updated: $Date: 2011-09-09 19:44:48 -0400 (Fri, 09 Sep 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @link http://hatynka.in
|
||||
* @since 20th February 2002
|
||||
* @version $Rev: 6882 $
|
||||
* @version $Rev: 9476 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,6 @@ class profileFriendsLib
|
||||
/**
|
||||
* Registry object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
@@ -38,7 +37,6 @@ class profileFriendsLib
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $DB;
|
||||
@@ -46,7 +44,6 @@ class profileFriendsLib
|
||||
/**
|
||||
* Settings object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $settings;
|
||||
@@ -54,7 +51,6 @@ class profileFriendsLib
|
||||
/**
|
||||
* Request object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $request;
|
||||
@@ -62,15 +58,14 @@ class profileFriendsLib
|
||||
/**
|
||||
* Member object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
|
||||
/**
|
||||
* Is approval pending?
|
||||
*
|
||||
* @access public
|
||||
* @var boolean
|
||||
*/
|
||||
public $pendingApproval = false;
|
||||
@@ -78,9 +73,8 @@ class profileFriendsLib
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry object
|
||||
* @return void
|
||||
* @param object $registry Registry object
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -96,7 +90,6 @@ class profileFriendsLib
|
||||
/**
|
||||
* Adds a friend to the account that is logged in or specified
|
||||
*
|
||||
* @access public
|
||||
* @param integer $friend_id The friend being added to the account
|
||||
* @param integer $from_id The requesting member, defaults to current member
|
||||
* @param boolean $forceApproval Automatically approve, regardless of setting
|
||||
@@ -144,7 +137,7 @@ class profileFriendsLib
|
||||
$friend_check = $this->DB->buildAndFetch( array(
|
||||
'select' => 'friends_id',
|
||||
'from' => 'profile_friends',
|
||||
'where' => "friends_member_id={$from_id} AND friends_friend_id={$friend['member_id']}"
|
||||
'where' => "friends_member_id={$from_id} AND friends_friend_id={$friend_id}"
|
||||
) );
|
||||
|
||||
if( $friend_check['friends_id'] )
|
||||
@@ -205,7 +198,7 @@ class profileFriendsLib
|
||||
|
||||
$notifyLibrary->setMember( $friend );
|
||||
$notifyLibrary->setFrom( $member );
|
||||
$notifyLibrary->setNotificationKey( 'friend_request_pending' );
|
||||
$notifyLibrary->setNotificationKey( 'friend_request' );
|
||||
$notifyLibrary->setNotificationUrl( "{$this->settings['board_url']}/index.{$this->settings['php_ext']}?app=members&section=friends&module=profile&do=list&tab=pending" );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
@@ -219,38 +212,42 @@ class profileFriendsLib
|
||||
}
|
||||
else
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Notifications library
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( "new_friend_added", $friend['language'] );
|
||||
|
||||
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&section=friends&module=profile&do=list"
|
||||
) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf(
|
||||
IPSText::getTextClass('email')->subject,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ),
|
||||
$member['members_display_name']
|
||||
);
|
||||
|
||||
$notifyLibrary->setMember( $friend );
|
||||
$notifyLibrary->setFrom( $member );
|
||||
$notifyLibrary->setNotificationKey( 'friend_request' );
|
||||
$notifyLibrary->setNotificationUrl( $this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ) );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
try
|
||||
/* Don't notify yourself */
|
||||
if( $friend['member_id'] != $this->memberData['member_id'] )
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
//-----------------------------------------
|
||||
// Notifications library
|
||||
//-----------------------------------------
|
||||
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_ROOT_PATH . '/sources/classes/member/notifications.php', 'notifications' );
|
||||
$notifyLibrary = new $classToLoad( $this->registry );
|
||||
|
||||
IPSText::getTextClass('email')->getTemplate( "new_friend_added", $friend['language'] );
|
||||
|
||||
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&section=friends&module=profile&do=list"
|
||||
) );
|
||||
|
||||
IPSText::getTextClass('email')->subject = sprintf(
|
||||
IPSText::getTextClass('email')->subject,
|
||||
$this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ),
|
||||
$member['members_display_name']
|
||||
);
|
||||
|
||||
$notifyLibrary->setMember( $friend );
|
||||
$notifyLibrary->setFrom( $member );
|
||||
$notifyLibrary->setNotificationKey( 'friend_request' );
|
||||
$notifyLibrary->setNotificationUrl( $this->registry->output->buildSEOUrl( 'showuser=' . $member['member_id'], 'public', $member['members_seo_name'], 'showuser' ) );
|
||||
$notifyLibrary->setNotificationText( IPSText::getTextClass('email')->message );
|
||||
$notifyLibrary->setNotificationTitle( IPSText::getTextClass('email')->subject );
|
||||
try
|
||||
{
|
||||
$notifyLibrary->sendNotification();
|
||||
}
|
||||
catch( Exception $e ){}
|
||||
}
|
||||
catch( Exception $e ){}
|
||||
|
||||
$return_msg = 'pp_friend_added';
|
||||
}
|
||||
@@ -265,7 +262,6 @@ class profileFriendsLib
|
||||
/**
|
||||
* Removes a friend from the logged in account
|
||||
*
|
||||
* @access public
|
||||
* @param integer $friend_id The friend being removed
|
||||
* @param integer $from_id The requesting member, defaults to current member
|
||||
* @return string Error Key or blank for success
|
||||
@@ -316,7 +312,6 @@ class profileFriendsLib
|
||||
/**
|
||||
* Recaches member's friends
|
||||
*
|
||||
* @access public
|
||||
* @param array $member Member array to recache
|
||||
* @return boolean
|
||||
*/
|
||||
@@ -350,12 +345,11 @@ class profileFriendsLib
|
||||
* Check to see if we can add this member
|
||||
* Just checks flood table right now, but this can be expanded upon
|
||||
*
|
||||
* @access private
|
||||
* @param int Member ID
|
||||
* @param int Friend ID
|
||||
* @return boolean
|
||||
*/
|
||||
private function _canAddFriend( $member_id, $friend_id )
|
||||
protected function _canAddFriend( $member_id, $friend_id )
|
||||
{
|
||||
/* Clean flood table */
|
||||
$this->_cleanFloodTable();
|
||||
@@ -377,12 +371,11 @@ class profileFriendsLib
|
||||
/**
|
||||
* Add entry to the flood table
|
||||
*
|
||||
* @access private
|
||||
* @param int Member ID
|
||||
* @param int Friend ID
|
||||
* @return boolean
|
||||
*/
|
||||
private function _addFloodEntry( $member_id, $friend_id )
|
||||
protected function _addFloodEntry( $member_id, $friend_id )
|
||||
{
|
||||
/* Clean flood table */
|
||||
$this->_cleanFloodTable();
|
||||
@@ -396,9 +389,8 @@ class profileFriendsLib
|
||||
/**
|
||||
* Clean flood table
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function _cleanFloodTable()
|
||||
protected function _cleanFloodTable()
|
||||
{
|
||||
$time = time() - ( 60 * 5 );
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,6 +5,6 @@
|
||||
<hr>
|
||||
You have reached this page in error, please use your back button to return to the forum.
|
||||
<hr>
|
||||
<a href="http://www.invisionboard.com/">IP.Board</a>
|
||||
<a href="http://www.invisionpower.com">IP.Board</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,19 +3,19 @@
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.1.4
|
||||
* IP.Board v3.2.3
|
||||
* Profile Plugin Library
|
||||
* Last Updated: $Date: 2010-01-15 10:18:44 -0500 (Fri, 15 Jan 2010) $
|
||||
* Last Updated: $Date: 2011-05-05 07:03:47 -0400 (Thu, 05 May 2011) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @license This is NULLED!
|
||||
* @package IP.Board
|
||||
* @subpackage Members
|
||||
* @link http://www.invisionpower.com
|
||||
* @link http://hatynka.in
|
||||
* @since 20th February 2002
|
||||
* @version $Revision: 5713 $
|
||||
* @version $Revision: 8644 $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -30,7 +30,6 @@ abstract class profile_plugin_parent
|
||||
/**
|
||||
* Registry object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
@@ -38,7 +37,6 @@ abstract class profile_plugin_parent
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $DB;
|
||||
@@ -46,7 +44,6 @@ abstract class profile_plugin_parent
|
||||
/**
|
||||
* Settings object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $settings;
|
||||
@@ -54,7 +51,6 @@ abstract class profile_plugin_parent
|
||||
/**
|
||||
* Request object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $request;
|
||||
@@ -62,7 +58,6 @@ abstract class profile_plugin_parent
|
||||
/**
|
||||
* Language object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $lang;
|
||||
@@ -70,25 +65,24 @@ abstract class profile_plugin_parent
|
||||
/**
|
||||
* Member object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
|
||||
/**
|
||||
* Cache object
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $cache;
|
||||
protected $caches;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @param object Registry object
|
||||
* @return void
|
||||
* @param object $registry Registry object
|
||||
* @return @e void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
@@ -107,22 +101,8 @@ abstract class profile_plugin_parent
|
||||
/**
|
||||
* Abstract :: return HTML block
|
||||
*
|
||||
* @access public
|
||||
* @param array Member information
|
||||
* @return string HTML block
|
||||
*/
|
||||
abstract public function return_html_block( $member=array() );
|
||||
|
||||
/**
|
||||
* Parse macros in HTML block
|
||||
*
|
||||
* @access private
|
||||
* @param string HTML block
|
||||
* @return string HTML block with macros parsed
|
||||
* @deprecated Just use the output library's method
|
||||
*/
|
||||
private function _parseMacros( $content='' )
|
||||
{
|
||||
return $this->registry->output->replaceMacros( $content );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user