2
0

Post.template.php 47 KB

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