Announcement Boards w/ Poll Mod
1.3f (Polls)
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.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
!!This Mod Updated to work AFTER installation of Embedded Polls!!
DaveB, Sniser, [CV]XXL
http://www.davesworldzone.com
Sources/Post.pl
sub Post {
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("Sorry, only members may start threads on this board.");
}
} elsif ($blah[3] == 2) {
if ($settings[7] ne 'Administrator' && !exists $moderators{$username}) {
&fatal_error("Sorry, only admins and moderators may start threads on this board.");
}
}
} else {
if ($blah[4] == 1) {
if ($username eq 'Guest') {
&fatal_error("Sorry, only members may reply on this board.");
}
} elsif ($blah[4] == 2) {
if ($settings[7] ne 'Administrator' && !exists $moderators{$username}) {
&fatal_error("Sorry, only admins and moderators may reply on this board.");
}
}
}
}
$notification = ! $enable_notification || $username eq 'Guest' ? '' : <<"EOT";
&Check_Board_Type($threadid);
if($username eq 'Guest' && $enable_guestposting == 0) { &fatal_error($txt{'165'}); }
&Check_Board_Type($FORM{'threadid'});
Sources/ManageBoards.pl
$descr="$boardinfo[1]";
## Announcement Mod ##
undef $starttype;
$starttype="$boardinfo[4]";
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[5]";
if ($replytype == 0) {
$reply0checked = ' checked';
$reply1checked = '';
$reply2checked = '';
}
if ($replytype == 1) {
$reply0checked = '';
$reply1checked = ' checked';
$reply2checked = '';
}
if ($replytype == 2) {
$reply0checked = '';
$reply1checked = '';
$reply2checked = ' checked';
}
## /End of Announcement Mod ##
if($FORM{'moda'} eq "$txt{'17'}") {
if (!$FORM{'startset'}) { $FORM{'startset'} == 0; }
if (!$FORM{'replyset'}) { $FORM{'replyset'} == 0; }
print FILE "$FORM{'moderator'}\n";
print FILE "$FORM{'startset'}\n";
print FILE "$FORM{'replyset'}\n";
$id="$FORM{'id'}";
if (!$FORM{'startset'}) { $FORM{'startset'} == 0; }
if (!$FORM{'replyset'}) { $FORM{'replyset'} == 0; }
print FILE "$FORM{'moderator'}|\n";
print FILE "$FORM{'startset'}\n";
print FILE "$FORM{'replyset'}\n";