D:\my docs\My Received Files\Yabb\Yabb\YaBB_2.5_AEB\cgi-bin\yabb2_old\Admin\MailMembers.pl D:\WEBSITES\testbed\cgi-bin\yabb252\Admin\MailMembers.pl
############################################################################### ###############################################################################
# MailMembers.pl                                                              # # MailMembers.pl                                                              #
############################################################################### ###############################################################################
# YaBB: Yet another Bulletin Board                                            # # YaBB: Yet another Bulletin Board                                            #
# Open-Source Community Software for Webmasters                               # # Open-Source Community Software for Webmasters                               #
# Version:        YaBB 2.5 Anniversary Edition                                # # Version:        YaBB 2.5.2                                                  #
# Packaged:       July 04, 2010                                               # # Packaged:       September 30, 2012                                          #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2010 YaBB (www.yabbforum.com) - All Rights Reserved.     # # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved.     #
# Software by:  The YaBB Development Team                                     # # Software by:  The YaBB Development Team                                     #
#               with assistance from the YaBB community.                      # #               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.         #    
############################################################################### ###############################################################################
   
$mailmembersplver = 'YaBB 2.5 AE $Revision: 1.17 $'; $mailmembersplver = 'YaBB 2.5.2 $Revision: 1.0 $';
if ($action eq 'detailedversion') { return 1; } if ($action eq 'detailedversion') { return 1; }
   
if ($iamguest) { &admin_fatal_error("no_access"); } if ($iamguest) { &admin_fatal_error("no_access"); }
   
&LoadLanguage('Main'); &LoadLanguage('Main');
&LoadLanguage('MemberList'); &LoadLanguage('MemberList');
   
$reused = 0; $reused = 0;
   
sub Mailing { sub Mailing {
   if ($iamguest) { &admin_fatal_error("no_access"); }    if ($iamguest) { &admin_fatal_error("no_access"); }
   $yymain .= qq~    $yymain .= qq~
<div style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> <div style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;">
   <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">    <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
   <tr>    <tr>
       <td width="100%" valign="middle" class="titlebg">        <td width="100%" valign="middle" class="titlebg">
       <span style="float: left;">        <span style="float: left;">
       <img src="$imagesdir/register.gif" alt="" border="0" style="vertical-align: middle;" /><b> $admintxt{'19'}</b>        <img src="$imagesdir/register.gif" alt="" border="0" style="vertical-align: middle;" /><b> $admintxt{'19'}</b>
       </span>        </span>
       <form action="$adminurl?action=mailinggrps" method="post" name="mailgrps" style="display: inline;">        <form action="$adminurl?action=mailinggrps" method="post" name="mailgrps" style="display: inline;">
       <span style="float: right;">        <span style="float: right;">
           <input type="submit" value="$amv_txt{'53'}" class="button" />            <input type="submit" value="$amv_txt{'53'}" class="button" />
       </span>        </span>
       </form>        </form>
       </td>        </td>
   </tr>    </tr>
   </table>    </table>
   <script language="JavaScript1.2" src="$yyhtml_root/ubbc.js" type="text/javascript"></script>    <script language="JavaScript1.2" src="$yyhtml_root/ubbc.js" type="text/javascript"></script>
   <form name="adv_membermail" action="$adminurl?action=mailing2" method="post" style="display: inline;" onsubmit="return checkIfChecked(this); return submitproc();">    <form name="adv_membermail" action="$adminurl?action=mailing2" method="post" style="display: inline;" onsubmit="return checkIfChecked(this); return submitproc();">
   
   <div class="windowbg2" style="width: 100%; border: 1px #cccccc solid;">    <div class="windowbg2" style="width: 100%; border: 1px #cccccc solid;">
   <div class="windowbg2" style="float: left; width: 44%; height: 260px; margin: 1%; border: 1px #cccccc solid;">    <div class="windowbg2" style="float: left; width: 44%; height: 260px; margin: 1%; border: 1px #cccccc solid;">
   <table border="0" width="98%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">    <table border="0" width="98%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">
   <tr>    <tr>
       <td align="left" width="100%"><label for="field1"><b>$amv_txt{'40'}:</b><br /><span class="small">$amv_txt{'46'}</span></label></td>        <td align="left" width="100%"><label for="field1"><b>$amv_txt{'40'}:</b><br /><span class="small">$amv_txt{'46'}</span></label></td>
   </tr>    </tr>
   <tr>    <tr>
       <td align="left" width="100%">        <td align="left" width="100%">
   ~;    ~;
   my $grpselect;    my $grpselect;
   my $groupcnt = 0;    my $groupcnt = 0;
   foreach (sort { $a cmp $b } keys %Group) {    foreach (sort { $a cmp $b } keys %Group) {
       unless($_ eq "Moderator") {        unless($_ eq "Moderator") {
           ($title, $dummy) = split(/\|/, $Group{$_}, 2);            ($title, $dummy) = split(/\|/, $Group{$_}, 2);
           $grpselect .= qq~\n<option value="$_"> $title</option>~;            $grpselect .= qq~\n<option value="$_"> $title</option>~;
           $groupcnt++;            $groupcnt++;
       }        }
   }    }
   foreach (@nopostorder) {    foreach (@nopostorder) {
       ($title, $dummy) = split(/\|/, $NoPost{$_}, 2);        ($title, $dummy) = split(/\|/, $NoPost{$_}, 2);
       $grpselect .= qq~\n<option value="$_"> $title</option>~;        $grpselect .= qq~\n<option value="$_"> $title</option>~;
       $groupcnt++;        $groupcnt++;
   }    }
   foreach (sort { $b <=> $a } keys %Post) {    foreach (sort { $b <=> $a } keys %Post) {
       ($title, $dummy) = split(/\|/, $Post{$_}, 2);        ($title, $dummy) = split(/\|/, $Post{$_}, 2);
       $grpselect .= qq~\n<option value="$title"> $title</option>~;        $grpselect .= qq~\n<option value="$title"> $title</option>~;
       $groupcnt++;        $groupcnt++;
   }    }
   if ($groupcnt > 12) { $groupcnt = 12; }    if ($groupcnt > 12) { $groupcnt = 12; }
   $yymain .= qq~    $yymain .= qq~
   <select name="field1" id="field1" size="$groupcnt" multiple="multiple" style="width: 100%; font-size: 11px;">    <select name="field1" id="field1" size="$groupcnt" multiple="multiple" style="width: 100%; font-size: 11px;">
   $grpselect    $grpselect
   </select>    </select>
   <label for="check_all"><b>$amv_txt{"42a"}: </b></label><input type="checkbox" name="check_all" id="check_all" value="1" class="windowbg2" style="border: 0; vertical-align: middle;" onclick="javascript: if (this.checked) selectCheckAll(true); else selectCheckAll(false);" />    <label for="check_all"><b>$amv_txt{"42a"}: </b></label><input type="checkbox" name="check_all" id="check_all" value="1" class="windowbg2" style="border: 0; vertical-align: middle;" onclick="javascript: if (this.checked) selectCheckAll(true); else selectCheckAll(false);" />
   </td>    </td>
   </tr>    </tr>
   </table>    </table>
   </div>    </div>
   ~;    ~;
   
   unless ($groupcnt == 0) {    unless ($groupcnt == 0) {
   
       $yymain .= qq~        $yymain .= qq~
   <div class="windowbg2" style="float: left; width: 50%; height: 260px; margin: 1%; border: 1px #cccccc solid;">    <div class="windowbg2" style="float: left; width: 50%; height: 260px; margin: 1%; border: 1px #cccccc solid;">
   
   <table border="0" width="98%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">    <table border="0" width="98%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">
       <tr>        <tr>
          <td align="left" width="100%"><label for="emailsubject"><b>$amv_txt{'1'}:</b></label></td>           <td align="left" width="100%"><label for="emailsubject"><b>$amv_txt{'1'}:</b></label></td>
       </tr>        </tr>
       <tr>        <tr>
          <td align="left" width="100%"><input type="text" value="" size="40" name="emailsubject" id="emailsubject" style="width: 100%" /></td>           <td align="left" width="100%"><input type="text" value="" size="40" name="emailsubject" id="emailsubject" style="width: 100%" /></td>
       </tr>        </tr>
       <tr>        <tr>
          <td align="left" width="100%"><label for="emailtext"><b>$amv_txt{'2'}:</b></label></td>           <td align="left" width="100%"><label for="emailtext"><b>$amv_txt{'2'}:</b></label></td>
       </tr>        </tr>
       <tr>        <tr>
          <td align="left" width="100%"><textarea cols="38" rows="9" name="emailtext" id="emailtext" style="width:100%"></textarea></td>           <td align="left" width="100%"><textarea cols="38" rows="9" name="emailtext" id="emailtext" style="width:100%"></textarea></td>
       </tr>        </tr>
       <tr>        <tr>
       <td align="left" width="100%"><span class="small">$amv_txt{'39'}</span></td>        <td align="left" width="100%"><span class="small">$amv_txt{'39'}</span></td>
       </tr>        </tr>
   </table>    </table>
       <input type="hidden" name="reused" value="$reused" />        <input type="hidden" name="reused" value="$reused" />
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 44%; margin: 1%; margin-top: 0; margin-bottom: 0; border: 0;">    <div class="windowbg2" style="float: left; width: 44%; margin: 1%; margin-top: 0; margin-bottom: 0; border: 0;">
   <table border="0" width="98%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">    <table border="0" width="98%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">
   <tr>    <tr>
   <td class="windowbg2" align="left" valign="top"><b>$amv_txt{'49'}:</b></td>    <td class="windowbg2" align="left" valign="top"><b>$amv_txt{'49'}:</b></td>
   </tr>    </tr>
   </table>    </table>
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 50%; margin: 1%; margin-top: 0; margin-bottom: 0; border: 0;">    <div class="windowbg2" style="float: left; width: 50%; margin: 1%; margin-top: 0; margin-bottom: 0; border: 0;">
   <table border="0" width="98%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">    <table border="0" width="98%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">
   <tr>    <tr>
   <td class="windowbg2" align="left" valign="top"><b>$amv_txt{'47'}:</b></td>    <td class="windowbg2" align="left" valign="top"><b>$amv_txt{'47'}:</b></td>
   </tr>    </tr>
   </table>    </table>
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 44%; height: 145px; margin: 1%; border: 1px #cccccc solid;">    <div class="windowbg2" style="float: left; width: 44%; height: 145px; margin: 1%; border: 1px #cccccc solid;">
   <table border="0" width="98%" style="height: 100%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">    <table border="0" width="98%" style="height: 100%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">
   <tr>    <tr>
   <td class="windowbg2" align="left" valign="top">    <td class="windowbg2" align="left" valign="top">
       <span class="small">$amv_txt{'50'}</span>        <span class="small">$amv_txt{'50'}</span>
   </td>    </td>
   </tr>    </tr>
   <tr>    <tr>
   <td class="windowbg2" align="center" valign="top">    <td class="windowbg2" align="center" valign="top">
       <input type="submit" name="convert" value="$amv_txt{'49'}" style="width: 100%;" class="button" />        <input type="submit" name="convert" value="$amv_txt{'49'}" style="width: 100%;" class="button" />
   </td>    </td>
   </tr>~;    </tr>~;
   
       if (-e "$vardir/yabbaddress.csv") {        if (-e "$vardir/yabbaddress.csv") {
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
   <td class="windowbg2" align="center" valign="top">    <td class="windowbg2" align="center" valign="top">
       <input type="button" value="$amv_txt{'51'}" class="button" onclick="MailListWin('$adminurl?action=mailing3');" />        <input type="button" value="$amv_txt{'51'}" class="button" onclick="MailListWin('$adminurl?action=mailing3');" />
   </td>    </td>
   </tr>~;    </tr>~;
       }        }
   
       $yymain .= qq~        $yymain .= qq~
   </table>    </table>
   </div>    </div>
<script language="JavaScript1.2" type="text/javascript"> <script language="JavaScript1.2" type="text/javascript">
<!-- <!--
   function MailListWin(FileName,WindowName) {    function MailListWin(FileName,WindowName) {
       WindowFeature="resizable=no,scrollbars=yes,menubar=yes,directories=no,toolbar=no,location=no,status=no,width=400,height=400,screenX=0,screenY=0,top=0,left=0"         WindowFeature="resizable=no,scrollbars=yes,menubar=yes,directories=no,toolbar=no,location=no,status=no,width=400,height=400,screenX=0,screenY=0,top=0,left=0" 
       newWindow=open(FileName,WindowName,WindowFeature);        newWindow=open(FileName,WindowName,WindowFeature);
       if (newWindow.opener == null) { newWindow.opener = self; }        if (newWindow.opener == null) { newWindow.opener = self; }
       if (newWindow.focus) { newWindow.focus(); }        if (newWindow.focus) { newWindow.focus(); }
   }    }
// --> // -->
</script> </script>
   
   <div class="windowbg2" style="float: left; width: 50%; height: 145px; margin: 1%; border: 1px #cccccc solid; overflow: auto;">    <div class="windowbg2" style="float: left; width: 50%; height: 145px; margin: 1%; border: 1px #cccccc solid; overflow: auto;">
   ~;    ~;
       if (-e ("$vardir/maillist.dat")) {        if (-e ("$vardir/maillist.dat")) {
           fopen(FILE, "$vardir/maillist.dat");            fopen(FILE, "$vardir/maillist.dat");
           @maillist = <FILE>;            @maillist = <FILE>;
           fclose(FILE);            fclose(FILE);
           $yymain .= qq~            $yymain .= qq~
       <table border="0" width="99%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">        <table border="0" width="99%" cellspacing="0" cellpadding="3" align="center" class="windowbg2">
       ~;        ~;
           foreach $curmail (@maillist) {            foreach $curmail (@maillist) {
               chomp $curmail;                chomp $curmail;
               ($otime, $osubject, $otext, $osender) = split(/\|/, $curmail);                ($otime, $osubject, $otext, $osender) = split(/\|/, $curmail);
               &LoadUser($osender);                &LoadUser($osender);
               $thetime = &timeformat($otime);                $thetime = &timeformat($otime);
   
               $jsubject = $osubject;                $jsubject = $osubject;
               $jtext = $otext;                $jtext = $otext;
               &ToJS($jsubject);                &ToJS($jsubject);
               &ToJS($jtext);                &ToJS($jtext);
   
               $yymain .= qq~                $yymain .= qq~
           <tr>            <tr>
               <td class="windowbg2" align="left" valign="middle">                <td class="windowbg2" align="left" valign="middle">
                   <input type="radio" name="usemail" value="$otime" class="windowbg2" style="border: 0; vertical-align: middle;" onclick="showMail('$jsubject', '$jtext', '$otime');" />                    <input type="radio" name="usemail" value="$otime" class="windowbg2" style="border: 0; vertical-align: middle;" onclick="showMail('$jsubject', '$jtext', '$otime');" />
               </td>                </td>
               <td class="windowbg2" align="left" valign="top"><span class="small">$thetime<br />${$uid.$osender}{'realname'}</span></td>                <td class="windowbg2" align="left" valign="top"><span class="small">$thetime<br />${$uid.$osender}{'realname'}</span></td>
               <td class="windowbg2" align="left" valign="top"><span class="small">$osubject</span></td>                <td class="windowbg2" align="left" valign="top"><span class="small">$osubject</span></td>
               <td class="windowbg2" align="left" valign="middle"><a href="$adminurl?action=deletemail;delmail=$otime"><img src="$imagesdir/admin_rem.gif" border="0" alt="del" /></a></td>                <td class="windowbg2" align="left" valign="middle"><a href="$adminurl?action=deletemail;delmail=$otime"><img src="$imagesdir/admin_rem.gif" border="0" alt="del" /></a></td>
           </tr>            </tr>
           ~;            ~;
           }            }
           $yymain .= qq~            $yymain .= qq~
       </table>        </table>
       ~;        ~;
       }        }
       $yymain .= qq~        $yymain .= qq~
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 44%; margin: 1%; margin-top: 0; border: 0;">    <div class="windowbg2" style="float: left; width: 44%; margin: 1%; margin-top: 0; border: 0;">
   &nbsp;    &nbsp;
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 50%; margin: 1%; margin-top: 0; border: 0;">    <div class="windowbg2" style="float: left; width: 50%; margin: 1%; margin-top: 0; border: 0;">
   <table border="0" width="100%" cellspacing="0" cellpadding="0">    <table border="0" width="100%" cellspacing="0" cellpadding="0">
   <tr>    <tr>
   <td align="center">    <td align="center">
       <input type="submit" name="mailsend" value="$amv_txt{'41'}" style="width: 100%;" class="button" />        <input type="submit" name="mailsend" value="$amv_txt{'41'}" style="width: 100%;" class="button" />
   </td>    </td>
   </tr>    </tr>
   </table>    </table>
   </div>    </div>
   
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
   
</form> </form>
   
<script language="JavaScript1.2" type="text/javascript"> <script language="JavaScript1.2" type="text/javascript">
<!-- <!--
function selectCheckAll(tchecked) { function selectCheckAll(tchecked) {
   for(var x = 0; x < document.adv_membermail.field1.options.length; x++) document.adv_membermail.field1.options[x].selected = tchecked;    for(var x = 0; x < document.adv_membermail.field1.options.length; x++) document.adv_membermail.field1.options[x].selected = tchecked;
} }
   
function showMail(thesubject, thetext, thetime) { function showMail(thesubject, thetext, thetime) {
   thetext=thetext.replace(/\<br \\/\>/g, "\\n");    thetext=thetext.replace(/\<br \\/\>/g, "\\n");
   document.adv_membermail.emailsubject.value = thesubject;    document.adv_membermail.emailsubject.value = thesubject;
   document.adv_membermail.emailtext.value = thetext;    document.adv_membermail.emailtext.value = thetext;
   document.adv_membermail.reused.value = thetime;    document.adv_membermail.reused.value = thetime;
} }
//--> //-->
</script> </script>
</div> </div>
   ~;    ~;
   }    }
   
   $yytitle = $admin_txt{'6'};    $yytitle = $admin_txt{'6'};
   $action_area = 'mailing';    $action_area = 'mailing';
   &AdminTemplate;    &AdminTemplate;
} }
   
sub Mailing2 { sub Mailing2 {
   if ($iamguest) { &fatal_error('no_access'); }    if ($iamguest) { &fatal_error('no_access'); }
   if (!$FORM{'mailsend'} && !$FORM{'convert'}) { &fatal_error('no_access'); }    if (!$FORM{'mailsend'} && !$FORM{'convert'}) { &fatal_error('no_access'); }
   @convlist = ();    @convlist = ();
   if ($FORM{'mailsend'} && $FORM{'emailtext'} ne '') {    if ($FORM{'mailsend'} && $FORM{'emailtext'} ne '') {
       $FORM{'emailsubject'} =~ s~\|~&#124;~g;        $FORM{'emailsubject'} =~ s~\|~&#124;~g;
       $FORM{'emailtext'} =~ s~\|~&#124;~g;        $FORM{'emailtext'} =~ s~\|~&#124;~g;
       $FORM{'emailtext'} =~ s~\r~~g;        $FORM{'emailtext'} =~ s~\r~~g;
       $mailline = qq~$date|$FORM{'emailsubject'}|$FORM{'emailtext'}|$username~;        $mailline = qq~$date|$FORM{'emailsubject'}|$FORM{'emailtext'}|$username~;
       &MailList($mailline);        &MailList($mailline);
   }    }
   (@mailgroups) = split(/\, /, $FORM{'field1'});    (@mailgroups) = split(/\, /, $FORM{'field1'});
   &ManageMemberinfo("load");    &ManageMemberinfo("load");
   $i = 0;    $i = 0;
   my ($emailsubject,$emailtext);    my ($emailsubject,$emailtext);
   foreach my $user (keys %memberinf) {    foreach my $user (keys %memberinf) {
       (undef, $memrealname, $mememail, $memposition, $memposts, $memaddgrp, undef) = split(/\|/, $memberinf{$user}, 7);         ($memrealname, $mememail, $memposition, $memposts, $memaddgrp) = split(/\|/, $memberinf{$user} );
       &FromHTML($memrealname);        &FromHTML($memrealname);
   
       if ($FORM{'mailsend'} && $FORM{'emailtext'} ne '') {        if ($FORM{'mailsend'} && $FORM{'emailtext'} ne '') {
           $emailsubject = $FORM{'emailsubject'};            $emailsubject = $FORM{'emailsubject'};
           $emailsubject =~ s~\[name\]~$memrealname~ig;            $emailsubject =~ s~\[name\]~$memrealname~ig;
           $emailsubject =~ s~\[username\]~$user~ig;            $emailsubject =~ s~\[username\]~$user~ig;
           $emailtext = $FORM{'emailtext'};            $emailtext = $FORM{'emailtext'};
           $emailtext =~ s~\[name\]~$memrealname~ig;            $emailtext =~ s~\[name\]~$memrealname~ig;
           $emailtext =~ s~\[username\]~$user~ig;            $emailtext =~ s~\[username\]~$user~ig;
       }        }
   
       $mailit = 0;        $mailit = 0;
       foreach $element (@mailgroups) {        foreach $element (@mailgroups) {
           chomp $element;            chomp $element;
           if ($element eq $memposition) { $mailit = 1; }            if ($element eq $memposition) { $mailit = 1; }
           foreach $memberaddgroups (split(/, /, $memaddgrp)) {            foreach $memberaddgroups (split(/, /, $memaddgrp)) {
               chomp $memberaddgroups;                chomp $memberaddgroups;
               if ($element eq $memberaddgroups) { $mailit = 1; last; }                if ($element eq $memberaddgroups) { $mailit = 1; last; }
           }            }
           if ($mailit) { last; }            if ($mailit) { last; }
       }        }
       if ($mailit && $FORM{'mailsend'}) {        if ($mailit && $FORM{'mailsend'}) {
           require "$sourcedir/Mailer.pl";            require "$sourcedir/Mailer.pl";
           &sendmail($mememail, $emailsubject, $emailtext);            &sendmail($mememail, $emailsubject, $emailtext);
       } elsif ($mailit && $FORM{'convert'}) {        } elsif ($mailit && $FORM{'convert'}) {
           if ($memrealname =~ /&#(\d{3,}?)\;/ig) { $memrealname = $user; }            if ($memrealname =~ /&#(\d{3,}?)\;/ig) { $memrealname = $user; }
           $convlist[$i] = qq~$memrealname\;$mememail\n~;            $convlist[$i] = qq~$memrealname\;$mememail\n~;
           $i++;            $i++;
       }        }
   }    }
   undef %memberinf;    undef %memberinf;
   if (@convlist) {    if (@convlist) {
       fopen(ADDRESSLIST, ">$vardir/yabbaddress.csv", 1);        fopen(ADDRESSLIST, ">$vardir/yabbaddress.csv", 1);
       print ADDRESSLIST "Name\;E-mail Address\n";        print ADDRESSLIST "Name\;E-mail Address\n";
       print ADDRESSLIST @convlist;        print ADDRESSLIST @convlist;
       fclose(ADDRESSLIST);        fclose(ADDRESSLIST);
   } elsif ($FORM{'convert'}) {    } elsif ($FORM{'convert'}) {
       unlink "$vardir/yabbaddress.csv"         unlink "$vardir/yabbaddress.csv" 
   }    }
   
   $yySetLocation = qq~$adminurl?action=mailing~;    $yySetLocation = qq~$adminurl?action=mailing~;
   &redirectexit;    &redirectexit;
} }
   
sub Mailing3 { sub Mailing3 {
   fopen(FILE, "$vardir/yabbaddress.csv");    fopen(FILE, "$vardir/yabbaddress.csv");
   @addlist = <FILE>;    @addlist = <FILE>;
   fclose(FILE);    fclose(FILE);
   print qq~Content-disposition: inline; filename=yabbaddress.csv\n\n~;    print qq~Content-disposition: inline; filename=yabbaddress.csv\n\n~;
   foreach $curadd (@addlist) {    foreach $curadd (@addlist) {
       chomp $curadd;        chomp $curadd;
       print qq~$curadd\n~;        print qq~$curadd\n~;
   }    }
} }
   
sub MailingMembers { sub MailingMembers {
   $sortmode = "";    $sortmode = "";
   $selPos   = "";    $selPos   = "";
   $selUser  = "";    $selUser  = "";
   
   if ($FORM{'sortform'} eq "position") { $selPos = qq~ selected="selected"~; }    if ($FORM{'sortform'} eq "position") { $selPos = qq~ selected="selected"~; }
   else { $selUser = qq~ selected="selected"~; }    else { $selUser = qq~ selected="selected"~; }
   
   if    ($INFO{'sort'}     ne "") { $sortmode = ";sort=" . $INFO{'sort'}; }    if    ($INFO{'sort'}     ne "") { $sortmode = ";sort=" . $INFO{'sort'}; }
   elsif ($FORM{'sortform'} ne "") { $sortmode = ";sort=" . $FORM{'sortform'}; }    elsif ($FORM{'sortform'} ne "") { $sortmode = ";sort=" . $FORM{'sortform'}; }
   
   if ($iamguest) { &admin_fatal_error("no_access"); }    if ($iamguest) { &admin_fatal_error("no_access"); }
   $yymain .= qq~    $yymain .= qq~
<div style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;"> <div style="padding: 0px; width: 99%; margin-left: 0px; margin-right: auto;">
   <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">    <table border="0" width="100%" cellspacing="1" cellpadding="3" class="bordercolor">
   <tr>    <tr>
       <td width="100%" valign="middle" class="titlebg">        <td width="100%" valign="middle" class="titlebg">
       <span style="float: left;">        <span style="float: left;">
       <img src="$imagesdir/register.gif" alt="" border="0" style="vertical-align: middle;" /><b> $admintxt{'19'}</b>        <img src="$imagesdir/register.gif" alt="" border="0" style="vertical-align: middle;" /><b> $admintxt{'19'}</b>
       </span>        </span>
       <form action="$adminurl?action=mailinggrps" method="post" name="selsort" style="display: inline">        <form action="$adminurl?action=mailinggrps" method="post" name="selsort" style="display: inline">
       <span style="float: right;">        <span style="float: right;">
       <label for="sortform"><b>$ml_txt{'1'}</b></label>        <label for="sortform"><b>$ml_txt{'1'}</b></label>
       <select name="sortform" id="sortform" style="font-size: 9pt;" onchange="submit()">        <select name="sortform" id="sortform" style="font-size: 9pt;" onchange="submit()">
           <option value="username"$selUser>$ml_txt{'35'}</option>            <option value="username"$selUser>$ml_txt{'35'}</option>
           <option value="position"$selPos>$ml_txt{'87'}</option>            <option value="position"$selPos>$ml_txt{'87'}</option>
       </select>        </select>
       &nbsp;        &nbsp;
       <input type="button" value="$amv_txt{'54'}" class="button" onclick="window.location.href=\'$adminurl?action=mailing\'" />        <input type="button" value="$amv_txt{'54'}" class="button" onclick="window.location.href=\'$adminurl?action=mailing\'" />
       </span>        </span>
       </form>        </form>
       </td>        </td>
   </tr>    </tr>
   </table>    </table>
   <script language="JavaScript1.2" src="$yyhtml_root/ubbc.js" type="text/javascript"></script>    <script language="JavaScript1.2" src="$yyhtml_root/ubbc.js" type="text/javascript"></script>
   <form name="adv_membermail" action="$adminurl?action=mailmultimembers;$sortmode" method="post" style="display: inline" onsubmit="return checkIfChecked(this); return submitproc()">    <form name="adv_membermail" action="$adminurl?action=mailmultimembers;$sortmode" method="post" style="display: inline" onsubmit="return checkIfChecked(this); return submitproc()">
   <input type="hidden" name="button" value="1" />    <input type="hidden" name="button" value="1" />
   
   <div class="windowbg2" style="width: 100%; border: 1px #cccccc solid;">    <div class="windowbg2" style="width: 100%; border: 1px #cccccc solid;">
   
   <div class="windowbg" style="float: left; width: 44%; height: 260px; margin: 1%; border: 1px #cccccc inset; overflow: auto;">    <div class="windowbg" style="float: left; width: 44%; height: 260px; margin: 1%; border: 1px #cccccc inset; overflow: auto;">
   <table border="0" width="99%" cellspacing="0" cellpadding="3" class="windowbg">    <table border="0" width="99%" cellspacing="0" cellpadding="3" class="windowbg">
   ~;    ~;
   
   %TopMembers = ();    %TopMembers = ();
   
   &ManageMemberinfo("load");    &ManageMemberinfo("load");
   while (($membername, $value) = each(%memberinf)) {    while (($membername, $value) = each(%memberinf)) {
       ($memberrealname, undef, $memposition, $memposts) = split(/\|/, $value);        ($memberrealname, undef, $memposition, $memposts) = split(/\|/, $value);
       $pstsort    = 99999999 - $memposts;        $pstsort    = 99999999 - $memposts;
       $sortgroups = "";        $sortgroups = "";
       $j          = 0;        $j          = 0;
   
       if ($membername eq $username) {        if ($membername eq $username) {
           $sortgroups = "!!!";            $sortgroups = "!!!";
       } else {        } else {
           if ($FORM{'sortform'} eq "position" || $INFO{'sort'} eq "position") {            if ($FORM{'sortform'} eq "position" || $INFO{'sort'} eq "position") {
               foreach my $key (keys %Group) {                foreach my $key (keys %Group) {
                   if ($memposition eq $key) {                    if ($memposition eq $key) {
                       if    ($key eq "Administrator")    { $sortgroups = "aaa.$pstsort.$memberrealname"; }                        if    ($key eq "Administrator")    { $sortgroups = "aaa.$pstsort.$memberrealname"; }
                       elsif ($key eq "Global Moderator") { $sortgroups = "bbb.$pstsort.$memberrealname"; }                        elsif ($key eq "Global Moderator") { $sortgroups = "bbb.$pstsort.$memberrealname"; }
                   }                    }
               }                }
               if (!$sortgroups) {                if (!$sortgroups) {
                   foreach (sort { $a <=> $b } keys %NoPost) {                    foreach (sort { $a <=> $b } keys %NoPost) {
                       if ($memposition eq $_) {                        if ($memposition eq $_) {
                           $sortgroups = "ddd.$memposition.$pstsort.$memberrealname";                            $sortgroups = "ddd.$memposition.$pstsort.$memberrealname";
                       }                        }
                   }                    }
               }                }
               if (!$sortgroups) {                if (!$sortgroups) {
                   $sortgroups = "eee.$pstsort.$memposition.$memberrealname";                    $sortgroups = "eee.$pstsort.$memposition.$memberrealname";
               }                }
   
           } else {            } else {
               $sortgroups = $memberrealname;                $sortgroups = $memberrealname;
           }            }
       }        }
       $TopMembers{$membername} = $sortgroups;        $TopMembers{$membername} = $sortgroups;
   }    }
   my @toplist = sort { lc $TopMembers{$a} cmp lc $TopMembers{$b} } keys %TopMembers;    my @toplist = sort { lc $TopMembers{$a} cmp lc $TopMembers{$b} } keys %TopMembers;
   
   $memcount = @toplist;    $memcount = @toplist;
   
   $b         = 0;    $b         = 0;
   $numshown  = 0;    $numshown  = 0;
   $actualnum = 0;    $actualnum = 0;
   
   while (($numshown < $memcount)) {    while (($numshown < $memcount)) {
       $user = $toplist[$b];        $user = $toplist[$b];
   
       ($memrealname, $mememail, $memposition, $memposts) = split(/\|/, $memberinf{$user});        ($memrealname, $mememail, $memposition, $memposts) = split(/\|/, $memberinf{$user});
   
       if ($user eq $username) { $bagcolor = "windowbg2"; }        if ($user eq $username) { $bagcolor = "windowbg2"; }
       else { $bagcolor = "windowbg"; }        else { $bagcolor = "windowbg"; }
       if ($memrealname ne "") {        if ($memrealname ne "") {
   
           $addel = qq~<input type="checkbox" name="member$actualnum" value="$user" class="windowbg" style="border: 0;" />~;            $addel = qq~<input type="checkbox" name="member$actualnum" value="$user" class="windowbg" style="border: 0;" />~;
           $actualnum++;            $actualnum++;
   
           my $memberinfo = "$memposition";            my $memberinfo = "$memposition";
           if ($memberinfo eq "Administrator") {            if ($memberinfo eq "Administrator") {
               ($memberinfo, undef) = split(/\|/, $Group{"Administrator"}, 2);                ($memberinfo, undef) = split(/\|/, $Group{"Administrator"}, 2);
           } elsif ($memberinfo eq "Global Moderator") {            } elsif ($memberinfo eq "Global Moderator") {
               ($memberinfo, undef) = split(/\|/, $Group{"Global Moderator"}, 2);                ($memberinfo, undef) = split(/\|/, $Group{"Global Moderator"}, 2);
           } else {            } else {
               foreach my $key (sort { $a <=> $b } keys %NoPost) {                foreach my $key (sort { $a <=> $b } keys %NoPost) {
                   if ($key eq $memberinfo) {                    if ($key eq $memberinfo) {
                       ($memberinfo, undef) = split(/\|/, $NoPost{$key}, 2);                        ($memberinfo, undef) = split(/\|/, $NoPost{$key}, 2);
                   }                    }
               }                }
           }            }
   
           $viewmembinfo = $memberinfo;            $viewmembinfo = $memberinfo;
           &ToJS($memberinfo);            &ToJS($memberinfo);
           $tmp_postcount = $memposts;            $tmp_postcount = $memposts;
           $checkinfo     = $memberinfo;            $checkinfo     = $memberinfo;
           $checkinfo =~ s/\, /\'\|\'/g;            $checkinfo =~ s/\, /\'\|\'/g;
           $CheckingAll .= qq~"'$checkinfo'", ~;            $CheckingAll .= qq~"'$checkinfo'", ~;
   
           if ($do_scramble_id) { $cloakusername = &cloak($user); } else { $cloakusername = $user; }            if ($do_scramble_id) { $cloakusername = &cloak($user); } else { $cloakusername = $user; }
           $linkuser = qq~<a href="$scripturl?action=viewprofile;username=$cloakusername"><b>$memrealname</b></a>~;            $linkuser = qq~<a href="$scripturl?action=viewprofile;username=$cloakusername"><b>$memrealname</b></a>~;
   
           $yymain .= qq~            $yymain .= qq~
           <tr>            <tr>
           <td class="$bagcolor" align="center" valign="middle">$addel</td>            <td class="$bagcolor" align="center" valign="middle">$addel</td>
           <td class="$bagcolor" align="left" valign="middle">$linkuser - $viewmembinfo</td>            <td class="$bagcolor" align="left" valign="middle">$linkuser - $viewmembinfo</td>
           </tr>~;            </tr>~;
       }        }
   
       $numshown++;        $numshown++;
       $b++;        $b++;
   }    }
   undef @toplist;    undef @toplist;
   undef %memberinf;    undef %memberinf;
   
   $yymain .= qq~    $yymain .= qq~
   </table>    </table>
   </div>    </div>
   ~;    ~;
   
   unless ($memcount == 0) {    unless ($memcount == 0) {
       if ($FORM{'sortform'} eq "") { $FORM{'sortform'} = $INFO{'sort'}; }        if ($FORM{'sortform'} eq "") { $FORM{'sortform'} = $INFO{'sort'}; }
       if (!$FORM{'reversed'}) { $FORM{'reversed'} = $INFO{'reversed'}; }        if (!$FORM{'reversed'}) { $FORM{'reversed'} = $INFO{'reversed'}; }
   
       @groupinfo = ();        @groupinfo = ();
       $i         = 0;        $i         = 0;
       $z         = 0;        $z         = 0;
   
       ($title, $dummy) = split(/\|/, $Group{"Administrator"}, 2);        ($title, $dummy) = split(/\|/, $Group{"Administrator"}, 2);
       &ToJS($title);        &ToJS($title);
       $groupinfo[$i] = $title;        $groupinfo[$i] = $title;
       $i++;        $i++;
       $grp_data = qq~"'$title'", ~;        $grp_data = qq~"'$title'", ~;
       ($title, $dummy) = split(/\|/, $Group{"Global Moderator"}, 2);        ($title, $dummy) = split(/\|/, $Group{"Global Moderator"}, 2);
       &ToJS($title);        &ToJS($title);
       $groupinfo[$i] = $title;        $groupinfo[$i] = $title;
       $i++;        $i++;
       $grp_data .= qq~"'$title'", ~;        $grp_data .= qq~"'$title'", ~;
   
       foreach (@nopostorder) {        foreach (@nopostorder) {
           ($title, $dummy) = split(/\|/, $NoPost{$_}, 2);            ($title, $dummy) = split(/\|/, $NoPost{$_}, 2);
           &ToJS($title);            &ToJS($title);
           $groupinfo[$i] = $title;            $groupinfo[$i] = $title;
           $grp_data .= qq~"'$title'", ~;            $grp_data .= qq~"'$title'", ~;
           $i++;            $i++;
           $z++;            $z++;
       }        }
   
       $groupcnt = $i;        $groupcnt = $i;
       $grp_data .= qq~""~;        $grp_data .= qq~""~;
   
       $yymain .= qq~        $yymain .= qq~
   <div class="windowbg2" style="float: left; width: 50%; height: 260px; margin: 1%; padding: 4px; border: 1px #cccccc solid;">    <div class="windowbg2" style="float: left; width: 50%; height: 260px; margin: 1%; padding: 4px; border: 1px #cccccc solid;">
   
   <table border="0" width="100%" cellspacing="0" cellpadding="2" class="windowbg2">    <table border="0" width="100%" cellspacing="0" cellpadding="2" class="windowbg2">
       <tr>        <tr>
          <td align="left" width="100%"><label for="emailsubject"><b>$amv_txt{'1'}:</b></label></td>           <td align="left" width="100%"><label for="emailsubject"><b>$amv_txt{'1'}:</b></label></td>
       </tr>        </tr>
       <tr>        <tr>
          <td align="left" width="100%"><input type="text" value="" size="40" name="emailsubject" id="emailsubject" style="width: 100%" /></td>           <td align="left" width="100%"><input type="text" value="" size="40" name="emailsubject" id="emailsubject" style="width: 100%" /></td>
       </tr>        </tr>
       <tr>        <tr>
          <td align="left" width="100%"><label for="emailtext"><b>$amv_txt{'2'}:</b></label></td>           <td align="left" width="100%"><label for="emailtext"><b>$amv_txt{'2'}:</b></label></td>
       </tr>        </tr>
       <tr>        <tr>
          <td align="left" width="100%"><textarea cols="38" rows="9" name="emailtext" id="emailtext" style="width:100%"></textarea></td>           <td align="left" width="100%"><textarea cols="38" rows="9" name="emailtext" id="emailtext" style="width:100%"></textarea></td>
       </tr>        </tr>
       <tr>        <tr>
       <td align="left" width="100%"><span class="small">$amv_txt{'39'}</span></td>        <td align="left" width="100%"><span class="small">$amv_txt{'39'}</span></td>
       </tr>        </tr>
   </table>    </table>
       <input type="hidden" name="reused" value="$reused" />        <input type="hidden" name="reused" value="$reused" />
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 44%; margin: 1%; margin-top: 0; border: 0;">    <div class="windowbg2" style="float: left; width: 44%; margin: 1%; margin-top: 0; border: 0;">
   <table border="0" width="100%" cellspacing="0" cellpadding="3" class="windowbg2">    <table border="0" width="100%" cellspacing="0" cellpadding="3" class="windowbg2">
   <tr>    <tr>
   <td class="windowbg2" align="left" valign="top" nowrap="nowrap"><label for="check_all"><b>$amv_txt{'42'}:</b></label></td>    <td class="windowbg2" align="left" valign="top" nowrap="nowrap"><label for="check_all"><b>$amv_txt{'42'}:</b></label></td>
   <td class="windowbg2" align="left" valign="top"><input type="checkbox" name="check_all" id="check_all" value="1" class="windowbg2" style="border: 0;" onclick="javascript: if (this.checked) selectCheckAllmemb(true); else selectCheckAllmemb(false);" /></td>    <td class="windowbg2" align="left" valign="top"><input type="checkbox" name="check_all" id="check_all" value="1" class="windowbg2" style="border: 0;" onclick="javascript: if (this.checked) selectCheckAllmemb(true); else selectCheckAllmemb(false);" /></td>
   </tr>    </tr>
   <tr>    <tr>
   <td class="windowbg2" align="left" valign="top" nowrap="nowrap"><label for="field1"><b>$amv_txt{'40'}:</b></label></td>    <td class="windowbg2" align="left" valign="top" nowrap="nowrap"><label for="field1"><b>$amv_txt{'40'}:</b></label></td>
   <td class="windowbg2" align="left" valign="top">    <td class="windowbg2" align="left" valign="top">
       <label for="field1"><span class="small">$amv_txt{'46'}</span></label><br />        <label for="field1"><span class="small">$amv_txt{'46'}</span></label><br />
       <select name="field1" id="field1" size="$groupcnt" multiple="multiple" onchange="selectCheck()">~;        <select name="field1" id="field1" size="$groupcnt" multiple="multiple" onchange="selectCheck()">~;
   
       $i = 0;        $i = 0;
       while ($i < $groupcnt) {        while ($i < $groupcnt) {
           $yymain .= qq~            $yymain .= qq~
           <option value="$i">$groupinfo[$i]</option>~;            <option value="$i">$groupinfo[$i]</option>~;
           $i++;            $i++;
       }        }
   
       $yymain .= qq~        $yymain .= qq~
       </select>        </select>
   </td>    </td>
   </tr>    </tr>
   </table>    </table>
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 50%; margin: 1%; margin-top: 0; margin-bottom: 0; border: 0;">    <div class="windowbg2" style="float: left; width: 50%; margin: 1%; margin-top: 0; margin-bottom: 0; border: 0;">
   <table border="0" width="100%" cellspacing="0" cellpadding="3" class="windowbg2">    <table border="0" width="100%" cellspacing="0" cellpadding="3" class="windowbg2">
   <tr>    <tr>
   <td class="windowbg2" align="left" valign="top"><b>$amv_txt{'47'}:</b></td>    <td class="windowbg2" align="left" valign="top"><b>$amv_txt{'47'}:</b></td>
   </tr>    </tr>
   </table>    </table>
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 50%; height: 115px; margin: 1%; border: 1px #cccccc solid; overflow: auto;">    <div class="windowbg2" style="float: left; width: 50%; height: 115px; margin: 1%; border: 1px #cccccc solid; overflow: auto;">
   ~;    ~;
       if (-e ("$vardir/maillist.dat")) {        if (-e ("$vardir/maillist.dat")) {
           fopen(FILE, "$vardir/maillist.dat");            fopen(FILE, "$vardir/maillist.dat");
           @maillist = <FILE>;            @maillist = <FILE>;
           fclose(FILE);            fclose(FILE);
           $yymain .= qq~            $yymain .= qq~
       <table border="0" width="99%" cellspacing="0" cellpadding="3" class="windowbg2">        <table border="0" width="99%" cellspacing="0" cellpadding="3" class="windowbg2">
       ~;        ~;
           foreach $curmail (@maillist) {            foreach $curmail (@maillist) {
               chomp $curmail;                chomp $curmail;
               ($otime, $osubject, $otext, $osender) = split(/\|/, $curmail);                ($otime, $osubject, $otext, $osender) = split(/\|/, $curmail);
               &LoadUser($osender);                &LoadUser($osender);
               $thetime = &timeformat($otime);                $thetime = &timeformat($otime);
   
               $jsubject = $osubject;                $jsubject = $osubject;
               $jtext    = $otext;                $jtext    = $otext;
               &ToJS($jsubject);                &ToJS($jsubject);
               &ToJS($jtext);                &ToJS($jtext);
   
               $yymain .= qq~                $yymain .= qq~
           <tr>            <tr>
               <td class="windowbg2" align="left" valign="middle">                <td class="windowbg2" align="left" valign="middle">
                   <input type="radio" name="usemail" value="$otime" class="windowbg2" style="border: 0; vertical-align: middle;" onclick="showMailmemb('$jsubject', '$jtext', '$otime');" />                    <input type="radio" name="usemail" value="$otime" class="windowbg2" style="border: 0; vertical-align: middle;" onclick="showMailmemb('$jsubject', '$jtext', '$otime');" />
               </td>                </td>
               <td class="windowbg2" align="left" valign="top"><span class="small">$thetime<br />${$uid.$osender}{'realname'}</span></td>                <td class="windowbg2" align="left" valign="top"><span class="small">$thetime<br />${$uid.$osender}{'realname'}</span></td>
               <td class="windowbg2" align="left" valign="top"><span class="small">$osubject</span></td>                <td class="windowbg2" align="left" valign="top"><span class="small">$osubject</span></td>
               <td class="windowbg2" align="left" valign="middle"><a href="$adminurl?action=deletemail;delmail=$otime"><img src="$imagesdir/admin_rem.gif" border="0" alt="del" /></a></td>                <td class="windowbg2" align="left" valign="middle"><a href="$adminurl?action=deletemail;delmail=$otime"><img src="$imagesdir/admin_rem.gif" border="0" alt="del" /></a></td>
           </tr>            </tr>
           ~;            ~;
           }            }
           $yymain .= qq~            $yymain .= qq~
       </table>        </table>
       ~;        ~;
       }        }
       $yymain .= qq~        $yymain .= qq~
   </div>    </div>
   
   
   <div class="windowbg2" style="float: left; width: 44%; margin: 1%; margin-top: 0; border: 0;">    <div class="windowbg2" style="float: left; width: 44%; margin: 1%; margin-top: 0; border: 0;">
   <table border="0" width="100%" cellspacing="0" cellpadding="0">    <table border="0" width="100%" cellspacing="0" cellpadding="0">
   <tr>    <tr>
   <td align="center">    <td align="center">
       &nbsp;        &nbsp;
   </td>    </td>
   </tr>    </tr>
   </table>    </table>
   </div>    </div>
   
   <div class="windowbg2" style="float: left; width: 50%; margin: 1%; margin-top: 0; border: 0;">    <div class="windowbg2" style="float: left; width: 50%; margin: 1%; margin-top: 0; border: 0;">
   <table border="0" width="100%" cellspacing="0" cellpadding="0">    <table border="0" width="100%" cellspacing="0" cellpadding="0">
   <tr>    <tr>
   <td align="center">    <td align="center">
       <input type="submit" name="mailsend" value="$amv_txt{'41'}" style="width: 100%;" class="button" />        <input type="submit" name="mailsend" value="$amv_txt{'41'}" style="width: 100%;" class="button" />
   </td>    </td>
   </tr>    </tr>
   </table>    </table>
   </div>    </div>
   
<div style="clear: both;"></div> <div style="clear: both;"></div>
</div> </div>
   
</form> </form>
   
<script language="JavaScript1.2" type="text/javascript"> <script language="JavaScript1.2" type="text/javascript">
<!-- <!--
mem_data = new Array ( $CheckingAll"" ); mem_data = new Array ( $CheckingAll"" );
group_data = new Array ( $grp_data ); group_data = new Array ( $grp_data );
   
function selectCheckAllmemb(tchecked) { function selectCheckAllmemb(tchecked) {
   for(var x = 0; x < document.adv_membermail.field1.options.length; x++) document.adv_membermail.field1.options[x].selected = tchecked;    for(var x = 0; x < document.adv_membermail.field1.options.length; x++) document.adv_membermail.field1.options[x].selected = tchecked;
   for(var i = 1; i <= $actualnum; i++) document.adv_membermail.elements[i].checked = tchecked;    for(var i = 1; i <= $actualnum; i++) document.adv_membermail.elements[i].checked = tchecked;
} }
   
function selectCheck() { function selectCheck() {
var z = 1; var z = 1;
var grpcnt = 0; var grpcnt = 0;
grp_data = new Array (); grp_data = new Array ();
   
   for(x = 0; x < document.adv_membermail.field1.options.length; x++) {    for(x = 0; x < document.adv_membermail.field1.options.length; x++) {
       if (document.adv_membermail.field1.options[x].selected) {        if (document.adv_membermail.field1.options[x].selected) {
           grp_data[grpcnt] = group_data[document.adv_membermail.field1.options[x].value];            grp_data[grpcnt] = group_data[document.adv_membermail.field1.options[x].value];
           grpcnt++;            grpcnt++;
       }        }
   }    }
   
   if (grpcnt < document.adv_membermail.field1.options.length) { document.adv_membermail.check_all.checked = false; }    if (grpcnt < document.adv_membermail.field1.options.length) { document.adv_membermail.check_all.checked = false; }
   
   for (var i = 0; i < $actualnum; i++) {    for (var i = 0; i < $actualnum; i++) {
       var check = 0;        var check = 0;
       for(x = 0; x < grpcnt; x++) {        for(x = 0; x < grpcnt; x++) {
           var limit = grp_data[x];            var limit = grp_data[x];
           var value = mem_data[i].split("|");            var value = mem_data[i].split("|");
           var j = 0;            var j = 0;
           while(value[j]) {            while(value[j]) {
               if (value[j] == limit) { check = 1; x = grpcnt; }                if (value[j] == limit) { check = 1; x = grpcnt; }
               j++;                j++;
           }            }
       }        }
       if (check == 1) {document.adv_membermail.elements[z].checked = true;}        if (check == 1) {document.adv_membermail.elements[z].checked = true;}
       else {document.adv_membermail.elements[z].checked = false;}        else {document.adv_membermail.elements[z].checked = false;}
       z++;        z++;
   }    }
} }
   
function checkIfChecked(theForm) { function checkIfChecked(theForm) {
   var nonechecked = true;    var nonechecked = true;
   for(var i = 1; i <= $actualnum; i++) {    for(var i = 1; i <= $actualnum; i++) {
       if (document.adv_membermail.elements[i].checked) nonechecked = false;        if (document.adv_membermail.elements[i].checked) nonechecked = false;
   }    }
   if (nonechecked) { alert("$amv_txt{'48'}"); return false }    if (nonechecked) { alert("$amv_txt{'48'}"); return false }
   return true    return true
} }
   
function showMailmemb(thesubject, thetext, thetime) { function showMailmemb(thesubject, thetext, thetime) {
   thetext=thetext.replace(/\<br \\/\>/g, "\\n");    thetext=thetext.replace(/\<br \\/\>/g, "\\n");
   document.adv_membermail.emailsubject.value = thesubject;    document.adv_membermail.emailsubject.value = thesubject;
   document.adv_membermail.emailtext.value = thetext;    document.adv_membermail.emailtext.value = thetext;
   document.adv_membermail.reused.value = thetime;    document.adv_membermail.reused.value = thetime;
} }
//--> //-->
</script> </script>
</div> </div>
   ~;    ~;
   }    }
   
   $yytitle     = "$admin_txt{'6'}";    $yytitle     = "$admin_txt{'6'}";
   $action_area = "mailing";    $action_area = "mailing";
   &AdminTemplate;    &AdminTemplate;
} }
   
sub ToJS { sub ToJS {
   $_[0] =~ s~;~&#059;~g;    $_[0] =~ s~;~&#059;~g;
   $_[0] =~ s~\!~&#33;~g;    $_[0] =~ s~\!~&#33;~g;
   $_[0] =~ s~\(~&#40;~g;    $_[0] =~ s~\(~&#40;~g;
   $_[0] =~ s~\)~&#41;~g;    $_[0] =~ s~\)~&#41;~g;
   $_[0] =~ s~\-~&#45;~g;    $_[0] =~ s~\-~&#45;~g;
   $_[0] =~ s~\.~&#46;~g;    $_[0] =~ s~\.~&#46;~g;
   $_[0] =~ s~\:~&#58;~g;    $_[0] =~ s~\:~&#58;~g;
   $_[0] =~ s~\?~&#63;~g;    $_[0] =~ s~\?~&#63;~g;
   $_[0] =~ s~\[~&#91;~g;    $_[0] =~ s~\[~&#91;~g;
   $_[0] =~ s~\\~&#92;&#92;~g;    $_[0] =~ s~\\~&#92;&#92;~g;
   $_[0] =~ s~\]~&#93;~g;    $_[0] =~ s~\]~&#93;~g;
   $_[0] =~ s~\^~&#94;~g;    $_[0] =~ s~\^~&#94;~g;
   $_[0] =~ s~\"~&#34;~g;    $_[0] =~ s~\"~&#34;~g;
   $_[0] =~ s~\'~&#96;~g;    $_[0] =~ s~\'~&#96;~g;
   $_[0] =~ s~\<~&#60;~g;    $_[0] =~ s~\<~&#60;~g;
   $_[0] =~ s~\>~&#62;~g;    $_[0] =~ s~\>~&#62;~g;
} }
   
1; 1;