cvs: pearweb /public_html/bugs/include functions.inc
| From: | Greg Beaver | Date: | Tue, 14 Mar 2006 04:36:48 +0000 |
| Subject: | cvs: pearweb /public_html/bugs/include functions.inc | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-4626@lists.php.net to get a copy of this message | ||
cellog Tue Mar 14 04:36:48 2006 UTC
Modified files:
/pearweb/public_html/bugs/include functions.inc
Log:
http://cvs.php.net/viewcvs.cgi/pearweb/public_html/bugs/include/functions.inc?r1=1.101&r2=1.102&diff_format=u
Index: pearweb/public_html/bugs/include/functions.inc
diff -u pearweb/public_html/bugs/include/functions.inc:1.101
pearweb/public_html/bugs/include/functions.inc:1.102
--- pearweb/public_html/bugs/include/functions.inc:1.101 Fri Feb 24 00:34:08 2006
+++ pearweb/public_html/bugs/include/functions.inc Tue Mar 14 04:36:48 2006
@@ -15,7 +15,7 @@
* @package Bugs
* @copyright Copyright (c) 1997-2005 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version $Id: functions.inc,v 1.101 2006/02/24 00:34:08 pajoye Exp $
+ * @version $Id: functions.inc,v 1.102 2006/03/14 04:36:48 cellog Exp $
*/
@@ -459,7 +459,7 @@
if (!$use && $current) {
echo '<option selected="selected">' . $current .
"</option>\n";
} else {
- echo '<option>CVS</option>' . "\n";
+ echo '<option>CVS</option>' . "\n";
}
echo '<option value="earlier">Earlier? Upgrade first!</option>'
. "\n";
echo "</select>\n";
@@ -667,7 +667,7 @@
*
* @return void
*/
-function mail_bug_updates($bug, $in, $from, $ncomment, $edit = 1, $id)
+function mail_bug_updates($bug, $in, $from, $ncomment, $edit = 1)
{
global $tla, $types, $site, $siteBig;
@@ -675,7 +675,7 @@
$headers = array();
/* Default addresses */
- list($mailto,$mailfrom, $Bcc) =
get_package_mail(oneof($in['package_name'],$bug['package_name']), $id);
+ list($mailto,$mailfrom) =
get_package_mail(oneof($in['package_name'],$bug['package_name']));
/* Get rid of slashes in bug status */
$bug['status'] = rinse($bug['status']);
@@ -683,18 +683,18 @@
$headers[] = array(" ID", $bug['id']);
switch ($edit) {
- case 3:
- $from = spam_protect(rinse($in['commentemail']), 'text');
- $headers[] = array(" Comment by", $from);
- $from = "\"$from\" <$mailfrom>";
- break;
- case 2:
- $from = spam_protect(txfield('email'), 'text');
- $headers[] = array(" User updated by", $from);
- $from = "\"$from\" <$mailfrom>";
- break;
- default:
- $headers[] = array(" Updated by", $from);
+ case 3:
+ $from = spam_protect(rinse($in['commentemail']), 'text');
+ $headers[] = array(" Comment by", $from);
+ $from = "\"$from\" <$mailfrom>";
+ break;
+ case 2:
+ $from = spam_protect(txfield('email'), 'text');
+ $headers[] = array(" User updated by", $from);
+ $from = "\"$from\" <$mailfrom>";
+ break;
+ default:
+ $headers[] = array(" Updated by", $from);
}
if (changed('sdesc')) {
@@ -802,12 +802,10 @@
"[$siteBig-BUG] " . rinse($subj) . txfield('sdesc'),
$user_text,
"From: $siteBig Bug Database <$mailfrom>\n".
- "Bcc: $Bcc\n" .
"X-PHP-Bug: $bug[id]\n".
"In-Reply-To: <bug-$bug[id]@$site.php.net>",
"-fbounces-ignored@php.net");
# but we go ahead and let the default sender get used for the list
-
@mail($mailto,
"[$siteBig-BUG] " . rinse($subj) . txfield('sdesc'),
$dev_text,
@@ -1007,9 +1005,9 @@
*
* @return array an array of eamil addresses
*/
-function get_package_mail($package_name, $bug_id=false)
+function get_package_mail($package_name)
{
- global $site, $bugEmail, $dbh;
+ global $site, $bugEmail;
// XXX Change to pear-bugs when it gets opened
//$to[] = "pear-dev@lists.php.net";
@@ -1026,23 +1024,10 @@
$to = array();
foreach ($maintainers as $data) {
- if (!$data['active']) {
- continue;
- }
$to[] = $data['email'];
}
- /* subscription */
- if ($bug_id) {
- $bug_id = (int)$bug_id;
-
- $bcc = $dbh->getCol('SELECT email FROM bugdb_subscribe WHERE bug_id=' .
$bug_id);
- $bcc = array_diff($bcc, $to);
- $bcc = array_unique($bcc);
- return array(implode(', ', $to), $bugEmail, implode(', ', $bcc));
- } else {
- return array(implode(', ', $to), $bugEmail);
- }
+ return array(implode(', ', $to), $bugEmail);
}
/**
@@ -1158,93 +1143,4 @@
echo "\n\n<!-- END BUG NAV -->\n\n";
}
-/**
- * Send the confirmation mail to confirm a subscription removal
- *
- * @param integer bug ID
- * @param string email to remove
- * @param array bug data
- *
- * @return void
- */
- function unsubscribe_hash($bug_id, $email, $bug)
- {
- global $dbh, $siteBig, $site;
-
- $now = time();
- $hash = crypt($email . $id, $now);
- $bug_id = (int)$bug_id;
-
- $query = 'UPDATE bugdb_subscribe
- SET unsubscribe_date=' . $now . ',
- unsubscribe_hash=' . "'" . escapeSQL($hash) .
"'" .
- ' WHERE bug_id=' . $bug_id . ' AND email=' ."'"
. escapeSQL($email) . "'";
-
- $res = $dbh->query($query);
-
- $affected = $dbh->affectedRows($res);
-
- if ($affected > 0) {
- $hash = urlencode($hash);
- /* user text with attention, headers and previous messages */
- $user_text = "ATTENTION! Do NOT reply to this email!\n\n" .
- "A request has been made to remove your subscription to\n" .
- "$siteBig bug #$bug_id ($bug[sdesc])\n\n" .
- "To confirm the removal please use this link:\n" .
- "http://$site.php.net/bugs/bug.php?id=$bug[id]&unsubscribe=1&t=$hash\n\n\n";
-
- @mail($email,
- "[$siteBig-BUG-unsubscribe] " . rinse($bug['sdesc']),
- $user_text,
- "From: $siteBig Bug Database <$mailfrom>\n".
- "X-PHP-Bug: $bug[id]\n".
- "In-Reply-To: <bug-$bug[id]@$site.php.net>",
- "-fbounces-ignored@php.net");
- }
-}
-
-
-/**
- * Remove a subscribtion
- *
- * @param integer bug ID
- * @param string hash
- *
- * @return void
- */
- function unsubscribe($bug_id, $hash)
- {
- global $dbh;
-
- $hash = escapeSQL($hash);
- $bug_id = (int) $bug_id;
-
- $query = 'SELECT
- bug_id, email, unsubscribe_date, unsubscribe_hash
- FROM
- bugdb_subscribe
- WHERE
- bug_id=' . $bug_id . '
- AND
- unsubscribe_hash=' . "'" . $hash . "'
- LIMIT 1";
-
- $sub = $dbh->getRow($query, DB_FETCHMODE_ASSOC);
-
- if (!$sub) {
- return false;
- }
-
- $now = time();
- $requested_on = $sub['unsubscribe_date'];
- /* 24hours delay to answer the mail */
- if (($now - $requested_on) > (24*60*60)) {
- return false;
- }
-
- $query = 'DELETE FROM bugdb_subscribe WHERE bug_id=' . $bug_id . '
- AND unsubscribe_hash=' . "'" . $hash . "'
- AND email='" . $sub['email'] . "'";
- $dbh->query($query);
- return true;
- }
+?>