PageRenderTime 70ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 1ms

/themes/default/Profile.template.php

https://github.com/Arantor/Elkarte
PHP | 3016 lines | 2493 code | 351 blank | 172 comment | 288 complexity | 45cb19ae1b89c809b22eeadd037cdabd MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-3.0

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

  1. <?php
  2. /**
  3. * @name ElkArte Forum
  4. * @copyright ElkArte Forum contributors
  5. * @license BSD http://opensource.org/licenses/BSD-3-Clause
  6. *
  7. * This software is a derived product, based on:
  8. *
  9. * Simple Machines Forum (SMF)
  10. * copyright: 2011 Simple Machines (http://www.simplemachines.org)
  11. * license: BSD, See included LICENSE.TXT for terms and conditions.
  12. *
  13. * @version 1.0 Alpha
  14. */
  15. // Template for the profile side bar - goes before any other profile template.
  16. function template_profile_above()
  17. {
  18. global $context, $settings, $scripturl, $modSettings, $txt;
  19. echo '
  20. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/profile.js"></script>';
  21. // Prevent Chrome from auto completing fields when viewing/editing other members profiles
  22. if (isBrowser('is_chrome') && !$context['user']['is_owner'])
  23. echo '
  24. <script type="text/javascript"><!-- // --><![CDATA[
  25. disableAutoComplete();
  26. // ]]></script>';
  27. // If an error occurred while trying to save previously, give the user a clue!
  28. echo '
  29. ', template_error_message();
  30. // If the profile was update successfully, let the user know this.
  31. if (!empty($context['profile_updated']))
  32. echo '
  33. <div class="infobox">
  34. ', $context['profile_updated'], '
  35. </div>';
  36. }
  37. // Template for closing off table started in profile_above.
  38. function template_profile_below()
  39. {
  40. }
  41. // This template displays users details without any option to edit them.
  42. function template_action_summary()
  43. {
  44. global $context, $settings, $scripturl, $modSettings, $txt;
  45. // Display the basic information about the user
  46. echo '
  47. <div id="profileview" class="flow_auto">
  48. <div id="basicinfo">
  49. <div class="windowbg">
  50. <div class="content flow_auto">
  51. <div class="username"><h4>', $context['member']['name'], ' <span class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</span></h4></div>
  52. ', $context['member']['avatar']['image'], '
  53. <ul class="reset">';
  54. // @TODO fix the <ul> when no fields are visible
  55. // What about if we allow email only via the forum??
  56. if ($context['member']['show_email'] === 'yes' || $context['member']['show_email'] === 'no_through_forum' || $context['member']['show_email'] === 'yes_permission_override' && $context['can_send_email'])
  57. echo '
  58. <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>';
  59. // Don't show an icon if they haven't specified a website.
  60. if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
  61. echo '
  62. <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>';
  63. // Are there any custom profile fields for the summary?
  64. if (!empty($context['custom_fields']))
  65. {
  66. foreach ($context['custom_fields'] as $field)
  67. if (($field['placement'] == 1 || empty($field['output_html'])) && !empty($field['value']))
  68. echo '
  69. <li class="cf_icon">', $field['output_html'], '</li>';
  70. }
  71. echo '
  72. </ul>
  73. <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>' : '';
  74. // Can they add this member as a buddy?
  75. if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
  76. echo '
  77. <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>';
  78. echo '
  79. </span>';
  80. echo '
  81. <p id="infolinks">';
  82. if (!$context['user']['is_owner'] && $context['can_send_pm'])
  83. echo '
  84. <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '">', $txt['profile_sendpm_short'], '</a><br />';
  85. echo '
  86. <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '">', $txt['showPosts'], '</a><br />';
  87. if ($context['user']['is_owner'] && !empty($modSettings['drafts_enabled']))
  88. echo '
  89. <a href="', $scripturl, '?action=profile;area=showdrafts;u=', $context['id_member'], '">', $txt['drafts_show'], '</a><br />';
  90. echo '
  91. <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '">', $txt['statPanel'], '</a>
  92. </p>';
  93. echo '
  94. </div>
  95. </div>
  96. </div>
  97. <div id="detailedinfo">
  98. <div class="windowbg2">
  99. <div class="content">
  100. <dl>';
  101. if ($context['user']['is_owner'] || $context['user']['is_admin'])
  102. echo '
  103. <dt>', $txt['username'], ': </dt>
  104. <dd>', $context['member']['username'], '</dd>';
  105. if (!isset($context['disabled_fields']['posts']))
  106. echo '
  107. <dt>', $txt['profile_posts'], ': </dt>
  108. <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
  109. if ($context['can_send_email'])
  110. {
  111. // Only show the email address fully if it's not hidden - and we reveal the email.
  112. if ($context['member']['show_email'] == 'yes')
  113. echo '
  114. <dt>', $txt['email'], ': </dt>
  115. <dd><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $context['member']['id'], '">', $context['member']['email'], '</a></dd>';
  116. // ... Or if the one looking at the profile is an admin they can see it anyway.
  117. elseif ($context['member']['show_email'] == 'yes_permission_override')
  118. echo '
  119. <dt>', $txt['email'], ': </dt>
  120. <dd><em><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $context['member']['id'], '">', $context['member']['email'], '</a></em></dd>';
  121. }
  122. if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
  123. echo '
  124. <dt>', $txt['custom_title'], ': </dt>
  125. <dd>', $context['member']['title'], '</dd>';
  126. if (!empty($context['member']['blurb']))
  127. echo '
  128. <dt>', $txt['personal_text'], ': </dt>
  129. <dd>', $context['member']['blurb'], '</dd>';
  130. // If karma enabled show the members karma.
  131. if ($modSettings['karmaMode'] == '1')
  132. echo '
  133. <dt>', $modSettings['karmaLabel'], ' </dt>
  134. <dd>', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</dd>';
  135. elseif ($modSettings['karmaMode'] == '2')
  136. echo '
  137. <dt>', $modSettings['karmaLabel'], ' </dt>
  138. <dd>+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '</dd>';
  139. if (!isset($context['disabled_fields']['gender']) && !empty($context['member']['gender']['name']))
  140. echo '
  141. <dt>', $txt['gender'], ': </dt>
  142. <dd>', $context['member']['gender']['name'], '</dd>';
  143. echo '
  144. <dt>', $txt['age'], ':</dt>
  145. <dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' &nbsp; <img src="' . $settings['images_url'] . '/cake.png" alt="" />' : ''), '</dd>';
  146. if (!isset($context['disabled_fields']['location']) && !empty($context['member']['location']))
  147. echo '
  148. <dt>', $txt['location'], ':</dt>
  149. <dd>', $context['member']['location'], '</dd>';
  150. echo '
  151. </dl>';
  152. // Any custom fields for standard placement?
  153. if (!empty($context['custom_fields']))
  154. {
  155. $shown = false;
  156. foreach ($context['custom_fields'] as $field)
  157. {
  158. if ($field['placement'] != 0 || empty($field['output_html']))
  159. continue;
  160. if (empty($shown))
  161. {
  162. echo '
  163. <dl>';
  164. $shown = true;
  165. }
  166. echo '
  167. <dt>', $field['name'], ':</dt>
  168. <dd>', $field['output_html'], '</dd>';
  169. }
  170. if (!empty($shown))
  171. echo '
  172. </dl>';
  173. }
  174. echo '
  175. <dl class="noborder">';
  176. // Can they view/issue a warning?
  177. if ($context['can_view_warning'] && $context['member']['warning'])
  178. {
  179. echo '
  180. <dt>', $txt['profile_warning_level'], ': </dt>
  181. <dd>
  182. <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', $context['can_issue_warning'] ? 'issuewarning' : 'viewwarning', '">', $context['member']['warning'], '%</a>';
  183. // Can we provide information on what this means?
  184. if (!empty($context['warning_status']))
  185. echo '
  186. <span class="smalltext">(', $context['warning_status'], ')</span>';
  187. echo '
  188. </dd>';
  189. }
  190. // Is this member requiring activation and/or banned?
  191. if (!empty($context['activate_message']) || !empty($context['member']['bans']))
  192. {
  193. // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
  194. if (!empty($context['activate_message']))
  195. echo '
  196. <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>';
  197. // If the current member is banned, show a message and possibly a link to the ban.
  198. if (!empty($context['member']['bans']))
  199. {
  200. echo '
  201. <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>
  202. <dt class="clear" id="ban_info" style="display: none;">
  203. <strong>', $txt['user_banned_by_following'], ':</strong>';
  204. foreach ($context['member']['bans'] as $ban)
  205. echo '
  206. <br /><span class="smalltext">', $ban['explanation'], '</span>';
  207. echo '
  208. </dt>';
  209. }
  210. }
  211. echo '
  212. <dt>', $txt['date_registered'], ': </dt>
  213. <dd>', $context['member']['registered'], '</dd>';
  214. // If the person looking is allowed, they can check the members IP address and hostname.
  215. if ($context['can_see_ip'])
  216. {
  217. if (!empty($context['member']['ip']))
  218. echo '
  219. <dt>', $txt['ip'], ': </dt>
  220. <dd><a href="', $scripturl, '?action=profile;area=history;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
  221. if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
  222. echo '
  223. <dt>', $txt['hostname'], ': </dt>
  224. <dd>', $context['member']['hostname'], '</dd>';
  225. }
  226. echo '
  227. <dt>', $txt['local_time'], ':</dt>
  228. <dd>', $context['member']['local_time'], '</dd>';
  229. if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
  230. echo '
  231. <dt>', $txt['language'], ':</dt>
  232. <dd>', $context['member']['language'], '</dd>';
  233. echo '
  234. <dt>', $txt['lastLoggedIn'], ': </dt>
  235. <dd>', $context['member']['last_login'], '</dd>
  236. </dl>';
  237. // Are there any custom profile fields for the summary?
  238. if (!empty($context['custom_fields']))
  239. {
  240. $shown = false;
  241. foreach ($context['custom_fields'] as $field)
  242. {
  243. if ($field['placement'] != 2 || empty($field['output_html']))
  244. continue;
  245. if (empty($shown))
  246. {
  247. $shown = true;
  248. echo '
  249. <div class="custom_fields_above_signature">
  250. <ul class="reset nolist">';
  251. }
  252. echo '
  253. <li>', $field['output_html'], '</li>';
  254. }
  255. if ($shown)
  256. echo '
  257. </ul>
  258. </div>';
  259. }
  260. // Show the users signature.
  261. if ($context['signature_enabled'] && !empty($context['member']['signature']))
  262. echo '
  263. <div class="signature">
  264. <h5>', $txt['signature'], ':</h5>
  265. ', $context['member']['signature'], '
  266. </div>';
  267. echo '
  268. </div>
  269. </div>
  270. </div>
  271. <div class="clear"></div>
  272. </div>';
  273. }
  274. // Template for showing all the posts of the user, in chronological order.
  275. function template_action_showPosts()
  276. {
  277. global $context, $settings, $scripturl, $modSettings, $txt;
  278. echo '
  279. <div class="cat_bar">
  280. <h3 class="catbg">
  281. ', (!isset($context['attachments']) && empty($context['is_topics']) ? $txt['showMessages'] : (!empty($context['is_topics']) ? $txt['showTopics'] : $txt['showAttachments'])), ' - ', $context['member']['name'], '
  282. </h3>
  283. </div>', !empty($context['page_index']) ? '
  284. <div class="pagesection">
  285. <div class="pagelinks">' . $context['page_index'] . '</div>
  286. </div>' : '';
  287. // Button shortcuts
  288. $quote_button = create_button('quote.png', 'reply_quote', 'quote', 'class="centericon"');
  289. $reply_button = create_button('reply_sm.png', 'reply', 'reply', 'class="centericon"');
  290. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'class="centericon"');
  291. $notify_button = create_button('notify_sm.png', 'notify_replies', 'notify', 'class="centericon"');
  292. // Are we displaying posts or attachments?
  293. if (!isset($context['attachments']))
  294. {
  295. // For every post to be displayed, give it its own div, and show the important details of the post.
  296. foreach ($context['posts'] as $post)
  297. {
  298. echo '
  299. <div class="', $post['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  300. <div class="content">
  301. <div class="counter">', $post['counter'], '</div>
  302. <div class="topic_details">
  303. <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>
  304. <span class="smalltext">', $post['time'], '</span>
  305. </div>
  306. <div class="list_posts">';
  307. if (!$post['approved'])
  308. echo '
  309. <div class="approve_post">
  310. <em>', $txt['post_awaiting_approval'], '</em>
  311. </div>';
  312. echo '
  313. ', $post['body'], '
  314. </div>';
  315. if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
  316. echo '
  317. <div class="floatright">
  318. <ul class="reset smalltext quickbuttons">';
  319. // If they *can* reply?
  320. if ($post['can_reply'])
  321. echo '
  322. <li><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '" class="reply_button"><span>', $txt['reply'], '</span></a></li>';
  323. // If they *can* quote?
  324. if ($post['can_quote'])
  325. echo '
  326. <li><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '" class="quote_button"><span>', $txt['quote'], '</span></a></li>';
  327. // Can we request notification of topics?
  328. if ($post['can_mark_notify'])
  329. echo '
  330. <li><a href="', $scripturl, '?action=notify;topic=', $post['topic'], '.', $post['start'], '" class="notify_button"><span>', $txt['notify'], '</span></a></li>';
  331. // How about... even... remove it entirely?!
  332. if ($post['can_delete'])
  333. echo '
  334. <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>';
  335. if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
  336. echo '
  337. </ul>
  338. </div>';
  339. echo '
  340. </div>
  341. </div>';
  342. }
  343. }
  344. else
  345. template_show_list('attachments');
  346. // No posts? Just end the table with a informative message.
  347. if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
  348. echo '
  349. <div class="windowbg2">
  350. <div class="content">
  351. ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
  352. </div>
  353. </div>';
  354. // Show more page numbers.
  355. if (!empty($context['page_index']))
  356. echo '
  357. <div class="pagesection" style="margin-bottom: 0;">
  358. <div class="pagelinks">', $context['page_index'], '</div>
  359. </div>';
  360. }
  361. // Template for showing all the drafts of the user.
  362. function template_showDrafts()
  363. {
  364. global $context, $settings, $scripturl, $modSettings, $txt;
  365. echo '
  366. <div class="pagesection" style="margin-bottom: 0;">
  367. <div class="pagelinks">', $context['page_index'], '</div>
  368. </div>';
  369. // No drafts? Just show an informative message.
  370. if (empty($context['drafts']))
  371. echo '
  372. <div class="tborder windowbg2 padding centertext">
  373. ', $txt['draft_none'], '
  374. </div>';
  375. else
  376. {
  377. // For every draft to be displayed, give it its own div, and show the important details of the draft.
  378. foreach ($context['drafts'] as $draft)
  379. {
  380. echo '
  381. <div class="', $draft['alternate'] === 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  382. <div class="content">
  383. <div class="counter">', $draft['counter'], '</div>
  384. <div class="topic_details">
  385. <h5><strong><a href="', $scripturl, '?board=', $draft['board']['id'], '.0">', $draft['board']['name'], '</a> / ', $draft['topic']['link'], '</strong>&nbsp;&nbsp;';
  386. if (!empty($draft['sticky']))
  387. echo '<img src="', $settings['images_url'], '/icons/quick_sticky.png" alt="', $txt['sticky_topic'], '" title="', $txt['sticky_topic'], '" />';
  388. if (!empty($draft['locked']))
  389. echo '<img src="', $settings['images_url'], '/icons/quick_lock.png" alt="', $txt['locked_topic'], '" title="', $txt['locked_topic'], '" />';
  390. echo '
  391. </h5>
  392. <span class="smalltext">&#171;&nbsp;<strong>', $txt['draft_saved_on'], ':</strong> ', ($draft['age'] > 0 ? sprintf($txt['draft_days_ago'], $draft['age']) : $draft['time']), (!empty($draft['remaining']) ? ', ' . sprintf($txt['draft_retain'], $draft['remaining']) : ''), '&#187;</span>
  393. </div>
  394. <div class="list_posts">
  395. ', $draft['body'], '
  396. </div>
  397. <div class="floatright">
  398. <ul class="quickbuttons">
  399. <li>
  400. <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>
  401. </li>
  402. <li>
  403. <a href="', $scripturl, '?action=profile;u=', $context['member']['id'], ';area=showdrafts;delete=', $draft['id_draft'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['draft_remove'], '?\');" class="remove_button"><span>', $txt['draft_delete'], '</span></a>
  404. </li>
  405. </ul>
  406. </div>
  407. </div>
  408. </div>';
  409. }
  410. }
  411. // Show page numbers.
  412. echo '
  413. <div class="pagesection" style="margin-bottom: 0;">
  414. <div class="pagelinks">', $context['page_index'], '</div>
  415. </div>';
  416. }
  417. // Template for showing all the buddies of the current user.
  418. function template_editBuddies()
  419. {
  420. global $context, $settings, $scripturl, $modSettings, $txt;
  421. $disabled_fields = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array();
  422. echo '
  423. <div class="generic_list_wrapper" id="edit_buddies">
  424. <div class="title_bar">
  425. <h3 class="titlebg">
  426. <img src="', $settings['images_url'], '/icons/online.png" alt="" class="icon" />', $txt['editBuddies'], '
  427. </h3>
  428. </div>
  429. <table class="table_grid">
  430. <tr class="catbg">
  431. <th class="first_th" scope="col" style="width:20%">', $txt['name'], '</th>
  432. <th class="centercol" scope="col">', $txt['status'], '</th>';
  433. if ($context['can_send_email'])
  434. echo '
  435. <th class="centercol" scope="col">', $txt['email'], '</th>';
  436. echo '
  437. <th class="last_th centercol" scope="col"></th>
  438. </tr>';
  439. // If they don't have any buddies don't list them!
  440. if (empty($context['buddies']))
  441. echo '
  442. <tr class="windowbg2">
  443. <td colspan="8" class="centertext"><strong>', $txt['no_buddies'], '</strong></td>
  444. </tr>';
  445. // Now loop through each buddy showing info on each.
  446. $alternate = false;
  447. foreach ($context['buddies'] as $buddy)
  448. {
  449. echo '
  450. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  451. <td>', $buddy['link'], '</td>
  452. <td class="centertext">
  453. <a href="', $buddy['online']['href'], '"><img src="', $buddy['online']['image_href'], '" alt="', $buddy['online']['text'], '" title="', $buddy['online']['text'], '" /></a>
  454. </td>';
  455. if ($context['can_send_email'])
  456. echo '
  457. <td class="centertext">', ($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>';
  458. // If these are off, don't show them
  459. // @todo this used to show the IM agents for buddies ... do we want to get any custom profile fields to populate here?
  460. if (isset($buddy_fields))
  461. {
  462. foreach ($buddy_fields as $key => $column)
  463. {
  464. if (!isset($disabled_fields[$column]))
  465. echo '
  466. <td class="centertext">', $buddy[$column]['link'], '</td>';
  467. }
  468. }
  469. echo '
  470. <td class="centertext">
  471. <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>
  472. </td>
  473. </tr>';
  474. $alternate = !$alternate;
  475. }
  476. echo '
  477. </table>
  478. </div>';
  479. // Add a new buddy?
  480. echo '
  481. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=buddies" method="post" accept-charset="UTF-8">
  482. <div class="tborder add_buddy">
  483. <div class="title_bar">
  484. <h3 class="titlebg">', $txt['buddy_add'], '</h3>
  485. </div>
  486. <div class="roundframe">
  487. <dl class="settings">
  488. <dt>
  489. <label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label>
  490. </dt>
  491. <dd>
  492. <input type="text" name="new_buddy" id="new_buddy" size="30" class="input_text" />
  493. <input type="submit" value="', $txt['buddy_add_button'], '" class="button_submit floatnone" />
  494. </dd>
  495. </dl>';
  496. if (!empty($context['token_check']))
  497. echo '
  498. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  499. echo '
  500. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  501. </div>
  502. </div>
  503. </form>
  504. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?alp21"></script>
  505. <script type="text/javascript"><!-- // --><![CDATA[
  506. var oAddBuddySuggest = new smc_AutoSuggest({
  507. sSelf: \'oAddBuddySuggest\',
  508. sSessionId: smf_session_id,
  509. sSessionVar: smf_session_var,
  510. sSuggestId: \'new_buddy\',
  511. sControlId: \'new_buddy\',
  512. sSearchType: \'member\',
  513. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  514. bItemList: false
  515. });
  516. // ]]></script>';
  517. }
  518. // Template for showing the ignore list of the current user.
  519. function template_editIgnoreList()
  520. {
  521. global $context, $settings, $scripturl, $modSettings, $txt;
  522. echo '
  523. <div class="generic_list_wrapper" id="edit_buddies">
  524. <div class="title_bar">
  525. <h3 class="titlebg">
  526. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon" />', $txt['editIgnoreList'], '
  527. </h3>
  528. </div>
  529. <table class="table_grid">
  530. <tr class="catbg">
  531. <th class="first_th" scope="col" style="width:20%">', $txt['name'], '</th>
  532. <th class="centercol" scope="col">', $txt['status'], '</th>';
  533. if ($context['can_send_email'])
  534. echo '
  535. <th class="centercol" scope="col">', $txt['email'], '</th>';
  536. echo '
  537. <th class="centercol last_th" scope="col"></th>
  538. </tr>';
  539. // If they don't have anyone on their ignore list, don't list it!
  540. if (empty($context['ignore_list']))
  541. echo '
  542. <tr class="windowbg2">
  543. <td colspan="4" class="centertext"><strong>', $txt['no_ignore'], '</strong></td>
  544. </tr>';
  545. // Now loop through each buddy showing info on each.
  546. $alternate = false;
  547. foreach ($context['ignore_list'] as $member)
  548. {
  549. echo '
  550. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  551. <td>', $member['link'], '</td>
  552. <td class="centertext"><a href="', $member['online']['href'], '"><img src="', $member['online']['image_href'], '" alt="', $member['online']['text'], '" title="', $member['online']['text'], '" /></a></td>';
  553. if ($context['can_send_email'])
  554. echo '
  555. <td class="centertext">', ($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>';
  556. echo '
  557. <td class="centertext"><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>
  558. </tr>';
  559. $alternate = !$alternate;
  560. }
  561. echo '
  562. </table>
  563. </div>';
  564. // Add to the ignore list?
  565. echo '
  566. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore" method="post" accept-charset="UTF-8">
  567. <div class="tborder add_buddy">
  568. <div class="title_bar">
  569. <h3 class="titlebg">', $txt['ignore_add'], '</h3>
  570. </div>
  571. <div class="roundframe">
  572. <dl class="settings">
  573. <dt>
  574. <label for="new_ignore"><strong>', $txt['who_member'], ':</strong></label>
  575. </dt>
  576. <dd>
  577. <input type="text" name="new_ignore" id="new_ignore" size="25" class="input_text" />
  578. <input type="submit" value="', $txt['ignore_add_button'], '" class="button_submit floatnone" />
  579. </dd>
  580. </dl>';
  581. if (!empty($context['token_check']))
  582. echo '
  583. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  584. echo '
  585. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  586. </div>
  587. </div>
  588. </form>
  589. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?alp21"></script>
  590. <script type="text/javascript"><!-- // --><![CDATA[
  591. var oAddIgnoreSuggest = new smc_AutoSuggest({
  592. sSelf: \'oAddIgnoreSuggest\',
  593. sSessionId: smf_session_id,
  594. sSessionVar: smf_session_var,
  595. sSuggestId: \'new_ignore\',
  596. sControlId: \'new_ignore\',
  597. sSearchType: \'member\',
  598. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  599. bItemList: false
  600. });
  601. // ]]></script>';
  602. }
  603. // This template shows an admin information on a users IP addresses used and errors attributed to them.
  604. function template_trackActivity()
  605. {
  606. global $context, $settings, $scripturl, $txt;
  607. // The first table shows IP information about the user.
  608. echo '
  609. <div class="generic_list_wrapper">
  610. <div class="title_bar">
  611. <h3 class="titlebg"><strong>', $txt['view_ips_by'], ' ', $context['member']['name'], '</strong></h3>
  612. </div>';
  613. // The last IP the user used.
  614. echo '
  615. <div id="tracking" class="windowbg2">
  616. <div class="content">
  617. <dl class="noborder">
  618. <dt>', $txt['most_recent_ip'], ':
  619. ', (empty($context['last_ip2']) ? '' : '<br />
  620. <span class="smalltext">(<a href="' . $scripturl . '?action=quickhelp;help=whytwoip" onclick="return reqOverlayDiv(this.href);">' . $txt['why_two_ip_address'] . '</a>)</span>'), '
  621. </dt>
  622. <dd>
  623. <a href="', $scripturl, '?action=profile;area=history;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
  624. // Second address detected?
  625. if (!empty($context['last_ip2']))
  626. echo '
  627. , <a href="', $scripturl, '?action=profile;area=history;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
  628. echo '
  629. </dd>';
  630. // Lists of IP addresses used in messages / error messages.
  631. echo '
  632. <dt>', $txt['ips_in_messages'], ':</dt>
  633. <dd>
  634. ', (count($context['ips']) > 0 ? implode(', ', $context['ips']) : '(' . $txt['none'] . ')'), '
  635. </dd>
  636. <dt>', $txt['ips_in_errors'], ':</dt>
  637. <dd>
  638. ', (count($context['ips']) > 0 ? implode(', ', $context['error_ips']) : '(' . $txt['none'] . ')'), '
  639. </dd>';
  640. // List any members that have used the same IP addresses as the current member.
  641. echo '
  642. <dt>', $txt['members_in_range'], ':</dt>
  643. <dd>
  644. ', (count($context['members_in_range']) > 0 ? implode(', ', $context['members_in_range']) : '(' . $txt['none'] . ')'), '
  645. </dd>
  646. </dl>
  647. </div>
  648. </div>
  649. </div>
  650. <br />';
  651. // Show the track user list.
  652. template_show_list('track_user_list');
  653. }
  654. // The template for trackIP, allowing the admin to see where/who a certain IP has been used.
  655. function template_trackIP()
  656. {
  657. global $context, $settings, $scripturl, $txt;
  658. // This function always defaults to the last IP used by a member but can be set to track any IP.
  659. // The first table in the template gives an input box to allow the admin to enter another IP to track.
  660. echo '
  661. <div class="tborder">
  662. <div class="cat_bar">
  663. <h3 class="catbg">', $txt['trackIP'], '</h3>
  664. </div>
  665. <div class="roundframe">
  666. <form action="', $context['base_url'], '" method="post" accept-charset="UTF-8">
  667. <dl class="settings">
  668. <dt>
  669. <label for="searchip"><strong>', $txt['enter_ip'], ':</strong></label>
  670. </dt>
  671. <dd>
  672. <input type="text" name="searchip" value="', $context['ip'], '" class="input_text" />
  673. </dd>
  674. </dl>
  675. <input type="submit" value="', $txt['trackIP'], '" class="button_submit" />
  676. </form>
  677. </div>
  678. </div>
  679. <br />
  680. <div class="generic_list_wrapper">';
  681. // The table inbetween the first and second table shows links to the whois server for every region.
  682. if ($context['single_ip'])
  683. {
  684. echo '
  685. <div class="title_bar">
  686. <h3 class="titlebg">', $txt['whois_title'], ' ', $context['ip'], '</h3>
  687. </div>
  688. <div class="windowbg2">
  689. <div class="padding">';
  690. foreach ($context['whois_servers'] as $server)
  691. echo '
  692. <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 />';
  693. echo '
  694. </div>
  695. </div>';
  696. }
  697. // The second table lists all the members who have been logged as using this IP address.
  698. echo '
  699. <div class="title_bar">
  700. <h3 class="titlebg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
  701. </div>';
  702. if (empty($context['ips']))
  703. echo '
  704. <p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>';
  705. else
  706. {
  707. echo '
  708. <table class="table_grid">
  709. <thead>
  710. <tr class="catbg">
  711. <th class="first_th" scope="col">', $txt['ip_address'], '</th>
  712. <th class="last_th" scope="col">', $txt['display_name'], '</th>
  713. </tr>
  714. </thead>
  715. <tbody>';
  716. // Loop through each of the members and display them.
  717. foreach ($context['ips'] as $ip => $memberlist)
  718. echo '
  719. <tr>
  720. <td class="windowbg2"><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
  721. <td class="windowbg2">', implode(', ', $memberlist), '</td>
  722. </tr>';
  723. echo '
  724. </tbody>
  725. </table>';
  726. }
  727. echo '
  728. </div>
  729. <br />';
  730. template_show_list('track_message_list');
  731. echo '<br />';
  732. template_show_list('track_user_list');
  733. }
  734. function template_action_showPermissions()
  735. {
  736. global $context, $settings, $scripturl, $txt;
  737. echo '
  738. <div class="cat_bar">
  739. <h3 class="catbg">
  740. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon" />', $txt['showPermissions'], '
  741. </h3>
  742. </div>';
  743. if ($context['member']['has_all_permissions'])
  744. {
  745. echo '
  746. <p class="description">', $txt['showPermissions_all'], '</p>';
  747. }
  748. else
  749. {
  750. echo '
  751. <p class="description">',$txt['showPermissions_help'],'</p>
  752. <div id="permissions" class="flow_hidden">';
  753. if (!empty($context['no_access_boards']))
  754. {
  755. echo '
  756. <div class="cat_bar">
  757. <h3 class="catbg">', $txt['showPermissions_restricted_boards'], '</h3>
  758. </div>
  759. <div class="windowbg smalltext">
  760. <div class="content">', $txt['showPermissions_restricted_boards_desc'], ':<br />';
  761. foreach ($context['no_access_boards'] as $no_access_board)
  762. echo '
  763. <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
  764. echo '
  765. </div>
  766. </div>';
  767. }
  768. // General Permissions section.
  769. echo '
  770. <div class="tborder">
  771. <div class="cat_bar">
  772. <h3 class="catbg">', $txt['showPermissions_general'], '</h3>
  773. </div>';
  774. if (!empty($context['member']['permissions']['general']))
  775. {
  776. echo '
  777. <table class="table_grid">
  778. <thead>
  779. <tr class="titlebg">
  780. <th class="lefttext first_th" scope="col" style="width:50%">', $txt['showPermissions_permission'], '</th>
  781. <th class="lefttext last_th" scope="col" style="width:50%">', $txt['showPermissions_status'], '</th>
  782. </tr>
  783. </thead>
  784. <tbody>';
  785. foreach ($context['member']['permissions']['general'] as $permission)
  786. {
  787. echo '
  788. <tr>
  789. <td class="windowbg" title="', $permission['id'], '">
  790. ', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], '
  791. </td>
  792. <td class="windowbg2 smalltext">';
  793. if ($permission['is_denied'])
  794. echo '
  795. <span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']),'</span>';
  796. else
  797. echo '
  798. ', $txt['showPermissions_given'], ':&nbsp;', implode(', ', $permission['groups']['allowed']);
  799. echo '
  800. </td>
  801. </tr>';
  802. }
  803. echo '
  804. </tbody>
  805. </table>
  806. </div><br />';
  807. }
  808. else
  809. echo '
  810. <p class="windowbg2 description">', $txt['showPermissions_none_general'], '</p>';
  811. // Board permission section.
  812. echo '
  813. <div class="tborder">
  814. <form action="' . $scripturl . '?action=profile;u=', $context['id_member'], ';area=permissions#board_permissions" method="post" accept-charset="UTF-8">
  815. <div class="cat_bar">
  816. <h3 class="catbg">
  817. <a id="board_permissions"></a>', $txt['showPermissions_select'], ':
  818. <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
  819. <option value="0"', $context['board'] == 0 ? ' selected="selected"' : '', '>', $txt['showPermissions_global'], '&nbsp;</option>';
  820. if (!empty($context['boards']))
  821. echo '
  822. <option value="" disabled="disabled">---------------------------</option>';
  823. // Fill the box with any local permission boards.
  824. foreach ($context['boards'] as $board)
  825. echo '
  826. <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
  827. echo '
  828. </select>
  829. </h3>
  830. </div>
  831. </form>';
  832. if (!empty($context['member']['permissions']['board']))
  833. {
  834. echo '
  835. <table class="table_grid">
  836. <thead>
  837. <tr class="titlebg">
  838. <th class="lefttext first_th" scope="col" style="width:50%">', $txt['showPermissions_permission'], '</th>
  839. <th class="lefttext last_th" scope="col" style="width:50%">', $txt['showPermissions_status'], '</th>
  840. </tr>
  841. </thead>
  842. <tbody>';
  843. foreach ($context['member']['permissions']['board'] as $permission)
  844. {
  845. echo '
  846. <tr>
  847. <td class="windowbg" title="', $permission['id'], '">
  848. ', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], '
  849. </td>
  850. <td class="windowbg2 smalltext">';
  851. if ($permission['is_denied'])
  852. {
  853. echo '
  854. <span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
  855. }
  856. else
  857. {
  858. echo '
  859. ', $txt['showPermissions_given'], ': &nbsp;', implode(', ', $permission['groups']['allowed']);
  860. }
  861. echo '
  862. </td>
  863. </tr>';
  864. }
  865. echo '
  866. </tbody>
  867. </table>';
  868. }
  869. else
  870. echo '
  871. <p class="windowbg2 description">', $txt['showPermissions_none_board'], '</p>';
  872. echo '
  873. </div>
  874. </div>';
  875. }
  876. }
  877. // Template for user statistics, showing graphs and the like.
  878. function template_action_statPanel()
  879. {
  880. global $context, $settings, $scripturl, $modSettings, $txt;
  881. // First, show a few text statistics such as post/topic count.
  882. echo '
  883. <div id="profileview">
  884. <div id="generalstats">
  885. <div class="windowbg2">
  886. <div class="content">
  887. <dl>
  888. <dt>', $txt['statPanel_total_time_online'], ':</dt>
  889. <dd>', $context['time_logged_in'], '</dd>
  890. <dt>', $txt['statPanel_total_posts'], ':</dt>
  891. <dd>', $context['num_posts'], ' ', $txt['statPanel_posts'], '</dd>
  892. <dt>', $txt['statPanel_total_topics'], ':</dt>
  893. <dd>', $context['num_topics'], ' ', $txt['statPanel_topics'], '</dd>
  894. <dt>', $txt['statPanel_users_polls'], ':</dt>
  895. <dd>', $context['num_polls'], ' ', $txt['statPanel_polls'], '</dd>
  896. <dt>', $txt['statPanel_users_votes'], ':</dt>
  897. <dd>', $context['num_votes'], ' ', $txt['statPanel_votes'], '</dd>
  898. </dl>
  899. </div>
  900. </div>
  901. </div>';
  902. // This next section draws a graph showing what times of day they post the most.
  903. echo '
  904. <div id="activitytime" class="flow_hidden">
  905. <div class="cat_bar">
  906. <h3 class="catbg">
  907. <img src="', $settings['images_url'], '/stats_history.png" alt="" class="icon" />', $txt['statPanel_activityTime'], '
  908. </h3>
  909. </div>
  910. <div class="windowbg2">
  911. <div class="content">';
  912. // If they haven't post at all, don't draw the graph.
  913. if (empty($context['posts_by_time']))
  914. echo '
  915. <span class="centertext">', $txt['statPanel_noPosts'], '</span>';
  916. // Otherwise do!
  917. else
  918. {
  919. echo '
  920. <ul class="activity_stats flow_hidden">';
  921. // The labels.
  922. foreach ($context['posts_by_time'] as $time_of_day)
  923. {
  924. echo '
  925. <li', $time_of_day['is_last'] ? ' class="last"' : '', '>
  926. <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']), '">
  927. <div style="height: ', (int) $time_of_day['relative_percent'], 'px;">
  928. <span>', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '</span>
  929. </div>
  930. </div>
  931. <span class="stats_hour">', $time_of_day['hour_format'], '</span>
  932. </li>';
  933. }
  934. echo '
  935. </ul>';
  936. }
  937. echo '
  938. <span class="clear" />
  939. </div>
  940. </div>
  941. </div>';
  942. // Two columns with the most popular boards by posts and activity (activity = users posts / total posts).
  943. echo '
  944. <div class="flow_hidden">
  945. <div id="popularposts">
  946. <div class="cat_bar">
  947. <h3 class="catbg">
  948. <img src="', $settings['images_url'], '/stats_replies.png" alt="" class="icon" />', $txt['statPanel_topBoards'], '
  949. </h3>
  950. </div>
  951. <div class="windowbg2">
  952. <div class="content">';
  953. if (empty($context['popular_boards']))
  954. echo '
  955. <span class="centertext">', $txt['statPanel_noPosts'], '</span>';
  956. else
  957. {
  958. echo '
  959. <dl>';
  960. // Draw a bar for every board.
  961. foreach ($context['popular_boards'] as $board)
  962. {
  963. echo '
  964. <dt>', $board['link'], '</dt>
  965. <dd>
  966. <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']), '">
  967. ', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), '
  968. </div>
  969. <span>', empty($context['hide_num_posts']) ? $board['posts'] : '', '</span>
  970. </dd>';
  971. }
  972. echo '
  973. </dl>';
  974. }
  975. echo '
  976. </div>
  977. </div>
  978. </div>';
  979. echo '
  980. <div id="popularactivity">
  981. <div class="cat_bar">
  982. <h3 class="catbg">
  983. <img src="', $settings['images_url'], '/stats_replies.png" alt="" class="icon" />', $txt['statPanel_topBoardsActivity'], '
  984. </h3>
  985. </div>
  986. <div class="windowbg2">
  987. <div class="content">';
  988. if (empty($context['board_activity']))
  989. echo '
  990. <span>', $txt['statPanel_noPosts'], '</span>';
  991. else
  992. {
  993. echo '
  994. <dl>';
  995. // Draw a bar for every board.
  996. foreach ($context['board_activity'] as $activity)
  997. {
  998. echo '
  999. <dt>', $activity['link'], '</dt>
  1000. <dd>
  1001. <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']), '">
  1002. ', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), '
  1003. </div>
  1004. <span>', $activity['percent'], '%</span>
  1005. </dd>';
  1006. }
  1007. echo '
  1008. </dl>';
  1009. }
  1010. echo '
  1011. </div>
  1012. </div>
  1013. </div>
  1014. </div>';
  1015. echo '
  1016. </div>';
  1017. }
  1018. // Template for editing profile options.
  1019. function template_edit_options()
  1020. {
  1021. global $context, $settings, $scripturl, $modSettings, $txt;
  1022. // The main header!
  1023. echo '
  1024. <form action="', (!empty($context['profile_custom_submit_url']) ? $context['profile_custom_submit_url'] : $scripturl . '?action=profile;area=' . $context['menu_item_selected'] . ';u=' . $context['id_member']), '" method="post" accept-charset="UTF-8" name="creator" id="creator" enctype="multipart/form-data" onsubmit="return checkProfileSubmit();">
  1025. <div class="cat_bar">
  1026. <h3 class="catbg">
  1027. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon" />';
  1028. // Don't say "Profile" if this isn't the profile...
  1029. if (!empty($context['profile_header_text']))
  1030. echo '
  1031. ', $context['profile_header_text'];
  1032. else
  1033. echo '
  1034. ', $txt['profile'];
  1035. echo '
  1036. </h3>
  1037. </div>';
  1038. // Have we some description?
  1039. if ($context['page_desc'])
  1040. echo '
  1041. <p class="description">', $context['page_desc'], '</p>';
  1042. echo '
  1043. <div class="windowbg2">
  1044. <div class="content">';
  1045. // Any bits at the start?
  1046. if (!empty($context['profile_prehtml']))
  1047. echo '
  1048. <div>', $context['profile_prehtml'], '</div>';
  1049. if (!empty($context['profile_fields']))
  1050. echo '
  1051. <dl>';
  1052. // Start the big old loop 'of love.
  1053. $lastItem = 'hr';
  1054. foreach ($context['profile_fields'] as $key => $field)
  1055. {
  1056. // We add a little hack to be sure we never get more than one hr in a row!
  1057. if ($lastItem == 'hr' && $field['type'] == 'hr')
  1058. continue;
  1059. $lastItem = $field['type'];
  1060. if ($field['type'] == 'hr')
  1061. {
  1062. echo '
  1063. </dl>
  1064. <hr width="100%" size="1" class="hrcolor clear" />
  1065. <dl>';
  1066. }
  1067. elseif ($field['type'] == 'callback')
  1068. {
  1069. if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
  1070. {
  1071. $callback_func = 'template_profile_' . $field['callback_func'];
  1072. $callback_func();
  1073. }
  1074. }
  1075. else
  1076. {
  1077. echo '
  1078. <dt>
  1079. <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['type'] !== 'label' ? '<label for="' . $key . '">' : '', $field['label'], $field['type'] !== 'label' ? '</label>' : '', '</strong>';
  1080. // Does it have any subtext to show?
  1081. if (!empty($field['subtext']))
  1082. echo '
  1083. <br />
  1084. <span class="smalltext">', $field['subtext'], '</span>';
  1085. echo '
  1086. </dt>
  1087. <dd>';
  1088. // Want to put something infront of the box?
  1089. if (!empty($field['preinput']))
  1090. echo '
  1091. ', $field['preinput'];
  1092. // What type of data are we showing?
  1093. if ($field['type'] == 'label')
  1094. echo '
  1095. ', $field['value'];
  1096. // Maybe it's a text box - very likely!
  1097. elseif (in_array($field['type'], array('int', 'float', 'text', 'password')))
  1098. echo '
  1099. <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', '" />';
  1100. // You "checking" me out? ;)
  1101. elseif ($field['type'] == 'check')
  1102. echo '
  1103. <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'], ' />';
  1104. // Always fun - select boxes!
  1105. elseif ($field['type'] == 'select')
  1106. {
  1107. echo '
  1108. <select name="', $key, '" id="', $key, '">';
  1109. if (isset($field['options']))
  1110. {
  1111. // Is this some code to generate the options?
  1112. if (!is_array($field['options']))
  1113. $field['options'] = eval($field['options']);
  1114. // Assuming we now have some!
  1115. if (is_array($field['options']))
  1116. foreach ($field['options'] as $value => $name)
  1117. echo '
  1118. <option value="', $value, '" ', $value == $field['value'] ? 'selected="selected"' : '', '>', $name, '</option>';
  1119. }
  1120. echo '
  1121. </select>';
  1122. }
  1123. // Something to end with?
  1124. if (!empty($field['postinput']))
  1125. echo '
  1126. ', $field['postinput'];
  1127. echo '
  1128. </dd>';
  1129. }
  1130. }
  1131. if (!empty($context['profile_fields']))
  1132. echo '
  1133. </dl>';
  1134. // Are there any custom profile fields - if so print them!
  1135. if (!empty($context['custom_fields']))
  1136. {
  1137. if ($lastItem != 'hr')
  1138. echo '
  1139. <hr width="100%" size="1" class="hrcolor clear" />';
  1140. echo '
  1141. <dl>';
  1142. foreach ($context['custom_fields'] as $field)
  1143. {
  1144. echo '
  1145. <dt>
  1146. <strong>', $field['name'], ': </strong><br />
  1147. <span class="smalltext">', $field['desc'], '</span>
  1148. </dt>
  1149. <dd>
  1150. ', $field['input_html'], '
  1151. </dd>';
  1152. }
  1153. echo '
  1154. </dl>';
  1155. }
  1156. // Any closing HTML?
  1157. if (!empty($context['profile_posthtml']))
  1158. echo '
  1159. <div>', $context['profile_posthtml'], '</div>';
  1160. // Only show the password box if it's actually needed.
  1161. if ($context['require_password'])
  1162. echo '
  1163. <dl>
  1164. <dt>
  1165. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '><label for="oldpasswrd">', $txt['current_password'], ': </label></strong><br />
  1166. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  1167. </dt>
  1168. <dd>
  1169. <input type="password" name="oldpasswrd" id="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  1170. </dd>
  1171. </dl>';
  1172. // The button shouldn't say "Change profile" unless we're changing the profile...
  1173. if (!empty($context['submit_button_text']))
  1174. echo '
  1175. <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button_submit" />';
  1176. else
  1177. echo '
  1178. <input type="submit" name="save" value="', $txt['change_profile'], '" class="button_submit" />';
  1179. if (!empty($context['token_check']))
  1180. echo '
  1181. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1182. echo '
  1183. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1184. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1185. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1186. </div>
  1187. </div>
  1188. </form>';
  1189. // Some javascript!
  1190. echo '
  1191. <script type="text/javascript"><!-- // --><![CDATA[
  1192. function checkProfileSubmit()
  1193. {';
  1194. // If this part requires a password, make sure to give a warning.
  1195. if ($context['require_password'])
  1196. echo '
  1197. // Did you forget to type your password?
  1198. if (document.forms.creator.oldpasswrd.value == "")
  1199. {
  1200. alert("', $txt['required_security_reasons'], '");
  1201. return false;
  1202. }';
  1203. // Any onsubmit javascript?
  1204. if (!empty($context['profile_onsubmit_javascript']))
  1205. echo '
  1206. ', $context['profile_javascript'];
  1207. echo '
  1208. }';
  1209. // Any totally custom stuff?
  1210. if (!empty($context['profile_javascript']))
  1211. echo '
  1212. ', $context['profile_javascript'];
  1213. echo '
  1214. // ]]></script>';
  1215. // Any final spellchecking stuff?
  1216. if (!empty($context['show_spellchecking']))
  1217. echo '
  1218. <form name="spell_form" id="spell_form" method="post" accept-charset="UTF-8" target="spellWindow" action="', $scripturl, '?action=spellcheck">
  1219. <input type="hidden" name="spellstring" value="" />
  1220. <input type="hidden" name="fulleditor" value="" />
  1221. </form>
  1222. <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/spellcheck.js"></script>';
  1223. }
  1224. // Personal Message settings.
  1225. function template_profile_pm_settings()
  1226. {
  1227. global $context, $settings, $scripturl, $modSettings, $txt;
  1228. echo '
  1229. <dt>
  1230. <label for="pm_prefs">', $txt['pm_display_mode'], ':</label>
  1231. </dt>
  1232. <dd>
  1233. <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'], '\');">
  1234. <option value="0"', $context['display_mode'] == 0 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_all'], '</option>
  1235. <option value="1"', $context['display_mode'] == 1 ? ' selected="select…

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