Skip to content

Commit

Permalink
Merge pull request #7 from robocoder/patch-4
Browse files Browse the repository at this point in the history
Howard Walsh's bug fixes
  • Loading branch information
hippich committed Mar 31, 2012
2 parents 1c815e0 + 58a441d commit ba5a652
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 71 deletions.
48 changes: 24 additions & 24 deletions callback samples/callback_csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function callbackAction ($msgnum, $bounce_type, $email, $subject, $xheader, $rem
$currentTime = date( 'Y-m-d H:i:s', time());

$displayData = prepData($email, $bounce_type, $remove);
$bounce_type = $displayData[bounce_type];
$emailName = $displayData[emailName];
$emailAddy = $displayData[emailAddy];
$remove = $displayData[remove];
$removeraw = $displayData[removestat];
$bounce_type = $displayData['bounce_type'];
$emailName = $displayData['emailName'];
$emailAddy = $displayData['emailAddy'];
$remove = $displayData['remove'];
$removeraw = $displayData['removestat'];

$msg = $msgnum . ',' . $currentTime . ',' . $rule_no . ',' . $rule_cat . ',' . $bounce_type . ',' . $removeraw . ',' . $email . ',' . $subject;

Expand Down Expand Up @@ -56,44 +56,44 @@ function callbackAction ($msgnum, $bounce_type, $email, $subject, $xheader, $rem

/* Function to clean the data from the Callback Function for optimized display */
function prepData($email, $bounce_type, $remove) {
$data[bounce_type] = trim($bounce_type);
$data[email] = '';
$data[emailName] = '';
$data[emailAddy] = '';
$data[remove] = '';
$data['bounce_type'] = trim($bounce_type);
$data['email'] = '';
$data['emailName'] = '';
$data['emailAddy'] = '';
$data['remove'] = '';
if ( strstr($email,'<') ) {
$pos_start = strpos($email,'<');
$data[emailName] = trim(substr($email,0,$pos_start));
$data[emailAddy] = substr($email,$pos_start + 1);
$pos_end = strpos($data[emailAddy],'>');
$data['emailName'] = trim(substr($email,0,$pos_start));
$data['emailAddy'] = substr($email,$pos_start + 1);
$pos_end = strpos($data['emailAddy'],'>');
if ( $pos_end ) {
$data[emailAddy] = substr($data[emailAddy],0,$pos_end);
$data['emailAddy'] = substr($data['emailAddy'],0,$pos_end);
}
}

// replace the < and > able so they display on screen
$email = str_replace('<','&lt;',$email);
$email = str_replace('>','&gt;',$email);
$data[email] = $email;
$data['email'] = $email;

// account for legitimate emails that have no bounce type
if ( trim($bounce_type) == '' ) {
$data[bounce_type] = 'none';
$data['bounce_type'] = 'none';
}

// change the remove flag from true or 1 to textual representation
if ( stristr($remove,'moved') && stristr($remove,'hard') ) {
$data[removestat] = 'moved (hard)';
$data[remove] = '<span style="color:red;">' . 'moved (hard)' . '</span>';
$data['removestat'] = 'moved (hard)';
$data['remove'] = '<span style="color:red;">' . 'moved (hard)' . '</span>';
} elseif ( stristr($remove,'moved') && stristr($remove,'soft') ) {
$data[removestat] = 'moved (soft)';
$data[remove] = '<span style="color:gray;">' . 'moved (soft)' . '</span>';
$data['removestat'] = 'moved (soft)';
$data['remove'] = '<span style="color:gray;">' . 'moved (soft)' . '</span>';
} elseif ( $remove == true || $remove == '1' ) {
$data[removestat] = 'deleted';
$data[remove] = '<span style="color:red;">' . 'deleted' . '</span>';
$data['removestat'] = 'deleted';
$data['remove'] = '<span style="color:red;">' . 'deleted' . '</span>';
} else {
$data[removestat] = 'not deleted';
$data[remove] = '<span style="color:gray;">' . 'not deleted' . '</span>';
$data['removestat'] = 'not deleted';
$data['remove'] = '<span style="color:gray;">' . 'not deleted' . '</span>';
}

return $data;
Expand Down
46 changes: 23 additions & 23 deletions callback samples/callback_database.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ function callbackAction ($msgnum, $bounce_type, $email, $subject, $xheader, $rem
}

$displayData = prepData($email, $bounce_type, $remove);
$bounce_type = $displayData[bounce_type];
$emailName = $displayData[emailName];
$emailAddy = $displayData[emailAddy];
$remove = $displayData[remove];
$bounce_type = $displayData['bounce_type'];
$emailName = $displayData['emailName'];
$emailAddy = $displayData['emailAddy'];
$remove = $displayData['remove'];

echo $msgnum . ': ' . $rule_no . ' | ' . $rule_cat . ' | ' . $bounce_type . ' | ' . $remove . ' | ' . $email . ' | ' . $subject . "<br />\n";

Expand All @@ -48,44 +48,44 @@ function callbackAction ($msgnum, $bounce_type, $email, $subject, $xheader, $rem

/* Function to clean the data from the Callback Function for optimized display */
function prepData($email, $bounce_type, $remove) {
$data[bounce_type] = trim($bounce_type);
$data[email] = '';
$data[emailName] = '';
$data[emailAddy] = '';
$data[remove] = '';
$data['bounce_type'] = trim($bounce_type);
$data['email'] = '';
$data['emailName'] = '';
$data['emailAddy'] = '';
$data['remove'] = '';
if ( strstr($email,'<') ) {
$pos_start = strpos($email,'<');
$data[emailName] = trim(substr($email,0,$pos_start));
$data[emailAddy] = substr($email,$pos_start + 1);
$pos_end = strpos($data[emailAddy],'>');
$data['emailName'] = trim(substr($email,0,$pos_start));
$data['emailAddy'] = substr($email,$pos_start + 1);
$pos_end = strpos($data['emailAddy'],'>');
if ( $pos_end ) {
$data[emailAddy] = substr($data[emailAddy],0,$pos_end);
$data['emailAddy'] = substr($data['emailAddy'],0,$pos_end);
}
}

// replace the < and > able so they display on screen
$email = str_replace('<','&lt;',$email);
$email = str_replace('>','&gt;',$email);
$data[email] = $email;
$data['email'] = $email;

// account for legitimate emails that have no bounce type
if ( trim($bounce_type) == '' ) {
$data[bounce_type] = 'none';
$data['bounce_type'] = 'none';
}

// change the remove flag from true or 1 to textual representation
if ( stristr($remove,'moved') && stristr($remove,'hard') ) {
$data[removestat] = 'moved (hard)';
$data[remove] = '<span style="color:red;">' . 'moved (hard)' . '</span>';
$data['removestat'] = 'moved (hard)';
$data['remove'] = '<span style="color:red;">' . 'moved (hard)' . '</span>';
} elseif ( stristr($remove,'moved') && stristr($remove,'soft') ) {
$data[removestat] = 'moved (soft)';
$data[remove] = '<span style="color:gray;">' . 'moved (soft)' . '</span>';
$data['removestat'] = 'moved (soft)';
$data['remove'] = '<span style="color:gray;">' . 'moved (soft)' . '</span>';
} elseif ( $remove == true || $remove == '1' ) {
$data[removestat] = 'deleted';
$data[remove] = '<span style="color:red;">' . 'deleted' . '</span>';
$data['removestat'] = 'deleted';
$data['remove'] = '<span style="color:red;">' . 'deleted' . '</span>';
} else {
$data[removestat] = 'not deleted';
$data[remove] = '<span style="color:gray;">' . 'not deleted' . '</span>';
$data['removestat'] = 'not deleted';
$data['remove'] = '<span style="color:gray;">' . 'not deleted' . '</span>';
}

return $data;
Expand Down
46 changes: 23 additions & 23 deletions callback samples/callback_echo.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,54 @@
*/
function callbackAction ($msgnum, $bounce_type, $email, $subject, $xheader, $remove, $rule_no=false, $rule_cat=false, $totalFetched=0) {
$displayData = prepData($email, $bounce_type, $remove);
$bounce_type = $displayData[bounce_type];
$emailName = $displayData[emailName];
$emailAddy = $displayData[emailAddy];
$remove = $displayData[remove];
$bounce_type = $displayData['bounce_type'];
$emailName = $displayData['emailName'];
$emailAddy = $displayData['emailAddy'];
$remove = $displayData['remove'];
echo $msgnum . ': ' . $rule_no . ' | ' . $rule_cat . ' | ' . $bounce_type . ' | ' . $remove . ' | ' . $email . ' | ' . $subject . "<br />\n";
return true;
}

/* Function to clean the data from the Callback Function for optimized display */
function prepData($email, $bounce_type, $remove) {
$data[bounce_type] = trim($bounce_type);
$data[email] = '';
$data[emailName] = '';
$data[emailAddy] = '';
$data[remove] = '';
$data['bounce_type'] = trim($bounce_type);
$data['email'] = '';
$data['emailName'] = '';
$data['emailAddy'] = '';
$data['remove'] = '';
if ( strstr($email,'<') ) {
$pos_start = strpos($email,'<');
$data[emailName] = trim(substr($email,0,$pos_start));
$data[emailAddy] = substr($email,$pos_start + 1);
$pos_end = strpos($data[emailAddy],'>');
$data['emailName'] = trim(substr($email,0,$pos_start));
$data['emailAddy'] = substr($email,$pos_start + 1);
$pos_end = strpos($data['emailAddy'],'>');
if ( $pos_end ) {
$data[emailAddy] = substr($data[emailAddy],0,$pos_end);
$data['emailAddy'] = substr($data['emailAddy'],0,$pos_end);
}
}

// replace the < and > able so they display on screen
$email = str_replace('<','&lt;',$email);
$email = str_replace('>','&gt;',$email);
$data[email] = $email;
$data['email'] = $email;

// account for legitimate emails that have no bounce type
if ( trim($bounce_type) == '' ) {
$data[bounce_type] = 'none';
$data['bounce_type'] = 'none';
}

// change the remove flag from true or 1 to textual representation
if ( stristr($remove,'moved') && stristr($remove,'hard') ) {
$data[removestat] = 'moved (hard)';
$data[remove] = '<span style="color:red;">' . 'moved (hard)' . '</span>';
$data['removestat'] = 'moved (hard)';
$data['remove'] = '<span style="color:red;">' . 'moved (hard)' . '</span>';
} elseif ( stristr($remove,'moved') && stristr($remove,'soft') ) {
$data[removestat] = 'moved (soft)';
$data[remove] = '<span style="color:gray;">' . 'moved (soft)' . '</span>';
$data['removestat'] = 'moved (soft)';
$data['remove'] = '<span style="color:gray;">' . 'moved (soft)' . '</span>';
} elseif ( $remove == true || $remove == '1' ) {
$data[removestat] = 'deleted';
$data[remove] = '<span style="color:red;">' . 'deleted' . '</span>';
$data['removestat'] = 'deleted';
$data['remove'] = '<span style="color:red;">' . 'deleted' . '</span>';
} else {
$data[removestat] = 'not deleted';
$data[remove] = '<span style="color:gray;">' . 'not deleted' . '</span>';
$data['removestat'] = 'not deleted';
$data['remove'] = '<span style="color:gray;">' . 'not deleted' . '</span>';
}

return $data;
Expand Down
6 changes: 5 additions & 1 deletion class.phpmailer-bmh.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ function processMailbox($max=false) {
} else { // not standard DSN msg
$this->output( 'Msg #' . $x . ' is not a standard DSN message',VERBOSE_REPORT);
if ($this->debug_body_rule) {
$this->output( " Content-Type : {$match[1]}",VERBOSE_DEBUG);
if ($structure->ifdescription) {
$this->output( " Content-Type : {$structure->description}",VERBOSE_DEBUG);
} else {
$this->output( " Content-Type : unsupported",VERBOSE_DEBUG);
}
}
$processed = $this->processBounce($x,'BODY',$c_total);
}
Expand Down

0 comments on commit ba5a652

Please sign in to comment.