Vergleich private.php - 1.8.15 - 1.8.21

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 42Zeile 42
	error_no_permission();
}


	error_no_permission();
}


 
$update = false;

if(!$mybb->user['pmfolders'])
{

if(!$mybb->user['pmfolders'])
{

	$mybb->user['pmfolders'] = "1**$%%$2**$%%$3**$%%$4**";










	$update = true;
$mybb->user['pmfolders'] = "0**$%%$1**$%%$2**$%%$3**$%%$4**";
}
elseif ((int)my_substr($mybb->user['pmfolders'], 0, 1) != 0)
{
// Old folder structure. Need to update
// Since MyBB 1.8.20 fid[0] represents 'Inbox' and fid[1] represents 'Unread'
$update = true;
$mybb->user['pmfolders'] = '0'. ltrim(str_replace("$%%$2**", "$%%$1**$%%$2**", $mybb->user['pmfolders']), '1');
}





 
// Folder structure update required?
if($update)
{

	$sql_array = array(

	$sql_array = array(

		 "pmfolders" => $mybb->user['pmfolders']

		 "pmfolders" => $db->escape_string($mybb->user['pmfolders']),

	);
$db->update_query("users", $sql_array, "uid = ".$mybb->user['uid']);

	);
$db->update_query("users", $sql_array, "uid = ".$mybb->user['uid']);

}

$mybb->input['fid'] = $mybb->get_input('fid', MyBB::INPUT_INT);


}

$mybb->input['fid'] = $mybb->get_input('fid', MyBB::INPUT_INT);


$folder_id = $folder_name = '';

$foldernames = array();

$folder_id = $folder_name = '';

$foldernames = array();

Zeile 77Zeile 90

eval("\$folderjump_folder .= \"".$templates->get("private_jump_folders_folder")."\";");
eval("\$folderoplist_folder .= \"".$templates->get("private_jump_folders_folder")."\";");


eval("\$folderjump_folder .= \"".$templates->get("private_jump_folders_folder")."\";");
eval("\$folderoplist_folder .= \"".$templates->get("private_jump_folders_folder")."\";");

	eval("\$foldersearch_folder .= \"".$templates->get("private_jump_folders_folder")."\";");









	// Manipulate search folder selection to omit "Unread"
if($folder_id != 1)
{
if($folder_id == 0)
{
$folder_id = 1;
}
eval("\$foldersearch_folder .= \"".$templates->get("private_jump_folders_folder")."\";");
}

}

}

 

$from_fid = $mybb->input['fid'];


eval("\$folderjump = \"".$templates->get("private_jump_folders")."\";");
eval("\$folderoplist = \"".$templates->get("private_move")."\";");


eval("\$folderjump = \"".$templates->get("private_jump_folders")."\";");
eval("\$folderoplist = \"".$templates->get("private_move")."\";");

Zeile 181Zeile 204
		"sender" => $mybb->get_input('sender'),
"status" => $mybb->get_input('status', MyBB::INPUT_ARRAY),
"folder" => $mybb->get_input('folder', MyBB::INPUT_ARRAY)

		"sender" => $mybb->get_input('sender'),
"status" => $mybb->get_input('status', MyBB::INPUT_ARRAY),
"folder" => $mybb->get_input('folder', MyBB::INPUT_ARRAY)

	);

	);


if($db->can_search == true)
{
require_once MYBB_ROOT."inc/functions_search.php";


if($db->can_search == true)
{
require_once MYBB_ROOT."inc/functions_search.php";





		$search_results = privatemessage_perform_search_mysql($search_data);
}
else

		$search_results = privatemessage_perform_search_mysql($search_data);
}
else

	{

	{

		error($lang->error_no_search_support);
}
$sid = md5(uniqid(microtime(), true));

		error($lang->error_no_search_support);
}
$sid = md5(uniqid(microtime(), true));

Zeile 215Zeile 238
	if(in_array($mybb->get_input('sort'), $sortby))
{
$sortby = $mybb->get_input('sort');

	if(in_array($mybb->get_input('sort'), $sortby))
{
$sortby = $mybb->get_input('sort');

	}

	}

	else
{
$sortby = "dateline";

	else
{
$sortby = "dateline";

Zeile 276Zeile 299
	{
$mybb->settings['threadsperpage'] = 20;
}

	{
$mybb->settings['threadsperpage'] = 20;
}

 

$query = $db->simple_select("privatemessages", "COUNT(*) AS total", "pmid IN(".$db->escape_string($search['querycache']).")");
$pmscount = $db->fetch_field($query, "total");


// Work out pagination, which page we're at, as well as the limits.
$perpage = $mybb->settings['threadsperpage'];


// Work out pagination, which page we're at, as well as the limits.
$perpage = $mybb->settings['threadsperpage'];

Zeile 283Zeile 309
	if($page > 0)
{
$start = ($page-1) * $perpage;

	if($page > 0)
{
$start = ($page-1) * $perpage;

	}







		$pages = ceil($pmscount / $perpage);
if($page > $pages)
{
$start = 0;
$page = 1;
}
}

	else
{
$start = 0;
$page = 1;

	else
{
$start = 0;
$page = 1;

	}

	}

	$end = $start + $perpage;
$lower = $start+1;
$upper = $end;

	$end = $start + $perpage;
$lower = $start+1;
$upper = $end;





	// Work out if we have terms to highlight
$highlight = "";
if($search['keywords'])

	// Work out if we have terms to highlight
$highlight = "";
if($search['keywords'])

	{

	{

		$highlight = "&highlight=".urlencode($search['keywords']);

		$highlight = "&highlight=".urlencode($search['keywords']);

	}

// Do Multi Pages
$query = $db->simple_select("privatemessages", "COUNT(*) AS total", "pmid IN(".$db->escape_string($search['querycache']).")");
$pmscount = $db->fetch_array($query);

	}









 
	// Do Multi Pages

	if($upper > $pmscount)
{
$upper = $pmscount;
}

	if($upper > $pmscount)
{
$upper = $pmscount;
}

	$multipage = multipage($pmscount['total'], $perpage, $page, "private.php?action=results&sid=".htmlspecialchars_uni($mybb->get_input('sid'))."&sortby={$sortby}&order={$order}");

	$multipage = multipage($pmscount, $perpage, $page, "private.php?action=results&sid=".htmlspecialchars_uni($mybb->get_input('sid'))."&sortby={$sortby}&order={$order}");

	$messagelist = '';

	$messagelist = '';





	$icon_cache = $cache->read("posticons");

// Cache users in multiple recipients for sent & drafts folder

	$icon_cache = $cache->read("posticons");

// Cache users in multiple recipients for sent & drafts folder

Zeile 318Zeile 347
	$cached_users = $get_users = array();
$users_query = $db->simple_select("privatemessages", "recipients", "pmid IN(".$db->escape_string($search['querycache']).")", array('limit_start' => $start, 'limit' => $perpage, 'order_by' => $query_sortby, 'order_dir' => $order));
while($row = $db->fetch_array($users_query))

	$cached_users = $get_users = array();
$users_query = $db->simple_select("privatemessages", "recipients", "pmid IN(".$db->escape_string($search['querycache']).")", array('limit_start' => $start, 'limit' => $perpage, 'order_by' => $query_sortby, 'order_dir' => $order));
while($row = $db->fetch_array($users_query))

	{

	{

		$recipients = my_unserialize($row['recipients']);
if(is_array($recipients['to']) && count($recipients['to']))

		$recipients = my_unserialize($row['recipients']);
if(is_array($recipients['to']) && count($recipients['to']))

		{

		{

			$get_users = array_merge($get_users, $recipients['to']);

			$get_users = array_merge($get_users, $recipients['to']);

		}

		}


if(isset($recipients['bcc']) && is_array($recipients['bcc']) && count($recipients['bcc']))
{


if(isset($recipients['bcc']) && is_array($recipients['bcc']) && count($recipients['bcc']))
{

Zeile 338Zeile 367
	{
$users_query = $db->simple_select("users", "uid, username, usergroup, displaygroup", "uid IN ({$get_users})");
while($user = $db->fetch_array($users_query))

	{
$users_query = $db->simple_select("users", "uid, username, usergroup, displaygroup", "uid IN ({$get_users})");
while($user = $db->fetch_array($users_query))

		{

		{

			$cached_users[$user['uid']] = $user;
}
}

			$cached_users[$user['uid']] = $user;
}
}

Zeile 376Zeile 405
		{
$msgstatus = 'fw_pm';
$msgalt = $lang->fwd_pm;

		{
$msgstatus = 'fw_pm';
$msgalt = $lang->fwd_pm;

		}

		}


$folder = $message['folder'];



$folder = $message['folder'];


Zeile 395Zeile 424
					$user['username'] = htmlspecialchars_uni($user['username']);
$username = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
eval("\$to_users .= \"".$templates->get("private_multiple_recipients_user")."\";");

					$user['username'] = htmlspecialchars_uni($user['username']);
$username = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
eval("\$to_users .= \"".$templates->get("private_multiple_recipients_user")."\";");

				}

				}

				if(isset($recipients['bcc']) && is_array($recipients['bcc']) && count($recipients['bcc']))
{
eval("\$bcc_users = \"".$templates->get("private_multiple_recipients_bcc")."\";");

				if(isset($recipients['bcc']) && is_array($recipients['bcc']) && count($recipients['bcc']))
{
eval("\$bcc_users = \"".$templates->get("private_multiple_recipients_bcc")."\";");

Zeile 415Zeile 444
			{
$tofromusername = htmlspecialchars_uni($message['tousername']);
$tofromuid = $message['toid'];

			{
$tofromusername = htmlspecialchars_uni($message['tousername']);
$tofromuid = $message['toid'];

			}

			}

			else
{
$tofromusername = $lang->not_sent;

			else
{
$tofromusername = $lang->not_sent;

			}
}

			}
}

		else
{
$tofromusername = htmlspecialchars_uni($message['fromusername']);

		else
{
$tofromusername = htmlspecialchars_uni($message['fromusername']);

Zeile 430Zeile 459
				$tofromusername = $lang->mybb_engine;
}
}

				$tofromusername = $lang->mybb_engine;
}
}





		$tofromusername = build_profile_link($tofromusername, $tofromuid);

$denyreceipt = '';

		$tofromusername = build_profile_link($tofromusername, $tofromuid);

$denyreceipt = '';





		if($message['icon'] > 0 && $icon_cache[$message['icon']])
{
$icon = $icon_cache[$message['icon']];

		if($message['icon'] > 0 && $icon_cache[$message['icon']])
{
$icon = $icon_cache[$message['icon']];

Zeile 473Zeile 502
			$senddate = $lang->not_sent;
}


			$senddate = $lang->not_sent;
}


		$foldername = $foldernames[$message['folder']];






		$fid = "0";
if((int)$message['folder'] > 1)
{
$fid = $message['folder'];
}
$foldername = $foldernames[$fid];


// What we do here is parse the post using our post parser, then strip the tags from it
$parser_options = array(


// What we do here is parse the post using our post parser, then strip the tags from it
$parser_options = array(

Zeile 556Zeile 590

// Attempt to see if this PM is a duplicate or not
$to = array_map("trim", explode(",", $mybb->get_input('to')));


// Attempt to see if this PM is a duplicate or not
$to = array_map("trim", explode(",", $mybb->get_input('to')));

 
	$to = array_unique($to); // Filter out any duplicates

	$to_escaped = implode("','", array_map(array($db, 'escape_string'), array_map('my_strtolower', $to)));
$time_cutoff = TIME_NOW - (5 * 60 * 60);
$query = $db->query("

	$to_escaped = implode("','", array_map(array($db, 'escape_string'), array_map('my_strtolower', $to)));
$time_cutoff = TIME_NOW - (5 * 60 * 60);
$query = $db->query("

Zeile 702Zeile 737
		{
$optionschecked['readreceipt'] = 'checked="checked"';
}

		{
$optionschecked['readreceipt'] = 'checked="checked"';
}

		$to = htmlspecialchars_uni($mybb->get_input('to'));
$bcc = htmlspecialchars_uni($mybb->get_input('bcc'));

		$to = htmlspecialchars_uni(implode(', ', array_unique(array_map('trim', explode(',', $mybb->get_input('to'))))));
$bcc = htmlspecialchars_uni(implode(', ', array_unique(array_map('trim', explode(',', $mybb->get_input('bcc'))))));

	}

$preview = '';

	}

$preview = '';

Zeile 922Zeile 957

if($send_errors)
{


if($send_errors)
{

		$to = htmlspecialchars_uni($mybb->get_input('to'));
$bcc = htmlspecialchars_uni($mybb->get_input('bcc'));

		$to = htmlspecialchars_uni(implode(', ', array_unique(array_map('trim', explode(',', $mybb->get_input('to'))))));
$bcc = htmlspecialchars_uni(implode(', ', array_unique(array_map('trim', explode(',', $mybb->get_input('bcc'))))));

	}

// Load the auto complete javascript if it is enabled.

	}

// Load the auto complete javascript if it is enabled.

Zeile 1129Zeile 1164
		$bcc_recipients = implode(', ', $bcc_recipients);
$bcc_form_val = implode(',', $bcc_form_val);
eval("\$bcc = \"".$templates->get("private_read_bcc")."\";");

		$bcc_recipients = implode(', ', $bcc_recipients);
$bcc_form_val = implode(',', $bcc_form_val);
eval("\$bcc = \"".$templates->get("private_read_bcc")."\";");

	}
else

	}
else

	{
$bcc_form_val = '';
}

	{
$bcc_form_val = '';
}

Zeile 1204Zeile 1239

eval("\$private_send_tracking = \"".$templates->get("private_send_tracking")."\";");
}


eval("\$private_send_tracking = \"".$templates->get("private_send_tracking")."\";");
}




		
$expaltext = (in_array("quickreply", $collapse)) ? "[+]" : "[-]";

		eval("\$quickreply = \"".$templates->get("private_quickreply")."\";");
}


		eval("\$quickreply = \"".$templates->get("private_quickreply")."\";");
}


Zeile 1264Zeile 1300

$query = $db->query("
SELECT pm.pmid, pm.subject, pm.toid, pm.readtime, u.username as tousername


$query = $db->query("
SELECT pm.pmid, pm.subject, pm.toid, pm.readtime, u.username as tousername

		FROM ".TABLE_PREFIX."privatemessages pm
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=pm.toid)

		FROM ".TABLE_PREFIX."privatemessages pm
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=pm.toid)

		WHERE pm.receipt='2' AND pm.folder!='3'  AND pm.status!='0' AND pm.fromid='".$mybb->user['uid']."'
ORDER BY pm.readtime DESC
LIMIT {$start}, {$perpage}

		WHERE pm.receipt='2' AND pm.folder!='3'  AND pm.status!='0' AND pm.fromid='".$mybb->user['uid']."'
ORDER BY pm.readtime DESC
LIMIT {$start}, {$perpage}

Zeile 1399Zeile 1435
		if(!empty($mybb->input['unreadcheck']))
{
foreach($mybb->input['unreadcheck'] as $pmid => $val)

		if(!empty($mybb->input['unreadcheck']))
{
foreach($mybb->input['unreadcheck'] as $pmid => $val)

			{

			{

				$pmids[$pmid] = (int)$pmid;
}


				$pmids[$pmid] = (int)$pmid;
}


Zeile 1431Zeile 1467

$sql_array = array(
"receipt" => 0


$sql_array = array(
"receipt" => 0

	);

	);

	$db->update_query("privatemessages", $sql_array, "receipt='2' AND folder!='3' AND status!='0' AND fromid=".$mybb->user['uid']);

$plugins->run_hooks("private_stopalltracking_end");

	$db->update_query("privatemessages", $sql_array, "receipt='2' AND folder!='3' AND status!='0' AND fromid=".$mybb->user['uid']);

$plugins->run_hooks("private_stopalltracking_end");

Zeile 1450Zeile 1486
		$foldername = $folderinfo[1];
$fid = $folderinfo[0];
$foldername = get_pm_folder_name($fid, $foldername);

		$foldername = $folderinfo[1];
$fid = $folderinfo[0];
$foldername = get_pm_folder_name($fid, $foldername);


if($folderinfo[0] == "1" || $folderinfo[0] == "2" || $folderinfo[0] == "3" || $folderinfo[0] == "4")
{


if((int)$folderinfo[0] < 5)
{

			$foldername2 = get_pm_folder_name($fid);
eval("\$folderlist .= \"".$templates->get("private_folders_folder_unremovable")."\";");
unset($name);

			$foldername2 = get_pm_folder_name($fid);
eval("\$folderlist .= \"".$templates->get("private_folders_folder_unremovable")."\";");
unset($name);

		}

		}

		else
{
eval("\$folderlist .= \"".$templates->get("private_folders_folder")."\";");

		else
{
eval("\$folderlist .= \"".$templates->get("private_folders_folder")."\";");

Zeile 1465Zeile 1501

$newfolders = '';
for($i = 1; $i <= 5; ++$i)


$newfolders = '';
for($i = 1; $i <= 5; ++$i)

	{

	{

		$fid = "new$i";
$foldername = '';
eval("\$newfolders .= \"".$templates->get("private_folders_folder")."\";");

		$fid = "new$i";
$foldername = '';
eval("\$newfolders .= \"".$templates->get("private_folders_folder")."\";");

Zeile 1481Zeile 1517
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));





	$plugins->run_hooks("private_do_folders_start");

$highestid = 2;

	$plugins->run_hooks("private_do_folders_start");

$highestid = 2;

Zeile 1493Zeile 1529
		if(empty($donefolders[$val]) )// Probably was a check for duplicate folder names, but doesn't seem to be used now
{
if(my_substr($key, 0, 3) == "new") // Create a new folder

		if(empty($donefolders[$val]) )// Probably was a check for duplicate folder names, but doesn't seem to be used now
{
if(my_substr($key, 0, 3) == "new") // Create a new folder

			{

			{

				++$highestid;
$fid = (int)$highestid;
}
else // Editing an existing folder

				++$highestid;
$fid = (int)$highestid;
}
else // Editing an existing folder

			{

			{

				if($key > $highestid)
{
$highestid = $key;

				if($key > $highestid)
{
$highestid = $key;

				}


				}


				$fid = (int)$key;
// Use default language strings if empty or value is language string

				$fid = (int)$key;
// Use default language strings if empty or value is language string

				switch($fid)
{
case 1:
if($val == $lang->folder_inbox || trim($val) == '')
{
$val = '';
}
break;
case 2:
if($val == $lang->folder_sent_items || trim($val) == '')
{
$val = '';
}
break;
case 3:
if($val == $lang->folder_drafts || trim($val) == '')
{
$val = '';
}
break;
case 4:
if($val == $lang->folder_trash || trim($val) == '')
{
$val = '';
}
break;
}

				if($val == get_pm_folder_name($fid) || trim($val) == '')
{
$val = '';
}
























			}


			}


			if($val != '' && trim($val) == '' && !($key >= 1 && $key <= 4))

			if($val != '' && trim($val) == '' && !(is_numeric($key) && $key <= 4))

			{
// If the name only contains whitespace and it's not a default folder, print an error
error($lang->error_emptypmfoldername);
}


			{
// If the name only contains whitespace and it's not a default folder, print an error
error($lang->error_emptypmfoldername);
}


			if($val != '' || ($key >= 1 && $key <= 4))

			if($val != '' || (is_numeric($key) && $key <= 4))

			{
// If there is a name or if this is a default folder, save it
$foldername = $db->escape_string(htmlspecialchars_uni($val));

			{
// If there is a name or if this is a default folder, save it
$foldername = $db->escape_string(htmlspecialchars_uni($val));

Zeile 1557Zeile 1570
				else
{
error($lang->error_invalidpmfoldername);

				else
{
error($lang->error_invalidpmfoldername);

				}
}

				}
}

			else
{
// Delete PMs from the folder

			else
{
// Delete PMs from the folder

Zeile 1571Zeile 1584
		"pmfolders" => $folders
);
$db->update_query("users", $sql_array, "uid='".$mybb->user['uid']."'");

		"pmfolders" => $folders
);
$db->update_query("users", $sql_array, "uid='".$mybb->user['uid']."'");





	// Update PM count
update_pm_count();


	// Update PM count
update_pm_count();


Zeile 1579Zeile 1592

redirect("private.php", $lang->redirect_pmfoldersupdated);
}


redirect("private.php", $lang->redirect_pmfoldersupdated);
}





if($mybb->input['action'] == "empty")
{
if($mybb->user['totalpms'] == 0)

if($mybb->input['action'] == "empty")
{
if($mybb->user['totalpms'] == 0)

Zeile 1590Zeile 1603
	$plugins->run_hooks("private_empty_start");

$foldersexploded = explode("$%%$", $mybb->user['pmfolders']);

	$plugins->run_hooks("private_empty_start");

$foldersexploded = explode("$%%$", $mybb->user['pmfolders']);

	$folderlist = '';

	$folderlist = $unread = '';

	foreach($foldersexploded as $key => $folders)

	foreach($foldersexploded as $key => $folders)

	{

	{

		$folderinfo = explode("**", $folders, 2);
$fid = $folderinfo[0];

		$folderinfo = explode("**", $folders, 2);
$fid = $folderinfo[0];

		$foldername = get_pm_folder_name($fid, $folderinfo[1]);
$query = $db->simple_select("privatemessages", "COUNT(*) AS pmsinfolder", " folder='$fid' AND uid='".$mybb->user['uid']."'");










		if($folderinfo[0] == "1")
{
$fid = "1";
$unread = " AND status='0'";
}
if($folderinfo[0] == "0")
{
$fid = "1";
}
$foldername = get_pm_folder_name($folderinfo[0], $folderinfo[1]);
$query = $db->simple_select("privatemessages", "COUNT(*) AS pmsinfolder", " folder='$fid'$unread AND uid='".$mybb->user['uid']."'");

		$thing = $db->fetch_array($query);
$foldercount = my_number_format($thing['pmsinfolder']);
eval("\$folderlist .= \"".$templates->get("private_empty_folder")."\";");

		$thing = $db->fetch_array($query);
$foldercount = my_number_format($thing['pmsinfolder']);
eval("\$folderlist .= \"".$templates->get("private_empty_folder")."\";");

	}


	}


	$plugins->run_hooks("private_empty_end");

eval("\$folders = \"".$templates->get("private_empty")."\";");

	$plugins->run_hooks("private_empty_end");

eval("\$folders = \"".$templates->get("private_empty")."\";");

Zeile 1612Zeile 1634
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));





	$plugins->run_hooks("private_do_empty_start");

$emptyq = '';
$mybb->input['empty'] = $mybb->get_input('empty', MyBB::INPUT_ARRAY);
$keepunreadq = '';
if($mybb->get_input('keepunread', MyBB::INPUT_INT) == 1)

	$plugins->run_hooks("private_do_empty_start");

$emptyq = '';
$mybb->input['empty'] = $mybb->get_input('empty', MyBB::INPUT_ARRAY);
$keepunreadq = '';
if($mybb->get_input('keepunread', MyBB::INPUT_INT) == 1)

	{

	{

		$keepunreadq = " AND status!='0'";
}
if(!empty($mybb->input['empty']))

		$keepunreadq = " AND status!='0'";
}
if(!empty($mybb->input['empty']))

	{

	{

		foreach($mybb->input['empty'] as $key => $val)
{
if($val == 1)

		foreach($mybb->input['empty'] as $key => $val)
{
if($val == 1)

Zeile 1635Zeile 1657
				}
$emptyq .= "folder='$key'";
}

				}
$emptyq .= "folder='$key'";
}

		}

		}


if($emptyq != '')
{


if($emptyq != '')
{

Zeile 1656Zeile 1678
	verify_post_check($mybb->get_input('my_post_key'));

$plugins->run_hooks("private_do_stuff");

	verify_post_check($mybb->get_input('my_post_key'));

$plugins->run_hooks("private_do_stuff");





	if(!empty($mybb->input['hop']))
{
header("Location: private.php?fid=".$mybb->get_input('jumpto'));
}
elseif(!empty($mybb->input['moveto']))

	if(!empty($mybb->input['hop']))
{
header("Location: private.php?fid=".$mybb->get_input('jumpto'));
}
elseif(!empty($mybb->input['moveto']))

	{
$mybb->input['check'] = $mybb->get_input('check', MyBB::INPUT_ARRAY);
if(!empty($mybb->input['check']))
{

	{
$mybb->input['check'] = $mybb->get_input('check', MyBB::INPUT_ARRAY);
if(!empty($mybb->input['check']))
{

			foreach($mybb->input['check'] as $key => $val)
{
$sql_array = array(

			foreach($mybb->input['check'] as $key => $val)
{
$sql_array = array(

Zeile 1673Zeile 1695
				);
$db->update_query("privatemessages", $sql_array, "pmid='".(int)$key."' AND uid='".$mybb->user['uid']."'");
}

				);
$db->update_query("privatemessages", $sql_array, "pmid='".(int)$key."' AND uid='".$mybb->user['uid']."'");
}

		}

		}

		// Update PM count
update_pm_count();


		// Update PM count
update_pm_count();


Zeile 1690Zeile 1712
	{
$mybb->input['check'] = $mybb->get_input('check', MyBB::INPUT_ARRAY);
if(!empty($mybb->input['check']))

	{
$mybb->input['check'] = $mybb->get_input('check', MyBB::INPUT_ARRAY);
if(!empty($mybb->input['check']))

		{

		{

			$pmssql = '';
foreach($mybb->input['check'] as $key => $val)
{

			$pmssql = '';
foreach($mybb->input['check'] as $key => $val)
{

Zeile 2076Zeile 2098

if(!$mybb->input['fid'] || !array_key_exists($mybb->input['fid'], $foldernames))
{


if(!$mybb->input['fid'] || !array_key_exists($mybb->input['fid'], $foldernames))
{

		$mybb->input['fid'] = 1;

		$mybb->input['fid'] = 0;

	}


	}


	$folder = $mybb->input['fid'];
$foldername = $foldernames[$folder];


	$fid = (int)$mybb->input['fid'];
$folder = !$fid ? 1 : $fid;
$foldername = $foldernames[$fid];


if($folder == 2 || $folder == 3)
{ // Sent Items Folder


if($folder == 2 || $folder == 3)
{ // Sent Items Folder

Zeile 2131Zeile 2154
	eval("\$orderarrow['$sortby'] = \"".$templates->get("private_orderarrow")."\";");

// Do Multi Pages

	eval("\$orderarrow['$sortby'] = \"".$templates->get("private_orderarrow")."\";");

// Do Multi Pages

	$query = $db->simple_select("privatemessages", "COUNT(*) AS total", "uid='".$mybb->user['uid']."' AND folder='$folder'");
$pmscount = $db->fetch_array($query);







	$selective = "";
if($fid == 1)
{
$selective = " AND status='0'";
}

$query = $db->simple_select("privatemessages", "COUNT(*) AS total", "uid='".$mybb->user['uid']."' AND folder='$folder'$selective");
$pmscount = $db->fetch_field($query, "total");


if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{


if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{

Zeile 2145Zeile 2174
	if($page > 0)
{
$start = ($page-1) *$perpage;

	if($page > 0)
{
$start = ($page-1) *$perpage;

	}







		$pages = ceil($pmscount / $perpage);
if($page > $pages)
{
$start = 0;
$page = 1;
}
}

	else
{
$start = 0;

	else
{
$start = 0;

Zeile 2162Zeile 2197
	}

if($mybb->input['order'] || ($sortby && $sortby != "dateline"))

	}

if($mybb->input['order'] || ($sortby && $sortby != "dateline"))

	{
$page_url = "private.php?fid={$folder}&sortby={$sortby}&order={$sortordernow}";
}
else
{
$page_url = "private.php?fid={$folder}";
}

$multipage = multipage($pmscount['total'], $perpage, $page, $page_url);
$messagelist = '';

$icon_cache = $cache->read("posticons");

	{
$page_url = "private.php?fid={$fid}&sortby={$sortby}&order={$sortordernow}";
}
else
{
$page_url = "private.php?fid={$fid}";
}

$multipage = multipage($pmscount, $perpage, $page, $page_url);
$selective = $messagelist = '';

$icon_cache = $cache->read("posticons");


// Cache users in multiple recipients for sent & drafts folder
if($folder == 2 || $folder == 3)


// Cache users in multiple recipients for sent & drafts folder
if($folder == 2 || $folder == 3)

Zeile 2185Zeile 2220
		else
{
$u = "pm.";

		else
{
$u = "pm.";

		}


		}


		// Get all recipients into an array
$cached_users = $get_users = array();
$users_query = $db->query("

		// Get all recipients into an array
$cached_users = $get_users = array();
$users_query = $db->query("

Zeile 2208Zeile 2243
			if(isset($recipients['bcc']) && is_array($recipients['bcc']) && count($recipients['bcc']))
{
$get_users = array_merge($get_users, $recipients['bcc']);

			if(isset($recipients['bcc']) && is_array($recipients['bcc']) && count($recipients['bcc']))
{
$get_users = array_merge($get_users, $recipients['bcc']);

			}
}

$get_users = implode(',', array_unique($get_users));

			}
}

$get_users = implode(',', array_unique($get_users));


// Grab info
if($get_users)


// Grab info
if($get_users)

Zeile 2237Zeile 2272
	}
else
{

	}
else
{

 
		if($fid == 1)
{
$selective = " AND pm.status='0'";
}


		if($sortfield == "username")
{
$pm = "fu.";

		if($sortfield == "username")
{
$pm = "fu.";

Zeile 2252Zeile 2292
		FROM ".TABLE_PREFIX."privatemessages pm
LEFT JOIN ".TABLE_PREFIX."users fu ON (fu.uid=pm.fromid)
LEFT JOIN ".TABLE_PREFIX."users tu ON (tu.uid=pm.toid)

		FROM ".TABLE_PREFIX."privatemessages pm
LEFT JOIN ".TABLE_PREFIX."users fu ON (fu.uid=pm.fromid)
LEFT JOIN ".TABLE_PREFIX."users tu ON (tu.uid=pm.toid)

		WHERE pm.folder='$folder' AND pm.uid='".$mybb->user['uid']."'

		WHERE pm.folder='$folder' AND pm.uid='".$mybb->user['uid']."'{$selective}

		ORDER BY {$pm}{$sortfield} {$sortordernow}
LIMIT $start, $perpage
");

		ORDER BY {$pm}{$sortfield} {$sortordernow}
LIMIT $start, $perpage
");

Zeile 2290Zeile 2330
			{ // Sent Items or Drafts Folder Check
$recipients = my_unserialize($message['recipients']);
$to_users = $bcc_users = '';

			{ // Sent Items or Drafts Folder Check
$recipients = my_unserialize($message['recipients']);
$to_users = $bcc_users = '';

				if(count($recipients['to']) > 1 || (count($recipients['to']) == 1 && isset($recipients['bcc']) && count($recipients['bcc']) > 0))

				if(isset($recipients['to']) && count($recipients['to']) > 1 || (isset($recipients['to']) && count($recipients['to']) == 1 && isset($recipients['bcc']) && count($recipients['bcc']) > 0))

				{
foreach($recipients['to'] as $uid)
{

				{
foreach($recipients['to'] as $uid)
{