<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w

################################################################################
#                                                                              #
# File:        user/fo_view.pl                                                 #
#                                                                              #
# Authors:     André Malo &lt;nd@o3media.de&gt;                                      #
#                                                                              #
# Description: display the forum main file or a single posting                 #
#                                                                              #
################################################################################

use strict;
use vars qw(
  $Bin
  $Shared
  $Script
  $Config
);

BEGIN {
  my $null = $0; $null =~ s/\\/\//g; # for win :-(
  $Bin     = ($null =~ /^(.*)\/.*$/)? $1 : '.';
  $Shared  = "$Bin/../shared";
  $Config  = "$Bin/config";
  $Script  = ($null =~ /^.*\/(.*)$/)? $1 : $null;

#  my $null = $0;
#  $Bin     = ($null =~ /^(.*)\/.*$/)? $1 : '.';
#  $Config  = "$Bin/../../daten/forum/config";
#  $Shared  = "$Bin/../../cgi-shared";
#  $Script  = ($null =~ /^.*\/(.*)$/)? $1 : $null;
}

# setting umask, remove or comment it, if you don't need
#
umask 006;

use lib "$Shared";
use CGI::Carp qw(fatalsToBrowser);

use Conf;
use Conf::Admin;
use Template::Forum;
use Template::Posting;

use CGI qw(
  param
  header
);

################################################################################
#
# Version check
#
# last modified:
#    $Date$ (GMT)
# by $Author$
#
sub VERSION {(q$Revision$ =~ /([\d.]+)\s*$/)[0] or '0.0'}

print header(
  -type    =&gt; 'text/html',
  -expires =&gt; '+10m'
);

my $conf = read_script_conf ($Config, $Shared, $Script);

my $show = $conf -&gt; {show};
my $show_forum = $show -&gt; {Forum};
my $show_posting = $show -&gt; {Posting};
my $cgi = $show -&gt; {assign} -&gt; {cgi};
my $tree = $show -&gt; {assign} -&gt; {thread};
my $adminDefault = read_admin_conf ($conf -&gt; {files} -&gt; {adminDefault});

my $forum_file = $conf -&gt; {files} -&gt; {forum};
my $message_path = $conf -&gt; {files} -&gt; {messagePath};

my ($tid, $mid) = (param ($cgi -&gt; {thread}), param ($cgi -&gt; {posting}));

if (defined ($tid) and defined ($mid)) {
  print_posting_as_HTML (
    $message_path,
    $show_posting -&gt; {templateFile},
    { assign       =&gt; $show_posting -&gt; {assign},
      thread       =&gt; $tid,
      posting      =&gt; $mid,
      adminDefault =&gt; $adminDefault,
      messages     =&gt; $conf -&gt; {template} -&gt; {messages},
      form         =&gt; $show_posting -&gt; {form},
      cgi          =&gt; $cgi,
      tree         =&gt; $tree,
      firsttime    =&gt; 1,
      cachepath    =&gt; $conf -&gt; {files} -&gt; {cachePath}
    }
  );
}

else {
  print_forum_as_HTML (
    $forum_file,
    $show_forum -&gt; {templateFile},
    { assign       =&gt; $show_forum -&gt; {assign},
      adminDefault =&gt; $adminDefault,
      cgi          =&gt; $cgi,
      tree         =&gt; $tree
    }
  );
}

#
#
### end of fo_view.pl ##########################################################</pre></body></html>