Version 3.1.4
This commit is contained in:
1 parent
1d4720f3e2
commit
ae5c01cc78
2563 files changed
+283048
-240689
No files matched your search
@@ -1,16 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* <pre>
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* IP.Board v3.1.4
|
||||
* API: Core
|
||||
* Last Updated: $Date: 2009-11-11 20:48:24 -0500 (Wed, 11 Nov 2009) $
|
||||
* Last Updated: $Date: 2010-11-12 13:07:33 -0500 (Fri, 12 Nov 2010) $
|
||||
* </pre>
|
||||
*
|
||||
* @author $Author: bfarber $
|
||||
* @author $Author: ips_terabyte $
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @version $Rev: 5376 $
|
||||
* @license http://www.invisionpower.com/community/board/license.html
|
||||
* @package IP.Board
|
||||
* @link http://www.invisionpower.com
|
||||
* @version $Rev: 7174 $
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
@@ -24,7 +26,6 @@ class hanEmail
|
||||
/**
|
||||
* Emailer object reference
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $emailer;
|
||||
@@ -32,7 +33,6 @@ class hanEmail
|
||||
/**
|
||||
* Email header
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $header;
|
||||
@@ -40,7 +40,6 @@ class hanEmail
|
||||
/**
|
||||
* Email footer
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $footer;
|
||||
@@ -48,7 +47,6 @@ class hanEmail
|
||||
/**
|
||||
* Email from
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $from;
|
||||
@@ -56,7 +54,6 @@ class hanEmail
|
||||
/**
|
||||
* Email to
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $to;
|
||||
@@ -64,7 +61,6 @@ class hanEmail
|
||||
/**
|
||||
* Email bcc's
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $bcc = array();
|
||||
@@ -72,7 +68,6 @@ class hanEmail
|
||||
/**
|
||||
* Email subject
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $subject;
|
||||
@@ -80,7 +75,6 @@ class hanEmail
|
||||
/**
|
||||
* Email body
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $message;
|
||||
@@ -88,7 +82,6 @@ class hanEmail
|
||||
/**
|
||||
* Temp word swapping array
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
private $_words;
|
||||
@@ -96,15 +89,15 @@ class hanEmail
|
||||
/**
|
||||
* Headers to pass to email lib
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $temp_headers = array();
|
||||
|
||||
private $_attachments = array();
|
||||
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
@@ -113,12 +106,12 @@ class hanEmail
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $memberData;
|
||||
/**#@-*/
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
@@ -137,7 +130,6 @@ class hanEmail
|
||||
/**
|
||||
* Init method (setup stuff)
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function init()
|
||||
@@ -145,9 +137,9 @@ class hanEmail
|
||||
$this->header = $this->settings['email_header'] ? $this->settings['email_header'] : '';
|
||||
$this->footer = $this->settings['email_footer'] ? $this->settings['email_footer'] : '';
|
||||
|
||||
require_once( IPS_KERNEL_PATH . 'classEmail.php' );
|
||||
$classToLoad = IPSLib::loadLibrary( IPS_KERNEL_PATH . 'classEmail.php', 'classEmail' );
|
||||
|
||||
$this->emailer = new classEmail(
|
||||
$this->emailer = new $classToLoad(
|
||||
array(
|
||||
'debug' => $this->settings['fake_mail'] ? $this->settings['fake_mail'] : '0',
|
||||
'debug_path' => DOC_IPS_ROOT_PATH . '_mail',
|
||||
@@ -168,7 +160,6 @@ class hanEmail
|
||||
/**
|
||||
* Clear out any temporary headers
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function clearHeaders()
|
||||
@@ -179,7 +170,6 @@ class hanEmail
|
||||
/**
|
||||
* Manually set an email header
|
||||
*
|
||||
* @access public
|
||||
* @param string Header key
|
||||
* @param string Header value
|
||||
* @return void
|
||||
@@ -192,7 +182,6 @@ class hanEmail
|
||||
/**
|
||||
* Send an email
|
||||
*
|
||||
* @access public
|
||||
* @return boolean Email sent successfully
|
||||
*/
|
||||
public function sendMail()
|
||||
@@ -201,6 +190,15 @@ class hanEmail
|
||||
//$this->emailer->clearError();
|
||||
$this->init();
|
||||
|
||||
/* Add attachments if any */
|
||||
if ( count( $this->_attachments ) )
|
||||
{
|
||||
foreach( $this->_attachments as $a )
|
||||
{
|
||||
$this->emailer->addAttachment( $a[0], $a[1], $a[2] );
|
||||
}
|
||||
}
|
||||
|
||||
$this->settings['board_name'] = $this->cleanMessage($this->settings['board_name']);
|
||||
|
||||
$this->emailer->setFrom( $this->from ? $this->from : $this->settings['email_out'], $this->settings['board_name'] );
|
||||
@@ -219,7 +217,13 @@ class hanEmail
|
||||
}
|
||||
}
|
||||
|
||||
$this->emailer->setSubject( $this->subject );
|
||||
//-----------------------------------------
|
||||
// Added strip_tags for the subject 4.16.2010
|
||||
// so we can have links in subject for inline
|
||||
// notifications and still use the subject
|
||||
//-----------------------------------------
|
||||
|
||||
$this->emailer->setSubject( $this->_cleanSubject($this->subject) );
|
||||
$this->emailer->setBody( $this->message );
|
||||
$this->emailer->sendMail();
|
||||
|
||||
@@ -234,7 +238,6 @@ class hanEmail
|
||||
/**
|
||||
* Retrieve an email template
|
||||
*
|
||||
* @access public
|
||||
* @param string Template key
|
||||
* @param string Language to use
|
||||
* @param string Language file to load
|
||||
@@ -308,7 +311,6 @@ class hanEmail
|
||||
/**
|
||||
* Builds an email from a template, replacing variables
|
||||
*
|
||||
* @access public
|
||||
* @param array Replacement keys to values
|
||||
* @param bool Do not "clean"
|
||||
* @return void
|
||||
@@ -361,7 +363,6 @@ class hanEmail
|
||||
/**
|
||||
* Replaces key with value
|
||||
*
|
||||
* @access private
|
||||
* @param string Key
|
||||
* @return string Replaced variable
|
||||
*/
|
||||
@@ -370,17 +371,41 @@ class hanEmail
|
||||
return $this->_words[ $matches[1] ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans the email subject
|
||||
*
|
||||
* @param string In text
|
||||
* @return string Out text
|
||||
*/
|
||||
private function _cleanSubject( $subject )
|
||||
{
|
||||
$subject = strip_tags( $subject );
|
||||
|
||||
$subject = str_replace( "$", "\$", $subject );
|
||||
$subject = str_replace( "!" , "!" , $subject );
|
||||
$subject = str_replace( """ , '"' , $subject );
|
||||
$subject = str_replace( "'" , "'" , $subject );
|
||||
$subject = str_replace( "|", '|' , $subject );
|
||||
$subject = str_replace( "&" , '&' , $subject );
|
||||
$subject = str_replace( ":" , ":" , $subject );
|
||||
$subject = str_replace( "[" , "[" , $subject );
|
||||
$subject = str_replace( "]" , "]" , $subject );
|
||||
$subject = str_replace( "@", '@' , $subject );
|
||||
$subject = str_replace( " " , ' ', $subject );
|
||||
|
||||
return $subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans an email message
|
||||
*
|
||||
* @access public
|
||||
* @param string Email content
|
||||
* @return string Cleaned email content
|
||||
*/
|
||||
public function cleanMessage( $message = "" )
|
||||
{
|
||||
$message = preg_replace( "#\[quote.*\](.+?)\[/quote\]#", "<br /><br />------------ QUOTE ----------<br />\\1<br />-----------------------------<br /><br />" , $message );
|
||||
$message = preg_replace_callback( "#\[url=(.+?)\](.+?)\[/url\]#", array( $this, "_formatUrl" ), $message );
|
||||
$message = preg_replace( '#\[quote.*\](.+?)\[/quote\]#s', "<br /><br />------------ QUOTE ----------<br />\\1<br />-----------------------------<br /><br />" , $message );
|
||||
$message = preg_replace_callback( '#\[url=(.+?)\](.+?)\[/url\]#', array( $this, "_formatUrl" ), $message );
|
||||
|
||||
|
||||
//-----------------------------------------
|
||||
@@ -440,7 +465,6 @@ class hanEmail
|
||||
/**
|
||||
* Format url for email
|
||||
*
|
||||
* @access public
|
||||
* @param array preg_replace matches
|
||||
* @return string Formatted url
|
||||
*/
|
||||
@@ -451,10 +475,22 @@ class hanEmail
|
||||
return $matches[2] . ' (' . $matches[1] . ')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an attachment to the current email
|
||||
*
|
||||
* @param string File data
|
||||
* @param string File name
|
||||
* @param string File type (MIME)
|
||||
* @return void
|
||||
*/
|
||||
public function addAttachment( $data="", $name="", $ctype='application/octet-stream' )
|
||||
{
|
||||
$this->_attachments[] = array( $data, $name, $ctype );
|
||||
}
|
||||
|
||||
/**
|
||||
* Log a fatal error
|
||||
*
|
||||
* @access private
|
||||
* @param string Message
|
||||
* @param string Help key (deprecated)
|
||||
* @return bool
|
||||
|
||||
Reference in new issue
Block a user