$maxkeysize = 0; foreach ($RESOLVE_REASONS as $v) { if (!$v['webonly']) { $actkeysize = strlen($v['title']) + 1; $maxkeysize = $maxkeysize < $actkeysize ? $actkeysize : $maxkeysize; } } foreach ($RESOLVE_REASONS as $k => $v) { if (!$v['webonly']) { $dev_extra .= str_pad("{$v['title']}:", $maxkeysize) . " {$site_method}://{$site_url}/fix.php?id={$cid}&r={$k}\n"; } } // mail to reporter bugs_mail($_POST['in']['email'], "{$type} #{$cid}: {$_POST['in']['sdesc']}", "{$ascii_report}2\n", "From: {$siteBig} Bug Database <{$mailfrom}>\n" . "X-PHP-Bug: {$cid}\n" . "X-PHP-Site: {$siteBig}\n" . "Message-ID: <bug-{$cid}@{$site_url}>"); // 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, $params); if ($redirectToPatchAdd) { $patchname = urlencode($_POST['in']['patchname']); $patchemail = urlencode($_POST['in']['email']); redirect("patch-add.php?bug_id={$cid}&patchname={$patchname}&email={$patchemail}"); } redirect("bug.php?id={$cid}&thanks=4"); } } else { // had errors... response_header('Report - Problems'); } } // end of if input $package = !empty($_REQUEST['package']) ? $_REQUEST['package'] : (!empty($package_name) ? $package_name : (isset($_POST['in']) && $_POST['in'] && isset($_POST['in']['package_name']) ? $_POST['in']['package_name'] : '')); if (!is_string($package)) {
/** * 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) { global $dbh, $siteBig, $site_method, $site_url, $bugEmail; $now = time(); $hash = crypt($email . $bug_id, $now); $query = "\n\t\tUPDATE bugdb_subscribe\n\t\tSET unsubscribe_date = '{$now}',\n\t\t\tunsubscribe_hash = ?\n\t\tWHERE bug_id = ? AND email = ?\n\t"; $affected = $dbh->prepare($query, null, MDB2_PREPARE_MANIP)->execute(array($hash, $bug_id, $email)); if ($affected > 0) { $hash = urlencode($hash); /* user text with attention, headers and previous messages */ $user_text = <<<USER_TEXT ATTENTION! Do NOT reply to this email! A request has been made to remove your subscription to {$siteBig} bug #{$bug_id} To view the bug in question please use this link: {$site_method}://{$site_url}{$basedir}/bug.php?id={$bug_id} To confirm the removal please use this link: {$site_method}://{$site_url}{$basedir}/bug.php?id={$bug_id}&unsubscribe=1&t={$hash} USER_TEXT; 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: <bug-{$bug_id}@{$site_url}>"); } }
if (empty($errors)) { $query = "SELECT email, passwd FROM bugdb WHERE id = '{$bug_id}'"; // Run the query $row = $dbh->prepare($query)->execute()->fetchRow(MDB2_FETCHMODE_ASSOC); if (is_null($row)) { $errors[] = "Invalid bug id provided: #{$bug_id}"; } else { if (empty($row['passwd'])) { $errors[] = "No password found for #{$bug_id} bug report, sorry."; } else { $new_passwd = bugs_gen_passwd(); $dbh->prepare('UPDATE bugdb SET passwd = ? WHERE id = ? ')->execute(array(bugs_get_hash($new_passwd), $bug_id)); $resp = bugs_mail($row['email'], "Password for {$siteBig} bug report #{$bug_id}", "The password for {$siteBig} bug report #{$bug_id} has been set to: {$new_passwd}", 'From: noreply@php.net'); if ($resp) { $success = "The password for bug report #{$bug_id} has been sent to " . spam_protect($row['email'], 'text'); } else { $errors[] = 'Sorry. Mail can not be sent at this time, please try again later.'; } } } } } response_header('Bug Report Password Finder'); echo "<h1>Bug Report Password Finder</h1>\n"; display_bug_error($errors); if ($success) { display_bug_success($success); }