#!/usr/bin/perl # # DCForum99 Version 1.0 # dcboard.cgi # Part of DCForum by DCScripts # Copyright ©1997-1999 DCScripts All Rights Reserved # # As part of the installation process, you will be asked # to accept the terms of this Agreement. This Agreement is # a legal contract, which specifies the terms of the license # and warranty limitation between you and DCScripts and DCForum. # You should carefully read this terms agreement as outlined in # the readme.txt file included with this distribution before # installing or using this software. Unless you have a different license # agreement obtained from DCScripts, installation or use of this software # indicates your acceptance of the license and warranty limitation terms # contained in this Agreement. If you do not agree to the terms of this # Agreement, promptly delete and destroy all copies of the Software. # ################################################################### # # NOTE: You may need to provide full path to each setup files # Some server require this. # $path is the directory path to the location of this file. $path = "."; #>>>>>>>>>>>>>>> NO NEED TO EDIT ANYTHING BELOW THIS LINE <<<<<<<< #>>>>>>>>>>>>>>> NO NEED TO EDIT ANYTHING BELOW THIS LINE <<<<<<<< #>>>>>>>>>>>>>>> NO NEED TO EDIT ANYTHING BELOW THIS LINE <<<<<<<< require "$path/dcforum.setup"; require "$path/dcboard.setup"; require "$cgidir/cgi-lib.pl"; require "$cgidir/dcforumlib.pl"; require "$cgidir/dclib.pl"; # Print HTTP output header print "Content-type: text/html\n"; # Read-in form data... # Someday, I need to replace this with my own version &ReadParse; # define reference to %in # this things going to be passed to everywhere $r_in = \%in; # Check and see if we are working with Archive if ($r_in->{'database'} eq "" or $r_in->{'database'} ne 'archive') { $r_in->{'database'} = $database; } else { $database = "arc_" . $database; $r_in->{'arc_database'} = $database; } # Get current time and date get_date($r_in); # initialize some internal variables... # Need to change this for speed improvement $r_setup = initialize($password_file_dir,$forum_file,$board_setup_file); # Set Global variables # Must require this after the call to initialize require "$path/global.pl"; # If the input forum type is Private, then # set appropriate file extension and dir if ($r_setup->{'forum_type'}->{ $r_in->{'forum'} } eq 'Private') { $ext = $privateext; $maindir = $privatedir; } # Get forum information and put them in old variables $forum = $r_in->{'forum'}; $az = $r_in->{'az'}; # OK, before we do anything, let's check the user's session ID # If it exists then read in user data $r_in->{'userdata'} = {}; $session = get_cookie($cookie_name); if ($session) { if (-e "$password_file_dir/$session.session") { $r_in->{'userdata'} = get_userdata("$password_file_dir/$session.session"); } else { send_cookie($cookie_name,'','Thur, 31-Dec-98 12:00:00 GMT',''); $session = ''; } } # Next readin the team members # and append it as a string #$r_team = []; if (-e "$password_file_dir/$team_file_name") { $r_team = readdata("$password_file_dir/$team_file_name"); } $team = join(" ",@{$r_team}); # OK, if $az is 'list' then list topics in a forum # If not, list forums if ($az eq "list") { # End of HTTP Header print "\n"; # Create menu buttons $menu_button = create_button('list',$r_in,$r_setup); # Oppps, forum is offline if ($r_setup->{'forum_status'}->{ $forum } ne "on") { ($heading,$sub_heading,$html_output) = access_error('forum off',$r_in,$r_setup); } # Oppps, no access allowed elsif ( ! check_forum_access($r_in,$r_setup,$forum) ) { ($heading,$sub_heading,$html_output) = access_error('forum private',$r_in,$r_setup); } else { ($heading, $sub_heading, $html_output) = list($r_in,$r_setup); } } # Listing main entrance - the forum list else { # First end http header print "\n"; $heading = $heading_list_forums; $sub_heading = $sub_heading_list_forums; # If no $session, display drop down menu to fetch messages # from last few days unless ($session) { $sub_heading .= qq~
Read new messages posted during last
~; } # Create menus for the forum listing $menu_button = create_button("list_forums",$r_in,$r_setup); # list forums $html_output = list_forums($r_in,$r_setup); } # create forum_links $html_forum_links = forum_links($r_in,$r_setup); # Get template variables ready my %namespace = ( FORUMLINKS => $html_forum_links, MENU => $menu_button, TITLE => $heading, HEADER => $heading, SUBHEADER => $sub_heading, HTMLOUTPUT => $html_output ); # display output display_output($templatefile,\%namespace); exit(0); ##### # # subroutine list_forums # Creates the main lobby page # ##### sub list_forums { my ($r_in,$r_setup) = @_; my $current_time = time_format($r_in->{'localtime'}); my $current_date = date_format($r_in->{'date'}); my $html_output = ''; $icon_display = 'yes'; # Should Icon indicator be displayed? $html_output .= qq~
Forums in $conf_name
~; $html_output .= qq~ ~; toggle_color('reset'); foreach (@{ $r_setup->{'forums'} }) { if ($r_setup->{'forum_status'}->{$_} eq "on") { my $moderator_email = $r_setup->{'forum_owner_email'}->{$_}; $r_setup->{'forum_desc'}->{$_} =~ s/>/>/g; $r_setup->{'forum_desc'}->{$_} =~ s/</{'forum_last'}->{$_}); $ltime .= ":00"; $ltime = time_format($ltime); $date = date_format($date); $html_output .= qq~ ~; toggle_color(); } } $html_output .= "
$r_setup->{'forum_name'}->{$_}
$r_setup->{'forum_desc'}->{$_}
Moderator: $r_setup->{'forum_owner'}->{$_}
$r_setup->{'forum_type'}->{$_} Forum
$r_setup->{'forum_threads'}->{$_} Current Discussions
$r_setup->{'forum_archive'}->{$_} Archived Discussions
$date $ltime
"; } #### # subroutine list # Reads in from $database and generates # the main threads listing #### sub list { my ($r_in,$r_setup) = @_; my $heading; my $temp_output; my $exist = ""; my $msg_num; my $moderator_email = $r_setup->{'forum_owner_email'}->{$forum}; my $datafile = "$maindir/$forum/$database"; my $r_rowdata = readdata($datafile); my $num_messages = @{$r_rowdata}; my $num_next = int(($num_messages - 1)/$mesg_max) + 1; my $start = $r_in->{'mm'} + 1; my $stop = $r_in->{'mm'} + $mesg_max; $stop = $num_messages if ($stop > $num_messages); $heading = "Topics in $r_setup->{'forum_name'}->{$forum}"; $html_output .= qq~
Viewing thread number $start-$stop
~; if ($r_in->{'arc_database'}) { $other = "[Current ($r_setup->{'forum_threads'}->{$forum} threads)]\n"; } else { $other = "[Archive ($r_setup->{'forum_archive'}->{$forum})]\n"; } $stop--; $start--; for ($j=1;$j<=$num_next;$j++) { my $mesg_marker = ($j-1)*$mesg_max; my $j_start = ($j-1)*$mesg_max + 1; my $j_stop = $j*$mesg_max; $j_stop=$num_messages if ($j_stop > $num_messages); if ($mesg_marker == $start) { $temp_output .=qq~ [$j] ~; } elsif ($r_in->{'arc_database'}) { $temp_output .=qq~ [$j] ~; } else { $temp_output .=qq~ [$j] ~; } } $html_output .= qq~ $temp_output $other
~; $html_output .= qq~
  ~; if ($r_setup->{'board_setup'}->{'display_caption'} eq "on") { $table_heading = get_table_heading('main'); } else { $table_heading = get_table_heading(); } $html_output .= $table_heading; my @row = @$r_rowdata[$start..$stop]; toggle_color('reset'); foreach (@row) { my $thisimg = "folder.gif"; my ($num,$date,$ltime,$name,$subject,$caption,$replies) = split(/\|/, $_); if ($r_setup->{'board_setup'}->{'display_caption'} eq "on" && $caption ne "") { $caption = "
$caption..."; } else { $caption = ""; } if (length($subject) > $subject_length_max) { $subject = substr($subject,0,$subject_length_max); $subject .= "..."; } # If threaded_main is on, then display threaded main my $r_thread = readdata("$maindir/$forum/$thread_dir/$num.$thread_ext"); shift(@$r_thread); shift(@$r_thread); my $re_num = @{$r_thread}; if ($r_setup->{'board_setup'}->{'display_caption'} eq "on") { $caption = trim($caption); $caption =~ s/&pip;/\|/g; $html_output .=qq~ ~; } else { $html_output .=qq~ $subject $caption ~; } $ltime = time_format($ltime); $date = date_format($date); $html_output .=qq~ ~; toggle_color(); } else { $html_output .=qq~ ~; } else { if ($r_setup->{'forum_type'}->{$forum} eq "Private") { $html_output .=qq~ $subject ~; } else { $html_output .=qq~ $subject ~; } } $ltime = time_format($ltime); $date = date_format($date); $html_output .=qq~ ~; toggle_color(); } } #End of foreach row unless ($r_setup->{'board_setup'}->{'threaded_main_listing'} eq "on" && $r_in->{'arc_database'} eq '') { $html_output .=qq~
Moderator: $r_setup->{'forum_owner'}->{$forum}
Time Zone: $time_zone
Forum Type: $r_setup->{'forum_type'}->{$forum}
~; if ($re_num > $r_setup->{'board_setup'}->{'max_messages'}) { $html_output .=qq~ $subject [Display All] $caption $name
$date $ltime
$replies messages
~; if ($re_num > $r_setup->{'board_setup'}->{'max_messages'}) { $html_output .=qq~ $subject~; if ($r_setup->{'forum_type'}->{$forum} eq "Private") { $html_output .=qq~ [Display All] ~; } else { $html_output .=qq~ [Display All] ~; } $html_output .=qq~ $caption $name $date $ltime $replies
 
$temp_output
~; } return ($heading, $sub_heading, $html_output); }