]> bicyclesonthemoon.info Git - ott/bsta/commitdiff
character encoding information in generated headers; password in eval_bb()
authorb <rowerynaksiezycu@gmail.com>
Fri, 12 Jan 2024 21:55:20 +0000 (21:55 +0000)
committerb <rowerynaksiezycu@gmail.com>
Fri, 12 Jan 2024 21:55:20 +0000 (21:55 +0000)
2words.1.pl
attach.1.pl
bbcode.1.pl
bsta_lib.1.pm
chat.1.pl
frame.1.pl
goto.1.pl
info.1.pl
opomba.1.pl
viewer.1.pl

index 9a151035814a88fd1da4b85ada97e8427101d428..b69ea409a84afb662a4609a5a743ba765df913bc 100644 (file)
@@ -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;
 }
index 226714f42dd2c9be034d29ebef562968dbb4b8a6..f2a124a0ca12ce92434d4d918f2e63630ea7d912 100644 (file)
@@ -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);
index 68953ab2ecd628c6bf823d040c1567535241181d..a478cdc23dd24e58916da4d96bb251d254afa112 100644 (file)
@@ -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";
index fc713655d741193ca947b488d2d3dc7e593ff99a..fe1f349eebb43f99a971cfb0f1e43b87ee9ceb7e 100644 (file)
@@ -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]<br>'."\n";
                print $fh '[url='.$_viewer_full_url.'][img]'.$_frame_full_url.'[/img][/url][/center]<br>'."\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 '    </div>'."\n";
        }
        elsif ($frame_data->{'content'} ne '') {
                print $fh '    <div id="undertext">'."\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 '    </div>'."\n";
        }
        
@@ -1483,7 +1502,13 @@ sub print_comments {
                        print $fh '       </div>'."\n";
                        print $fh '      </div>'."\n";
                        print $fh '      <div class="opomba_text">'."\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 '      </div>'."\n";
                        print $fh '     </div>'."\n";
                        print $fh '     <br>'."\n";
index 583a46780ce7218543810cdf0eb8de10d5963e1b..bf764ee0f7a291a9af32c3d1b1cf3e6f73ccf582 100644 (file)
--- 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;
 }
index 360f8ad630aedbaf258ef4175bcc805dbde1d7df..92485f34d9ef5367cd04c945b59a4f60bda0f3d4 100644 (file)
@@ -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.");
index 8ea175383dabbc5761f8f6ec268eb69f36b60022..3fc45cd5d013873caf798b099582f31815f917e5 100644 (file)
--- 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;
index 94cba163af9c6e8fe1a83bd9f046f399932b2481..d712acb212c0df448e5b4a94bd3832348baee182 100644 (file)
--- 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";
 }
index 28b3b49bb8f670c49760145b7bccaa04d6b041f8..3b2adb567abb7ecc3ee68ff521e1faa568273f43 100644 (file)
@@ -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 '      </div>'."\n";
                        print '      <div class="opomba_text">'."\n";
-                 print bb_to_html(eval_bb($content, 0))."\n";
+                 print bb_to_html(
+                               eval_bb(
+                                       $content,
+                                       0,
+                                       $password_ok ? $settings{'password'} : ''
+                               )
+                       )."\n";
                        print '      </div>'."\n";
                        print '     </div>'."\n";
                }
index 84a26bfb016434960ce793eb6f712a48dc48f78c..c62a0f77672d0949e0ac08e5fde7ce36e3bd14d1 100644 (file)
@@ -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";
 }