Wireless.template.php 75 KB

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