1
0
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:
jim winstead
2002-01-02 00:37:01 +00:00
parent ab2f28fa63
commit 2d72d85eb4
3 changed files with 17 additions and 6 deletions

View File

@@ -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):.+?)(&gt;|\\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;
}

View File

@@ -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
&lt;p&gt;, &lt;/p&gt;, and &lt;br&gt; tags.</p>
<p>Note that HTML tags are not allowed in the posts, but the note is presented
in side a &lt;pre&gt; 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>

View File

@@ -36,6 +36,10 @@ code, pre {
font-size: 90%;
}
pre.note {
font-size: 80%;
}
h1 {
font-family: arial,helvetica,sans-serif;
font-size: 140%;