]> bicyclesonthemoon.info Git - ott/bsta/blobdiff - bbcode.1.pl
Adapted for new config tool.
[ott/bsta] / bbcode.1.pl
index 34503b8a0863e76271a394f919464499e14f523d..c8112b9f6699de48819af46923377f5fe070d01a 100644 (file)
@@ -1,42 +1,43 @@
-###PERL;
-#
+###RUN_PERL: #!/usr/bin/perl
+
 # /bsta/b
 # bbcode.pl is generated from bbcode.1.pl.
-# 05.06.2017
 #
 # The bbcode interface
 #
-#    Copyright (C) 2017  Balthasar Szczepański
+# Copyright (C) 2017, 2023  Balthasar Szczepański
 #
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
 #
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 use strict;
 #use warnings;
-###LIB;
+###PERL_LIB: use lib /botm/lib/bsta
 use bsta_lib qw(failpage gethttpheader getcgi readdatafile bb2bb linehtml);
 use File::Copy;
 
-###DATA_PATH;
-###DEFAULT_PATH;
-###SETTINGS_PATH;
-###STATE_PATH;
-###NOACCESS_PATH;
-###WEBSITE;
-###VIEWER_PATH;
-###ATTACH_PATH;
-###FRAME_PATH;
-###CGI_PATH;
+###PERL_CGI_PATH:           CGI_PATH           = /bsta/
+###PERL_CGI_ATTACH_PATH:    CGI_ATTACH_PATH    = /bsta/a
+###PERL_CGI_FRAME_PATH:     CGI_FRAME_PATH     = /bsta/f
+###PERL_CGI_VIEWER_PATH:    CGI_VIEWER_PATH    = /bsta/v
+
+###PERL_DATA_PATH:          DATA_PATH          = /botm/data/bsta/
+###PERL_DATA_DEFAULT_PATH:  DATA_DEFAULT_PATH  = /botm/data/bsta/default
+###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_WEBSITE:            WEBSITE            = 1190.bicyclesonthemoon.info
 
 my %http;
 my %cgi;
@@ -58,7 +59,7 @@ my $ongtime;
 my $seconds;
 
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
-###PATH;
+###PERL_SET_PATH: $ENV{'PATH'} = /usr/local/bin:/usr/bin:/bin;
 
 if ($ENV{'REQUEST_METHOD'} =~ /^(HEAD|GET|POST)$/) {
        $method=$1;
@@ -100,10 +101,10 @@ else {
        $password='';
 }
 
-%settings=readdatafile(SETTINGS_PATH);
-%default=readdatafile(DEFAULT_PATH);
+%settings=readdatafile(DATA_SETTINGS_PATH);
+%default=readdatafile(DATA_DEFAULT_PATH);
 %framedata=readdatafile(DATA_PATH.$frame);
-%state=readdatafile(STATE_PATH);
+%state=readdatafile(DATA_STATE_PATH);
 if($password eq $settings{'password'}){
        $passwordOK = 1;
 }
@@ -127,7 +128,7 @@ if ($passwordOK || (int($state{'state'}) >= 1 && $frame <= int($state{'last'}) &
 }
 else {
        $access=0;
-       %framedata = readdatafile(NOACCESS_PATH);
+       %framedata = readdatafile(DATA_NOACCESS_PATH);
        foreach my $ind (keys %default) {
                unless(defined($framedata{$ind})){
                        $framedata{$ind}=$default{$ind};
@@ -145,7 +146,7 @@ if($method eq 'HEAD') {
 }
 
 print '[quote][center][size=200]'.$framedata{'title'}.'[/size]'."\n";
-print '[url=http://'.WEBSITE.VIEWER_PATH.'/'.$frame.'][img]http://'.WEBSITE.CGI_PATH.($access?sprintf($settings{'frame'},$frame,$framedata{'ext'}):$framedata{'frame'}).'[/img][/url][/center]'."\n";
+print '[url=http://'.WEBSITE.CGI_VIEWER_PATH.'/'.$frame.'][img]http://'.WEBSITE.CGI_PATH.($access?sprintf($settings{'frame'},$frame,$framedata{'ext'}):$framedata{'frame'}).'[/img][/url][/center]'."\n";
 print bb2bbf($framedata{'content'}).'[/quote]'."\n";
 
 sub bb2bbf {
@@ -162,13 +163,13 @@ sub bb2bbf {
                $posttext = substr ($bb,pos ($bb));
                
                if ($tagvalue =~ /^att&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.ATTACH_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_ATTACH_PATH.'/'.int($1);
                }
                elsif ($tagvalue =~ /^vw&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.VIEWER_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_VIEWER_PATH.'/'.int($1);
                }
                elsif ($tagvalue =~ /^fr&([0-9]+)$/) {
-                       $tagvalue = 'http://'.WEBSITE.FRAME_PATH.'/'.int($1);
+                       $tagvalue = 'http://'.WEBSITE.CGI_FRAME_PATH.'/'.int($1);
                }
                else {
                        $tagvalue = '';