Announcement Boards
1.4a
Let's you set a board as an "Announcement Board" where everyone can read posts, but only the Admin and Moderators can post/reply to topics.
Boards can be set to announcement mode in the admin center under Forum Controls - Edit Boards. This feature may be enabled/disabled at any time for a board through the admin center.
1.1: Fixed error where all boards below announcement boards were also made into announcement boards.
1.2: (Sniser) Enhanced it so you now can define if [guests / members / admins and moderators of that board] can can start threads or reply (separately, eg. only members can start threads but guests can reply (note that this does NOT override the $enable_guest_posting setting))
Also added a check in sub Post2, so you can't override it by modifying the HTML of a post page you are allowed access to.
1.31 Compatible with SP1 by Manuel Medina
1.3 by [CV]XXL: made it working ;)
1.3a made it compatible with file_attachment.mod
1.3b fixed enhancement
1.3c fixed enhancement again
1.3d re-closed the security hole :P
1.3e fixed "string not found" error
1.3f tiny fix
1.4 Took all hardcoded text out of the mod and made it SP1.1 compatible
1.4a Made it SP1.4 compatible
DaveB, Sniser, [CV]XXL, Manuel Medina, Spikecity
http://www.spikecity.net
Sources/Post.pl
sub Post {
##### Announcement Board Mod SP1.4 #####
sub Check_Board_Type {
my($num) = $_[0];
fopen(FILE, "$boardsdir/$currentboard.dat") || &fatal_error("300 $txt{'106'}: $txt{'23'} $currentboard.dat");
@blah = ;
fclose(FILE);
chomp($blah[3]);
chomp($blah[4]);
if (!$num) {
if ($blah[3] == 1) {
if ($username eq 'Guest') {
&fatal_error($annbtxt{'1'});
}
} elsif ($blah[3] == 2) {
if ($settings[7] ne 'Administrator' && !exists $moderators{$username}) {
&fatal_error($annbtxt{'2'});
}
}
} else {
if ($blah[4] == 1) {
if ($username eq 'Guest') {
&fatal_error($annbtxt{'3'});
}
} elsif ($blah[4] == 2) {
if ($settings[7] ne 'Administrator' && !exists $moderators{$username}) {
&fatal_error($annbtxt{'4'});
}
}
}
}
##### Announcement Board Mod SP1.4 #####
fopen(FILE, "$boardsdir/$cat.cat") || &fatal_error("300 $txt{'106'}: $txt{'23'} $cat.cat");
$cat = ;
fclose(FILE);
##### Announcement Board Mod SP1.4 #####
&Check_Board_Type($threadid);
##### Announcement Board Mod SP1.4 #####
sub Post2 {
if($username eq 'Guest' && $enable_guestposting == 0) { &fatal_error($txt{'165'}); }
##### Announcement Board Mod SP1.4 #####
&Check_Board_Type($FORM{'threadid'});
##### Announcement Board Mod SP1.4 #####
Sources/ManageBoards.pl
chomp $curboardname;
$descr = $boardinfo[1];
##### Announcement Board Mod SP1.4 #####
undef $starttype;
$starttype="$boardinfo[3]";
if ($starttype == 0) {
$start0checked = ' checked';
$start1checked = '';
$start2checked = '';
}
if ($starttype == 1) {
$start0checked = '';
$start1checked = ' checked';
$start2checked = '';
}
if ($starttype == 2) {
$start0checked = '';
$start1checked = '';
$start2checked = ' checked';
}
undef $replytype;
$replytype="$boardinfo[4]";
if ($replytype == 0) {
$reply0checked = ' checked';
$reply1checked = '';
$reply2checked = '';
}
if ($replytype == 1) {
$reply0checked = '';
$reply1checked = ' checked';
$reply2checked = '';
}
if ($replytype == 2) {
$reply0checked = '';
$reply1checked = '';
$reply2checked = ' checked';
}
##### Announcement Board Mod SP1.4 #####
sub ModifyBoard {
&is_admin;
if($FORM{'moda'} eq "$txt{'17'}") {
##### Announcement Board Mod SP1.4 #####
if (!$FORM{'startset'}) { $FORM{'startset'} == 0; }
if (!$FORM{'replyset'}) { $FORM{'replyset'} == 0; }
##### Announcement Board Mod SP1.4 #####
print FILE "$FORM{'descr'}\n";
print FILE "$mods\n";
##### Announcement Board Mod SP1.4 #####
print FILE "$FORM{'startset'}\n";
print FILE "$FORM{'replyset'}\n";
##### Announcement Board Mod SP1.4 #####
sub CreateBoard {
&is_admin;
$id = $FORM{'id'};
##### Announcement Board Mod SP1.4 #####
if (!$FORM{'startset'}) { $FORM{'startset'} == 0; }
if (!$FORM{'replyset'}) { $FORM{'replyset'} == 0; }
##### Announcement Board Mod SP1.4 #####
print FILE "$FORM{'boardname'}\n";
print FILE "$FORM{'descr'}\n";
print FILE "$mods\n";
##### Announcement Board Mod SP1.4 #####
print FILE "$FORM{'startset'}\n";
print FILE "$FORM{'replyset'}\n";
##### Announcement Board Mod SP1.4 #####
english.lng
$yycopyright = qq~Powered by YaBB $YaBBversion!
\nForum software copyright © 2000-2004 Yet another Bulletin Board~;
##### Announcement Board Mod SP1.4 #####
$annbtxt{'1'} = "Sorry, Only members are allowed to start new threads on this board.";
$annbtxt{'2'} = "Sorry, Only Administrators and Moderators are allowed to start new threads on this board.";
$annbtxt{'3'} = "Sorry, Only members may answer messages on this board.";
$annbtxt{'4'} = "Sorry, Only Administrators and Moderators may answer messages on this board.";
$annbtxt{'5'} = "Guests";
$annbtxt{'6'} = "Members";
$annbtxt{'7'} = "Admins&Mods";
$annbtxt{'8'} = "Start threads: ";
$annbtxt{'9'} = "Reply Allowed: ";
##### Announcement Board Mod SP1.4 #####