]> bicyclesonthemoon.info Git - ott/bsta/blob - 2words.1.pl
add source & license & author information; fix fake index html bug
[ott/bsta] / 2words.1.pl
1 ###RUN_PERL: #!/usr/bin/perl
2
3 # /bsta/2words
4 # 2words is generated from 2words.1.pl.
5 #
6 # The wordgame interface
7 #
8 # Copyright (C) 2016, 2017, 2023, 2024  Balthasar SzczepaƄski
9 #
10 # This program is free software: you can redistribute it and/or modify
11 # it under the terms of the GNU Affero General Public License as
12 # published by the Free Software Foundation, either version 3 of the
13 # License, or (at your option) any later version.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU Affero General Public License for more details.
19 #
20 # You should have received a copy of the GNU Affero General Public License
21 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
23 use strict;
24 use utf8;
25 # use Encode::Locale ('decode_argv');
26 use Encode ('encode', 'decode');
27
28 ###PERL_LIB: use lib /botm/lib/bsta
29 use botm_common (
30         'read_data_file', 'write_data_file',
31         'join_path',
32         'merge_url',
33         'read_header_env',
34         'html_entity_encode_dec',
35         'url_query_decode'
36 );
37 use bsta_lib (
38         'STATE', 'INTF_STATE',
39         'get_id',
40         'fail_method', 'fail_content_type',
41         'print_html_start', 'print_html_end',
42         'print_html_head_start', 'print_html_head_end',
43         'print_html_body_start', 'print_html_body_end',
44         'write_index',
45         'get_remote_addr',
46         'merge_settings',
47         'ong'
48 );
49
50 ###PERL_PATH_SEPARATOR:     PATH_SEPARATOR     = /
51
52 ###PERL_CGI_PATH:           CGI_PATH           = /bsta/
53 ###PERL_CGI_2WORDS_PATH:    CGI_2WORDS_PATH    = /bsta/2words
54
55 ###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
56 ###PERL_DATA_STATE_PATH:    DATA_STATE_PATH    = /botm/data/bsta/state
57 ###PERL_DATA_STORY_PATH:    DATA_STORY_PATH    = /botm/data/bsta/story
58
59 ###PERL_WEBSITE_NAME:       WEBSITE_NAME       = Bicycles on the Moon
60
61 ###PERL_STORY_LENGTH:       STORY_LENGTH       = 16
62 ###PERL_PAGE_LENGTH:        PAGE_LENGTH        = 16
63 ###PERL_FIRSTPAGE_LENGTH:   FIRSTPAGE_LENGTH   = 4
64
65 binmode STDIN,  ':encoding(UTF-8)';
66 binmode STDOUT, ':encoding(UTF-8)';
67 binmode STDERR, ':encoding(UTF-8)';
68 # decode_argv();
69
70 my %http;
71 my %cgi;
72 my %story;
73 my %new_story;
74 my %settings;
75 my %state;
76
77 my $time = time();
78 srand ($time-$$);
79
80 my $method;
81 my $IP;
82 my $words;
83 my $color2;
84 my $last_IP;
85 my $story_id;
86 my $turn;
87 my $message;
88 my $first_letter;
89 my $second_letter;
90 my $last_letter;
91 my $intf_state;
92 my $intf_pass;
93 my $intf_pause;
94 my $intf_mode;
95 my $story_i_path;
96 my $story_file;
97 my $story_lock;
98 my @story_lines;
99 my $ong_state;
100 my $page;
101 my $cmd_clear;
102 my $cmd_clear_all;
103
104
105 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
106 ###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
107
108 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
109         $method = $1;
110 }
111 else {
112         exit fail_method($ENV{'REQUEST_METHOD'}, 'GET, POST, HEAD');
113 }
114
115 %http = read_header_env(\%ENV);
116 %cgi = url_query_decode($ENV{'QUERY_STRING'});
117
118 if ($method eq 'POST') {
119         if ($http{'content-type'} eq 'application/x-www-form-urlencoded') {
120                 my %cgi_post = url_query_decode( <STDIN> );
121                 %cgi = merge_settings(\%cgi, \%cgi_post);
122         }
123         # multipart not supported
124         else{
125                 exit fail_content_type($method, $http{'content-type'});
126         }
127 }
128
129 $IP = get_remote_addr();
130 $page = get_id(\%cgi);
131 if ($cgi{'words'} ne '') {
132         $words = $cgi{'words'};
133 }
134
135 %settings = read_data_file(DATA_SETTINGS_PATH());
136 %state    = read_data_file(DATA_STATE_PATH());
137 $ong_state = int($state{'state'});
138 $cmd_clear     = $settings{'password'}.' clear';
139 $cmd_clear_all = $settings{'password'}.' clearall';
140
141 $story_lock=0;
142 if (open ($story_file, "+<:encoding(UTF-8)", encode('locale_fs', DATA_STORY_PATH()))){
143         $story_lock=1;
144         if (flock($story_file,2)) {
145                 $story_lock=2;
146         }
147         %story = read_data_file($story_file);
148         
149         if ($story{'lastip'} =~ /^.+$/) {
150                 $last_IP=$&;
151         }
152         else {
153                 $last_IP='0.0.0.0';
154         }
155         
156         $last_letter = lc($story{'letter'});
157         $story_id   = int($story{'id'});
158         $intf_pass  = int($story{'pass'});
159         $intf_state = int($story{'state'});
160         $intf_mode  = $intf_state & INTF_STATE->{'mode'};
161         $intf_pause = $intf_state & INTF_STATE->{'||'};
162         
163         if ($IP ne $last_IP) {
164                 $turn = 1;
165         }
166         else {
167                 $turn = 0;
168         }
169         
170         if (
171                 ($words eq $cmd_clear) ||
172                 ($words eq $cmd_clear_all) ||
173                 ($intf_state < 0)
174         ) {
175                 if (
176                         ($words eq $cmd_clear_all) ||
177                         ($intf_state < -1)
178                 ) {
179                         $story{'id'} = 0;
180                 }
181                 $story{'content'} = '';
182                 $story{'lastip' } = '0.0.0.0';
183                 $story{'letter' } = '';
184                 $story{'pass'   } = 0;
185                 $story{'state'  } = INTF_STATE->{'X'};
186                 $turn = 0;
187                 if ($ong_state == STATE->{'inactive'}) {
188                         write_index(
189                                 \%state,
190                                 \%settings,
191                                 $story{'pass'},
192                                 $story{'state'},
193                                 0 # pause
194                         );
195                 }
196                 write_data_file($story_file, '', '', \%story);
197         }
198         
199         if ($words ne '') {
200                 if (!$turn) {
201                         $message = "It's not your turn.";
202                 }
203                 # TODO: consider allowing non-ASCII letters in words.
204                 # (not very important in English language)
205                 elsif ($words =~ /^([!"\(\),\.:;\?][ \t]*)?([A-Za-z][A-Za-z'\-]*[A-Za-z']?)([!"\(\),\.:;\? \t][ \t]*)([A-Za-z][A-Za-z'\-]*[A-Za-z']?)([!"\(\),\.:;\?]?[ \t]*)$/) {
206                         # we have 2 words
207                         $first_letter  = lc(substr($2, 0, 1));
208                         $second_letter = lc(substr($4, 0, 1));
209                         if (
210                                 ($first_letter ne $last_letter) &&
211                                 ($last_letter ne '')
212                         ) {
213                                 $message = 'The first word must start with '.uc($last_letter).'.';
214                         }
215                         elsif ($first_letter eq $second_letter) {
216                                 $message = 'The second word can\'t also start with '.uc($first_letter).'.';
217                         }
218                         else {
219                                 # words are valid
220                                 # update state
221                                 $story{'content'} = $story{'content'} . $words."\n";
222                                 $turn = 0;
223                                 $story{'lastip'} = $IP;
224                                 $story{'letter'} = $second_letter;
225                                 
226                                 if ($cgi{'next'} ne '') {
227                                         # start next game
228                                         if (split(/\r?\n/,$story{'content'}) >= (STORY_LENGTH-1)) {
229                                                 # store finished game
230                                                 $story_i_path = DATA_STORY_PATH.$story_id;
231                                                 write_data_file($story_i_path, '', '', \%story);
232                                                 # init new game
233                                                 $new_story{'id'     } = $story_id + 1;
234                                                 $new_story{'letter' } = '';
235                                                 $new_story{'lastip' } = $IP;
236                                                 $new_story{'content'} = '';
237                                                 $new_story{'pass'   } = 0;
238                                                 $new_story{'state'  } = INTF_STATE->{'X'};
239                                                 # reset hidden interface
240                                                 $intf_state = INTF_STATE->{'X'};
241                                                 $intf_pass = 0;
242                                                 $intf_mode = INTF_STATE->{'X'};
243                                                 $intf_pause= 0;
244                                                 if($ong_state == STATE->{'inactive'}) {
245                                                         # ONG not activated yet; reset index
246                                                         write_index(
247                                                                 \%state,
248                                                                 \%settings,
249                                                                 $intf_pass,
250                                                                 $intf_mode,
251                                                                 $intf_pause
252                                                         );
253                                                 }
254                                                 # save new game
255                                                 write_data_file($story_file, '', '', \%new_story);
256                                         }
257                                         else {
258                                                 $message = 'To early to finish this wordgame.';
259                                                 write_data_file($story_file, '', '', \%story);
260                                         }
261                                 }
262                                 else {
263                                         # continue the game
264                                         if ($intf_pass == 1) {
265                                                 # hidden interface was already active; deactivate
266                                                 $intf_pass = 2;
267                                                 $story{'pass'} = 2;
268                                                 if($ong_state == STATE->{'inactive'}) {
269                                                         write_index(
270                                                                 \%state,
271                                                                 \%settings,
272                                                                 $intf_pass,
273                                                                 $intf_mode,
274                                                                 $intf_pause
275                                                         );
276                                                 }
277                                         }
278                                         elsif(lc($2).' '.lc($4) eq $settings{'unlock'}) {
279                                                 # correct password for the hidden interface!
280                                                 if ($intf_pass != 0) {
281                                                         $message = 'The password has already been used in this story.';
282                                                 }
283                                                 elsif ($ong_state != STATE->{'inactive'}) {
284                                                         # ONG already active, nothing to do here
285                                                         $message = "???";
286                                                 }
287                                                 else {
288                                                         # ready to activate?
289                                                         my $r;
290                                                         
291                                                         # ONG tape interface
292                                                         $r = ong(
293                                                                 'i',   # ID: tape interface
294                                                                 $time, # ONG time;    not relevant
295                                                                 0,     # timer;       not relevant
296                                                                 0,     # update;      not relevant
297                                                                 0,     # print
298                                                                 \%settings,         # not relevant
299                                                                 '',    # %default;    not relevant
300                                                                 '',    # %frame_data; not relevant
301                                                                 ''     # $goto_list;  not relevant
302                                                         );
303                                                         if ($r) {
304                                                                 # ONG CFRT
305                                                                 $r = ong(
306                                                                         'c',   # ID: CFRT
307                                                                         $time, # ONG time;   not relevant
308                                                                         0,     # timer;      not relevant
309                                                                         0,     # update;     not relevant
310                                                                         0,     # print
311                                                                         \%settings,
312                                                                         '',    # %default
313                                                                         '',    # %frame_data
314                                                                         ''     # $goto_list; not relevant
315                                                                 );
316                                                         }
317                                                         if ($r) {
318                                                                 # ONG frame 0!
319                                                                 $r = ong(
320                                                                         0,     # frame ID
321                                                                         $time, # ONG time; might get overwritten later
322                                                                         0,     # timer
323                                                                         0,     # update
324                                                                         0,     # print
325                                                                         \%settings,
326                                                                         '',    # %default
327                                                                         '',    # %frame_data
328                                                                         ''     # $goto_list
329                                                                 );
330                                                         }
331                                                         if($r) {
332                                                                 # new state of hidden interface
333                                                                 $intf_pass = 1;
334                                                                 $intf_state = INTF_STATE->{'X'};
335                                                                 $intf_mode  = INTF_STATE->{'X'};
336                                                                 $intf_pause = 0;
337                                                                 $story{'pass'} = 1;
338                                                                 $story{'state'} = INTF_STATE->{'X'};
339                                                                 write_index(
340                                                                         \%state,
341                                                                         \%settings,
342                                                                         $intf_pass,
343                                                                         $intf_mode,
344                                                                         $intf_pause
345                                                                 );
346                                                         }
347                                                 }
348                                         }
349                                         write_data_file($story_file, '', '', \%story);
350                                 }
351                         }
352                 }
353                 else {
354                         $message = 'Please, two words, not more, not less (some punctuation is allowed).';
355                 }
356         }
357         elsif (
358                 ($cgi{'s'} ne '') &&
359                 ($intf_pass == 1) &&
360                 ($ong_state == STATE->{'inactive'})
361         ) {
362                 $intf_state = int($cgi{'s'}) & INTF_STATE->{'mask'};
363                 $intf_mode  = $intf_state & INTF_STATE->{'mode'};
364                 $intf_pause = $intf_state & INTF_STATE->{'||'};
365                 $story{'state'} = $intf_state;
366                 write_index(
367                         \%state,
368                         \%settings,
369                         $intf_pass,
370                         $intf_mode,
371                         $intf_pause
372                 );
373                 write_data_file($story_file, '', '', \%story);
374         }
375         @story_lines = split(/\r?\n/, $story{'content'});
376         if(@story_lines & 1) {
377                 $turn = !$turn;
378         }
379         
380         close($story_file);
381 }
382
383 print "Content-type: text/html\n\n";
384 if($method eq 'HEAD') {
385         exit;
386 }
387
388 my $max_page = int(($story_id - FIRSTPAGE_LENGTH - 1) / PAGE_LENGTH) + 1;
389 my $newer_available = ($page > 0);
390 my $older_available = ($page < $max_page);
391 my $show_intf = ($intf_pass == 1) && ($ong_state == STATE->{'inactive'});
392 my $id_start = 
393         $story_id-1 -(
394                 ($page == 0)    ? 0 : (
395                         (($page-1) * PAGE_LENGTH ) + FIRSTPAGE_LENGTH
396                 )
397         );
398 my $id_stop = $story_id-1 - (($page*PAGE_LENGTH) + FIRSTPAGE_LENGTH);
399 if ($id_stop < 0) {
400         $id_stop = -1;
401 }
402
403 my $bsta_url = CGI_PATH;
404 my $twowords_url = CGI_2WORDS_PATH;
405 my $newer_url;
406 my $older_url;
407 my $oldest_url;
408 my $newest_url = merge_url(
409         {'path' => $twowords_url},
410         {'path' => 0}
411 );
412 if ($newer_available) {
413         $newer_url = merge_url(
414                 {'path' => $twowords_url},
415                 {'path' => $page-1}
416         );
417 }
418 if ($older_available) {
419         $older_url = merge_url(
420                 {'path' => $twowords_url},
421                 {'path' => $page+1}
422         );
423         $oldest_url = merge_url(
424                 {'path' => $twowords_url},
425                 {'path' => $max_page}
426         );
427 }
428 my $button_4_url = merge_url(
429         {'path' => $twowords_url},
430         {'query' => {'s' => (INTF_STATE->{'>'} | $intf_pause)}}
431 );
432 my $button_3_url = merge_url(
433         {'path' => $twowords_url},
434         {'query' => {'s' => (INTF_STATE->{'<<'} | $intf_pause)}}
435 );
436 my $button_2_url = merge_url(
437         {'path' => $twowords_url},
438         {'query' => {'s' => (INTF_STATE->{'>>'} | $intf_pause)}}
439 );
440 my $button_1_url = merge_url(
441         {'path' => $twowords_url},
442         {'query' => {'s' => INTF_STATE->{'X'}}}
443 );
444 my $button_0_url = merge_url(
445         {'path' => $twowords_url},
446         {'query' => {'s' => ($intf_pause ? $intf_mode : ($intf_mode | INTF_STATE->{'||'}))}}
447 );
448 my $button_5_img = merge_url(
449         {'path' => CGI_PATH()},
450         {'path' => 'intf-20.gif'}
451 );
452 my $button_4_img = merge_url(
453         {'path' => CGI_PATH()},
454         {'path' => 'intf-10'.(($intf_mode == INTF_STATE->{'>'}) ? '_' : '').'.gif'}
455 );
456 my $button_3_img = merge_url(
457         {'path' => CGI_PATH()},
458         {'path' => 'intf-08'.(($intf_mode == INTF_STATE->{'<<'}) ? '_' : '').'.gif'}
459 );
460 my $button_2_img = merge_url(
461         {'path' => CGI_PATH()},
462         {'path' => 'intf-04'.(($intf_mode == INTF_STATE->{'>>'}) ? '_' : '').'.gif'}
463 );
464 my $button_1_img = merge_url(
465         {'path' => CGI_PATH()},
466         {'path' => 'intf-02.gif'}
467 );
468 my $button_0_img = merge_url(
469         {'path' => CGI_PATH()},
470         {'path' => 'intf-01'.($intf_pause ? '_' : '').'.gif'}
471 );
472 my $intf_img_id = '';
473 if ($intf_state == INTF_STATE->{'>'}) {
474         $intf_img_id = '_10'
475 }
476 elsif ($intf_mode == INTF_STATE->{'<<'}) {
477         $intf_img_id = '_08'
478 }
479 elsif ($intf_mode == INTF_STATE->{'>>'}) {
480         $intf_img_id = '_04'
481 }
482 my $intf_img = merge_url(
483         {'path' => CGI_PATH()},
484         {'path' => 'intf-00'.$intf_img_id.'.gif'}
485 );
486
487 my $_bsta_url     = html_entity_encode_dec($bsta_url     , 1);
488 my $_twowords_url = html_entity_encode_dec($twowords_url , 1);
489 my $_newest_url   = html_entity_encode_dec($newest_url   , 1);
490 my $_newer_url    = html_entity_encode_dec($newer_url    , 1);
491 my $_older_url    = html_entity_encode_dec($older_url    , 1);
492 my $_oldest_url   = html_entity_encode_dec($oldest_url   , 1);
493 my $_button_4_url = html_entity_encode_dec($button_4_url , 1);
494 my $_button_3_url = html_entity_encode_dec($button_3_url , 1);
495 my $_button_2_url = html_entity_encode_dec($button_2_url , 1);
496 my $_button_1_url = html_entity_encode_dec($button_1_url , 1);
497 my $_button_0_url = html_entity_encode_dec($button_0_url , 1);
498 my $_button_5_img = html_entity_encode_dec($button_5_img , 1);
499 my $_button_4_img = html_entity_encode_dec($button_4_img , 1);
500 my $_button_3_img = html_entity_encode_dec($button_3_img , 1);
501 my $_button_2_img = html_entity_encode_dec($button_2_img , 1);
502 my $_button_1_img = html_entity_encode_dec($button_1_img , 1);
503 my $_button_0_img = html_entity_encode_dec($button_0_img , 1);
504 my $_intf_img     = html_entity_encode_dec($intf_img     , 1);
505 my $_message      = html_entity_encode_dec($message      , 1);
506 my $_website_name = html_entity_encode_dec(WEBSITE_NAME(), 1);
507
508 print_html_start(\*STDOUT);
509 print_html_head_start(\*STDOUT);
510
511
512 print '  <title>Two words &bull; '.$_website_name.'</title>'."\n";
513 print '  <link rel="start" href="'.$_oldest_url.'">'."\n";
514 if ($older_available) {
515         print '  <link rel="prev" href="'.$_older_url.'">'."\n";
516 }
517 if ($newer_available) {
518         print '  <link rel="next" href="'.$_newer_url.'">'."\n";
519 }
520
521 print_html_head_end(\*STDOUT);
522 print_html_body_start(\*STDOUT);
523
524 print '   <div id="inst" class="ins">'."\n";
525
526 print '    <div id="title">'."\n";
527 print '     <h1 id="titletext">Two words</h1>'."\n";
528 print '    </div>'."\n";
529
530 if ($page == 0) {
531         print '    <div id="storypuzzle">'."\n";
532         for (my $i = 0; $i < @story_lines; ++$i) {
533                 print '     <span class="'.($turn ? 'ni':'br').'">'.html_entity_encode_dec($story_lines[$i], 1).'</span>'."\n";
534                 $turn = !$turn;
535         }
536         print '    </div>'."\n";
537
538         print '    <div id="command">'."\n";
539         if ($message ne '') {
540                 print '     <span class="br">'.$_message.'</span>'."\n";
541         }
542         
543         if ($turn) {
544                 print '     <form method="post" action="'.$_twowords_url.'">'."\n";
545                 if ($message eq '') {
546                         if ($story{"content"} eq '') {
547                                 print '      Two words, please:<br>'."\n";
548                         }
549                         else {
550                                 print '      Please continue, two words:<br>'."\n";
551                         }
552                 }
553                 print '      <input class="intx" type="text" name="words">'."\n";
554                 print '      <input class="inbt" type="submit" value="enter">'."\n";
555                 if(@story_lines >= (STORY_LENGTH-1)) {
556                         print '      <input class="inbt" type="submit" name="next" value="enter and then start a new one">'."\n";
557                 }
558                 print '     </form>'."\n";
559         }
560         else {
561                 if ($message eq '') {
562                         print '     Wait for it.'."\n";
563                 }
564         }
565         print '    </div>'."\n";
566 }
567 elsif ($message ne '') {
568         print '    <div id="command">'."\n";
569         print '     <span class="br">'.$_message.'</span>'."\n";
570         print '    </div>'."\n";
571 }
572 print '   </div>'."\n";
573
574 if ($show_intf) {
575         print '   <div id="framespace">'."\n";
576         print '    <table id="intftable" cellspacing="0" cellpadding="0">'."\n";
577         print '     <tr class="intf">'."\n";
578         print '      <td colspan="6" class="intf"><img src="'.$_intf_img.'" alt="" class="intf"></td>'."\n";
579         print '     </tr>'."\n";
580         
581         print '     <tr class="intf">'."\n";
582         print '      <td class="intf"><img src="'.$_button_5_img.'" alt="o" class="intf"></td>'."\n";
583         print '      <td class="intf"><a href="'.$_button_4_url.'"><img src="'.$_button_4_img.'" class="intf" alt="&gt;"></a></td>'."\n";
584         print '      <td class="intf"><a href="'.$_button_3_url.'"><img src="'.$_button_3_img.'" class="intf" alt="&lt;&lt;"></a></td>'."\n";
585         print '      <td class="intf"><a href="'.$_button_2_url.'"><img src="'.$_button_2_img.'" class="intf" alt="&gt;&gt;"></a></td>'."\n";
586         print '      <td class="intf"><a href="'.$_button_1_url.'"><img src="'.$_button_1_img.'" class="intf" alt="^"></a></td>'."\n";
587         print '      <td class="intf"><a href="'.$_button_0_url.'"><img src="'.$_button_0_img.'" class="intf" alt="||"></a></td>'."\n";
588         print '     </tr>'."\n";
589         print '    </table>'."\n";
590         print '   </div>'."\n";
591 }
592
593 print '   <div id="insb" class="ins">'."\n";
594
595 print '    <div id="undertext">'."\n";
596 for (my $i = $id_start; $i > $id_stop; --$i) {
597         $story_i_path = DATA_STORY_PATH.$i;
598         %new_story = read_data_file($story_i_path);
599         print '     <p class="'.(($i&1)?'br':'ni').'" id="s'.$i.'">'.html_entity_encode_dec($new_story{'content'}).'</p>'."\n";
600 }
601 print '    </div>'."\n";
602
603 print '    <div id="underlinks">'."\n";
604 print '     <a href="'.$_bsta_url.'">BSTA</a> |'."\n";
605 print '     <a href="'.$_twowords_url.'">Once again</a>';
606 if ($older_available) {
607         print ' |'."\n";
608         print '     <a href="'.$_older_url.'">Before</a>';
609 }
610 if ($newer_available) {
611         print ' |'."\n";
612         print '     <a href="'.$newer_url.'">Unbefore</a>';
613 }
614 if ($older_available) {
615         print ' |'."\n";
616         print '<a href="'.$_oldest_url.'">Initially</a>';
617 }
618 if($turn) {
619         print ' |'."\n";
620         print '     (Entering words here is irreversible. Your actions might be remembered forever. So please be reasonable.)';
621 }
622 print "\n";
623 print '    </div>'."\n";
624
625 print '   </div>'."\n";
626
627 print_html_body_end(\*STDOUT, $ong_state == STATE->{'inactive'});
628 print_html_end(\*STDOUT);