###############################################################################
# ManageCats.pm #
# $Date: 01 Sep 2026 $ #
###############################################################################
# YaBB: Yet another Bulletin Board #
# Open-Source Community Software for Webmasters #
# Version: YaBBForum 3.2 #
# Packaged: 01 Sep 2026 #
# Distributed by: https://yabbforum.nz #
# =========================================================================== #
# Copyright (c) 2000-2026 YaBB (yabbforum.nz) - All Rights Reserved. #
# Software by: The YaBB Development Team #
# with assistance from the YaBB community. #
###############################################################################
use CGI::Carp qw(fatalsToBrowser);
our $VERSION = '3.2';
$managecatspmver = 'YaBBForum 3.2';
if ( $action eq 'detailedversion' ) { return 1; }
sub DoCats {
is_admin_or_gmod();
my $i = 0;
while ( $_ = each %FORM ) {
if ( $FORM{$_} && /^yitem_(.+)$/xsm ) {
$editcats[$i] = $1;
$i++;
}
}
if ( $FORM{'baction'} eq 'edit' ) { AddCats(@editcats); }
elsif ( $FORM{'baction'} eq 'delme' ) {
get_forum_master();
foreach my $catid (@editcats) {
##Check if category has any boards, and if it does remove them.
if ( $cat{$catid} ne q{} ) {
require Admin::ManageBoards;
DeleteBoards( split /,/xsm, $cat{$catid} );
}
delete $cat{"$catid"};
delete $catinfo{"$catid"};
my $x = 0;
foreach my $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();
return;
}
sub AddCats {
my @editcats = @_;
is_admin_or_gmod();
if ( $INFO{'action'} eq 'catscreen' ) { $FORM{'amount'} = @editcats; }
get_forum_master();
$yymain .= qq~