cvs: pearweb /public_html/bugs report.php

From: Date: Tue, 15 Jun 2004 14:36:53 +0000
Subject: cvs: pearweb /public_html/bugs report.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-20682@lists.php.net to get a copy of this message
danielc Tue Jun 15 10:36:53 2004 EDT Modified files: /pearweb/public_html/bugs report.php Log: * Coding standards. * Use rinse() rather than stripslashes() to account for magic quotes potentially being off. * Use style sheets.

http://cvs.php.net/diff.php/pearweb/public_html/bugs/report.php?r1=1.30&r2=1.31&ty=u Index: pearweb/public_html/bugs/report.php diff -u pearweb/public_html/bugs/report.php:1.30 pearweb/public_html/bugs/report.php:1.31 --- pearweb/public_html/bugs/report.php:1.30 Mon Jun 14 16:38:49 2004 +++ pearweb/public_html/bugs/report.php Tue Jun 15 10:36:53 2004 @@ -1,24 +1,37 @@ <?php /* vim: set noet ts=4 sw=4: : */ -// $Id: report.php,v 1.30 2004/06/14 20:38:49 danielc Exp $ +/** + * Procedures for reporting bugs + * + * See pearweb/sql/bugs.sql for the table layout. + * + * @category pearweb + * @package Bugs + * @version $Id: report.php,v 1.31 2004/06/15 14:36:53 danielc Exp $ + */ +/** + * Obtain needed files + */ require_once './include/prepend.inc'; require_once './include/cvs-auth.inc'; error_reporting(E_ALL ^ E_NOTICE); -/* When user submits a report, do a search and display the results before allowing -* them to continue */ - -if (isset($save) && isset($pw)) { # non-developers don't have $user set - setcookie("MAGIC_COOKIE",base64_encode("$user:$pw"),time()+3600*24*12,'/','.php.net'); +/* + * When user submits a report, + * do a search and display the results before allowing them to continue + */ +if (isset($save) && isset($pw)) { + // non-developers don't have $user set + setcookie('MAGIC_COOKIE', base64_encode("$user:$pw"), + time() + 3600 * 24 * 12, '/', '.php.net'); } + if (isset($MAGIC_COOKIE) && !isset($user) && !isset($pw)) { - list($user,$pw) = explode(":", base64_decode($MAGIC_COOKIE)); + list($user, $pw) = explode(':', base64_decode($MAGIC_COOKIE)); } -/* See bugs.sql for the table layout. */ - $errors = array(); if ($in) { if (!($errors = incoming_details_are_valid($_POST['in'], 1))) { @@ -27,11 +40,13 @@ $in['did_luser_search'] = 1; - /* search for a match using keywords from the subject */ - + // search for a match using keywords from the subject $sdesc = rinse($in['sdesc']); - /* if they are filing a feature request, only look for similar features */ + /* + * If they are filing a feature request, + * only look for similar features + */ $package_name = $in['package_name']; if ($package_name == 'Feature/Change Request') { $where_clause = "WHERE package_name = '$package_name'"; @@ -52,23 +67,30 @@ } else { response_header("Report - Confirm"); -?> -<p>Are you sure that you searched before you submitted your bug report? -We found the following bugs that seem to be similar to yours; please check them -before sumitting the report as they might contain the solution you are looking for. -</p> -<p>If you're sure that your report is a genuine bug that has not been reported before, -you can scroll down and click the submit button to really enter the details into our database. + ?> + +<p> + Are you sure that you searched before you submitted your bug report? We + found the following bugs that seem to be similar to yours; please check + them before sumitting the report as they might contain the solution you + are looking for. </p> +<p> + If you're sure that your report is a genuine bug that has not been reported + before, you can scroll down and click the submit button to really enter the + details into our database. +</p> <div class="warnings"> + <table class="lusersearch"> -<tr> -<td><b>Description</b></td> -<td><b>Possible Solution</b></td> -</tr> -<?php + <tr> + <th>Description</th> + <th>Possible Solution</th> + </tr> + + <?php while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) { @@ -82,46 +104,51 @@ $summary = $row['ldesc']; if (strlen($summary) > 256) { - $summary = htmlspecialchars(substr(trim($summary), 0, 256)) . " ..."; + $summary = htmlspecialchars(substr(trim($summary), + 0, 256)) . ' ...'; } else { $summary = htmlspecialchars($summary); } $bug_url = "/bugs/bug.php?id=$row[id]&amp;edit=2"; - echo "<tr><td colspan=\"2\"><a href=\"$bug_url\">Bug #" . $row['id'] . ": " . htmlspecialchars($row['sdesc']) . "</a></td></tr>"; - echo "<tr><td>" . $summary . "</td>"; - - echo "<td>" . nl2br($resolution) . "</td>"; - - echo "</tr>\n"; + echo " <tr>\n"; + echo ' <td colspan="2"><a href="' . $bug_url . '">Bug #'; + echo $row['id'] . ': ' . htmlspecialchars($row['sdesc']); + echo "</a></td>\n"; + echo " </tr>\n"; + echo " <tr>\n"; + echo ' <td>' . $summary . "</td>\n"; + echo ' <td>' . nl2br($resolution) . "</td>\n"; + echo " </tr>\n"; } -?> -</table> -</div> -<?php - + echo "</table>\n"; + echo "</div>\n"; } } else { - /* we displayed the luser search and they said it really - * was not already submitted, so let's allow them to submit */ + /* + * We displayed the luser search and they said it really + * was not already submitted, so let's allow them to submit. + */ $ok_to_submit_report = true; } if ($ok_to_submit_report) { - - /* Put all text areas together. */ - $fdesc = "Description:\n------------\n". $in['ldesc'] ."\n\n"; + // Put all text areas together. + $fdesc = "Description:\n------------\n" . $in['ldesc'] . "\n\n"; if (!empty($in['repcode'])) { - $fdesc .= "Reproduce code:\n---------------\n". $in['repcode'] ."\n\n"; + $fdesc .= "Reproduce code:\n---------------\n"; + $fdesc .= $in['repcode'] . "\n\n"; } if (!empty($in['expres']) || $in['expres'] === '0') { - $fdesc .= "Expected result:\n----------------\n". $in['expres'] ."\n\n"; + $fdesc .= "Expected result:\n----------------\n"; + $fdesc .= $in['expres'] . "\n\n"; } if (!empty($in['actres']) || $in['actres'] === '0') { - $fdesc .= "Actual result:\n--------------\n". $in['actres'] ."\n"; + $fdesc .= "Actual result:\n--------------\n"; + $fdesc .= $in['actres'] . "\n"; } $query = 'INSERT INTO bugdb (' . @@ -129,7 +156,7 @@ ' email, sdesc, ldesc,' . ' php_version, php_os, status,' . ' ts1, passwd' . - ") VALUES (" . + ') VALUES (' . " '$in[package_name]', '$in[bug_type]'," . " '$in[email]', '$in[sdesc]', '$fdesc'," . " '$in[php_version]', '$in[php_os]', 'Open'," . @@ -138,222 +165,300 @@ $dbh->query($query); /* - * need to move this to DB eventually... + * Need to move the insert ID determination to DB eventually... */ $cid = mysql_insert_id(); - $report = ""; - $report .= "From: ".spam_protect(stripslashes($in['email']), 'text')."\n"; - $report .= "Operating system: ".stripslashes($in['php_os'])."\n"; - $report .= "PHP version: ".stripslashes($in['php_version'])."\n"; - $report .= "Package: $in[package_name]\n"; - $report .= "Bug Type: $in[bug_type]\n"; - $report .= "Bug description: "; + $report = ''; + $report .= 'From: ' . spam_protect(rinse($in['email']), + 'text') . "\n"; + $report .= 'Operating system: ' . rinse($in['php_os']) . "\n"; + $report .= 'PHP version: ' . rinse($in['php_version']) . "\n"; + $report .= 'Package: ' . $in['package_name'] . "\n"; + $report .= 'Bug Type: ' . $in['bug_type'] . "\n"; + $report .= 'Bug description: '; - $fdesc = stripslashes($fdesc); - $sdesc = stripslashes($in['sdesc']); + $fdesc = rinse($fdesc); + $sdesc = rinse($in['sdesc']); - $ascii_report = "$report$sdesc\n\n".wordwrap($fdesc); - $ascii_report.= "\n-- \nEdit bug report at http://pear.php.net/bugs/bug.php?id=$cid&edit="; + $ascii_report = "$report$sdesc\n\n" . wordwrap($fdesc); + $ascii_report .= "\n-- \nEdit bug report at "; + $ascii_report .= "http://pear.php.net/bugs/bug.php?id=$cid&edit="; - //list($mailto,$mailfrom) = get_package_mail($in['package_name']); list($mailto, $mailfrom) = get_package_mail($in['package_name']); - - $email = stripslashes($in['email']); - $protected_email = '"'.spam_protect($email, 'text')."\" <$mailfrom>"; + $email = rinse($in['email']); + $protected_email = '"' . spam_protect($email, 'text') . '"'; + $protected_email .= '<' . $mailfrom . '>'; // provide shortcut URLS for "quick bug fixes" - $dev_extra = ""; - /* - $maxkeysize = 0; - foreach ($RESOLVE_REASONS as $v) { - if (!$v['webonly']) { - $actkeysize = strlen($v['desc']) + 1; - $maxkeysize = (($maxkeysize < $actkeysize) ? $actkeysize : $maxkeysize); - } - } - foreach ($RESOLVE_REASONS as $k => $v) { - if (!$v['webonly']) - $dev_extra .= str_pad($v['desc'] . ":", $maxkeysize) . - " http://bugs.php.net/fix.php?id=$cid&r=$k\n"; - } - */ - - // Set extra-headers - $extra_headers = "From: $protected_email\n"; - $extra_headers.= "X-PHP-Bug: $cid\n"; - $extra_headers.= "X-PHP-Type: " . stripslashes($in['bug_type']) . "\n"; - $extra_headers.= "X-PHP-Version: " . stripslashes($in['php_version']) . "\n"; - $extra_headers.= "X-PHP-Category: " . stripslashes($in['package_name']) . "\n"; - $extra_headers.= "X-PHP-OS: " . stripslashes($in['php_os']) . "\n"; - $extra_headers.= "X-PHP-Status: Open\n"; - $extra_headers.= "Message-ID: <bug-$cid@pear.php.net>"; + // $dev_extra = ''; + // $maxkeysize = 0; + // foreach ($RESOLVE_REASONS as $v) { + // if (!$v['webonly']) { + // $actkeysize = strlen($v['desc']) + 1; + // $maxkeysize = (($maxkeysize < $actkeysize) ? $actkeysize : $maxkeysize); + // } + // } + // foreach ($RESOLVE_REASONS as $k => $v) { + // if (!$v['webonly']) + // $dev_extra .= str_pad($v['desc'] . ":", $maxkeysize) . + // " http://bugs.php.net/fix.php?id=$cid&r=$k\n"; + // } + + $extra_headers = 'From: ' . $protected_email . "\n"; + $extra_headers .= 'X-PHP-Bug: ' . $cid . "\n"; + $extra_headers .= 'X-PHP-Type: ' . rinse($in['bug_type']) . "\n"; + $extra_headers .= 'X-PHP-Version: ' . rinse($in['php_version']) . "\n"; + $extra_headers .= 'X-PHP-Category: ' . rinse($in['package_name']) . "\n"; + $extra_headers .= 'X-PHP-OS: ' . rinse($in['php_os']) . "\n"; + $extra_headers .= 'X-PHP-Status: Open' . "\n"; + $extra_headers .= 'Message-ID: <bug-' . $cid . '@pear.php.net>'; $type = @$types[$in['bug_type']]; if (DEVBOX == false) { // mail to package developers - mail($mailto, "[PEAR-BUG] $type #$cid [NEW]: $sdesc", $ascii_report."1\n-- \n$dev_extra", $extra_headers, "-fpear-sys@php.net"); + @mail($mailto, "[PEAR-BUG] $type #$cid [NEW]: $sdesc", + $ascii_report . "1\n-- \n$dev_extra", $extra_headers, + '-fpear-sys@php.net'); // mail to reporter - mail($email, "[PEAR-BUG] $type #$cid: $sdesc", $ascii_report."2\n", "From: PHP Bug Database <$mailfrom>\nX-PHP-Bug: $cid\nMessage-ID: <bug-$cid@pear.php.net>", "-fpear-sys@php.net"); + @mail($email, "[PEAR-BUG] $type #$cid: $sdesc", + $ascii_report . "2\n", + "From: PHP Bug Database <$mailfrom>\n" . + "X-PHP-Bug: $cid\n" . + "Message-ID: <bug-$cid@pear.php.net>", + '-fpear-sys@php.net'); } localRedirect('bug.php?id=' . $cid . '&thanks=4'); exit; } } else { - response_header("Report - Problems"); + // had errors... + response_header('Report - Problems'); } -} + +} // end of if input + + if (!package_exists($package)) { $errors[] = 'Package &quot;' . $package . '&quot; does not exist.'; response_header("Report - Invalid bug type"); display_errors($errors); } else { - if (!isset($in)) { - response_header("Report - New"); + response_header('Report - New'); show_bugs_menu($package); -?> -<p>Before you report a bug, make sure to search for similar bugs using the -"Bug List" link. Also, read the instructions for <a target="top" href="http://bugs.php.net/how-to-report.php">how to report a bug -that someone will want to help fix</a>.</p> + ?> -<p>If you aren't sure that what you're about to report is a bug, you should ask for help using one of the means for support -<a href="/support.php">listed here</a>.</p> +<p> + Before you report a bug, make sure to search for similar bugs using the + &quot;Bug List&quot; link. Also, read the instructions for + <a target="top" href="http://bugs.php.net/how-to-report.php">how to report + a bug that someone will want to help fix</a>. +</p> + +<p> + If you aren't sure that what you're about to report is a bug, you should + ask for help using one of the means for support + <a href="/support.php">listed here</a>. +</p> + +<p> + <strong>Failure to follow these instructions may result in your bug + simply being marked as &quot;bogus.&quot;</strong> +</p> -<p><strong>Failure to follow these instructions may result in your bug -simply being marked as "bogus".</strong></p> +<p> + <strong>If you feel this bug concerns a security issue, eg a buffer + overflow, weak encryption, etc, then email + <a href="mailto:pear-group@php.net?subject=%5BSECURITY%5D+possible+new+bug%21">pear-group@php.net</a> + who will assess the situation.</strong> +</p> -<p><strong>If you feel this bug concerns a security issue, eg a buffer overflow, weak encryption, etc, then email -<a href="mailto:pear-group@php.net?subject=%5BSECURITY%5D+possible+new+bug%21">pear-group@php.net</a> who will assess the situation. </strong></p> + <?php -<?php } - if ($errors) display_errors($errors); -?> -<form method="post" action="<?php echo "$PHP_SELF?package=$package";?>"> -<table> -<tr> - <th align="right">Y<span class="underline">o</span>ur email address:</th> - <td colspan="2"> - <input type="hidden" name="in[did_luser_search]" value="<?php echo $in['did_luser_search'] ? 1 : 0; ?>" /> - <input type="text" size="20" maxlength="40" name="in[email]" value="<?php echo clean($in['email']);?>" accesskey="o" /> - </td> -</tr><tr> - <th align="right">PHP version:</th> - <td> - <select name="in[php_version]"><?php show_version_options($in['php_version']);?></select> + if ($errors) { + display_errors($errors); + } + + ?> + +<form method="post" action="<?php echo "$PHP_SELF?package=$package"; ?>"> +<table class="form-holder" cellspacing="1" border="1"> + <tr> + <th class="form-label_left"> + Y<span class="underline">o</span>ur email address: + </th> + <td class="form-input"> + <input type="hidden" name="in[did_luser_search]" + value="<?php echo $in['did_luser_search'] ? 1 : 0; ?>" /> + <input type="text" size="20" maxlength="40" name="in[email]" + value="<?php echo clean($in['email']); ?>" accesskey="o" /> + </td> + </tr> + <tr> + <th class="form-label_left"> + PHP version: + </th> + <td class="form-input"> + <select name="in[php_version]"> + <?php show_version_options($in['php_version']); ?> + </select> </td> -</tr><tr> - <th align="right">Package affected:</th> - <td colspan="2"> + </tr> + <tr> + <th class="form-label_left"> + Package affected: + </th> + <td class="form-input"> + <?php - if (!empty($package)) { ?> - <input type="hidden" name="in[package_name]" value="<?php echo $package;?>" /> - <?php echo $package; + + if (!empty($package)) { + echo '<input type="hidden" name="in[package_name]" value="'; + echo $package . '" />' . $package; } else { + echo '<select name="in[package_name]">' . "\n"; + show_types(null, 0, $package); + echo '</select>'; + } + ?> - <select name="in[package_name]"><?php show_types(null,0,$package);?></select> - <?php } ?> + </td> -</tr><tr> - <th align="right">Bug Type:</th> - <td colspan="2"> + </tr> + <tr> + <th class="form-label_left"> + Bug Type: + </th> + <td class="form-input"> <select name="in[bug_type]"> <?php show_type_options($in['bug_type']); ?> </select> </td> -</tr><tr> - <th align="right">Operating system:</th> - <td colspan="2"> - <input type="text" size="20" maxlength="32" name="in[php_os]" value="<?php echo clean($in['php_os']);?>" /> - </td> -</tr><tr> - <th align="right">Summary:</th> - <td colspan="2"> - <input type="text" size="40" maxlength="79" name="in[sdesc]" value="<?php echo clean($in['sdesc']);?>" /> - </td> -</tr><tr> - <th align="right">Password:</th> - <td> - <input type="password" size="20" maxlength="20" name="in[passwd]" value="<?php echo clean($in['passwd']);?>" /> - </td> - <td><small> + </tr> + <tr> + <th class="form-label_left"> + Operating system: + </th> + <td class="form-input"> + <input type="text" size="20" maxlength="32" name="in[php_os]" + value="<?php echo clean($in['php_os']); ?>" /> + </td> + </tr> + <tr> + <th class="form-label_left"> + Summary: + </th> + <td class="form-input"> + <input type="text" size="40" maxlength="79" name="in[sdesc]" + value="<?php echo clean($in['sdesc']); ?>" /> + </td> + </tr> + <tr> + <th class="form-label_left"> + Password: + </th> + <td class="form-input"> + <input type="password" size="20" maxlength="20" name="in[passwd]" + value="<?php echo clean($in['passwd']); ?>" /> + <p class="cell_note"> You may enter any password here, which will be stored for this bug report. This password allows you to come back and modify your submitted bug report - at a later date. <!-- [<a href="/bug-pwd-finder.php">Lost a bug password?</a>] --> - </small></td> -</tr> -</table> -<table> -<tr> - <td valign="top" colspan="2" style="font-size: 85%;"> + at a later date. + </p> + </td> + </tr> + <tr> + <th class="form-label_left"> + Note: + </th> + <td class="form-input"> Please supply any information that may be helpful in fixing the bug: <ul> <li>The version number of the PEAR package or files you are using.</li> <li>A short script that reproduces the problem.</li> <li>The list of modules you compiled PHP with (your configure line).</li> <li>Any other information unique or specific to your setup.</li> - <li>Any changes made in your php.ini compared to php.ini-dist (<b>not</b> your whole php.ini!)</li> - <li>A <a href="http://bugs.php.net/bugs-generating-backtrace.php">gdb backtrace</a>.</li> + <li> + Any changes made in your php.ini compared to php.ini-dist + (<strong>not</strong> your whole php.ini!) + </li> + <li> + A <a href="http://bugs.php.net/bugs-generating-backtrace.php">gdb + backtrace</a>. + </li> </ul> </td> -</tr> -<tr> - <td valign="top"> - <b>Description:</b><br /> - </td> + </tr> + <tr> + <th class="form-label_left"> + Description: + </th> <td> - <textarea cols="60" rows="15" name="in[ldesc]" wrap="physical"><?php echo clean($in['ldesc']);?></textarea> + <textarea cols="60" rows="15" name="in[ldesc]" + wrap="physical"><?php echo clean($in['ldesc']); ?></textarea> </td> -</tr> -<tr> - <td valign="top"> - <b>Reproduce code:</b><br /> - <small> - Please <b>do not</b> post more than 20 lines of source code.<br /> - If the code is longer than 20 lines, provide a URL to the source<br /> + </tr> + <tr> + <th class="form-label_left"> + Reproduce code: + <p class="cell_note"> + Please <strong>do not</strong> post more than 20 lines of source code. + If the code is longer than 20 lines, provide a URL to the source code that will reproduce the bug. - </small> - </td> - <td valign="top"> - <textarea cols="60" rows="15" name="in[repcode]" wrap="no"><?php echo clean($in['repcode']);?></textarea> - </td> -</tr> -<tr> - <td valign="top"> - <b>Expected result:</b><br /> - <small> - What do you expect to happen or see when you run the code above ?<br /> - </small> - </td> - <td valign="top"> - <textarea cols="60" rows="15" name="in[expres]" wrap="physical"><?php echo clean($in['expres']);?></textarea> - </td> -</tr> -<tr> - <td valign="top"> - <b>Actual result:</b><br /> - <small> - This could be a <a href="http://bugs.php.net/bugs-generating-backtrace.php">backtrace</a> for example.<br /> + </p> + </th> + <td class="form-input" valign="top"> + <textarea cols="60" rows="15" name="in[repcode]" + wrap="no"><?php echo clean($in['repcode']); ?></textarea> + </td> + </tr> + <tr> + <th class="form-label_left"> + Expected result: + <p class="cell_note"> + What do you expect to happen or see when you run the code above? + </p> + </th> + <td class="form-input" valign="top"> + <textarea cols="60" rows="15" name="in[expres]" + wrap="physical"><?php echo clean($in['expres']); ?></textarea> + </td> + </tr> + <tr> + <th class="form-label_left"> + Actual result: + <p class="cell_note"> + This could be a + <a href="http://bugs.php.net/bugs-generating-backtrace.php">backtrace</a> + for example. Try to keep it as short as possible without leaving anything relevant out. - </small> - </td> - <td valign="top"> - <textarea cols="60" rows="15" name="in[actres]" wrap="physical"><?php echo clean($in['actres']);?></textarea> - </td> -</tr> -<tr> - <td colspan="2" align="center"> + </p> + </th> + <td class="form-input" valign="top"> + <textarea cols="60" rows="15" name="in[actres]" + wrap="physical"><?php echo clean($in['actres']); ?></textarea> + </td> + </tr> + <tr> + <th class="form-label_left"> + Submit: + </th> + <td class="form-input" align="center"> <input type="submit" value="Send bug report" /> </td> -</tr> + </tr> </table> </form> -<?php + + <?php } + response_footer(); + ?>
« previous php.pear.cvs (#20682) next »