D:\my docs\My Received Files\Yabb\Yabb\YaBB_2.5_AEB\cgi-bin\yabb2_old\Sources\Post.pl D:\WEBSITES\testbed\cgi-bin\yabb252\Sources\Post.pl
############################################################################### ###############################################################################
# Post.pl                                                                     # # Post.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.         #    
############################################################################### ###############################################################################
   
$postplver = 'YaBB 2.5 AE $Revision: 1.144 $'; $postplver = 'YaBB 2.5.2 $Revision: 1.1 $';
if ($action eq 'detailedversion') { return 1; } if ($action eq 'detailedversion') { return 1; }
   
&LoadLanguage('Post'); &LoadLanguage('Post');
&LoadLanguage('Display'); &LoadLanguage('Display');
&LoadLanguage('FA'); &LoadLanguage('FA');
&LoadLanguage('UserSelect'); &LoadLanguage('UserSelect');
   
require "$sourcedir/Notify.pl"; require "$sourcedir/Notify.pl";
require "$sourcedir/SpamCheck.pl"; require "$sourcedir/SpamCheck.pl";
   
if ($iamguest && $gpvalid_en && ($enable_guestposting || $PMenableGuestButton|| $PMAlertButtonGuests)) { if ($iamguest && $gpvalid_en && ($enable_guestposting || $PMenableGuestButton|| $PMAlertButtonGuests)) {
   require "$sourcedir/Decoder.pl";    require "$sourcedir/Decoder.pl";
} }
$set_subjectMaxLength ||= 50; $set_subjectMaxLength ||= 50;
   
&LoadCensorList; &LoadCensorList;
   
sub Post { sub Post {
   if ($iamguest && $enable_guestposting == 0) { &fatal_error("not_logged_in"); }    if ($iamguest && $enable_guestposting == 0) { &fatal_error("not_logged_in"); }
   if (!$iamadmin && !$iamgmod && !$iammod && $speedpostdetection && ${$uid.$username}{'spamcount'} >= $post_speed_count) {    if (!$iamadmin && !$iamgmod && !$iammod && $speedpostdetection && ${$uid.$username}{'spamcount'} >= $post_speed_count) {
       $detention_time = ${$uid.$username}{'spamtime'} + $spd_detention_time;        $detention_time = ${$uid.$username}{'spamtime'} + $spd_detention_time;
       if($date <= $detention_time){        if($date <= $detention_time){
           $detention_left = $detention_time - $date;            $detention_left = $detention_time - $date;
           &fatal_error("speedpostban");            &fatal_error("speedpostban");
       } else {        } else {
           ${$uid.$username}{'spamcount'} = 0;            ${$uid.$username}{'spamcount'} = 0;
           &UserAccount($username,"update");            &UserAccount($username,"update");
       }        }
   }    }
   if ($currentboard eq '' && !$iamguest) { &fatal_error("no_access"); }    if ($currentboard eq '' && !$iamguest) { &fatal_error("no_access"); }
   my ($filetype_info, $filesize_info);    my ($filetype_info, $filesize_info);
   my ($subtitle, $x, $mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate, $msubject, $mattach, $mip, $mmessage, $mns);    my ($subtitle, $x, $mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate, $msubject, $mattach, $mip, $mmessage, $mns);
   my $quotemsg = $INFO{'quote'};    my $quotemsg = $INFO{'quote'};
   $threadid = $INFO{'num'};    $threadid = $INFO{'num'};
   
   ($mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/, $yyThreadLine);    ($mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/, $yyThreadLine);
   
   my $icanbypass;    my $icanbypass;
   ## only if bypass switched on    ## only if bypass switched on
   if ($mstate =~ /l/i && $bypass_lock_perm) { $icanbypass = &checkUserLockBypass; }    if ($mstate =~ /l/i && $bypass_lock_perm) { $icanbypass = &checkUserLockBypass; }
   if ($action eq 'modalert') { $icanbypass = 1; }    if ($action eq 'modalert') { $icanbypass = 1; }
   if ($mstate =~ /l/i && !$icanbypass) { &fatal_error('topic_locked'); }    if ($mstate =~ /l/i && !$icanbypass) { &fatal_error('topic_locked'); }
   #if ($mstate =~ /a/i && !$iamadmin && !$iamgmod) { &fatal_error('no_access'); }    #if ($mstate =~ /a/i && !$iamadmin && !$iamgmod) { &fatal_error('no_access'); }
   
   # Determine category    # Determine category
   $curcat = ${$uid.$currentboard}{'cat'};    $curcat = ${$uid.$currentboard}{'cat'};
   &BoardTotals("load", $currentboard);    &BoardTotals("load", $currentboard);
   
   # Figure out the name of the category    # Figure out the name of the category
   unless ($mloaded == 1) { require "$boardsdir/forum.master"; }    unless ($mloaded == 1) { require "$boardsdir/forum.master"; }
   ($cat, $catperms) = split(/\|/, $catinfo{$curcat});    ($cat, $catperms) = split(/\|/, $catinfo{$curcat});
   &ToChars($cat);    &ToChars($cat);
   
   $pollthread = 0;    $pollthread = 0;
   $postthread = 0;    $postthread = 0;
   $INFO{'title'} =~ tr/+/ /;    $INFO{'title'} =~ tr/+/ /;
   
   if    ($INFO{'title'} eq 'CreatePoll') { $pollthread = 1; $t_title = $post_polltxt{'1a'}; }    if    ($INFO{'title'} eq 'CreatePoll') { $pollthread = 1; $t_title = $post_polltxt{'1a'}; }
   elsif ($INFO{'title'} eq 'AddPoll')    { $pollthread = 2; $t_title = $post_polltxt{'2a'}; }    elsif ($INFO{'title'} eq 'AddPoll')    { $pollthread = 2; $t_title = $post_polltxt{'2a'}; }
   elsif ($INFO{'title'} eq 'PostReply')  { $postthread = 2; $t_title = $display_txt{'116'}; }    elsif ($INFO{'title'} eq 'PostReply')  { $postthread = 2; $t_title = $display_txt{'116'}; }
   else { $postthread = 1; $t_title = $post_txt{'33'}; }    else { $postthread = 1; $t_title = $post_txt{'33'}; }
   if ($FORM{'title'} eq 'PostReply')  { $postthread = 2;}    if ($FORM{'title'} eq 'PostReply')  { $postthread = 2;}
   if ($pollthread == 2 && $useraddpoll == 0) { &fatal_error("no_access"); }    if ($pollthread == 2 && $useraddpoll == 0) { &fatal_error("no_access"); }
   
   $name_field = $iamguest ? qq~      <tr>    $name_field = $iamguest ? qq~      <tr>
   <td class="windowbg" align="left" width="23%"><label for="name"><b>$post_txt{'68'}:</b></label></td>    <td class="windowbg" align="left" width="23%"><label for="name"><b>$post_txt{'68'}:</b></label></td>
   <td class="windowbg" align="left" width="77%"><input type="text" name="name" id="name" size="25" value="$FORM{'name'}" maxlength="25" tabindex="2" /></td>    <td class="windowbg" align="left" width="77%"><input type="text" name="name" id="name" size="25" value="$FORM{'name'}" maxlength="25" tabindex="2" /></td>
     </tr>~      </tr>~
     : qq~~;      : qq~~;
   
   $email_field = $iamguest ? qq~      <tr>    $email_field = $iamguest ? qq~      <tr>
   <td class="windowbg" width="23%"><label for="email"><b>$post_txt{'69'}:</b></label></td>    <td class="windowbg" width="23%"><label for="email"><b>$post_txt{'69'}:</b></label></td>
   <td class="windowbg" width="77%"><input type="text" name="email" id="email" size="25" value="$FORM{'email'}" maxlength="40" tabindex="3" /></td>    <td class="windowbg" width="77%"><input type="text" name="email" id="email" size="25" value="$FORM{'email'}" maxlength="40" tabindex="3" /></td>
     </tr>~      </tr>~
     : qq~~;      : qq~~;
   
   if ($iamguest && $gpvalid_en) {    if ($iamguest && $gpvalid_en) {
       &validation_code;        &validation_code;
       $verification_field = $verification eq ''         $verification_field = $verification eq '' 
       ? qq~        ? qq~
           <tr>            <tr>
               <td class="windowbg" width="23%" valign="top"><label for="verification"><b>$floodtxt{'1'}:</b></label></td>                <td class="windowbg" width="23%" valign="top"><label for="verification"><b>$floodtxt{'1'}:</b></label></td>
               <td class="windowbg" width="77%">$showcheck<br /><label for="verification"><span class="small">$floodtxt{'casewarning'}</span></label></td>                <td class="windowbg" width="77%">$showcheck<br /><label for="verification"><span class="small">$floodtxt{'casewarning'}</span></label></td>
           </tr>            </tr>
           <tr>            <tr>
               <td class="windowbg" width="23%" valign="top"><label for="verification"><b>$floodtxt{'3'}:</b></label></td>                <td class="windowbg" width="23%" valign="top"><label for="verification"><b>$floodtxt{'3'}:</b></label></td>
               <td class="windowbg" width="77%">                <td class="windowbg" width="77%">
               <input type="text" maxlength="30" name="verification" id="verification" size="30" />                <input type="text" maxlength="30" name="verification" id="verification" size="30" />
               </td>                </td>
           </tr>            </tr>
       ~        ~
       : qq~~;        : qq~~;
   }    }
   
   $sub = '';    $sub = '';
   $settofield = 'subject';    $settofield = 'subject';
   if ($threadid ne '') {    if ($threadid ne '') {
       unless (ref($thread_arrayref{$threadid})) {        unless (ref($thread_arrayref{$threadid})) {
           fopen(FILE, "$datadir/$threadid.txt") || &fatal_error("cannot_open","$datadir/$threadid.txt", 1);            fopen(FILE, "$datadir/$threadid.txt") || &fatal_error("cannot_open","$datadir/$threadid.txt", 1);
           @{$thread_arrayref{$threadid}} = <FILE>;            @{$thread_arrayref{$threadid}} = <FILE>;
           fclose(FILE);            fclose(FILE);
       }        }
       if ($quotemsg ne '') {        if ($quotemsg ne '') {
           ($msubject, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns) = split(/\|/, ${$thread_arrayref{$threadid}}[$quotemsg]);            ($msubject, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns) = split(/\|/, ${$thread_arrayref{$threadid}}[$quotemsg]);
           $message = $mmessage;            $message = $mmessage;
           $message =~ s~<br.*?>~\n~ig;            $message =~ s~<br.*?>~\n~ig;
           $message =~ s/ \&nbsp; \&nbsp; \&nbsp;/\t/ig;            $message =~ s/ \&nbsp; \&nbsp; \&nbsp;/\t/ig;
           if (!$nestedquotes) {            if (!$nestedquotes) {
               $message =~ s~\n{0,1}\[quote([^\]]*)\](.*?)\[/quote([^\]]*)\]\n{0,1}~\n~isg;                $message =~ s~\n{0,1}\[quote([^\]]*)\](.*?)\[/quote([^\]]*)\]\n{0,1}~\n~isg;
           }            }
           $mname ||= $musername || $post_txt{'470'};            $mname ||= $musername || $post_txt{'470'};
           my $hidename = $musername;            my $hidename = $musername;
           $hidename = $mname if $musername eq 'Guest';            $hidename = $mname if $musername eq 'Guest';
           $hidename = &cloak($hidename) if $do_scramble_id;            $hidename = &cloak($hidename) if $do_scramble_id;
           $usernames_life_quote{$hidename} = $mname; # for display names in Quotes in LivePreview            $usernames_life_quote{$hidename} = $mname; # for display names in Quotes in LivePreview
           my $maxlengthofquote = $MaxMessLen - length(qq~[quote author=$hidename link=$threadid/$quotemsg#$quotemsg date=$mdate\]\[/quote\]\n~) - 3;            my $maxlengthofquote = $MaxMessLen - length(qq~[quote author=$hidename link=$threadid/$quotemsg#$quotemsg date=$mdate\]\[/quote\]\n~) - 3;
           my $mess_len = $message;            my $mess_len = $message;
           &ToChars($mess_len);            &ToChars($mess_len);
           $mess_len =~ s/[\r\n ]//ig;            $mess_len =~ s/[\r\n ]//ig;
           $mess_len =~ s/&#\d{3,}?\;/X/ig;            $mess_len =~ s/&#\d{3,}?\;/X/ig;
           if (length $mess_len >= $maxlengthofquote) {            if (length $mess_len >= $maxlengthofquote) {
               &LoadLanguage('Error');                &LoadLanguage('Error');
               &alertbox($error_txt{'quote_too_long'});                &alertbox($error_txt{'quote_too_long'});
               $message = substr($message, 0, $maxlengthofquote) . '...';                $message = substr($message, 0, $maxlengthofquote) . '...';
           }            }
           undef $mess_len;            undef $mess_len;
           $message = qq~[quote author=$hidename link=$threadid/$quotemsg#$quotemsg date=$mdate\]$message\[/quote\]\n~;            $message = qq~[quote author=$hidename link=$threadid/$quotemsg#$quotemsg date=$mdate\]$message\[/quote\]\n~;
           if ($mns eq 'NS') { $nscheck = qq~ checked="checked"~; }            if ($mns eq 'NS') { $nscheck = qq~ checked="checked"~; }
       } else {        } else {
           ($msubject, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns) = split(/\|/, ${$thread_arrayref{$threadid}}[0]);            ($msubject, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mmessage, $mns) = split(/\|/, ${$thread_arrayref{$threadid}}[0]);
       }        }
       $msubject =~ s/\bre:\s+//ig;        $msubject =~ s/\bre:\s+//ig;
       $sub = "Re: $msubject";        $sub = "Re: $msubject";
       $settofield = 'message';        $settofield = 'message';
   }    }
   
   if ($ENV{'HTTP_USER_AGENT'} =~ /(MSIE) (\d)/) {    if ($ENV{'HTTP_USER_AGENT'} =~ /(MSIE) (\d)/) {
       if ($2 >= 7.0) { $iecopycheck = ''; } else { $iecopycheck = qq~ checked="checked"~; }        if ($2 >= 7.0) { $iecopycheck = ''; } else { $iecopycheck = qq~ checked="checked"~; }
   }    }
   $submittxt   = "$post_txt{'105'}";    $submittxt   = "$post_txt{'105'}";
   $destination = "post2";    $destination = "post2";
   $icon        = "xx";    $icon        = "xx";
   $is_preview  = 0;    $is_preview  = 0;
   $post        = "post";    $post        = "post";
   $prevmain    = "";    $prevmain    = "";
   $preview     = "preview";    $preview     = "preview";
   $yytitle     = "$t_title" unless $Quick_Post;    $yytitle     = "$t_title" unless $Quick_Post;
   &Postpage;    &Postpage;
   &doshowthread unless $Quick_Post;    &doshowthread unless $Quick_Post;
   if (%usernames_life_quote) { # for display names in Quotes in LivePreview    if (%usernames_life_quote) { # for display names in Quotes in LivePreview
       $yymain .= qq~        $yymain .= qq~
   <script language="JavaScript" type="text/javascript">    <script language="JavaScript" type="text/javascript">
   <!-- //    <!-- //
       ~ . join(';', map { qq~LivePrevDisplayNames['$_'] = "$usernames_life_quote{$_}"~ } keys %usernames_life_quote) . qq~;        ~ . join(';', map { qq~LivePrevDisplayNames['$_'] = "$usernames_life_quote{$_}"~ } keys %usernames_life_quote) . qq~;
   // -->    // -->
   </script>\n~;    </script>\n~;
   }    }
   &template;    &template;
} }
   
##  post message page ##  post message page
sub Postpage { sub Postpage {
   my $extra;    my $extra;
   my ($filetype_info, $filesize_info, $extensions);    my ($filetype_info, $filesize_info, $extensions);
   $extensions = join(" ", @ext);    $extensions = join(" ", @ext);
   $filetype_info = $checkext == 1 ? qq~$fatxt{'2'} $extensions~ : qq~$fatxt{'2'} $fatxt{'4'}~;    $filetype_info = $checkext == 1 ? qq~$fatxt{'2'} $extensions~ : qq~$fatxt{'2'} $fatxt{'4'}~;
   $filesize_info = $limit != 0    ? qq~$fatxt{'3'} $limit KB~   : qq~$fatxt{'3'} $fatxt{'5'}~;    $filesize_info = $limit != 0    ? qq~$fatxt{'3'} $limit KB~   : qq~$fatxt{'3'} $fatxt{'5'}~;
   $normalquot = $post_txt{'599'};    $normalquot = $post_txt{'599'};
   $simpelquot = $post_txt{'601'};    $simpelquot = $post_txt{'601'};
   $simpelcode = $post_txt{'602'};    $simpelcode = $post_txt{'602'};
   $edittext   = $post_txt{'603'};    $edittext   = $post_txt{'603'};
   if (!$fontsizemax) { $fontsizemax = 72; }    if (!$fontsizemax) { $fontsizemax = 72; }
   if (!$fontsizemin) { $fontsizemin = 6; }    if (!$fontsizemin) { $fontsizemin = 6; }
   
   if ($postid eq 'Poll')  { $sub = "$post_txt{'66a'}"; }    if ($postid eq 'Poll')  { $sub = "$post_txt{'66a'}"; }
   
   $message =~ s~<\/~\&lt\;/~isg;    $message =~ s~<\/~\&lt\;/~isg;
   &ToChars($message);    &ToChars($message);
   $message = &Censor($message);    $message = &Censor($message);
   &ToChars($sub);    &ToChars($sub);
   $sub = &Censor($sub);    $sub = &Censor($sub);
   
   if ($action eq "modify" || $action eq "modify2") {    if ($action eq "modify" || $action eq "modify2") {
       $displayname = qq~$mename~;        $displayname = qq~$mename~;
   } else {    } else {
       $displayname = ${$uid.$username}{'realname'};        $displayname = ${$uid.$username}{'realname'};
   }    }
   require "$sourcedir/ContextHelp.pl";    require "$sourcedir/ContextHelp.pl";
   &ContextScript("post");    &ContextScript("post");
   $yymain .= $ctmain;    $yymain .= $ctmain;
   
   # this defines what the top area of the post box will look like: option 1 ) IM area    # this defines what the top area of the post box will look like: option 1 ) IM area
   # option 2) all other post areas    # option 2) all other post areas
   #  im stuff now separate    #  im stuff now separate
   if ($postid ne 'Poll' && $destination ne 'modalert2' && $destination ne 'guestpm2') {    if ($postid ne 'Poll' && $destination ne 'modalert2' && $destination ne 'guestpm2') {
       $extra = qq~        $extra = qq~
   <tr id="feature_status_1">    <tr id="feature_status_1">
       <td class="windowbg" width="23%"><label for="icon"><b>$post_txt{'71'}:</b></label></td>        <td class="windowbg" width="23%"><label for="icon"><b>$post_txt{'71'}:</b></label></td>
       <td width="77%" class="windowbg">        <td width="77%" class="windowbg">
           <select name="icon" id="icon" onchange="showimage(); updatTopic();">            <select name="icon" id="icon" onchange="showimage(); updatTopic();">
           <option value="xx"$ic1>$post_txt{'281'}</option>            <option value="xx"$ic1>$post_txt{'281'}</option>
           <option value="thumbup"$ic2>$post_txt{'282'}</option>            <option value="thumbup"$ic2>$post_txt{'282'}</option>
           <option value="thumbdown"$ic3>$post_txt{'283'}</option>            <option value="thumbdown"$ic3>$post_txt{'283'}</option>
           <option value="exclamation"$ic4>$post_txt{'284'}</option>            <option value="exclamation"$ic4>$post_txt{'284'}</option>
           <option value="question"$ic5>$post_txt{'285'}</option>            <option value="question"$ic5>$post_txt{'285'}</option>
           <option value="lamp"$ic6>$post_txt{'286'}</option>            <option value="lamp"$ic6>$post_txt{'286'}</option>
           <option value="smiley"$ic7>$post_txt{'287'}</option>            <option value="smiley"$ic7>$post_txt{'287'}</option>
           <option value="angry"$ic8>$post_txt{'288'}</option>            <option value="angry"$ic8>$post_txt{'288'}</option>
           <option value="cheesy"$ic9>$post_txt{'289'}</option>            <option value="cheesy"$ic9>$post_txt{'289'}</option>
           <option value="grin"$ic10>$post_txt{'290'}</option>            <option value="grin"$ic10>$post_txt{'290'}</option>
           <option value="sad"$ic11>$post_txt{'291'}</option>            <option value="sad"$ic11>$post_txt{'291'}</option>
           <option value="wink"$ic12>$post_txt{'292'}</option>            <option value="wink"$ic12>$post_txt{'292'}</option>
           </select>            </select>
           <img src="$imagesdir/$icon.gif" name="icons" border="0" hspace="15" alt="" />            <img src="$imagesdir/$icon.gif" name="icons" border="0" hspace="15" alt="" />
       </td>        </td>
   </tr>    </tr>
        ~;         ~;
       if ($iamguest && $threadid ne '') { $settofield = "name"; }        if ($iamguest && $threadid ne '') { $settofield = "name"; }
   }    }
   
   if ($pollthread && $iamguest) { $guest_vote = 1; }    if ($pollthread && $iamguest) { $guest_vote = 1; }
   if ($pollthread == 2) { $settofield = "question"; }    if ($pollthread == 2) { $settofield = "question"; }
   
   # this defines if the notify on reply is shown or not.    # this defines if the notify on reply is shown or not.
   if ($iamguest || $destination eq "modalert2" || $destination eq "guestpm2") {    if ($iamguest || $destination eq "modalert2" || $destination eq "guestpm2") {
       $notification = '';        $notification = '';
   } else {    } else {
       # check if you are already being notified and if so we check the checkbox.        # check if you are already being notified and if so we check the checkbox.
       # if the mail file exists then we have to check it otherwise we continue on        # if the mail file exists then we have to check it otherwise we continue on
       my $notify = "";        my $notify = "";
       my $hasnotify = 0;        my $hasnotify = 0;
       $notifytext = qq~$post_txt{'750'}~;        $notifytext = qq~$post_txt{'750'}~;
       if (!$FORM{'notify'} && !exists $FORM{'hasnotify'}) {        if (!$FORM{'notify'} && !exists $FORM{'hasnotify'}) {
           &ManageThreadNotify("load", $threadid);            &ManageThreadNotify("load", $threadid);
           if (exists $thethread{$username}) {            if (exists $thethread{$username}) {
               $notify    = qq~ checked="checked"~;                $notify    = qq~ checked="checked"~;
               $hasnotify = 1;                $hasnotify = 1;
           }            }
           undef %thethread;            undef %thethread;
   
           &ManageBoardNotify("load", $currentboard);            &ManageBoardNotify("load", $currentboard);
           if (exists $theboard{$username} && (split(/\|/, $theboard{$username}))[1] == 2) {            if (exists $theboard{$username} && (split(/\|/, $theboard{$username}))[1] == 2) {
               $notify     = qq~ disabled="disabled" checked="checked"~;                $notify     = qq~ disabled="disabled" checked="checked"~;
               $hasnotify  = 2;                $hasnotify  = 2;
               $notifytext = qq~$post_txt{'132'}~;                $notifytext = qq~$post_txt{'132'}~;
           }            }
           undef %theboard;            undef %theboard;
   
       } else {        } else {
           $notify = qq~ checked="checked"~ if $FORM{'notify'} eq 'x';            $notify = qq~ checked="checked"~ if $FORM{'notify'} eq 'x';
           $hasnotify = $FORM{'hasnotify'};            $hasnotify = $FORM{'hasnotify'};
           if ($hasnotify == 2) {            if ($hasnotify == 2) {
               $notify     = qq~ disabled="disabled" checked="checked"~;                $notify     = qq~ disabled="disabled" checked="checked"~;
               $notifytext = qq~$post_txt{'132'}~;                $notifytext = qq~$post_txt{'132'}~;
           }            }
       }        }
   
   
       if ($postid ne 'Poll') {        if ($postid ne 'Poll') {
           $notification = qq~            $notification = qq~
   <tr id="feature_status_2">    <tr id="feature_status_2">
       <td width="23%"><label for="notify"><b>$post_txt{'131'}:</b></label></td>        <td width="23%"><label for="notify"><b>$post_txt{'131'}:</b></label></td>
       <td width="77%"><input type="hidden" name="hasnotify" value="$hasnotify" /><input type="checkbox" name="notify" id="notify" value="x"$notify /> <span class="small"><label for="notify">$notifytext</label></span></td>        <td width="77%"><input type="hidden" name="hasnotify" value="$hasnotify" /><input type="checkbox" name="notify" id="notify" value="x"$notify /> <span class="small"><label for="notify">$notifytext</label></span></td>
   </tr>~;    </tr>~;
       }        }
   }    }
   
   #add to favorites checkbox code    #add to favorites checkbox code
   $favoriteadd = '';    $favoriteadd = '';
   if (!$iamguest && $currentboard ne $annboard && $destination ne 'modalert2') {    if (!$iamguest && $currentboard ne $annboard && $destination ne 'modalert2') {
       $favoritetext = $post_txt{'notfav'};        $favoritetext = $post_txt{'notfav'};
       require "$sourcedir/Favorites.pl";        require "$sourcedir/Favorites.pl";
       $nofav = &IsFav($threadid, '', 1);        $nofav = &IsFav($threadid, '', 1);
       if ($FORM{'favorite'}) {        if ($FORM{'favorite'}) {
           $favorite = qq~ checked="checked"~;            $favorite = qq~ checked="checked"~;
       }        }
       if (!$nofav) {        if (!$nofav) {
           $favorite = qq~ disabled="disabled" checked="checked"~;            $favorite = qq~ disabled="disabled" checked="checked"~;
           $favoritetext = $post_txt{'alreadyfav'};            $favoritetext = $post_txt{'alreadyfav'};
           $hasfavorite = 1;            $hasfavorite = 1;
       } elsif ($nofav == 2){        } elsif ($nofav == 2){
           $favorite = qq~ disabled="disabled"~;            $favorite = qq~ disabled="disabled"~;
           $favoritetext = $post_txt{'maximumfav'};            $favoritetext = $post_txt{'maximumfav'};
       }        }
       $favoriteadd = qq~        $favoriteadd = qq~
   <tr id="feature_status_3">    <tr id="feature_status_3">
       <td width="23%"><label for="favorite"><b>$post_txt{'favorite'}:</b></label></td>        <td width="23%"><label for="favorite"><b>$post_txt{'favorite'}:</b></label></td>
       <td width="77%"><input type="checkbox" name="favorite" id="favorite" value="x"$favorite /> <span class="small"><label for="favorite">$favoritetext</label></span></td>        <td width="77%"><input type="checkbox" name="favorite" id="favorite" value="x"$favorite /> <span class="small"><label for="favorite">$favoritetext</label></span></td>
   </tr>~;    </tr>~;
   }    }
   
   if (!$sub) { $subtitle = "<i>$post_txt{'33'}</i>"; }    if (!$sub) { $subtitle = "<i>$post_txt{'33'}</i>"; }
   else { $subtitle = "<i>$sub</i>"; }    else { $subtitle = "<i>$sub</i>"; }
   # this is shown every post page except the IM area.    # this is shown every post page except the IM area.
   if ($destination ne 'modalert2' && $destination ne 'guestpm2' && !$Quick_Post) {    if ($destination ne 'modalert2' && $destination ne 'guestpm2' && !$Quick_Post) {
       if ($threadid) {        if ($threadid) {
           $threadlink = qq~<a href="$scripturl?num=$threadid" class="nav">$subtitle</a>~;            $threadlink = qq~<a href="$scripturl?num=$threadid" class="nav">$subtitle</a>~;
       } else {        } else {
           $threadlink = "$subtitle";            $threadlink = "$subtitle";
       }        }
       &ToChars($boardname);        &ToChars($boardname);
       &ToChars($cat);        &ToChars($cat);
       $yynavigation = qq~&rsaquo; <a href="$scripturl?catselect=$catid" class="nav">$cat</a> &rsaquo; <a href="$scripturl?board=$currentboard" class="nav">$boardname</a> &rsaquo; $t_title ( $threadlink )~;        $yynavigation = qq~&rsaquo; <a href="$scripturl?catselect=$catid" class="nav">$cat</a> &rsaquo; <a href="$scripturl?board=$currentboard" class="nav">$boardname</a> &rsaquo; $t_title ( $threadlink )~;
   } elsif (!$Quick_Post) {    } elsif (!$Quick_Post) {
       $yynavigation = qq~&rsaquo; $t_title~;        $yynavigation = qq~&rsaquo; $t_title~;
   }    }
   #this is the end of the upper area of the post page.    #this is the end of the upper area of the post page.
   $yymain .= qq~    $yymain .= qq~
   
<script language="JavaScript1.2" type="text/javascript"> <script language="JavaScript1.2" type="text/javascript">
<!-- <!--
   
function alertqq() { function alertqq() {
   alert("$post_txt{'alertquote'}");    alert("$post_txt{'alertquote'}");
} }
function quick_quote_confirm(ahref) { function quick_quote_confirm(ahref) {
   if (document.postmodify.message.value == "") {    if (document.postmodify.message.value == "") {
       window.location.href = ahref;        window.location.href = ahref;
   } else {    } else {
       var Check = confirm('$post_txt{'quote_confirm'}');        var Check = confirm('$post_txt{'quote_confirm'}');
       if (Check == true) {        if (Check == true) {
           window.location.href = ahref;            window.location.href = ahref;
       } else {        } else {
           document.postmodify.message.focus();            document.postmodify.message.focus();
       }        }
   }    }
} }
   
var postas = '$post'; var postas = '$post';
function checkForm(theForm) { function checkForm(theForm) {
   var isError = 0;    var isError = 0;
   var msgError = "$post_txt{'751'}\\n";    var msgError = "$post_txt{'751'}\\n";
   if (navigator.appName == "Microsoft Internet Explorer" && document.getElementById('iecopy').checked == true) { theForm.message.createTextRange().execCommand("Copy"); }    if (navigator.appName == "Microsoft Internet Explorer" && document.getElementById('iecopy').checked == true) { theForm.message.createTextRange().execCommand("Copy"); }
   ~ . ($iamguest && $post ne "imsend" && $post ne "imsend2" ? qq~if (theForm.name.value == "" || theForm.name.value == "_" || theForm.name.value == " ") { msgError += "\\n - $post_txt{'75'}"; if (isError == 0) isError = 2; }    ~ . ($iamguest && $post ne "imsend" && $post ne "imsend2" ? qq~if (theForm.name.value == "" || theForm.name.value == "_" || theForm.name.value == " ") { msgError += "\\n - $post_txt{'75'}"; if (isError == 0) isError = 2; }
   if (theForm.name.value.length > 25)  { msgError += "\\n - $post_txt{'568'}"; if (isError == 0) isError = 2; }    if (theForm.name.value.length > 25)  { msgError += "\\n - $post_txt{'568'}"; if (isError == 0) isError = 2; }
   if (theForm.email.value == "") { msgError += "\\n - $post_txt{'76'}"; if (isError == 0) isError = 3; }    if (theForm.email.value == "") { msgError += "\\n - $post_txt{'76'}"; if (isError == 0) isError = 3; }
   if (! checkMailaddr(theForm.email.value)) { msgError += "\\n - $post_txt{'500'}"; if (isError == 0) isError = 3; }~ : qq~if (postas == "imsend" || postas == "imsend2") {    if (! checkMailaddr(theForm.email.value)) { msgError += "\\n - $post_txt{'500'}"; if (isError == 0) isError = 3; }~ : qq~if (postas == "imsend" || postas == "imsend2") {
       if (theForm.toshow.options.length == 0 ) { msgError += "\\n - $post_txt{'752'}"; isError = 1; }        if (theForm.toshow.options.length == 0 ) { msgError += "\\n - $post_txt{'752'}"; isError = 1; }
       else { selectNames(); }        else { selectNames(); }
   
   }~) . qq~    }~) . qq~
   
   if (theForm.subject.value == "") { msgError += "\\n - $post_txt{'77'}"; if (isError == 0) isError = 4; }    if (theForm.subject.value == "") { msgError += "\\n - $post_txt{'77'}"; if (isError == 0) isError = 4; }
   else if ($checkallcaps && theForm.subject.value.search(/[A-Z]{$checkallcaps,}/g) != -1) {    else if ($checkallcaps && theForm.subject.value.search(/[A-Z]{$checkallcaps,}/g) != -1) {
       if (isError == 0) { msgError = " - $post_txt{'79'}"; isError = 4; }        if (isError == 0) { msgError = " - $post_txt{'79'}"; isError = 4; }
       else { msgError += "\\n - $post_txt{'79'}"; }        else { msgError += "\\n - $post_txt{'79'}"; }
   }    }
   if (theForm.message.value == "") { msgError += "\\n - $post_txt{'78'}"; if (isError == 0) isError = 5; }    if (theForm.message.value == "") { msgError += "\\n - $post_txt{'78'}"; if (isError == 0) isError = 5; }
   else if ($checkallcaps && theForm.message.value.search(/[A-Z]{$checkallcaps,}/g) != -1) {    else if ($checkallcaps && theForm.message.value.search(/[A-Z]{$checkallcaps,}/g) != -1) {
       if (isError == 0) { msgError = " - $post_txt{'79'}"; isError = 5; }        if (isError == 0) { msgError = " - $post_txt{'79'}"; isError = 5; }
       else { msgError += "\\n - $post_txt{'79'}"; }        else { msgError += "\\n - $post_txt{'79'}"; }
   }    }
   if (isError > 0) {    if (isError > 0) {
       alert(msgError);        alert(msgError);
       if (isError == 1) imWin();        if (isError == 1) imWin();
       else if (isError == 2) theForm.name.focus();        else if (isError == 2) theForm.name.focus();
       else if (isError == 3) theForm.email.focus();        else if (isError == 3) theForm.email.focus();
       else if (isError == 4) theForm.subject.focus();        else if (isError == 4) theForm.subject.focus();
       else if (isError == 5) theForm.message.focus();        else if (isError == 5) theForm.message.focus();
       return false;        return false;
   }    }
   return true    return true
} }
   
//--> //-->
</script> </script>
   
~; ~;
   
   # if this is an IM from the admin or to groups declare where it goes.    # if this is an IM from the admin or to groups declare where it goes.
   if ($INFO{'adminim'} || $INFO{'action'} eq "imgroups") {    if ($INFO{'adminim'} || $INFO{'action'} eq "imgroups") {
       $yymain .= qq~<form action="$scripturl?action=imgroups" method="post" name="postmodify" onsubmit="return submitproc()">~;        $yymain .= qq~<form action="$scripturl?action=imgroups" method="post" name="postmodify" onsubmit="return submitproc()">~;
   } else {    } else {
       if ($curnum) { $thecurboard = qq~num=$curnum\;action=$destination~; }        if ($curnum) { $thecurboard = qq~num=$curnum\;action=$destination~; }
       elsif ($destination eq "guestpm2") { $thecurboard = qq~action=$destination~; }        elsif ($destination eq "guestpm2") { $thecurboard = qq~action=$destination~; }
       else { $thecurboard = qq~board=$currentboard\;action=$destination~; }        else { $thecurboard = qq~board=$currentboard\;action=$destination~; }
       if (&AccessCheck($currentboard, 4) eq "granted" && $allowattach && ${$uid.$currentboard}{'attperms'} == 1) {        if (&AccessCheck($currentboard, 4) eq "granted" && $allowattach && ${$uid.$currentboard}{'attperms'} == 1) {
           $yymain .= qq~<form action="$scripturl?$thecurboard" method="post" name="postmodify" enctype="multipart/form-data" onsubmit="if(!checkForm(this)) {return false} else {return submitproc()}">~;            $yymain .= qq~<form action="$scripturl?$thecurboard" method="post" name="postmodify" enctype="multipart/form-data" onsubmit="if(!checkForm(this)) {return false} else {return submitproc()}">~;
       } else {        } else {
           $yymain .= qq~<form action="$scripturl?$thecurboard" method="post" name="postmodify" enctype="application/x-www-form-urlencoded" onsubmit="if(!checkForm(this)) {return false} else {return submitproc()}">~;            $yymain .= qq~<form action="$scripturl?$thecurboard" method="post" name="postmodify" enctype="application/x-www-form-urlencoded" onsubmit="if(!checkForm(this)) {return false} else {return submitproc()}">~;
       }        }
   }    }
   if ($postthread == 2) { $yymain .= qq~<input type="hidden" id="title" name="PostReply" value="title" />~; }    if ($postthread == 2) { $yymain .= qq~<input type="hidden" id="title" name="PostReply" value="title" />~; }
   # this declares the beginning of the UBBC section    # this declares the beginning of the UBBC section
   $yymain .= qq~    $yymain .= qq~
   
   <div class="bordercolor" style="padding: 1px; width: 100%; margin-left: auto; margin-right: auto;">    <div class="bordercolor" style="padding: 1px; width: 100%; margin-left: auto; margin-right: auto;">
   <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>
   <script language="JavaScript1.2" type="text/javascript">    <script language="JavaScript1.2" type="text/javascript">
   <!--    <!--
   ~;    ~;
   
   $moresmilieslist = '';    $moresmilieslist = '';
   $more_smilie_array = '';    $more_smilie_array = '';
   $i = 0;    $i = 0;
   if ($showadded == 1) {    if ($showadded == 1) {
       while ($SmilieURL[$i]) {        while ($SmilieURL[$i]) {
           if ($SmilieURL[$i] =~ /\//i) { $tmpurl = $SmilieURL[$i]; }            if ($SmilieURL[$i] =~ /\//i) { $tmpurl = $SmilieURL[$i]; }
           else { $tmpurl = qq~$imagesdir/$SmilieURL[$i]~; }            else { $tmpurl = qq~$imagesdir/$SmilieURL[$i]~; }
           $moresmilieslist .= qq~                document.write('<img src="$tmpurl" align="bottom" alt="$SmilieDescription[$i]" title="$SmilieDescription[$i]" border="0" onclick="javascript: MoreSmilies($i);" style="cursor: pointer;" />$SmilieLinebreak[$i] ');\n~;            $moresmilieslist .= qq~                document.write('<img src="$tmpurl" align="bottom" alt="$SmilieDescription[$i]" title="$SmilieDescription[$i]" border="0" onclick="javascript: MoreSmilies($i);" style="cursor: pointer;" />$SmilieLinebreak[$i] ');\n~;
           $tmpcode = $SmilieCode[$i];            $tmpcode = $SmilieCode[$i];
           $tmpcode =~ s/\&quot;/"+'"'+"/g;    #" Adding that because if not it screws up my syntax view'             $tmpcode =~ s/\&quot;/"+'"'+"/g;    #" Adding that because if not it screws up my syntax view' 
           &FromHTML($tmpcode);            &FromHTML($tmpcode);
           $tmpcode =~ s/&#36;/\$/g;            $tmpcode =~ s/&#36;/\$/g;
           $tmpcode =~ s/&#64;/\@/g;            $tmpcode =~ s/&#64;/\@/g;
           $more_smilie_array .= qq~" $tmpcode", ~;            $more_smilie_array .= qq~" $tmpcode", ~;
           $i++;            $i++;
       }        }
   }    }
   
   if ($showsmdir == 1) {    if ($showsmdir == 1) {
       opendir(DIR, "$smiliesdir");        opendir(DIR, "$smiliesdir");
       @contents = readdir(DIR);        @contents = readdir(DIR);
       closedir(DIR);        closedir(DIR);
       foreach $line (sort { uc($a) cmp uc($b) } @contents) {        foreach $line (sort { uc($a) cmp uc($b) } @contents) {
           ($name, $extension) = split(/\./, $line);            ($name, $extension) = split(/\./, $line);
           if ($extension =~ /gif/i || $extension =~ /jpg/i || $extension =~ /jpeg/i || $extension =~ /png/i) {            if ($extension =~ /gif/i || $extension =~ /jpg/i || $extension =~ /jpeg/i || $extension =~ /png/i) {
               if ($line !~ /banner/i) {                if ($line !~ /banner/i) {
                   $moresmilieslist .= qq~                document.write('<img src="$smiliesurl/$line" align="bottom" alt="$name" title="$name" border="0" onclick="javascript: MoreSmilies($i);" style="cursor: hand;" />$SmilieLinebreak[$i] ');\n~;                    $moresmilieslist .= qq~                document.write('<img src="$smiliesurl/$line" align="bottom" alt="$name" title="$name" border="0" onclick="javascript: MoreSmilies($i);" style="cursor: hand;" />$SmilieLinebreak[$i] ');\n~;
                   $more_smilie_array .= qq~" [smiley=$line]", ~;                    $more_smilie_array .= qq~" [smiley=$line]", ~;
                   $i++;                    $i++;
               }                }
           }            }
       }        }
   }    }
   
   $more_smilie_array .= qq~""~;    $more_smilie_array .= qq~""~;
   
   $yymain .= qq~    $yymain .= qq~
   moresmiliecode = new Array($more_smilie_array)    moresmiliecode = new Array($more_smilie_array)
   function MoreSmilies(i) {    function MoreSmilies(i) {
       AddTxt=moresmiliecode[i];        AddTxt=moresmiliecode[i];
       AddText(AddTxt);        AddText(AddTxt);
   }    }
   ~;    ~;
   
   if ($smiliestyle == 1) { $smiliewinlink = qq~$scripturl?action=smilieput~; }    if ($smiliestyle == 1) { $smiliewinlink = qq~$scripturl?action=smilieput~; }
   else { $smiliewinlink = qq~$scripturl?action=smilieindex~; }    else { $smiliewinlink = qq~$scripturl?action=smilieindex~; }
   
   $yymain .= qq~    $yymain .= qq~
   function smiliewin() {    function smiliewin() {
       window.open("$smiliewinlink", 'list', 'width=$winwidth, height=$winheight, scrollbars=yes');        window.open("$smiliewinlink", 'list', 'width=$winwidth, height=$winheight, scrollbars=yes');
   }    }
   ~;    ~;
   
   if ($destination ne 'modalert2' && $destination ne 'guestpm2') {    if ($destination ne 'modalert2' && $destination ne 'guestpm2') {
       $yymain .= qq~        $yymain .= qq~
   function showimage() {    function showimage() {
       document.images.icons.src="$imagesdir/"+document.postmodify.icon.options[document.postmodify.icon.selectedIndex].value+".gif";        document.images.icons.src="$imagesdir/"+document.postmodify.icon.options[document.postmodify.icon.selectedIndex].value+".gif";
   }~;    }~;
   }    }
   
   $yymain .= qq~    $yymain .= qq~
//--> //-->
</script> </script>
<input type="hidden" name="threadid" value="$threadid" /> <input type="hidden" name="threadid" value="$threadid" />
<input type="hidden" name="postid" value="$postid" /> <input type="hidden" name="postid" value="$postid" />
<input type="hidden" name="info" value="$idinfo" /> <input type="hidden" name="info" value="$idinfo" />
<input type="hidden" name="mename" value="$mename" /> <input type="hidden" name="mename" value="$mename" />
<input type="hidden" name="post_entry_time" value="$date" /> <input type="hidden" name="post_entry_time" value="$date" />
<input type="hidden" name="virboard" value="$INFO{'virboard'}$FORM{'virboard'}" /> <input type="hidden" name="virboard" value="$INFO{'virboard'}$FORM{'virboard'}" />
   
<table border="0" width="100%" cellpadding="3" cellspacing="0" style="table-layout: fixed;"> <table border="0" width="100%" cellpadding="3" cellspacing="0" style="table-layout: fixed;">
   <tr>    <tr>
       <td class="titlebg" height="18" width="100%">        <td class="titlebg" height="18" width="100%">
           <img src="$imagesdir/$icon.gif" name="icons2" border="0" alt="" style="vertical-align:middle;" /> $yytitle            <img src="$imagesdir/$icon.gif" name="icons2" border="0" alt="" style="vertical-align:middle;" /> $yytitle
       </td>        </td>
   </tr>    </tr>
~; ~;
   
   $iammod = 0;    $iammod = 0;
   if (keys(%moderators) > 0) {    if (keys(%moderators) > 0) {
       while ($_ = each(%moderators)) {        while ($_ = each(%moderators)) {
           if ($username eq $_) { $iammod = 1; }            if ($username eq $_) { $iammod = 1; }
       }        }
   }    }
   if (keys(%moderatorgroups) > 0) {    if (keys(%moderatorgroups) > 0) {
       while ($_ = each(%moderatorgroups)) {        while ($_ = each(%moderatorgroups)) {
           if (${$uid.$username}{'position'} eq $_) { $iammod = 1; }            if (${$uid.$username}{'position'} eq $_) { $iammod = 1; }
           foreach $memberaddgroups (split(/,/, ${$uid.$username}{'addgroups'})) {            foreach $memberaddgroups (split(/,/, ${$uid.$username}{'addgroups'})) {
               if ($memberaddgroups eq $_) { $iammod = 1; last; }                if ($memberaddgroups eq $_) { $iammod = 1; last; }
           }            }
       }        }
   }    }
   
   if ($threadid && (!$Quick_Post || $is_preview) && $postthread == 2 && $username ne "Guest") {    if ($threadid && (!$Quick_Post || $is_preview) && $postthread == 2 && $username ne "Guest") {
       my ($reptime, $repuser, $isreplying, @tmprepliers, $isrep, $template_viewers, $topviewers);        my ($reptime, $repuser, $isreplying, @tmprepliers, $isrep, $template_viewers, $topviewers);
       chomp(@repliers);        chomp(@repliers);
       for (my $i = 0; $i < @repliers; $i++) {        for (my $i = 0; $i < @repliers; $i++) {
           ($reptime, $repuser, $isreplying) = split(/\|/, $repliers[$i]);            ($reptime, $repuser, $isreplying) = split(/\|/, $repliers[$i]);
           next if ($date - $reptime) > 600;            next if ($date - $reptime) > 600;
           if ($repuser eq $username) { push(@tmprepliers, qq~$date|$repuser|1~); $isrep = 1; $isreplying = 1;}            if ($repuser eq $username) { push(@tmprepliers, qq~$date|$repuser|1~); $isrep = 1; $isreplying = 1;}
           else { push(@tmprepliers, $repliers[$i]); }            else { push(@tmprepliers, $repliers[$i]); }
           if ($isreplying) {            if ($isreplying) {
               &LoadUser($repuser);                &LoadUser($repuser);
               $template_viewers .= qq~$link{$repuser}, ~;                $template_viewers .= qq~$link{$repuser}, ~;
               $topviewers++;                $topviewers++;
           }            }
       }        }
       if (!$isrep) {        if (!$isrep) {
           push(@tmprepliers, qq~$date|$username|1~);            push(@tmprepliers, qq~$date|$username|1~);
           $template_viewers .= qq~$link{$username}, ~;            $template_viewers .= qq~$link{$username}, ~;
           $topviewers++;            $topviewers++;
       }        }
       &MessageTotals("load", $curnum);        &MessageTotals("load", $curnum);
       @repliers = @tmprepliers;        @repliers = @tmprepliers;
       &MessageTotals("update", $curnum);        &MessageTotals("update", $curnum);
   
       if ($showtopicrepliers && $template_viewers && (($iamadmin || $iamgmod || $iammod) && $sessionvalid == 1)) {        if ($showtopicrepliers && $template_viewers && (($iamadmin || $iamgmod || $iammod) && $sessionvalid == 1)) {
           $template_viewers =~ s/\, \Z/\./;            $template_viewers =~ s/\, \Z/\./;
           $yymain .= qq~            $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg" valign="middle" align="left">        <td class="windowbg" valign="middle" align="left">
           $display_txt{'646'} ($topviewers): $template_viewers            $display_txt{'646'} ($topviewers): $template_viewers
       </td>        </td>
   </tr>~;    </tr>~;
       }        }
   }    }
   
   $yymain .= qq~    $yymain .= qq~
</table> </table>
   ~;    ~;
   
   if ($pollthread) {    if ($pollthread) {
       $maxpq          ||= 60;        $maxpq          ||= 60;
       $maxpo          ||= 50;        $maxpo          ||= 50;
       $maxpc          ||= 0;        $maxpc          ||= 0;
       $numpolloptions ||= 8;        $numpolloptions ||= 8;
       $vote_limit     ||= 0;        $vote_limit     ||= 0;
       $pie_radius     ||= 100;        $pie_radius     ||= 100;
   
       if (($iamadmin || $iamgmod) && -e "$datadir/showcase.poll") {        if (($iamadmin || $iamgmod) && -e "$datadir/showcase.poll") {
           fopen (FILE, "$datadir/showcase.poll");            fopen (FILE, "$datadir/showcase.poll");
           $scchecked = ' checked="checked"' if $threadid == <FILE>;            $scchecked = ' checked="checked"' if $threadid == <FILE>;
           fclose (FILE);            fclose (FILE);
       }        }
       if ($guest_vote)   { $gvchecked = ' checked="checked"'; }        if ($guest_vote)   { $gvchecked = ' checked="checked"'; }
       if ($hide_results) { $hrchecked = ' checked="checked"'; }        if ($hide_results) { $hrchecked = ' checked="checked"'; }
       if ($multi_choice) { $mcchecked = ' checked="checked"'; }        if ($multi_choice) { $mcchecked = ' checked="checked"'; }
       if ($pie_legends)  { $legchecked = ' checked="checked"'; }        if ($pie_legends)  { $legchecked = ' checked="checked"'; }
   
       $yymain .= qq~        $yymain .= qq~
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="windowbg" style="table-layout: fixed;"> <table border="0" width="100%" cellpadding="3" cellspacing="0" class="windowbg" style="table-layout: fixed;">
   <tr>    <tr>
       <td width="250" class="catbg"><label for="question"><b>$post_polltxt{'6'}:</b></label></td>        <td width="250" class="catbg"><label for="question"><b>$post_polltxt{'6'}:</b></label></td>
       <td width="240" class="catbg">&nbsp;</td>        <td width="240" class="catbg">&nbsp;</td>
       <td width="60" class="catbg">&nbsp;</td>        <td width="60" class="catbg">&nbsp;</td>
       <td width="60" class="catbg">&nbsp;</td>        <td width="60" class="catbg">&nbsp;</td>
       <td class="catbg">&nbsp;</td>        <td class="catbg">&nbsp;</td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg2" colspan="5" style="font-size: 3px;">&nbsp;</td>        <td class="windowbg2" colspan="5" style="font-size: 3px;">&nbsp;</td>
   </tr>    </tr>
   <tr>    <tr>
   <td align="left" class="windowbg2">&nbsp;</td>    <td align="left" class="windowbg2">&nbsp;</td>
   <td colspan="4" align="left" class="windowbg2">    <td colspan="4" align="left" class="windowbg2">
       <input type="text" size="60" name="question" id="question" value="$poll_question" maxlength="$maxpq" />        <input type="text" size="60" name="question" id="question" value="$poll_question" maxlength="$maxpq" />
       <input type="hidden" name="pollthread" value="$pollthread" />        <input type="hidden" name="pollthread" value="$pollthread" />
   </td>    </td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg2" colspan="5" style="font-size: 3px;">&nbsp;</td>        <td class="windowbg2" colspan="5" style="font-size: 3px;">&nbsp;</td>
   </tr>    </tr>
   <tr>    <tr>
       <td align="left" class="catbg"><b>$post_polltxt{'polloptions'}</b></td>        <td align="left" class="catbg"><b>$post_polltxt{'polloptions'}</b></td>
       <td align="left" class="catbg"><b>$post_polltxt{'polloptionstext'}</b></td>        <td align="left" class="catbg"><b>$post_polltxt{'polloptionstext'}</b></td>
       <td align="center" class="catbg"><b>$post_polltxt{'pieslicecolor'}</b></td>        <td align="center" class="catbg"><b>$post_polltxt{'pieslicecolor'}</b></td>
       <td align="center" class="catbg"><b>$post_polltxt{'pieslicesplit'}</b></td>        <td align="center" class="catbg"><b>$post_polltxt{'pieslicesplit'}</b></td>
       <td class="catbg">&nbsp;</td>        <td class="catbg">&nbsp;</td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg2" colspan="5" style="font-size: 3px;">&nbsp;</td>        <td class="windowbg2" colspan="5" style="font-size: 3px;">&nbsp;</td>
   </tr>~;    </tr>~;
   
       $piecolarray = qq~["",~;        $piecolarray = qq~["",~;
       for (my $i = 1; $i <= $numpolloptions; $i++) {        for (my $i = 1; $i <= $numpolloptions; $i++) {
           if ($split[$i]) { $splitchecked[$i] = ' checked="checked"'; }            if ($split[$i]) { $splitchecked[$i] = ' checked="checked"'; }
           if($FORM{"slicecol$i"}) { $slicecolor[$i] = $FORM{"slicecol$i"}; }            if($FORM{"slicecol$i"}) { $slicecolor[$i] = $FORM{"slicecol$i"}; }
           $yymain .= qq~            $yymain .= qq~
   <tr>    <tr>
       <td align="right" class="windowbg2"><label for="option$i"> &nbsp; $post_polltxt{'7'} $i: &nbsp;</label></td>        <td align="right" class="windowbg2"><label for="option$i"> &nbsp; $post_polltxt{'7'} $i: &nbsp;</label></td>
       <td align="left" class="windowbg2">        <td align="left" class="windowbg2">
           <input type="text" size="35" maxlength="$maxpo" name="option$i" id="option$i" value="$options[$i]" />            <input type="text" size="35" maxlength="$maxpo" name="option$i" id="option$i" value="$options[$i]" />
       </td>        </td>
       <td align="center" class="windowbg2">        <td align="center" class="windowbg2">
           <input type="text" size="3" name="slicecolor$i" id="slicecolor$i" value="" style="background-color: $slicecolor[$i]; border: 1px outset $slicecolor[$i]; cursor: pointer;" readonly="readonly" onclick="getSlicecolor($i)" />            <input type="text" size="3" name="slicecolor$i" id="slicecolor$i" value="" style="background-color: $slicecolor[$i]; border: 1px outset $slicecolor[$i]; cursor: pointer;" readonly="readonly" onclick="getSlicecolor($i)" />
           <input type="hidden" name="slicecol$i" id="slicecol$i" value="$slicecolor[$i]" />            <input type="hidden" name="slicecol$i" id="slicecol$i" value="$slicecolor[$i]" />
       </td>        </td>
       <td align="center" class="windowbg2">        <td align="center" class="windowbg2">
           <input type="checkbox" name="split$i" value="1"$splitchecked[$i] /> <span  class="small">$post_polltxt{'splitslice'}</span>            <input type="checkbox" name="split$i" value="1"$splitchecked[$i] /> <span  class="small">$post_polltxt{'splitslice'}</span>
       </td>        </td>
       <td align="left" class="windowbg2">        <td align="left" class="windowbg2">
           &nbsp;            &nbsp;
       </td>        </td>
   </tr>~;    </tr>~;
           $piecolarray .= qq~"$slicecolor[$i]", ~;            $piecolarray .= qq~"$slicecolor[$i]", ~;
       }        }
       $piecolarray =~ s/\, $//i;        $piecolarray =~ s/\, $//i;
       $piecolarray .= qq~]~;        $piecolarray .= qq~]~;
   
       if ($maxpc > 0) {        if ($maxpc > 0) {
           $yymain .= qq~            $yymain .= qq~
   <tr>    <tr>
       <td valign=top class="windowbg2"><b>$post_polltxt{'59'}:</b></td>        <td valign=top class="windowbg2"><b>$post_polltxt{'59'}:</b></td>
       <td class="windowbg2" colspan="4"><textarea name="poll_comment" rows="3" cols="60" wrap="soft" onkeyup="if (document.postmodify.poll_comment.value.length > $maxpc) {document.postmodify.poll_comment.value = document.postmodify.poll_comment.value.substring(0,$maxpc)}">$poll_comment</textarea></td>        <td class="windowbg2" colspan="4"><textarea name="poll_comment" rows="3" cols="60" wrap="soft" onkeyup="if (document.postmodify.poll_comment.value.length > $maxpc) {document.postmodify.poll_comment.value = document.postmodify.poll_comment.value.substring(0,$maxpc)}">$poll_comment</textarea></td>
   </tr>~;    </tr>~;
       }        }
   
       if ($poll_end) {        if ($poll_end) {
           my $x = $poll_end - $date;            my $x = $poll_end - $date;
           if ($x <= 0) {            if ($x <= 0) {
               $poll_end_min = 1;                $poll_end_min = 1;
           } else {            } else {
               $poll_end_days = int($x / 86400);                $poll_end_days = int($x / 86400);
               $poll_end_min = int(($x - ($poll_end_days * 86400)) / 60);                $poll_end_min = int(($x - ($poll_end_days * 86400)) / 60);
           }            }
       }        }
   
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td class="windowbg2" colspan="5" style="font-size: 3px;">        <td class="windowbg2" colspan="5" style="font-size: 3px;">
           <script language="JavaScript1.2" type="text/javascript">            <script language="JavaScript1.2" type="text/javascript">
           <!--            <!--
           var tmpslicecolor;            var tmpslicecolor;
           var itohex = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];            var itohex = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];
           var slice_col = $piecolarray;            var slice_col = $piecolarray;
           var defslice_col = new Array();            var defslice_col = new Array();
           function tohex(i) {            function tohex(i) {
               a2 = ''                 a2 = '' 
               ihex = Math.floor(eval(i +'/16'));                ihex = Math.floor(eval(i +'/16'));
               idiff = eval(i + '-(' + ihex + '*16)')                idiff = eval(i + '-(' + ihex + '*16)')
               a2 = itohex[idiff] + a2;                a2 = itohex[idiff] + a2;
               while( ihex >= 16) {                while( ihex >= 16) {
                   itmp = Math.floor(eval(ihex +'/16'));                    itmp = Math.floor(eval(ihex +'/16'));
                   idiff = eval(ihex + '-(' + itmp + '*16)');                    idiff = eval(ihex + '-(' + itmp + '*16)');
                   a2 = itohex[idiff] + a2;                    a2 = itohex[idiff] + a2;
                   ihex = itmp;                    ihex = itmp;
               }                  }  
               a1 = itohex[ihex];                a1 = itohex[ihex];
               return a1 + a2;                return a1 + a2;
           }            }
   
           for (var tz = 0; tz < 256; tz += 63)            for (var tz = 0; tz < 256; tz += 63)
               for (var ty = 0; ty < 256; ty += 85)                for (var ty = 0; ty < 256; ty += 85)
                   for (var tx = 0; tx < 256; tx += 127) defslice_col.push('#' + tohex(tx) + tohex(ty) + tohex(tz));                    for (var tx = 0; tx < 256; tx += 127) defslice_col.push('#' + tohex(tx) + tohex(ty) + tohex(tz));
   
           for(var i = 1; i <= $numpolloptions; i++) {            for(var i = 1; i <= $numpolloptions; i++) {
               if(!slice_col[i]) slice_col[i] = defslice_col[i]                if(!slice_col[i]) slice_col[i] = defslice_col[i]
               document.getElementById('slicecolor' + i).style.backgroundColor = slice_col[i];                document.getElementById('slicecolor' + i).style.backgroundColor = slice_col[i];
               document.getElementById('slicecolor' + i).style.borderColor = slice_col[i];                document.getElementById('slicecolor' + i).style.borderColor = slice_col[i];
               document.getElementById('slicecol' + i).value = slice_col[i];                document.getElementById('slicecol' + i).value = slice_col[i];
           }            }
   
           function getSlicecolor(slicenum) {            function getSlicecolor(slicenum) {
               tmpslicecolor = slicenum;                tmpslicecolor = slicenum;
               window.open('$scripturl?action=palette;task=templ', '', 'height=308,width=302,menubar=no,toolbar=no,scrollbars=no');                window.open('$scripturl?action=palette;task=templ', '', 'height=308,width=302,menubar=no,toolbar=no,scrollbars=no');
           }            }
   
           function previewColor(newsilcecolor) {            function previewColor(newsilcecolor) {
               document.getElementById('slicecolor' + tmpslicecolor).style.backgroundColor = newsilcecolor;                document.getElementById('slicecolor' + tmpslicecolor).style.backgroundColor = newsilcecolor;
               document.getElementById('slicecolor' + tmpslicecolor).style.borderColor = newsilcecolor;                document.getElementById('slicecolor' + tmpslicecolor).style.borderColor = newsilcecolor;
               document.getElementById('slicecol' + tmpslicecolor).value = newsilcecolor;                document.getElementById('slicecol' + tmpslicecolor).value = newsilcecolor;
           }            }
           //-->            //-->
           </script>            </script>
       </td>        </td>
   </tr>~ . ($poll_locked ? '' : qq~    </tr>~ . ($poll_locked ? '' : qq~
   <tr>    <tr>
       <td align="left" valign="top"><label for="poll_end_days"><b>$post_polltxt{'31'}</b></label></td>        <td align="left" valign="top"><label for="poll_end_days"><b>$post_polltxt{'31'}</b></label></td>
       <td align="left" valign="top" colspan="4"><span  class="small"><input type="text" name="poll_end_days" id="poll_end_days" value="$poll_end_days" size="4" /> $post_polltxt{'31a'} <input type="text" name="poll_end_min" value="$poll_end_min" size="4" /> $post_polltxt{'31b'} $post_polltxt{'31c'}</span></td>        <td align="left" valign="top" colspan="4"><span  class="small"><input type="text" name="poll_end_days" id="poll_end_days" value="$poll_end_days" size="4" /> $post_polltxt{'31a'} <input type="text" name="poll_end_min" value="$poll_end_min" size="4" /> $post_polltxt{'31b'} $post_polltxt{'31c'}</span></td>
   </tr>~) . (($iamadmin || $iamgmod) ? qq~    </tr>~) . (($iamadmin || $iamgmod) ? qq~
   <tr>    <tr>
       <td align="left" valign="top"><label for="scpoll"><b>$post_polltxt{'30'}</b></label></td>        <td align="left" valign="top"><label for="scpoll"><b>$post_polltxt{'30'}</b></label></td>
       <td align="left" valign="top" colspan="4"><input type="checkbox" name="scpoll" id="scpoll" value="1"$scchecked /> <span  class="small"><label for="scpoll">$post_polltxt{'30a'}</label></span></td>        <td align="left" valign="top" colspan="4"><input type="checkbox" name="scpoll" id="scpoll" value="1"$scchecked /> <span  class="small"><label for="scpoll">$post_polltxt{'30a'}</label></span></td>
   </tr>~ : '') . qq~    </tr>~ : '') . qq~
   <tr>    <tr>
       <td align="left" valign="top"><label for="guest_vote"><b>$post_polltxt{'32'}</b></label></td>        <td align="left" valign="top"><label for="guest_vote"><b>$post_polltxt{'32'}</b></label></td>
       <td align="left" valign="top" colspan="4"><input type="checkbox" name="guest_vote" id="guest_vote" value="1"$gvchecked /> <span  class="small"><label for="guest_vote">$post_polltxt{'54'}</label></span></td>        <td align="left" valign="top" colspan="4"><input type="checkbox" name="guest_vote" id="guest_vote" value="1"$gvchecked /> <span  class="small"><label for="guest_vote">$post_polltxt{'54'}</label></span></td>
   </tr>    </tr>
   <tr>    <tr>
       <td align="left" valign="top"><label for="hide_results"><b>$post_polltxt{'26'}</b></label></td>        <td align="left" valign="top"><label for="hide_results"><b>$post_polltxt{'26'}</b></label></td>
       <td align="left" valign="top" colspan="4"><input type="checkbox" name="hide_results" id="hide_results" value="1"$hrchecked /> <span  class="small"><label for="hide_results">$post_polltxt{'55'}</label></span></td>        <td align="left" valign="top" colspan="4"><input type="checkbox" name="hide_results" id="hide_results" value="1"$hrchecked /> <span  class="small"><label for="hide_results">$post_polltxt{'55'}</label></span></td>
   </tr>    </tr>
   <tr>    <tr>
       <td align="left" valign="top"><label for="multi_choice"><b>$post_polltxt{'58'}</b></label></td>        <td align="left" valign="top"><label for="multi_choice"><b>$post_polltxt{'58'}</b></label></td>
       <td align="left" valign="top" colspan="4"><input type="checkbox" name="multi_choice" id="multi_choice" value="1"$mcchecked /> <span  class="small"><label for="multi_choice">$post_polltxt{'56'}</label></span></td>        <td align="left" valign="top" colspan="4"><input type="checkbox" name="multi_choice" id="multi_choice" value="1"$mcchecked /> <span  class="small"><label for="multi_choice">$post_polltxt{'56'}</label></span></td>
   </tr>    </tr>
   <tr>    <tr>
       <td align="left" valign="top"><label for="vote_limit"><b>$post_polltxt{'60'}</b></label></td>        <td align="left" valign="top"><label for="vote_limit"><b>$post_polltxt{'60'}</b></label></td>
       <td align="left" valign="top" colspan="4"><input type="text" size="6" name="vote_limit" id="vote_limit" value="$vote_limit" /> <span  class="small"><label for="vote_limit">$post_polltxt{'61'}</label></span></td>        <td align="left" valign="top" colspan="4"><input type="text" size="6" name="vote_limit" id="vote_limit" value="$vote_limit" /> <span  class="small"><label for="vote_limit">$post_polltxt{'61'}</label></span></td>
   </tr>    </tr>
   <tr>    <tr>
       <td align="left" valign="top"><label for="pie_legends"><b>$post_polltxt{'pielegends'}</b></label></td>        <td align="left" valign="top"><label for="pie_legends"><b>$post_polltxt{'pielegends'}</b></label></td>
       <td align="left" valign="top" colspan="4"><input type="checkbox" name="pie_legends" id="pie_legends" value="1"$legchecked /> <span  class="small"><label for="pie_legends">$post_polltxt{'pielegends_descr'}</label></span></td>        <td align="left" valign="top" colspan="4"><input type="checkbox" name="pie_legends" id="pie_legends" value="1"$legchecked /> <span  class="small"><label for="pie_legends">$post_polltxt{'pielegends_descr'}</label></span></td>
   </tr>    </tr>
   <tr>    <tr>
       <td align="left" valign="top"><label for="pie_radius"><b>$post_polltxt{'pieradius'}</b></label></td>        <td align="left" valign="top"><label for="pie_radius"><b>$post_polltxt{'pieradius'}</b></label></td>
       <td align="left" valign="top" colspan="4"><input type="text" size="4" name="pie_radius" id="pie_radius" value="$pie_radius" /> <span  class="small"><label for="pie_radius">$post_polltxt{'pieradius_descr'}</label></span></td>        <td align="left" valign="top" colspan="4"><input type="text" size="4" name="pie_radius" id="pie_radius" value="$pie_radius" /> <span  class="small"><label for="pie_radius">$post_polltxt{'pieradius_descr'}</label></span></td>
   </tr>    </tr>
</table>~; </table>~;
   }    }
   
   
   $yymain .= qq~    $yymain .= qq~
<table border="0" width="100%" cellpadding="3" cellspacing="0" class="windowbg" style="table-layout: fixed;">~; <table border="0" width="100%" cellpadding="3" cellspacing="0" class="windowbg" style="table-layout: fixed;">~;
   
   if ($postid ne 'Poll') {    if ($postid ne 'Poll') {
       $yymain .= qq~        $yymain .= qq~
       <tr>        <tr>
           <td width="23%" align="left" valign="top" class="windowbg"><b>$post_txt{'507'}</b></td>            <td width="23%" align="left" valign="top" class="windowbg"><b>$post_txt{'507'}</b></td>
           <td width="77%" class="windowbg">$prevmain</td>            <td width="77%" class="windowbg">$prevmain</td>
       </tr>        </tr>
       ~ if $prevmain;        ~ if $prevmain;
   
       $yymain .= qq~        $yymain .= qq~
   <tr>    <tr>
       <td width="23%" class="windowbg" valign="top">        <td width="23%" class="windowbg" valign="top">
           <div id="SaveInfo" style="height:16px;">            <div id="SaveInfo" style="height:16px;">
           <img name="prevwin" id="prevwin" src="$defaultimagesdir/cat_expand.gif" alt="$npf_txt{'01'}" title="$npf_txt{'01'}" border="0" style="cursor:pointer; cursor:hand;" onclick="enabPrev();" /> <b>$npf_txt{'04'}</b>            <img name="prevwin" id="prevwin" src="$defaultimagesdir/cat_expand.gif" alt="$npf_txt{'01'}" title="$npf_txt{'01'}" border="0" style="cursor:pointer; cursor:hand;" onclick="enabPrev();" /> <b>$npf_txt{'04'}</b>
           </div>            </div>
       </td>        </td>
       <td width="77%" class="windowbg">        <td width="77%" class="windowbg">
           <div id="savetable" class="bordercolor" style="padding:1px; width:100%; margin:auto; visibility:hidden;">            <div id="savetable" class="bordercolor" style="padding:1px; width:100%; margin:auto; visibility:hidden;">
           <table border="0" width="100%" cellpadding="3" cellspacing="0" style="table-layout:fixed;">            <table border="0" width="100%" cellpadding="3" cellspacing="0" style="table-layout:fixed;">
             <tr>              <tr>
               <td class="titlebg">                <td class="titlebg">
                <div id="savetopic" style="height:0px; text-align:left; vertical-align:middle; font-weight:bold; overflow:auto;">&nbsp;</div>                 <div id="savetopic" style="height:0px; text-align:left; vertical-align:middle; font-weight:bold; overflow:auto;">&nbsp;</div>
               </td>                </td>
             </tr>              </tr>
             <tr>              <tr>
               <td class="windowbg2">                <td class="windowbg2">
                <div id="saveframe" class="message" style="height:0px; text-align:left; vertical-align:top; overflow:auto;">&nbsp;</div>                 <div id="saveframe" class="message" style="height:0px; text-align:left; vertical-align:top; overflow:auto;">&nbsp;</div>
               </td>                </td>
             </tr>              </tr>
           </table>            </table>
           </div>            </div>
       </td>        </td>
   </tr>~;    </tr>~;
   
       $topicstatus_row = "";        $topicstatus_row = "";
       $stselect        = "";        $stselect        = "";
       $lcselect        = "";        $lcselect        = "";
       $hdselect        = "";        $hdselect        = "";
       $threadclass     = 'thread';        $threadclass     = 'thread';
   
       ($mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/, $yyThreadLine);        ($mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/, $yyThreadLine);
       if ($FORM{'topicstatus'}) { $thestatus = $FORM{'topicstatus'}; }        if ($FORM{'topicstatus'}) { $thestatus = $FORM{'topicstatus'}; }
       else { $thestatus = $mstate; }        else { $thestatus = $mstate; }
       if ($currentboard eq $annboard) {        if ($currentboard eq $annboard) {
           $threadclass     = 'announcement';            $threadclass     = 'announcement';
       } else {        } else {
           if ($mreplies >= $VeryHotTopic) { $threadclass = 'veryhotthread'; }            if ($mreplies >= $VeryHotTopic) { $threadclass = 'veryhotthread'; }
           elsif ($mreplies >= $HotTopic) { $threadclass = 'hotthread'; }            elsif ($mreplies >= $HotTopic) { $threadclass = 'hotthread'; }
       }        }
       if($action ne "modalert") {        if($action ne "modalert") {
           if ($thestatus =~ /s/) { $stselect = qq~selected="selected"~; }            if ($thestatus =~ /s/) { $stselect = qq~selected="selected"~; }
           if ($thestatus =~ /l/) { $lcselect = qq~selected="selected"~; }            if ($thestatus =~ /l/) { $lcselect = qq~selected="selected"~; }
           if ($thestatus =~ /h/) { $hdselect = qq~selected="selected"~; }            if ($thestatus =~ /h/) { $hdselect = qq~selected="selected"~; }
           $hidestatus = "";            $hidestatus = "";
   
           if (($iamadmin || $iamgmod || $iammod) && $sessionvalid == 1) {            if (($iamadmin || $iamgmod || $iammod) && $sessionvalid == 1) {
               $yymain .= qq~                $yymain .= qq~
   <tr id="feature_status_4">    <tr id="feature_status_4">
       <td class="windowbg" align="left" valign="top" width="23%"><label for="topicstatus"><b>$post_txt{'34'}:</b></label></td>        <td class="windowbg" align="left" valign="top" width="23%"><label for="topicstatus"><b>$post_txt{'34'}:</b></label></td>
       <td class="windowbg" align="left" valign="middle" width="77%">        <td class="windowbg" align="left" valign="middle" width="77%">
           <select multiple="multiple" name="topicstatus" id="topicstatus" size="~ . ($currentboard ne $annboard ? 3 : 2) . qq~" style="vertical-align: middle;" onchange="showtpstatus()">            <select multiple="multiple" name="topicstatus" id="topicstatus" size="~ . ($currentboard ne $annboard ? 3 : 2) . qq~" style="vertical-align: middle;" onchange="showtpstatus()">
           ~ . ($currentboard ne $annboard ? qq~<option value="s" $stselect>$post_txt{'35'}</option>~ : "") . qq~            ~ . ($currentboard ne $annboard ? qq~<option value="s" $stselect>$post_txt{'35'}</option>~ : "") . qq~
           <option value="l" $lcselect>$post_txt{'36'}</option>            <option value="l" $lcselect>$post_txt{'36'}</option>
           <option value="h" $hdselect>$post_txt{'37'}</option>            <option value="h" $hdselect>$post_txt{'37'}</option>
           </select>            </select>
           <img src="$imagesdir/$threadclass.gif" name="thrstat" border="0" hspace="15" alt="" style="vertical-align: middle;" />            <img src="$imagesdir/$threadclass.gif" name="thrstat" border="0" hspace="15" alt="" style="vertical-align: middle;" />
       </td>        </td>
   </tr>~;    </tr>~;
   
           } else {            } else {
               $hidestatus = qq~<input type="hidden" value="$thestatus" name="topicstatus" />~;                $hidestatus = qq~<input type="hidden" value="$thestatus" name="topicstatus" />~;
           }            }
       }        }
       $yymain .= qq~        $yymain .= qq~
   $extra    $extra
   $name_field    $name_field
   $email_field    $email_field
   $verification_field    $verification_field
   <tr>    <tr>
       <td align="left" class="windowbg2" width="23%">        <td align="left" class="windowbg2" width="23%">
           <label for="subject"><b>$post_txt{'70'}:</b></label>            <label for="subject"><b>$post_txt{'70'}:</b></label>
       </td>        </td>
       <td align="left" class="windowbg2" width="77%">        <td align="left" class="windowbg2" width="77%">
           <input type="text" name="subject" id="subject" value="$sub" size="50" maxlength="~ . ($set_subjectMaxLength + ($sub =~ /^Re: / ? 4 : 0)) . qq~" tabindex="1" style="width: 437px;" onkeyup="updatTopic()" />            <input type="text" name="subject" id="subject" value="$sub" size="50" maxlength="~ . ($set_subjectMaxLength + ($sub =~ /^Re: / ? 4 : 0)) . qq~" tabindex="1" style="width: 437px;" onkeyup="updatTopic()" />
       </td>        </td>
   </tr>    </tr>
   <tr>    <tr>
       <td class="windowbg2" width="23%" align="left" valign="top">        <td class="windowbg2" width="23%" align="left" valign="top">
           <label for="message"><b>$post_txt{'72'}:</b></label><br /><span class="small">$post_txt{'resizedescript'}</span>            <label for="message"><b>$post_txt{'72'}:</b></label><br /><span class="small">$post_txt{'resizedescript'}</span>
       </td>        </td>
       <td rowspan="~ . ((!$removenormalsmilies || ($showadded == 3 && $showsmdir != 2) || ($showsmdir == 3 && $showadded != 2)) ? 2 : 3) . qq~" valign="middle" class="windowbg2" width="77%">        <td rowspan="~ . ((!$removenormalsmilies || ($showadded == 3 && $showsmdir != 2) || ($showsmdir == 3 && $showadded != 2)) ? 2 : 3) . qq~" valign="middle" class="windowbg2" width="77%">
       ~;        ~;
       if ($enable_ubbc && $showyabbcbutt) {        if ($enable_ubbc && $showyabbcbutt) {
           $yymain .= qq~            $yymain .= qq~
           <div style="float: left; width: 440px;">            <div style="float: left; width: 440px;">
           <script language="JavaScript1.2" type="text/javascript">            <script language="JavaScript1.2" type="text/javascript">
           <!--            <!--
           HAND = "style='cursor: pointer;'";            HAND = "style='cursor: pointer;'";
           HAND += " onmouseover='contextTip(event, this.alt)' onmouseout='contextTip(event, this.alt)' oncontextmenu='if(!showcontexthelp(this.src, this.alt)) return false;'";            HAND += " onmouseover='contextTip(event, this.alt)' onmouseout='contextTip(event, this.alt)' oncontextmenu='if(!showcontexthelp(this.src, this.alt)) return false;'";
           document.write('<div style="width: 437px; float: left;">');            document.write('<div style="width: 437px; float: left;">');
           document.write("<img src='$imagesdir/url.gif' onclick='hyperlink();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'257'}' title='$post_txt{'257'}' border='0' />");            document.write("<img src='$imagesdir/url.gif' onclick='hyperlink();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'257'}' title='$post_txt{'257'}' border='0' />");
           document.write("<img src='$imagesdir/ftp.gif' onclick='ftp();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'434'}' title='$post_txt{'434'}' border='0' />");            document.write("<img src='$imagesdir/ftp.gif' onclick='ftp();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'434'}' title='$post_txt{'434'}' border='0' />");
           document.write("<img src='$imagesdir/img.gif' onclick='image();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'435'}' title='$post_txt{'435'}' border='0' />");            document.write("<img src='$imagesdir/img.gif' onclick='image();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'435'}' title='$post_txt{'435'}' border='0' />");
           document.write("<img src='$imagesdir/email2.gif' onclick='emai1();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'258'}' title='$post_txt{'258'}' border='0' />");            document.write("<img src='$imagesdir/email2.gif' onclick='emai1();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'258'}' title='$post_txt{'258'}' border='0' />");
           document.write("<img src='$imagesdir/media.gif' onclick='flash();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'433'}' title='$post_txt{'433'}' border='0' />");            document.write("<img src='$imagesdir/media.gif' onclick='flash();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'433'}' title='$post_txt{'433'}' border='0' />");
           document.write("<img src='$imagesdir/table.gif' onclick='table();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'436'}' title='$post_txt{'436'}' border='0' />");            document.write("<img src='$imagesdir/table.gif' onclick='table();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'436'}' title='$post_txt{'436'}' border='0' />");
           document.write("<img src='$imagesdir/tr.gif' onclick='trow();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'449'}' title='$post_txt{'449'}' border='0' />");            document.write("<img src='$imagesdir/tr.gif' onclick='trow();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'449'}' title='$post_txt{'449'}' border='0' />");
           document.write("<img src='$imagesdir/td.gif' onclick='tcol();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'437'}' title='$post_txt{'437'}' border='0' />");            document.write("<img src='$imagesdir/td.gif' onclick='tcol();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'437'}' title='$post_txt{'437'}' border='0' />");
           document.write("<img src='$imagesdir/hr.gif' onclick='hr();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'531'}' title='$post_txt{'531'}' border='0' />");            document.write("<img src='$imagesdir/hr.gif' onclick='hr();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'531'}' title='$post_txt{'531'}' border='0' />");
           document.write("<img src='$imagesdir/tele.gif' onclick='teletype();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'440'}' title='$post_txt{'440'}' border='0' />");            document.write("<img src='$imagesdir/tele.gif' onclick='teletype();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'440'}' title='$post_txt{'440'}' border='0' />");
           document.write("<img src='$imagesdir/code.gif' onclick='selcodelang();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'259'}' title='$post_txt{'259'}' border='0' />");            document.write("<img src='$imagesdir/code.gif' onclick='selcodelang();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'259'}' title='$post_txt{'259'}' border='0' />");
           document.write("<img src='$imagesdir/quote2.gif' onclick='quote();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'260'}' title='$post_txt{'260'}' border='0' />");            document.write("<img src='$imagesdir/quote2.gif' onclick='quote();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'260'}' title='$post_txt{'260'}' border='0' />");
           document.write("<img src='$imagesdir/edit.gif' onclick='edit();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'603'}' title='$post_txt{'603'}' border='0' />");            document.write("<img src='$imagesdir/edit.gif' onclick='edit();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'603'}' title='$post_txt{'603'}' border='0' />");
           document.write("<img src='$imagesdir/sup.gif' onclick='superscript();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'447'}' title='$post_txt{'447'}' border='0' />");            document.write("<img src='$imagesdir/sup.gif' onclick='superscript();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'447'}' title='$post_txt{'447'}' border='0' />");
           document.write("<img src='$imagesdir/sub.gif' onclick='subscript();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'448'}' title='$post_txt{'448'}' border='0' />");            document.write("<img src='$imagesdir/sub.gif' onclick='subscript();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'448'}' title='$post_txt{'448'}' border='0' />");
           document.write("<img src='$imagesdir/list.gif' onclick='bulletset();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'261'}' title='$post_txt{'261'}' border='0' />");            document.write("<img src='$imagesdir/list.gif' onclick='bulletset();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'261'}' title='$post_txt{'261'}' border='0' />");
           document.write("<img src='$imagesdir/me.gif' onclick='me();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'604'}' title='$post_txt{'604'}' border='0' />");            document.write("<img src='$imagesdir/me.gif' onclick='me();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'604'}' title='$post_txt{'604'}' border='0' />");
           document.write("<img src='$imagesdir/move.gif' onclick='move();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'439'}' title='$post_txt{'439'}' border='0' />");            document.write("<img src='$imagesdir/move.gif' onclick='move();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'439'}' title='$post_txt{'439'}' border='0' />");
           document.write("<img src='$imagesdir/timestamp.gif' onclick='timestamp($date);' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'245'}' title='$post_txt{'245'}' border='0' /><br />");            document.write("<img src='$imagesdir/timestamp.gif' onclick='timestamp($date);' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'245'}' title='$post_txt{'245'}' border='0' /><br />");
           document.write('</div>');            document.write('</div>');
           document.write('<div style="width: 115px; float: left;">');            document.write('<div style="width: 115px; float: left;">');
           document.write("<img src='$imagesdir/bold.gif' onclick='bold();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'253'}' title='$post_txt{'253'}' border='0' />");            document.write("<img src='$imagesdir/bold.gif' onclick='bold();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'253'}' title='$post_txt{'253'}' border='0' />");
           document.write("<img src='$imagesdir/italicize.gif' onclick='italicize();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'254'}' title='$post_txt{'254'}' border='0' />");            document.write("<img src='$imagesdir/italicize.gif' onclick='italicize();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'254'}' title='$post_txt{'254'}' border='0' />");
           document.write("<img src='$imagesdir/underline.gif' onclick='underline();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'255'}' title='$post_txt{'255'}' border='0' />");            document.write("<img src='$imagesdir/underline.gif' onclick='underline();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'255'}' title='$post_txt{'255'}' border='0' />");
           document.write("<img src='$imagesdir/strike.gif' onclick='strike();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'441'}' title='$post_txt{'441'}' border='0' />");            document.write("<img src='$imagesdir/strike.gif' onclick='strike();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'441'}' title='$post_txt{'441'}' border='0' />");
           document.write("<img src='$imagesdir/highlight.gif' onclick='highlight();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'246'}' title='$post_txt{'246'}' border='0' />");            document.write("<img src='$imagesdir/highlight.gif' onclick='highlight();' "+HAND+" align='top' width='23' height='22' alt='$post_txt{'246'}' title='$post_txt{'246'}' border='0' />");
           document.write('</div>');            document.write('</div>');
           document.write('<div style="width: 139px; float: left; text-align: center;">');            document.write('<div style="width: 139px; float: left; text-align: center;">');
           document.write('<select name="fontface" id="fontface" onchange="if(this.options[this.selectedIndex].value) fontfce(this.options[this.selectedIndex].value);" style="width: 90px; margin-top: 2px; margin-left: 2px; margin-right: 1px; font-size: 9px;">');            document.write('<select name="fontface" id="fontface" onchange="if(this.options[this.selectedIndex].value) fontfce(this.options[this.selectedIndex].value);" style="width: 90px; margin-top: 2px; margin-left: 2px; margin-right: 1px; font-size: 9px;">');
           document.write('<option value="">Verdana</option>');            document.write('<option value="">Verdana</option>');
           document.write('<option value="">-\\-\\-\\-\\-\\-\\-\\-\\-</option>');            document.write('<option value="">-\\-\\-\\-\\-\\-\\-\\-\\-</option>');
           document.write('<option value="Arial" style="font-family: Arial">Arial</option>');            document.write('<option value="Arial" style="font-family: Arial">Arial</option>');
           document.write('<option value="Bitstream Vera Sans Mono" style="font-family: Bitstream Vera Sans Mono">Bitstream</option>');            document.write('<option value="Bitstream Vera Sans Mono" style="font-family: Bitstream Vera Sans Mono">Bitstream</option>');
           document.write('<option value="Bradley Hand ITC" style="font-family: Bradley Hand ITC">Bradley Hand ITC</option>');            document.write('<option value="Bradley Hand ITC" style="font-family: Bradley Hand ITC">Bradley Hand ITC</option>');
           document.write('<option value="Comic Sans MS" style="font-family: Comic Sans MS">Comic Sans MS</option>');            document.write('<option value="Comic Sans MS" style="font-family: Comic Sans MS">Comic Sans MS</option>');
           document.write('<option value="Courier" style="font-family: Courier">Courier</option>');            document.write('<option value="Courier" style="font-family: Courier">Courier</option>');
           document.write('<option value="Courier New" style="font-family: Courier New">Courier New</option>');            document.write('<option value="Courier New" style="font-family: Courier New">Courier New</option>');
           document.write('<option value="Georgia" style="font-family: Georgia">Georgia</option>');            document.write('<option value="Georgia" style="font-family: Georgia">Georgia</option>');
           document.write('<option value="Impact" style="font-family: Impact">Impact</option>');            document.write('<option value="Impact" style="font-family: Impact">Impact</option>');
           document.write('<option value="Lucida Sans" style="font-family: Lucida Sans">Lucida Sans</option>');            document.write('<option value="Lucida Sans" style="font-family: Lucida Sans">Lucida Sans</option>');
           document.write('<option value="Microsoft Sans Serif" style="font-family: Microsoft Sans Serif">MS Sans Serif</option>');            document.write('<option value="Microsoft Sans Serif" style="font-family: Microsoft Sans Serif">MS Sans Serif</option>');
           document.write('<option value="Papyrus" style="font-family: Papyrus">Papyrus</option>');            document.write('<option value="Papyrus" style="font-family: Papyrus">Papyrus</option>');
           document.write('<option value="Tahoma" style="font-family: Tahoma">Tahoma</option>');            document.write('<option value="Tahoma" style="font-family: Tahoma">Tahoma</option>');
           document.write('<option value="Tempus Sans ITC" style="font-family: Tempus Sans ITC">Tempus Sans ITC</option>');            document.write('<option value="Tempus Sans ITC" style="font-family: Tempus Sans ITC">Tempus Sans ITC</option>');
           document.write('<option value="Times New Roman" style="font-family: Times New Roman">Times New Roman</option>');            document.write('<option value="Times New Roman" style="font-family: Times New Roman">Times New Roman</option>');
           document.write('<option value="Verdana" style="font-family: Verdana">Verdana</option>');            document.write('<option value="Verdana" style="font-family: Verdana">Verdana</option>');
           document.write('</select>');            document.write('</select>');
           var fntoptions = ["6", "7", "8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "36", "48", "56", "72"]            var fntoptions = ["6", "7", "8", "9", "10", "11", "12", "14", "16", "18", "20", "22", "24", "36", "48", "56", "72"]
           document.write('<select name="fontsize" id="fontsize" onchange="if(this.options[this.selectedIndex].value) fntsize(this.options[this.selectedIndex].value);" style="width: 39px; margin-top: 2px; margin-left: 1px; margin-right: 2px; font-size: 9px;">');            document.write('<select name="fontsize" id="fontsize" onchange="if(this.options[this.selectedIndex].value) fntsize(this.options[this.selectedIndex].value);" style="width: 39px; margin-top: 2px; margin-left: 1px; margin-right: 2px; font-size: 9px;">');
           document.write('<option value="">11</option>');            document.write('<option value="">11</option>');
           document.write('<option value="">-\\-</option>');            document.write('<option value="">-\\-</option>');
           for(var i = 0; i < fntoptions.length; i++) {            for(var i = 0; i < fntoptions.length; i++) {
               if(fntoptions[i] >= $fontsizemin && fntoptions[i] <= $fontsizemax) {                if(fntoptions[i] >= $fontsizemin && fntoptions[i] <= $fontsizemax) {
                   if(fntoptions[i] == 11) document.write('<option value="11" selected="selected">11</option>');                    if(fntoptions[i] == 11) document.write('<option value="11" selected="selected">11</option>');
                   else document.write('<option value=' + fntoptions[i] + '>' + fntoptions[i] + '</option>');                    else document.write('<option value=' + fntoptions[i] + '>' + fntoptions[i] + '</option>');
               }                }
           }            }
           document.write('</select>');            document.write('</select>');
           document.write('</div>');            document.write('</div>');
   
   
           function selcodelang() {            function selcodelang() {
               if (document.getElementById("codelang").style.display == "none")                if (document.getElementById("codelang").style.display == "none")
               document.getElementById("codelang").style.display = "inline-block";                document.getElementById("codelang").style.display = "inline-block";
               else                else
               document.getElementById("codelang").style.display = "none";                document.getElementById("codelang").style.display = "none";
               document.getElementById("codelang").style.zIndex = "100";                document.getElementById("codelang").style.zIndex = "100";
   
               var openbox = document.getElementsByTagName("div");                var openbox = document.getElementsByTagName("div");
               for (var i = 0; i < openbox.length; i++) {                for (var i = 0; i < openbox.length; i++) {
                   if (openbox[i].className == "ubboptions" && openbox[i].id != "codelang") {                    if (openbox[i].className == "ubboptions" && openbox[i].id != "codelang") {
                       openbox[i].style.display = "none";                        openbox[i].style.display = "none";
                   }                    }
               }                }
           }            }
   
           function syntaxlang(lang, optnum) {            function syntaxlang(lang, optnum) {
               AddSelText("[code"+lang+"]","[/code]");                AddSelText("[code"+lang+"]","[/code]");
               document.getElementById("codesyntax").options[optnum].selected = false;                document.getElementById("codesyntax").options[optnum].selected = false;
               document.getElementById("codelang").style.display = "none";                document.getElementById("codelang").style.display = "none";
           }            }
   
           function bulletset() {            function bulletset() {
               if (document.getElementById("bullets").style.display == "none")                if (document.getElementById("bullets").style.display == "none")
               document.getElementById("bullets").style.display = "block";                document.getElementById("bullets").style.display = "block";
               else                else
               document.getElementById("bullets").style.display = "none";                document.getElementById("bullets").style.display = "none";
               document.getElementById("bullets").style.zIndex = "100";                document.getElementById("bullets").style.zIndex = "100";
   
               var openbox = document.getElementsByTagName("div");                var openbox = document.getElementsByTagName("div");
               for (var i = 0; i < openbox.length; i++) {                for (var i = 0; i < openbox.length; i++) {
                   if (openbox[i].className == "ubboptions" && openbox[i].id != "bullets") {                    if (openbox[i].className == "ubboptions" && openbox[i].id != "bullets") {
                       openbox[i].style.display = "none";                        openbox[i].style.display = "none";
                   }                    }
               }                }
           }            }
                 
           function showbullets(bullet) {            function showbullets(bullet) {
               AddSelText("[list "+bullet+"][*]", "\\n[/list]");                AddSelText("[list "+bullet+"][*]", "\\n[/list]");
           }            }
   
           function olist() {            function olist() {
               AddSelText("[olist][*]", "\\n[/olist]");                AddSelText("[olist][*]", "\\n[/olist]");
           }            }
   
           // Palette            // Palette