[Cpan-forum-commit] rev 55 - in trunk: lib/CPAN t www

svn at pti.co.il svn at pti.co.il
Wed Feb 2 00:58:28 IST 2005


Author: gabor
Date: 2005-02-02 00:58:27 +0200 (Wed, 02 Feb 2005)
New Revision: 55

Modified:
   trunk/lib/CPAN/Forum.pm
   trunk/t/010-markup.t
   trunk/www/style.css
Log:
escape HTML characters whe showing them in the editor page again

Modified: trunk/lib/CPAN/Forum.pm
===================================================================
--- trunk/lib/CPAN/Forum.pm	2005-02-01 22:31:58 UTC (rev 54)
+++ trunk/lib/CPAN/Forum.pm	2005-02-01 22:58:27 UTC (rev 55)
@@ -1207,6 +1207,7 @@
 		$new_group_id     = $post->gid->id;   	
 	}
 	$t->param("group_selector" => $self->_group_selector($new_group, $new_group_id));
+	$t->param(new_text     => CGI::escapeHTML($q->param("new_text")));
 	
 	# for previewing purposes:
 	# This is funky, in order to use the same template for regular show of a message and for

Modified: trunk/t/010-markup.t
===================================================================
--- trunk/t/010-markup.t	2005-02-01 22:31:58 UTC (rev 54)
+++ trunk/t/010-markup.t	2005-02-01 22:58:27 UTC (rev 55)
@@ -33,6 +33,7 @@
 	'a<b>c</b><code>x</code>d<code>y</code>' => q(<div class="text">a<b>c</b></div><div class="code">x</div><div class="text">d</div><div class="code">y</div>),
 	'a<i>c</i><code>x</code>d<code>y</code>' => q(<div class="text">a<i>c</i></div><div class="code">x</div><div class="text">d</div><div class="code">y</div>),
 	'a<b>c</b>d<i>x</i>f'      => q(<div class="text">a<b>c</b>d<i>x</i>f</div>),
+	'&lt;'                     => q(<div class="text">&lt;</div>),
 
 
 );
@@ -106,3 +107,9 @@
 1;
 </code>
 
+CODE
+I am using Parse::RecDescent to validate the input on this forum. Right now it can give OK/NOT OK but I'd like to be a bit more specific. E.g.I'd like to give differen error messages 
+if there is a not approved HTML tag such as &lt;img&gt; in the text 
+or if there is an opening tag withou a closing tag
+or just a single &lt; mark somewhere
+

Modified: trunk/www/style.css
===================================================================
--- trunk/www/style.css	2005-02-01 22:31:58 UTC (rev 54)
+++ trunk/www/style.css	2005-02-01 22:58:27 UTC (rev 55)
@@ -204,6 +204,7 @@
 .text {
 	background: #eeeeee;
 	white-space: pre;
+	width: 80%;
 }
 .code {
 	background: #dddddd;



More information about the Cpan-forum-commit mailing list