', $context['current_pm_subject'], '
', $txt['started_by'], ' ', $context['current_pm_author'], ', ', $context['current_pm_time'], '
';
}
else
{
echo '
';
}
// Show the conversation buttons.
template_button_strip($context['conversation_buttons'], 'right');
echo '
';
}
while ($message = $context['get_pmessage']('message'))
template_single_pm($message);
if (empty($context['display_mode']))
echo '
';
// Show a few buttons if we are in conversation mode and outputting the first message.
elseif ($context['display_mode'] == 2 && isset($context['conversation_buttons']))
{
echo '
';
template_button_strip($context['conversation_buttons'], 'right');
echo '
';
}
echo '
';
}
// Individual messages = buttom list!
if ($context['display_mode'] == 1)
{
template_subject_list();
echo '
';
}
echo '
';
}
/**
* Template for displaying a single personal message.
*
* @param array $message An array of information about the message to display.
*/
function template_single_pm($message)
{
global $context, $scripturl, $txt, $settings, $options, $modSettings;
echo '
';
// Are there any custom fields above the member name?
if (!empty($message['custom_fields']['above_member']))
{
echo '
';
foreach ($message['custom_fields']['above_member'] as $custom)
echo '
', $custom['value'], ' ';
echo '
';
}
echo '
';
// Show online and offline buttons?
if (!empty($modSettings['onlineEnable']) && !$message['member']['is_guest'])
echo '
';
// Custom fields BEFORE the username?
if (!empty($message['custom_fields']['before_member']))
foreach ($message['custom_fields']['before_member'] as $custom)
echo '
', $custom['value'], ' ';
// Show a link to the member's profile.
echo '
', $message['member']['link'];
// Custom fields AFTER the username?
if (!empty($message['custom_fields']['after_member']))
foreach ($message['custom_fields']['after_member'] as $custom)
echo '
', $custom['value'], ' ';
echo '
';
echo '
';
// Show the member's custom title, if they have one.
if (isset($message['member']['title']) && $message['member']['title'] != '')
echo '
', $message['member']['title'], ' ';
// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], ' ';
// Show the user's avatar.
if (!empty($modSettings['show_user_images']) && empty($options['show_no_avatars']) && !empty($message['member']['avatar']['image']))
echo '
', $message['member']['avatar']['image'], '
';
// Are there any custom fields below the avatar?
if (!empty($message['custom_fields']['below_avatar']))
foreach ($message['custom_fields']['below_avatar'] as $custom)
echo '
', $custom['value'], ' ';
// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group icons
echo '
', $message['member']['group_icons'], ' ';
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($modSettings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
', $message['member']['post_group'], ' ';
// Show how many posts they have made.
if (!isset($context['disabled_fields']['posts']))
echo '
', $txt['member_postcount'], ': ', $message['member']['posts'], ' ';
// Show their personal text?
if (!empty($modSettings['show_blurb']) && $message['member']['blurb'] != '')
echo '
', $message['member']['blurb'], ' ';
// Any custom fields to show as icons?
if (!empty($message['custom_fields']['icons']))
{
echo '
';
foreach ($message['custom_fields']['icons'] as $custom)
echo '
', $custom['value'], ' ';
echo '
';
}
// Show the IP to this user for this post - because you can moderate?
if (!empty($context['can_moderate_forum']) && !empty($message['member']['ip']))
echo '
', $message['member']['ip'], ' (?)
';
// Or, should we show it because this is you?
elseif ($message['can_see_ip'])
echo '
', $message['member']['ip'], '
';
// Okay, you are logged in, then we can show something about why IPs are logged...
else
echo '
', $txt['logged'], '
';
// Show the profile, website, email address, and personal message buttons.
if ($message['member']['show_profile_buttons'])
{
echo '
';
// Show the profile button
if ($message['member']['can_view_profile'])
echo '
', ($settings['use_image_buttons'] ? ' ' : $txt['view_profile']), ' ';
// Don't show an icon if they haven't specified a website.
if ($message['member']['website']['url'] != '' && !isset($context['disabled_fields']['website']))
echo '
', ($settings['use_image_buttons'] ? ' ' : $txt['www']), ' ';
// Don't show the email address if they want it hidden.
if ($message['member']['show_email'])
echo '
', ($settings['use_image_buttons'] ? ' ' : $txt['email']), ' ';
// Since we know this person isn't a guest, you *can* message them.
if ($context['can_send_pm'] && $message['member']['id'] != 0)
echo '
', $settings['use_image_buttons'] ? ' ' : ($message['member']['online']['is_online'] ? $txt['pm_online'] : $txt['pm_offline']), ' ';
echo '
';
}
// Any custom fields for standard placement?
if (!empty($message['custom_fields']['standard']))
foreach ($message['custom_fields']['standard'] as $custom)
echo '
', $custom['title'], ': ', $custom['value'], ' ';
// Are we showing the warning status?
if ($message['member']['can_see_warning'])
echo '
', $context['can_issue_warning'] ? '' : '', ' ', $context['can_issue_warning'] ? ' ' : '', '', $txt['warn_' . $message['member']['warning_status']], ' ';
// Are there any custom fields to show at the bottom of the poster info?
if (!empty($message['custom_fields']['bottom_poster']))
foreach ($message['custom_fields']['bottom_poster'] as $custom)
echo '
', $custom['value'], ' ';
}
// Done with the information about the poster... on to the post itself.
echo '
', $message['subject'], '
';
// Show who the message was sent to.
echo '
', $txt['sent_to'], ': ';
// People it was sent directly to....
if (!empty($message['recipients']['to']))
echo implode(', ', $message['recipients']['to']);
// Otherwise, we're just going to say "some people"...
elseif ($context['folder'] != 'sent')
echo '(', $txt['pm_undisclosed_recipients'], ')';
echo '
', $txt['on'], ': ', $message['time'], '
';
// If we're in the sent items, show who it was sent to besides the "To:" people.
if (!empty($message['recipients']['bcc']))
echo '
', $txt['pm_bcc'], ': ', implode(', ', $message['recipients']['bcc']), ' ';
if (!empty($message['is_replied_to']))
echo '
', $context['folder'] == 'sent' ? $txt['pm_sent_is_replied_to'] : $txt['pm_is_replied_to'], ' ';
echo '
';
// Add an extra line at the bottom if we have labels enabled.
if ($context['folder'] != 'sent' && !empty($context['currently_using_labels']) && $context['display_mode'] != 2)
{
echo '
';
// Add the label drop down box.
if (!empty($context['currently_using_labels']))
{
echo '
', $txt['pm_msg_label_title'], ':
--------------- ';
// Are there any labels which can be added to this?
if (!$message['fully_labeled'])
{
echo '
', $txt['pm_msg_label_apply'], ': ';
foreach ($context['labels'] as $label)
if (!isset($message['labels'][$label['id']]))
echo '
', $label['name'], ' ';
}
// ... and are there any that can be removed?
if (!empty($message['labels']) && (count($message['labels']) > 1 || !isset($message['labels'][-1])))
{
echo '
', $txt['pm_msg_label_remove'], ': ';
foreach ($message['labels'] as $label)
echo '
', $label['name'], ' ';
}
echo '
';
}
echo '
';
}
// Message options
template_quickbuttons($message['quickbuttons'], 'pm');
echo '
';
// Are there any custom profile fields for above the signature?
if (!empty($message['custom_fields']['above_signature']))
{
echo '
';
foreach ($message['custom_fields']['above_signature'] as $custom)
echo '
', $custom['value'], ' ';
echo '
';
}
// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
echo '
', $message['member']['signature'], '
';
// Are there any custom profile fields for below the signature?
if (!empty($message['custom_fields']['below_signature']))
{
echo '
';
foreach ($message['custom_fields']['below_signature'] as $custom)
echo '
', $custom['value'], ' ';
echo '
';
}
echo '
';
}
/**
* Just list all the personal message subjects - to make templates easier.
*/
function template_subject_list()
{
global $context, $settings, $txt, $scripturl;
echo '
', $context['folder'] == 'sent' ? $txt['sent_items'] : $context['current_label'], '
', $txt['date'], $context['sort_by'] == 'date' ? ' ' : '', '
', $txt['subject'], $context['sort_by'] == 'subject' ? ' ' : '', '
', ($context['from_or_to'] == 'from' ? $txt['from'] : $txt['pm_to']), $context['sort_by'] == 'name' ? ' ' : '', '
';
if (!$context['show_delete'])
echo '
', $txt['pm_alert_none'], '
';
while ($message = $context['get_pmessage']('subject'))
{
// Used for giving extra info in conversation view
if ($context['current_pm'] == $message['id'])
{
$context['current_pm_subject'] = $message['subject'];
$context['current_pm_time'] = $message['time'];
$context['current_pm_author'] = $message['member']['link'];
}
echo '
', $message['is_replied_to'] ? ' ' : ' ', '
', $message['time'], '
', ($context['display_mode'] != 0 && $context['current_pm'] == $message['id'] ? ' ' : ''), '', $message['subject'], $message['is_unread'] ? ' ' . $txt['new'] . ' ' : '', '
', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), ' ', $message['time'], '
', ($context['from_or_to'] == 'from' ? $message['member']['link'] : (empty($message['recipients']['to']) ? '' : implode(', ', $message['recipients']['to']))), '
';
}
echo '
', $context['page_index'], '
';
if ($context['show_delete'])
{
if (!empty($context['currently_using_labels']) && $context['folder'] != 'sent')
{
echo '
', $txt['pm_sel_label_title'], ':
---------------
', $txt['pm_msg_label_apply'], ': ';
foreach ($context['labels'] as $label)
{
if ($label['id'] != $context['current_label_id'])
echo '
', $label['name'], ' ';
}
echo '
', $txt['pm_msg_label_remove'], ': ';
foreach ($context['labels'] as $label)
echo '
', $label['name'], ' ';
echo '
';
}
echo '
';
}
echo '
';
}
/**
* The form for the PM search feature
*/
function template_search()
{
global $context, $scripturl, $txt;
if (!empty($context['search_errors']))
echo '
', implode(' ', $context['search_errors']['messages']), '
';
echo '
';
}
/**
* Displays results from a PM search
*/
function template_search_results()
{
global $context, $txt;
echo '
', $txt['pm_search_results'], '
', sprintf($txt['pm_search_results_info'], $context['num_results'], sentence_list($context['search_in'])), '
', $context['page_index'], '
';
// Complete results?
if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
echo '
', $txt['date'], '
', $txt['subject'], '
', $txt['from'], '
';
// Print each message out...
foreach ($context['personal_messages'] as $message)
{
// Are we showing it all?
if (!empty($context['search_params']['show_complete']))
template_single_pm($message);
// Otherwise just a simple list!
// @todo No context at all of the search?
else
echo '
', $message['time'], '
', $message['link'], '
', $message['member']['link'], '
';
}
// Finish off the page...
if (empty($context['search_params']['show_complete']) && !empty($context['personal_messages']))
echo '
';
// No results?
if (empty($context['personal_messages']))
echo '
', $txt['pm_search_none_found'], '
';
echo '
', $context['page_index'], '
';
}
/**
* The form for sending a new PM
*/
function template_send()
{
global $context, $options, $scripturl, $modSettings, $txt;
// Show which messages were sent successfully and which failed.
if (!empty($context['send_log']))
{
echo '
', $txt['pm_send_report'], '
';
if (!empty($context['send_log']['sent']))
foreach ($context['send_log']['sent'] as $log_entry)
echo '
', $log_entry, ' ';
if (!empty($context['send_log']['failed']))
foreach ($context['send_log']['failed'] as $log_entry)
echo '
', $log_entry, ' ';
echo '
';
}
// Show the preview of the personal message.
echo '
', empty($context['preview_subject']) ? '' : $context['preview_subject'], '
', empty($context['preview_message']) ? ' ' : $context['preview_message'], '
';
// Main message editing box.
echo '
';
echo '
';
// Show the message you're replying to.
if ($context['reply'])
echo '
', $txt['subject'], ': ', $context['quoted_message']['subject'], '
', $txt['on'], ': ', $context['quoted_message']['time'], '
', $txt['from'], ': ', $context['quoted_message']['member']['name'], '
', $context['quoted_message']['body'], '
';
echo '
';
}
/**
* This template asks the user whether they wish to empty out their folder/messages.
*/
function template_ask_delete()
{
global $context, $scripturl, $txt;
echo '
', ($context['delete_all'] ? $txt['delete_message'] : $txt['delete_all']), '
';
}
/**
* This template asks the user what messages they want to prune.
*/
function template_prune()
{
global $context, $scripturl, $txt;
echo '
', $txt['pm_prune'], '
';
}
/**
* Here we allow the user to setup labels, remove labels and change rules for labels (i.e, do quite a bit)
*/
function template_labels()
{
global $context, $scripturl, $txt;
echo '
';
}
/**
* Template for reporting a personal message.
*/
function template_report_message()
{
global $context, $txt, $scripturl;
echo '
';
}
/**
* Little template just to say "Yep, it's been submitted"
*/
function template_report_message_complete()
{
global $context, $txt, $scripturl;
echo '
', $txt['pm_report_title'], '
';
}
/**
* Manage rules.
*/
function template_rules()
{
global $context, $txt, $scripturl;
echo '
', $txt['pm_manage_rules'], '
', $txt['pm_manage_rules_desc'], '
', $txt['pm_add_rule'], ' ';
if (!empty($context['rules']))
echo '
[
', $txt['pm_apply_rules'], ' ]';
if (!empty($context['rules']))
echo '
';
echo '
';
}
/**
* Template for adding/editing a rule.
*/
function template_add_rule()
{
global $context, $txt, $scripturl;
echo '
';
echo '
', $context['rid'] == 0 ? $txt['pm_add_rule'] : $txt['pm_edit_rule'], '
', $txt['pm_rule_name'], ':
', $txt['pm_rule_name_desc'], '
', $txt['pm_rule_criteria'], ' ';
// Add a dummy criteria to allow expansion for none js users.
$context['rule']['criteria'][] = array('t' => '', 'v' => '');
// For each criteria print it out.
$isFirst = true;
foreach ($context['rule']['criteria'] as $k => $criteria)
{
if (!$isFirst && $criteria['t'] == '')
echo '';
elseif (!$isFirst)
echo ' ';
echo '
', $txt['pm_rule_criteria_pick'], ': ';
foreach (array('mid', 'gid', 'sub', 'msg', 'bud') as $cr)
echo '
', $txt['pm_rule_' . $cr], ' ';
echo '
', $txt['pm_rule_sel_group'], ' ';
foreach ($context['groups'] as $id => $group)
echo '
', $group, ' ';
echo '
';
// If this is the dummy we add a means to hide for non js users.
if ($isFirst)
$isFirst = false;
elseif ($criteria['t'] == '')
echo '
';
}
echo '
(', $txt['pm_rule_criteria_add'], ')
', $txt['pm_rule_logic'], ':
', $txt['pm_rule_logic_and'], '
', $txt['pm_rule_logic_or'], '
', $txt['pm_rule_actions'], ' ';
// As with criteria - add a dummy action for "expansion".
$context['rule']['actions'][] = array('t' => '', 'v' => '');
// Print each action.
$isFirst = true;
foreach ($context['rule']['actions'] as $k => $action)
{
if (!$isFirst && $action['t'] == '')
echo '';
elseif (!$isFirst)
echo ' ';
echo '
', $txt['pm_rule_sel_action'], ':
', $txt['pm_rule_label'], '
', $txt['pm_rule_delete'], '
', $txt['pm_rule_sel_label'], ' ';
foreach ($context['labels'] as $label)
if ($label['id'] != -1)
echo '
', $label['name'], ' ';
echo '
';
if ($isFirst)
$isFirst = false;
elseif ($action['t'] == '')
echo '
';
}
echo '
(', $txt['pm_rule_add_action'], ')
', $txt['pm_rule_description'], '
';
// Now setup all the bits!
echo '
';
}
/**
* Template for showing all of a user's PM drafts.
*/
function template_showPMDrafts()
{
global $context, $scripturl, $txt;
echo '
', $txt['drafts_show'], '
', $txt['drafts_show_desc'], '
';
// No drafts? Just show an informative message.
if (empty($context['drafts']))
echo '
', $txt['draft_none'], '
';
else
{
echo '
', $context['page_index'], '
';
// For every draft to be displayed, give it its own div, and show the important details of the draft.
foreach ($context['drafts'] as $draft)
{
echo '
#', $draft['counter'], '
', $draft['subject'], '
', $txt['pm_to'], ': ', implode(', ', $draft['recipients']['to']), '
';
if(!empty($draft['recipients']['bcc']))
echo'
', $txt['pm_bcc'], ': ', implode(', ', $draft['recipients']['bcc']), '
';
echo '
', $txt['draft_saved_on'], ': ', sprintf($txt['draft_days_ago'], $draft['age']), (!empty($draft['remaining']) ? ', ' . sprintf($txt['draft_retain'], $draft['remaining']) : ''), '
', $draft['body'], '
';
// Draft buttons
template_quickbuttons($draft['quickbuttons'], 'pm_drafts');
echo '
';
}
// Show page numbers.
echo '
', $context['page_index'], '
';
}
}
?>