BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

quickreply.php 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * This version of #quickpostform is used in all subsections.
  5. * Instead of modifying multiple places, just modify this one.
  6. *
  7. * To include it in a section use this example.
  8. *
  9. * View::parse('generic/reply/quickreply.php', array(
  10. * 'InputTitle' => 'Post',
  11. * 'InputName' => 'thread',
  12. * 'InputID' => $ThreadID,
  13. * 'ForumID' => $ForumID,
  14. * 'TextareaCols' => 90
  15. * ));
  16. *
  17. * Note that InputName and InputID are the only required variables.
  18. * They're used to construct the $_POST.
  19. *
  20. * e.g.,
  21. * <input name="thread" value="123" />
  22. * <input name="groupid" value="321" />
  23. *
  24. * Globals are required as this template is included within a
  25. * function scope.
  26. *
  27. * To add a "Subscribe" box for non-forum pages (like artist/collage/...
  28. * comments), add a key 'SubscribeBox' to the array passed to View::parse.
  29. *
  30. * e.g.,
  31. * View::parse('generic/reply/quickreply.php', array(
  32. * 'InputTitle' => 'Comment',
  33. * 'InputName' => 'groupid',
  34. * 'InputID' => $GroupID,
  35. * 'TextareaCols' => 65,
  36. * 'SubscribeBox' => true
  37. * ));
  38. */
  39. global $HeavyInfo, $UserSubscriptions, $ThreadInfo, $Document;
  40. if (G::$LoggedUser['DisablePosting']) {
  41. return;
  42. }
  43. /*
  44. if (!isset($TextareaCols)) {
  45. $TextareaCols = 70;
  46. }
  47. */
  48. /*
  49. if (!isset($TextareaRows)) {
  50. $TextareaRows = 8;
  51. }
  52. */
  53. if (!isset($InputAction)) {
  54. $InputAction = 'reply';
  55. }
  56. if (!isset($InputTitle)) {
  57. $InputTitle = 'Comment';
  58. }
  59. ?>
  60. <div id="reply_box">
  61. <h3>
  62. <?=$InputTitle?>
  63. </h3>
  64. <div class="box pad">
  65. <form class="send_form" name="reply" id="quickpostform" <?=isset($Action)?'action="'.$Action.'"':''?>
  66. method="post"
  67. <?php if (!check_perms('users_mod')) { ?>
  68. onsubmit="quickpostform.submit_button.disabled = true;"
  69. <?php } ?>
  70. <?php if (!G::$LoggedUser['DisableAutoSave']) { ?>
  71. data-autosave-text="quickpost"
  72. <?php } ?>>
  73. <input type="hidden" name="action" value="<?=$InputAction?>" />
  74. <input type="hidden" name="auth"
  75. value="<?=G::$LoggedUser['AuthKey']?>" />
  76. <input type="hidden" name="<?=$InputName?>"
  77. data-autosave-id="<?=$InputID?>"
  78. value="<?=$InputID?>" />
  79. <div id="quickreplytext">
  80. <?php
  81. # Needs to come before, e.g., $ReplyText->getID()
  82. $ReplyText = new TEXTAREA_PREVIEW(
  83. $Name = 'body',
  84. $ID = 'quickpost',
  85. $Value = '',
  86. /*
  87. $Preview = false,
  88. $Buttons = false,
  89. $Buffer = true,
  90. $ExtraAttributes = [
  91. 'tabindex="1"',
  92. 'onkeyup="resize(\'quickpost\')"',
  93. ]
  94. */
  95. ); ?>
  96. <?=null#$ReplyText->getBuffer()?>
  97. </div>
  98. <!--
  99. Start moved stuff
  100. $ReplyText->getBuffer() seems broken with EasyMDE
  101. The new textarea needs to come before, e.g., $ReplyText->getID()
  102. -->
  103. <table class="forum_post box vertical_margin hidden preview_wrap"
  104. id="preview_wrap_<?=$ReplyText->getID()?>">
  105. <colgroup>
  106. <?php if (Users::has_avatars_enabled()) { ?>
  107. <col class="col_avatar" />
  108. <?php } ?>
  109. <col class="col_post_body" />
  110. </colgroup>
  111. <tr class="colhead_dark">
  112. <td colspan="<?=(Users::has_avatars_enabled() ? 2 : 1)?>">
  113. <div class="float_left">
  114. <a href="#quickreplypreview">#xyz</a>
  115. by <strong>
  116. <?=Users::format_username(G::$LoggedUser['ID'], true, true, true, true)?>
  117. </strong>
  118. Just now
  119. </div>
  120. <div class="float_right">
  121. <a href="#quickreplypreview" class="brackets">Report</a>
  122. &nbsp;
  123. <a href="#">&uarr;</a>
  124. </div>
  125. </td>
  126. </tr>
  127. <tr>
  128. <?php if (Users::has_avatars_enabled()) { ?>
  129. <td class="avatar valign_top">
  130. <?=
  131. Users::show_avatar(
  132. G::$LoggedUser['Avatar'],
  133. G::$LoggedUser['ID'],
  134. G::$LoggedUser['Username'],
  135. (!isset($HeavyInfo['DisableAvatars']) || $HeavyInfo['DisableAvatars'])
  136. )
  137. ?>
  138. </td>
  139. <?php } ?>
  140. <td class="body valign_top">
  141. <div id="contentpreview" style="text-align: left;">
  142. <div id="preview_<?=$ReplyText->getID()?>">
  143. </div>
  144. </div>
  145. </td>
  146. </tr>
  147. </table>
  148. <!-- End moved stuff -->
  149. <div class="preview_submit">
  150. <?php
  151. if (isset($SubscribeBox) && !isset($ForumID)
  152. && Subscriptions::has_subscribed_comments($Document, $InputID) === false) { ?>
  153. <input id="subscribebox" type="checkbox" name="subscribe" <?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?>
  154. tabindex="2" />
  155. <label for="subscribebox">Subscribe</label>
  156. <?php
  157. }
  158. // Forum thread logic
  159. // This might use some more abstraction
  160. if (isset($ForumID)) {
  161. if (!Subscriptions::has_subscribed($InputID)) { ?>
  162. <input id="subscribebox" type="checkbox" name="subscribe" <?=!empty($HeavyInfo['AutoSubscribe']) ? ' checked="checked"' : ''?>
  163. tabindex="2" />
  164. <label for="subscribebox">Subscribe</label>
  165. <?php
  166. }
  167. if ($ThreadInfo['LastPostAuthorID'] === G::$LoggedUser['ID']
  168. && (check_perms('site_forums_double_post'))) { ?>
  169. <input id="mergebox" type="checkbox" name="merge" tabindex="2" />
  170. <label for="mergebox">Merge</label>
  171. <?php
  172. }
  173. } ?>
  174. <input type="button" value="Preview"
  175. class="hidden button_preview_<?=$ReplyText->getID()?>"
  176. tabindex="1" />
  177. <input type="submit" class="button-primary" value="Post" id="submit_button" tabindex="1" />
  178. </div>
  179. </form>
  180. </div>
  181. </div>