<?php

include_once(XOOPS_ROOT_PATH."/class/xoopslists.php");
include(XOOPS_ROOT_PATH."/include/xoopscodes.php");
echo "<table border='0' cellpadding='1' cellspacing='1' width='100%' class='bg2'><tr class='bg3' align='left'><td width='25%' valign='top' class='nw'><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 validate(\"subject\", \"message\");'><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>&nbsp;[&nbsp;<a href='".XOOPS_URL."/user.php?op=logout'>"._MD_LOGOUT."</a>&nbsp;]";
} else {
	echo "<span style='color: #ff0000;'>".$xoopsConfig['anonymous']."</span>";
	echo " [ <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>". _MD_SUBJECTC ."</b></td>
<td>";

if ( !$istopic ) {
	if ( !eregi("^re:",$subject) ) {
		$subject = "Re: ".substr($subject,0,81);
	}
}

echo "<input type='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' value='$file' name='icon'$checked />&nbsp;";
	echo "<img src='".XOOPS_URL."/images/subject/$file' alt='' />&nbsp;";
	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 />";
xoopsCodeTarea("message");

if ( !empty($isreply) && isset($hidden) && $hidden != "" ) {
	echo "<input type='hidden' name='isreply' value='1' />";
	echo "<input type='hidden' name='hidden' id='hidden' value='$hidden' />
	<input type='button' name='quote' value='"._MD_QUOTE."' onclick='xoopsGetElementById(\"message\").value=xoopsGetElementById(\"message\").value + xoopsGetElementById(\"hidden\").value; xoopsGetElementById(\"hidden\").value=\"\";' /><br />";
} 
xoopsSmilies("message");
echo "<br /><br />";

if ( $forumdata['allow_html'] ) {
	echo "<br />"._MD_ALLOWEDHTML."<br />";
	echo get_allowed_html();
}

echo "</td></tr>
<tr class='bg1' align='left'>";
echo "<td valign='top' style='white-space: nowrap;'><b>"._MD_OPTIONS."</b></td>\n";
echo "<td>";

if ( $xoopsUser && $forumdata['forum_access'] == 2 && !$post_id ) {
	echo "<input type='checkbox' name='noname' value='1'";
	if ( isset($noname) && $noname ) {
		echo " checked='checked'";
	}
	echo " />&nbsp;"._MD_POSTANONLY."<br />\n"; 
}

echo "<input type='checkbox' name='nosmiley' value='1'";
if ( isset($nosmiley) && $nosmiley ) {
	echo " checked='checked'";
}
echo " />&nbsp;"._MD_DISABLESMILEY."<br />\n";

if ( $forumdata['allow_html'] ) {
	echo "<input type='checkbox' name='nohtml' value='1'";
	if ( $nohtml ) {
		echo " checked='checked'";
	}
	echo " />&nbsp;"._MD_DISABLEHTML."<br />\n";
} else {
	echo "<input type='hidden' name='nohtml' value='1' />";
}

if ( isset($istopic) && $istopic ) {
	echo "<input type='hidden' name='istopic' value='1' />";
	echo "<input type='checkbox' name='notify' value='1'";
	if( isset($notify) && $notify ){
		echo " checked='checked'";
	}
	echo " />&nbsp;"._MD_EMAILNOTIFY."<br />\n";
}

if ( $forumdata['allow_sig'] && $xoopsUser ) {
	echo "<input type='checkbox' name='attachsig' value='1'";
	if ( $op == "preview" ) {
		if ( $attachsig ) {
			echo " checked='checked' />&nbsp;";
		} else {
			echo " />&nbsp;";
		}
	} else {
		if ( $xoopsUser->attachsig() || $attachsig ) {
			echo " checked='checked' />&nbsp;";
		} else {
			echo "/>&nbsp;";
		}
	}
			
	echo _MD_ATTACHSIG."<br />\n";
}

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)."' />
<select name='op'>
<option value='preview' selected='selected'>". _MD_PREVIEW ."</option>
<option value='post'>". _MD_POST ."</option>
</select>
<input type='submit' value='". _MD_SUBMIT ."' id='sumitbutton' />&nbsp;";
echo "<input type='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='"._MD_CANCELPOST."' />";
echo "</form>\n";
echo "</td></tr></table>\n";


?>