#!/usr/bin/perl -- ############################################################################### # BoardConvert.pl # # $Date: 26.7.26 $ # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 2.6.14 # # Packaged: July 26, 2026 # # Distributed by: http://yabbforum.nz # # =========================================================================== # # Copyright (c) 2000-2026 YaBB (yabbforum.nz) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### use CGI::Carp qw(fatalsToBrowser); our $VERSION = '2.6.14'; $boardconvertplver = 'YaBB 2.6.14 $Revision: 2601 $'; if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/sm ) { $yyIIS = 1; $PROGRAM_NAME =~ m{(.*)(\\|/)}xsm; $yypath = $1; $yypath =~ s/\\/\//gxsm; chdir $yypath; push @INC, $yypath; } ### Requirements and Errors ### my $script_root = $ENV{'SCRIPT_FILENAME'}; if( ! $script_root ) { $script_root = $ENV{'PATH_TRANSLATED'}; } $script_root =~ s/\\/\//gxsm; $script_root =~ s/\/BoardConvert\.(pl|cgi)//igxsm; if ( -e 'YaBB.cgi' ) { $yyext = 'cgi'; } else { $yyext = 'pl'; } if ($boardurl) { $set_cgi = "$boardurl/BoardConvert.$yyext"; } else { $set_cgi = "BoardConvert.$yyext"; } my $nxt = $yyext; if ( -e './Paths.pm' ) { require Paths; $nxt = 'pm'; } else { require "Paths.$yyext";} require "$sourcedir/Subs.$nxt"; require "$sourcedir/Load.$nxt"; if ( !$action ) { adminlogin(); } if ( $action eq 'adminlogin2' ) { adminlogin2(); } elsif ( $action eq 'convbrd') { convcontrol(); } sub convcontrol { open(FORUMCONTROL, '<', "$boardsdir/forum.control") or croak 'cannot_open forum.control'; my @boardcontrols = ; close(FORUMCONTROL); chomp @boardcontrols; my @allboards = (); foreach my $boardline (@boardcontrols) { $boardline =~ s/[\r\n]//g; # Built in chomp (undef, $cntboard ) = split /[|]/xsm, $boardline; ## create a global boards array push(@allboards, $cntboard); } my %seen = (); my @mybrds = grep { !$seen{$_} ++ } @allboards; LoadBoardControl(); my $allboards = join q~', '~, @mybrds; my $newbrds = qq{\@allboards = ('$allboards');\n}; foreach my $cntboard (@mybrds) { $newbrds .= qq~\%{$cntboard} = (\n~; foreach (keys %{ $uid . $cntboard } ) { ${ $uid . $cntboard }{$_} =~ s/'/\\'/gxsm; ${ $uid . $cntboard }{$_} =~ s/~/\\~/gxsm; $newbrds .= qq{'$_' => q~${ $uid . $cntboard }{$_}~,\n}; } $newbrds .= qq~);\n~; } $newbrds .= qq~\n1;\n~; $newbrds =~ s/-/FIX/gxsm; open $BOARDCONV, '>',"$vardir/boardconv.txt"; print {$BOARDCONV} $newbrds; close $BOARDCONV; $yymain .= qq~
Export of '$boardsdir/forum.control' settings to '$vardir/boardconv.txt' done.

Return to YaBB

~; return SimpleOutput(); } sub SimpleOutput { $gzcomp = 0; print_output_header(); print qq~ YaBB 2.6.14 Forum Control Exporter Utility $yymain ~ or croak 'cannot print page to screen'; exit; } sub adminlogin { $yymain .= qq~

~; return SimpleOutput(); } sub adminlogin2 { if ( $FORM{'password'} eq q{} ) { setup_error('Setup Error: You should fill in your password!'); } # No need to pass a form variable setup is only used by user: admin $username = 'admin'; if ( -e "$memberdir/$username.vars" ) { LoadUser($username); my $spass = ${ $uid . $username }{'password'}; $cryptpass = encode_password( $FORM{'password'} ); if ( $spass ne $cryptpass && $spass ne $FORM{'password'} ) { setup_error('Setup Error: Login Failed!'); } } else { setup_error( qq~Setup Error: Could not find the admin data file in $memberdir! Please check your access rights.~ ); } $yymain .= qq~
You are now logged in, ${$uid.$username}{'realname'}!
Click 'Run Exporter' to run the Forum Control Exporter Utility.

~; return SimpleOutput(); } sub setup_error { my ($screen) = @_; return simpleoutput($screen); } 1;