1############################################################################### 2# Printpage.pm # 3# $Date: 12.02.14 $ # 4############################################################################### 5# YaBB: Yet another Bulletin Board # 6# Open-Source Community Software for Webmasters # 7# Version: YaBB 2.6.11 # 8# Packaged: December 2, 2014 # 9# Distributed by: http://www.yabbforum.com # 10# =========================================================================== # 11# Copyright (c) 2000-2014 YaBB (www.yabbforum.com) - All Rights Reserved. # 12# Software by: The YaBB Development Team # 13# with assistance from the YaBB community. # 14############################################################################### 15use CGI::Carp qw(fatalsToBrowser); 16our $VERSION = '2.6.11'; 17 18$printpagepmver = 'YaBB 2.6.11 $Revision: 1611 $'; 19if ( $action eq 'detailedversion' ) { return 1; } 20get_micon(); 21 22sub Print_IM { 23 if ($iamguest) { fatal_error('not_allowed'); } 24 LoadLanguage('InstantMessage'); 25 26 my ( 27 $fromTitle, $toTitle, $toTitleCC, $toTitleBCC, 28 $usernameFrom, $usernameTo, $usernameCC, $usernameBCC, 29 $pmAttachment, $pmShowAttach, $pmAttachments, %attach_gif 30 ); 31 32 if ( $INFO{'caller'} == 1 ) { 33 fopen( THREADS, "$memberdir/$username.msg" ) || donoopen(); 34 $boxtitle = qq~$inmes_txt{'inbox'}~; 35 } 36 elsif ( $INFO{'caller'} == 2 ) { 37 fopen( THREADS, "$memberdir/$username.outbox" ) || donoopen(); 38 $boxtitle = qq~$inmes_txt{'outbox'}~; 39 } 40 elsif ( $INFO{'caller'} == 3 ) { 41 fopen( THREADS, "$memberdir/$username.imstore" ) || donoopen(); 42 $boxtitle = qq~$inmes_txt{'storage'}~; 43 $storetitle = qq~$INFO{'viewfolder'}~; 44 } 45 elsif ( $INFO{'caller'} == 5 ) { 46 fopen( THREADS, "$memberdir/broadcast.messages" ) || donoopen(); 47 $boxtitle = qq~$inmes_txt{'broadcast'}~; 48 } 49 @threads = <THREADS>; 50 fclose(THREADS); 51 52 $threadid = $INFO{'id'}; 53 foreach my $thread (@threads) { 54 chomp $thread; 55 if ( $thread =~ /$threadid/xsm ) { 56 ( 57 undef, $threadposter, $threadtousers, 58 $threadccusers, $threadbccusers, $threadtitle, 59 $threaddate, $threadpost, undef, 60 undef, undef, $threadstatus, 61 undef, $fold, $threadAttach 62 ) = split /\|/xsm, $thread; 63 if ( $INFO{'caller'} == 3 ) { 64 $folder = ucfirst $fold; 65 $boxtitle .= qq~ >> $folder~; 66 } 67 } 68 } 69 70 $printDate = timeformat( $date, 1 ); 71 72 # Lets output all that info. 73 if ($yycharset) {$yymycharset = $yycharset;} 74 $output = 75qq~<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 76<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$abbr_lang" lang="$abbr_lang"> 77<head> 78<title>$mbname - $maintxt{'668'}</title> 79<meta http-equiv="Content-Type" content="text/html; charset=$yymycharset" /> 80<meta name="robots" content="noindex,noarchive" /> 81<link rel="stylesheet" href="$yyhtml_root/Templates/Forum/$usestyle.css" type="text/css" /> 82<style type="text/css"> 83 body { background-color:#fff;background-image:none; } 84</style> 85<style type="text/css" media="print"> 86 .no-print { display: none; } 87</style> 88<script type="text/javascript" src="$yyhtml_root/YaBB.js"></script> 89<script type="text/javascript"> 90var imgdisplay = 'none'; 91function do_images() { 92 for (var i = 0; i < document.images.length; i++) { 93 document.images[i].style.display = imgdisplay; 94 } 95 if (imgdisplay == 'none') { 96 imgdisplay = 'inline'; 97 document.getElementById("Hide_Image").value = "$maintxt{'669b'}"; 98 } else { 99 imgdisplay = 'none'; 100 document.getElementById("Hide_Image").value = "$maintxt{'669a'}"; 101 } 102} 103 104</script> 105</head> 106<body> 107 108<table style="width:96%; margin-top:10px"> 109 <tr> 110 <td class="vtop"> 111 <span style="font-family: arial, sans-serif; font-size: 18px; font-weight: bold;">$mbname</span> 112 </td> 113 <td class="right vtop"> 114 <input type="button" id="Hide_Image" value="$maintxt{'669a'}" class="no-print" onclick="do_images();" /> 115 </td> 116 </tr><tr> 117 <td class="vtop" colspan="2"> 118 <!-- Uncomment the following line if you want the Forum URL to appear--> 119 <!--<span style="font-family: arial, sans-serif; font-size: 10px;">$scripturl</span><br />--> 120 <!--<span style="font-family: arial, sans-serif; font-size: 16px; font-weight: bold;">$load_imtxt{'71'} $boxtitle $inmes_txt{'30'} $printDate</span>--> 121 <!--<span style="font-family: arial, sans-serif; font-size: 16px; font-weight: bold;">$mbname >> $inmes_txt{'usercp'} >> $boxtitle $storetitle</span>--> 122 <span style="font-family: arial, sans-serif; font-size: 16px; font-weight: bold;">$load_imtxt{'71'} $inmes_txt{'usercp'} >> $boxtitle $storetitle $inmes_txt{'30'} $printDate</span> 123 <br /> 124 <span style="font-family: arial, sans-serif; font-size: 10px;">$scripturl?action=imshow;caller=$INFO{'caller'};id=$INFO{'id'}</span> 125 </td> 126 </tr> 127</table> 128<br /> 129~; 130 131 $threadDate = timeformat( $threaddate, 1 ); 132 133 if ( $INFO{'caller'} == 1 ) { 134 if ($threadtousers) { 135 foreach my $uname ( split /,/xsm, $threadtousers ) { 136 LoadUser($uname); 137 $usernameTo .= ( 138 ${ $uid . $uname }{'realname'} 139 ? ${ $uid . $uname }{'realname'} 140 : ( 141 $uname ? qq~$uname ($maintxt{'470a'})~ 142 : $maintxt{'470a'} 143 ) 144 ) . q{, }; # 470a == Ex-Member 145 } 146 $usernameTo =~ s/, $//sm; 147 $usernameTo = qq~<b>$usernameTo</b><br />~; 148 $toTitle = qq~$inmes_txt{'324'}:~; 149 } 150 if ($threadccusers) { 151 foreach my $uname ( split /,/xsm, $threadccusers ) { 152 LoadUser($uname); 153 $usernameCC .= ( 154 ${ $uid . $uname }{'realname'} 155 ? ${ $uid . $uname }{'realname'} 156 : ( 157 $uname ? qq~$uname ($maintxt{'470a'})~ 158 : $maintxt{'470a'} 159 ) 160 ) . q{, }; 161 } 162 $usernameCC =~ s/, $//sm; 163 $usernameCC = qq~<b>$usernameCC</b><br />~; 164 $toTitleCC = qq~$inmes_txt{'325'}:~; 165 } 166 if ($threadbccusers) { 167 foreach my $uname ( split /,/xsm, $threadbccusers ) { 168 if ( $uname eq $username ) { 169 LoadUser($uname); 170 $usernameBCC = 171 ${ $uid . $uname }{'realname'} 172 ? ${ $uid . $uname }{'realname'} 173 : ( 174 $uname ? qq~$uname ($maintxt{'470a'})~ 175 : $maintxt{'470a'} 176 ); 177 } 178 } 179 if ($usernameBCC) { 180 $usernameBCC = qq~<b>$usernameBCC</b>~; 181 $toTitleBCC = qq~$inmes_txt{'326'}:~; 182 } 183 } 184 185 if ( $threadstatus eq 'g' || $threadstatus eq 'ga' ) { 186 my ( $guestName, $guestEmail ) = split / /sm, $threadposter; 187 $guestName =~ s/%20/ /gsm; 188 $usernameFrom = qq~<b>$guestName ($guestEmail)</b><br />~; 189 } 190 else { 191 LoadUser($threadposter); 192 $usernameFrom = 193 ${ $uid . $threadposter }{'realname'} 194 ? ${ $uid . $threadposter }{'realname'} 195 : ( 196 $threadposter ? qq~$threadposter ($maintxt{'470a'})~ 197 : $maintxt{'470a'} 198 ); # 470a == Ex-Member 199 $usernameFrom = qq~<b>$usernameFrom</b><br />~; 200 } 201 $fromTitle = qq~$inmes_txt{'318'}:~; 202 } 203 chomp $threadAttach; 204 if ( $threadAttach ne q{} ) { 205 LoadLanguage('FA'); 206 foreach ( split /,/xsm, $threadAttach ) { 207 my ( $pmAttachFile, undef ) = split /~/xsm, $_; 208 if ( $pmAttachFile =~ /\.(.+?)$/sm ) { 209 $ext = lc $1; 210 } 211 if ( !exists $attach_gif{$ext} ) { 212 $attach_gif{$ext} = 213 ( $ext 214 && -e "$htmldir/Templates/Forum/$useimages/$att_img{$ext}" 215 ) ? "$imagesdir/$att_img{$ext}" : "$micon_bg{'paperclip'}"; 216 } 217 my $filesize = -s "$pmuploaddir/$pmAttachFile"; 218 if ($filesize) { 219 if ( $pmAttachFile =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ism 220 && $pmDisplayPics == 1 ) 221 { 222 $imagecount++; 223 $pmShowAttach .= 224qq~<div class="small" style="float:left; margin:8px;"><img src="$attach_gif{$ext}" class="bottom" alt="" /> $pmAttachFile ( ~ 225 . int( $filesize / 1024 ) 226 . qq~ KB)<br /><img src="$pmuploadurl/$pmAttachFile" name="attach_img_resize" alt="$pmAttachFile" title="$pmAttachFile" style="display:none;" /></div>\n~; 227 } 228 else { 229 $pmAttachment .= 230qq~<div class="small"><img src="$attach_gif{$ext}" class="bottom" alt="" /> $pmAttachFile ( ~ 231 . int( $filesize / 1024 ) 232 . q~ KB)</div>~; 233 } 234 } 235 else { 236 $pmAttachment .= 237qq~<div class="small"><img src="$attach_gif{$ext}" class="bottom" alt="" /> $pmAttachFile ($fatxt{'1'})</div>~; 238 } 239 } 240 if ( $pmShowAttach && $pmAttachment ) { 241 $pmAttachment =~ 242 s/<div class="small">/<div class="small" style="margin:8px;">/gsm; 243 } 244 $pmAttachments .= qq~ 245 <hr /> 246 $pmAttachment 247 $pmShowAttach~; 248 } 249 elsif ( $INFO{'caller'} == 2 ) { 250 LoadUser($threadposter); 251 $usernameFrom = 252 ${ $uid . $threadposter }{'realname'} 253 ? ${ $uid . $threadposter }{'realname'} 254 : ( 255 $threadposter ? qq~$threadposter ($maintxt{'470a'})~ 256 : $maintxt{'470a'} 257 ); # 470a == Ex-Member 258 $usernameFrom = qq~<b>$usernameFrom</b><br />~; 259 $fromTitle = qq~$inmes_txt{'318'}:~; 260 261 if ( $threadstatus !~ /b/sm ) { 262 if ( $threadstatus !~ /gr/sm ) { 263 foreach my $uname ( split /,/xsm, $threadtousers ) { 264 LoadUser($uname); 265 $usernameTo .= ( 266 ${ $uid . $uname }{'realname'} 267 ? ${ $uid . $uname }{'realname'} 268 : ( 269 $uname ? qq~$uname ($maintxt{'470a'})~ 270 : $maintxt{'470a'} 271 ) 272 ) . q{, }; # 470a == Ex-Member 273 } 274 } 275 else { 276 my ( $guestName, $guestEmail ) = split / /sm, $threadtousers; 277 $guestName =~ s/%20/ /gxsm; 278 $usernameTo = qq~$guestName ($guestEmail)~; 279 } 280 $toTitle = qq~$inmes_txt{'324'}:~; 281 } 282 else { 283 require Sources::InstantMessage; 284 foreach my $uname ( split /,/xsm, $threadtousers ) { 285 $usernameTo .= links_to($uname); 286 } 287 $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; 288 } 289 $usernameTo =~ s/, $//sm; 290 $usernameTo = qq~<b>$usernameTo</b><br />~; 291 if ($threadccusers) { 292 foreach my $uname ( split /,/xsm, $threadccusers ) { 293 LoadUser($uname); 294 $usernameCC .= ( 295 ${ $uid . $uname }{'realname'} 296 ? ${ $uid . $uname }{'realname'} 297 : ( 298 $uname ? qq~$uname ($maintxt{'470a'})~ 299 : $maintxt{'470a'} 300 ) 301 ) . q{, }; # 470a == Ex-Member 302 } 303 $usernameCC =~ s/, $//sm; 304 $usernameCC = qq~<b>$usernameCC</b><br />~; 305 $toTitleCC = qq~$inmes_txt{'325'}:~; 306 } 307 if ($threadbccusers) { 308 foreach my $uname ( split /,/xsm, $threadbccusers ) { 309 LoadUser($uname); 310 $usernameBCC .= ( 311 ${ $uid . $uname }{'realname'} 312 ? ${ $uid . $uname }{'realname'} 313 : ( 314 $uname ? qq~$uname ($maintxt{'470a'})~ 315 : $maintxt{'470a'} 316 ) 317 ) . q{, }; # 470a == Ex-Member 318 } 319 $usernameBCC =~ s/, $//sm; 320 $usernameBCC = qq~<b>$usernameBCC</b>~; 321 $toTitleBCC = qq~$inmes_txt{'326'}:~; 322 } 323 } 324 elsif ( $INFO{'caller'} == 3 ) { 325 if ( $threadstatus !~ /b/sm ) { 326 if ( $threadstatus !~ /gr/sm ) { 327 foreach my $uname ( split /,/xsm, $threadtousers ) { 328 LoadUser($uname); 329 $usernameTo .= ( 330 ${ $uid . $uname }{'realname'} 331 ? ${ $uid . $uname }{'realname'} 332 : ( 333 $uname ? qq~$uname ($maintxt{'470a'})~ 334 : $maintxt{'470a'} 335 ) 336 ) . q{, }; # 470a == Ex-Member 337 } 338 } 339 else { 340 my ( $guestName, $guestEmail ) = split / /sm, $threadtousers; 341 $guestName =~ s/%20/ /gsm; 342 $usernameTo = qq~$guestName ($guestEmail)~; 343 } 344 $toTitle = qq~$inmes_txt{'324'}:~; 345 if ( $threadccusers && $threadposter eq $username ) { 346 foreach my $uname ( split /,/xsm, $threadccusers ) { 347 LoadUser($uname); 348 $usernameCC .= ( 349 ${ $uid . $uname }{'realname'} 350 ? ${ $uid . $uname }{'realname'} 351 : ( 352 $uname ? qq~$uname ($maintxt{'470a'})~ 353 : $maintxt{'470a'} 354 ) 355 ) . q{, }; # 470a == Ex-Member 356 } 357 $usernameCC =~ s/, $//sm; 358 $usernameCC = qq~<b>$usernameCC</b><br />~; 359 $toTitleCC = qq~$inmes_txt{'325'}:~; 360 } 361 if ( $threadbccusers && $threadposter eq $username ) { 362 foreach my $uname ( split /,/xsm, $threadbccusers ) { 363 LoadUser($uname); 364 $usernameBCC .= ( 365 ${ $uid . $uname }{'realname'} 366 ? ${ $uid . $uname }{'realname'} 367 : ( 368 $uname ? qq~$uname ($maintxt{'470a'})~ 369 : $maintxt{'470a'} 370 ) 371 ) . q{, }; # 470a == Ex-Member 372 } 373 $usernameBCC =~ s/, $//sm; 374 $usernameBCC = qq~<b>$usernameBCC</b>~; 375 $toTitleBCC = qq~$inmes_txt{'326'}:~; 376 } 377 } 378 else { 379 foreach my $uname ( split /,/xsm, $threadtousers ) { 380 require Sources::InstantMessage; 381 $usernameTo .= links_to($uname); 382 } 383 $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; 384 } 385 $usernameTo =~ s/, $//sm; 386 $usernameTo = qq~<b>$usernameTo</b><br />~; 387 388 if ( $threadstatus eq 'g' || $threadstatus eq 'ga' ) { 389 my ( $guestName, $guestEmail ) = split / /sm, $threadposter; 390 $guestName =~ s/%20/ /gsm; 391 $usernameFrom = qq~$guestName ($guestEmail)~; 392 } 393 else { 394 LoadUser($threadposter); 395 $usernameFrom = 396 ${ $uid . $threadposter }{'realname'} 397 ? ${ $uid . $threadposter }{'realname'} 398 : ( 399 $threadposter ? qq~$threadposter ($maintxt{'470a'})~ 400 : $maintxt{'470a'} 401 ); # 470a == Ex-Member 402 } 403 $usernameFrom = qq~<b>$usernameFrom</b><br />~; 404 $fromTitle = qq~$inmes_txt{'318'}:~; 405 406 } 407 elsif ( $INFO{'caller'} == 5 408 && ( $threadstatus eq 'g' || $threadstatus eq 'ga' ) ) 409 { 410 my ( $guestName, $guestEmail ) = split / /sm, $threadposter; 411 $guestName =~ s/%20/ /gsm; 412 $usernameFrom = qq~<b>$guestName ($guestEmail)</b><br />~; 413 $fromTitle = qq~$inmes_txt{'318'}:~; 414 415 } 416 elsif ( $INFO{'caller'} == 5 && $threadstatus =~ /b/sm ) { 417 if ($threadtousers) { 418 require Sources::InstantMessage; # Needed for To Member Groups 419 foreach my $uname ( split /,/xsm, $threadtousers ) { 420 $usernameTo .= links_to($uname); 421 } 422 $usernameTo =~ s/, $//sm; 423 $usernameTo .= q~<br />~; 424 $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; 425 } 426 427 LoadUser($threadposter); 428 $usernameFrom = 429 ${ $uid . $threadposter }{'realname'} 430 ? ${ $uid . $threadposter }{'realname'} 431 : ( 432 $threadposter ? qq~$threadposter ($maintxt{'470a'})~ 433 : $maintxt{'470a'} 434 ); # 470a == Ex-Member 435 436 $usernameFrom = qq~<b>$usernameFrom</b><br />~; 437 $fromTitle = qq~$inmes_txt{'318'}:~; 438 } 439 440 do_print(); 441 $output .= qq~ 442<table class="cs_10px" style="border: 1px solid #000000; width:96%"> 443 <tr> 444 <td style="font-family: arial, sans-serif; font-size: 12px;"> 445 <div>$inmes_txt{'70'}: <b>$threadtitle</b></div> 446 <div>$inmes_txt{'317'}: <b>$threadDate</b></div> 447 $toTitle $usernameTo 448 $fromTitle $usernameFrom 449 $toTitleCC $usernameCC 450 $toTitleBCC $usernameBCC 451 <hr /> 452 <span style="font-family: arial, sans-serif; font-size: 12px;"> 453 $threadpost 454 </span> 455 $pmAttachments 456 </td> 457 </tr> 458</table> 459<form><p class="no-print" style="text-align:center"><input class="no-print" type="button" value=" $maintxt{'printpage'} " onclick="window.print();" /></p></form> 460~; 461 462 $output .= qq~ 463<table class="pad_10px" style="width:96%"> 464 <tr> 465 <td class="center"> 466 <span style="font-family: arial, sans-serif; font-size: 10px;"> 467 $yycopyright 468 </span> 469 </td> 470 </tr> 471</table> 472</body> 473</html>~; 474 475 image_resize(); 476 477 print_output_header(); 478 print_HTML_output_and_finish(); 479 return; 480} 481 482sub Print { 483 $num = $INFO{'num'}; 484 $post = $INFO{'post'}; 485 486 # Determine category 487 $curcat = ${ $uid . $currentboard }{'cat'}; 488 MessageTotals( 'load', $num ); 489 490 my $ishidden; 491 if ( ${$num}{'threadstatus'} =~ /h/ism ) { 492 $ishidden = 1; 493 } 494 495 if ( $ishidden && !$staff ) { 496 fatal_error('no_access'); 497 } 498 499 # Figure out the name of the category 500 get_forum_master(); 501 ( $cat, $catperms ) = split /\|/xsm, $catinfo{"$curcat"}; 502 503 ( $boardname, $boardperms, $boardview ) = 504 split /\|/xsm, $board{"$currentboard"}; 505 506 LoadCensorList(); 507 508 # Lets open up the thread file itself 509 if ( !ref $thread_arrayref{$num} ) { 510 fopen( THREADS, "$datadir/$num.txt" ) || donoopen(); 511 @{ $thread_arrayref{$num} } = <THREADS>; 512 fclose(THREADS); 513 } 514 $cat =~ s/\n//gxsm; 515 516 ( $messagetitle, $poster, undef, $date, undef ) = 517 split /\|/xsm, ${ $thread_arrayref{$num} }[0]; 518 519 $startedby = $poster; 520 $startedon = timeformat( $date, 1 ); 521 ToChars($messagetitle); 522 ( $messagetitle, undef ) = Split_Splice_Move( $messagetitle, 0 ); 523 my $pageTitle = $post ? $maintxt{'668a'} : $maintxt{'668'}; 524 525 ### Lets output all that info. ### 526 if ($yycharset) {$yymycharset = $yycharset;} 527 $output = 528qq~<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 529<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$abbr_lang" lang="$abbr_lang"> 530<head> 531<title>$mbname - $pageTitle</title> 532<meta http-equiv="Content-Type" content="text/html; charset=$yymycharset" /> 533<meta name="robots" content="noindex,noarchive" /> 534<link rel="canonical" href="$scripturl?num=$num" /> 535<link rel="stylesheet" href="$yyhtml_root/Templates/Forum/$usestyle.css" type="text/css" /> 536<style type="text/css"> 537 body { background-color:#fff;background-image:none; } 538</style> 539<style type="text/css" media="print"> 540 .no-print { display: none; } 541</style> 542<script type="text/javascript" src="$yyhtml_root/YaBB.js"></script> 543<script type="text/javascript"> 544var imgdisplay = 'none'; 545var urldisplay = 'inline'; 546function do_images() { 547 for (var i = 0; i < document.images.length; i++) { 548 if (document.images[i].align != 'bottom') { 549 document.images[i].style.display = imgdisplay; 550 imageid = document.images[i].id; 551 if (imageid) document.getElementById('url' + imageid).style.display = urldisplay; 552 } 553 } 554 if (imgdisplay == 'none') { 555 imgdisplay = 'inline'; 556 urldisplay = 'none'; 557 document.getElementById("Hide_Image").value = "$maintxt{'669b'}"; 558 } else { 559 imgdisplay = 'none'; 560 urldisplay = 'inline'; 561 document.getElementById("Hide_Image").value = "$maintxt{'669a'}"; 562 } 563} 564 565</script> 566</head> 567<body> 568 569<table style="width:96%; margin-top:10px"> 570 <tr> 571 <td class="vtop"> 572 <span style="font-family: arial, sans-serif; font-size: 18px; font-weight: bold;">$mbname</span> 573 </td> 574 <td class="right vtop"> 575 <input type="button" id="Hide_Image" value="$maintxt{'669a'}" class="no-print" onclick="do_images();" /> 576 </td> 577 </tr><tr> 578 <td class="vtop" colspan="2"> 579 <!-- Uncomment the following line if you want the Forum URL to appear --> 580 <!--<span style="font-family: arial, sans-serif; font-size: 10px;">$scripturl</span><br />--> 581 <span style="font-family: arial, sans-serif; font-size: 16px; font-weight: bold;">$cat >> $boardname >> $messagetitle</span> 582 <br /> 583 <span style="font-family: arial, sans-serif; font-size: 10px;">$scripturl?num=$num</span> 584 <br /> 585 <hr /> 586 <span style="font-family: arial, sans-serif; font-size: 14px; font-weight: bold;">$maintxt{'195'} $startedby $maintxt{'30'} $startedon</span> 587 </td> 588 </tr> 589</table> 590<br />~; 591 592 LoadLanguage('FA'); 593 594 # Split the threads up so we can print them. 595 $postnum = 0; 596 foreach my $thread ( @{ $thread_arrayref{$num} } ) { 597 $postnum++; 598 ( 599 $threadtitle, $threadposter, undef, $threaddate, 600 undef, undef, undef, undef, 601 $threadpost, undef, undef, undef, 602 $attachments 603 ) = split /\|/xsm, $thread; 604 if ( $post && ( $post ne $postnum ) ) { 605 next; 606 ( 607 $threadtitle, $threadposter, undef, $threaddate, 608 undef, undef, undef, undef, 609 $threadpost, undef, undef, undef, 610 $attachments 611 ) = split /\|/xsm, @{ $thread_arrayref{$num} }[$post]; 612 last; 613 } 614 ( $threadtitle, undef ) = Split_Splice_Move( $threadtitle, 0 ); 615 ( $threadpost, undef ) = Split_Splice_Move( $threadpost, $num ); 616 do_print(); 617 618 $output .= qq~ 619<table class="pad_10px" style="border: 1px solid #000000; width:96%"> 620 <tr> 621 <td style="font-family: arial, sans-serif; font-size: 12px;"> 622 $maintxt{'196'}: <b>$threadtitle</b><br /> 623 $maintxt{'197'} <b>$threadposter</b> $maintxt{'30'} <b>$threaddate</b> 624 <hr /> 625 <div style="font-family: arial, sans-serif; font-size: 12px;"> 626 $threadpost~; 627 628 chomp $attachments; 629 if ($attachments) { 630 631 # store all downloadcounts in variable 632 if ( !%attach_count ) { 633 my ( $atfile, $atcount ); 634 fopen( ATM, "$vardir/attachments.txt" ); 635 while (<ATM>) { 636 ( 637 undef, undef, undef, undef, undef, 638 undef, undef, $atfile, $atcount 639 ) = split /\|/xsm, $_; 640 $attach_count{$atfile} = $atcount; 641 } 642 fclose(ATM); 643 if ( !%attach_count ) { $attach_count{'no_attachments'} = 1; } 644 } 645 646 my $attachment = q{}; 647 my $showattach = q{}; 648 649 foreach ( split /,/xsm, $attachments ) { 650 if ( $_ =~ /\.(.+?)$/xsm ) { 651 $ext = lc $1; 652 } 653 if ( !exists $attach_gif{$ext} ) { 654 $attach_gif{$ext} = 655 ( $ext 656 && -e "$htmldir/Templates/Forum/$useimages/$att_img{$ext}" 657 ) 658 ? "$imagesdir/$att_img{$ext}" 659 : "$micon_bg{'paperclip'}"; 660 } 661 my $filesize = -s "$uploaddir/$_"; 662 $download_txt = ( $attach_count{$_} == 1 ) ? $fatxt{'41b'} : isempty( $fatxt{'41c'}, $fatxt{'41a'} ); 663 if ($filesize) { 664 if ( $_ =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ixsm 665 && $amdisplaypics == 1 ) 666 { 667 $imagecount++; 668 $showattach .= 669qq~<div class="small" style="float:left; margin:8px;"><img src="$attach_gif{$ext}" class="bottom" alt="" /> <span id="urlimagecount$imagecount" style="display:none">$scripturl?action=downloadfile;file=</span>$_ ( ~ 670 . int( $filesize / 1024 ) 671 . qq~ KB | $attach_count{$_} $download_txt )<br /><img src="$uploadurl/$_" name="attach_img_resize" alt="$_" id="imagecount$imagecount" title="$_" style="display:none" /></div>\n~; 672 } 673 else { 674 $attachment .= 675qq~<div class="small"><img src="$attach_gif{$ext}" class="bottom" alt="" /> $scripturl?action=downloadfile;file=$_ ( ~ 676 . int( $filesize / 1024 ) 677 . qq~ KB | $attach_count{$_} $download_txt )</div>~; 678 } 679 } 680 else { 681 $attachment .= 682qq~<div class="small"><img src="$attach_gif{$ext}" class="bottom" alt="" /> $_ ($fatxt{'1'}~ 683 . ( 684 exists $attach_count{$_} 685 ? qq~ | $attach_count{$_} $download_txt ~ 686 : q{} 687 ) . q~)</div>~; 688 } 689 } 690 if ( $showattach && $attachment ) { 691 $attachment =~ 692s/<div class="small">/<div class="small" style="margin:8px;">/gsm; 693 } 694 $output .= qq~ 695 <hr /> 696 $attachment 697 $showattach~; 698 } 699 700 $output .= q~ 701 </div> 702 </td> 703 </tr> 704</table> 705<br /> 706~; 707 } 708 709 $output .= qq~ 710<form><p class="no-print" style="text-align:center"><input class="no-print" type="button" value=" $maintxt{'printpage'} " onclick="window.print();" /></p></form> 711<table class="pad_10px" style="width:96%"> 712 <tr> 713 <td class="center" style="font-family: arial, sans-serif; font-size: 10px;"> 714 $yycopyright 715 </td> 716 </tr> 717</table> 718</body> 719</html>~; 720 721 image_resize(); 722 723 print_output_header(); 724 print_HTML_output_and_finish(); 725 return; 726} 727 728sub codemsg { 729 my ($code) = @_; 730 my %killhash = ( 731 q{;} => ';', 732 q{!} => '!', 733 q{(} => '(', 734 q{)} => ')', 735 q{-} => '-', 736 q{.} => '.', 737 q{/} => '/', 738 q{:} => ':', 739 q{?} => '?', 740 q{[} => '[', 741 q{\\} => '\', 742 q{]} => ']', 743 q{^} => '^', 744 ); 745 if ( $code !~ /&\S*;/xsm ) { $code =~ s/;/;/gxsm; } 746 $code =~ s/([\(\)\-\:\\\/\?\!\]\[\.\^])/$killhash{$1}/gxsm; 747 $_ = 748q~<br /><b>Code:</b><br /><table class="cs_thin" style="width:90%"><tr><td><table class="padd_2px"><tr><td><span style="font-family:courier; font-size:80%">CODE</span></td></tr></table></td></tr></table>~; 749 $_ =~ s/CODE/$code/gxsm; 750 return $_; 751} 752 753sub donoopen { 754 print qq~Content-Type: text/html\r\n\r\n 755<html> 756<head> 757<title>$maintxt{'199'}</title> 758</head> 759<body> 760<p style="font-size:small; font-family:Arial,Helvetica; text-align:center">$maintxt{'199'}</p> 761</body> 762</html>~ or croak "$croak{'print'}"; 763 exit; 764} 765 766sub do_print { 767 $threadpost =~ s/\[reason\](.+?)\[\/reason\]//isgxm; 768 $threadpost =~ s/<br \/>/\n/igxsm; 769 $threadpost =~ s/\[highlight(.*?)\](.*?)\[\/highlight\]/$2/isgxm; 770 $threadpost =~ 771s/\[code\s*(.+?)\]\n*(.+?)\n*\[\/code\]/<br \/><b>Code ($1):<\/b><br \/><table class=\"cs_thin\"><tr><td><table class=\"pad_2px\"><tr><td><span style=\"font-family:courier; font-size:80%\">$2<\/span><\/td><\/tr><\/table><\/td><\/tr><\/table>/isgm; 772 $threadpost =~ s/\[([^\]]{0,30})\n([^\]]{0,30})\]/\[$1$2\]/gxsm; 773 $threadpost =~ s/\[\/([^\]]{0,30})\n([^\]]{0,30})\]/\[\/$1$2\]/gxsm; 774 $threadpost =~ s/(\w+:\/\/[^<>\s\n\"\]\[]+)\n([^<>\s\n\"\]\[]+)/$1\n$2/gxsm; 775 776 $threadpost =~ s/\[b\](.*?)\[\/b\]/<b>$1<\/b>/isgxm; 777 $threadpost =~ s/\[i\](.*?)\[\/i\]/<i>$1<\/i>/isgxm; 778 $threadpost =~ 779s/\[u\](.*?)\[\/u\]/<span style="text-decoration:underline">$1<\/span>/isgm; 780 $threadpost =~ s/\[s\](.*?)\[\/s\]/<s>$1<\/s>/isgxm; 781 $threadpost =~ s/\[move\](.*?)\[\/move\]/$1/isgxm; 782 783 $threadpost =~ s/\[glow(.*?)\](.*?)\[\/glow\]/&elimnests($2)/eisgxm; 784 $threadpost =~ s/\[shadow(.*?)\](.*?)\[\/shadow\]/&elimnests($2)/eisgxm; 785 786 $threadpost =~ s/\[shadow=(\S+?),(.+?),(.+?)\](.+?)\[\/shadow\]/$4/eisgxm; 787 $threadpost =~ s/\[glow=(\S+?),(.+?),(.+?)\](.+?)\[\/glow\]/$4/eisgxm; 788 789 $threadpost =~ s/\[color=([\w#]+)\](.*?)\[\/color\]/$2/isgxm; 790 $threadpost =~ s/\[black\](.*?)\[\/black\]/$1/isgxm; 791 $threadpost =~ s/\[white\](.*?)\[\/white\]/$1/isgxm; 792 $threadpost =~ s/\[red\](.*?)\[\/red\]/$1/isgxm; 793 $threadpost =~ s/\[green\](.*?)\[\/green\]/$1/isgxm; 794 $threadpost =~ s/\[blue\](.*?)\[\/blue\]/$1/isgxm; 795 $threadpost =~ 796s/\[font=(.+?)\](.+?)\[\/font\]/<span style="font-family:$1;">$2<\/span>/isgm; 797 798 while ( 799 $threadpost =~ s/\[size=(.+?)\](.+?)\[\/size\]/sizefont($1,$2)/eisgxm ) 800 { 801 } 802 803 $threadpost =~ 804s/\[quote\s+author=(.*?)\s+link=(.*?)\].*\/me\s+(.*?)\[\/quote\]/\[quote author=$1 link=$2\]<i>* $1 $3<\/i>\[\/quote\]/isgm; 805 $threadpost =~ 806s/\[quote(.*?)\].*\/me\s+(.*?)\[\/quote\]/\[quote$1\]<i>* Me $2<\/i>\[\/quote\]/isgm; 807 $threadpost =~ 808 s/\/me\s+(.*)/* $displayname $1/igsm; #*/ make my syntax checker happy 809 810 # Images in message 811 $threadpost =~ s/\[img(.*?)\](.*?)\[\/img\]/ imagemsg($1,$2) /eisgm; 812 813 $threadpost =~ s/\[tt\](.*?)\[\/tt\]/<tt>$1<\/tt>/isgxm; 814 $threadpost =~ 815 s/\[left\](.*?)\[\/left\]/<div style="text-align: left;">$1<\/div>/isgm; 816 $threadpost =~ 817s/\[center\](.*?)\[\/center\]/<div style="text-align: center;">$1<\/div>/isgm; 818 $threadpost =~ 819s/\[right\](.*?)\[\/right\]/<div style="text-align: right;">$1<\/div>/isgm; 820 $threadpost =~ 821s/\[justify\](.*?)\[\/justify\]/<div style="text-align: justify">$1<\/div>/isgm; 822 $threadpost =~ s/\[sub\](.*?)\[\/sub\]/<sub>$1<\/sub>/isxgm; 823 $threadpost =~ s/\[sup\](.*?)\[\/sup\]/<sup>$1<\/sup>/isgxm; 824 $threadpost =~ 825s/\[fixed\](.*?)\[\/fixed\]/<span style="font-family: Courier New;">$1<\/span>/isgm; 826 827 $threadpost =~ s/\[\[/\{\{/gxsm; 828 $threadpost =~ s/\]\]/\}\}/gxsm; 829 $threadpost =~ s/\|/\|/gxsm; 830 $threadpost =~ 831 s/\[hr\]\n/<hr style="width:40%; text-align:left" class="hr" \/>/gsm; 832 $threadpost =~ 833 s/\[hr\]/<hr style="width:40%; text-align:left" class="hr" \/>/gsm; 834 $threadpost =~ s/\[br\]/\n/igxsm; 835 836 $threadpost =~ s/\[flash\](.*?)\[\/flash\]/\[media\]$1\[\/media\]/isgxm; 837 838 $threadpost =~ 839 s/\[url=\s*(.+?)\s*\]\s*(.+?)\s*\[\/url\]/format_url2($1, $2)/eisgxm; 840 $threadpost =~ s/\[url\]\s*(\S+?)\s*\[\/url\]/format_url3($1)/eisgxm; 841 842 if ($autolinkurls) { 843 $threadpost =~ s/\[url\]\s*([^\[]+)\s*\[\/url\]/[url]$1\[\/url]/gxsm; 844 $threadpost =~ 845 s/\[link\]\s*([^\[]+)\s*\[\/link\]/[link]$1\[\/link]/gxsm; 846 $threadpost =~ s/\[news\](\S+?)\[\/news\]/<a href="$1">$1<\/a>/isgm; 847 $threadpost =~ s/\[gopher\](\S+?)\[\/gopher\]/<a href="$1">$1<\/a>/isgm; 848 $threadpost =~ s/">/">/gxsm; #" 849 $threadpost =~ s/(\[\*\])/ $1/gsm; 850 $threadpost =~ s/(\[\/list\])/ $1/gsm; 851 $threadpost =~ s/(\[\/tr\])/ $1/gsm; 852 $threadpost =~ s/(\[\/td\])/ $1/gsm; 853 $threadpost =~ s/\<span style\=/\<span_style\=/gsm; 854 $threadpost =~ s/\<div style\=/\<div_style\=/gsm; 855 $threadpost =~ 856s/([^\w\"\=\[\]]|[\n\b]|\"\;|\[quote.*?\]|\[edit\]|\[highlight\]|\[\*\]|\[td\]|\A)\\*(\w+?\:\/\/(?:[\w\~\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%\(\)\[\](?:\<\S+?\>\S+?\<\/\S+?\>)]+?)\.(?:[\w\~\.\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%\(\)\[\]\x80-\xFF]{1,})+?)/format_url($1,$2)/eisgm; 857 $threadpost =~ 858s/([^\"\=\[\]\/\:\.\-(\:\/\/\w+)]|[\n\b]|\"\;|\[quote.*?\]|\[edit\]|\[highlight\]|\[\*\]|\[td\]|\A|\()\\*(www\.[^\.](?:[\w\~\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%\(\)\[\](?:\<\S+?\>\S+?\<\/\S+?\>)]+?)\.(?:[\w\~\.\;\:\,\$\-\+\!\*\?\/\=\&\@\#\%\(\)\[\]\x80-\xFF]{1,})+?)/format_url($1,$2)/eisgm; 859 $threadpost =~ s/\<span_style\=/\<span style\=/gsm; 860 $threadpost =~ s/\<div_style\=/\<div style\=/gsm; 861 } 862 863 if ($stealthurl) { 864 $threadpost =~ 865s/\[url=\s*(\w+\:\/\/.+?)\](.+?)\s*\[\/url\]/<a href="$boardurl\/$yyexec.$yyext?action=dereferer;url=$1" target="_blank">$2<\/a>/isgm; 866 $threadpost =~ 867s/\[url=\s*(.+?)\]\s*(.+?)\s*\[\/url\]/<a href="$boardurl\/$yyexec.$yyext?action=dereferer;url=http:\/\/$1" target="_blank">$2<\/a>/isgm; 868 869 $threadpost =~ 870s/\[link\]\s*www\.\s*(.+?)\s*\[\/link\]/<a href="$boardurl\/$yyexec.$yyext?action=dereferer;url=http:\/\/www.$1">www.$1<\/a>/isgm; 871 $threadpost =~ 872s/\[link=\s*(\w+\:\/\/.+?)\](.+?)\s*\[\/link\]/<a href="$boardurl\/$yyexec.$yyext?action=dereferer;url=$1">$2<\/a>/isgm; 873 $threadpost =~ 874s/\[link=\s*(.+?)\]\s*(.+?)\s*\[\/link\]/<a href="$boardurl\/$yyexec.$yyext?action=dereferer;url=http:\/\/$1">$2<\/a>/isgm; 875 $threadpost =~ 876s/\[link\]\s*(.+?)\s*\[\/link\]/<a href="$boardurl\/$yyexec.$yyext?action=dereferer;url=$1">$1<\/a>/isgm; 877 $threadpost =~ 878s/\[ftp\]\s*(.+?)\s*\[\/ftp\]/<a href="$boardurl\/$yyexec.$yyext?action=dereferer;url=$1" target="_blank">$1<\/a>/isgm; 879 } 880 else { 881 $threadpost =~ 882s/\[url=\s*(\S\w+\:\/\/\S+?)\s*\](.+?)\[\/url\]/<a href="$1" target="_blank">$2<\/a>/isgm; 883 $threadpost =~ 884s/\[url=\s*(\S+?)\](.+?)\s*\[\/url\]/<a href="http:\/\/$1" target="_blank">$2<\/a>/isgm; 885 $threadpost =~ 886s/\[link\]\s*www\.(\S+?)\s*\[\/link\]/<a href="http:\/\/www.$1">www.$1<\/a>/isgm; 887 $threadpost =~ 888s/\[link=\s*(\S\w+\:\/\/\S+?)\s*\](.+?)\[\/link\]/<a href="$1">$2<\/a>/isgm; 889 $threadpost =~ 890s/\[link=\s*(\S+?)\](.+?)\s*\[\/link\]/<a href="http:\/\/$1">$2<\/a>/isgm; 891 $threadpost =~ 892 s/\[link\]\s*(\S+?)\s*\[\/link\]/<a href="$1">$1<\/a>/isgm; 893 $threadpost =~ 894s/\[ftp\]\s*(ftp:\/\/)?(.+?)\s*\[\/ftp\]/<a href="ftp:\/\/$2">$1$2<\/a>/isgm; 895 } 896 897 $threadpost =~ s/(dereferer\;url\=http\:\/\/.*?)#(\S+?\")/$1;anch=$2/isgm; 898 899 if ( $guest_media_disallowed && $iamguest ) { 900 my $oops = 901qq~ <i>$maintxt{'40'} $maintxt{'41'} <a href="$scripturl?action=login"><b>$maintxt{'34'}</b></a></i>~; 902 if ($regtype) { 903 $oops .= 904qq~<i> $maintxt{'42'} <a href="$scripturl?action=register"><b>$maintxt{'97'}</b></a></i>~; 905 } 906 907 $threadpost =~ s/<a href=".+?<\/a>/[oops]/gsm; 908 $threadpost =~ s/<img src=".+?>/[oops]/gsm; 909 $threadpost =~ s/\[media\].*?\[\/media\]/[oops]/isgxm; 910 $threadpost =~ s/\[oops\]/$oops/gxsm; 911 } 912 913 $threadpost =~ s/\[media\](.*?)\[\/media\]/$1/isgxm; 914 915 $threadpost =~ s/\[email\]\s*(\S+?\@\S+?)\s*\[\/email\]/$1/isgxm; 916 $threadpost =~ 917 s/\[email=\s*(\S+?\@\S+?)\]\s*(.*?)\s*\[\/email\]/$2 ($1)/isgm; 918 919 $threadpost =~ s/\[news\](.+?)\[\/news\]/$1/isgxm; 920 $threadpost =~ s/\[gopher\](.+?)\[\/gopher\]/$1/isgxm; 921 $threadpost =~ s/\[ftp\](.+?)\[\/ftp\]/$1/isgxm; 922 923 while ( $threadpost =~ 924/\[quote\s+author=(.*?)\slink=.*?\s+date=(.*?)\s*\]\n*.*?\n*\[\/quote\]/ism 925 ) 926 { 927 my $author = $1; 928 my $date = timeformat( $2, 1 ); 929 930 if ($author) { # out of YaBBC.pm -> sub quotemsg { 931 ToChars($author); 932 if ( !-e "$memberdir/$author.vars" ) 933 { # if the file is there it is an unencrypted user ID 934 $author = decloak($author); 935 936 # if not, decrypt it and see if it is a regged user 937 if ( !-e "$memberdir/$author.vars" ) 938 { # if still not found probably the author is a screen name 939 $testauthor = MemberIndex( 'check_exist', "$author" ); 940 941 # check if this name exists in the memberlist 942 if ( $testauthor ne q{} ) 943 { # if it is, load the user id returned 944 $author = $testauthor; 945 LoadUser($author); 946 $author = ${ $uid . $author }{'realname'}; 947 948 # set final author var to the current users screen name 949 } 950 else { 951 $author = decloak($author); 952 953 # if all fails it is a non existing real name so decode and asign as screenname 954 } 955 } 956 else { 957 LoadUser($author); 958 959# after encoding the user ID was found and loaded, setting the current real name 960 $author = ${ $uid . $author }{'realname'}; 961 } 962 } 963 else { 964 LoadUser($author); 965 966# it was an old style user id which could be loaded and screen name set to final author 967 $author = ${ $uid . $author }{'realname'}; 968 } 969 } 970 971 $threadpost =~ 972s/\[quote\s+author=.*?link=.*?\s+date=.*?\s*\]\n*(.*?)\n*\[\/quote\]/<br \/><i>$author $maintxt{'30a'} $date:<\/i><table style="padding:1px; width:90%; border:thin solid #000"><tr><td style="width:100%;font-size:10px">$1<\/td><\/tr><\/table>/ism; 973 } 974 $threadpost =~ 975s/\[quote\]\n*(.+?)\n*\[\/quote\]/<br \/><i>$maintxt{'31'}:<\/i><table style="padding:1px; width:90%; border:thin solid #000"><tr><td style="width:100%;font-size:10px; font-family:Arial,Helvetica">$1<\/td><\/tr><\/table>/isgm; 976 977## list code from YaBBC.pm - DAR ## 978 $threadpost =~ s/\s*\[\*\]/<\/li><li>/isgm; 979 $threadpost =~ s/\[olist\]/<ol>/isgm; 980 $threadpost =~ s/\s*\[\/olist\]/<\/li><\/ol>/isgm; 981 $threadpost =~ s/<\/li><ol>/<ol>/isgm; 982 $threadpost =~ s/<ol><\/li>/<ol>/isgm; 983 $threadpost =~ s/\[list\]/<ul>/isgm; 984 $threadpost =~ 985s/\[list (.+?)\]/<ul style="list-style-image\: url($defaultimagesdir\/$1\.gif)">/isgm; 986 $threadpost =~ s/\s*\[\/list\]/<\/li><\/ul>/isgm; 987 $threadpost =~ s/<\/li><ul>/<ul>/isgm; 988 $threadpost =~ s/<ul><\/li>/<ul>/isgm; 989 $threadpost =~ s/<\/li><ul (.+?)>/<ul $1>/isgm; 990 $threadpost =~ s/<ul (.+?)><\/li>/<ul $1>/isgm; 991 992 $threadpost =~ 993 s/\[pre\](.+?)\[\/pre\]/'<pre>' . dopre($1) . '<\/pre>'/isegm; 994 995 $threadpost =~ s/\[flash=(\S+?),(\S+?)\](\S+?)\[\/flash\]/$3/isxgm; 996 997 $threadpost =~ s/\{\{/\[/gxsm; 998 $threadpost =~ s/\}\}/\]/gxsm; 999 1000 if ( $threadpost =~ m{\[table\]}ixsm ) { 1001 $threadpost =~ 1002s/\n{0,1}\[table\]\n*(.+?)\n*\[\/table\]\n{0,1}/<table>$1<\/table>/isgxm; 1003 while ( $threadpost =~ 1004s/\<table\>(.*?)\n*\[tr\]\n*(.*?)\n*\[\/tr\]\n*(.*?)\<\/table\>/<table>$1<tr>$2<\/tr>$3<\/table>/isxm 1005 ) 1006 { 1007 } 1008 while ( $threadpost =~ 1009s/\<tr\>(.*?)\n*\[td\]\n{0,1}(.*?)\n{0,1}\[\/td\]\n*(.*?)\<\/tr\>/<tr>$1<td>$2<\/td>$3<\/tr>/isxm 1010 ) 1011 { 1012 } 1013 } 1014 1015 $threadpost =~ s/\[\&table(.*?)\]/<table$1>/gxsm; 1016 $threadpost =~ s/\[\/\&table\]/<\/table>/gxsm; 1017 $threadpost =~ s/\n/<br \/>/igsm; 1018 1019 ### Censor it ### 1020 $threadtitle = Censor($threadtitle); 1021 $threadpost = Censor($threadpost); 1022 1023 ToChars($threadtitle); 1024 ToChars($threadpost); 1025 1026 $threaddate = timeformat( $threaddate, 1 ); 1027 return; 1028} 1029 1030sub imagemsg { # out of YaBBC.pm -> sub imagemsg { 1031 my ( $attribut, $url ) = @_; 1032 1033 # use or kill urls 1034 $url =~ s/\[url\](.*?)\[\/url\]/$1/igxsm; 1035 $url =~ s/\[link\](.*?)\[\/link\]/$1/igxsm; 1036 $url =~ s/\[url\s*=\s*(.*?)\s*.*?\].*?\[\/url\]/$1/igxsm; 1037 $url =~ s/\[link\s*=\s*(.*?)\s*.*?\].*?\[\/link\]/$1/igxsm; 1038 $url =~ s/\[url.*?\/url\]//igxsm; 1039 $url =~ s/\[link.*?\/link\]//igxsm; 1040 1041 my $char_160 = chr 160; 1042 $url =~ s/(\s| |$char_160)+//gxsm; 1043 1044 if ( $url !~ /^http.+?\.(gif|jpg|jpeg|png|bmp)$/ixsm ) { 1045 return q{ } . $url; 1046 } 1047 1048 my %parameter; 1049 FromHTML($attribut); 1050 $attribut =~ s/(\s|$char_160)+/ /gsm; 1051 foreach ( split / +/sm, $attribut ) { 1052 my ( $key, $value ) = split /=/xsm, $_; 1053 $value =~ s/["']//gxsm; #'" make my syntax checker happy; 1054 $parameter{$key} = $value; 1055 } 1056 1057 if ( $parameter{'name'} ne 'signat_img_resize' ) { 1058 $parameter{'name'} = 'post_img_resize'; 1059 } 1060 ToHTML( $parameter{'alt'} ); 1061 $parameter{'align'} =~ s/[^a-z]//igxsm; 1062 $parameter{'width'} =~ s/\D//gxsm; 1063 $parameter{'height'} =~ s/\D//gxsm; 1064 if ( $parameter{'align'} ) { 1065 $parameter{'align'} = qq~ align:$parameter{'align'};~; 1066 } 1067 if ( $parameter{'width'} ) { 1068 $parameter{'width'} = qq~ width:$parameter{'width'};~; 1069 } 1070 if ( $parameter{'height'} ) { 1071 $parameter{'height'} = qq~ height:$parameter{'height'};~; 1072 } 1073 1074 $imagecount++; 1075 return 1076qq~ <img src="$url" name="$parameter{'name'}" alt="$parameter{'alt'}" style="display:none;$parameter{'align'}$parameter{'width'}$parameter{'height'}" /><span id="urlimagecount$imagecount" style="display:none">$url</span>~; 1077} 1078 10791; 1080