Advertisement
Clauduke

Untitled

May 31st, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.19 KB | None | 0 0
  1. <?php
  2. // Do not delete these lines
  3. if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
  4. die ('Please do not load this page directly. Thanks!');
  5.  
  6. if ( post_password_required() ) { ?>
  7. <p class="nocomments"><?php echo get_option('ptthemes_password_protected_name'); ?></p>
  8. <?php
  9. return;
  10. }
  11. ?>
  12.  
  13. <!-- You can start editing here. -->
  14. <span id="commentarea"></span>
  15. <form method="post" name="correct_answer_frm" id="correct_answer_frm" action="<?php echo get_option('siteurl'); ?>/?ptype=add_comments">
  16. <div id="comments_wrap">
  17. <?php if ( have_comments() ) : ?>
  18.  
  19. <h3><?php echo $post->comment_count. ' '.__('Answers') //comments_number(); ?>
  20.  
  21.  
  22.  
  23. <?php
  24. if($_REQUEST['msg']=='selectans')
  25. {
  26. _e('Please select correct answer');
  27. }
  28. ?>
  29. </h3>
  30.  
  31.  
  32. <?php
  33. global $current_user,$post,$comment;
  34. //if($current_user->data->ID==$post->post_author)
  35. if($current_user->data->ID==$post->post_author || current_user_can('edit_post'))
  36. {
  37. ?>
  38. <script type="text/javascript">
  39. function select_as_best_answers(commentid)
  40. {
  41. document.location.href="<?php echo get_option('siteurl'); ?>/?ptype=add_comments&set_correct_answer=1&pid=<?php echo $post->ID?>&correct_answer="+commentid;
  42. }
  43. </script>
  44.  
  45.  
  46. <?php }?>
  47.  
  48. <ol class="commentlist">
  49.  
  50. <?php wp_list_comments('avatar_size=48&callback=custom_comment'); ?>
  51.  
  52. </ol>
  53.  
  54. <div class="navigation">
  55.  
  56. <div class="fl"><?php previous_comments_link() ?></div>
  57.  
  58. <div class="fr"><?php next_comments_link() ?></div>
  59.  
  60. <div class="fix"></div>
  61.  
  62. </div>
  63.  
  64. <br />
  65.  
  66. <?php if ( $comments_by_type['pings'] ) : ?>
  67.  
  68. <h3 id="pings"><?php echo get_option('comment_trackbacks_name'); ?></h3>
  69.  
  70. <ol class="commentlist">
  71.  
  72. <?php wp_list_comments('type=pings'); ?>
  73. </ol>
  74.  
  75. <?php endif; ?>
  76.  
  77. <?php else : // this is displayed if there are no comments so far ?>
  78.  
  79. <?php if ('open' == $post->comment_status) : ?>
  80. <!-- If comments are open, but there are no comments. -->
  81.  
  82. <?php else : // comments are closed ?>
  83.  
  84. <!-- If comments are closed. -->
  85. <p class="nocomments"><?php echo get_option('ptthemes_comment_closed_name'); ?></p>
  86.  
  87. <?php endif; ?>
  88.  
  89. <?php endif; ?>
  90.  
  91. </div> <!-- end #comments_wrap -->
  92. </form>
  93. <?php if ('open' == $post->comment_status) : ?>
  94.  
  95. <div id="respond">
  96.  
  97. <?php /*?> <h3><?php comment_form_title( ); ?></h3><?php */?>
  98.  
  99.  
  100. <h3><?php _e('Answer Question');?></h3>
  101. <div class="cancel-comment-reply">
  102.  
  103. <?php cancel_comment_reply_link(); ?>
  104.  
  105. </div>
  106.  
  107. <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
  108.  
  109. <p><?php echo get_option('ptthemes_comment_mustbe_name'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php echo get_option('ptthemes_comment_loggedin_name'); ?></a> <?php echo get_option('ptthemes_comment_postcomment_name'); ?></p>
  110.  
  111. <?php else : ?>
  112.  
  113. <form action="<?php echo get_option('siteurl'); ?>/?ptype=add_comments" method="post" id="commentform">
  114. <?php if ( $user_ID ) { ?>
  115. <p><?php _e('Loged in as - '); ?>
  116. <?php echo $user_identity; ?>
  117. <?php /*?>. <a href="<?php echo get_option('siteurl'); ?>/?ptype=login&action=logout" title="Log out of this account"><?php _e('Logout &raquo;');?></a></p><?php */?>
  118. <?php }?>
  119. <p class="clearfix"><textarea name="comment" id="comment" rows="10" cols="10" tabindex="4" class="textarea"></textarea></p>
  120.  
  121. <?php if (!$user_ID ) : ?>
  122. <p class="clearfix">
  123. <label > <?php _e("I'm")?></label>
  124. <input name="user_login_or_not" type="radio" value="existing_user" <?php if($user_login_or_not=='existing_user'){ echo 'checked="checked"';}?> checked onClick="set_login_registration_frm(this.value);" <?php if($_REQUEST['msg']=='log_err'){ echo 'checked="checked"';}?> class="radio" /> <span class="user_login"> <?php _e('Existing User');?> </span> <input name="user_login_or_not" type="radio" value="new_user" <?php if($user_login_or_not=='new_user'){ echo 'checked="checked"';}?> onClick="set_login_registration_frm(this.value);" <?php if($_REQUEST['msg']=='reg_err' || $_REQUEST['msg']=='regexist_err'){ echo 'checked="checked"';}?> class="radio" /> <span class="user_login"><?php _e('New User? Register Now');?> </span>
  125. </p>
  126.  
  127. <p class="clearfix" id="login_user_frm_id">
  128. <label > <?php _e('Email');?> <span class="indicates">*</span></label>
  129. <input type="text" name="log" id="user_log" class="textfield2" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
  130.  
  131. <label class="label_spacer" > <?php _e('Password');?> <span class="indicates">*</span></label>
  132. <input type="password" name="pwd" id="user_pass" class="textfield2" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
  133. </p>
  134.  
  135. <div id="contact_detail_id" style="display:none;">
  136. <p class="clearfix"><label for="author"> <?php if ($req) _e('Name'); ?> <span class="indicates">*</span> </label>
  137. <input type="text" name="user_fname" id="user_fname" class="textfield" value="<?php echo $user_fname; ?>" size="22" tabindex="1" />
  138. <?php
  139. if($_GET['msg']=='reg_err')
  140. {
  141. ?>
  142. <span class="error_msg que_error_msg">
  143. <?php
  144. if($_GET['msg1']=='name_empty')
  145. {
  146. _e('Please Enter Name');
  147. }?></span>
  148. <?php
  149. }
  150. ?>
  151. </p>
  152.  
  153. <p class="clearfix">
  154. <label for="email"> <?php if ($req) _e('Email'); ?> <span class="indicates">*</span> </label>
  155. <input type="text" name="user_email" id="user_email" class="textfield" value="<?php echo $user_email; ?>" size="22" tabindex="2" />
  156. <?php
  157. if($_GET['msg']=='reg_err' || $_GET['msg']=='regexist_err')
  158. {
  159. ?>
  160. <span class="error_msg que_error_msg">
  161. <?php
  162. if($_GET['msg1']=='em_empty')
  163. {
  164. _e('Please Enter Email');
  165. }else
  166. if($_GET['msg1']=='em_exist')
  167. {
  168. _e('E-mail already exist or wrong E-mail, please select different one');
  169. }
  170. if($_GET['msg']=='regexist_err')
  171. {
  172. _e('E-mail already exist or wrong E-mail, please select different one');
  173. }
  174. ?></span>
  175. <?php
  176. }
  177. ?>
  178. </p>
  179.  
  180. <p class="clearfix">
  181. <label for="url"> <?php _e('Password');?> <span class="indicates">*</span></label>
  182. <input type="password" name="user_pwd" id="user_pwd" class="textfield" value="<?php echo $user_pwd; ?>" size="22" tabindex="3" />
  183. <?php
  184. if($_GET['msg']=='reg_err')
  185. {
  186. ?>
  187. <span class="error_msg que_error_msg">
  188. <?php
  189. if($_GET['msg1']=='pw_empty')
  190. {
  191. _e('Please Enter Password');
  192. }else
  193. if($_GET['msg1']=='pw_min')
  194. {
  195. _e('Password should be minimum of 5 characters');
  196. }?></span>
  197. <?php
  198. }
  199. ?>
  200. </p>
  201. </div>
  202. <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/question_validation.js"></script>
  203. <script language="javascript" type="text/javascript">
  204. <?php
  205. if($_REQUEST['msg']=='log_err' || $_REQUEST['msg']=='reg_err' || $_REQUEST['msg']=='regexist_err')
  206. {
  207. if($_REQUEST['msg']=='log_err')
  208. {
  209. ?>
  210. set_login_registration_frm('existing_user');
  211. <?php
  212. }else
  213. {
  214. ?>
  215. set_login_registration_frm('new_user');
  216. <?php
  217. }
  218. }
  219. ?>
  220. </script>
  221. <?php endif; ?>
  222. <div class="aleft" > <input name="submit" type="submit" id="submit" class="<?php if ( $user_ID ) { echo 'spacer';} ?>" value="" />
  223. <?php comment_id_fields(); ?>
  224.  
  225. </div>
  226.  
  227. <?php do_action('comment_form', $post->ID); ?>
  228.  
  229. </form>
  230.  
  231. <?php endif; // If logged in ?>
  232.  
  233. <div class="fix"></div>
  234.  
  235. </div> <!-- end #respond -->
  236.  
  237. <?php endif; // if you delete this the sky will fall on your head ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement