mirror of
https://github.com/php/web-php.git
synced 2026-03-23 23:02:13 +01:00
highlight urls in notes, use <pre> instead of <tt> to preserve formatting, and say that html is disallowed entirely (although we still preserve <p>, </p>, and <br> until entries in the database are cleaned up).
This commit is contained in:
@@ -185,7 +185,6 @@ function commonHeader($title="",$dont_enclose=0,$headers_gone=0) {
|
||||
<head>
|
||||
<title>PHP<?php if ($title) echo ": $title";?></title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<meta name="MSSmartTagsPreventParsing" content="TRUE">
|
||||
</head>
|
||||
|
||||
<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"
|
||||
@@ -383,16 +382,24 @@ function clean($var) {
|
||||
|
||||
function clean_note($text) {
|
||||
$text = htmlspecialchars(trim($text));
|
||||
|
||||
/* turn urls into links */
|
||||
$text = preg_replace("/((mailto|http|ftp|nntp|news):.+?)(>|\\s|\\)|\\.\\s|$)/","<a href=\"\\1\">\\1</a>\\3",$text);
|
||||
|
||||
/* this 'fixing' code will go away eventually. */
|
||||
$fixes = array('<br>','<p>','</p>');
|
||||
reset($fixes);
|
||||
while (list(,$f)=each($fixes)) {
|
||||
$text=str_replace(htmlspecialchars($f), $f, $text);
|
||||
$text=str_replace(htmlspecialchars(strtoupper($f)), $f, $text);
|
||||
}
|
||||
|
||||
/* this will only break long lines */
|
||||
if (function_exists("wordwrap")) {
|
||||
$text = wordwrap($text);
|
||||
}
|
||||
$text = "<tt>".nl2br($text)."</tt>";
|
||||
|
||||
$text = "<pre class=\"note\">".$text."</pre>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,10 @@ Just add your comment in the big field below, and, optionally, your email
|
||||
address in the little one (usual anti-spam practices are OK, e.g.
|
||||
johnNOSPAM@doe.NO_SPAM.com).</p>
|
||||
|
||||
<p>Note that most HTML tags are not allowed in the posts. We tried
|
||||
allowing them in the past, but people invariably made a mess of
|
||||
things making the manual hard to read for everybody. You can include
|
||||
<p>, </p>, and <br> tags.</p>
|
||||
<p>Note that HTML tags are not allowed in the posts, but the note is presented
|
||||
in side a <pre> element so formatting is preserved. URLs will be turned
|
||||
into clickable links automatically. (Double-check that your note appears as you
|
||||
want during the preview. That's why it is there!)</p>
|
||||
|
||||
<p>Read the following note carefully. If your post falls into one of the
|
||||
categories mentioned there, it will be rejected by one of the editors.</p>
|
||||
|
||||
Reference in New Issue
Block a user