############################################################################### # InstantMessage.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 strict; #use warnings; #no warnings qw(uninitialized once redefine); use CGI::Carp qw(fatalsToBrowser); our $VERSION = '3.1'; $instantmessagepmver = 'YaBBForum 3.1'; if ( $action eq 'detailedversion' ) { return 1; } require Sources::PostBox; require Sources::SpamCheck; LoadLanguage('FA'); LoadLanguage('Post'); get_micon(); get_template('MyMessage'); $set_subjectMaxLength ||= 50; if ( ( $action eq 'imsend' || $action eq 'imsend2' ) && $MaxIMMessLen && $AdMaxIMMessLen ) { $MaxMessLen = $MaxIMMessLen; $AdMaxMessLen = $AdMaxIMMessLen; } if ( $iamadmin || $iamgmod ) { $MaxMessLen = $AdMaxMessLen; } ## create the send IM section of the screen sub buildIMsend { LoadLanguage('InstantMessage'); LoadCensorList(); if ( $FORM{'previewim'} ) { require Sources::Post; Preview($error); } $mctitle = $inmes_txt{'775'}; if ($sendBMess) { $mctitle = $inmes_txt{'775a'}; } ## check for a draft being opened if ( $INFO{'caller'} == 4 && $INFO{'id'} ) { if ( !-e "$memberdir/$username.imdraft" ) { fatal_error( 'cannot_open', "$username.imdraft" ); } fopen( DRAFT, "$memberdir/$username.imdraft" ); my @draftPM = ; fclose(DRAFT); chomp @draftPM; my $flagfound; foreach my $draftMess (@draftPM) { my ( $checkId, undef ) = split /\|/xsm, $draftMess, 2; if ( $checkId eq $INFO{'id'} ) { ( $dmessageid, $dmusername, $userto, $usernamecc, $usernamebcc, $subject, $dmdate, $message, $dmpmessageid, $dmreplyno, $dmips, $dmessageStatus, $dmessageFlags, $dstoreFolder, $dmessageAttachment ) = split /\|/xsm, $draftMess; $flagfound = 1; last; } } if ( !$flagfound ) { fatal_error('cannot_find_draftmess'); } FromHTML($message); FromHTML($subject); } my $pmicon = 'standard'; if ( $FORM{'status'} || $INFO{'status'} ) { $thestatus = $FORM{'status'} || $INFO{'status'}; } elsif ($dmessageStatus) { $thestatus = $dmessageStatus; } else { $thestatus = 's'; } my @ststs = qw( s u c ); my @ststt = qw( sb ub cb ); my @s_select = (); foreach my $i ( 0 .. 2 ) { if ( $thestatus eq $ststs[$i] ) { $s_select[$i] = q~ selected="selected"~; } } foreach my $i ( 0 .. 2 ) { if ( $thestatus eq $ststt[$i] ) { $s_select[$i] = q~ selected="selected"~; $sendBMess = 1; } } if ( $sendBMess != 1 || ( ( $PMenableBm_level != 1 || ( !$staff ) ) && ( $PMenableBm_level != 2 || ( !$iamadmin && !$iamgmod ) ) && ( $PMenableBm_level != 4 || ( !$iamadmin && !$iamgmod && !$iamfmod ) ) && ( $PMenableBm_level != 3 || !$iamadmin ) ) ) { $sendBMess = 0; } ########## post code ######### if ( !$iamadmin && !$iamgmod && !$staff && ${ $uid . $username }{'postcount'} < $numposts ) { fatal_error('im_low_postcount'); } if ( !$replyguest ) { if ($is_preview) { $post_txt{'507'} = $post_txt{'771'}; } $normalquot = $post_txt{'599'}; $simpelquot = $post_txt{'601'}; $simpelcode = $post_txt{'602'}; $edittext = $post_txt{'603'}; if ( !$fontsizemax ) { $fontsizemax = 72; } if ( !$fontsizemin ) { $fontsizemin = 6; } # this defines what the top area of the post box will look like: ## if this is a reply , load the 'from' name off the message if ( $INFO{'reply'} || $INFO{'quote'} ) { $INFO{'to'} = $mfrom; } if ( !$INFO{'to'} && $FORM{'to'} ne q{} ) { $INFO{'to'} = $FORM{'to'}; } ## if cloaking is enabled, and 'to' is not a blank if ( $do_scramble_id && $INFO{'to'} ne q{} ) { decloak( $INFO{'to'} ); } if ( !$sendBMess ) { LoadUser( $INFO{'to'} ); } } $message =~ s//\n/igsm; $message =~ s/ / /gsm; ToChars($message); $message = Censor($message); ToHTML($message); $message =~ s/      /\t/igsm; if ($msubject) { $subject = $msubject; } ToChars($subject); $subject = Censor($subject); ToHTML($subject); if ( $action eq 'modify' || $action eq 'modify2' ) { $displayname = qq~$mename~; } else { $displayname = ${ $uid . $username }{'realname'}; } require Sources::ContextHelp; ContextScript('post'); $MCGlobalFormStart .= qq~ $ctmain ~; $my_gimsend = q{}; $my_tosend_a = q{}; if ( !$replyguest ) { if ($prevmain) { $my_gimsend = $myIM_prevmain; $my_gimsend =~ s/{yabb prevmain}/$prevmain/sm; } $my_gimsend .= $myIM_liveprev; } else { $my_gimsend = $myIM_replyguest; $my_gimsend =~ s/{yabb guest_reply}/$guest_reply{'guesttext'}/sm; } if ( !$replyguest && !$sendBMess && ( $PMenable_cc || $PMenable_bcc ) ) { $yyjavascripttoform = q~ ~; $my_send = $my_tosend; $my_send =~ s/{yabb yyjavascripttoform}/$yyjavascripttoform/sm; $my_send =~ s/{yabb my_tosend_a}/$my_tosend_a/sm; } # now uses a multi-line select ProcIMrecs(); $toname = $INFO{'forward'} ? q{} : $INFO{'to'}; my $toUsersTitle = $inmes_txt{'torecepients'}; if ( !$replyguest ) { $onchangeText = q~ onkeyup="autoPreview();"~; if ($sendBMess) { $toUsersTitle = $inmes_txt{'togroups'}; } if ( $PMenable_cc || $PMenable_bcc ) { $us_winhight = $us_winhight_cc; } else { $us_winhight = $us_winhight_to; } my $toIdtext = $sendBMess ? 'groups' : 'toshow'; $imWinop = qq~
$inmes_txt{'324'} $toUsersTitle: $inmes_txt{'clickto1'} $inmes_txt{'324'} $toUsersTitle $inmes_txt{'clickto2'}
~; $JSandInput = q~ ~; my $iconopts = q{}; for my $i ( sort keys %pmiconlist ) { my ( $img, $alt ) = split /[|]/xsm, $pmiconlist{$i}; if ( $icon eq $img ) { $myic = ' selected="selected" '; } $iconopts .= qq~ \n~; } $imsend_send = $my_imsend_IM; $imsend_send =~ s/{yabb my_send}/$my_send/sm; $imsend_send =~ s/{yabb my_gimsend}/$my_gimsend/sm; $imsend_send =~ s/{yabb imWinop}/$imWinop/sm; $imsend_send =~ s/{yabb imsend_cc}/$imsend_cc/sm; $imsend_send =~ s/{yabb onchange_text2}/$onchange_text2/sm; $imsend_send =~ s/{yabb iconopts}/$iconopts/sm; $imsend_send =~ s/{yabb pmicon}/$pmicon/gsm; $imsend_send =~ s/{yabb pmicon_img}/$micon_bg{$pmicon}/gsm; } else { $imsend_send = $my_imsend_Guest; $imsend_send =~ s/{yabb my_gimsend}/$my_gimsend/sm; $imsend_send =~ s/{yabb my_send}/$my_send/sm; $imsend_send =~ s/{yabb toUsersTitle}/$toUsersTitle/sm; $imsend_send =~ s/{yabb guestName}/$guestName/gsm; $imsend_send =~ s/{yabb guestEmail}/$guestEmail/sm; } $subtitle = "$subject"; #this is the end of the upper area of the post page. # this declares the beginning of the UBBC section $JSandInput .= qq~ ~; $JSandInput .= qq~ ~; if ( $FORM{'draftid'} || $INFO{'caller'} == 4 ) { $JSandInput .= q~~; } $my_max = ( $set_subjectMaxLength + ( $subject =~ /^Re: /sm ? 4 : 0 ) ); # this is for the ubbc buttons if ( !$replyguest ) { if ( $enable_ubbc && $showyabbcbutt ) { $my_ubbc_yes .= qq~$post_txt{'252'}:
~; # ubbc set separated out into PostBox.pm DAR 11/13/2012 # $my_ubbc_yes .= postbox(); } } if ($replyguest) { $tmpmtext = qq~$post_txt{'72'}: ~; } $postbox2 = postbox2(); $postbox3 = postbox3(); if ( !$replyguest ) { $imsend_notguest = $my_postbox_notguest; $moresmilieslist = q{}; $more_smilie_array = q{}; $i = 0; if ( $showadded == 1 ) { while ( $SmilieURL[$i] ) { if ( $SmilieURL[$i] =~ /\//ism ) { $tmpurl = $SmilieURL[$i]; } else { $tmpurl = qq~$imagesdir/$SmilieURL[$i]~; } $moresmilieslist .= qq~ $SmilieDescription[$i]$SmilieLinebreak[$i]\n~; $tmpcode = $SmilieCode[$i]; $tmpcode =~ s/\"/"+'"'+"/gsm; FromHTML($tmpcode); $tmpcode =~ s/&\x2336;/\$/gxsm; $tmpcode =~ s/&\x2364;/\@/gxsm; $more_smilie_array .= qq~" $tmpcode", ~; $i++; } } if ( $showsmdir == 1 ) { opendir DIR, "$htmldir/Smilies"; @contents = readdir DIR; closedir DIR; foreach my $line ( sort { uc($a) cmp uc $b } @contents ) { ( $name, $extension ) = split /\./xsm, $line; if ( $extension =~ /gif/ism || $extension =~ /jpg/ism || $extension =~ /jpeg/ism || $extension =~ /png/ism ) { if ( $line !~ /banner/ism ) { $moresmilieslist .= qq~ $name$SmilieLinebreak[$i]\n~; $more_smilie_array .= qq~" [smiley=$line]", ~; $i++; } } } } $more_smilie_array .= q~""~; if ( $smiliestyle == 1 ) { $smiliewinlink = qq~$scripturl?action=smilieput~; } else { $smiliewinlink = qq~$scripturl?action=smilieindex~; } $im_smilies .= $imsend_notguest . qq~ moresmiliecode = new Array($more_smilie_array); function MoreSmilies(i) { AddTxt=moresmiliecode[i]; AddText(AddTxt); } function smiliewin() { window.open("$smiliewinlink", 'list', 'width=$winwidth, height=$winheight, scrollbars=yes'); } ~; $im_smilies .= smilies_list(); $im_smilies .= qq~ $post_smiltxt{'17'}\n~; $im_smilies .= $my_postbox_smilie; } # PM File Attachments Browse Box Code $allowAttachIM ||= 0; $pmFileLimit ||= 0; $allowGroups = GroupPerms( $allowAttachIM, $pmAttachGroups ); my ( $pmFileTypeInfo, $pmFileSizeInfo, $pmFileExtensions, @files, @fileUsers ); if ( !$replyguest && $allowAttachIM && $allowGroups && -d "$pmuploaddir" ) { $pmFileExtensions = join q{ }, @pmAttachExt; $pmFileTypeInfo = $pmCheckExt == 1 ? qq~$fatxt{'2'} $pmFileExtensions~ : qq~$fatxt{'2'} $fatxt{'4'}~; $pmFileSizeInfo = $pmFileLimit != 0 ? qq~$fatxt{'3'} $pmFileLimit KB~ : qq~$fatxt{'3'} $fatxt{'5'}~; $FORM{'oldattach'} = decloak( $FORM{'oldattach'} ); $mattach = $mattach || $FORM{'oldattach'}; chomp $mattach; foreach my $senderFile ( split /,/xsm, $mattach ) { chomp $senderFile; my ( $forwardFileName, $forwardFileUser ) = split /~/xsm, $senderFile; push @files, $forwardFileName; push @fileUsers, $forwardFileUser; } $cloakAttach = cloak($mattach); $my_show_FA .= $my_FA_show; $my_show_FA =~ s/{yabb cloakAttach}/$cloakAttach/sm; if ( $allowAttachIM > 1 ) { $my_allow_FA = qq~ $fatxt{'80a'} ~; } $my_imFA = $my_FA_attach; $my_imFA =~ s/{yabb my_show_FA}/$my_show_FA/sm; $my_imFA =~ s/{yabb pmFileTypeInfo}/$pmFileTypeInfo/sm; $my_imFA =~ s/{yabb pmFileSizeInfo}/$pmFileSizeInfo/sm; $my_imFA =~ s/{yabb my_allow_FA}/$my_allow_FA/sm; my $startcount; if ( $allowAttachIM > 0 ) { for my $y ( 1 .. $allowAttachIM ) { if ( ( ( $action eq 'imsend2' || $INFO{'forward'} || $FORM{'draftid'} || $INFO{'caller'} == 4 ) && !$FORM{'reply'} ) && $files[ $y - 1 ] ne q{} && -e "$pmuploaddir/$files[$y-1]" ) { if ( $FORM{'draftid'} || $INFO{'caller'} == 4 ) { $fatxt{'6d'} = $fatxt{'6f'}; $fatxt{'6e'} = $fatxt{'6c'}; } $startcount++; $pmAttachUser = cloak( $fileUsers[ $y - 1 ] ); $my_att_FA .= qq~
$fatxt{'6'} $y:
X
 $fatxt{'40'}: $files[$y-1] ~; } else { $my_att_FA .= qq~
1 ? q~ style="visibility:hidden; height:0px"~ : q{} ) . qq~>$fatxt{'6'} $y:
1 ? q~ style="visibility:hidden; height:0px"~ : q{} ) . qq~>\n X~; } $my_att_FA .= qq~\n
\n~; } if ( !$startcount ) { $startcount = 1; } if ( $allowAttachIM > 1 ) { $my_att_FA .= qq~ ~; } $my_imFA .= $my_FA_att; $my_imFA =~ s/{yabb my_att_FA}/$my_att_FA/sm; } } # /PM File Attachments Browse Box Code if ( $INFO{'quote'} || $INFO{'reply'} || $FORM{'reply'} ) { # if this is a reply, need to pass the reply # forward $my_isreply = qq~ ~; } if ( !$replyguest ) { $my_isreply .= qq~
~; if ( $FORM{'draftid'} || $INFO{'caller'} == 4 ) { $my_isreply .= qq~ $post_txt{'draftleave'}
~; } my $sentboxAttachInfo; if ( $allowAttachIM && $allowGroups ) { $sentboxAttachInfo = qq~
$inmes_txt{'321'}~; } $my_isreply .= q~
~; } #these are the buttons to submit my $sendBMessFlag; if ( $sendBMess || $isBMess ) { $sendBMessFlag = q~~; } if ($speedpostdetection) { $my_spdpost = q~ ~; } if ( !$replyguest ) { $my_draft = qq~      ~; } $smilie_url_array = q{}; $smilie_code_array = q{}; $i = 0; if ( $showadded == 2 ) { while ( $SmilieURL[$i] ) { if ( $SmilieURL[$i] =~ /\//ism ) { $tmpurl = $SmilieURL[$i]; } else { $tmpurl = qq~$defaultimagesdir/$SmilieURL[$i]~; } $smilie_url_array .= qq~"$tmpurl", ~; $tmpcode = $SmilieCode[$i]; $tmpcode =~ s/\"/"+'"'+"/gsm; # "' FromHTML($tmpcode); $tmpcode =~ s/&\x2336;/\$/gxsm; $tmpcode =~ s/&\x2364;/\@/gxsm; $smilie_code_array .= qq~" $tmpcode", ~; $i++; } } if ( $showsmdir == 2 ) { opendir DIR, "$htmldir/Smilies"; @contents = readdir DIR; closedir DIR; foreach my $line ( sort { uc($a) cmp uc $b } @contents ) { ( $name, $extension ) = split /\./xsm, $line; if ( $extension =~ /gif/ism || $extension =~ /jpg/ism || $extension =~ /jpeg/ism || $extension =~ /png/ism ) { if ( $line !~ /banner/ism ) { $smilie_url_array .= qq~"$yyhtml_root/Smilies/$line", ~; $smilie_code_array .= qq~" [smiley=$line]", ~; $i++; } } } } $my_browser = qq~ ~; } } return; } ## output one or all IM - detailed view sub DoShowIM { my ($inp) = @_; $messfound = 0; if ( $callerid < 5 ) { updateIMS( $username, $inp, 'inread' ); } my ( $showIM, $fromTitle, $toTitle, $toTitleCC, $toTitleBCC, $usernamelinkfrom, $usernamelinkto, $usernamelinkcc, $usernamelinkbcc, $prevMessId, $nextMessid, $PMnav, $attachDeleteWarn, $pmAttachment, $pmShowAttach, %attach_gif ); $messcount = 0; foreach my $messagesim (@dimmessages) { $nextMessid = $messageid; ( $messageid, $musername, $mtousers, $mccusers, $mbccusers, $msub, $mdate, $immessage, $mpmessageid, $mreplyno, $imip, $mstatus, $mflags, $mstorefolder, $mattach, ) = split /\|/xsm, $messagesim; $messcount++; if ( $messageid == $inp ) { $messfound = 1; last; } } if ( !$messfound ) { my $redirect; my @redrect = ( q{}, 'im', 'imoutbox', 'imstorage', 'imdraft', 'im;focus=bmess', ); foreach my $i ( 1 .. 5 ) { if ( $INFO{'caller'} == $i + 1 ) { $redirect = $redrect[$i]; } } $yySetLocation = qq~$scripturl?action=$redirect~; redirectexit(); } ## if not at the end of the list, catch the 'previous' id if ( $messcount <= $#dimmessages ) { ( $prevMessId, undef ) = split /\|/xsm, $dimmessages[$messcount]; } ## wrap the URL in if ( $INFO{'id'} ne 'all' && $prevMessId ne q{} ) { $previd = qq~« $inmes_imtxt{'40'}~; } if ( $INFO{'id'} ne 'all' && $nextMessid ne q{} ) { $nextid = qq~$inmes_imtxt{'41'} »~; } if ( $INFO{'id'} ne 'all' && $#dimmessages > 0 ) { $allid = qq~$inmes_txt{'190'}~; } my $mydate = timeformat( $mdate, 0, 0, 0, 1 ); if ( $INFO{'caller'} == 1 ) { if ($mtousers) { foreach my $uname ( split /,/xsm, $mtousers ) { LoadValidUserDisplay($uname); $usernamelinkto .= ( ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernamelinkto =~ s/, $//sm; $toTitle = qq~$inmes_txt{'324'}:~; } if ($mccusers) { foreach my $uname ( split /,/xsm, $mccusers ) { LoadValidUserDisplay($uname); $usernamelinkcc .= ( ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; } $usernamelinkcc =~ s/, $//sm; $toTitleCC = qq~$inmes_txt{'325'}:~; } if ($mbccusers) { foreach my $uname ( split /,/xsm, $mbccusers ) { if ( $uname eq $username ) { LoadValidUserDisplay($uname); $usernamelinkbcc = ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ); } } if ($usernamelinkbcc) { $toTitleBCC = qq~$inmes_txt{'326'}:~; } } if ( $mstatus eq 'g' || $mstatus eq 'ga' ) { my ( $guestName, $guestEmail ) = split / /sm, $musername; $guestName =~ s/%20/ /gsm; $usernamelinkfrom = qq~$guestName ($guestEmail)~; } else { LoadValidUserDisplay($musername); $usernamelinkfrom = ${ $uid . $musername }{'realname'} ? CreateUserDisplayLine($musername) : ( $musername ? qq~$musername ($maintxt{'470a'})~ : $maintxt{'470a'} ); # 470a == Ex-Member } $fromTitle = qq~$inmes_txt{'318'}:~; } elsif ( $INFO{'caller'} == 2 ) { LoadValidUserDisplay($musername); $usernamelinkfrom = ${ $uid . $musername }{'realname'} ? CreateUserDisplayLine($musername) : ( $musername ? qq~$musername ($maintxt{'470a'})~ : $maintxt{'470a'} ); # 470a == Ex-Member $fromTitle = qq~$inmes_txt{'318'}:~; if ( $mstatus !~ /b/sm ) { if ( $mstatus !~ /gr/sm ) { foreach my $uname ( split /,/xsm, $mtousers ) { LoadValidUserDisplay($uname); $usernamelinkto .= ( ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } } else { my ( $guestName, $guestEmail ) = split / /sm, $mtousers; $guestName =~ s/%20/ /gsm; $usernamelinkto = qq~$guestName ($guestEmail)~; } $toTitle = qq~$inmes_txt{'324'}:~; } else { foreach my $uname ( split /,/xsm, $mtousers ) { $usernamelinkto .= links_to($uname); } $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; } $usernamelinkto =~ s/, $//sm; if ($mccusers) { foreach my $uname ( split /,/xsm, $mccusers ) { LoadValidUserDisplay($uname); $usernamelinkcc .= ( ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernamelinkcc =~ s/, $//sm; $toTitleCC = qq~$inmes_txt{'325'}:~; } if ($mbccusers) { foreach my $uname ( split /,/xsm, $mbccusers ) { LoadValidUserDisplay($uname); $usernamelinkbcc .= ( ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernamelinkbcc =~ s/, $//sm; $toTitleBCC = qq~$inmes_txt{'326'}:~; } } elsif ( $INFO{'caller'} == 3 ) { if ( $mstatus !~ /b/sm ) { if ( $mstatus !~ /gr/sm ) { foreach my $uname ( split /,/xsm, $mtousers ) { LoadValidUserDisplay($uname); $usernamelinkto .= ( ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } } else { my ( $guestName, $guestEmail ) = split / /sm, $mtousers; $guestName =~ s/%20/ /gsm; $usernamelinkto = qq~$guestName ($guestEmail)~; } $toTitle = qq~$inmes_txt{'324'}:~; if ( $mccusers && $musername eq $username ) { foreach my $uname ( split /,/xsm, $mccusers ) { LoadValidUserDisplay($uname); $usernamelinkcc .= ( ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernamelinkcc =~ s/, $//sm; $toTitleCC = qq~$inmes_txt{'325'}:~; } if ( $mbccusers && $musername eq $username ) { foreach my $uname ( split /,/xsm, $mbccusers ) { LoadValidUserDisplay($uname); $usernamelinkbcc .= ( ${ $uid . $uname }{'realname'} ? CreateUserDisplayLine($uname) : ( $uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'} ) ) . q{, }; # 470a == Ex-Member } $usernamelinkbcc =~ s/, $//sm; $toTitleBCC = qq~$inmes_txt{'326'}:~; } } else { foreach my $uname ( split /,/xsm, $mtousers ) { $usernamelinkto .= links_to($uname); } $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; } $usernamelinkto =~ s/, $//sm; if ( $mstatus eq 'g' || $mstatus eq 'ga' ) { my ( $guestName, $guestEmail ) = split / /sm, $musername; $guestName =~ s/%20/ /gsm; $usernamelinkfrom = qq~$guestName ($guestEmail)~; } else { LoadValidUserDisplay($musername); $usernamelinkfrom = ${ $uid . $musername }{'realname'} ? CreateUserDisplayLine($musername) : ( $musername ? qq~$musername ($maintxt{'470a'})~ : $maintxt{'470a'} ); # 470a == Ex-Member } $fromTitle = qq~$inmes_txt{'318'}:~; } elsif ( $INFO{'caller'} == 5 && ( $mstatus eq 'g' || $mstatus eq 'ga' ) ) { my ( $guestName, $guestEmail ) = split / /sm, $musername; $guestName =~ s/%20/ /gsm; $usernamelinkfrom = qq~$guestName ($guestEmail)~; $fromTitle = qq~$inmes_txt{'318'}:~; } elsif ( $INFO{'caller'} == 5 && $mstatus =~ /b/sm ) { if ($mtousers) { foreach my $uname ( split /,/xsm, $mtousers ) { $usernamelinkto .= links_to($uname); } $usernamelinkto =~ s/, $//sm; $toTitle = qq~$inmes_txt{'324'} $inmes_txt{'327'}:~; } LoadValidUserDisplay($musername); $usernamelinkfrom = ${ $uid . $musername }{'realname'} ? CreateUserDisplayLine($musername) : ( $musername ? qq~$musername ($maintxt{'470a'})~ : $maintxt{'470a'} ); # 470a == Ex-Member $fromTitle = qq~$inmes_txt{'318'}:~; } $PMnav = buildPMNavigator(); ToChars($msub); $msub = Censor($msub); $message = $immessage; wrap(); if ($enable_ubbc) { enable_yabbc(); DoUBBC(); } wrap2(); ToChars($message); $message = Censor($message); $avstyle = q{}; $my_title = q{}; $my_sig = q{}; if ($fromTitle) { $my_title = qq~ $fromTitle $usernamelinkfrom
~; } if ($toTitle) { $my_title .= qq~ $toTitle $usernamelinkto
~; } if ($toTitleCC) { $my_title .= qq~ $toTitleCC $usernamelinkcc
~; } if ($toTitleBCC) { $my_title .= qq~ $toTitleBCC $usernamelinkbcc
~; } if ( $mstatus ne 'ga' && $mstatus ne 'g' && $signature ) { $my_sig = $show_my_sig; $my_sig =~ s/{yabb signature}/$signature/sm; } # Do we have an attachment file? chomp $mattach; if ( $mattach ne q{} ) { foreach ( split /,/xsm, $mattach ) { my ( $pmAttachFile, undef ) = split /~/xsm, $_; if ( $pmAttachFile =~ /\.(.+?)$/xsm ) { $ext = lc $1; } if ( !exists $attach_gif{$ext} ) { $attach_gif{$ext} = ( $ext && -e "$htmldir/Templates/Forum/$useimages/$ext.gif" ) ? "$imagesdir/$ext.gif" : "$micon_bg{'paperclip'}"; } my $filesize = -s "$pmuploaddir/$pmAttachFile"; if ($filesize) { if ( $pmAttachFile =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/ixsm && $pmDisplayPics == 1 ) { $pmShowAttach .= qq~
$pmAttachFile (~ . int( $filesize / 1024 ) . q~ KB)
~ . ( $img_greybox ? ( $img_greybox == 2 ? qq~~ : qq~~ ) : qq~~ ) . qq~$pmAttachFile
\n~; } else { $pmAttachment .= qq~
$pmAttachFile (~ . int( $filesize / 1024 ) . q~ KB)
~; } } else { $pmAttachment .= qq~
$pmAttachFile ($fatxt{'1'})
~; } } if ( $pmShowAttach && $pmAttachment ) { $pmAttachment =~ s/
/
/gsm; } $my_attach .= $show_my_attach; $my_attach =~ s/{yabb pmAttachment}/$pmAttachment/sm; $my_attach =~ s/{yabb pmShowAttach}/$pmShowAttach/sm; } my $lookupIP = ($ipLookup) ? qq~$imip~ : qq~$imip~; if ( $iamadmin || $iamgmod && $gmod_access2{'ipban2'} eq 'on' ) { $imip = $lookupIP; } else { $imip = $inmes_txt{'511'}; } my $postMenuTemp = q{}; if ( $mstatus ne 'ga' && $mstatus ne 'g' ) { $postMenuTemp = $sendEmail . $sendPM . $membAdInfo . ' '; $postMenuTemp =~ s/\Q$menusep//ism; } $mreplyno++; $showIM_link = q{}; if ( $INFO{'caller'} == 1 || ( $INFO{'caller'} == 3 && $musername ne q{} ) || ( $INFO{'caller'} == 5 && $musername ne q{} ) ) { ## inbox / stored inbox can reply/quote if ( $mstatus eq 'g' || $mstatus eq 'ga' ) { $showIM_link .= qq~$img{'reply_ims'}~; } else { $showIM_link .= qq~ $img{'quote'}$menusep $img{'reply_ims'}$menusep~; } } if ( $INFO{'caller'} != 5 && $mstatus ne 'ga' && $mstatus ne 'g' ) { $showIM_link .= qq~ $img{'forward'}$menusep~; } if ( $INFO{'caller'} != 5 || ( $INFO{'caller'} == 5 && ( $iamadmin || $username eq $musername ) ) ) { chomp $mattach; if ( $INFO{'caller'} == 2 || $INFO{'caller'} == 3 || $INFO{'caller'} == 5 && $mattach ne q{} ) { foreach ( split /,/xsm, $mattach ) { my ( $pmAttachFile, $pmAttachUser ) = split /~/xsm, $_; if ( $username eq $pmAttachUser && -e "$pmuploaddir/$pmAttachFile" ) { $attachDeleteWarn = $inmes_txt{'770a'}; } } } $showIM_link .= qq~ $img{'im_remove'} ~; } $showIM_link .= qq~ $menusep$img{'print_im'} ~; $my_notme = q{}; if ( $mstatus =~ m/c/sm ) { $messIconName = 'confidential'; } elsif ( $mstatus =~ m/u/sm ) { $messIconName = 'urgent'; } elsif ( $mstatus =~ m/a/sm || $messStatus =~ m/ga/sm ) { $messIconName = 'alertmod'; } elsif ( $mstatus =~ m/gr/sm ) { $messIconName = 'guestpmreply'; } elsif ( $mstatus =~ m/g/sm ) { $messIconName = 'guestpm'; } else { $messIconName = 'standard'; } if ( $mstatus ne 'ga' && $mstatus ne 'g' ) { $notme = $musername eq $username ? $mtousers : $musername; $notme = ${ $uid . $notme }{'realname'}; $my_notme = ( $notme ? qq~$inmes_imtxt{'42'} $notme~ : ' ' ); } $showIM .= $myIM_show; $showIM =~ s/{yabb my_title}/$my_title/sm; $showIM =~ s/{yabb msub}/$msub/sm; $showIM =~ s/{yabb msimg}/$micon{$messIconName}/sm; $showIM =~ s/{yabb mydate}/$mydate/sm; $showIM =~ s/{yabb message}/$message/sm; $showIM =~ s/{yabb my_sig}/$my_sig/sm; $showIM =~ s/{yabb my_showIP}/$my_showIP/sm; $showIM =~ s/{yabb imip}/$imip/sm; $showIM =~ s/{yabb my_attach}/$my_attach/sm; $showIM =~ s/{yabb postMenuTemp}/$postMenuTemp/sm; $showIM =~ s/{yabb showIM_link}/$showIM_link/sm; $showIM =~ s/{yabb my_notme}/$my_notme/sm; $showIM =~ s/{yabb PMnav}/$PMnav/sm; return $showIM; } ## build the links for single PM display sub buildPMNavigator { if ( $previd ne q{} ) { $PMnav = qq~$previd~; } if ( $allid ne q{} && $previd ne q{} ) { $PMnav .= qq~ | $allid~; } elsif ( $allid ne q{} ) { $PMnav = qq~$allid~; } if ( $nextid ne q{} && $allid ne q{} ) { $PMnav .= qq~ | $nextid~; } return $PMnav; } ## show original PM/BM or the PM/BM before Preview at the bottom of the message field sub doshowims { my $tempdate; if ( $INFO{'id'} && !$INFO{'replyguest'} ) { my $messageCount = 0; my $messageFoundFlag = 0; foreach my $message (@messages) { my $tmnum = ( split /\|/xsm, $message )[0]; if ( $tmnum == $INFO{'id'} ) { $messageFoundFlag = 1; last; } else { $messageCount++; } } ## as a backup, if it is not found that way, revert to the list member if ( !$messageFoundFlag ) { $messageCount = $INFO{'num'}; } ( $messageid, $musername, $mto, $mtocc, $mtobcc, $msub, $mdate, $message, $mparid, $mreplyno, $mip, $mstatus, $mflags, $mstore, $mattach ) = split /\|/xsm, $messages[$messageCount]; $tempdate = timeformat($mdate); } else { return; } ToChars($msub); $msub = Censor($msub); wrap(); if ($enable_ubbc) { enable_yabbc(); DoUBBC(); } wrap2(); ToChars($message); $message = Censor($message); if ( !${ $uid . $musername }{'password'} ) { LoadUser($musername); } my $musernameRealName = ${ $uid . $musername }{'realname'}; if ( !$musernameRealName ) { $musernameRealName = $musername; } $my_save_draft = ( ( $INFO{'id'} && $INFO{'caller'} != 4 ) ? "$inmes_txt{'30'}: " : ( $INFO{'id'} ? "$inmes_txt{'savedraft'} $inmes_txt{'30'}: " : q{} ) ); $imsend .= $my_savedraft; $imsend =~ s/{yabb msub}/$msub/sm; $imsend =~ s/{yabb musernameRealName}/$musernameRealName/sm; $imsend =~ s/{yabb my_save_draft}/$my_save_draft/sm; $imsend =~ s/{yabb tempdate}/$tempdate/sm; $imsend =~ s/{yabb message}/$message/sm; return $imsend; } sub links_to { my ($uname) = @_; my @opts2 = ( [ 'all', 'admins', 'gmods', 'fmods', 'mods', ], [ qq~$inmes_txt{'bmallmembers'}~, qq~$inmes_txt{'bmadmins'}~, qq~$inmes_txt{'bmgmods'}~, qq~$inmes_txt{'bmfmods'}~, qq~$inmes_txt{'bmmods'}~, ], ); if ( $uname eq 'all' || $uname eq 'admins' || $uname eq 'gmods' || $uname eq 'fmods' || $uname eq 'mods' ) { foreach my $i ( 0 .. 4 ) { my $opt0 = $opts2[0]->[$i]; my $opt1 = $opts2[1]->[$i]; if ( $uname eq $opt0 ) { $usernamelinkto = $opt1 . q{, }; } } } else { my ( $title, undef ) = split /\|/xsm, $NoPost{$uname}, 2; $usernamelinkto = qq~$title~ . q{, }; } return $usernamelinkto; } 1;