Modified: pear/packages/Bugtracker/trunk/site/bug.php =================================================================== --- pear/packages/Bugtracker/trunk/site/bug.php 2009-08-13 11:04:22 UTC (rev 287209) +++ pear/packages/Bugtracker/trunk/site/bug.php 2009-08-13 11:09:00 UTC (rev 287210) @@ -1,30 +1,30 @@ 0) { - if ($_POST['captcha'] != $_SESSION['answer']) { - $errors = 'Incorrect Captcha'; - } - } + /** + * Check if session answer is set, then compare + * it with the post captcha value. If it's not + * the same, then it's an incorrect password. + */ + $errors = ''; + if (isset($_SESSION['answer']) && strlen(trim($_SESSION['answer'])) > 0) { + if ($_POST['captcha'] != $_SESSION['answer']) { + $errors = 'Incorrect Captcha'; + } + } - if (empty($errors)) { - if ($logged_in && $auth_user->registered && !empty($auth_user->email)) { - $email = $auth_user->email; - } else { - $email = isset($_POST['in']['commentemail']) ? $_POST['in']['commentemail'] : ''; - } - if ($email == '' || !is_valid_email($email)) { - $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 // Subscribe - { - $dbh->prepare('REPLACE INTO bugdb_subscribe SET bug_id = ?, email = ?')->execute(array($bug_id, $email)); - $thanks = 7; - } - localRedirect("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; + if (empty($errors)) { + if ($logged_in && $auth_user->registered && !empty($auth_user->email)) { + $email = $auth_user->email; + } else { + $email = isset($_POST['in']['commentemail']) ? $_POST['in']['commentemail'] : ''; + } + if ($email == '' || !is_valid_email($email)) { + $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 // Subscribe + { + $dbh->prepare('REPLACE INTO bugdb_subscribe SET bug_id = ?, email = ?')->execute(array($bug_id, $email)); + $thanks = 7; + } + localRedirect("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 ($edit == 1 && $is_trusted_developer && isset($_GET['delete_comment'])) { - $delete_comment = (int) $_GET['delete_comment']; - $addon = ''; + $delete_comment = (int) $_GET['delete_comment']; + $addon = ''; - if ($delete_comment) { - delete_comment($bug_id, $delete_comment); - $addon = '&thanks=1'; - } - localRedirect("bug.php?id=$bug_id&edit=1$addon"); + if ($delete_comment) { + delete_comment($bug_id, $delete_comment); + $addon = '&thanks=1'; + } + localRedirect("bug.php?id=$bug_id&edit=1$addon"); } // captcha is not necessary if the user is logged in if ($logged_in) { - unset($_SESSION['answer']); + unset($_SESSION['answer']); } else { - /** - * Numeral Captcha Class - */ - require_once 'Text/CAPTCHA/Numeral.php'; + require_once 'Text/CAPTCHA/Numeral.php'; + $numeralCaptcha = new Text_CAPTCHA_Numeral(); - /** - * Instantiate the numeral captcha object. - */ - $numeralCaptcha = new Text_CAPTCHA_Numeral(); + $captcha = $numeralCaptcha->getOperation(); + $_SESSION['answer'] = $numeralCaptcha->getAnswer(); } $trytoforce = isset($_POST['trytoforce']) ? (int) $_POST['trytoforce'] : 0; @@ -129,18 +125,18 @@ // DB error if (is_object($bug)) { - response_header('DB error'); - display_bug_error($bug); - response_footer(); - exit; + response_header('DB error'); + display_bug_error($bug); + response_footer(); + exit; } // Bug not found with passed id if (!$bug) { - response_header('No Such Bug'); - display_bug_error("No such bug #{$bug_id}"); - response_footer(); - exit; + response_header('No Such Bug'); + display_bug_error("No such bug #{$bug_id}"); + response_footer(); + exit; } // handle any updates, displaying errors if there were any @@ -156,156 +152,156 @@ Bug_DataObject::init(); if (isset($_POST['ncomment']) && !isset($_POST['preview']) && $edit == 3) { - // Submission of additional comment by others + // Submission of additional comment by others - /** - * Check if session answer is set, then compare - * it with the post captcha value. If it's not - * the same, then it's an incorrect password. - */ - if (isset($_SESSION['answer']) && strlen(trim($_SESSION['answer'])) > 0) { - if ($_POST['captcha'] != $_SESSION['answer']) { - $errors[] = 'Incorrect Captcha'; - } - } + /** + * Check if session answer is set, then compare + * it with the post captcha value. If it's not + * the same, then it's an incorrect password. + */ + if (isset($_SESSION['answer']) && strlen(trim($_SESSION['answer'])) > 0) { + if ($_POST['captcha'] != $_SESSION['answer']) { + $errors[] = 'Incorrect Captcha'; + } + } - // Defaults to '' if not logged in - $_POST['in']['handle'] = $auth_user->handle; + // Defaults to '' if not logged in + $_POST['in']['handle'] = $auth_user->handle; - $ncomment = trim($_POST['ncomment']); - if (!$ncomment) { - $errors[] = 'You must provide a comment.'; - } + $ncomment = trim($_POST['ncomment']); + if (!$ncomment) { + $errors[] = 'You must provide a comment.'; + } - if (!$errors) { - do { - if (!$logged_in) { + if (!$errors) { + do { + if (!$logged_in) { - if (!is_valid_email($_POST['in']['commentemail'])) { - $errors[] = 'You must provide a valid email address.'; - response_header('Add Comment - Problems'); - break; // skip bug comment addition - } + if (!is_valid_email($_POST['in']['commentemail'])) { + $errors[] = 'You must provide a valid email address.'; + response_header('Add Comment - Problems'); + break; // skip bug comment addition + } - $_POST['in']['name'] = ''; - } else { - $_POST['in']['commentemail'] = $auth_user->email; - $_POST['in']['handle'] = $auth_user->handle; - $_POST['in']['name'] = $auth_user->name; - } + $_POST['in']['name'] = ''; + } else { + $_POST['in']['commentemail'] = $auth_user->email; + $_POST['in']['handle'] = $auth_user->handle; + $_POST['in']['name'] = $auth_user->name; + } // FIXME: MDB2 changes '' into null? Need to pass handle like this because of it.. - $handle = $dbh->escape($_POST['in']['handle']); - $query = "INSERT INTO bugdb_comments (bug, email, handle, ts, comment, reporter_name) - VALUES (?, ?, '{$handle}', NOW(), ?, ?)"; - $res = $dbh->prepare($query)->execute(array( - $bug_id, - $_POST['in']['commentemail'], - $ncomment, - $_POST['in']['name'], - )); - } while (false); + $handle = $dbh->escape($_POST['in']['handle']); + $query = "INSERT INTO bugdb_comments (bug, email, handle, ts, comment, reporter_name) + VALUES (?, ?, '{$handle}', NOW(), ?, ?)"; + $res = $dbh->prepare($query)->execute(array( + $bug_id, + $_POST['in']['commentemail'], + $ncomment, + $_POST['in']['name'], + )); + } while (false); - if (isset($auth_user) && $auth_user) { - $from = $auth_user->email; - } else { - $from = ''; - } - } else { - $from = ''; - } + if (isset($auth_user) && $auth_user) { + $from = $auth_user->email; + } else { + $from = ''; + } + } else { + $from = ''; + } } elseif (isset($_POST['ncomment']) && isset($_POST['preview']) && $edit == 3) { - $ncomment = trim($_POST['ncomment']); - $from = spam_protect($_POST['in']['commentemail']); - + $ncomment = trim($_POST['ncomment']); + $from = spam_protect($_POST['in']['commentemail']); + } elseif (isset($_POST['in']) && !isset($_POST['preview']) && $edit == 2) { - // Edits submitted by original reporter for old bugs + // Edits submitted by original reporter for old bugs - if (!verify_bug_passwd($bug_id, $pw)) { - $errors[] = 'The password you supplied was incorrect.'; - } + if (!verify_bug_passwd($bug_id, $pw)) { + $errors[] = 'The password you supplied was incorrect.'; + } - $ncomment = trim($_POST['ncomment']); - if (!$ncomment) { - $errors[] = 'You must provide a comment.'; - } + $ncomment = trim($_POST['ncomment']); + if (!$ncomment) { + $errors[] = 'You must provide a comment.'; + } - /* check that they aren't being bad and setting a status they - aren't allowed to (oh, the horrors.) */ - if ($_POST['in']['status'] != $bug['status'] && $state_types[$_POST['in']['status']] != 2) { - $errors[] = 'You aren\'t allowed to change a bug to that state.'; - } + /* check that they aren't being bad and setting a status they + aren't allowed to (oh, the horrors.) */ + if ($_POST['in']['status'] != $bug['status'] && $state_types[$_POST['in']['status']] != 2) { + $errors[] = 'You aren\'t allowed to change a bug to that state.'; + } - /* check that they aren't changing the mail to a php.net address - (gosh, somebody might be fooled!) */ - if (preg_match('/^(.+)@php\.net/i', $_POST['in']['email'], $m)) { - if ($user != $m[1] || $logged_in != 'developer') { - $errors[] = 'You have to be logged in as a developer to use your php.net email address.'; - $errors[] = 'Tip: log in via another browser window then resubmit the form in this window.'; - } - } + /* check that they aren't changing the mail to a php.net address + (gosh, somebody might be fooled!) */ + if (preg_match('/^(.+)@php\.net/i', $_POST['in']['email'], $m)) { + if ($user != $m[1] || $logged_in != 'developer') { + $errors[] = 'You have to be logged in as a developer to use your php.net email address.'; + $errors[] = 'Tip: log in via another browser window then resubmit the form in this window.'; + } + } - if (!empty($_POST['in']['email']) && - $bug['email'] != $_POST['in']['email'] - ) { - $from = $_POST['in']['email']; - } else { - $from = $bug['email']; - } + if (!empty($_POST['in']['email']) && + $bug['email'] != $_POST['in']['email'] + ) { + $from = $_POST['in']['email']; + } else { + $from = $bug['email']; + } - if (!empty($_POST['in']['package_name']) && - $bug['package_name'] != $_POST['in']['package_name'] - ) { - // reset package version if we change package name - $_POST['in']['package_version'] = ''; - } + if (!empty($_POST['in']['package_name']) && + $bug['package_name'] != $_POST['in']['package_name'] + ) { + // reset package version if we change package name + $_POST['in']['package_version'] = ''; + } - if (!$errors && !($errors = incoming_details_are_valid($_POST['in'], false))) { - $dbh->prepare(" - UPDATE bugdb - SET - sdesc = ?, - status = ?, - package_name = ?, - bug_type = ?, - package_version = ?, - php_version = ?, - php_os = ?, - email = ?, - ts2 = NOW() - WHERE id={$bug_id} - ")->execute(array( - $_POST['in']['sdesc'], - $_POST['in']['status'], - $_POST['in']['package_name'], - $_POST['in']['bug_type'], - $_POST['in']['package_version'], - $_POST['in']['php_version'], - $_POST['in']['php_os'], - $from, - )); + if (!$errors && !($errors = incoming_details_are_valid($_POST['in'], false))) { + $dbh->prepare(" + UPDATE bugdb + SET + sdesc = ?, + status = ?, + package_name = ?, + bug_type = ?, + package_version = ?, + php_version = ?, + php_os = ?, + email = ?, + ts2 = NOW() + WHERE id={$bug_id} + ")->execute(array( + $_POST['in']['sdesc'], + $_POST['in']['status'], + $_POST['in']['package_name'], + $_POST['in']['bug_type'], + $_POST['in']['package_version'], + $_POST['in']['php_version'], + $_POST['in']['php_os'], + $from, + )); - if (!empty($ncomment)) { - $query = "INSERT INTO bugdb_comments (bug, email, ts, comment) - VALUES ({$bug_id}, ?, NOW(), ?)"; - $dbh->prepare($query)->execute(array($from, $ncomment)); - } - } + if (!empty($ncomment)) { + $query = "INSERT INTO bugdb_comments (bug, email, ts, comment) + VALUES ({$bug_id}, ?, NOW(), ?)"; + $dbh->prepare($query)->execute(array($from, $ncomment)); + } + } } elseif (isset($_POST['in']) && isset($_POST['preview']) && $edit == 2) { - $ncomment = trim($_POST['ncomment']); - $from = $_POST['in']['commentemail']; + $ncomment = trim($_POST['ncomment']); + $from = $_POST['in']['commentemail']; } elseif (isset($_POST['in']) && is_array($_POST['in']) && !isset($_POST['preview']) && $edit == 1) { - // Edits submitted by developer - if ($logged_in != 'developer') { - $errors[] = 'You have to login first in order to edit the bug report.'; - $errors[] = 'Tip: log in via another browser window then resubmit the form in this window.'; - } - $comment_name = $auth_user->name; - if (empty($_POST['ncomment'])) { - $ncomment = ''; - } else { - $ncomment = trim($_POST['ncomment']); - } + // Edits submitted by developer + if ($logged_in != 'developer') { + $errors[] = 'You have to login first in order to edit the bug report.'; + $errors[] = 'Tip: log in via another browser window then resubmit the form in this window.'; + } + $comment_name = $auth_user->name; + if (empty($_POST['ncomment'])) { + $ncomment = ''; + } else { + $ncomment = trim($_POST['ncomment']); + } /* Require comment for open bugs only */ if ($_POST['in']['status'] == 'Bogus' && !in_array($bug['status'], array ('Bogus', 'Closed', 'Duplicate', 'No feedback', 'Wont fix')) && @@ -328,197 +324,197 @@ } $_POST['in']['status'] = 'To be documented'; } elseif (!empty($_POST['in']['resolve'])) { - if (!$trytoforce && isset($RESOLVE_REASONS[$_POST['in']['resolve']]) && - $RESOLVE_REASONS[$_POST['in']['resolve']]['status'] == $bug['status']) - { - $errors[] = 'The bug is already marked "'.$bug['status'].'". (Submit again to ignore this.)'; - } elseif (!$errors) { - if ($_POST['in']['status'] == $bug['status']) { - $_POST['in']['status'] = $RESOLVE_REASONS[$_POST['in']['resolve']]['status']; + if (!$trytoforce && isset($RESOLVE_REASONS[$_POST['in']['resolve']]) && + $RESOLVE_REASONS[$_POST['in']['resolve']]['status'] == $bug['status']) + { + $errors[] = 'The bug is already marked "'.$bug['status'].'". (Submit again to ignore this.)'; + } elseif (!$errors) { + if ($_POST['in']['status'] == $bug['status']) { + $_POST['in']['status'] = $RESOLVE_REASONS[$_POST['in']['resolve']]['status']; } - if ($_POST['in']['status'] == 'Closed' && $bug['status'] == 'To be documented') { - $reason = $FIX_VARIATIONS['fixed']['Documentation problem']; + if ($_POST['in']['status'] == 'Closed' && $bug['status'] == 'To be documented') { + $reason = $FIX_VARIATIONS['fixed']['Documentation problem']; } elseif (isset($FIX_VARIATIONS) && isset($FIX_VARIATIONS[$_POST['in']['resolve']][$bug['package_name']])) { - $reason = $FIX_VARIATIONS[$_POST['in']['resolve']][$bug['package_name']]; - } else { - $reason = isset($RESOLVE_REASONS[$_POST['in']['resolve']]) ? $RESOLVE_REASONS[$_POST['in']['resolve']]['message'] : ''; - } + $reason = $FIX_VARIATIONS[$_POST['in']['resolve']][$bug['package_name']]; + } else { + $reason = isset($RESOLVE_REASONS[$_POST['in']['resolve']]) ? $RESOLVE_REASONS[$_POST['in']['resolve']]['message'] : ''; + } - // do a replacement on @svn@ to the likely location of SVN for this package - if ($_POST['in']['resolve'] == 'trysvn') { - switch ($bug['package_name']) { - case 'Documentation' : - case 'Web Site' : - case 'Bug System' : - case 'PEPr' : - $errors[] = 'Cannot use "try svn" with ' . $bug['package_name']; - break; - case 'PEAR' : - $reason = str_replace('@svn@', 'pear-core', $reason); - $ncomment = "$reason\n\n$ncomment"; - break; - default : - $reason = str_replace('@svn@', $bug['package_name'], $reason); - $ncomment = "$reason\n\n$ncomment"; - break; - } - } else { - $ncomment = "$reason\n\n$ncomment"; - } - } - } + // do a replacement on @svn@ to the likely location of SVN for this package + if ($_POST['in']['resolve'] == 'trysvn') { + switch ($bug['package_name']) { + case 'Documentation' : + case 'Web Site' : + case 'Bug System' : + case 'PEPr' : + $errors[] = 'Cannot use "try svn" with ' . $bug['package_name']; + break; + case 'PEAR' : + $reason = str_replace('@svn@', 'pear-core', $reason); + $ncomment = "$reason\n\n$ncomment"; + break; + default : + $reason = str_replace('@svn@', $bug['package_name'], $reason); + $ncomment = "$reason\n\n$ncomment"; + break; + } + } else { + $ncomment = "$reason\n\n$ncomment"; + } + } + } - $from = $auth_user->email; + $from = $auth_user->email; - if (!$errors && !($errors = incoming_details_are_valid($_POST['in']))) { - $query = 'UPDATE bugdb SET'; + if (!$errors && !($errors = incoming_details_are_valid($_POST['in']))) { + $query = 'UPDATE bugdb SET'; - // Update email only if it's passed - if ($bug['email'] != $_POST['in']['email'] && !empty($_POST['in']['email'])) - { - $query .= " email='{$_POST['in']['email']}',"; - } + // Update email only if it's passed + if ($bug['email'] != $_POST['in']['email'] && !empty($_POST['in']['email'])) + { + $query .= " email='{$_POST['in']['email']}',"; + } - if ($logged_in != 'developer') { - // don't reset assigned status - $_POST['in']['assign'] = $bug['assign']; - } - if (!empty($_POST['in']['assign']) && $_POST['in']['status'] == 'Open') { - $status = 'Assigned'; - } elseif (empty($_POST['in']['assign']) && $_POST['in']['status'] == 'Assigned') { - $status = 'Open'; - } else { - $status = $_POST['in']['status']; - } + if ($logged_in != 'developer') { + // don't reset assigned status + $_POST['in']['assign'] = $bug['assign']; + } + if (!empty($_POST['in']['assign']) && $_POST['in']['status'] == 'Open') { + $status = 'Assigned'; + } elseif (empty($_POST['in']['assign']) && $_POST['in']['status'] == 'Assigned') { + $status = 'Open'; + } else { + $status = $_POST['in']['status']; + } - if ($status == 'Closed' && $_POST['in']['assign'] == '') { - $_POST['in']['assign'] = $auth_user->handle; - } + if ($status == 'Closed' && $_POST['in']['assign'] == '') { + $_POST['in']['assign'] = $auth_user->handle; + } - if (!empty($_POST['in']['package_name']) && - $bug['package_name'] != $_POST['in']['package_name']) { - // reset package version if we change package name - $_POST['in']['package_version'] = ''; - } + if (!empty($_POST['in']['package_name']) && + $bug['package_name'] != $_POST['in']['package_name']) { + // reset package version if we change package name + $_POST['in']['package_version'] = ''; + } - $dbh->prepare($query .= " - sdesc = ?, - status = ?, - package_name = ?, - bug_type = ?, - assign = ?, - package_version = ?, - php_version = ?, - php_os = ?, - ts2=NOW() WHERE id = {$bug_id} - ")->execute(array ( - $_POST['in']['sdesc'], - $status, - $_POST['in']['package_name'], - $_POST['in']['bug_type'], - $_POST['in']['assign'], - !empty($_POST['in']['package_version']) ? $_POST['in']['package_version'] : '', - $_POST['in']['php_version'], - $_POST['in']['php_os'], - )); + $dbh->prepare($query .= " + sdesc = ?, + status = ?, + package_name = ?, + bug_type = ?, + assign = ?, + package_version = ?, + php_version = ?, + php_os = ?, + ts2=NOW() WHERE id = {$bug_id} + ")->execute(array ( + $_POST['in']['sdesc'], + $status, + $_POST['in']['package_name'], + $_POST['in']['bug_type'], + $_POST['in']['assign'], + !empty($_POST['in']['package_version']) ? $_POST['in']['package_version'] : '', + $_POST['in']['php_version'], + $_POST['in']['php_os'], + )); - $changed = bug_diff($bug, $_POST['in']); - if (!empty($changed)) { - $log_comment = bug_diff_render_html($changed); - } + $changed = bug_diff($bug, $_POST['in']); + if (!empty($changed)) { + $log_comment = bug_diff_render_html($changed); + } - if (!empty($log_comment)) { - $dbh->prepare(" - INSERT INTO bugdb_comments (bug, email, ts, comment, reporter_name, handle, comment_type) - VALUES (?, ?, NOW(), ?, ?, ?, 'log') - ")->execute(array ($bug_id, $from, $log_comment, $comment_name, $auth_user->handle)); - } + if (!empty($log_comment)) { + $dbh->prepare(" + INSERT INTO bugdb_comments (bug, email, ts, comment, reporter_name, handle, comment_type) + VALUES (?, ?, NOW(), ?, ?, ?, 'log') + ")->execute(array ($bug_id, $from, $log_comment, $comment_name, $auth_user->handle)); + } - if (!empty($ncomment)) { - $dbh->prepare(" - INSERT INTO bugdb_comments (bug, email, ts, comment, reporter_name, handle, comment_type) - VALUES (?, ?, NOW(), ?, ?, ?, 'comment') - ")->execute(array ($bug_id, $from, $ncomment, $comment_name, $auth_user->handle)); - } - } + if (!empty($ncomment)) { + $dbh->prepare(" + INSERT INTO bugdb_comments (bug, email, ts, comment, reporter_name, handle, comment_type) + VALUES (?, ?, NOW(), ?, ?, ?, 'comment') + ")->execute(array ($bug_id, $from, $ncomment, $comment_name, $auth_user->handle)); + } + } } elseif (isset($_POST['in']) && isset($_POST['preview']) && $edit == 1) { - $ncomment = trim($_POST['ncomment']); - $from = $auth_user->email; + $ncomment = trim($_POST['ncomment']); + $from = $auth_user->email; } elseif (isset($_POST['in'])) { - $errors[] = 'Invalid edit mode.'; - $ncomment = ''; + $errors[] = 'Invalid edit mode.'; + $ncomment = ''; } else { - $ncomment = ''; + $ncomment = ''; } if (isset($_POST['in']) && (!isset($_POST['preview']) && $ncomment || $previous != $current)) { - if (!$errors) { - if (!isset($buggie)) { - mail_bug_updates($bug, $_POST['in'], $from, $ncomment, $edit, $bug_id, $previous, $current); - } - localRedirect("bug.php?id=$bug_id&thanks=$edit"); - exit; - } + if (!$errors) { + if (!isset($buggie)) { + mail_bug_updates($bug, $_POST['in'], $from, $ncomment, $edit, $bug_id, $previous, $current); + } + localRedirect("bug.php?id=$bug_id&thanks=$edit"); + exit; + } } switch (txfield('bug_type', $bug, isset($_POST['in']) ? $_POST['in'] : null)) { - case 'Feature/Change Request': - $bug_type = 'Request'; - break; - case 'Documentation Problem': - $bug_type = 'Doc Bug'; - break; - default: - case 'Bug': - $bug_type = 'Bug'; - break; + case 'Feature/Change Request': + $bug_type = 'Request'; + break; + case 'Documentation Problem': + $bug_type = 'Doc Bug'; + break; + default: + case 'Bug': + $bug_type = 'Bug'; + break; } response_header( - "{$bug_type} #{$bug_id} :: " . htmlspecialchars($bug['sdesc']), - " - - - - " + "{$bug_type} #{$bug_id} :: " . htmlspecialchars($bug['sdesc']), + " + + + + " ); // DISPLAY BUG $thanks = (isset($_GET['thanks'])) ? (int) $_GET['thanks'] : 0; switch ($thanks) { - case 1: - case 2: - display_bug_success('The bug was updated successfully.'); - break; - case 3: - display_bug_success('Your comment was added to the bug successfully.'); - break; - case 4: - $bug_url = "http://{$site_url}{$basedir}/bug.php?id={$bug_id}"; - display_bug_success(" - Thank you for your help! - If the status of the bug report you submitted changes, you will be notified. - You may return here and check the status or update your report at any time.
- The URL for your bug report is: {$bug_url}. - "); - break; - case 6: - display_bug_success('Thanks for voting! Your vote should be reflected in the statistics below.'); - break; - case 7: - display_bug_success('Your subscribe request has been processed.'); - break; - case 8: - display_bug_success('Your unsubscribe request has been processed, please check your email.'); - break; - case 9: - display_bug_success('You have successfully unsubscribed.'); - break; + case 1: + case 2: + display_bug_success('The bug was updated successfully.'); + break; + case 3: + display_bug_success('Your comment was added to the bug successfully.'); + break; + case 4: + $bug_url = "http://{$site_url}{$basedir}/bug.php?id={$bug_id}"; + display_bug_success(" + Thank you for your help! + If the status of the bug report you submitted changes, you will be notified. + You may return here and check the status or update your report at any time.
+ The URL for your bug report is: {$bug_url}. + "); + break; + case 6: + display_bug_success('Thanks for voting! Your vote should be reflected in the statistics below.'); + break; + case 7: + display_bug_success('Your subscribe request has been processed.'); + break; + case 8: + display_bug_success('Your unsubscribe request has been processed, please check your email.'); + break; + case 9: + display_bug_success('You have successfully unsubscribed.'); + break; - default: - break; + default: + break; } display_bug_error($errors); @@ -537,15 +533,15 @@ - - - - - - - - -
Votes:
Avg. Score:
Reproduced:
Same Version:
Same OS:
+ + + + + + + + +
Votes:
Avg. Score:
Reproduced:
Same Version:
Same OS:
@@ -590,47 +586,47 @@
- Have you experienced this issue? -
- - - -
+ Have you experienced this issue? +
+ + + +
- Rate the importance of this bug to you: -
- - - - - - - -
+ Rate the importance of this bug to you: +
+ + + + + + + +
@@ -646,75 +642,75 @@ // if (isset($_POST['preview']) && !empty($ncomment)) { - $preview = '
'; - $preview .= "[" . format_date(time()) . "] "; - $preview .= spam_protect(htmlspecialchars($from)); - $preview .= "\n
";
-    $comment = wordwrap($ncomment, 72);
-    $preview .= make_ticket_links(addlinks($comment));
-    $preview .= "
\n"; - $preview .= '
'; + $preview = '
'; + $preview .= "[" . format_date(time()) . "] "; + $preview .= spam_protect(htmlspecialchars($from)); + $preview .= "\n
";
+	$comment = wordwrap($ncomment, 72);
+	$preview .= make_ticket_links(addlinks($comment));
+	$preview .= "
\n"; + $preview .= '
'; } else { - $preview = ''; + $preview = ''; } if ($edit == 1 || $edit == 2) { ?> - + -
- Welcome back! Since you opted to store your bug's password in a - cookie, you can just go ahead and add more information to this - bug or edit the other fields. -
+ if (!isset($_POST['in']) && $pw && verify_bug_passwd($bug['id'], $pw)) { ?> +
+ Welcome back! Since you opted to store your bug's password in a + cookie, you can just go ahead and add more information to this + bug or edit the other fields. +
-
- - Welcome back! If you're the original bug submitter, here's - where you can edit the bug or add additional notes. If this - is not your bug, you can add a comment by following this link. - If this is your bug, but you forgot your password, you can retrieve your password here. - +
+ + Welcome back! If you're the original bug submitter, here's + where you can edit the bug or add additional notes. If this + is not your bug, you can add a comment by following this link. + If this is your bug, but you forgot your password, you can retrieve your password here. + - - - - - - - -
Password: - - - - - /> -
-
+ + + + + + + +
Password: + + + + + /> +
+
-
- Welcome back, ! (Not ? - Log out.) -
+
+ Welcome back, ! (Not ? + Log out.) +
-
+
- + - Welcome! If you don't have a SVN account, you can't do anything here.
- You can add a comment by following this link - or if you reported this bug, you can edit this bug over here. + Welcome! If you don't have a SVN account, you can't do anything here.
+ You can add a comment by following this link + or if you reported this bug, you can edit this bug over here.
@@ -723,186 +719,185 @@ />
- + -
+
- + - +
- - - + + - + (description) + + - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - +
+ + + - - - + + + - (description) -
Status:> - +
Status:> + - Assign to: - + Assign to: + - - - -
Package: - -
Bug Type: - -
Summary: - -
From: - -
New email: - -
PHP Version: - - OS: - -
+ + + + + + + Package: + + + + + + Bug Type: + + + + + + Summary: + + + + + + From: + + + + + + New email: + + + + + + PHP Version: + + + + OS: + + + + + -

- -

+

+ +

- + -

-   -

- +

+   +

+ -
+ - + -
- Anyone can comment on a bug. Have a simpler test case? Does it - work for you on a different platform? Let us know!
- Just going to say 'Me too!'? Don't clutter the database with that please +
+ Anyone can comment on a bug. Have a simpler test case? Does it + work for you on a different platform? Let us know!
+ Just going to say 'Me too!'? Don't clutter the database with that please vote on the bug'; - } + if (canvote($thanks, $bug['status'])) { + echo ' — but make sure to vote on the bug'; + } ?>! -
+
- - - - - - - - - - getAnswer(); ?> - - - - -
Your email address:
- MUST BE VALID
- -
Solve the problem : getOperation(); ?> = ?
Subscribe to this entry? - - - - -
+ + + + + + + + + + + + + +
Your email address:
+ MUST BE VALID
+ +
Solve the problem:
= ?
Subscribe to this entry? +
+ + +
+
-
- - - -
  -
+
+ + + +
  +
- + @@ -910,7 +905,7 @@ // Display original report if ($bug['ldesc']) { - output_note(0, $bug['submitted'], $bug['email'], $bug['ldesc'], 'comment', $bug['bughandle'], $bug['reporter_name']); + output_note(0, $bug['submitted'], $bug['email'], $bug['ldesc'], 'comment', $bug['bughandle'], $bug['reporter_name']); } // Display patches @@ -924,8 +919,8 @@ foreach ($p as $name => $revisions) { - $obsolete = $patches->getObsoletingPatches($bug_id, $name, $revisions[0][0]); - $style = !empty($obsolete) ? ' style="background-color: yellow; text-decoration: line-through;" ' : ''; + $obsolete = $patches->getObsoletingPatches($bug_id, $name, $revisions[0][0]); + $style = !empty($obsolete) ? ' style="background-color: yellow; text-decoration: line-through;" ' : ''; // ?>> (last revision by )
History', + echo '

History

', "
- All + All Comments - Changes - SVN commits + Changes + SVN commits
"; echo "
\n"; - foreach ($bug_comments as $row) { - output_note($row['id'], $row['added'], $row['email'], $row['comment'], $row['comment_type'], ($row['bughandle'] ? $row['bughandle'] : $row['handle']), $row['comment_name']); - } - echo "
\n"; + foreach ($bug_comments as $row) { + output_note($row['id'], $row['added'], $row['email'], $row['comment'], $row['comment_type'], ($row['bughandle'] ? $row['bughandle'] : $row['handle']), $row['comment_name']); + } + echo "\n"; } if($bug_id == 'PREVIEW'): ?> @@ -998,26 +993,26 @@ */ function output_note($com_id, $ts, $email, $comment, $comment_type, $handle, $comment_name) { - global $edit, $bug_id, $dbh, $is_trusted_developer, $logged_in; + global $edit, $bug_id, $dbh, $is_trusted_developer, $logged_in; - $display = ($comment_type == 'comment') ? '' : 'style="display:none;"'; - echo "
"; - echo ' '; - echo "[" , format_date($ts) , "] "; - echo spam_protect(htmlspecialchars($email)) , "\n"; + $display = ($comment_type == 'comment') ? '' : 'style="display:none;"'; + echo "
"; + echo ' '; + echo "[" , format_date($ts) , "] "; + echo spam_protect(htmlspecialchars($email)) , "\n"; - switch ($comment_type) - { - case 'log': - echo "
{$comment}
"; - break; + switch ($comment_type) + { + case 'log': + echo "
{$comment}
"; + break; - default: - // Delete comment action only for trusted developers - echo ($edit == 1 && $com_id !== 0 && $is_trusted_developer) ? "[delete]\n" : ''; + default: + // Delete comment action only for trusted developers + echo ($edit == 1 && $com_id !== 0 && $is_trusted_developer) ? "[delete]\n" : ''; - $comment = make_ticket_links(addlinks($comment)); - echo "
{$comment}\n
\n"; + $comment = make_ticket_links(addlinks($comment)); + echo "
{$comment}\n
\n"; } echo '
'; @@ -1025,26 +1020,26 @@ function delete_comment($bug_id, $com_id) { - global $dbh; - - $res = $dbh->prepare("DELETE FROM bugdb_comments WHERE bug='{$bug_id}' AND id='{$com_id}'")->execute(); + global $dbh; + + $res = $dbh->prepare("DELETE FROM bugdb_comments WHERE bug='{$bug_id}' AND id='{$com_id}'")->execute(); } function control($num, $desc) { - global $bug_id, $edit; + global $bug_id, $edit; - echo "'; - echo $desc; - } else { - echo "'>{$desc}"; - } - echo "\n"; + echo "'; + echo $desc; + } else { + echo "'>{$desc}"; + } + echo "\n"; } function canvote($thanks, $status) { - return ($thanks != 4 && $thanks != 6 && $status != 'Closed' && $status != 'Bogus' && $status != 'Duplicate'); + return ($thanks != 4 && $thanks != 6 && $status != 'Closed' && $status != 'Bogus' && $status != 'Duplicate'); } Modified: pear/packages/Bugtracker/trunk/site/patch-add.php =================================================================== --- pear/packages/Bugtracker/trunk/site/patch-add.php 2009-08-13 11:04:22 UTC (rev 287209) +++ pear/packages/Bugtracker/trunk/site/patch-add.php 2009-08-13 11:09:00 UTC (rev 287210) @@ -37,6 +37,9 @@ } else { require_once 'Text/CAPTCHA/Numeral.php'; $numeralCaptcha = new Text_CAPTCHA_Numeral(); + + $captcha = $numeralCaptcha->getOperation(); + $_SESSION['answer'] = $numeralCaptcha->getAnswer(); } require_once "{$ROOT_DIR}/include/classes/bug_patchtracker.php"; @@ -56,7 +59,6 @@ $name = $_POST['name']; $patches = $patchinfo->listPatches($bug_id); $errors[] = 'No patch name entered'; - $captcha = $numeralCaptcha->getOperation(); include "{$ROOT_DIR}/templates/addpatch.php"; exit; } @@ -96,8 +98,6 @@ $patches = $patchinfo->listPatches($bug_id); $errors[] = $e->getMessage(); $errors[] = 'Could not attach patch "' . htmlspecialchars($_POST['name']) . '" to Bug #' . $bug_id; - $captcha = $numeralCaptcha->getOperation(); - $_SESSION['answer'] = $numeralCaptcha->getAnswer(); include "{$ROOT_DIR}/templates/addpatch.php"; exit; } @@ -110,8 +110,6 @@ } $name = $_POST['name']; $patches = $patchinfo->listPatches($bug_id); - $captcha = $numeralCaptcha->getOperation(); - $_SESSION['answer'] = $numeralCaptcha->getAnswer(); include "{$ROOT_DIR}/templates/addpatch.php"; exit; } @@ -130,9 +128,6 @@ 'Could not attach patch "' . htmlspecialchars($_POST['name']) . '" to Bug #' . $bug_id); - $captcha = $numeralCaptcha->getOperation(); - $_SESSION['answer'] = $numeralCaptcha->getAnswer(); - include "{$ROOT_DIR}/templates/addpatch.php"; exit; } @@ -191,12 +186,9 @@ } - $email = isset($_GET['email']) ? $_GET['email'] : ''; $errors = array(); $name = isset($_GET['patch']) ? $_GET['patch'] : ''; $patches = $patchinfo->listPatches($bug); -$captcha = $numeralCaptcha->getOperation(); -$_SESSION['answer'] = $numeralCaptcha->getAnswer(); include "{$ROOT_DIR}/templates/addpatch.php"; Modified: pear/packages/Bugtracker/trunk/site/report.php =================================================================== --- pear/packages/Bugtracker/trunk/site/report.php 2009-08-13 11:04:22 UTC (rev 287209) +++ pear/packages/Bugtracker/trunk/site/report.php 2009-08-13 11:09:00 UTC (rev 287210) @@ -24,6 +24,9 @@ } else { require_once 'Text/CAPTCHA/Numeral.php'; $numeralCaptcha = new Text_CAPTCHA_Numeral(); + + $captcha = $numeralCaptcha->getOperation(); + $_SESSION['answer'] = $numeralCaptcha->getAnswer(); } // Handle input @@ -432,16 +435,12 @@ -getOperation(); - $_SESSION['answer'] = $numeralCaptcha->getAnswer(); -?> + - Solve the problem : = ? + Solve the problem:
= ? - Summary: Modified: pear/packages/Bugtracker/trunk/templates/addpatch.php =================================================================== --- pear/packages/Bugtracker/trunk/templates/addpatch.php 2009-08-13 11:04:22 UTC (rev 287209) +++ pear/packages/Bugtracker/trunk/templates/addpatch.php 2009-08-13 11:09:00 UTC (rev 287210) @@ -30,7 +30,7 @@ - Solve the problem : = ? + Solve the problem:
= ?