]> bicyclesonthemoon.info Git - ott/bsta/commitdiff
continued bugfix of 2words & index & launch
authorb <rowerynaksiezycu@gmail.com>
Fri, 29 Dec 2023 12:20:19 +0000 (12:20 +0000)
committerb <rowerynaksiezycu@gmail.com>
Fri, 29 Dec 2023 12:20:19 +0000 (12:20 +0000)
2words.1.pl
bsta_lib.1.pm
viewer.1.pl

index 186e31a70fbfb0ba79961ea848430a520afc764c..2c1cca6fd2355b051b7ca970d9a8e87fe9315934 100644 (file)
@@ -50,12 +50,8 @@ use  File::Copy;
 
 ###PERL_CGI_PATH:           CGI_PATH           = /bsta/
 ###PERL_CGI_2WORDS_PATH:    CGI_2WORDS_PATH    = /bsta/2words
-###PERL_CGI_CSS_PATH:       CGI_CSS_PATH       = /bsta/bsta.css
-###PERL_CGI_LOGO_PATH:      CGI_LOGO_PATH      = /bsta/botmlogo.png
-###PERL_CGI_VIEWER_PATH:    CGI_VIEWER_PATH    = /bsta/v
 
 ###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta/
-###PERL_DATA_COIN_PATH:     DATA_COIN_PATH     = /botm/data/bsta/coincidence
 ###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH  = /botm/data/bsta/default
 ###PERL_DATA_LIST_PATH:     DATA_LIST_PATH     = /botm/data/bsta/list
 ###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
@@ -63,14 +59,8 @@ use  File::Copy;
 ###PERL_DATA_STORY_PATH:    DATA_STORY_PATH    = /botm/data/bsta/story
 
 ###PERL_WWW_PATH:           WWW_PATH           = /botm/www/1190/bsta/
-###PERL_WWW_INDEX_PATH:     WWW_INDEX_PATH     = /botm/www/1190/bsta/index.htm
 
-###PERL_WEBSITE:            WEBSITE            = 1190.bicyclesonthemoon.info
 ###PERL_WEBSITE_NAME:       WEBSITE_NAME       = Bicycles on the Moon
-###PERL_FAVICON_PATH:       FAVICON_PATH       = /img/favicon.png
-
-###PERL_COIN_DATE:          COIN_DATE          = 13-Nov-2016 22:15
-###PERL_INTF_DATE:          INTF_DATE          = 28-Sep-2016 20:34
 
 ###PERL_STORY_LENGTH:       STORY_LENGTH       = 16
 ###PERL_PAGE_LENGTH:        PAGE_LENGTH        = 16
@@ -312,21 +302,26 @@ if (open ($story_file,"+<:encoding(UTF-8)",DATA_STORY_PATH())){
                                                        my $frame_file;
                                                        my $in_path;
                                                        my $out_path;
+                                                       my $ext;
                                                        
                                                        # prepare to ONG frame 0!
                                                        
                                                        $frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), 0);
                                                        %frame_data = read_data_file($frame_data_path);
                                                        %default    = read_data_file(DATA_DEFAULT_PATH());
-                                                       %frame_data = merge_settings(\%default, \%frame_data);
                                                        
-                                                       $frame_file = sprintf($settings{'frame'}, 0, $frame_data{'ext'});
+                                                       $ext = (defined($frame_data{'ext'})) ?
+                                                               $frame_data{'ext'} :
+                                                               $default{'ext'};
+                                                       
+                                                       $frame_file = sprintf($settings{'frame'}, 0, $ext);
                                                        $in_path  = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame_file);;
                                                        $out_path = join_path(PATH_SEPARATOR(), WWW_PATH(),  $frame_file);
                                                        
                                                        # set ONG time of frame 0
                                                        # NOTE: might get overwritten later if ONG not launched
                                                        $frame_data{'ongtime'} = $time;
+                                                       $frame_data{'timer'} = 0;
                                                        write_data_file($frame_data_path, '', '', \%frame_data);
                                                        
                                                        # update the GOTO list with frame 0
@@ -394,7 +389,7 @@ if($method eq 'HEAD') {
 my $max_page = int(($story_id - FIRSTPAGE_LENGTH - 1) / PAGE_LENGTH) + 1;
 my $newer_available = ($page > 0);
 my $older_available = ($page < $max_page);
-my $show_intf = ($intf_pass == 1) && ($ong_state == STATE=>{'inactive'});
+my $show_intf = ($intf_pass == 1) && ($ong_state == STATE->{'inactive'});
 my $id_start = 
        $story_id-1 -(
                ($page == 0)    ? 0 : (
@@ -632,185 +627,3 @@ print '   </div>'."\n";
 
 print_html_body_end(\*STDOUT);
 print_html_end(\*STDOUT);
-
-# sub writeindex {
-       # (my $indexpath, my $pass, my $mode, my $pause) = @_;
-       # my $indexfile;
-       # my $indexof;
-               
-       # if(ref($indexpath)) {
-               # $indexfile=$indexpath;
-               # unless (seek($indexfile, 0, 0)) {
-                       # return 0;
-               # }
-       # }
-       # else {
-               # unless (open ($indexfile, ">", $indexpath)) {
-                       # return 0;
-               # }
-       # }
-       
-       # $indexof = CGI_PATH;
-       # $indexof =~ s/\/$//g;
-       
-       # my %coin = readdatafile(DATA_COIN_PATH);
-       
-       # if ($pass != 1) {
-               # print $indexfile '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'."\n";
-               # print $indexfile '<html>'."\n";
-               # print $indexfile ' <head>'."\n";
-               # print $indexfile '  <title>Index of '.$indexof.'</title>'."\n";
-               # print $indexfile ' </head>'."\n";
-               # print $indexfile ' <body>'."\n";
-               # print $indexfile '<h1>Index of '.$indexof.'</h1>'."\n";
-               # print $indexfile '<table><tr><th><img src="/icons/blank.gif" alt="[ICO]"></th><th><a href="?C=N;O=D">Name</a></th><th><a href="?C=M;O=A">Last modified</a></th><th><a href="?C=S;O=A">Size</a></th><th><a href="?C=D;O=A">Description</a></th></tr><tr><th colspan="5"><hr></th></tr>'."\n";
-               # print $indexfile '<tr><td valign="top"><img src="/icons/back.gif" alt="[DIR]"></td><td><a href="/">Parent Directory</a></td><td>&nbsp;</td><td align="right">  - </td><td>&nbsp;</td></tr>'."\n";
-               # print $indexfile '<tr><td valign="top"><img src="/icons/folder.gif" alt="[DIR]"></td><td><a href="2words/">2words/</a></td><td align="right">'.INTF_DATE.'  </td><td align="right">  - </td><td>&nbsp;</td></tr>'."\n";
-               # print $indexfile '<tr><td valign="top"><img src="/icons/folder.gif" alt="[DIR]"></td><td><a href="coin/">coin/</a></td><td align="right">'.COIN_DATE.'  </td><td align="right">  - </td><td> Coincidence </td></tr>'."\n";
-               # print $indexfile '<tr><th colspan="5"><hr></th></tr>'."\n";
-               # print $indexfile '</table>'."\n";
-               # print $indexfile '<address>Apache/2.2.22 (Debian) Server at '.WEBSITE.' Port 80</address>'."\n";
-               # print $indexfile '</body></html>'."\n";
-       # }
-       # else {
-               # my %framedata;
-               # my %nextframedata;
-               # my %default;
-               
-               # %framedata = readdatafile(DATA_PATH.0);
-               # %nextframedata = readdatafile(DATA_PATH.1);
-               # %default=readdatafile(DATA_DEFAULT_PATH);
-               
-               # # if($mode == 16 && $pause) {
-                       # # $framedata{'ongtime'} = $time;
-                       # # writedatafile(DATA_PATH.0,%framedata);
-               # # }
-               
-               # foreach my $ind (keys %default) {
-                       # unless(defined($framedata{$ind})){
-                               # $framedata{$ind}=$default{$ind};
-                       # }
-                       # unless(defined($nextframedata{$ind})){
-                               # $nextframedata{$ind}=$default{$ind};
-                       # }
-               # }
-               
-               
-               # print $indexfile '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">'."\n";
-               # print $indexfile '<html lang="en"><head>'."\n";
-               # print $indexfile '<title>';
-               # if($mode == 8 || $mode == 4) {
-                       # print $indexfile 'Index of';
-               # }
-               # elsif($mode == 16) {
-                       # print $indexfile entityencode($settings{'story'});
-                       # if($pause) {
-                               # print $indexfile ' &bull; '.WEBSITE_NAME;
-                       # }
-               # }
-               # else {
-                       # print $indexfile 'Index of '.$indexof;
-               # }
-               # print $indexfile '</title>'."\n";
-               # print $indexfile '<meta http-equiv="Content-type" content="text/html; charset=UTF-8">'."\n";
-               # print $indexfile '<link rel="icon" type="image/png" href="'.FAVICON_PATH.'">'."\n";
-               # print $indexfile '<link rel="stylesheet" href="'.CGI_CSS_PATH.'">'."\n";
-               # print $indexfile '</head><body>'."\n";
-               # print $indexfile '<a href="/"><img id="botmlogo" src="'.CGI_LOGO_PATH.'" alt="'.WEBSITE.'"></a>'."\n";
-               # print $indexfile '<div id="all">'."\n";
-               
-               # print $indexfile '<div id="inst" class="ins">'."\n";
-               
-               # print $indexfile '<div id="title">'."\n";
-               # print $indexfile '<H1 id="titletext">';
-               # if($mode == 8 || $mode == 4) {
-                       # print $indexfile 'Index of';
-               # }
-               # elsif($mode == 16) {
-                       # print $indexfile entityencode($settings{'story'});
-               # }
-               # else {
-                       # print $indexfile 'Index of '.$indexof;
-               # }
-               # print $indexfile '</H1>'."\n";
-               # print $indexfile '</div>'."\n";
-               
-               # print $indexfile '</div><div id="framespace">'."\n";
-               # print $indexfile '<img src="'.CGI_PATH;
-               # if($mode == 8) {
-                       # print $indexfile 'intf-ll.gif'
-               # }
-               # elsif($mode == 4) {
-                       # print $indexfile 'intf-pp.gif'
-               # }
-               # elsif($mode == 16) {
-                       # if($pause) {
-                               # print $indexfile sprintf($settings{'frame'},0,$framedata{'ext'}).'" title="'.entityencode($framedata{'title'});
-                       # }
-                       # else {
-                               # print $indexfile 'intf-tr.gif'
-                       # }
-               # }
-               # else {
-                       # print $indexfile 'intf-kw.gif'
-               # }
-               # print $indexfile '" alt="0" id="frame">'."\n";
-               
-               # print $indexfile '</div><div id="insb" class="ins">'."\n";
-               # print $indexfile '<div id="undertext">'."\n";
-               # if($mode == 8 || $mode == 4) {
-                       # print $indexfile '<img src="/icons/back.gif" alt="[DIR]"> <a href="/">Parent Directory</a><br><img src="/icons/folder.gif" alt="[DIR]"> <a href="#">yyyyb/</a>'."\n";
-               # }
-               # elsif ($mode == 16) {
-                       # if($pause) {
-                               # print $indexfile bb2ht($framedata{'content'})."\n";
-                       # }
-                       # else {
-                               # print $indexfile "...\n";
-                       # }
-               # }
-               # else {
-                       # print $indexfile '<img src="/icons/back.gif" alt="[DIR]"> <a href="/">Parent Directory</a><br>'."\n";
-                       # print $indexfile '<img src="/icons/folder.gif" alt="[DIR]"> <a href="2words/">2words/</a> '.INTF_DATE.' - <br>'."\n";
-                       # print $indexfile '<img src="/icons/folder.gif" alt="[DIR]"> <a href="coin/">coin/</a> '.COIN_DATE.' - '.entityencode($coin{'server'})."\n";
-               # }
-               # print $indexfile '</div>'."\n";
-               
-               # print $indexfile '<div id="command">'."\n";
-               # if ($mode == 8) {
-                       # print $indexfile '[<span class="br">EE</span>:<span class="br">EE</span>:<span class="br">EE</span>]'."\n";
-               # }
-               # elsif ($mode == 4) {
-                       # print $indexfile '[<span class="ni">EE</span>:<span class="ni">EE</span>:<span class="ni">EE</span>]'."\n";
-               # }
-               # elsif ($mode == 16) {
-                       # if($pause) {
-                               # print $indexfile '[<span class="br">00</span>:<span class="br">00</span>:<span class="br">00</span>]<br>'."\n";
-                               # print $indexfile '&gt;<a href="'.CGI_VIEWER_PATH.'/1">'.entityencode($nextframedata{'title'}).'</a>'."\n";
-                       # }
-                       # else {
-                               # print $indexfile '[<span class="ni">--</span>:<span class="ni">--</span>:<span class="ni">--</span>]<br>'."\n";
-                               # print $indexfile '&gt;...<span class="inp">_</span>'."\n";
-                       # }
-               # }
-               # else {
-               # }
-               # print $indexfile '</div>'."\n";
-               
-               # print $indexfile '</div>'."\n";
-               
-               # print $indexfile '</div>'."\n";
-               # print $indexfile '<a href="/" class="cz">'.WEBSITE.'</a>'."\n";
-               
-               # print $indexfile '</body></html>'."\n";
-       # }
-       
-       # unless (ref($indexpath)) {
-               # close ($indexfile);
-       # }
-       # else {
-               # truncate ($indexfile , tell($indexfile));
-       # }
-       
-       # return 1;
-# }
index 1c19400603f5c0b256464b63645b78414f74e6ec..ee800e5b1eb6c2e79162ac49daf067d5e1e80bb9 100644 (file)
@@ -1354,7 +1354,6 @@ sub write_index {
                        $frame_file = 'intf-tr.gif';
                        $undertext = '...';
                        $timer = '--';
-                       $timer_color = 'br';
                }
                elsif ($mode == INTF_STATE->{'<<'}) {
                        $title = 'Index of';
@@ -1362,10 +1361,11 @@ sub write_index {
                        $show_parent_dir = 1;
                        $show_yb = 1;
                        $timer = 'EE';
+                       $timer_color = 'br';
                }
                elsif ($mode == INTF_STATE->{'>>'}) {
                        $title = 'Index of';
-                       $frame_file = 'intf-ll.gif';
+                       $frame_file = 'intf-pp.gif';
                        $show_parent_dir = 1;
                        $show_yb = 1;
                        $timer = 'EE';
@@ -1396,7 +1396,7 @@ sub write_index {
                print_html_start($fh);
                print_html_head_start($fh);
                
-               print $fh '  <title>'.$_title.' $bull; '.$_website_name.'</title>'."\n";
+               print $fh '  <title>'.$_title.' &bull; '.$_website_name.'</title>'."\n";
                
                print_html_head_end($fh);
                print_html_body_start($fh);
index 9205be6ddab2a9227aaea22991ad98153b6db3da..7eb559c189b35423b4e4b38c3800fd9dfa395414 100644 (file)
@@ -176,6 +176,8 @@ if (open ($state_file, "+<:encoding(UTF-8)", DATA_STATE_PATH())) {
                        my $frame_file;
                        my $in_path;
                        my $out_path;
+                       my $ext;
+                       my $ong_time = int($settings{'firstongtime'});
                        
                        %story     = read_data_file(DATA_STORY_PATH());
                        %goto_list = read_data_file(DATA_LIST_PATH);
@@ -188,6 +190,7 @@ if (open ($state_file, "+<:encoding(UTF-8)", DATA_STATE_PATH())) {
                                
                                # update ONG time of frame 1
                                $frame_data{'ongtime'} = $time;
+                               $frame_data{'timer'} = $ong_time;
                                write_data_file($frame_data_path, '', '', \%frame_data);
                                
                                # set initial state
@@ -197,15 +200,15 @@ if (open ($state_file, "+<:encoding(UTF-8)", DATA_STATE_PATH())) {
                                $state{'ip2'}   = '0.0.0.0';
                                $state{'ip3'}   = '';
                                $state{'nextong'} = (int($time / 3600) + int($settings{'firstongtime'})) * 3600 ;
-                               $state{'ongtime'} = int($settings{'firstongtime'});
+                               $state{'ongtime'} = $ong_time;
                                
                                # prepare to ONG frame 1
                                
                                # determine frame file & paths
-                               unless (defined($frame_data{'ext'})){
-                                       $frame_data{'ext'} = $default{'ext'};
-                               }
-                               $frame_file = sprintf($settings{'frame'}, $frame, $frame_data{'ext'});
+                               $ext = (defined($frame_data{'ext'})) ?
+                                       $frame_data{'ext'} :
+                                       $default{'ext'};
+                               $frame_file = sprintf($settings{'frame'}, $frame, $ext);
                                $in_path  = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame_file);
                                $out_path = join_path(PATH_SEPARATOR(), WWW_PATH(),  $frame_file);