Bug linking functionality
| From: | Justin Plock | Date: | Wed, 18 Dec 2002 21:55:34 +0000 |
| Subject: | Bug linking functionality | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-7344@lists.php.net to get a copy of this message | ||
Hi all,
I hope this is the correct place to post this, but I added a neat
feature to bug.php to allow users to post references to other bug posts in
the form of #ID.
For example: A user could type #123 and it would be replaced with <a
href="bug.php?id=123">#123</a>, allowing the user to view that bug posting.
I added this simple functionality in another system I was developing and
found it useful.
I've pasted the diff at the end of this email.
-Justin Plock
Index: bug.php
===================================================================
RCS file: /repository/php-bugs-web/bug.php,v
retrieving revision 1.40
diff -u -r1.40 bug.php
--- bug.php 1 Oct 2002 17:05:16 -0000 1.40
+++ bug.php 18 Dec 2002 21:49:41 -0000
@@ -453,7 +453,9 @@
echo "<b>[",format_date($ts),"] ",htmlspecialchars($email),
"</b>\n";
echo "<pre class=\"note\">";
- echo
addlinks(preg_replace("/(\r?\n){3,}/","\n\n",wordwrap($comment,72,"\n",1)));
+ $note =
addlinks(preg_replace("/(\r?\n){3,}/","\n\n",wordwrap($comment,72,"\n",1)));
+ preg_replace('/#([0-9]+)/', "<a
href=\"$PHP_SELF?id=\\1\">#\\1</a>",
$note);
+ echo $note;
echo "</pre>\n";
echo "</div>";
}