svn: /web/php-bugs/trunk/ bug.php include/functions.inc report.php

From: Date: Wed, 17 Feb 2010 22:05:24 +0000
Subject: svn: /web/php-bugs/trunk/ bug.php include/functions.inc report.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-7342@lists.php.net to get a copy of this message
degeberg Wed, 17 Feb 2010 22:05:24 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=295218 Log: - Added metadata changelog to the comments (like in emails) - Made links to documentation pages generated using "Report a bug" links full instead of partial Changed paths: U web/php-bugs/trunk/bug.php U web/php-bugs/trunk/include/functions.inc U web/php-bugs/trunk/report.php Modified: web/php-bugs/trunk/bug.php =================================================================== --- web/php-bugs/trunk/bug.php 2010-02-17 21:59:41 UTC (rev 295217) +++ web/php-bugs/trunk/bug.php 2010-02-17 22:05:24 UTC (rev 295218) @@ -156,6 +156,8 @@ } $from = ($bug['email'] != $in['email'] && !empty($in['email'])) ? $in['email'] : $bug['email']; + + $ncommentDb = trim(comment_get_headers($bug, $in) . "\n\n$ncomment"); if (!$errors && !($errors = incoming_details_are_valid($in))) { /* update bug record */ @@ -164,7 +166,7 @@ /* add comment */ if ($success && !empty($ncomment)) { - $query = "INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES ($id,'$from',NOW(),'$ncomment')"; + $query = "INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES ($id,'$from',NOW(),'$ncommentDb')"; $success = @mysql_query($query); } } @@ -211,14 +213,16 @@ . "\n\n$ncomment"; } } - + + $ncommentDb = trim(comment_get_headers($bug, $in) . "\n\n$ncomment"); + if (!$errors && !($errors = incoming_details_are_valid($in))) { $query = 'UPDATE bugdb SET '; $query.= ($bug['email'] != $in['email'] && !empty($in['email'])) ? "email='{$in['email']}', " : ''; $query.= "sdesc='{$in['sdesc']}', status='{$in['status']}', bug_type='{$in['bug_type']}', assign='{$in['assign']}', php_version='{$in['php_version']}', php_os='{$in['php_os']}', ts2=NOW() WHERE id=$id"; $success = @mysql_query($query); if ($success && !empty($ncomment)) { - $query = "INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES ($id,'$user@php.net',NOW(),'$ncomment')"; + $query = "INSERT INTO bugdb_comments (bug, email, ts, comment) VALUES ($id,'$user@php.net',NOW(),'$ncommentDb')"; $success = @mysql_query($query); } Modified: web/php-bugs/trunk/include/functions.inc =================================================================== --- web/php-bugs/trunk/include/functions.inc 2010-02-17 21:59:41 UTC (rev 295217) +++ web/php-bugs/trunk/include/functions.inc 2010-02-17 22:05:24 UTC (rev 295218) @@ -227,6 +227,39 @@ } } +function comment_get_headers($bug, $in, $array = false) +{ + $headers = array(); + + $fields = array( + 'email' => 'Reported by', + 'sdesc' => 'Summary', + 'status' => 'Status', + 'bug_type' => 'Bug Type', + 'php_os' => 'Operating System', + 'php_version' => 'PHP Version', + 'assign' => 'Assigned To' + ); + + foreach ($fields as $name => $desc) { + if (changed($name)) { + $headers[] = array("-$desc", $bug[$name]); + $headers[] = array("+$desc", $in[$name]); + } + } + + if ($array) { + return $headers; + } + + $ret = ''; + foreach ($headers as $header) { + $ret .= vsprintf("%s: %s\n", $header); + } + + return rtrim($ret); +} + function mail_bug_updates($bug, $in, $from, $ncomment, $edit=1) { $text = array(); Modified: web/php-bugs/trunk/report.php =================================================================== --- web/php-bugs/trunk/report.php 2010-02-17 21:59:41 UTC (rev 295217) +++ web/php-bugs/trunk/report.php 2010-02-17 22:05:24 UTC (rev 295218) @@ -229,7 +229,14 @@ // Allow passing in manpage to repcode (e.g., report.php?manpage=/manual/en/foo.php) if (isset($_GET['manpage'])) { - $in['repcode'] .= "\n---\nFrom manual page: " . clean($_GET['manpage']) . "\n---\n"; + $manpage = clean($_GET['manpage']); + if ($manpage[0] !== '/') { + $manpage = '/' . $manpage; + } + + $manpage = 'http://www.php.net' . $manpage; + + $in['repcode'] .= "\n---\nFrom manual page: $manpage\n---\n"; } ?>

« previous php.webmaster (#7342) next »