From 72d4c5f4c8e324a614c34d58973fa90585bb491b Mon Sep 17 00:00:00 2001 From: "Difrex(Denis Zheleztsov)" Date: Tue, 1 Jul 2014 11:27:24 +0400 Subject: [PATCH] New ui style --- II/Enc.pm | 5 ++++- II/T.pm | 16 ++++++++++++++++ t/head.html | 16 ++++++++++------ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/II/Enc.pm b/II/Enc.pm index 5c0aed0..389d48b 100644 --- a/II/Enc.pm +++ b/II/Enc.pm @@ -46,6 +46,9 @@ sub encode { $encoded =~ s/\//_/g; $encoded =~ s/\+/-/g; + # Preparsing + my $post = II::T->in_pre($data->{post}); + # Make data my %out = ( hash => $hash, @@ -54,7 +57,7 @@ sub encode { from_user => $data->{from}, to_user => $data->{to}, subg => $data->{subg}, - post => $data->{post}, + post => $post, base64 => $encoded, send => 0, ); diff --git a/II/T.pm b/II/T.pm index 6780343..ac6b74c 100644 --- a/II/T.pm +++ b/II/T.pm @@ -145,12 +145,28 @@ sub send { return $p->output(); } +# Preparsing before input to SQL +sub in_pre { + my ($self, $post) = @_; + + $post =~ s/'/\\'/g; + $post =~ s/"/\\"/g; + $post =~ s/'/\\'/g; + $post =~ s/`/\\`/g; + $post =~ s/\$/\\\$/g; + + return $post; +} + +# Preparsing output sub pre { my ( $self, $post ) = @_; $post =~ s//>/g; $post =~ s/>(.+)/>$1<\/font>/g; + $post =~ s/--/—/g; + $post =~ s/.?\*(.+)\*.?/$1<\/b>/g; $post =~ s/^$/
\n/g; $post =~ s/(.?)\n/$1
\n/g; $post diff --git a/t/head.html b/t/head.html index 8bac01a..a5f7e0d 100644 --- a/t/head.html +++ b/t/head.html @@ -8,7 +8,7 @@ .post { border-width: 1; border: solid; - border-color: #C7BA6C; + border-color: #CCC; border-radius: 10px; margin-top: 0.5em; margin-left: 15%; @@ -17,9 +17,9 @@ } .post h2 { display: block; - /*position: relative;*/ - background-color: #C7BA6C; - border-color: #999; + background-color: #CCC; + border-color: #C9C9C9; + border-style: solid; color: #222; border-radius: 5px; padding-left: 0.5em; @@ -28,13 +28,15 @@ margin-top: 0.5em; margin-bottom: 0px; } + .post h2:hover { + background-color: #c4c4c4; + } .post img { display: inline-block; border-radius: 10px; } .subg { display: block; - /*background-color: #C7CCCA;*/ border-radius: 5px; margin-top: 0.5em; margin-left: 15%; @@ -57,12 +59,14 @@ display: block; margin-left: 0.5em; margin-top: -0.8em; + margin-right: 0.5em; } .headall { text-align: center; display: block; color: #000; - background-color: #C7BA6C; + /*background-color: #C7BA6C;*/ + background-color: #C9C9C9; border-radius: 5px; width: 75%; position: top;