Version 3.2.3
This commit is contained in:
1 parent
ae5c01cc78
commit
78706903a2
2641 files changed
+228363
-201264
No files matched your search
+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
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user