$errors[] = 'Incorrect Captcha'; } } if (empty($errors)) { if ($logged_in && !empty($auth_user->email)) { $email = $auth_user->email; } else { $email = isset($_POST['in']['commentemail']) ? $_POST['in']['commentemail'] : ''; } if ($email == '' || !is_valid_email($email, $logged_in)) { $errors[] = 'You must provide a valid email address.'; } else { // Unsubscribe if (isset($_POST['unsubscribe_to_bug'])) { // Generate the hash unsubscribe_hash($bug_id, $email); $thanks = 8; } else { $dbh->prepare('REPLACE INTO bugdb_subscribe SET bug_id = ?, email = ?')->execute(array($bug_id, $email)); $thanks = 7; } redirect("bug.php?id={$bug_id}&thanks={$thanks}"); } } // If we get here, display errors response_header('Error in subscription'); display_bug_error($errors); response_footer(); exit; } // Delete comment
if (isset($_POST['unsubscribe_to_bug']) || isset($_POST['subscribe_to_bug'])) { if (isset($auth_user) && $auth_user && $auth_user->registered) { $email = $auth_user->email; } else { $email = $_POST['subscribe_email']; } if (!preg_match("/[.\\w+-]+@[.\\w-]+\\.\\w{2,}/i", $email)) { $errors[] = "You must provide a valid email address."; } else { if (isset($_POST['subscribe_to_bug'])) { $query = 'REPLACE INTO bugdb_subscribe SET bug_id = ?, email = ?'; $dbh->query($query, array($id, $email)); $thanks = 7; } elseif (isset($_POST['unsubscribe_to_bug'])) { /* Generate the hash */ unsubscribe_hash($id, $email, $bug); $thanks = 8; } localRedirect('bug.php?id=' . $id . '&thanks=' . $thanks); exit; } } // Redirect to PECL if it's a PECL bug if (!empty($bug['package_type']) && $bug['package_type'] != SITE) { SITE == 'pear' ? $redirect = 'pecl' : ($redirect = 'pear'); localRedirect('http://' . $redirect . '.php.net/bugs/bug.php?id=' . $id); exit; } // if the user is not registered, this might be spam, don't display if (!$bug['registered'] && !auth_check('pear.dev')) { response_header('User has not confirmed identity');