PageRenderTime 71ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

/Themes/default/Profile.template.php

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