Post.template.php 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2012 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // The main template for the post page.
  13. function template_main()
  14. {
  15. global $context, $settings, $options, $txt, $scripturl, $modSettings, $counter;
  16. // Start the javascript... and boy is there a lot.
  17. echo '
  18. <script type="text/javascript"><!-- // --><![CDATA[';
  19. // When using Go Back due to fatal_error, allow the form to be re-submitted with changes.
  20. if (isBrowser('is_firefox'))
  21. echo '
  22. window.addEventListener("pageshow", reActivate, false);';
  23. // Start with message icons - and any missing from this theme.
  24. echo '
  25. var icon_urls = {';
  26. foreach ($context['icons'] as $icon)
  27. echo '
  28. \'', $icon['value'], '\': \'', $icon['url'], '\'', $icon['is_last'] ? '' : ',';
  29. echo '
  30. };';
  31. // If this is a poll - use some javascript to ensure the user doesn't create a poll with illegal option combinations.
  32. if ($context['make_poll'])
  33. echo '
  34. var pollOptionNum = 0, pollTabIndex;
  35. var pollOptionId = ', $context['last_choice_id'], ';
  36. function addPollOption()
  37. {
  38. if (pollOptionNum == 0)
  39. {
  40. for (var i = 0, n = document.forms.postmodify.elements.length; i < n; i++)
  41. if (document.forms.postmodify.elements[i].id.substr(0, 8) == \'options-\')
  42. {
  43. pollOptionNum++;
  44. pollTabIndex = document.forms.postmodify.elements[i].tabIndex;
  45. }
  46. }
  47. pollOptionNum++
  48. pollOptionId++
  49. setOuterHTML(document.getElementById(\'pollMoreOptions\'), ', JavaScriptEscape('<li><label for="options-'), ' + pollOptionId + ', JavaScriptEscape('">' . $txt['option'] . ' '), ' + pollOptionNum + ', JavaScriptEscape('</label>: <input type="text" name="options['), ' + pollOptionId + ', JavaScriptEscape(']" id="options-'), ' + pollOptionId + ', JavaScriptEscape('" value="" size="80" maxlength="255" tabindex="'), ' + pollTabIndex + ', JavaScriptEscape('" class="input_text" /></li><li id="pollMoreOptions"></li>'), ');
  50. }';
  51. // If we are making a calendar event we want to ensure we show the current days in a month etc... this is done here.
  52. if ($context['make_event'])
  53. echo '
  54. var monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];';
  55. // End of the javascript, start the form and display the link tree.
  56. echo '
  57. // ]]></script>
  58. <form action="', $scripturl, '?action=', $context['destination'], ';', empty($context['current_board']) ? '' : 'board=' . $context['current_board'], '" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="', ($context['becomes_approved'] ? '' : 'alert(\'' . $txt['js_post_will_require_approval'] . '\');'), 'submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'', $context['post_box_name'], '\', \'guestname\', \'evtitle\', \'question\'], \'options\');" enctype="multipart/form-data">';
  59. // If the user wants to see how their message looks - the preview section is where it's at!
  60. echo '
  61. <div id="preview_section"', isset($context['preview_message']) ? '' : ' style="display: none;"', '>
  62. <div class="cat_bar">
  63. <h3 class="catbg">
  64. <span id="preview_subject">', empty($context['preview_subject']) ? '' : $context['preview_subject'], '</span>
  65. </h3>
  66. </div>
  67. <div class="windowbg">
  68. <div class="content">
  69. <div class="post" id="preview_body">
  70. ', empty($context['preview_message']) ? '<br />' : $context['preview_message'], '
  71. </div>
  72. </div>
  73. </div>
  74. </div><br />';
  75. if ($context['make_event'] && (!$context['event']['new'] || !empty($context['current_board'])))
  76. echo '
  77. <input type="hidden" name="eventid" value="', $context['event']['id'], '" />';
  78. // Start the main table.
  79. echo '
  80. <div class="cat_bar">
  81. <h3 class="catbg">', $context['page_title'], '</h3>
  82. </div>
  83. <div>
  84. <div class="roundframe">', isset($context['current_topic']) ? '
  85. <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '';
  86. // If an error occurred, explain what happened.
  87. echo '
  88. <div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']) ? ' style="display: none"' : '', ' id="errors">
  89. <dl>
  90. <dt>
  91. <strong id="error_serious">', $txt['error_while_submitting'], '</strong>
  92. </dt>
  93. <dd class="error" id="error_list">
  94. ', empty($context['post_error']) ? '' : implode('<br />', $context['post_error']), '
  95. </dd>
  96. </dl>
  97. </div>';
  98. // If this won't be approved let them know!
  99. if (!$context['becomes_approved'])
  100. {
  101. echo '
  102. <p class="information">
  103. <em>', $txt['wait_for_approval'], '</em>
  104. <input type="hidden" name="not_approved" value="1" />
  105. </p>';
  106. }
  107. // If it's locked, show a message to warn the replyer.
  108. echo '
  109. <p class="information"', $context['locked'] ? '' : ' style="display: none"', ' id="lock_warning">
  110. ', $txt['topic_locked_no_reply'], '
  111. </p>';
  112. if (!empty($modSettings['drafts_post_enabled']))
  113. echo '
  114. <div id="draft_section" class="infobox"', isset($context['draft_saved']) ? '' : ' style="display: none;"', '>',
  115. sprintf($txt['draft_saved'], $scripturl . '?action=profile;u=' . $context['user']['id'] . ';area=showdrafts'), '
  116. </div>';
  117. // The post header... important stuff
  118. echo '
  119. <dl id="post_header">';
  120. // Guests have to put in their name and email...
  121. if (isset($context['name']) && isset($context['email']))
  122. {
  123. echo '
  124. <dt>
  125. <span', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) || isset($context['post_error']['bad_name']) ? ' class="error"' : '', ' id="caption_guestname">', $txt['name'], ':</span>
  126. </dt>
  127. <dd>
  128. <input type="text" name="guestname" size="25" value="', $context['name'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  129. </dd>';
  130. if (empty($modSettings['guest_post_no_email']))
  131. echo '
  132. <dt>
  133. <span', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' class="error"' : '', ' id="caption_email">', $txt['email'], ':</span>
  134. </dt>
  135. <dd>
  136. <input type="text" name="email" size="25" value="', $context['email'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  137. </dd>';
  138. }
  139. // Now show the subject box for this post.
  140. echo '
  141. <dt class="clear">
  142. <span', isset($context['post_error']['no_subject']) ? ' class="error"' : '', ' id="caption_subject">', $txt['subject'], ':</span>
  143. </dt>
  144. <dd>
  145. <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' tabindex="', $context['tabindex']++, '" size="80" maxlength="80"', isset($context['post_error']['no_subject']) ? ' class="error"' : ' class="input_text"', '/>
  146. </dd>
  147. <dt class="clear_left">
  148. ', $txt['message_icon'], ':
  149. </dt>
  150. <dd>
  151. <select name="icon" id="icon" onchange="showimage()">';
  152. // Loop through each message icon allowed, adding it to the drop down list.
  153. foreach ($context['icons'] as $icon)
  154. echo '
  155. <option value="', $icon['value'], '"', $icon['value'] == $context['icon'] ? ' selected="selected"' : '', '>', $icon['name'], '</option>';
  156. echo '
  157. </select>
  158. <img src="', $context['icon_url'], '" name="icons" hspace="15" alt="" />
  159. </dd>
  160. </dl>
  161. <hr class="clear" />';
  162. // Are you posting a calendar event?
  163. if ($context['make_event'])
  164. {
  165. echo '
  166. <div id="post_event">
  167. <fieldset id="event_main">
  168. <legend><span', isset($context['post_error']['no_event']) ? ' class="error"' : '', ' id="caption_evtitle">', $txt['calendar_event_title'], '</span></legend>
  169. <input type="text" name="evtitle" maxlength="255" size="55" value="', $context['event']['title'], '" tabindex="', $context['tabindex']++, '" class="input_text" />
  170. <div class="smalltext" style="white-space: nowrap;">
  171. <input type="hidden" name="calendar" value="1" />', $txt['calendar_year'], '
  172. <select name="year" id="year" tabindex="', $context['tabindex']++, '" onchange="generateDays();">';
  173. // Show a list of all the years we allow...
  174. for ($year = $modSettings['cal_minyear']; $year <= $modSettings['cal_maxyear']; $year++)
  175. echo '
  176. <option value="', $year, '"', $year == $context['event']['year'] ? ' selected="selected"' : '', '>', $year, '&nbsp;</option>';
  177. echo '
  178. </select>
  179. ', $txt['calendar_month'], '
  180. <select name="month" id="month" onchange="generateDays();">';
  181. // There are 12 months per year - ensure that they all get listed.
  182. for ($month = 1; $month <= 12; $month++)
  183. echo '
  184. <option value="', $month, '"', $month == $context['event']['month'] ? ' selected="selected"' : '', '>', $txt['months'][$month], '&nbsp;</option>';
  185. echo '
  186. </select>
  187. ', $txt['calendar_day'], '
  188. <select name="day" id="day">';
  189. // This prints out all the days in the current month - this changes dynamically as we switch months.
  190. for ($day = 1; $day <= $context['event']['last_day']; $day++)
  191. echo '
  192. <option value="', $day, '"', $day == $context['event']['day'] ? ' selected="selected"' : '', '>', $day, '&nbsp;</option>';
  193. echo '
  194. </select>
  195. </div>
  196. </fieldset>';
  197. if (!empty($modSettings['cal_allowspan']) || ($context['event']['new'] && $context['is_new_post']))
  198. {
  199. echo '
  200. <fieldset id="event_options">
  201. <legend>', $txt['calendar_event_options'], '</legend>
  202. <div class="event_options smalltext">
  203. <ul class="event_options">';
  204. // If events can span more than one day then allow the user to select how long it should last.
  205. if (!empty($modSettings['cal_allowspan']))
  206. {
  207. echo '
  208. <li>
  209. ', $txt['calendar_numb_days'], '
  210. <select name="span">';
  211. for ($days = 1; $days <= $modSettings['cal_maxspan']; $days++)
  212. echo '
  213. <option value="', $days, '"', $days == $context['event']['span'] ? ' selected="selected"' : '', '>', $days, '&nbsp;</option>';
  214. echo '
  215. </select>
  216. </li>';
  217. }
  218. // If this is a new event let the user specify which board they want the linked post to be put into.
  219. if ($context['event']['new'] && $context['is_new_post'])
  220. {
  221. echo '
  222. <li>
  223. ', $txt['calendar_post_in'], '
  224. <select name="board">';
  225. foreach ($context['event']['categories'] as $category)
  226. {
  227. echo '
  228. <optgroup label="', $category['name'], '">';
  229. foreach ($category['boards'] as $board)
  230. echo '
  231. <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['child_level'] > 0 ? str_repeat('==', $board['child_level'] - 1) . '=&gt;' : '', ' ', $board['name'], '&nbsp;</option>';
  232. echo '
  233. </optgroup>';
  234. }
  235. echo '
  236. </select>
  237. </li>';
  238. }
  239. echo '
  240. </ul>
  241. </div>
  242. </fieldset>';
  243. }
  244. echo '
  245. </div>';
  246. }
  247. // If this is a poll then display all the poll options!
  248. if ($context['make_poll'])
  249. {
  250. echo '
  251. <div id="edit_poll">
  252. <fieldset id="poll_main">
  253. <legend><span ', (isset($context['poll_error']['no_question']) ? ' class="error"' : ''), '>', $txt['poll_question'], '</span></legend>
  254. <input type="text" name="question" value="', isset($context['question']) ? $context['question'] : '', '" tabindex="', $context['tabindex']++, '" size="80" class="input_text" />
  255. <ul class="poll_main">';
  256. // Loop through all the choices and print them out.
  257. foreach ($context['choices'] as $choice)
  258. {
  259. echo '
  260. <li>
  261. <label for="options-', $choice['id'], '">', $txt['option'], ' ', $choice['number'], '</label>:
  262. <input type="text" name="options[', $choice['id'], ']" id="options-', $choice['id'], '" value="', $choice['label'], '" tabindex="', $context['tabindex']++, '" size="80" maxlength="255" class="input_text" />
  263. </li>';
  264. }
  265. echo '
  266. <li id="pollMoreOptions"></li>
  267. </ul>
  268. <strong><a href="javascript:addPollOption(); void(0);">(', $txt['poll_add_option'], ')</a></strong>
  269. </fieldset>
  270. <fieldset id="poll_options">
  271. <legend>', $txt['poll_options'], '</legend>
  272. <dl class="settings poll_options">
  273. <dt>
  274. <label for="poll_max_votes">', $txt['poll_max_votes'], ':</label>
  275. </dt>
  276. <dd>
  277. <input type="text" name="poll_max_votes" id="poll_max_votes" size="2" value="', $context['poll_options']['max_votes'], '" class="input_text" />
  278. </dd>
  279. <dt>
  280. <label for="poll_expire">', $txt['poll_run'], ':</label><br />
  281. <em class="smalltext">', $txt['poll_run_limit'], '</em>
  282. </dt>
  283. <dd>
  284. <input type="text" name="poll_expire" id="poll_expire" size="2" value="', $context['poll_options']['expire'], '" onchange="pollOptions();" maxlength="4" class="input_text" /> ', $txt['days_word'], '
  285. </dd>
  286. <dt>
  287. <label for="poll_change_vote">', $txt['poll_do_change_vote'], ':</label>
  288. </dt>
  289. <dd>
  290. <input type="checkbox" id="poll_change_vote" name="poll_change_vote"', !empty($context['poll']['change_vote']) ? ' checked="checked"' : '', ' class="input_check" />
  291. </dd>';
  292. if ($context['poll_options']['guest_vote_enabled'])
  293. echo '
  294. <dt>
  295. <label for="poll_guest_vote">', $txt['poll_guest_vote'], ':</label>
  296. </dt>
  297. <dd>
  298. <input type="checkbox" id="poll_guest_vote" name="poll_guest_vote"', !empty($context['poll_options']['guest_vote']) ? ' checked="checked"' : '', ' class="input_check" />
  299. </dd>';
  300. echo '
  301. <dt>
  302. ', $txt['poll_results_visibility'], ':
  303. </dt>
  304. <dd>
  305. <input type="radio" name="poll_hide" id="poll_results_anyone" value="0"', $context['poll_options']['hide'] == 0 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_anyone">', $txt['poll_results_anyone'], '</label><br />
  306. <input type="radio" name="poll_hide" id="poll_results_voted" value="1"', $context['poll_options']['hide'] == 1 ? ' checked="checked"' : '', ' class="input_radio" /> <label for="poll_results_voted">', $txt['poll_results_voted'], '</label><br />
  307. <input type="radio" name="poll_hide" id="poll_results_expire" value="2"', $context['poll_options']['hide'] == 2 ? ' checked="checked"' : '', empty($context['poll_options']['expire']) ? 'disabled="disabled"' : '', ' class="input_radio" /> <label for="poll_results_expire">', $txt['poll_results_after'], '</label>
  308. </dd>
  309. </dl>
  310. </fieldset>
  311. </div>';
  312. }
  313. // Show the actual posting area...
  314. echo '
  315. ', template_control_richedit($context['post_box_name'], 'smileyBox_message', 'bbcBox_message');
  316. // If this message has been edited in the past - display when it was.
  317. if (isset($context['last_modified']))
  318. echo '
  319. <div class="padding smalltext">
  320. ', $context['last_modified_text'], '
  321. </div>';
  322. // If the admin has enabled the hiding of the additional options - show a link and image for it.
  323. if (!empty($settings['additional_options_collapsable']))
  324. echo '
  325. <div id="postAdditionalOptionsHeader" class="title_bar">
  326. <h4 class="titlebg">
  327. <img id="postMoreExpand" class="panel_toggle" style="display: none;" src="', $settings['images_url'], '/collapse.png" alt="-" /> <strong><a href="#" id="postMoreExpandLink">', $context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt'], '</a></strong>
  328. </h4>
  329. </div>';
  330. // Display the check boxes for all the standard options - if they are available to the user!
  331. echo '
  332. <div id="postMoreOptions" class="smalltext">
  333. <ul class="post_options">
  334. ', $context['can_notify'] ? '<li><input type="hidden" name="notify" value="0" /><label for="check_notify"><input type="checkbox" name="notify" id="check_notify"' . ($context['notify'] || !empty($options['auto_notify']) ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['notify_replies'] . '</label></li>' : '', '
  335. ', $context['can_lock'] ? '<li><input type="hidden" name="lock" value="0" /><label for="check_lock"><input type="checkbox" name="lock" id="check_lock"' . ($context['locked'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['lock_topic'] . '</label></li>' : '', '
  336. <li><label for="check_back"><input type="checkbox" name="goback" id="check_back"' . ($context['back_to_topic'] || !empty($options['return_to_post']) ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['back_to_topic'] . '</label></li>
  337. ', $context['can_sticky'] ? '<li><input type="hidden" name="sticky" value="0" /><label for="check_sticky"><input type="checkbox" name="sticky" id="check_sticky"' . ($context['sticky'] ? ' checked="checked"' : '') . ' value="1" class="input_check" /> ' . $txt['sticky_after'] . '</label></li>' : '', '
  338. <li><label for="check_smileys"><input type="checkbox" name="ns" id="check_smileys"', $context['use_smileys'] ? '' : ' checked="checked"', ' value="NS" class="input_check" /> ', $txt['dont_use_smileys'], '</label></li>', '
  339. ', $context['can_move'] ? '<li><input type="hidden" name="move" value="0" /><label for="check_move"><input type="checkbox" name="move" id="check_move" value="1" class="input_check" ' . (!empty($context['move']) ? 'checked="checked" ' : '') . '/> ' . $txt['move_after2'] . '</label></li>' : '', '
  340. ', $context['can_announce'] && $context['is_first_post'] ? '<li><label for="check_announce"><input type="checkbox" name="announce_topic" id="check_announce" value="1" class="input_check" ' . (!empty($context['announce']) ? 'checked="checked" ' : '') . '/> ' . $txt['announce_topic'] . '</label></li>' : '', '
  341. ', $context['show_approval'] ? '<li><label for="approve"><input type="checkbox" name="approve" id="approve" value="2" class="input_check" ' . ($context['show_approval'] === 2 ? 'checked="checked"' : '') . ' /> ' . $txt['approve_this_post'] . '</label></li>' : '', '
  342. </ul>
  343. </div>';
  344. // If this post already has attachments on it - give information about them.
  345. if (!empty($context['current_attachments']))
  346. {
  347. echo '
  348. <dl id="postAttachment">
  349. <dt>
  350. ', $txt['attached'], ':
  351. </dt>
  352. <dd class="smalltext">
  353. <input type="hidden" name="attach_del[]" value="0" />
  354. ', $txt['uncheck_unwatchd_attach'], ':
  355. </dd>';
  356. foreach ($context['current_attachments'] as $attachment)
  357. echo '
  358. <dd class="smalltext">
  359. <label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''),
  360. !empty($modSettings['attachmentPostLimit']) || !empty($modSettings['attachmentSizeLimit']) ? sprintf($txt['attach_kb'], comma_format(round(max($attachment['size'], 1028) / 1028), 0)) : '', '</label>
  361. </dd>';
  362. if (!empty($context['files_in_session_warning']))
  363. echo '
  364. <dd class="smalltext">', $context['files_in_session_warning'], '</dd>';
  365. echo '
  366. </dl>';
  367. }
  368. // Is the user allowed to post any additional ones? If so give them the boxes to do it!
  369. if ($context['can_post_attachment'])
  370. {
  371. echo '
  372. <dl id="postAttachment2">';
  373. // But, only show them if they haven't reached a limit. Or a mod author hasn't hidden them.
  374. if ($context['num_allowed_attachments'] > 0 || !empty($context['dont_show_them']))
  375. {
  376. echo '
  377. <dt>
  378. ', $txt['attach'], ':
  379. </dt>
  380. <dd class="smalltext">
  381. ', empty($modSettings['attachmentSizeLimit']) ? '' : ('<input type="hidden" name="MAX_FILE_SIZE" value="' . $modSettings['attachmentSizeLimit'] * 1028 . '" />'), '
  382. <input type="file" size="60" multiple="multiple" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';
  383. // Show more boxes if they aren't approaching that limit.
  384. if ($context['num_allowed_attachments'] > 1)
  385. echo '
  386. <script type="text/javascript"><!-- // --><![CDATA[
  387. var allowed_attachments = ', $context['num_allowed_attachments'], ';
  388. var current_attachment = 1;
  389. function addAttachment()
  390. {
  391. allowed_attachments = allowed_attachments - 1;
  392. current_attachment = current_attachment + 1;
  393. if (allowed_attachments <= 0)
  394. return alert("', $txt['more_attachments_error'], '");
  395. setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\' + current_attachment + \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\' + current_attachment + \'\\\');">', $txt['clean_attach'], '<\/a>)\' + \'<\/dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\' + \'/a><\' + \'/dd>\');
  396. return true;
  397. }
  398. // ]]></script>
  399. </dd>
  400. <dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';
  401. else
  402. echo '
  403. </dd>';
  404. }
  405. // Add any template changes for an alternative upload system here.
  406. call_integration_hook('integrate_upload_template');
  407. echo '
  408. <dd class="smalltext">';
  409. // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
  410. if (!empty($modSettings['attachmentCheckExtensions']))
  411. echo '
  412. ', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br />';
  413. if (!empty($context['attachment_restrictions']))
  414. echo '
  415. ', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br />';
  416. if ($context['num_allowed_attachments'] == 0)
  417. echo '
  418. ', $txt['attach_limit_nag'], '<br />';
  419. if (!$context['can_post_attachment_unapproved'])
  420. echo '
  421. <span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br />';
  422. echo '
  423. </dd>
  424. </dl>';
  425. }
  426. // If the admin enabled the drafts feature, show a draft selection box
  427. if (!empty($modSettings['drafts_enabled']) && !empty($context['drafts']) && !empty($options['drafts_show_saved_enabled']))
  428. {
  429. echo '
  430. <br />
  431. <div id="postDraftOptionsHeader" class="title_bar">
  432. <h4 class="titlebg">
  433. <img id="postDraftExpand" class="panel_toggle" style="display: none;" src="', $settings['images_url'], '/collapse.png" alt="-" /> <strong><a href="#" id="postDraftExpandLink">', $txt['draft_load'], '</a></strong>
  434. </h4>
  435. </div>
  436. <div id="postDraftOptions" class="load_drafts padding">
  437. <dl class="settings">
  438. <dt><strong>', $txt['subject'], '</strong></dt>
  439. <dd><strong>', $txt['draft_saved_on'], '</strong></dd>';
  440. foreach ($context['drafts'] as $draft)
  441. echo '
  442. <dt>', $draft['link'], '</dt>
  443. <dd>', $draft['poster_time'], '</dd>';
  444. echo '
  445. </dl>
  446. </div>';
  447. }
  448. // Is visual verification enabled?
  449. if ($context['require_verification'])
  450. {
  451. echo '
  452. <div class="post_verification">
  453. <span', !empty($context['post_error']['need_qr_verification']) ? ' class="error"' : '', '>
  454. <strong>', $txt['verification'], ':</strong>
  455. </span>
  456. ', template_control_verification($context['visual_verification_id'], 'all'), '
  457. </div>';
  458. }
  459. // Finally, the submit buttons.
  460. echo '
  461. <br class="clear_right" />
  462. <span id="post_confirm_buttons">
  463. ', template_control_richedit_buttons($context['post_box_name']);
  464. // Option to delete an event if user is editing one.
  465. if ($context['make_event'] && !$context['event']['new'])
  466. echo '
  467. <input type="submit" name="deleteevent" value="', $txt['event_delete'], '" onclick="return confirm(\'', $txt['event_delete_confirm'], '\');" class="button_submit" />';
  468. echo '
  469. </span>
  470. </div>
  471. </div>
  472. <br class="clear" />';
  473. // Assuming this isn't a new topic pass across the last message id.
  474. if (isset($context['topic_last_message']))
  475. echo '
  476. <input type="hidden" name="last_msg" value="', $context['topic_last_message'], '" />';
  477. echo '
  478. <input type="hidden" name="additional_options" id="additional_options" value="', $context['show_additional_options'] ? '1' : '0', '" />
  479. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  480. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
  481. </form>';
  482. echo '
  483. <script type="text/javascript"><!-- // --><![CDATA[';
  484. // The functions used to preview a posts without loading a new page.
  485. echo '
  486. var current_board = ', empty($context['current_board']) ? 'null' : $context['current_board'], ';
  487. var make_poll = ', $context['make_poll'] ? 'true' : 'false', ';
  488. var txt_preview_title = "', $txt['preview_title'], '";
  489. var txt_preview_fetch = "', $txt['preview_fetch'], '";
  490. var new_replies = new Array();
  491. var reply_counter = ', empty($counter) ? 0 : $counter, ';
  492. function previewPost()
  493. {';
  494. if (isBrowser('is_firefox'))
  495. echo '
  496. // Firefox doesn\'t render <marquee> that have been put it using javascript
  497. if (document.forms.postmodify.elements[', JavaScriptEscape($context['post_box_name']), '].value.indexOf(\'[move]\') != -1)
  498. {
  499. return submitThisOnce(document.forms.postmodify);
  500. }';
  501. echo '
  502. if (window.XMLHttpRequest)
  503. {
  504. // Opera didn\'t support setRequestHeader() before 8.01.
  505. if (\'opera\' in window)
  506. {
  507. var test = new XMLHttpRequest();
  508. if (!(\'setRequestHeader\' in test))
  509. return submitThisOnce(document.forms.postmodify);
  510. }
  511. // @todo Currently not sending poll options and option checkboxes.
  512. var x = new Array();
  513. var textFields = [\'subject\', ', JavaScriptEscape($context['post_box_name']), ', ', JavaScriptEscape($context['session_var']), ', \'icon\', \'guestname\', \'email\', \'evtitle\', \'question\', \'topic\'];
  514. var numericFields = [
  515. \'board\', \'topic\', \'last_msg\',
  516. \'eventid\', \'calendar\', \'year\', \'month\', \'day\',
  517. \'poll_max_votes\', \'poll_expire\', \'poll_change_vote\', \'poll_hide\'
  518. ];
  519. var checkboxFields = [
  520. \'ns\'
  521. ];
  522. for (var i = 0, n = textFields.length; i < n; i++)
  523. if (textFields[i] in document.forms.postmodify)
  524. {
  525. // Handle the WYSIWYG editor.
  526. if (textFields[i] == ', JavaScriptEscape($context['post_box_name']), ' && $("#', $context['post_box_name'], '").data("sceditor") != undefined)
  527. x[x.length] = textFields[i] + \'=\' + $("#', $context['post_box_name'], '").data("sceditor").getText().replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
  528. else
  529. x[x.length] = textFields[i] + \'=\' + document.forms.postmodify[textFields[i]].value.replace(/&#/g, \'&#38;#\').php_to8bit().php_urlencode();
  530. }
  531. for (var i = 0, n = numericFields.length; i < n; i++)
  532. if (numericFields[i] in document.forms.postmodify && \'value\' in document.forms.postmodify[numericFields[i]])
  533. x[x.length] = numericFields[i] + \'=\' + parseInt(document.forms.postmodify.elements[numericFields[i]].value);
  534. for (var i = 0, n = checkboxFields.length; i < n; i++)
  535. if (checkboxFields[i] in document.forms.postmodify && document.forms.postmodify.elements[checkboxFields[i]].checked)
  536. x[x.length] = checkboxFields[i] + \'=\' + document.forms.postmodify.elements[checkboxFields[i]].value;
  537. sendXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=post2\' + (current_board ? \';board=\' + current_board : \'\') + (make_poll ? \';poll\' : \'\') + \';preview;xml\', x.join(\'&\'), onDocSent);
  538. document.getElementById(\'preview_section\').style.display = \'\';
  539. setInnerHTML(document.getElementById(\'preview_subject\'), txt_preview_title);
  540. setInnerHTML(document.getElementById(\'preview_body\'), txt_preview_fetch);
  541. return false;
  542. }
  543. else
  544. return submitThisOnce(document.forms.postmodify);
  545. }
  546. function onDocSent(XMLDoc)
  547. {
  548. if (!XMLDoc)
  549. {
  550. document.forms.postmodify.preview.onclick = new function ()
  551. {
  552. return true;
  553. }
  554. document.forms.postmodify.preview.click();
  555. }
  556. // Show the preview section.
  557. var preview = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'preview\')[0];
  558. setInnerHTML(document.getElementById(\'preview_subject\'), preview.getElementsByTagName(\'subject\')[0].firstChild.nodeValue);
  559. var bodyText = \'\';
  560. for (var i = 0, n = preview.getElementsByTagName(\'body\')[0].childNodes.length; i < n; i++)
  561. bodyText += preview.getElementsByTagName(\'body\')[0].childNodes[i].nodeValue;
  562. setInnerHTML(document.getElementById(\'preview_body\'), bodyText);
  563. document.getElementById(\'preview_body\').className = \'post\';
  564. // Show a list of errors (if any).
  565. var errors = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'errors\')[0];
  566. var errorList = new Array();
  567. for (var i = 0, numErrors = errors.getElementsByTagName(\'error\').length; i < numErrors; i++)
  568. errorList[errorList.length] = errors.getElementsByTagName(\'error\')[i].firstChild.nodeValue;
  569. document.getElementById(\'errors\').style.display = numErrors == 0 ? \'none\' : \'\';
  570. document.getElementById(\'errors\').className = errors.getAttribute(\'serious\') == 1 ? \'errorbox\' : \'noticebox\';
  571. document.getElementById(\'error_serious\').style.display = numErrors == 0 ? \'none\' : \'\';
  572. setInnerHTML(document.getElementById(\'error_list\'), numErrors == 0 ? \'\' : errorList.join(\'<br />\'));
  573. // Show a warning if the topic has been locked.
  574. document.getElementById(\'lock_warning\').style.display = errors.getAttribute(\'topic_locked\') == 1 ? \'\' : \'none\';
  575. // Adjust the color of captions if the given data is erroneous.
  576. var captions = errors.getElementsByTagName(\'caption\');
  577. for (var i = 0, numCaptions = errors.getElementsByTagName(\'caption\').length; i < numCaptions; i++)
  578. if (document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')))
  579. document.getElementById(\'caption_\' + captions[i].getAttribute(\'name\')).className = captions[i].getAttribute(\'class\');
  580. if (errors.getElementsByTagName(\'post_error\').length == 1)
  581. document.forms.postmodify.', $context['post_box_name'], '.style.border = \'1px solid red\';
  582. else if (document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red\' || document.forms.postmodify.', $context['post_box_name'], '.style.borderColor == \'red red red red\')
  583. {
  584. if (\'runtimeStyle\' in document.forms.postmodify.', $context['post_box_name'], ')
  585. document.forms.postmodify.', $context['post_box_name'], '.style.borderColor = \'\';
  586. else
  587. document.forms.postmodify.', $context['post_box_name'], '.style.border = null;
  588. }
  589. // Set the new last message id.
  590. if (\'last_msg\' in document.forms.postmodify)
  591. document.forms.postmodify.last_msg.value = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'last_msg\')[0].firstChild.nodeValue;
  592. // Remove the new image from old-new replies!
  593. for (i = 0; i < new_replies.length; i++)
  594. document.getElementById(\'image_new_\' + new_replies[i]).style.display = \'none\';
  595. new_replies = new Array();
  596. var ignored_replies = new Array(), ignoring;
  597. var newPosts = XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'new_posts\')[0] ? XMLDoc.getElementsByTagName(\'smf\')[0].getElementsByTagName(\'new_posts\')[0].getElementsByTagName(\'post\') : {length: 0};
  598. var numNewPosts = newPosts.length;
  599. if (numNewPosts != 0)
  600. {
  601. var newPostsHTML = \'<span id="new_replies"><\' + \'/span>\';
  602. for (var i = 0; i < numNewPosts; i++)
  603. {
  604. new_replies[new_replies.length] = newPosts[i].getAttribute("id");
  605. ignoring = false;
  606. if (newPosts[i].getElementsByTagName("is_ignored")[0].firstChild.nodeValue != 0)
  607. ignored_replies[ignored_replies.length] = ignoring = newPosts[i].getAttribute("id");
  608. newPostsHTML += \'<div class="windowbg\' + (++reply_counter % 2 == 0 ? \'2\' : \'\') + \' core_posts"><div class="content" id="msg\' + newPosts[i].getAttribute("id") + \'"><div class="floatleft"><h5>', $txt['posted_by'], ': \' + newPosts[i].getElementsByTagName("poster")[0].firstChild.nodeValue + \'</h5><span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> \' + newPosts[i].getElementsByTagName("time")[0].firstChild.nodeValue + \'&nbsp;&#187;</span> <span class="new_posts" id="image_new_\' + newPosts[i].getAttribute("id") + \'">', $txt['new'], '</span></div>\';';
  609. if ($context['can_quote'])
  610. echo '
  611. newPostsHTML += \'<ul class="reset smalltext quickbuttons" id="msg_\' + newPosts[i].getAttribute("id") + \'_quote"><li><a href="#postmodify" onclick="return insertQuoteFast(\\\'\' + newPosts[i].getAttribute("id") + \'\\\');" class="quote_button"><span>',$txt['bbc_quote'],'</span><\' + \'/a></li></ul>\';';
  612. echo '
  613. newPostsHTML += \'<br class="clear" />\';
  614. if (ignoring)
  615. newPostsHTML += \'<div id="msg_\' + newPosts[i].getAttribute("id") + \'_ignored_prompt" class="smalltext">', $txt['ignoring_user'], '<a href="#" id="msg_\' + newPosts[i].getAttribute("id") + \'_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a></div>\';
  616. newPostsHTML += \'<div class="list_posts smalltext" id="msg_\' + newPosts[i].getAttribute("id") + \'_body">\' + newPosts[i].getElementsByTagName("message")[0].firstChild.nodeValue + \'<\' + \'/div></div></div>\';
  617. }
  618. setOuterHTML(document.getElementById(\'new_replies\'), newPostsHTML);
  619. }
  620. var numIgnoredReplies = ignored_replies.length;
  621. if (numIgnoredReplies != 0)
  622. {
  623. for (var i = 0; i < numIgnoredReplies; i++)
  624. {
  625. aIgnoreToggles[ignored_replies[i]] = new smc_Toggle({
  626. bToggleEnabled: true,
  627. bCurrentlyCollapsed: true,
  628. aSwappableContainers: [
  629. \'msg_\' + ignored_replies[i] + \'_body\',
  630. \'msg_\' + ignored_replies[i] + \'_quote\',
  631. ],
  632. aSwapLinks: [
  633. {
  634. sId: \'msg_\' + ignored_replies[i] + \'_ignored_link\',
  635. msgExpanded: \'\',
  636. msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
  637. }
  638. ]
  639. });
  640. }
  641. }
  642. location.hash = \'#\' + \'preview_section\';
  643. if (typeof(smf_codeFix) != \'undefined\')
  644. smf_codeFix();
  645. }';
  646. // Code for showing and hiding additional options.
  647. if (!empty($settings['additional_options_collapsable']))
  648. echo '
  649. var oSwapAdditionalOptions = new smc_Toggle({
  650. bToggleEnabled: true,
  651. bCurrentlyCollapsed: ', $context['show_additional_options'] ? 'false' : 'true', ',
  652. funcOnBeforeCollapse: function () {
  653. document.getElementById(\'additional_options\').value = \'0\';
  654. },
  655. funcOnBeforeExpand: function () {
  656. document.getElementById(\'additional_options\').value = \'1\';
  657. },
  658. aSwappableContainers: [
  659. \'postMoreOptions\',
  660. \'postAttachment\',
  661. \'postAttachment2\',
  662. \'postAttachment3\'
  663. ],
  664. aSwapImages: [
  665. {
  666. sId: \'postMoreExpand\',
  667. srcExpanded: smf_images_url + \'/collapse.png\',
  668. altExpanded: \'-\',
  669. srcCollapsed: smf_images_url + \'/expand.png\',
  670. altCollapsed: \'+\'
  671. }
  672. ],
  673. aSwapLinks: [
  674. {
  675. sId: \'postMoreExpandLink\',
  676. msgExpanded: ', JavaScriptEscape($context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), ',
  677. msgCollapsed: ', JavaScriptEscape($context['can_post_attachment'] ? $txt['post_additionalopt_attach'] : $txt['post_additionalopt']), '
  678. }
  679. ]
  680. });';
  681. // Code for showing and hiding drafts
  682. if (!empty($context['drafts']))
  683. echo '
  684. var oSwapDraftOptions = new smc_Toggle({
  685. bToggleEnabled: true,
  686. bCurrentlyCollapsed: true,
  687. aSwappableContainers: [
  688. \'postDraftOptions\',
  689. ],
  690. aSwapImages: [
  691. {
  692. sId: \'postDraftExpand\',
  693. srcExpanded: smf_images_url + \'/collapse.png\',
  694. altExpanded: \'-\',
  695. srcCollapsed: smf_images_url + \'/expand.png\',
  696. altCollapsed: \'+\'
  697. }
  698. ],
  699. aSwapLinks: [
  700. {
  701. sId: \'postDraftExpandLink\',
  702. msgExpanded: ', JavaScriptEscape($txt['draft_hide']), ',
  703. msgCollapsed: ', JavaScriptEscape($txt['draft_load']), '
  704. }
  705. ]
  706. });';
  707. echo '
  708. // ]]></script>';
  709. // If the user is replying to a topic show the previous posts.
  710. if (isset($context['previous_posts']) && count($context['previous_posts']) > 0)
  711. {
  712. echo '
  713. <div id="recent" class="flow_hidden main_section">
  714. <div class="cat_bar">
  715. <h3 class="catbg">', $txt['topic_summary'], '</h3>
  716. </div>
  717. <span id="new_replies"></span>';
  718. $ignored_posts = array();
  719. foreach ($context['previous_posts'] as $post)
  720. {
  721. $ignoring = false;
  722. if (!empty($post['is_ignored']))
  723. $ignored_posts[] = $ignoring = $post['id'];
  724. echo '
  725. <div class="', $post['alternate'] == 0 ? 'windowbg' : 'windowbg2', ' core_posts">
  726. <div class="content" id="msg', $post['id'], '">
  727. <h5 class="floatleft">
  728. <span>', $txt['posted_by'], '</span>&nbsp;', $post['poster'], '
  729. </h5>&nbsp;-&nbsp;', $post['time'];
  730. if ($context['can_quote'])
  731. {
  732. echo '
  733. <ul class="quickbuttons" id="msg_', $post['id'], '_quote">
  734. <li><a href="#postmodify" onclick="return insertQuoteFast(', $post['id'], ');" class="quote_button">',$txt['bbc_quote'],'</a></li>
  735. </ul>';
  736. }
  737. echo '
  738. <br class="clear" />';
  739. if ($ignoring)
  740. {
  741. echo '
  742. <div id="msg_', $post['id'], '_ignored_prompt" class="smalltext">
  743. ', $txt['ignoring_user'], '
  744. <a href="#" id="msg_', $post['id'], '_ignored_link" style="display: none;">', $txt['show_ignore_user_post'], '</a>
  745. </div>';
  746. }
  747. echo '
  748. <div class="list_posts smalltext" id="msg_', $post['id'], '_body">', $post['message'], '</div>
  749. </div>
  750. </div>';
  751. }
  752. echo '
  753. </div>
  754. <script type="text/javascript"><!-- // --><![CDATA[
  755. var aIgnoreToggles = new Array();';
  756. foreach ($ignored_posts as $post_id)
  757. {
  758. echo '
  759. aIgnoreToggles[', $post_id, '] = new smc_Toggle({
  760. bToggleEnabled: true,
  761. bCurrentlyCollapsed: true,
  762. aSwappableContainers: [
  763. \'msg_', $post_id, '_body\',
  764. \'msg_', $post_id, '_quote\',
  765. ],
  766. aSwapLinks: [
  767. {
  768. sId: \'msg_', $post_id, '_ignored_link\',
  769. msgExpanded: \'\',
  770. msgCollapsed: ', JavaScriptEscape($txt['show_ignore_user_post']), '
  771. }
  772. ]
  773. });';
  774. }
  775. echo '
  776. function insertQuoteFast(messageid)
  777. {
  778. if (window.XMLHttpRequest)
  779. getXMLDocument(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';xml;pb=', $context['post_box_name'], ';mode=0\', onDocReceived);
  780. else
  781. reqWin(smf_prepareScriptUrl(smf_scripturl) + \'action=quotefast;quote=\' + messageid + \';pb=', $context['post_box_name'], ';mode=0\', 240, 90);
  782. return true;
  783. }
  784. function onDocReceived(XMLDoc)
  785. {
  786. var text = \'\';
  787. for (var i = 0, n = XMLDoc.getElementsByTagName(\'quote\')[0].childNodes.length; i < n; i++)
  788. text += XMLDoc.getElementsByTagName(\'quote\')[0].childNodes[i].nodeValue;
  789. $("#', $context['post_box_name'], '").data("sceditor").InsertText(text);
  790. }
  791. function onReceiveOpener(text)
  792. {
  793. $("#', $context['post_box_name'], '").data("sceditor").InsertText(text);
  794. }
  795. // ]]></script>';
  796. }
  797. }
  798. // The template for the spellchecker.
  799. function template_spellcheck()
  800. {
  801. global $context, $settings, $options, $txt;
  802. // The style information that makes the spellchecker look... like the forum hopefully!
  803. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  804. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  805. <head>
  806. <title>', $txt['spell_check'], '</title>
  807. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  808. <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?alp21" />
  809. <style type="text/css">
  810. body, td
  811. {
  812. font-size: small;
  813. margin: 0;
  814. background: #f0f0f0;
  815. color: #000;
  816. padding: 10px;
  817. }
  818. .highlight
  819. {
  820. color: red;
  821. font-weight: bold;
  822. }
  823. #spellview
  824. {
  825. border-style: outset;
  826. border: 1px solid black;
  827. padding: 5px;
  828. width: 95%;
  829. height: 314px;
  830. overflow: auto;
  831. background: #ffffff;
  832. }';
  833. // As you may expect - we need a lot of javascript for this... load it form the separate files.
  834. echo '
  835. </style>
  836. <script type="text/javascript"><!-- // --><![CDATA[
  837. var spell_formname = window.opener.spell_formname;
  838. var spell_fieldname = window.opener.spell_fieldname;
  839. // ]]></script>
  840. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/spellcheck.js"></script>
  841. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
  842. <script type="text/javascript"><!-- // --><![CDATA[
  843. ', $context['spell_js'], '
  844. // ]]></script>
  845. </head>
  846. <body onload="nextWord(false);">
  847. <form action="#" method="post" accept-charset="', $context['character_set'], '" name="spellingForm" id="spellingForm" onsubmit="return false;" style="margin: 0;">
  848. <div id="spellview">&nbsp;</div>
  849. <table border="0" cellpadding="4" cellspacing="0" width="100%"><tr class="windowbg">
  850. <td width="50%" valign="top">
  851. ', $txt['spellcheck_change_to'], '<br />
  852. <input type="text" name="changeto" style="width: 98%;" class="input_text" />
  853. </td>
  854. <td width="50%">
  855. ', $txt['spellcheck_suggest'], '<br />
  856. <select name="suggestions" style="width: 98%;" size="5" onclick="if (this.selectedIndex != -1) this.form.changeto.value = this.options[this.selectedIndex].text;" ondblclick="replaceWord();">
  857. </select>
  858. </td>
  859. </tr></table>
  860. <div class="righttext" style="padding: 4px;">
  861. <input type="button" name="change" value="', $txt['spellcheck_change'], '" onclick="replaceWord();" class="button_submit" />
  862. <input type="button" name="changeall" value="', $txt['spellcheck_change_all'], '" onclick="replaceAll();" class="button_submit" />
  863. <input type="button" name="ignore" value="', $txt['spellcheck_ignore'], '" onclick="nextWord(false);" class="button_submit" />
  864. <input type="button" name="ignoreall" value="', $txt['spellcheck_ignore_all'], '" onclick="nextWord(true);" class="button_submit" />
  865. </div>
  866. </form>
  867. </body>
  868. </html>';
  869. }
  870. function template_quotefast()
  871. {
  872. global $context, $settings, $options, $txt;
  873. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  874. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  875. <head>
  876. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  877. <title>', $txt['retrieving_quote'], '</title>
  878. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js"></script>
  879. </head>
  880. <body>
  881. ', $txt['retrieving_quote'], '
  882. <div id="temporary_posting_area" style="display: none;"></div>
  883. <script type="text/javascript"><!-- // --><![CDATA[';
  884. if ($context['close_window'])
  885. echo '
  886. window.close();';
  887. else
  888. {
  889. // Lucky for us, Internet Explorer has an "innerText" feature which basically converts entities <--> text. Use it if possible ;).
  890. echo '
  891. var quote = \'', $context['quote']['text'], '\';
  892. var stage = \'createElement\' in document ? document.createElement("DIV") : document.getElementById("temporary_posting_area");
  893. if (\'DOMParser\' in window && !(\'opera\' in window))
  894. {
  895. var xmldoc = new DOMParser().parseFromString("<temp>" + \'', $context['quote']['mozilla'], '\'.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_") + "</temp>", "text/xml");
  896. quote = xmldoc.childNodes[0].textContent.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t");
  897. }
  898. else if (\'innerText\' in stage)
  899. {
  900. setInnerHTML(stage, quote.replace(/\n/g, "_SMF-BREAK_").replace(/\t/g, "_SMF-TAB_").replace(/</g, "&lt;").replace(/>/g, "&gt;"));
  901. quote = stage.innerText.replace(/_SMF-BREAK_/g, "\n").replace(/_SMF-TAB_/g, "\t");
  902. }
  903. if (\'opera\' in window)
  904. quote = quote.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, \'"\').replace(/&amp;/g, "&");
  905. window.opener.onReceiveOpener(quote);
  906. window.focus();
  907. setTimeout("window.close();", 400);';
  908. }
  909. echo '
  910. // ]]></script>
  911. </body>
  912. </html>';
  913. }
  914. function template_announce()
  915. {
  916. global $context, $settings, $options, $txt, $scripturl;
  917. echo '
  918. <div id="announcement">
  919. <form action="', $scripturl, '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '">
  920. <div class="cat_bar">
  921. <h3 class="catbg">', $txt['announce_title'], '</h3>
  922. </div>
  923. <div class="information">
  924. ', $txt['announce_desc'], '
  925. </div>
  926. <div class="windowbg2">
  927. <div class="content">
  928. <p>
  929. ', $txt['announce_this_topic'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0">', $context['topic_subject'], '</a>
  930. </p>
  931. <ul class="reset">';
  932. foreach ($context['groups'] as $group)
  933. echo '
  934. <li>
  935. <label for="who_', $group['id'], '"><input type="checkbox" name="who[', $group['id'], ']" id="who_', $group['id'], '" value="', $group['id'], '" checked="checked" class="input_check" /> ', $group['name'], '</label> <em>(', $group['member_count'], ')</em>
  936. </li>';
  937. echo '
  938. <li>
  939. <label for="checkall"><input type="checkbox" id="checkall" class="input_check" onclick="invertAll(this, this.form);" checked="checked" /> <em>', $txt['check_all'], '</em></label>
  940. </li>
  941. </ul>
  942. <hr class="hrcolor" />
  943. <div id="confirm_buttons">
  944. <input type="submit" value="', $txt['post'], '" class="button_submit" />
  945. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  946. <input type="hidden" name="topic" value="', $context['current_topic'], '" />
  947. <input type="hidden" name="move" value="', $context['move'], '" />
  948. <input type="hidden" name="goback" value="', $context['go_back'], '" />
  949. </div>
  950. </div>
  951. <br class="clear_right" />
  952. </div>
  953. </form>
  954. </div>
  955. <br />';
  956. }
  957. function template_announcement_send()
  958. {
  959. global $context, $settings, $options, $txt, $scripturl;
  960. echo '
  961. <div id="announcement">
  962. <form action="' . $scripturl . '?action=announce;sa=send" method="post" accept-charset="', $context['character_set'], '" name="autoSubmit" id="autoSubmit">
  963. <div class="windowbg2">
  964. <div class="content">
  965. <p>', $txt['announce_sending'], ' <a href="', $scripturl, '?topic=', $context['current_topic'], '.0" target="_blank" class="new_win">', $context['topic_subject'], '</a></p>
  966. <div class="progress_bar">
  967. <div class="full_bar">', $context['percentage_done'], '% ', $txt['announce_done'], '</div>
  968. <div class="green_percent" style="width: ', $context['percentage_done'], '%;">&nbsp;</div>
  969. </div>
  970. <hr class="hrcolor" />
  971. <div id="confirm_buttons">
  972. <input type="submit" name="b" value="', $txt['announce_continue'], '" class="button_submit" />
  973. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  974. <input type="hidden" name="topic" value="', $context['current_topic'], '" />
  975. <input type="hidden" name="move" value="', $context['move'], '" />
  976. <input type="hidden" name="goback" value="', $context['go_back'], '" />
  977. <input type="hidden" name="start" value="', $context['start'], '" />
  978. <input type="hidden" name="membergroups" value="', $context['membergroups'], '" />
  979. </div>
  980. </div>
  981. <br class="clear_right" />
  982. </div>
  983. </form>
  984. </div>
  985. <br />
  986. <script type="text/javascript"><!-- // --><![CDATA[
  987. var countdown = 2;
  988. doAutoSubmit();
  989. function doAutoSubmit()
  990. {
  991. if (countdown == 0)
  992. document.forms.autoSubmit.submit();
  993. else if (countdown == -1)
  994. return;
  995. document.forms.autoSubmit.b.value = "', $txt['announce_continue'], ' (" + countdown + ")";
  996. countdown--;
  997. setTimeout("doAutoSubmit();", 1000);
  998. }
  999. // ]]></script>';
  1000. }
  1001. ?>