############################################################################### # Notify.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Software Version: YaBB 1 Gold - SP1 # # Released: December 2001 # # =========================================================================== # # Software Distributed by: http://yabb.xnull.com # # Support, News, Updates at: http://yabb.xnull.com/community/ # # =========================================================================== # # Copyright (c) 2000-2002 Xnull (www.xnull.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### $notifyplver = "1 Gold - SP1"; sub Notify { if( $currentboard eq '' ) { &fatal_error($txt{'1'}); } if($username eq "Guest") { &fatal_error("$txt{'138'}"); } # Check, if User already gets a notification fopen(FILE, "$datadir/$INFO{'thread'}.mail"); @mails = ; fclose(FILE); $isonlist = 0; foreach $curmail (@mails) { $curmail =~ s/[\n\r]//g; if($settings[2] eq "$curmail") { $isonlist = 1; } } if ($isonlist){ $yymain .= qq~
$txt{'125'}
$txt{'212'}
$txt{'163'} - $txt{'164'}
~; } else { $yymain .= qq~
$txt{'125'}
$txt{'126'}
$txt{'163'} - $txt{'164'}
~; } $yytitle = "$txt{'125'}"; &template; exit; } sub Notify2 { if( $currentboard eq '' ) { &fatal_error($txt{'1'}); } if($username eq 'Guest') { &fatal_error($txt{'138'}); } $thread = $INFO{'thread'}; $start = $INFO{'start'} ne '' ? $INFO{'start'} : 9999999; fopen(FILE, "$datadir/$thread.mail"); @mails = ; fclose(FILE); fopen(FILE, ">$datadir/$thread.mail", 1) || &fatal_error("$txt{'23'} $thread.mail"); print FILE "$settings[2]\n"; foreach $curmail (@mails) { $curmail =~ s/[\n\r]//g; if($settings[2] ne $curmail) { print FILE "$curmail\n"; } } fclose(FILE); $yySetLocation = qq~$cgi;action=display;num=$thread;start=$start~; &redirectexit; } sub Notify3 { if( $currentboard eq '' ) { &fatal_error($txt{'1'}); } if($username eq "Guest") { &fatal_error("$txt{'138'}"); } $thread = $INFO{'thread'}; $start = $INFO{'start'} ne '' ? $INFO{'start'} : 9999999; fopen(FILE, "$datadir/$thread.mail"); @mails = ; fclose(FILE); fopen(FILE, ">$datadir/$thread.mail", 1) || &fatal_error("$txt{'23'} $thread.mail"); foreach $curmail (@mails) { $curmail =~ s/[\n\r]//g; if($settings[2] ne "$curmail") { print FILE "$curmail\n"; } } fclose(FILE); $yySetLocation = qq~$cgi;action=display;num=$thread;start=$start~; &redirectexit; } sub Notify4 { if($username eq "Guest") { &fatal_error("$txt{'138'}"); } my( $variable, $dummy, $dummy2, $threadno, @mails, $curmail ); foreach $variable (keys %FORM) { $dummy = $FORM{$variable}; ($dummy2,$threadno) = split(/-/,$variable); if ($dummy2 eq "thread") { fopen(FILE, "$datadir/$threadno.mail"); @mails = ; fclose(FILE); fopen(FILE, ">$datadir/$threadno.mail") || &fatal_error("$txt{'23'} $threadno.mail"); foreach $curmail (@mails) { $curmail =~ s/[\n\r]//g; if($settings[2] ne $curmail) { print FILE "$curmail\n"; } } fclose(FILE); } } &ShowNotifications; } sub ShowNotifications { if($username eq "Guest") { &error("$txt{'138'}"); } my(@dirdata,@datdata,$filename,$entry,@entries,$mnum,$dummy,$msub,$mname,$memail,$mdate,$musername,$micon,$mattach,$mip,$mmessage,@messages,@found_number,@found_subject,@found_date,@found_username); # Read all .mail-Files and search for username opendir (DIRECTORY,"$datadir"); @dirdata = readdir(DIRECTORY); closedir (DIRECTORY); @datdata = grep(/mail/,@dirdata); # Load Censor List &LoadCensorList; foreach $filename (@datdata) { fopen(FILE, "$datadir/$filename"); @entries = ; fclose(FILE); foreach $entry (@entries) { $entry =~ s/[\n\r]//g; if ($entry eq $settings[2]) { ($mnum, $dummy) = split(/\./,$filename); fopen(FILE, "$datadir/$mnum.txt"); @messages = ; fclose(FILE); ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage) = split(/\|/,$messages[0]); push(@found_number,$mnum); push(@found_subject,$msub); push(@found_date,$mdate); push(@found_username,$musername); push(@found_name,$mname); } } } # Display all Entries $yymain .= qq~
$txt{'418'}

~; if (@found_number==0) { $yymain .= "$txt{'414'}

 "; } else { foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $found_subject[$counter] =~ s~\Q$tmpa\E~$tmpb~gi; } $yymain .= qq~
~; $counter=0; foreach $entry (@found_number) { &FormatUserName($found_username[$counter]); $yymain .= "~; $yymain .= qq~\n~; $counter++; } $yymain .= "\n"; $yymain .= qq~~; $yymain .= "
$txt{'415'}:
 
"; $yymain .= qq~$found_subject[$counter] $txt{'525'} $found_name[$counter]

$txt{'416'}
 
    

 \n"; } $yymain .= qq~
~; $yytitle = "$txt{'417'}"; &template; exit; } 1;