Version 3.4.5

This commit is contained in:
Neo committed 2025-12-19 00:38:12 -08:00
1 parent fb6b5baabc
commit e4478369d8
1360 files changed
+228921 -179445

No files matched your search

@@ -3,18 +3,18 @@
/**
* <pre>
* Invision Power Services
* IP.Board v3.3.4
* IP.Board v3.4.5
* Notification library
* Last Updated: $Date: 2012-06-12 10:14:49 -0400 (Tue, 12 Jun 2012) $
* Last Updated: $Date: 2012-10-30 18:24:46 -0400 (Tue, 30 Oct 2012) $
* </pre>
*
* @author $Author: bfarber $ (Original: bfarber)
* @author $Author: AndyMillne $ (Original: bfarber)
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
* @license http://www.invisionpower.com/company/standards.php#license
* @package IP.Board
* @link http://www.invisionpower.com
* @since Thursday Jan 7, 2010
* @version $Revision: 10914 $
* @version $Revision: 11530 $
*
*/
@@ -89,7 +89,8 @@ class notifications
*/
protected $_notificationText_forDisplay = '';
protected $_notificationText_forEmails = '';
protected $_notificationHtml = '';
/**
* Notification title
*
@@ -275,6 +276,15 @@ class notifications
$this->_notificationText_forEmails = $text;
}
/**
* Set notification HTML for emails
* @param string $html
*/
public function setNotificationHtml( $html )
{
$this->_notificationHtml = $html;
}
/**
* Set notification text
*
@@ -640,7 +650,7 @@ class notifications
}
$_config = $this->getMemberNotificationConfig( $r );
/* update msg show notification for inline pop-up */
if ( in_array( $this->_notificationKey, $this->_showInlinePopUp ) )
{
@@ -752,15 +762,16 @@ class notifications
}
$subject = ( ! empty( $this->_emailTitle ) ) ? strip_tags( $this->_emailTitle ) : strip_tags( $this->_notificationTitle );
/* Add to mail queue */
$this->DB->insert( 'mail_queue', array( 'mail_to' => $to,
'mail_cc' => ( count($cc) ? implode( ',', $cc ) : '' ),
'mail_from' => $this->settings['email_out'],
'mail_date' => time(),
'mail_html_on' => intval( $this->_mail_html_on ),
'mail_subject' => $subject,
'mail_content' => $this->_notificationText_forEmails ) );
$this->DB->insert( 'mail_queue', array( 'mail_to' => $to,
'mail_cc' => ( count($cc) ? implode( ',', $cc ) : '' ),
'mail_from' => $this->settings['email_out'],
'mail_date' => time(),
'mail_html_on' => intval( $this->_mail_html_on ),
'mail_subject' => $subject,
'mail_content' => $this->_notificationText_forEmails,
'mail_html_content' => ( $this->_notificationHtml ) ? $this->_notificationHtml : '' ) );
$cache = $this->cache->getCache('systemvars');
$cache['mail_queue'] += 1;
@@ -827,8 +838,14 @@ class notifications
if ( ! $hidden )
{
$this->DB->update( 'members', 'notification_cnt=notification_cnt+1', 'member_id=' . $member['member_id'], true, true );
}
// Do we have a notification limit?
$_limit = $this->getGroupLimit( $member );
if( $_limit > $member['notification_cnt'] || !$_limit )
{
$this->DB->update( 'members', 'notification_cnt=notification_cnt+1', 'member_id=' . $member['member_id'], true, true );
}
}
return true;
}
@@ -846,35 +863,8 @@ class notifications
// Determine member's limit first
//-----------------------------------------
$groups = array( $member['member_group_id'] );
$_limit = $this->getGroupLimit( $member );
if( $member['mgroup_others'] )
{
$_others = IPSText::cleanPermString( $member['mgroup_others'] );
$groups = ( is_array( $groups ) AND is_array( $_others ) ) ? array_merge( $_others, $groups ) : array();
}
//-----------------------------------------
// 0 is best, otherwise higher is better
//-----------------------------------------
$_limit = 0;
foreach( $groups as $_group )
{
$_thisLimit = $this->caches['group_cache'][ $_group ]['g_max_notifications'];
if( !$_thisLimit )
{
$_limit = 0;
break;
}
else if( $_thisLimit > $_limit )
{
$_limit = $_thisLimit;
}
}
//-----------------------------------------
// We have a limit
//-----------------------------------------
@@ -1104,6 +1094,8 @@ class notifications
$detail['member_PhotoTag'] = IPSMember::buildPhotoTag( $author, 'mini' );
$detail['member_HoverCard'] = $this->registry->getClass('output')->getTemplate('global')->userHoverCard( $author );
/* Slap on the URL */
$detail['url'] = $latest['notify_url'];
@@ -1292,6 +1284,45 @@ class notifications
return 0;
}
/**
* Determine member's notification limit
* @return int $_limit
*/
public function getGroupLimit( $member )
{
$groups = array( $member['member_group_id'] );
if( $member['mgroup_others'] )
{
$_others = explode( ",", IPSText::cleanPermString( $member['mgroup_others'] ) );
$groups = ( is_array( $groups ) AND is_array( $_others ) ) ? array_merge( $_others, $groups ) : array();
}
//-----------------------------------------
// 0 is best, otherwise higher is better
//-----------------------------------------
$_limit = 0;
foreach( $groups as $_group )
{
$_thisLimit = $this->caches['group_cache'][ $_group ]['g_max_notifications'];
if( !$_thisLimit )
{
$_limit = 0;
break;
}
else if( $_thisLimit > $_limit )
{
$_limit = $_thisLimit;
}
}
return intval( $_limit );
}
/**
* Do we have an application class?
* @return boolean