sub RepairBoards { &is_admin; unless( $maintenance ) { &fatal_error($txt{'611'}); } $yytitle = $txt{'612'}; &header; %users = (); %emails = (); %userslc = (); %nicknamess = (); %nicknameslc = (); keys %users = $#memberlist; keys %emails = $#memberlist; keys %userslc = $#memberlist; keys %nicknames = $#memberlist; keys %nicknameslc = $#memberlist; fopen(FILE, "$memberdir/memberlist.txt") || &fatal_error("1000 $txt{'106'}: $txt{'23'} memberlist.txt"); while( $musername = ) { $musername =~ s~[\n\r]~~g; if( $musername && fopen(FILE2, "$memberdir/$musername.dat") ) { $_ = ; $mname = ; $memail = ; fclose(FILE2); $mname =~ s~[\n\r]~~g; $memail =~ s~[\n\r]~~g; $musernamelc = lc $musername; $mnamelc = lc $mname; $users{$musername} = $mname; $emails{$musername} = $memail; $nicknames{$mname} = $musername; $userslc{$musernamelc} = $mname; $nicknameslc{$mnamelc} = $musername; } } fclose(FILE); @categories = (); fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); foreach $curcat (@categories) { chomp $curcat; fopen(FILE, "$boardsdir/$curcat.cat"); $catname{$curcat} = ; chomp $catname{$curcat}; $cataccess{$curcat} = ; chomp $cataccess{$curcat}; @catboards = ; fclose(FILE); print qq~
$txt{'613'}: $curcat / $catname{$curcat}
~; boardcheck: foreach $curboard (@catboards) { $curboard =~ s~[\n\r]~~g; print qq~$txt{'614'}: $curboard
~; fopen(FILE, "$boardsdir/$curboard.dat"); @boardinfo = ; fclose(FILE); chomp @boardinfo; @{$boardinfo{$curboard}} = @boardinfo; $cat{$curboard} = $curcat; fopen(FILE, "$boardsdir/$curboard.txt") || &fatal_error("1001 $txt{'106'}: $txt{'23'} $curboard.txt"); @threads = ; fclose(FILE); # Process Board Here # %ttimes = (); keys %ttimes = $#threads; $totalposts = 0; $totalthreads = 0; threadcheck: for( $threadnum = 0; $threadnum < @threads; ++$threadnum ) { $curthread = $threads[$threadnum]; $curthread =~ s~[\n\r]~~g; if( $curthread =~ m~\A\s*\Z~ ) { $threads[$threadnum] = ''; next threadcheck; } ($tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate, $tispoll) = split( /\|/, $curthread ); if( fopen(FILE, "$datadir/$tnum.txt") ) { @messages = ; fclose(FILE); } else { $threads[$threadnum] = ''; next threadcheck; } $treplies = 0; postcheck: for( $postnum = 0; $postnum < @messages; ++$postnum ) { $curpost = $messages[$postnum]; $curpost =~ s~[\n\r]~~g; if( $curpost =~ m~\A\s*\Z~ ) { $messages[$postnum] = ''; next postcheck; } ++$treplies; ($msub, $mname, $memail, $mdate, $musername, $icon, $mattach, $mip, $message, $mns, $mlm, $mlmb) = split(/\|/,$curpost); $mnamelc = lc $mname; $musernamelc = lc $musername; unless( $musername eq 'Guest' || exists $userslc{$musernamelc} ) { $musername = $nicknames{$mname} || $nicknameslc{$mnamelc} || 'Guest'; } if( $mlmb ) { $mlmblc = lc $mlmb; $mlmb = $users{ $nicknames{$mlmb} } || $userslc{ $nicknameslc{$mlmblc} } || $mlmb; } if( $musername ne 'Guest' && exists $users{$musername} ) { $mname = $users{$musername}; $memail = $emails{$musername}; } else { $musername = 'Guest'; $mname =~ s/\&/\&/g; $mname =~ s/"/\"/g; $mname =~ s/ / \ /g; $mname =~ s//>/g; $mname =~ s/\|/\|/g; $memail =~ s/\&/\&/g; $memail =~ s/"/\"/g; $memail =~ s/ / \ /g; $memail =~ s//>/g; $memail =~ s/\|//g; $mnamelc = lc $mname; if( exists $nicknameslc{$mnamelc} || exists $userslc{$mnamelc} ) { $mname .= " ($txt{'28'})"; } } $msub =~ s/\cM//g; $msub =~ s~<~<~g; $msub =~ s~>~>~g; $msub =~ s~"~"~g; $msub =~ s~|~\|~g; $msub =~ s~ ~ ~g; $msub =~ s~&~&~g; if (length($msub) > 50) { $msub = substr($msub,0,50); } $msub =~ s/\&/\&/g; $msub =~ s/"/\"/g; $msub =~ s/ / \ /g; $msub =~ s//>/g; $msub =~ s/\|/\|/g; $message =~ s/\cM//g; $message =~ s~<~<~g; $message =~ s~>~>~g; $message =~ s~"~"~g; $message =~ s~|~\|~g; $message =~ s~ \  \  \ ~\t~g; $message =~ s~ ~ ~g; $message =~ s~&~&~g; $message =~ s/
/\n/gi; $message =~ s~(\S{80})(?=\S)~$1\n~g; $message =~ s~\[([^\]]{0,30})\n([^\]]{0,30})\]~\[$1$2\]~g; $message =~ s~\[/([^\]]{0,30})\n([^\]]{0,30})\]~\[/$1$2\]~g; $message =~ s~(\w+://[^<>\s\n\"\]\[]+)\n([^<>\s\n\"\]\[]+)~$1$2~g; $message =~ s/\&/\&/g; $message =~ s/"/\"/g; $message =~ s/ / \ /g; $message =~ s//>/g; $message =~ s/\t/ \  \  \ /g; $message =~ s/\|/\|/g; $message =~ s~\n~
~g; &CheckIcon; $messages[$postnum] = qq~$msub|$mname|$memail|$mdate|$musername|$icon|$mattach|$mip|$message|$mns|$mlm|$mlmb\n~; if( $postnum == 0 ) { $tname = $mname; $temail = $memail; $tusername = $musername; $tsub = $msub; $ticon = $icon; } if( $postnum == $#messages ) { $tdate = $mdate; $lastposter = $musername eq 'Guest' ? qq~Guest-$mname~ : $musername; } } if( $treplies ) { --$treplies; if( fopen(FILE, ">$datadir/$tnum.txt") ) { print FILE @messages; fclose(FILE); $totalposts += $treplies + 1; ++$totalthreads; $ttimes{$threadnum} = stringtotime($tdate); $threads[$threadnum] = qq~$tnum|$tsub|$tname|$temail|$tdate|$treplies|$tusername|$ticon|$tstate\n~; if( fopen(FILE, "$datadir/$tnum.data") ) { $_ = ; ($views, $_) = split( /\|/, $_ ); fclose(FILE); } else { $views = 0; } if( fopen(FILE, ">$datadir/$tnum.data") ) { print FILE qq~$views|$lastposter|$pollcount|$lastpoller~; fclose(FILE); } } else { $treplies = -1; } } if( $treplies < 0 ) { unlink("$datadir/$tnum.txt"); unlink("$datadir/$tnum.mail"); unlink("$datadir/$tnum.data"); unlink("$datadir/$tnum.poll"); unlink("$datadir/$tnum.polled"); $threads[$threadnum] = ''; $ttimes{$threadnum} = 0; } print qq~~; } @threads = map { $_->[0] } sort { $b->[1] <=> $a->[1] } map { [ $threads[$_], $ttimes{$_} ] } keys %ttimes; if( fopen(FILE, ">$boardsdir/$curboard.txt", 1) ) { print FILE @threads; fclose(FILE); } ($tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate, $tispoll) = split( /\|/, $threads[0] ); if( fopen(FILE, "$datadir/$tnum.data") ) { $_ = ; ($views, $lastposter, $pollcount,$lastpoller) = split( /\|/, $_ ); fclose(FILE); } &BoardCountSet( $curboard, $totalthreads, $totalposts, $tdate, $lastposter ); #/ Process Board Here /# } } &BoardCatsMake; print qq~$txt{'51'}
~; &footer; exit; }