phpBB

Code Changes

File: includes/ucp/ucp_pm_compose.php

  Unmodified   Added   Modified   Removed
Line 20Line 20
* Compose private message
* Called from ucp_pm with mode == 'compose'
*/

* Compose private message
* Called from ucp_pm with mode == 'compose'
*/

function compose_pm($id, $mode, $action)

function compose_pm($id, $mode, $action, $user_folders = array())

{
global $template, $db, $auth, $user;
global $phpbb_root_path, $phpEx, $config;

{
global $template, $db, $auth, $user;
global $phpbb_root_path, $phpEx, $config;

 

// Damn php and globals - i know, this is horrible
// Needed for handle_message_list_actions()
global $refresh, $submit, $preview;


include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);


include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

Line 41Line 45
	$msg_id			= request_var('p', 0);
$draft_id = request_var('d', 0);
$lastclick = request_var('lastclick', 0);

	$msg_id			= request_var('p', 0);
$draft_id = request_var('d', 0);
$lastclick = request_var('lastclick', 0);

 

// Reply to all triggered (quote/reply)
$reply_to_all = request_var('reply_to_all', 0);


// Do NOT use request_var or specialchars here
$address_list = isset($_REQUEST['address_list']) ? $_REQUEST['address_list'] : array();


// Do NOT use request_var or specialchars here
$address_list = isset($_REQUEST['address_list']) ? $_REQUEST['address_list'] : array();

 

if (!is_array($address_list))
{
$address_list = array();
}


$submit = (isset($_POST['post'])) ? true : false;
$preview = (isset($_POST['preview'])) ? true : false;


$submit = (isset($_POST['post'])) ? true : false;
$preview = (isset($_POST['preview'])) ? true : false;

Line 75Line 87
		}
redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'));
}

		}
redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'));
}

 

// Since viewtopic.php language entries are used in several modes,
// we include the language file here
$user->add_lang('viewtopic');


// Output PM_TO box if message composing
if ($action != 'edit')
{


// Output PM_TO box if message composing
if ($action != 'edit')
{

		if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm'))


		// Add groups to PM box
if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group'))

		{
$sql = 'SELECT g.group_id, g.group_name, g.group_type
FROM ' . GROUPS_TABLE . ' g';

		{
$sql = 'SELECT g.group_id, g.group_name, g.group_type
FROM ' . GROUPS_TABLE . ' g';

Line 112Line 129
		$template->assign_vars(array(
'S_SHOW_PM_BOX' => true,
'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false,

		$template->assign_vars(array(
'S_SHOW_PM_BOX' => true,
'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false,

			'S_GROUP_OPTIONS'	=> ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? $group_options : '',

			'S_GROUP_OPTIONS'	=> ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) ? $group_options : '',

			'U_FIND_USERNAME'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=$select_single"),
));
}

$sql = '';

			'U_FIND_USERNAME'	=> append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=$select_single"),
));
}

$sql = '';

 
	$folder_id = 0;


// What is all this following SQL for? Well, we need to know
// some basic information in all cases before we do anything.


// What is all this following SQL for? Well, we need to know
// some basic information in all cases before we do anything.

Line 248Line 266
			if (($post['forum_id'] && !$auth->acl_get('f_read', $post['forum_id'])) || (!$post['forum_id'] && !$auth->acl_getf_global('f_read')))
{
trigger_error('NOT_AUTHORISED');

			if (($post['forum_id'] && !$auth->acl_get('f_read', $post['forum_id'])) || (!$post['forum_id'] && !$auth->acl_getf_global('f_read')))
{
trigger_error('NOT_AUTHORISED');

 
			}

// Passworded forum?
if ($post['forum_id'])
{
$sql = 'SELECT forum_id, forum_name, forum_password
FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . (int) $post['forum_id'];
$result = $db->sql_query($sql);
$forum_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);

if (!empty($forum_data['forum_password']))
{
login_forum_box($forum_data);
}

			}
}


			}
}


Line 280Line 314
			$icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0;

if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview)

			$icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0;

if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !sizeof($address_list) && !$refresh && !$submit && !$preview)

 
			{
// Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all"
if ($action == 'quotepost' || !$reply_to_all)

			{
$address_list = array('u' => array($post['author_id'] => 'to'));

			{
$address_list = array('u' => array($post['author_id'] => 'to'));

 
				}
else
{
// We try to include every previously listed member from the TO Header - Reply to all
$address_list = rebuild_header(array('to' => $post['to_address']));

// Add the author (if he is already listed then this is no shame (it will be overwritten))
$address_list['u'][$post['author_id']] = 'to';

// Now, make sure the user itself is not listed. ;)
if (isset($address_list['u'][$user->data['user_id']]))
{
unset($address_list['u'][$user->data['user_id']]);
}
}

			}
else if ($action == 'edit' && !sizeof($address_list) && !$refresh && !$submit && !$preview)
{

			}
else if ($action == 'edit' && !sizeof($address_list) && !$refresh && !$submit && !$preview)
{

Line 304Line 356
		$message_attachment = 0;
$message_text = $message_subject = '';


		$message_attachment = 0;
$message_text = $message_subject = '';


		if ($to_user_id && $action == 'post')

		if ($to_user_id && $to_user_id != ANONYMOUS && $action == 'post')

		{
$address_list['u'][$to_user_id] = 'to';
}

		{
$address_list['u'][$to_user_id] = 'to';
}

Line 315Line 367
		$check_value = 0;
}


		$check_value = 0;
}


	if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')))

	if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')))

	{
trigger_error('NO_AUTH_GROUP_MESSAGE');
}

	{
trigger_error('NO_AUTH_GROUP_MESSAGE');
}

Line 344Line 396
	unset($message_text);

$s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=$mode&action=$action", true, $user->session_id);

	unset($message_text);

$s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=$mode&action=$action", true, $user->session_id);

	$s_action .= ($msg_id) ? "&p=$msg_id" : '';

	$s_action .= (($folder_id) ? "&f=$folder_id" : '') . (($msg_id) ? "&p=$msg_id" : '');


// Delete triggered ?
if ($action == 'delete')


// Delete triggered ?
if ($action == 'delete')

Line 378Line 430
		}

redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id));

		}

redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id));

 
	}

// Get maximum number of allowed recipients
$sql = 'SELECT MAX(g.group_max_recipients) as max_recipients
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
WHERE ug.user_id = ' . $user->data['user_id'] . '
AND ug.user_pending = 0
AND ug.group_id = g.group_id';
$result = $db->sql_query($sql);
$max_recipients = (int) $db->sql_fetchfield('max_recipients');
$db->sql_freeresult($result);

$max_recipients = (!$max_recipients) ? $config['pm_max_recipients'] : $max_recipients;

// If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients
if (($action == 'reply' || $action == 'quote') && $max_recipients && $reply_to_all)
{
// We try to include every previously listed member from the TO Header
$list = rebuild_header(array('to' => $post['to_address']));

// Can be an empty array too ;)
$list = (!empty($list['u'])) ? $list['u'] : array();
$list[$post['author_id']] = 'to';

if (isset($list[$user->data['user_id']]))
{
unset($list[$user->data['user_id']]);
}

$max_recipients = ($max_recipients < sizeof($list)) ? sizeof($list) : $max_recipients;

unset($list);

	}

// Handle User/Group adding/removing
handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc);


	}

// Handle User/Group adding/removing
handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc);


	// Check for too many recipients








	// Check mass pm to group permission
if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')) && !empty($address_list['g']))
{
$address_list = array();
$error[] = $user->lang['NO_AUTH_GROUP_MESSAGE'];
}

// Check mass pm to users permission

	if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1)
{

	if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1)
{

		$address_list = get_recipient_pos($address_list, 1);
$error[] = $user->lang['TOO_MANY_RECIPIENTS'];








		$address_list = get_recipients($address_list, 1);
$error[] = $user->lang('TOO_MANY_RECIPIENTS', 1);
}

// Check for too many recipients
if (!empty($address_list['u']) && $max_recipients && sizeof($address_list['u']) > $max_recipients)
{
$address_list = get_recipients($address_list, $max_recipients);
$error[] = $user->lang('TOO_MANY_RECIPIENTS', $max_recipients);

	}

// Always check if the submitted attachment data is valid and belongs to the user.

	}

// Always check if the submitted attachment data is valid and belongs to the user.

Line 539Line 637
	// Load Drafts
if ($load && $drafts)
{

	// Load Drafts
if ($load && $drafts)
{

		load_drafts(0, 0, $id);

		load_drafts(0, 0, $id, $action, $msg_id);

	}

if ($submit || $preview || $refresh)

	}

if ($submit || $preview || $refresh)

Line 641Line 739
			$msg_id = submit_pm($action, $subject, $pm_data);

$return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=view&amp;p=' . $msg_id);

			$msg_id = submit_pm($action, $subject, $pm_data);

$return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=view&amp;p=' . $msg_id);

			$return_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=outbox');
meta_refresh(3, $return_message_url);

			$inbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox');
$outbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=outbox');





			$message = $user->lang['MESSAGE_STORED'] . '<br /><br />' . sprintf($user->lang['VIEW_PRIVATE_MESSAGE'], '<a href="' . $return_message_url . '">', '</a>') . '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $return_folder_url . '">', '</a>', $user->lang['PM_OUTBOX']);






















			$folder_url = '';
if (($folder_id > 0) && isset($user_folders[$folder_id]))
{
$folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=' . $folder_id);
}

$return_box_url = ($action === 'post' || $action === 'edit') ? $outbox_folder_url : $inbox_folder_url;
$return_box_lang = ($action === 'post' || $action === 'edit') ? 'PM_OUTBOX' : 'PM_INBOX';


$save_message = ($action === 'edit') ? $user->lang['MESSAGE_EDITED'] : $user->lang['MESSAGE_STORED'];
$message = $save_message . '<br /><br />' . $user->lang('VIEW_PRIVATE_MESSAGE', '<a href="' . $return_message_url . '">', '</a>');

$last_click_type = 'CLICK_RETURN_FOLDER';
if ($folder_url)
{
$message .= '<br /><br />' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '<a href="' . $folder_url . '">', '</a>', $user_folders[$folder_id]['folder_name']);
$last_click_type = 'CLICK_GOTO_FOLDER';
}
$message .= '<br /><br />' . sprintf($user->lang[$last_click_type], '<a href="' . $return_box_url . '">', '</a>', $user->lang[$return_box_lang]);

meta_refresh(3, $return_message_url);

			trigger_error($message);
}


			trigger_error($message);
}


Line 654Line 773
	// Preview
if (!sizeof($error) && $preview)
{

	// Preview
if (!sizeof($error) && $preview)
{

		$user->add_lang('viewtopic');

 
		$preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);

$preview_signature = $user->data['user_sig'];

		$preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false);

$preview_signature = $user->data['user_sig'];

Line 668Line 786
			$parse_sig->bbcode_uid = $preview_signature_uid;
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;


			$parse_sig->bbcode_uid = $preview_signature_uid;
$parse_sig->bbcode_bitfield = $preview_signature_bitfield;


			$parse_sig->format_display($enable_bbcode, $enable_urls, $enable_smilies);

			$parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']);

			$preview_signature = $parse_sig->message;
unset($parse_sig);
}

			$preview_signature = $parse_sig->message;
unset($parse_sig);
}

Line 712Line 830
	}

// Decode text for message display

	}

// Decode text for message display

	$bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && !sizeof($error)) ? $bbcode_uid : $message_parser->bbcode_uid;

	$bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && (!sizeof($error) || (sizeof($error) && !$submit))) ? $bbcode_uid : $message_parser->bbcode_uid;


$message_parser->decode_message($bbcode_uid);



$message_parser->decode_message($bbcode_uid);


Line 758Line 876
		$forward_text = array();
$forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE'];
$forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject));

		$forward_text = array();
$forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE'];
$forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject));

		$forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time));

		$forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time, false, true));

		$forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text);
$forward_text[] = sprintf($user->lang['FWD_TO'], implode(', ', $fwd_to_field['to']));


		$forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text);
$forward_text[] = sprintf($user->lang['FWD_TO'], implode(', ', $fwd_to_field['to']));


		$message_parser->message = implode("\n", $forward_text) . "\n\n[quote=\"{$quote_username}\"]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]";

		$message_parser->message = implode("\n", $forward_text) . "\n\n[quote=&quot;{$quote_username}&quot;]\n" . censor_text(trim($message_parser->message)) . "\n[/quote]";

		$message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject);
}


		$message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject);
}


Line 932Line 1050
	$s_hidden_fields .= (isset($check_value)) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : '';
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . ((isset($_REQUEST['draft_loaded'])) ? intval($_REQUEST['draft_loaded']) : $draft_id) . '" />' : '';


	$s_hidden_fields .= (isset($check_value)) ? '<input type="hidden" name="status_switch" value="' . $check_value . '" />' : '';
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '<input type="hidden" name="draft_loaded" value="' . ((isset($_REQUEST['draft_loaded'])) ? intval($_REQUEST['draft_loaded']) : $draft_id) . '" />' : '';


	$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || @ini_get('file_uploads') == '0' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"';

	$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"';


// Start assigning vars for main posting page ...
$template->assign_vars(array(


// Start assigning vars for main posting page ...
$template->assign_vars(array(

Line 947Line 1065
		'FLASH_STATUS'			=> ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],

		'FLASH_STATUS'			=> ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],

 
		'MAX_FONT_SIZE'			=> (int) $config['max_post_font_size'],

		'MINI_POST_IMG'			=> $user->img('icon_post_target', $user->lang['PM']),
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',

		'MINI_POST_IMG'			=> $user->img('icon_post_target', $user->lang['PM']),
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',

 
		'MAX_RECIPIENTS'		=> ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0,


'S_COMPOSE_PM' => true,
'S_EDIT_POST' => ($action == 'edit'),
'S_SHOW_PM_ICONS' => $s_pm_icons,


'S_COMPOSE_PM' => true,
'S_EDIT_POST' => ($action == 'edit'),
'S_SHOW_PM_ICONS' => $s_pm_icons,

		'S_BBCODE_ALLOWED'		=> $bbcode_status,

		'S_BBCODE_ALLOWED'		=> ($bbcode_status) ? 1 : 0,

		'S_BBCODE_CHECKED'		=> ($bbcode_checked) ? ' checked="checked"' : '',
'S_SMILIES_ALLOWED' => $smilies_status,
'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '',

		'S_BBCODE_CHECKED'		=> ($bbcode_checked) ? ' checked="checked"' : '',
'S_SMILIES_ALLOWED' => $smilies_status,
'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '',

Line 981Line 1101

// Build custom bbcodes array
display_custom_bbcodes();


// Build custom bbcodes array
display_custom_bbcodes();

 

// Show attachment box for adding attachments if true
$allowed = ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype);


// Attachment entry


// Attachment entry

	if ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype)
{
posting_gen_attachment_entry($attachment_data, $filename_data);
}

	posting_gen_attachment_entry($attachment_data, $filename_data, $allowed);





// Message History
if ($action == 'reply' || $action == 'quote' || $action == 'forward')


// Message History
if ($action == 'reply' || $action == 'quote' || $action == 'forward')

Line 1024Line 1144
		if (isset($remove_group_id[0]))
{
unset($address_list['g'][(int) $remove_group_id[0]]);

		if (isset($remove_group_id[0]))
{
unset($address_list['g'][(int) $remove_group_id[0]]);

 
		}
}

// Add Selected Groups
$group_list = request_var('group_list', array(0));

// Build usernames to add
$usernames = request_var('username', '', true);
$usernames = (empty($usernames)) ? array() : array($usernames);

$username_list = request_var('username_list', '', true);
if ($username_list)
{
$usernames = array_merge($usernames, explode("\n", $username_list));
}

// If add to or add bcc not pressed, users could still have usernames listed they want to add...
if (!$add_to && !$add_bcc && (sizeof($group_list) || sizeof($usernames)))
{
$add_to = true;

global $refresh, $submit, $preview;

$refresh = true;
$submit = false;

// Preview is only true if there was also a message entered
if (request_var('message', ''))
{
$preview = true;

		}
}


		}
}


Line 1031Line 1181
	if ($add_to || $add_bcc)
{
$type = ($add_to) ? 'to' : 'bcc';

	if ($add_to || $add_bcc)
{
$type = ($add_to) ? 'to' : 'bcc';


// Add Selected Groups
$group_list = request_var('group_list', array(0));

 

if (sizeof($group_list))
{


if (sizeof($group_list))
{

Line 1045Line 1192

// User ID's to add...
$user_id_ary = array();


// User ID's to add...
$user_id_ary = array();


// Build usernames to add
$usernames = (isset($_REQUEST['username'])) ? array(request_var('username', '', true)) : array();
$username_list = request_var('username_list', '', true);
if ($username_list)
{
$usernames = array_merge($usernames, explode("\n", $username_list));
}

 

// Reveal the correct user_ids
if (sizeof($usernames))


// Reveal the correct user_ids
if (sizeof($usernames))

Line 1068Line 1207
		}

// Add Friends if specified

		}

// Add Friends if specified

		$friend_list = (is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array();

		$friend_list = (isset($_REQUEST['add_' . $type]) && is_array($_REQUEST['add_' . $type])) ? array_map('intval', array_keys($_REQUEST['add_' . $type])) : array();

		$user_id_ary = array_merge($user_id_ary, $friend_list);

foreach ($user_id_ary as $user_id)

		$user_id_ary = array_merge($user_id_ary, $friend_list);

foreach ($user_id_ary as $user_id)

Line 1144Line 1283
}

/**

}

/**

* Get recipient at position 'pos'

* Get number of 'num_recipients' recipients from first position

*/

*/

function get_recipient_pos($address_list, $position = 1)

function get_recipients($address_list, $num_recipients = 1)

{
$recipient = array();


{
$recipient = array();


	$count = 1;

	$count = 0;

	foreach ($address_list as $field => $adr_ary)
{
foreach ($adr_ary as $id => $type)
{

	foreach ($address_list as $field => $adr_ary)
{
foreach ($adr_ary as $id => $type)
{

			if ($count == $position)

			if ($count >= $num_recipients)

			{

			{

				$recipient[$field][$id] = $type;

 
				break 2;
}

				break 2;
}

 
			$recipient[$field][$id] = $type;

			$count++;
}
}

			$count++;
}
}