PageRenderTime 1494ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 1ms

/themes/CurveClassic/Profile.template.php

https://github.com/Arantor/Elkarte
PHP | 3386 lines | 2757 code | 392 blank | 237 comment | 303 complexity | e22b6da194d67b2d760207a6a747e199 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-3.0
  1. <?php
  2. /**
  3. * @name ElkArte Forum
  4. * @copyright ElkArte Forum contributors
  5. * @license BSD http://opensource.org/licenses/BSD-3-Clause
  6. *
  7. * This software is a derived product, based on:
  8. *
  9. * Simple Machines Forum (SMF)
  10. * copyright: 2011 Simple Machines (http://www.simplemachines.org)
  11. * license: BSD, See included LICENSE.TXT for terms and conditions.
  12. *
  13. * @version 1.0 Alpha
  14. */
  15. // Template for the profile side bar - goes before any other profile template.
  16. function template_profile_above()
  17. {
  18. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  19. echo '
  20. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/profile.js"></script>';
  21. // Prevent Chrome from auto completing fields when viewing/editing other members profiles
  22. if (isBrowser('is_chrome') && !$context['user']['is_owner'])
  23. echo '
  24. <script type="text/javascript"><!-- // --><![CDATA[
  25. disableAutoComplete();
  26. // ]]></script>';
  27. // If an error occurred while trying to save previously, give the user a clue!
  28. echo '
  29. ', template_error_message();
  30. // If the profile was update successfully, let the user know this.
  31. if (!empty($context['profile_updated']))
  32. echo '
  33. <div class="infobox">
  34. ', $context['profile_updated'], '
  35. </div>';
  36. }
  37. // Template for closing off table started in profile_above.
  38. function template_profile_below()
  39. {
  40. }
  41. // This template displays users details without any option to edit them.
  42. function template_action_summary()
  43. {
  44. // Header block(s)
  45. echo '
  46. <div id="profile_header">';
  47. template_profile_block_buddies();
  48. echo '
  49. </div>';
  50. // left and right blocks, entered as left, right, left, right
  51. $templates = array(
  52. 'summary',
  53. 'user_info',
  54. 'other_info',
  55. 'contact',
  56. 'user_customprofileinfo',
  57. 'moderation',
  58. );
  59. $left = true;
  60. echo '
  61. <div id="profile_summary_container">';
  62. foreach ($templates as $template)
  63. {
  64. echo '
  65. <div class="float', $left ? 'left' : 'right', '" style="width:49.5%; margin:2px 2px; padding:0">
  66. <div>';
  67. $tcall = 'template_profile_block_' . $template;
  68. $tcall();
  69. echo '
  70. </div>
  71. </div>';
  72. // next row?
  73. if (!$left)
  74. echo '
  75. <br class="clear" />';
  76. $left = !$left;
  77. }
  78. // clear up odd number of blocks
  79. if (!$left)
  80. echo '
  81. <br class="clear" />';
  82. // end of the sidexside container
  83. echo'
  84. </div>';
  85. // Footer Block(s)
  86. echo '
  87. <div id="profile_footer">';
  88. template_profile_block_attachments();
  89. echo '
  90. <br class="clear" />
  91. </div>';
  92. }
  93. // Template for showing all the posts of the user, in chronological order.
  94. function template_action_showPosts()
  95. {
  96. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  97. echo '
  98. <div class="cat_bar">
  99. <h3 class="catbg">
  100. ', (!isset($context['attachments']) && empty($context['is_topics']) ? $txt['showMessages'] : (!empty($context['is_topics']) ? $txt['showTopics'] : $txt['showAttachments'])), ' - ', $context['member']['name'], '
  101. </h3>
  102. </div>';
  103. // Are we displaying posts or attachments?
  104. if (!isset($context['attachments']))
  105. {
  106. // For every post to be displayed, give it its own div, and show the important details of the post.
  107. foreach ($context['posts'] as $post)
  108. {
  109. echo '
  110. <div class="', $post['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  111. <div class="content">
  112. <div class="counter">', $post['counter'], '</div>
  113. <div class="topic_details">
  114. <h5><strong><a href="', $scripturl, '?board=', $post['board']['id'], '.0">', $post['board']['name'], '</a> / <a href="', $scripturl, '?topic=', $post['topic'], '.', $post['start'], '#msg', $post['id'], '">', $post['subject'], '</a></strong></h5>
  115. <span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> ', $post['time'], '&nbsp;&#187;</span>
  116. </div>
  117. <div class="list_posts">';
  118. if (!$post['approved'])
  119. echo '
  120. <div class="approve_post">
  121. <em>', $txt['post_awaiting_approval'], '</em>
  122. </div>';
  123. echo '
  124. ', $post['body'], '
  125. </div>';
  126. if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
  127. echo '
  128. <ul class="quickbuttons">';
  129. // If they *can* reply?
  130. if ($post['can_reply'])
  131. echo '
  132. <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '" class="reply_button"><span>', $txt['reply'], '</span></a></li>';
  133. // If they *can* quote?
  134. if ($post['can_quote'])
  135. echo '
  136. <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '" class="quote_button"><span>', $txt['quote'], '</span></a></li>';
  137. // Can we request notification of topics?
  138. if ($post['can_mark_notify'])
  139. echo '
  140. <li><a href="', $scripturl, '?action=notify;topic=', $post['topic'], '.', $post['start'], '" class="notify_button"><span>', $txt['notify'], '</span></a></li>';
  141. // How about... even... remove it entirely?!
  142. if ($post['can_delete'])
  143. echo '
  144. <li><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');" class="remove_button"><span>', $txt['remove'], '</span></a></li>';
  145. if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
  146. echo '
  147. </ul>';
  148. echo '
  149. </div>
  150. </div>';
  151. }
  152. }
  153. else
  154. template_show_list('attachments');
  155. // No posts? Just end the table with a informative message.
  156. if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
  157. echo '
  158. <div class="tborder windowbg2 padding centertext" >
  159. ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
  160. </div>';
  161. }
  162. // Template for showing all the drafts of the user.
  163. function template_showDrafts()
  164. {
  165. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  166. echo '
  167. <div class="pagesection">
  168. <div class="floatleft">
  169. ', $txt['pages'], ': ', $context['page_index'], '
  170. </div>
  171. </div>';
  172. // No drafts? Just show an informative message.
  173. if (empty($context['drafts']))
  174. echo '
  175. <div class="tborder windowbg2 padding centertext">
  176. ', $txt['draft_none'], '
  177. </div>';
  178. else
  179. {
  180. // For every draft to be displayed, give it its own div, and show the important details of the draft.
  181. foreach ($context['drafts'] as $draft)
  182. {
  183. echo '
  184. <div class="', $draft['alternate'] === 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  185. <div class="content">
  186. <div class="counter">', $draft['counter'], '</div>
  187. <div class="topic_details">
  188. <h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong>&nbsp;&nbsp;';
  189. if (!empty($draft['sticky']))
  190. echo '<img src="', $settings['images_url'], '/icons/quick_sticky.png" alt="', $txt['sticky_topic'], '" title="', $txt['sticky_topic'], '" />';
  191. if (!empty($draft['locked']))
  192. echo '<img src="', $settings['images_url'], '/icons/quick_lock.png" alt="', $txt['locked_topic'], '" title="', $txt['locked_topic'], '" />';
  193. echo '
  194. </h5>
  195. <span class="smalltext">&#171;&nbsp;<strong>', $txt['draft_saved_on'], ':</strong> ', ($draft['age'] > 0 ? sprintf($txt['draft_days_ago'], $draft['age']) : $draft['time']), (!empty($draft['remaining']) ? ', ' . sprintf($txt['draft_retain'], $draft['remaining']) : ''), '&#187;</span>
  196. </div>
  197. <div class="list_posts">
  198. ', $draft['body'], '
  199. </div>
  200. <ul class="quickbuttons">
  201. <li>
  202. <a href="', $scripturl, '?action=post;', (empty($draft['topic']['id']) ? 'board=' . $draft['board']['id'] : 'topic=' . $draft['topic']['id']), '.0;id_draft=', $draft['id_draft'], '" class="reply_button"><span>', $txt['draft_edit'], '</span></a>
  203. </li>
  204. <li>
  205. <a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=showdrafts;delete=', $draft['id_draft'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['draft_remove'], '?\');" class="remove_button"><span>', $txt['draft_delete'], '</span></a>
  206. </li>
  207. </ul>
  208. </div>
  209. </div>';
  210. }
  211. }
  212. // Show page numbers.
  213. echo '
  214. <div class="pagesection">
  215. <div class="floatleft">
  216. ', $txt['pages'], ': ', $context['page_index'], '
  217. </div>
  218. </div>';
  219. }
  220. // Template for showing all the buddies of the current user.
  221. function template_editBuddies()
  222. {
  223. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  224. $disabled_fields = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array();
  225. echo '
  226. <div class="generic_list_wrapper" id="edit_buddies">
  227. <div class="title_bar">
  228. <h3 class="titlebg">
  229. <img src="', $settings['images_url'], '/icons/online.png" alt="" class="icon" />', $txt['editBuddies'], '
  230. </h3>
  231. </div>
  232. <table class="table_grid table_layout">
  233. <tr class="catbg">
  234. <th class="first_th" scope="col" width="20%">', $txt['name'], '</th>
  235. <th scope="col">', $txt['status'], '</th>';
  236. if ($context['can_send_email'])
  237. echo '
  238. <th scope="col">', $txt['email'], '</th>';
  239. echo '
  240. <th class="last_th" scope="col"></th>
  241. </tr>';
  242. // If they don't have any buddies don't list them!
  243. if (empty($context['buddies']))
  244. echo '
  245. <tr class="windowbg2">
  246. <td colspan="8" align="center"><strong>', $txt['no_buddies'], '</strong></td>
  247. </tr>';
  248. // Now loop through each buddy showing info on each.
  249. $alternate = false;
  250. foreach ($context['buddies'] as $buddy)
  251. {
  252. echo '
  253. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  254. <td>', $buddy['link'], '</td>
  255. <td align="center"><a href="', $buddy['online']['href'], '"><img src="', $buddy['online']['image_href'], '" alt="', $buddy['online']['text'], '" title="', $buddy['online']['text'], '" /></a></td>';
  256. if ($context['can_send_email'])
  257. echo '
  258. <td align="center">', ($buddy['show_email'] == 'no' ? '' : '<a href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $buddy['id'] . '" rel="nofollow"><img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . ' ' . $buddy['name'] . '" /></a>'), '</td>';
  259. echo '
  260. <td align="center"><a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['id_member'], ';remove=', $buddy['id'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="', $settings['images_url'], '/icons/delete.png" alt="', $txt['buddy_remove'], '" title="', $txt['buddy_remove'], '" /></a></td>
  261. </tr>';
  262. $alternate = !$alternate;
  263. }
  264. echo '
  265. </table>
  266. </div>';
  267. // Add a new buddy?
  268. echo '
  269. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=buddies" method="post" accept-charset="UTF-8">
  270. <div class="tborder add_buddy">
  271. <div class="title_bar">
  272. <h3 class="titlebg">', $txt['buddy_add'], '</h3>
  273. </div>
  274. <div class="roundframe">
  275. <dl class="settings">
  276. <dt>
  277. <label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label>
  278. </dt>
  279. <dd>
  280. <input type="text" name="new_buddy" id="new_buddy" size="30" class="input_text" />
  281. </dd>
  282. </dl>';
  283. if (!empty($context['token_check']))
  284. echo '
  285. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  286. echo '
  287. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  288. <input type="submit" value="', $txt['buddy_add_button'], '" class="button_submit" />
  289. <br class="clear_right" />
  290. </div>
  291. </div>
  292. </form>
  293. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?alp21"></script>
  294. <script type="text/javascript"><!-- // --><![CDATA[
  295. var oAddBuddySuggest = new smc_AutoSuggest({
  296. sSelf: \'oAddBuddySuggest\',
  297. sSessionId: smf_session_id,
  298. sSessionVar: smf_session_var,
  299. sSuggestId: \'new_buddy\',
  300. sControlId: \'new_buddy\',
  301. sSearchType: \'member\',
  302. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  303. bItemList: false
  304. });
  305. // ]]></script>';
  306. }
  307. // Template for showing the ignore list of the current user.
  308. function template_editIgnoreList()
  309. {
  310. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  311. echo '
  312. <div class="generic_list_wrapper" id="edit_buddies">
  313. <div class="title_bar">
  314. <h3 class="titlebg">
  315. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['editIgnoreList'], '
  316. </h3>
  317. </div>
  318. <table class="table_grid table_layout">
  319. <tr class="catbg">
  320. <th class="first_th" scope="col" width="20%">', $txt['name'], '</th>
  321. <th scope="col">', $txt['status'], '</th>';
  322. if ($context['can_send_email'])
  323. echo '
  324. <th scope="col">', $txt['email'], '</th>';
  325. echo '
  326. <th class="last_th" scope="col"></th>
  327. </tr>';
  328. // If they don't have anyone on their ignore list, don't list it!
  329. if (empty($context['ignore_list']))
  330. echo '
  331. <tr class="windowbg2">
  332. <td colspan="8" align="center"><strong>', $txt['no_ignore'], '</strong></td>
  333. </tr>';
  334. // Now loop through each buddy showing info on each.
  335. $alternate = false;
  336. foreach ($context['ignore_list'] as $member)
  337. {
  338. echo '
  339. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  340. <td>', $member['link'], '</td>
  341. <td align="center"><a href="', $member['online']['href'], '"><img src="', $member['online']['image_href'], '" alt="', $member['online']['text'], '" title="', $member['online']['text'], '" /></a></td>';
  342. if ($context['can_send_email'])
  343. echo '
  344. <td align="center">', ($member['show_email'] == 'no' ? '' : '<a href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $member['id'] . '" rel="nofollow"><img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . ' ' . $member['name'] . '" /></a>'), '</td>';
  345. echo '
  346. <td align="center"><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="', $settings['images_url'], '/icons/delete.png" alt="', $txt['ignore_remove'], '" title="', $txt['ignore_remove'], '" /></a></td>
  347. </tr>';
  348. $alternate = !$alternate;
  349. }
  350. echo '
  351. </table>
  352. </div>';
  353. // Add to the ignore list?
  354. echo '
  355. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore" method="post" accept-charset="UTF-8">
  356. <div class="tborder add_buddy">
  357. <div class="title_bar">
  358. <h3 class="titlebg">', $txt['ignore_add'], '</h3>
  359. </div>
  360. <div class="roundframe">
  361. <dl class="settings">
  362. <dt>
  363. <label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label>
  364. </dt>
  365. <dd>
  366. <input type="text" name="new_ignore" id="new_ignore" size="25" class="input_text" />
  367. </dd>
  368. </dl>';
  369. if (!empty($context['token_check']))
  370. echo '
  371. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  372. echo '
  373. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  374. <input type="submit" value="', $txt['ignore_add_button'], '" class="button_submit" />
  375. <br class="clear_right" />
  376. </div>
  377. </div>
  378. </form>
  379. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?alp21"></script>
  380. <script type="text/javascript"><!-- // --><![CDATA[
  381. var oAddIgnoreSuggest = new smc_AutoSuggest({
  382. sSelf: \'oAddIgnoreSuggest\',
  383. sSessionId: smf_session_id,
  384. sSessionVar: smf_session_var,
  385. sSuggestId: \'new_ignore\',
  386. sControlId: \'new_ignore\',
  387. sSearchType: \'member\',
  388. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  389. bItemList: false
  390. });
  391. // ]]></script>';
  392. }
  393. // This template shows an admin information on a users IP addresses used and errors attributed to them.
  394. function template_trackActivity()
  395. {
  396. global $context, $settings, $options, $scripturl, $txt;
  397. // The first table shows IP information about the user.
  398. echo '
  399. <div class="generic_list_wrapper">
  400. <div class="title_bar">
  401. <h3 class="titlebg"><strong>', $txt['view_ips_by'], ' ', $context['member']['name'], '</strong></h3>
  402. </div>';
  403. // The last IP the user used.
  404. echo '
  405. <div id="tracking" class="windowbg2">
  406. <div class="content">
  407. <dl class="noborder">
  408. <dt>', $txt['most_recent_ip'], ':
  409. ', (empty($context['last_ip2']) ? '' : '<br />
  410. <span class="smalltext">(<a href="' . $scripturl . '?action=quickhelp;help=whytwoip" onclick="return reqOverlayDiv(this.href);">' . $txt['why_two_ip_address'] . '</a>)</span>'), '
  411. </dt>
  412. <dd>
  413. <a href="', $scripturl, '?action=profile;area=history;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
  414. // Second address detected?
  415. if (!empty($context['last_ip2']))
  416. echo '
  417. , <a href="', $scripturl, '?action=profile;area=history;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
  418. echo '
  419. </dd>';
  420. // Lists of IP addresses used in messages / error messages.
  421. echo '
  422. <dt>', $txt['ips_in_messages'], ':</dt>
  423. <dd>
  424. ', (count($context['ips']) > 0 ? implode(', ', $context['ips']) : '(' . $txt['none'] . ')'), '
  425. </dd>
  426. <dt>', $txt['ips_in_errors'], ':</dt>
  427. <dd>
  428. ', (count($context['ips']) > 0 ? implode(', ', $context['error_ips']) : '(' . $txt['none'] . ')'), '
  429. </dd>';
  430. // List any members that have used the same IP addresses as the current member.
  431. echo '
  432. <dt>', $txt['members_in_range'], ':</dt>
  433. <dd>
  434. ', (count($context['members_in_range']) > 0 ? implode(', ', $context['members_in_range']) : '(' . $txt['none'] . ')'), '
  435. </dd>
  436. </dl>
  437. </div>
  438. </div>
  439. </div>';
  440. // Show the track user list.
  441. template_show_list('track_user_list');
  442. }
  443. // The template for trackIP, allowing the admin to see where/who a certain IP has been used.
  444. function template_trackIP()
  445. {
  446. global $context, $settings, $options, $scripturl, $txt;
  447. // This function always defaults to the last IP used by a member but can be set to track any IP.
  448. // The first table in the template gives an input box to allow the admin to enter another IP to track.
  449. echo '
  450. <div class="tborder">
  451. <div class="cat_bar">
  452. <h3 class="catbg">', $txt['trackIP'], '</h3>
  453. </div>
  454. <div class="roundframe">
  455. <form action="', $context['base_url'], '" method="post" accept-charset="UTF-8">
  456. <dl class="settings">
  457. <dt>
  458. <label for="searchip"><strong>', $txt['enter_ip'], ':</strong></label>
  459. </dt>
  460. <dd>
  461. <input type="text" name="searchip" value="', $context['ip'], '" class="input_text" />
  462. </dd>
  463. </dl>
  464. <input type="submit" value="', $txt['trackIP'], '" class="button_submit" />
  465. <br class="clear_right" />
  466. </form>
  467. </div>
  468. </div>
  469. <div class="generic_list_wrapper">';
  470. // The table inbetween the first and second table shows links to the whois server for every region.
  471. if ($context['single_ip'])
  472. {
  473. echo '
  474. <div class="title_bar">
  475. <h3 class="titlebg">', $txt['whois_title'], ' ', $context['ip'], '</h3>
  476. </div>
  477. <div class="windowbg2">
  478. <div class="padding">';
  479. foreach ($context['whois_servers'] as $server)
  480. echo '
  481. <a href="', $server['url'], '" target="_blank" class="new_win"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br />';
  482. echo '
  483. </div>
  484. </div>';
  485. }
  486. // The second table lists all the members who have been logged as using this IP address.
  487. echo '
  488. <div class="title_bar">
  489. <h3 class="titlebg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
  490. </div>';
  491. if (empty($context['ips']))
  492. echo '
  493. <p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>';
  494. else
  495. {
  496. echo '
  497. <table class="table_grid" cellspacing="0" width="100%">
  498. <thead>
  499. <tr class="catbg">
  500. <th class="first_th" scope="col">', $txt['ip_address'], '</th>
  501. <th class="last_th" scope="col">', $txt['display_name'], '</th>
  502. </tr>
  503. </thead>
  504. <tbody>';
  505. // Loop through each of the members and display them.
  506. foreach ($context['ips'] as $ip => $memberlist)
  507. echo '
  508. <tr>
  509. <td class="windowbg2"><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
  510. <td class="windowbg2">', implode(', ', $memberlist), '</td>
  511. </tr>';
  512. echo '
  513. </tbody>
  514. </table>';
  515. }
  516. echo '
  517. </div>';
  518. template_show_list('track_message_list');
  519. echo '<br />';
  520. template_show_list('track_user_list');
  521. }
  522. function template_action_showPermissions()
  523. {
  524. global $context, $settings, $options, $scripturl, $txt;
  525. echo '
  526. <div class="cat_bar">
  527. <h3 class="catbg">
  528. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['showPermissions'], '
  529. </h3>
  530. </div>';
  531. if ($context['member']['has_all_permissions'])
  532. {
  533. echo '
  534. <p class="windowbg description">', $txt['showPermissions_all'], '</p>';
  535. }
  536. else
  537. {
  538. echo '
  539. <p class="description">',$txt['showPermissions_help'],'</p>
  540. <div id="permissions" class="flow_hidden">';
  541. if (!empty($context['no_access_boards']))
  542. {
  543. echo '
  544. <div class="cat_bar">
  545. <h3 class="catbg">', $txt['showPermissions_restricted_boards'], '</h3>
  546. </div>
  547. <div class="windowbg smalltext">
  548. <div class="content">', $txt['showPermissions_restricted_boards_desc'], ':<br />';
  549. foreach ($context['no_access_boards'] as $no_access_board)
  550. echo '
  551. <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
  552. echo '
  553. </div>
  554. </div>';
  555. }
  556. // General Permissions section.
  557. echo '
  558. <div class="tborder">
  559. <div class="cat_bar">
  560. <h3 class="catbg">', $txt['showPermissions_general'], '</h3>
  561. </div>';
  562. if (!empty($context['member']['permissions']['general']))
  563. {
  564. echo '
  565. <table class="table_grid" width="100%" cellspacing="0">
  566. <thead>
  567. <tr class="titlebg">
  568. <th class="lefttext first_th" scope="col" width="50%">', $txt['showPermissions_permission'], '</th>
  569. <th class="lefttext last_th" scope="col" width="50%">', $txt['showPermissions_status'], '</th>
  570. </tr>
  571. </thead>
  572. <tbody>';
  573. foreach ($context['member']['permissions']['general'] as $permission)
  574. {
  575. echo '
  576. <tr>
  577. <td class="windowbg" title="', $permission['id'], '">
  578. ', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], '
  579. </td>
  580. <td class="windowbg2 smalltext">';
  581. if ($permission['is_denied'])
  582. echo '
  583. <span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']),'</span>';
  584. else
  585. echo '
  586. ', $txt['showPermissions_given'], ':&nbsp;', implode(', ', $permission['groups']['allowed']);
  587. echo '
  588. </td>
  589. </tr>';
  590. }
  591. echo '
  592. </tbody>
  593. </table>
  594. </div><br />';
  595. }
  596. else
  597. echo '
  598. <p class="windowbg2 description">', $txt['showPermissions_none_general'], '</p>';
  599. // Board permission section.
  600. echo '
  601. <div class="tborder">
  602. <form action="' . $scripturl . '?action=profile;u=', $context['id_member'], ';area=permissions#board_permissions" method="post" accept-charset="UTF-8">
  603. <div class="cat_bar">
  604. <h3 class="catbg">
  605. <a id="board_permissions"></a>', $txt['showPermissions_select'], ':
  606. <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
  607. <option value="0"', $context['board'] == 0 ? ' selected="selected"' : '', '>', $txt['showPermissions_global'], '&nbsp;</option>';
  608. if (!empty($context['boards']))
  609. echo '
  610. <option value="" disabled="disabled">---------------------------</option>';
  611. // Fill the box with any local permission boards.
  612. foreach ($context['boards'] as $board)
  613. echo '
  614. <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
  615. echo '
  616. </select>
  617. </h3>
  618. </div>
  619. </form>';
  620. if (!empty($context['member']['permissions']['board']))
  621. {
  622. echo '
  623. <table class="table_grid" width="100%" cellspacing="0">
  624. <thead>
  625. <tr class="titlebg">
  626. <th class="lefttext first_th" scope="col" width="50%">', $txt['showPermissions_permission'], '</th>
  627. <th class="lefttext last_th" scope="col" width="50%">', $txt['showPermissions_status'], '</th>
  628. </tr>
  629. </thead>
  630. <tbody>';
  631. foreach ($context['member']['permissions']['board'] as $permission)
  632. {
  633. echo '
  634. <tr>
  635. <td class="windowbg" title="', $permission['id'], '">
  636. ', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], '
  637. </td>
  638. <td class="windowbg2 smalltext">';
  639. if ($permission['is_denied'])
  640. {
  641. echo '
  642. <span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
  643. }
  644. else
  645. {
  646. echo '
  647. ', $txt['showPermissions_given'], ': &nbsp;', implode(', ', $permission['groups']['allowed']);
  648. }
  649. echo '
  650. </td>
  651. </tr>';
  652. }
  653. echo '
  654. </tbody>
  655. </table>';
  656. }
  657. else
  658. echo '
  659. <p class="windowbg2 description">', $txt['showPermissions_none_board'], '</p>';
  660. echo '
  661. </div>
  662. </div>';
  663. }
  664. }
  665. // Template for user statistics, showing graphs and the like.
  666. function template_action_statPanel()
  667. {
  668. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  669. // First, show a few text statistics such as post/topic count.
  670. echo '
  671. <div class="cat_bar">
  672. <h3 class="catbg">
  673. <img src="', $settings['images_url'], '/stats_info.png" alt="" class="icon" />
  674. ', $txt['statPanel_generalStats'], ' - ', $context['member']['name'], '
  675. </h3>
  676. </div>
  677. <div id="profileview">
  678. <div id="generalstats">
  679. <div class="windowbg2">
  680. <div class="content">
  681. <dl>
  682. <dt>', $txt['statPanel_total_time_online'], ':</dt>
  683. <dd>', $context['time_logged_in'], '</dd>
  684. <dt>', $txt['statPanel_total_posts'], ':</dt>
  685. <dd>', $context['num_posts'], ' ', $txt['statPanel_posts'], '</dd>
  686. <dt>', $txt['statPanel_total_topics'], ':</dt>
  687. <dd>', $context['num_topics'], ' ', $txt['statPanel_topics'], '</dd>
  688. <dt>', $txt['statPanel_users_polls'], ':</dt>
  689. <dd>', $context['num_polls'], ' ', $txt['statPanel_polls'], '</dd>
  690. <dt>', $txt['statPanel_users_votes'], ':</dt>
  691. <dd>', $context['num_votes'], ' ', $txt['statPanel_votes'], '</dd>
  692. </dl>
  693. </div>
  694. </div>
  695. </div>';
  696. // This next section draws a graph showing what times of day they post the most.
  697. echo '
  698. <div id="activitytime" class="flow_hidden">
  699. <div class="cat_bar">
  700. <h3 class="catbg">
  701. <img src="', $settings['images_url'], '/stats_history.png" alt="" class="icon" />', $txt['statPanel_activityTime'], '
  702. </h3>
  703. </div>
  704. <div class="windowbg2">
  705. <div class="content">';
  706. // If they haven't post at all, don't draw the graph.
  707. if (empty($context['posts_by_time']))
  708. echo '
  709. <span class="centertext">', $txt['statPanel_noPosts'], '</span>';
  710. // Otherwise do!
  711. else
  712. {
  713. echo '
  714. <ul class="activity_stats flow_hidden">';
  715. // The labels.
  716. foreach ($context['posts_by_time'] as $time_of_day)
  717. {
  718. echo '
  719. <li', $time_of_day['is_last'] ? ' class="last"' : '', '>
  720. <div class="bar" style="padding-top: ', ((int) (100 - $time_of_day['relative_percent'])), 'px;" title="', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '">
  721. <div style="height: ', (int) $time_of_day['relative_percent'], 'px;">
  722. <span>', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '</span>
  723. </div>
  724. </div>
  725. <span class="stats_hour">', $time_of_day['hour_format'], '</span>
  726. </li>';
  727. }
  728. echo '
  729. </ul>';
  730. }
  731. echo '
  732. <span class="clear" />
  733. </div>
  734. </div>
  735. </div>';
  736. // Two columns with the most popular boards by posts and activity (activity = users posts / total posts).
  737. echo '
  738. <div class="flow_hidden">
  739. <div id="popularposts">
  740. <div class="cat_bar">
  741. <h3 class="catbg">
  742. <img src="', $settings['images_url'], '/stats_replies.png" alt="" class="icon" />', $txt['statPanel_topBoards'], '
  743. </h3>
  744. </div>
  745. <div class="windowbg2">
  746. <div class="content">';
  747. if (empty($context['popular_boards']))
  748. echo '
  749. <span class="centertext">', $txt['statPanel_noPosts'], '</span>';
  750. else
  751. {
  752. echo '
  753. <dl>';
  754. // Draw a bar for every board.
  755. foreach ($context['popular_boards'] as $board)
  756. {
  757. echo '
  758. <dt>', $board['link'], '</dt>
  759. <dd>
  760. <div class="profile_pie" style="background-position: -', ((int) ($board['posts_percent'] / 5) * 20), 'px 0;" title="', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), '">
  761. ', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), '
  762. </div>
  763. <span>', empty($context['hide_num_posts']) ? $board['posts'] : '', '</span>
  764. </dd>';
  765. }
  766. echo '
  767. </dl>';
  768. }
  769. echo '
  770. </div>
  771. </div>
  772. </div>';
  773. echo '
  774. <div id="popularactivity">
  775. <div class="cat_bar">
  776. <h3 class="catbg">
  777. <img src="', $settings['images_url'], '/stats_replies.png" alt="" class="icon" />', $txt['statPanel_topBoardsActivity'], '
  778. </h3>
  779. </div>
  780. <div class="windowbg2">
  781. <div class="content">';
  782. if (empty($context['board_activity']))
  783. echo '
  784. <span>', $txt['statPanel_noPosts'], '</span>';
  785. else
  786. {
  787. echo '
  788. <dl>';
  789. // Draw a bar for every board.
  790. foreach ($context['board_activity'] as $activity)
  791. {
  792. echo '
  793. <dt>', $activity['link'], '</dt>
  794. <dd>
  795. <div class="profile_pie" style="background-position: -', ((int) ($activity['percent'] / 5) * 20), 'px 0;" title="', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), '">
  796. ', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), '
  797. </div>
  798. <span>', $activity['percent'], '%</span>
  799. </dd>';
  800. }
  801. echo '
  802. </dl>';
  803. }
  804. echo '
  805. </div>
  806. </div>
  807. </div>
  808. </div>';
  809. echo '
  810. </div>';
  811. }
  812. // Template for editing profile options.
  813. function template_edit_options()
  814. {
  815. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  816. // The main header!
  817. echo '
  818. <form action="', (!empty($context['profile_custom_submit_url']) ? $context['profile_custom_submit_url'] : $scripturl . '?action=profile;area=' . $context['menu_item_selected'] . ';u=' . $context['id_member']), '" method="post" accept-charset="UTF-8" name="creator" id="creator" enctype="multipart/form-data" onsubmit="return checkProfileSubmit();">
  819. <div class="cat_bar">
  820. <h3 class="catbg">
  821. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />';
  822. // Don't say "Profile" if this isn't the profile...
  823. if (!empty($context['profile_header_text']))
  824. echo '
  825. ', $context['profile_header_text'];
  826. else
  827. echo '
  828. ', $txt['profile'];
  829. echo '
  830. </h3>
  831. </div>';
  832. // Have we some description?
  833. if ($context['page_desc'])
  834. echo '
  835. <p class="windowbg description">', $context['page_desc'], '</p>';
  836. echo '
  837. <div class="windowbg2">
  838. <div class="content">';
  839. // Any bits at the start?
  840. if (!empty($context['profile_prehtml']))
  841. echo '
  842. <div>', $context['profile_prehtml'], '</div>';
  843. if (!empty($context['profile_fields']))
  844. echo '
  845. <dl>';
  846. // Start the big old loop 'of love.
  847. $lastItem = 'hr';
  848. foreach ($context['profile_fields'] as $key => $field)
  849. {
  850. // We add a little hack to be sure we never get more than one hr in a row!
  851. if ($lastItem == 'hr' && $field['type'] == 'hr')
  852. continue;
  853. $lastItem = $field['type'];
  854. if ($field['type'] == 'hr')
  855. {
  856. echo '
  857. </dl>
  858. <hr width="100%" size="1" class="hrcolor clear" />
  859. <dl>';
  860. }
  861. elseif ($field['type'] == 'callback')
  862. {
  863. if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
  864. {
  865. $callback_func = 'template_profile_' . $field['callback_func'];
  866. $callback_func();
  867. }
  868. }
  869. else
  870. {
  871. echo '
  872. <dt>
  873. <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
  874. // Does it have any subtext to show?
  875. if (!empty($field['subtext']))
  876. echo '
  877. <br />
  878. <span class="smalltext">', $field['subtext'], '</span>';
  879. echo '
  880. </dt>
  881. <dd>';
  882. // Want to put something infront of the box?
  883. if (!empty($field['preinput']))
  884. echo '
  885. ', $field['preinput'];
  886. // What type of data are we showing?
  887. if ($field['type'] == 'label')
  888. echo '
  889. ', $field['value'];
  890. // Maybe it's a text box - very likely!
  891. elseif (in_array($field['type'], array('int', 'float', 'text', 'password')))
  892. echo '
  893. <input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '" />';
  894. // You "checking" me out? ;)
  895. elseif ($field['type'] == 'check')
  896. echo '
  897. <input type="hidden" name="', $key, '" value="0" /><input type="checkbox" name="', $key, '" id="', $key, '" ', !empty($field['value']) ? ' checked="checked"' : '', ' value="1" class="input_check" ', $field['input_attr'], ' />';
  898. // Always fun - select boxes!
  899. elseif ($field['type'] == 'select')
  900. {
  901. echo '
  902. <select name="', $key, '" id="', $key, '">';
  903. if (isset($field['options']))
  904. {
  905. // Is this some code to generate the options?
  906. if (!is_array($field['options']))
  907. $field['options'] = eval($field['options']);
  908. // Assuming we now have some!
  909. if (is_array($field['options']))
  910. foreach ($field['options'] as $value => $name)
  911. echo '
  912. <option value="', $value, '" ', $value == $field['value'] ? 'selected="selected"' : '', '>', $name, '</option>';
  913. }
  914. echo '
  915. </select>';
  916. }
  917. // Something to end with?
  918. if (!empty($field['postinput']))
  919. echo '
  920. ', $field['postinput'];
  921. echo '
  922. </dd>';
  923. }
  924. }
  925. if (!empty($context['profile_fields']))
  926. echo '
  927. </dl>';
  928. // Are there any custom profile fields - if so print them!
  929. if (!empty($context['custom_fields']))
  930. {
  931. if ($lastItem != 'hr')
  932. echo '
  933. <hr width="100%" size="1" class="hrcolor clear" />';
  934. echo '
  935. <dl>';
  936. foreach ($context['custom_fields'] as $field)
  937. {
  938. echo '
  939. <dt>
  940. <strong>', $field['name'], ': </strong><br />
  941. <span class="smalltext">', $field['desc'], '</span>
  942. </dt>
  943. <dd>
  944. ', $field['input_html'], '
  945. </dd>';
  946. }
  947. echo '
  948. </dl>';
  949. }
  950. // Any closing HTML?
  951. if (!empty($context['profile_posthtml']))
  952. echo '
  953. <div>', $context['profile_posthtml'], '</div>';
  954. // Only show the password box if it's actually needed.
  955. if ($context['require_password'])
  956. echo '
  957. <dl>
  958. <dt>
  959. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br />
  960. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  961. </dt>
  962. <dd>
  963. <input type="password" name="oldpasswrd" id="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  964. </dd>
  965. </dl>';
  966. echo '
  967. <hr class="hrcolor" />';
  968. // The button shouldn't say "Change profile" unless we're changing the profile...
  969. if (!empty($context['submit_button_text']))
  970. echo '
  971. <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button_submit" />';
  972. else
  973. echo '
  974. <input type="submit" name="save" value="', $txt['change_profile'], '" class="button_submit" />';
  975. if (!empty($context['token_check']))
  976. echo '
  977. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  978. echo '
  979. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  980. <input type="hidden" name="u" value="', $context['id_member'], '" />
  981. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  982. </div>
  983. </div>
  984. </form>';
  985. // Some javascript!
  986. echo '
  987. <script type="text/javascript"><!-- // --><![CDATA[
  988. function checkProfileSubmit()
  989. {';
  990. // If this part requires a password, make sure to give a warning.
  991. if ($context['require_password'])
  992. echo '
  993. // Did you forget to type your password?
  994. if (document.forms.creator.oldpasswrd.value == "")
  995. {
  996. alert("', $txt['required_security_reasons'], '");
  997. return false;
  998. }';
  999. // Any onsubmit javascript?
  1000. if (!empty($context['profile_onsubmit_javascript']))
  1001. echo '
  1002. ', $context['profile_javascript'];
  1003. echo '
  1004. }';
  1005. // Any totally custom stuff?
  1006. if (!empty($context['profile_javascript']))
  1007. echo '
  1008. ', $context['profile_javascript'];
  1009. echo '
  1010. // ]]></script>';
  1011. // Any final spellchecking stuff?
  1012. if (!empty($context['show_spellchecking']))
  1013. echo '
  1014. <form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="', $scripturl, '?action=spellcheck">
  1015. <input type="hidden" name="spellstring" value="" />
  1016. <input type="hidden" name="fulleditor" value="" />
  1017. </form>
  1018. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
  1019. }
  1020. // Personal Message settings.
  1021. function template_profile_pm_settings()
  1022. {
  1023. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1024. echo '
  1025. <dt>
  1026. <label for="pm_prefs">', $txt['pm_display_mode'], ':</label>
  1027. </dt>
  1028. <dd>
  1029. <select name="pm_prefs" id="pm_prefs" onchange="if (this.value == 2 &amp;&amp; !document.getElementById(\'copy_to_outbox\').checked) alert(\'', $txt['pm_recommend_enable_outbox'], '\');">
  1030. <option value="0"', $context['display_mode'] == 0 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_all'], '</option>
  1031. <option value="1"', $context['display_mode'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_one'], '</option>
  1032. <option value="2"', $context['display_mode'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_linked'], '</option>
  1033. </select>
  1034. </dd>
  1035. <dt>
  1036. <label for="view_newest_pm_first">', $txt['recent_pms_at_top'], '</label>
  1037. </dt>
  1038. <dd>
  1039. <input type="hidden" name="default_options[view_newest_pm_first]" value="0" />
  1040. <input type="checkbox" name="default_options[view_newest_pm_first]" id="view_newest_pm_first" value="1"', !empty($context['member']['options']['view_newest_pm_first']) ? ' checked="checked"' : '', ' class="input_check" />
  1041. </dd>
  1042. </dl>
  1043. <hr />
  1044. <dl>
  1045. <dt>
  1046. <label for="pm_receive_from">', $txt['pm_receive_from'], '</label>
  1047. </dt>
  1048. <dd>
  1049. <select name="pm_receive_from" id="pm_receive_from">
  1050. <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected="selected"' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
  1051. if (!empty($modSettings['enable_buddylist']))
  1052. echo '
  1053. <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_ignore'], '</option>
  1054. <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
  1055. echo '
  1056. <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_admins'], '</option>
  1057. </select>
  1058. </dd>
  1059. <dt>
  1060. <label for="pm_email_notify">', $txt['email_notify'], '</label>
  1061. </dt>
  1062. <dd>
  1063. <select name="pm_email_notify" id="pm_email_notify">
  1064. <option value="0"', empty($context['send_email']) ? ' selected="selected"' : '', '>', $txt['email_notify_never'], '</option>
  1065. <option value="1"', !empty($context['send_email']) && ($context['send_email'] == 1 || (empty($modSettings['enable_buddylist']) && $context['send_email'] > 1)) ? ' selected="selected"' : '', '>', $txt['email_notify_always'], '</option>';
  1066. if (!empty($modSettings['enable_buddylist']))
  1067. echo '
  1068. <option value="2"', !empty($context['send_email']) && $context['send_email'] > 1 ? ' selected="selected"' : '', '>', $txt['email_notify_buddies'], '</option>';
  1069. echo '
  1070. </select>
  1071. </dd>
  1072. <dt>
  1073. <label for="popup_messages">', $txt['popup_messages'], '</label>
  1074. </dt>
  1075. <dd>
  1076. <input type="hidden" name="default_options[popup_messages]" value="0" />
  1077. <input type="checkbox" name="default_options[popup_messages]" id="popup_messages" value="1"', !empty($context['member']['options']['popup_messages']) ? ' checked="checked"' : '', ' class="input_check" />
  1078. </dd>
  1079. </dl>
  1080. <hr />
  1081. <dl>
  1082. <dt>
  1083. <label for="copy_to_outbox"> ', $txt['copy_to_outbox'], '</label>
  1084. </dt>
  1085. <dd>
  1086. <input type="hidden" name="default_options[copy_to_outbox]" value="0" />
  1087. <input type="checkbox" name="default_options[copy_to_outbox]" id="copy_to_outbox" value="1"', !empty($context['member']['options']['copy_to_outbox']) ? ' checked="checked"' : '', ' class="input_check" />
  1088. </dd>
  1089. <dt>
  1090. <label for="pm_remove_inbox_label">', $txt['pm_remove_inbox_label'], '</label>
  1091. </dt>
  1092. <dd>
  1093. <input type="hidden" name="default_options[pm_remove_inbox_label]" value="0" />
  1094. <input type="checkbox" name="default_options[pm_remove_inbox_label]" id="pm_remove_inbox_label" value="1"', !empty($context['member']['options']['pm_remove_inbox_label']) ? ' checked="checked"' : '', ' class="input_check" />
  1095. </dd>';
  1096. }
  1097. // Template for showing theme settings. Note: template_options() actually adds the theme specific options.
  1098. function template_profile_theme_settings()
  1099. {
  1100. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1101. echo '
  1102. <dt>
  1103. <label for="show_board_desc">', $txt['board_desc_inside'], '</label>
  1104. </dt>
  1105. <dd>
  1106. <input type="hidden" name="default_options[show_board_desc]" value="0" />
  1107. <input type="checkbox" name="default_options[show_board_desc]" id="show_board_desc" value="1"', !empty($context['member']['options']['show_board_desc']) ? ' checked="checked"' : '', ' class="input_check" />
  1108. </dd>
  1109. <dt>
  1110. <label for="show_children">', $txt['show_children'], '</label>
  1111. </dt>
  1112. <dd>
  1113. <input type="hidden" name="default_options[show_children]" value="0" />
  1114. <input type="checkbox" name="default_options[show_children]" id="show_children" value="1"', !empty($context['member']['options']['show_children']) ? ' checked="checked"' : '', ' class="input_check" />
  1115. </dd>
  1116. <dt>
  1117. <label for="use_sidebar_menu">', $txt['use_sidebar_menu'], '</label>
  1118. </dt>
  1119. <dd>
  1120. <input type="hidden" name="default_options[use_sidebar_menu]" value="0" />
  1121. <input type="checkbox" name="default_options[use_sidebar_menu]" id="use_sidebar_menu" value="1"', !empty($context['member']['options']['use_sidebar_menu']) ? ' checked="checked"' : '', ' class="input_check" />
  1122. </dd>
  1123. <dt>
  1124. <label for="show_no_avatars">', $txt['show_no_avatars'], '</label>
  1125. </dt>
  1126. <dd>
  1127. <input type="hidden" name="default_options[show_no_avatars]" value="0" />
  1128. <input type="checkbox" name="default_options[show_no_avatars]" id="show_no_avatars" value="1"', !empty($context['member']['options']['show_no_avatars']) ? ' checked="checked"' : '', ' class="input_check" />
  1129. </dd>
  1130. <dt>
  1131. <label for="show_no_signatures">', $txt['show_no_signatures'], '</label>
  1132. </dt>
  1133. <dd>
  1134. <input type="hidden" name="default_options[show_no_signatures]" value="0" />
  1135. <input type="checkbox" name="default_options[show_no_signatures]" id="show_no_signatures" value="1"', !empty($context['member']['options']['show_no_signatures']) ? ' checked="checked"' : '', ' class="input_check" />
  1136. </dd>';
  1137. if ($settings['allow_no_censored'])
  1138. echo '
  1139. <dt>
  1140. <label for="show_no_censored">' . $txt['show_no_censored'] . '</label>
  1141. </dt>
  1142. <dd>
  1143. <input type="hidden" name="default_options[show_no_censored]" value="0" />
  1144. <input type="checkbox" name="default_options[show_no_censored]" id="show_no_censored" value="1"' . (!empty($context['member']['options']['show_no_censored']) ? ' checked="checked"' : '') . ' class="input_check" />
  1145. </dd>';
  1146. echo '
  1147. <dt>
  1148. <label for="return_to_post">', $txt['return_to_post'], '</label>
  1149. </dt>
  1150. <dd>
  1151. <input type="hidden" name="default_options[return_to_post]" value="0" />
  1152. <input type="checkbox" name="default_options[return_to_post]" id="return_to_post" value="1"', !empty($context['member']['options']['return_to_post']) ? ' checked="checked"' : '', ' class="input_check" />
  1153. </dd>
  1154. <dt>
  1155. <label for="no_new_reply_warning">', $txt['no_new_reply_warning'], '</label>
  1156. </dt>
  1157. <dd>
  1158. <input type="hidden" name="default_options[no_new_reply_warning]" value="0" />
  1159. <input type="checkbox" name="default_options[no_new_reply_warning]" id="no_new_reply_warning" value="1"', !empty($context['member']['options']['no_new_reply_warning']) ? ' checked="checked"' : '', ' class="input_check" />
  1160. </dd>';
  1161. if (!empty($modSettings['enable_buddylist']))
  1162. echo '
  1163. <dt>
  1164. <label for="posts_apply_ignore_list">', $txt['posts_apply_ignore_list'], '</label>
  1165. </dt>
  1166. <dd>
  1167. <input type="hidden" name="default_options[posts_apply_ignore_list]" value="0" />
  1168. <input type="checkbox" name="default_options[posts_apply_ignore_list]" id="posts_apply_ignore_list" value="1"', !empty($context['member']['options']['posts_apply_ignore_list']) ? ' checked="checked"' : '', ' class="input_check" />
  1169. </dd>';
  1170. echo '
  1171. <dt>
  1172. <label for="view_newest_first">', $txt['recent_posts_at_top'], '</label>
  1173. </dt>
  1174. <dd>
  1175. <input type="hidden" name="default_options[view_newest_first]" value="0" />
  1176. <input type="checkbox" name="default_options[view_newest_first]" id="view_newest_first" value="1"', !empty($context['member']['options']['view_newest_first']) ? ' checked="checked"' : '', ' class="input_check" />
  1177. </dd>';
  1178. // Choose WYSIWYG settings?
  1179. if (empty($modSettings['disable_wysiwyg']))
  1180. echo '
  1181. <dt>
  1182. <label for="wysiwyg_default">', $txt['wysiwyg_default'], '</label>
  1183. </dt>
  1184. <dd>
  1185. <input type="hidden" name="default_options[wysiwyg_default]" value="0" />
  1186. <input type="checkbox" name="default_options[wysiwyg_default]" id="wysiwyg_default" value="1"', !empty($context['member']['options']['wysiwyg_default']) ? ' checked="checked"' : '', ' class="input_check" />
  1187. </dd>';
  1188. if (empty($modSettings['disableCustomPerPage']))
  1189. {
  1190. echo '
  1191. <dt>
  1192. <label for="topics_per_page">', $txt['topics_per_page'], '</label>
  1193. </dt>
  1194. <dd>
  1195. <select name="default_options[topics_per_page]" id="topics_per_page">
  1196. <option value="0"', empty($context['member']['options']['topics_per_page']) ? ' selected="selected"' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxTopics'], ')</option>
  1197. <option value="5"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 5 ? ' selected="selected"' : '', '>5</option>
  1198. <option value="10"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 10 ? ' selected="selected"' : '', '>10</option>
  1199. <option value="25"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 25 ? ' selected="selected"' : '', '>25</option>
  1200. <option value="50"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 50 ? ' selected="selected"' : '', '>50</option>
  1201. </select>
  1202. </dd>
  1203. <dt>
  1204. <label for="messages_per_page">', $txt['messages_per_page'], '</label>
  1205. </dt>
  1206. <dd>
  1207. <select name="default_options[messages_per_page]" id="messages_per_page">
  1208. <option value="0"', empty($context['member']['options']['messages_per_page']) ? ' selected="selected"' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxMessages'], ')</option>
  1209. <option value="5"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 5 ? ' selected="selected"' : '', '>5</option>
  1210. <option value="10"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 10 ? ' selected="selected"' : '', '>10</option>
  1211. <option value="25"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 25 ? ' selected="selected"' : '', '>25</option>
  1212. <option value="50"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 50 ? ' selected="selected"' : '', '>50</option>
  1213. </select>
  1214. </dd>';
  1215. }
  1216. if (!empty($modSettings['cal_enabled']))
  1217. echo '
  1218. <dt>
  1219. <label for="calendar_start_day">', $txt['calendar_start_day'], ':</label>
  1220. </dt>
  1221. <dd>
  1222. <select name="default_options[calendar_start_day]" id="calendar_start_day">
  1223. <option value="0"', empty($context['member']['options']['calendar_start_day']) ? ' selected="selected"' : '', '>', $txt['days'][0], '</option>
  1224. <option value="1"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 1 ? ' selected="selected"' : '', '>', $txt['days'][1], '</option>
  1225. <option value="6"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 6 ? ' selected="selected"' : '', '>', $txt['days'][6], '</option>
  1226. </select>
  1227. </dd>';
  1228. if (!empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_autosave_enabled']))
  1229. echo '
  1230. <dt>
  1231. <label for="drafts_autosave_enabled">', $txt['drafts_autosave_enabled'], '</label>
  1232. </dt>
  1233. <dd>
  1234. <input type="hidden" name="default_options[drafts_autosave_enabled]" value="0" />
  1235. <label for="drafts_autosave_enabled"><input type="checkbox" name="default_options[drafts_autosave_enabled]" id="drafts_autosave_enabled" value="1"', !empty($context['member']['options']['drafts_autosave_enabled']) ? ' checked="checked"' : '', ' class="input_check" /></label>
  1236. </dd>';
  1237. if (!empty($modSettings['drafts_enabled']) && !empty($modSettings['drafts_show_saved_enabled']))
  1238. echo '
  1239. <dt>
  1240. <label for="drafts_show_saved_enabled">', $txt['drafts_show_saved_enabled'], '</label>
  1241. </dt>
  1242. <dd>
  1243. <input type="hidden" name="default_options[drafts_show_saved_enabled]" value="0" />
  1244. <label for="drafts_show_saved_enabled"><input type="checkbox" name="default_options[drafts_show_saved_enabled]" id="drafts_show_saved_enabled" value="1"', !empty($context['member']['options']['drafts_show_saved_enabled']) ? ' checked="checked"' : '', ' class="input_check" /></label>
  1245. </dd>';
  1246. echo '
  1247. <dt>
  1248. <label for="display_quick_reply">', $txt['display_quick_reply'], '</label>
  1249. </dt>
  1250. <dd>
  1251. <select name="default_options[display_quick_reply]" id="display_quick_reply">
  1252. <option value="0"', empty($context['member']['options']['display_quick_reply']) ? ' selected="selected"' : '', '>', $txt['display_quick_reply1'], '</option>
  1253. <option value="1"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 1 ? ' selected="selected"' : '', '>', $txt['display_quick_reply2'], '</option>
  1254. <option value="2"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 2 ? ' selected="selected"' : '', '>', $txt['display_quick_reply3'], '</option>
  1255. </select>
  1256. </dd>
  1257. <dt>
  1258. <label for="use_editor_quick_reply">', $txt['use_editor_quick_reply'], '</label>
  1259. </dt>
  1260. <dd>
  1261. <input type="hidden" name="default_options[use_editor_quick_reply]" value="0" />
  1262. <label for="use_editor_quick_reply"><input type="checkbox" name="default_options[use_editor_quick_reply]" id="use_editor_quick_reply" value="1"', !empty($context['member']['options']['use_editor_quick_reply']) ? ' checked="checked"' : '', ' class="input_check" /></label>
  1263. </dd>
  1264. <dt>
  1265. <label for="display_quick_mod">', $txt['display_quick_mod'], '</label>
  1266. </dt>
  1267. <dd>
  1268. <select name="default_options[display_quick_mod]" id="display_quick_mod">
  1269. <option value="0"', empty($context['member']['options']['display_quick_mod']) ? ' selected="selected"' : '', '>', $txt['display_quick_mod_none'], '</option>
  1270. <option value="1"', !empty($context['member']['options']['display_quick_mod']) && $context['member']['options']['display_quick_mod'] == 1 ? ' selected="selected"' : '', '>', $txt['display_quick_mod_check'], '</option>
  1271. <option value="2"', !empty($context['member']['options']['display_quick_mod']) && $context['member']['options']['display_quick_mod'] != 1 ? ' selected="selected"' : '', '>', $txt['display_quick_mod_image'], '</option>
  1272. </select>
  1273. </dd>';
  1274. }
  1275. function template_action_notification()
  1276. {
  1277. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  1278. // The main containing header.
  1279. echo '
  1280. <form action="', $scripturl, '?action=profile;area=notification;save" method="post" accept-charset="UTF-8" id="notify_options" class="flow_hidden">
  1281. <div class="cat_bar">
  1282. <h3 class="catbg">
  1283. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['profile'], '
  1284. </h3>
  1285. </div>
  1286. <p class="windowbg description">', $txt['notification_info'], '</p>
  1287. <div class="windowbg2">
  1288. <div class="content">
  1289. <dl class="settings">';
  1290. // Allow notification on announcements to be disabled?
  1291. if (!empty($modSettings['allow_disableAnnounce']))
  1292. echo '
  1293. <dt>
  1294. <label for="notify_announcements">', $txt['notify_important_email'], '</label>
  1295. </dt>
  1296. <dd>
  1297. <input type="hidden" name="notify_announcements" value="0" />
  1298. <input type="checkbox" id="notify_announcements" name="notify_announcements"', !empty($context['member']['notify_announcements']) ? ' checked="checked"' : '', ' class="input_check" />
  1299. </dd>';
  1300. // More notification options.
  1301. echo '
  1302. <dt>
  1303. <label for="auto_notify">', $txt['auto_notify'], '</label>
  1304. </dt>
  1305. <dd>
  1306. <input type="hidden" name="default_options[auto_notify]" value="0" />
  1307. <input type="checkbox" id="auto_notify" name="default_options[auto_notify]" value="1"', !empty($context['member']['options']['auto_notify']) ? ' checked="checked"' : '', ' class="input_check" />
  1308. </dd>';
  1309. if (empty($modSettings['disallow_sendBody']))
  1310. echo '
  1311. <dt>
  1312. <label for="notify_send_body">', $txt['notify_send_body'], '</label>
  1313. </dt>
  1314. <dd>
  1315. <input type="hidden" name="notify_send_body" value="0" />
  1316. <input type="checkbox" id="notify_send_body" name="notify_send_body"', !empty($context['member']['notify_send_body']) ? ' checked="checked"' : '', ' class="input_check" />
  1317. </dd>';
  1318. echo '
  1319. <dt>
  1320. <label for="notify_regularity">', $txt['notify_regularity'], ':</label>
  1321. </dt>
  1322. <dd>
  1323. <select name="notify_regularity" id="notify_regularity">
  1324. <option value="0"', $context['member']['notify_regularity'] == 0 ? ' selected="selected"' : '', '>', $txt['notify_regularity_instant'], '</option>
  1325. <option value="1"', $context['member']['notify_regularity'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_regularity_first_only'], '</option>
  1326. <option value="2"', $context['member']['notify_regularity'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_regularity_daily'], '</option>
  1327. <option value="3"', $context['member']['notify_regularity'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_regularity_weekly'], '</option>
  1328. </select>
  1329. </dd>
  1330. <dt>
  1331. <label for="notify_types">', $txt['notify_send_types'], ':</label>
  1332. </dt>
  1333. <dd>
  1334. <select name="notify_types" id="notify_types">
  1335. <option value="1"', $context['member']['notify_types'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything'], '</option>
  1336. <option value="2"', $context['member']['notify_types'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything_own'], '</option>
  1337. <option value="3"', $context['member']['notify_types'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_send_type_only_replies'], '</option>
  1338. <option value="4"', $context['member']['notify_types'] == 4 ? ' selected="selected"' : '', '>', $txt['notify_send_type_nothing'], '</option>
  1339. </select>
  1340. </dd>
  1341. </dl>
  1342. <hr class="hrcolor" />
  1343. <div>
  1344. <input id="notify_submit" type="submit" value="', $txt['notify_save'], '" class="button_submit" />
  1345. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />', !empty($context['token_check']) ? '
  1346. <input type="hidden" name="' . $context[$context['token_check'] . '_token_var'] . '" value="' . $context[$context['token_check'] . '_token'] . '" />' : '', '
  1347. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1348. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1349. </div>
  1350. </div>
  1351. </div>
  1352. </form>
  1353. <br />';
  1354. template_show_list('topic_notification_list');
  1355. echo '
  1356. <br />';
  1357. template_show_list('board_notification_list');
  1358. }
  1359. // Template for choosing group membership.
  1360. function template_groupMembership()
  1361. {
  1362. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1363. // The main containing header.
  1364. echo '
  1365. <form action="', $scripturl, '?action=profile;area=groupmembership;save" method="post" accept-charset="UTF-8" name="creator" id="creator">
  1366. <div class="cat_bar">
  1367. <h3 class="catbg">
  1368. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['profile'], '
  1369. </h3>
  1370. </div>
  1371. <p class="description">', $txt['groupMembership_info'], '</p>';
  1372. // Do we have an update message?
  1373. if (!empty($context['update_message']))
  1374. echo '
  1375. <div class="infobox">
  1376. ', $context['update_message'], '.
  1377. </div>';
  1378. // Requesting membership to a group?
  1379. if (!empty($context['group_request']))
  1380. {
  1381. echo '
  1382. <div class="groupmembership">
  1383. <div class="cat_bar">
  1384. <h3 class="catbg">', $txt['request_group_membership'], '</h3>
  1385. </div>
  1386. <div class="roundframe">
  1387. ', $txt['request_group_membership_desc'], ':
  1388. <textarea name="reason" rows="4" cols="80" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 99%; min-width: 99%' : 'width: 99%') . ';"></textarea>
  1389. <div class="padding flow_auto" >
  1390. <input type="hidden" name="gid" value="', $context['group_request']['id'], '" />
  1391. <input type="submit" name="req" value="', $txt['submit_request'], '" class="button_submit" />
  1392. </div>
  1393. </div>
  1394. </div>';
  1395. }
  1396. else
  1397. {
  1398. echo '
  1399. <table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
  1400. <thead>
  1401. <tr class="catbg">
  1402. <th class="first_th" scope="col" ', $context['can_edit_primary'] ? ' colspan="2"' : '', '>', $txt['current_membergroups'], '</th>
  1403. <th class="last_th" scope="col"></th>
  1404. </tr>
  1405. </thead>
  1406. <tbody>';
  1407. $alternate = true;
  1408. foreach ($context['groups']['member'] as $group)
  1409. {
  1410. echo '
  1411. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '" id="primdiv_', $group['id'], '">';
  1412. if ($context['can_edit_primary'])
  1413. echo '
  1414. <td width="4%">
  1415. <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '" ', $group['is_primary'] ? 'checked="checked"' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');" ', $group['can_be_primary'] ? '' : 'disabled="disabled"', ' class="input_radio" />
  1416. </td>';
  1417. echo '
  1418. <td>
  1419. <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br /><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>
  1420. </td>
  1421. <td width="15%" class="righttext">';
  1422. // Can they leave their group?
  1423. if ($group['can_leave'])
  1424. echo '
  1425. <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>';
  1426. echo '
  1427. </td>
  1428. </tr>';
  1429. $alternate = !$alternate;
  1430. }
  1431. echo '
  1432. </tbody>
  1433. </table>';
  1434. if ($context['can_edit_primary'])
  1435. echo '
  1436. <div class="padding righttext">
  1437. <input type="submit" value="', $txt['make_primary'], '" class="button_submit" />
  1438. </div>';
  1439. // Any groups they can join?
  1440. if (!empty($context['groups']['available']))
  1441. {
  1442. echo '
  1443. <br />
  1444. <table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
  1445. <thead>
  1446. <tr class="catbg">
  1447. <th class="first_th" scope="col">
  1448. ', $txt['available_groups'], '
  1449. </th>
  1450. <th class="last_th" scope="col"></th>
  1451. </tr>
  1452. </thead>
  1453. <tbody>';
  1454. $alternate = true;
  1455. foreach ($context['groups']['available'] as $group)
  1456. {
  1457. echo '
  1458. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  1459. <td>
  1460. <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br /><span class="smalltext">' . $group['desc'] . '</span>' : ''), '
  1461. </td>
  1462. <td width="15%" class="lefttext">';
  1463. if ($group['type'] == 3)
  1464. echo '
  1465. <a class="button_link" href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">', $txt['join_group'], '</a>';
  1466. elseif ($group['type'] == 2 && $group['pending'])
  1467. echo '
  1468. ', $txt['approval_pending'];
  1469. elseif ($group['type'] == 2)
  1470. echo '
  1471. <a class="button_link" href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '">', $txt['request_group'], '</a>';
  1472. // <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1473. echo '
  1474. </td>
  1475. </tr>';
  1476. $alternate = !$alternate;
  1477. }
  1478. echo '
  1479. </tbody>
  1480. </table>';
  1481. }
  1482. // Javascript for the selector stuff.
  1483. echo '
  1484. <script type="text/javascript"><!-- // --><![CDATA[
  1485. var prevClass = "";
  1486. var prevDiv = "";';
  1487. if (isset($context['groups']['member'][$context['primary_group']]))
  1488. echo '
  1489. highlightSelected("primdiv_' . $context['primary_group'] . '");';
  1490. echo '
  1491. // ]]></script>';
  1492. }
  1493. if (!empty($context['token_check']))
  1494. echo '
  1495. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1496. echo '
  1497. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1498. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1499. </form>';
  1500. }
  1501. function template_ignoreboards()
  1502. {
  1503. global $context, $txt, $settings, $scripturl;
  1504. // The main containing header.
  1505. echo '
  1506. <form action="', $scripturl, '?action=profile;area=ignoreboards;save" method="post" accept-charset="UTF-8" name="creator" id="creator">
  1507. <div class="cat_bar">
  1508. <h3 class="catbg">
  1509. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['profile'], '
  1510. </h3>
  1511. </div>
  1512. <p class="description">', $txt['ignoreboards_info'], '</p>
  1513. <div class="windowbg2">
  1514. <div class="content flow_hidden">
  1515. <ul class="ignoreboards floatleft">';
  1516. $i = 0;
  1517. $limit = ceil($context['num_boards'] / 2);
  1518. foreach ($context['categories'] as $category)
  1519. {
  1520. if ($i == $limit)
  1521. {
  1522. echo '
  1523. </ul>
  1524. <ul class="ignoreboards floatright">';
  1525. $i++;
  1526. }
  1527. echo '
  1528. <li class="category">
  1529. <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'creator\'); return false;">', $category['name'], '</a>
  1530. <ul>';
  1531. foreach ($category['boards'] as $board)
  1532. {
  1533. if ($i == $limit)
  1534. echo '
  1535. </ul>
  1536. </li>
  1537. </ul>
  1538. <ul class="ignoreboards floatright">
  1539. <li class="category">
  1540. <ul>';
  1541. echo '
  1542. <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
  1543. <label for="ignore_brd', $board['id'], '"><input type="checkbox" id="ignore_brd', $board['id'], '" name="ignore_brd[', $board['id'], ']" value="', $board['id'], '"', $board['selected'] ? ' checked="checked"' : '', ' class="input_check" /> ', $board['name'], '</label>
  1544. </li>';
  1545. $i++;
  1546. }
  1547. echo '
  1548. </ul>
  1549. </li>';
  1550. }
  1551. echo '
  1552. </ul>';
  1553. // Show the standard "Save Settings" profile button.
  1554. template_profile_save();
  1555. echo '
  1556. </div>
  1557. </div>
  1558. </form>
  1559. <br />';
  1560. }
  1561. // Simple load some theme variables common to several warning templates.
  1562. function template_load_warning_variables()
  1563. {
  1564. global $modSettings, $context;
  1565. $context['warningBarWidth'] = 200;
  1566. // Setup the colors - this is a little messy for theming.
  1567. $context['colors'] = array(
  1568. 0 => 'green',
  1569. $modSettings['warning_watch'] => 'darkgreen',
  1570. $modSettings['warning_moderate'] => 'orange',
  1571. $modSettings['warning_mute'] => 'red',
  1572. );
  1573. // Work out the starting color.
  1574. $context['current_color'] = $context['colors'][0];
  1575. foreach ($context['colors'] as $limit => $color)
  1576. if ($context['member']['warning'] >= $limit)
  1577. $context['current_color'] = $color;
  1578. }
  1579. // Show all warnings of a user?
  1580. function template_viewWarning()
  1581. {
  1582. global $context, $txt, $scripturl, $settings;
  1583. template_load_warning_variables();
  1584. echo '
  1585. <div class="cat_bar">
  1586. <h3 class="catbg">
  1587. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />
  1588. ', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), '
  1589. </h3>
  1590. </div>
  1591. <p class="description">', $txt['viewWarning_help'], '</p>
  1592. <div class="windowbg">
  1593. <div class="content">
  1594. <dl class="settings">
  1595. <dt>
  1596. <strong>', $txt['profile_warning_name'], ':</strong>
  1597. </dt>
  1598. <dd>
  1599. ', $context['member']['name'], '
  1600. </dd>
  1601. <dt>
  1602. <strong>', $txt['profile_warning_level'], ':</strong>
  1603. </dt>
  1604. <dd>
  1605. <div>
  1606. <div>
  1607. <div style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
  1608. <div id="warning_text" style="padding-top: 1pt; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['member']['warning'], '%</div>
  1609. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  1610. </div>
  1611. </div>
  1612. </div>
  1613. </dd>';
  1614. // There's some impact of this?
  1615. if (!empty($context['level_effects'][$context['current_level']]))
  1616. echo '
  1617. <dt>
  1618. <strong>', $txt['profile_viewwarning_impact'], ':</strong>
  1619. </dt>
  1620. <dd>
  1621. ', $context['level_effects'][$context['current_level']], '
  1622. </dd>';
  1623. echo '
  1624. </dl>
  1625. </div>
  1626. </div>';
  1627. template_show_list('view_warnings');
  1628. }
  1629. // Show a lovely interface for issuing warnings.
  1630. function template_issueWarning()
  1631. {
  1632. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1633. template_load_warning_variables();
  1634. echo '
  1635. <script type="text/javascript"><!-- // --><![CDATA[
  1636. function setWarningBarPos(curEvent, isMove, changeAmount)
  1637. {
  1638. barWidth = ', $context['warningBarWidth'], ';
  1639. // Are we passing the amount to change it by?
  1640. if (changeAmount)
  1641. {
  1642. if (document.getElementById(\'warning_level\').value == \'SAME\')
  1643. percent = ', $context['member']['warning'], ' + changeAmount;
  1644. else
  1645. percent = parseInt(document.getElementById(\'warning_level\').value) + changeAmount;
  1646. }
  1647. // If not then it\'s a mouse thing.
  1648. else
  1649. {
  1650. if (!curEvent)
  1651. var curEvent = window.event;
  1652. // If it\'s a movement check the button state first!
  1653. if (isMove)
  1654. {
  1655. if (!curEvent.button || curEvent.button != 1)
  1656. return false
  1657. }
  1658. // Get the position of the container.
  1659. contain = document.getElementById(\'warning_contain\');
  1660. position = 0;
  1661. while (contain != null)
  1662. {
  1663. position += contain.offsetLeft;
  1664. contain = contain.offsetParent;
  1665. }
  1666. // Where is the mouse?
  1667. if (curEvent.pageX)
  1668. {
  1669. mouse = curEvent.pageX;
  1670. }
  1671. else
  1672. {
  1673. mouse = curEvent.clientX;
  1674. mouse += document.documentElement.scrollLeft != "undefined" ? document.documentElement.scrollLeft : document.body.scrollLeft;
  1675. }
  1676. // Is this within bounds?
  1677. if (mouse < position || mouse > position + barWidth)
  1678. return;
  1679. percent = Math.round(((mouse - position) / barWidth) * 100);
  1680. // Round percent to the nearest 5 - by kinda cheating!
  1681. percent = Math.round(percent / 5) * 5;
  1682. }
  1683. // What are the limits?
  1684. minLimit = ', $context['min_allowed'], ';
  1685. maxLimit = ', $context['max_allowed'], ';
  1686. percent = Math.max(percent, minLimit);
  1687. percent = Math.min(percent, maxLimit);
  1688. size = barWidth * (percent/100);
  1689. setInnerHTML(document.getElementById(\'warning_text\'), percent + "%");
  1690. document.getElementById(\'warning_text\').innerHTML = percent + "%";
  1691. document.getElementById(\'warning_level\').value = percent;
  1692. document.getElementById(\'warning_progress\').style.width = size + "px";
  1693. // Get the right color.
  1694. color = "black"';
  1695. foreach ($context['colors'] as $limit => $color)
  1696. echo '
  1697. if (percent >= ', $limit, ')
  1698. color = "', $color, '";';
  1699. echo '
  1700. document.getElementById(\'warning_progress\').style.backgroundColor = color;
  1701. // Also set the right effect.
  1702. effectText = "";';
  1703. foreach ($context['level_effects'] as $limit => $text)
  1704. echo '
  1705. if (percent >= ', $limit, ')
  1706. effectText = "', $text, '";';
  1707. echo '
  1708. setInnerHTML(document.getElementById(\'cur_level_div\'), effectText);
  1709. }
  1710. // Disable notification boxes as required.
  1711. function modifyWarnNotify()
  1712. {
  1713. disable = !document.getElementById(\'warn_notify\').checked;
  1714. document.getElementById(\'warn_sub\').disabled = disable;
  1715. document.getElementById(\'warn_body\').disabled = disable;
  1716. document.getElementById(\'warn_temp\').disabled = disable;
  1717. document.getElementById(\'new_template_link\').style.display = disable ? \'none\' : \'\';
  1718. document.getElementById(\'preview_button\').style.display = disable ? \'none\' : \'\';
  1719. }
  1720. function changeWarnLevel(amount)
  1721. {
  1722. setWarningBarPos(false, false, amount);
  1723. }
  1724. // Warn template.
  1725. function populateNotifyTemplate()
  1726. {
  1727. index = document.getElementById(\'warn_temp\').value;
  1728. if (index == -1)
  1729. return false;
  1730. // Otherwise see what we can do...';
  1731. foreach ($context['notification_templates'] as $k => $type)
  1732. echo '
  1733. if (index == ', $k, ')
  1734. document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
  1735. echo '
  1736. }
  1737. // ]]></script>';
  1738. echo '
  1739. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="UTF-8">
  1740. <div class="cat_bar">
  1741. <h3 class="catbg">
  1742. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />
  1743. ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], '
  1744. </h3>
  1745. </div>';
  1746. if (!$context['user']['is_owner'])
  1747. echo '
  1748. <p class="description">', $txt['profile_warning_desc'], '</p>';
  1749. echo '
  1750. <div class="windowbg">
  1751. <div class="content">
  1752. <dl class="settings">';
  1753. if (!$context['user']['is_owner'])
  1754. echo '
  1755. <dt>
  1756. <strong>', $txt['profile_warning_name'], ':</strong>
  1757. </dt>
  1758. <dd>
  1759. <strong>', $context['member']['name'], '</strong>
  1760. </dd>';
  1761. echo '
  1762. <dt>
  1763. <strong>', $txt['profile_warning_level'], ':</strong>';
  1764. // Is there only so much they can apply?
  1765. if ($context['warning_limit'])
  1766. echo '
  1767. <br /><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
  1768. echo '
  1769. </dt>
  1770. <dd>
  1771. <div id="warndiv1" style="display: none;">
  1772. <div>
  1773. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(-5); return false;">[-]</a></span>
  1774. <div class="floatleft" id="warning_contain" style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;" onmousedown="setWarningBarPos(event, true);" onmousemove="setWarningBarPos(event, true);" onclick="setWarningBarPos(event);">
  1775. <div id="warning_text" style="padding-top: 1pt; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['member']['warning'], '%</div>
  1776. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  1777. </div>
  1778. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(5); return false;">[+]</a></span>
  1779. <div class="clear_left smalltext">', $txt['profile_warning_impact'], ': <span id="cur_level_div">', $context['level_effects'][$context['current_level']], '</span></div>
  1780. </div>
  1781. <input type="hidden" name="warning_level" id="warning_level" value="SAME" />
  1782. </div>
  1783. <div id="warndiv2">
  1784. <input type="text" name="warning_level_nojs" size="6" maxlength="4" value="', $context['member']['warning'], '" class="input_text" />&nbsp;', $txt['profile_warning_max'], '
  1785. <div class="smalltext">', $txt['profile_warning_impact'], ':<br />';
  1786. // For non-javascript give a better list.
  1787. foreach ($context['level_effects'] as $limit => $effect)
  1788. echo '
  1789. ', sprintf($txt['profile_warning_effect_text'], $limit, $effect), '<br />';
  1790. echo '
  1791. </div>
  1792. </div>
  1793. </dd>';
  1794. if (!$context['user']['is_owner'])
  1795. {
  1796. echo '
  1797. <dt>
  1798. <strong>', $txt['profile_warning_reason'], ':</strong><br />
  1799. <span class="smalltext">', $txt['profile_warning_reason_desc'], '</span>
  1800. </dt>
  1801. <dd>
  1802. <input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50" style="width: 80%;" class="input_text" />
  1803. </dd>
  1804. </dl>
  1805. <hr />
  1806. <div id="box_preview"', !empty($context['warning_data']['body_preview']) ? '' : ' style="display:none"', '>
  1807. <dl class="settings">
  1808. <dt>
  1809. <strong>', $txt['preview'] , '</strong>
  1810. </dt>
  1811. <dd id="body_preview">
  1812. ', !empty($context['warning_data']['body_preview']) ? $context['warning_data']['body_preview'] : '', '
  1813. </dd>
  1814. </dl>
  1815. <hr />
  1816. </div>
  1817. <dl class="settings">
  1818. <dt>
  1819. <strong><label for="warn_notify">', $txt['profile_warning_notify'], ':</label></strong>
  1820. </dt>
  1821. <dd>
  1822. <input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();" ', $context['warning_data']['notify'] ? 'checked="checked"' : '', ' class="input_check" />
  1823. </dd>
  1824. <dt>
  1825. <strong><label for="warn_sub">', $txt['profile_warning_notify_subject'], ':</label></strong>
  1826. </dt>
  1827. <dd>
  1828. <input type="text" name="warn_sub" id="warn_sub" value="', empty($context['warning_data']['notify_subject']) ? $txt['profile_warning_notify_template_subject'] : $context['warning_data']['notify_subject'], '" size="50" style="width: 80%;" class="input_text" />
  1829. </dd>
  1830. <dt>
  1831. <strong><label for="warn_temp">', $txt['profile_warning_notify_body'], ':</label></strong>
  1832. </dt>
  1833. <dd>
  1834. <select name="warn_temp" id="warn_temp" disabled="disabled" onchange="populateNotifyTemplate();" style="font-size: x-small;">
  1835. <option value="-1">', $txt['profile_warning_notify_template'], '</option>
  1836. <option value="-1">------------------------------</option>';
  1837. foreach ($context['notification_templates'] as $id_template => $template)
  1838. echo '
  1839. <option value="', $id_template, '">', $template['title'], '</option>';
  1840. echo '
  1841. </select>
  1842. <span class="smalltext" id="new_template_link" style="display: none;">[<a href="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=0" target="_blank" class="new_win">', $txt['profile_warning_new_template'], '</a>]</span><br />
  1843. <textarea name="warn_body" id="warn_body" cols="40" rows="8" style="min-width: 50%; max-width: 99%;">', $context['warning_data']['notify_body'], '</textarea>
  1844. </dd>';
  1845. }
  1846. echo '
  1847. </dl>
  1848. <div class="righttext">';
  1849. if (!empty($context['token_check']))
  1850. echo '
  1851. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1852. echo '
  1853. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1854. <input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" />
  1855. <input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit" />
  1856. </div>
  1857. </div>
  1858. </div>
  1859. </form>';
  1860. // Previous warnings?
  1861. template_show_list('view_warnings');
  1862. // Do our best to get pretty javascript enabled.
  1863. echo '
  1864. <script type="text/javascript"><!-- // --><![CDATA[
  1865. document.getElementById(\'warndiv1\').style.display = "";
  1866. document.getElementById(\'preview_button\').style.display = "none";
  1867. document.getElementById(\'warndiv2\').style.display = "none";';
  1868. if (!$context['user']['is_owner'])
  1869. echo '
  1870. modifyWarnNotify();
  1871. $(document).ready(function() {
  1872. $("#preview_button").click(function() {
  1873. return ajax_getTemplatePreview();
  1874. });
  1875. });
  1876. function ajax_getTemplatePreview ()
  1877. {
  1878. $.ajax({
  1879. type: "POST",
  1880. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  1881. data: {item: "warning_preview", title: $("#warn_sub").val(), body: $("#warn_body").val(), issuing: true},
  1882. context: document.body,
  1883. success: function(request){
  1884. $("#box_preview").css({display:""});
  1885. $("#body_preview").html($(request).find(\'body\').text());
  1886. if ($(request).find("error").text() != \'\')
  1887. {
  1888. $("#profile_error").css({display:""});
  1889. var errors_html = \'<span>\' + $("#profile_error").find("span").html() + \'</span>\' + \'<ul class="list_errors" class="reset">\';
  1890. var errors = $(request).find(\'error\').each(function() {
  1891. errors_html += \'<li>\' + $(this).text() + \'</li>\';
  1892. });
  1893. errors_html += \'</ul>\';
  1894. $("#profile_error").html(errors_html);
  1895. }
  1896. else
  1897. {
  1898. $("#profile_error").css({display:"none"});
  1899. $("#error_list").html(\'\');
  1900. }
  1901. return false;
  1902. },
  1903. });
  1904. return false;
  1905. }';
  1906. echo '
  1907. // ]]></script>';
  1908. }
  1909. // Template to show for deleting a users account - now with added delete post capability!
  1910. function template_deleteAccount()
  1911. {
  1912. global $context, $settings, $options, $scripturl, $txt, $scripturl;
  1913. // The main containing header.
  1914. echo '
  1915. <form action="', $scripturl, '?action=profile;area=deleteaccount;save" method="post" accept-charset="UTF-8" name="creator" id="creator">
  1916. <div class="title_bar">
  1917. <h3 class="titlebg">
  1918. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['deleteAccount'], '
  1919. </h3>
  1920. </div>';
  1921. // If deleting another account give them a lovely info box.
  1922. if (!$context['user']['is_owner'])
  1923. echo '
  1924. <p class="windowbg2 description">', $txt['deleteAccount_desc'], '</p>';
  1925. echo '
  1926. <div class="windowbg2">
  1927. <div class="content">';
  1928. // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
  1929. if ($context['needs_approval'])
  1930. echo '
  1931. <div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
  1932. // If the user is deleting their own account warn them first - and require a password!
  1933. if ($context['user']['is_owner'])
  1934. {
  1935. echo '
  1936. <div class="errorbox">', $txt['own_profile_confirm'], '</div>
  1937. <div>
  1938. <strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong>
  1939. <input type="password" name="oldpasswrd" size="20" class="input_password" />&nbsp;&nbsp;&nbsp;&nbsp;
  1940. <input type="submit" value="', $txt['yes'], '" class="button_submit" />';
  1941. if (!empty($context['token_check']))
  1942. echo '
  1943. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1944. echo '
  1945. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1946. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1947. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1948. </div>';
  1949. }
  1950. // Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts!
  1951. else
  1952. {
  1953. echo '
  1954. <div class="alert">', $txt['deleteAccount_warning'], '</div>';
  1955. // Only actually give these options if they are kind of important.
  1956. if ($context['can_delete_posts'])
  1957. echo '
  1958. <div>
  1959. ', $txt['deleteAccount_posts'], ':
  1960. <select name="remove_type">
  1961. <option value="none">', $txt['deleteAccount_none'], '</option>
  1962. <option value="posts">', $txt['deleteAccount_all_posts'], '</option>
  1963. <option value="topics">', $txt['deleteAccount_topics'], '</option>
  1964. </select>
  1965. </div>';
  1966. echo '
  1967. <div>
  1968. <label for="deleteAccount"><input type="checkbox" name="deleteAccount" id="deleteAccount" value="1" class="input_check" onclick="if (this.checked) return confirm(\'', $txt['deleteAccount_confirm'], '\');" /> ', $txt['deleteAccount_member'], '.</label>
  1969. </div>
  1970. <div>
  1971. <input type="submit" value="', $txt['delete'], '" class="button_submit" />';
  1972. if (!empty($context['token_check']))
  1973. echo '
  1974. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1975. echo '
  1976. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1977. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1978. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1979. </div>';
  1980. }
  1981. echo '
  1982. </div>
  1983. </div>
  1984. <br />
  1985. </form>';
  1986. }
  1987. // Template for the password box/save button stuck at the bottom of every profile page.
  1988. function template_profile_save()
  1989. {
  1990. global $context, $settings, $options, $txt;
  1991. echo '
  1992. <hr width="100%" size="1" class="hrcolor clear" />';
  1993. // Only show the password box if it's actually needed.
  1994. if ($context['require_password'])
  1995. echo '
  1996. <dl>
  1997. <dt>
  1998. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  1999. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2000. </dt>
  2001. <dd>
  2002. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  2003. </dd>
  2004. </dl>';
  2005. echo '
  2006. <div class="righttext">
  2007. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />
  2008. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2009. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2010. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2011. </div>';
  2012. }
  2013. // Small template for showing an error message upon a save problem in the profile.
  2014. function template_error_message()
  2015. {
  2016. global $context, $txt;
  2017. echo '
  2018. <div class="errorbox" ', empty($context['post_errors']) ? 'style="display:none" ' : '', 'id="profile_error">';
  2019. if (!empty($context['post_errors']))
  2020. {
  2021. echo '
  2022. <span>', !empty($context['custom_error_title']) ? $context['custom_error_title'] : $txt['profile_errors_occurred'], ':</span>
  2023. <ul id="list_errors">';
  2024. // Cycle through each error and display an error message.
  2025. foreach ($context['post_errors'] as $error)
  2026. echo '
  2027. <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
  2028. echo '
  2029. </ul>';
  2030. }
  2031. echo '
  2032. </div>';
  2033. }
  2034. // Display a load of drop down selectors for allowing the user to change group.
  2035. function template_profile_group_manage()
  2036. {
  2037. global $context, $txt, $scripturl;
  2038. echo '
  2039. <dt>
  2040. <strong>', $txt['primary_membergroup'], ': </strong><br />
  2041. <span class="smalltext">[<a href="', $scripturl, '?action=quickhelp;help=moderator_why_missing" onclick="return reqOverlayDiv(this.href);">', $txt['moderator_why_missing'], '</a>]</span>
  2042. </dt>
  2043. <dd>
  2044. <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 &amp;&amp; !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>';
  2045. // Fill the select box with all primary member groups that can be assigned to a member.
  2046. foreach ($context['member_groups'] as $member_group)
  2047. if (!empty($member_group['can_be_primary']))
  2048. echo '
  2049. <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected="selected"' : '', '>
  2050. ', $member_group['name'], '
  2051. </option>';
  2052. echo '
  2053. </select>
  2054. </dd>
  2055. <dt>
  2056. <strong>', $txt['additional_membergroups'], ':</strong>
  2057. </dt>
  2058. <dd>
  2059. <span id="additional_groupsList">
  2060. <input type="hidden" name="additional_groups[]" value="0" />';
  2061. // For each membergroup show a checkbox so members can be assigned to more than one group.
  2062. foreach ($context['member_groups'] as $member_group)
  2063. if ($member_group['can_be_additional'])
  2064. echo '
  2065. <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked="checked"' : '', ' class="input_check" /> ', $member_group['name'], '</label><br />';
  2066. echo '
  2067. </span>
  2068. <a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;">', $txt['additional_membergroups_show'], '</a>
  2069. <script type="text/javascript"><!-- // --><![CDATA[
  2070. document.getElementById("additional_groupsList").style.display = "none";
  2071. document.getElementById("additional_groupsLink").style.display = "";
  2072. // ]]></script>
  2073. </dd>';
  2074. }
  2075. // Callback function for entering a birthdate!
  2076. function template_profile_birthdate()
  2077. {
  2078. global $txt, $context;
  2079. // Just show the pretty box!
  2080. echo '
  2081. <dt>
  2082. <strong>', $txt['dob'], ':</strong><br />
  2083. <span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
  2084. </dt>
  2085. <dd>
  2086. <input type="text" name="bday3" size="4" maxlength="4" value="', $context['member']['birth_date']['year'], '" class="input_text" /> -
  2087. <input type="text" name="bday1" size="2" maxlength="2" value="', $context['member']['birth_date']['month'], '" class="input_text" /> -
  2088. <input type="text" name="bday2" size="2" maxlength="2" value="', $context['member']['birth_date']['day'], '" class="input_text" />
  2089. </dd>';
  2090. }
  2091. // Show the signature editing box?
  2092. function template_profile_signature_modify()
  2093. {
  2094. global $txt, $context, $settings, $scripturl;
  2095. echo '
  2096. <dt id="current_signature"', !isset($context['member']['current_signature']) ? ' style="display:none"' : '', '>
  2097. <strong>', $txt['current_signature'], ':</strong>
  2098. </dt>
  2099. <dd id="current_signature_display"', !isset($context['member']['current_signature']) ? ' style="display:none"' : '', '>
  2100. ', isset($context['member']['current_signature']) ? $context['member']['current_signature'] : '', '<hr />
  2101. </dd>';
  2102. echo '
  2103. <dt id="preview_signature"', !isset($context['member']['signature_preview']) ? ' style="display:none"' : '', '>
  2104. <strong>', $txt['signature_preview'], ':</strong>
  2105. </dt>
  2106. <dd id="preview_signature_display"', !isset($context['member']['signature_preview']) ? ' style="display:none"' : '', '>
  2107. ', isset($context['member']['signature_preview']) ? $context['member']['signature_preview'] : '', '<hr />
  2108. </dd>';
  2109. echo '
  2110. <dt>
  2111. <strong>', $txt['signature'], ':</strong><br />
  2112. <span class="smalltext">', $txt['sig_info'], '</span>
  2113. <br />
  2114. <br />
  2115. </dt>
  2116. <dd>
  2117. <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50" style="min-width: 50%; max-width: 99%;">', $context['member']['signature'], '</textarea><br />';
  2118. // If there is a limit at all!
  2119. if (!empty($context['signature_limits']['max_length']))
  2120. echo '
  2121. <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br />';
  2122. if ($context['show_spellchecking'])
  2123. echo '
  2124. <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\', false);" tabindex="', $context['tabindex']++, '" class="button_submit" />';
  2125. if (!empty($context['show_preview_button']))
  2126. echo '
  2127. <input type="submit" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" tabindex="', $context['tabindex']++, '" class="button_submit" />';
  2128. if ($context['signature_warning'])
  2129. echo '
  2130. <span class="smalltext">', $context['signature_warning'], '</span>';
  2131. // Some javascript used to count how many characters have been used so far in the signature.
  2132. echo '
  2133. <script type="text/javascript"><!-- // --><![CDATA[
  2134. var maxLength = ', $context['signature_limits']['max_length'], ';
  2135. $(document).ready(function() {
  2136. calcCharLeft();
  2137. $("#preview_button").click(function() {
  2138. return ajax_getSignaturePreview(true);
  2139. });
  2140. });
  2141. // ]]></script>
  2142. </dd>';
  2143. }
  2144. function template_profile_avatar_select()
  2145. {
  2146. global $context, $txt, $modSettings;
  2147. // Start with the upper menu
  2148. echo '
  2149. <dt>
  2150. <strong id="personal_picture"><label for="avatar_upload_box">', $txt['personal_picture'], '</label></strong>
  2151. <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_none" value="none"' . ($context['member']['avatar']['choice'] == 'none' ? ' checked="checked"' : '') . ' class="input_radio" /><label for="avatar_choice_none"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['no_avatar'] . '</label><br />
  2152. ', !empty($context['member']['avatar']['allow_server_stored']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_server_stored" value="server_stored"' . ($context['member']['avatar']['choice'] == 'server_stored' ? ' checked="checked"' : '') . ' class="input_radio" /><label for="avatar_choice_server_stored"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['choose_avatar_gallery'] . '</label><br />' : '', '
  2153. ', !empty($context['member']['avatar']['allow_external']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_external" value="external"' . ($context['member']['avatar']['choice'] == 'external' ? ' checked="checked"' : '') . ' class="input_radio" /><label for="avatar_choice_external"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['my_own_pic'] . '</label><br />' : '', '
  2154. ', !empty($context['member']['avatar']['allow_upload']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_upload" value="upload"' . ($context['member']['avatar']['choice'] == 'upload' ? ' checked="checked"' : '') . ' class="input_radio" /><label for="avatar_choice_upload"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['avatar_will_upload'] . '</label>' : '', '
  2155. </dt>
  2156. <dd>';
  2157. // If users are allowed to choose avatars stored on the server show selection boxes to choice them from.
  2158. if (!empty($context['member']['avatar']['allow_server_stored']))
  2159. {
  2160. echo '
  2161. <div id="avatar_server_stored">
  2162. <div>
  2163. <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
  2164. // This lists all the file catergories.
  2165. foreach ($context['avatars'] as $avatar)
  2166. echo '
  2167. <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected="selected"' : ''), '>', $avatar['name'], '</option>';
  2168. echo '
  2169. </select>
  2170. </div>
  2171. <div>
  2172. <select name="file" id="file" size="10" style="display: none;" onchange="showAvatar()" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');" disabled="disabled"><option></option></select>
  2173. </div>
  2174. <div><img name="avatar" id="avatar" src="', !empty($context['member']['avatar']['allow_external']) && $context['member']['avatar']['choice'] == 'external' ? $context['member']['avatar']['external'] : $modSettings['avatar_url'] . '/blank.png', '" alt="Do Nothing" /></div>
  2175. <script type="text/javascript"><!-- // --><![CDATA[
  2176. var files = ["' . implode('", "', $context['avatar_list']) . '"];
  2177. var avatar = document.getElementById("avatar");
  2178. var cat = document.getElementById("cat");
  2179. var selavatar = "' . $context['avatar_selected'] . '";
  2180. var avatardir = "' . $modSettings['avatar_url'] . '/";
  2181. var size = avatar.alt.substr(3, 2) + " " + avatar.alt.substr(0, 2) + String.fromCharCode(117, 98, 116);
  2182. var file = document.getElementById("file");
  2183. var maxHeight = ', !empty($modSettings['avatar_max_height_external']) ? $modSettings['avatar_max_height_external'] : 0, ';
  2184. var maxWidth = ', !empty($modSettings['avatar_max_width_external']) ? $modSettings['avatar_max_width_external'] : 0, ';
  2185. if (avatar.src.indexOf("blank.png") > -1)
  2186. changeSel(selavatar);
  2187. else
  2188. previewExternalAvatar(avatar.src)
  2189. // ]]></script>
  2190. </div>';
  2191. }
  2192. // If the user can link to an off server avatar, show them a box to input the address.
  2193. if (!empty($context['member']['avatar']['allow_external']))
  2194. {
  2195. echo '
  2196. <div id="avatar_external">
  2197. <div class="smalltext">', $txt['avatar_by_url'], '</div>
  2198. <input type="text" name="userpicpersonal" size="45" value="', $context['member']['avatar']['external'], '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);" class="input_text" />
  2199. </div>';
  2200. }
  2201. // If the user is able to upload avatars to the server show them an upload box.
  2202. if (!empty($context['member']['avatar']['allow_upload']))
  2203. {
  2204. echo '
  2205. <div id="avatar_upload">
  2206. <input type="file" size="44" name="attachment" id="avatar_upload_box" value="" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" class="input_file" />
  2207. ', ($context['member']['avatar']['id_attach'] > 0 ? '<br /><br /><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&amp;') . 'time=' . time() . '" alt="" /><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '" />' : ''), '
  2208. </div>';
  2209. }
  2210. echo '
  2211. <script type="text/javascript"><!-- // --><![CDATA[
  2212. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "' . ($context['member']['avatar']['choice'] == 'server_stored' ? '' : 'none') . '";' : '', '
  2213. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "' . ($context['member']['avatar']['choice'] == 'external' ? '' : 'none') . '";' : '', '
  2214. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "' . ($context['member']['avatar']['choice'] == 'upload' ? '' : 'none') . '";' : '', '
  2215. function swap_avatar(type)
  2216. {
  2217. switch(type.id)
  2218. {
  2219. case "avatar_choice_server_stored":
  2220. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "";' : '', '
  2221. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2222. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2223. break;
  2224. case "avatar_choice_external":
  2225. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2226. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "";' : '', '
  2227. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2228. break;
  2229. case "avatar_choice_upload":
  2230. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2231. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2232. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "";' : '', '
  2233. break;
  2234. case "avatar_choice_none":
  2235. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2236. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2237. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2238. break;
  2239. }
  2240. }
  2241. // ]]></script>
  2242. </dd>';
  2243. }
  2244. // Callback for modifying karam.
  2245. function template_profile_karma_modify()
  2246. {
  2247. global $context, $modSettings, $txt;
  2248. echo '
  2249. <dt>
  2250. <strong>', $modSettings['karmaLabel'], '</strong>
  2251. </dt>
  2252. <dd>
  2253. ', $modSettings['karmaApplaudLabel'], ' <input type="text" name="karma_good" size="4" value="', $context['member']['karma']['good'], '" onchange="setInnerHTML(document.getElementById(\'karmaTotal\'), this.value - this.form.karma_bad.value);" style="margin-right: 2ex;" class="input_text" /> ', $modSettings['karmaSmiteLabel'], ' <input type="text" name="karma_bad" size="4" value="', $context['member']['karma']['bad'], '" onchange="this.form.karma_good.onchange();" class="input_text" /><br />
  2254. (', $txt['total'], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
  2255. </dd>';
  2256. }
  2257. // Select the time format!
  2258. function template_profile_timeformat_modify()
  2259. {
  2260. global $context, $modSettings, $txt, $scripturl, $settings;
  2261. echo '
  2262. <dt>
  2263. <strong><label for="easyformat">', $txt['time_format'], ':</label></strong><br />
  2264. <a href="', $scripturl, '?action=quickhelp;help=time_format" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" class="floatleft" /></a>
  2265. <span class="smalltext">&nbsp;<label for="time_format">', $txt['date_format'], '</label></span>
  2266. </dt>
  2267. <dd>
  2268. <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;" style="margin-bottom: 4px;">';
  2269. // Help the user by showing a list of common time formats.
  2270. foreach ($context['easy_timeformats'] as $time_format)
  2271. echo '
  2272. <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected="selected"' : '', '>', $time_format['title'], '</option>';
  2273. echo '
  2274. </select><br />
  2275. <input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30" class="input_text" />
  2276. </dd>';
  2277. }
  2278. // Time offset?
  2279. function template_profile_timeoffset_modify()
  2280. {
  2281. global $txt, $context;
  2282. echo '
  2283. <dt>
  2284. <strong', (isset($context['modify_error']['bad_offset']) ? ' class="error"' : ''), '><label for="time_offset">', $txt['time_offset'], ':</label></strong><br />
  2285. <span class="smalltext">', $txt['personal_time_offset'], '</span>
  2286. </dt>
  2287. <dd>
  2288. <input type="text" name="time_offset" id="time_offset" size="5" maxlength="5" value="', $context['member']['time_offset'], '" class="input_text" /> ', $txt['hours'], ' [<a href="javascript:void(0);" onclick="currentDate = new Date(', $context['current_forum_time_js'], '); document.getElementById(\'time_offset\').value = autoDetectTimeOffset(currentDate); return false;">', $txt['timeoffset_autodetect'], '</a>]<br />', $txt['current_time'], ': <em>', $context['current_forum_time'], '</em>
  2289. </dd>';
  2290. }
  2291. // Theme?
  2292. function template_profile_theme_pick()
  2293. {
  2294. global $txt, $context, $scripturl;
  2295. echo '
  2296. <dt>
  2297. <strong>', $txt['current_theme'], ':</strong>
  2298. </dt>
  2299. <dd>
  2300. ', $context['member']['theme']['name'], ' [<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['change'], '</a>]
  2301. </dd>';
  2302. }
  2303. // Smiley set picker.
  2304. function template_profile_smiley_pick()
  2305. {
  2306. global $txt, $context, $modSettings, $settings;
  2307. echo '
  2308. <dt>
  2309. <strong><label for="smiley_set">', $txt['smileys_current'], ':</label></strong>
  2310. </dt>
  2311. <dd>
  2312. <select name="smiley_set" id="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.gif\';">';
  2313. foreach ($context['smiley_sets'] as $set)
  2314. echo '
  2315. <option value="', $set['id'], '"', $set['selected'] ? ' selected="selected"' : '', '>', $set['name'], '</option>';
  2316. echo '
  2317. </select> <img id="smileypr" class="centericon" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.gif' : $settings['images_url'] . '/blank.png', '" alt=":)" style="padding-left: 20px;" />
  2318. </dd>';
  2319. }
  2320. // Change the way you login to the forum.
  2321. function template_authentication_method()
  2322. {
  2323. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  2324. // The main header!
  2325. echo '
  2326. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/register.js"></script>
  2327. <form action="', $scripturl, '?action=profile;area=authentication;save" method="post" accept-charset="UTF-8" name="creator" id="creator" enctype="multipart/form-data">
  2328. <div class="cat_bar">
  2329. <h3 class="catbg">
  2330. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['authentication'], '
  2331. </h3>
  2332. </div>
  2333. <p class="windowbg description">', $txt['change_authentication'], '</p>
  2334. <div class="windowbg2">
  2335. <div class="content">
  2336. <dl>
  2337. <dt>
  2338. <input type="radio" onclick="updateAuthMethod();" name="authenticate" value="openid" id="auth_openid"', $context['auth_method'] == 'openid' ? ' checked="checked"' : '', ' class="input_radio" /><label for="auth_openid"><strong>', $txt['authenticate_openid'], '</strong></label>&nbsp;<em><a href="', $scripturl, '?action=quickhelp;help=register_openid" onclick="return reqOverlayDiv(this.href);" class="help">(?)</a></em><br />
  2339. <input type="radio" onclick="updateAuthMethod();" name="authenticate" value="passwd" id="auth_pass"', $context['auth_method'] == 'password' ? ' checked="checked"' : '', ' class="input_radio" /><label for="auth_pass"><strong>', $txt['authenticate_password'], '</strong></label>
  2340. </dt>
  2341. <dd>
  2342. <dl id="auth_openid_div">
  2343. <dt>
  2344. <em>', $txt['authenticate_openid_url'], ':</em>
  2345. </dt>
  2346. <dd>
  2347. <input type="text" name="openid_identifier" id="openid_url" size="30" tabindex="', $context['tabindex']++, '" value="', $context['member']['openid_uri'], '" class="input_text openid_login" />
  2348. </dd>
  2349. </dl>
  2350. <dl id="auth_pass_div">
  2351. <dt>
  2352. <em>', $txt['choose_pass'], ':</em>
  2353. </dt>
  2354. <dd>
  2355. <input type="password" name="passwrd1" id="smf_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
  2356. <span id="smf_autov_pwmain_div" style="display: none;"><img id="smf_autov_pwmain_img" class="centericon" src="', $settings['images_url'], '/icons/field_invalid.png" alt="*" /></span>
  2357. </dd>
  2358. <dt>
  2359. <em>', $txt['verify_pass'], ':</em>
  2360. </dt>
  2361. <dd>
  2362. <input type="password" name="passwrd2" id="smf_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
  2363. <span id="smf_autov_pwverify_div" style="display: none;"><img id="smf_autov_pwverify_img" class="centericon" src="', $settings['images_url'], '/icons/field_valid.png" alt="*" /></span>
  2364. </dd>
  2365. </dl>
  2366. </dd>
  2367. </dl>';
  2368. if ($context['require_password'])
  2369. echo '
  2370. <hr width="100%" size="1" class="hrcolor clear" />
  2371. <dl>
  2372. <dt>
  2373. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  2374. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2375. </dt>
  2376. <dd>
  2377. <input type="password" name="oldpasswrd" tabindex="', $context['tabindex']++, '" size="20" style="margin-right: 4ex;" class="input_password" />
  2378. </dd>
  2379. </dl>';
  2380. echo '
  2381. <hr class="hrcolor" />';
  2382. if (!empty($context['token_check']))
  2383. echo '
  2384. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  2385. echo '
  2386. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2387. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2388. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2389. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />
  2390. </div>
  2391. </div>
  2392. </form>';
  2393. // The password stuff.
  2394. echo '
  2395. <script type="text/javascript"><!-- // --><![CDATA[
  2396. var regTextStrings = {
  2397. "password_short": "', $txt['registration_password_short'], '",
  2398. "password_reserved": "', $txt['registration_password_reserved'], '",
  2399. "password_numbercase": "', $txt['registration_password_numbercase'], '",
  2400. "password_no_match": "', $txt['registration_password_no_match'], '",
  2401. "password_valid": "', $txt['registration_password_valid'], '"
  2402. };
  2403. var verificationHandle = new smfRegister("creator", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
  2404. var currentAuthMethod = \'passwd\';
  2405. updateAuthMethod();
  2406. // ]]></script>';
  2407. }
  2408. /**
  2409. * Profile block that shows: Avatar, Title, blurb, group info, number of posts, karma
  2410. * Has links to show posts and attachments
  2411. */
  2412. function template_profile_block_summary()
  2413. {
  2414. global $settings, $txt, $context, $modSettings, $scripturl;
  2415. echo '
  2416. <div class="cat_bar">
  2417. <h3 class="catbg">
  2418. <img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon"/>&nbsp;', $txt['summary'], ' - ', $context['member']['name'], '
  2419. </h3>
  2420. </div>';
  2421. echo '
  2422. <div class="windowbg">
  2423. <div class="content">
  2424. <div id="basicinfo">
  2425. ', $context['member']['avatar']['image'], '
  2426. <div class="clear">
  2427. <em>', $settings['use_image_buttons'] ? '<img style="vertical-align:middle" src="' . $context['member']['online']['image_href'] . '" alt="' . $context['member']['online']['text'] . '" />' : $context['member']['online']['text'], $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['text'] . '</span>' : '', '</em>
  2428. </div>
  2429. </div>
  2430. <div class="content profileblock">
  2431. <dl>
  2432. <dt><strong>', $txt['name'], ': </strong></dt>
  2433. <dd>', $context['member']['name'], '</dd>';
  2434. // Title?
  2435. if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
  2436. echo '
  2437. <dt><strong>', $txt['custom_title'], ': </strong></dt>
  2438. <dd>', $context['member']['title'], '</dd>';
  2439. // A little something about them?
  2440. if (!empty($context['member']['blurb']))
  2441. echo '
  2442. <dt><strong>', $txt['personal_text'], ': </strong></dt>
  2443. <dd>', $context['member']['blurb'], '</dd>';
  2444. // Some stats for fun
  2445. if (!isset($context['disabled_fields']['posts']))
  2446. echo '
  2447. <dt><strong>', $txt['profile_posts'], ': </strong></dt>
  2448. <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
  2449. // Group info
  2450. echo '
  2451. <dt><strong>', $txt['position'], ': </strong></dt>
  2452. <dd>', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</dd>';
  2453. // If karma is enabled show the members karma.
  2454. if ($modSettings['karmaMode'] == '1')
  2455. echo '
  2456. <dt><strong>', $modSettings['karmaLabel'], ' </strong></dt>
  2457. <dd>', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</dd>';
  2458. elseif ($modSettings['karmaMode'] == '2')
  2459. echo '
  2460. <dt><strong>', $modSettings['karmaLabel'], '</strong></dt>
  2461. <dd>+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '</dd>';
  2462. // Some links to this users fine work
  2463. echo '
  2464. <dt><strong>Data:</strong></dt>
  2465. <dd>
  2466. <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '">', $txt['showPosts'], '</a>
  2467. <br />';
  2468. if (!empty($modSettings['drafts_enabled']))
  2469. echo '
  2470. <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '">', $txt['drafts_show'], '</a>
  2471. <br />';
  2472. echo '
  2473. <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '">', $txt['statPanel'], '</a>
  2474. </dd>';
  2475. // close this block up
  2476. echo '
  2477. </dl>
  2478. </div>
  2479. </div>
  2480. </div>';
  2481. }
  2482. /**
  2483. * Profile block to show additional user details including:
  2484. * age, gender, location, join date, localization details (language and time)
  2485. * If user has permissions can see IP address
  2486. */
  2487. function template_profile_block_user_info()
  2488. {
  2489. global $settings, $txt, $context, $scripturl, $modSettings;
  2490. echo '
  2491. <div class="cat_bar">
  2492. <h3 class="catbg">
  2493. <img src="', $settings['images_url'], '/stats_info.png" alt="" class="icon"/>&nbsp;';
  2494. if ($context['user']['is_owner'])
  2495. echo '
  2496. <a href="', $scripturl ,'?action=profile;area=forumprofile;u=', $context['member']['id'], '">' , $txt['profile_user_info'] , '</a>';
  2497. else
  2498. echo
  2499. $txt['profile_user_info'];
  2500. echo '
  2501. </h3>
  2502. </div>';
  2503. echo '
  2504. <div class="windowbg">
  2505. <div class="content profileblock">
  2506. <dl>';
  2507. // Show the gender
  2508. if (!isset($context['disabled_fields']['gender']) && !empty($context['member']['gender']['name']))
  2509. echo '
  2510. <dt><strong>', $txt['gender'], ': </strong></dt>
  2511. <dd>', $context['member']['gender']['image'] ,' ', $context['member']['gender']['name'], '</dd>';
  2512. // and how old are we?
  2513. echo '
  2514. <dt><strong>', $txt['age'], ':</strong></dt>
  2515. <dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? '&nbsp;<img src="' . $settings['images_url'] . '/cake.png" alt="" style="vertical-align:middle;"/>' : ''), '</dd>';
  2516. // I know where you are, you're at ....
  2517. if (!isset($context['disabled_fields']['location']) && !empty($context['member']['location']))
  2518. echo '
  2519. <dt><strong>', $txt['location'], ':</strong></dt>
  2520. <dd>', $context['member']['location'], '</dd>';
  2521. // How long have they been a member, and when were they last on line?
  2522. echo '
  2523. <dt><strong>', $txt['date_registered'], ': </strong></dt>
  2524. <dd>', $context['member']['registered'], '</dd>
  2525. <dt><strong>', $txt['lastLoggedIn'], ': </strong></dt>
  2526. <dd>', $context['member']['last_login'], '</dd>';
  2527. // If the person looking is allowed, they can check the members IP address and hostname.
  2528. if ($context['can_see_ip'])
  2529. {
  2530. if (!empty($context['member']['ip']))
  2531. echo '
  2532. <dt><strong>', $txt['ip'], ': </strong></dt>
  2533. <dd><a href="', $scripturl, '?action=profile;area=history;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
  2534. if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
  2535. echo '
  2536. <dt><strong>', $txt['hostname'], ': </strong></dt>
  2537. <dd>', $context['member']['hostname'], '</dd>';
  2538. }
  2539. // Users language
  2540. if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
  2541. echo '
  2542. <dt><strong>', $txt['language'], ':</strong></dt>
  2543. <dd>', $context['member']['language'], '</dd>';
  2544. // and their time settings
  2545. echo '
  2546. <dt><strong>', $txt['local_time'], ':</strong></dt>
  2547. <dd>', $context['member']['local_time'], '</dd>';
  2548. // nuff about them for now
  2549. echo '
  2550. </dl>
  2551. </div>
  2552. </div>';
  2553. }
  2554. /**
  2555. * Show the custom profile fields for placement '0'
  2556. */
  2557. function template_profile_block_user_customprofileinfo()
  2558. {
  2559. global $settings, $txt, $context, $scripturl;
  2560. echo '
  2561. <div class="cat_bar">
  2562. <h3 class="catbg">
  2563. <img src="', $settings['images_url'], '/icon.png" alt="" class="icon"/>&nbsp;';
  2564. if ($context['user']['is_owner'])
  2565. echo '
  2566. <a href="', $scripturl ,'?action=profile;area=forumprofile;u=', $context['member']['id'], '">' , $txt['additional_info'] , '</a>';
  2567. else
  2568. echo $txt['additional_info'];
  2569. echo '
  2570. </h3>
  2571. </div>';
  2572. echo '
  2573. <div class="windowbg">
  2574. <div class="content profileblock">';
  2575. // Any custom fields for standard placement?
  2576. if (!empty($context['custom_fields']))
  2577. {
  2578. $shown = false;
  2579. foreach ($context['custom_fields'] as $field)
  2580. {
  2581. if ($field['placement'] != 0 || empty($field['output_html']))
  2582. continue;
  2583. if (empty($shown))
  2584. {
  2585. echo '
  2586. <dl>';
  2587. $shown = true;
  2588. }
  2589. echo '
  2590. <dt><strong>', $field['name'], ':</strong></dt>
  2591. <dd>', $field['output_html'], '</dd>';
  2592. }
  2593. if (!empty($shown))
  2594. echo '
  2595. </dl>';
  2596. }
  2597. if (empty($shown))
  2598. echo $txt['none'];
  2599. echo '
  2600. </div>
  2601. </div>';
  2602. }
  2603. /**
  2604. * Show information on how to contact a member
  2605. * Allows the adding or removal of buddies
  2606. * Provides a PM link
  2607. * Provides a Email link
  2608. * Shows any profile website information
  2609. * Shows any IM fields they have added in their profile
  2610. * Shows custom profile fields of type '1'
  2611. */
  2612. function template_profile_block_contact()
  2613. {
  2614. global $settings, $txt, $context, $scripturl;
  2615. echo '
  2616. <div class="cat_bar">
  2617. <h3 class="catbg">
  2618. <img src="', $settings['images_url'], '/post/wireless.png" alt="" class="icon"/>&nbsp;', $txt['profile_contact'], '
  2619. </h3>
  2620. </div>
  2621. <div class="windowbg">
  2622. <div class="content profileblock">';
  2623. // Can they add this member as a buddy, or can they de-friend them instead?
  2624. if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
  2625. {
  2626. echo '
  2627. <dl>';
  2628. echo '
  2629. <dt><img src="', $settings['images_url'], '/icons/online.png" alt="" class="icon" /></dt>
  2630. <dd>
  2631. <a class="button_link" href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], '</a>
  2632. </dd>';
  2633. echo '
  2634. </dl>';
  2635. }
  2636. // PM's are nice to send
  2637. if (!$context['user']['is_owner'] && $context['can_send_pm'])
  2638. {
  2639. echo '
  2640. <dl>';
  2641. if ($context['member']['online']['is_online'])
  2642. echo '
  2643. <dt><img src="', $settings['images_url'] ,'/im_on.png" alt="" class="icon" /></dt>
  2644. <dd><a href="', $scripturl, '?action=pm;sa=send;u=', $context['member']['id'], '">', $txt['send_member_pm'], '.</a></dd>';
  2645. else
  2646. echo '
  2647. <dt><img src="', $settings['images_url'] ,'/im_off.png" alt="" class="icon" /></dt>
  2648. <dd><a href="', $scripturl, '?action=pm;sa=send;u=', $context['member']['id'], '">', $txt['send_member_pm'], '.</a></dd>';
  2649. echo '
  2650. </dl>';
  2651. }
  2652. echo '
  2653. <dl>';
  2654. // Show the email contact info?
  2655. if ($context['can_send_email'])
  2656. {
  2657. echo '
  2658. <dt><img src="', $settings['images_url'] ,'/email_sm.png" alt="', $txt['email'], '" /></dt>
  2659. <dd>';
  2660. // Only show the email address fully if it's not hidden - and we reveal the email.
  2661. if ($context['member']['show_email'] == 'yes')
  2662. echo '
  2663. <a href="', $scripturl, '?action=emailuser;sa=email;uid=', $context['member']['id'], '">', $context['member']['email'], '</a>';
  2664. // ... Or if the one looking at the profile is an admin they can see it anyway.
  2665. elseif ($context['member']['show_email'] == 'yes_permission_override')
  2666. echo '
  2667. <em><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $context['member']['id'], '">', $context['member']['email'], '</a></em>';
  2668. else
  2669. echo '
  2670. <em>', $txt['hidden'], '</em>';
  2671. echo '
  2672. </dd>';
  2673. }
  2674. // Don't show an icon if they haven't specified a website.
  2675. if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
  2676. echo '
  2677. <dt><img src="', $settings['images_url'] ,'/www.png" alt="', $txt['website'], '" /></dt>
  2678. <dd><a href="', $context['member']['website']['url'], '" target="_blank" class="new_win">', $context['member']['website']['title'] == '' ? $context['member']['website']['url'] : $context['member']['website']['title'], '</a></dd>';
  2679. echo '
  2680. </dl>';
  2681. // Are there any custom profile fields for the summary?
  2682. if (!empty($context['custom_fields']))
  2683. {
  2684. $shown = false;
  2685. foreach ($context['custom_fields'] as $field)
  2686. {
  2687. if (($field['placement'] == 1 || empty($field['output_html'])) && !empty($field['value']))
  2688. {
  2689. if (empty($shown))
  2690. {
  2691. echo '
  2692. <dl>';
  2693. $shown = true;
  2694. }
  2695. echo '
  2696. <dt><strong>', $field['name'], ':</strong></dt>
  2697. <dd>', $field['output_html'], '</dd>';
  2698. }
  2699. }
  2700. if (!empty($shown))
  2701. echo '
  2702. </dl>';
  2703. }
  2704. echo '
  2705. </div>
  2706. </div>';
  2707. }
  2708. /**
  2709. * Shows the users signature
  2710. * Shows custom profile fields of type '2', you know the ones that go with the signature line :D
  2711. */
  2712. function template_profile_block_other_info()
  2713. {
  2714. global $settings, $txt, $context, $scripturl;
  2715. echo '
  2716. <div class="cat_bar">
  2717. <h3 class="catbg">
  2718. <img src="', $settings['images_url'], '/post/question.png" alt="" class="icon"/>&nbsp;';
  2719. if ($context['user']['is_owner'])
  2720. echo '
  2721. <a href="', $scripturl ,'?action=profile;area=forumprofile;u=', $context['member']['id'], '">' , $txt['profile_more'] , '</a>';
  2722. else
  2723. echo $txt['profile_more'];
  2724. echo '
  2725. </h3>
  2726. </div>';
  2727. echo '
  2728. <div class="windowbg">
  2729. <div class="content profileblock">';
  2730. // Are there any custom profile fields for the above signature area?
  2731. if (!empty($context['custom_fields']))
  2732. {
  2733. $shown = false;
  2734. foreach ($context['custom_fields'] as $field)
  2735. {
  2736. if ($field['placement'] != 2 || empty($field['output_html']))
  2737. continue;
  2738. if (empty($shown))
  2739. {
  2740. echo '
  2741. <dl>';
  2742. $shown = true;
  2743. }
  2744. echo '
  2745. <dt><strong>', $field['name'], ':</strong></dt>
  2746. <dd>', $field['output_html'], '</dd>';
  2747. }
  2748. if (!empty($shown))
  2749. echo '
  2750. </dl>';
  2751. }
  2752. // Show the users signature.
  2753. if ($context['signature_enabled'] && !empty($context['member']['signature']))
  2754. echo '
  2755. <div class="signature">
  2756. <h5>', $txt['signature'], ':</h5>
  2757. ', $context['member']['signature'], '
  2758. </div>
  2759. <hr class="hrcolor"/>';
  2760. elseif (empty($shown))
  2761. echo $txt['none'];
  2762. // Done with this block
  2763. echo '
  2764. </div>
  2765. </div>';
  2766. }
  2767. /**
  2768. * Show any warnings on this user and allows for editing of it
  2769. * Can approve members
  2770. * Needs the correct permissions for either action in order to view
  2771. */
  2772. function template_profile_block_moderation()
  2773. {
  2774. global $settings, $txt, $context, $scripturl;
  2775. // Can they do view warnings or approve members ?
  2776. if (($context['can_view_warning'] && $context['member']['warning']) || (!empty($context['activate_message']) || !empty($context['member']['bans'])))
  2777. {
  2778. echo '
  2779. <div class="cat_bar">
  2780. <h3 class="catbg">
  2781. <img src="', $settings['images_url'], '/post/wireless.png" alt="" class="icon"/>&nbsp;', $txt['profile_moderation'], '
  2782. </h3>
  2783. </div>
  2784. <div class="windowbg">
  2785. <div class="content profileblock">';
  2786. // Can they view/issue a warning?
  2787. if ($context['can_view_warning'] && $context['member']['warning'])
  2788. {
  2789. echo '
  2790. <dl>
  2791. <dt><strong>', $txt['profile_warning_level'], ': </strong></dt>
  2792. <dd>
  2793. <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', $context['can_issue_warning'] ? 'issuewarning' : 'viewwarning', '">', $context['member']['warning'], '%</a>';
  2794. // Can we provide information on what this means?
  2795. if (!empty($context['warning_status']))
  2796. echo '
  2797. <span class="alert">(', $context['warning_status'], ')</span>';
  2798. echo '
  2799. </dd>
  2800. </dl>';
  2801. }
  2802. // Is this member requiring activation and/or banned?
  2803. if (!empty($context['activate_message']) || !empty($context['member']['bans']))
  2804. {
  2805. echo '
  2806. <dl>';
  2807. // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
  2808. if (!empty($context['activate_message']))
  2809. echo '
  2810. <dt class="clear"><span class="alert">', $context['activate_message'], '</span>&nbsp;(<a href="' . $scripturl . '?action=profile;save;area=activateaccount;u=' . $context['id_member'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"', ($context['activate_type'] == 4 ? ' onclick="return confirm(\'' . $txt['profileConfirm'] . '\');"' : ''), '>', $context['activate_link_text'], '</a>)</dt>';
  2811. // If the current member is banned, show a message and possibly a link to the ban.
  2812. if (!empty($context['member']['bans']))
  2813. {
  2814. echo '
  2815. <dt class="clear"><span class="alert">', $txt['user_is_banned'], '</span>&nbsp;[<a href="#" onclick="document.getElementById(\'ban_info\').style.display = document.getElementById(\'ban_info\').style.display == \'none\' ? \'\' : \'none\';return false;">' . $txt['view_ban'] . '</a>]</dt>
  2816. <dt class="clear" id="ban_info" style="display: none;">
  2817. <strong>', $txt['user_banned_by_following'], ':</strong>';
  2818. foreach ($context['member']['bans'] as $ban)
  2819. echo '
  2820. <br />
  2821. <span class="smalltext">', $ban['explanation'], '</span>';
  2822. echo '
  2823. </dt>';
  2824. }
  2825. echo '
  2826. </dl>';
  2827. }
  2828. // Done with this block
  2829. echo '
  2830. </div>
  2831. </div>';
  2832. }
  2833. }
  2834. /**
  2835. * Shows a list of your buddies
  2836. */
  2837. function template_profile_block_buddies()
  2838. {
  2839. global $context, $settings, $scripturl, $txt, $modSettings;
  2840. // init
  2841. $i = 0;
  2842. $per_line = 4;
  2843. // set the height to about 2 lines of buddies w/avatars
  2844. if (isset($context['buddies']))
  2845. $div_height = 120 + (2 * max(empty($modSettings['avatar_max_height_external']) ? 0 : $modSettings['avatar_max_height_external'], empty($modSettings['avatar_max_height_upload']) ? 0 : $modSettings['avatar_max_height_upload'], 65));
  2846. if (!empty($modSettings['enable_buddylist']) && $context['user']['is_owner'])
  2847. {
  2848. echo '
  2849. <div class="cat_bar">
  2850. <h3 class="catbg">
  2851. <img src="', $settings['images_url'], '/icons/online.png" alt="" class="icon"/>&nbsp;
  2852. <a href="', $scripturl ,'?action=profile;area=lists;sa=buddies;u=', $context['member']['id'], '">', $txt['buddies'], '</a>
  2853. </h3>
  2854. </div>
  2855. <div class="windowbg">
  2856. <div class="content flow_auto" ', (isset($div_height) ? 'style="max-height: ' . $div_height . 'px"' : ''), '>
  2857. <table class="profile_attachments">';
  2858. // now show them all
  2859. if (isset($context['buddies']))
  2860. {
  2861. foreach ($context['buddies'] as $buddy_id => $data)
  2862. {
  2863. if ($i % $per_line === 0)
  2864. echo '
  2865. <tr>';
  2866. echo '
  2867. <td align="center">
  2868. ', $data['avatar']['image'],'<br />
  2869. <a href="', $scripturl , '?action=profile;u=', $data['id'] , '">' , $data['name'] , '</a><br />
  2870. <em>', $settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/buddy_' . ($data['online']['is_online'] ? 'useron' : 'useroff') . '.png' . '" alt="' . $txt[$data['online']['is_online'] ? 'online' : 'offline'] . '" class="icon"/>' : $txt[$data['online']['is_online'] ? 'online' : 'offline'], $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $txt[$data['online']['is_online'] ? 'online' : 'offline'] . '</span>' : '', '</em>
  2871. ';
  2872. // Only show the email address fully if it's not hidden - and we reveal the email.
  2873. if ($context['can_send_email'] && ($data['show_email'] == 'yes' || $data['show_email'] == 'yes_permission_override'))
  2874. echo '
  2875. <br />
  2876. <a href="', $scripturl, '?action=emailuser;sa=email;uid=', $data['id'], '"><img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . ' ' . $data['name'] . '" class="icon"/></a>';
  2877. if ($context['can_send_pm'])
  2878. {
  2879. if ($data['online']['is_online'])
  2880. echo '
  2881. &nbsp;<a href="', $scripturl, '?action=pm;sa=send;u=', $data['id'], '"><img src="', $settings['images_url'] ,'/im_on.png" alt="',$txt['profile_sendpm_short'],'" title="',$txt['profile_sendpm_short'],' to ',$data['name'], '" class="icon"/></a>';
  2882. else
  2883. echo '
  2884. &nbsp;<a href="', $scripturl, '?action=pm;sa=send;u=', $data['id'], '"><img src="', $settings['images_url'] ,'/im_off.png" alt="',$txt['profile_sendpm_short'],'" title="',$txt['profile_sendpm_short'],' to ',$data['name'], '" class="icon"/></a>';
  2885. }
  2886. echo '
  2887. </td>';
  2888. if (++$i % $per_line === 0)
  2889. echo '
  2890. </tr>';
  2891. }
  2892. // close this final row
  2893. if ($i % $per_line !== 0)
  2894. echo '
  2895. </tr>';
  2896. }
  2897. // buddyless how sad :(
  2898. else
  2899. echo '
  2900. <tr>
  2901. <td>', $txt['profile_buddies_no'] ,'</td>
  2902. </tr>';
  2903. // All done
  2904. echo '
  2905. </table>
  2906. </div>
  2907. </div>';
  2908. }
  2909. }
  2910. /**
  2911. * Shows the most recent attachments (as thumbnails) for this user
  2912. */
  2913. function template_profile_block_attachments()
  2914. {
  2915. global $settings, $txt, $context, $scripturl;
  2916. // init
  2917. $i = 0;
  2918. $per_line = 4;
  2919. // the attachment div
  2920. echo '
  2921. <div class="cat_bar">
  2922. <h3 class="catbg">
  2923. <img src="', $settings['images_url'], '/image.png" alt="" class="icon"/>&nbsp;
  2924. <a href="', $scripturl ,'?action=profile;area=showposts;sa=attach;u=', $context['member']['id'], '">', $txt['profile_attachments'], '</a>
  2925. </h3>
  2926. </div>';
  2927. echo '
  2928. <div class="windowbg creator">
  2929. <div class="content">';
  2930. echo '
  2931. <table class="profile_attachments">';
  2932. // Show the thumbnails
  2933. if (!empty($context['thumbs']))
  2934. {
  2935. foreach ($context['thumbs'] as $picture)
  2936. {
  2937. if ($i % $per_line === 0)
  2938. echo '
  2939. <tr>';
  2940. echo '
  2941. <td align="center">
  2942. <a href="', $picture['url'], '">', $picture['img'], '</a>
  2943. </td>';
  2944. if (++$i % $per_line === 0)
  2945. echo '
  2946. </tr>';
  2947. }
  2948. // close this final row
  2949. if ($i % $per_line !== 0)
  2950. echo '
  2951. </tr>';
  2952. }
  2953. else
  2954. // No data for this member
  2955. echo '
  2956. <tr>
  2957. <td>', $txt['profile_attachments_no'], '</td>
  2958. </tr>';
  2959. // All done
  2960. echo '
  2961. </table>
  2962. </div>
  2963. </div>';
  2964. }