cvs: phpweb / bugs-edit.php
| From: | Sterling Hughes | Date: | Wed, 17 Jan 2001 15:15:31 +0000 |
| Subject: | cvs: phpweb / bugs-edit.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-3437@lists.php.net to get a copy of this message | ||
sterling Wed Jan 17 07:15:31 2001 EDT
Added files:
/phpweb bugs-edit.php
Log:
testing, testing, 1,2,3
Index: phpweb/bugs-edit.php +++ phpweb/bugs-edit.php <? if(isset($save) && isset($user) && isset($pw)) { SetCookie("MAGIC_COOKIE",base64_encode("$user:$pw"),time()+3600*24*12,'/'); } /* See the end of the script for the table layout. */ if(!isset($status)) $status = ''; if(!isset($user)) $user = ''; if(!isset($pw)) $pw = ''; $destination = "php-dev@lists.php.net"; require("shared.inc"); if (strstr($MYSITE,"bugs.php.net")) { $dbhost="localhost"; $dbuser="nobody"; $dbpwd=""; } else if (strstr($MYSITE,"il.php.net")) { $dbhost="bugs.php.net"; $dbuser="bourbon"; $dbpwd=""; } else if (strstr($MYSITE,"localhost")) { $dbhost="localhost"; $dbuser="nobody"; $dbpwd=""; } else { Header("Location: http://bugs.php.net"); exit; } /* if ($edit) $edit = $MAGIC_COOKIE ? 1 : 2; */ $DISABLE_KICKOUTS=1; commonHeader("Bug Reporting"); echo "<!-- Bug photo by Dexter Sear, IO Vision. http://www.insects.org -->\n"; echo "<font size=-1>\n"; function indent($string, $prefix) { $string = ereg_replace(13, "", $string); /* get rid of Ctrl-M */ return $prefix . ereg_replace("\n", "\n$prefix", $string) . "\n"; } function wrap($text,$margin=72) { $i=0; $last_space=0; $printfrom=0; $len=strlen($text); $line_len=0; while($i<$len) { if($text[$i]==chr(32) || $text[$i]==chr(7)) { $last_space=$i; $line_len++; } else if($text[$i]==chr(10) || $text[$i]==chr(13)) { $line_len=0; } else { $line_len++; } if($line_len>$margin) { if($last_space==0 || $last_space<$printfrom) { echo substr($text,$printfrom,$margin); echo "\n"; $printfrom+=$margin+1; } else { echo substr($text,$printfrom,$last_space-$printfrom); echo "\n"; $printfrom=$last_space+1; } $line_len=0; } $i++; } echo substr($text,$printfrom); } function list_ids($current) { global $dbhost,$dbuser,$dbpwd; mysql_connect($dbhost,$dbuser,$dbpwd) or die("Unable to connect to SQL server."); $result = mysql_db_query('php3', "select distinct dev_id from bugdb where dev_id not like '%@%' and dev_id not like '%.%' and php_version like '4%' order by dev_id"); if($current) echo "<option>$current\n"; echo "<option>Any\n"; while($row = mysql_fetch_row($result)) { if($row[0]!=$current) echo "<option>".$row[0]."\n"; } } function show_state_options($state, $show_all, $user_mode=0) { if(empty($state)) $state = "Open"; $state_types = array ( "Open" => 2, "Closed" => 2, "Duplicate" => 2, "Assigned" => 1, "Analyzed" => 1, "Suspended" => 1, "Feedback" => 3, "OldFeedback" => 3, "Bogus" => 1 ); /* Restricted status's have value 1, i.e. User can only close the report (except Bogus). */ if($state != "All" && $state_types[$state] == 1 && $user_mode == 2) { echo "<option>$state\n"; if($state != "Bogus") echo "<option>Closed\n"; } else { foreach($state_types as $type => $mode) { if($mode == $user_mode || $user_mode == 1 || $user_mode == 0) { echo "<option"; if($type == $state) echo " SELECTED"; echo ">$type\n"; } } if($show_all) { $sel = ($state == "All") ? "SELECTED" : ""; echo "<option $sel>All\n"; } } } function show_menu($state) { global $PHP_SELF, $bug_type, $by, $MAGIC_COOKIE; if(!isset($bug_type)) { $bug_type="Any"; } echo "<form method=POST action=\"$PHP_SELF\">\n"; echo "<input type=hidden name=cmd value=\"Display Bugs\">\n"; echo "<table bgcolor=#aabbcc cellspacing=0><tr><td><input type=submit value=\"Display\"></td><td><select name=\"status\">\n"; show_state_options($state, 1); echo "</select></td><td align=right>bugs of type: </td><td>"; show_types($bug_type,1,"bug_type"); $fields = array( "id" => "Bug ID", "bug_type" => "Bug Type", "email" => "Email address", "sdesc" => "Short Description", "ldesc" => "Long Description", "php_version" => "PHP Version", "php_os" => "Platform", "status" => "Status", "comments" => "Comments", "ts1" => "Opened", "assign" => "Assigned To"); reset($fields); echo "</td><td align=right>Last Comment By:</td><td> <select name=\"by\">\n"; list_ids($by); echo "</select></td></tr>\n"; echo "<tr><td colspan=3 align=right>Where the bug description contains:</td>\n"; echo "<td colspan=3><input type=text name=\"search_for\"></td></tr></form>\n"; echo "<tr><td colspan=3 align=right><form method=GET action=\"$PHP_SELF\">\n"; echo "<input type='submit' value='Edit'> bug number:</td><td colspan=2><input type='text' name='id'></td>\n"; if (isset($MAGIC_COOKIE)) echo "<input type='hidden' name='edit' value='1'>\n"; else echo "<input type='hidden' name='edit' value='2'>\n"; echo "</td><td><a href=\"bugstats.php\">Statistics</a></td></tr></table>"; echo "<i>Feature/Change requests must be explicitly selected to be shown</i></form>\n"; } ### show_types significantly modified by j.a.greant 00/09/05 function show_types($first_item,$show_any,$var_name) { $items = array ("Any" => "Any", "*General Issues" => "General Issues", "Feature/Change Request" => " Feature/Change Request", "Documentation problem" => " Documentation problem", "Reproduceable crash" => " Reproduceable crash", "Scripting Engine problem" => " Scripting Engine problem", "Performance problem" => " Performance problem", "*Install and Config" => "Install and Config", "Compile Problem" => " Compile Problem", "Compile Failure" => " Compile Failure", "Compile Warning" => " Compile Warning", "*Web Server problem" => " Web Server problem", "Apache related" => " Apache related", "IIS related" => " IIS related", "PWS related" => " PWS related", "Other web server" => " Other web server", "*Configuration Issues" => " Configuration Issues", "Dynamic loading" => " Dynamic loading", "PHP options/info functions" => " PHP options/info functions", "*Function Specific" => "Function Specific", "Calendar problems" => " Calendar problems", "Calendar related" => " Calendar related", "ICAP related" => " ICAP related", "MCAL related" => " MCAL related", "*Compression related" => " Compression related", "Bzip2 Related" => " Bzip2 Related", "ZZiplib Related" => " ZZiplib Related", "Zlib Related" => " Zlib Related", "Date/time related" => " Date/time related", "*Directory/Filesystem functions" => " Directory/Filesystem functions", "Directory function related" => " Directory function related", "Filesystem function related" => " Filesystem function related", "*Directory Services problems" => " Directory Services problems", "YP/NIS related" => " YP/NIS related", "LDAP related" => " LDAP related", "*Database Functions" => " Database Functions", "Adabas-D related" => " Adabas-D related", "dBase related" => " dBase related", "DBM/DBA related" => " DBM/DBA related", "filePro related" => " filePro related", "Hyperwave related" => " Hyperwave related", "Informix related" => " Informix related", "InterBase related" => " InterBase related", "Sybase-ct (ctlib) related" => " Sybase-ct (ctlib) related", "Sybase (dblib) related" => " Sybase (dblib) related", "mSQL related" => " mSQL related", "MSSQL related" => " MSSQL related", "MySQL related" => " MySQL related", "OCI8 related" => " OCI8 related", "ODBC related" => " ODBC related", "Oracle related" => " Oracle related", "Ovrimos related" => " Ovrimos related", "PostgreSQL related" => " PostgreSQL related", "Solid related" => " Solid related", "*Data Exchange functions" => " Data Exchange functions", "WDDX related" => " WDDX related", "YAZ related" => " YAZ related", "*Extensibility Functions" => " Extensibility Functions", "COM related" => " COM related", "Program Execution" => " Program Execution", "Semaphore related" => " Semaphore related", "Readline related" => " Readline related", "Satellite CORBA related" => " Satellite CORBA related", "*E-commerce functions" => " E-commerce functions", "Cybercash related" => " Cybercash related", "Verisign Payflow Pro related" => " Verisign Payflow Pro related", "CCVS related" => " CCVS related", "FrontPage related" => " FrontPage related", "*Graphics related" => " Graphics related", "GD related" => " GD related", "GetImageSize related" => " GetImageSize related", "*Languages/Translation" => " Languages/Translation", "Gettext related" => " Gettext related", "Recode related" => " Recode related", "*Mail Related" => " Mail Related", "IMAP related" => " IMAP related", "Mail related" => " Mail function related", "*Math Functions" => " Math Functions", "BC math related" => " BC math related", "Math related" => " Math related", "mcrypt related" => " mcrypt related", "mhash related" => " mhash related", "*Network Functions" => " Network Functions", "Network related" => " Network related", "SNMP related" => " SNMP related", "FTP related" => " FTP related", "HTTP related" => " HTTP related", "Sockets related" => " Sockets related", "Output Control" => " Output Control", "*PDF functions" => " PDF functions", "ClibPDF related" => " ClibPDF related", "FDF related" => " FDF related", "PDF related" => " PDF related", "POSIX related" => " POSIX related", "*Programming Data Structures" => " Programming Data Structures", "Class/Object related" => " Class/Object related", "Arrays related" => " Arrays related", "Strings related" => " Strings related", "Variables related" => " Variables related", "*Regular Expressions" => " Regular Expressions", "PCRE related" => " PCRE related", "Regexps related" => " Regexps related", "*Session related" => " Session related", "*Spelling functions" => " Spelling functions", "Aspell related" => " Aspell related", "Pspell related" => " Pspell related", "SWF related" => " SWF related", "*XML functions" => " XML functions", "DOM XML related" => " DOM XML related", "XML related" => " XML related", "Sablotron XSL" => " Sablotron XSL", "*URL Functions" => " URL Functions", "cURL related" => " cURL related", "URL related" => " URL related", "Unknown/Other Function" => "Unknown/Other Function" ); print "<select name=\"$var_name\">\n"; if($first_item == '--Please Select--') { print "<option value\"$first_item\">$first_item\n"; } foreach ($items as $key => $value) { if ($show_any || $value != 'Any') { $sel = ($key == $first_item) ? 'SELECTED' : ''; print "<option value=\"$key\" $sel>$value</option>\n"; } } print "</select>\n"; } function find_password($user) { $fp=@fopen("/repository/CVSROOT/passwd","r"); if (!$fp) { return (""); } while(!feof($fp)) { $line=fgets($fp,120); list($luser,$passwd,$junk) = explode(":",$line); if($user==$luser) { fclose($fp); return($passwd); } } fclose($fp); return(""); } function addlinks($text) { $text = htmlspecialchars($text); $new_text = ereg_replace("(http:[^ \n\t]*)","<a href=\"\\1\">\\1</a>",$text); $new_text = ereg_replace("(ftp:[^ \n\t]*)","<a href=\"\\1\">\\1</a>",$text); $new_text = ereg_replace("[.,]-=-\"","\"",$new_text); $new_text = ereg_replace("-=-\"","\"",$new_text); return $new_text; } if (isset($cmd) && $cmd == "Send bug report") { if(!ereg("@",$email)) { echo "ERROR! Please provide a valid email address<P>\n"; commonFooter(); exit; } if($ebug_type=="--Please Select--") { echo "ERROR! Please select an appropriate bug type<P>\n"; commonFooter(); exit; } if ($php_version=='earlier') { echo "ERROR! Please select a valid PHP version. If your PHP version is too old, please upgrade first and see if the problem has not already been fixed."; commonFooter(); exit; } show_menu($status); echo "<hr>\n"; mysql_connect($dbhost,$dbuser,$dbpwd) or die("Unable to connect to SQL server."); mysql_select_db("php3"); $ts=date("Y-m-d H:i:s"); $ret = mysql_query("INSERT into bugdb values (0,'$ebug_type','$email','$sdesc','$ldesc','$php_version','$php_os','Open','','$ts','$ts','','','$passwd')"); $cid = mysql_insert_id(); $report = ""; echo("<pre>\n"); $ldesc = stripslashes($ldesc); $sdesc = stripslashes($sdesc); $report .= "From: $email\n"; $report .= "Operating system: $php_os\n"; $report .= "PHP version: $php_version\n"; $report .= "PHP Bug Type: $ebug_type\n"; $report .= "Bug description: "; $html_sdesc = ereg_replace("<", "<", $sdesc); $html_sdesc = ereg_replace(">", ">", $html_sdesc); $report .= $html_sdesc."\n\n"; $ascii_report = indent($report.$ldesc,""); $ascii_report.= "\n\n-- \nEdit Bug report at: http://bugs.php.net/?id=$cid&edit=1\n\n"; $html_desc = ereg_replace("<", "<", $ldesc); $html_desc = ereg_replace(">", ">", $html_desc); $report .= $html_desc."\n"; $html_report = ereg_replace("<", "<", $report); $html_report = ereg_replace(">", ">", $html_report); echo wrap($html_report); echo("</pre>\n"); if (Mail($destination, "PHP 4.0 Bug #$cid: $sdesc", $ascii_report, "From: $email")) { echo "<p><h2>Mail sent to $destination...</h2>\n"; echo "Thank you for your help!<P>"; echo "<i>The password for this report is</i>: <b>".htmlentities($passwd)."</b><br>"; echo "If the status of the bug report you submitted\n"; echo "changes, you will be notified. You may return here and check on the status\n"; echo "or update your report at any time. The URL for your bug report is: <a href=\"http://bugs.php.net/?id=$cid\">"; echo "http://bugs.php.net/?id=$cid</a>\n"; } else { echo("<p><h2>Mail not sent!</h2>\n"); echo("Please send this page in a mail to " . "<a href=\"mailto:$destination\">$destination</a> manually.\n"); } } elseif(isset($cmd) && $cmd=="Display Bugs") { show_menu($status); echo "<hr>\n"; include("table_wrapper.inc"); function external_processing($fieldname,$tablename,$data,$row){ switch($fieldname) { case "id": print "<a href=\"bugs.php?id=$data\">$data</a>\n"; break; case "Originator": print "<a href=\"mailto:$data\">$data</a>\n"; break; case "Mod": print "<a href=\"bugs.php?id=${row['id']}&edit=1\"><img src=\"gifs/circular_arrow.gif\" border=\"0\"></a>\n"; break; case "Status": if ($data == "Feedback") { echo "Feedback<br>(".$row[unchanged_days]." days)"; break; } /* otherwise fall through */ default: $data = ereg_replace("<","<",$data); $data = ereg_replace(">",">",$data); print $data; break; } } function row_coloring($row) { if ($row["bug_type"]=="Feature/Change Request") { return "#aaaaaa"; } switch($row["Status"]) { case "Open": return "#ffbbaa"; break; case "Closed": return "#aaffbb"; break; case "Suspended": return "#ffccbb"; break; case "Assigned": return "#bbaaff"; break; case "Feedback": return "#bbeeff"; break; case "Analyzed": return "#99bbaa"; break; case "Duplicate": return "#bbbbbb"; break; default: return "#aaaaaa"; break; } } $external_processing_function="external_processing"; $row_coloring_function="row_coloring"; mysql_connect($dbhost,$dbuser,$dbpwd) or die("Unable to connect to SQL server"); mysql_select_db("php3"); $tables[] = "bugdb"; $fields[] = "id"; $fields[] = "bug_type"; $fields[] = "status as Status"; $fields[] = "assign as Assigned"; $fields[] = "php_version as Version"; $fields[] = "php_os as Platform"; $fields[] = "sdesc as Description"; $fields[] = "id as Mod"; $fields[] = "TO_DAYS(NOW())-TO_DAYS(ts2) as unchanged_days"; $conversion_table["id"] = "ID#"; $conversion_table["bug_type"] = "Bug Type"; $pass_on = ereg_replace(" ","+","&cmd=Display+Bugs&status=$status&bug_type=$bug_type"); $default_header_color="aaaaaa"; $centering["id"] = $centering["Mod"] = "center"; $dont_link["Mod"]=1; $dont_display["unchanged_days"] = 1; if (!isset($order_by_clause)) { $order_by_clause = "id"; } if($status=="All" && $bug_type=="Any") { $where_clause = "bug_type!='Feature/Change Request'"; /* nothing */ } elseif($status=="All" && $bug_type!="Any") { $where_clause = "bug_type='$bug_type'"; } else { if($bug_type=="Any") { $where_clause = "bug_type!='Feature/Change Request'"; } else { $where_clause = "bug_type='$bug_type'"; } /* Treat assigned and analyzed bugs as open */ if($status=="Open") { $where_clause .= " and (status='Open' or status='Assigned' or status='Analyzed')"; } elseif($status=="OldFeedback") { $where_clause .= " and status='Feedback' and TO_DAYS(NOW())-TO_DAYS(ts2)>60"; } else { $where_clause .= " and status='$status'"; } } if(strlen($search_for)) { $where_clause .= " and (sdesc like '%$search_for%' or ldesc like '%$search_for%' or comments like '%$search_for%')"; } // not supported by the HTML form yet : use the URL :) if(isset($bug_age) && ($bug_age!="All")) { $where_clause .= " and ts1 >= date_sub(now(), interval $bug_age day)"; } if (strlen($where_clause)) { $where_clause .= " and"; } $where_clause .= " php_version like '4%'"; if(strlen($by) and $by!='Any') $where_clause .= " and dev_id = '$by' "; table_wrapper(); echo "<br><center><a href=\"$PHP_SELF\">Submit a Bug Report</a></center>\n"; } else if(!isset($cmd) && isset($id)) { /* Change made by j.a.greant 00/09/03 */ function get_old_comments ($bug_id) { $divider = '---------------------------------------------------------------------------'; $max_message_length = 10 * 1024; #fetch comments $result = mysql_query ("SELECT ts, email, comment from bugdb_comments where bug = $bug_id order by ts desc"); while ($temp = mysql_fetch_row ($result)) # $result should always be valid, suppress error just in case. $comments[] = $temp; if ($comments[0]) unset ($comments[0]); # Ditch the most recent comment #fetch original bug description $query = "SELECT ts1, email, ldesc FROM bugdb WHERE id=$bug_id LIMIT 5"; $result = mysql_query ($query); $comments[] = mysql_fetch_row ($result); $counter = 0; foreach ($comments as $value) { $output .= "[$value[0]] $value[1]\n$value[2]\n\n$divider\n\n"; if (strlen ($output) > $max_message_length || ++$counter > 4 ) { $output .= "The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online.\n"; break; } } if ($output) return "\n\nPrevious Comments:\n$divider\n\n" . $output; } show_menu($status); echo "<hr>\n"; mysql_connect($dbhost,$dbuser,$dbpwd) or die("Unable to connect to SQL server."); mysql_select_db("php3"); /* HANDLE NORMAL DEVELOPER UPDATES */ if(isset($modify) && $modify=="Edit Bug") { $ok=0; if($user!="cvsread") { $psw=find_password($user); if(strlen($psw)>0) { if(crypt($pw,substr($psw,0,2))==$psw) { $ts=date("Y-m-d H:i:s"); $result = mysql_query("select status, bug_type, ldesc, php_version, php_os from bugdb where id=$id"); mysql_query("UPDATE bugdb set sdesc='$esdesc',status='$estatus', bug_type='$ebug_type', assign='$eassign', comments='$comments', ts2='$ts', dev_id='$user' where id=$id"); if (!empty($ncomment)) { mysql_query("INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES ($id,'".$user."@php.net','$ts','$ncomment')"); } $ok=1; } } } if(!$ok) { echo "<b>Sorry, incorrect user id/password pair.</b><br>\n"; Mail("rasmus@lerdorf.on.ca", "bugdb auth failure for $user/$pw", "", "From: bugdb"); } else { echo "<b>Database updated!</b><br>\n"; $row=mysql_fetch_row($result); $text = "ID: $id\nUpdated by: $user\n"; $text.= "Reported By: $eemail\n"; if($estatus!=$row[0]) $text .= "Old-Status: ".$row[0]."\n"; $text.= "Status: $estatus\n"; if($ebug_type != $row[1]) $text .= "Old-Bug Type: ".$row[1]."\n"; $text.= "Bug Type: $ebug_type\n"; $text.= "Assigned To: $eassign\n"; $text.= "Comments:\n\n$ncomment" . get_old_comments ($id); $text.= "\nFull Bug description available at: http://bugs.php.net/?id=$id\n"; $text = stripslashes($text); $esdesc = stripslashes($esdesc); /* mail bug originator */ Mail($eemail, "PHP 4.0 Bug #$id Updated: $esdesc", $text, "From: Bug Database <$destination>"); Mail($destination, "PHP 4.0 Bug #$id Updated: $esdesc", $text, "From: $user@php.net"); } mysql_freeresult($result); } /* HANDLE USER UDPATES */ if(isset($modify) && $modify=="User Edit Bug") { $ts=date("Y-m-d H:i:s"); $result = mysql_query("select status, bug_type, ldesc, php_version, php_os from bugdb where id=$id and passwd='$pw'"); $ok=mysql_numrows($result); if(!$ok) { echo "<b>Sorry, incorrect password. The entry has not been changed.</b><br>\n"; Mail("rasmus@lerdorf.on.ca", "bugdb auth failure for bug #$id - ($pw)", "", "From: bugdb"); } else { $row=mysql_fetch_row($result); /* update bug record */ if($estatus=="Closed" and $row[0]!="Closed") { mysql_query("UPDATE bugdb set status='$estatus', bug_type='$ebug_type', php_version='$ephp_version', php_os='$ephp_os', ts2='$ts', dev_id='$eemail' where id=$id"); } else { mysql_query("UPDATE bugdb set status='$estatus', bug_type='$ebug_type', php_version='$ephp_version', php_os='$ephp_os', ts2='$ts' where id=$id"); } /* add comment */ if (!empty($ncomment)) { mysql_query("INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES ($id,'$eemail','$ts','$ncomment')"); } echo "<b>Database updated!</b><br>\n"; $text = "ID: $id\nUser Update by: $eemail\n"; if($estatus!=$row[0]) $text .= "Old-Status: ".$row[0]."\n"; $text .= "Status: $estatus\n"; if($ebug_type != $row[1]) $text .= "Old-Bug Type: ".$row[1]."\n"; $text .= "Bug Type: $ebug_type\n"; $text .= "Description: $esdesc\n\n$ncomment"; $text .= get_old_comments ($id); $text .= "\nFull Bug description available at: http://bugs.php.net/?id=$id\n"; $text = stripslashes($text); $esdesc = stripslashes($esdesc); Mail($eemail, "PHP 4.0 Bug #$id Updated: $esdesc", $text, "From: Bug Database <$destination>"); Mail($destination, "PHP 4.0 Bug #$id Updated: $esdesc", $text, "From: $eemail"); mysql_freeresult($result); } } /* DISPLAY BUG */ $result = mysql_query("SELECT * from bugdb where id=$id"); if($result and mysql_numrows($result)>0) { $row = mysql_fetch_row($result); echo "<br><h1>Bug id #$id</h1>\n"; echo "<table>\n"; if(!isset($edit)) { echo "<tr><th align=right>Status:</th><td>".$row[7]."</td>"; echo "<td><a href=\"$PHP_SELF?id=$id&edit=2\"><font size=-1><tt>User Modify</tt></font></a> "; echo "<a href=\"$PHP_SELF?id=$id&edit=1\"><font size=-1><tt>Dev Modify</tt></font></a></td>"; } else { echo "<form method=POST action=\"http://bugs.php.net$PHP_SELF?id=$id\">\n"; if($edit==1) { echo "<input type=hidden name=modify value=\"Edit Bug\">\n"; } else { echo "<tr><td align=right colspan=2><a href=\"$PHP_SELF?id=$id&edit=1\"><font size=-1><tt>Dev Modify</tt></font></a></td></tr>"; echo "<input type=hidden name=modify value=\"User Edit Bug\">\n"; } echo "<tr><th align=right>Status:</th><td><select name=\"estatus\">\n"; show_state_options($row[7], 0, ($edit==2)?2:0); echo "</select>\n"; if($edit==1) { echo "Assign to: <input type=text name=eassign value=\"$row[12]\">\n"; echo "<input type=submit value=\"Commit Changes\">\n"; } } echo "</tr>\n"; echo "<tr><th align=right>From:</th><td><a href=\"mailto:".$row[2]."\">".$row[2]."</a>"; echo "<input type=hidden name=eemail value=\"$row[2]\"></td></tr>\n"; echo "<tr><th align=right>Date:</th><td>".$row[9]."</td></tr>\n"; if(!isset($edit)) { echo "<tr><th align=right>Type:</th><td>".$row[1]."</td></tr>\n"; } else { echo "<tr><th align=right>Type:</th><td>\n"; show_types($row[1],0,"ebug_type"); echo "</td></tr>\n"; } if(isset($edit) && $edit==2) { echo "<tr><th align=right>OS:</th><td><input type=text size=20 name=ephp_os value=\"".$row[6]."\"></td></tr>\n"; } else { echo "<tr><th align=right>OS:</th><td>".$row[6]."</td></tr>\n"; } if(isset($edit) && ($edit==2 || $edit == 1)) { echo "<tr><th align=right>PHP Version:</th><td><input type=text size=20 name=ephp_version value=\"".$row[5]."\"></td></tr>\n"; } else { echo "<tr><th align=right>PHP Version:</th><td>".$row[5]."</td></tr>\n"; } echo "<tr><th align=right>Assigned To:</th><td>".$row[12]."</td></tr>\n"; $sd = ereg_replace("<","<",$row[3]); $sd = ereg_replace(">",">",$sd); if(isset($edit) && $edit==1) { echo "<tr><th align=right>Short Desc.:</th><td><input type=text size=40 name=esdesc value=\"", htmlspecialchars($row[3]), "\"></td></tr>\n"; } else { echo "<tr><th align=right>Short Desc.:</th><td></b>$sd<input type=hidden name=esdesc value=\"", htmlspecialchars($row[3]), "\"></td></tr>\n"; } echo "</table>\n"; /* INSERT NEW COMMENT HERE */ if (isset($edit)) { echo "<b>New Comment:</b><br>\n"; echo "<textarea cols=60 rows=15 name=\"ncomment\" wrap=physical></textarea><br>\n"; if(isset($MAGIC_COOKIE)) list($user, $pw) = explode(":", base64_decode($MAGIC_COOKIE)); if ($edit == 1) { echo "CVS user id: <input type=text size=10 name=user value=\"$user\">\n"; } echo "Password: <input type=password size=10 name=pw value=\"$pw\">\n"; echo "<input type=submit value=\"Commit Changes\">"; echo ($edit == 2) ? " [<a href=\"http://bugs.php.net/bug-pwd-finder.php\">Lost your password?</a>]<br>\n" : "<br>\n"; if(!$user || !$pw) { echo "Remember my login/password: <input type=checkbox name=save>\n"; } echo "</form>\n"; } echo "<hr>\n"; /* ORIGINAL REPORT */ echo "<b><i>[".$row[9]."] ".$row[2]."</i></b><br>\n"; $text = addlinks($row[4]); echo "<blockquote><blockquote><pre>"; echo wrap($text,90); echo "</pre></blockquote></blockquote>\n"; /* OLD-STYLE DEVELOPER COMMENT */ if(strlen($row[8])) { echo "<b><i>[".$row[10]."] ".$row[11]."</i></b><br>\n"; $text=addlinks($row[8]); echo "<blockquote><blockquote><pre>"; wrap($text,90); echo "</pre></blockquote></blockquote>\n"; } /* NEW-STYLE COMMENTS */ $query = "SELECT *,UNIX_TIMESTAMP(ts) AS my_when FROM bugdb_comments WHERE bug=$id ORDER BY ts"; if ($comresult = mysql_query($query)) { while ($com = mysql_fetch_array($comresult)) { echo "<b><i>[".$com['ts']."] ".$com['email']."</i></b><br>\n"; $text = addlinks($com['comment']); echo "<blockquote><blockquote><pre>"; wrap($text,90); echo "</pre></blockquote></blockquote>\n"; } mysql_freeresult($comresult); } } else { echo "<br><h1>Sorry bug id #$id does not exist</h1>\n"; } if ($result) { mysql_freeresult($result); } } else { show_menu($status); ?> Or use the form below to submit a new bug report. <hr> <form method=POST action="<? echo $PHP_SELF;?>"> <input type=hidden name=cmd value="Send bug report"> <p><strong>Please read the <a href="bugs-dos-and-donts.php">Dos & Don'ts</a> before submitting a bug report!</strong></p> <p><strong>To report bugs in PHP 3.0, please go <a href="http://bugs.php.net/bugs-php3.php">here</a>.</strong></p> <table> <tr> <th align=right>Your email address:</th> <td colspan="2"> <input type=text size=20 name="email" value="<?if(isset($email)) { echo $email; }?>"> </td> </tr><tr> <th align=right>PHP version:</th> <td> <select name="php_version"> <option name="4.0.4pl1">4.0.4pl1 <option name="4.0.4">4.0.4 <option name="4.0.3pl1">4.0.3pl1 <option name="4.0.3">4.0.3 <option name="4.0.2">4.0.2 <option name="4.0.1pl2">4.0.1pl2 <option name="4.0.1">4.0.1 <option name="4.0.0">4.0.0 <option name="4.0CVS-<? print date("d/m/Y"); ?>">4.0 Latest CVS (<? print date("d/m/Y"); ?>) <option name="earlier">Earlier? Upgrade first! </select> </td> </tr><tr> <th align=right>Type of bug:</th> <td colspan="2"> <?show_types("--Please Select--",0,"ebug_type")?> </td> </tr><tr> <th align=right>Operating system:</th> <td colspan="2"> <input type=text size=20 name="php_os" value="<?echo isset($operating_system)?$operating_system:"";?>"> </td> </tr><tr> <th align=right>Bug description:</th> <td colspan="2"> <input type=text size=40 maxlength=79 name="sdesc"> </td></tr> </tr><tr> <th align=right>Password:</th> <td> <input type=text size=20 maxlength=20 name="passwd"></td> <td><font size="-2"> You may enter any password here. This password allows you to come back and modify your submitted bug report at a later date. [<a href="http://bugs.php.net/bug-pwd-finder.php">Lost your password?</a>] </font> </td></tr> </table> <table> <tr> <td valign="top"> Please supply any information that may be helpful in fixing the bug: <ul> <li>A short script that reproduces the problem <li>The list of modules you compiled PHP with (your configure line) <li>A copy of your php.ini file (if it might be relevant) <li>Any other information unique or specific to your setup <li>A <a href="http://bugs.php.net/bugs-generating-backtrace.php">gdb backtrace</a>. </ul> <center> <input type=submit value="Send bug report"> </center> </td> <td> <textarea cols=60 rows=15 name="ldesc" wrap=physical></textarea> </td> </tr> </table> <p> </form> <? } ?> </font> <? commonFooter(); ?> <? /* # MySQL dump 4.0 # # Host: localhost Database: php3 #-------------------------------------------------------- DROP table bugdb; CREATE TABLE bugdb ( id int(8) NOT NULL AUTO_INCREMENT, bug_type char(32), email varchar(40) NOT NULL, sdesc varchar(80), ldesc text, php_version char(16), php_os varchar(32), status varchar(16), comments text,# developer comment (deprecated) ts1 datetime, # bug created date ts2 datetime, # developer comment date (deprecated) dev_id varchar(16),# developer who commented (deprecated) assign varchar(16), passwd varchar(20),# user password PRIMARY KEY (id) ); CREATE TABLE bugdb_comments ( id int(8) NOT NULL AUTO_INCREMENT, bug int(8) NOT NULL, email varchar(40) NOT NULL, ts datetime NOT NULL, comment text, PRIMARY KEY (id) ); */ ?>
Index: phpweb/bugs-edit.php +++ phpweb/bugs-edit.php <? if(isset($save) && isset($user) && isset($pw)) { SetCookie("MAGIC_COOKIE",base64_encode("$user:$pw"),time()+3600*24*12,'/'); } /* See the end of the script for the table layout. */ if(!isset($status)) $status = ''; if(!isset($user)) $user = ''; if(!isset($pw)) $pw = ''; $destination = "php-dev@lists.php.net"; require("shared.inc"); if (strstr($MYSITE,"bugs.php.net")) { $dbhost="localhost"; $dbuser="nobody"; $dbpwd=""; } else if (strstr($MYSITE,"il.php.net")) { $dbhost="bugs.php.net"; $dbuser="bourbon"; $dbpwd=""; } else if (strstr($MYSITE,"localhost")) { $dbhost="localhost"; $dbuser="nobody"; $dbpwd=""; } else { Header("Location: http://bugs.php.net"); exit; } /* if ($edit) $edit = $MAGIC_COOKIE ? 1 : 2; */ $DISABLE_KICKOUTS=1; commonHeader("Bug Reporting"); echo "<!-- Bug photo by Dexter Sear, IO Vision. http://www.insects.org -->\n"; echo "<font size=-1>\n"; function indent($string, $prefix) { $string = ereg_replace(13, "", $string); /* get rid of Ctrl-M */ return $prefix . ereg_replace("\n", "\n$prefix", $string) . "\n"; } function wrap($text,$margin=72) { $i=0; $last_space=0; $printfrom=0; $len=strlen($text); $line_len=0; while($i<$len) { if($text[$i]==chr(32) || $text[$i]==chr(7)) { $last_space=$i; $line_len++; } else if($text[$i]==chr(10) || $text[$i]==chr(13)) { $line_len=0; } else { $line_len++; } if($line_len>$margin) { if($last_space==0 || $last_space<$printfrom) { echo substr($text,$printfrom,$margin); echo "\n"; $printfrom+=$margin+1; } else { echo substr($text,$printfrom,$last_space-$printfrom); echo "\n"; $printfrom=$last_space+1; } $line_len=0; } $i++; } echo substr($text,$printfrom); } function list_ids($current) { global $dbhost,$dbuser,$dbpwd; mysql_connect($dbhost,$dbuser,$dbpwd) or die("Unable to connect to SQL server."); $result = mysql_db_query('php3', "select distinct dev_id from bugdb where dev_id not like '%@%' and dev_id not like '%.%' and php_version like '4%' order by dev_id"); if($current) echo "<option>$current\n"; echo "<option>Any\n"; while($row = mysql_fetch_row($result)) { if($row[0]!=$current) echo "<option>".$row[0]."\n"; } } function show_state_options($state, $show_all, $user_mode=0) { if(empty($state)) $state = "Open"; $state_types = array ( "Open" => 2, "Closed" => 2, "Duplicate" => 2, "Assigned" => 1, "Analyzed" => 1, "Suspended" => 1, "Feedback" => 3, "OldFeedback" => 3, "Bogus" => 1 ); /* Restricted status's have value 1, i.e. User can only close the report (except Bogus). */ if($state != "All" && $state_types[$state] == 1 && $user_mode == 2) { echo "<option>$state\n"; if($state != "Bogus") echo "<option>Closed\n"; } else { foreach($state_types as $type => $mode) { if($mode == $user_mode || $user_mode == 1 || $user_mode == 0) { echo "<option"; if($type == $state) echo " SELECTED"; echo ">$type\n"; } } if($show_all) { $sel = ($state == "All") ? "SELECTED" : ""; echo "<option $sel>All\n"; } } } function show_menu($state) { global $PHP_SELF, $bug_type, $by, $MAGIC_COOKIE; if(!isset($bug_type)) { $bug_type="Any"; } echo "<form method=POST action=\"$PHP_SELF\">\n"; echo "<input type=hidden name=cmd value=\"Display Bugs\">\n"; echo "<table bgcolor=#aabbcc cellspacing=0><tr><td><input type=submit value=\"Display\"></td><td><select name=\"status\">\n"; show_state_options($state, 1); echo "</select></td><td align=right>bugs of type: </td><td>"; show_types($bug_type,1,"bug_type"); $fields = array( "id" => "Bug ID", "bug_type" => "Bug Type", "email" => "Email address", "sdesc" => "Short Description", "ldesc" => "Long Description", "php_version" => "PHP Version", "php_os" => "Platform", "status" => "Status", "comments" => "Comments", "ts1" => "Opened", "assign" => "Assigned To"); reset($fields); echo "</td><td align=right>Last Comment By:</td><td> <select name=\"by\">\n"; list_ids($by); echo "</select></td></tr>\n"; echo "<tr><td colspan=3 align=right>Where the bug description contains:</td>\n"; echo "<td colspan=3><input type=text name=\"search_for\"></td></tr></form>\n"; echo "<tr><td colspan=3 align=right><form method=GET action=\"$PHP_SELF\">\n"; echo "<input type='submit' value='Edit'> bug number:</td><td colspan=2><input type='text' name='id'></td>\n"; if (isset($MAGIC_COOKIE)) echo "<input type='hidden' name='edit' value='1'>\n"; else echo "<input type='hidden' name='edit' value='2'>\n"; echo "</td><td><a href=\"bugstats.php\">Statistics</a></td></tr></table>"; echo "<i>Feature/Change requests must be explicitly selected to be shown</i></form>\n"; } ### show_types significantly modified by j.a.greant 00/09/05 function show_types($first_item,$show_any,$var_name) { $items = array ("Any" => "Any", "*General Issues" => "General Issues", "Feature/Change Request" => " Feature/Change Request", "Documentation problem" => " Documentation problem", "Reproduceable crash" => " Reproduceable crash", "Scripting Engine problem" => " Scripting Engine problem", "Performance problem" => " Performance problem", "*Install and Config" => "Install and Config", "Compile Problem" => " Compile Problem", "Compile Failure" => " Compile Failure", "Compile Warning" => " Compile Warning", "*Web Server problem" => " Web Server problem", "Apache related" => " Apache related", "IIS related" => " IIS related", "PWS related" => " PWS related", "Other web server" => " Other web server", "*Configuration Issues" => " Configuration Issues", "Dynamic loading" => " Dynamic loading", "PHP options/info functions" => " PHP options/info functions", "*Function Specific" => "Function Specific", "Calendar problems" => " Calendar problems", "Calendar related" => " Calendar related", "ICAP related" => " ICAP related", "MCAL related" => " MCAL related", "*Compression related" => " Compression related", "Bzip2 Related" => " Bzip2 Related", "ZZiplib Related" => " ZZiplib Related", "Zlib Related" => " Zlib Related", "Date/time related" => " Date/time related", "*Directory/Filesystem functions" => " Directory/Filesystem functions", "Directory function related" => " Directory function related", "Filesystem function related" => " Filesystem function related", "*Directory Services problems" => " Directory Services problems", "YP/NIS related" => " YP/NIS related", "LDAP related" => " LDAP related", "*Database Functions" => " Database Functions", "Adabas-D related" => " Adabas-D related", "dBase related" => " dBase related", "DBM/DBA related" => " DBM/DBA related", "filePro related" => " filePro related", "Hyperwave related" => " Hyperwave related", "Informix related" => " Informix related", "InterBase related" => " InterBase related", "Sybase-ct (ctlib) related" => " Sybase-ct (ctlib) related", "Sybase (dblib) related" => " Sybase (dblib) related", "mSQL related" => " mSQL related", "MSSQL related" => " MSSQL related", "MySQL related" => " MySQL related", "OCI8 related" => " OCI8 related", "ODBC related" => " ODBC related", "Oracle related" => " Oracle related", "Ovrimos related" => " Ovrimos related", "PostgreSQL related" => " PostgreSQL related", "Solid related" => " Solid related", "*Data Exchange functions" => " Data Exchange functions", "WDDX related" => " WDDX related", "YAZ related" => " YAZ related", "*Extensibility Functions" => " Extensibility Functions", "COM related" => " COM related", "Program Execution" => " Program Execution", "Semaphore related" => " Semaphore related", "Readline related" => " Readline related", "Satellite CORBA related" => " Satellite CORBA related", "*E-commerce functions" => " E-commerce functions", "Cybercash related" => " Cybercash related", "Verisign Payflow Pro related" => " Verisign Payflow Pro related", "CCVS related" => " CCVS related", "FrontPage related" => " FrontPage related", "*Graphics related" => " Graphics related", "GD related" => " GD related", "GetImageSize related" => " GetImageSize related", "*Languages/Translation" => " Languages/Translation", "Gettext related" => " Gettext related", "Recode related" => " Recode related", "*Mail Related" => " Mail Related", "IMAP related" => " IMAP related", "Mail related" => " Mail function related", "*Math Functions" => " Math Functions", "BC math related" => " BC math related", "Math related" => " Math related", "mcrypt related" => " mcrypt related", "mhash related" => " mhash related", "*Network Functions" => " Network Functions", "Network related" => " Network related", "SNMP related" => " SNMP related", "FTP related" => " FTP related", "HTTP related" => " HTTP related", "Sockets related" => " Sockets related", "Output Control" => " Output Control", "*PDF functions" => " PDF functions", "ClibPDF related" => " ClibPDF related", "FDF related" => " FDF related", "PDF related" => " PDF related", "POSIX related" => " POSIX related", "*Programming Data Structures" => " Programming Data Structures", "Class/Object related" => " Class/Object related", "Arrays related" => " Arrays related", "Strings related" => " Strings related", "Variables related" => " Variables related", "*Regular Expressions" => " Regular Expressions", "PCRE related" => " PCRE related", "Regexps related" => " Regexps related", "*Session related" => " Session related", "*Spelling functions" => " Spelling functions", "Aspell related" => " Aspell related", "Pspell related" => " Pspell related", "SWF related" => " SWF related", "*XML functions" => " XML functions", "DOM XML related" => " DOM XML related", "XML related" => " XML related", "Sablotron XSL" => " Sablotron XSL", "*URL Functions" => " URL Functions", "cURL related" => " cURL related", "URL related" => " URL related", "Unknown/Other Function" => "Unknown/Other Function" ); print "<select name=\"$var_name\">\n"; if($first_item == '--Please Select--') { print "<option value\"$first_item\">$first_item\n"; } foreach ($items as $key => $value) { if ($show_any || $value != 'Any') { $sel = ($key == $first_item) ? 'SELECTED' : ''; print "<option value=\"$key\" $sel>$value</option>\n"; } } print "</select>\n"; } function find_password($user) { $fp=@fopen("/repository/CVSROOT/passwd","r"); if (!$fp) { return (""); } while(!feof($fp)) { $line=fgets($fp,120); list($luser,$passwd,$junk) = explode(":",$line); if($user==$luser) { fclose($fp); return($passwd); } } fclose($fp); return(""); } function addlinks($text) { $text = htmlspecialchars($text); $new_text = ereg_replace("(http:[^ \n\t]*)","<a href=\"\\1\">\\1</a>",$text); $new_text = ereg_replace("(ftp:[^ \n\t]*)","<a href=\"\\1\">\\1</a>",$text); $new_text = ereg_replace("[.,]-=-\"","\"",$new_text); $new_text = ereg_replace("-=-\"","\"",$new_text); return $new_text; } if (isset($cmd) && $cmd == "Send bug report") { if(!ereg("@",$email)) { echo "ERROR! Please provide a valid email address<P>\n"; commonFooter(); exit; } if($ebug_type=="--Please Select--") { echo "ERROR! Please select an appropriate bug type<P>\n"; commonFooter(); exit; } if ($php_version=='earlier') { echo "ERROR! Please select a valid PHP version. If your PHP version is too old, please upgrade first and see if the problem has not already been fixed."; commonFooter(); exit; } show_menu($status); echo "<hr>\n"; mysql_connect($dbhost,$dbuser,$dbpwd) or die("Unable to connect to SQL server."); mysql_select_db("php3"); $ts=date("Y-m-d H:i:s"); $ret = mysql_query("INSERT into bugdb values (0,'$ebug_type','$email','$sdesc','$ldesc','$php_version','$php_os','Open','','$ts','$ts','','','$passwd')"); $cid = mysql_insert_id(); $report = ""; echo("<pre>\n"); $ldesc = stripslashes($ldesc); $sdesc = stripslashes($sdesc); $report .= "From: $email\n"; $report .= "Operating system: $php_os\n"; $report .= "PHP version: $php_version\n"; $report .= "PHP Bug Type: $ebug_type\n"; $report .= "Bug description: "; $html_sdesc = ereg_replace("<", "<", $sdesc); $html_sdesc = ereg_replace(">", ">", $html_sdesc); $report .= $html_sdesc."\n\n"; $ascii_report = indent($report.$ldesc,""); $ascii_report.= "\n\n-- \nEdit Bug report at: http://bugs.php.net/?id=$cid&edit=1\n\n"; $html_desc = ereg_replace("<", "<", $ldesc); $html_desc = ereg_replace(">", ">", $html_desc); $report .= $html_desc."\n"; $html_report = ereg_replace("<", "<", $report); $html_report = ereg_replace(">", ">", $html_report); echo wrap($html_report); echo("</pre>\n"); if (Mail($destination, "PHP 4.0 Bug #$cid: $sdesc", $ascii_report, "From: $email")) { echo "<p><h2>Mail sent to $destination...</h2>\n"; echo "Thank you for your help!<P>"; echo "<i>The password for this report is</i>: <b>".htmlentities($passwd)."</b><br>"; echo "If the status of the bug report you submitted\n"; echo "changes, you will be notified. You may return here and check on the status\n"; echo "or update your report at any time. The URL for your bug report is: <a href=\"http://bugs.php.net/?id=$cid\">"; echo "http://bugs.php.net/?id=$cid</a>\n"; } else { echo("<p><h2>Mail not sent!</h2>\n"); echo("Please send this page in a mail to " . "<a href=\"mailto:$destination\">$destination</a> manually.\n"); } } elseif(isset($cmd) && $cmd=="Display Bugs") { show_menu($status); echo "<hr>\n"; include("table_wrapper.inc"); function external_processing($fieldname,$tablename,$data,$row){ switch($fieldname) { case "id": print "<a href=\"bugs.php?id=$data\">$data</a>\n"; break; case "Originator": print "<a href=\"mailto:$data\">$data</a>\n"; break; case "Mod": print "<a href=\"bugs.php?id=${row['id']}&edit=1\"><img src=\"gifs/circular_arrow.gif\" border=\"0\"></a>\n"; break; case "Status": if ($data == "Feedback") { echo "Feedback<br>(".$row[unchanged_days]." days)"; break; } /* otherwise fall through */ default: $data = ereg_replace("<","<",$data); $data = ereg_replace(">",">",$data); print $data; break; } } function row_coloring($row) { if ($row["bug_type"]=="Feature/Change Request") { return "#aaaaaa"; } switch($row["Status"]) { case "Open": return "#ffbbaa"; break; case "Closed": return "#aaffbb"; break; case "Suspended": return "#ffccbb"; break; case "Assigned": return "#bbaaff"; break; case "Feedback": return "#bbeeff"; break; case "Analyzed": return "#99bbaa"; break; case "Duplicate": return "#bbbbbb"; break; default: return "#aaaaaa"; break; } } $external_processing_function="external_processing"; $row_coloring_function="row_coloring"; mysql_connect($dbhost,$dbuser,$dbpwd) or die("Unable to connect to SQL server"); mysql_select_db("php3"); $tables[] = "bugdb"; $fields[] = "id"; $fields[] = "bug_type"; $fields[] = "status as Status"; $fields[] = "assign as Assigned"; $fields[] = "php_version as Version"; $fields[] = "php_os as Platform"; $fields[] = "sdesc as Description"; $fields[] = "id as Mod"; $fields[] = "TO_DAYS(NOW())-TO_DAYS(ts2) as unchanged_days"; $conversion_table["id"] = "ID#"; $conversion_table["bug_type"] = "Bug Type"; $pass_on = ereg_replace(" ","+","&cmd=Display+Bugs&status=$status&bug_type=$bug_type"); $default_header_color="aaaaaa"; $centering["id"] = $centering["Mod"] = "center"; $dont_link["Mod"]=1; $dont_display["unchanged_days"] = 1; if (!isset($order_by_clause)) { $order_by_clause = "id"; } if($status=="All" && $bug_type=="Any") { $where_clause = "bug_type!='Feature/Change Request'"; /* nothing */ } elseif($status=="All" && $bug_type!="Any") { $where_clause = "bug_type='$bug_type'"; } else { if($bug_type=="Any") { $where_clause = "bug_type!='Feature/Change Request'"; } else { $where_clause = "bug_type='$bug_type'"; } /* Treat assigned and analyzed bugs as open */ if($status=="Open") { $where_clause .= " and (status='Open' or status='Assigned' or status='Analyzed')"; } elseif($status=="OldFeedback") { $where_clause .= " and status='Feedback' and TO_DAYS(NOW())-TO_DAYS(ts2)>60"; } else { $where_clause .= " and status='$status'"; } } if(strlen($search_for)) { $where_clause .= " and (sdesc like '%$search_for%' or ldesc like '%$search_for%' or comments like '%$search_for%')"; } // not supported by the HTML form yet : use the URL :) if(isset($bug_age) && ($bug_age!="All")) { $where_clause .= " and ts1 >= date_sub(now(), interval $bug_age day)"; } if (strlen($where_clause)) { $where_clause .= " and"; } $where_clause .= " php_version like '4%'"; if(strlen($by) and $by!='Any') $where_clause .= " and dev_id = '$by' "; table_wrapper(); echo "<br><center><a href=\"$PHP_SELF\">Submit a Bug Report</a></center>\n"; } else if(!isset($cmd) && isset($id)) { /* Change made by j.a.greant 00/09/03 */ function get_old_comments ($bug_id) { $divider = '---------------------------------------------------------------------------'; $max_message_length = 10 * 1024; #fetch comments $result = mysql_query ("SELECT ts, email, comment from bugdb_comments where bug = $bug_id order by ts desc"); while ($temp = mysql_fetch_row ($result)) # $result should always be valid, suppress error just in case. $comments[] = $temp; if ($comments[0]) unset ($comments[0]); # Ditch the most recent comment #fetch original bug description $query = "SELECT ts1, email, ldesc FROM bugdb WHERE id=$bug_id LIMIT 5"; $result = mysql_query ($query); $comments[] = mysql_fetch_row ($result); $counter = 0; foreach ($comments as $value) { $output .= "[$value[0]] $value[1]\n$value[2]\n\n$divider\n\n"; if (strlen ($output) > $max_message_length || ++$counter > 4 ) { $output .= "The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online.\n"; break; } } if ($output) return "\n\nPrevious Comments:\n$divider\n\n" . $output; } show_menu($status); echo "<hr>\n"; mysql_connect($dbhost,$dbuser,$dbpwd) or die("Unable to connect to SQL server."); mysql_select_db("php3"); /* HANDLE NORMAL DEVELOPER UPDATES */ if(isset($modify) && $modify=="Edit Bug") { $ok=0; if($user!="cvsread") { $psw=find_password($user); if(strlen($psw)>0) { if(crypt($pw,substr($psw,0,2))==$psw) { $ts=date("Y-m-d H:i:s"); $result = mysql_query("select status, bug_type, ldesc, php_version, php_os from bugdb where id=$id"); mysql_query("UPDATE bugdb set sdesc='$esdesc',status='$estatus', bug_type='$ebug_type', assign='$eassign', comments='$comments', ts2='$ts', dev_id='$user' where id=$id"); if (!empty($ncomment)) { mysql_query("INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES ($id,'".$user."@php.net','$ts','$ncomment')"); } $ok=1; } } } if(!$ok) { echo "<b>Sorry, incorrect user id/password pair.</b><br>\n"; Mail("rasmus@lerdorf.on.ca", "bugdb auth failure for $user/$pw", "", "From: bugdb"); } else { echo "<b>Database updated!</b><br>\n"; $row=mysql_fetch_row($result); $text = "ID: $id\nUpdated by: $user\n"; $text.= "Reported By: $eemail\n"; if($estatus!=$row[0]) $text .= "Old-Status: ".$row[0]."\n"; $text.= "Status: $estatus\n"; if($ebug_type != $row[1]) $text .= "Old-Bug Type: ".$row[1]."\n"; $text.= "Bug Type: $ebug_type\n"; $text.= "Assigned To: $eassign\n"; $text.= "Comments:\n\n$ncomment" . get_old_comments ($id); $text.= "\nFull Bug description available at: http://bugs.php.net/?id=$id\n"; $text = stripslashes($text); $esdesc = stripslashes($esdesc); /* mail bug originator */ Mail($eemail, "PHP 4.0 Bug #$id Updated: $esdesc", $text, "From: Bug Database <$destination>"); Mail($destination, "PHP 4.0 Bug #$id Updated: $esdesc", $text, "From: $user@php.net"); } mysql_freeresult($result); } /* HANDLE USER UDPATES */ if(isset($modify) && $modify=="User Edit Bug") { $ts=date("Y-m-d H:i:s"); $result = mysql_query("select status, bug_type, ldesc, php_version, php_os from bugdb where id=$id and passwd='$pw'"); $ok=mysql_numrows($result); if(!$ok) { echo "<b>Sorry, incorrect password. The entry has not been changed.</b><br>\n"; Mail("rasmus@lerdorf.on.ca", "bugdb auth failure for bug #$id - ($pw)", "", "From: bugdb"); } else { $row=mysql_fetch_row($result); /* update bug record */ if($estatus=="Closed" and $row[0]!="Closed") { mysql_query("UPDATE bugdb set status='$estatus', bug_type='$ebug_type', php_version='$ephp_version', php_os='$ephp_os', ts2='$ts', dev_id='$eemail' where id=$id"); } else { mysql_query("UPDATE bugdb set status='$estatus', bug_type='$ebug_type', php_version='$ephp_version', php_os='$ephp_os', ts2='$ts' where id=$id"); } /* add comment */ if (!empty($ncomment)) { mysql_query("INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES ($id,'$eemail','$ts','$ncomment')"); } echo "<b>Database updated!</b><br>\n"; $text = "ID: $id\nUser Update by: $eemail\n"; if($estatus!=$row[0]) $text .= "Old-Status: ".$row[0]."\n"; $text .= "Status: $estatus\n"; if($ebug_type != $row[1]) $text .= "Old-Bug Type: ".$row[1]."\n"; $text .= "Bug Type: $ebug_type\n"; $text .= "Description: $esdesc\n\n$ncomment"; $text .= get_old_comments ($id); $text .= "\nFull Bug description available at: http://bugs.php.net/?id=$id\n"; $text = stripslashes($text); $esdesc = stripslashes($esdesc); Mail($eemail, "PHP 4.0 Bug #$id Updated: $esdesc", $text, "From: Bug Database <$destination>"); Mail($destination, "PHP 4.0 Bug #$id Updated: $esdesc", $text, "From: $eemail"); mysql_freeresult($result); } } /* DISPLAY BUG */ $result = mysql_query("SELECT * from bugdb where id=$id"); if($result and mysql_numrows($result)>0) { $row = mysql_fetch_row($result); echo "<br><h1>Bug id #$id</h1>\n"; echo "<table>\n"; if(!isset($edit)) { echo "<tr><th align=right>Status:</th><td>".$row[7]."</td>"; echo "<td><a href=\"$PHP_SELF?id=$id&edit=2\"><font size=-1><tt>User Modify</tt></font></a> "; echo "<a href=\"$PHP_SELF?id=$id&edit=1\"><font size=-1><tt>Dev Modify</tt></font></a></td>"; } else { echo "<form method=POST action=\"http://bugs.php.net$PHP_SELF?id=$id\">\n"; if($edit==1) { echo "<input type=hidden name=modify value=\"Edit Bug\">\n"; } else { echo "<tr><td align=right colspan=2><a href=\"$PHP_SELF?id=$id&edit=1\"><font size=-1><tt>Dev Modify</tt></font></a></td></tr>"; echo "<input type=hidden name=modify value=\"User Edit Bug\">\n"; } echo "<tr><th align=right>Status:</th><td><select name=\"estatus\">\n"; show_state_options($row[7], 0, ($edit==2)?2:0); echo "</select>\n"; if($edit==1) { echo "Assign to: <input type=text name=eassign value=\"$row[12]\">\n"; echo "<input type=submit value=\"Commit Changes\">\n"; } } echo "</tr>\n"; echo "<tr><th align=right>From:</th><td><a href=\"mailto:".$row[2]."\">".$row[2]."</a>"; echo "<input type=hidden name=eemail value=\"$row[2]\"></td></tr>\n"; echo "<tr><th align=right>Date:</th><td>".$row[9]."</td></tr>\n"; if(!isset($edit)) { echo "<tr><th align=right>Type:</th><td>".$row[1]."</td></tr>\n"; } else { echo "<tr><th align=right>Type:</th><td>\n"; show_types($row[1],0,"ebug_type"); echo "</td></tr>\n"; } if(isset($edit) && $edit==2) { echo "<tr><th align=right>OS:</th><td><input type=text size=20 name=ephp_os value=\"".$row[6]."\"></td></tr>\n"; } else { echo "<tr><th align=right>OS:</th><td>".$row[6]."</td></tr>\n"; } if(isset($edit) && ($edit==2 || $edit == 1)) { echo "<tr><th align=right>PHP Version:</th><td><input type=text size=20 name=ephp_version value=\"".$row[5]."\"></td></tr>\n"; } else { echo "<tr><th align=right>PHP Version:</th><td>".$row[5]."</td></tr>\n"; } echo "<tr><th align=right>Assigned To:</th><td>".$row[12]."</td></tr>\n"; $sd = ereg_replace("<","<",$row[3]); $sd = ereg_replace(">",">",$sd); if(isset($edit) && $edit==1) { echo "<tr><th align=right>Short Desc.:</th><td><input type=text size=40 name=esdesc value=\"", htmlspecialchars($row[3]), "\"></td></tr>\n"; } else { echo "<tr><th align=right>Short Desc.:</th><td></b>$sd<input type=hidden name=esdesc value=\"", htmlspecialchars($row[3]), "\"></td></tr>\n"; } echo "</table>\n"; /* INSERT NEW COMMENT HERE */ if (isset($edit)) { echo "<b>New Comment:</b><br>\n"; echo "<textarea cols=60 rows=15 name=\"ncomment\" wrap=physical></textarea><br>\n"; if(isset($MAGIC_COOKIE)) list($user, $pw) = explode(":", base64_decode($MAGIC_COOKIE)); if ($edit == 1) { echo "CVS user id: <input type=text size=10 name=user value=\"$user\">\n"; } echo "Password: <input type=password size=10 name=pw value=\"$pw\">\n"; echo "<input type=submit value=\"Commit Changes\">"; echo ($edit == 2) ? " [<a href=\"http://bugs.php.net/bug-pwd-finder.php\">Lost your password?</a>]<br>\n" : "<br>\n"; if(!$user || !$pw) { echo "Remember my login/password: <input type=checkbox name=save>\n"; } echo "</form>\n"; } echo "<hr>\n"; /* ORIGINAL REPORT */ echo "<b><i>[".$row[9]."] ".$row[2]."</i></b><br>\n"; $text = addlinks($row[4]); echo "<blockquote><blockquote><pre>"; echo wrap($text,90); echo "</pre></blockquote></blockquote>\n"; /* OLD-STYLE DEVELOPER COMMENT */ if(strlen($row[8])) { echo "<b><i>[".$row[10]."] ".$row[11]."</i></b><br>\n"; $text=addlinks($row[8]); echo "<blockquote><blockquote><pre>"; wrap($text,90); echo "</pre></blockquote></blockquote>\n"; } /* NEW-STYLE COMMENTS */ $query = "SELECT *,UNIX_TIMESTAMP(ts) AS my_when FROM bugdb_comments WHERE bug=$id ORDER BY ts"; if ($comresult = mysql_query($query)) { while ($com = mysql_fetch_array($comresult)) { echo "<b><i>[".$com['ts']."] ".$com['email']."</i></b><br>\n"; $text = addlinks($com['comment']); echo "<blockquote><blockquote><pre>"; wrap($text,90); echo "</pre></blockquote></blockquote>\n"; } mysql_freeresult($comresult); } } else { echo "<br><h1>Sorry bug id #$id does not exist</h1>\n"; } if ($result) { mysql_freeresult($result); } } else { show_menu($status); ?> Or use the form below to submit a new bug report. <hr> <form method=POST action="<? echo $PHP_SELF;?>"> <input type=hidden name=cmd value="Send bug report"> <p><strong>Please read the <a href="bugs-dos-and-donts.php">Dos & Don'ts</a> before submitting a bug report!</strong></p> <p><strong>To report bugs in PHP 3.0, please go <a href="http://bugs.php.net/bugs-php3.php">here</a>.</strong></p> <table> <tr> <th align=right>Your email address:</th> <td colspan="2"> <input type=text size=20 name="email" value="<?if(isset($email)) { echo $email; }?>"> </td> </tr><tr> <th align=right>PHP version:</th> <td> <select name="php_version"> <option name="4.0.4pl1">4.0.4pl1 <option name="4.0.4">4.0.4 <option name="4.0.3pl1">4.0.3pl1 <option name="4.0.3">4.0.3 <option name="4.0.2">4.0.2 <option name="4.0.1pl2">4.0.1pl2 <option name="4.0.1">4.0.1 <option name="4.0.0">4.0.0 <option name="4.0CVS-<? print date("d/m/Y"); ?>">4.0 Latest CVS (<? print date("d/m/Y"); ?>) <option name="earlier">Earlier? Upgrade first! </select> </td> </tr><tr> <th align=right>Type of bug:</th> <td colspan="2"> <?show_types("--Please Select--",0,"ebug_type")?> </td> </tr><tr> <th align=right>Operating system:</th> <td colspan="2"> <input type=text size=20 name="php_os" value="<?echo isset($operating_system)?$operating_system:"";?>"> </td> </tr><tr> <th align=right>Bug description:</th> <td colspan="2"> <input type=text size=40 maxlength=79 name="sdesc"> </td></tr> </tr><tr> <th align=right>Password:</th> <td> <input type=text size=20 maxlength=20 name="passwd"></td> <td><font size="-2"> You may enter any password here. This password allows you to come back and modify your submitted bug report at a later date. [<a href="http://bugs.php.net/bug-pwd-finder.php">Lost your password?</a>] </font> </td></tr> </table> <table> <tr> <td valign="top"> Please supply any information that may be helpful in fixing the bug: <ul> <li>A short script that reproduces the problem <li>The list of modules you compiled PHP with (your configure line) <li>A copy of your php.ini file (if it might be relevant) <li>Any other information unique or specific to your setup <li>A <a href="http://bugs.php.net/bugs-generating-backtrace.php">gdb backtrace</a>. </ul> <center> <input type=submit value="Send bug report"> </center> </td> <td> <textarea cols=60 rows=15 name="ldesc" wrap=physical></textarea> </td> </tr> </table> <p> </form> <? } ?> </font> <? commonFooter(); ?> <? /* # MySQL dump 4.0 # # Host: localhost Database: php3 #-------------------------------------------------------- DROP table bugdb; CREATE TABLE bugdb ( id int(8) NOT NULL AUTO_INCREMENT, bug_type char(32), email varchar(40) NOT NULL, sdesc varchar(80), ldesc text, php_version char(16), php_os varchar(32), status varchar(16), comments text,# developer comment (deprecated) ts1 datetime, # bug created date ts2 datetime, # developer comment date (deprecated) dev_id varchar(16),# developer who commented (deprecated) assign varchar(16), passwd varchar(20),# user password PRIMARY KEY (id) ); CREATE TABLE bugdb_comments ( id int(8) NOT NULL AUTO_INCREMENT, bug int(8) NOT NULL, email varchar(40) NOT NULL, ts datetime NOT NULL, comment text, PRIMARY KEY (id) ); */ ?>