| ############################################################################### |
| ############################################################################### |
| # ManageBoards.pl # |
| # ManageBoards.pm # |
| |
| # $Date: 01.05.16 $ # |
| ############################################################################### |
| ############################################################################### |
| # YaBB: Yet another Bulletin Board # |
| # YaBB: Yet another Bulletin Board # |
| # Open-Source Community Software for Webmasters # |
| # Open-Source Community Software for Webmasters # |
| # Version: YaBB 2.5.2 # |
| # Version: YaBB 2.6.12 # |
| # Packaged: October 21, 2012 # |
| # Packaged: January 5, 2016 # |
| # Distributed by: http://www.yabbforum.com # |
| # Distributed by: http://www.yabbforum.com # |
| # =========================================================================== # |
| # =========================================================================== # |
| # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Copyright (c) 2000-2016 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Software by: The YaBB Development Team # |
| # Software by: The YaBB Development Team # |
| # with assistance from the YaBB community. # |
| # with assistance from the YaBB community. # |
| ############################################################################### |
| ############################################################################### |
| |
| use CGI::Carp qw(fatalsToBrowser); |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| $manageboardsplver = 'YaBB 2.5.2 $Revision: 1.0 $'; |
| $manageboardspmver = 'YaBB 2.6.12 $Revision: 1710 $'; |
| if ($action eq 'detailedversion') { return 1; } |
| if ( $action eq 'detailedversion' ) { return 1; } |
| |
| $admin_images = "$yyhtml_root/Templates/Admin/default"; |
| |
| |
| sub ManageBoards { |
| sub ManageBoards { |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| &LoadBoardControl; |
| LoadBoardControl(); |
| unless ($mloaded == 1) { require "$boardsdir/forum.master"; } |
| get_forum_master(); |
| if ($INFO{'action'} eq 'managecats') { |
| if ( $INFO{'action'} eq 'managecats' ) { |
| $colspan = qq~colspan="2"~; |
| $colspan = q~colspan="2"~; |
| $add = $admin_txt{'47'}; |
| $add = $admin_txt{'47'}; |
| $act = 'catscreen'; |
| $act = 'catscreen'; |
| $manage = qq~<a href="$adminurl?action=reordercats"><img src="$imagesdir/reorder.gif" alt="$admin_txt{'829'}" title="$admin_txt{'829'}" border="0" style="vertical-align: middle;" /></a> <b>$admin_txt{'49'}</b>~; |
| $manage = |
| $managedescr = $admin_txt{'678'}; |
| qq~<a href="$adminurl?action=reordercats"><img src="$admin_img{'reorder'}" alt="$admin_txt{'829'}" title="$admin_txt{'829'}" /></a> <b>$admin_txt{'49'}</b>~; |
| $act2 = 'addcat'; |
| $managedescr = $admin_txt{'678'}; |
| $action_area = 'managecats'; |
| $act2 = 'addcat'; |
| } else { |
| $action_area = 'managecats'; |
| $colspan = qq~colspan="4"~; |
| } |
| $add = $admin_txt{'50'}; |
| else { |
| $act = 'boardscreen'; |
| $colspan = q~colspan="4"~; |
| $manage = qq~<img src="$imagesdir/cat.gif" alt="" border="0" style="vertical-align: middle;" /> <b>$admin_txt{'51'}</b>~; |
| $add = $admin_txt{'50'}; |
| $managedescr = $admin_txt{'677'}; |
| $act = 'boardscreen'; |
| $act2 = 'addboard'; |
| $manage = |
| $action_area = 'manageboards'; |
| qq~$admin_img{'cat_img'} <b>$admin_txt{'51'}</b>~; |
| } |
| $managedescr = $admin_txt{'677'}; |
| $yymain .= qq~ |
| $act2 = 'addboard'; |
| <script language="JavaScript1.2" type="text/javascript"> |
| $action_area = 'manageboards'; |
| <!-- |
| ## find bad boards |
| function checkSubmit(where){ |
| my @dupedbrds = (); |
| var something_checked = false; |
| my @mylist = (); |
| for (i=0; i<where.elements.length; i++){ |
| while( ( $key, $value ) = each %cat ) { |
| if(where.elements[i].type == "checkbox"){ |
| @mylist = split /,/xsm, $value; |
| if(where.elements[i].checked == true){ |
| push @dupedbrds, @mylist; |
| something_checked = true; |
| } |
| } |
| while( ( $key, $value ) = each %subboard ) { |
| } |
| @mylist = split /[|]/xsm, $value; |
| } |
| push @dupedbrds, @mylist; |
| if(something_checked == true){ |
| } |
| if (where.baction[1].checked == false){ |
| my %dup_counts; |
| return true; |
| for (@dupedbrds) { $dup_counts{$_}++ }; |
| } |
| my @chkbrds = grep { $dup_counts{$_} > 1 } keys %dup_counts; |
| if (confirm("$admin_txt{'617'}")) { |
| @chkbrds = sort(@chkbrds); |
| return true; |
| if (@chkbrds) { |
| } else { |
| $managedescr .= qq~<br />$admin_txt{'dupbrd'} @chkbrds<br />$admin_txt{'dupbrdlnk'}~; |
| return false; |
| } |
| } |
| } |
| } else { |
| $yymain .= qq~<script type="text/javascript"> |
| alert("$admin_txt{'5'}"); |
| function checkSubmit(where){ |
| return false; |
| var something_checked = false; |
| } |
| for (i=0; i<where.elements.length; i++){ |
| } |
| if(where.elements[i].type == "checkbox"){ |
| //--> |
| if(where.elements[i].checked === true){ |
| </script> |
| something_checked = true; |
| <form name="whattodo" action="$adminurl?action=$act" onSubmit="return checkSubmit(this);" method="post"> |
| } |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| } |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| } |
| <tr valign="middle"> |
| if(something_checked === true){ |
| <td align="left" class="titlebg" $colspan> |
| if (where.baction[1].checked === false){ |
| $manage |
| return true; |
| </td> |
| } |
| </tr> |
| if (confirm("$admin_txt{'617'}")) { |
| <tr align="center" valign="middle"> |
| return true; |
| <td align="left" class="windowbg2" $colspan><br /> |
| } else { |
| $managedescr<br /><br /> |
| return false; |
| </td> |
| } |
| </tr> |
| } else { |
| ~; |
| alert("$admin_txt{'5'}"); |
| foreach $catid (@categoryorder) { |
| return false; |
| @bdlist = split(/,/, $cat{$catid}); |
| } |
| ($curcatname, $catperms) = split(/\|/, $catinfo{"$catid"}); |
| } |
| &ToChars($curcatname); |
| |
| |
| function editSingle(board) { |
| if ($INFO{"action"} eq "managecats") { |
| var where = document.getElementById("whattodo"); |
| $tempcolspan = ""; |
| for (i=0; i<where.elements.length; i++){ |
| $tempclass = "windowbg2"; |
| if(where.elements[i].type == "checkbox"){ |
| $temphrefclass = ""; |
| if(where.elements[i].getAttribute("name") == board){ |
| } else { |
| where.elements[i].checked = true; |
| $tempcolspan = qq~colspan="4"~; |
| } else { |
| $tempclass = "catbg"; |
| where.elements[i].checked = false; |
| $temphrefclass = qq~class="catbg a"~; |
| } |
| } |
| } |
| |
| } |
| $yymain .= qq~ |
| document.getElementById("baction").checked = true; |
| <tr valign="middle"> |
| where.submit(); |
| <td align="left" height="25" class="$tempclass" valign="middle" $tempcolspan> |
| } |
| <a href="$adminurl?action=reorderboards;item=$catid" $temphrefclass><img src="$imagesdir/reorder.gif" alt="$admin_txt{'832'}" title="$admin_txt{'832'}" border="0" style="vertical-align: middle;" /></a> <b>$curcatname</b> |
| |
| </td> |
| function delSingle(board) { |
| ~; |
| var where = document.getElementById("whattodo"); |
| if ($INFO{"action"} eq "managecats") { |
| for (i=0; i<where.elements.length; i++){ |
| $yymain .= qq~ |
| if(where.elements[i].type == "checkbox"){ |
| <td class="windowbg" height="25" width="10%" align="center"><input type="checkbox" name="yitem_$catid" value="1" /></td>~; |
| if(where.elements[i].getAttribute("name") == board){ |
| } |
| where.elements[i].checked = true; |
| |
| } else { |
| $yymain .= qq~ |
| where.elements[i].checked = false; |
| </tr>~; |
| } |
| unless ($INFO{"action"} eq "managecats") { |
| } |
| foreach $curboard (@bdlist) { |
| } |
| ($boardname, $boardperms, $boardview) = split(/\|/, $board{$curboard}); |
| document.getElementById("delme").checked = true; |
| $boardname =~ s/\"\;/"/g; |
| if (confirm("$admin_txt{'617'}")) { |
| &ToChars($boardname); |
| where.submit(); |
| $descr = ${$uid.$curboard}{'description'}; |
| } |
| $descr =~ s~\<br />~\n~g; |
| } |
| my $bicon = ""; |
| </script> |
| if(${$uid.$curboard}{'pic'}) { $bicon = ${$uid.$curboard}{'pic'}; } |
| <form name="whattodo" id="whattodo" action="$adminurl?action=$act" onsubmit="return checkSubmit(this);" method="post" enctype="multipart/form-data"> |
| if ($bicon =~ /\//i) { $bicon = qq~ <img src="$bicon" alt="" border="0" /> ~; } |
| <div class="rightboxdiv"> |
| elsif ($bicon) { $bicon = qq~ <img src="$imagesdir/$bicon" alt="" border="0" /> ~; } |
| <table class="bordercolor border-space pad-cell" style="margin-bottom: .5em;"> |
| if (${$uid.$curboard}{'ann'} == 1) { $bicon = qq~ <img src="$imagesdir/ann.gif" alt="$admin_txt{'64g'}" title="$admin_txt{'64g'}" border="0" />~; } |
| <tr> |
| if (${$uid.$curboard}{'rbin'} == 1) { $bicon = qq~ <img src="$imagesdir/recycle.gif" alt="$admin_txt{'64i'}" title="$admin_txt{'64i'}" border="0" />~; } |
| <td class="titlebg" $colspan>$manage</td> |
| $convertstr = $descr; |
| </tr><tr> |
| unless($convertstr =~ /<.+?>/) { # Don't cut it if there's HTML in it. |
| <td class="windowbg2" $colspan> |
| $convertcut = 60; |
| <div class="pad-more">$managedescr</div> |
| &CountChars; |
| </td> |
| } |
| </tr> |
| my $descr = $convertstr; |
| </table>~; |
| &ToChars($descr); |
| for my $catid (@categoryorder) { |
| if ($cliped) { $descr .= "..."; } |
| @bdlist = split /,/xsm, $cat{$catid}; |
| $yymain .= qq~ |
| ( $curcatname, $catperms, undef, $catpic ) = split /\|/xsm, $catinfo{$catid}; |
| <tr> |
| ToChars($curcatname); |
| <td class="windowbg" width="25%" align="left">$boardname</td> |
| $temppic = q{}; |
| <td class="windowbg" width="65%" align="left">$descr</td> |
| if ( $INFO{'action'} eq 'managecats' ) { |
| <td class="windowbg" width="5%" align="center">$bicon</td> |
| $tempcolspan = q{}; |
| <td class="titlebg" width="5%" align="center"><input type="checkbox" name="yitem_$curboard" value="1" /></td> |
| $tempclass = 'windowbg2'; |
| </tr> |
| $temphrefclass = q{}; |
| ~; |
| } |
| } |
| else { |
| } |
| $tempcolspan = q~colspan="4"~; |
| } |
| $tempclass = 'catbg'; |
| |
| if ( $catpic ) { |
| $yymain .= qq~ |
| $temppic = qq~<div style="float:right; margin-right: 10%"><img src="$yyhtml_root/Templates/Forum/default/$catpic" id="brd_img_resize" alt="$catid" /></div>~; |
| <tr> |
| } |
| <td class="catbg" width="100%" align="center" valign="middle" $colspan> <label for="baction">$admin_txt{'52'}</label> |
| $temphrefclass = q~class="catbg a"~; |
| <input type="radio" name="baction" id="baction" value="edit" checked="checked" /> $admin_txt{'53'} |
| } |
| <input type="radio" name="baction" value="delme" /> $admin_txt{'54'} |
| |
| <input type="submit" value="$admin_txt{'32'}" class="button" /></td> |
| $yymain .= qq~ |
| </tr> |
| <table class="bordercolor borderstyle border-space pad-cell" style="margin-bottom: .5em;"> |
| </table> |
| <tr> |
| </div> |
| <td class="$tempclass" style="height:25px" $tempcolspan> |
| </form> |
| <a href="$adminurl?action=reorderboards;item=$catid" $temphrefclass><img src="$admin_img{'reorder'}" alt="$admin_txt{'832'}" title="$admin_txt{'832'}" /></a> <b>$curcatname</b>$temppic</td>~; |
| <br /> |
| if ( $INFO{'action'} eq 'managecats' ) { |
| <form name="diff" action="$adminurl?action=$act2" method="post"> |
| $yymain .= qq~ |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| <td class="windowbg center" style="height:25px; width: 10%"><input type="checkbox" name="yitem_$catid" value="1" /></td>~; |
| <table width="100%" cellspacing="1" cellpadding="4"> |
| } |
| <tr> |
| |
| <td class="catbg" align="center" valign="middle"><label for="amount"><b>$add: </b></label> |
| $yymain .= q~ |
| <input type="text" name="amount" id="amount" value="3" size="2" maxlength="2" /> |
| </tr> |
| <input type="submit" value="$admintxt{'45'}" class="button" /> |
| </table>~; |
| </td> |
| if ( $INFO{'action'} ne 'managecats' ) { |
| </tr> |
| my $indent = -3; |
| </table> |
| @tmplt = (); |
| </div> |
| |
| </form> |
| for my $curtemplate ( sort keys %templateset ){ |
| ~; |
| @templatelst = split /\|/xsm, $templateset{$curtemplate}; |
| $yytitle = "$admintxt{'a4_title'}"; |
| push @tmplt, $curtemplate; |
| &AdminTemplate; |
| } |
| |
| my $tmpwidth2 = 90 - $indent; |
| |
| my $tmpwidth3 = 5; |
| |
| # recursive loop to display all sub boards |
| |
| |
| |
| *show_boards = sub { |
| |
| my @brdlist = @_; |
| |
| $indent += 3; |
| |
| for my $curboard (@brdlist) { |
| |
| ( $boardname, $boardperms, $boardview ) = |
| |
| split /\|/xsm, $board{$curboard}; |
| |
| $boardname =~ s/\"\;/&\x2334;/gxsm; |
| |
| ToChars($boardname); |
| |
| $descr = ${ $uid . $curboard }{'description'}; |
| |
| $descr =~ s/\<br \/>/\n/gsm; |
| |
| my $bicon = q{}; |
| |
| fopen( BRDPIC, "<$boardsdir/brdpics.db" ); |
| |
| my @brdpics = <BRDPIC>; |
| |
| fclose( BRDPIC); |
| |
| chomp @brdpics; |
| |
| for (@brdpics) { |
| |
| my ( $brdnm, $style, $brdpic ) = split /[|]/xsm, $_; |
| |
| if ( $brdnm eq $curboard ) { |
| |
| for my $x ( 0 .. $#tmplt ) { |
| |
| if ( $style eq $tmplt[$x] ) { |
| |
| if ( $brdpic =~ /\//ixsm ) { |
| |
| $bicon .= qq~$style: <img src="$brdpic" id="brd_img_resize" alt="" style="margin-bottom:.5em" /><br />~; |
| |
| } |
| |
| else { |
| |
| @mytempst = split /\|/xsm, $templateset{$style}; |
| |
| $myimgfolder = $mytempst[1]; |
| |
| $bicon .= qq~$style: <img src="$yyhtml_root/Templates/Forum/$myimgfolder/Boards/$brdpic" id="brd_img_resize" alt="" style="margin-bottom:.5em" /><br />~; |
| |
| } |
| |
| $tmpwidth2 = 80 - $indent; |
| |
| $tmpwidth3 = 15; |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| if ( ${ $uid . $curboard }{'ann'} == 1 ) { |
| |
| $bicon = |
| |
| qq~ <img src="$imagesdir/ann.png" alt="$admin_txt{'64g'}" title="$admin_txt{'64g'}" />~; |
| |
| $tmpwidth2 = 90 - $indent; |
| |
| $tmpwidth3 = 5; |
| |
| } |
| |
| if ( ${ $uid . $curboard }{'rbin'} == 1 ) { |
| |
| $bicon = |
| |
| qq~ <img src="$imagesdir/recycle.png" alt="$admin_txt{'64i'}" title="$admin_txt{'64i'}" />~; |
| |
| $tmpwidth2 = 90 - $indent; |
| |
| $tmpwidth3 = 5; |
| |
| } |
| |
| $convertstr = $descr; |
| |
| if ( $convertstr !~ /<.+?>/xsm ) |
| |
| { # Don't cut it if there's HTML in it. |
| |
| $convertcut = 60; |
| |
| CountChars(); |
| |
| } |
| |
| my $descr = $convertstr; |
| |
| ToChars($descr); |
| |
| if ($cliped) { $descr .= q{...}; } |
| |
| |
| |
| my $tmpwidth = 100 - $indent; |
| |
| |
| |
| my @children = split /\|/xsm, $subboard{$curboard}; |
| |
| |
| |
| $reorder_subs = |
| |
| @children > 0 |
| |
| ? qq~ <a href="$adminurl?action=reorderboards;item=$curboard;subboards=1"><img src="$admin_images/reorder_sub.png" alt="$admin_txt{'252'}" title="$admin_txt{'252'}" /></a>~ |
| |
| : q{}; |
| |
| |
| |
| my $del_txt = $admin_txt{'251'}; |
| |
| my $edit_txt = $admin_txt{'253'}; |
| |
| if ( ${ $uid . $curboard }{'parent'} ) { |
| |
| $del_txt =~ s/{(.*?)}/$admin_txt{'254'}$1/gxsm; |
| |
| $edit_txt =~ s/{(.*?)}/$admin_txt{'254'}$1/gxsm; |
| |
| } |
| |
| else { |
| |
| $del_txt =~ s/{(.*?)}/$1/gxsm; |
| |
| $edit_txt =~ s/{(.*?)}/$1/gxsm; |
| |
| } |
| |
| |
| |
| $yymain .= q~ |
| |
| <table class="bordercolor borderstyle border-space pad-cell" style="margin-bottom: .5em; margin-left:~ |
| |
| . $indent . q~%; width:~ . $tmpwidth . q~%"> |
| |
| <colgroup> |
| |
| <col style="width: ~ . $tmpwidth2 . q~%" /> |
| |
| <col style="width: ~ . $tmpwidth3 . qq~%" /> |
| |
| <col style="width: 5%" /> |
| |
| </colgroup> |
| |
| <tr> |
| |
| <td class="windowbg2"> |
| |
| <b>$boardname</b> |
| |
| <div style="position:relative; display:inline; float:right;"> |
| |
| <a href="$adminurl?action=addboard;parent=$curboard;category=$catid"><img src="$admin_images/add_sub.png" alt="$admin_txt{'250'}" title="$admin_txt{'250'}" /></a> |
| |
| <a href="javascript:editSingle('yitem_$curboard')"><img src="$admin_images/edit_sub.png" alt="$edit_txt" title="$edit_txt" /></a> |
| |
| <a href="javascript:delSingle('yitem_$curboard')"><img src="$admin_images/delete_sub.png" alt="$del_txt" title="$del_txt" /></a> |
| |
| ~ . $reorder_subs . qq~ |
| |
| </div> |
| |
| </td> |
| |
| <td class="windowbg2 center">$bicon</td> |
| |
| <td class="titlebg center"><input type="checkbox" name="yitem_$curboard" value="1" /></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg" colspan="3">$descr</td> |
| |
| </tr> |
| |
| </table>~; |
| |
| if ( $subboard{$curboard} ) { show_boards(@children); } |
| |
| } |
| |
| $indent -= 3; |
| |
| }; |
| |
| show_boards(@bdlist); |
| |
| } |
| |
| } |
| |
| |
| |
| $yymain .= qq~ |
| |
| <table class="bordercolor borderstyle border-space pad-cell" style="margin-bottom: .5em;"> |
| |
| <tr> |
| |
| <td class="catbg center" $colspan> <label for="baction">$admin_txt{'52'}</label> |
| |
| <input type="radio" name="baction" id="baction" value="edit" checked="checked" /> $admin_txt{'53'} |
| |
| <input type="radio" name="baction" id="delme" value="delme" /> $admin_txt{'54'} |
| |
| <input type="submit" value="$admin_txt{'32'}" class="button" /> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div> |
| |
| </form> |
| |
| <form name="diff" id="diff" action="$adminurl?action=$act2" method="post" accept-charset="$yymycharset"> |
| |
| <div class="bordercolor rightboxdiv"> |
| |
| <table class="border-space pad-cell"> |
| |
| <tr> |
| |
| <th class="titlebg">$admin_img{'cat_img'} $add</th> |
| |
| </tr><tr> |
| |
| <td class="catbg center"> |
| |
| <label for="amount"><b>$add: </b></label> |
| |
| <input type="text" name="amount" id="amount" value="3" size="2" maxlength="2" /> |
| |
| <input type="submit" value="$admintxt{'45'}" class="button" /> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div> |
| |
| </form>~; |
| |
| $yytitle = "$admintxt{'a4_title'}"; |
| |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub BoardScreen { |
| sub BoardScreen { |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| unless ($mloaded == 1) { require "$boardsdir/forum.master"; } |
| get_forum_master(); |
| $i = 0; |
| $i = 0; |
| while ($_ = each(%FORM)) { |
| while ( $_ = each %FORM ) { |
| if ($FORM{$_} && $_ =~ /^yitem_(.+)$/) { |
| if ( $FORM{$_} && $_ =~ /^yitem_(.+)$/xsm ) { |
| $editboards[$i] = $1; |
| $editboards[$i] = $1; |
| $i++; |
| $i++; |
| } |
| } |
| } |
| } |
| $i = 1; |
| $i = 1; |
| foreach $thiscat (@categoryorder) { |
| for my $thiscat (@categoryorder) { |
| @theboards = split(/,/, $cat{$thiscat}); |
| my @catboards = split /,/xsm, $cat{$thiscat}; |
| for (my $z = 0; $z < @theboards; $z++) { |
| |
| for (my $j = 0; $j < @editboards; $j++) { |
| # make an array of all sub boards recursively |
| if ($editboards[$j] eq $theboards[$z]) { |
| *recursive_boards = sub { |
| $editbrd[$i] = $theboards[$z]; |
| my @x = @_; |
| $i++; |
| push @theboards, @x; |
| splice(@editboards,$j,1); |
| for my $childbd (@x) { |
| last; |
| if ( $subboard{$childbd} ) { |
| } |
| recursive_boards( split /\|/xsm, $subboard{$childbd} ); |
| } |
| } |
| } |
| } |
| } |
| }; |
| if ($FORM{'baction'} eq "edit") { &AddBoards(@editbrd); } |
| recursive_boards(@catboards); |
| elsif ($FORM{'baction'} eq "delme") { |
| |
| shift(@editbrd); |
| for my $z ( 0 .. ( @theboards - 1 ) ) { |
| if (!$mloaded) { require "$boardsdir/forum.master"; } |
| my $found = 0; |
| foreach my $bd (@editbrd) { |
| for my $j ( 0 .. ( @editboards - 1 ) ) { |
| # Remove Board form category it belongs to |
| if ( $editboards[$j] eq $theboards[$z] ) { |
| $category = ${$uid.$bd}{'cat'}; |
| $editbrd[$i] = $theboards[$z]; |
| @bdlist = split(/,/, $cat{$category}); |
| $found = 1; |
| my $c = 0; |
| $i++; |
| foreach (@bdlist) { |
| splice @editboards, $j, 1; |
| if ($_ eq $bd) { splice(@bdlist, $c, 1); last; } |
| last; |
| $c++; |
| } |
| } |
| } |
| $cat{$category} = join(',', &undupe(@bdlist)); |
| } |
| delete $board{$bd}; |
| } |
| $yymain .= qq~$admin_txt{'55'}$bd <br />~; |
| if ( $FORM{'baction'} eq 'edit' ) { AddBoards(@editbrd); } |
| } |
| elsif ( $FORM{'baction'} eq 'delme' ) { |
| |
| shift @editbrd; |
| # Actual deleting |
| get_forum_master(); |
| &DeleteBoards(@editbrd); |
| for my $bd (@editbrd) { |
| &Write_ForumMaster; |
| |
| |
| # Remove Board form category it belongs to unless it's a sub board, then it's not in the cat list |
| } else { |
| if ( !${ $uid . $bd }{'parent'} ) { |
| &admin_fatal_error("no_action","$FORM{'baction'}"); |
| $category = ${ $uid . $bd }{'cat'}; |
| } |
| @bdlist = split /,/xsm, $cat{$category}; |
| |
| my $c = 0; |
| $action_area = "manageboards"; |
| for (@bdlist) { |
| &AdminTemplate; |
| if ( $_ eq $bd ) { splice @bdlist, $c, 1; last; } |
| |
| $c++; |
| |
| } |
| |
| $cat{$category} = join q{,}, undupe(@bdlist); |
| |
| } |
| |
| else |
| |
| { # if it has a parent, remove it from its parent's child board list |
| |
| my @bdlist = |
| |
| split /\|/xsm, $subboard{ ${ $uid . $bd }{'parent'} }; |
| |
| |
| |
| # Remove Board from old parent board |
| |
| my $k = 0; |
| |
| for (@bdlist) { |
| |
| if ( $bd eq $_ ) { splice @bdlist, $k, 1; } |
| |
| $k++; |
| |
| } |
| |
| $subboard{ ${ $uid . $bd }{'parent'} } = join q{|}, @bdlist; |
| |
| } |
| |
| |
| |
| # remove the $subboard{} hash that contains children list, since it's a parent board and move children up |
| |
| if ( $subboard{$bd} ) { |
| |
| for my $childbd ( split /\|/xsm, $subboard{$bd} ) { |
| |
| |
| |
| # if this one has a parent board, move its 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'} = q{}; |
| |
| } |
| |
| push @del_updateparent, $childbd; |
| |
| } |
| |
| delete $subboard{$bd}; |
| |
| } |
| |
| delete $board{$bd}; |
| |
| $yymain .= qq~$admin_txt{'55'}$bd <br />~; |
| |
| } |
| |
| |
| |
| # Actual deleting |
| |
| DeleteBoards(@editbrd); |
| |
| Write_ForumMaster(); |
| |
| } |
| |
| else { |
| |
| fatal_error( 'no_action', "$FORM{'baction'}" ); |
| |
| } |
| |
| |
| |
| $action_area = 'manageboards'; |
| |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub DeleteBoards { |
| sub DeleteBoards { |
| &is_admin_or_gmod; |
| my @x = @_; |
| |
| is_admin_or_gmod(); |
| |
| |
| fopen(FORUMCONTROL, "+<$boardsdir/forum.control") || &fatal_error("cannot_open","$boardsdir/forum.control", 1); |
| fopen( FORUMCONTROL, "+<$boardsdir/forum.control" ) |
| seek FORUMCONTROL, 0, 0; |
| || fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 ); |
| my @oldcontrols = <FORUMCONTROL>; |
| seek FORUMCONTROL, 0, 0; |
| foreach $board (@_) { |
| my @oldcontrols = <FORUMCONTROL>; |
| fopen(BOARDDATA, "$boardsdir/$board.txt"); |
| for my $board (@x) { |
| @messages = <BOARDDATA>; |
| fopen( BOARDDATA, "$boardsdir/$board.txt" ); |
| fclose(BOARDDATA); |
| @messages = <BOARDDATA>; |
| foreach $curmessage (@messages) { |
| fclose(BOARDDATA); |
| my ($id, undef) = split(/\|/, $curmessage, 2); |
| for my $curmessage (@messages) { |
| unlink("$datadir/$id\.txt"); |
| my ( $id, undef ) = split /\|/xsm, $curmessage, 2; |
| unlink("$datadir/$id\.mail"); |
| unlink "$datadir/$id\.txt"; |
| unlink("$datadir/$id\.ctb"); |
| unlink "$datadir/$id\.mail"; |
| unlink("$datadir/$id\.data"); |
| unlink "$datadir/$id\.ctb"; |
| unlink("$datadir/$id\.poll"); |
| unlink "$datadir/$id\.data"; |
| unlink("$datadir/$id\.polled"); |
| unlink "$datadir/$id\.poll"; |
| } |
| unlink "$datadir/$id\.polled"; |
| for (my $cnt = 0; $cnt < @oldcontrols; $cnt++) { |
| } |
| my $oldboard; |
| for my $cnt ( 0 .. ( @oldcontrols - 1 ) ) { |
| (undef, $oldboard, undef) = split(/\|/, $oldcontrols[$cnt], 3); |
| my $oldboard; |
| $yydebug .= "$cnt $oldboard \n"; |
| ( undef, $oldboard, undef ) = split /\|/xsm, $oldcontrols[$cnt], 3; |
| if ($oldboard eq $board) { |
| $yydebug .= "$cnt $oldboard \n"; |
| $oldcontrols[$cnt] = ""; |
| if ( $oldboard eq $board ) { |
| $yydebug .= "\$board{\"$oldboard\"}"; |
| $oldcontrols[$cnt] = q{}; |
| delete $board{"$board"}; |
| $yydebug .= qq~\$board{\"$oldboard\"}~; |
| last; |
| delete $board{"$board"}; |
| } |
| last; |
| } |
| } |
| unlink("$boardsdir/$board.txt"); |
| } |
| unlink("$boardsdir/$board.ttl"); |
| unlink "$boardsdir/$board.txt"; |
| unlink("$boardsdir/$board.poster"); |
| unlink "$boardsdir/$board.ttl"; |
| unlink("$boardsdir/$board.mail"); |
| unlink "$boardsdir/$board.poster"; |
| |
| unlink "$boardsdir/$board.mail"; |
| fopen(ATM, "+<$vardir/attachments.txt", 1); |
| unlink "$boardsdir/$board.exhits"; |
| seek ATM, 0, 0; |
| |
| my @buffer = <ATM>; |
| fopen( ATM, "+<$vardir/attachments.txt", 1 ); |
| my ($amcurrentboard,$amfn); |
| seek ATM, 0, 0; |
| for (my $a = 0; $a < @buffer; $a++) { |
| my @buffer = <ATM>; |
| (undef, undef, undef, undef, $amcurrentboard, undef, undef, $amfn, undef) = split(/\|/, $buffer[$a]); |
| my ( $amcurrentboard, $amfn ); |
| if ($amcurrentboard eq $board) { |
| for my $aa ( 0 .. ( @buffer - 1 ) ) { |
| $buffer[$a] = ''; |
| ( |
| unlink("$upload_dir/$amfn"); |
| undef, undef, undef, |
| } |
| undef, $amcurrentboard, undef, |
| } |
| undef, $amfn, undef |
| truncate ATM, 0; |
| ) = split /\|/xsm, $buffer[$aa]; |
| seek ATM, 0, 0; |
| if ( $amcurrentboard eq $board ) { |
| print ATM @buffer; |
| $buffer[$aa] = q{}; |
| fclose(ATM); |
| unlink "$upload_dir/$amfn"; |
| |
| } |
| &BoardTotals("delete", $board); |
| } |
| } |
| truncate ATM, 0; |
| |
| seek ATM, 0, 0; |
| my @boardcontrol = grep { $_; } @oldcontrols; |
| print {ATM} @buffer or croak "$croak{'print'} ATM"; |
| |
| fclose(ATM); |
| truncate FORUMCONTROL, 0; |
| |
| seek FORUMCONTROL, 0, 0; |
| BoardTotals( 'delete', $board ); |
| print FORUMCONTROL sort(@boardcontrol); |
| } |
| fclose(FORUMCONTROL); |
| |
| |
| # Update parents for subboards that had a parent deleted. |
| fopen(FORUMCONTROL, "$boardsdir/forum.control"); |
| if (@del_updateparent) { |
| @forum_control = <FORUMCONTROL>; |
| for my $cnt ( 0 .. ( @oldcontrols - 1 ) ) { |
| fclose(FORUMCONTROL); |
| @newbrd = split /\|/xsm, $oldcontrols[$cnt]; |
| |
| for my $changedboard (@del_updateparent) { |
| |
| if ( $changedboard eq $oldboard ) { |
| |
| $newbrd[18] = ${$uid.$changedboard}{'parent'}; |
| |
| $newbrd = join q{|}, @newbrd; |
| |
| $oldcontrols[$cnt] = $newbrd . "\n"; |
| |
| last; |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| my @boardcontrol = grep { $_; } @oldcontrols; |
| |
| |
| |
| truncate FORUMCONTROL, 0; |
| |
| seek FORUMCONTROL, 0, 0; |
| |
| print {FORUMCONTROL} sort @boardcontrol |
| |
| or croak "$croak{'print'} FORUMCONTROL"; |
| |
| fclose(FORUMCONTROL); |
| |
| |
| |
| fopen( FORUMCONTROL, "$boardsdir/forum.control" ); |
| |
| @forum_control = <FORUMCONTROL>; |
| |
| fclose(FORUMCONTROL); |
| |
| return; |
| } |
| } |
| |
| |
| sub AddBoards { |
| sub AddBoards { |
| my @editboards = @_; |
| my @editboards = @_; |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| $addtext = $admin_txt{'50'}; |
| $addtext = $admin_txt{'50'}; |
| if ($INFO{'action'} eq 'boardscreen') { $FORM{'amount'} = $#editboards; $addtext = $admin_txt{'50a'}; } |
| if ( $INFO{'action'} eq 'boardscreen' ) { |
| unless ($mloaded == 1) { require "$boardsdir/forum.master"; } |
| $FORM{'amount'} = $#editboards; |
| $yymain .= qq~ |
| $addtext = $admin_txt{'50a'}; |
| <script language="JavaScript1.2" type="text/javascript"> |
| } |
| <!-- |
| if ( $INFO{'parent'} ) { |
| var copyValues = new Array(); |
| $FORM{'amount'} = 1; |
| var copyList = new Array(); |
| } |
| |
| get_forum_master(); |
| |
| LoadBoardControl(); |
| |
| |
| |
| # build recursive drop down of boards in each category for selecting parent board |
| |
| *get_subboards = sub { |
| |
| my @x = @_; |
| |
| $indent += 2; |
| |
| for my $childbd (@x) { |
| |
| my $dash; |
| |
| if ( $indent > 0 ) { $dash = q{-}; } |
| |
| ( $chldboardname, undef, undef ) = |
| |
| split /\|/xsm, $board{"$childbd"}; |
| |
| ToChars($chldboardname); |
| |
| $catboardlist{$thiscat} .= |
| |
| qq~$childbd|~ |
| |
| . ( q{ } x $indent ) |
| |
| . ( $dash x ( $indent / 2 ) ) |
| |
| . qq~ $chldboardname|~; |
| |
| if ( $subboard{$childbd} ) { |
| |
| get_subboards( split /\|/xsm, $subboard{$childbd} ); |
| |
| } |
| |
| } |
| |
| $indent -= 2; |
| |
| }; |
| |
| for $thiscat (@categoryorder) { |
| |
| # $thiscat cannot be properly localized |
| |
| my @catboards = split /\,/xsm, $cat{$thiscat}; |
| |
| my $indent = -2; |
| |
| $catboardlist{$thiscat} = q~||~; |
| |
| |
| |
| get_subboards(@catboards); |
| |
| |
| |
| $catboardlist_js .= qq~ |
| |
| catboardlist['$thiscat'] = "$catboardlist{$thiscat}"; |
| |
| ~; |
| |
| } |
| |
| |
| |
| $yymain .= qq~<script type="text/javascript"> |
| |
| var copyValues = new Array(); |
| |
| var copyList = new Array(); |
| |
| |
| |
| var catboardlist = new Array(); |
| |
| $catboardlist_js |
| |
| |
| // this function removes an entry from the IM multi-list |
| // this function removes an entry from the IM multi-list |
| function removeUser(oElement) { |
| function removeUser(oElement) { |
| var oList = oElement.options; |
| var oList = oElement.options; |
| var noneSelected = 1; |
| var noneSelected = 1; |
| |
| |
| for (var i = 0; i < oList.length; i++) { |
| for (var i = 0; i < oList.length; i++) { |
| if(oList[i].selected) noneSelected = 0; |
| if(oList[i].selected) noneSelected = 0; |
| } |
| } |
| if(noneSelected) return false; |
| if(noneSelected) return false; |
| |
| |
| var indexToRemove = oList.selectedIndex; |
| var indexToRemove = oList.selectedIndex; |
| if (confirm("$selector_txt{'remove'}")) |
| if (confirm("$selector_txt{'remove'}")) |
| {oElement.remove(indexToRemove);} |
| {oElement.remove(indexToRemove);} |
| } |
| } |
| // this function forces all users listed in moderators to be selected for processing |
| // this function forces all users listed in moderators to be selected for processing |
| function selectNames(total) { |
| function selectNames(total) { |
| for(var x = 1; x <= total; x++) { |
| for(var x = 1; x <= total; x++) { |
| var oList = document.getElementById('moderators'+x) |
| var oList = document.getElementById('moderators'+x); |
| for (var i = 0; i < oList.options.length; i++) |
| for (var i = 0; i < oList.options.length; i++) |
| {oList.options[i].selected = true;} |
| {oList.options[i].selected = true;} |
| } |
| } |
| } |
| } |
| // allows copying one or multiple items from moderators list |
| // allows copying one or multiple items from moderators list |
| function copyNames(num) { |
| function copyNames(num) { |
| copyList = new Array(); |
| copyList = new Array(); |
| copyValues = new Array(); |
| copyValues = new Array(); |
| var oList = document.getElementById('moderators'+num).options; |
| var oList = document.getElementById('moderators'+num).options; |
| for (var i = 0; i < oList.length; i++) { |
| for (var i = 0; i < oList.length; i++) { |
| if(oList[i].selected == true) { |
| if(oList[i].selected === true) { |
| copyList[copyList.length] = oList[i].text; |
| copyList[copyList.length] = oList[i].text; |
| copyValues[copyValues.length] = oList[i].value; |
| copyValues[copyValues.length] = oList[i].value; |
| } |
| } |
| } |
| } |
| } |
| } |
| // allows pasting from previously copied moderator list items |
| // allows pasting from previously copied moderator list items |
| function pasteNames(num,total) { |
| function pasteNames(num,total) { |
| var found = false; |
| var found = false; |
| var oList = null; |
| var oList = null; |
| var which = 0; |
| var which = 0; |
| if(copyList.length != 0) { |
| if(copyList.length !== 0) { |
| for(var x = 0; x < total; x++) { |
| for(var x = 0; x < total; x++) { |
| which = num + x; |
| which = num + x; |
| oList = document.getElementById('moderators'+which).options; |
| oList = document.getElementById('moderators'+which).options; |
| for (var e = 0; e < copyList.length; e++) { |
| for (var e = 0; e < copyList.length; e++) { |
| found = false; |
| found = false; |
| for (var i = 0; i < oList.length; i++) { |
| for (var i = 0; i < oList.length; i++) { |
| if(oList[i].value == copyValues[e] || oList[i].text == copyList[e]) { |
| if(oList[i].value == copyValues[e] || oList[i].text == copyList[e]) { |
| found = true; |
| found = true; |
| break; |
| break; |
| } |
| } |
| } |
| } |
| if(found == false) { |
| if(found === false) { |
| if(navigator.appName=="Microsoft Internet Explorer") { |
| if(navigator.appName=="Microsoft Internet Explorer") { |
| document.getElementById('moderators'+which).add(new Option(copyList[e],copyValues[e])); |
| document.getElementById('moderators'+which).add(new Option(copyList[e],copyValues[e])); |
| } else { |
| } else { |
| document.getElementById('moderators'+which).add(new Option(copyList[e],copyValues[e]),null); |
| document.getElementById('moderators'+which).add(new Option(copyList[e],copyValues[e]),null); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| //--> |
| // updates parent drop down list when new category is selected |
| </script> |
| function updateParent(cat, board, id) { |
| <form name="boardsadd" action="$adminurl?action=addboard2" method="post" onsubmit="selectNames($FORM{'amount'});"> |
| var parentsel = document.getElementById("parent" + id); |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| var insertbds = catboardlist[cat].split("|"); |
| <table border="0" align="center" cellspacing="1" cellpadding="4" width="100%"> |
| |
| <tr> |
| clearSelect(parentsel); |
| <td class="titlebg" colspan="5" align="left"> |
| for (var j = 1; j < insertbds.length; j += 2) { |
| <img src="$imagesdir/cat.gif" alt="" border="0" /> |
| var op; |
| <b>$addtext</b></td> |
| if(navigator.appName=="Microsoft Internet Explorer") { |
| </tr><tr> |
| op = new Option(insertbds[j],insertbds[j-1]); |
| <td class="windowbg2" colspan="5" align="left"><br />$admin_txt{'57'}<br /><br /></td> |
| } else { |
| </tr> |
| op = new Option(insertbds[j],insertbds[j-1],null); |
| </table> |
| } |
| </div> |
| if(insertbds[j-1] == board) { |
| <br /> |
| op.style.backgroundColor = "#ffbbbb"; |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| } |
| <table border="0" align="center" cellspacing="1" cellpadding="4" width="100%"> |
| op.value = insertbds[j-1]; |
| |
| parentsel.add(op); |
| |
| } |
| |
| } |
| |
| // changes the parent board dropdown to whatever it should be, otherwise default is the first category's set of boards |
| |
| function selectParentBoard() { |
| |
| for (var i = 1; i <= editbrds.length - 1; i++) { |
| |
| var parentsel = document.getElementById("parent" + i); |
| |
| |
| |
| var bdinfo = editbrds[i].split("|"); |
| |
| var insertbds; |
| |
| |
| |
| if(bdinfo[0]) { |
| |
| insertbds = catboardlist[bdinfo[0]].split("|"); |
| |
| } else { |
| |
| insertbds = catboardlist[document.getElementById("cat" + i).value].split("|"); |
| |
| } |
| |
| |
| |
| clearSelect(parentsel); |
| |
| for (var j = 1; j < insertbds.length; j += 2) { |
| |
| var op = new Option(insertbds[j],insertbds[j-1]); |
| |
| if(insertbds[j-1] == bdinfo[1]) { |
| |
| op.style.backgroundColor = "#ffbbbb"; |
| |
| } |
| |
| if(insertbds[j-1] == bdinfo[2]) { |
| |
| op.selected = true; |
| |
| } |
| |
| op.value = insertbds[j-1]; |
| |
| if(navigator.appName=="Microsoft Internet Explorer") { |
| |
| parentsel.add(op); |
| |
| } else { |
| |
| parentsel.add(op,null); |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| // clear a select box |
| |
| function clearSelect(sel) { |
| |
| for (var i = sel.options.length - 1; i >= 0 ; i--) { |
| |
| sel.options[i] = null; |
| |
| } |
| |
| } |
| |
| // make sure we don't select a board and decide to move it to itself.... |
| |
| function checkParent(id, board) { |
| |
| var parent = document.getElementById("parent" + id).value; |
| |
| if(parent == board) { |
| |
| alert("$admin_txt{'735'}"); |
| |
| } |
| |
| } |
| |
| </script> |
| |
| <form name="boardsadd" id="boardsadd" action="$adminurl?action=addboard2" method="post" enctype="multipart/form-data" onsubmit="selectNames($FORM{'amount'});" accept-charset="$yymycharset"> |
| |
| <div class="bordercolor rightboxdiv"> |
| |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| |
| <tr> |
| |
| <td class="titlebg">$admin_img{'cat_img'} <b>$addtext</b></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"> |
| |
| <div class="pad-more">$admin_txt{'57'}</div> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div> |
| |
| <div class="bordercolor rightboxdiv"> |
| |
| <table class="border-space pad-cell" style="margin-bottom:.5em"> |
| |
| <colgroup> |
| |
| <col span="4" style="width:25%" /> |
| |
| </colgroup> |
| ~; |
| ~; |
| |
| |
| # Check if and which board are set for announcements or recycle bin |
| # Check if and which board are set for announcements or recycle bin |
| # Start Looping through and repeating the board adding wherever needed |
| # Start Looping through and repeating the board adding wherever needed |
| $istart = 0; |
| $istart = 0; |
| $annexist = ""; |
| $annexist = q{}; |
| $rbinexist = ""; |
| $rbinexist = q{}; |
| |
| |
| for ($i = 1; $i != $FORM{'amount'} + 1; $i++) { |
| for my $i ( 1 .. $FORM{'amount'} ) { |
| # differentiate between edit or add boards |
| |
| if ($editboards[$i] eq "" && $INFO{"action"} eq "boardscreen") { next; } |
| # differentiate between edit or add boards |
| if ($INFO{"action"} eq "boardscreen") { |
| if ( $editboards[$i] eq q{} && $INFO{'action'} eq 'boardscreen' ) { |
| $id = $editboards[$i]; |
| next; |
| } else { |
| } |
| $boardtext = "$admin_txt{'58'} $i:"; |
| if ( $INFO{'action'} eq 'boardscreen' ) { |
| } |
| $id = $editboards[$i]; |
| foreach $catid (@categoryorder) { |
| } |
| @bdlist = split(/,/, $cat{$catid}); |
| else { |
| ($curcatname, $catperms) = split(/\|/, $catinfo{"$catid"}); |
| $boardtext = "$admin_txt{'58'} $i:"; |
| my $boardcat = ${$uid.$editboards[$i]}{'cat'}; |
| } |
| if ($INFO{"action"} eq "boardscreen") { |
| |
| if ($catid eq $boardcat) { $selected = qq~selected="selected" ~; } |
| # print javascript hash of board names and their equivalent category |
| else { $selected = ""; } |
| if ( !$INFO{'parent'} ) { |
| } |
| $brd_javascript .= |
| &ToChars($curcatname); |
| qq~editbrds[$i] = "${$uid.$editboards[$i]}{'cat'}|$editboards[$i]|${$uid.$editboards[$i]}{'parent'}";\n~; |
| $catsel{$i} .= qq~<option value="$catid"$selected>$curcatname</option>~; |
| } |
| } |
| else { |
| if ($istart == 0) { $istart = $i; } |
| $brd_javascript .= |
| |
| qq~editbrds[$i] = "$INFO{'category'}||$INFO{'parent'}";\n~; |
| ($boardname, $boardperms, $boardview) = split(/\|/, $board{"$id"}); |
| } |
| &ToChars($boardname); |
| |
| if ($INFO{"action"} eq "boardscreen") { $boardtext = $boardname; } |
| my $boardcat = ${ $uid . $editboards[$i] }{'cat'}; |
| $boardpic = ${$uid.$editboards[$i]}{'pic'}; |
| for my $catid (@categoryorder) { |
| $description = ${$uid.$editboards[$i]}{'description'}; |
| @bdlist = split /,/xsm, $cat{$catid}; |
| $description =~ s~<br />~\n~g; |
| ( $curcatname, $catperms ) = split /\|/xsm, $catinfo{"$catid"}; |
| &ToChars($description); |
| if ( $INFO{'action'} eq 'boardscreen' || $INFO{'parent'} ) { |
| $moderators = ${$uid.$editboards[$i]}{'mods'}; |
| if ( $catid eq $boardcat || $catid eq $INFO{'category'} ) { |
| $moderatorgroups = ${$uid.$editboards[$i]}{'modgroups'}; |
| $selected = q~ selected="selected"~; |
| $boardminage = ${$uid.$editboards[$i]}{'minageperms'}; |
| } |
| $boardmaxage = ${$uid.$editboards[$i]}{'maxageperms'}; |
| else { $selected = q{}; } |
| $boardgender = ${$uid.$editboards[$i]}{'genderperms'}; |
| } |
| $genselect = qq~<select name="gender$i" id="gender$i">~; |
| ToChars($curcatname); |
| $gentag[0] = ""; |
| $catsel{$i} .= |
| $gentag[1] = "M"; |
| qq~<option value="$catid"$selected>$curcatname</option>~; |
| $gentag[2] = "F"; |
| } |
| $gentag[3] = "B"; |
| $catsel .= q~</select>~; |
| foreach $genlabel (@gentag) { |
| if ( $istart == 0 ) { $istart = $i; } |
| $gentext = "99"; |
| |
| $gentext .= $genlabel; |
| ( $boardname, $boardperms, $boardview ) = split /\|/xsm, $board{"$id"}; |
| if ($genlabel eq $boardgender) { |
| ToChars($boardname); |
| $genselect .= qq~<option value="$genlabel" selected="selected">$admin_txt{$gentext}</option>~; |
| if ( $INFO{'action'} eq 'boardscreen' ) { $boardtext = $boardname; } |
| } else { |
| $description = ${ $uid . $editboards[$i] }{'description'}; |
| $genselect .= qq~<option value="$genlabel">$admin_txt{$gentext}</option>~; |
| $description =~ s/<br \/>/\n/gsm; |
| } |
| ToChars($description); |
| } |
| $moderators = ${ $uid . $editboards[$i] }{'mods'}; |
| $genselect .= qq~</select>~; |
| $moderatorgroups = ${ $uid . $editboards[$i] }{'modgroups'}; |
| |
| $boardminage = ${ $uid . $editboards[$i] }{'minageperms'}; |
| # Retrieve Optional Details |
| $boardmaxage = ${ $uid . $editboards[$i] }{'maxageperms'}; |
| $ann = ""; |
| $boardgender = ${ $uid . $editboards[$i] }{'genderperms'}; |
| $rbin = ""; |
| $genselect = qq~<select name="gender$i" id="gender$i">~; |
| $zeroch = ""; |
| $gentag[0] = q{}; |
| $attch = ""; |
| $gentag[1] = 'M'; |
| $showpriv = ""; |
| $gentag[2] = 'F'; |
| $brdpic = ""; |
| $gentag[3] = 'B'; |
| if ($boardview == 1) { $showpriv = qq~ checked="checked"~; } |
| for my $genlabel (@gentag) { |
| if (${$uid.$id}{'zero'} == 1) { $zeroch = qq~ checked="checked"~; } |
| $gentext = '99'; |
| if (${$uid.$id}{'attperms'} == 1) { $attch = qq~ checked="checked"~; } |
| $gentext .= $genlabel; |
| |
| if ( $genlabel eq $boardgender ) { |
| if (${$uid.$id}{'ann'} == 1) { |
| $genselect .= |
| $annch = qq~ checked="checked"~; |
| qq~<option value="$genlabel" selected="selected">$admin_txt{$gentext}</option>~; |
| $brdpic = qq~ disabled="disabled"~; |
| } |
| } elsif ($annboard ne "") { |
| else { |
| $annch = qq~ disabled="disabled"~; |
| $genselect .= |
| $annexist = 1; |
| qq~<option value="$genlabel">$admin_txt{$gentext}</option>~; |
| } |
| } |
| if (${$uid.$id}{'rbin'} == 1) { |
| } |
| $rbinch = qq~ checked="checked"~; |
| $genselect .= q~</select>~; |
| $brdpic = qq~ disabled="disabled"~; |
| my $canpostch; |
| } elsif ($binboard ne "") { |
| if ( ${ $uid . $id }{'canpost'} == 1 |
| $rbinch = qq~ disabled="disabled"~; |
| || $INFO{'action'} ne 'boardscreen' ) |
| $rbinexist = 1; |
| { |
| } |
| $canpostch = q~ checked="checked"~; |
| |
| } |
| #Get Board permissions here |
| |
| my $startperms = &DrawPerms(${$uid.$id}{'topicperms'}, 0); |
| # Make children list if it contains sub boards |
| my $replyperms = &DrawPerms(${$uid.$id}{'replyperms'}, 1); |
| my $childrenlist; |
| my $viewperms = &DrawPerms($boardperms, 0); |
| if ( $subboard{$id} ) { |
| my $pollperms = &DrawPerms(${$uid.$id}{'pollperms'}, 0); |
| for my $childbd ( split /\|/xsm, $subboard{$id} ) { |
| |
| my ( $chldboardname, undef, undef ) = |
| $yymain .= qq~ |
| split /\|/xsm, $board{"$childbd"}; |
| <tr> |
| ToChars($chldboardname); |
| <td class="titlebg" width="100%" colspan="5" align="left"> <b>$boardtext</b></td> |
| $childrenlist .= qq~$chldboardname, ~; |
| </tr><tr> |
| } |
| <td class="catbg" colspan="4"><b>$admin_txt{'59'}:</b> $admin_txt{'60'}</td> |
| $childrenlist =~ s/, $//gsm; |
| </tr><tr>~; |
| } |
| if ($id ne '') { |
| |
| $yymain .= qq~ |
| if ( $childrenlist eq q{} ) { $childrenlist = $admin_txt{'246'}; } |
| <td class="windowbg" width="25%" align="left"><label for="id$i"><b>$admin_txt{'61'}</b></label></td> |
| |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="hidden" name="id$i" id="id$i" value="$id" />$id</td>~; |
| # Retrieve Optional Details |
| } else { |
| $ann = q{}; |
| $yymain .= qq~ |
| $rbin = q{}; |
| <td class="windowbg" width="25%" align="left"><label for="id$i"><b>$admin_txt{'61'}</b><br />$admin_txt{'61b'}</label></td> |
| $zeroch = q{}; |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="text" name="id$i" id="id$i" /></td>~; |
| $attch = q{}; |
| } |
| $showpriv = q{}; |
| $yymain .= qq~ |
| $brdpic = q{}; |
| </tr><tr> |
| $brdrssch = q{}; ### RSS on Board Index ### |
| <td class="windowbg" width="25%" align="left"><label for="name$i"><b>$admin_txt{'68'}:</b></label></td> |
| $brdpasswr = q{}; |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="text" name="name$i" id="name$i" value="$boardname" size="50" maxlength="100" /></td> |
| $brdpassw = ${$uid.$editboards[$i]}{'brdpassw'}; |
| </tr><tr> |
| $brdpassw3 = q{}; |
| <td class="windowbg" width="25%" align="left"><label for="description$i"><b>$admin_txt{'62'}:</b></label></td> |
| $brdpassw2 = q{}; |
| <td class="windowbg2" width="75%" colspan="3" align="left"><textarea name="description$i" id="description$i" rows="5" cols="30" style="width:98%; height:60px">$description</textarea></td> |
| if ($brdpassw ne q{}) { $brdpassw2 = qq~$boardpass_txt{'900pt'}~; } |
| </tr><tr> |
| if (${$uid.$editboards[$i]}{'brdpasswr'} == 1) { $brdpasswr = q~ checked="checked"~; } |
| <td class="windowbg" width="25%" align="left"> |
| if ( $boardview == 1 ) { $showpriv = q~ checked="checked"~; } |
| <b>$admin_txt{'63'}:</b><br /><span class="small"> |
| if ( ${ $uid . $id }{'zero'} == 1 ) { |
| <!-- <a href="javascript:void(0);" onclick="window.open('$scripturl?action=imlist;sort=username;toid=moderators$i','','status=no,height=345,width=464,menubar=no,toolbar=no,top=50,left=50,scrollbars=no')">$selector_txt{linklabel}</a><br/> --> |
| $zeroch = q~ checked="checked"~; |
| <a href="javascript:void(0);" onclick="window.open('$scripturl?action=qsearch;toid=moderators$i','','status=no,height=325px,width=300,menubar=no,toolbar=no,top=50,left=50,scrollbars=no')">$selector_txt{linklabel}</a><br /> |
| } |
| <a href="javascript:copyNames($i)">$admin_txt{'63a'}</a><br/> |
| |
| <a href="javascript:pasteNames($i,1)">$admin_txt{'63b'}</a><br/> |
| if ( ${ $uid . $id }{'attperms'} == 1 ) { |
| <a href="javascript:pasteNames(1,$FORM{'amount'})">$admin_txt{'63c'}</a></span> |
| $attch = q~ checked="checked"~; |
| </td> |
| } |
| <td class="windowbg2" width="75%" colspan="3" align="left"> |
| if ( ${ $uid . $id }{'brdrss'} == 1 ) { |
| <select name="moderators$i" id="moderators$i" multiple="multiple" size="3" style="width: 320px;" ondblclick="removeUser(this);">~; |
| $brdrssch = q~ checked="checked"~; |
| |
| } ### RSS on Board Index ### |
| my @thisBoardModerators = split(/, ?/, $moderators); |
| |
| foreach my $thisMod (@thisBoardModerators ) { |
| if ( ${ $uid . $id }{'ann'} == 1 ) { |
| &LoadUser($thisMod); |
| $annch = q~ checked="checked"~; |
| my $thisModname = ${$uid.$thisMod}{'realname'}; |
| $brdpic = q~ disabled="disabled"~; |
| if (!$thisModname) { $thisModname = $thisMod; } |
| } |
| if ($do_scramble_id) { $thisMod = &cloak($thisMod); } |
| elsif ( $annboard ne q{} ) { |
| $yymain .= qq~ |
| $annch = q~ disabled="disabled"~; |
| <option value="$thisMod">$thisModname</option>~; |
| $annexist = 1; |
| } |
| } |
| |
| if ( ${ $uid . $id }{'rbin'} == 1 ) { |
| $yymain .= qq~ |
| $rbinch = q~ checked="checked"~; |
| </select> |
| $brdpic = q~ disabled="disabled"~; |
| <br /><span class="small">$selector_txt{instructions}</span> |
| } |
| <!--<input type="text" name="moderators$i" value="$moderators" size="50" maxlength="100" />--> |
| elsif ( $binboard ne q{} ) { |
| </tr><tr> |
| $rbinch = q~ disabled="disabled"~; |
| <td class="windowbg" width="25%" align="left"><label for="moderatorgroups$i"><b>$admin_txt{'13'}:</b></label></td> |
| $rbinexist = 1; |
| <td class="windowbg2" width="75%" colspan="3"> |
| } |
| |
| $en_rules = q{}; |
| |
| if ( ${ $uid . $id }{'rules'} == 1 ) { |
| |
| $en_rules = q~ checked="checked"~; |
| |
| } |
| |
| $en_rulescoll = q{}; |
| |
| if ( ${ $uid . $id }{'rulescollapse'} == 1 ) { |
| |
| $en_rulescoll = q~ checked="checked"~; |
| |
| } |
| |
| $rulestitle = ${ $uid . $editboards[$i] }{'rulestitle'}; |
| |
| ToChars($rulestitle); |
| |
| $rulesdesc = ${ $uid . $editboards[$i] }{'rulesdesc'}; |
| |
| $rulesdesc =~ s/<br \/>/\n/gsm; |
| |
| ToChars($rulesdesc); |
| |
| |
| |
| #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~ <tr> |
| |
| <td class="titlebg" colspan="4"> <b>$boardtext</b></td> |
| |
| </tr><tr> |
| |
| <td class="catbg" colspan="4"><b>$admin_txt{'59'}:</b> $admin_txt{'60'}</td> |
| |
| </tr><tr>~; |
| |
| if ( $id ne q{} ) { |
| |
| $yymain .= qq~ |
| |
| <td class="windowbg2"><b>$admin_txt{'61'}</b></td> |
| |
| <td class="windowbg2" colspan="3"><input type="hidden" name="id$i" id="id$i" value="$id" />$id</td>~; |
| |
| } |
| |
| else { |
| |
| $yymain .= qq~ |
| |
| <td class="windowbg2"><label for="id$i"><b>$admin_txt{'61'}</b><br />$admin_txt{'61b'}</label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="text" name="id$i" id="id$i" /></td>~; |
| |
| } |
| |
| $yymain .= qq~ |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="name$i"><b>$admin_txt{'68'}:</b><br />$admin_txt{'68a'}</label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="text" name="name$i" id="name$i" value="$boardname" size="50" maxlength="100" /></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="description$i"><b>$admin_txt{'62'}:</b><br />$admin_txt{'62a'}</label></td> |
| |
| <td class="windowbg2" colspan="3"><textarea name="description$i" id="description$i" rows="5" cols="30" style="width:98%; height:60px">$description</textarea></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"> |
| |
| <b>$admin_txt{'63'}:</b><br /><span class="small"> |
| |
| <a href="javascript:void(0);" onclick="window.open('$scripturl?action=qsearch;toid=moderators$i','','status=no,height=350px,width=300,menubar=no,toolbar=no,top=50,left=50,scrollbars=no')">$selector_txt{linklabel}</a><br /> |
| |
| <a href="javascript:copyNames($i)">$admin_txt{'63a'}</a><br/> |
| |
| <a href="javascript:pasteNames($i,1)">$admin_txt{'63b'}</a><br/> |
| |
| <a href="javascript:pasteNames(1,$FORM{'amount'})">$admin_txt{'63c'}</a></span> |
| |
| </td> |
| |
| <td class="windowbg2" colspan="3"> |
| |
| <select name="moderators$i" id="moderators$i" multiple="multiple" size="3" style="width: 320px;" ondblclick="removeUser(this);">~; |
| |
| |
| |
| my @thisBoardModerators = split /, ?/sm, $moderators; |
| |
| for my $thisMod (@thisBoardModerators) { |
| |
| LoadUser($thisMod); |
| |
| my $thisModname = ${ $uid . $thisMod }{'realname'}; |
| |
| if ( !$thisModname ) { $thisModname = $thisMod; } |
| |
| if ($do_scramble_id) { $thisMod = cloak($thisMod); } |
| |
| $yymain .= qq~ |
| |
| <option value="$thisMod">$thisModname</option>~; |
| |
| } |
| |
| |
| |
| $yymain .= qq~ |
| |
| <option value="" disabled="disabled">--</option> |
| |
| </select> |
| |
| <br /><span class="small">$selector_txt{instructions}</span> |
| |
| </td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="moderatorgroups$i"><b>$admin_txt{'13'}:</b></label></td> |
| |
| <td class="windowbg2" colspan="3"> |
| ~; |
| ~; |
| |
| |
| # Allows admin to select entire membergroups to be a board moderator |
| # Allows admin to select entire membergroups to be a board moderator |
| $k = 0; |
| $k = 0; |
| my $box = ""; |
| my $box = q{}; |
| foreach (@nopostorder) { |
| for (@nopostorder) { |
| @groupinfo = split(/\|/, $NoPost{$_}); |
| @groupinfo = split /\|/xsm, $NoPost{$_}; |
| $box .= qq~<option value="$_"~; |
| $box .= qq~<option value="$_"~; |
| foreach (split(/, /, $moderatorgroups)) { |
| for ( split /, /sm, $moderatorgroups ) { |
| ($lineinfo, undef) = split(/\|/, $NoPost{$_}, 2); |
| ( $lineinfo, undef ) = split /\|/xsm, $NoPost{$_}, 2; |
| if ($lineinfo eq $groupinfo[0]) { |
| if ( $lineinfo eq $groupinfo[0] ) { |
| $box .= qq~ selected="selected" ~; |
| $box .= q~ selected="selected" ~; |
| } |
| } |
| } |
| } |
| $box .= qq~>$groupinfo[0]</option>~; |
| $box .= qq~>$groupinfo[0]</option>~; |
| $k++; |
| $k++; |
| } |
| } |
| if ($k > 5) { $k = 5; } |
| if ( $k > 5 ) { $k = 5; } |
| if ($k > 0) { |
| if ( $k > 0 ) { |
| $yymain .= qq~<select multiple="multiple" name="moderatorgroups$i" id="moderatorgroups$i" size="$k">$box</select> <label for="moderatorgroups$i"><span class="small">$admin_txt{'14'}</span></label>~; |
| $yymain .= |
| } else { |
| qq~ <select multiple="multiple" name="moderatorgroups$i" id="moderatorgroups$i" size="$k">$box</select> <label for="moderatorgroups$i"><span class="small">$admin_txt{'14'}</span></label>~; |
| $yymain .= qq~$admin_txt{'15'}~; |
| } |
| } |
| else { |
| |
| $yymain .= qq~$admin_txt{'15'}~; |
| $yymain .= qq~ |
| } |
| </td> |
| |
| </tr><tr> |
| my $drawndirs = q{}; |
| <td class="windowbg" width="25%" align="left"><label for="cat$i"><b>$admin_txt{'44'}:</b></label></td> |
| @tmplt = (); |
| <td class="windowbg2" width="75%" colspan="3" align="left"><select name="cat$i" id="cat$i">$catsel{$i}</select></td> |
| for my $curtemplate ( sort keys %templateset ){ |
| </tr><tr> |
| @templatelst = split /\|/xsm, $templateset{$curtemplate}; |
| <td class="catbg" colspan="4"><b>$admin_txt{'64'}</b> $admin_txt{'64a'} </td> |
| $drawndirs .= qq~<option value="$curtemplate">$curtemplate</option>\n~; |
| </tr><tr> |
| push @tmplt, $curtemplate; |
| <td class="windowbg" width="25%" align="left"><label for="pic$i"><b>$admin_txt{'64b'}:</b></label></td> |
| } |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="text" name="pic$i" id="pic$i" value="$boardpic" size="50" maxlength="255"$brdpic /></td> |
| |
| </tr><tr> |
| my $boardpic_value = q{}; |
| <td class="windowbg" width="25%" align="left"><label for="zero$i"><b>$admin_txt{'64c'}</b></label></td> |
| my $brdpic_addr = q{}; |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="checkbox" name="zero$i" id="zero$i" value="1"$zeroch /> <label for="zero$i">$admin_txt{'64d'}</label></td> |
| my $brdpic_loc = q{}; |
| </tr><tr> |
| my $mystyle = q{}; |
| <td class="windowbg" width="25%" align="left"><label for="show$i"><b>$admin_txt{'64e'}</b></label></td> |
| fopen( BRDPIC, "<$boardsdir/brdpics.db" ); |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="checkbox" name="show$i" id="show$i" value="1"$showpriv /> <label for="show$i">$admin_txt{'64f'}</label></td> |
| my @brdpics = <BRDPIC>; |
| </tr><tr> |
| fclose( BRDPIC); |
| <td class="windowbg" width="25%" align="left"><label for="att$i"><b>$admin_txt{'64k'}</b></label></td> |
| chomp @brdpics; |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="checkbox" name="att$i" id="att$i" value="1"$attch /> <label for="att$i">$admin_txt{'64l'}</label></td> |
| for (@brdpics) { |
| </tr><tr> |
| my ( $brdnm, $style, $brdpic ) = split /[|]/xsm, $_; |
| <td class="windowbg" width="25%" align="left"><label for="ann$i"><b>$admin_txt{'64g'}</b></label></td> |
| if ( $brdnm eq $editboards[$i] ) { |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="checkbox" id="ann$i" name="ann$i" value="1" $annch onclick="javascript: if (this.checked) checkann(true, '$i'); else checkann(false, '$i');" /> <label for="ann$i">$admin_txt{'64h'}</label></td> |
| for my $x ( 0 .. $#tmplt ) { |
| </tr><tr> |
| if ( $style eq $tmplt[$x] ) { |
| <td class="windowbg" width="25%" align="left"><label for="rbin$i"><b>$admin_txt{'64i'}</b></label></td> |
| $mystyle = $style; |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="checkbox" id="rbin$i" name="rbin$i" value="1" $rbinch onclick="javascript: if (this.checked) checkbin(true, '$i'); else checkbin(false, '$i');" /> <label for="rbin$i">$admin_txt{'64j'}</label></td> |
| if ( $brdpic =~ /\/\//ixsm ) { |
| </tr><tr> |
| $brdpic_addr = qq~$brdpic~; |
| <td class="catbg" colspan="4"><b>$admin_txt{'100'}:</b> $admin_txt{'100a'}</td> |
| } |
| </tr><tr> |
| else { |
| <td class="windowbg" width="25%" align="left"><label for="minage$i"><b>$admin_txt{'95'}:</b></label></td> |
| @mytempst = split /\|/xsm, $templateset{$style}; |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="text" size="3" name="minage$i" id="minage$i" value="$boardminage" /> <label for="minage$i">$admin_txt{'96'}</label></td> |
| $myimgfolder = $mytempst[1]; |
| </tr><tr> |
| $brdpic_addr = qq~$yyhtml_root/Templates/Forum/$myimgfolder/Boards/$brdpic~; |
| <td class="windowbg" width="25%" align="left"><label for="maxage$i"><b>$admin_txt{'95a'}:</b></label></td> |
| } |
| <td class="windowbg2" width="75%" colspan="3" align="left"><input type="text" size="3" name="maxage$i" id="maxage$i" value="$boardmaxage" /> <label for="maxage$i">$admin_txt{'96a'}</label></td> |
| $lbl = 'del_pic' . $i . '_' . $x; |
| </tr><tr> |
| $boardpic_value .= qq~ <div class="small bold"><input type="checkbox" name="$lbl" id="$lbl" value="$brdnm|$style|$brdpic" /><label for="$lbl">$admin_txt{'64b4'}</label><br />$admin_txt{'current_img'}: <a href="$brdpic_addr" target="_blank">$mystyle - $brdpic</a> <img src="$brdpic_addr" id="brd_img_resize" alt="board_pic" /> </div>~; |
| <td class="windowbg" width="25%" align="left"><label for="gender$i"><b>$admin_txt{'97'}:</b></label></td> |
| } |
| <td class="windowbg2" width="75%" colspan="3" align="left">$genselect <label for="gender$i">$admin_txt{'98'}</label></td> |
| } |
| </tr><tr> |
| } |
| <td class="catbg" colspan="4"><b>$admin_txt{'65'}:</b> $admin_txt{'65a'} <span class="small">$admin_txt{'14'}</span></td> |
| } |
| </tr><tr> |
| |
| <td class="titlebg" width="25%" align="center"><label for="topicperms$i"><b>$admin_txt{'65b'}:</b></label></td> |
| $yymain .= qq~ |
| <td class="titlebg" width="25%" align="center"><label for="replyperms$i"><b>$admin_txt{'65c'}:</b></label></td> |
| </td> |
| <td class="titlebg" width="25%" align="center"><label for="viewperms$i"><b>$admin_txt{'65d'}:</b></label></td> |
| </tr><tr> |
| <td class="titlebg" width="25%" align="center"><label for="pollperms$i"><b>$admin_txt{'65e'}:</b></label></td> |
| <td class="windowbg2"><label for="cat$i"><b>$admin_txt{'44'}:</b></label></td> |
| </tr><tr> |
| <td class="windowbg2" colspan="3"><select name="cat$i" id="cat$i" onchange="updateParent(this.value, '$editboards[$i]', $i)">$catsel{$i}</select></td> |
| <td class="windowbg2" width="25%" align="center"><select multiple="multiple" name="topicperms$i" id="topicperms$i" size="8">$startperms</select></td> |
| </tr><tr> |
| <td class="windowbg2" width="25%" align="center"><select multiple="multiple" name="replyperms$i" id="replyperms$i" size="8">$replyperms</select></td> |
| <td class="windowbg2"><label for="parent$i"><b>$admin_txt{'249'}:</b></label></td> |
| <td class="windowbg2" width="25%" align="center"><select multiple="multiple" name="viewperms$i" id="viewperms$i" size="8">$viewperms</select></td> |
| <td class="windowbg2" colspan="3"> |
| <td class="windowbg2" width="25%" align="center"><select multiple="multiple" name="pollperms$i" id="pollperms$i" size="8">$pollperms</select></td> |
| <select onchange="checkParent($i, '$editboards[$i]')" name="parent$i" id="parent$i"> |
| </tr> |
| <option value="">--</option> |
| </table> |
| </select> |
| </div> |
| </td> |
| <br /><br /> |
| </tr><tr> |
| <div class="bordercolor" style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> |
| <td class="windowbg2"><b>$admin_txt{'248'}:</b></td> |
| <table border="0" align="center" cellspacing="1" cellpadding="4" width="100%"> |
| <td class="windowbg2" colspan="3">$childrenlist</td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="canpost$i"><b>$admin_txt{'247'}</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" name="canpost$i" id="canpost$i" value="1"$canpostch /> <label for="canpost$i">$admin_txt{'247a'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="catbg" colspan="4"><b>$admin_txt{'64'}</b> $admin_txt{'64a'} </td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="pic$i"><b>$admin_txt{'64b'}:</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><span class="small">$admin_txt{'64b3'}</span> |
| |
| <br />$admin_txt{'for_template'}: <select id="templt$i" name="templt$i"> |
| |
| $drawndirs |
| |
| </select> |
| |
| <br /><input type="file" name="pic$i" id="pic$i" size="35" /><input type="hidden" name="cur_pic$i" value="$brdpic_addr" /> |
| |
| <br /><span class="small">$admin_txt{'64b6'}</span> |
| |
| <br /><input type="text" name="mypic$i" id="mypic$i" value="$myboardpic" size="50" maxlength="255"$brdpic /><span class="cursor small bold" title="$admin_txt{'remove_file'}" onclick="document.getElementById('pic$i').value='';">X</span>$boardpic_value |
| |
| </td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="brdrss$i"><b>$admin_txt{'brdrss1'}:</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" name="brdrss$i" id="brdrss$i" value="1"$brdrssch /> <label for="brdrss$i"><span class="small">$admin_txt{'brdrss3'}</span></label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="zero$i"><b>$admin_txt{'64c'}</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" name="zero$i" id="zero$i" value="1"$zeroch /> <label for="zero$i">$admin_txt{'64d'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="show$i"><b>$admin_txt{'64e'}</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" name="show$i" id="show$i" value="1"$showpriv /> <label for="show$i">$admin_txt{'64f'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="att$i"><b>$admin_txt{'64k'}</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" name="att$i" id="att$i" value="1"$attch /> <label for="att$i">$admin_txt{'64l'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="ann$i"><b>$admin_txt{'64g'}</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" id="ann$i" name="ann$i" value="1" $annch onclick="javascript: if (this.checked) checkann(true, '$i'); else checkann(false, '$i');" /> <label for="ann$i">$admin_txt{'64h'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="rbin$i"><b>$admin_txt{'64i'}</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" id="rbin$i" name="rbin$i" value="1" $rbinch onclick="javascript: if (this.checked) checkbin(true, '$i'); else checkbin(false, '$i');" /> <label for="rbin$i">$admin_txt{'64j'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="catbg" colspan="4"><b>$admin_txt{'rules'}:</b></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="rules$i"><b>$admin_txt{'rules1'}:</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" name="rules$i" id="rules$i" value="1"$en_rules /></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="rulescollapse$i"><b>$exptxt{'6'}</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="checkbox" name="rulescollapse$i" id="rulescollapse$i" value="1"$en_rulescoll /></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="rulestitle$i"><b>$admin_txt{'rules2'}:</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="text" name="rulestitle$i" id="rulestitle$i" value="$rulestitle" size="50" maxlength="100" /></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="rulesdesc$i"><b>$admin_txt{'rules3'}:</b><br /><span class="small">$admin_txt{'rules4'}</span></label></td> |
| |
| <td class="windowbg2" colspan="3"><textarea name="rulesdesc$i" id="rulesdesc$i" rows="5" cols="30" style="width:98%; height:60px">$rulesdesc</textarea></td> |
| |
| </tr><tr> |
| |
| <td class="catbg" colspan="4"><b>$admin_txt{'100'}:</b> $admin_txt{'100a'}</td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="minage$i"><b>$admin_txt{'95'}:</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="text" size="3" name="minage$i" id="minage$i" value="$boardminage" /> <label for="minage$i">$admin_txt{'96'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="maxage$i"><b>$admin_txt{'95a'}:</b></label></td> |
| |
| <td class="windowbg2" colspan="3"><input type="text" size="3" name="maxage$i" id="maxage$i" value="$boardmaxage" /> <label for="maxage$i">$admin_txt{'96a'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="gender$i"><b>$admin_txt{'97'}:</b></label></td> |
| |
| <td class="windowbg2" colspan="3">$genselect <label for="gender$i">$admin_txt{'98'}</label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2"><label for="pasww$i"><b>$boardpass_txt{'900pw'}:</b><br /><br />$boardpass_txt{'900pwb'}</label></td> |
| |
| <td class="windowbg2" colspan="3"> |
| |
| <input type="checkbox" name="paswwr$i" id="paswwr$i" value="1"$brdpasswr /> <input type="text" size="15" name="pasww$i" id="pasww$i" value="$brdfpassw3" /> |
| |
| <br /><label for="paswwr$i">$boardpass_txt{'900pf'}</label> |
| |
| <br /><span class="important">$brdpassw2</span> |
| |
| <input type="hidden" name="brdpassw$i" value="$brdpassw" /> |
| |
| </td> |
| |
| </tr><tr> |
| |
| <td class="catbg" colspan="4"><b>$admin_txt{'65'}:</b> $admin_txt{'65a'} <span class="small">$admin_txt{'14'}</span></td> |
| |
| </tr><tr> |
| |
| <td class="titlebg center"><label for="topicperms$i"><b>$admin_txt{'65b'}:</b></label></td> |
| |
| <td class="titlebg center"><label for="replyperms$i"><b>$admin_txt{'65c'}:</b></label></td> |
| |
| <td class="titlebg center"><label for="viewperms$i"><b>$admin_txt{'65d'}:</b></label></td> |
| |
| <td class="titlebg center"><label for="pollperms$i"><b>$admin_txt{'65e'}:</b></label></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg2 center"> |
| |
| <select multiple="multiple" name="topicperms$i" id="topicperms$i" size="8">\n$startperms |
| |
| </select> |
| |
| </td> |
| |
| <td class="windowbg2 center"> |
| |
| <select multiple="multiple" name="replyperms$i" id="replyperms$i" size="8">\n$replyperms |
| |
| </select> |
| |
| </td> |
| |
| <td class="windowbg2 center"> |
| |
| <select multiple="multiple" name="viewperms$i" id="viewperms$i" size="8">\n$viewperms |
| |
| </select> |
| |
| </td> |
| |
| <td class="windowbg2 center"> |
| |
| <select multiple="multiple" name="pollperms$i" id="pollperms$i" size="8">\n$pollperms |
| |
| </select> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </div> |
| |
| <div class="bordercolor rightboxdiv"> |
| |
| <table class="border-space pad-cell" style="margin-bottom: .5em;"> |
| ~; |
| ~; |
| } |
| } |
| $yymain .= qq~ |
| $yymain .= qq~ <tr> |
| <tr> |
| <th class="titlebg">$admin_img{'prefimg'} $admin_txt{'10'}</th> |
| <td class="catbg" width="100%" colspan="5" align="center"> <input type="hidden" name="amount" value=\"$FORM{"amount"}\" /> |
| </tr><tr> |
| <input type="hidden" name="screenornot" value="$INFO{'action'}" /> |
| <td class="catbg center"> |
| <input type="submit" value="$admin_txt{'10'}" class="button" /></td> |
| <input type="hidden" name="amount" value="$FORM{'amount'}" /> |
| </tr> |
| <input type="hidden" name="screenornot" value="$INFO{'action'}" /> |
| </table> |
| <input type="submit" value="$admin_txt{'10'}" class="button" /> |
| </div> |
| </td> |
| </form> |
| </tr> |
| |
| </table> |
| <script language="JavaScript1.2" type="text/javascript"> |
| </div> |
| <!-- |
| </form> |
| |
| <script type="text/javascript"> |
| var numboards = "$FORM{'amount'}"; |
| var numboards = "$FORM{'amount'}"; |
| var annexist = "$annexist"; |
| var annexist = "$annexist"; |
| var rbinexist = "$rbinexist"; |
| var rbinexist = "$rbinexist"; |
| var istart = "$istart"; |
| var istart = "$istart"; |
| |
| var editbrds = new Array(); |
| |
| $brd_javascript |
| |
| |
| function checkann(acheck, awho) { |
| function checkann(acheck, awho) { |
| var adischeck = acheck; |
| var adischeck = acheck; |
| var adisuncheck = acheck; |
| var adisuncheck = acheck; |
| for (var i = istart; i <= numboards; i++) { |
| for (var i = istart; i <= numboards; i++) { |
| if(i != awho) { |
| if(i != awho) { |
| if(document.getElementById('rbin'+i).checked == true) { |
| if(document.getElementById('rbin'+i).checked === true) { |
| adischeck = true; |
| adischeck = true; |
| document.getElementById('ann'+i).disabled = true; |
| document.getElementById('ann'+i).disabled = true; |
| } |
| } |
| else { |
| else { |
| document.getElementById('ann'+i).disabled = acheck; |
| document.getElementById('ann'+i).disabled = acheck; |
| } |
| } |
| } |
| } |
| } |
| } |
| if(document.getElementById('ann'+awho).checked == true) { |
| if(document.getElementById('ann'+awho).checked === true) { |
| adischeck = true; |
| adischeck = true; |
| document.forms["boardsadd"].elements['topicperms'+awho].selectedIndex = -1; |
| document.forms["boardsadd"].elements['topicperms'+awho].selectedIndex = -1; |
| document.forms["boardsadd"].elements['topicperms'+awho].options[0].selected = true; |
| document.forms["boardsadd"].elements['topicperms'+awho].options[0].selected = true; |
| document.forms["boardsadd"].elements['replyperms'+awho].selectedIndex = -1; |
| document.forms["boardsadd"].elements['replyperms'+awho].selectedIndex = -1; |
| document.forms["boardsadd"].elements['replyperms'+awho].options[0].selected = true; |
| document.forms["boardsadd"].elements['replyperms'+awho].options[0].selected = true; |
| document.forms["boardsadd"].elements['pollperms'+awho].selectedIndex = -1; |
| document.forms["boardsadd"].elements['pollperms'+awho].selectedIndex = -1; |
| document.forms["boardsadd"].elements['pollperms'+awho].options[0].selected = true; |
| document.forms["boardsadd"].elements['pollperms'+awho].options[0].selected = true; |
| } |
| } |
| document.getElementById('rbin'+awho).disabled = adischeck; |
| document.getElementById('rbin'+awho).disabled = adischeck; |
| document.getElementById('pic'+awho).disabled = adisuncheck; |
| document.getElementById('pic'+awho).disabled = adisuncheck; |
| if(rbinexist == '1') document.getElementById('rbin'+awho).disabled = true; |
| if(rbinexist == '1') document.getElementById('rbin'+awho).disabled = true; |
| } |
| } |
| |
| |
| function checkbin(bcheck, bwho) { |
| function checkbin(bcheck, bwho) { |
| var bdischeck = bcheck; |
| var bdischeck = bcheck; |
| var bdisuncheck = bcheck; |
| var bdisuncheck = bcheck; |
| for (var i = istart; i <= numboards; i++) { |
| for (var i = istart; i <= numboards; i++) { |
| if(i != bwho) { |
| if(i != bwho) { |
| if(document.getElementById('ann'+i).checked == true) { |
| if(document.getElementById('ann'+i).checked === true) { |
| bdischeck = true; |
| bdischeck = true; |
| document.getElementById('rbin'+i).disabled = true; |
| document.getElementById('rbin'+i).disabled = true; |
| } |
| } |
| else document.getElementById('rbin'+i).disabled = bcheck; |
| else document.getElementById('rbin'+i).disabled = bcheck; |
| } |
| } |
| } |
| } |
| if(document.getElementById('rbin'+bwho).checked == true) bdischeck = true; |
| if(document.getElementById('rbin'+bwho).checked === true) bdischeck = true; |
| document.getElementById('ann'+bwho).disabled = bdischeck; |
| document.getElementById('ann'+bwho).disabled = bdischeck; |
| document.getElementById('pic'+bwho).disabled = bdisuncheck; |
| document.getElementById('pic'+bwho).disabled = bdisuncheck; |
| if(annexist == '1') document.getElementById('ann'+bwho).disabled = true; |
| if(annexist == '1') document.getElementById('ann'+bwho).disabled = true; |
| } |
| } |
| |
| |
| |
| selectParentBoard(); |
| //--> |
| </script> |
| </script> |
| ~; |
| |
| $yytitle = "$admin_txt{'50'}"; |
| ~; |
| if ( $INFO{'action'} eq 'boardscreen' ) { |
| $yytitle = "$admin_txt{'50'}"; |
| $yytitle = "$admin_txt{'50a'}"; |
| $action_area = "manageboards"; |
| } |
| &AdminTemplate; |
| $action_area = 'manageboards'; |
| |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub DrawPerms { |
| sub DrawPerms { |
| my ($permissions,$permstype) = @_; |
| my ( $permissions, $permstype ) = @_; |
| my ($foundit, %found, $groupsel, $groupsel2, $name); |
| my ( $foundit, %found, $groupsel, $groupsel2, $name ); |
| my $count = 0; |
| my $count = 0; |
| if ($permissions eq "") { $permissions = "xk8yj56ndkal"; } |
| if ( $permissions eq q{} ) { $permissions = 'xk8yj56ndkal'; } |
| my @perms = split(/, /, $permissions); |
| my @perms = split /, /sm, $permissions; |
| foreach $perm (@perms) { |
| for my $perm (@perms) { |
| $foundit = 0; |
| $foundit = 0; |
| if ($permstype == 1) { |
| if ( $permstype == 1 ) { |
| $name = $admin_txt{'65f'}; |
| $name = $admin_txt{'65f'}; |
| if ($perm eq "Topic Starter") { |
| if ( $perm eq 'Topic Starter' ) { |
| $foundit = 1; |
| $foundit = 1; |
| $found{$name} = 1; |
| $found{$name} = 1; |
| $groupsel .= qq~<option value="Topic Starter" selected="selected">$name</option>\n~; |
| $groupsel .= |
| } |
| qq~ <option value="Topic Starter" selected="selected">$name</option>\n~; |
| if ($count == $#perms && $found{$name} != 1) { $groupsel2 .= qq~<option value="Topic Starter">$name</option>\n~; } |
| } |
| } |
| if ( $count == $#perms && $found{$name} != 1 ) { |
| |
| $groupsel2 .= |
| ($name, undef) = split(/\|/, $Group{"Administrator"}, 2); |
| qq~ <option value="Topic Starter">$name</option>\n~; |
| if ($perm eq "Administrator") { |
| } |
| $foundit = 1; |
| } |
| $found{$name} = 1; |
| |
| $groupsel .= qq~<option value="Administrator" selected="selected">$name</option>\n~; |
| ( $name, undef ) = split /\|/xsm, $Group{'Administrator'}, 2; |
| } |
| if ( $perm eq 'Administrator' ) { |
| if ($count == $#perms && $found{$name} != 1) { $groupsel2 .= qq~<option value="Administrator">$name</option>\n~; } |
| $foundit = 1; |
| |
| $found{$name} = 1; |
| ($name, undef) = split(/\|/, $Group{"Global Moderator"}, 2); |
| $groupsel .= |
| if ($perm eq "Global Moderator") { |
| qq~ <option value="Administrator" selected="selected">$name</option>\n~; |
| $foundit = 1; |
| } |
| $found{$name} = 1; |
| if ( $count == $#perms && $found{$name} != 1 ) { |
| $groupsel .= qq~<option value="Global Moderator" selected="selected">$name</option>\n~; |
| $groupsel2 .= qq~ <option value="Administrator">$name</option>\n~; |
| } |
| } |
| if ($count == $#perms && $found{$name} != 1) { $groupsel2 .= qq~<option value="Global Moderator">$name</option>\n~; } |
| |
| |
| ( $name, undef ) = split /\|/xsm, $Group{'Global Moderator'}, 2; |
| if ($foundit != 1 || $count == $#perms) { |
| if ( $perm eq 'Global Moderator' ) { |
| foreach (@nopostorder) { |
| $foundit = 1; |
| ($name, undef) = split(/\|/, $NoPost{$_}, 2); |
| $found{$name} = 1; |
| if ($perm eq $_) { |
| $groupsel .= |
| $foundit = 1; |
| qq~ <option value="Global Moderator" selected="selected">$name</option>\n~; |
| $found{$_} = 1; |
| } |
| $groupsel .= qq~<option value="$_" selected="selected">$name</option>\n~; |
| if ( $count == $#perms && $found{$name} != 1 ) { |
| } |
| $groupsel2 .= qq~ <option value="Global Moderator">$name</option>\n~; |
| if ($found{$_} != 1 && $count == $#perms) { $groupsel2 .= qq~<option value="$_">$name</option>\n~; } |
| } |
| } |
| |
| if ($foundit != 1 || $count == $#perms) { |
| ( $name, undef ) = split /\|/xsm, $Group{'Mid Moderator'}, 2; |
| foreach (sort { $b <=> $a } keys %Post) { |
| if ( $perm eq 'Mid Moderator' ) { |
| ($name, undef) = split(/\|/, $Post{$_}, 2); |
| $foundit = 1; |
| if ($perm eq $name) { |
| $found{$name} = 1; |
| $foundit = 1; |
| $groupsel .= |
| $found{$name} = 1; |
| qq~ <option value="Mid Moderator" selected="selected">$name</option>\n~; |
| $groupsel .= qq~<option value="$name" selected="selected">$name</option>\n~; |
| } |
| } |
| if ( $count == $#perms && $found{$name} != 1 ) { |
| if ($count == $#perms && ($found{$name} != 1 || $found{$name} eq "")) { $groupsel2 .= qq~<option value="$name">$name</option>\n~; } |
| $groupsel2 .= qq~ <option value="Mid Moderator">$name</option>\n~; |
| } |
| } |
| } |
| if ( $foundit != 1 || $count == $#perms ) { |
| } |
| for (@nopostorder) { |
| $count++; |
| ( $name, undef ) = split /\|/xsm, $NoPost{$_}, 2; |
| } |
| if ( $perm eq $_ ) { |
| $groupsel . $groupsel2; |
| $foundit = 1; |
| |
| $found{$_} = 1; |
| |
| $groupsel .= |
| |
| qq~ <option value="$_" selected="selected">$name</option>\n~; |
| |
| } |
| |
| if ( $found{$_} != 1 && $count == $#perms ) { |
| |
| $groupsel2 .= qq~ <option value="$_">$name</option>\n~; |
| |
| } |
| |
| } |
| |
| if ( $foundit != 1 || $count == $#perms ) { |
| |
| for ( reverse sort { $a <=> $b } keys %Post ) { |
| |
| ( $name, undef ) = split /\|/xsm, $Post{$_}, 2; |
| |
| if ( $perm eq $name ) { |
| |
| $foundit = 1; |
| |
| $found{$name} = 1; |
| |
| $groupsel .= |
| |
| qq~ <option value="$name" selected="selected">$name</option>\n~; |
| |
| } |
| |
| if ( $count == $#perms |
| |
| && ( $found{$name} != 1 || $found{$name} eq q{} ) ) |
| |
| { |
| |
| $groupsel2 .= |
| |
| qq~ <option value="$name">$name</option>\n~; |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| $count++; |
| |
| } |
| |
| return $groupsel . $groupsel2; |
| } |
| } |
| |
| |
| sub AddBoards2 { |
| sub AddBoards2 { |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| unless ($mloaded == 1) { require "$boardsdir/forum.master"; } |
| get_forum_master(); |
| $anncount = 0; |
| $anncount = 0; |
| $rbincount = 0; |
| $rbincount = 0; |
| my (@boardcontrol,@changes); |
| my ( @boardcontrol, @changes, @updatecats ); |
| for (my $i = 1; $i != $FORM{'amount'} + 1; $i++) { |
| LoadBoardControl(); |
| if ($FORM{"pic$i"} ne '' && $FORM{"pic$i"} !~ m~^[0-9a-zA-Z_\.\#\%\-\:\+\?\$\&\~\.\,\@/]+\.(gif|png|bmp|jpg)$~) { &admin_fatal_error("invalid_picture"); } |
| |
| ##### Dealing with Required Info here ##### |
| for my $i ( 1 .. $FORM{'amount'} ) { |
| if ($FORM{"id$i"} eq '') { next; } |
| ##### Dealing with Required Info here ##### |
| $id = $FORM{"id$i"}; |
| if ( $FORM{"id$i"} eq q{} ) { next; } |
| if ($FORM{"ann$i"}) { $anncount++; } |
| $id = $FORM{"id$i"}; |
| if ($FORM{"rbin$i"}) { $rbincount++; } |
| if ( $FORM{"ann$i"} ) { $anncount++; } |
| &admin_fatal_error('announcement_defined') if ($anncount > 1); |
| if ( $FORM{"rbin$i"} ) { $rbincount++; } |
| &admin_fatal_error('recycle_bin_defined') if ($rbincount > 1); |
| if ( $anncount > 1 ) { fatal_error('announcement_defined'); } |
| &admin_fatal_error('invalid_character',"$admin_txt{'61'} $admin_txt{'241'}") if ($id !~ /\A[0-9A-Za-z#%+-\.@^_]+\Z/); |
| if ( $rbincount > 1 ) { fatal_error('recycle_bin_defined'); } |
| |
| if ( $id !~ /\A[0-9A-Za-z#%+-\.@^_]+\Z/xsm ) { |
| if ($FORM{'screenornot'} ne "boardscreen") { |
| fatal_error( 'invalid_character', |
| # adding a board |
| "$admin_txt{'61'} $admin_txt{'241'}" ); |
| # make sure no board already exists with that id |
| } |
| &admin_fatal_error("board_defined","$id") if (exists $board{"$id"}); |
| my $newpic = q{}; |
| |
| if ( $FORM{"pic$i"} ne q{} ) { |
| my @bdlist = split(/\,/, $cat{$FORM{"cat$i"}}); |
| $newpic = $FORM{"pic$i"}; |
| push(@bdlist, "$id"); |
| @mytempst = split /\|/xsm, $templateset{$FORM{"templt$i"}}; |
| $cat{$FORM{"cat$i"}} = join(',', @bdlist); |
| $myimgfolder = $mytempst[1]; |
| fopen(BOARDINFO, ">$boardsdir/$id.txt"); |
| $FORM{"pic$i"} = UploadFile("pic$i", qq~Templates/Forum/$myimgfolder/Boards~, 'png jpg jpeg gif', '250', '0'); |
| print BOARDINFO ''; |
| fopen( BRDPIC, ">>$boardsdir/brdpics.db" ); |
| fclose(BOARDINFO); |
| print {BRDPIC} qq~$id|$FORM{"templt$i"}|$newpic\n~; |
| } |
| fclose(BRDPIC); |
| if ($FORM{'screenornot'} eq "boardscreen") { |
| |
| # editing a board |
| if ( $FORM{"cur_pic$i"} ne q{} ) { |
| my $category = ${$uid.$id}{'cat'}; |
| unlink qq~$htmldir/Templates/Forum/$myimgfolder/Boards/$FORM{"cur_pic$i"}~; |
| |
| } |
| # move category of board |
| } |
| if ($category ne $FORM{"cat$i"}) { |
| elsif ( $FORM{"mypic$i"} ne q{} ) { |
| ${$uid.$id}{'cat'} = qq~$FORM{"cat$i"}~; |
| $newpic = $FORM{"mypic$i"}; |
| my @bdlist = split(/,/, $cat{$category}); |
| if ( $newpic !~ m{^[0-9a-zA-Z_\.\#\%\-\:\+\?\$\&\~\.\,\@/]+\.(gif|png|bmp|jpg)$}xsm ) |
| |
| { |
| # Remove Board from old Category |
| fatal_error('invalid_picture'); |
| my $k = 0; |
| } |
| foreach $bd (@bdlist) { |
| else { |
| if ($id eq $bd) { splice(@bdlist, $k, 1); } |
| fopen( BRDPIC, ">>$boardsdir/brdpics.db" ); |
| $k++; |
| print {BRDPIC} qq~$id|$FORM{"templt$i"}|$newpic\n~; |
| } |
| fclose(BRDPIC); |
| $cat{"$category"} = join(',', @bdlist); |
| $FORM{"pic$i"} = $FORM{"mypic$i"}; |
| |
| } |
| # Add Category to new Category |
| } |
| my $ncat = $FORM{"cat$i"}; |
| else { |
| if ($cat{$ncat} ne "") { $cat{$ncat} .= ",$id"; } |
| $FORM{"pic$i"} = $FORM{"cur_pic$i"}; |
| else { $cat{$ncat} = $id; } |
| } |
| } |
| |
| |
| $templx = scalar keys %templateset; |
| if (-e "$boardsdir/$id.txt") { # fix a(nnboard) in the boardid.txt |
| for my $x ( 0 .. $templx ) { |
| fopen(BOARDINFO, "$boardsdir/$id.txt") || &fatal_error('cannot_open', "$openboard/$id.txt", 1); |
| $lbl = 'del_pic' . $i . '_' . $x; |
| my @boardtomodify = <BOARDINFO>; |
| if ( $FORM{"$lbl"} ) { |
| fclose(BOARDINFO); |
| my @pklst = split /[|]/xsm, $FORM{"$lbl"}; |
| my $x; |
| if ( $pklst[2] !~ /[ht|f]tp[s]{0,1}:\/\//xsm ) { |
| if ($FORM{"ann$i"} && (split /\|/, $boardtomodify[0])[8] !~ /a/i) { |
| unlink qq~$htmldir/Templates/Forum/$pklst[1]/Boards/$pklst[2]~; |
| for ($x = 0; $x < @boardtomodify; $x++) { |
| } |
| $boardtomodify[$x] =~ s/(.*\|)(0?)(.*)/ $1 . ($2 eq '0' ? "0a$3" : "a$3") /e; |
| fopen( BRDPIC, "<$boardsdir/brdpics.db" ); |
| } |
| @piclist = <BRDPIC>; |
| } elsif (!$FORM{"ann$i"} && (split /\|/, $boardtomodify[0])[8] =~ /a/i) { |
| fclose(BRDPIC); |
| for ($x = 0; $x < @boardtomodify; $x++) { |
| chomp @piclist; |
| $boardtomodify[$x] =~ s/(.*\|)(.*)/ $1 . &take_a_off($2) /e; |
| fopen( BRDPIC2, ">$boardsdir/brdpics.db" ); |
| } |
| for ( @piclist) { |
| sub take_a_off { my $y = shift; $y =~ s/a//g; $y; } |
| if ( $_ ne $FORM{"$lbl"} ) { |
| } |
| print {BRDPIC2} qq~$_\n~; |
| if ($x) { |
| } |
| fopen(BOARDINFO, ">$boardsdir/$id.txt") || &fatal_error('cannot_open', "$openboard/$id.txt", 1); |
| else { print {BRDPIC2} q{}; |
| print BOARDINFO @boardtomodify; |
| } |
| fclose(BOARDINFO); |
| } |
| } |
| fclose(BRDPIC2); |
| } |
| } |
| } |
| $FORM{"pic$i"} = q{}; |
| |
| } |
| $bname = $FORM{"name$i"}; |
| |
| &FromChars($bname); |
| if ( $FORM{'screenornot'} ne 'boardscreen' ) { |
| &ToHTML($bname); |
| |
| |
| # adding a board |
| # If someone has the bright idea of starting a membergroup with a $ |
| # make sure no board already exists with that id |
| # We need to escape it for them, to prevent us interpreting it as a var... |
| if ( exists $board{"$id"} ) { |
| $FORM{"viewperms$i"} =~ s~\$~\\\$~g; |
| fatal_error( 'board_defined', "$id" ); |
| |
| } |
| $board{"$id"} = "$bname|$FORM{\"viewperms$i\"}|$FORM{\"show$i\"}"; |
| |
| $bdescription = $FORM{"description$i"}; |
| # add to category if it's not a sub board, otherwise add it to subboard list for its parent |
| &FromChars($bdescription); |
| if ( !$FORM{"parent$i"} ) { |
| $bdescription =~ s/\r//g; |
| my @bdlist = split /\,/xsm, $cat{ $FORM{"cat$i"} }; |
| $bdescription =~ s~\n~<br \/>~g; |
| push @bdlist, "$id"; |
| if ($do_scramble_id) { |
| $cat{ $FORM{"cat$i"} } = join q{,}, @bdlist; |
| my @mods; |
| } |
| foreach (split(', ', $FORM{"moderators$i"})) { |
| else { |
| push(@mods, &decloak($_)); |
| if ( $subboard{ $FORM{"parent$i"} } ne q{} ) { |
| } |
| $subboard{ $FORM{"parent$i"} } .= qq~|$id~; |
| $FORM{"moderators$i"} = join(', ', @mods); |
| } |
| } |
| else { |
| if ($FORM{"zero$i"} eq '') { $FORM{"zero$i"} = 0; } |
| $subboard{ $FORM{"parent$i"} } = $id; |
| $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"} = ""; } |
| fopen( BOARDINFO, ">$boardsdir/$id.txt" ); |
| if ($FORM{"maxage$i"} < 0) { $FORM{"maxage$i"} = ""; } |
| print {BOARDINFO} q{} or croak "$croak{'print'}' BOARDINFO"; |
| if ($FORM{"minage$i"} > 180) { $FORM{"minage$i"} = ""; } |
| fclose(BOARDINFO); |
| if ($FORM{"maxage$i"} > 180) { $FORM{"maxage$i"} = ""; } |
| } |
| if ($FORM{"maxage$i"} && $FORM{"maxage$i"} < $FORM{"minage$i"}) { $FORM{"maxage$i"} = $FORM{"minage$i"}; } |
| if ( $FORM{'screenornot'} eq 'boardscreen' ) { |
| |
| |
| 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\"}\n"); |
| # editing a board |
| push(@changes, $id); |
| my $category = ${ $uid . $id }{'cat'}; |
| $yymain .= qq~<i>'$FORM{"name$i"}'</i> $admin_txt{'48'} <br />~; |
| |
| } |
| # move category of board |
| |
| if ( $category ne $FORM{"cat$i"} ) { |
| # do the saving here, after all new boards passed the tests (admin_fatal_error) |
| ${ $uid . $id }{'cat'} = qq~$FORM{"cat$i"}~; |
| &BoardTotals("add", @changes); |
| |
| |
| # recursively change the category of child boards. |
| &Write_ForumMaster; |
| if ( $subboard{$id} ) { |
| fopen(FORUMCONTROL, "+<$boardsdir/forum.control"); |
| |
| seek FORUMCONTROL, 0, 0; |
| *cat_change = sub { |
| my @oldcontrols = <FORUMCONTROL>; |
| my @x = @_; |
| my $oldboard; |
| for my $childbd (@x) { |
| for (my $cnt = 0; $cnt < @oldcontrols; $cnt++) { |
| ${ $uid . $childbd }{'cat'} = qq~$FORM{"cat$i"}~; |
| (undef, $oldboard, undef) = split(/\|/, $oldcontrols[$cnt], 3); |
| push @updatecats, $childbd; |
| foreach my $changedboard (@changes) { |
| if ( $subboard{$childbd} ) { |
| if ($changedboard eq $oldboard) { $oldcontrols[$cnt] = ""; } |
| cat_change( split /\|/xsm, |
| } |
| $subboard{$childbd} ); |
| } |
| } |
| push(@oldcontrols, @boardcontrol); |
| } |
| @boardcontrol = grep { $_; } @oldcontrols; |
| }; |
| |
| cat_change( split /\|/xsm, $subboard{$id} ); |
| truncate FORUMCONTROL, 0; |
| } |
| seek FORUMCONTROL, 0, 0; |
| |
| print FORUMCONTROL sort(@boardcontrol); |
| # if it's not a sub board, remove from the old category |
| fclose(FORUMCONTROL); |
| if ( !${ $uid . $id }{'parent'} ) { |
| |
| my @bdlist = split /,/xsm, $cat{$category}; |
| $action_area = "manageboards"; |
| |
| &AdminTemplate; |
| # Remove Board from old Category |
| |
| my $k = 0; |
| |
| for my $bd (@bdlist) { |
| |
| if ( $id eq $bd ) { splice @bdlist, $k, 1; } |
| |
| $k++; |
| |
| } |
| |
| $cat{"$category"} = join q{,}, @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 q{} ) { $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 /\|/xsm, $subboard{ ${ $uid . $id }{'parent'} }; |
| |
| |
| |
| # Remove Board from old parent board |
| |
| my $k = 0; |
| |
| for my $bd (@bdlist) { |
| |
| if ( $id eq $bd ) { splice @bdlist, $k, 1; } |
| |
| $k++; |
| |
| } |
| |
| $subboard{ ${ $uid . $id }{'parent'} } = join q{|}, @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 /,/xsm, $cat{$category}; |
| |
| |
| |
| # Remove Board from old Category |
| |
| my $k = 0; |
| |
| for my $bd (@bdlist) { |
| |
| if ( $id eq $bd ) { splice @bdlist, $k, 1; } |
| |
| $k++; |
| |
| } |
| |
| $cat{$category} = join q{,}, @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 q{} ) { |
| |
| |
| |
| # only move up to cat if cat is the same as previously |
| |
| if ( $category eq $FORM{"cat$i"} ) { |
| |
| my @bdlist = split /\,/xsm, $cat{ $FORM{"cat$i"} }; |
| |
| push @bdlist, "$id"; |
| |
| $cat{ $FORM{"cat$i"} } = join q{,}, @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 ( -e "$boardsdir/$id.txt" ) { # fix a(nnboard) in the boardid.txt |
| |
| fopen( BOARDINFO, "$boardsdir/$id.txt" ) |
| |
| || fatal_error( 'cannot_open', "$openboard/$id.txt", 1 ); |
| |
| my @boardtomodify = <BOARDINFO>; |
| |
| fclose(BOARDINFO); |
| |
| my $x; |
| |
| if ( $FORM{"ann$i"} |
| |
| && ( split /\|/xsm, $boardtomodify[0] )[8] !~ /a/ism ) |
| |
| { |
| |
| for my $x ( 0 .. ( @boardtomodify - 1 ) ) { |
| |
| $boardtomodify[$x] =~ |
| |
| s/(.*\|)(0?)(.*)/ $1 . ($2 eq '0' ? "0a$3" : "a$3") /exsm; |
| |
| } |
| |
| } |
| |
| elsif ( !$FORM{"ann$i"} |
| |
| && ( split /\|/xsm, $boardtomodify[0] )[8] =~ /a/ism ) |
| |
| { |
| |
| *take_a_off = |
| |
| sub { my $y = shift; $y =~ s/a//gsm; return $y; }; |
| |
| for my $x ( 0 .. ( @boardtomodify - 1 ) ) { |
| |
| $boardtomodify[$x] =~ |
| |
| s/(.*\|)(.*)/ $1 . take_a_off($2) /exsm; |
| |
| } |
| |
| } |
| |
| if ($x) { |
| |
| fopen( BOARDINFO, ">$boardsdir/$id.txt" ) |
| |
| || fatal_error( 'cannot_open', "$openboard/$id.txt", 1 ); |
| |
| print {BOARDINFO} @boardtomodify |
| |
| or croak "$croak{'print'} BOARDINFO"; |
| |
| fclose(BOARDINFO); |
| |
| } |
| |
| } |
| |
| } |
| |
| |
| |
| $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/\$/\\\$/gxsm; |
| |
| |
| |
| $board{"$id"} = "$bname|$FORM{\"viewperms$i\"}|$FORM{\"show$i\"}"; |
| |
| $bdescription = $FORM{"description$i"}; |
| |
| FromChars($bdescription); |
| |
| $bdescription =~ s/\r//gxsm; |
| |
| $bdescription =~ s/\n/<br \/>/gsm; |
| |
| if ($do_scramble_id) { |
| |
| my @mods; |
| |
| for ( split /\, /sm, $FORM{"moderators$i"} ) { |
| |
| push @mods, decloak($_); |
| |
| } |
| |
| $FORM{"moderators$i"} = join q{, }, @mods; |
| |
| } |
| |
| if ( $FORM{"brdrss$i"} eq q{} ) { $FORM{"brdrss$i"} = 0; } ### RSS on Board Index ### |
| |
| if ( $FORM{"zero$i"} eq q{} ) { $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"} = q{}; } |
| |
| if ( $FORM{"maxage$i"} < 0 ) { $FORM{"maxage$i"} = q{}; } |
| |
| if ( $FORM{"minage$i"} > 180 ) { $FORM{"minage$i"} = q{}; } |
| |
| if ( $FORM{"maxage$i"} > 180 ) { $FORM{"maxage$i"} = q{}; } |
| |
| |
| |
| if ( $FORM{"maxage$i"} && $FORM{"maxage$i"} < $FORM{"minage$i"} ) { |
| |
| $FORM{"maxage$i"} = $FORM{"minage$i"}; |
| |
| } |
| |
| |
| |
| if ( $FORM{"rules$i"} eq q{} ) { $FORM{"rules$i"} = 0; } |
| |
| if ( $FORM{"rulescollapse$i"} eq q{} ) { $FORM{"rulescollapse$i"} = 0; } |
| |
| $brulestitle = $FORM{"rulestitle$i"}; |
| |
| FromChars($brulestitle); |
| |
| $brulesdesc = $FORM{"rulesdesc$i"}; |
| |
| FromChars($brulesdesc); |
| |
| $brulesdesc =~ s/\r//gxsm; |
| |
| $brulesdesc =~ s/\n/<br \/>/gsm; |
| |
| |
| |
| $FORM{"pasww$i"} =~ s/ //gsm; |
| |
| if ($FORM{"pasww$i"} ne q{}) { |
| |
| if ($FORM{"pasww$i"} !~ /\A[\s0-9A-Za-z!@#$%\^&*\(\)_\+|`~\-=\\:;'",\.\/?\[\]\{\}]+\Z/sm) { fatal_error("$register_txt{'240'} $register_txt{'36'} $register_txt{'241'}") } |
| |
| $encryptopass = encode_password($FORM{"pasww$i"}); |
| |
| } |
| |
| else { |
| |
| if ($FORM{"paswwr$i"}) { $encryptopass = $FORM{"brdpassw$i"}; } else { $encryptopass = q{};} |
| |
| } |
| |
| if ( $FORM{"pic$i"} ) { |
| |
| $mypic = 'y'; |
| |
| } |
| |
| @modhook = ( |
| |
| ); |
| |
| ## BRD Mod Hook ## |
| |
| $modchk = @modhook; |
| |
| $modhook = q{}; |
| |
| if ( $modchk > 0 ) { |
| |
| $modhook = join q{|}, @modhook; |
| |
| } |
| |
| push @boardcontrol, |
| |
| qq~$FORM{"cat$i"}|$id|$mypic|$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"}|$FORM{"rules$i"}|$brulestitle|$brulesdesc|$FORM{"rulescollapse$i"}|$FORM{"paswwr$i"}|$encryptopass|$FORM{"brdrss$i"}|$modhook\n~; |
| |
| push @changes, $id; |
| |
| $yymain .= qq~<i>'$FORM{"name$i"}'</i> $admin_txt{'48'} <br /><a href="$adminurl?action=manageboards">$admin_txt{'51'}</a>~; |
| |
| } |
| |
| |
| |
| # do the saving here, after all new boards passed the tests (fatal_error) |
| |
| if ( $FORM{'screenornot'} ne 'boardscreen' ) { |
| |
| BoardTotals( 'add', @changes ); |
| |
| } |
| |
| |
| |
| Write_ForumMaster(); |
| |
| fopen( FORUMCONTROL, "+<$boardsdir/forum.control" ); |
| |
| seek FORUMCONTROL, 0, 0; |
| |
| my @oldcontrols = <FORUMCONTROL>; |
| |
| my $oldboard; |
| |
| |
| |
| # Update categories for subboards that got changed. |
| |
| for my $cnt ( 0 .. ( @oldcontrols - 1 ) ) { |
| |
| ( undef, $oldboard, undef ) = split /\|/xsm, $oldcontrols[$cnt], 3; |
| |
| for my $changedboard (@updatecats) { |
| |
| if ( $changedboard eq $oldboard ) { |
| |
| my ( $oldcat, $therest ) = split /\|/xsm, $oldcontrols[$cnt], 2; |
| |
| $oldcontrols[$cnt] = qq~${$uid.$changedboard}{'cat'}|$therest~; |
| |
| last; |
| |
| } |
| |
| } |
| |
| } |
| |
| |
| |
| for my $cnt ( 0 .. ( @oldcontrols - 1 ) ) { |
| |
| ( undef, $oldboard, undef ) = split /\|/xsm, $oldcontrols[$cnt], 3; |
| |
| for my $changedboard (@changes) { |
| |
| if ( $changedboard eq $oldboard ) { |
| |
| $oldcontrols[$cnt] = q{}; |
| |
| last; |
| |
| } |
| |
| } |
| |
| } |
| |
| push @oldcontrols, @boardcontrol; |
| |
| @boardcontrol = grep { $_; } @oldcontrols; |
| |
| |
| |
| truncate FORUMCONTROL, 0; |
| |
| seek FORUMCONTROL, 0, 0; |
| |
| print {FORUMCONTROL} sort @boardcontrol or croak "$croak{'print'} FORUMCONTOL"; |
| |
| fclose(FORUMCONTROL); |
| |
| |
| |
| $yytitle = $admin_txt{'50a'}; |
| |
| $action_area = 'manageboards'; |
| |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub ReorderBoards { |
| sub ReorderBoards { |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| unless ($mloaded == 1) { require "$boardsdir/forum.master"; } |
| get_forum_master(); |
| if ($#categoryorder > 0) { |
| if ( $INFO{'subboards'} ) { LoadBoardControl(); } |
| foreach $category (@categoryorder) { |
| if ( $#categoryorder > 0 ) { |
| chomp $category; |
| for my $category (@categoryorder) { |
| ($categoryname, undef) = split(/\|/, $catinfo{$category}); |
| chomp $category; |
| &ToChars($categoryname); |
| ( $categoryname, undef ) = split /\|/xsm, $catinfo{$category}; |
| if ($category eq $INFO{"item"}) { |
| ToChars($categoryname); |
| $categorylistsel = qq~<option value="$category" selected="selected">$categoryname</option>~; |
| if ( |
| } else { |
| ( $category eq $INFO{'item'} && !$INFO{'subboards'} ) |
| $categorylist .= qq~<option value="$category">$categoryname</option>~; |
| || ( $category eq ${ $uid . $INFO{'item'} }{'cat'} |
| } |
| && $INFO{'subboards'} ) |
| } |
| ) |
| } |
| { |
| @bdlist = split(/,/, $cat{ $INFO{"item"} }); |
| $categorylistsel = |
| $bdcnt = @bdlist; |
| qq~<option value="$category" selected="selected">$categoryname</option>~; |
| $bdnum = $bdcnt; |
| } |
| if ($bdcnt < 4) { $bdcnt = 4; } |
| else { |
| ($curcatname, $catperms) = split(/\|/, $catinfo{ $INFO{"item"} }); |
| $categorylist .= |
| &ToChars($curcatname); |
| qq~<option value="$category">$categoryname</option>~; |
| |
| } |
| # Prepare the list of current boards to be put in the select box |
| |
| $boardslist = qq~<select name="selectboards" id="selectboards" size="$bdcnt" style="width: 190px;">~; |
| # build option lists for parent boards |
| foreach $board (@bdlist) { |
| my @catboards = split /,/xsm, $cat{$category}; |
| chomp $board; |
| my $indent = -2; |
| ($boardname, undef) = split(/\|/, $board{$board}, 2); |
| $catboardlist{$category} = q~<option value=''> </option>~; |
| &ToChars($boardname); |
| |
| if ($board eq $INFO{'theboard'}) { |
| *get_subboards2 = sub { |
| $boardslist .= qq~<option value="$board" selected="selected">$boardname</option>~; |
| my @x = @_; |
| } else { |
| $indent += 2; |
| $boardslist .= qq~<option value="$board">$boardname</option>~; |
| for my $childbd (@x) { |
| } |
| my $dash; |
| } |
| if ( $indent > 0 ) { $dash = q{-}; } |
| $boardslist .= qq~</select>~; |
| ( $chldboardname, undef, undef ) = |
| |
| split /\|/xsm, $board{"$childbd"}; |
| |
| ToChars($chldboardname); |
| |
| $catboardlist{$category} .= |
| |
| qq~<option value='$childbd'>~ |
| |
| . ( ' ' x $indent ) |
| |
| . ( $dash x ( $indent / 2 ) ) |
| |
| . qq~ $chldboardname</option>~; |
| |
| if ( $subboard{$childbd} ) { |
| |
| get_subboards2( split /\|/xsm, $subboard{$childbd} ); |
| |
| } |
| |
| } |
| |
| $indent -= 2; |
| |
| }; |
| |
| get_subboards2(@catboards); |
| |
| |
| |
| $catboardlist_js .= qq~ |
| |
| catboardlist['$category'] = "$catboardlist{$category}"; |
| |
| ~; |
| |
| } |
| |
| } |
| |
| |
| |
| # get list of subboards if that's what we're reordering otherwise boards in the selected category |
| |
| if ( $INFO{'subboards'} ) { |
| |
| @bdlist = split /\|/xsm, $subboard{ $INFO{'item'} }; |
| |
| $INFO{'subboards'} = ';subboards=1'; |
| |
| ( $curname, $boardperms, $boardview ) = |
| |
| split /\|/xsm, $board{ $INFO{'item'} }; |
| |
| ToChars($curname); |
| |
| $cur_txt = $admin_txt{'832a'}; |
| |
| } |
| |
| else { |
| |
| @bdlist = split /,/xsm, $cat{ $INFO{'item'} }; |
| |
| ( $curname, $catperms ) = split /\|/xsm, $catinfo{ $INFO{'item'} }; |
| |
| ToChars($curname); |
| |
| $cur_txt = $admin_txt{'832'}; |
| |
| } |
| |
| $bdcnt = @bdlist; |
| |
| $bdnum = $bdcnt; |
| |
| if ( $bdcnt < 4 ) { $bdcnt = 4; } |
| |
| |
| |
| # Prepare the list of current boards to be put in the select box |
| |
| $boardslist = |
| |
| qq~<select name="selectboards" id="selectboards" size="$bdcnt" style="width: 190px;">~; |
| |
| for my $board (@bdlist) { |
| |
| chomp $board; |
| |
| ( $boardname, undef ) = split /\|/xsm, $board{$board}, 2; |
| |
| ToChars($boardname); |
| |
| if ( $board eq $INFO{'theboard'} ) { |
| |
| $boardslist .= |
| |
| qq~<option value="$board" selected="selected">$boardname</option>~; |
| |
| } |
| |
| else { |
| |
| $boardslist .= qq~<option value="$board">$boardname</option>~; |
| |
| } |
| |
| } |
| |
| $boardslist .= q~</select>~; |
| |
| |
| |
| if ( $INFO{'subboards'} ) { |
| |
| $cat_or_bd_txt = $admin_txt{'739h'}; |
| |
| $admin_txt{'739c'} =~ s/{(.*?)}/$admin_txt{'739j'}$1/gsm; |
| |
| $admin_txt{'739d'} =~ s/{(.*?)}/$admin_txt{'739j'}$1/gsm; |
| |
| $admin_txt{'739f'} =~ s/{(.*?)}/$admin_txt{'739j'}$1/gsm; |
| |
| } |
| |
| else { |
| |
| $cat_or_bd_txt = $admin_txt{'739'}; |
| |
| $admin_txt{'739c'} =~ s/{(.*?)}/$1/gsm; |
| |
| $admin_txt{'739d'} =~ s/{(.*?)}/$1/gsm; |
| |
| $admin_txt{'739f'} =~ s/{(.*?)}/$1/gsm; |
| |
| } |
| |
| |
| $yymain .= qq~ |
| $yymain .= qq~ |
| <br /><br /> |
| <br /><br /> |
| <form action="$adminurl?action=reorderboards2;item=$INFO{'item'}" method="post"> |
| <form action="$adminurl?action=reorderboards2;item=$INFO{'item'}$INFO{'subboards'}" method="post" id="bdform" accept-charset="$yymycharset"> |
| <table border="0" width="525" cellspacing="1" cellpadding="4" class="bordercolor" align="center"> |
| <table class="bordercolor border-space pad-cell" style="width:535px"> |
| <tr> |
| |
| <td class="titlebg"><img src="$imagesdir/board.gif" alt="" style="vertical-align: middle;" /> <b>$admin_txt{'832'} ($curcatname)</b></td> |
| |
| </tr> |
| |
| <tr> |
| <tr> |
| <td class="windowbg" valign="middle" align="left"> |
| <td class="titlebg">$admin_img{'board'} <b>$cur_txt ($curname)</b></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg"> |
| ~; |
| ~; |
| if ($bdnum) { |
| if ($bdnum) { |
| $yymain .= qq~ |
| $yymain .= qq~ |
| <div style="float: left; width: 280px; text-align: left; margin-bottom: 4px;" class="small"><label for="selectboards">$admin_txt{'739'}</label></div> |
| <div style="float: left; width: 280px; text-align: left; margin-bottom: 4px;" class="small"><label for="selectboards">$cat_or_bd_txt</label></div> |
| <div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;">$boardslist</div> |
| <div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;">$boardslist</div> |
| <div style="float: left; width: 280px; text-align: left; margin-bottom: 4px;" class="small">$admin_txt{'739d'}</div> |
| <div style="float: left; width: 280px; text-align: left; margin-bottom: 4px;" class="small">$admin_txt{'739d'}</div> |
| <div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;"> |
| <div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;"> |
| <input type="submit" value="$admin_txt{'739a'}" name="moveup" style="font-size: 11px; width: 95px;" class="button" /> |
| <input type="submit" value="$admin_txt{'739a'}" name="moveup" style="font-size: 11px; width: 95px;" class="button" /> |
| <input type="submit" value="$admin_txt{'739b'}" name="movedown" style="font-size: 11px; width: 95px;" class="button" /> |
| <input type="submit" value="$admin_txt{'739b'}" name="movedown" style="font-size: 11px; width: 95px;" class="button" /> |
| </div> |
| </div> |
| ~; |
| ~; |
| if ($#categoryorder > 0) { |
| if ( $#categoryorder > 0 ) { |
| $yymain .= qq~ |
| $yymain .= qq~ |
| <div class="small" style="float: left; width: 280px; text-align: left; margin-bottom: 4px;"><label for="selectcategory">$admin_txt{'739c'}</label></div> |
| <div class="small" style="float: left; width: 280px; text-align: left; margin-bottom: 4px;"><label for="selectcategory">$admin_txt{'739c'}</label></div> |
| <div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;"> |
| <div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;"> |
| <select name="selectcategory" id="selectcategory" style="width: 190px;" onchange="submit();"> |
| <select name="selectcategory" id="selectcategory" style="width: 190px;" onchange = "updateParent(this.value, '~ |
| $categorylistsel |
| . ( $INFO{'subboards'} ? $INFO{'item'} : q{} ) . qq~')"> |
| $categorylist |
| $categorylistsel |
| </select> |
| $categorylist |
| |
| </select> |
| |
| </div><br /> |
| |
| ~; |
| |
| } |
| |
| $yymain .= qq~ |
| |
| <div class="small" style="float: left; width: 280px; text-align: left; margin-bottom: 4px;"><label for="selectboard">$admin_txt{'739f'}</label></div> |
| |
| <div style="float: left; width: 230px; text-align: center; margin-bottom: 4px;"> |
| |
| <select name="selectboard" id="selectboard" style="width: 190px;"><option> </option></select> |
| |
| </div> |
| |
| <br /> |
| |
| <div style="float: left; width: 280px; text-align: left;"> </div> |
| |
| <div style="float: left; width: 230px; text-align: center;"> |
| |
| <input type="button" onclick="checkParent()" value="$admin_txt{'739g'}" name="update" style="font-size: 11px; width: 190px;" class="button" /> |
| </div> |
| </div> |
| ~; |
| ~; |
| } |
| } |
| } else { |
| else { |
| $yymain .= qq~ |
| $yymain .= qq~ |
| <div class="small" style="text-align: center; margin-bottom: 4px;">$admin_txt{'739e'}</div> |
| <div class="small center" style="margin-bottom: 4px;">$admin_txt{'739e'}</div> |
| ~; |
| ~; |
| } |
| } |
| $yymain .= qq~ |
| $yymain .= q~ |
| </td> |
| </td> |
| </tr> |
| </tr> |
| </table> |
| </table> |
| </form> |
| </form> |
| ~; |
| ~; |
| $yytitle = "$admin_txt{'832'}"; |
| $yymain .= qq~ |
| $action_area = "manageboards"; |
| <script type="text/javascript"> |
| &AdminTemplate; |
| var catboardlist = new Array(); |
| |
| $catboardlist_js |
| |
| |
| |
| // updates parent drop down list when new category is selected |
| |
| function updateParent(cat, board) { |
| |
| var parentsel = document.getElementById("selectboard"); |
| |
| parentsel.innerHTML = catboardlist[cat]; |
| |
| |
| |
| for (var i = 0; i < parentsel.options.length; i++) { |
| |
| if(parentsel.options[i].value == board) { |
| |
| parentsel.options[i].style.backgroundColor = "#ffbbbb"; |
| |
| } |
| |
| } |
| |
| } |
| |
| |
| |
| // make sure we don't select a board and decide to move it to itself.... |
| |
| function checkParent() { |
| |
| var parent = document.getElementById("selectboard").value; |
| |
| var board = document.getElementById("selectboards").value; |
| |
| if(parent == board) { |
| |
| alert("$admin_txt{'733'}"); |
| |
| } |
| |
| else if (!board) { |
| |
| alert("$admin_txt{'734'}"); |
| |
| } else { |
| |
| document.getElementById("bdform").submit(); |
| |
| } |
| |
| } |
| |
| |
| |
| updateParent('~ |
| |
| . ( |
| |
| $INFO{'subboards'} ? ${ $uid . $INFO{'item'} }{'cat'} : $INFO{'item'} ) |
| |
| . qq~','$INFO{'item'}'); |
| |
| var parentsel = document.getElementById("selectboard"); |
| |
| ~; |
| |
| |
| |
| if ( $INFO{'subboards'} ) { |
| |
| $yymain .= qq~ |
| |
| for (var i = 0; i < parentsel.options.length; i++) { |
| |
| if(parentsel.options[i].value == '$INFO{'item'}') { |
| |
| parentsel.options[i].selected = true; |
| |
| } |
| |
| } |
| |
| ~; |
| |
| } |
| |
| |
| |
| $yymain .= q~ |
| |
| </script> |
| |
| ~; |
| |
| |
| |
| $yytitle = "$admin_txt{'832'}"; |
| |
| $action_area = 'manageboards'; |
| |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| |
| |
| sub ReorderBoards2 { |
| sub ReorderBoards2 { |
| &is_admin_or_gmod; |
| is_admin_or_gmod(); |
| unless ($mloaded == 1) { require "$boardsdir/forum.master"; } |
| get_forum_master(); |
| @itemorder = split(/,/, $cat{ $INFO{"item"} }); |
| |
| my $moveitem = $FORM{'selectboards'}; |
| if ( $INFO{'subboards'} ) { |
| my $category = $INFO{"item"}; |
| @itemorder = split /\|/xsm, $subboard{ $INFO{'item'} }; |
| if ($moveitem) { |
| } |
| if ($FORM{'moveup'} || $FORM{'movedown'}) { |
| else { |
| if ($FORM{'moveup'}) { |
| @itemorder = split /,/xsm, $cat{ $INFO{'item'} }; |
| for ($i = 0; $i < @itemorder; $i++) { |
| } |
| if ($itemorder[$i] eq $moveitem && $i > 0) { |
| |
| $j = $i - 1; |
| LoadBoardControl(); |
| $itemorder[$i] = $itemorder[$j]; |
| |
| $itemorder[$j] = $moveitem; |
| my $moveitem = $FORM{'selectboards'}; |
| last; |
| my $catorbd = $INFO{'item'}; |
| } |
| my @updatecats; |
| } |
| if ($moveitem) { |
| } elsif ($FORM{'movedown'}) { |
| if ( $FORM{'moveup'} || $FORM{'movedown'} ) { |
| for ($i = 0; $i < @itemorder; $i++) { |
| if ( $FORM{'moveup'} ) { |
| if ($itemorder[$i] eq $moveitem && $i < $#itemorder) { |
| for my $i ( 0 .. ( @itemorder - 1 ) ) { |
| $j = $i + 1; |
| if ( $itemorder[$i] eq $moveitem && $i > 0 ) { |
| $itemorder[$i] = $itemorder[$j]; |
| $j = $i - 1; |
| $itemorder[$j] = $moveitem; |
| $itemorder[$i] = $itemorder[$j]; |
| last; |
| $itemorder[$j] = $moveitem; |
| } |
| last; |
| } |
| } |
| } |
| } |
| $cat{$category} = join(',', grep { $_; } @itemorder); |
| } |
| } else { |
| elsif ( $FORM{'movedown'} ) { |
| if ($category ne $FORM{"selectcategory"}) { |
| for my $i ( 0 .. ( @itemorder - 1 ) ) { |
| ${$uid.$moveitem}{'cat'} = qq~$FORM{'selectcategory'}~; |
| if ( $itemorder[$i] eq $moveitem && $i < $#itemorder ) { |
| my @bdlist = split(/,/, $cat{$category}); |
| $j = $i + 1; |
| my $k = 0; |
| $itemorder[$i] = $itemorder[$j]; |
| foreach $bd (@bdlist) { |
| $itemorder[$j] = $moveitem; |
| if ($moveitem eq $bd) { splice(@bdlist, $k, 1); } |
| last; |
| $k++; |
| } |
| } |
| } |
| $cat{"$category"} = join(',', @bdlist); |
| } |
| my $ncat = $FORM{"selectcategory"}; |
| if ( $INFO{'subboards'} ) { |
| if ($cat{$ncat} ne "") { $cat{$ncat} .= ",$moveitem"; } |
| $subboard{$catorbd} = join q{|}, grep { $_; } @itemorder; |
| else { $cat{$ncat} = $moveitem; } |
| } |
| $category = qq~$FORM{"selectcategory"}~; |
| else { |
| } |
| $cat{$catorbd} = join q{,}, grep { $_; } @itemorder; |
| } |
| } |
| &Write_ForumMaster; |
| } |
| |
| else { |
| |
| my $category = ${ $uid . $moveitem }{'cat'}; |
| fopen(FORUMCONTROL, "+<$boardsdir/forum.control"); |
| if ( ${ $uid . $moveitem }{'cat'} ne $FORM{'selectcategory'} ) { |
| seek FORUMCONTROL, 0, 0; |
| ${ $uid . $moveitem }{'cat'} = qq~$FORM{'selectcategory'}~; |
| my @oldcontrols = <FORUMCONTROL>; |
| my @bdlist = split /,/xsm, $cat{$category}; |
| my $oldboard; |
| |
| for (my $cnt = 0; $cnt < @oldcontrols; $cnt++) { |
| # recursively change the category of child boards. |
| my (undef, $oldboard,$pic,$bdescription,$moderators,$moderatorgroups,$topicperms,$replyperms,$pollperms,$zero,$membergroups,$ann,$rbin,$att,$minage,$maxage,$gender) = split(/\|/, $oldcontrols[$cnt]); |
| if ( $subboard{$moveitem} ) { |
| if ($moveitem eq $oldboard) { |
| |
| $oldcontrols[$cnt] = qq~$category|$moveitem|$pic|$bdescription|$moderators|$moderatorgroups|$topicperms|$replyperms|$pollperms|$zero|$membergroups|$ann|$rbin|$att|$minage|$maxage|$gender~; |
| *cat_change2 = sub { |
| } |
| my @x = @_; |
| } |
| for my $childbd (@x) { |
| my @boardcontrol = grep { $_; } @oldcontrols; |
| ${ $uid . $childbd }{'cat'} = |
| |
| qq~$FORM{'selectcategory'}~; |
| truncate FORUMCONTROL, 0; |
| push @updatecats, $childbd; |
| seek FORUMCONTROL, 0, 0; |
| if ( $subboard{$childbd} ) { |
| print FORUMCONTROL sort(@boardcontrol); |
| cat_change2( split /\|/xsm, |
| fclose(FORUMCONTROL); |
| $subboard{$childbd} ); |
| |
| } |
| } |
| } |
| $yySetLocation = qq~$adminurl?action=reorderboards;item=$category;theboard=$moveitem~; |
| }; |
| &redirectexit; |
| cat_change2( split /\|/xsm, $subboard{$moveitem} ); |
| |
| } |
| |
| |
| |
| # remove from the category list only if it was not a subboard |
| |
| if ( !${ $uid . $moveitem }{'parent'} ) { |
| |
| my $k = 0; |
| |
| for my $bd (@bdlist) { |
| |
| if ( $moveitem eq $bd ) { splice @bdlist, $k, 1; } |
| |
| $k++; |
| |
| } |
| |
| $cat{$category} = join q{,}, @bdlist; |
| |
| } |
| |
| |
| |
| # add to new category if there's no parent selected |
| |
| if ( !$FORM{'selectboard'} ) { |
| |
| |
| |
| # add to new cat list |
| |
| my $ncat = $FORM{'selectcategory'}; |
| |
| if ( $cat{$ncat} ne q{} ) { $cat{$ncat} .= ",$moveitem"; } |
| |
| else { $cat{$ncat} = $moveitem; } |
| |
| } |
| |
| } |
| |
| |
| |
| # if parent has changed |
| |
| if ( ${ $uid . $moveitem }{'parent'} ne $FORM{'selectboard'} ) { |
| |
| |
| |
| # if it had a parent, remove it from that list, otherwise it didnt have a parent so remove it from cat list |
| |
| if ( ${ $uid . $moveitem }{'parent'} ) { |
| |
| my @bdlist = split /\|/xsm, |
| |
| $subboard{ ${ $uid . $moveitem }{'parent'} }; |
| |
| |
| |
| # Remove Board from old parent board |
| |
| my $k = 0; |
| |
| for my $bd (@bdlist) { |
| |
| if ( $moveitem eq $bd ) { splice @bdlist, $k, 1; } |
| |
| $k++; |
| |
| } |
| |
| $subboard{ ${ $uid . $moveitem }{'parent'} } = join q{|}, |
| |
| @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{'selectcategory'} ) { |
| |
| my @bdlist = split /,/xsm, $cat{$category}; |
| |
| |
| |
| # Remove Board from old Category |
| |
| my $k = 0; |
| |
| for my $bd (@bdlist) { |
| |
| if ( $moveitem eq $bd ) { splice @bdlist, $k, 1; } |
| |
| $k++; |
| |
| } |
| |
| $cat{$category} = join q{,}, @bdlist; |
| |
| } |
| |
| |
| |
| # if we're removing the parent board, move it back up to its category, otherwise add to new parent board |
| |
| if ( $FORM{'selectboard'} eq q{} ) { |
| |
| |
| |
| # only move up to cat if cat is the same as previously |
| |
| if ( $category eq $FORM{'selectcategory'} ) { |
| |
| my @bdlist = |
| |
| split /\,/xsm, $cat{ $FORM{'selectcategory'} }; |
| |
| push @bdlist, "$moveitem"; |
| |
| $cat{ $FORM{'selectcategory'} } = join q{,}, @bdlist; |
| |
| } |
| |
| } |
| |
| else { |
| |
| |
| |
| # Add to new parent board |
| |
| if ( $subboard{ $FORM{'selectboard'} } ) { |
| |
| $subboard{ $FORM{'selectboard'} } .= qq~|$moveitem~; |
| |
| } |
| |
| else { |
| |
| $subboard{ $FORM{'selectboard'} } = $moveitem; |
| |
| } |
| |
| } |
| |
| ${ $uid . $moveitem }{'parent'} = $FORM{'selectboard'}; |
| |
| } |
| |
| } |
| |
| Write_ForumMaster(); |
| |
| fopen( FORUMCONTROL, "+<$boardsdir/forum.control" ); |
| |
| seek FORUMCONTROL, 0, 0; |
| |
| my @oldcontrols = <FORUMCONTROL>; |
| |
| for my $cnt ( 0 .. ( @oldcontrols - 1 ) ) { |
| |
| my @newbrd = split /\|/xsm, $oldcontrols[$cnt]; |
| |
| if ( $moveitem eq $oldboard ) { |
| |
| $newbrd[0] = ${$uid.$moveitem}{'cat'}; |
| |
| $newbrd[18] = ${$uid.$moveitem}{'parent'}; |
| |
| $newboardline = join q{|}, @newbrd; |
| |
| $oldcontrols[$cnt] = $newboardline . "\n"; |
| |
| } |
| |
| for my $changedboard (@updatecats) { |
| |
| if ( $changedboard eq $oldboard ) { |
| |
| $newbrd[0] = ${$uid.$changedboard}{'cat'}; |
| |
| $newbrd[18] = ${$uid.$changedboard}{'parent'}; |
| |
| $newboardline = join q{|}, @newbrd; |
| |
| $oldcontrols[$cnt] = $newboardline . "\n"; |
| |
| } |
| |
| } |
| |
| } |
| |
| my @boardcontrol = grep { $_; } @oldcontrols; |
| |
| |
| |
| truncate FORUMCONTROL, 0; |
| |
| seek FORUMCONTROL, 0, 0; |
| |
| print {FORUMCONTROL} sort @boardcontrol |
| |
| or croak "$croak{'print'} FORUMCONTROL"; |
| |
| fclose(FORUMCONTROL); |
| |
| |
| |
| } |
| |
| $yySetLocation = |
| |
| qq~$adminurl?action=reorderboards;item=$category;theboard=$moveitem~; |
| |
| if ( !$INFO{'subboards'} ) { |
| |
| $yySetLocation = |
| |
| qq~$adminurl?action=reorderboards;item=$catorbd;theboard=$moveitem~; |
| |
| } |
| |
| else { |
| |
| $yySetLocation = |
| |
| qq~$adminurl?action=reorderboards;item=$catorbd;theboard=$moveitem;subboards=1~; |
| |
| } |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub ConfRemBoard { |
| sub ConfRemBoard { |
| $yymain .= qq~ |
| $yymain .= qq~ |
| <table border="0" width="100%" cellspacing="1" class="bordercolor"> |
| <table class="bordercolor border-space"> |
| <tr> |
| <tr> |
| <td class="titlebg"><b>$admin_txt{'31'} - '$FORM{'boardname'}'?</b></td> |
| <td class="titlebg"><b>$admin_txt{'31'} - '$FORM{'boardname'}'?</b></td> |
| </tr> |
| </tr><tr> |
| <tr> |
| <td class="windowbg"> |
| <td class="windowbg" > |
| $admin_txt{'617'}<br /> |
| $admin_txt{'617'}<br /> |
| <b><a href="$adminurl?action=modifyboard;cat=$FORM{'cat'};id=$FORM{'id'};moda=$admin_txt{'31'}2">$admin_txt{'163'}</a> - <a href="$adminurl?action=manageboards">$admin_txt{'164'}</a></b> |
| <b><a href="$adminurl?action=modifyboard;cat=$FORM{'cat'};id=$FORM{'id'};moda=$admin_txt{'31'}2">$admin_txt{'163'}</a> - <a href="$adminurl?action=manageboards">$admin_txt{'164'}</a></b> |
| </td> |
| </td> |
| </tr> |
| </tr> |
| </table> |
| </table> |
| ~; |
| |
| $yytitle = "$admin_txt{'31'} - '$FORM{'boardname'}'?"; |
| |
| $action_area = 'manageboards'; |
| |
| AdminTemplate(); |
| |
| return; |
| |
| } |
| |
| |
| |
| sub FixBoardDupes { |
| |
| is_admin_or_gmod(); |
| |
| get_forum_master(); |
| |
| my @dupedbrds = (); |
| |
| my @mylist = (); |
| |
| my @catbrds = (); |
| |
| my @subbrds = (); |
| |
| while( ( $key, $value ) = each %cat ) { |
| |
| @mylist = split /,/xsm, $value; |
| |
| push @dupedbrds, @mylist; |
| |
| } |
| |
| while( ( $key, $value ) = each %subboard ) { |
| |
| @mylist = split /[|]/xsm, $value; |
| |
| push @dupedbrds, @mylist; |
| |
| } |
| |
| my %dup_counts; |
| |
| for (@dupedbrds) { $dup_counts{$_}++ }; |
| |
| my @chkbrds = grep { $dup_counts{$_} > 1 } keys %dup_counts; |
| |
| if (@chkbrds) { |
| |
| while( ( $key, $value ) = each %cat ) { |
| |
| @mylist = split /,/xsm, $value; |
| |
| for my $x (@mylist) { |
| |
| for my $y (@chkbrds) { |
| |
| if ( $x eq $y ) { |
| |
| push @catbrds, qq~$x|c|$key~; |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| while( ( $key, $value ) = each %subboard ) { |
| |
| @mylist = split /[|]/xsm, $value; |
| |
| for my $x (@mylist) { |
| |
| for my $y (@chkbrds) { |
| |
| if ( $x eq $y ) { |
| |
| push @catbrds, qq~$x|s|$key~; |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| $dupedlist = qq~<br /><span style="font-size:125%">$admin_txt{'fixinstruct'}</span>~; |
| |
| @catbrds = sort(@catbrds); |
| |
| $mynum = 0; |
| |
| for (@catbrds) { |
| |
| my( $dpfile, $tp, $mydupcat ) = split /[|]/xsm, $_; |
| |
| if ( $tp eq 'c') { |
| |
| $dupedlist .= qq~<br /><input type="checkbox" name="$mynum|$_" value="1" /> $admin_txt{'58'} $dpfile $admin_txt{'incat'} $mydupcat~; |
| |
| } |
| |
| else { |
| |
| $dupedlist .= qq~<br /><input type="checkbox" name="$mynum|$_" value="1" /> $admin_txt{'subbrd'} $dpfile $admin_txt{'inbrd'} $mydupcat~; |
| |
| } |
| |
| $mynum++; |
| |
| } |
| |
| $yymain .= qq~ |
| |
| <form action="$adminurl?action=fixdupes" method="post" accept-charset="$yymycharset"> |
| |
| <table class="bordercolor border-space pad-cell"> |
| |
| <tr> |
| |
| <td class="titlebg">$admin_img{'cat_img'} <b>$admin_txt{'fixdupbrd'}</b></td> |
| |
| </tr><tr> |
| |
| <td class="windowbg"> |
| |
| $dupedlist |
| |
| </td> |
| |
| </tr><tr> |
| |
| <td class="titlebg center"> |
| |
| <input type="submit" value="$admin_txt{'fixdupbrd'}" class="button" /> |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </form> |
| ~; |
| ~; |
| $yytitle = "$admin_txt{'31'} - '$FORM{'boardname'}'?"; |
| $yytitle = qq~$admin_txt{'fixdupbrd'}~; |
| $action_area = "manageboards"; |
| $action_area = 'manageboards'; |
| &AdminTemplate; |
| AdminTemplate(); |
| |
| return; |
| } |
| } |
| 1; |
| |
| |
| sub FixDupes { |
| |
| is_admin_or_gmod(); |
| |
| get_forum_master(); |
| |
| @torem = (); |
| |
| $i = 0; |
| |
| while ( $_ = each %FORM ) { |
| |
| if ( $FORM{$_} ) { |
| |
| my( $num, $dpfile, $tp, $mydupcat ) = split /[|]/xsm, $_; |
| |
| push @torem, qq~$dpfile|$tp|$mydupcat~; |
| |
| } |
| |
| } |
| |
| my %hash; |
| |
| my @del = (); |
| |
| my $i = 0; |
| |
| $hash{$_}++ foreach (@torem); |
| |
| for (keys %hash) { |
| |
| ( $dpfile, $tp, $mydupcat ) = split /[|]/xsm, $_; |
| |
| if ( $tp eq 'c' ) { |
| |
| @dupcat = split /,/xsm, $cat{$mydupcat}; |
| |
| $i = 0; |
| |
| $i++ until $dupcat[$i] eq $dpfile; |
| |
| splice(@dupcat, $i, 1); |
| |
| $cat{$mydupcat} = join q{,}, @dupcat; |
| |
| push @del, $dpfile; |
| |
| } |
| |
| else { |
| |
| @dupcat = split /[|]/xsm, $subboard{$mydupcat}; |
| |
| $i = 0; |
| |
| $i++ until $dupcat[$i] eq $dpfile; |
| |
| splice(@dupcat, $i, 1); |
| |
| $subboard{$mydupcat} = join q{,}, @dupcat; |
| |
| push @del, $dpfile; |
| |
| } |
| |
| } |
| |
| |
| |
| Write_ForumMaster(); |
| |
| $yymain .= qq~Duplicate Boards removed<br />@del<br /><a href="$adminurl?action=manageboards">$admin_txt{'51'}</a>~; |
| |
| $yytitle = qq~$admin_txt{'fixdupbrd'}~; |
| |
| $action_area = 'manageboards'; |
| |
| AdminTemplate(); |
| |
| return; |
| |
| } |
| |
| |
| |
| 1; |
| |
| |