$title="PHP3 Bug Database";
require "include/header.inc";
$destination = "php3@php.il.eu.org";
#$destination = "rasmus@lerdorf.on.ca";
function indent($string, $prefix) {
$string = ereg_replace(13, "", $string); /* get rid of Ctrl-M */
return $prefix . ereg_replace("\n", "\n$prefix", $string) . "\n";
}
function show_menu($state) {
global $PHP_SELF;
echo "
\n";
}
function show_types($first_item) {
echo "
$first_item
Feature/Change Request
Documentation problem
Installation problem
Failed to compile
Parser error
Performance problem
MySQL related
mSQL related
PostgreSQL related
ODBC related
Oracle related
Sybase related
Solid related
Adabas-D related
dBase related
dbm related
Other
";
}
function find_password($user) {
$fp=fopen("/repository/CVSROOT/passwd","r");
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]*)","\1 ",$text);
$new_text = ereg_replace("(ftp:[^ \n\t]*)","\1 ",$text);
$new_text = ereg_replace("[.,]-=-\"","\"",$new_text);
$new_text = ereg_replace("-=-\"","\"",$new_text);
return $new_text;
}
if (isset($cmd) && $cmd == "Send bug report") {
show_menu($status);
echo " \n";
mysql_pconnect("localhost","nobody","");
mysql_select_db("php3");
$ts=date("Y-m-d H:i:s");
mysql_query("INSERT into bugdb values (0,'$bug_type','$email','$sdesc','$ldesc','$php_version','$php_os','Open','','$ts','$ts','')");
$report = "";
echo("\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: $bug_type\n";
$report .= "Bug description:\n";
$report .= indent($ldesc, " ");
$html_report = ereg_replace("<", "<", $report);
$html_report = ereg_replace(">", ">", $html_report);
echo $html_report;
echo(" \n");
if (Mail($destination, "Bug report: $sdesc", $report, "From: $email")) {
echo("
Mail sent to $destination... \n");
echo("Thank you for your help!\n");
} else {
echo("
Mail not sent! \n");
echo("Please send this page in a mail to " .
"$email manually.\n");
}
} elseif(isset($cmd) && $cmd=="Display Bugs") {
show_menu($status);
echo " \n";
mysql_pconnect("localhost","nobody","");
mysql_select_db("php3");
echo "ID# Status Type Version OS Originator Description \n";
if($status=="All" && $bug_type=="Any") {
$result = mysql_query("SELECT * from bugdb order by id");
} elseif($status=="All" && $bug_type!="Any") {
$result = mysql_query("SELECT * from bugdb where bug_type='$bug_type' order by id");
} elseif($status!="All" && $bug_type=="Any") {
$result = mysql_query("SELECT * from bugdb where status='$status' order by id");
} else {
$result = mysql_query("SELECT * from bugdb where status='$status' and bug_type='$bug_type' order by id");
}
while($row=mysql_fetch_row($result)) {
if($row[7]=="Open") {
$col = "#ffbbaa";
} else {
$col = "#aaffbb";
}
echo "".$row[0]." ";
echo " ".$row[7]." ";
echo "".$row[1]." ";
echo "".$row[5]." ";
echo "".$row[6]." ";
echo "".$row[2]." ";
echo "".$row[3]." \n";
}
mysql_freeresult($result);
echo "
\n";
echo "Submit a Bug Report \n";
} else if(!isset($cmd) && isset($id)) {
show_menu($status);
echo " \n";
mysql_pconnect("localhost","nobody","");
mysql_select_db("php3");
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");
if($status=="Delete!") {
mysql_query("DELETE from bugdb where id=$id");
} else {
mysql_query("UPDATE bugdb set status='$status', comments='$comments', ts2='$ts', dev_id='$user' where id=$id");
}
$ok=1;
}
}
}
if(!$ok) {
echo "Sorry, incorrect user id/password pair. \n";
Mail("rasmus@lerdorf.on.ca", "bugdb auth failure for $user/$pw", "", "From: bugdb");
} else {
echo "Database updated! \n";
}
}
$result = mysql_query("SELECT * from bugdb where id=$id");
if(mysql_numrows($result)>0) {
$row = mysql_fetch_row($result);
echo "Bug id #$id \n";
echo "\n";
if(!isset($edit)) {
echo "Status: ".$row[7]." ";
echo "Modify ";
} else {
echo "
\n";
$text = addlinks($row[4]);
echo "".$text." \n";
if(!isset($edit)) {
if(strlen($row[8])) {
echo "[".$row[10]."] Updated by ".$row[11]." \n";
$text=addlinks($row[8]);
echo "".$text." \n";
}
} else {
echo "Developer Comments: \n";
echo " \n";
echo "CVS user id: \n";
echo "CVS password: \n";
echo " \n";
echo "\n";
}
} else {
if(isset($modify) && $status=="Delete!") {
echo "Bug id #$id has been deleted \n";
} else {
echo "Sorry bug id #$id does not exist \n";
}
}
mysql_freeresult($result);
} else {
show_menu($status);
?>
Or use the form below to submit a new bug report.
} ?>
require("include/footer.inc"); ?>