From: b Date: Fri, 12 Jan 2024 21:55:20 +0000 (+0000) Subject: character encoding information in generated headers; password in eval_bb() X-Git-Tag: v1.2.3~1 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=b74f635ec52c7cd335c7ca16d4b27d3e042ed36d;p=ott%2Fbsta character encoding information in generated headers; password in eval_bb() --- diff --git a/2words.1.pl b/2words.1.pl index 9a15103..b69ea40 100644 --- a/2words.1.pl +++ b/2words.1.pl @@ -378,7 +378,7 @@ if (open_encoded($fh, "+<:encoding(UTF-8)", DATA_STORY_PATH())) { close($fh); } -print "Content-type: text/html\n\n"; +print "Content-type: text/html; charset=UTF-8\n\n"; if($method eq 'HEAD') { exit; } diff --git a/attach.1.pl b/attach.1.pl index 226714f..f2a124a 100644 --- a/attach.1.pl +++ b/attach.1.pl @@ -106,8 +106,6 @@ if ($method eq 'POST') { } } -# print "content-type: text/plain\n\n"; - $ID = get_id( \%cgi); $password = get_password(\%cgi); @@ -170,8 +168,12 @@ else { print 'Content-length: '.$file_info[7]."\n"; } } -print 'Content-type: '.$file_data{'content-type'}."\n"; -print 'Content-disposition: attachment; filename="'.$file_name.'"'."\n"; +if ($file_data{'content-type'} ne '') { + print 'Content-type: '.$file_data{'content-type'}."\n"; +} +if ($file_name ne '') { + print 'Content-disposition: inline; filename="'.$file_name.'"'."\n"; +} unless ($direct) { unless (binmode STDOUT) { close($fh); diff --git a/bbcode.1.pl b/bbcode.1.pl index 68953ab..a478cdc 100644 --- a/bbcode.1.pl +++ b/bbcode.1.pl @@ -148,7 +148,7 @@ else { ); } -print "Content-type: text/plain\n"; +print "Content-type: text/plain; charset=UTF-8\n"; if(!$access) { print "Status: 403 Forbidden\n"; } @@ -167,7 +167,12 @@ my $frame_url = merge_url( {'path' => CGI_PATH()}, {'path' => $frame_file} ); -my $content = bb_to_bbcode(eval_bb($frame_data{'content'}, 1)); +my $content = bb_to_bbcode( + eval_bb( + $frame_data{'content'}, + 1 + ) +); print '[quote][center][size=200]'.$frame_data{'title'}.'[/size]'."\n"; print '[url='.$viewer_url.'][img]'.$frame_url.'[/img][/url][/center]'."\n"; diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index fc71365..fe1f349 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -715,7 +715,7 @@ sub bb_to_bbcode { } sub eval_bb { - (my $bb, my $full_url) = @_; + (my $bb, my $full_url, my $password) = @_; my $value; my $before; my $after; @@ -753,6 +753,12 @@ sub eval_bb { else { $value = ''; } + if (($value ne '') && ($password ne '')) { + $value = merge_url( + $value, + {'query' => {'p' => $password}} + ); + } $bb = $before . $value . $after; } return $bb; @@ -1226,14 +1232,27 @@ sub print_viewer_page { print $fh '[quote][center][size=200]'.$_title.'[/size]
'."\n"; print $fh '[url='.$_viewer_full_url.'][img]'.$_frame_full_url.'[/img][/url][/center]
'."\n"; - print $fh html_encode_line(bb_to_bbcode(eval_bb($frame_data->{'content'}, 1))); + print $fh html_encode_line( + bb_to_bbcode( + eval_bb( + $frame_data->{'content'}, + 1 + ) + ) + ); print $fh '[/quote]'."\n"; print $fh ' '."\n"; } elsif ($frame_data->{'content'} ne '') { print $fh '
'."\n"; - print $fh bb_to_html(eval_bb($frame_data->{'content'}), 0)."\n"; + print $fh bb_to_html( + eval_bb( + $frame_data->{'content'}, + 0, + $password_ok ? $settings->{'password'} : '' + ) + )."\n"; print $fh '
'."\n"; } @@ -1483,7 +1502,13 @@ sub print_comments { print $fh ' '."\n"; print $fh ' '."\n"; print $fh '
'."\n"; - print $fh bb_to_html(eval_bb($post_data{'content'}), 0)."\n"; + print $fh bb_to_html( + eval_bb( + $post_data{'content'}, + 0, + $password_ok ? $settings->{'password'} : '' + ) + )."\n"; print $fh '
'."\n"; print $fh ' '."\n"; print $fh '
'."\n"; diff --git a/chat.1.pl b/chat.1.pl index 583a467..bf764ee 100644 --- a/chat.1.pl +++ b/chat.1.pl @@ -277,7 +277,7 @@ else { } } -print "Content-type: text/html\n\n"; +print "Content-type: text/html; charset=UTF-8\n\n"; if($method eq 'HEAD') { exit; } diff --git a/frame.1.pl b/frame.1.pl index 360f8ad..92485f3 100644 --- a/frame.1.pl +++ b/frame.1.pl @@ -201,7 +201,9 @@ unless (binmode($fh)) { if (my @file_info = stat_encoded($frame_path)){ print 'Content-length: '.$file_info[7]."\n"; } -print 'Content-type: '.$frame_data{'content-type'}."\n"; +if ($frame_data{'content-type'} ne '') { + print 'Content-type: '.$frame_data{'content-type'}."\n"; +} unless (binmode STDOUT) { close($fh); exit fail_500("Can't switch output to binary mode."); diff --git a/goto.1.pl b/goto.1.pl index 8ea1753..3fc45cd 100644 --- a/goto.1.pl +++ b/goto.1.pl @@ -116,7 +116,7 @@ $ong_state = int($state{'state'}); $password_ok = ($password eq $settings{'password'}); $password_query = url_query_encode({'p', $settings{'password'}}); -print "Content-type: text/html\n"; +print "Content-type: text/html; charset=UTF-8\n"; print "\n"; if($method eq 'HEAD') { exit; diff --git a/info.1.pl b/info.1.pl index 94cba16..d712acb 100644 --- a/info.1.pl +++ b/info.1.pl @@ -193,7 +193,7 @@ else { $state{'ip3'} = 1; } } - print "Content-type: text/plain\n\n"; + print "Content-type: text/plain; charset=UTF-8\n\n"; if ($method eq 'HEAD') { exit; } @@ -247,7 +247,7 @@ if ( $info_data{'frame'} = sprintf($settings{'frame'}, $frame, $info_data{'ext'}); } -print "Content-type: text/plain\n"; +print "Content-type: text/plain; charset=UTF-8\n"; if (!$access) { print "Status: 403 Forbidden\n"; } diff --git a/opomba.1.pl b/opomba.1.pl index 28b3b49..3b2adb5 100644 --- a/opomba.1.pl +++ b/opomba.1.pl @@ -441,7 +441,7 @@ sub output { return redirect ($method, $return_url, 303); } - print "Content-type: text/html\n"; + print "Content-type: text/html; charset=UTF-8\n"; if ($status ne '') { print 'Status: '.$status."\n"; } @@ -577,7 +577,13 @@ sub output { print ' Preview:'."\n"; print ' '."\n"; print '
'."\n"; - print bb_to_html(eval_bb($content, 0))."\n"; + print bb_to_html( + eval_bb( + $content, + 0, + $password_ok ? $settings{'password'} : '' + ) + )."\n"; print '
'."\n"; print ' '."\n"; } diff --git a/viewer.1.pl b/viewer.1.pl index 84a26bf..c62a0f7 100644 --- a/viewer.1.pl +++ b/viewer.1.pl @@ -297,7 +297,7 @@ $words_data_path = join_path(PATH_SEPARATOR(), DATA_WORDS_PATH(), $frame); 1, # as list ); -print "Content-type: text/html\n"; +print "Content-type: text/html; charset=UTF-8\n"; if(!$access) { print "Status: 403 Forbidden\n"; }