From: b Date: Sat, 15 Mar 2025 23:49:18 +0000 (+0000) Subject: special treatment of author's comments X-Git-Tag: v1.2.12~1 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=7ec13142c4cb3a017143fdd745d63b5ee3deb2f2;p=ott%2Fbsta special treatment of author's comments --- diff --git a/bsta.css b/bsta.css index 0d7f0d2..1456c58 100644 --- a/bsta.css +++ b/bsta.css @@ -316,6 +316,26 @@ div.opomba:target:hover border-color: #bb6622; background-color: #bb6622; } +div.opomba.mywords +{ + border-color: #000000; + background-color: #000000; +} +div.opomba.mywords:hover +{ + border-color: #000000; + background-color: #000000; +} +div.opomba.mywords:target +{ + border-color: #000000; + background-color: #000000; +} +div.opomba.mywords:target:hover +{ + border-color: #000000; + background-color: #000000; +} div.opomba_info { color: #ffffff!important; diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index e0da5bc..663ad74 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -1608,13 +1608,15 @@ sub print_comments { $remove_url = merge_url($remove_url, {'query' => $password_query, 'append_query' => 1, 'preserve_fragment' => 1}); } + my $post_class = $post_data{'mywords'} ? 'opomba mywords' : 'opomba'; + my $_ID = html_entity_encode_dec($ID, 1); my $_name = html_entity_encode_dec($post_data{'name'}, 1); my $_quote_url = html_entity_encode_dec($quote_url, 1); my $_edit_url = html_entity_encode_dec($edit_url, 1); my $_remove_url = html_entity_encode_dec($remove_url, 1); - print $fh '
'."\n"; + print $fh '
'."\n"; print $fh '
'."\n"; print $fh ' '.$i.': '.$_name; if ($post_time_text ne '') { @@ -2365,6 +2367,12 @@ sub validate_words { if ($data{'edittime'} ne '') { $data{'edittime'} = int($data{'edittime'}); } + if ($data{'mywords'}) { + $data{'mywords'} = 1; + } + elsif (exists ($data{'mywords'})) { + delete $data{'mywords'}; + } return %data; } diff --git a/opomba.1.pl b/opomba.1.pl index 37a849e..26cdaa5 100644 --- a/opomba.1.pl +++ b/opomba.1.pl @@ -196,7 +196,7 @@ $words_data_path = join_path(PATH_SEPARATOR(), DATA_WORDS_PATH(), $frame); unless (open_encoded($fh, "+<:encoding(UTF-8)", $words_data_path)) { unless (open_encoded($fh, "+>:encoding(UTF-8)", $words_data_path)) { - exit output(0, '500 Internal Server Error', 'Failed opening data file.', 1); + exit output(0, HTTP_STATUS->{'internal_server_error'}, 'Failed opening data file.', 1); } } unless (flock($fh, 2)) { @@ -218,6 +218,10 @@ for (my $i=0; $i< scalar(@post_list); $i +=1) { } } +if (($cgi{'password'} eq $settings{'password'}) && (!$remove) && ($ID eq '')) { + $post_data{'mywords'} = 1; +} + if ($remove || ($ID ne '')) { unless ($index ne '') { close($fh); @@ -263,7 +267,7 @@ if ($remove || ($ID ne '')) { unless ( ($cgi{'password'} eq $post_data{'password'}) || ( ($cgi{'password'} eq $settings{'password'}) && - $password_ok + ($password_ok || $post_data{'mywords'}) ) ) { close($fh); @@ -273,6 +277,7 @@ if ($remove || ($ID ne '')) { $cgi{'password'} = $post_data{'password'}; } } + unless ($cgi{'password2'} eq '') { close($fh); # no error code to confuse spambot :) @@ -353,7 +358,7 @@ $words_data{'content'} = \@post_list; $post_data{'frame'} = $frame; $post_data{'name'} = $cgi{'username'}; -$post_data{'password'} = $cgi{'password'}; +$post_data{'password'} = $post_data{'mywords'} ? '' : $cgi{'password'}; if ($post_data{'posttime'} eq '') { $post_data{'posttime'} = $time; } @@ -482,7 +487,9 @@ sub output { $content = ''; } - my $_password = $password_ok ? html_entity_encode_dec($settings{'password'}, 1) : ''; + my $_password = ($password_ok || ($post_data{'mywords'} && $cgi{'password'} eq $settings{'password'})) ? html_entity_encode_dec($settings{'password'}, 1) : ''; + my $_post_password = ($post_data{'mywords'} && $cgi{'password'} eq $settings{'password'}) ? $_password : ''; + my $_bsta_password = $password_ok ? $_password : ''; my $_key = html_entity_encode_dec($post_data{'key'}, 1); my $_ID = html_entity_encode_dec($ID, 1); my $_title = html_entity_encode_dec($title, 1); @@ -494,7 +501,9 @@ sub output { my $_website_name = html_entity_encode_dec(WEBSITE_NAME(), 1); my $_post_url = html_entity_encode_dec(CGI_WORDS_PATH(), 1); my $_return_url = html_entity_encode_dec($return_url, 1); - + + my $preview_class = $post_data{'mywords'} ? 'opomba mywords' : 'opomba'; + print_html_start(\*STDOUT); print_html_head_start(\*STDOUT); @@ -528,7 +537,7 @@ sub output { print ' '."\n"; print ' '."\n"; print ' '.(($ID ne '') ? 'Password' : 'Optional password').': '."\n"; - print ' '."\n"; + print ' '."\n"; print ' '.(($ID ne '') ? '' : '(if you want to edit later)').''."\n"; print ' '."\n"; print ' Leave this empty: '."\n"; @@ -549,12 +558,12 @@ sub output { } print ' '."\n"; if ($password_ok) { - print ' '."\n"; + print ' '."\n"; } print ' '."\n"; if ($content ne ''){ print '
'."\n"; - print '
'."\n"; + print '
'."\n"; print '
'."\n"; print ' Preview:'."\n"; print '
'."\n";