#!/usr/bin/perl
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
# File: simpleforum.cgi #
# Name: SimpleForum v3.9 #
# Author: Daan Deconinck #
# E-mail: daan.deconinck@pandora.be #
# Date: 10/12/2002 (DD/MM/YYYY) #
# Last Update: 14/07/2003 (DD/MM/YYYY) #
# #
# This script is made to work on all HTTP #
# servers supporting CGI, and requires no #
# modules to be installed. #
# #
# This software cannot be edited or modified #
# by anyone without the explicit permission #
# from the author. See "Terms of use.txt". #
# #
# SimpleForum #
# ©2003 Daan Deconinck #
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # #
# #
# F O R U M #
# #
# # # # # # # # # #
# # # # # # # CONSTANTS / CONFIG # # # # # # # # # # # # # # # # # # # # # #
#The dir where SimpleForum will place all its files in, likely you won't want to change this line.
#(example: $simpleforum_dir = "simpleforum_files";)
$simpleforum_dir = "simpleforum_files";
#The rest of the configurations can be done through the Admin area on the forum. Time to start 'r up :)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # MAIN # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Do not change anything below
# See "Terms of use.txt" that came with the download for more info
use CGI;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use lib ".";
&start;
if ($qs) {
if ($qs =~ /topic_id=(\d*)(.*?)edit=(\d*)/s and $forum_id) {
#edit a post
$topic_id = $1;
$edit_id = $3;
&edit;
} elsif ($qs =~ /topic_id=(\d*)(.*?)quickdel=(\d*)/s and $forum_id) {
#quickdelete a post
$topic_id = $1;
$dele_id = $3;
&quick_delete;
} elsif ($qs =~ /topic_id=(\d*)(.*?)reply=(\d*)/s and $forum_id) {
#reply to a specific message
$topic_id = $1;
$msg_id = $3;
&page_start;
&post_form("reply_id=$topic_id");
&page_end;
} elsif ($qs =~ /topic_id=(\d*)/s and $forum_id) {
#print a topic
$topic_id = $1;
&page_start;
&print_topic;
&page_end;
} elsif ($qs =~ /reply_id=(\d*)/s and $forum_id) {
#reply to a topic
$topic_id = $1;
&verify_content;
&write_to_topic;
print redirect("simpleforum.cgi?fid=$forum_id");
} elsif ($qs =~ /post/ and $forum_id) {
#post a new message
if (!param('posted')) {
#print the form
&page_start;
&post_form('post');
&page_end;
} else {
#"post-new-topic" form is submitted
&verify_content;
&write_to_topic;
print redirect("simpleforum.cgi?fid=$forum_id");
}
} elsif ($qs =~ /admin/) {
&admin;
&page_end;
} elsif ($qs =~ /search/) {
&page_start;
&search;
&page_end;
} elsif ($qs =~ /help/) {
&page_start;
&help;
&page_end;
} elsif ($forum_id) {
#print topic index for this forum section
&page_start;
&print_topic_index;
&page_end;
} else {
#invalid query string
print redirect("simpleforum.cgi");
}
} else {
#index
&page_start;
&print_forum_index;
&page_end;
}
# # # # # # SUBROUTINES # # # # # # # # # # # # # # # # # # # # # # # # # #
sub page_start {
#self-explanatory
#Don't touch this line!
print header;
$header_printed = 1;
if ($qs =~ /admin/) {
if ($forum_id) {
$menu = "<$standardfont>$forum_name
$home_name | $lang_forum_index | $forum_name | $lang_new_topic | $lang_search | $lang_help | $lang_admin";
} else {
$menu = "<$standardfont>$lang_welcome
$home_name | $lang_forum_index | $lang_search | $lang_help | $lang_admin";
}
} else {
if ($forum_id) {
$menu = "<$standardfont>$forum_name
$home_name | $lang_new_topic | $lang_search | $lang_help | $lang_admin";
} else {
$menu = "<$standardfont>$lang_welcome
$home_name | $lang_search | $lang_help | $lang_admin";
}
}
# # # # HTML # # # #
print <
<$bigfont>.: $lang_forum_index :. | HTML print &select_a_forum; print < |
<$smallfont>» $lang_forum_index » $forum_name | HTML print &select_a_forum; print < |
<$smallfont>» $lang_forum_index » $forum_name » $lang_topic: $topic_title |
HTML
print &select_a_forum;
print < |