In-Thread Multi Delete 1.5 SP1.3 Allows admins/moderators/global Moderators (settable in admin center) to delete multiple posts within a thread quickly and easily. For the lazy types. Enjoy! Omario :) Thanks to Bhra Webmaster for amazing amounts of help! SP1.3 compatible version only Shoeb Omar http://www.muslimteens.net Sources/SubList.pl 'markasread',"MessageIndex.pl&MarkRead", 'multidel',"ModifyMessage.pl&MultiDel", Sources/ModifyMessage.pl 1; sub MultiDel { $yySetLocation = qq~$cgi;action=display;num=$INFO{'thread'};start=$INFO{'start'}~; $mkill = 0; $topickill = 0; fopen(FILE, "$datadir/$INFO{'thread'}.txt", 1) || &fatal_error("$txt{'23'} $INFO{'thread'}.txt"); @mess = ; fclose(FILE); $count = $#mess; $tnum = $INFO{'thread'}; fopen(AMV, "$vardir/attachments.txt"); my @attachments = ; fclose(AMV); # Find thread position in message index fopen(FILE, "$boardsdir/$currentboard.txt"); @threads = ; fclose(FILE); $tmpcount = 0; $threadpos = ''; foreach $curentry (@threads) { ($tmpa, $dummy) = split(/\|/, $curentry); if($INFO{'thread'} eq $tmpa) { $threadpos = $tmpcount; } $tmpcount++; } # check all checkboxes, delete posts if checkbox is ticked while (0 <= $count) { if ($FORM{"del$count"} ne '' && $threadpos ne ''){ ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns, $mlm, $mlmb, $msf, $mfn) = split( /\|/, $mess[$count] ); chomp $mfn; if(-e("$upload_dir/$mfn")) { $attachpos = $#attachments; while (0 <= $attachpos) { my ($amthreadid, $amreplies, $amthreadsub, $amposter, $amcurrentboard, $amkb, $amdate, $amfn) = split(/\|/,$attachments[$attachpos]); chomp $amfn; if($tnum eq $amthreadid) { if($amreplies eq $count) { splice(@attachments, $attachpos, 1); } elsif ($amreplies > $count) { $amreplies--; $attachments[$attachpos] = "$amthreadid|$amreplies|$amthreadsub|$amposter|$currentboard|$amkb|$amdate|$amfn\n"; } } $attachpos--; } unlink("$upload_dir/$mfn"); } if ($mess[1] eq '' || $mess[1] eq "\n"){ # if this is the only post, delete the files unlink("$datadir/$tnum.txt"); unlink("$datadir/$tnum.mail"); unlink("$datadir/$tnum.data"); unlink("$datadir/$tnum.poll"); unlink("$datadir/$tnum.polled"); unlink("$datadir/$tnum.polll"); splice(@threads, $threadpos, 1); $topickill = 1; $yySetLocation = qq~$cgi~; } else { # if this is not the only post, delete post splice(@mess, $count, 1); $mkill++; } } $count--; } # if thread has not been deleted from message index, update message index details ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns, $mlm, $mlmb) = split( /\|/, $mess[$#mess]); if ($topickill != 1 && $threadpos ne ''){ ($tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate) = split( /\|/, $threads[$threadpos] ); $treplies = $treplies - $mkill; $threads[$threadpos] = qq~$tnum|$tsub|$tname|$temail|$mdate|$treplies|$tusername|$ticon|$tstate~; # Save updated posts fopen(FILE, ">$datadir/$INFO{'thread'}.txt", 1) || &fatal_error("$txt{'23'} $threadid.txt"); print FILE @mess; fclose(FILE); # Update last poster information if( -e "$datadir/$INFO{'thread'}.data" ) { fopen(FILE, "$datadir/$INFO{'thread'}.data"); $tmpa = ; fclose(FILE); ($views,$dummy) = split(/\|/, $tmpa); fopen(FILE, "+>$datadir/$INFO{'thread'}.data"); print FILE qq~$views|$musername~; fclose(FILE); } } # Save updated attachments file fopen(FILE, ">$vardir/attachments.txt", 1) || &fatal_error("$txt{'23'} $threadid.txt"); foreach $row(@attachments) { chomp $row; print FILE qq~$row\n~; } fclose(FILE); # Save updated message index fopen(FILE, ">$boardsdir/$currentboard.txt", 1) || &fatal_error("$txt{'23'} $currentboard.txt"); print FILE @threads; fclose(FILE); # update board index details ($latestnum, $dummy) = split( /\|/, $threads[0] ); fopen(FILE, "$datadir/$latestnum.txt", 1) || &fatal_error("$txt{'23'} $latestnum.txt"); @mess = ; fclose(FILE); ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns, $mlm, $mlmb) = split( /\|/, $mess[$#mess]); my( $threadcount, $messagecount, $lastposttime, $lastposter ) = &BoardCountGet($currentboard); $messagecount = $messagecount - $mkill; if( $topickill == 1) { --$threadcount; --$messagecount; } &BoardCountSet( $currentboard, $threadcount, $messagecount, $mdate, $musername ); &redirectexit; } Sources/AdminEdit.pl my @onoff = qw/ allowpics showyabbcbutt showbdescrip maintenance guestaccess insert_original enable_ubbc enable_news enable_guestposting enable_notification showlatestmember showrecentbar showmarkread showmodify showuserpic showusertext showgenderimage shownewsfader MenuType curposlinks profilebutton autolinkurls emailpassword RegAgree emailwelcome allow_hide_email usetempfile faketruncation emailnewpass/; push(@onoff, "mdadmin", "mdglobal", "mdmod"); my($snfchecked, $fls1, $fls2, $fls3, $utfchecked, $truncchecked, $mts1, $mts2, $mts3, $tsl6, $tsl5, $tsl4, $tsl3, $tsl2, $tsl1); my($mdadchecked, $mdglchecked, $mdmochecked); if ($maintenance) { $mainchecked = ' checked'; } if ($mdadmin) { $mdadchecked = ' checked'; } if ($mdglobal) { $mdglchecked = ' checked'; } if ($mdmod) { $mdmochecked = ' checked'; } $timeout = $FORM{'timeout'} || 5; $mdadmin = $FORM{'mdadmin'} || 0; $mdglobal = $FORM{'mdglobal'} || 0; $mdmod = $FORM{'mdmod'} || 0; $txt{'498'}
$mdintxt{'1'}
$mdintxt{'2'}   
########## Feature Settings ########## \$mdadmin = $mdadmin; \$mdglobal = $mdglobal; \$mdmod = $mdmod; english.lng $txt{'749'} = "The 'number of posts' box can only contain digits."; $mdintxt{'1'} = "Enable Multi Delete for:"; $mdintxt{'2'} = "1st Checkbox Admins, 2nd: Global Modearators, 3rd: Moderators"; $mdintxt{'3'} = "Delete Selected"; Sources/Display.pl
$yymain .= qq~ $menusep$img{'delete'}~; if((exists $moderators{$username} && $mdmod eq 1) || ($settings[7] eq 'Administrator' && $mdadmin eq 1) || ($settings[7] eq 'Global Moderator' && $mdglobal eq 1)) { $yymain .= qq~ ~; } ~; } if((exists $moderators{$username} && $mdmod eq 1) || ($settings[7] eq 'Administrator' && $mdadmin eq 1) || ($settings[7] eq 'Global Moderator' && $mdglobal eq 1)) { if ($mstate != 1) {$yymain .= qq~~;} }