<?PHP

  $p_author = str_replace("\"","&quot;",$p_author);
  $p_subject = str_replace("\"","&quot;",$p_subject);

  $name_cookie="phorum_name";
  if(isset($$name_cookie) && empty($author)){
    $author=$$name_cookie;
  }
  elseif(!isset($author)){
    $author="";
  }

  $email_cookie="phorum_email";
  if(isset($$email_cookie) && empty($email)){
    $email=$$email_cookie;
  }
  elseif(!isset($email)){
    $email="";
  }

  $email="";
  
  if(get_cfg_var("magic_quotes_gpc")){
    $email=stripslashes($email);
    $author=stripslashes($author);
    if(!empty($subject)) $subject=stripslashes($subject);
    $body=stripslashes($body);
  }

  if($read!=false){
    $caption = $lReplyMessage;
    if(!eregi("^re:", $qsubject)){
      $p_subject="RE: ".$qsubject;
    }
    else{
      $p_subject= $qsubject;
    }

    $parent=$id;
    if(!$$phflat){
      $quote = undo_htmlspecialchars($qauthor) . " $lWrote:\n";
      $quote .= textwrap("\n$qbody", 63, "\n", "> ") . "\n";
      $quote = htmlspecialchars($quote);
      $quote_button="&nbsp;&nbsp;<input type=\"Hidden\" name=\"hide\" value=\"".$quote."\"><input tabindex=\"100\" type=\"Button\" name=\"quote\" value=\"$lQuote\" onClick=\"this.form.body.value=this.form.body.value + this.form.hide.value; this.form.hide.value='';\">";
    }
  }
  else{
    $caption = $lStartTopic;
    $p_subject=$subject;
    $p_body=$body;
  }
  $p_author=$author;
  $p_email=$email;

?>
<?PHP
  if($IsError && $action){
    echo "<p><b>$IsError</b>";
  }
?>
<?PHP
  if ($ForumAllowUploads == 'Y' && !empty($uploadDir)) {
    $enctype = "multipart/form-data";
  } else {
    $enctype = "application/x-www-form-urlencoded";
  }

### VIRALGAMES ###
$form_action = $sess->action($FORUM_URL."$post_page.$ext");
$form_name = "forum_form";
##################
?>
<form action="<?PHP echo $form_action ?>" method="post" enctype="<?PHP echo $enctype ?>">
<input type="hidden" name="<?php echo $form_name ?>" value="x"><?php echo $sess->hfield(); ?>
<input type="Hidden" name="t" value="<?PHP  echo $thread; ?>">
<input type="Hidden" name="a" value="post">
<input type="Hidden" name="f" value="<?PHP echo $num; ?>">
<input type="Hidden" name="p" value="<?PHP echo $parent; ?>">
<?php echo $PostVars; ?>
<br>

<?php
table_ktf_up( $caption, "100%", 'green',1,'','','#FFFFFF' ); 



 ?>
<table cellspacing="0" cellpadding="3" border="0">
<tr>
    <td class=boldDark nowrap>&nbsp;<?PHP echo $lFormName;?> :</td>
    <td align=left ><input type="Text" READONLY name="author" size="30" maxlength="30" class=inputBg value="<?PHP 
	//echo $p_author; 

	// 1. on regarde le cookie
	$CookVal=$HTTP_COOKIE_VARS[$COOKIE_NAME];
	if ((!($CookVal)) || ($CookVal == ""))
	{
		// 2. il n'existe pas, on regarde s'il est connecté
		if ((!isset($sess->memberid)) || ($sess->memberid <= 0))
		{
			// non, il n'est pas connecté
			echo "Connectez-vous pour pouvoir mettre un message";
			//	$sess->redirect($LOGIN_PAGE, "errorLogin=".urlencode("Pour laisser un message dans le forum, vous devez être inscrit, et avoir été connecté au moins une fois dans les 24 heures"));
		}
		else
		{
			// oui, on prend son login. A virer ?
			//$member = getmember($sess->memberid);
			$player = getplayer($sess->memberid);
			
			if (checkAuthor($player['NickName'], "NickName"))
				echo setAuthor($player['NickName'], "NickName");
			else
				echo $player['NickName'];
			/*
			if ($player['NickName'] == $WEBMASTER_NICKNAME)
				echo $WEBMASTER_NAME;
			else
				echo $player['NickName'];
			*/
		}
	}
	else
	{
		// il y a un cookie, on prend ce nom-là
		if (checkAuthor($$COOKIE_NAME, "NickName"))
			echo setAuthor($$COOKIE_NAME, "NickName", false);
		else
			echo $$COOKIE_NAME;
		
		/*
		if ($$COOKIE_NAME == $WEBMASTER_NICKNAME)
			echo $WEBMASTER_NAME;
		else
			echo $$COOKIE_NAME;
		*/
	}
	?>">
	</td>
</tr>
<!--<tr>
    <td <?PHP echo bgcolor($ForumTableBodyColor2); ?> class=stdDarkGreen nowrap>&nbsp;<?PHP echo $lFormEmail;?>:</td>
    <td <?PHP echo bgcolor($ForumTableBodyColor2); ?>><input type="Text" name="email" size="30" maxlength="200" value="<?PHP echo $p_email; ?>"></td>
</tr>
-->
<tr>
    <td  class=boldDark nowrap>&nbsp;<?PHP echo $lFormSubject;?> :</td>
    <td align=left><input type="Text" class=inputBg name="subject" size="30" maxlength="255" value="<?PHP echo $p_subject; ?>"></td>
</tr>
<?PHP
	if ($ForumAllowUploads == 'Y' AND $uploadDir != '') {
		print "<tr>\n";
		print '    <td ' . bgcolor($ForumTableBodyColor2) . ' nowrap><font color="' . $TableBodyFontColor1 . '">&nbsp;' . $lFormAttachment . ':</font></td>';
		print '    <td ' . bgcolor($ForumTableBodyColor2) . '><input type="File" name="attachment" size="30" maxlength="64"></td>';
		print "</tr>\n";
	}
?>
<tr>
    <td  colspan=2 width="100%" nowrap align="center">
		<table cellpadding="5" cellspacing="0" border="0">
		<tr>
			<td align="CENTER" valign="TOP">
				<font face="courier"><textarea class=inputBg  name="body" cols="80" rows="15" wrap="VIRTUAL"><?PHP echo $p_body; ?></textarea></font>
			</td>
		</tr>
		</table>
	</td>
</tr>
<?PHP 

// if($ForumModeration!="a"){ pas de mail

if(false){ ?>
<tr>
    <td colspan=2 nowrap align="left" class=stdDark><input type="checkbox" name="email_reply" value="Y"><?PHP echo $lEmailMe; ?></td>
</tr>
<?PHP } ?>
<tr>
<!--    <td width="100%" colspan="2" align="RIGHT" <?PHP echo bgcolor($ForumTableBodyColor2); ?>><?PHP echo $quote_button; ?>&nbsp;<input type="Submit" name="post" value=" <?PHP echo $lFormPost;?> ">&nbsp;<br><img src="images/trans.gif" width=3 height=3 border=0></td> -->
    <td width="100%" colspan="2" align="RIGHT" >&nbsp;<input type="image" name="post" src="<?php echo $IMAGES_DIR . "boutons/btn_forum_ok.gif"?>"  border="0" value=" <?PHP echo $lFormPost;?> " alt="Voir">&nbsp;<br><img src="images/trans.gif" width=3 height=3 border=0></td>
</tr>
</table>

      <table width=100% cellspacing="0" cellpadding="1" border="0">
        <tr>
          <td align=center class=forumnav ><?PHP echo $nav; ?></td>
        </tr>
      </table>


<?php table_ktf_down('',1);
?>



</form>
