<?php
// Do not delete these lines
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
	die ( __('Please do not load this page directly. Thanks!') );

if (!empty($post->post_password)) { // if there's a password
	if ($_COOKIE['wp-postpass_'.$cookiehash] != $post->post_password) {  // and it doesn't match the cookie
		?>

		<p class="nocomments"><?php _e("This post is password protected. Enter the password to view comments."); ?><p>

		<?php
		return;
	}
}
?>

<?php if ($comments) : ?>
<ol class="commentlist">

<?php foreach ($comments as $comment) : ?>
	<li id="comment-<?php comment_ID() ?>" <?php if(function_exists('highlight_comment')) highlight_comment(); ?>>
	<span class="posted"><?php comment_author_link() ?> در 
	<a href="<?php the_permalink() ?>#comment-<?php comment_ID() ?>" title=""><?php comment_date('j M Y') ?> در <?php comment_time() ?></a> <?php if (function_exists('quote_comment')) { quote_comment(); } ?> گفته است : 
	<?php edit_comment_link('Edit', $before = ' | '); ?></span>
	<?php comment_text() ?>
	</li>

<?php endforeach; /* end for each comment */ ?>

</ol>

<?php endif; ?>

<?php if ('open' == $post-> comment_status) :

// check if comments need registration and if user is logged in
if ( get_option('comment_registration') && !$user_ID ) : ?>
<p><a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">Log in</a> to post a comment.</p>

<?php
else :

if (function_exists('bnCommentPreviewValidate')) {
	bnCommentPreviewValidate(); // draws the code for the comments form from the ComPreVal plugin
} else { // 'normal' comments form without preview
?>

<div id="postcomment">
<h3 id="respond"></h3>

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<p><label for="comment">نوشتن نظر : </label>
<textarea name="comment" id="comment" cols="50" rows="10"></textarea></p>

<?php if ( $user_ID ) : ?>
<p>وارد شده با نام کاربری  <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">[خروج]</a></p>
<?php else : ?>

<p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" />
&nbsp;<label for="author">نام<?php if ($req) _e('(*)'); ?></label></p>
<p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" />
&nbsp;<label for="email">ایمیل<?php if ($req) _e('(*)'); ?></label></p>
<p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" />
&nbsp;<label for="url">آدرس سایت</label></p>

<?php endif; ?>

<p><input name="submitComment" type="submit" id="submitComment" value="ارسال دیدگاه" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /></p>
<?php do_action('comment_form', $post->ID); ?>
</form>
</div>
<?php } ?>

<?php endif; // if registration required and not logged in ?>
<center>
<?php comments_rss_link('[ RSS نظرات این نوشته ]'); ?>
<?php
if('open' == $post->ping_status) {	
?>
<a href="<?php trackback_url(true); ?>" rel="trackback" title="Trackback URL"> - [ ارسال بازتاب ]</a>
<?php } ?></center>

<?php else : // if comments are closed ?>

	<p class="nocomments">نظرات بسته می باشد.</p>

<?php endif; ?>
