<?php
//v1.0.4 www.bcoos.net 2006/10 GPL
// www.bcoos.net 2006-09 1.0.2 GPL
//v1.7 www.exoops.info 2006/08 GPL
//v1.6 www.exoops.info 2006/03 GPL 
// $Id: forumform.inc.php,v 1.5 2003/07/05 18:43:47 half-dead Exp $
// ------------------------------------------------------------------------- //
//               E-Xoops: Content Management for the Masses                  //
//                       < http://www.e-xoops.com >                          //
// ------------------------------------------------------------------------- //
// Based on:
// phpBB: http://www.phpBB.com
// License type: GPL
// ------------------------------------------------------------------------- //
include_once(XOOPS_ROOT_PATH."/class/xoopslists.php");
include_once(XOOPS_ROOT_PATH.'/class/xoopsform/formdhtmltextarea.php');
include_once('./cache/config.php');
if ( $newbbConfig['disc_show'] == 3 || ($isreply && $newbbConfig['disc_show'] == 2) || (empty($editpost) && $newbbConfig['disc_show'] == 1) ) {
	$disclaimer = join('', file("./cache/disclaimer.txt"));
	if ($disclaimer != "") {
		OpenTable();
		$myts->setType('admin');
		echo $myts->makeTareaData4Show($disclaimer, 1, 1, 1);
		CloseTable();
		echo "<br /><br />";
	}
}
echo "
<table border='0' cellpadding='1' cellspacing='1' width='100%' class='bg2'><tr class='bg3' align='left'>
<td width='25%' valign='top'><b>". _MD_ABOUTPOST .":</b></td>";
if ( $forumdata['forum_access'] == 1 ) {
	echo "<td>". _MD_REGCANPOST ."</td>";
	} elseif ( $forumdata['forum_access'] == 2 ) {
		echo "<td>". _MD_ANONCANPOST ."</td>";
		} elseif ( $forumdata['forum_access'] == 3 ) {
			echo "<td>". _MD_MODSCANPOST ."</td>";
		}
echo "
</tr><tr class='bg1' align='left'>
<form action='post.php' method='post' name='forumform' id='forumform' onsubmit='return xoopsValidate(\"subject\", \"message\", \"contents_submit\");'>
<td width='25%' valign='top' style='white-space: nowrap;'><b>". _MD_YOURNAME ."</b></td><td>";
if ($xoopsUser) {
	echo "
	<a href='".XOOPS_URL."/userinfo.php?uid=".$xoopsUser->getVar("uid")."'>".$xoopsUser->getVar("uname")."</a>
	[ <a href='".XOOPS_URL."/user.php?op=logout'>"._LOGOUT."</a> ]";
	} else {
		echo "
		<span style='color: #ff0000;'>".$bcoosConfig['anonymous']."</span>
		[ <a href='".XOOPS_URL."/register.php'>"._MD_REGISTER."</a> ]";
	}
echo "
</td></tr>
<tr class='bg3' align='left'>
<td valign='top' style='white-space: nowrap;'><b>". _SUBJECT.": </b></td>
<td>";
if ( !$istopic ) {
	if ( !preg_match("/^re:/i", $subject) ) {
		$subject = "Re: ".substr($subject, 0, 81);
	}
}
echo "
<input type='text' class='text' id='subject' name='subject' size='60' maxlength='100' value='$subject' /></td></tr>
<tr class='bg1' align='left'>
<td valign='top' style='white-space: nowrap;'><b>"._MD_MESSAGEICON."</b></td>
<td>
<table><tr align='left'>
<td>";
$lists    = new XoopsLists;
$filelist = $lists->getSubjectsList();
$count    = 1;
while ( list($key, $file) = each($filelist) ) {
	$checked = "";
	if ( isset($icon) && $file == $icon ) {
		$checked = " checked='checked'";
	}
	echo "
	<input type='radio' class='radio' value='$file' name='icon'$checked />
	<img src='".XOOPS_URL."/images/subject/$file' alt='' />";
	if ($count == 8) {
		echo "<br />";
		$count = 0;
	}
	$count++;
}
echo "
</td></tr></table></td>
</tr><tr class='bg3' align='left'>
<td valign='top' style='white-space: nowrap;'><b>"._MD_MESSAGEC."</b><br /></td>
<td><br />";
$desc = new XoopsFormDhtmlTextArea('', 'message', $message, 10, 50);
echo $desc->render();
if ( !empty($isreply) && isset($hidden) && $hidden != "" ) {
	echo "
	<input type='hidden' name='isreply' value='1' />
	<input type='hidden' name='hidden' id='hidden' value='$hidden' />
	<input type='button' class='button' name='quote' value='"._MD_QUOTE."' onclick='xoopsGetElementById(\"message\").value=xoopsGetElementById(\"message\").value + xoopsGetElementById(\"hidden\").value; xoopsGetElementById(\"hidden\").value=\"\";' />
	<br />";
}
echo "<br /><br />";
echo "
</td></tr>
<tr class='bg1' align='left'>
<td valign='top' style='white-space: nowrap;'><b>"._MD_OPTIONS."</b></td>
<td>";
// Allow html?
if ( $xoopsUser && !empty($forumdata['allow_html']) ) {
	echo _MD_ALLOWEDHTML."<br />";
	echo get_allowed_html();
	if ($allow_html == '0' || $_POST['allow_html'] == '0') {
		$option0 = " selected";
		} elseif ($allow_html == '2' || $_POST['allow_html'] == '2') {
			$option2 = " selected";
			} else {
				$option1 = " selected";
			}
	echo "<br /><br />
	<select class='select' name='allow_html'>
	<option value='0'$option0>"._HTMLOFF."</option>
	<option value='1'$option1>"._HTMLAUTOWRAP."</option>
	<option value='2'$option2>"._HTMLNOAUTOWRAP."</option>
	</select><br />";
	} else {
		echo "<input type='hidden' name='allow_html' value='0'>";
	}
// Enable Smileys?
echo "<input type='checkbox' class='checkbox' name='allow_smileys' value='1'";
if (!isPost() || $_POST['allow_smileys'] == 1) {
	echo " checked='checked'";
}
echo " />&nbsp;"._ENABLESMILEY."<br />";
// Enable bbcode?
echo "<input type='checkbox' class='checkbox' name='allow_bbcode' value='1'";
if (!isPost() || $_POST['allow_bbcode'] == 1) {
	echo " checked='checked'";
}
echo " />&nbsp;"._ENABLEBBCODE."<br />";
if ($xoopsUser && !empty($editpost) ) {
	echo "<input type='hidden' name='editpost' value='1' />";
}
if ($xoopsUser && isset($istopic) && $istopic) {
	echo "<input type='hidden' name='istopic' value='1' />";
	echo "<input type='checkbox' class='checkbox' name='notify' value='1'";
	if ( isset($notify) && $notify ) {
		echo " checked='checked'";
	}
	echo " />&nbsp;"._MD_EMAILNOTIFY."<br />";
}
if ( $xoopsUser && ($forumdata['forum_access'] == 2) && !$post_id ) {
	echo "<input type='checkbox' class='checkbox' name='noname' value='1'";
	if ( isset($noname) && $noname ) {
		echo " checked='checked'";
	}
	echo " />&nbsp;"._MD_POSTANONLY."<br />";
}
if ( $forumdata['allow_sig'] && $xoopsUser ) {
	echo "<input type='checkbox' class='checkbox' name='attachsig' value='1'";
	if ( isset($_POST['contents_preview'] ) ) {
		if ( $attachsig ) {
			echo " checked='checked' />&nbsp;";
			} else {
				echo " />&nbsp;";
			}
		} elseif ( isset($attachsig) && $attachsig == 1 ) {
			echo " checked='checked' />&nbsp;";
			} elseif ( isset($attachsig) && $attachsig == 0 ) {
				echo "/>&nbsp;";
				} else {
					if ( $xoopsUser->getVar("attachsig") ) {
						echo " checked='checked' />&nbsp;";
						} else {
							echo "/>&nbsp;";
						}
				}
	echo _MD_ATTACHSIG."<br />";
}
echo "
</td></tr>
<tr><td colspan='2'>";
if ( !$xoopsUser && $bcoosConfig['anonpost'] && $bcoosConfig['captcha_comments'] && function_exists('imagecreate')) {
	include_once(XOOPS_ROOT_PATH."/class/rc4.crypt.php");
	$checksum   = "verified";
	$pass       = strtoupper(makepass());
	$rc4        = new rc4_crypt();
	$rc4->key($pass);
	$rc4->crypt($checksum);
	$im         = imagecreatefrompng('../../images/verify.png');
	$text_color = imagecolorallocate($im, 50, 50, 50);
	imagestring($im, 5, 2, 2, $pass, $text_color);
	imagepng($im, "../../cache/verify.png");
	imagedestroy($im);
	
	?>
	<br />
	<input type="hidden" name="verify_crc" value="<?php echo base64_encode($checksum);?>" />
	<table><tr><td>
	<input type='text' class='text' id='verify_text' name='verify_text' size='12' maxlength='12' value='' />
	</td><td>
	<?php echo _US_ENTERVERIF;?>
	</td></tr></table>
	&nbsp;<img src="../../cache/verify.png?<?php echo time();?>" /><br />
	<?php
	if (@file_exists("../../cache/verify.png")) {
		$img_verify = 1;
	}
	
}
echo "
</td></tr>
<tr class='bg3' align='left'><td colspan='2' align='center'><br />
<input type='hidden' name='pid' value='".intval($pid)."' />
<input type='hidden' name='post_id' value='".intval($post_id)."' />
<input type='hidden' name='topic_id' value='".intval($topic_id)."' />
<input type='hidden' name='forum' value='".intval($forum)."' />
<input type='hidden' name='viewmode' value='$viewmode' />
<input type='hidden' name='order' value='".intval($order)."' />
<input type='submit' class='button' name='contents_preview' value='"._PREVIEW."' />
<input type='submit' class='button' name='contents_submit' id='contents_submit' value='"._SUBMIT."' />
<input type='button' class='button' onclick='location=\"";
if ( isset($topic_id) && $topic_id != "" ) {
	echo "viewtopic.php?topic_id=".intval($topic_id)."&amp;forum=".intval($forum)."\"'";
	} else {
		echo "viewforum.php?forum=".intval($forum)."\"'";
	}
echo " value='"._CANCEL."' /></form></td></tr></table>";
?>
