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; } mysql_connect("localhost","nobody","") or die("Unable to connect to SQL server\n"); mysql_select_db("php3"); if($id) { $result = mysql_query("select id,bug_type,email,sdesc,ldesc,php_version,php_os,status,comments,ts1,dev_id,assign from bugdb where id=$id"); if($num=mysql_num_rows($result)) { $row = mysql_fetch_array($result); echo "
"; } else { echo "Bug #$id is not in the database"; } } else { $result = mysql_query("select id,bug_type,status,sdesc from bugdb where status != 'Closed' and status!='Suspended' and status!='Duplicate' and php_version like '4%' order by bug_type,id"); if($num=mysql_num_rows($result)) { echo "Bug $id
\n"; echo "From : " . htmlspecialchars($row['email']) . "\n"; echo "Date : " . $row['ts1'] . "\n"; echo "Status : " . htmlspecialchars($row['status']) . "\n"; echo "Type : " . htmlspecialchars($row['bug_type']) . "\n"; echo "Version : " . htmlspecialchars($row['php_version']) . "\n"; echo "OS : " . htmlspecialchars($row['php_os']) . "\n"; echo "Subject : " . htmlspecialchars($row['sdesc']) . "\n"; echo "\n" . htmlspecialchars($row['ldesc']) . "\n\n"; if(strlen($row['comments'])) { echo "From: " . $row['dev_id'] . "\n"; echo '' . htmlspecialchars($row['comments']) . "\n"; } $query = "SELECT *,UNIX_TIMESTAMP(ts) AS when FROM bugdb_comments WHERE bug=$id ORDER BY ts"; if ($comresult = mysql_query($query)) { while ($com = mysql_fetch_array($comresult)) { echo "[".$com['ts']."] ".$com['email']."
\n"; $text = addlinks($com['comment']); echo ""; echo $text; echo "\n"; } mysql_freeresult($comresult); } echo "
Num Status Summary ($num total including feature requests)\n";
$last_group = "";
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
if($last_group!=$row[bug_type]) {
$last_group = $row[bug_type];
echo "===============================================[".$row[bug_type]."]";
$len = 29-strlen($row[bug_type]);
$s='';
for($i=0;$i<$len; $i++) $s.= "=";
echo "$s\n";
}
printf("%4d",$PHP_SELF,$row[id],$row[id]);
sprintf("%-9s ",$row[status]);
echo " ".htmlspecialchars($row[sdesc])."\n";
}
mysql_free_result($result);
echo "";
}
}
?>