############################################################################### # MyCenter.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 2.4 # # Packaged: April 12, 2009 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2009 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # # Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com # # Your source for web hosting, web design, and domains. # ############################################################################### $mycenterplver = 'YaBB 2.4 $Revision: 1.124 $'; if ($action eq 'detailedversion') { return 1; } &LoadLanguage('InstantMessage'); &LoadLanguage('MyCenter'); require "$templatesdir/$usemycenter/MyCenter.template"; if (-e "$vardir/gmodsettings.txt" && $iamgmod) { require "$vardir/gmodsettings.txt"; } $mycenter_txt{'welcometxt'} =~ s/USERLABEL/${$uid.$username}{'realname'}/g; # Member Awards Mod Start if (-e("$vardir/AwardSettings.txt")) { require "$vardir/AwardSettings.txt"; } if ($en_awards && $en_awards_mv) { require "$sourcedir/Awards.pl"; &LoadAwards; } # Member Awards Mod End $showIM = ''; $IM_box = ''; $showProfile = ''; $PMfileToOpen = ''; $sendBMess = ''; $isBMess = ''; $showFavorites = ''; $showNotifications = ''; ## here begins the user centre, from the old IMIndex sub mycenter { if ($iamguest) { &fatal_error('im_members_only'); } &LoadBroadcastMessages($username); # get the BM infos $IM_box = ''; my $PMfileToOpen = ''; my @otherStoreFolders = (); my $otherStoreSelect = ''; $replyguest = $INFO{'replyguest'} || $FORM{'replyguest'}; ## select view by action if ($action =~ /^im/ || $action eq 'deletemultimessages' || $action eq 'pmsearch') { $view = 'pm'; } elsif ($action eq 'mycenter') { $view = 'mycenter'; } elsif ($action eq 'shownotify' || $action=~ /^notify/ || $action eq 'boardnotify2') { $view = 'notify'; $mctitle = $img_txt{'418'}; } elsif ($action eq 'myusersrecentposts') { $view = 'recentposts'; } elsif ($action eq 'favorites') { $view = 'favorites'; $mctitle = $img_txt{'70'}; } elsif ($action =~ /^my/) { $view = 'profile'; } ## viewing PMs if ($view eq 'pm') { # pm views ## viewing a message box require "$sourcedir/InstantMessage.pl"; if ($action eq 'im' || $action eq 'imoutbox' || $action eq 'imstorage') { my $foundextra = 0; foreach my $storefolder (split(/\|/, ${$username}{'PMfolders'})) { if($storefolder ne $INFO{'viewfolder'}) { push (@otherStoreFolders, $storefolder); $foundextra = 1; } } if ($foundextra > 0) { $otherStoreSelect = qq~ $inmes_txt{'storein'} ~; } } ## inbox if ($action eq 'im' || ($action eq 'imshow' && $INFO{'caller'} == 1)) { $mctitle = $inmes_txt{'inbox'}; $status = $inmes_imtxt{'status'}; $senderinfo = $inmes_txt{'318'}; $callerid = 1; $boxtxt = $inmes_txt{'316'}; $movebutton = qq~$otherStoreSelect $inmes_txt{'storeor'}~; $IM_box = $inmes_txt{'inbox'}; if($INFO{'focus'} eq 'bmess' || $INFO{'bmess'} eq 'yes') { $IM_box = $inmes_txt{'broadcast'}; $callerid = 5; } $PMfileToOpen = 'msg'; } ## draft box elsif ($action eq 'imdraft') { $mctitle = $inmes_txt{'draft'}; $status = $inmes_imtxt{'status'}; $senderinfo = $inmes_txt{'324'}; $callerid = 4; $boxtxt = $inmes_txt{'draft'}; $movebutton = ''; $IM_box = $inmes_txt{'draft'}; $PMfileToOpen = 'imdraft'; } ## outbox elsif ($action eq 'imoutbox' || ($action eq 'imshow' && $INFO{'caller'} == 2)) { $mctitle = $inmes_txt{'773'}; $status = $inmes_imtxt{'status'}; $senderinfo = $inmes_txt{'324'}; $callerid = 2; $boxtxt = $inmes_txt{'outbox'}; $movebutton = qq~$otherStoreSelect $inmes_txt{'storeor'}~; $IM_box = $inmes_txt{'outbox'}; $PMfileToOpen = 'outbox'; } # store elsif ($action eq 'imstorage' || ($action eq 'imshow' && $INFO{'caller'} == 3)) { $mctitle = $inmes_txt{'774'}; $status = ''; $senderinfo = $inmes_txt{'318'}; if ($INFO{'viewfolder'} eq 'out') { $senderinfo = $inmes_txt{'324'}; } elsif ($INFO{'viewfolder'} ne 'in') { $senderinfo = qq~$inmes_txt{'318'} / $inmes_txt{'324'}~; } $callerid = 3; $boxtxt = $inmes_txt{'storage'}; $movebutton = qq~$otherStoreSelect $inmes_txt{'storeor'}~; $IM_box = $inmes_txt{'storage'}; if ($INFO{'viewfolder'} eq 'in' || $INFO{'viewfolder'} eq 'out') { $IM_box .= qq~ › $im_folders_txt{"$INFO{'viewfolder'}"}~; } elsif ($INFO{'viewfolder'}) { $IM_box .= qq~ › $INFO{'viewfolder'}~; } $PMfileToOpen = 'imstore'; } ## sending a message / previewing elsif ($action eq 'imsend' || ($action eq 'imsend2' && $FORM{'previewim'})) { $IM_box = $inmes_txt{'148'}; if ($INFO{'forward'} == 1) { $IM_box = $inmes_txt{'forward'}; } if ($INFO{'reply'}) { $IM_box = $inmes_txt{'replymess'}; } &IMPost; &buildIMsend; &doshowims; } ## posting the message or draft elsif ($action eq 'imsend2' || $FORM{'draft'}) { $IM_box = $inmes_txt{'148'}; if($INFO{'forward'} == 1) { $IM_box = $inmes_txt{'forward'}; } if($INFO{'reply'}) { $IM_box = $inmes_txt{'replymess'}; } &IMsendMessage; } elsif ($action eq 'imshow' && $INFO{'caller'} == 5) { $mctitle = $inmes_txt{'broadcast'}; $status = $inmes_imtxt{'status'}; $senderinfo = $inmes_txt{'318'}; $callerid = 5; $boxtxt = $inmes_txt{'316'}; $movebutton = qq~$otherStoreSelect $inmes_txt{'storeor'}~; $IM_box = $inmes_txt{'broadcast'}; $PMfileToOpen = 'msg'; } } ## viewing front page elsif ($view eq "mycenter") { $mctitle = "$inmes_txt{'mycenter'}"; } ## viewing my profile elsif ($view eq "profile") { $mctitle = "$mc_menus{'profile'}"; } ## viewing my recent posts elsif ($view eq 'recentposts') { $mctitle = "$inmes_txt{'viewrecentposts'} $inmes_txt{'viewrecentposts2'}"; } ## draw the container &drawPMbox($PMfileToOpen); &LoadIMs; # navigation link $yynavigation = qq~› $img_txt{'mycenter'} › $mctitle~; ## set template up $mycenter_template =~ s/({|<)yabb mcviewmenu(}|>)/$MCViewMenu/g; $mycenter_template =~ s/({|<)yabb mcmenu(}|>)/$yymcmenu/g; $mycenter_template =~ s/({|<)yabb mcpmmenu(}|>)/$MCPmMenu/g; $mycenter_template =~ s/({|<)yabb mcprofmenu(}|>)/$MCProfMenu/g; $mycenter_template =~ s/({|<)yabb mcpostsmenu(}|>)/$MCPostsMenu/g; $mycenter_template =~ s/({|<)yabb mcglobformstart(}|>)/$MCGlobalFormStart/g; $mycenter_template =~ s/({|<)yabb mcglobformend(}|>)/ ($MCGlobalFormStart ? "<\/form>" : "") /e; $mycenter_template =~ s/({|<)yabb mcextrasmilies(}|>)/$MCExtraSmilies/g; $mycenter_template =~ s/({|<)yabb mccontent(}|>)/$MCContent/g; $mycenter_template =~ s/({|<)yabb mctitle(}|>)/$mctitle/g; $mycenter_template =~ s/({|<)yabb selecthtml(}|>)/$selecthtml/g; $mycenter_template =~ s/({|<)yabb forumjump(}|>)//g; ## end new style box $yymain .= $mycenter_template; if (%usernames_life_quote) { # for display names in Quotes in LivePreview $yymain .= qq~ \n\n~; } &template; } sub AddFolder { if ($iamguest) { &fatal_error("im_members_only"); } my $storefolders = ${$username}{'PMfolders'}; my @currStoreFolders = split(/\|/, ${$username}{'PMfolders'}); my $newStoreFolders = "in|out"; my $newFolderName = $FORM{'newfolder'}; chomp $newFolderName; my $x = 0; nxtfdr: foreach my $currStoreFolder (@currStoreFolders) { if ($FORM{'newfolder'}) { if ($newFolderName =~ /[^0-9A-Za-z \-_]/) { &fatal_error('invalid_character', $inmes_txt{'foldererror'}); } if ($FORM{'newfolder'} eq $currStoreFolder) { &fatal_error('im_folder_exists'); } } elsif ($FORM{'delfolders'}) { if ($currStoreFolder ne 'in' && $currStoreFolder ne 'out' && $FORM{"delfolder$x"} ne 'del') { $newStoreFolders .= qq~|$currStoreFolder~; } } $x++; } if ($FORM{'newfolder'}) { ${$username}{'PMfolders'} = qq~$storefolders|$FORM{'newfolder'}~; } elsif ($FORM{'delfolders'}) { ${$username}{'PMfolders'} = $newStoreFolders; } &buildIMS($username, 'update'); $yySetLocation = qq~$scripturl?action=mycenter~; &redirectexit; } ## call an unopened message back sub CallBack { if ($iamguest) { &fatal_error("im_members_only"); } my $receiver = $INFO{'receiver'}; # set variables from GET - localised if ($receiver && $receiver !~ /,/) { my $receiver = &decloak($receiver); if (&CallBackRec($receiver,$INFO{'rid'},1)) { &fatal_error("im_deleted"); } &updateIMS($receiver,$INFO{'rid'},'callback'); } elsif ($receiver) { my $rec; foreach $rec (split(/,/, $receiver)) { $rec = &decloak($rec); if (&CallBackRec($rec,$INFO{'rid'},0)) { &fatal_error("im_deleted_multi"); } } foreach $rec (split(/,/, $receiver)) { $rec = &decloak($rec); &CallBackRec($rec,$INFO{'rid'},1); &updateIMS($rec,$INFO{'rid'},'callback'); } } &updateMessageFlag($username, $INFO{'rid'}, 'outbox', '', 'c'); $yySetLocation = qq~$scripturl?action=imoutbox~; &redirectexit; } sub CallBackRec { my ($receiver,$rid,$do_it) = @_; fopen(RECMSG, "$memberdir/$receiver.msg"); my @rims = ; fclose(RECMSG); my ($nodel,$rmessageid,$fromuser,$flags); fopen(REVMSG, ">$memberdir/$receiver.msg") if $do_it; ## run through and drop the message line foreach (@rims) { ($rmessageid,$fromuser, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $flags, undef) = split(/\|/, $_, 14); if (!$do_it) { if ($rmessageid == $rid && $fromuser eq $username) { if ($flags !~ /u/i) { $nodel = 1; } last; } } else { if ($rmessageid != $rid || $fromuser ne $username) { print REVMSG $_; } elsif ($flags !~ /u/i) { print REVMSG $_; $nodel = 1;} } } fclose(REVMSG) if $do_it; $nodel; } sub checkIMS { # lookup value in pm file my $user = $_[0]; my $id = $_[1]; my $checkfor = $_[2]; ## has the message been opened by the receiver? 1 = yes 0 = no if ($checkfor eq 'messageopened') { my $messageFoundFlag = &checkMessageFlag($user, $id, 'msg', 'u'); if ($messageFoundFlag == 1) { return 0; } else {$messageFoundFlag = &checkMessageFlag($user, $id, 'imstore', 'u'); } if ($messageFoundFlag == 1) { return 0; } else { return 1; } ## has the message been replied to? 1 = yes 0 = no } elsif ($checkfor eq 'messagereplied') { ## check in msg and imstore my $messageFoundFlag = &checkMessageFlag($user, $id, 'msg', 'r'); if ($messageFoundFlag == 1) { return 1; } else {$messageFoundFlag = &checkMessageFlag($user, $id, 'imstore', 'r'); } if ($messageFoundFlag == 1) { return 1; } else { return 0; } } } sub checkMessageFlag { # look for $user.$pmFile, find $id message and check for $messageFlag my ($user, $id, $pmFile, $messageFlag) = @_; my $messageFoundFlag = 0; if (%{'MF' . $user . $pmFile}) { if (exists ${'MF' . $user . $pmFile}{$id} && ${'MF' . $user . $pmFile}{$id} =~ /$messageFlag/i) { $messageFoundFlag = 1; } } elsif (-e "$memberdir/$user.$pmFile") { fopen ("USERMSG", "$memberdir/$user.$pmFile"); my @userMessages = ; fclose ("USERMSG"); my ($uMessageId,$uMessageFlags); foreach (@userMessages) { ($uMessageId, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $uMessageFlags, undef) = split(/\|/, $_, 14); ${'MF' . $user . $pmFile}{$uMessageId} = $uMessageFlags; if ($uMessageId == $id && $uMessageFlags =~ /$messageFlag/i) { $messageFoundFlag = 1; } } } $messageFoundFlag; } sub updateMessageFlag { # look for $user.$pmFile, find $id message and check for $messageFlag. change to $newMessageFlag my ($user, $id, $pmFile, $messageFlag, $newMessageFlag) = @_; my $messageFoundFlag = 0; if ((!exists ${'MF' . $user . $pmFile}{$id} || ($messageFlag ne '' && ${'MF' . $user . $pmFile}{$id} =~ /$messageFlag/) || ($messageFlag eq '' && !${'MF' . $user . $pmFile}{$id} =~ /$newMessageFlag/)) && -e "$memberdir/$user.$pmFile") { fopen ("USERFILE", "+<$memberdir/$user.$pmFile"); my @userFile = ; seek USERFILE, 0, 0; truncate USERFILE, 0; foreach my $userMessage (@userFile) { my ($uMessageId, $uFrom, $uToUser, $uTocc, $uTobcc, $uSubject, $uDate, $uMessage, $uPid, $uReply , $uip, $uStatus, $uMessageFlags, $uStorefolder, $uAttach) = split(/\|/, $userMessage); if ($uMessageId == $id) { $uMessageFlags =~ s/$newMessageFlag//gi if $newMessageFlag ne ''; if ($uMessageFlags =~ s/$messageFlag/$newMessageFlag/i) { $messageFoundFlag = 1; } else { $uMessageFlags .= $newMessageFlag; } $userMessage = "$uMessageId|$uFrom|$uToUser|$uTocc|$uTobcc|$uSubject|$uDate|$uMessage|$uPid|$uReply|$uip|$uStatus|$uMessageFlags|$uStorefolder|$uAttach"; } ${'MF' . $user . $pmFile}{$uMessageId} = $uMessageFlags; print USERFILE $userMessage; } fclose("USERFILE"); } $messageFoundFlag; } sub updateIMS { # update .ims file for user: &updateIMS(,,[target/action]) my ($user,$id,$target) = @_; # load the user who is processed here, if not allready loaded &buildIMS($user, 'load') unless exists ${$user}{'PMmnum'}; # new msg received - add to the inbox lists and increment the counts if ($target eq 'messagein') { # read the lines into temp variables ${$user}{'PMmnum'}++; ${$user}{'PMimnewcount'}++; # message sent - add to the outbox list and increment count } elsif ($target eq 'messageout') { ${$user}{'PMmoutnum'}++; # reading msg in inbox - newcount -1, remove from unread list } elsif ($target eq 'inread') { if (&updateMessageFlag($user, $id, 'msg', 'u', '')) { ${$user}{'PMimnewcount'}--; } else { return; } # callback message - take off imnewcount, mnum } elsif ($target eq 'callback') { ${$user}{'PMmnum'}--; ${$user}{'PMimnewcount'}--; # draft added } elsif ($target eq 'draftadd') { ${$user}{'PMdraftnum'}++; # draft send } elsif ($target eq 'draftsend') { ${$user}{'PMdraftnum'}--; } &buildIMS($user, 'update'); # rebuild the .ims file it with the new values } # delete|move IMs sub Del_Some_IM { &LoadLanguage('InstantMessage'); if ($iamguest) { &fatal_error('im_members_only'); } my $fileToOpen = "$username.msg"; if ($INFO{'caller'} == 2) { $fileToOpen = "$username.outbox"; } elsif ($INFO{'caller'} == 3) { $fileToOpen = "$username.imstore"; } elsif ($INFO{'caller'} == 4) { $fileToOpen = "$username.imdraft"; } elsif ($INFO{'caller'} == 5) { $fileToOpen = "broadcast.messages"; } fopen(USRFILE, "+<$memberdir/$fileToOpen"); seek USRFILE, 0, 0; my @messages = ; seek USRFILE, 0, 0; truncate USRFILE, 0; # deleting if ($FORM{'imaction'} eq $inmes_txt{'remove'} || $INFO{'action'} eq $inmes_txt{'remove'} || $INFO{'deleteid'}) { my %CountStore; if ($INFO{'caller'} == 2) { ${$username}{'PMmoutnum'} = 0; } elsif ($INFO{'caller'} == 4) { ${$username}{'PMdraftnum'} = 0; } elsif ($INFO{'caller'} != 3) { ${$username}{'PMmnum'} = 0; ${$username}{'PMimnewcount'} = 0; } if ($INFO{'deleteid'}) { $FORM{"message" . $INFO{'deleteid'}} = 1; } # singel delete foreach (@messages) { my @m = split(/\|/, $_); if (!exists $FORM{"message" . $m[0]}) { print USRFILE $_; if ($INFO{'caller'} == 2) { ${$username}{'PMmoutnum'}++; } elsif ($INFO{'caller'} == 3) { $CountStore{$m[13]}++; } elsif ($INFO{'caller'} == 4) { ${$username}{'PMdraftnum'}++; } else { ${$username}{'PMmnum'}++; ${$username}{'PMimnewcount'}++ if $m[12] =~ /u/; } } else { if ($INFO{'caller'} == 3) { $INFO{'viewfolder'} = $m[13]; } elsif ($INFO{'caller'} == 5) { ${$username}{'PMbcRead'} =~ s/$m[0]\b//g unless ${$username}{'PMbcRead'} =~ s/\b$m[0]$//; } } } fclose(USRFILE); if ($INFO{'caller'} == 3) { ${$username}{'PMfoldersCount'} = ''; ${$username}{'PMstorenum'} = 0; foreach (split(/\|/, ${$username}{'PMfolders'})) { $CountStore{$_} ||= 0; ${$username}{'PMfoldersCount'} .= ${$username}{'PMfoldersCount'} eq '' ? $CountStore{$_} : "|$CountStore{$_}"; ${$username}{'PMstorenum'} += $CountStore{$_}; } } &buildIMS($username, 'update'); # moving messages } elsif ($FORM{'imaction'} eq $inmes_imtxt{'store'} || $INFO{'imaction'} eq $inmes_imtxt{'store'}) { my (@newmessages,%CountStore,$imstorefolder); if ($FORM{'tostorefolder'}) { $imstorefolder = $FORM{'tostorefolder'}; } elsif ($INFO{'caller'} == 1) { $imstorefolder = 'in'; } else { $imstorefolder = 'out'; } foreach (@messages) { if (!$FORM{"message" . (split(/\|/, $_, 2))[0]}) { if ($INFO{'caller'} != 3) { print USRFILE $_; } else { my @m = split(/\|/, $_); push(@newmessages, [@m]); $CountStore{$m[13]}++; } } else { my @m = split(/\|/, $_); $m[13] = $imstorefolder; push(@newmessages, [@m]); $CountStore{$imstorefolder}++; if ($INFO{'caller'} != 3) { ${$username}{'PMstorenum'}++; ${$username}{'PMmnum'}--; ${$username}{'PMimnewcount'}-- if $m[12] =~ /u/; } } } fclose(USRFILE); if (@newmessages) { if ($INFO{'caller'} != 3) { fopen(IUSRFILE, "$memberdir/$username.imstore"); foreach () { my @m = split(/\|/, $_); push(@newmessages, [@m]); $CountStore{$m[13]}++; } fclose(IUSRFILE); } fopen(TRANSFER, ">$memberdir/$username.imstore"); print TRANSFER map({ join('|', @$_) } sort { $$b[6] <=> $$a[6] } @newmessages); fclose(TRANSFER); ${$username}{'PMfoldersCount'} = ''; foreach (split(/\|/, ${$username}{'PMfolders'})) { $CountStore{$_} ||= 0; ${$username}{'PMfoldersCount'} .= ${$username}{'PMfoldersCount'} eq '' ? $CountStore{$_} : "|$CountStore{$_}"; } &buildIMS($username, 'update'); } } my $redirect = 'im'; if ($INFO{'caller'} == 2) { $redirect = 'imoutbox'; } elsif ($INFO{'caller'} == 3) { $redirect = "imstorage;viewfolder=$INFO{'viewfolder'}"; } elsif ($INFO{'caller'} == 4) { $redirect = 'imdraft'; } elsif ($INFO{'caller'} == 5) { $redirectview = ';focus=bmess'; } $yySetLocation = qq~$scripturl?action=$redirect~; &redirectexit; } # if the user is valid.. sub LoadValidUserDisplay { my $muser = $_[0]; if (!$yyUDLoaded{$muser} && -e "$memberdir/$muser.vars") { $sm = 1; &LoadUserDisplay($muser); } } # create either a full link or just a name for the IM display sub CreateUserDisplayLine { $usrname = $_[0]; my $usernamelink; $sendPM = ''; $sendEmail = ''; $membAdInfo = ''; if ($yyUDLoaded{$usrname}) { unless ($INFO{'caller'} == 2 && ($mstatus =~ /b/ || $mtousers =~ /,/ || $mccusers || $mbccusers)) { $signature = ${$uid.$usrname}{'signature'}; if ($INFO{'caller'} == 2 || $INFO{'caller'} == 3) { $signature = ''; } unless($INFO{'caller'} == 5 && $mstatus eq 'g') { &userOnLineStatus($usrname); } if (!$iamguest) { # Allow instant message sending if current user is a member. $sendPM = qq~$menusep$img{'message_sm'}~; } if (!${$uid.$usrname}{'hidemail'} || $iamadmin || $iamgmod || $allow_hide_email != 1) { $sendEmail = qq~$menusep$img{'email_sm'}~; } my $wwwlink = ${$uid.$usrname}{'weburl'} ? qq~$menusep${$uid.$usrname}{'weburl'}~ : ''; my $aimad = ${$uid.$usrname}{'aim'} ? qq~$menusep${$uid.$usrname}{'aim'}~ : ''; my $icqad = ${$uid.$usrname}{'icq'} ? qq~$menusep${$uid.$usrname}{'icq'}~ : ''; my $yimad = ${$uid.$usrname}{'yim'} ? qq~$menusep${$uid.$usrname}{'yim'}~ : ''; my $msnad = ${$uid.$usrname}{'msn'} ? qq~$menusep${$uid.$usrname}{'msn'}~ : ''; my $gtalkad = ${$uid.$usrname}{'gtalk'} ? qq~$menusep${$uid.$usrname}{'gtalk'}~ : ''; my $skypead = ${$uid.$usrname}{'skype'} ? qq~$menusep${$uid.$usrname}{'skype'}~ : ''; my $myspacead = ${$uid.$usrname}{'myspace'} ? qq~$menusep${$uid.$usrname}{'myspace'}~ : ''; my $facebookad = ${$uid.$usrname}{'facebook'} ? qq~$menusep${$uid.$usrname}{'facebook'}~ : ''; $membAdInfo = $profbutton . $wwwlink . $msnad . $gtalkad . $icqad . $yimad . $aimad . $skypead . $myspacead . $facebookad; } $usernamelink = $link{$usrname}; if ($musername eq $username) { $imOpened = &checkIMS($usrname, $messageid, 'messageopened'); &LoadUser($usrname); if (!$imOpened && (${$uid.$usrname}{'notify_me'} < 2 || $enable_notifications < 2)) { $usernamelink .= qq~ ($inmes_imtxt{'83'})~; } } } else { $usernamelink = qq~$usrname~; } $usernamelink; } # posting the IM sub IMPost { if (($INFO{'bmess'} || $FORM{'isBMess'}) eq 'yes') { $sendBMess = 1; } ## if user isn't a FA/gmod and has a postcount below the threshold if (!$staff && ${$uid.$username}{'postcount'} < $numposts) { &fatal_error('im_low_postcount'); } ## guests not allowed if ($iamguest) { &fatal_error('im_members_only'); } my ($mdate, $mip, $mmessage); ## if the IM has a number assigned already, open the right IM file if ($INFO{'id'} ne '' && !$replyguest) { if ($INFO{'caller'} < 5) { &updateIMS($username, $INFO{'id'}, 'inread'); } my $pmFileType = "$username.msg"; if ($INFO{'caller'} == 2) { $pmFileType = "$username.outbox"; } elsif ($INFO{'caller'} == 3) { $pmFileType = "$username.imstore"; } elsif ($INFO{'caller'} == 4) { $pmFileType = "$username.imdraft"; } elsif ($INFO{'caller'} == 5) { $pmFileType = "broadcast.messages"; } fopen(FILE, "$memberdir/$pmFileType"); @messages = ; fclose(FILE); ## split content of IM file up foreach my $checkTheMessage (@messages) { ($qmessageid, $mfrom, $mto, $mtocc, $mtobcc, $msubject, $mdate, $message, $mparid, $mreplyno, $mip, $mstatus, $mflags, $mstore, $mattach) = split(/\|/, $checkTheMessage); if ($qmessageid == $INFO{'id'}) { last; } } ## remove 're:' from subject (why?) $msubject =~ s/Re: //g; ## if replying/quoting, up the reply# by 1 if ($INFO{'quote'} || $INFO{'reply'}) { $mreplyno++; $INFO{'status'} = $mstatus; } ## if quote if ($INFO{'reply'}) { $message = ''; } if ($INFO{'quote'}) { # swap out brs and spaces $message =~ s~~\n~gi; $message =~ s/ \  \  \ /\t/ig; if (!$nestedquotes) { $message =~ s~\n{0,1}\[quote([^\]]*)\](.*?)\[/quote\]\n{0,1}~\n~isg; $message =~ s~\n*\[/*quote([^\]]*)\]\n*~~ig; } if ($mfrom ne "" && $do_scramble_id) { $cloakedAuthor = &cloak($mfrom); } else { $cloakedAuthor = $mfrom; } # next 2 lines for display names in Quotes in LivePreview &LoadUser($mfrom); $usernames_life_quote{$cloakedAuthor} = ${$uid.$mfrom}{'realname'}; $quotestart = int($quotemsg / $maxmessagedisplay) * $maxmessagedisplay; if ($INFO{'forward'} || $INFO{'quote'}) { $message = qq~[quote author=$cloakedAuthor link=impost date=$mdate\]$message\[/quote\]\n~; } if ($message =~ /\#nosmileys/isg) { $message =~ s/\#nosmileys//isg; $nscheck = "checked"; } } if ($INFO{'reply'} || $INFO{'forward'} || $INFO{'quote'}) { $msubject = "Re: $msubject"; } } elsif ($replyguest) { fopen(FILE, "$memberdir/broadcast.messages"); my @messages = ; fclose(FILE); ## split content of IM file up foreach my $checkTheMessage (@messages){ ($qmessageid, $mfrom, $mto, $mtocc, $mtobcc, $msubject, $mdate, $message, $mparid, $mreplyno, $mip, $mstatus, $mflags, $mstore, $mattach) = split(/\|/, $checkTheMessage); if ($qmessageid == $INFO{'id'}) { last; } } ($guestName, $guestEmail) = split(/\ /, $mfrom); $guestName =~ s/%20/ /g; $message =~ s~~\n~gi; $message =~ s/ \  \  \ /\t/ig; $message =~ s~\[b\](.*?)\[/b\]~*$1*~isg; $message =~ s~\[i\](.*?)\[/i\]~/$1/~isg; $message =~ s~\[u\](.*?)\[/u\]~_$1_~isg; $message =~ s~\[.*?\]~~g; my $sendtouser = ${$uid.$username}{'realname'}; my $mdate = &timeformat($mdate, 1); require "$sourcedir/Mailer.pl"; &LoadLanguage('Email'); #sender email date subject message $message = &template_email($replyguestmail, {'sender' => $guestName, 'email' => $guestEmail, 'sendto' => $sendtouser, 'date' => $mdate, 'subject' => $msubject, 'message' => $message}); $msubject = qq~Re: $msubject~; } &FromHTML($message) if $INFO{'forward'} || $INFO{'quote'}; &FromHTML($msubject); $submittxt = $inmes_txt{'sendmess'}; if ($INFO{'forward'} == 1) { $submittxt = $inmes_txt{'forward'}; } $destination = 'imsend2'; $waction = 'imsend'; $is_preview = 0; $post = 'imsend'; $previewtxt = $inmes_txt{'507'}; $preview = 'previewim'; $icon = 'xx'; $draft = 'draft'; $mctitle = $inmes_txt{'sendmess'}; if ($sendBMess) { $mctitle = $inmes_txt{'sendbroadmess'}; } } sub MarkAll { if ($iamguest) { &fatal_error('im_members_only'); } fopen(FILE, "+<$memberdir/$username.msg"); seek FILE, 0, 0; my @messages = ; seek FILE, 0, 0; truncate FILE, 0; foreach (@messages) { my ($imessageid, $imusername, $imusernameto, $imusernametocc, $imusernametobcc, $imsub, $imdate, $mmessage, $imessagepid, $imreply, $mip, $imstatus, $imflags, $imstore, $imattach) = split(/\|/, $_); if ($imflags =~ s/u//i) { print FILE "$imessageid|$imusername|$imusernameto|$imusernametocc|$imusernametobcc|$imsub|$imdate|$mmessage|$imessagepid|$imreply|$mip|$imstatus|$imflags|$imstore|$imattach"; } else { print FILE $_; } } fclose(FILE); ${$username}{'PMimnewcount'} = 0; &buildIMS($username, 'update'); if ($INFO{'oldmarkread'}) { $yySetLocation = qq~$scripturl?action=im~; &redirectexit; } $elenable = 0; die ""; # This is here only to avoid server error log entries! } # change type of page index for PM sub PmPageindex { my ($msindx, $trindx, $mbindx, undef) = split(/\|/, ${$uid.$username}{'pageindex'}); if ($INFO{'action'} eq 'pmpagedrop') { ${$uid.$username}{'pageindex'} = qq~$msindx|$trindx|$mbindx|1~; } if ($INFO{'action'} eq 'pmpagetext') { ${$uid.$username}{'pageindex'} = qq~$msindx|$trindx|$mbindx|0~; } &UserAccount($username, 'update'); if ($INFO{'pmaction'} =~ /\//) { my ($act, $val) = split(/\//, $INFO{'pmaction'}); $INFO{'pmaction'} = $act . ';start=' . $val; } if ($INFO{'focus'} eq 'bmess') { $bmesslink = qq~;focus=bmess~;} $yySetLocation = qq~$scripturl?action=$INFO{'pmaction'}$bmesslink;start=$INFO{'start'}~ . ($INFO{'viewfolder'} ? ";viewfolder=$INFO{'viewfolder'}" : ""); &redirectexit; } # draw the whole block , with the menu, and the various PM views. sub drawPMbox { &LoadLanguage('InstantMessage'); &LoadLanguage('Profile'); $PMfileToOpen = $_[0]; @dimmessages; @bmessages; if ($view eq 'pm' && ($PM_level == 1 || $PM_level == 2 && ($iamadmin || $iamgmod || $iammod) || $PM_level == 3 && ($iamadmin || $iamgmod) )) { ($qmessageid, $mfrom, $mto, $mtocc, $mtobcc, $msubject, $mdate, $message, $mparid, $mreplyno, $mip, $mstatus, $mflags, $mstore, $mattach); if (!$INFO{'focus'}) { if ($callerid < 5) { fopen(NFILE, "$memberdir/$username.$PMfileToOpen"); @dimmessages = ; my ($mID,$mFlag); foreach (reverse(@dimmessages)) { ($mID, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, undef, $mFlag, undef) = split(/\|/, $_, 14); ${$username . $PMfileToOpen}{$mID} = $mFlag; if ($INFO{'id'} == -1 && $mFlag eq 'u') { $INFO{'id'} = $mID; } } } else { fopen(NFILE, "$memberdir/broadcast.messages"); @bmessages = ; } fclose(NFILE); } elsif ($INFO{'focus'} eq 'bmess' && $PMenableBm_level > 0) { fopen(BFILE, "$memberdir/broadcast.messages"); @bmessages = ; fclose(BFILE); } $stkmess = 0; if (@bmessages > 0) { foreach my $checkbcm (@bmessages) { my (undef, $mfrom, $mto, undef, undef, undef, undef, undef, undef, undef, undef, $messStatus, undef) = split (/\|/, $checkbcm); if ($mfrom eq $username || &BroadMessageView($mto)) { if ($INFO{'sort'} ne 'gpdate' && ($messStatus =~ /g/ || $messStatus =~ /a/)) { push (@stkbmessages, $checkbcm); $stkmess++; } else { push (@tmpbmessages, $checkbcm); } } } undef @bmessages; } @stkbmessages = sort {$b <=> $a} @stkbmessages; @tmpbmessages = sort {$b <=> $a} @tmpbmessages; push (@dimmessages, @stkbmessages); push (@dimmessages, @tmpbmessages); undef @stkbmessages; undef @tmpbmessages; } $yyjavascript .= qq~ function changeBox(cbox) { box = eval(cbox); box.checked = !box.checked; } ~; ## new style box #### ## start with forum > my messages > inbox $yymain .= qq~ ~; if ($action =~ /^im/ && (!@dimmessages && $INFO{'focus'} ne 'bmess') && ($PM_level == 1 || $PM_level == 2 && ($iamadmin || $iamgmod || $iammod) || $PM_level == 3 && ($iamadmin || $iamgmod))) { if (!@dimmessages) { if ($action eq 'im') { unlink("$memberdir/$username.msg"); } elsif ($action eq 'imoutbox') { unlink("$memberdir/$username.outbox"); } elsif ($action eq 'imstorage') { unlink("$memberdir/$username.imstore"); } elsif ($action eq 'imdraft') { unlink("$memberdir/$username.imdraft"); } } } &LoadCensorList; # Fix moderator showing in info $sender = 'im'; $acount = 0; ## set browser title $yytitle = $mycenter_txt{'welcometxt'}; ## start new container - left side is menu, right side is content my ($display_prof, $display_posts, $display_pm, $tabPMHighlighted, $tabProfHighlighted, $tabNotifyHighlighted); if ($mycenter_template =~ /({|<)yabb mcmenu(}|>)/g) { &mcMenu; $newtemplate = 1; } if ($view eq 'profile' || ($view eq 'mycenter' && ($PM_level == 0 || ($PM_level == 2 && !$iamadmin && !$iamgmod && !$iammod ) || ($PM_level == 3 && !$iamadmin && !$iamgmod)))) { $display_prof = 'inline'; $tabProfHighlighted = 'windowbg2'; } else { $display_prof = 'none'; $tabProfHighlighted = 'windowbg'; } if ($view eq 'notify' || $view eq 'favorites' || $view eq 'recentposts') { $display_posts = 'inline'; $tabNotifyHighlighted = 'windowbg2'; } else { $display_posts = 'none'; $tabNotifyHighlighted = 'windowbg'; } if ($view eq 'pm' || ($view eq 'mycenter' && ($PM_level == 1 || ($PM_level == 2 && ($iamadmin || $iamgmod || $iammod)) || ($PM_level == 3 && ($iamadmin || $iamgmod))))) { $display_pm = 'inline'; $tabPMHighlighted = 'windowbg2'; } else { $display_pm = 'none'; $tabPMHighlighted = 'windowbg'; } my $tabWidth = '33%'; if ($PM_level == 0 || ($PM_level == 2 && !$iamadmin && !$iamgmod && !$iammod ) || ($PM_level == 3 && !$iamadmin && !$iamgmod)) { $tabWidth = '50%'; } $MCViewMenu = ''; $MCPmMenu = ''; $MCProfMenu = ''; $MCPostsMenu = ''; $MCExtraSmilies = ''; $MCContent = ''; if ($newtemplate) { $MCViewMenu .= qq~ ~; } else { $MCViewMenu .= qq~ \n~; $MCViewMenu .= qq~ ~; if ($PM_level == 0 || ($PM_level == 2 && !$iamadmin && !$iamgmod && !$iammod ) || ($PM_level == 3 && !$iamadmin && !$iamgmod)) { $display_prof = 'inline'; $tabProfHighlighted = 'windowbg2'; } if ($PM_level == 1 || ($PM_level == 2 && ($iamadmin || $iamgmod || $iammod)) || ($PM_level == 3 && ($iamadmin || $iamgmod)) ) { $MCViewMenu .= qq~ ~; } $MCViewMenu .= qq~
\n~; } ## start Profile div $MCProfMenu = qq~
~; ## links for profile pages. SID is now cloaked and controls whether or not ## the action goes to authenticate or straight to the page. ## The trick is to use $page to pass the intended page through and switch over on ## positive id. if ($page && $page ne $action) { $action = $page; } my $profileLink; my $sid = $INFO{'sid'}; my $thisLink = ''; my $sidLink = ''; if (!$sid) {$sid = $FORM{'sid'}; } if ($sid) { $sidLink = ";sid=$sid"; } if (!$sid) { $profileLink = 'action=profileCheck;page='; } else {$profileLink = 'action=';} $thisLink = 'action=myviewprofile;username=' . $useraccount{$username}; $MCProfMenu .= qq~ $inmes_txt{'viewprofile'}

~; $thisLink = $profileLink . 'myprofile;username=' . $useraccount{$username} . $sidLink; $MCProfMenu .= qq~ $profile_txt{'79'}
~; $thisLink = $profileLink . 'myprofileContacts;username=' . $useraccount{$username} . $sidLink; $MCProfMenu .= qq~ $profile_txt{'819'}
~; $thisLink = $profileLink . 'myprofileOptions;username=' . $useraccount{$username} . $sidLink; $MCProfMenu .= qq~ $profile_txt{'818'}
~; if ($buddyListEnabled) { $thisLink = $profileLink . 'myprofileBuddy;username=' . $useraccount{$username} . $sidLink; $MCProfMenu .= qq~ $profile_buddy_list{'buddylist'}
~; } if ($PM_level == 1 || ($PM_level == 2 && ($iamadmin || $iamgmod || $iammod)) || ($PM_level == 3 && ($iamadmin || $iamgmod))) { $thisLink = $profileLink . 'myprofileIM;username=' . $useraccount{$username} . $sidLink; $MCProfMenu .= qq~ $inmes_txt{'765'}
~; } if ($PersonalPadEnabled) { $thisLink = $profileLink . 'myprofileNotepad;username=' . $useraccount{$username} . $sidLink; $MCProfMenu .= qq~ $profile_txt{'notepad'}
~; } if ($iamadmin || ($iamgmod && $allow_gmod_profile && $gmod_access2{'profileAdmin'} eq 'on')) { $thisLink = $profileLink . 'myprofileAdmin;username=' . $useraccount{$username} . $sidLink; $MCProfMenu .= qq~ $profile_txt{'820'}
~; } $MCProfMenu .= qq~
~; ## end Profile div ## start Posts div $MCPostsMenu = qq~
$inmes_txt{'viewnotify'}
$inmes_txt{'viewfavs'}
~; if (${$uid.$username}{'postcount'} > 0 && $maxrecentdisplay > 0) { $MCPostsMenu .= qq~

$inmes_txt{'viewrecentposts'} $inmes_txt{'viewrecentposts2'}
~; } $MCPostsMenu .= qq~
~; ## end Posts div if (!$replyguest) { if ($view eq 'pm' && $action ne 'imsend' && $action ne 'imsend2') { my $imstoreFolder; if ($action eq 'imstorage') { $imstoreFolder = ";viewfolder=$INFO{'viewfolder'}"; } $MCGlobalFormStart .= qq~
~; } elsif ($view eq 'pm') { $MCGlobalFormStart .= qq~~; ## add smilies box ## smilies $MCPmMenu .= qq~ \n~; if ($showadded == 2 || $showsmdir == 2) { $MCExtraSmilies .= qq~

~; } } } else { $MCGlobalFormStart .= qq~~; } ################################################### ######## right side container starts here ################################################### if ($view eq 'mycenter') { &LoadUserDisplay($username); my $memberinfo = "$memberinfo{$username}${$uid.$username}{'cutitle'}$addmembergroup{$username}"; my $userOnline = &userOnLineStatus($username) . "
"; my $template_mood = ${$uid.$username}{'mood'}; my $template_postinfo = qq~$mycenter_txt{'posts'}: ${$uid.$username}{'postcount'}
~; my $template_age; if ($age && $showuserage) { &CalcAge($username, "calc"); $template_age = qq~$profile_txt{'420'}: $age
~; } my $userlocation; if (${$uid.$username}{'location'}) { $userlocation = ${$uid.$username}{'location'} . "
"; } $mctitle = $mycenter_txt{'welcometxt'}; ################################# $myprofileblock =~ s/({|<)yabb userlink(}|>)/$link{$username}/g; $myprofileblock =~ s/({|<)yabb memberinfo(}|>)/$memberinfo/g; $myprofileblock =~ s/({|<)yabb stars(}|>)/$memberstar{$username}/g; $myprofileblock =~ s/({|<)yabb useronline(}|>)/$userOnline/g; $myprofileblock =~ s/({|<)yabb userpic(}|>)/${$uid.$username}{'userpic'}/g; $myprofileblock =~ s/({|<)yabb usertext(}|>)/${$uid.$username}{'usertext'}/g; $myprofileblock =~ s/({|<)yabb postinfo(}|>)/$template_postinfo/g; $myprofileblock =~ s/({|<)yabb location(}|>)/$userlocation/g; $myprofileblock =~ s/({|<)yabb age(}|>)/$template_age/g; $myprofileblock =~ s/({|<)yabb gender(}|>)/${$uid.$username}{'gender'}/g; $myprofileblock =~ s/({|<)yabb zodiac(}|>)/${$uid.$username}{'zodiac'}/g; $myprofileblock =~ s/({|<)yabb awards(}|>)/$member_awards{$username}/g; # Member Awards Mod $myprofileblock =~ s/({|<)yabb mood(}|>)/$template_mood/g; ################################ $myprofileblock =~ s/({|<)yabb .+?(}|>)//g; if ($buddyListEnabled) { $buddiesCurrentStatus; if (${$uid.$username}{'buddylist'}) { &LoadBuddyList; $buddiesCurrentStatus = qq~$mycenter_txt{'buddylisttitle'}:
$buddiesCurrentStatus~; } else { $buddiesCurrentStatus = $mycenter_txt{'buddylistnone'}; } } else { $buddiesCurrentStatus = qq~ ~; } $MCContent .= qq~ ~; } $MCContent .= qq~'$onOffStatus' $stealthstatus
$myprofileblock $buddiesCurrentStatus
$mycenter_txt{'currentsettings'}
$mycenter_txt{'onoffstatus'}
~; my $onOffStatus = ${$uid.$username}{'offlinestatus'} eq 'away' ? $mycenter_txt{'onoffstatusaway'} : $mycenter_txt{'onoffstatuson'}; my $stealthstatus = ''; if (($iamadmin || $iamgmod) && $enable_MCstatusStealth) { $stealthstatus = $mycenter_txt{'stealth_off'}; if (${$uid.$username}{'stealth'}) { $stealthstatus = $mycenter_txt{'stealth_on'}; } $stealthstatus = qq~
$mycenter_txt{'stealth'} '$stealthstatus'
~; ############### sending pm ####################### } elsif ($view eq 'pm' && ($action eq 'imsend' || $action eq 'imsend2')) { my $sendTitle = $inmes_txt{'sendmess'}; if ($sendBMess) { $sendTitle = $inmes_txt{'sendbroadmess'}; } $MCContent .= qq~ $MCGlobalFormStart $imsend
~; $MCGlobalFormStart = ''; # inbox/outbox/ storage/draft viewing } elsif ($view eq 'pm' && ($action eq 'im' || $action eq 'imoutbox' || $action eq 'imstorage' || $action eq 'imdraft')) { &drawPMView; } elsif ($view eq 'pm' && $action eq 'imshow') { $showIM = ''; if ($INFO{'id'} eq 'all') { my $BC; foreach (@dimmessages) { $showmessid = (split /\|/, $_)[0]; $showIM .= &DoShowIM($showmessid); if ($INFO{'caller'} == 5 && !${$username}{'PMbcRead' . $showmessid}) { ${$username}{'PMbcRead'} .= ${$username}{'PMbcRead'} ? ",$showmessid" : $showmessid; $BCnewMessage--; $BC = 1; } } if ($BC) { &buildIMS($username, 'update'); } } else { $showIM = &DoShowIM($INFO{'id'}); if ($INFO{'caller'} == 5 && !${$username}{'PMbcRead' . $INFO{'id'}}) { ${$username}{'PMbcRead'} .= ${$username}{'PMbcRead'} ? ",$INFO{'id'}" : $INFO{'id'}; &buildIMS($username, 'update'); $BCnewMessage--; } } $MCContent .= qq~ $showIM
~; } elsif ($view eq 'pm' && $action eq 'pmsearch') { &spam_protection; $yysearchmain = ''; require "$sourcedir/Search.pl"; &pmsearch; $MCContent .= qq~ $yysearchmain
~; $mctitle = "$pm_search{'desc'}"; } elsif ($view eq 'profile') { ## if user has had to go via id check, this restores their intended page $page = $INFO{'page'}; if($page && $action ne $page) { $action = $page; } require "$sourcedir/Profile.pl"; if ($action eq 'myprofileIM') { &ModifyProfileIM; } elsif ($action eq 'myprofileIM2') { &ModifyProfileIM2; } elsif ($action eq 'myprofile') { &ModifyProfile; } elsif ($action eq 'myprofile2') { &ModifyProfile2; } elsif ($action eq 'myprofileContacts') { &ModifyProfileContacts; } elsif ($action eq 'myprofileContacts2') { &ModifyProfileContacts2; } elsif ($action eq 'myprofileOptions') { &ModifyProfileOptions; } elsif ($action eq 'myprofileOptions2') { &ModifyProfileOptions2; } elsif ($action eq 'myprofileBuddy') { &ModifyProfileBuddy; } elsif ($action eq 'myprofileBuddy2') { &ModifyProfileBuddy2; } elsif ($action eq 'myprofileNotepad') { &ModifyProfileNotepad; } elsif ($action eq 'myprofileNotepad2') { &ModifyProfileNotepad2; } elsif ($action eq 'myviewprofile') { &ViewProfile; } elsif ($action eq 'myprofileAdmin') { &ModifyProfileAdmin; } elsif ($action eq 'myprofileAdmin2') { &ModifyProfileAdmin2; } $MCContent .= qq~ $showProfile
~; } elsif ($view eq 'notify') { require "$sourcedir/Notify.pl"; if ($action eq 'shownotify') { &ShowNotifications; } elsif ($action eq 'boardnotify2') { &BoardNotify2; &ShowNotifications; } elsif ($action eq 'notify4') { &Notify4; } $MCContent .= qq~$showNotifications
~; } elsif ($view eq 'recentposts') { require "$sourcedir/Profile.pl"; &usersrecentposts; $MCContent .= qq~$showProfile
~; } elsif ($view eq 'favorites'){ require "$sourcedir/Favorites.pl"; &Favorites; $MCContent .= qq~$showFavorites
~; } ## start PM div if ($PM_level == 1 || ($PM_level == 2 && ($iamadmin || $iamgmod || $iammod)) || ($PM_level == 3 && ($iamadmin || $iamgmod))) { $MCPmMenu .= qq~
~; if (($PMenableBm_level == 1 && ($iamadmin || $iamgmod || $iammod)) || ($PMenableBm_level == 2 && ($iamadmin || $iamgmod)) || ($PMenableBm_level == 3 && $iamadmin)) { $MCPmMenu .= qq~ ~; } my $inboxNewCount = qq~, ${$username}{'PMimnewcount'} $inmes_txt{'new'}~; if (${$username}{'PMimnewcount'} == 0) { $inboxNewCount = ''; } $MCPmMenu .= qq~ ~; if ($PMenableBm_level > 0 || ($PMenableGuestButton == 1 && ($iamadmin || $iamgmod))) { $inboxNewCount = $BCnewMessage ? " ($inmes_txt{'new'})" : ""; $MCPmMenu .= qq~ ~; } my @folderCount = split(/\|/, ${$username}{'PMfoldersCount'}); $MCPmMenu .= qq~ ~; ## if there are some folders to show under storage ## split the list down and show it with link to each folder if ($enable_storefolders > 0) { my $storeFoldersTotal = 0; my $DelAdFolder = 0; if (${$username}{'PMfolders'}) { my $x = 2; foreach my $storefolder (split(/\|/, ${$username}{'PMfolders'})) { if ($storefolder ne 'in' && $storefolder ne 'out') { $storeFoldersTotal++; $MCPmMenuTemp .= qq~ ~; $x++; } } if ($DelAdFolder) { $MCPmMenuTemp .= qq~ ~; } } if ($storeFoldersTotal) { $MCPmMenu .= qq~ ~; } $MCPmMenu .= qq~ ~; $yyjavascript .= qq~\nvar markallreadlang = '$inmes_txt{'500'}';\nvar markfinishedlang = '$inmes_txt{'500a'}';~; ## this allows user to add a new folder on the fly if ($storeFoldersTotal < $enable_storefolders ) { $MCPmMenu .= qq~ ~; } } unless ($enable_PMsearch == 0) { $MCPmMenu .= qq~ ~; } $MCPmMenu .= qq~
$img{'sendbmess'}
$img{'im_send'}
$inmes_txt{'inbox'} $inmes_txt{'inbox'} ${$username}{'PMmnum'}$inboxNewCount
$inmes_txt{'broadcast'} $inmes_txt{'broadcast'} $BCCount$inboxNewCount
$inmes_txt{'draft'} $inmes_txt{'draft'} ${$username}{'PMdraftnum'}
$inmes_txt{'outbox'} $inmes_txt{'outbox'} ${$username}{'PMmoutnum'}

$inmes_txt{'storage'} $inmes_txt{'storage'} ${$username}{'PMstorenum'}
     $im_folders_txt{'in'} ~; $MCPmMenu .= $folderCount[0] || 0; $MCPmMenu .= qq~
     $im_folders_txt{'out'} ~; $MCPmMenu .= $folderCount[1] || 0; $MCPmMenu .= qq~
~; if ($storeFoldersTotal > 0 && $folderCount[$x] == 0) { $DelAdFolder = 1; $MCPmMenuTemp .= qq~ ~; } else { $MCPmMenuTemp .= qq~ ~; } $MCPmMenuTemp .= qq~    $storefolder ~; $MCPmMenuTemp .= $folderCount[$x] || 0; $MCPmMenuTemp .= qq~
$MCPmMenuTemp

$inmes_txt{'764'}




~; if ($view eq 'pm' && $action ne 'pmsearch') { $MCPmMenu .= qq~ -
~; } $MCPmMenu .= qq~ -
~; } ## end PM div } sub drawPMView { ## column headers ## note - if broadcast messages not enabled but guest pm is, admin/gmod still ## see the broadcast split if (($enable_PMcontrols && ${$uid.$username}{'pmviewMess'}) || (!$enable_PMcontrols && !$enable_PMviewMess) ) { if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } } if ($INFO{'sort'} ne 'gpdate' && $INFO{'sort'} ne 'thread') { &pageLinksList; } my $dateColhead = "$inmes_txt{'317'}"; if ($action eq 'imdraft') { $dateColhead = $inmes_txt{'datesave'}; } $mctitle = $IM_box; $MCContent .= qq~ ~; if (($#dimmessages >= $maxmessagedisplay || $INFO{'start'} =~ /all/) && $action ne 'imstorage') { $MCContent .= qq~ ~; } if ($INFO{'viewfolder'} ne '') { $vfolder = qq~;viewfolder=$INFO{'viewfolder'}~; } if ($INFO{'focus'} eq 'bmess') { $vbmess = qq~;focus=bmess~; } if ($INFO{'sort'} ne 'gpdate') { $sbgpdate = qq~;sort=gpdate~; } unless ($action eq 'imstorage' && $INFO{'viewfolder'} eq '') { $MCContent .= qq~ ~; } ## if no messages found in file, say so my $storeContentFound = 0; if ($INFO{'viewfolder'} && @dimmessages) { foreach my $checkPost (@dimmessages) { my $thisStorefolder= (split /\|/, $checkPost)[13]; if ($thisStorefolder eq $INFO{'viewfolder'}) { $storeContentFound = 1; last; } } } if (!@dimmessages || ($storeContentFound == 0 && $INFO{'viewfolder'})) { ## drop in the 'no messages' text $MCContent .= qq~
$pageindex1$pageindexjs
$inmes_txt{'70'} $senderinfo $dateColhead
$inmes_txt{'151'}


~; } else { ## set colours for display $acount++; my $sortBy = $INFO{'sort'}; my $maxcounter; $start = $start || 0; ## if on last page, adjust the maxcounter down if ((($#dimmessages + 1) - $start) < $maxmessagedisplay || $sortBy eq 'gpdate' || $action eq 'imstorage') { $maxcounter = @dimmessages; } else { $maxcounter = ($start + $maxmessagedisplay); } my $viewBMess; my $groupByDate = 0; my $dateSpan = 0; my $latestPM = 0; if ($INFO{'focus'} eq 'bmess') { $viewBMess = 1; } if ($sortBy eq 'gpdate') { my $topMDate = (split /\|/, $dimmessages[0])[6]; my $oldestDate = (split /\|/, $dimmessages[$#dimmessages])[6]; $groupByDate = 1; ## work out the span of days - today less oldest message, in days $dateSpan = int(($date - $oldestDate) / 86400); # in days $latestPM = (($date - $topMDate) / 3600); # in hours } ## if sort is grouped, extra block is added per group ## pull date of newest pm my $latestDateSet = 0; my $lastWeekSet = 0; my $twoWeeksSet = 0; my $threeWeeksSet = 0; my $monthSet = 0; my $gtMonthSet = 0; my $uselegend = ""; # work out the newest pm date soa s to put the right first block in if ($dateSpan > 31) { $gtMonthSet = 1; $uselegend = 'older'; } if ($dateSpan > 21 && ($latestPM / 24) < 32 ) { $monthSet = 1; $uselegend = 'fourweeks';} if ($dateSpan > 14 && ($latestPM / 24) < 22 ) { $threeWeeksSet = 1; $uselegend = 'threeweeks';} if ($dateSpan > 7 && ($latestPM / 24) < 15 ) { $twoWeeksSet = 1; $uselegend = 'twoweeks';} if ($dateSpan > 1 && ($latestPM / 24) < 8 ) { $lastWeekSet = 1; $uselegend = 'oneweek';} if ($latestPM < 24) { $latestDateSet = 1; $uselegend = 'latest'; } if ($sortBy eq 'gpdate') { $MCContent .= qq~ $im_sorted{$uselegend} ~; $counterCheck = $start; } if ($viewBMess) { $stkDateSet = 1; } for ($counter = $start; $counter < $maxcounter; $counter++) { ########## top of messages list ########## # $messageid, $musername, $musernameto, $musernamecc, $musernamebcc $class_PM_list = $class_PM_list eq 'windowbg2' ? 'windowbg' : 'windowbg2'; chomp $dimmessages[$counter]; my ($messageid, $musername, $musernameto, $musernamecc, $musernamebcc, $msub, $mdate, $immessage, $mpmessageid, $mreplyno, $mips, $messageStatus, $messageFlags, $storeFolder, $messageAttachment) = split(/\|/, $dimmessages[$counter]); ## if we are viewing one of the storage folders, filter out the ## PMs that don't match if ($action eq 'imstorage' && $INFO{'viewfolder'} ne $storeFolder) { $class_PM_list = $class_PM_list eq 'windowbg2' ? 'windowbg' : 'windowbg2'; next; } ## set the status icon my $messIconName = 'standard'; if ($messageStatus =~ /c/) { $messIconName = 'confidential'; } elsif ($messageStatus =~ /u/) { $messIconName = 'urgent'; } elsif ($messageStatus =~ /a/) { $messIconName = 'alertmod'; } elsif ($messageStatus =~ /gr/) { $messIconName = 'guestpmreply'; } elsif ($messageStatus =~ /g/) { $messIconName = 'guestpm'; } my $messIcon = qq~$im_message_status{$messIconName}~; my ($hasMultiRecs,$multiRecs); if ($musernameto =~ /,/ || $musernamecc || $musernamebcc ) { $hasMultiRecs = 1; } ## if store, set the from/to # check for multiple recs (outbox/store/draft only) ## and build the to/rec string for individual callback my %usersRec; my $usernameto = ''; if ($action eq 'imoutbox' || $action eq 'imstorage' || $action eq 'imdraft') { if ($hasMultiRecs) { my $switchComma = 0; $usernameto = ''; if ($messageStatus !~ /b/) { ## check each to see if they read the message foreach my $muser (split(/\,/, $musernameto)) { $userToMessRead = &checkIMS($muser, $messageid, 'messageopened'); %usersRec = {%usersRec , $muser => $userToMessRead}; if (!$yyUDLoaded{$muser}) { &LoadUser($muser); } if ($usernameto && $switchComma == 0) { $usernameto .= qq~ ...~; $switchComma = 1; } elsif (!$usernameto) { $usernameto = qq~${$uid.$muser}{'realname'}~; } } if ($musernamecc) { ## check each to see if they read the message foreach my $muser (split(/\,/, $musernamecc)) { $userToMessRead = &checkIMS($muser, $messageid, 'messageopened'); %usersRec = {%usersRec , $muser => $userToMessRead}; if (!$yyUDLoaded{$muser}) { &LoadUser($muser); } if ($usernameto && $switchComma == 0) { $usernameto .= qq~ ...~; $switchComma = 1; } } } if ($musernamebcc) { ## check each to see if they read the message foreach my $muser (split(/\,/, $musernamebcc)) { $userToMessRead = &checkIMS($muser, $messageid, 'messageopened'); %usersRec = {%usersRec , $muser => $userToMessRead}; if (!$yyUDLoaded{$muser}) { &LoadUser($muser); } if($usernameto && $switchComma == 0) {$usernameto .= qq~ ...~; $switchComma = 1; } } } } else { foreach my $muser (split(/\,/, $musernameto)) { if ($muser eq 'all') { $usernameto = $inmes_txt{'bmallmembers'}; } elsif ($muser eq 'mods') { $usernameto = $inmes_txt{'bmmods'}; } elsif ($muser eq 'gmods') { $usernameto = $inmes_txt{'bmgmods'}; } elsif ($muser eq 'admins') { $usernameto = $inmes_txt{'bmadmins'}; } else { my $title = (split /\|/, $NoPost{$muser})[0]; $usernameto = $title; } if ($usernameto && $switchComma == 0) { $usernameto .= qq~ ...~; $switchComma = 1; last; } } } } else { if ($messageStatus !~ /b/) { $userToMessRead = &checkIMS($musernameto, $messageid, 'messageopened'); if (!$yyUDLoaded{$musernameto}) { &LoadUser($musernameto); } $usernameto = qq~${$uid.$musernameto}{'realname'}~; } else { if ($musernameto eq 'all') { $usernameto = $inmes_txt{'bmallmembers'}; } elsif ($musernameto eq 'mods') { $usernameto = $inmes_txt{'bmmods'}; } elsif ($musernameto eq 'gmods') { $usernameto = $inmes_txt{'bmgmods'}; } elsif ($musernameto eq 'admins') { $usernameto = $inmes_txt{'bmadmins'}; } else { my $title = (split /\|/, $NoPost{$musernameto})[0]; $usernameto = $title; } } } } ## done multi ## kill if not needed if (!$hasMultiRecs) { undef %usersRec; } ## time to output name # for multi recs, have to split it down and test per user ## happens for any message sent with cc or bcc my $checkz = 0; my $allChecked = 0; $msub = &Censor($msub); &ToChars($msub); $mydate = &timeformat($mdate); ## start of message row 1 ## for inbox or store, check from my ($fromToName, $messageIcon, $callBack, $messageAction); if ($action ne 'imstorage' && $action ne 'imdraft' && !$viewBMess) { ## detect multi-rec my ($imnew, $imRepliedTo, $imOpened); ## outbox - has the recp opened the message? (allow for multi) if ($action eq 'imoutbox' && !$hasMultiRecs ) { $imOpened = &checkIMS($musernameto, $messageid, 'messageopened'); } elsif ($action eq 'im') { ## inbox - has user opened ? $imOpened = &checkIMS($username, $messageid, 'messageopened'); } if ($action eq 'im') { $imRepliedTo = &checkIMS($username, $messageid, 'messagereplied'); } ## viewing inbox if ($action eq 'im') { ## not opened if (!$imOpened && !$hasMultiRecs) { $messageIcon = qq~$inmes_imtxt{'innotread'}~; } ## replied to elsif ($imRepliedTo && !$hasMultiRecs) { $messageIcon = qq~$inmes_imtxt{'08'}~; } ## opened elsif ($imOpened && !$hasMultiRecs) { $messageIcon = qq~$inmes_imtxt{'inread'}~; } ## not opened multi elsif (!$imOpened && $hasMultiRecs) { $messageIcon = qq~$inmes_imtxt{'inread'}~; } ## opened multi elsif ($imOpened && $hasMultiRecs) { $messageIcon = qq~$inmes_imtxt{'inread'}~; } } ## outbox elsif ($action eq 'imoutbox') { ## not opened if (!$imOpened && !$hasMultiRecs) { &LoadUser($musernameto); if (${$uid.$musernameto}{'notify_me'} < 2 || $enable_notifications < 2) { $messageIcon = qq~$inmes_imtxt{'outnotread'}~; $callBack = qq~$inmes_imtxt{'83'} | ~; } else { $messageIcon = qq~$inmes_imtxt{'outnotread'}~; } } ## opened elsif ($imOpened && !$hasMultiRecs) { $messageIcon = $messageFlags =~ /c/i ? qq~$inmes_imtxt{'callback'}~ : qq~$inmes_imtxt{'outread'}~; } ## for multi rec, and none opened if ($hasMultiRecs) { my ($countrecepients,$countread,@receivers); my $tousers = $musernameto; $tousers .= ",$musernamecc" if $musernamecc; $tousers .= ",$musernamebcc" if $musernamebcc; foreach my $recname (split(/,/, $tousers)) { $countrecepients++; &LoadUser($recname); if (&checkIMS($recname, $messageid, 'messageopened') || (${$uid.$recname}{'notify_me'} > 1 && $enable_notifications > 1)) { $countread++; } else { push(@receivers, $useraccount{$recname}); } } if (!$countread) { $messageIcon = qq~$inmes_imtxt{'outmultinotread'}~; $callBack = qq~$inmes_imtxt{'83'} | ~; } elsif ($countrecepients == $countread) { $messageIcon = $messageFlags =~ /c/i ? qq~$inmes_imtxt{'outmulticallback'}~ : qq~$inmes_imtxt{'outmultiread'}~; } else { $messageIcon = $messageFlags =~ /c/i ? qq~$inmes_imtxt{'outsomemulticallback'}~ : qq~$inmes_imtxt{'outmultisomeread'}~; $callBack = qq~$inmes_imtxt{'multicallback'} | ~; } } } } ## switch action if opening a draft - want this sending to the 'send' screen my $actString = 'imshow'; if ($action eq 'imdraft') { $actString = 'imsend'; } ## if grouping, check bar here if ($stkmess && $sortBy ne 'gpdate' && $normDateSet && $viewBMess) { ## sticky messages $normDateSet = 0; $MCContent .= qq~ $im_sorted{'standart'} ~; } if ($stkmess && $sortBy ne 'gpdate' && $stkDateSet && $viewBMess && ($messageStatus =~ /g/ || $messageStatus =~ /a/)) { ## sticky messages $stkDateSet = 0; $MCContent .= qq~ $im_sorted{'important'} ~; } if ($sortBy eq 'gpdate') { $uselegend = ''; if ($latestDateSet && ($date - $mdate)/86400 > 1 && $counter > $counterCheck) { $latestDateSet = 0; if ($lastWeekSet) { $counterCheck = $counter if ($date - $mdate)/86400 <= 7; $uselegend = 'oneweek'; } } if ($lastWeekSet && ($date - $mdate)/86400 > 7 && $counter > $counterCheck) { $lastWeekSet = 0; if ($twoWeeksSet) { $counterCheck = $counter if ($date - $mdate)/86400 <= 14; $uselegend = 'twoweeks'; } } if ($twoWeeksSet && ($date - $mdate)/86400 > 14 && $counter > $counterCheck) { $twoWeeksSet = 0; if ($threeWeeksSet) { $counterCheck = $counter if ($date - $mdate)/86400 <= 21; $uselegend = 'threeweeks'; } } if ($threeWeeksSet && ($date - $mdate)/86400 > 21 && $counter > $counterCheck) { $threeWeeksSet = 0; if ($monthSet) { $counterCheck = $counter if ($date - $mdate)/86400 <= 31; $uselegend = 'fourweeks'; } } if ($monthSet && ($date - $mdate)/86400 > 31 && $counter > $counterCheck) { $monthSet = 0; if ($gtMonthSet) { $uselegend = 'older'; } } $MCContent .= qq~ $im_sorted{$uselegend} ~ if $uselegend; } my $BCnew; if ($action eq 'im' && $viewBMess && !${$username}{'PMbcRead' . $messageid}) { $BCnew = qq~ ~; } $MCContent .= qq~ $BCnew$messageIcon$messIcon$msub ~; if ($action eq 'im' || ($action eq 'imstorage' && $INFO{'viewfolder'} eq 'in')) { if ($messageStatus eq 'g') { my ($guestName, $guestEmail) = split(/ /, $musername); $guestName =~ s/%20/ /g; $usernamefrom = qq~$guestName
($guestEmail)~; } else { &LoadUser($musername); # is from user $usernamefrom = ${$uid.$musername}{'realname'} ? qq~${$uid.$musername}{'realname'}~ : ($musername ? qq~$musername ($maintxt{'470a'})~ : $maintxt{'470a'}); # 470a == Ex-Member } $MCContent .= $usernamefrom; # [inbox / broadcast / storage in] } elsif ($action eq 'imoutbox' || ($action eq 'imstorage' && $INFO{'viewfolder'} eq 'out')) { my @usernameto; if ($messageStatus eq 'gr') { my ($guestName, $guestEmail) = split(/ /, $musernameto); $guestName =~ s/%20/ /g; $usernameto[0] = qq~$guestName
($guestEmail)~; } elsif ($messageStatus =~ /b/) { foreach my $uname (split(/,/, $musernameto)) { if ($uname eq 'all') { push(@usernameto, $inmes_txt{'bmallmembers'}); } elsif ($uname eq 'mods') { push(@usernameto, $inmes_txt{'bmmods'}); } elsif ($uname eq 'gmods') { push(@usernameto, $inmes_txt{'bmgmods'}); } elsif ($uname eq 'admins') { push(@usernameto, $inmes_txt{'bmadmins'}); } else { my ($title, undef) = split(/\|/, $NoPost{$uname}, 2); push(@usernameto, $title); } } } else { my $uname = $musernameto; # is to user $uname .= ",$musernamecc" if $musernamecc; if ($musernamebcc) { if ($musername eq $username) { $uname .= ",$musernamebcc"; } else { foreach (split(/,/, $musernamebcc)) { if ($_ eq $username) { $uname .= ",$username"; last; } } } } foreach $uname (split(/,/, $uname)) { &LoadUser($uname); push(@usernameto, (${$uid.$uname}{'realname'} ? qq~${$uid.$uname}{'realname'}~ : ($uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'}))); # 470a == Ex-Member } } $MCContent .= join(', ', @usernameto); # [outbox / storage out] } elsif ($action eq 'imdraft') { my @usernameto; if ($messageStatus =~ /b/) { foreach my $uname (split(/,/, $musernameto)) { if ($uname eq 'all') { push(@usernameto, $inmes_txt{'bmallmembers'}); } elsif ($uname eq 'mods') { push(@usernameto, $inmes_txt{'bmmods'}); } elsif ($uname eq 'gmods') { push(@usernameto, $inmes_txt{'bmgmods'}); } elsif ($uname eq 'admins') { push(@usernameto, $inmes_txt{'bmadmins'}); } else { my ($title, undef) = split(/\|/, $NoPost{$uname}, 2); push(@usernameto, $title); } } } else { my $uname = $musernameto; # is to user $uname .= ",$musernamecc" if $musernamecc; if ($musernamebcc) { if ($musername eq $username) { $uname .= ",$musernamebcc"; } else { foreach (split(/,/, $musernamebcc)) { if ($_ eq $username) { $uname .= ",$username"; last; } } } } foreach $uname (split(/,/, $uname)) { &LoadUser($uname); push(@usernameto, (${$uid.$uname}{'realname'} ? qq~${$uid.$uname}{'realname'}~ : ($uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'}))); # 470a == Ex-Member } } $MCContent .= join(', ', @usernameto); # [draft] } else { my @usernameto; if ($messageStatus eq 'g') { my ($guestName, $guestEmail) = split(/ /, $musername); $guestName =~ s/%20/ /g; $usernamefrom = qq~$guestName
($guestEmail)~; my $uname = $musernameto; # is to user $uname .= ",$musernamecc" if $musernamecc; if ($musernamebcc) { if ($musername eq $username) { $uname .= ",$musernamebcc"; } else { foreach (split(/,/, $musernamebcc)) { if ($_ eq $username) { $uname .= ",$username"; last; } } } } foreach $uname (split(/,/, $uname)) { &LoadUser($uname); push(@usernameto, (${$uid.$uname}{'realname'} ? qq~${$uid.$uname}{'realname'}~ : ($uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'}))); # 470a == Ex-Member } $usernameto = join(', ', @usernameto); } elsif ($messageStatus eq 'gr') { my ($guestName, $guestEmail) = split(/ /, $musernameto); $guestName =~ s/%20/ /g; $usernameto = qq~$guestName
($guestEmail)~; &LoadUser($musername); # is from user $usernamefrom = ${$uid.$musername}{'realname'} ? qq~${$uid.$musername}{'realname'}~ : ($musername ? qq~$musername ($maintxt{'470a'})~ : $maintxt{'470a'}); # 470a == Ex-Member } elsif ($messageStatus =~ /b/) { foreach my $uname (split(/,/, $musernameto)) { if ($uname eq 'all') { push(@usernameto, $inmes_txt{'bmallmembers'}); } elsif ($uname eq 'mods') { push(@usernameto, $inmes_txt{'bmmods'}); } elsif ($uname eq 'gmods') { push(@usernameto, $inmes_txt{'bmgmods'}); } elsif ($uname eq 'admins') { push(@usernameto, $inmes_txt{'bmadmins'}); } else { my ($title, undef) = split(/\|/, $NoPost{$uname}, 2); push(@usernameto, $title); } } $usernameto = join(', ', @usernameto); &LoadUser($musername); # is from user $usernamefrom = ${$uid.$musername}{'realname'} ? qq~${$uid.$musername}{'realname'}~ : ($musername ? qq~$musername ($maintxt{'470a'})~ : $maintxt{'470a'}); # 470a == Ex-Member } else { my $uname = $musernameto; # is to user $uname .= ",$musernamecc" if $musernamecc; if ($musernamebcc) { if ($musername eq $username) { $uname .= ",$musernamebcc"; } else { foreach (split(/,/, $musernamebcc)) { if ($_ eq $username) { $uname .= ",$username"; last; } } } } foreach $uname (split(/,/, $uname)) { &LoadUser($uname); push(@usernameto, (${$uid.$uname}{'realname'} ? qq~${$uid.$uname}{'realname'}~ : ($uname ? qq~$uname ($maintxt{'470a'})~ : $maintxt{'470a'}))); # 470a == Ex-Member } $usernameto = join(', ', @usernameto); &LoadUser($musername); # is from user $usernamefrom = ${$uid.$musername}{'realname'} ? qq~${$uid.$musername}{'realname'}~ : ($musername ? qq~$musername ($maintxt{'470a'})~ : $maintxt{'470a'}); # 470a == Ex-Member } $MCContent .= qq~$usernamefrom / $usernameto~; #[store other] } $MCContent .= qq~ $mydate ~; undef $quotecount; undef $codecount; undef $spoilercount; $quoteimg = ''; $codeimg = ''; $spoilerimg = ''; if ($UseMenuType != 1) { $sepa = ' | '; } else { $sepa = $menusep; } ## inline list for msg my ($actionsMenu, $actionsMenuselect, $storefolderView); $mreplyno++; ## build actionsMenu for output if ($action eq 'im' && !$viewBMess) { $actionsMenu = qq~$inmes_txt{'145'}$sepa$inmes_txt{'146'}$sepa$inmes_txt{'147'}$sepa$inmes_txt{'remove'}~; ## broadcast messages can only be quoted on! } elsif ($action eq 'im' && $viewBMess) { if ($messageStatus eq 'g') { $actionsMenu = qq~$inmes_txt{'146'}~; } else { $actionsMenu = qq~$inmes_txt{'145'}$sepa$inmes_txt{'146'}~; } if ($iamadmin || $username eq $musername) { $actionsMenu .= qq~$sepa$inmes_txt{'remove'}~; $deleteButton = 1; } ## for others } elsif ($action eq 'imdraft') { $actionsMenu = qq~$inmes_txt{'remove'}~; } elsif ($action eq 'imoutbox') { $actionsMenu = qq~$callBack$inmes_txt{'remove'}~; } else { if ($action eq 'imstorage') { $storefolderView = ";viewfolder=$INFO{'viewfolder'}"; } if ($messageStatus =~ /gr/) { $actionsMenu = qq~$inmes_txt{'remove'}~; } else { $actionsMenu = qq~$callBack$inmes_txt{'145'}$sepa$inmes_txt{'146'}$sepa$inmes_txt{'147'}$sepa$inmes_txt{'remove'}~; } } if (!$viewBMess || ($viewBMess && ($iamadmin || $username eq $musername))) { $actionsMenuselect = qq~ ~; if ($action ne 'imdraft' && !$viewBMess) { $actionsMenuselect .= qq~/~; } } $MCContent .= qq~ ~; if (($enable_PMcontrols && ${$uid.$username}{'pmviewMess'}) || (!$enable_PMcontrols && $enable_PMviewMess && ${$uid.$username}{'pmviewMess'})) { if ($immessage =~ /\[quote(.*?)\]/isg) { $quoteimg = qq~$inmes_imtxt{'69'} ~; $immessage =~ s/\[quote(.*?)\](.+?)\[\/quote\]//ig; } if ($immessage =~ /\[code\]/isg) { $codeimg = qq~$inmes_imtxt{'84'} ~; $immessage =~ s/\[code\](.+?)\[\/code\]//ig; } if ($immessage =~ /\[spoiler\]/isg) { $spoilerimg = qq~$inmes_imtxt{'85'} ~; $immessage =~ s/\[spoiler\](.+?)\[\/spoiler\]//ig; } if ($immessage =~ /\[spoiler=([A-Za-z0-9# -,.]+)\]/isg) { $spoilerimg = qq~$inmes_imtxt{'85'} ~; $immessage =~ s/\[spoiler=([A-Za-z0-9# -,.]+)\](.+?)\[\/spoiler\]//ig; } $immessage =~ s~~ ~gi; $immessage =~ s~  ~ ~g; &ToChars($immessage); $immessage =~ s~\[.*?\]~~g; &FromChars($immessage); $convertstr = $immessage; $convertcut = 100; &CountChars; my $immessage = $convertstr; &ToChars($immessage); if ($cliped) { $immessage .= "..."; } &LoadHotlinkList; if($hot_im) { $hotmessage = $immessage; &ConvHotlink; $immessage = $hotmessage; } $immessage = qq~$quoteimg$codeimg$spoilerimg $immessage~; $immessage = &Censor($immessage); if ($immessage =~ /\#nosmileys/isg || $ns =~ "NS") { $immessage =~ s/\#nosmileys//isg; } else {$message = $immessage; if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &MakeSmileys; $immessage = $message; } $MCContent .= qq~ $immessage


~; } $MCContent .= qq~
$actionsMenu
$actionsMenuselect
~; $acount++; if ($acount == $stkmess +1) { $normDateSet = 1; } } ################ end of message loop ################### ## limiter bar if ($enable_imlimit == 1 && !$viewBMess) { my $impercent = 0; my $imbar = 0; my $imrest = 0; my $messageCounter = @dimmessages; if ($action eq 'im' && !$viewBMess) { if ($messageCounter != 0 && $numibox != 0) { $impercent = int(100 / $numibox * $messageCounter); $imbar = int(200 / $numibox * $messageCounter); } $intext = qq~($inmes_imtxt{'13'} $messageCounter $inmes_imtxt{'01'} $numibox $inmes_imtxt{'19'} $inmes_txt{'inbox'} $inmes_txt{'folder'})~; } elsif ($action eq 'imoutbox') { if ($messageCounter != 0 && $numobox != 0) { $impercent = int(100 / $numobox * $messageCounter); $imbar = int(200 / $numobox * $messageCounter); } $intext = qq~($inmes_imtxt{'13'} $messageCounter $inmes_imtxt{'01'} $numobox $inmes_imtxt{'19'} $inmes_txt{'outbox'} $inmes_txt{'folder'})~; } elsif ($action eq 'imdraft') { if ($messageCounter != 0 && $numdraft != 0) { $impercent = int(100 / $numdraft * $messageCounter); $imbar = int(200 / $numdraft * $messageCounter); } $intext = qq~($inmes_imtxt{'13'} $messageCounter $inmes_imtxt{'01'} $numdraft $inmes_imtxt{'19'} $inmes_txt{'draft'} $inmes_txt{'folder'})~; } elsif ($action eq 'imstorage') { if ($messageCounter != 0 && $numstore != 0) { $impercent = int(100 / $numstore * $messageCounter); $imbar = int(200 / $numstore * $messageCounter); } $intext = qq~($inmes_imtxt{'13'} $messageCounter $inmes_imtxt{'01'} $numstore $inmes_imtxt{'19'} $inmes_txt{'storage'} $inmes_txt{'folder'})~; } $imrest = 200 - $imbar; if ($imbar > 200) { $imbar = 200; } if ($imrest <= 0) { $dorest = ''; } else { $dorest = qq~~; } $imbargfx = qq~$inmes_imtxt{'67'}: $dorest $impercent % 
~; } else { $intext = qq~ ~; $imbargfx = qq~ ~; } unless ($action eq 'imstorage' && $INFO{'viewfolder'} eq '') { $removeButton = qq~~; $inmes_txt{'777'} =~ s/REMOVE/$removeButton/; $removeButton = $inmes_txt{'777'}; } if (@dimmessages) { $MCContent .= qq~ ~; if (!$viewBMess) { $MCContent .= qq~ $imbargfx $intext

~; unless ($action eq 'imstorage' && $INFO{'viewfolder'} eq '') { $MCContent .= $movebutton; } } if (!$viewBMess || ($viewBMess && ($iamadmin|| $deleteButton))) { $MCContent .= qq~ $removeButton~; } $MCContent .= qq~ ~; if ((!$viewBMess || ($viewBMess && ($iamadmin || $deleteButton))) && !($action eq 'imstorage' && $INFO{'viewfolder'} eq '')) { $MCContent .= qq~
 

~; } } $MCContent .= qq~ ~; } } # load user's buddylist and show status of said members sub LoadBuddyList { # Load background color list my @cssvalues = ('windowbg2', 'windowbg'); my $cssnum = @cssvalues; my $counter = 0; my @buddies = split('\|',${$uid.$username}{'buddylist'}); chomp @buddies; $buddiesCurrentStatus = qq~ ~; foreach my $buddyname (@buddies) { $css = $cssvalues[($counter % $cssnum)]; my ($buddyrealname); my ($online, $buddyemail, $buddypm, $buddywww) = ' '; if (-e "$memberdir/$buddyname.vars") { &LoadUser($buddyname); $online = &userOnLineStatus($buddyname); $buddyrealname = ${$uid.$buddyname}{'realname'}; $usernamelink = $link{$buddyname}; if (${$uid.$buddyname}{'hidemail'} && !$iamadmin && $allow_hide_email == 1) { $buddyemail = qq~Hidden Email~; } else { $buddyemail = qq~$profile_txt{'889'} ${$uid.$buddyname}{'email'}~; } &CheckUserPM_Level($buddyname); if ($PM_level == 1 || ($PM_level == 2 && $UserPM_Level{$buddyname} > 1 && ($iamadmin || $iamgmod || $iammod)) || ($PM_level == 3 && $UserPM_Level{$buddyname} == 3 && ($iamadmin || $iamgmod))) { $buddypm = qq~$profile_txt{'688'} $buddyrealname~; } if (${$uid.$buddyname}{'weburl'}) { $buddywww = qq~${$uid.$buddyname}{'webtitle'}~; } } else { $usernamelink = $mycenter_txt{'buddydeleted'}; # Ex-Member } $buddiesCurrentStatus .= qq~~; $counter++; } undef %UserPM_Level; $buddiesCurrentStatus .= "
$profile_txt{'68a'}$profile_txt{'68b'}$profile_txt{'69a'}$profile_txt{'69'}$profile_txt{'96'}
$usernamelink$online$buddypm$buddyemail$buddywww
"; return $buddiesCurrentStatus; } sub mcMenu { my ($pmclass, $profclass, $postclass); if ($action eq "mycenter" || $action eq "im" || $action eq "imdraft" || $action eq "imoutbox" || $action eq "imstorage" || $action eq "imsend" || $action eq "imsend2" || $action eq "imshow") { $pmclass = qq~ class="selected"~; if ($PM_level == 0 || ($PM_level == 2 && !$iamadmin && !$iamgmod && !$iammod ) || ($PM_level == 3 && !$iamadmin && !$iamgmod)) { $profclass = qq~ class="selected"~; } } if ($action eq "profileCheck" || $action eq "myviewprofile" || $action eq "myprofile" || $action eq "myprofileContacts" || $action eq "myprofileOptions" || $action eq "myprofileBuddy" || $action eq "myprofileIM" || $action eq "myprofileAdmin") { $profclass = qq~ class="selected"~; } if ($action eq "favorites" || $action eq "shownotify" || $action eq "myusersrecentposts") { $postclass = qq~ class="selected"~; } my $tabsep = qq~~; my $tabfill = qq~~; # pm link if ($PM_level == 1 || ($PM_level == 2 && ($iamadmin || $iamgmod || $iammod)) || ($PM_level == 3 && ($iamadmin || $iamgmod))) { $yymcmenu .= qq~$tabfill$mc_menus{'messages'}$tabfill$tabsep ~; } # profile link $yymcmenu .= qq~$tabfill$mc_menus{'profile'}$tabfill ~; # posts link $yymcmenu .= qq~$tabsep$tabfill$mc_menus{'posts'}$tabfill ~; $yymcmenu .= qq~$tabsep~; } 1;