Re: new bug viewing/editing form
| From: | Hellekin O. Wolf | Date: | Sat, 05 Jan 2002 12:46:55 +0000 |
| Subject: | Re: new bug viewing/editing form | ||
| References: | 1 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-4277@lists.php.net to get a copy of this message | ||
At 13:27 2002-01-04 -0800, Jim Winstead wrote:
i could use some people to bang on a revamped bug viewing and editing form. you can get to it at:I suggested two functions to use for message input cleanup but the second seems to have been somehow cut. (too many columns in my editor). So, here they are again : /** * $txt from database */ function msgFormat($txt) {http://master.php.net/~jimw/bugs/bug.php?id=14841(that's just a test bug i opened which you can feel free to add comments to and otherwise mess with. don't worry, this version is hardcoded to just send the mails to me for now.) i've only tested on mozilla 0.9.7 and opera 5.0, both on linux, since i don't have ready access to anything else. *** Netscape 6 on Win32 likes it.
/* PLEASE KEEP THAT IN ORDER -- how */
/* LINK MATCHING PATTERN */
$txt = preg_replace("/([[:alpha:]]+):\/\/([\w\d-#\?=\/&]+[^\s_]+)(?<![,.:;])/i",'<a href="\1://\2">\1://\2</a>',$txt);
/* EMAIL MATCHING PATTERN */
$txt = preg_replace("/(?!mailto:)([[:alnum:]-.]+)@([[:alnum:]-.]+\.[[:alnum:]]{1,3})(?<![,.:;])/i",'<a href="mailto:\1@\2">\1@\2</a>',$txt);
/* PARAGRAPH MATCHING PATTERN */
$txt = preg_replace("/(\r\n\r\n|\n\n)/i",'<p>',$txt);
/* SINGLE LINE MATCHING PATTERN */
$txt = preg_replace("/(\r\n|\n)/i",'<br />',$txt);
return $txt;} /** * $txt to database */ function msgClean($txt) {
/* SCRIPT PATTERN MATCHING */
$txt = preg_replace("/<script([\n\r]*.*)>([\n\r]*|[^>]*.*)<\/script>/i",'',$txt);
/* STRIP UNWANTED HTML TAGS */
$txt = strip_tags($txt,"<b></b><i></i><u></u>");
return $txt;} hellekin