Version 4.2.0
This commit is contained in:
1 parent
0dc2aee5ed
commit
96997ddd8e
2074 files changed
+125454
-55780
No files matched your search
+59
-27
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* @brief Outgoing Email Class
|
||||
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
|
||||
* @license http://www.invisionpower.com/legal/standards/
|
||||
* @package IPS Community Suite
|
||||
* @author <a href='https://www.invisioncommunity.com'>Invision Power Services, Inc.</a>
|
||||
* @copyright (c) Invision Power Services, Inc.
|
||||
* @license https://www.invisioncommunity.com/legal/standards/
|
||||
* @package Invision Community
|
||||
* @since 17 Apr 2013
|
||||
* @version SVN_VERSION_NUMBER
|
||||
*/
|
||||
|
||||
namespace IPS;
|
||||
@@ -312,7 +311,7 @@ abstract class _Email
|
||||
something to read */
|
||||
if ( $language === NULL )
|
||||
{
|
||||
$language = $member ? $member->language() : \IPS\Lang::load( \IPS\Lang::defaultLanguage() );
|
||||
$language = $member ? $member->language( TRUE ) : \IPS\Lang::load( \IPS\Lang::defaultLanguage() );
|
||||
}
|
||||
$this->language = $language;
|
||||
|
||||
@@ -347,9 +346,10 @@ abstract class _Email
|
||||
* @param NULL|string $fromName The name the email should appear from. If NULL, default setting is used
|
||||
* @param array $additionalHeaders Additional headers to send
|
||||
* @param string $eol EOL character to use
|
||||
* @param int|NULL $lineLimit Maximum line length
|
||||
* @return string
|
||||
*/
|
||||
public function compileFullEmail( $to, $cc=array(), $bcc=array(), $fromEmail = NULL, $fromName = NULL, $additionalHeaders = array(), $eol = "\r\n" )
|
||||
public function compileFullEmail( $to, $cc=array(), $bcc=array(), $fromEmail = NULL, $fromName = NULL, $additionalHeaders = array(), $eol = "\r\n", $lineLimit = 998 )
|
||||
{
|
||||
$boundary = "--==_mimepart_" . md5( uniqid() );
|
||||
|
||||
@@ -357,13 +357,19 @@ abstract class _Email
|
||||
|
||||
foreach ( $this->_compileHeaders( $this->compileSubject( static::_getMemberFromRecipients( $to ) ), $to, $cc, $bcc, $fromEmail, $fromName, $additionalHeaders, $boundary ) as $k => $v )
|
||||
{
|
||||
$return .= "{$k}: {$v}{$eol}";
|
||||
$line = "{$k}: {$v}";
|
||||
if ( $lineLimit )
|
||||
{
|
||||
$line = wordwrap( $line, $lineLimit, $eol );
|
||||
}
|
||||
|
||||
$return .= $line . $eol;
|
||||
}
|
||||
|
||||
$return .= $eol;
|
||||
$return .= $eol;
|
||||
|
||||
$return .= $this->_compileMessage( static::_getMemberFromRecipients( $to ), $boundary, $eol );
|
||||
$return .= $this->_compileMessage( static::_getMemberFromRecipients( $to ), $boundary, $eol, $lineLimit );
|
||||
|
||||
return $return;
|
||||
}
|
||||
@@ -440,10 +446,11 @@ abstract class _Email
|
||||
* @param \IPS\Member $member If the email is going to a member, the member object. Ensures correct language is used.
|
||||
* @param string $boundary The boundary used in the Content-Type header
|
||||
* @param string $eol EOL character to use
|
||||
* @param int|NULL $lineLimit Maximum line length
|
||||
* @return bool
|
||||
* @throws \IPS\Email\Outgoing\Exception
|
||||
*/
|
||||
protected function _compileMessage( \IPS\Member $member = NULL, $boundary, $eol )
|
||||
protected function _compileMessage( \IPS\Member $member = NULL, $boundary, $eol, $lineLimit = 998 )
|
||||
{
|
||||
$return = '';
|
||||
|
||||
@@ -452,8 +459,19 @@ abstract class _Email
|
||||
$return .= "--{$boundary}{$eol}";
|
||||
$return .= "Content-Type: {$contentType}; charset=UTF-8{$eol}";
|
||||
$return .= "{$eol}";
|
||||
$return .= preg_replace( "/(?<!\r)\n/", "{$eol}", $content );
|
||||
$return .= "{$eol}";
|
||||
|
||||
$content = preg_replace( "/(?<!\r)\n/", "{$eol}", $content );
|
||||
if ( $lineLimit )
|
||||
{
|
||||
foreach ( explode( $eol, $content ) as $line )
|
||||
{
|
||||
$return .= wordwrap( $line, $lineLimit, $eol ) . $eol;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$return .= $content . $eol;
|
||||
}
|
||||
}
|
||||
|
||||
$return .= "--{$boundary}--{$eol}";
|
||||
@@ -1174,24 +1192,38 @@ abstract class _Email
|
||||
{
|
||||
$url = \IPS\Http\Url::createFromString( $node->getAttribute('src') );
|
||||
|
||||
/* Strip "do" param, but only if it is set to "embed" */
|
||||
if ( isset( $url->queryString['do'] ) AND $url->queryString['do'] == 'embed' )
|
||||
/* If this is an external embed link, swap it for whatever is actually embedded */
|
||||
if ( $url instanceof \IPS\Http\Url\Internal and isset( $url->queryString['app'] ) and $url->queryString['app'] == 'core' and isset( $url->queryString['module'] ) and $url->queryString['module'] == 'system' and isset( $url->queryString['controller'] ) and $url->queryString['controller'] == 'embed' and isset( $url->queryString['url'] ) )
|
||||
{
|
||||
$url = $url->stripQueryString( 'do' );
|
||||
try
|
||||
{
|
||||
$url = new \IPS\Http\Url( $url->queryString['url'] );
|
||||
}
|
||||
catch ( \Exception $e ) { }
|
||||
}
|
||||
|
||||
/* Convert embedDo and embedComment if present */
|
||||
if ( isset( $url->queryString['embedDo'] ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'do', $url->queryString['embedDo'] )->stripQueryString( 'embedDo' );
|
||||
}
|
||||
|
||||
if ( isset( $url->queryString['embedComment'] ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'comment', $url->queryString['embedComment'] )->stripQueryString( 'embedComment' );
|
||||
}
|
||||
|
||||
|
||||
/* Same for internal embeds */
|
||||
if ( $url instanceof \IPS\Http\Url\Internal )
|
||||
{
|
||||
/* Strip "do" param, but only if it is set to "embed" */
|
||||
if ( isset( $url->queryString['do'] ) AND $url->queryString['do'] == 'embed' )
|
||||
{
|
||||
$url = $url->stripQueryString( 'do' );
|
||||
}
|
||||
|
||||
/* Convert embedDo and embedComment if present */
|
||||
if ( isset( $url->queryString['embedDo'] ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'do', $url->queryString['embedDo'] )->stripQueryString( 'embedDo' );
|
||||
}
|
||||
|
||||
if ( isset( $url->queryString['embedComment'] ) )
|
||||
{
|
||||
$url = $url->setQueryString( 'comment', $url->queryString['embedComment'] )->stripQueryString( 'embedComment' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Swap the iframe for a link */
|
||||
$a = new \DOMElement( 'a' );
|
||||
$parent->insertBefore( $a, $node );
|
||||
$a->setAttribute( 'href', (string) $url );
|
||||
|
||||
Reference in new issue
Block a user