2
0

Wireless.template.php 75 KB

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