Oppaitime'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.4KB

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