Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3b4ea93dca67
Choose a base ref
...
head repository: mantisbt/mantisbt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 86abb9cc145f
Choose a head ref
  • 5 commits
  • 11 files changed
  • 1 contributor

Commits on Aug 16, 2012

  1. Store bugnote URL replacement string in a static variable

    The purpose is to make code more readable.
    
    Follow up on fix for issue #14447.
    dregad committed Aug 16, 2012

    Verified

    This commit was signed with the committer’s verified signature.
    elseym Simon Waibl
    Copy the full SHA
    71c7e02 View commit details

Commits on Aug 17, 2012

  1. Upgrade PHPMailer from 5.1 to 5.2.1

    Version 5.2.1 (January 16, 2012)
    * Closed several bugs
    * Performance improvements
    * MsgHTML() now returns the message as required.
    * New method: GetSentMIMEMessage() (returns full copy of sent message)
    
    Version 5.2 (July 19, 2011)
    * protected MIME body and header
    * better DKIM DNS Resource Record support
    * better aly handling
    * htmlfilter class added to extras
    * moved to Apache Extras
    
    Fixes #12562
    dregad committed Aug 17, 2012
    Copy the full SHA
    a4f644c View commit details
  2. Fix #14630: Improved logging for emails

    Prior to this, several e-mail related events were not reported at all,
    making troubleshooting of issues difficult. The following cases are now
    logged:
    
     * sending of queued messages (email_send_all)
     * errors thrown by PHPMailer
     * reminder emails (email_bug_reminder) - fixes #9368
     * deletion of records from the email queue
    
    In addition, admin/email_queue.php was modified to print a formatted
    date instead of a numeric timestamp.
    dregad committed Aug 17, 2012
    Copy the full SHA
    6e27e96 View commit details
  3. Fix #14631: Consistent email validation

    PHPMailer uses filter_var() to check for an e-mail validity; this
    function treats single-domain e-mail addresses (e.g. user@localhost) as
    invalid. However, Mantis API function email_is_valid() relies on a
    custom regex to validate e-mails, which does accept such addresses. As a
    consequence, we accept addresses to which we are unable to send
    messages.
    
    To avoid this problem, we now rely on PHPMailer::ValidateAddress()
    method to ensure that any email we store can be sent PHPMailer.
    dregad committed Aug 17, 2012
    Copy the full SHA
    a38858a View commit details
  4. Do not skip e-mail validation if $g_login_method != LDAP

    Prior to this, function email_is_valid() always returned true when
    $g_use_ldap_email = ON, even if $g_login_method != LDAP.
    
    Even though this is not an usual case (when not using LDAP, the other
    LDAP-related configuration options should be left to their default
    values), this causes the actual validation to be skipped which could
    lead to email sending errors.
    
    Fixes #14632
    dregad committed Aug 17, 2012
    Copy the full SHA
    86abb9c View commit details
7 changes: 6 additions & 1 deletion admin/email_queue.php
Original file line number Diff line number Diff line change
@@ -65,7 +65,12 @@
foreach( $t_ids as $t_id ) {
$row = email_queue_get( $t_id );

echo '<tr><td>' . $row->email_id . '</td><td>' . $row->email . '</td><td>' . $row->submitted . '</td><td>' , html_button( 'email_queue.php', 'Send Or Delete', array( 'send' => $row->email_id ) ) , '</td></tr>';
echo '<tr><td>'
. $row->email_id . '</td><td>'
. $row->email . '</td><td>'
. date( config_get( 'complete_date_format' ), $row->submitted ) . '</td><td>'
, html_button( 'email_queue.php', 'Send Or Delete', array( 'send' => $row->email_id ) )
, '</td></tr>';
}
echo '</table>';
} else {
60 changes: 29 additions & 31 deletions core/email_api.php
Original file line number Diff line number Diff line change
@@ -46,6 +46,8 @@
* @uses user_api.php
* @uses user_pref_api.php
* @uses utility_api.php
*
* @uses class.phpmailer.php PHPMailer library
*/

require_api( 'access_api.php' );
@@ -72,6 +74,8 @@
require_api( 'user_pref_api.php' );
require_api( 'utility_api.php' );

require_lib( 'phpmailer' . DIRECTORY_SEPARATOR . 'class.phpmailer.php' );

/**
* reusable object of class SMTP
*/
@@ -109,19 +113,17 @@ function email_is_valid( $p_email ) {
return true;
}

if ( ON == config_get( 'use_ldap_email' ) ) {
if ( LDAP == config_get( 'login_method' ) && ON == config_get( 'use_ldap_email' ) ) {
return true;
}

if( is_blank( $p_email ) && ON == config_get( 'allow_blank_email' ) ) {
return true;
}

# Use a regular expression to check to see if the email is in valid format
# x-xx.xxx@yyy.zzz.abc etc.
if( preg_match( email_regex_simple(), $p_email, $t_check ) ) {
$t_local = $t_check[1];
$t_domain = $t_check[2];
# Delegate email validation to PHPMailer
if( PHPMailer::ValidateAddress( $p_email ) ) {
$t_domain = end( explode( '@', $p_email ) );

# see if we're limited to one domain
$t_limit_email_domain = config_get( 'limit_email_domain' );
@@ -865,8 +867,13 @@ function email_send_all($p_delete_on_failure = false) {

$t_emails_recipients_failed = array();
$t_start = microtime(true);
log_event( LOG_EMAIL, "Processing " . count( $t_ids ) . " queued messages" );
foreach( $t_ids as $t_id ) {
$t_email_data = email_queue_get( $t_id );
log_event( LOG_EMAIL,
"Sending message #$t_id queued on " .
date( config_get( 'complete_date_format' ), $t_email_data->submitted )
);

# check if email was not found. This can happen if another request picks up the email first and sends it.
if( $t_email_data === false ) {
@@ -907,10 +914,8 @@ function email_send( $p_email_data ) {
$t_mailer_method = config_get( 'phpMailer_method' );

if( is_null( $g_phpMailer ) ) {
if ( $t_mailer_method == PHPMAILER_METHOD_SMTP )
if ( $t_mailer_method == PHPMAILER_METHOD_SMTP ) {
register_shutdown_function( 'email_smtp_close' );
if( !class_exists( 'PHPMailer' ) ) {
require_lib( 'phpmailer' . DIRECTORY_SEPARATOR . 'class.phpmailer.php' );
}
$mail = new PHPMailer(true);
} else {
@@ -973,27 +978,19 @@ function email_send( $p_email_data ) {

if( OFF !== $t_debug_email ) {
$t_message = 'To: ' . $t_recipient . "\n\n" . $t_message;
try {
$mail->AddAddress( $t_debug_email, '' );
} catch ( phpmailerException $e ) {
$t_success = false;
$mail->ClearAllRecipients();
$mail->ClearAttachments();
$mail->ClearReplyTos();
$mail->ClearCustomHeaders();
return $t_success;
}
} else {
try {
$mail->AddAddress( $t_recipient, '' );
} catch ( phpmailerException $e ) {
$t_success = false;
$mail->ClearAllRecipients();
$mail->ClearAttachments();
$mail->ClearReplyTos();
$mail->ClearCustomHeaders();
return $t_success;
}
$t_recipient = $t_debug_email;
}

try {
$mail->AddAddress( $t_recipient, '' );
} catch ( phpmailerException $e ) {
log_event( LOG_EMAIL, "ERROR: Message could not be sent - " . $e->getMessage() );
$t_success = false;
$mail->ClearAllRecipients();
$mail->ClearAttachments();
$mail->ClearReplyTos();
$mail->ClearCustomHeaders();
return $t_success;
}

$mail->Subject = $t_subject;
@@ -1159,7 +1156,8 @@ function email_bug_reminder( $p_recipients, $p_bug_id, $p_message ) {
$t_contents = $t_header . string_get_bug_view_url_with_fqdn( $p_bug_id, $t_recipient ) . " \n\n$p_message";

if( ON == config_get( 'enable_email_notification' ) ) {
email_store( $t_email, $t_subject, $t_contents );
$t_id = email_store( $t_email, $t_subject, $t_contents );
log_event( LOG_EMAIL, "queued reminder email #$t_id for U$t_recipient" );
}

lang_pop();
2 changes: 2 additions & 0 deletions core/email_queue_api.php
Original file line number Diff line number Diff line change
@@ -177,6 +177,8 @@ function email_queue_delete( $p_email_id ) {

$query = 'DELETE FROM ' . $t_email_table . ' WHERE email_id=' . db_param();
db_query_bound( $query, Array( $c_email_id ) );

log_event( LOG_EMAIL, "message #$p_email_id deleted from queue" );
}

/**
7 changes: 6 additions & 1 deletion core/string_api.php
Original file line number Diff line number Diff line change
@@ -443,6 +443,7 @@ function string_process_bugnote_link( $p_string, $p_include_anchor = true, $p_de
*/
function string_insert_hrefs( $p_string ) {
static $s_url_regex = null;
static $s_url_replace = null;
static $s_email_regex = null;
static $s_anchor_regex = '/(<a[^>]*>.*?<\/a>)/is';

@@ -476,12 +477,16 @@ function string_insert_hrefs( $p_string ) {

$s_url_regex = "/(${t_url_protocol}(${t_url_part1}*?${t_url_part2}+))/sue";

# URL replacement
$t_url_href = "href=\"'.rtrim('\\1','.').'\"";
$s_url_replace = "'<a ${t_url_href}>\\1</a> [<a ${t_url_href} target=\"_blank\">^</a>]'";

# e-mail regex
$s_email_regex = substr_replace( email_regex_simple(), '(?:mailto:)?', 1, 0 );
}

# Find any URL in a string and replace it by a clickable link
$p_string = preg_replace( $s_url_regex, "'<a href=\"'.rtrim('\\1','.').'\">\\1</a> [<a href=\"'.rtrim('\\1','.').'\" target=\"_blank\">^</a>]'", $p_string );
$p_string = preg_replace( $s_url_regex, $s_url_replace, $p_string );
if( $t_change_quotes ) {
ini_set( 'magic_quotes_sybase', true );
}
4 changes: 2 additions & 2 deletions library/README.libs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ adodb | adodb | 5.11 | unpatched
disposable | disposable | 1.1.0 | unpatched
ezc | ez Components | 2009.2.1 | unpatched
nusoap | nusoap | 0.9.5 | patched: XSS vulnerabilities as per #12312
phpmailer | PHPMailer | 5.1 | unpatched
phpmailer | PHPMailer | 5.2.1 | unpatched
rssbuilder | RSSBuilder | 2.2.1 | patched: removed __autoload function
utf8 | phputf8 | 0.5 | unpatched

@@ -18,6 +18,6 @@ adodb - http://adodb.sourceforge.net/
disposable - http://github.com/vboctor/disposable_email_checker/tree/master
ezc - http://ezcomponents.org/
nusoap - http://sourceforge.net/projects/nusoap/
phpmailer - http://phpmailer.codeworxtech.com/
phpmailer - http://code.google.com/a/apache-extras.org/p/phpmailer/
rssbuilder - http://code.google.com/p/flaimo-php/
utf8 - http://sourceforge.net/projects/phputf8
15 changes: 11 additions & 4 deletions library/phpmailer/README
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
/*******************************************************************
* The http://phpmailer.codeworxtech.com/ website now carries a few *
* advertisements through the Google Adsense network. Please visit *
* the advertiser sites and help us offset some of our costs. *
* Thanks .... *
* http://code.google.com/a/apache-extras.org/p/phpmailer/ *
********************************************************************/

PHPMailer
Full Featured Email Transfer Class for PHP
==========================================

Version 5.2.1 (January 16, 2012)

Patch release (see changelog.txt).

Version 5.2.0 (July 19, 2011)

With the release of this version, PHPMailer has moved to Apache
Extras:
http://code.google.com/a/apache-extras.org/p/phpmailer/

Version 5.0.0 (April 02, 2009)

With the release of this version, we are initiating a new version numbering
Original file line number Diff line number Diff line change
@@ -3,6 +3,19 @@ ChangeLog
NOTE: THIS VERSION OF PHPMAILER IS DESIGNED FOR PHP5/PHP6.
IT WILL NOT WORK WITH PHP4.

Version 5.2.1 (January 16, 2012)
* Closed several bugs
* Performance improvements
* MsgHTML() now returns the message as required.
* New method: GetSentMIMEMessage() (returns full copy of sent message)

Version 5.2 (July 19, 2011)
* protected MIME body and header
* better DKIM DNS Resource Record support
* better aly handling
* htmlfilter class added to extras
* moved to Apache Extras

Version 5.1 (October 20, 2009)
* fixed filename issue with AddStringAttachment (thanks to Tony)
* fixed "SingleTo" property, now works with Senmail, Qmail, and SMTP in
@@ -175,9 +188,9 @@ Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release
******************
A note on sending bulk emails:

If the email you are sending is not personalized, consider using the
If the email you are sending is not personalized, consider using the
"undisclosed-recipient:;" strategy. That is, put all of your recipients
in the Bcc field and set the To field to "undisclosed-recipients:;".
in the Bcc field and set the To field to "undisclosed-recipients:;".
It's a lot faster (only one send) and saves quite a bit on resources.
Contrary to some opinions, this will not get you listed in spam engines -
it's a legitimate way for you to send emails.
@@ -214,11 +227,11 @@ Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release
* added TLS/SSL SMTP support
example of use:
$mail = new PHPMailer();
$mail->Mailer = "smtp";
$mail->Host = "smtp.example.com";
$mail->SMTPSecure = "tls"; // option
//$mail->SMTPSecure = "ssl"; // option
...
$mail->Mailer = "smtp";
$mail->Host = "smtp.example.com";
$mail->SMTPSecure = "tls"; // option
//$mail->SMTPSecure = "ssl"; // option
...
$mail->Send();
* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7)
* Works with PHP installed as a module or as CGI-PHP
@@ -231,7 +244,7 @@ Version 1.73 (Sun, Jun 10 2005)

Version 1.72 (Wed, May 25 2004)
* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.
* Received: Removed this method because spam filter programs like
* Received: Removed this method because spam filter programs like
SpamAssassin reject this header.
* Fixed error count bug.
* SetLanguage default is now "language/".
640 changes: 426 additions & 214 deletions library/phpmailer/class.phpmailer.php

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions library/phpmailer/class.pop3.php
Original file line number Diff line number Diff line change
@@ -2,15 +2,15 @@
/*~ class.pop3.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.1 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
| Version: 5.2.1 |
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Andy Prevost (project admininistrator) |
| Admin: Jim Jagielski (project admininistrator) |
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
| : Jim Jagielski (jimjag) jimjag@gmail.com |
| Founder: Brent R. Matzelle (original founder) |
| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. |
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
| Copyright (c) 2001-2003, Brent R. Matzelle |
| ------------------------------------------------------------------------- |
@@ -19,11 +19,6 @@
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
| ------------------------------------------------------------------------- |
| We offer a number of paid services (www.codeworxtech.com): |
| - Web Hosting on highly optimized fast and secure servers |
| - Technology Consulting |
| - Oursourcing (highly qualified programmers and graphic designers) |
'---------------------------------------------------------------------------'
*/

@@ -33,14 +28,16 @@
* @package PHPMailer
* @author Andy Prevost
* @author Marcus Bointon
* @author Jim Jagielski
* @copyright 2010 - 2012 Jim Jagielski
* @copyright 2004 - 2009 Andy Prevost
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
* @version $Id: class.pop3.php 444 2009-05-05 11:22:26Z coolbru $
* @version $Id: class.pop3.php 450 2010-06-23 16:46:33Z coolbru $
*/

/**
* POP Before SMTP Authentication Class
* Version 5.0.0
* Version 5.2.1
*
* Author: Richard Davey (rich@corephp.co.uk)
* Modifications: Andy Prevost
@@ -114,6 +111,12 @@ class POP3 {
*/
public $password;

/**
* Sets the POP3 PHPMailer Version number
* @var string
*/
public $Version = '5.2.1';

/////////////////////////////////////////////////
// PROPERTIES, PRIVATE AND PROTECTED
/////////////////////////////////////////////////
@@ -404,4 +407,4 @@ private function catchWarning ($errno, $errstr, $errfile, $errline) {

// End of class
}
?>
?>
30 changes: 17 additions & 13 deletions library/phpmailer/class.smtp.php
Original file line number Diff line number Diff line change
@@ -2,15 +2,15 @@
/*~ class.smtp.php
.---------------------------------------------------------------------------.
| Software: PHPMailer - PHP email class |
| Version: 5.1 |
| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
| Info: http://phpmailer.sourceforge.net |
| Support: http://sourceforge.net/projects/phpmailer/ |
| Version: 5.2.1 |
| Site: https://code.google.com/a/apache-extras.org/p/phpmailer/ |
| ------------------------------------------------------------------------- |
| Admin: Andy Prevost (project admininistrator) |
| Admin: Jim Jagielski (project admininistrator) |
| Authors: Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net |
| : Marcus Bointon (coolbru) coolbru@users.sourceforge.net |
| : Jim Jagielski (jimjag) jimjag@gmail.com |
| Founder: Brent R. Matzelle (original founder) |
| Copyright (c) 2010-2012, Jim Jagielski. All Rights Reserved. |
| Copyright (c) 2004-2009, Andy Prevost. All Rights Reserved. |
| Copyright (c) 2001-2003, Brent R. Matzelle |
| ------------------------------------------------------------------------- |
@@ -19,11 +19,6 @@
| This program is distributed in the hope that it will be useful - WITHOUT |
| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. |
| ------------------------------------------------------------------------- |
| We offer a number of paid services (www.codeworxtech.com): |
| - Web Hosting on highly optimized fast and secure servers |
| - Technology Consulting |
| - Oursourcing (highly qualified programmers and graphic designers) |
'---------------------------------------------------------------------------'
*/

@@ -34,8 +29,10 @@
* @author Andy Prevost
* @author Marcus Bointon
* @copyright 2004 - 2008 Andy Prevost
* @author Jim Jagielski
* @copyright 2010 - 2012 Jim Jagielski
* @license http://www.gnu.org/copyleft/lesser.html Distributed under the Lesser General Public License (LGPL)
* @version $Id: class.smtp.php 444 2009-05-05 11:22:26Z coolbru $
* @version $Id: class.smtp.php 450 2010-06-23 16:46:33Z coolbru $
*/

/**
@@ -71,6 +68,12 @@ class SMTP {
*/
public $do_verp = false;

/**
* Sets the SMTP PHPMailer Version number
* @var string
*/
public $Version = '5.2.1';

/////////////////////////////////////////////////
// PROPERTIES, PRIVATE AND PROTECTED
/////////////////////////////////////////////////
@@ -794,7 +797,8 @@ public function getError() {
*/
private function get_lines() {
$data = "";
while($str = @fgets($this->smtp_conn,515)) {
while(!feof($this->smtp_conn)) {
$str = @fgets($this->smtp_conn,515);
if($this->do_debug >= 4) {
echo "SMTP -> get_lines(): \$data was \"$data\"" . $this->CRLF . '<br />';
echo "SMTP -> get_lines(): \$str is \"$str\"" . $this->CRLF . '<br />';
@@ -811,4 +815,4 @@ private function get_lines() {

}

?>
?>
10 changes: 6 additions & 4 deletions library/phpmailer/readme_mantis.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
Description of PHPMailer import into mantis.
Description of PHPMailer 5.2.1 import into mantis.

See ../readme.libs for summary of all libraries
See ../README.libs for summary of all libraries

Removed:
test/
docs/
docs.ini
examples/
extras/
test/
test_script/

Added:
readme_mantis.txt - this file ;-)
index.html - prevent directory browsing on misconfigured servers

Changes:
none