<?php
global $vbulletin;
$vbulletin->input->clean_array_gpc('p', array('reply_all' => TYPE_STR));
if ($vbulletin->GPC['reply_all'] != '')
{
	$pmdata = $vbulletin->db->query_first_slave("
		SELECT pm.*, pmtext.*
		FROM " . TABLE_PREFIX . "pm AS pm
		LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)
		WHERE pm.userid=" . $vbulletin->userinfo['userid'] . " AND pm.pmid=" . $vbulletin->GPC['pmid'] . "
	");
	$touser = unserialize($pmdata['touserarray']);
	if (is_array($touser))
	{
		$recipients = $touser['cc'];
		$recipients[] = $pmdata['fromusername'];
		$recipients = array_unique($recipients);
		unset($recipients[array_search($vbulletin->userinfo['username'], $recipients)]);
		$pm['recipients'] = implode('; ', $recipients);
		$pmdm->set_recipients($pm['recipients'], $permissions, 'cc');
	}
}
?>