Wireless.template.php 75 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2013 Simple Machines and individual contributors
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // This is the header for WAP 1.1 output. You can view it with ?wap in the URL.
  13. function template_wap_above()
  14. {
  15. // Show the xml declaration...
  16. echo '<?xml version="1.0"?', '>
  17. <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
  18. <wml>
  19. <head>
  20. </head>';
  21. }
  22. // This is the board index (main page) in WAP 1.1.
  23. function template_wap_boardindex()
  24. {
  25. global $context, $options, $scripturl;
  26. // This is the "main" card...
  27. echo '
  28. <card id="main" title="', $context['page_title'], '">
  29. <p><strong>', $context['forum_name_html_safe'], '</strong><br /></p>';
  30. // Show an anchor for each category.
  31. foreach ($context['categories'] as $category)
  32. {
  33. // Skip it if it's empty.
  34. if (!empty($category['boards']))
  35. echo '
  36. <p><a href="#c', $category['id'], '">', $category['name'], '</a><br /></p>';
  37. }
  38. // Okay, that's it for the main card.
  39. echo '
  40. </card>';
  41. // Now fill out the deck of cards with the boards in each category.
  42. foreach ($context['categories'] as $category)
  43. {
  44. // Begin the card, and make the name available.
  45. echo '
  46. <card id="c', $category['id'], '" title="', strip_tags($category['name']), '">
  47. <p><strong>', strip_tags($category['name']), '</strong><br /></p>';
  48. // Now show a link for each board.
  49. foreach ($category['boards'] as $board)
  50. echo '
  51. <p><a href="', $scripturl, '?board=', $board['id'], '.0;wap">', $board['name'], '</a><br /></p>';
  52. echo '
  53. </card>';
  54. }
  55. }
  56. // This is the message index (list of topics in a board) for WAP 1.1.
  57. function template_wap_messageindex()
  58. {
  59. global $context, $options, $scripturl, $txt;
  60. echo '
  61. <card id="main" title="', $context['page_title'], '">
  62. <p><strong>', $context['name'], '</strong></p>';
  63. if (isset($context['boards']) && count($context['boards']) > 0)
  64. {
  65. foreach ($context['boards'] as $board)
  66. echo '
  67. <p>- <a href="', $scripturl, '?board=', $board['id'], '.0;wap">', $board['name'], '</a><br /></p>';
  68. echo '
  69. <p><br /></p>';
  70. }
  71. if (!empty($context['topics']))
  72. {
  73. echo '
  74. <p>', $txt['pages'], ': ', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';wap">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';wap">&gt;</a> <a href="' . $context['links']['last'] . ';wap">&gt;&gt;</a> ' : '', '<br /></p>';
  75. foreach ($context['topics'] as $topic)
  76. echo '
  77. <p><a href="', $scripturl, '?topic=', $topic['id'], '.0;wap">', $topic['first_post']['subject'], '</a>', (!$topic['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), ' - ', $topic['first_post']['member']['name'], '<br /></p>';
  78. echo '
  79. <p>', $txt['pages'], ': ', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';wap">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';wap">&gt;</a> <a href="' . $context['links']['last'] . ';wap">&gt;&gt;</a> ' : '', '</p>';
  80. }
  81. echo '
  82. </card>';
  83. }
  84. function template_wap_display()
  85. {
  86. global $context, $options, $txt;
  87. echo '
  88. <card id="main" title="', $context['page_title'], '">
  89. <p><strong>' . $context['linktree'][1]['name'] . ' > ' . $context['linktree'][count($context['linktree']) - 2]['name'] . '</strong></p>
  90. <p><strong>', $context['subject'], '</strong></p>
  91. <p>', $txt['pages'], ': ', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';wap">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';wap">&gt;</a> <a href="' . $context['links']['last'] . ';wap">&gt;&gt;</a> ' : '', '<br /><br /></p>';
  92. while ($message = $context['get_message']())
  93. {
  94. // This is a special modification to the post so it will work on phones:
  95. $message['body'] = preg_replace('~<div class="(?:quote|code)header">(.+?)</div>~', '<br />--- $1 ---', $message['body']);
  96. $message['body'] = strip_tags(str_replace(
  97. array(
  98. '<blockquote>',
  99. '</blockquote>',
  100. '<code>',
  101. '</code>',
  102. '<li>',
  103. $txt['code_select'],
  104. ),
  105. array(
  106. '<br>',
  107. '<br>--- ' . $txt['wireless_end_quote'] . ' ---<br>',
  108. '<br>',
  109. '<br>--- ' . $txt['wireless_end_code'] . ' ---<br>',
  110. '<br>* ',
  111. '',
  112. ), $message['body']), '<br>');
  113. echo '
  114. <p><u>', $message['member']['name'], '</u>:', (!$message['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), '<br /></p>
  115. <p>', $message['body'], '<br /><br /></p>';
  116. }
  117. echo '
  118. <p>', $txt['pages'], ': ', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';wap">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';wap">&gt;</a> <a href="' . $context['links']['last'] . ';wap">&gt;&gt;</a> ' : '', '</p>
  119. </card>';
  120. }
  121. function template_wap_login()
  122. {
  123. global $context, $modSettings, $scripturl, $txt;
  124. echo '
  125. <card id="login" title="', $context['page_title'], '">';
  126. if (isset($context['login_errors']))
  127. foreach ($context['login_errors'] as $error)
  128. echo '
  129. <p><strong>', $error, '</strong></p>';
  130. echo '
  131. <p>', $txt['username'], ':<br />
  132. <input type="text" name="user" class="input_text" /></p>
  133. <p>', $txt['password'], ':<br />
  134. <input type="password" name="passwrd" class="input_password" /></p>';
  135. // Open ID?
  136. if (!empty($modSettings['enableOpenID']))
  137. echo '
  138. <p><strong>&mdash;', $txt['or'], '&mdash;</strong></p>
  139. <p>', $txt['openid'], ':<br />
  140. <input type="text" name="openid_identifier" class="input_text openid_login" size="17" /></p>';
  141. echo '
  142. <p><do type="accept" label="', $txt['login'], '">
  143. <go method="post" href="', $scripturl, '?action=login2;wap">
  144. <postfield name="user" value="$user" />
  145. <postfield name="passwrd" value="$passwrd" />
  146. <postfield name="cookieneverexp" value="1" />
  147. </go>
  148. </do></p>
  149. </card>';
  150. }
  151. function template_wap_recent()
  152. {
  153. global $context, $options, $scripturl, $txt;
  154. echo '
  155. <card id="recent" title="', $context['page_title'], '">
  156. <p><strong>', $_REQUEST['action'] == 'unread' ? $txt['wireless_recent_unread_posts'] : $txt['wireless_recent_unread_replies'], '</strong></p>';
  157. if (empty($context['topics']))
  158. echo '
  159. <p>', $txt['old_posts'], '</p>';
  160. else
  161. {
  162. echo '
  163. <p>', $txt['pages'], ': ', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';wap">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';wap">&gt;</a> <a href="' . $context['links']['last'] . ';wap">&gt;&gt;</a> ' : '', '<br /><br /></p>';
  164. foreach ($context['topics'] as $topic)
  165. {
  166. echo '
  167. <p><a href="', $scripturl, '?topic=', $topic['id'], '.msg', $topic['new_from'], ';topicseen;imode#new">', $topic['first_post']['subject'], '</a></p>';
  168. }
  169. }
  170. echo '
  171. </card>';
  172. }
  173. function template_wap_error()
  174. {
  175. global $context, $options, $txt, $scripturl;
  176. echo '
  177. <card id="main" title="', $context['page_title'], '">
  178. <p><strong>', $context['error_title'], '</strong></p>
  179. <p>', $context['error_message'], '</p>
  180. <p><a href="', $scripturl, '?wap">', $txt['wireless_error_home'], '</a></p>
  181. </card>';
  182. }
  183. function template_wap_below()
  184. {
  185. global $context, $options, $txt;
  186. echo '
  187. <card id="switch" title="', $txt['wireless_go_to_full_version'], '">
  188. <p>
  189. <a href="', $context['linktree'][count($context['linktree']) - 1]['url'], (count($context['linktree']) > 1 ? ';' : '?'), 'nowap" rel="nofollow">', $txt['wireless_go_to_full_version'], '</a>
  190. </p>
  191. </card>
  192. </wml>';
  193. }
  194. // The cHTML protocol used for i-mode starts here.
  195. function template_imode_above()
  196. {
  197. global $context, $options, $user_info;
  198. echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD Compact HTML 1.0 Draft//EN">
  199. <html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  200. <head>
  201. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />';
  202. // Present a canonical url for search engines to prevent duplicate content in their indices.
  203. if ($user_info['is_guest'] && !empty($context['canonical_url']))
  204. echo '
  205. <link rel="canonical" href="', $context['canonical_url'], '" />';
  206. echo '
  207. <title>', $context['page_title'], '</title>
  208. </head>
  209. <body>';
  210. }
  211. function template_imode_boardindex()
  212. {
  213. global $context, $options, $scripturl, $txt;
  214. echo '
  215. <table border="0" cellspacing="0" cellpadding="0">
  216. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $context['forum_name_html_safe'], '</font></td></tr>';
  217. $count = 0;
  218. foreach ($context['categories'] as $category)
  219. {
  220. if (!empty($category['boards']) || $category['is_collapsed'])
  221. echo '
  222. <tr bgcolor="#b6dbff"><td>', $category['can_collapse'] ? '<a href="' . $scripturl . '?action=collapse;c=' . $category['id'] . ';sa=' . ($category['is_collapsed'] ? 'expand;' : 'collapse;') . $context['session_var'] . '=' . $context['session_id'] . ';imode">' : '', $category['name'], $category['can_collapse'] ? '</a>' : '', '</td></tr>';
  223. foreach ($category['boards'] as $board)
  224. {
  225. $count++;
  226. echo '
  227. <tr><td>', $board['new'] ? '<font color="#ff0000">' : '', $count < 10 ? '&#' . (59105 + $count) . ';' : '<strong>-</strong>', $board['new'] ? '</font>' : ($board['children_new'] ? '<font color="#ff0000">.</font>' : ''), ' <a href="', $scripturl, '?board=', $board['id'], '.0;imode"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $board['name'], '</a></td></tr>';
  228. }
  229. }
  230. echo '
  231. <tr bgcolor="#6d92aa"><td>', $txt['wireless_options'], '</td></tr>';
  232. if ($context['user']['is_guest'])
  233. echo '
  234. <tr><td><a href="', $scripturl, '?action=login;imode">', $txt['wireless_options_login'], '</a></td></tr>';
  235. else
  236. {
  237. if ($context['allow_pm'])
  238. echo '
  239. <tr><td><a href="', $scripturl, '?action=pm;imode">', empty($context['user']['unread_messages']) ? $txt['wireless_pm_inbox'] : sprintf($txt['wireless_pm_inbox_new'], $context['user']['unread_messages']), '</a></td></tr>';
  240. echo '
  241. <tr><td><a href="', $scripturl, '?action=unread;imode">', $txt['wireless_recent_unread_posts'], '</a></td></tr>
  242. <tr><td><a href="', $scripturl, '?action=unreadreplies;imode">', $txt['wireless_recent_unread_replies'], '</a></td></tr>
  243. <tr><td><a href="', $scripturl, '?action=logout;', $context['session_var'], '=', $context['session_id'], ';imode">', $txt['wireless_options_logout'], '</a></td></tr>';
  244. }
  245. echo '
  246. </table>';
  247. }
  248. function template_imode_messageindex()
  249. {
  250. global $context, $options, $scripturl, $txt;
  251. echo '
  252. <table border="0" cellspacing="0" cellpadding="0">
  253. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $context['name'], '</font></td></tr>';
  254. if (!empty($context['boards']))
  255. {
  256. echo '
  257. <tr bgcolor="#b6dbff"><td>', $txt['sub_boards'], '</td></tr>';
  258. foreach ($context['boards'] as $board)
  259. echo '
  260. <tr><td>', $board['new'] ? '<font color="#ff0000">-</font> ' : ($board['children_new'] ? '-<font color="#ff0000">.</font>' : '- '), '<a href="', $scripturl, '?board=', $board['id'], '.0;imode">', $board['name'], '</a></td></tr>';
  261. }
  262. $count = 0;
  263. if (!empty($context['topics']))
  264. {
  265. echo '
  266. <tr bgcolor="#b6dbff"><td>', $txt['topics'], '</td></tr>
  267. <tr><td>', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';imode">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';imode">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';imode">&gt;</a> <a href="' . $context['links']['last'] . ';imode">&gt;&gt;</a> ' : '', '</td></tr>';
  268. foreach ($context['topics'] as $topic)
  269. {
  270. $count++;
  271. echo '
  272. <tr><td>', $count < 10 ? '&#' . (59105 + $count) . '; ' : '', '<a href="', $scripturl, '?topic=', $topic['id'], '.0;imode"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $topic['first_post']['subject'], '</a>', (!$topic['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), $topic['new'] && $context['user']['is_logged'] ? ' [<a href="' . $scripturl . '?topic=' . $topic['id'] . '.msg' . $topic['new_from'] . ';imode#new">' . $txt['new'] . '</a>]' : '', '</td></tr>';
  273. }
  274. }
  275. echo '
  276. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</td></tr>
  277. <tr><td>&#59115; <a href="', $context['links']['up'], ($context['links']['up'] == $scripturl . '?' ? '' : ';'), 'imode" accesskey="0">', $txt['wireless_navigation_up'], '</a></td></tr>', !empty($context['links']['next']) ? '
  278. <tr><td>&#59104; <a href="' . $context['links']['next'] . ';imode" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></td></tr>' : '', !empty($context['links']['prev']) ? '
  279. <tr><td><strong>[*]</strong> <a href="' . $context['links']['prev'] . ';imode" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></td></tr>' : '', $context['can_post_new'] ? '
  280. <tr><td><a href="' . $scripturl . '?action=post;board=' . $context['current_board'] . '.0;imode">' . $txt['start_new_topic'] . '</a></td></tr>' : '', '
  281. </table>';
  282. }
  283. function template_imode_display()
  284. {
  285. global $context, $options, $scripturl, $board, $txt;
  286. echo '
  287. <table border="0" cellspacing="0" cellpadding="0">
  288. <tr bgcolor="#b6dbff"><td>' . $context['linktree'][1]['name'] . ' > ' . $context['linktree'][count($context['linktree']) - 2]['name'] . '</td></tr>
  289. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $context['subject'], '</font></td></tr>
  290. <tr><td>', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';imode">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';imode">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';imode">&gt;</a> <a href="' . $context['links']['last'] . ';imode">&gt;&gt;</a> ' : '', '</td></tr>';
  291. while ($message = $context['get_message']())
  292. {
  293. // This is a special modification to the post so it will work on phones:
  294. $message['body'] = preg_replace('~<div class="(?:quote|code)header">(.+?)</div>~', '<br />--- $1 ---', $message['body']);
  295. $message['body'] = strip_tags(str_replace(
  296. array(
  297. '<blockquote>',
  298. '</blockquote>',
  299. '<code>',
  300. '</code>',
  301. '<li>',
  302. $txt['code_select'],
  303. ),
  304. array(
  305. '<br />',
  306. '<br />--- ' . $txt['wireless_end_quote'] . ' ---<br />',
  307. '<br />',
  308. '<br />--- ' . $txt['wireless_end_code'] . ' ---<br />',
  309. '<br />* ',
  310. '',
  311. ), $message['body']), '<br>');
  312. echo '
  313. <tr><td>', $message['first_new'] ? '
  314. <a id="new"></a>' : '',
  315. $context['wireless_moderate'] && $message['member']['id'] ? '<a href="' . $scripturl . '?action=profile;u=' . $message['member']['id'] . ';imode">' . $message['member']['name'] . '</a>' : '<strong>' . $message['member']['name'] . '</strong>', ':
  316. ', ((empty($context['wireless_more']) && $message['can_modify']) || !empty($context['wireless_moderate']) ? '[<a href="' . $scripturl . '?action=post;msg=' . $message['id'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';imode">' . $txt['wireless_display_edit'] . '</a>]' : ''), (!$message['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), '<br />
  317. ', $message['body'], '
  318. </td></tr>';
  319. }
  320. echo '
  321. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</td></tr>
  322. <tr><td>&#59115; <a href="', $context['links']['up'], ';imode" accesskey="0">', $txt['wireless_navigation_index'], '</a></td></tr>', $context['user']['is_logged'] ? '
  323. <tr><td>&#59115; <a href="' . $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time']. ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';imode" accesskey="1">' . $txt['mark_unread'] . '</a></td></tr>' : '', !empty($context['links']['next']) ? '
  324. <tr><td><a href="' . $context['links']['next'] . ';imode' . $context['wireless_moderate'] . '" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></td></tr>' : '', !empty($context['links']['prev']) ? '
  325. <tr><td><a href="' . $context['links']['prev'] . ';imode' . $context['wireless_moderate'] . '" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></td></tr>' : '', $context['can_reply'] ? '
  326. <tr><td><a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';imode">' . $txt['reply'] . '</a></td></tr>' : '';
  327. if (!empty($context['wireless_more']) && empty($context['wireless_moderate']))
  328. echo '
  329. <tr><td><a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], ';moderate;imode">', $txt['wireless_display_moderate'], '</a></td></tr>';
  330. elseif (!empty($context['wireless_moderate']))
  331. {
  332. if ($context['can_sticky'])
  333. echo '
  334. <tr><td><a href="', $scripturl, '?action=sticky;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';imode">', $txt['wireless_display_' . ($context['is_sticky'] ? 'unsticky' : 'sticky')], '</a></td></tr>';
  335. if ($context['can_lock'])
  336. echo '
  337. <tr><td><a href="', $scripturl, '?action=lock;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';imode">', $txt['wireless_display_' . ($context['is_locked'] ? 'unlock' : 'lock')], '</a></td></tr>';
  338. }
  339. echo '
  340. </table>';
  341. }
  342. function template_imode_post()
  343. {
  344. global $context, $options, $scripturl, $txt, $modSettings;
  345. // @todo $modSettings['guest_post_no_email']
  346. echo '
  347. <form action="', $scripturl, '?action=', $context['destination'], ';board=', $context['current_board'], '.0;imode" method="post">
  348. <table border="0" cellspacing="0" cellpadding="0">';
  349. if (!$context['becomes_approved'])
  350. echo '
  351. <tr><td>' . $txt['wait_for_approval'] . '<input type="hidden" name="not_approved" value="1" /></td></tr>';
  352. if ($context['locked'])
  353. echo '
  354. <tr><td>' . $txt['topic_locked_no_reply'] . '</td></tr>';
  355. if (isset($context['name']) && isset($context['email']))
  356. {
  357. echo '
  358. <tr><td>', isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) ? '<font color="#cc0000">' . $txt['username'] . '</font>' : $txt['username'], ':</td></tr>
  359. <tr><td><input type="text" name="guestname" value="', $context['name'], '" class="input_text" /></td></tr>';
  360. if (empty($modSettings['guest_post_no_email']))
  361. echo '
  362. <tr><td>', isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? '<font color="#cc0000">' . $txt['email'] . '</font>' : $txt['email'], ':</td></tr>
  363. <tr><td><input type="text" name="email" value="', $context['email'], '" class="input_text" /></td></tr>';
  364. }
  365. // @todo Needs a more specific imode template.
  366. if ($context['require_verification'])
  367. echo '
  368. <tr><td>', !empty($context['post_error']['need_qr_verification']) ? '<font color="#cc0000">' . $txt['verification'] . '</font>' : $txt['verification'], ':</td></tr>
  369. <tr><td>', template_control_verification($context['visual_verification_id'], 'all'), '</td></tr>';
  370. echo '
  371. <tr><td>', isset($context['post_error']['no_subject']) ? '<font color="#FF0000">' . $txt['subject'] . '</font>' : $txt['subject'], ':</td></tr>
  372. <tr><td><input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' maxlength="80" class="input_text" /></td></tr>
  373. <tr><td>', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? '<font color="#ff0000">' . $txt['message'] . '</font>' : $txt['message'], ':</td></tr>
  374. <tr><td><textarea name="message" id="message" rows="5" cols="20">', $context['message'], '</textarea></td></tr>
  375. <tr><td>
  376. <input type="submit" name="post" value="', $context['submit_label'], '" class="button_submit" />
  377. <input type="hidden" name="icon" value="wireless" />
  378. <input type="hidden" name="goback" value="', $context['back_to_topic'] || !empty($options['return_to_post']) ? '1' : '0', '" />
  379. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
  380. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />', isset($context['current_topic']) ? '
  381. <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '', '
  382. <input type="hidden" name="notify" value="', $context['notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
  383. </td></tr>
  384. <tr><td>
  385. &#59115; ', !empty($context['current_topic']) ? '<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.new;imode">' . $txt['wireless_navigation_topic'] . '</a>' : '<a href="' . $scripturl . '?board=' . $context['current_board'] . '.0;imode" accesskey="0">' . $txt['wireless_navigation_index'] . '</a>', '
  386. </td></tr>
  387. </table>
  388. </form>';
  389. }
  390. function template_imode_login()
  391. {
  392. global $context, $options, $scripturl, $txt, $modSettings;
  393. echo '
  394. <form action="', $scripturl, '?action=login2;imode" method="post">
  395. <table border="0" cellspacing="0" cellpadding="0">
  396. <tr bgcolor="#b6dbff"><td>', $txt['login'], '</td></tr>';
  397. if (isset($context['login_errors']))
  398. foreach ($context['login_errors'] as $error)
  399. echo '
  400. <tr><td><strong><font color="#ff00000">', $error, '</strong></td></tr>';
  401. echo '
  402. <tr><td>', $txt['username'], ':</td></tr>
  403. <tr><td><input type="text" name="user" size="10" class="input_text" /></td></tr>
  404. <tr><td>', $txt['password'], ':</td></tr>
  405. <tr><td><input type="password" name="passwrd" size="10" class="input_password" /></td></tr>';
  406. // Open ID?
  407. if (!empty($modSettings['enableOpenID']))
  408. echo '
  409. <tr><td><strong>&mdash;', $txt['or'], '&mdash;</strong></td></tr>
  410. <tr><td>', $txt['openid'], ':</td></tr>
  411. <tr><td><input type="text" name="openid_identifier" class="input_text openid_login" size="17" /></td></tr>';
  412. echo '
  413. <tr><td><input type="submit" value="', $txt['login'], '" class="button_submit" /><input type="hidden" name="cookieneverexp" value="1" /></td></tr>
  414. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</td></tr>
  415. <tr><td>[0] <a href="', $scripturl, '?imode" accesskey="0">', $txt['wireless_navigation_up'], '</a></td></tr>
  416. </table>
  417. </form>';
  418. }
  419. function template_imode_pm()
  420. {
  421. global $context, $options, $scripturl, $txt, $user_info;
  422. if ($_REQUEST['action'] == 'findmember')
  423. {
  424. echo '
  425. <form action="', $scripturl, '?action=findmember;', $context['session_var'], '=', $context['session_id'], ';imode" method="post">
  426. <table border="0" cellspacing="0" cellpadding="0">
  427. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $txt['wireless_pm_search_member'], '</font></td></tr>
  428. <tr bgcolor="#b6dbff"><td>', $txt['find_members'], '</td></tr>
  429. <tr><td>
  430. <strong>', $txt['wireless_pm_search_name'], ':</strong>
  431. <input type="text" name="search" value="', isset($context['last_search']) ? $context['last_search'] : '', '" class="input_text" />', empty($_REQUEST['u']) ? '' : '
  432. <input type="hidden" name="u" value="' . $_REQUEST['u'] . '" />', '
  433. </td></tr>
  434. <tr><td><input type="submit" value="', $txt['search'], '" class="button_submit" /></td></tr>';
  435. if (!empty($context['last_search']))
  436. {
  437. echo '
  438. <tr bgcolor="#b6dbff"><td>', $txt['find_results'], '</td></tr>';
  439. if (empty($context['results']))
  440. echo '
  441. <tr bgcolor="#b6dbff"><td>[-] ', $txt['find_no_results'], '</tr></td>';
  442. else
  443. {
  444. echo '
  445. <tr bgcolor="#b6dbff"><td>', empty($context['links']['prev']) ? '' : '<a href="' . $context['links']['first'] . ';imode">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';imode">&lt;</a> ', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', empty($context['links']['next']) ? '' : ' <a href="' . $context['links']['next'] . ';imode">&gt;</a> <a href="' . $context['links']['last'] . ';imode">&gt;&gt;</a> ', '</tr></td>';
  446. $count = 0;
  447. foreach ($context['results'] as $result)
  448. {
  449. $count++;
  450. echo '
  451. <tr bgcolor="#b6dbff"><td>
  452. ', $count < 10 ? '&#' . (59105 + $count) . '; ' : '', '<a href="', $scripturl, '?action=pm;sa=send;u=', empty($_REQUEST['u']) ? $result['id'] : $_REQUEST['u'] . ',' . $result['id'], ';imode"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $result['name'], '</a>
  453. </tr></td>';
  454. }
  455. }
  456. }
  457. echo '
  458. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</tr></td>
  459. <tr><td>[0] <a href="', $context['links']['up'], ';imode" accesskey="0">', $txt['wireless_navigation_up'], '</a></tr></td>';
  460. if (!empty($context['results']))
  461. echo empty($context['links']['next']) ? '' : '
  462. <tr><td>[#] <a href="' . $context['links']['next'] . ';imode" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></tr></td>', empty($context['links']['prev']) ? '' : '
  463. <tr><td>[*] <a href="' . $context['links']['prev'] . ';imode" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></tr></td>';
  464. echo '
  465. </table>
  466. </form>';
  467. }
  468. elseif (!empty($_GET['sa']))
  469. {
  470. echo '
  471. <table border="0" cellspacing="0" cellpadding="0">';
  472. if ($_GET['sa'] == 'addbuddy')
  473. {
  474. echo '
  475. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $txt['wireless_pm_add_buddy'], '</font></td></tr>
  476. <tr bgcolor="#b6dbff"><td>', $txt['wireless_pm_select_buddy'], '</td></tr>';
  477. $count = 0;
  478. foreach ($context['buddies'] as $buddy)
  479. {
  480. $count++;
  481. if ($buddy['selected'])
  482. echo '
  483. <tr><td>[-] <span style="color: gray">', $buddy['name'], '</span></tr></td>';
  484. else
  485. echo '
  486. <tr><td>
  487. ', $count < 10 ? '&#' . (59105 + $count) . '; ' : '', '<a href="', $buddy['add_href'], ';imode"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $buddy['name'], '</a>
  488. </tr></td>';
  489. }
  490. echo '
  491. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</tr></td>
  492. <tr><td>[0] <a href="', $context['pm_href'], ';imode" accesskey="0">', $txt['wireless_navigation_up'], '</a></tr></td>
  493. </table>';
  494. }
  495. if ($_GET['sa'] == 'send' || $_GET['sa'] == 'send2')
  496. {
  497. echo '
  498. <form action="', $scripturl, '?action=pm;sa=send2;imode" method="post">
  499. <table border="0" cellspacing="0" cellpadding="0">
  500. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $txt['new_message'], '</tr></td>', empty($context['post_error']['messages']) ? '' : '
  501. <tr><td><font color="#ff0000">' . implode('<br />', $context['post_error']['messages']) . '</font></tr></td>', '
  502. <tr><td>
  503. <strong>', $txt['pm_to'], ':</strong> ';
  504. if (empty($context['recipients']['to']))
  505. echo $txt['wireless_pm_no_recipients'];
  506. else
  507. {
  508. $to_names = array();
  509. $ids = array();
  510. foreach ($context['recipients']['to'] as $to)
  511. {
  512. $ids[] = $to['id'];
  513. $to_names[] = $to['name'];
  514. }
  515. echo implode(', ', $to_names);
  516. $ids = implode(',', $ids);
  517. }
  518. echo '
  519. ', empty($ids) ? '' : '<input type="hidden" name="u" value="' . $ids . '" />', '<br />
  520. <a href="', $scripturl, '?action=findmember', empty($ids) ? '' : ';u=' . $ids, ';', $context['session_var'], '=', $context['session_id'], ';imode">', $txt['wireless_pm_search_member'], '</a>', empty($user_info['buddies']) ? '' : '<br />
  521. <a href="' . $scripturl . '?action=pm;sa=addbuddy' . (empty($ids) ? '' : ';u=' . $ids) . ';imode">' . $txt['wireless_pm_add_buddy'] . '</a>', '
  522. </tr></td>
  523. <tr><td>
  524. <strong>', $txt['subject'], ':</strong> <input type="text" name="subject" value="', $context['subject'], '" class="input_text" />
  525. </tr></td>
  526. <tr><td>
  527. <strong>', $txt['message'], ':</strong><br />
  528. <textarea name="message" id="message" rows="5" cols="20">', $context['message'], '</textarea>
  529. </tr></td>
  530. <tr><td>
  531. <input type="submit" value="', $txt['send_message'], '" class="button_submit" />
  532. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  533. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
  534. <input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />
  535. <input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '" />
  536. <input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" />
  537. <input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" />
  538. </tr></td>';
  539. if ($context['reply'])
  540. echo '
  541. <tr bgcolor="#b6dbff"><td>', $txt['wireless_pm_reply_to'], '</tr></td>
  542. <tr><td><strong>', $context['quoted_message']['subject'], '</strong></tr></td>
  543. <tr><td>', $context['quoted_message']['body'], '</tr></td>';
  544. echo '
  545. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</tr></td>
  546. <tr><td>[0] <a href="', $scripturl, '?action=pm;imode" accesskey="0">', $txt['wireless_navigation_up'], '</a></tr></td>
  547. </table>
  548. </form>';
  549. }
  550. }
  551. elseif (empty($_GET['pmsg']))
  552. {
  553. echo '
  554. <table border="0" cellspacing="0" cellpadding="0">
  555. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $context['current_label_id'] == -1 ? $txt['wireless_pm_inbox'] : $txt['pm_current_label'] . ': ' . $context['current_label'], '</td></tr>
  556. <tr><td>', empty($context['links']['prev']) ? '' : '<a href="' . $context['links']['first'] . ';imode">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';imode">&lt;</a> ', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', empty($context['links']['next']) ? '' : ' <a href="' . $context['links']['next'] . ';imode">&gt;</a> <a href="' . $context['links']['last'] . ';imode">&gt;&gt;</a> ', '</tr></td>';
  557. $count = 0;
  558. while ($message = $context['get_pmessage']())
  559. {
  560. $count++;
  561. echo '
  562. <tr><td>
  563. ', $count < 10 ? '&#' . (59105 + $count) . '; ' : '', '<a href="', $scripturl, '?action=pm;start=', $context['start'], ';pmsg=', $message['id'], ';l=', $context['current_label_id'], ';imode"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $message['subject'], ' <em>', $txt['wireless_pm_by'], '</em> ', $message['member']['name'], '</a>', $message['is_unread'] ? ' [' . $txt['new'] . ']' : '', '
  564. </td></tr>';
  565. }
  566. if ($context['currently_using_labels'])
  567. {
  568. $labels = array();
  569. ksort($context['labels']);
  570. foreach ($context['labels'] as $label)
  571. $labels[] = '<a href="' . $scripturl . '?action=pm;l=' . $label['id'] . ';imode">' . $label['name'] . '</a>' . (!empty($label['unread_messages']) ? ' (' . $label['unread_messages'] . ')' : '');
  572. echo '
  573. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $txt['pm_labels'], '</font></td></tr>
  574. <tr><td>
  575. ', implode(', ', $labels), '
  576. </td></tr>';
  577. }
  578. echo '
  579. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</tr></td>
  580. <tr><td>[0] <a href="', $scripturl, '?imode" accesskey="0">', $txt['wireless_navigation_up'], '</a></tr></td>', empty($context['links']['next']) ? '' : '
  581. <tr><td>[#] <a href="' . $context['links']['next'] . ';imode" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></tr></td>', empty($context['links']['prev']) ? '' : '
  582. <tr><td>[*] <a href="' . $context['links']['prev'] . ';imode" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></tr></td>', $context['can_send_pm'] ? '
  583. <tr><td><a href="' . $scripturl . '?action=pm;sa=send;imode">' . $txt['new_message'] . '</a></tr></td>' : '', '
  584. </table>';
  585. }
  586. else
  587. {
  588. $message = $context['get_pmessage']();
  589. $message['body'] = preg_replace('~<div class="(?:quote|code)header">(.+?)</div>~', '<br />--- $1 ---', $message['body']);
  590. $message['body'] = strip_tags(str_replace(
  591. array(
  592. '<blockquote>',
  593. '</blockquote>',
  594. '<code>',
  595. '</code>',
  596. '<li>',
  597. $txt['code_select'],
  598. ),
  599. array(
  600. '<br />',
  601. '<br />--- ' . $txt['wireless_end_quote'] . ' ---<br />',
  602. '<br />',
  603. '<br />--- ' . $txt['wireless_end_code'] . ' ---<br />',
  604. '<br />* ',
  605. '',
  606. ), $message['body']), '<br>');
  607. echo '
  608. <table border="0" cellspacing="0" cellpadding="0">
  609. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $message['subject'], '</td></tr>
  610. <tr bgcolor="#b6dbff"><td>
  611. <strong>', $txt['wireless_pm_by'], ':</strong> ', $message['member']['name'], '<br />
  612. <strong>', $txt['on'], ':</strong> ', $message['time'], '
  613. </td></tr>
  614. <tr><td>
  615. ', $message['body'], '
  616. </td></tr>
  617. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</tr></td>
  618. <tr><td>[0] <a href="', $scripturl, '?action=pm;start=', $context['start'], ';l=', $context['current_label_id'], ';imode" accesskey="0">', $txt['wireless_navigation_up'], '</a></tr></td>';
  619. if ($context['can_send_pm'])
  620. echo '
  621. <tr><td><a href="', $scripturl, '?action=pm;sa=send;pmsg=', $message['id'], ';u=', $message['member']['id'], ';reply;imode">', $txt['wireless_pm_reply'], '</a></tr></td>';
  622. if ($context['can_send_pm'] && $message['number_recipients'] > 1)
  623. echo '
  624. <tr><td><a href="', $scripturl, '?action=pm;sa=send;pmsg=', $message['id'], ';u=all;reply;imode">', $txt['wireless_pm_reply_all'], '</a></tr></td>';
  625. echo '
  626. </table>';
  627. }
  628. }
  629. function template_imode_recent()
  630. {
  631. global $context, $options, $scripturl, $txt;
  632. echo '
  633. <table border="0" cellspacing="0" cellpadding="0">
  634. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $_REQUEST['action'] == 'unread' ? $txt['wireless_recent_unread_posts'] : $txt['wireless_recent_unread_replies'], '</tr></td>';
  635. $count = 0;
  636. if (empty($context['topics']))
  637. echo '
  638. <tr><td>', $txt['old_posts'], '</td></tr>';
  639. else
  640. {
  641. echo '
  642. <tr><td>', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';imode">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';imode">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';imode">&gt;</a> <a href="' . $context['links']['last'] . ';imode">&gt;&gt;</a> ' : '', '</td></tr>';
  643. foreach ($context['topics'] as $topic)
  644. {
  645. $count++;
  646. echo '
  647. <tr><td>', $count < 10 ? '&#' . (59105 + $count) . '; ' : '', '<a href="', $scripturl, '?topic=', $topic['id'], '.msg', $topic['new_from'], ';topicseen;imode#new"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $topic['first_post']['subject'], '</a></td></tr>';
  648. }
  649. }
  650. echo '
  651. <tr bgcolor="#b6dbff"><td>', $txt['wireless_navigation'], '</td></tr>
  652. <tr><td>[0] <a href="', $context['links']['up'], '?imode" accesskey="0">', $txt['wireless_navigation_up'], '</a></td></tr>', !empty($context['links']['next']) ? '
  653. <tr><td>[#] <a href="' . $context['links']['next'] . ';imode" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></td></tr>' : '', !empty($context['links']['prev']) ? '
  654. <tr><td>[*] <a href="' . $context['links']['prev'] . ';imode" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></td></tr>' : '', '
  655. </table>';
  656. }
  657. function template_imode_error()
  658. {
  659. global $context, $options, $txt, $scripturl;
  660. echo '
  661. <table border="0" cellspacing="0" cellpadding="0">
  662. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $context['error_title'], '</font></td></tr>
  663. <tr><td>', $context['error_message'], '</td></tr>
  664. <tr class="windowbg"><td>[0] <a href="', $scripturl, '?imode" accesskey="0">', $txt['wireless_error_home'], '</a></td></tr>
  665. </table>';
  666. }
  667. function template_imode_profile()
  668. {
  669. global $context, $options, $scripturl, $board, $txt;
  670. echo '
  671. <table border="0" cellspacing="0" cellpadding="0">
  672. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $txt['summary'], ' - ', $context['member']['name'], '</font></td></tr>
  673. <tr><td>
  674. <strong>', $txt['name'], ':</strong> ', $context['member']['name'], '
  675. </td></tr>
  676. <tr><td>
  677. <strong>', $txt['position'], ': </strong>', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '
  678. </td></tr>
  679. <tr><td>
  680. <strong>', $txt['lastLoggedIn'], ':</strong> ', $context['member']['last_login'], '
  681. </td></tr>';
  682. if (!empty($context['member']['bans']))
  683. {
  684. echo '
  685. <tr><td>
  686. <font color="red"><strong>', $txt['user_banned_by_following'], ':</strong></font>';
  687. foreach ($context['member']['bans'] as $ban)
  688. echo '
  689. <br />', $ban['explanation'], '';
  690. echo '
  691. </td></tr>';
  692. }
  693. echo '
  694. <tr bgcolor="#b6dbff"><td>', $txt['additional_info'], '</td></tr>';
  695. if (!$context['user']['is_owner'] && $context['can_send_pm'])
  696. echo '
  697. <tr><td><a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], ';imode">', $txt['wireless_profile_pm'], '.</a></td></tr>';
  698. if (!$context['user']['is_owner'] && !empty($context['can_edit_ban']))
  699. echo '
  700. <tr><td><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $context['id_member'], ';imode">', $txt['profileBanUser'], '.</a></td></tr>';
  701. echo '
  702. <tr><td><a href="', $scripturl, '?imode">', $txt['wireless_error_home'], '.</a></td></tr>';
  703. echo '
  704. </table>';
  705. }
  706. function template_imode_ban_edit()
  707. {
  708. global $context, $options, $scripturl, $board, $txt, $modSettings;
  709. echo '
  710. <form action="', $scripturl, '?action=admin;area=ban;sa=add;imode" method="post">
  711. <table border="0" cellspacing="0" cellpadding="0">
  712. <tr bgcolor="#6d92aa"><td><font color="#ffffff">', $context['ban']['is_new'] ? $txt['ban_add_new'] : $txt['ban_edit'] . ' \'' . $context['ban']['name'] . '\'', '</font></td></tr>
  713. <tr><td>
  714. <strong>', $txt['ban_name'], ': </strong>
  715. <input type="text" name="ban_name" value="', $context['ban']['name'], '" size="20" class="input_text" />
  716. </td></tr>
  717. <tr><td>
  718. <strong>', $txt['ban_expiration'], ': </strong><br />
  719. <input type="radio" name="expiration" value="never" ', $context['ban']['expiration']['status'] == 'never' ? ' checked="checked"' : '', ' class="input_radio" /> ', $txt['never'], '<br />
  720. <input type="radio" name="expiration" value="one_day" ', $context['ban']['expiration']['status'] == 'one_day' ? ' checked="checked"' : '', ' class="input_radio" /> ', $txt['ban_will_expire_within'], ' <input type="text" name="expire_date" size="3" value="', $context['ban']['expiration']['days'], '" /> ', $txt['ban_days'], '<br />
  721. <input type="radio" name="expiration" value="expired" ', $context['ban']['expiration']['status'] == 'expired' ? ' checked="checked"' : '', ' class="input_radio" /> ', $txt['ban_expired'], '<br />
  722. </td></tr>
  723. <tr><td>
  724. <strong>', $txt['ban_reason'], ': </strong>
  725. <input type="text" name="reason" value="', $context['ban']['reason'], '" size="20" class="input_text" />
  726. </td></tr>
  727. <tr><td>
  728. <strong>', $txt['ban_notes'], ': </strong><br />
  729. <textarea name="notes" cols="20" rows="3">', $context['ban']['notes'], '</textarea>
  730. </td></tr>
  731. <tr><td>
  732. <strong>', $txt['ban_restriction'], ': </strong><br />
  733. <input type="checkbox" name="full_ban" value="1"', $context['ban']['cannot']['access'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['ban_full_ban'], '<br />
  734. <input type="checkbox" name="cannot_post" value="1"', $context['ban']['cannot']['post'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['ban_cannot_post'], '<br />
  735. <input type="checkbox" name="cannot_register" value="1"', $context['ban']['cannot']['register'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['ban_cannot_register'], '<br />
  736. <input type="checkbox" name="cannot_login" value="1"', $context['ban']['cannot']['login'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['ban_cannot_login'], '
  737. </td></tr>';
  738. if (!empty($context['ban_suggestions']))
  739. {
  740. echo '
  741. <tr bgcolor="#b6dbff"><td>', $txt['ban_triggers'], '</td></tr>
  742. <tr><td>
  743. <input type="checkbox" name="ban_suggestions[]" value="main_ip" class="input_check" /> <strong>', $txt['wireless_ban_ip'], ':</strong><br />
  744. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="20" class="input_text" />
  745. </td></tr>';
  746. if (empty($modSettings['disableHostnameLookup']))
  747. echo '
  748. <tr><td>
  749. <input type="checkbox" name="ban_suggestions[]" value="hostname" class="input_check" /> <strong>', $txt['wireless_ban_hostname'], ':</strong><br />
  750. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="20" class="input_text" />
  751. </td></tr>';
  752. echo '
  753. <tr><td>
  754. <input type="checkbox" name="ban_suggestions[]" value="email" class="input_check" /> <strong>', $txt['wireless_ban_email'], ':</strong><br />
  755. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email" value="', $context['ban_suggestions']['email'], '" size="20" class="input_text" />
  756. </td></tr>
  757. <tr><td>
  758. <input type="checkbox" name="ban_suggestions[]" value="user" class="input_check" /> <strong>', $txt['ban_on_username'], ':</strong><br />';
  759. if (empty($context['ban_suggestions']['member']['id']))
  760. echo '
  761. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="user" value="" size="20" class="input_text" />';
  762. else
  763. echo '
  764. &nbsp;&nbsp;&nbsp;&nbsp;', $context['ban_suggestions']['member']['name'], '
  765. <input type="hidden" name="bannedUser" value="', $context['ban_suggestions']['member']['id'], '" />';
  766. echo '
  767. </td></tr>';
  768. }
  769. echo '
  770. <tr><td><input type="submit" name="', $context['ban']['is_new'] ? 'add_ban' : 'modify_ban', '" value="', $context['ban']['is_new'] ? $txt['ban_add'] : $txt['ban_modify'], '" class="button_submit" /></td></tr>
  771. <tr bgcolor="#b6dbff"><td>', $txt['wireless_additional_info'], '</td></tr>
  772. <tr><td><a href="', $scripturl, '?imode">', $txt['wireless_error_home'], '.</a></td></tr>';
  773. echo '
  774. </table>
  775. <input type="hidden" name="old_expire" value="', $context['ban']['expiration']['days'], '" />
  776. <input type="hidden" name="bg" value="', $context['ban']['id'], '" />
  777. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  778. </form>';
  779. }
  780. function template_imode_below()
  781. {
  782. global $context, $options, $txt;
  783. echo '
  784. <br /><a href="', $context['linktree'][count($context['linktree']) - 1]['url'], (count($context['linktree']) > 1 ? ';' : '?'), 'nowap" rel="nofollow">', $txt['wireless_go_to_full_version'], '</a>
  785. </body>
  786. </html>';
  787. }
  788. // XHTMLMP (XHTML Mobile Profile) templates used for WAP 2.0 start here
  789. function template_wap2_above()
  790. {
  791. global $context, $settings, $options, $user_info;
  792. echo '<?xml version="1.0" encoding="', $context['character_set'], '"?', '>
  793. <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
  794. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  795. <head>
  796. <title>', $context['page_title'], '</title>';
  797. // Present a canonical url for search engines to prevent duplicate content in their indices.
  798. if ($user_info['is_guest'] && !empty($context['canonical_url']))
  799. echo '
  800. <link rel="canonical" href="', $context['canonical_url'], '" />';
  801. echo '
  802. <link rel="stylesheet" href="', $settings['default_theme_url'], '/css/wireless.css" type="text/css" />
  803. </head>
  804. <body>';
  805. }
  806. function template_wap2_boardindex()
  807. {
  808. global $context, $options, $scripturl, $txt;
  809. echo '
  810. <p class="catbg">', $context['forum_name_html_safe'], '</p>';
  811. $count = 0;
  812. foreach ($context['categories'] as $category)
  813. {
  814. if (!empty($category['boards']) || $category['is_collapsed'])
  815. echo '
  816. <p class="titlebg">', $category['can_collapse'] ? '<a href="' . $scripturl . '?action=collapse;c=' . $category['id'] . ';sa=' . ($category['is_collapsed'] ? 'expand;' : 'collapse;') . $context['session_var'] . '=' . $context['session_id'] . ';wap2">' : '', $category['name'], $category['can_collapse'] ? '</a>' : '', '</p>';
  817. foreach ($category['boards'] as $board)
  818. {
  819. $count++;
  820. echo '
  821. <p class="windowbg">', $board['new'] ? '<span class="updated">' : '', $count < 10 ? '[' . $count . '' : '[-', $board['children_new'] && !$board['new'] ? '<span class="updated">' : '', '] ', $board['new'] || $board['children_new'] ? '</span>' : '', '<a href="', $scripturl, '?board=', $board['id'], '.0;wap2"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $board['name'], '</a></p>';
  822. }
  823. }
  824. echo '
  825. <p class="titlebg">', $txt['wireless_options'], '</p>';
  826. if ($context['user']['is_guest'])
  827. echo '
  828. <p class="windowbg"><a href="', $scripturl, '?action=login;wap2">', $txt['wireless_options_login'], '</a></p>';
  829. else
  830. {
  831. if ($context['allow_pm'])
  832. echo '
  833. <p class="windowbg"><a href="', $scripturl, '?action=pm;wap2">', empty($context['user']['unread_messages']) ? $txt['wireless_pm_inbox'] : sprintf($txt['wireless_pm_inbox_new'], $context['user']['unread_messages']), '</a></p>';
  834. echo '
  835. <p class="windowbg"><a href="', $scripturl, '?action=unread;wap2">', $txt['wireless_recent_unread_posts'], '</a></p>
  836. <p class="windowbg"><a href="', $scripturl, '?action=unreadreplies;wap2">', $txt['wireless_recent_unread_replies'], '</a></p>
  837. <p class="windowbg"><a href="', $scripturl, '?action=logout;', $context['session_var'], '=', $context['session_id'], ';wap2">', $txt['wireless_options_logout'], '</a></p>';
  838. }
  839. }
  840. function template_wap2_messageindex()
  841. {
  842. global $context, $options, $scripturl, $txt;
  843. echo '
  844. <p class="catbg">', $context['name'], '</p>';
  845. if (!empty($context['boards']))
  846. {
  847. echo '
  848. <p class="titlebg">', $txt['sub_boards'], '</p>';
  849. foreach ($context['boards'] as $board)
  850. echo '
  851. <p class="windowbg">', $board['new'] ? '<span class="updated">[-] </span>' : ($board['children_new'] ? '[-<span class="updated">] </span>' : '[-] '), '<a href="', $scripturl, '?board=', $board['id'], '.0;wap2">', $board['name'], '</a></p>';
  852. }
  853. $count = 0;
  854. if (!empty($context['topics']))
  855. {
  856. echo '
  857. <p class="titlebg">', $txt['topics'], '</p>
  858. <p class="windowbg">', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';wap2">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap2">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';wap2">&gt;</a> <a href="' . $context['links']['last'] . ';wap2">&gt;&gt;</a> ' : '', '</p>';
  859. foreach ($context['topics'] as $topic)
  860. {
  861. $count++;
  862. echo '
  863. <p class="windowbg">', $count < 10 ? '[' . $count . '] ' : '', '<a href="', $scripturl, '?topic=', $topic['id'], '.0;wap2"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $topic['first_post']['subject'], '</a>', (!$topic['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), $topic['new'] && $context['user']['is_logged'] ? ' [<a href="' . $scripturl . '?topic=' . $topic['id'] . '.msg' . $topic['new_from'] . ';wap2#new" class="new">' . $txt['new'] . '</a>]' : '', '</p>';
  864. }
  865. }
  866. echo '
  867. <p class="titlebg">', $txt['wireless_navigation'], '</p>
  868. <p class="windowbg">[0] <a href="', $context['links']['up'], ($context['links']['up'] == $scripturl . '?' ? '' : ';'), 'wap2" accesskey="0">', $txt['wireless_navigation_up'], '</a></p>', !empty($context['links']['next']) ? '
  869. <p class="windowbg">[#] <a href="' . $context['links']['next'] . ';wap2" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></p>' : '', !empty($context['links']['prev']) ? '
  870. <p class="windowbg">[*] <a href="' . $context['links']['prev'] . ';wap2" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></p>' : '', $context['can_post_new'] ? '
  871. <p class="windowbg"><a href="' . $scripturl . '?action=post;board=' . $context['current_board'] . '.0;wap2">' . $txt['start_new_topic'] . '</a></p>' : '';
  872. }
  873. function template_wap2_display()
  874. {
  875. global $context, $options, $scripturl, $txt;
  876. echo '
  877. <p class="titlebg">' . $context['linktree'][1]['name'] . ' > ' . $context['linktree'][count($context['linktree']) - 2]['name'] . '</p>
  878. <p class="catbg">', $context['subject'], '</p>
  879. <p class="windowbg">', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';wap2">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap2">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';wap2">&gt;</a> <a href="' . $context['links']['last'] . ';wap2">&gt;&gt;</a> ' : '', '</p>';
  880. $alternate = true;
  881. while ($message = $context['get_message']())
  882. {
  883. // This is a special modification to the post so it will work on phones:
  884. $message['body'] = preg_replace('~<div class="(?:quote|code)header">(.+?)</div>~', '<br />--- $1 ---', $message['body']);
  885. $message['body'] = strip_tags(str_replace(
  886. array(
  887. '<blockquote>',
  888. '</blockquote>',
  889. '<code>',
  890. '</code>',
  891. '<li>',
  892. $txt['code_select'],
  893. ),
  894. array(
  895. '<br />',
  896. '<br />--- ' . $txt['wireless_end_quote'] . ' ---<br />',
  897. '<br />',
  898. '<br />--- ' . $txt['wireless_end_code'] . ' ---<br />',
  899. '<br />* ',
  900. '',
  901. ), $message['body']), '<br>');
  902. echo $message['first_new'] ? '
  903. <a id="new"></a>' : '', '
  904. <p class="windowbg', $alternate ? '' : '2', '">
  905. ', $context['wireless_moderate'] && $message['member']['id'] ? '<a href="' . $scripturl . '?action=profile;u=' . $message['member']['id'] . ';wap2">' . $message['member']['name'] . '</a>' : '<strong>' . $message['member']['name'] . '</strong>', ':
  906. ', ((empty($context['wireless_more']) && $message['can_modify']) || !empty($context['wireless_moderate']) ? '[<a href="' . $scripturl . '?action=post;msg=' . $message['id'] . ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';wap2">' . $txt['wireless_display_edit'] . '</a>]' : ''), (!$message['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : ''), '<br />
  907. ', $message['body'], '
  908. </p>';
  909. $alternate = !$alternate;
  910. }
  911. echo '
  912. <p class="titlebg">', $txt['wireless_navigation'], '</p>
  913. <p class="windowbg">[0] <a href="', $context['links']['up'], ';wap2" accesskey="0">', $txt['wireless_navigation_index'], '</a></p>', $context['user']['is_logged'] ? '
  914. <p class="windowbg">[1] <a href="' . $scripturl . '?action=markasread;sa=topic;t=' . $context['mark_unread_time']. ';topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';wap2" accesskey="1">' . $txt['mark_unread'] . '</a></p>' : '', !empty($context['links']['next']) ? '
  915. <p class="windowbg">[#] <a href="' . $context['links']['next'] . ';wap2' . $context['wireless_moderate'] . '" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></p>' : '', !empty($context['links']['prev']) ? '
  916. <p class="windowbg">[*] <a href="' . $context['links']['prev'] . ';wap2' . $context['wireless_moderate'] . '" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></p>' : '', $context['can_reply'] ? '
  917. <p class="windowbg"><a href="' . $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';wap2">' . $txt['reply'] . '</a></p>' : '';
  918. if (!empty($context['wireless_more']) && empty($context['wireless_moderate']))
  919. echo '
  920. <p class="windowbg"><a href="', $scripturl, '?topic=', $context['current_topic'], '.', $context['start'], ';moderate;wap2">', $txt['wireless_display_moderate'], '</a></p>';
  921. elseif (!empty($context['wireless_moderate']))
  922. {
  923. if ($context['can_sticky'])
  924. echo '
  925. <p class="windowbg"><a href="', $scripturl, '?action=sticky;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';wap2">', $txt['wireless_display_' . ($context['is_sticky'] ? 'unsticky' : 'sticky')], '</a></p>';
  926. if ($context['can_lock'])
  927. echo '
  928. <p class="windowbg"><a href="', $scripturl, '?action=lock;topic=', $context['current_topic'], '.', $context['start'], ';', $context['session_var'], '=', $context['session_id'], ';wap2">', $txt['wireless_display_' . ($context['is_locked'] ? 'unlock' : 'lock')], '</a></p>';
  929. }
  930. }
  931. function template_wap2_login()
  932. {
  933. global $context, $modSettings, $scripturl, $txt;
  934. echo '
  935. <form action="', $scripturl, '?action=login2;wap2" method="post">
  936. <p class="catbg">', $txt['login'], '</p>';
  937. if (isset($context['login_errors']))
  938. foreach ($context['login_errors'] as $error)
  939. echo '
  940. <p class="windowbg" style="color: #ff0000;"><strong>', $error, '</strong></p>';
  941. echo '
  942. <p class="windowbg">', $txt['username'], ':</p>
  943. <p class="windowbg"><input type="text" name="user" size="10" class="input_text" /></p>
  944. <p class="windowbg">', $txt['password'], ':</p>
  945. <p class="windowbg"><input type="password" name="passwrd" size="10" class="input_password" /></p>';
  946. // Open ID?
  947. if (!empty($modSettings['enableOpenID']))
  948. echo '
  949. <p class="windowbg"><strong>&mdash;', $txt['or'], '&mdash;</strong></p>
  950. <p class="windowbg">', $txt['openid'], ':</p>
  951. <p class="windowbg"><input type="text" name="openid_identifier" class="input_text openid_login" size="17" /></p>';
  952. echo '
  953. <p class="windowbg"><input type="submit" value="', $txt['login'], '" class="button_submit" /><input type="hidden" name="cookieneverexp" value="1" /></p>
  954. <p class="catbg">', $txt['wireless_navigation'], '</p>
  955. <p class="windowbg">[0] <a href="', $scripturl, '?wap2" accesskey="0">', $txt['wireless_navigation_up'], '</a></p>
  956. </form>';
  957. }
  958. function template_wap2_post()
  959. {
  960. global $context, $options, $scripturl, $txt, $modSettings;
  961. echo '
  962. <form action="', $scripturl, '?action=', $context['destination'], ';board=', $context['current_board'], '.0;wap2" method="post">
  963. <p class="titlebg">', $context['page_title'], '</p>';
  964. if (!$context['becomes_approved'])
  965. echo '
  966. <p class="windowbg">
  967. ' . $txt['wait_for_approval'] . '
  968. <input type="hidden" name="not_approved" value="1" />
  969. </p>';
  970. if ($context['locked'])
  971. echo '
  972. <p class="windowbg">
  973. ' . $txt['topic_locked_no_reply'] . '
  974. </p>';
  975. if (isset($context['name']) && isset($context['email']))
  976. {
  977. echo '
  978. <p class="windowbg"' . (isset($context['post_error']['long_name']) || isset($context['post_error']['no_name']) ? ' style="color: #ff0000"' : '') . '>
  979. ' . $txt['username'] . ': <input type="text" name="guestname" value="' . $context['name'] . '" class="input_text" />
  980. </p>';
  981. if (empty($modSettings['guest_post_no_email']))
  982. echo '
  983. <p class="windowbg"' . (isset($context['post_error']['no_email']) || isset($context['post_error']['bad_email']) ? ' style="color: #ff0000"' : '') . '>
  984. ' . $txt['email'] . ': <input type="text" name="email" value="' . $context['email'] . '" class="input_text" />
  985. </p>';
  986. }
  987. if ($context['require_verification'])
  988. echo '
  989. <p class="windowbg"', !empty($context['post_error']['need_qr_verification']) ? ' style="color: #ff0000"' : '', '>
  990. ' . $txt['verification'] . ': ', template_control_verification($context['visual_verification_id'], 'all'), '
  991. </p>';
  992. echo '
  993. <p class="windowbg"', isset($context['post_error']['no_subject']) ? ' style="color: #ff0000"' : '', '>
  994. ', $txt['subject'], ': <input type="text" name="subject"', $context['subject'] == '' ? '' : ' value="' . $context['subject'] . '"', ' maxlength="80" class="input_text" />
  995. </p>
  996. <p class="windowbg"', isset($context['post_error']['no_message']) || isset($context['post_error']['long_message']) ? ' style="color: #ff0000;"' : '', '>
  997. ', $txt['message'], ': <br />
  998. <textarea name="message" id="message" rows="5" cols="20">', $context['message'], '</textarea>
  999. </p>
  1000. <p class="windowbg">
  1001. <input type="submit" name="post" value="', $context['submit_label'], '" class="button_submit" />
  1002. <input type="hidden" name="icon" value="wireless" />
  1003. <input type="hidden" name="goback" value="', $context['back_to_topic'] || !empty($options['return_to_post']) ? '1' : '0', '" />
  1004. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
  1005. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />', isset($context['current_topic']) ? '
  1006. <input type="hidden" name="topic" value="' . $context['current_topic'] . '" />' : '', '
  1007. <input type="hidden" name="notify" value="', $context['notify'] || !empty($options['auto_notify']) ? '1' : '0', '" />
  1008. </p>
  1009. <p class="windowbg">[0] ', !empty($context['current_topic']) ? '<a href="' . $scripturl . '?topic=' . $context['current_topic'] . '.new;wap2">' . $txt['wireless_navigation_topic'] . '</a>' : '<a href="' . $scripturl . '?board=' . $context['current_board'] . '.0;wap2" accesskey="0">' . $txt['wireless_navigation_index'] . '</a>', '</p>
  1010. </form>';
  1011. }
  1012. function template_wap2_pm()
  1013. {
  1014. global $context, $options, $scripturl, $txt, $user_info;
  1015. if ($_REQUEST['action'] == 'findmember')
  1016. {
  1017. echo '
  1018. <form action="', $scripturl, '?action=findmember;', $context['session_var'], '=', $context['session_id'], ';wap2" method="post">
  1019. <p class="catbg">', $txt['wireless_pm_search_member'], '</p>
  1020. <p class="titlebg">', $txt['find_members'], '</p>
  1021. <p class="windowbg">
  1022. <strong>', $txt['wireless_pm_search_name'], ':</strong>
  1023. <input type="text" name="search" value="', isset($context['last_search']) ? $context['last_search'] : '', '" class="input_text" />', empty($_REQUEST['u']) ? '' : '
  1024. <input type="hidden" name="u" value="' . $_REQUEST['u'] . '" />', '
  1025. </p>
  1026. <p class="windowbg"><input type="submit" value="', $txt['search'], '" class="button_submit" /></p>
  1027. </form>';
  1028. if (!empty($context['last_search']))
  1029. {
  1030. echo '
  1031. <p class="titlebg">', $txt['find_results'], '</p>';
  1032. if (empty($context['results']))
  1033. echo '
  1034. <p class="windowbg">[-] ', $txt['find_no_results'], '</p>';
  1035. else
  1036. {
  1037. echo '
  1038. <p class="windowbg">', empty($context['links']['prev']) ? '' : '<a href="' . $context['links']['first'] . ';wap2">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap2">&lt;</a> ', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', empty($context['links']['next']) ? '' : ' <a href="' . $context['links']['next'] . ';wap2">&gt;</a> <a href="' . $context['links']['last'] . ';wap2">&gt;&gt;</a> ', '</p>';
  1039. $count = 0;
  1040. foreach ($context['results'] as $result)
  1041. {
  1042. $count++;
  1043. echo '
  1044. <p class="windowbg">
  1045. [', $count < 10 ? $count : '-', '] <a href="', $scripturl, '?action=pm;sa=send;u=', empty($_REQUEST['u']) ? $result['id'] : $_REQUEST['u'] . ',' . $result['id'], ';wap2"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $result['name'], '</a>
  1046. </p>';
  1047. }
  1048. }
  1049. }
  1050. echo '
  1051. <p class="titlebg">', $txt['wireless_navigation'], '</p>
  1052. <p class="windowbg">[0] <a href="', $context['links']['up'], ';wap2" accesskey="0">', $txt['wireless_navigation_up'], '</a></p>';
  1053. if (!empty($context['results']))
  1054. echo empty($context['links']['next']) ? '' : '
  1055. <p class="windowbg">[#] <a href="' . $context['links']['next'] . ';wap2" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></p>', empty($context['links']['prev']) ? '' : '
  1056. <p class="windowbg">[*] <a href="' . $context['links']['prev'] . ';wap2" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></p>';
  1057. }
  1058. elseif (!empty($_GET['sa']))
  1059. {
  1060. if ($_GET['sa'] == 'addbuddy')
  1061. {
  1062. echo '
  1063. <p class="catbg">', $txt['wireless_pm_add_buddy'], '</p>
  1064. <p class="titlebg">', $txt['wireless_pm_select_buddy'], '</p>';
  1065. $count = 0;
  1066. foreach ($context['buddies'] as $buddy)
  1067. {
  1068. $count++;
  1069. if ($buddy['selected'])
  1070. echo '
  1071. <p class="windowbg">[-] <span style="color: gray">', $buddy['name'], '</span></p>';
  1072. else
  1073. echo '
  1074. <p class="windowbg">
  1075. [', $count < 10 ? $count : '-', '] <a href="', $buddy['add_href'], ';wap2"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $buddy['name'], '</a>
  1076. </p>';
  1077. }
  1078. echo '
  1079. <p class="titlebg">', $txt['wireless_navigation'], '</p>
  1080. <p class="windowbg">[0] <a href="', $context['pm_href'], ';wap2" accesskey="0">', $txt['wireless_navigation_up'], '</a></p>';
  1081. }
  1082. if ($_GET['sa'] == 'send' || $_GET['sa'] == 'send2')
  1083. {
  1084. echo '
  1085. <form action="', $scripturl, '?action=pm;sa=send2;wap2" method="post">
  1086. <p class="catbg">', $txt['new_message'], '</p>', empty($context['post_error']['messages']) ? '' : '
  1087. <p class="windowbg error">' . implode('<br />', $context['post_error']['messages']) . '</p>', '
  1088. <p class="windowbg">
  1089. <strong>', $txt['pm_to'], ':</strong> ';
  1090. if (empty($context['recipients']['to']))
  1091. echo $txt['wireless_pm_no_recipients'];
  1092. else
  1093. {
  1094. $to_names = array();
  1095. $ids = array();
  1096. foreach ($context['recipients']['to'] as $to)
  1097. {
  1098. $ids[] = $to['id'];
  1099. $to_names[] = $to['name'];
  1100. }
  1101. echo implode(', ', $to_names);
  1102. $ids = implode(',', $ids);
  1103. }
  1104. echo '
  1105. ', empty($ids) ? '' : '<input type="hidden" name="u" value="' . $ids . '" />', '<br />
  1106. <a href="', $scripturl, '?action=findmember', empty($ids) ? '' : ';u=' . $ids, ';', $context['session_var'], '=', $context['session_id'], ';wap2">', $txt['wireless_pm_search_member'], '</a>', empty($user_info['buddies']) ? '' : '<br />
  1107. <a href="' . $scripturl . '?action=pm;sa=addbuddy' . (empty($ids) ? '' : ';u=' . $ids) . ';wap2">' . $txt['wireless_pm_add_buddy'] . '</a>', '
  1108. </p>
  1109. <p class="windowbg">
  1110. <strong>', $txt['subject'], ':</strong> <input type="text" name="subject" value="', $context['subject'], '" />
  1111. </p>
  1112. <p class="windowbg">
  1113. <strong>', $txt['message'], ':</strong><br />
  1114. <textarea name="message" id="message" rows="5" cols="20">', $context['message'], '</textarea>
  1115. </p>
  1116. <p class="windowbg">
  1117. <input type="submit" value="', $txt['send_message'], '" class="button_submit" />
  1118. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1119. <input type="hidden" name="seqnum" value="', $context['form_sequence_number'], '" />
  1120. <input type="hidden" name="replied_to" value="', !empty($context['quoted_message']['id']) ? $context['quoted_message']['id'] : 0, '" />
  1121. <input type="hidden" name="pm_head" value="', !empty($context['quoted_message']['pm_head']) ? $context['quoted_message']['pm_head'] : 0, '" />
  1122. <input type="hidden" name="f" value="', isset($context['folder']) ? $context['folder'] : '', '" />
  1123. <input type="hidden" name="l" value="', isset($context['current_label_id']) ? $context['current_label_id'] : -1, '" />
  1124. </p>';
  1125. if ($context['reply'])
  1126. echo '
  1127. <p class="titlebg">', $txt['wireless_pm_reply_to'], '</p>
  1128. <p class="windowbg"><strong>', $context['quoted_message']['subject'], '</strong></p>
  1129. <p class="windowbg">', $context['quoted_message']['body'], '</p>';
  1130. echo '
  1131. <p class="titlebg">', $txt['wireless_navigation'], '</p>
  1132. <p class="windowbg">[0] <a href="', $scripturl, '?action=pm;wap2" accesskey="0">', $txt['wireless_navigation_up'], '</a></p>
  1133. </form>';
  1134. }
  1135. }
  1136. elseif (empty($_GET['pmsg']))
  1137. {
  1138. echo '
  1139. <p class="catbg">', $context['current_label_id'] == -1 ? $txt['wireless_pm_inbox'] : $txt['pm_current_label'] . ': ' . $context['current_label'], '</p>
  1140. <p class="windowbg">', empty($context['links']['prev']) ? '' : '<a href="' . $context['links']['first'] . ';wap2">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap2">&lt;</a> ', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', empty($context['links']['next']) ? '' : ' <a href="' . $context['links']['next'] . ';wap2">&gt;</a> <a href="' . $context['links']['last'] . ';wap2">&gt;&gt;</a> ', '</p>';
  1141. $count = 0;
  1142. while ($message = $context['get_pmessage']())
  1143. {
  1144. $count++;
  1145. echo '
  1146. <p class="windowbg">
  1147. [', $count < 10 ? $count : '-', '] <a href="', $scripturl, '?action=pm;start=', $context['start'], ';pmsg=', $message['id'], ';l=', $context['current_label_id'], ';wap2"', $count < 10 ? ' accesskey="' . $count . '"' : '', '>', $message['subject'], ' <em>', $txt['wireless_pm_by'], '</em> ', $message['member']['name'], '</a>', $message['is_unread'] ? ' [' . $txt['new'] . ']' : '', '
  1148. </p>';
  1149. }
  1150. if ($context['currently_using_labels'])
  1151. {
  1152. $labels = array();
  1153. ksort($context['labels']);
  1154. foreach ($context['labels'] as $label)
  1155. $labels[] = '<a href="' . $scripturl . '?action=pm;l=' . $label['id'] . ';wap2">' . $label['name'] . '</a>' . (!empty($label['unread_messages']) ? ' (' . $label['unread_messages'] . ')' : '');
  1156. echo '
  1157. <p class="catbg">
  1158. ', $txt['pm_labels'], '
  1159. </p>
  1160. <p class="windowbg">
  1161. ', implode(', ', $labels), '
  1162. </p>';
  1163. }
  1164. echo '
  1165. <p class="titlebg">', $txt['wireless_navigation'], '</p>
  1166. <p class="windowbg">[0] <a href="', $scripturl, '?wap2" accesskey="0">', $txt['wireless_navigation_up'], '</a></p>', empty($context['links']['next']) ? '' : '
  1167. <p class="windowbg">[#] <a href="' . $context['links']['next'] . ';wap2" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></p>', empty($context['links']['prev']) ? '' : '
  1168. <p class="windowbg">[*] <a href="' . $context['links']['prev'] . ';wap2" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></p>', $context['can_send_pm'] ? '
  1169. <p class="windowbg"><a href="' . $scripturl . '?action=pm;sa=send;wap2">' . $txt['new_message'] . '</a></p>' : '';
  1170. }
  1171. else
  1172. {
  1173. $message = $context['get_pmessage']();
  1174. $message['body'] = preg_replace('~<div class="(?:quote|code)header">(.+?)</div>~', '<br />--- $1 ---', $message['body']);
  1175. $message['body'] = strip_tags(str_replace(
  1176. array(
  1177. '<blockquote>',
  1178. '</blockquote>',
  1179. '<code>',
  1180. '</code>',
  1181. '<li>',
  1182. $txt['code_select'],
  1183. ),
  1184. array(
  1185. '<br />',
  1186. '<br />--- ' . $txt['wireless_end_quote'] . ' ---<br />',
  1187. '<br />',
  1188. '<br />--- ' . $txt['wireless_end_code'] . ' ---<br />',
  1189. '<br />* ',
  1190. '',
  1191. ), $message['body']), '<br>');
  1192. echo '
  1193. <p class="catbg">', $message['subject'], '</p>
  1194. <p class="titlebg">
  1195. <strong>', $txt['wireless_pm_by'], ':</strong> ', $message['member']['name'], '<br />
  1196. <strong>', $txt['on'], ':</strong> ', $message['time'], '
  1197. </p>
  1198. <p class="windowbg">
  1199. ', $message['body'], '
  1200. </p>
  1201. <p class="titlebg">', $txt['wireless_navigation'], '</p>
  1202. <p class="windowbg">[0] <a href="', $scripturl, '?action=pm;start=', $context['start'], ';l=', $context['current_label_id'], ';wap2" accesskey="0">', $txt['wireless_navigation_up'], '</a></p>';
  1203. if ($context['can_send_pm'])
  1204. echo '
  1205. <p class="windowbg"><a href="', $scripturl, '?action=pm;sa=send;pmsg=', $message['id'], ';u=', $message['member']['id'], ';reply;wap2">', $txt['wireless_pm_reply'], '</a></p>';
  1206. if ($context['can_send_pm'] && $message['number_recipients'] > 1)
  1207. echo '
  1208. <p class="windowbg"><a href="', $scripturl, '?action=pm;sa=send;pmsg=', $message['id'], ';u=all;reply;wap2">', $txt['wireless_pm_reply_all'], '</a></p>';
  1209. }
  1210. }
  1211. function template_wap2_recent()
  1212. {
  1213. global $context, $options, $scripturl, $txt;
  1214. echo '
  1215. <p class="catbg">', $_REQUEST['action'] == 'unread' ? $txt['wireless_recent_unread_posts'] : $txt['wireless_recent_unread_replies'], '</p>';
  1216. $count = 0;
  1217. if (empty($context['topics']))
  1218. echo '
  1219. <p class="windowbg">', $txt['old_posts'], '</p>';
  1220. else
  1221. {
  1222. echo '
  1223. <p class="windowbg">', !empty($context['links']['prev']) ? '<a href="' . $context['links']['first'] . ';wap2">&lt;&lt;</a> <a href="' . $context['links']['prev'] . ';wap2">&lt;</a> ' : '', '(', $context['page_info']['current_page'], '/', $context['page_info']['num_pages'], ')', !empty($context['links']['next']) ? ' <a href="' . $context['links']['next'] . ';wap2">&gt;</a> <a href="' . $context['links']['last'] . ';wap2">&gt;&gt;</a> ' : '', '</p>';
  1224. foreach ($context['topics'] as $topic)
  1225. {
  1226. $count++;
  1227. echo '
  1228. <p class="windowbg">', ($count < 10 ? '[' . $count . '] ' : ''), '<a href="', $scripturl, '?topic=', $topic['id'], '.msg', $topic['new_from'], ';topicseen;wap2#new"', ($count < 10 ? ' accesskey="' . $count . '"' : ''), '>', $topic['first_post']['subject'], '</a></p>';
  1229. }
  1230. }
  1231. echo '
  1232. <p class="titlebg">', $txt['wireless_navigation'], '</p>
  1233. <p class="windowbg">[0] <a href="', $context['links']['up'], '?wap2" accesskey="0">', $txt['wireless_navigation_up'], '</a></p>', !empty($context['links']['next']) ? '
  1234. <p class="windowbg">[#] <a href="' . $context['links']['next'] . ';wap2" accesskey="#">' . $txt['wireless_navigation_next'] . '</a></p>' : '', !empty($context['links']['prev']) ? '
  1235. <p class="windowbg">[*] <a href="' . $context['links']['prev'] . ';wap2" accesskey="*">' . $txt['wireless_navigation_prev'] . '</a></p>' : '';
  1236. }
  1237. function template_wap2_error()
  1238. {
  1239. global $context, $options, $txt, $scripturl;
  1240. echo '
  1241. <p class="catbg">', $context['error_title'], '</p>
  1242. <p class="windowbg">', $context['error_message'], '</p>
  1243. <p class="windowbg">[0] <a href="', $scripturl, '?wap2" accesskey="0">', $txt['wireless_error_home'], '</a></p>';
  1244. }
  1245. function template_wap2_profile()
  1246. {
  1247. global $context, $options, $scripturl, $board, $txt;
  1248. echo '
  1249. <p class="catbg">', $txt['summary'], ' - ', $context['member']['name'], '</p>
  1250. <p class="windowbg"><strong>', $txt['name'], ':</strong> ', $context['member']['name'], '</p>
  1251. <p class="windowbg"><strong>', $txt['position'], ': </strong>', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</p>
  1252. <p class="windowbg"><strong>', $txt['lastLoggedIn'], ':</strong> ', $context['member']['last_login'], '</p>';
  1253. if (!empty($context['member']['bans']))
  1254. {
  1255. echo '
  1256. <p class="titlebg"><strong>', $txt['user_banned_by_following'], ':</strong></p>';
  1257. foreach ($context['member']['bans'] as $ban)
  1258. echo '
  1259. <p class="windowbg">', $ban['explanation'], '</p>';
  1260. }
  1261. echo '
  1262. <p class="titlebg">', $txt['additional_info'], '</p>';
  1263. if (!$context['user']['is_owner'] && $context['can_send_pm'])
  1264. echo '
  1265. <p class="windowbg"><a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], ';wap2">', $txt['wireless_profile_pm'], '.</a></p>';
  1266. if (!$context['user']['is_owner'] && !empty($context['can_edit_ban']))
  1267. echo '
  1268. <p class="windowbg"><a href="', $scripturl, '?action=admin;area=ban;sa=add;u=', $context['id_member'], ';wap2">', $txt['profileBanUser'], '.</a></p>';
  1269. echo '
  1270. <p class="windowbg"><a href="', $scripturl, '?wap2">', $txt['wireless_error_home'], '.</a></p>';
  1271. }
  1272. function template_wap2_ban_edit()
  1273. {
  1274. global $context, $options, $scripturl, $board, $txt, $modSettings;
  1275. echo '
  1276. <form action="', $scripturl, '?action=admin;area=ban;sa=add;wap2" method="post">
  1277. <p class="catbg">', $context['ban']['is_new'] ? $txt['ban_add_new'] : $txt['ban_edit'] . ' \'' . $context['ban']['name'] . '\'', '</p>
  1278. <p class="windowbg">
  1279. <strong>', $txt['ban_name'], ': </strong>
  1280. <input type="text" name="ban_name" value="', $context['ban']['name'], '" size="20" class="input_text" />
  1281. </p>
  1282. <p class="windowbg">
  1283. <strong>', $txt['ban_expiration'], ': </strong><br />
  1284. <input type="radio" name="expiration" value="never" ', $context['ban']['expiration']['status'] == 'never' ? ' checked="checked"' : '', ' class="input_radio" /> ', $txt['never'], '<br />
  1285. <input type="radio" name="expiration" value="one_day" ', $context['ban']['expiration']['status'] == 'one_day' ? ' checked="checked"' : '', ' class="input_radio" /> ', $txt['ban_will_expire_within'], ' <input type="text" name="expire_date" size="3" value="', $context['ban']['expiration']['days'], '" /> ', $txt['ban_days'], '<br />
  1286. <input type="radio" name="expiration" value="expired" ', $context['ban']['expiration']['status'] == 'expired' ? ' checked="checked"' : '', ' class="input_radio" /> ', $txt['ban_expired'], '<br />
  1287. </p>
  1288. <p class="windowbg">
  1289. <strong>', $txt['ban_reason'], ': </strong>
  1290. <input type="text" name="reason" value="', $context['ban']['reason'], '" size="20" class="input_text" />
  1291. </p>
  1292. <p class="windowbg">
  1293. <strong>', $txt['ban_notes'], ': </strong><br />
  1294. <textarea name="notes" cols="20" rows="3">', $context['ban']['notes'], '</textarea>
  1295. </p>
  1296. <p class="windowbg">
  1297. <strong>', $txt['ban_restriction'], ': </strong><br />
  1298. <input type="checkbox" name="full_ban" value="1"', $context['ban']['cannot']['access'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['ban_full_ban'], '<br />
  1299. <input type="checkbox" name="cannot_post" value="1"', $context['ban']['cannot']['post'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['ban_cannot_post'], '<br />
  1300. <input type="checkbox" name="cannot_register" value="1"', $context['ban']['cannot']['register'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['ban_cannot_register'], '<br />
  1301. <input type="checkbox" name="cannot_login" value="1"', $context['ban']['cannot']['login'] ? ' checked="checked"' : '', ' class="input_check" /> ', $txt['ban_cannot_login'], '
  1302. </p>';
  1303. if (!empty($context['ban_suggestions']))
  1304. {
  1305. echo '
  1306. <p class="titlebg">', $txt['ban_triggers'], '</p>
  1307. <p class="windowbg">
  1308. <input type="checkbox" name="ban_suggestions[]" value="main_ip" class="input_check" /> <strong>', $txt['wireless_ban_ip'], ':</strong><br />
  1309. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="main_ip" value="', $context['ban_suggestions']['main_ip'], '" size="20" class="input_text" />
  1310. </p>';
  1311. if (empty($modSettings['disableHostnameLookup']))
  1312. echo '
  1313. <p class="windowbg">
  1314. <input type="checkbox" name="ban_suggestions[]" value="hostname" class="input_check" /> <strong>', $txt['wireless_ban_hostname'], ':</strong><br />
  1315. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="hostname" value="', $context['ban_suggestions']['hostname'], '" size="20" class="input_text" />
  1316. <p>';
  1317. echo '
  1318. <p class="windowbg">
  1319. <input type="checkbox" name="ban_suggestions[]" value="email" class="input_check" /> <strong>', $txt['wireless_ban_email'], ':</strong><br />
  1320. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email" value="', $context['ban_suggestions']['email'], '" size="20" class="input_text" />
  1321. </p>
  1322. <p class="windowbg">
  1323. <input type="checkbox" name="ban_suggestions[]" value="user" class="input_check" /> <strong>', $txt['ban_on_username'], ':</strong><br />';
  1324. if (empty($context['ban_suggestions']['member']['id']))
  1325. echo '
  1326. &nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="user" value="" size="20" class="input_text" />';
  1327. else
  1328. echo '
  1329. &nbsp;&nbsp;&nbsp;&nbsp;', $context['ban_suggestions']['member']['name'], '
  1330. <input type="hidden" name="bannedUser" value="', $context['ban_suggestions']['member']['id'], '" />';
  1331. echo '
  1332. </p>';
  1333. }
  1334. echo '
  1335. <p class="windowbg"><input type="submit" name="', $context['ban']['is_new'] ? 'add_ban' : 'modify_ban', '" value="', $context['ban']['is_new'] ? $txt['ban_add'] : $txt['ban_modify'], '" class="button_submit" /></p>
  1336. <p class="titlebg">', $txt['wireless_additional_info'], '</p>
  1337. <p class="windowbg"><a href="', $scripturl, '?wap2">', $txt['wireless_error_home'], '.</a></p>';
  1338. echo '
  1339. <input type="hidden" name="old_expire" value="', $context['ban']['expiration']['days'], '" />
  1340. <input type="hidden" name="bg" value="', $context['ban']['id'], '" />
  1341. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1342. </form>';
  1343. }
  1344. function template_wap2_below()
  1345. {
  1346. global $context, $txt;
  1347. echo '
  1348. <a href="', $context['linktree'][count($context['linktree']) - 1]['url'], (count($context['linktree']) > 1 ? ';' : '?'), 'nowap" rel="nofollow">', $txt['wireless_go_to_full_version'], '</a>
  1349. </body>
  1350. </html>';
  1351. }
  1352. ?>