############################################################################### # Printpage.pm # # $Date: 01.09.2026 $ # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBBForum 3.1 # # Packaged: 01 Sep, 2026 # # Distributed by: https://yabbforum.nz # # =========================================================================== # # Copyright (c) 2000-2026 YaBB (yabbforum.nz) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### use CGI::Carp qw(fatalsToBrowser); our $VERSION = '3.1'; $printpagepmver = 'YaBBForum 3.1'; if ( $action eq 'detailedversion' ) { return 1; } get_micon(); sub Print_IM { if ($iamguest) { fatal_error('not_allowed'); } LoadLanguage('InstantMessage'); my ( $fromTitle, $toTitle, $toTitleCC, $toTitleBCC, $usernameFrom, $usernameTo, $usernameCC, $usernameBCC, $pmAttachment, $pmShowAttach, $pmAttachments, %attach_gif ); if ( $INFO{'caller'} == 1 ) { fopen( THREADS, "$memberdir/$username.msg" ) || donoopen(); $boxtitle = qq~$inmes_txt{'inbox'}~; } elsif ( $INFO{'caller'} == 2 ) { fopen( THREADS, "$memberdir/$username.outbox" ) || donoopen(); $boxtitle = qq~$inmes_txt{'outbox'}~; } elsif ( $INFO{'caller'} == 3 ) { fopen( THREADS, "$memberdir/$username.imstore" ) || donoopen(); $boxtitle = qq~$inmes_txt{'storage'}~; $storetitle = qq~$INFO{'viewfolder'}~; } elsif ( $INFO{'caller'} == 5 ) { fopen( THREADS, "$memberdir/broadcast.messages" ) || donoopen(); $boxtitle = qq~$inmes_txt{'broadcast'}~; } @threads = ; fclose(THREADS); $threadid = $INFO{'id'}; foreach my $thread (@threads) { chomp $thread; if ( $thread =~ /$threadid/xsm ) { ( undef, $threadposter, $threadtousers, $threadccusers, $threadbccusers, $threadtitle, $threaddate, $threadpost, undef, undef, undef, $threadstatus, undef, $fold, $threadAttach ) = split /\|/xsm, $thread; if ( $INFO{'caller'} == 3 ) { $folder = ucfirst $fold; $boxtitle .= qq~ >> $folder~; } } } $printDate = timeformat( $date, 1 ); # Lets output all that info. if ($yycharset) {$yymycharset = $yycharset;} $output = qq~ $mbname - $maintxt{'668'}
$mbname
$load_imtxt{'71'} $inmes_txt{'usercp'} >> $boxtitle $storetitle $inmes_txt{'30'} $printDate
$scripturl?action=imshow;caller=$INFO{'caller'};id=$INFO{'id'}

~; $threadDate = timeformat( $threaddate, 1 ); if ( $INFO{'caller'} == 1 ) { if ($threadtousers) { foreach my $uname ( split /,/xsm, $threadtousers ) { LoadUser($uname); $usernameTo .= ( ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernameTo =~ s/, $//sm; $usernameTo = qq~$usernameTo
~; $toTitle = qq~$inmes_txt{'324'}:~; } if ($threadccusers) { foreach my $uname ( split /,/xsm, $threadccusers ) { LoadUser($uname); $usernameCC .= ( ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; } $usernameCC =~ s/, $//sm; $usernameCC = qq~$usernameCC
~; $toTitleCC = qq~$inmes_txt{'325'}:~; } if ($threadbccusers) { foreach my $uname ( split /,/xsm, $threadbccusers ) { if ( $uname eq $username ) { LoadUser($uname); $usernameBCC = ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ); } } if ($usernameBCC) { $usernameBCC = qq~$usernameBCC~; $toTitleBCC = qq~$inmes_txt{'326'}:~; } } if ( $threadstatus eq 'g' || $threadstatus eq 'ga' ) { my ( $guestName, $guestEmail ) = split / /sm, $threadposter; $guestName =~ s/%20/ /gsm; $usernameFrom = qq~$guestName ($guestEmail)
~; } else { LoadUser($threadposter); $usernameFrom = ${ $uid . $threadposter }{'realname'} ? ${ $uid . $threadposter }{'realname'} : ( $threadposter ? qq~$threadposter ($maintxt{'470a'})~ : $maintxt{'470a'} ); # 470a == Ex-Member $usernameFrom = qq~$usernameFrom
~; } $fromTitle = qq~$inmes_txt{'318'}:~; } chomp $threadAttach; if ( $threadAttach ne q{} ) { LoadLanguage('FA'); foreach ( split /,/xsm, $threadAttach ) { my ( $pmAttachFile, undef ) = split /~/xsm, $_; if ( $pmAttachFile =~ /\.(.+?)$/sm ) { $ext = lc $1; } if ( !exists $attach_gif{$ext} ) { $attach_gif{$ext} = ( $ext && -e "$htmldir/Templates/Forum/$useimages/$att_img{$ext}" ) ? "$imagesdir/$att_img{$ext}" : "$micon_bg{'paperclip'}"; } my $filesize = -s "$pmuploaddir/$pmAttachFile"; if ($filesize) { if ( $pmAttachFile =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ism && $pmDisplayPics == 1 ) { $imagecount++; $pmShowAttach .= qq~
$pmAttachFile ( ~ . int( $filesize / 1024 ) . qq~ KB)
$pmAttachFile
\n~; } else { $pmAttachment .= qq~
$pmAttachFile ( ~ . int( $filesize / 1024 ) . q~ KB)
~; } } else { $pmAttachment .= qq~
$pmAttachFile ($fatxt{'1'})
~; } } if ( $pmShowAttach && $pmAttachment ) { $pmAttachment =~ s/
/
/gsm; } $pmAttachments .= qq~
$pmAttachment $pmShowAttach~; } elsif ( $INFO{'caller'} == 2 ) { LoadUser($threadposter); $usernameFrom = ${ $uid . $threadposter }{'realname'} ? ${ $uid . $threadposter }{'realname'} : ( $threadposter ? qq~$threadposter ($maintxt{'470a'})~ : $maintxt{'470a'} ); # 470a == Ex-Member $usernameFrom = qq~$usernameFrom
~; $fromTitle = qq~$inmes_txt{'318'}:~; if ( $threadstatus !~ /b/sm ) { if ( $threadstatus !~ /gr/sm ) { foreach my $uname ( split /,/xsm, $threadtousers ) { LoadUser($uname); $usernameTo .= ( ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } } else { my ( $guestName, $guestEmail ) = split / /sm, $threadtousers; $guestName =~ s/%20/ /gxsm; $usernameTo = qq~$guestName ($guestEmail)~; } $toTitle = qq~$inmes_txt{'324'}:~; } else { require Sources::InstantMessage; foreach my $uname ( split /,/xsm, $threadtousers ) { $usernameTo .= links_to($uname); } $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; } $usernameTo =~ s/, $//sm; $usernameTo = qq~$usernameTo
~; if ($threadccusers) { foreach my $uname ( split /,/xsm, $threadccusers ) { LoadUser($uname); $usernameCC .= ( ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernameCC =~ s/, $//sm; $usernameCC = qq~$usernameCC
~; $toTitleCC = qq~$inmes_txt{'325'}:~; } if ($threadbccusers) { foreach my $uname ( split /,/xsm, $threadbccusers ) { LoadUser($uname); $usernameBCC .= ( ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernameBCC =~ s/, $//sm; $usernameBCC = qq~$usernameBCC~; $toTitleBCC = qq~$inmes_txt{'326'}:~; } } elsif ( $INFO{'caller'} == 3 ) { if ( $threadstatus !~ /b/sm ) { if ( $threadstatus !~ /gr/sm ) { foreach my $uname ( split /,/xsm, $threadtousers ) { LoadUser($uname); $usernameTo .= ( ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } } else { my ( $guestName, $guestEmail ) = split / /sm, $threadtousers; $guestName =~ s/%20/ /gsm; $usernameTo = qq~$guestName ($guestEmail)~; } $toTitle = qq~$inmes_txt{'324'}:~; if ( $threadccusers && $threadposter eq $username ) { foreach my $uname ( split /,/xsm, $threadccusers ) { LoadUser($uname); $usernameCC .= ( ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernameCC =~ s/, $//sm; $usernameCC = qq~$usernameCC
~; $toTitleCC = qq~$inmes_txt{'325'}:~; } if ( $threadbccusers && $threadposter eq $username ) { foreach my $uname ( split /,/xsm, $threadbccusers ) { LoadUser($uname); $usernameBCC .= ( ${ $uid . $uname }{'realname'} ? ${ $uid . $uname }{'realname'} : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernameBCC =~ s/, $//sm; $usernameBCC = qq~$usernameBCC~; $toTitleBCC = qq~$inmes_txt{'326'}:~; } } else { foreach my $uname ( split /,/xsm, $threadtousers ) { require Sources::InstantMessage; $usernameTo .= links_to($uname); } $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; } $usernameTo =~ s/, $//sm; $usernameTo = qq~$usernameTo
~; if ( $threadstatus eq 'g' || $threadstatus eq 'ga' ) { my ( $guestName, $guestEmail ) = split / /sm, $threadposter; $guestName =~ s/%20/ /gsm; $usernameFrom = qq~$guestName ($guestEmail)~; } else { LoadUser($threadposter); $usernameFrom = ${ $uid . $threadposter }{'realname'} ? ${ $uid . $threadposter }{'realname'} : ( $threadposter ? qq~$threadposter ($maintxt{'470a'})~ : $maintxt{'470a'} ); # 470a == Ex-Member } $usernameFrom = qq~$usernameFrom
~; $fromTitle = qq~$inmes_txt{'318'}:~; } elsif ( $INFO{'caller'} == 5 && ( $threadstatus eq 'g' || $threadstatus eq 'ga' ) ) { my ( $guestName, $guestEmail ) = split / /sm, $threadposter; $guestName =~ s/%20/ /gsm; $usernameFrom = qq~$guestName ($guestEmail)
~; $fromTitle = qq~$inmes_txt{'318'}:~; } elsif ( $INFO{'caller'} == 5 && $threadstatus =~ /b/sm ) { if ($threadtousers) { require Sources::InstantMessage; # Needed for To Member Groups foreach my $uname ( split /,/xsm, $threadtousers ) { $usernameTo .= links_to($uname); } $usernameTo =~ s/, $//sm; $usernameTo .= q~
~; $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; } LoadUser($threadposter); $usernameFrom = ${ $uid . $threadposter }{'realname'} ? ${ $uid . $threadposter }{'realname'} : ( $threadposter ? qq~$threadposter ($maintxt{'470a'})~ : $maintxt{'470a'} ); # 470a == Ex-Member $usernameFrom = qq~$usernameFrom
~; $fromTitle = qq~$inmes_txt{'318'}:~; } do_print(); $output .= qq~
$inmes_txt{'70'}: $threadtitle
$inmes_txt{'317'}: $threadDate
$toTitle $usernameTo $fromTitle $usernameFrom $toTitleCC $usernameCC $toTitleBCC $usernameBCC
$threadpost $pmAttachments

~; $output .= qq~
$yycopyright
~; image_resize(); print_output_header(); print_HTML_output_and_finish(); return; } sub Print { $num = $INFO{'num'}; $post = $INFO{'post'}; # Determine category $curcat = ${ $uid . $currentboard }{'cat'}; MessageTotals( 'load', $num ); my $ishidden; if ( ${$num}{'threadstatus'} =~ /h/ism ) { $ishidden = 1; } if ( $ishidden && !$staff ) { fatal_error('no_access'); } # Figure out the name of the category get_forum_master(); ( $cat, $catperms ) = split /\|/xsm, $catinfo{"$curcat"}; ( $boardname, $boardperms, $boardview ) = split /\|/xsm, $board{"$currentboard"}; LoadCensorList(); # Lets open up the thread file itself if ( !ref $thread_arrayref{$num} ) { fopen( THREADS, "$datadir/$num.txt" ) || donoopen(); @{ $thread_arrayref{$num} } = ; fclose(THREADS); } $cat =~ s/\n//gxsm; ( $messagetitle, $poster, undef, $date, undef ) = split /\|/xsm, ${ $thread_arrayref{$num} }[0]; $startedby = $poster; $startedon = timeformat( $date, 1 ); ToChars($messagetitle); ( $messagetitle, undef ) = Split_Splice_Move( $messagetitle, 0 ); my $pageTitle = $post ? $maintxt{'668a'} : $maintxt{'668'}; ### Lets output all that info. ### if ($yycharset) {$yymycharset = $yycharset;} $output = qq~ $mbname - $pageTitle
$mbname
$cat >> $boardname >> $messagetitle
$scripturl?num=$num

$maintxt{'195'} $startedby $maintxt{'30'} $startedon

~; LoadLanguage('FA'); # Split the threads up so we can print them. $postnum = 0; foreach my $thread ( @{ $thread_arrayref{$num} } ) { $postnum++; ( $threadtitle, $threadposter, undef, $threaddate, undef, undef, undef, undef, $threadpost, undef, undef, undef, $attachments ) = split /\|/xsm, $thread; if ( $post && ( $post ne $postnum ) ) { next; ( $threadtitle, $threadposter, undef, $threaddate, undef, undef, undef, undef, $threadpost, undef, undef, undef, $attachments ) = split /\|/xsm, @{ $thread_arrayref{$num} }[$post]; last; } ( $threadtitle, undef ) = Split_Splice_Move( $threadtitle, 0 ); ( $threadpost, undef ) = Split_Splice_Move( $threadpost, $num ); do_print(); $output .= qq~
$maintxt{'196'}: $threadtitle
$maintxt{'197'} $threadposter $maintxt{'30'} $threaddate
$threadpost~; chomp $attachments; if ($attachments) { # store all downloadcounts in variable if ( !%attach_count ) { my ( $atfile, $atcount ); fopen( ATM, "$vardir/attachments.txt" ); while () { ( undef, undef, undef, undef, undef, undef, undef, $atfile, $atcount ) = split /\|/xsm, $_; $attach_count{$atfile} = $atcount; } fclose(ATM); if ( !%attach_count ) { $attach_count{'no_attachments'} = 1; } } my $attachment = q{}; my $showattach = q{}; foreach ( split /,/xsm, $attachments ) { if ( $_ =~ /\.(.+?)$/xsm ) { $ext = lc $1; } if ( !exists $attach_gif{$ext} ) { $attach_gif{$ext} = ( $ext && -e "$htmldir/Templates/Forum/$useimages/$att_img{$ext}" ) ? "$imagesdir/$att_img{$ext}" : "$micon_bg{'paperclip'}"; } my $filesize = -s "$uploaddir/$_"; $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : isempty( $fatxt{'41c'}, $fatxt{'41a'} ); if ($filesize) { if ( $_ =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ixsm && $amdisplaypics == 1 ) { $imagecount++; $showattach .= qq~
$_ ( ~ . int( $filesize / 1024 ) . qq~ KB | $attach_count{$_} $download_txt )
\n~; } else { $attachment .= qq~
$scripturl?action=downloadfile;file=$_ ( ~ . int( $filesize / 1024 ) . qq~ KB | $attach_count{$_} $download_txt )
~; } } else { $attachment .= qq~
$_ ($fatxt{'1'}~ . ( exists $attach_count{$_} ? qq~ | $attach_count{$_} $download_txt ~ : q{} ) . q~)
~; } } if ( $showattach && $attachment ) { $attachment =~ s/
/
/gsm; } $output .= qq~
$attachment $showattach~; } $output .= q~

~; } $output .= qq~

$yycopyright
~; image_resize(); print_output_header(); print_HTML_output_and_finish(); return; } sub codemsg { my ($code) = @_; my %killhash = ( q{;} => ';', q{!} => '!', q{(} => '(', q{)} => ')', q{-} => '-', q{.} => '.', q{/} => '/', q{:} => ':', q{?} => '?', q{[} => '[', q{\\} => '\', q{]} => ']', q{^} => '^', ); if ( $code !~ /&\S*;/xsm ) { $code =~ s/;/&\x23059;/gxsm; } $code =~ s/([\(\)\-\:\\\/\?\!\]\[\.\^])/$killhash{$1}/gxsm; $_ = q~
Code:
CODE
~; $_ =~ s/CODE/$code/gxsm; return $_; } sub donoopen { print qq~Content-Type: text/html\r\n\r\n $maintxt{'199'}

$maintxt{'199'}

~ or croak "$croak{'print'}"; exit; } sub do_print { $threadpost =~ s/\[reason\](.+?)\[\/reason\]//isgxm; $threadpost =~ s/
/\n/igxsm; $threadpost =~ s/\[highlight(.*?)\](.*?)\[\/highlight\]/$2/isgxm; $threadpost =~ s/\[code\s*(.+?)\]\n*(.+?)\n*\[\/code\]/
Code ($1):<\/b>
$2<\/span><\/td><\/tr><\/table><\/td><\/tr><\/table>/isgm; $threadpost =~ s/\[([^\]]{0,30})\n([^\]]{0,30})\]/\[$1$2\]/gxsm; $threadpost =~ s/\[\/([^\]]{0,30})\n([^\]]{0,30})\]/\[\/$1$2\]/gxsm; $threadpost =~ s/(\w+:\/\/[^<>\s\n\"\]\[]+)\n([^<>\s\n\"\]\[]+)/$1\n$2/gxsm; $threadpost =~ s/\[b\](.*?)\[\/b\]/$1<\/b>/isgxm; $threadpost =~ s/\[i\](.*?)\[\/i\]/$1<\/i>/isgxm; $threadpost =~ s/\[u\](.*?)\[\/u\]/$1<\/span>/isgm; $threadpost =~ s/\[s\](.*?)\[\/s\]/$1<\/s>/isgxm; $threadpost =~ s/\[move\](.*?)\[\/move\]/$1/isgxm; $threadpost =~ s/\[glow(.*?)\](.*?)\[\/glow\]/&elimnests($2)/eisgxm; $threadpost =~ s/\[shadow(.*?)\](.*?)\[\/shadow\]/&elimnests($2)/eisgxm; $threadpost =~ s/\[shadow=(\S+?),(.+?),(.+?)\](.+?)\[\/shadow\]/$4/eisgxm; $threadpost =~ s/\[glow=(\S+?),(.+?),(.+?)\](.+?)\[\/glow\]/$4/eisgxm; $threadpost =~ s/\[color=([\w#]+)\](.*?)\[\/color\]/$2/isgxm; $threadpost =~ s/\[black\](.*?)\[\/black\]/$1/isgxm; $threadpost =~ s/\[white\](.*?)\[\/white\]/$1/isgxm; $threadpost =~ s/\[red\](.*?)\[\/red\]/$1/isgxm; $threadpost =~ s/\[green\](.*?)\[\/green\]/$1/isgxm; $threadpost =~ s/\[blue\](.*?)\[\/blue\]/$1/isgxm; $threadpost =~ s/\[font=(.+?)\](.+?)\[\/font\]/$2<\/span>/isgm; while ( $threadpost =~ s/\[size=(.+?)\](.+?)\[\/size\]/sizefont($1,$2)/eisgxm ) { } $threadpost =~ s/\[quote\s+author=(.*?)\s+link=(.*?)\].*\/me\s+(.*?)\[\/quote\]/\[quote author=$1 link=$2\]* $1 $3<\/i>\[\/quote\]/isgm; $threadpost =~ s/\[quote(.*?)\].*\/me\s+(.*?)\[\/quote\]/\[quote$1\]* Me $2<\/i>\[\/quote\]/isgm; $threadpost =~ s/\/me\s+(.*)/* $displayname $1/igsm; #*/ make my syntax checker happy # Images in message $threadpost =~ s/\[img(.*?)\](.*?)\[\/img\]/ imagemsg($1,$2) /eisgm; $threadpost =~ s/\[tt\](.*?)\[\/tt\]/$1<\/tt>/isgxm; $threadpost =~ s/\[left\](.*?)\[\/left\]/
$1<\/div>/isgm; $threadpost =~ s/\[center\](.*?)\[\/center\]/
$1<\/div>/isgm; $threadpost =~ s/\[right\](.*?)\[\/right\]/
$1<\/div>/isgm; $threadpost =~ s/\[justify\](.*?)\[\/justify\]/
$1<\/div>/isgm; $threadpost =~ s/\[sub\](.*?)\[\/sub\]/$1<\/sub>/isxgm; $threadpost =~ s/\[sup\](.*?)\[\/sup\]/$1<\/sup>/isgxm; $threadpost =~ s/\[fixed\](.*?)\[\/fixed\]/$1<\/span>/isgm; $threadpost =~ s/\[\[/\{\{/gxsm; $threadpost =~ s/\]\]/\}\}/gxsm; $threadpost =~ s/\|/\|/gxsm; $threadpost =~ s/\[hr\]\n/
/gsm; $threadpost =~ s/\[hr\]/
/gsm; $threadpost =~ s/\[br\]/\n/igxsm; $threadpost =~ s/\[flash\](.*?)\[\/flash\]/\[media\]$1\[\/media\]/isgxm; $threadpost =~ s/\[url=\s*(.+?)\s*\]\s*(.+?)\s*\[\/url\]/format_url2($1, $2)/eisgxm; $threadpost =~ s/\[url\]\s*(\S+?)\s*\[\/url\]/format_url3($1)/eisgxm; if ($autolinkurls) { $threadpost =~ s/\[url\]\s*([^\[]+)\s*\[\/url\]/[url]$1\[\/url]/gxsm; $threadpost =~ s/\[link\]\s*([^\[]+)\s*\[\/link\]/[link]$1\[\/link]/gxsm; $threadpost =~ s/\[news\](\S+?)\[\/news\]/$1<\/a>/isgm; $threadpost =~ s/\[gopher\](\S+?)\[\/gopher\]/$1<\/a>/isgm; $threadpost =~ s/">/\x22>/gxsm; $threadpost =~ s/(\[\*\])/ $1/gsm; $threadpost =~ s/(\[\/list\])/ $1/gsm; $threadpost =~ s/(\[\/tr\])/ $1/gsm; $threadpost =~ s/(\[\/td\])/ $1/gsm; $threadpost =~ s/\\S+?\<\/\S+?\>)]+?)\.(?:[\w\~\.\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%\(\)\[\]\x80-\xFF]{1,})+?)/format_url($1,$2)/eisgm; $threadpost =~ s/([^\"\=\[\]\/\:\.\-(\:\/\/\w+)]|[\n\b]|\"\;|\[quote.*?\]|\[edit\]|\[highlight\]|\[\*\]|\[td\]|\A|\()\\*(www\.[^\.](?:[\w\~\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%\(\)\[\](?:\<\S+?\>\S+?\<\/\S+?\>)]+?)\.(?:[\w\~\.\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%\(\)\[\]\x80-\xFF]{1,})+?)/format_url($1,$2)/eisgm; $threadpost =~ s/\$2<\/a>/isgm; $threadpost =~ s/\[url=\s*(.+?)\]\s*(.+?)\s*\[\/url\]/$2<\/a>/isgm; $threadpost =~ s/\[link\]\s*www\.\s*(.+?)\s*\[\/link\]/www.$1<\/a>/isgm; $threadpost =~ s/\[link=\s*(\w+\:\/\/.+?)\](.+?)\s*\[\/link\]/$2<\/a>/isgm; $threadpost =~ s/\[link=\s*(.+?)\]\s*(.+?)\s*\[\/link\]/$2<\/a>/isgm; $threadpost =~ s/\[link\]\s*(.+?)\s*\[\/link\]/$1<\/a>/isgm; $threadpost =~ s/\[ftp\]\s*(.+?)\s*\[\/ftp\]/$1<\/a>/isgm; } else { $threadpost =~ s/\[url=\s*(\S\w+\:\/\/\S+?)\s*\](.+?)\[\/url\]/$2<\/a>/isgm; $threadpost =~ s/\[url=\s*(\S+?)\](.+?)\s*\[\/url\]/$2<\/a>/isgm; $threadpost =~ s/\[link\]\s*www\.(\S+?)\s*\[\/link\]/www.$1<\/a>/isgm; $threadpost =~ s/\[link=\s*(\S\w+\:\/\/\S+?)\s*\](.+?)\[\/link\]/$2<\/a>/isgm; $threadpost =~ s/\[link=\s*(\S+?)\](.+?)\s*\[\/link\]/$2<\/a>/isgm; $threadpost =~ s/\[link\]\s*(\S+?)\s*\[\/link\]/$1<\/a>/isgm; $threadpost =~ s/\[ftp\]\s*(ftp:\/\/)?(.+?)\s*\[\/ftp\]/$1$2<\/a>/isgm; } $threadpost =~ s/(dereferer\;url\=http\:\/\/.*?)#(\S+?\")/$1;anch=$2/isgm; if ( $guest_media_disallowed && $iamguest ) { my $oops = qq~ $maintxt{'40'}  $maintxt{'41'} $maintxt{'34'}~; if ($regtype) { $oops .= qq~ $maintxt{'42'} $maintxt{'97'}~; } $threadpost =~ s//[oops]/gsm; $threadpost =~ s/\[media\].*?\[\/media\]/[oops]/isgxm; $threadpost =~ s/\[oops\]/$oops/gxsm; } $threadpost =~ s/\[media\](.*?)\[\/media\]/$1/isgxm; $threadpost =~ s/\[email\]\s*(\S+?\@\S+?)\s*\[\/email\]/$1/isgxm; $threadpost =~ s/\[email=\s*(\S+?\@\S+?)\]\s*(.*?)\s*\[\/email\]/$2 ($1)/isgm; $threadpost =~ s/\[news\](.+?)\[\/news\]/$1/isgxm; $threadpost =~ s/\[gopher\](.+?)\[\/gopher\]/$1/isgxm; $threadpost =~ s/\[ftp\](.+?)\[\/ftp\]/$1/isgxm; while ( $threadpost =~ /\[quote\s+author=(.*?)\slink=.*?\s+date=(.*?)\s*\]\n*.*?\n*\[\/quote\]/ism ) { my $author = $1; my $date = timeformat( $2, 1 ); if ($author) { # out of YaBBC.pm -> sub quotemsg { ToChars($author); if ( !-e "$memberdir/$author.vars" ) { # if the file is there it is an unencrypted user ID $author = decloak($author); # if not, decrypt it and see if it is a regged user if ( !-e "$memberdir/$author.vars" ) { # if still not found probably the author is a screen name $testauthor = MemberIndex( 'check_exist', "$author" ); # check if this name exists in the memberlist if ( $testauthor ne q{} ) { # if it is, load the user id returned $author = $testauthor; LoadUser($author); $author = ${ $uid . $author }{'realname'}; # set final author var to the current users screen name } else { $author = decloak($author); # if all fails it is a non existing real name so decode and asign as screenname } } else { LoadUser($author); # after encoding the user ID was found and loaded, setting the current real name $author = ${ $uid . $author }{'realname'}; } } else { LoadUser($author); # it was an old style user id which could be loaded and screen name set to final author $author = ${ $uid . $author }{'realname'}; } } $threadpost =~ s/\[quote\s+author=.*?link=.*?\s+date=.*?\s*\]\n*(.*?)\n*\[\/quote\]/
$author $maintxt{'30a'} $date:<\/i>
$1<\/td><\/tr><\/table>/ism; } $threadpost =~ s/\[quote\]\n*(.+?)\n*\[\/quote\]/
$maintxt{'31'}:<\/i>
$1<\/td><\/tr><\/table>/isgm; ## list code from YaBBC.pm - DAR ## $threadpost =~ s/\s*\[\*\]/<\/li>
  • /isgm; $threadpost =~ s/\[olist\]/
      /isgm; $threadpost =~ s/\s*\[\/olist\]/<\/li><\/ol>/isgm; $threadpost =~ s/<\/li>
        /
          /isgm; $threadpost =~ s/
            <\/li>/
              /isgm; $threadpost =~ s/\[list\]/
                /isgm; $threadpost =~ s/\[list (.+?)\]/
                  /isgm; $threadpost =~ s/\s*\[\/list\]/<\/li><\/ul>/isgm; $threadpost =~ s/<\/li>
                    /
                      /isgm; $threadpost =~ s/
                        <\/li>/
                          /isgm; $threadpost =~ s/<\/li>
                            /
                              /isgm; $threadpost =~ s/
                                <\/li>/
                                  /isgm; $threadpost =~ s/\[pre\](.+?)\[\/pre\]/'
                                  ' . dopre($1) . '<\/pre>'/isegm;
                                  
                                      $threadpost =~ s/\[flash=(\S+?),(\S+?)\](\S+?)\[\/flash\]/$3/isxgm;
                                  
                                      $threadpost =~ s/\{\{/\[/gxsm;
                                      $threadpost =~ s/\}\}/\]/gxsm;
                                  
                                      if ( $threadpost =~ m{\[table\]}ixsm ) {
                                          $threadpost =~
                                  s/\n{0,1}\[table\]\n*(.+?)\n*\[\/table\]\n{0,1}/$1<\/table>/isgxm;
                                          while ( $threadpost =~
                                  s/\(.*?)\n*\[tr\]\n*(.*?)\n*\[\/tr\]\n*(.*?)\<\/table\>/
                                  $1$2<\/tr>$3<\/table>/isxm ) { } while ( $threadpost =~ s/\(.*?)\n*\[td\]\n{0,1}(.*?)\n{0,1}\[\/td\]\n*(.*?)\<\/tr\>/$1
                                  $2<\/td>$3<\/tr>/isxm ) { } } $threadpost =~ s/\[\&table(.*?)\]//gxsm; $threadpost =~ s/\[\/\&table\]/<\/table>/gxsm; $threadpost =~ s/\n/
                                  /igsm; ### Censor it ### $threadtitle = Censor($threadtitle); $threadpost = Censor($threadpost); ToChars($threadtitle); ToChars($threadpost); $threaddate = timeformat( $threaddate, 1 ); return; } sub imagemsg { # out of YaBBC.pm -> sub imagemsg { my ( $attribut, $url ) = @_; # use or kill urls $url =~ s/\[url\](.*?)\[\/url\]/$1/igxsm; $url =~ s/\[link\](.*?)\[\/link\]/$1/igxsm; $url =~ s/\[url\s*=\s*(.*?)\s*.*?\].*?\[\/url\]/$1/igxsm; $url =~ s/\[link\s*=\s*(.*?)\s*.*?\].*?\[\/link\]/$1/igxsm; $url =~ s/\[url.*?\/url\]//igxsm; $url =~ s/\[link.*?\/link\]//igxsm; my $char_160 = chr 160; $url =~ s/(\s| |$char_160)+//gxsm; if ( $url !~ /^http.+?\.(gif|jpg|jpeg|png|bmp)$/ixsm ) { return q{ } . $url; } my %parameter; FromHTML($attribut); $attribut =~ s/(\s|$char_160)+/ /gsm; foreach ( split / +/sm, $attribut ) { my ( $key, $value ) = split /=/xsm, $_; $value =~ s/[\x22\x27]//gxsm; $parameter{$key} = $value; } if ( $parameter{'name'} ne 'signat_img_resize' ) { $parameter{'name'} = 'post_img_resize'; } ToHTML( $parameter{'alt'} ); $parameter{'align'} =~ s/[^a-z]//igxsm; $parameter{'width'} =~ s/\D//gxsm; $parameter{'height'} =~ s/\D//gxsm; if ( $parameter{'align'} ) { $parameter{'align'} = qq~ align:$parameter{'align'};~; } if ( $parameter{'width'} ) { $parameter{'width'} = qq~ width:$parameter{'width'};~; } if ( $parameter{'height'} ) { $parameter{'height'} = qq~ height:$parameter{'height'};~; } $imagecount++; return qq~ $parameter{'alt'}~; } 1;