PageRenderTime 59ms CodeModel.GetById 16ms 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

Large files files are truncated, but you can click here to view the full 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. <

Large files files are truncated, but you can click here to view the full file