<?php

if ( VB35 == "on" ) {
echo<<<PPPRINT
<form name="vbform" method="post" action="{$Globals['maindir']}/comments.php" onsubmit="return vB_Editor['{$editorid}'].prepare_submit(0, 5)">
PPPRINT;
}
else {
echo<<<PPPRINT
<!-- BEGIN TEMPLATE: comments.tmpl -->
<form name="vbform" method="post" action="{$Globals['maindir']}/comments.php" onsubmit="return validatePost(this, this.subject.value, $vboptions[postminchars], $vboptions[postmaxchars]);" onreset="vB_RESET(this);">
PPPRINT;
}

echo<<<PPPRINT
$ppopen
    <tr>
    <td width="20%" align="left" class="{$Style['menubar']}">
        <span class="{$Style['menubar']}"><b>{$Globals['pp_lang']['addyour']}</b></span>
    </td>
    <td width="80%" align="right" class="{$Style['menubar']}">
        <span class="{$Style['menubar']}"><a href="javascript:PopUpHelp('help/comments.php')">{$Globals['pp_lang']['help']}</a></span>
    </td>
    </tr>
    <tr>
    <td class="{$Style['tddetails']}">
        <span class="{$Style['medium']}">{$Globals['pp_lang']['username']}</span>
    </td>
    <td colspan="2" class="{$Style['tddetails']}" align="left">
        <span class="{$Style['medium']}">$cusername</span>
    </td>
    </tr>
PPPRINT;

if ( ($Globals['allowrate'] == "yes" && $CatPerms['ugvote'][$thiscat] == 0) && $User['userid'] != $theuser ) {
    if ( $alreadyrated == 0 ) {
        if ( $ratingtype == 0 ) {
echo<<<PPPRINT
    <tr>
    <td class="{$Style['tddetails']}">
        {$Globals['pp_lang']['ratethis']}</span>
    </td>
    <td class="{$Style['tddetails']}" colspan="2" align="left">
        $rate_code
    </td>
    </tr>
PPPRINT;
        }
    }
    else {
echo<<<PPPRINT
    <tr>
    <td class="{$Style['tddetails']}">
        {$Globals['pp_lang']['ratethis']}
    </td>
    <td class="{$Style['tddetails']}" colspan="2" align="left">
        $ratedisplay
    </td>
    </tr>
PPPRINT;
    }
}

if ( $CatPerms['ugpost'][$thiscat] == 0 ) {
echo<<<PPPRINT
    <tr>
    <td class="{$Style['tddetails']}" valign="top">
        {$Globals['pp_lang']['addyour']}:<br /><br />
        <div align="center">$imgtag</div>
    </td>
    <td class="{$Style['tddetails']}">
PPPRINT;

    if ( VB35 == "on" && VB3_ENHANCEDINT == "on" ) {
        if ( VB35 == "on" ) {
echo<<<PPPRINT
<!-- scripts for quick reply and quick edit -->
<!-- EDITOR SCRIPTS -->
<script type="text/javascript" src="{$Globals['vbulletin']}/clientscript/vbulletin_textedit.js"></script>
<script type="text/javascript">
<!--
var istyles = new Array(); istyles = { $istyles_js };

var smiliewindow_x = 240;
var smiliewindow_y = 280;
var threadedmode = 0;
var ignorequotechars = 1;


// vB Phrases
vbphrase["wysiwyg_please_wait"]          = "$vbphrase[wysiwyg_please_wait]";
vbphrase["wysiwyg_initialized"]          = "$vbphrase[wysiwyg_initialized]";
vbphrase["wysiwyg_command_invalid"]      = "$vbphrase[wysiwyg_command_invalid]";
vbphrase["moz_must_select_text"]         = "$vbphrase[moz_must_select_text]";
vbphrase["moz_edit_config_file"]         = "$vbphrase[moz_edit_config_file]";
vbphrase["enter_tag_option"]             = "$vbphrase[enter_tag_option]";
vbphrase["must_select_text_to_use"]      = "$vbphrase[must_select_text_to_use]";
vbphrase["browser_is_safari_no_wysiwyg"] = "$vbphrase[browser_is_safari_no_wysiwyg]";
vbphrase["enter_option_x_tag"]           = "$vbphrase[enter_option_x_tag]";
vbphrase["enter_text_to_be_formatted"]   = "$vbphrase[enter_text_to_be_formatted]";
vbphrase["enter_link_text"]              = "$vbphrase[enter_link_text]";
vbphrase["enter_list_type"]              = "$vbphrase[enter_list_type]";
vbphrase["enter_list_item"]              = "$vbphrase[enter_list_item]";
vbphrase["must_enter_subject"]           = "$vbphrase[must_enter_subject]";
vbphrase["message_too_short"]            = "$vbphrase[message_too_short]";
vbphrase["enter_link_url"]               = "$vbphrase[enter_link_url]";
vbphrase["enter_image_url"]              = "$vbphrase[enter_image_url]";
vbphrase["enter_email_link"]             = "$vbphrase[enter_email_link]";
vbphrase["iespell_not_installed"]        = "$vbphrase[iespell_not_installed]";
vbphrase["click_quick_reply_icon"]       = "$vbphrase[click_quick_reply_icon]";
vbphrase["insert_all"]                   = "$vbphrase[insert_all]";

//-->
</script>
<!-- END EDITOR SCRIPTS -->

<!-- start message area -->
	<table cellpadding="0" cellspacing="0" border="0">
	<tr>
		<td class="controlbar" colspan="2">
		    $messagearea
    	</td>
    </tr>
    </table>
<!-- end message area -->
PPPRINT;
        }
        else {
echo<<<PPPRINT
        <!-- message area -->
        <input type="hidden" class="bginput" name="subject" value="wedontusesubjectsfortheseposts" />
        $messagearea
        <!-- end message area -->
    </td>
    </tr>
PPPRINT;
        }
    }
    else {
        // Standard Interface

echo<<<PPPRINT
<script type="text/javascript">
<!--
var WYSIWYG = 1;
var threadedmode = 0;
var minchars = $vboptions[postminchars];
var maxchars = $vboptions[postmaxchars];
var require_click = 0;
var must_click_message = "Please click one of the Quick Reply icons in the posts above to activate Quick Reply.";
var istyles = new Array(); istyles = { $istyles_js };
var normalmode = false;
var vbphrase = {
	// wysiwyg only
	"wysiwyg_please_wait" : "$vbphrase[wysiwyg_please_wait]",
	"wysiwyg_initialized" : "$vbphrase[wysiwyg_initialized]",
	"wysiwyg_command_invalid" : "$vbphrase[wysiwyg_command_invalid]",
	"moz_must_select_text" : "$vbphrase[moz_must_select_text]",
	"moz_edit_config_file" : "$vbphrase[moz_edit_config_file]",
	"enter_tag_option" : "$vbphrase[enter_tag_option]",
	"must_select_text_to_use" : "$vbphrase[must_select_text_to_use]",
	"browser_is_safari_no_wysiwyg" : "$vbphrase[browser_is_safari_no_wysiwyg]",
	// standard only
	"enter_text_to_be_formatted" : "$vbphrase[enter_text_to_be_formatted]",
	"enter_link_text" : "$vbphrase[enter_link_text]",
	"enter_list_type" : "$vbphrase[enter_list_type]",
	"enter_list_item" : "$vbphrase[enter_list_item]",
	// both
	"must_enter_subject" : "$vbphrase[must_enter_subject]",
	"message_too_short" : "$vbphrase[message_too_short]",
	"enter_link_url" :  "$vbphrase[enter_link_url]",
	"enter_image_url" : "$vbphrase[enter_image_url]",
	"enter_email_link" : "$vbphrase[enter_email_link]"
};
//-->
</script>

<!-- start message area -->
<table cellpadding="0" cellspacing="0" border="0" align="left">
<tr>
	<td id="vBulletin_editor" align="left">

	<div id="controlbar">
	<table cellpadding="0" cellspacing="0" border="0">
	<tr>
		<td><div class="button"><a href="#" onclick="return vbcode('B', '')"><img src="{$Globals['vbulletin']}/images/editor/bold.gif" alt="Bold" width="21" height="20" border="0" /></a></div></td>
		<td><div class="button"><a href="#" onclick="return vbcode('I', '')"><img src="{$Globals['vbulletin']}/images/editor/italic.gif" alt="Italic" width="21" height="20" border="0" /></a></div></td>
		<td><div class="button"><a href="#" onclick="return vbcode('U', '')"><img src="{$Globals['vbulletin']}/images/editor/underline.gif" alt="Underline" width="21" height="20" border="0" /></a></div></td>
		<td><img src="{$Globals['vbulletin']}/images/editor/separator.gif" alt="" width="6" height="20" /></td>
		<td><div class="button"><a href="#" onclick="return vbcode('QUOTE', '')"><img src="{$Globals['vbulletin']}/images/editor/quote.gif" alt="Wrap [QUOTE] tags around selected text" title="Wrap [QUOTE] tags around selected text" width="21" height="21" border="0" /></a></div></td>

	</tr>
	</table>
	</div>
	
	<div class="controlbar">
		<textarea name="message" id="qr_message" class="bginput" style="width:{$vbphrase[form_width]}; height:100px" cols="60" rows="5" tabindex="1">$ecomments</textarea>
	</div>
				
	<script type="text/javascript" src="{$Globals['vbulletin']}/clientscript/vbulletin_editor.js"></script>
	<script type="text/javascript" src="{$Globals['vbulletin']}/clientscript/vbulletin_stdedit.js"></script>
	
	</td>
</tr>
</table>

<!-- end message area --></div>
PPPRINT;
    }
}

if ($cedit != "") {
echo<<<PPPRINT
    <tr>
    <td class="{$Style['tddetails']}">
        {$Globals['pp_lang']['delete']}?</span>
    </td>
    <td class="{$Style['tddetails']}" colspan="2">
        <span class="{$Style['medium']}">{$Globals['pp_lang']['check']}: <input type="checkbox" name="delete" value="yes" />
    </td>
    </tr>
PPPRINT;
}

echo<<<PPPRINT
    <tr>
    <td class="{$Style['tddetails']}" colspan="3" align="center">
        <input type="hidden" name="thiscat" value="$thiscat" />
        <input type="hidden" name="theuser" value="$theuser" />
        <input type="hidden" name="photo" value="$photo" />
PPPRINT;

if ($cedit == "") {
echo<<<PPPRINT
        <input type="hidden" name="post" value="new" />
        <input type="submit" value="{$Globals['pp_lang']['submitpost']}" />
PPPRINT;
}
else {
echo<<<PPPRINT
        <input type="hidden" name="comid" value="$cedit" />
        <input type="hidden" name="post" value="cedit" />
        <input type="submit" value="{$Globals['pp_lang']['submitedit']}" />
PPPRINT;
}

echo<<<PPPRINT
</td>
</tr>
$ppclose
</form><br />
<!-- END TEMPLATE: comments.tmpl -->
PPPRINT;

?>
