###############################################################################
# ManageCats.pl #
###############################################################################
# YaBB: Yet another Bulletin Board #
# Open-Source Community Software for Webmasters #
# Version: YaBB 2.4 #
# Packaged: April 12, 2009 #
# Distributed by: http://www.yabbforum.com #
# =========================================================================== #
# Copyright (c) 2000-2009 YaBB (www.yabbforum.com) - All Rights Reserved. #
# Software by: The YaBB Development Team #
# with assistance from the YaBB community. #
# Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com #
# Your source for web hosting, web design, and domains. #
###############################################################################
$managecatsplver = 'YaBB 2.4 $Revision$';
if ($GLOBAL::ACTION eq 'detailedversion') { return 1; }
sub DoCats {
&is_admin_or_gmod;
my $i = 0;
while ($_ = each(%FORM)) {
if($FORM{$_} && /^yitem_(.+)$/) {
$editcats[$i] = $1;
$i++;
}
}
if ($FORM{'baction'} eq "edit") { &AddCats(@editcats); }
elsif ($FORM{'baction'} eq "delme") {
foreach $catid (@editcats) {
##Check if category has any boards, and if it does remove them.
if ($cat{$catid} ne "") { require "$admindir/ManageBoards.pl"; &DeleteBoards(split(/,/, $cat{$catid})); }
delete $cat{"$catid"};
delete $catinfo{"$catid"};
my $x = 0;
foreach $categoryid (@categoryorder) {
if ($catid eq $categoryid) { splice(@categoryorder, $x, 1); last; }
$x++;
}
$yymain .= qq~$admin_txt{'830'} $catid $admin_txt{'831'}
~;
}
&Write_ForumMaster;
}
$yytitle = "$admin_txt{'3'}";
$action_area = "managecats";
&AdminTemplate;
}
sub AddCats {
&is_admin_or_gmod;
my @editcats = @_;
if ($INFO{"action"} eq "catscreen") { $FORM{"amount"} = @editcats; }
$yymain .= qq~