Guest User

Untitled

a guest
Mar 5th, 2016
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. <?php
  2. if (!defined('init_pages'))
  3. {
  4. header('HTTP/1.0 404 not found');
  5. exit;
  6. }
  7.  
  8. $CORE->loggedInOrReturn();
  9.  
  10. $quote = isset($_GET['quote']) ? (int)$_GET['quote'] : false;
  11.  
  12. if (!($topicId = WCF::getLastViewedTopic()))
  13. {
  14. WCF::SetupNotification('Please make sure you are in a valid topic before posting.');
  15. header("Location: ".$config['BaseURL']."/forums.php");
  16. die;
  17. }
  18.  
  19. //Set the title
  20. $TPL->SetTitle('Reply to Topic');
  21. $TPL->SetParameter('topbar', true);
  22. //Print the header
  23. $TPL->LoadHeader();
  24.  
  25. if ($topic = WCF::getTopicInfo($topicId))
  26. {
  27. if ($forum = WCF::getForumInfo($topic['forum']))
  28. {
  29. if ($catName = WCF::getCategoryName($forum['category']))
  30. {
  31. $forum['category_name'] = $catName;
  32. }
  33. else
  34. {
  35. $forum['category_name'] = 'Unknown';
  36. }
  37. unset($catName);
  38. }
  39. }
  40.  
  41. ?>
  42.  
  43. <!--<a href="#" class="important_notice"><p>Please read and accept the rules and regulations before communicating with other members!</p></a>-->
  44.  
  45. <div class="page-header-navigation">
  46. <a href="<?php echo $config['BaseURL'], '/forums.php'; ?>">Board Index</a>
  47. <?php
  48. if ($topic && $forum)
  49. {
  50. echo '
  51. <a href="', $config['BaseURL'], '/forums.php?category=', $forum['category'], '">', WCF::parseTitle($forum['category_name']), '</a>
  52. <a href="', $config['BaseURL'], '/forums.php?page=forum&id=', $forum['id'], '">', WCF::parseTitle($forum['name']), '</a>
  53. <a href="', $config['BaseURL'], '/forums.php?page=topic&id=', $topic['id'], '">', WCF::parseTitle($topic['name']), '</a>';
  54. }
  55. ?>
  56. </div>
  57.  
  58. <div class="container main-wide">
  59. <div class="forum-padding">
  60.  
  61. <div class="forum_header">
  62.  
  63. <div class="new_title">
  64. <p>Topic Reply</p>
  65. <div></div>
  66. </div>
  67.  
  68. <?php
  69. if ($topic)
  70. {
  71. echo '
  72. <div class="topic_title">
  73. <h1>', WCF::parseTitle($topic['name']), '</h1>
  74. <h3>', $topic['added'], '</h3>
  75. </div>';
  76. }
  77. ?>
  78.  
  79. </div>
  80.  
  81. <?php
  82. if ($error = $ERRORS->DoPrint('post_reply', true))
  83. {
  84. echo '<div class="alerts-container">', $error, '</div>';
  85. }
  86. unset($error);
  87. ?>
  88.  
  89. <form method="post" action="<?php echo $config['BaseURL']; ?>/execute.php?take=post_reply" class="post_topic_reply" name="post_reply">
  90.  
  91. <label>
  92. <p>Reply title</p>
  93. <input name="title" type="text" maxlength="150" value="<?php echo ($topic ? 'Re: ' . WCF::parseTitle($topic['name']) : ''); ?>" />
  94. </label>
  95.  
  96. <label>
  97. <p>Reply text</p>
  98. <?php
  99. echo '<textarea name="text" class="bbcode">';
  100.  
  101. //Check if we're quoting somebody
  102. if ($quote)
  103. {
  104. //Try getting info about the post
  105. if ($QuoteInfo = WCF::getQuoteInfo($quote))
  106. {
  107. echo '[quote=', $QuoteInfo['author'], ']', $QuoteInfo['text'], '[/quote]', "\n\r";
  108. }
  109. }
  110.  
  111. echo '</textarea>';
  112. ?>
  113. </label>
  114.  
  115. <input type="hidden" value="<?php echo $topicId; ?>" name="topic" />
  116.  
  117. <div><?php
  118. error_reporting(0);
  119. $serveradress ='localhost';
  120. $serverusername = 'root';
  121. $serverpassword = 'ascent';
  122. $serverdatabase = 'warcry';
  123.  
  124. $connect = mysql_connect("$serveradress", "$serverusername", "$serverpassword")
  125. OR die(mysql_error());
  126. mysql_select_db("$serverdatabase", $connect);
  127. //ALWAYS ESCAPE STRINGS IF YOU HAVE RECEIVED THEM FROM USERS
  128. //FIND AND GET THE ROW
  129. $q = mysql_query("SELECT * FROM wcf_topics WHERE id = $topicId") or die(mysql_error());
  130.  
  131. $result = mysql_fetch_array($q);
  132.  
  133. if ($result['lock'] != 0)
  134. {
  135. echo("Topic is locked, you cant reply");
  136. }
  137. else {
  138. echo'<input type="submit" value="Post Reply" />';
  139. }
  140. ?>
  141.  
  142.  
  143.  
  144. <?php
  145. //Should we enable staff posting
  146. if ($CURUSER->getRank()->int() >= RANK_STAFF_MEMBER)
  147. {
  148. echo '
  149. <div style="display: inline-block; padding: 15px 0 0 15px;">
  150. <label class="label_check" for="staff_post">
  151. <div></div>
  152. <input type="checkbox" value="1" checked="checked" id="staff_post" name="staff_post" />
  153. <p style="margin: 5px 0 0 0;">Staff Post</p>
  154. </label>
  155. </div>';
  156. }
  157. ?>
  158. </div>
  159.  
  160. </form>
  161.  
  162. </div>
  163. </div>
  164.  
  165. <script>
  166. $(document).ready(function()
  167. {
  168. $("textarea.bbcode").sceditor({
  169. plugins: 'bbcode',
  170. style: 'template/style/bbcode-default-iframe.css'
  171. });
  172.  
  173. <?php
  174. if ($formData = $ERRORS->multipleError_accessFormData('post_reply'))
  175. {
  176. echo '
  177. var savedFormData = $.parseJSON(', json_encode(json_encode($formData)), ');
  178. restoreFormData(\'post_reply\', savedFormData);';
  179. }
  180. unset($formData);
  181. ?>
  182. });
  183. </script>
  184.  
  185. <?php
  186.  
  187. //Add some javascripts to the loader
  188. $TPL->AddFooterJs('template/js/sceditor/jquery.sceditor.js');
  189. $TPL->AddFooterJs('template/js/sceditor/jquery.sceditor.bbcode.js');
  190. $TPL->AddFooterJs('template/js/forms.js');
  191. //Print the footer
  192. $TPL->LoadFooter();
  193.  
  194. ?>
Add Comment
Please, Sign In to add comment