From: b Date: Sun, 8 Oct 2023 22:49:46 +0000 (+0000) Subject: bugfix new viewer X-Git-Tag: v1.0.0~53 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=1fb9bf8cef125f699ec261644a6675e47056a1ef;p=botm%2Foldlogs bugfix new viewer --- diff --git a/bsta_lib.1.pm b/bsta_lib.1.pm index 4d5450c..42c700e 100644 --- a/bsta_lib.1.pm +++ b/bsta_lib.1.pm @@ -57,6 +57,8 @@ use botm_common ( 'read_data_file', 'write_data_file' ); +###PERL_PATH_SEPARATOR: PATH_SEPARATOR = / + ###PERL_CGI_PATH: CGI_PATH = /bsta/ ###PERL_CGI_BBCODE_PATH: CGI_BBCODE_PATH = /bsta/b ###PERL_CGI_CSS_PATH: CGI_CSS_PATH = /bsta/bsta.css @@ -222,7 +224,7 @@ sub get_remote_addr { sub get_frame { (my $cgi) = @_; - if ($cgi{'f'} =~ /^.+$/) { + if ($cgi->{'f'} =~ /^.+$/) { return int($&); } elsif ($ENV{'PATH_INFO'} =~ /^\/(.+)$/) { @@ -237,7 +239,7 @@ sub get_frame { sub get_password { (my $cgi) = @_; - if ($cgi{'p'} =~ /^.+$/) { + if ($cgi->{'p'} =~ /^.+$/) { return $&; } else { @@ -434,7 +436,7 @@ sub bbtree { # $new_ind = $ind.'.'.$bbtree{$ind.'.count'}; } else { - $debug .= debug($printdebug, "[$new_$ind]tag: $tag\n"); + $debug .= debug($printdebug, "[$new_ind]tag: $tag\n"); $bbtree{$new_ind.'.type' } = 'tag'; $bbtree{$new_ind.'.name' } = '/'.$tag_name; $bbtree{$new_ind.'.value' } = $tag_value; @@ -476,7 +478,7 @@ sub bbtree { $bb = ''; } } - my $final_ind = '_.'.$bbtree{"_.count"} + my $final_ind = '_.'.$bbtree{"_.count"}; $debug .= debug($printdebug, "[$final_ind]automatic tag: [/ht]\n -->\n"); $bbtree{$final_ind.'.type' } = "tag"; $bbtree{$final_ind.'.name' } = '/ht'; @@ -512,7 +514,7 @@ sub convtree { $debug .= debug($printdebug, "[$level:$ind:".int($bbtree->{$ind.'.count'})."]"); #normal text if ($bbtree->{$ind.'.type'} eq 'text') { - my $text = $bbtree->{$ind.'.value'} + my $text = $bbtree->{$ind.'.value'}; $debug .= debug($printdebug, "text: ".$text); $out .= $escape ? html_encode_line($text) : $text; @@ -541,7 +543,7 @@ sub convtree { $level -= 1; $debug .= debug($printdebug, "[<]"); if ($level >= 0) { - $goto-next = 'nd'; + $goto_next = 'nd'; } else { # time to end this @@ -558,7 +560,7 @@ sub convtree { if (exists($tags->{$name.'='.$value})) { $out .= $tags->{$name.'='} . - $tags->{$name.'='.$value'} . + $tags->{$name.'='.$value} . $tags->{$name.'/='}; } else { @@ -640,7 +642,7 @@ sub bb_to_html { my $debug; ($debug, %bbtree) = bbtree($bb, $printdebug); - ($debug, $ht) = convtree ($printdebug, $debug, 'html', %bbtree); + ($debug, $ht) = convtree ($printdebug, $debug, 'html', \%bbtree); return $ht; } @@ -760,6 +762,7 @@ sub print_html_end { } sub print_html_head_start { + (my $fh) = @_; print $fh ''."\n"; print $fh ''."\n"; print $fh ''."\n"; @@ -822,7 +825,7 @@ sub print_viewer_page { my $text_mode = int($context->{'text_mode'}); my $timer_unlocked = int($context->{'timer_unlocked'}); - my $timer = int($context->{'timer'}; + my $timer = int($context->{'timer'}); my $last_frame = int($state->{'last'}); my $ong_state = int($state->{'state'}); @@ -851,25 +854,25 @@ sub print_viewer_page { $timer_s = 'EE'; } - my $prev_available = (($frame > 0) && $access'); - my $next_available = ($password_ok' || ($next_frame <= $last_frame)); + my $prev_available = (($frame > 0) && $access); + my $next_available = ($password_ok || ($next_frame <= $last_frame)); my $prefetch_next = ( $password_ok || - ($next_frame < $tast_frame) || ( + ($next_frame < $last_frame) || ( ($next_frame <= $last_frame) && ($ong_state >= STATE->{'ready'}) ) ); my $show_timer = ( - ($frame == $last_frame)) && ( + ($frame == $last_frame) && ( ($ong_state == STATE->{'waiting'}) || ($ong_state == STATE->{'ready'}) ) ); my $show_command = ( - $password_ok' || - ($frame' < $last_frame) || ( - ($ong_state) >= STATE->{'ready'}) && + $password_ok || + ($frame < $last_frame) || ( + ($ong_state >= STATE->{'ready'}) && $context->{'show_command'} ) ); @@ -919,7 +922,7 @@ sub print_viewer_page { $bbcode_url = merge_url( $viewer_url, {'query'=>{ - 'b' = TEXT_MODE->{'bb'} + 'b' => TEXT_MODE->{'bb'} }} ); } @@ -927,7 +930,7 @@ sub print_viewer_page { $info_url = merge_url( $viewer_url, {'query'=>{ - 'b' = TEXT_MODE->{'info'} + 'b' => TEXT_MODE->{'info'} }} ); } @@ -962,7 +965,7 @@ sub print_viewer_page { if ($nextframe_indirect) { $frame_next_url = merge_url( {'path' => CGI_FRAME_PATH()}, - {'path' => $nextframe} + {'path' => $next_frame} ); } elsif ($next_frame_data->{'frame'} ne '') { @@ -1099,7 +1102,7 @@ sub print_viewer_page { } print '>'; if ($show_command_link) { - print $fh ''; + print $fh ''; } if ($show_command) { print $fh $_command; @@ -1114,7 +1117,7 @@ sub print_viewer_page { print $fh '\n\n"; @@ -1156,7 +1159,7 @@ sub write_index { my $settings ) = @_; - if ($mode eq viewer) { + if ($mode eq 'viewer') { my %frame_data = read_data_file(join_path(PATH_SEPARATOR(), DATA_PATH(), 0)); my %next_frame_data= read_data_file(join_path(PATH_SEPARATOR(), DATA_PATH(), 1)); my %default = read_data_file(DATA_DEFAULT_PATH()); diff --git a/settings.txt b/settings.txt index 59fa4b7..a346d99 100644 --- a/settings.txt +++ b/settings.txt @@ -140,7 +140,7 @@ PERL_SET_PATH = \$ENV{'PATH'} = @_PERL_STR($path); PERL_EXPORT_VERSION = @_PERL_OUR_STR( VERSION, $_version) -PERL_PATH_SEPARATOR = = @_PERL_CONSTANT_STR( PATH_SEPARATOR, $_PATH_SEPARATOR) +PERL_PATH_SEPARATOR = @_PERL_CONSTANT_STR( PATH_SEPARATOR, $_PATH_SEPARATOR) PERL_CGI_PATH = @_PERL_CONSTANT_STR( CGI_PATH , $_cgi_path ) PERL_CGI_2WORDS_PATH = @_PERL_CONSTANT_STR( CGI_2WORDS_PATH, $_cgi_2words_path) diff --git a/viewer.1.pl b/viewer.1.pl index 3c59102..91d5d5c 100644 --- a/viewer.1.pl +++ b/viewer.1.pl @@ -33,7 +33,7 @@ use botm_common ( 'join_path' ); use bsta_lib ( - 'STATE', 'TEXT_MODE' + 'STATE', 'TEXT_MODE', 'fail_method', 'fail_content_type', 'get_remote_addr', 'get_frame', 'get_password', 'merge_settings', @@ -122,7 +122,7 @@ if ($frame >= 0) { %frame_data= read_data_file($frame_data_path); } -$password_ok = ($password eq $settings{'password'}) { +$password_ok = ($password eq $settings{'password'}); # state & activation logic if (open ($state_file, "+<:encoding(UTF-8)", DATA_STATE_PATH())) { @@ -209,7 +209,7 @@ if (open ($state_file, "+<:encoding(UTF-8)", DATA_STATE_PATH())) { $goto_list{'title-1'} = $frame_data{'title'}; $goto_list{'ongtime-1'} = $frame_data{'ongtime'}; - if (copy ($inpath, $outpath)) { + if (copy ($in_path, $out_path)) { write_index('viewer', \%state, \%settings); write_data_file($state_file, '','', \%state); write_data_file(DATA_LIST_PATH(),'','', \%goto_list);