############################################################################### # ManageBoards.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 3.0 Beta # # Packaged: October 05, 2010 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2010 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### $manageboardsplver = 'YaBB 3.0 Beta $Revision: 348 $'; if ($action eq 'detailedversion') { return 1; } sub ManageBoards { &is_admin_or_gmod; &LoadBoardControl; &get_forum_master; if ($INFO{'action'} eq 'managecats') { $colspan = qq~colspan="2"~; $add = $admin_txt{'47'}; $act = 'catscreen'; $manage = qq~$admin_txt{'829'}  $admin_txt{'49'}~; $managedescr = $admin_txt{'678'}; $act2 = 'addcat'; $action_area = 'managecats'; } else { $colspan = qq~colspan="4"~; $add = $admin_txt{'50'}; $act = 'boardscreen'; $manage = qq~  $admin_txt{'51'}~; $managedescr = $admin_txt{'677'}; $act2 = 'addboard'; $action_area = 'manageboards'; } $yymain .= qq~
$manage

$managedescr

~; foreach $catid (@categoryorder) { @bdlist = split(/,/, $cat{$catid}); ($curcatname, $catperms) = split(/\|/, $catinfo{"$catid"}); &ToChars($curcatname); if ($INFO{"action"} eq "managecats") { $tempcolspan = ""; $tempclass = "windowbg2"; $temphrefclass = ""; } else { $tempcolspan = qq~colspan="4"~; $tempclass = "catbg"; $temphrefclass = qq~class="catbg a"~; } $yymain .= qq~ ~; if ($INFO{"action"} eq "managecats") { $yymain .= qq~ ~; } $yymain .= qq~
$admin_txt{'832'}  $curcatname
~; unless ($INFO{"action"} eq "managecats") { # recursive loop to display all sub boards my $indent = -3; &show_boards(@bdlist); sub show_boards { my @brdlist = @_; $indent += 3; foreach $curboard (@brdlist) { ($boardname, $boardperms, $boardview) = split(/\|/, $board{$curboard}); $boardname =~ s/\"\;/"/g; &ToChars($boardname); $descr = ${$uid.$curboard}{'description'}; $descr =~ s~\
~\n~g; my $bicon = ""; if(${$uid.$curboard}{'pic'}) { $bicon = ${$uid.$curboard}{'pic'}; } if ($bicon =~ /\//i) { $bicon = qq~ ~; } elsif ($bicon) { $bicon = qq~ ~; } if (${$uid.$curboard}{'ann'} == 1) { $bicon = qq~ $admin_txt{'64g'}~; } if (${$uid.$curboard}{'rbin'} == 1) { $bicon = qq~ $admin_txt{'64i'}~; } $convertstr = $descr; unless($convertstr =~ /<.+?>/) { # Don't cut it if there's HTML in it. $convertcut = 60; &CountChars; } my $descr = $convertstr; &ToChars($descr); if ($cliped) { $descr .= "..."; } my $tmpwidth = 100 - $indent; my $tmpwidth2 = 90 - $indent; my @children = split(/\|/, $subboard{$curboard}); $reorder_subs = @children > 0 ? qq~$admin_txt{'252'}~ : ""; my $del_txt = $admin_txt{'251'}; my $edit_txt = $admin_txt{'253'}; if(${$uid.$curboard}{'parent'}) { $del_txt =~ s/{(.*?)}/$admin_txt{'254'}$1/g; $edit_txt =~ s/{(.*?)}/$admin_txt{'254'}$1/g; } else { $del_txt =~ s/{(.*?)}/$1/g; $edit_txt =~ s/{(.*?)}/$1/g; } $yymain .= qq~
$boardname
$admin_txt{'250'} $edit_txt $del_txt ~ . $reorder_subs . qq~
$bicon
$descr
~; if($subboard{$curboard}) { &show_boards(@children); } } $indent -= 3; } } } $yymain .= qq~
$admin_txt{'53'} $admin_txt{'54'}

~; $yytitle = "$admintxt{'a4_title'}"; &AdminTemplate; } sub BoardScreen { &is_admin_or_gmod; &get_forum_master; $i = 0; while ($_ = each(%FORM)) { if ($FORM{$_} && $_ =~ /^yitem_(.+)$/) { $editboards[$i] = $1; $i++; } } $i = 1; foreach $thiscat (@categoryorder) { my @catboards = split(/,/, $cat{$thiscat}); # make an array of all sub boards recursively &recursive_boards(@catboards); sub recursive_boards { push(@theboards, @_); foreach $childbd (@_) { if($subboard{$childbd}) { &recursive_boards(split(/\|/,$subboard{$childbd})); } } } for (my $z = 0; $z < @theboards; $z++) { my $found = 0; for (my $j = 0; $j < @editboards; $j++) { if ($editboards[$j] eq $theboards[$z]) { $editbrd[$i] = $theboards[$z]; $found = 1; $i++; splice(@editboards,$j,1); last; } } } } if ($FORM{'baction'} eq "edit") { &AddBoards(@editbrd); } elsif ($FORM{'baction'} eq "delme") { shift(@editbrd); &get_forum_master; foreach my $bd (@editbrd) { # Remove Board form category it belongs to unless it's a sub board, then it's not in the cat list if(!${$uid.$bd}{'parent'}) { $category = ${$uid.$bd}{'cat'}; @bdlist = split(/,/, $cat{$category}); my $c = 0; foreach (@bdlist) { if ($_ eq $bd) { splice(@bdlist, $c, 1); last; } $c++; } $cat{$category} = join(',', &undupe(@bdlist)); } else { # if it has a parent, remove it from it's parent's child board list my @bdlist = split(/\|/, $subboard{${$uid.$bd}{'parent'}}); # Remove Board from old parent board my $k = 0; foreach (@bdlist) { if ($bd eq $_) { splice(@bdlist, $k, 1); } $k++; } $subboard{${$uid.$bd}{'parent'}} = join('|', @bdlist); } # remove the $subboard{} hash that contains children list, since it's a parent board and move children up if($subboard{$bd}) { foreach $childbd (split(/\|/,$subboard{$bd})) { # if this one has a parent board, move it's children up to that, otherwise to category. if(${$uid.$bd}{'parent'}) { if($subboard{${$uid.$bd}{'parent'}}) { $subboard{${$uid.$bd}{'parent'}} .= qq~|$childbd~; } else { $subboard{${$uid.$bd}{'parent'}} = $childbd; } ${$uid.$childbd}{'parent'} = ${$uid.$bd}{'parent'}; } else { $cat{${$uid.$bd}{'cat'}} .= ",$childbd"; ${$uid.$childbd}{'parent'} = ""; } push(@del_updateparent, $childbd); } delete $subboard{$bd}; } delete $board{$bd}; $yymain .= qq~$admin_txt{'55'}$bd
~; } # Actual deleting &DeleteBoards(@editbrd); &Write_ForumMaster; } else { &fatal_error("no_action","$FORM{'baction'}"); } $action_area = "manageboards"; &AdminTemplate; } sub DeleteBoards { &is_admin_or_gmod; my @oldcontrols = &read_DBorFILE(0,'',$boardsdir,'forum','control'); foreach $board (@_) { @messages = &read_DBorFILE(0,'',$boardsdir,$board,'txt'); foreach $curmessage (@messages) { my ($id, undef) = split(/\|/, $curmessage, 2); &delete_DBorFILE("$datadir/$id.txt"); &delete_DBorFILE("$datadir/$id.mail"); &delete_DBorFILE("$datadir/$id.ctb"); &delete_DBorFILE("$datadir/$id.data"); &delete_DBorFILE("$datadir/$id.poll"); &delete_DBorFILE("$datadir/$id.polled"); } for (my $cnt = 0; $cnt < @oldcontrols; $cnt++) { my $oldboard; (undef, $oldboard, undef) = split(/\|/, $oldcontrols[$cnt], 3); $yydebug .= "$cnt $oldboard \n"; if ($oldboard eq $board) { $oldcontrols[$cnt] = ""; $yydebug .= "\$board{\"$oldboard\"}"; delete $board{"$board"}; last; } } &delete_DBorFILE("$boardsdir/$board.txt"); &delete_DBorFILE("$boardsdir/$board.ttl"); &delete_DBorFILE("$boardsdir/$board.poster"); &delete_DBorFILE("$boardsdir/$board.mail"); my @buffer = &read_DBorFILE(0,ATM,$vardir,'attachments','txt'); my ($amcurrentboard,$amfn); for (my $a = 0; $a < @buffer; $a++) { (undef, undef, undef, undef, $amcurrentboard, undef, undef, $amfn, undef) = split(/\|/, $buffer[$a]); if ($amcurrentboard eq $board) { $buffer[$a] = ''; &delete_DBorFILE("$upload_dir/$amfn"); } } &write_DBorFILE(0,ATM,$vardir,'attachments','txt',@buffer); &BoardTotals("delete", $board); } # Update parents for subboards that had a parent deleted. if(@del_updateparent) { for (my $cnt = 0; $cnt < @oldcontrols; $cnt++) { my ($oldcat,$oldboard,$pic,$bdescription,$moderators,$moderatorgroups,$topicperms,$replyperms,$pollperms,$zero,$membergroups,$ann,$rbin,$att,$minage,$maxage,$gender,$canpost,$parent) = split(/\|/, $oldcontrols[$cnt]); foreach my $changedboard (@del_updateparent) { if ($changedboard eq $oldboard) { $oldcontrols[$cnt] = qq~$oldcat|$oldboard|$pic|$bdescription|$moderators|$moderatorgroups|$topicperms|$replyperms|$pollperms|$zero|$membergroups|$ann|$rbin|$att|$minage|$maxage|$gender|$canpost|${$uid.$changedboard}{'parent'}\n~; last; } } } } &write_DBorFILE(0,'',$boardsdir,'forum','control',sort(grep { $_; } @oldcontrols)); @forum_control = &read_DBorFILE(0,'',$boardsdir,'forum','control'); } sub AddBoards { my @editboards = @_; &is_admin_or_gmod; $addtext = $admin_txt{'50'}; if ($INFO{'action'} eq 'boardscreen') { $FORM{'amount'} = $#editboards; $addtext = $admin_txt{'50a'}; } if ($INFO{'parent'}) { $FORM{'amount'} = 1; } &get_forum_master; &LoadBoardControl; # build recursive drop down of boards in each category for selecting parent board foreach $thiscat (@categoryorder) { my @catboards = split(/\,/, $cat{$thiscat}); my $indent = -2; $catboardlist{$thiscat} = qq~||~; &get_subboards(@catboards); $catboardlist_js .= qq~ catboardlist['$thiscat'] = "$catboardlist{$thiscat}"; ~; } sub get_subboards { $indent += 2; foreach $childbd (@_) { my $dash; if($indent > 0) { $dash = "-"; } ($chldboardname, undef, undef) = split(/\|/, $board{"$childbd"}); &ToChars($chldboardname); $catboardlist{$thiscat} .= qq~$childbd|~ . (" " x $indent) . ($dash x ($indent / 2)) . qq~ $chldboardname|~; if($subboard{$childbd}) { &get_subboards(split(/\|/,$subboard{$childbd})); } } $indent -= 2; } $yymain .= qq~
$addtext

$admin_txt{'57'}


~; # Check if and which board are set for announcements or recycle bin # Start Looping through and repeating the board adding wherever needed $istart = 0; $annexist = ""; $rbinexist = ""; for ($i = 1; $i != $FORM{'amount'} + 1; $i++) { # differentiate between edit or add boards if ($editboards[$i] eq "" && $INFO{"action"} eq "boardscreen") { next; } if ($INFO{"action"} eq "boardscreen") { $id = $editboards[$i]; } else { $boardtext = "$admin_txt{'58'} $i:"; } # print javascript hash of board names and their equivalent category if(!$INFO{'parent'}) { $brd_javascript .= qq~editbrds[$i] = "${$uid.$editboards[$i]}{'cat'}|$editboards[$i]|${$uid.$editboards[$i]}{'parent'}";\n~; } else { $brd_javascript .= qq~editbrds[$i] = "$INFO{'category'}||$INFO{'parent'}";\n~; } my $boardcat = ${$uid.$editboards[$i]}{'cat'}; foreach $catid (@categoryorder) { @bdlist = split(/,/, $cat{$catid}); ($curcatname, $catperms) = split(/\|/, $catinfo{"$catid"}); if ($INFO{"action"} eq "boardscreen" || $INFO{'parent'}) { if ($catid eq $boardcat || $catid eq $INFO{'category'}) { $selected = qq~selected="selected" ~; } else { $selected = ""; } } &ToChars($curcatname); $catsel{$i} .= qq~~; } $catsel .= qq~~; if ($istart == 0) { $istart = $i; } ($boardname, $boardperms, $boardview) = split(/\|/, $board{"$id"}); &ToChars($boardname); if ($INFO{"action"} eq "boardscreen") { $boardtext = $boardname; } $boardpic = ${$uid.$editboards[$i]}{'pic'}; $description = ${$uid.$editboards[$i]}{'description'}; $description =~ s~
~\n~g; &ToChars($description); $moderators = ${$uid.$editboards[$i]}{'mods'}; $moderatorgroups = ${$uid.$editboards[$i]}{'modgroups'}; $boardminage = ${$uid.$editboards[$i]}{'minageperms'}; $boardmaxage = ${$uid.$editboards[$i]}{'maxageperms'}; $boardgender = ${$uid.$editboards[$i]}{'genderperms'}; $genselect = qq~~; if (${$uid.$id}{'canpost'} == 1 || $INFO{'action'} ne 'boardscreen') { $canpostch = qq~ checked="checked"~; } # Make children list if it contains sub boards my $childrenlist; if($subboard{$id}) { foreach $childbd (split(/\|/, $subboard{$id})) { my ($chldboardname, undef, undef) = split(/\|/, $board{"$childbd"}); &ToChars($chldboardname); $childrenlist .= qq~$chldboardname, ~; } $childrenlist =~ s/, $//g; } if($childrenlist eq "") { $childrenlist = $admin_txt{'246'}; } # Retrieve Optional Details $ann = ""; $rbin = ""; $zeroch = ""; $attch = ""; $showpriv = ""; $brdpic = ""; if ($boardview == 1) { $showpriv = qq~ checked="checked"~; } if (${$uid.$id}{'zero'} == 1) { $zeroch = qq~ checked="checked"~; } if (${$uid.$id}{'attperms'} == 1) { $attch = qq~ checked="checked"~; } if (${$uid.$id}{'ann'} == 1) { $annch = qq~ checked="checked"~; $brdpic = qq~ disabled="disabled"~; } elsif ($annboard ne "") { $annch = qq~ disabled="disabled"~; $annexist = 1; } if (${$uid.$id}{'rbin'} == 1) { $rbinch = qq~ checked="checked"~; $brdpic = qq~ disabled="disabled"~; } elsif ($binboard ne "") { $rbinch = qq~ disabled="disabled"~; $rbinexist = 1; } #Get Board permissions here my $startperms = &DrawPerms(${$uid.$id}{'topicperms'}, 0); my $replyperms = &DrawPerms(${$uid.$id}{'replyperms'}, 1); my $viewperms = &DrawPerms($boardperms, 0); my $pollperms = &DrawPerms(${$uid.$id}{'pollperms'}, 0); $yymain .= qq~ ~; if ($id ne '') { $yymain .= qq~ ~; } else { $yymain .= qq~ ~; } $yymain .= qq~
$boardtext
$admin_txt{'59'}: $admin_txt{'60'}
$id
$admin_txt{'63'}:
$selector_txt{linklabel}
$admin_txt{'63a'}
$admin_txt{'63b'}
$admin_txt{'63c'}

$selector_txt{instructions}
~; # Allows admin to select entire membergroups to be a board moderator $k = 0; my $box = ""; foreach (@nopostorder) { @groupinfo = split(/\|/, $NoPost{$_}); $box .= qq~~; $k++; } if ($k > 5) { $k = 5; } if ($k > 0) { $yymain .= qq~ ~; } else { $yymain .= qq~$admin_txt{'15'}~; } $yymain .= qq~
$childrenlist
$admin_txt{'64'} $admin_txt{'64a'}
$admin_txt{'100'}: $admin_txt{'100a'}
$genselect
$admin_txt{'65'}: $admin_txt{'65a'} $admin_txt{'14'}


~; } $yymain .= qq~
~; $yytitle = "$admin_txt{'50'}"; $action_area = "manageboards"; &AdminTemplate; } sub DrawPerms { my ($permissions,$permstype) = @_; my ($foundit, %found, $groupsel, $groupsel2, $name); my $count = 0; if ($permissions eq "") { $permissions = "xk8yj56ndkal"; } my @perms = split(/, /, $permissions); foreach $perm (@perms) { $foundit = 0; if ($permstype == 1) { $name = $admin_txt{'65f'}; if ($perm eq "Topic Starter") { $foundit = 1; $found{$name} = 1; $groupsel .= qq~\n~; } if ($count == $#perms && $found{$name} != 1) { $groupsel2 .= qq~\n~; } } ($name, undef) = split(/\|/, $Group{"Administrator"}, 2); if ($perm eq "Administrator") { $foundit = 1; $found{$name} = 1; $groupsel .= qq~\n~; } if ($count == $#perms && $found{$name} != 1) { $groupsel2 .= qq~\n~; } ($name, undef) = split(/\|/, $Group{"Global Moderator"}, 2); if ($perm eq "Global Moderator") { $foundit = 1; $found{$name} = 1; $groupsel .= qq~\n~; } if ($count == $#perms && $found{$name} != 1) { $groupsel2 .= qq~\n~; } if ($foundit != 1 || $count == $#perms) { foreach (@nopostorder) { ($name, undef) = split(/\|/, $NoPost{$_}, 2); if ($perm eq $_) { $foundit = 1; $found{$_} = 1; $groupsel .= qq~\n~; } if ($found{$_} != 1 && $count == $#perms) { $groupsel2 .= qq~\n~; } } if ($foundit != 1 || $count == $#perms) { foreach (sort { $b <=> $a } keys %Post) { ($name, undef) = split(/\|/, $Post{$_}, 2); if ($perm eq $name) { $foundit = 1; $found{$name} = 1; $groupsel .= qq~\n~; } if ($count == $#perms && ($found{$name} != 1 || $found{$name} eq "")) { $groupsel2 .= qq~\n~; } } } } $count++; } $groupsel . $groupsel2; } sub AddBoards2 { &is_admin_or_gmod; &get_forum_master; $anncount = 0; $rbincount = 0; my (@boardcontrol,@changes,@updatecats); &LoadBoardControl; for (my $i = 1; $i != $FORM{'amount'} + 1; $i++) { if ($FORM{"pic$i"} ne '' && $FORM{"pic$i"} !~ m~^[0-9a-zA-Z_\.\#\%\-\:\+\?\$\&\~\.\,\@/]+\.(gif|png|bmp|jpg)$~) { &fatal_error("invalid_picture"); } ##### Dealing with Required Info here ##### if ($FORM{"id$i"} eq '') { next; } $id = $FORM{"id$i"}; if ($FORM{"ann$i"}) { $anncount++; } if ($FORM{"rbin$i"}) { $rbincount++; } &fatal_error('announcement_defined') if ($anncount > 1); &fatal_error('recycle_bin_defined') if ($rbincount > 1); &fatal_error('invalid_character',"$admin_txt{'61'} $admin_txt{'241'}") if ($id !~ /\A[0-9A-Za-z#%+-\.@^_]+\Z/); if ($FORM{'screenornot'} ne "boardscreen") { # adding a board # make sure no board already exists with that id &fatal_error("board_defined","$id") if (exists $board{"$id"}); # add to category if it's not a sub board, otherwise add it to subboard list for its parent if(!$FORM{"parent$i"}) { my @bdlist = split(/\,/, $cat{$FORM{"cat$i"}}); push(@bdlist, "$id"); $cat{$FORM{"cat$i"}} = join(',', @bdlist); } else { if($subboard{$FORM{"parent$i"}} ne "") { $subboard{$FORM{"parent$i"}} .= qq~|$id~; } else { $subboard{$FORM{"parent$i"}} = $id; } } &write_DBorFILE(0,'',$boardsdir,$id,'txt',('')); } if ($FORM{'screenornot'} eq "boardscreen") { # editing a board my $category = ${$uid.$id}{'cat'}; # move category of board if ($category ne $FORM{"cat$i"}) { ${$uid.$id}{'cat'} = qq~$FORM{"cat$i"}~; # recursively change the category of child boards. if($subboard{$id}) { &cat_change(split(/\|/, $subboard{$id})); sub cat_change { foreach $childbd (@_) { ${$uid.$childbd}{'cat'} = qq~$FORM{"cat$i"}~; push(@updatecats, $childbd); if($subboard{$childbd}) { &cat_change(split(/\|/, $subboard{$childbd})); } } } } # if it's not a sub board, remove from the old category if(!${$uid.$id}{'parent'}) { my @bdlist = split(/,/, $cat{$category}); # Remove Board from old Category my $k = 0; foreach $bd (@bdlist) { if ($id eq $bd) { splice(@bdlist, $k, 1); } $k++; } $cat{"$category"} = join(',', @bdlist); } # Add Category to new Category, but only if it isn't a sub board if(!$FORM{"parent$i"}) { my $ncat = $FORM{"cat$i"}; if ($cat{$ncat} ne "") { $cat{$ncat} .= ",$id"; } else { $cat{$ncat} = $id; } } } # move parent board of board if(${$uid.$id}{'parent'} ne $FORM{"parent$i"}) { # if it had a parent, remove it from that list, otherwise it didnt have a parent so remove it from cat list if(${$uid.$id}{'parent'}) { my @bdlist = split(/\|/, $subboard{${$uid.$id}{'parent'}}); # Remove Board from old parent board my $k = 0; foreach $bd (@bdlist) { if ($id eq $bd) { splice(@bdlist, $k, 1); } $k++; } $subboard{${$uid.$id}{'parent'}} = join('|', @bdlist); } # only remove from old category if it now has a parent and its in the same cat as before, otherwise # cat had to have been changed to get a parent in a different cat, and the cat change takes care of # removing it from the previous category elsif ($category eq $FORM{"cat$i"}) { my @bdlist = split(/,/, $cat{$category}); # Remove Board from old Category my $k = 0; foreach $bd (@bdlist) { if ($id eq $bd) { splice(@bdlist, $k, 1); } $k++; } $cat{$category} = join(',', @bdlist); } # if we're removing the parent board, move it back up to it's category, otherwise add to new parent board if($FORM{"parent$i"} eq "") { # only move up to cat if cat is the same as previously if ($category eq $FORM{"cat$i"}) { my @bdlist = split(/\,/, $cat{$FORM{"cat$i"}}); push(@bdlist, "$id"); $cat{$FORM{"cat$i"}} = join(',', @bdlist); } } else { # Add to new parent board if($subboard{$FORM{"parent$i"}}) { $subboard{$FORM{"parent$i"}} .= qq~|$id~; } else { $subboard{$FORM{"parent$i"}} = $id; } } } if (&checkfor_DBorFILE("$boardsdir/$id.txt")) { # fix a(nnboard) in the boardid.txt my @boardtomodify = &read_DBorFILE(0,'',$boardsdir,$id,'txt'); my $x; if ($FORM{"ann$i"} && (split /\|/, $boardtomodify[0])[8] !~ /a/i) { for ($x = 0; $x < @boardtomodify; $x++) { $boardtomodify[$x] =~ s/(.*\|)(0?)(.*)/ $1 . ($2 eq '0' ? "0a$3" : "a$3") /e; } } elsif (!$FORM{"ann$i"} && (split /\|/, $boardtomodify[0])[8] =~ /a/i) { for ($x = 0; $x < @boardtomodify; $x++) { $boardtomodify[$x] =~ s/(.*\|)(.*)/ $1 . &take_a_off($2) /e; } sub take_a_off { my $y = shift; $y =~ s/a//g; $y; } } if ($x) { &write_DBorFILE(0,'',$boardsdir,$id,'txt',@boardtomodify); } } } $bname = $FORM{"name$i"}; &FromChars($bname); &ToHTML($bname); # If someone has the bright idea of starting a membergroup with a $ # We need to escape it for them, to prevent us interpreting it as a var... $FORM{"viewperms$i"} =~ s~\$~\\\$~g; $board{"$id"} = "$bname|$FORM{\"viewperms$i\"}|$FORM{\"show$i\"}"; $bdescription = $FORM{"description$i"}; &FromChars($bdescription); $bdescription =~ s/\r//g; $bdescription =~ s~\n~
~g; if ($do_scramble_id) { my @mods; foreach (split(', ', $FORM{"moderators$i"})) { push(@mods, &decloak($_)); } $FORM{"moderators$i"} = join(', ', @mods); } if ($FORM{"zero$i"} eq '') { $FORM{"zero$i"} = 0; } $FORM{"minage$i"} =~ tr/[0-9]//cd; ## remove non numbers $FORM{"maxage$i"} =~ tr/[0-9]//cd; ## remove non numbers if ($FORM{"minage$i"} < 0) { $FORM{"minage$i"} = ""; } if ($FORM{"maxage$i"} < 0) { $FORM{"maxage$i"} = ""; } if ($FORM{"minage$i"} > 180) { $FORM{"minage$i"} = ""; } if ($FORM{"maxage$i"} > 180) { $FORM{"maxage$i"} = ""; } if ($FORM{"maxage$i"} && $FORM{"maxage$i"} < $FORM{"minage$i"}) { $FORM{"maxage$i"} = $FORM{"minage$i"}; } push(@boardcontrol, "$FORM{\"cat$i\"}|$id|$FORM{\"pic$i\"}|$bdescription|$FORM{\"moderators$i\"}|$FORM{\"moderatorgroups$i\"}|$FORM{\"topicperms$i\"}|$FORM{\"replyperms$i\"}|$FORM{\"pollperms$i\"}|$FORM{\"zero$i\"}|$FORM{\"membergroups$i\"}|$FORM{\"ann$i\"}|$FORM{\"rbin$i\"}|$FORM{\"att$i\"}|$FORM{\"minage$i\"}|$FORM{\"maxage$i\"}|$FORM{\"gender$i\"}|$FORM{\"canpost$i\"}|$FORM{\"parent$i\"}\n"); push(@changes, $id); $yymain .= qq~'$FORM{"name$i"}' $admin_txt{'48'}
~; } # do the saving here, after all new boards passed the tests (fatal_error) if ($FORM{'screenornot'} ne "boardscreen") { &BoardTotals("add", @changes); } &Write_ForumMaster; my @oldcontrols = &read_DBorFILE(0,FORUMCONTROL,$boardsdir,'forum','control'); my $oldboard; # Update categories for subboards that got changed. for (my $cnt = 0; $cnt < @oldcontrols; $cnt++) { (undef, $oldboard, undef) = split(/\|/, $oldcontrols[$cnt], 3); foreach my $changedboard (@updatecats) { if ($changedboard eq $oldboard) { my ($oldcat, $therest) = split(/\|/, $oldcontrols[$cnt], 2); $oldcontrols[$cnt] = qq~${$uid.$changedboard}{'cat'}|$therest~; last; } } } for (my $cnt = 0; $cnt < @oldcontrols; $cnt++) { (undef, $oldboard, undef) = split(/\|/, $oldcontrols[$cnt], 3); foreach my $changedboard (@changes) { if ($changedboard eq $oldboard) { $oldcontrols[$cnt] = ""; last;} } } push(@oldcontrols, @boardcontrol); &write_DBorFILE(0,FORUMCONTROL,$boardsdir,'forum','control',sort(grep { $_; } @oldcontrols)); $action_area = "manageboards"; &AdminTemplate; } sub ReorderBoards { &is_admin_or_gmod; &get_forum_master; if($INFO{'subboards'}) { &LoadBoardControl; } if ($#categoryorder > 0) { foreach $category (@categoryorder) { chomp $category; ($categoryname, undef) = split(/\|/, $catinfo{$category}); &ToChars($categoryname); if (($category eq $INFO{"item"} && !$INFO{'subboards'}) || ($category eq ${$uid.$INFO{"item"}}{'cat'} && $INFO{'subboards'})) { $categorylistsel = qq~~; } else { $categorylist .= qq~~; } # build option lists for parent boards my @catboards = split(/,/, $cat{$category}); my $indent = -2; $catboardlist{$category} = qq~