###PERL_DATA_NOACCESS_PATH: DATA_NOACCESS_PATH = /botm/data/bsta/noaccess
###PERL_DATA_SETTINGS_PATH: DATA_SETTINGS_PATH = /botm/data/bsta/settings
###PERL_DATA_STATE_PATH: DATA_STATE_PATH = /botm/data/bsta/state
+###PERL_DATA_WORDS_PATH: DATA_WORDS_PATH = /botm/data/bsta/words/
binmode STDIN, ':encoding(UTF-8)';
binmode STDOUT, ':encoding(UTF-8)';
my %http;
my %cgi;
-my %frame_data;
+my %info_data;
my %next_frame_data;
my %default;
my %settings;
my $method;
my $frame = '';
my $attachment = '';
+my $words = '';
my $password;
my $password_ok;
my $access;
my $show_command;
my $ongtime;
my $timer;
-my $frame_data_path;
+my $info_data_path;
my $next_frame_data_path;
my $ong_state;
my $last_frame;
if ($cgi{'f'} =~ /^.+$/) {
$frame = int($&);
}
+elsif ($cgi{'a'} =~ /^.+$/) {
+ $attachment = int($&);
+}
elsif ($cgi{'i'} =~ /^.+$/) {
$attachment = int($&);
}
+elsif ($cgi{'w'} =~ /^.+$/) {
+ $words = $&;
+}
elsif ($ENV{'PATH_INFO'} =~ /^\/a(.+)$/) {
$attachment = int($1);
}
-elsif ($ENV{'PATH_INFO'} =~ /^\/(.+)$/) {
+elsif ($ENV{'PATH_INFO'} =~ /^\/w(.+)$/) {
+ $words = $1;
+}
+elsif ($ENV{'PATH_INFO'} =~ /^\/f?(.+)$/) {
$frame = int($1);
}
$password_ok = ($password eq $settings{'password'});
+# comment info, not frame
+if ($words ne '') {
+ $info_data_path = join_path(PATH_SEPARATOR(), DATA_WORDS_PATH(), $words);
+ %info_data = read_data_file($info_data_path);
+ if ($words =~ /^[0-9]+$/) {
+ $frame = int($&);
+ if ($info_data{'posts'} eq '') {
+ $info_data{'posts'} = 0;
+ }
+ }
+ else {
+ $frame = ($info_data{'frame'} ne '') ? int($info_data{'frame'}) : -1;
+ unless ($password_ok) {
+ delete($info_data{'password'});
+ delete($info_data{'key'});
+ }
+ }
+}
# attachment info, not frame
-if ($attachment ne '') {
- %frame_data = read_data_file(DATA_ATTACH_PATH().$attachment);
- $frame = ($frame_data{'frame'} ne '') ? int($frame_data{'frame'}) : -1;
+elsif ($attachment ne '') {
+ %info_data = read_data_file(DATA_ATTACH_PATH().$attachment);
+ $frame = ($info_data{'frame'} ne '') ? int($info_data{'frame'}) : -1;
}
# frame info
elsif ($frame ne '') {
if ($frame < 0) {
$frame = $last_frame + $frame +1;
}
- $frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame);
+ $info_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame);
$next_frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame+1);
- %frame_data = read_data_file($frame_data_path);
+ %info_data = read_data_file($info_data_path);
%next_frame_data = read_data_file($next_frame_data_path);
- %frame_data = merge_settings(\%default, \%frame_data);
+ %info_data = merge_settings(\%default, \%info_data);
%next_frame_data = merge_settings(\%default, \%next_frame_data);
$timer = int($state{'nextong'}) - $time;
$access = 1;
if (
+ ($words eq '') &&
($attachment eq '') &&
- ($frame_data{'command'} eq '') && (
+ ($info_data{'command'} eq '') && (
$password_ok ||
($frame < $last_frame) || (
($ong_state >= STATE->{'ready'}) &&
)
)
) {
- $frame_data{'command'} = $next_frame_data{'title'};
+ $info_data{'command'} = $next_frame_data{'title'};
}
}
else {
$access = 0;
- if ($attachment ne '') {
- %frame_data = ();
+ if (($attachment ne '') || ($words ne '')) {
+ %info_data = ();
}
else {
- %frame_data = read_data_file(DATA_NOACCESS_PATH());
- %frame_data = merge_settings(\%default, \%frame_data);
+ %info_data = read_data_file(DATA_NOACCESS_PATH());
+ %info_data = merge_settings(\%default, \%info_data);
}
}
if (
- ($frame_data{'frame'} eq '') &&
- ($attachment eq '')
+ ($info_data{'frame'} eq '') &&
+ ($attachment eq '') &&
+ ($words eq '')
) {
- $frame_data{'frame'} = sprintf($settings{'frame'}, $frame, $frame_data{'ext'});
+ $info_data{'frame'} = sprintf($settings{'frame'}, $frame, $info_data{'ext'});
}
print "Content-type: text/plain\n";
exit;
}
write_data_file(
- \*STDOUT, \%frame_data, '',
+ \*STDOUT, \%info_data, '',
0, 0, 0,
'>>', 1
);