]> mj.ucw.cz Git - pciids.git/commitdiff
Fix escaping of characters in stock answers
authorMichal Vaner <vorner@ucw.cz>
Thu, 4 Sep 2008 15:19:04 +0000 (17:19 +0200)
committerMichal Vaner <vorner@ucw.cz>
Thu, 4 Sep 2008 15:19:04 +0000 (17:19 +0200)
PciIds/Html/Admin.pm

index c539686c81fd6f9054b0e4b2cdd43909536c0bc2..e90b7a9646a71f26b1e7229992a2f28dd8ac7d71 100644 (file)
@@ -72,8 +72,8 @@ sub loadStock() {
                        while( defined( $text = <ANS> ) ) {
                                chomp $text;
                                last if $text eq '';
-                               $lines .= '<br>' if $lines ne '';
-                               $lines .= encode( $text );
+                               $lines .= "\n" if $lines ne '';
+                               $lines .= $text;
                        }
                        push @stock, [ encode( $name ), $lines ];
                }
@@ -110,6 +110,8 @@ sub genNewAdminForm( $$$$$ ) {
                print "function answers() {\nreturn new Array( \"\" ";
                foreach( @{$stock} ) {
                        my( $x, $text ) = @{$_};
+                       $text =~ s/"/\\"/g;
+                       $text =~ s/\n/\\n/g;
                        print ', "'.$text.'"';
                }
                print ");\n}\n";