disableAutoComplete(); '; // If an error occurred while trying to save previously, give the user a clue! echo ' ', template_error_message(); // If the profile was update successfully, let the user know this. if (!empty($context['profile_updated'])) echo '
', $context['profile_updated'], '
'; } /** * Template for any HTML needed below the profile (closing off divs/tables, etc.) */ function template_profile_below() { } /** * Template for showing off the spiffy popup of the menu */ function template_profile_popup() { global $context, $scripturl; // Unlike almost every other template, this is designed to be included into the HTML directly via $().load() echo '
', $context['member']['avatar']['image'], '
', $context['user']['name'], ' ', $context['member']['group'], '
'; } /** * The "popup" showing the user's alerts */ function template_alerts_popup() { global $context, $txt, $scripturl; // Unlike almost every other template, this is designed to be included into the HTML directly via $().load() echo '
', $txt['mark_alerts_read'], ' ', $txt['alert_settings'], '
', $txt['all_alerts'], '
'; if (empty($context['unread_alerts'])) template_alerts_all_read(); else { foreach ($context['unread_alerts'] as $id_alert => $details) { echo ' <', !$details['show_links'] ? 'a href="' . $scripturl . '?action=profile;area=showalerts;alert=' . $id_alert . '" onclick="this.classList.add(\'alert_read\')"' : 'div', ' class="unread_notify">
', empty($details['sender']['avatar']['image']) ? '' : $details['sender']['avatar']['image'] . ' ', $details['icon'], '
', $details['text'], ' - ', $details['time'], '
'; } } echo '
'; } /** * A simple template to say "You don't have any unread alerts". */ function template_alerts_all_read() { global $txt; echo '
', $txt['alerts_no_unread'], '
'; } /** * This template displays a user's details without any option to edit them. */ function template_summary() { global $context, $settings, $scripturl, $modSettings, $txt; // Display the basic information about the user echo '
'; // Are there any custom profile fields for above the name? if (!empty($context['print_custom_fields']['above_member'])) { $fields = ''; foreach ($context['print_custom_fields']['above_member'] as $field) if (!empty($field['output_html'])) $fields .= '
  • ' . $field['output_html'] . '
  • '; if (!empty($fields)) echo '
      ', $fields, '
    '; } echo '

    '; if (!empty($context['print_custom_fields']['before_member'])) foreach ($context['print_custom_fields']['before_member'] as $field) if (!empty($field['output_html'])) echo ' ', $field['output_html'], ''; echo ' ', $context['member']['name']; if (!empty($context['print_custom_fields']['after_member'])) foreach ($context['print_custom_fields']['after_member'] as $field) if (!empty($field['output_html'])) echo ' ', $field['output_html'], ''; echo ' ', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '

    ', $context['member']['avatar']['image']; // Are there any custom profile fields for below the avatar? if (!empty($context['print_custom_fields']['below_avatar'])) { $fields = ''; foreach ($context['print_custom_fields']['below_avatar'] as $field) if (!empty($field['output_html'])) $fields .= '
  • ' . $field['output_html'] . '
  • '; if (!empty($fields)) echo '
      ', $fields, '
    '; } echo ' '; // Can they add this member as a buddy? if (!empty($context['can_have_buddy']) && !$context['user']['is_owner']) echo '
    ', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ''; echo '
    '; if (!$context['user']['is_owner'] && $context['can_send_pm']) echo ' ', $txt['profile_sendpm_short'], ''; echo ' ', $txt['showPosts'], ''; if ($context['user']['is_owner'] && !empty($modSettings['drafts_post_enabled'])) echo ' ', $txt['drafts_show'], ''; echo ' ', $txt['statPanel'], ''; // Are there any custom profile fields for bottom? if (!empty($context['print_custom_fields']['bottom_poster'])) { $fields = ''; foreach ($context['print_custom_fields']['bottom_poster'] as $field) if (!empty($field['output_html'])) $fields .= '
  • ' . $field['output_html'] . '
  • '; if (!empty($fields)) echo '
      ', $fields, '
    '; } echo '
    '; if ($context['user']['is_owner'] || $context['user']['is_admin']) echo '
    ', $txt['username'], ':
    ', $context['member']['username'], '
    '; if (!isset($context['disabled_fields']['posts'])) echo '
    ', $txt['profile_posts'], ':
    ', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')
    '; if ($context['member']['show_email']) echo '
    ', $txt['email'], ':
    ', $context['member']['email'], '
    '; if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title'])) echo '
    ', $txt['custom_title'], ':
    ', $context['member']['title'], '
    '; if (!empty($context['member']['blurb'])) echo '
    ', $txt['personal_text'], ':
    ', $context['member']['blurb'], '
    '; echo '
    ', $txt['age'], ':
    ', $context['member']['age'] . ($context['member']['today_is_birthday'] ? '   ' : ''), '
    '; echo '
    '; // Any custom fields for standard placement? if (!empty($context['print_custom_fields']['standard'])) { $fields = array(); foreach ($context['print_custom_fields']['standard'] as $field) if (!empty($field['output_html'])) $fields[] = $field; if (count($fields) > 0) { echo '
    '; foreach ($fields as $field) echo '
    ', $field['name'], ':
    ', $field['output_html'], '
    '; echo '
    '; } } echo '
    '; // Can they view/issue a warning? if ($context['can_view_warning'] && $context['member']['warning']) { echo '
    ', $txt['profile_warning_level'], ':
    ', $context['member']['warning'], '%'; // Can we provide information on what this means? if (!empty($context['warning_status'])) echo ' (', $context['warning_status'], ')'; echo '
    '; } // Is this member requiring activation and/or banned? if (!empty($context['activate_message']) || !empty($context['member']['bans'])) { // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves. if (!empty($context['activate_message'])) echo '
    ', $context['activate_message'], ' (', $context['activate_link_text'], ')
    '; // If the current member is banned, show a message and possibly a link to the ban. if (!empty($context['member']['bans'])) { echo '
    ', $txt['user_is_banned'], ' [' . $txt['view_ban'] . ']
    '; } } echo '
    ', $txt['date_registered'], ':
    ', $context['member']['registered'], '
    '; // If the person looking is allowed, they can check the members IP address and hostname. if ($context['can_see_ip']) { if (!empty($context['member']['ip'])) echo '
    ', $txt['ip'], ':
    ', $context['member']['ip'], '
    '; if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip'])) echo '
    ', $txt['hostname'], ':
    ', $context['member']['hostname'], '
    '; } echo '
    ', $txt['local_time'], ':
    ', $context['member']['local_time'], '
    '; if (!empty($modSettings['userLanguage']) && !empty($context['member']['language'])) echo '
    ', $txt['language'], ':
    ', $context['member']['language'], '
    '; if ($context['member']['show_last_login']) echo '
    ', $txt['lastLoggedIn'], ':
    ', $context['member']['last_login'], (!empty($context['member']['is_hidden']) ? ' (' . $txt['hidden'] . ')' : ''), '
    '; echo '
    '; // Are there any custom profile fields for above the signature? if (!empty($context['print_custom_fields']['above_signature'])) { $fields = ''; foreach ($context['print_custom_fields']['above_signature'] as $field) if (!empty($field['output_html'])) $fields .= '
  • ' . $field['output_html'] . '
  • '; if (!empty($fields)) echo '
      ', $fields, '
    '; } // Show the users signature. if ($context['signature_enabled'] && !empty($context['member']['signature'])) echo '
    ', $txt['signature'], ':
    ', $context['member']['signature'], '
    '; // Are there any custom profile fields for below the signature? if (!empty($context['print_custom_fields']['below_signature'])) { $fields = ''; foreach ($context['print_custom_fields']['below_signature'] as $field) if (!empty($field['output_html'])) $fields .= '
  • ' . $field['output_html'] . '
  • '; if (!empty($fields)) echo '
      ', $fields, '
    '; } echo '
    '; } /** * Template for showing all the posts of the user, in chronological order. */ function template_showPosts() { global $context, $scripturl, $txt; echo '

    ', (!isset($context['attachments']) && empty($context['is_topics']) ? $txt['showMessages'] : (!empty($context['is_topics']) ? $txt['showTopics'] : $txt['showAttachments'])), !$context['user']['is_owner'] ? ' - ' . $context['member']['name'] : '', '

    ', !empty($context['page_index']) ? '
    ' : ''; // Are we displaying posts or attachments? if (!isset($context['attachments'])) { // For every post to be displayed, give it its own div, and show the important details of the post. OK ? foreach ($context['posts'] as $post) { echo '
    ', $post['time'], '
    '; if (!$post['approved']) echo '
    ', $txt['post_awaiting_approval'], '
    '; // affiche les messages mais uniquement si on passe dessus (collapse) echo '
    ', $txt['khbb_collapse_recent_post'], '
    ', $post['body'], '
    '; // Post options template_quickbuttons($post['quickbuttons'], 'profile_showposts'); echo '
    '; } } else template_show_list('attachments'); // No posts? Just end with a informative message. if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts']))) echo '
    ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
    '; // Show more page numbers. if (!empty($context['page_index'])) echo '
    '; } /** * Template for showing all alerts */ function template_showAlerts() { global $context, $txt, $scripturl; // Do we have an update message? if (!empty($context['update_message'])) echo '
    ', $context['update_message'], '
    '; echo '

    ', $txt['alerts'], !$context['user']['is_owner'] ? ' - ' . $context['member']['name'] : '', '

    '; if (empty($context['alerts'])) echo '
    ', $txt['alerts_none'], '
    '; else { // Start the form if checkboxes are in use if ($context['showCheckboxes']) echo '
    '; echo '
    '; foreach ($context['alerts'] as $id => $alert) { echo '
    '; echo '
    ', $alert['text'], ' - ', $alert['time'], '
    '; // Alert options template_quickbuttons($alert['quickbuttons'], 'profile_alerts'); echo '
    '; } echo '
    '; if ($context['showCheckboxes']) echo ' ', $txt['check_all'], ': '; echo ' ', $txt['alert_purge'], '
    '; if ($context['showCheckboxes']) echo '
    '; } } /** * Template for showing all of a user's drafts */ function template_showDrafts() { global $context, $scripturl, $txt; echo '

    ', $txt['drafts'], !$context['user']['is_owner'] ? ' - ' . $context['member']['name'] : '', '

    ', !empty($context['page_index']) ? '
    ' : ''; // No drafts? Just show an informative message. if (empty($context['drafts'])) echo '
    ', $txt['draft_none'], '
    '; else { // For every draft to be displayed, give it its own div, and show the important details of the draft. OK foreach ($context['drafts'] as $draft) { echo '
    #', $draft['counter'], '
    ', $draft['board']['name'], ' / ', $draft['topic']['link'], '    '; if (!empty($draft['sticky'])) echo ' '; if (!empty($draft['locked'])) echo ' '; echo '
    ', $txt['draft_saved_on'], ': ', $draft['time'], '
    '; // Draft buttons template_quickbuttons($draft['quickbuttons'], 'profile_drafts'); echo '
    ', $draft['body'], '
    '; } } // Show page numbers. echo '
    '; } /** * Template for showing and managing the buddy list. */ function template_editBuddies() { global $context, $scripturl, $txt; if (!empty($context['saved_successful'])) echo '
    ', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '
    '; elseif (!empty($context['saved_failed'])) echo '
    ', $context['saved_failed'], '
    '; echo '

    ', $txt['editBuddies'], '

    '; // if ($context['can_moderate_forum']) echo ' '; if (!empty($context['custom_pf'])) foreach ($context['custom_pf'] as $column) echo ' '; echo ' '; // If they don't have any buddies don't list them! if (empty($context['buddies'])) echo ' '; // Now loop through each buddy showing info on each. else { foreach ($context['buddies'] as $buddy) { echo ' '; /* ';*/ if ($buddy['show_email']) echo ' '; // Show the custom profile fields for this user. if (!empty($context['custom_pf'])) foreach ($context['custom_pf'] as $key => $column) echo ' '; echo ' '; } } echo '
    ', $txt['name'], '', $txt['status'], '', $txt['email'], '', $column['label'], '', $txt['remove'], '
    ', $txt['no_buddies'], '
    ', $buddy['options'][$key], '
    '; // Add a new buddy? echo '

    ', $txt['buddy_add'], '

    '; if (!empty($context['token_check'])) echo ' '; echo '
    '; } /** * Template for showing the ignore list of the current user. */ function template_editIgnoreList() { global $context, $scripturl, $txt; if (!empty($context['saved_successful'])) echo '
    ', $context['user']['is_owner'] ? $txt['profile_updated_own'] : sprintf($txt['profile_updated_else'], $context['member']['name']), '
    '; elseif (!empty($context['saved_failed'])) echo '
    ', $context['saved_failed'], '
    '; echo '

    ', $txt['editIgnoreList'], '

    '; //'; if ($context['can_moderate_forum']) echo ' '; echo ' '; // If they don't have anyone on their ignore list, don't list it! if (empty($context['ignore_list'])) echo ' '; // Now loop through each buddy showing info on each. foreach ($context['ignore_list'] as $member) { echo ' '; /*';*/ if ($context['can_moderate_forum']) echo ' '; echo ' '; } echo '
    ', $txt['name'], '', $txt['status'], '', $txt['email'], '', $txt['ignore_remove'], '
    ', $txt['no_ignore'], '
    '; // Add to the ignore list? echo '

    ', $txt['ignore_add'], '

    '; if (!empty($context['token_check'])) echo ' '; echo '
    '; } /** * This template shows an admin information on a users IP addresses used and errors attributed to them. */ function template_trackActivity() { global $context, $scripturl, $txt; // The first table shows IP information about the user. echo '

    ', $txt['view_ips_by'], ' ', $context['member']['name'], '

    '; // The last IP the user used. echo '
    ', $txt['most_recent_ip'], ': ', (empty($context['last_ip2']) ? '' : '
    (' . $txt['why_two_ip_address'] . ')'), '
    ', $context['last_ip'], ''; // Second address detected? if (!empty($context['last_ip2'])) echo ' , ', $context['last_ip2'], ''; echo '
    '; // Lists of IP addresses used in messages / error messages. echo '
    ', $txt['ips_in_messages'], ':
    ', (count($context['ips']) > 0 ? implode(', ', $context['ips']) : '(' . $txt['none'] . ')'), '
    ', $txt['ips_in_errors'], ':
    ', (count($context['error_ips']) > 0 ? implode(', ', $context['error_ips']) : '(' . $txt['none'] . ')'), '
    '; // List any members that have used the same IP addresses as the current member. echo '
    ', $txt['members_in_range'], ':
    ', (count($context['members_in_range']) > 0 ? implode(', ', $context['members_in_range']) : '(' . $txt['none'] . ')'), '
    '; // Show the track user list. template_show_list('track_user_list'); } /** * The template for trackIP, allowing the admin to see where/who a certain IP has been used. */ function template_trackIP() { global $context, $txt; // This function always defaults to the last IP used by a member but can be set to track any IP. // The first table in the template gives an input box to allow the admin to enter another IP to track. echo '

    ', $txt['trackIP'], '


    '; // The table inbetween the first and second table shows links to the whois server for every region. if ($context['single_ip']) { echo '

    ', $txt['whois_title'], ' ', $context['ip'], '

    '; foreach ($context['whois_servers'] as $server) echo ' ', $server['name'], '
    '; echo '

    '; } // The second table lists all the members who have been logged as using this IP address. echo '

    ', $txt['members_from_ip'], ' ', $context['ip'], '

    '; if (empty($context['ips'])) echo '

    ', $txt['no_members_from_ip'], '

    '; else { echo ' '; // Loop through each of the members and display them. foreach ($context['ips'] as $ip => $memberlist) echo ' '; echo '
    ', $txt['ip_address'], ' ', $txt['display_name'], '
    ', $ip, ' ', implode(', ', $memberlist), '
    '; } echo '
    '; template_show_list('track_message_list'); echo '
    '; template_show_list('track_user_list'); // 3rd party integrations may have added additional tracking. if (!empty($context['additional_track_lists'])) { foreach ($context['additional_track_lists'] as $list) { echo '
    '; template_show_list($list); } } } /** * This template shows an admin which permissions a user have and which group(s) give them each permission. */ function template_showPermissions() { global $context, $scripturl, $txt; echo '

    ', $txt['showPermissions'], '

    '; if ($context['member']['has_all_permissions']) echo '
    ', $txt['showPermissions_all'], '
    '; else { echo '
    ', $txt['showPermissions_help'], '
    '; if (!empty($context['no_access_boards'])) { echo '

    ', $txt['showPermissions_restricted_boards'], '

    ', $txt['showPermissions_restricted_boards_desc'], ':
    '; foreach ($context['no_access_boards'] as $no_access_board) echo ' ', $no_access_board['name'], '', $no_access_board['is_last'] ? '' : ', '; echo '
    '; } // General Permissions section. echo '

    ', $txt['showPermissions_general'], '

    '; if (!empty($context['member']['permissions']['general'])) { echo ' '; foreach ($context['member']['permissions']['general'] as $permission) { echo ' '; } echo '
    ', $txt['showPermissions_permission'], ' ', $txt['showPermissions_status'], '
    ', $permission['is_denied'] ? '' . $permission['name'] . '' : $permission['name'], ' '; if ($permission['is_denied']) echo ' ', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), ''; else echo ' ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); echo '

    '; } else echo '

    ', $txt['showPermissions_none_general'], '

    '; // Board permission section. echo '

    ', $txt['showPermissions_select'], ':

    '; if (!empty($context['member']['permissions']['board'])) { echo ' '; foreach ($context['member']['permissions']['board'] as $permission) { echo ' '; } echo '
    ', $txt['showPermissions_permission'], ' ', $txt['showPermissions_status'], '
    ', $permission['is_denied'] ? '' . $permission['name'] . '' : $permission['name'], ' '; if ($permission['is_denied']) echo ' ', $txt['showPermissions_denied'], ': ', implode(', ', $permission['groups']['denied']), ''; else echo ' ', $txt['showPermissions_given'], ': ', implode(', ', $permission['groups']['allowed']); echo '
    '; } else echo '

    ', $txt['showPermissions_none_board'], '

    '; echo '
    '; } } /** * Template for user statistics, showing graphs and the like. */ function template_statPanel() { global $context, $txt; // First, show a few text statistics such as post/topic count. echo '
    '; foreach ($context['text_stats'] as $key => $stat) { echo '
    ', $txt['statPanel_' . $key], '
    '; if (!empty($stat['url'])) echo '
    ', $stat['text'], '
    '; else echo '
    ', $stat['text'], '
    '; } echo '
    '; // This next section draws a graph showing what times of day they post the most. echo '

    ', $txt['statPanel_activityTime'], '

    '; // If they haven't post at all, don't draw the graph. if (empty($context['posts_by_time'])) echo '

    ', $txt['statPanel_noPosts'], '

    '; // Otherwise do! else { echo ' '; } echo '
    '; // Two columns with the most popular boards by posts and activity (activity = users posts / total posts). echo '

    ', $txt['statPanel_topBoards'], '

    '; if (empty($context['popular_boards'])) echo '

    ', $txt['statPanel_noPosts'], '

    '; else { echo '
    '; // Draw a bar for every board. foreach ($context['popular_boards'] as $board) { echo '
    ', $board['link'], '
    ', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), '
    ', empty($context['hide_num_posts']) ? $board['posts'] : '', '
    '; } echo '
    '; } echo '

    ', $txt['statPanel_topBoardsActivity'], '

    '; if (empty($context['board_activity'])) echo '

    ', $txt['statPanel_noPosts'], '

    '; else { echo '
    '; // Draw a bar for every board. foreach ($context['board_activity'] as $activity) { echo '
    ', $activity['link'], '
    ', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), '
    ', $activity['percent'], '%
    '; } echo '
    '; } echo '
    '; echo '
    '; } /** * Template for editing profile options. */ function template_edit_options() { global $context, $scripturl, $txt, $modSettings; // The main header! // because some browsers ignore autocomplete=off and fill username in display name and/ or email field, fake them out. $url = !empty($context['profile_custom_submit_url']) ? $context['profile_custom_submit_url'] : $scripturl . '?action=profile;area=' . $context['menu_item_selected'] . ';u=' . $context['id_member']; $url = $context['require_password'] && !empty($modSettings['force_ssl']) ? strtr($url, array('http://' => 'https://')) : $url; echo '

    '; // Don't say "Profile" if this isn't the profile... if (!empty($context['profile_header_text'])) echo ' ', $context['profile_header_text']; else echo ' ', $txt['profile']; echo '

    '; // Have we some description? if ($context['page_desc']) echo '

    ', $context['page_desc'], '

    '; echo '
    '; // Any bits at the start? if (!empty($context['profile_prehtml'])) echo '
    ', $context['profile_prehtml'], '
    '; if (!empty($context['profile_fields'])) echo '
    '; // Start the big old loop 'of love. $lastItem = 'hr'; foreach ($context['profile_fields'] as $key => $field) { // We add a little hack to be sure we never get more than one hr in a row! if ($lastItem == 'hr' && $field['type'] == 'hr') continue; $lastItem = $field['type']; if ($field['type'] == 'hr') echo '

    '; elseif ($field['type'] == 'callback') { if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func'])) { $callback_func = 'template_profile_' . $field['callback_func']; $callback_func(); } } else { echo '
    ', $field['type'] !== 'label' ? '' : '', ''; // Does it have any subtext to show? if (!empty($field['subtext'])) echo '
    ', $field['subtext'], ''; echo '
    '; // Want to put something infront of the box? if (!empty($field['preinput'])) echo ' ', $field['preinput']; // What type of data are we showing? if ($field['type'] == 'label') echo ' ', $field['value']; // Maybe it's a text box - very likely! elseif (in_array($field['type'], array('int', 'float', 'text', 'password', 'color', 'date', 'datetime', 'datetime-local', 'email', 'month', 'number', 'time', 'url'))) { if ($field['type'] == 'int' || $field['type'] == 'float') $type = 'number'; else $type = $field['type']; $step = $field['type'] == 'float' ? ' step="0.1"' : ''; echo ' '; } // You "checking" me out? ;) elseif ($field['type'] == 'check') echo ' '; // Always fun - select boxes! elseif ($field['type'] == 'select') { echo ' '; } // Something to end with? if (!empty($field['postinput'])) echo ' ', $field['postinput']; echo '
    '; } } if (!empty($context['profile_fields'])) echo '
    '; // Are there any custom profile fields - if so print them! if (!empty($context['custom_fields'])) { if ($lastItem != 'hr') echo '
    '; echo '
    '; foreach ($context['custom_fields'] as $field) echo '
    ', $field['name'], '
    ', $field['desc'], '
    ', $field['input_html'], '
    '; echo '
    '; } // Any closing HTML? if (!empty($context['profile_posthtml'])) echo '
    ', $context['profile_posthtml'], '
    '; // Only show the password box if it's actually needed. if ($context['require_password']) echo '

    ', $txt['required_security_reasons'], '
    '; // The button shouldn't say "Change profile" unless we're changing the profile... if (!empty($context['submit_button_text'])) echo ' '; else echo ' '; if (!empty($context['token_check'])) echo ' '; echo '
    '; // Any final spellchecking stuff? if (!empty($context['show_spellchecking'])) echo '
    '; } /** * Personal Message settings. */ function template_profile_pm_settings() { global $context, $modSettings, $txt; echo '


    '; } /** * Template for showing theme settings. Note: template_options() actually adds the theme specific options. */ function template_profile_theme_settings() { global $context, $modSettings; $skeys = array_keys($context['theme_options']); $first_option_key = array_shift($skeys); $titled_section = false; foreach ($context['theme_options'] as $i => $setting) { // Just spit out separators and move on if (empty($setting) || !is_array($setting)) { // Avoid double separators and empty titled sections $empty_section = true; for ($j=$i+1; $j < count($context['theme_options']); $j++) { // Found another separator, so we're done if (!is_array($context['theme_options'][$j])) break; // Once we know there's something to show in this section, we can stop if (!isset($context['theme_options'][$j]['enabled']) || !empty($context['theme_options'][$j]['enabled'])) { $empty_section = false; break; } } if ($empty_section) { if ($i === $first_option_key) $first_option_key = array_shift($skeys); continue; } // Insert a separator (unless this is the first item in the list) if ($i !== $first_option_key) echo '

    '; // Should we give a name to this section? if (is_string($setting) && !empty($setting)) { $titled_section = true; echo '
    ' . $setting . '
    '; } else $titled_section = false; continue; } // Is this disabled? if (isset($setting['enabled']) && $setting['enabled'] === false) { if ($i === $first_option_key) $first_option_key = array_shift($skeys); continue; } // Some of these may not be set... Set to defaults here $opts = array('calendar_start_day', 'topics_per_page', 'messages_per_page', 'display_quick_mod'); if (in_array($setting['id'], $opts) && !isset($context['member']['options'][$setting['id']])) $context['member']['options'][$setting['id']] = 0; if (!isset($setting['type']) || $setting['type'] == 'bool') $setting['type'] = 'checkbox'; elseif ($setting['type'] == 'int' || $setting['type'] == 'integer') $setting['type'] = 'number'; elseif ($setting['type'] == 'string') $setting['type'] = 'text'; if (isset($setting['options'])) $setting['type'] = 'list'; echo '
    '; if (isset($setting['description'])) echo '
    ', $setting['description'], ''; echo '
    '; // Display checkbox options if ($setting['type'] == 'checkbox') echo ' '; // How about selection lists, we all love them elseif ($setting['type'] == 'list') { echo ' '; } // A textbox it is then else { if (isset($setting['type']) && $setting['type'] == 'number') { $min = isset($setting['min']) ? ' min="' . $setting['min'] . '"' : ' min="0"'; $max = isset($setting['max']) ? ' max="' . $setting['max'] . '"' : ''; $step = isset($setting['step']) ? ' step="' . $setting['step'] . '"' : ''; echo ' '; } // end of this defintion echo '
    '; } } /** * The template for configuring alerts */ function template_alert_configuration() { global $context, $txt, $scripturl, $modSettings; echo '

    ', $txt['alert_prefs'], '

    ', (empty($context['description']) ? $txt['alert_prefs_desc'] : $context['description']), '

    ', $txt['notification_general'], '

    ', $context['id_member'] == 0 ? '
    ' . $txt['notify_announcements_desc'] . '' : '', '
    '; if (!empty($modSettings['enable_ajax_alerts'])) echo '
    '; echo '

    ', $txt['notify_what_how'], '

    '; foreach ($context['alert_types'] as $alert_group => $alerts) { echo ' '; if (isset($context['alert_group_options'][$alert_group])) { foreach ($context['alert_group_options'][$alert_group] as $opts) { if ($opts[0] == 'hide') continue; echo ' '; } } foreach ($alerts as $alert_id => $alert_details) { echo ' '; foreach ($context['alert_bits'] as $type => $bitmask) { echo ' '; } echo ' '; } } echo '
    ', $txt['alert_group_' . $alert_group], ' ', $txt['receive_alert'], ' ', $txt['receive_mail'], '
    '; $label = $txt['alert_opt_' . $opts[1]]; $label_pos = isset($opts['label']) ? $opts['label'] : ''; if ($label_pos == 'before') echo ' '; $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0; switch ($opts[0]) { case 'check': echo ' '; break; case 'select': echo ' '; break; } if ($label_pos == 'after') echo ' '; echo '
    ', $txt['alert_' . $alert_id], isset($alert_details['help']) ? '' : '', ' '; $this_value = isset($context['alert_prefs'][$alert_id]) ? $context['alert_prefs'][$alert_id] : 0; switch ($alert_details[$type]) { case 'always': echo ' '; break; case 'yes': echo ' '; break; case 'never': echo ' '; break; } echo '

    ', !empty($context['token_check']) ? ' ' : '', '

    '; } /** * Template for showing which topics you're subscribed to */ function template_alert_notifications_topics() { global $txt; // The main containing header. echo '

    ', $txt['watched_topics'], '

    ', $txt['watched_topics_desc'], '


    '; template_show_list('topic_notification_list'); } /** * Template for showing which boards you're subscribed to */ function template_alert_notifications_boards() { global $txt; echo '

    ', $txt['watched_boards'], '

    ', $txt['watched_boards_desc'], '


    '; template_show_list('board_notification_list'); } /** * Template for choosing group membership. */ function template_groupMembership() { global $context, $scripturl, $txt; // The main containing header. echo '

    ', $txt['profile'], '

    ', $txt['groupMembership_info'], '

    '; // Do we have an update message? if (!empty($context['update_message'])) echo '
    ', $context['update_message'], '.
    '; echo '
    '; // Requesting membership to a group? if (!empty($context['group_request'])) { echo '

    ', $txt['request_group_membership'], '

    ', $txt['request_group_membership_desc'], ':
    '; } else { echo '

    ', $txt['current_membergroups'], '

    '; foreach ($context['groups']['member'] as $group) { echo '
    '; if ($context['can_edit_primary']) echo ' '; echo ' '; // Can they leave their group? if ($group['can_leave']) echo ' ' . $txt['leave_group'] . ''; echo '
    '; } if ($context['can_edit_primary']) echo '
    '; // Any groups they can join? if (!empty($context['groups']['available'])) { echo '

    ', $txt['available_groups'], '

    '; foreach ($context['groups']['available'] as $group) { echo '
    ', (empty($group['color']) ? $group['name'] : '' . $group['name'] . ''), '', (!empty($group['desc']) ? '
    ' . $group['desc'] . '' : ''), ''; if ($group['type'] == 3) echo ' ', $txt['join_group'], ''; elseif ($group['type'] == 2 && $group['pending']) echo ' ', $txt['approval_pending'], ''; elseif ($group['type'] == 2) echo ' ', $txt['request_group'], ''; echo '
    '; } } // Javascript for the selector stuff. echo ' '; } echo '
    '; if (!empty($context['token_check'])) echo ' '; echo '
    '; } /** * Template for managing ignored boards */ function template_ignoreboards() { global $context, $txt, $scripturl; // The main containing header. echo '

    ', $txt['profile'], '

    ', $txt['ignoreboards_info'], '

      '; foreach ($context['categories'] as $category) { echo '
    • ', $category['name'], '
        '; $cat_boards = array_values($category['boards']); foreach ($cat_boards as $key => $board) { echo '
      • '; // Nest child boards inside another list. $curr_child_level = $board['child_level']; $next_child_level = $cat_boards[$key + 1]['child_level'] ?? 0; if ($next_child_level > $curr_child_level) { echo '
          '; } else { // Close child board lists until we reach a common level // with the next board. while ($next_child_level < $curr_child_level--) { echo '
        '; } echo '
      • '; } } echo '
    • '; } echo '
    '; // Show the standard "Save Settings" profile button. template_profile_save(); echo '

    '; } /** * Simply loads some theme variables common to several warning templates. */ function template_load_warning_variables() { global $modSettings, $context; // Setup the warning mode $context['warning_mode'] = array( 0 => 'none', $modSettings['warning_watch'] => 'watched', $modSettings['warning_moderate'] => 'moderated', $modSettings['warning_mute'] => 'muted', ); // Work out the starting warning. $context['current_warning_mode'] = $context['warning_mode'][0]; foreach ($context['warning_mode'] as $limit => $warning) if ($context['member']['warning'] >= $limit) $context['current_warning_mode'] = $warning; } /** * Template for viewing a user's warnings */ function template_viewWarning() { global $context, $txt; template_load_warning_variables(); echo '

    ', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), '

    ', $txt['viewWarning_help'], '

    ', $txt['profile_warning_name'], ':
    ', $context['member']['name'], '
    ', $txt['profile_warning_level'], ':
    ', $context['member']['warning'], '%
    '; // There's some impact of this? if (!empty($context['level_effects'][$context['current_level']])) echo '
    ', $txt['profile_viewwarning_impact'], ':
    ', $context['level_effects'][$context['current_level']], '
    '; echo '
    '; template_show_list('view_warnings'); } /** * Template for issuing warnings */ function template_issueWarning() { global $context, $scripturl, $txt; template_load_warning_variables(); echo ' '; echo '

    ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], '

    '; if (!$context['user']['is_owner']) echo '

    ', $txt['profile_warning_desc'], '

    '; echo '
    '; if (!$context['user']['is_owner']) echo '
    ', $txt['profile_warning_name'], ':
    ', $context['member']['name'], '
    '; echo '
    ', $txt['profile_warning_level'], ':'; // Is there only so much they can apply? if ($context['warning_limit']) echo '
    ', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), ''; echo '
    0% 100%
    ', $txt['profile_warning_impact'], ': ', $context['member']['warning'], '% (', $context['level_effects'][$context['current_level']], ')
    '; if (!$context['user']['is_owner']) { echo '
    ', $txt['profile_warning_reason'], ':
    ', $txt['profile_warning_reason_desc'], '


    '; } echo '
    '; if (!empty($context['token_check'])) echo ' '; echo '
    '; // Previous warnings? template_show_list('view_warnings'); echo ' '; } /** * Template to show for deleting a user's account - now with added delete post capability! */ function template_deleteAccount() { global $context, $scripturl, $txt; // The main containing header. echo '

    ', $txt['deleteAccount'], '

    '; // If deleting another account give them a lovely info box. if (!$context['user']['is_owner']) echo '

    ', $txt['deleteAccount_desc'], '

    '; echo '
    '; // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;) if ($context['needs_approval']) echo '
    ', $txt['deleteAccount_approval'], '
    '; // If the user is deleting their own account warn them first - and require a password! if ($context['user']['is_owner']) { echo '
    ', $txt['own_profile_confirm'], '
    ', $txt['current_password'], ': '; if (!empty($context['token_check'])) echo ' '; echo '
    '; } // Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts! else { echo '
    ', $txt['deleteAccount_warning'], '
    '; // Only actually give these options if they are kind of important. if ($context['can_delete_posts']) { echo '

    '; if ($context['show_perma_delete']) echo '
    '; echo '
    '; } echo '
    '; if (!empty($context['token_check'])) echo ' '; echo '
    '; } echo '

    '; } /** * Template for the password box/save button stuck at the bottom of every profile page. */ function template_profile_save() { global $context, $txt; echo '
    '; // Only show the password box if it's actually needed. if ($context['require_password']) echo '
    ', $txt['current_password'], ':
    ', $txt['required_security_reasons'], '
    '; echo '
    '; if (!empty($context['token_check'])) echo ' '; echo '
    '; } /** * Small template for showing an error message upon a save problem in the profile. */ function template_error_message() { global $context, $modSettings, $txt; echo '
    '; if (!empty($context['post_errors'])) { echo ' ', !empty($context['custom_error_title']) ? $context['custom_error_title'] : $txt['profile_errors_occurred'], ': '; } echo '
    '; } /** * Display a load of drop down selectors for allowing the user to change group. */ function template_profile_group_manage() { global $context, $txt, $scripturl; echo '
    ', $txt['primary_membergroup'], '
    ', $txt['moderator_why_missing'], '
    ', $txt['additional_membergroups'], '
    '; // For each membergroup show a checkbox so members can be assigned to more than one group. foreach ($context['member_groups'] as $member_group) if ($member_group['can_be_additional']) echo '
    '; echo '
    '; } /** * Callback function for entering a birthdate! */ function template_profile_birthdate() { global $txt, $context; // Just show the pretty box! //echo 'no birthday'; } /** * Show the signature editing box? */ function template_profile_signature_modify() { global $txt, $context; echo '
    ', $txt['signature'], '
    ', $txt['sig_info'], '

    '; if ($context['show_spellchecking']) echo ' '; echo '

    '; // If there is a limit at all! if (!empty($context['signature_limits']['max_length'])) echo ' ', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' ', $context['signature_limits']['max_length'], '
    '; if (!empty($context['show_preview_button'])) echo ' '; if ($context['signature_warning']) echo ' ', $context['signature_warning'], ''; // Some javascript used to count how many characters have been used so far in the signature. echo '
    '; } /** * Template for selecting an avatar */ function template_profile_avatar_select() { global $context, $txt, $modSettings, $scripturl; // Start with the upper menu echo '
    '; if (empty($modSettings['gravatarEnabled']) || empty($modSettings['gravatarOverride'])) echo '
    '; if (!empty($context['member']['avatar']['allow_server_stored'])) echo '
    '; if (!empty($context['member']['avatar']['allow_external'])) echo '
    '; if (!empty($context['member']['avatar']['allow_upload'])) echo '
    '; if (!empty($context['member']['avatar']['allow_gravatar'])) echo ' '; echo '
    '; // If users are allowed to choose avatars stored on the server show selection boxes to choice them from. if (!empty($context['member']['avatar']['allow_server_stored'])) { echo '
    '; } // If the user can link to an off server avatar, show them a box to input the address. if (!empty($context['member']['avatar']['allow_external'])) echo '
    ', $context['member']['avatar']['choice'] == 'external' ? '
    ' : '', '
    ', $txt['avatar_by_url'], '
    ', !empty($modSettings['avatar_action_too_large']) && $modSettings['avatar_action_too_large'] == 'option_download_and_resize' ? template_max_size('external') : '', '
    '; // If the user is able to upload avatars to the server show them an upload box. if (!empty($context['member']['avatar']['allow_upload'])) echo '
    ', $context['member']['avatar']['choice'] == 'upload' ? '
    ' : '', ' ', template_max_size('upload'), ' ', (!empty($context['member']['avatar']['id_attach']) ? '
    ' : ''), '
    '; // if the user is able to use Gravatar avatars show then the image preview if (!empty($context['member']['avatar']['allow_gravatar'])) { echo '
    ', $context['member']['avatar']['choice'] == 'gravatar' ? '
    ' : ''; if (empty($modSettings['gravatarAllowExtraEmail'])) echo '
    ', $txt['gravatar_noAlternateEmail'], '
    '; else { // Depending on other stuff, the stored value here might have some odd things in it from other areas. if ($context['member']['avatar']['external'] == $context['member']['email']) $textbox_value = ''; else $textbox_value = $context['member']['avatar']['external']; echo '
    ', $txt['gravatar_alternateEmail'], '
    '; } echo '
    '; } echo '
    '; } /** * This is just a really little helper to avoid duplicating code unnecessarily * * @param string $type The type of avatar */ function template_max_size($type) { global $modSettings, $txt; $w = !empty($modSettings['avatar_max_width_' . $type]) ? comma_format($modSettings['avatar_max_width_' . $type]) : 0; $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0; $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : ''); if (empty($suffix)) return; echo '
    ', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '
    '; } /** * Select the time format! */ function template_profile_timeformat_modify() { global $context, $txt, $scripturl; echo '

    '; } /** * Template for picking a theme */ function template_profile_theme_pick() { global $txt, $context, $scripturl; echo '
    ', $txt['current_theme'], '
    ', $context['member']['theme']['name'], ' ', $txt['change'], '
    '; } /** * Smiley set picker. */ function template_profile_smiley_pick() { global $txt, $context, $modSettings, $settings; echo '
    :)
    '; } /** * Template for setting up and managing Two-Factor Authentication. */ function template_tfasetup() { global $txt, $context, $scripturl, $modSettings; echo '

    ', $txt['tfa_title'], '

    '; if (!empty($context['tfa_backup'])) echo '
    ', $txt['tfa_backup_used_desc'], '
    '; elseif ($modSettings['tfa_mode'] == 2) echo '
    ', $txt['tfa_forced_desc'], '
    '; echo '
    ', $txt['tfa_desc'], '
    ', $txt['tfa_step1'], '
    '; if (!empty($context['tfa_pass_error'])) echo '
    ', $txt['tfa_pass_invalid'], '
    '; echo '
    ', $txt['tfa_step2'], '
    ', $txt['tfa_step2_desc'], '
    ', $context['tfa_secret'], '
    ', $txt['tfa_step3'], '
    '; if (!empty($context['tfa_error'])) echo '
    ', $txt['tfa_code_invalid'], '
    '; echo '
    '; if (!empty($context['from_ajax'])) echo '
    '; echo '
    '; } /** * Template for disabling two-factor authentication. */ function template_tfadisable() { global $txt, $context, $scripturl; echo '

    ', $txt['tfadisable'], '

    '; if ($context['user']['is_owner']) echo '
    ', $txt['current_password'], '
    '; else echo '
    ', sprintf($txt['tfa_disable_for_user'], $context['user']['name']), '
    '; echo '
    '; } /** * Template for setting up 2FA backup code */ function template_tfasetup_backup() { global $context, $txt; echo '

    ', $txt['tfa_backup_title'], '

    ', $txt['tfa_backup_desc'], '
    ', $context['tfa_backup'], '
    '; } /** * Simple template for showing the 2FA area when editing a profile. */ function template_profile_tfa() { global $context, $txt, $scripturl, $modSettings; echo '
    ', $txt['tfa_profile_label'], '
    ', $txt['tfa_profile_desc'], '
    '; if (!$context['tfa_enabled'] && $context['user']['is_owner']) echo ' ', $txt['tfa_profile_enable'], ''; elseif (!$context['tfa_enabled']) echo ' ', $txt['tfa_profile_disabled']; else echo ' ', sprintf($txt['tfa_profile_enabled'], (!empty($modSettings['force_ssl']) ? strtr($scripturl, array('http://' => 'https://')) : $scripturl) . '?action=profile;u=' . $context['id_member'] . ';area=tfadisable'); echo '
    '; } /** * Template for initiating and retrieving profile data exports */ function template_export_profile_data() { global $context, $scripturl, $txt; $default_settings = array('included' => array(), 'format' => ''); $dltoken = ''; // The main containing header. echo '

    ', $txt['export_profile_data'], '

    ', $context['export_profile_data_desc'], '
    '; if (!empty($context['completed_exports'])) { echo '

    ', $txt['completed_exports'], '

    '; foreach ($context['completed_exports'] as $basehash_ext => $parts) { echo '
    '; if (!empty($context['outdated_exports'][$basehash_ext])) { echo '

    ', $txt['export_outdated_warning'], '

      '; foreach ($context['outdated_exports'][$basehash_ext] as $datatype) echo '
    • ', $txt[$datatype], '
    • '; echo '
    '; } echo '

    ', sprintf($txt['export_file_desc'], $parts[1]['included_desc'], $context['export_formats'][$parts[1]['format']]['description']), '

    '; if (count($parts) > 10) echo '
    ', sprintf($txt['export_file_count'], count($parts)), ''; echo '
      '; foreach ($parts as $part => $file) { $dltoken = $file['dltoken']; if (empty($default_settings['included'])) $default_settings['included'] = $file['included']; if (empty($default_settings['format'])) $default_settings['format'] = $file['format']; echo '
    • ', $file['dlbasename'], ' (', $file['size'], ', ', $file['mtime'], ')
    • '; } echo '
    '; if (count($parts) > 10) echo '
    '; echo '
    '; } echo '
    '; } if (!empty($context['active_exports'])) { echo '

    ', $txt['active_exports'], '

    '; foreach ($context['active_exports'] as $file) { $dltoken = $file['dltoken']; if (empty($default_settings['included'])) $default_settings['included'] = $file['included']; if (empty($default_settings['format'])) $default_settings['format'] = $file['format']; echo '
    1 ? ' class="descbox"' : '', '>

    ', sprintf($txt['export_file_desc'], $file['included_desc'], $context['export_formats'][$file['format']]['description']), '

    '; } echo '
    '; } echo '

    ', $txt['export_settings'], '

    '; foreach ($context['export_datatypes'] as $datatype => $datatype_settings) { if (!empty($datatype_settings['label'])) echo '
    '; } echo '
    ', $txt['export_format'], '
    '; // At least one active or completed export exists. if (!empty($dltoken)) { echo '
    '; } // No existing exports. else { echo ' '; } echo '
    '; } ?>