<?php
$file = __FILE__;
include ("inc/inc_common.php");
include ("inc/inc_connect.php");

$result = mysql_query( "SELECT * FROM $forumtable WHERE intId = '$postid'" );
$num_rows = mysql_num_rows( $result );
//Dispay records
while ( $a_row = mysql_fetch_object( $result ) )
{
    if ($a_row->intEdited == 1)
    {
        //post has been edited - find new post
        $resultb=mysql_query("SELECT * FROM $forumtable WHERE intId = '$a_row->intNewId'");
        $num_rowsb = mysql_num_rows( $resultb );
        while ( $b_row = mysql_fetch_object( $resultb ) )
        {
            $thistitle = $b_row->strTopicName;
            $thisid = $b_row->intTopicId;
            $locked = $b_row->ynLocked;
            $locker = $b_row->strLockedBy;
            $post = $b_row->memPost;
            $author = $b_row->strName;
            $timeofpost = $b_row->strTime;
            $dateofpost = $b_row->strDate;
        }
    }
    else
    {
        $thistitle = $a_row->strTopicName;
        $thisid = $a_row->intTopicId;
        $locked = $a_row->ynLocked;
        $locker = $a_row->strLockedBy;
        $post = $a_row->memPost;
        $author = $a_row->strName;
        $timeofpost = $a_row->strTime;
        $dateofpost = $a_row->strDate;
    }
}

include ("inc/inc_admincheck.php");
include ("inc/inc_getdate.php");
include ("inc/inc_forumname.php");
$page = "Quote $author";
$pagelink = $file;
include("inc/inc_setonline.php");
$title = "Quote $author";
include ("inc/inc_head.php");
include ("inc/inc_body.php");
$title = "Quote $author";
include ("inc/inc_title.php");

print "</centeR><table border=0 width=\"100%\" cellpadding=1 cellspacing=0><tr><td  width=\"30%\">
<table border=0 cellpadding=1 cellspacing=0><tr><td>
<font face=\"$font\" size=$fontsize><image src=\"images/folder_icon.gif\">&nbsp;<a href=\"index.php\">$name1&nbsp;Home</a>
</td></tr>
<tr><td><image src=\"images/folder_line.gif\">
<font face=\"$font\" size=$fontsize><image src=\"images/folder_icon.gif\">&nbsp;<a href=\"forums.php\">$name2</a></td></tr>
<tr><td><font face=\"$font\" size=$fontsize>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<image src=\"images/folder_line.gif\">
<image src=\"images/folder_icon.gif\">&nbsp;<a href=\"topics.php?groupid=$groupid\">$name3</a></td></tr>
<tr><td><font face=\"$font\" size=$fontsize>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<image src=\"images/folder_line.gif\">
<image src=\"images/open_folder_icon.gif\">&nbsp;<a href=\"topic.php?topicid=$thisid&groupid=$groupid#post$postid\">$thistitle</a></td></tr>
</table>
</td><td><center>";

include ("inc/inc_navigation.php");
include ("inc/inc_newmailsdisplay.php");
print "</td></tr></table><br><center>";

//end of include files...

print "<center><br><br><br><br>";

if ($locked == "Yes")
{
    print "<br><font face=\"$font\" size=$fontsize><center>This thread has been locked by $locker. You cannot quote $author.<br><br><br><br>";
}
else
{
    ?>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="60%" id="AutoNumber15" bgcolor=<?php print "$fgcolour"; ?>>
  <tr>
    <td width="100%">
<br><br>
    <form method="POST" action="add_reply.php">
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber16">
        <tr>
          <td width="40%"><br><br>
          <?php
          include("inc_smilies.php")
          ?>
<td>
<script language=javascript>
<!--

function markSelection ( txtObj ) {
 if ( txtObj.createTextRange ) {
   txtObj.caretPos = document.selection.createRange().duplicate();
   isSelected = true;
 }
}

function insertTag ( txtName, tag, enclose ) {
 var closeTag = tag;
 if ( enclose ) {
   var attribSplit = tag.indexOf ( ' ' );
   if ( tag.indexOf ( ' ' ) > -1 )
     closeTag = tag.substring ( 0, attribSplit );
 }
 if ( isSelected ) {
   var txtObj = eval ( "document.forms[0]." + txtName );
   if (txtObj.createTextRange && txtObj.caretPos) {
     var caretPos = txtObj.caretPos;
     caretPos.text = ( ( enclose ) ? "["+tag+"]"+caretPos.text+"[/"+closeTag+"]" : ""+tag+""+caretPos.text );
     markSelection ( txtObj );
     if ( txtObj.caretPos.text=='' ) {
       isSelected=false;
    txtObj.focus();
     }
   }
 } else {
   // placeholder for loss of focus handler
 }
}

//-->
</script>

<form>
<?php

$post = str_replace("[swear]", "", $post);
$post = str_replace("[/swear]", "", $post);
$time = $timeofpost;
include ("inc/inc_time.php");
$timeofpost = $time.$am;
if ($boxedquotes == 1)
{
    $quotecode = "[QUOTE]Originally posted by $author on the $dateofpost at $timeofpost [br] [SIZE2]$post [/QUOTE]";
}
else
{
    $quotecode = "[hr][SIZE1][navy]Originally posted by $author on the $dateofpost at $timeofpost [br][SIZE2][navy]$post [black][hr]";
}

?>

<textarea onfocus="document.onkeypress=function(){};" rows="11" cols="36" style="background-image: url('images/big_area_background.gif')" name="tsttxt" ONSELECT="markSelection(this);" ONCLICK="markSelection(this);" ONKEYUP="markSelection(this);"><?php print "$quotecode"; ?>
</textarea><br>

<?php
          include ("inc_buttons.php");
          ?>



          <?php
          print "<input type=\"hidden\" name=\"topicid\" value=\"$thisid\">";
          print "<input type=\"hidden\" name=\"groupid\" value=\"$groupid\">";
          print "<input type=\"hidden\" name=\"topictitle\" value=\"$thistitle\">";
          ?>


          </td>
          <td width="20%">&nbsp;</td>
        </tr>
      </table>
      <p align="center"><input type="submit" value="Post This Quote!" name="B1"></p>
    </form>
    <p align="center">&nbsp;</td>
  </tr>
</table>






<?php
}
include("inc/inc_footer.php");
?>
</body>

</html>