Modified: pear/packages/Bugtracker/trunk/include/functions.inc =================================================================== --- pear/packages/Bugtracker/trunk/include/functions.inc 2009-08-13 14:32:09 UTC (rev 287240) +++ pear/packages/Bugtracker/trunk/include/functions.inc 2009-08-13 14:40:41 UTC (rev 287241) @@ -876,36 +876,34 @@ $subj .= " #{$bug['id']} [{$tla[$bug['status']]}]: "; } - if (DEVBOX == false) { - // the user gets sent mail with an envelope sender that ignores bounces - @mail( - $bug['email'], - "[$siteBig-BUG] {$subj}" . txfield('sdesc', $bug, $in), - $user_text, - "From: $siteBig Bug Database <$mailfrom>\n". - "Bcc: $Bcc\n" . - "X-PHP-Bug: {$bug['id']}\n". - "In-Reply-To: ", - "-f bounces-ignored@php.net" - ); + // the user gets sent mail with an envelope sender that ignores bounces + bugs_mail( + $bug['email'], + "[$siteBig-BUG] {$subj}" . txfield('sdesc', $bug, $in), + $user_text, + "From: $siteBig Bug Database <$mailfrom>\n". + "Bcc: $Bcc\n" . + "X-PHP-Bug: {$bug['id']}\n". + "In-Reply-To: ", + "-f bounces-ignored@php.net" + ); - // but we go ahead and let the default sender get used for the list - @mail( - $mailto, - "[$siteBig-BUG] {$subj}" . txfield('sdesc', $bug, $in), - $dev_text, - "From: $from\n". - "X-PHP-Bug: {$bug['id']}\n". - "X-PHP-Type: " . (($edit != 3) ? $in['bug_type'] : $bug['bug_type']) . "\n" . - "X-PHP-Version: " . (($edit != 3) ? $in['php_version'] : $bug['php_version']) . "\n" . - "X-PHP-Category: " . (($edit != 3) ? $in['package_name'] : $bug['package_name']) . "\n" . - "X-PHP-OS: " . (($edit != 3) ? $in['php_os'] : $bug['php_os']) . "\n" . - "X-PHP-Status: {$new_status}\n" . - "X-PHP-Old-Status: {$old_status}\n" . - "In-Reply-To: ", - "-f bounces-ignored@php.net" - ); - } + // but we go ahead and let the default sender get used for the list + bugs_mail( + $mailto, + "[$siteBig-BUG] {$subj}" . txfield('sdesc', $bug, $in), + $dev_text, + "From: $from\n". + "X-PHP-Bug: {$bug['id']}\n". + "X-PHP-Type: " . (($edit != 3) ? $in['bug_type'] : $bug['bug_type']) . "\n" . + "X-PHP-Version: " . (($edit != 3) ? $in['php_version'] : $bug['php_version']) . "\n" . + "X-PHP-Category: " . (($edit != 3) ? $in['package_name'] : $bug['package_name']) . "\n" . + "X-PHP-OS: " . (($edit != 3) ? $in['php_os'] : $bug['php_os']) . "\n" . + "X-PHP-Status: {$new_status}\n" . + "X-PHP-Old-Status: {$old_status}\n" . + "In-Reply-To: ", + "-f bounces-ignored@php.net" + ); } /* if a developer assigns someone else, let that other person know about it */ @@ -918,18 +916,16 @@ return; } - if (DEVBOX == false) { - @mail( - $email, - $subj . txfield('sdesc', $bug, $in), - wordwrap($in['assign'] . " you have just been assigned to this bug by {$from}\n\n") . - $dev_text, - "From: {$from}\n". - "X-PHP-Bug: {$bug['id']}\n". - "In-Reply-To: ", - "-f bounces-ignored@php.net" - ); - } + bugs_mail( + $email, + $subj . txfield('sdesc', $bug, $in), + wordwrap($in['assign'] . " you have just been assigned to this bug by {$from}\n\n") . + $dev_text, + "From: {$from}\n". + "X-PHP-Bug: {$bug['id']}\n". + "In-Reply-To: ", + "-f bounces-ignored@php.net" + ); } } @@ -1036,8 +1032,7 @@ if (isset($pseudo_pkgs[$package_name])) { return true; } - $found = $dbh->prepare('SELECT count(name) FROM packages WHERE name = ?')->execute(array($package_name))->fetchOne(); - return ($found == 1) ? true : false; + return false; } /** @@ -1113,14 +1108,21 @@ { global $dbh, $bugEmail; - if (DEVBOX) { - return array ('root@localhost', 'root@localhost'); - } - $to = array(); /* Get package mailing list address */ - $list_email = $dbh->prepare("SELECT list_email FROM bugdb_pseudo_packages WHERE package_name = ? ")->execute(array($package_name))->fetchOne(); + $res = $dbh->prepare(' + SELECT list_email + FROM bugdb_pseudo_packages + WHERE name = ? + ')->execute(array($package_name)); + + if (PEAR::isError($res)) { + throw new Exception('SQL Error in get_package_name(): ' . $res->getMessage()); + } + + $list_email = $res->fetchOne(); + if ($list_email) { $to[] = $list_email; } else { // Fall back to default mailing list @@ -1234,13 +1236,15 @@ USER_TEXT; - @mail($email, - "[$siteBig-BUG-unsubscribe] #{$bug_id}", - $user_text, - "From: {$siteBig} Bug Database <{$bugEmail}>\n". - "X-PHP-Bug: {$bug_id}\n". - "In-Reply-To: ", - "-fbounces-ignored@php.net"); + bugs_mail( + $email, + "[$siteBig-BUG-unsubscribe] #{$bug_id}", + $user_text, + "From: {$siteBig} Bug Database <{$bugEmail}>\n". + "X-PHP-Bug: {$bug_id}\n". + "In-Reply-To: ", + "-fbounces-ignored@php.net" + ); } } @@ -1374,3 +1378,20 @@ return (bool) $dbh->prepare('SELECT 1 FROM bugdb WHERE id = ? AND passwd = ?')->execute(array($bug_id, $passwd))->fetchOne(); } + +/** + * Mailer function. When DEVBOX is defined, this only outputs the parameters as-is. + * + * @return bool + * + */ +function bugs_mail($to, $subject, $message, $headers = '', $parameters = '') +{ + if (DEVBOX === false) { + echo '
';
+		var_dump($to, $subject, $message, $headers, $parameters);
+		echo '
'; + return true; + } + return @mail($to, $subject, $message, $headers, $parameters); +} Modified: pear/packages/Bugtracker/trunk/site/patch-add.php =================================================================== --- pear/packages/Bugtracker/trunk/site/patch-add.php 2009-08-13 14:32:09 UTC (rev 287240) +++ pear/packages/Bugtracker/trunk/site/patch-add.php 2009-08-13 14:40:41 UTC (rev 287241) @@ -144,13 +144,8 @@ $query = ' INSERT INTO bugdb_comments ( - bug, - email, - ts, - comment, - comment_type, - reporter_name - ) VALUES (?, ?, NOW(), ?, "patch", ?) + bug, email, comment, reporter_name, comment_type, ts + ) VALUES (?, ?, ?, ?, "patch", NOW()) '; $res = $dbh->prepare($query)->execute(array( $bug_id, @@ -166,15 +161,14 @@ $extra_headers = "From: {$protected_email}\n"; $extra_headers .= "Message-ID: "; - if (!DEVBOX) { - @mail( - $mailto, - "[$siteBig-BUG] {$buginfo['bug_type']} #{$bug_id} [PATCH]: {$buginfo['sdesc']}", - $text, - $extra_headers, - '-f bounce-no-user@php.net' - ); - } + bugs_mail( + $mailto, + "[$siteBig-BUG] {$buginfo['bug_type']} #{$bug_id} [PATCH]: {$buginfo['sdesc']}", + $text, + $extra_headers, + '-f bounce-no-user@php.net' + ); + $name = $_POST['name']; $patches = $patchinfo->listPatches($bug_id); $errors = array(); Modified: pear/packages/Bugtracker/trunk/site/report.php =================================================================== --- pear/packages/Bugtracker/trunk/site/report.php 2009-08-13 14:32:09 UTC (rev 287240) +++ pear/packages/Bugtracker/trunk/site/report.php 2009-08-13 14:40:41 UTC (rev 287241) @@ -262,27 +262,25 @@ } } - if (!DEVBOX) { - // mail to reporter - @mail( - $_POST['in']['email'], - "[$siteBig-BUG] $type #$cid: {$_POST['in']['sdesc']}", - "{$ascii_report}2\n", - "From: $siteBig Bug Database <$mailfrom>\n" . - "X-PHP-Bug: $cid\n" . - "Message-ID: ", - '-f bounce-no-user@php.net' - ); + // mail to reporter + bugs_mail( + $_POST['in']['email'], + "[$siteBig-BUG] $type #$cid: {$_POST['in']['sdesc']}", + "{$ascii_report}2\n", + "From: $siteBig Bug Database <$mailfrom>\n" . + "X-PHP-Bug: $cid\n" . + "Message-ID: ", + '-f bounce-no-user@php.net' + ); - // mail to package mailing list - @mail( - $mailto, - "[$siteBig-BUG] $type #$cid [NEW]: {$_POST['in']['sdesc']}", - $ascii_report . "1\n-- \n{$dev_extra}", - $extra_headers, - '-f bounce-no-user@php.net' - ); - } + // mail to package mailing list + bugs_mail( + $mailto, + "[$siteBig-BUG] $type #$cid [NEW]: {$_POST['in']['sdesc']}", + $ascii_report . "1\n-- \n{$dev_extra}", + $extra_headers, + '-f bounce-no-user@php.net' + ); if ($redirectToPatchAdd) { $patchname = urlencode($_POST['in']['patchname']);