Vergleich private.php - 1.8.16 - 1.8.22

  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']);
}

Zeile 62Zeile 75
{
$folderinfo = explode("**", $folders, 2);
if($mybb->input['fid'] == $folderinfo[0])

{
$folderinfo = explode("**", $folders, 2);
if($mybb->input['fid'] == $folderinfo[0])

	{

	{

		$sel = ' selected="selected"';
}
else

		$sel = ' selected="selected"';
}
else

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")."\";");

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

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

Zeile 174Zeile 195
	else
{
$resulttype = "pmsubjects";

	else
{
$resulttype = "pmsubjects";

	}


	}


	$search_data = array(
"keywords" => $mybb->get_input('keywords'),
"subject" => $mybb->get_input('subject', MyBB::INPUT_INT),

	$search_data = array(
"keywords" => $mybb->get_input('keywords'),
"subject" => $mybb->get_input('subject', MyBB::INPUT_INT),

Zeile 183Zeile 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";

Zeile 208Zeile 229
		"keywords" => $db->escape_string($mybb->get_input('keywords')),
);
$plugins->run_hooks("private_do_search_process");

		"keywords" => $db->escape_string($mybb->get_input('keywords')),
);
$plugins->run_hooks("private_do_search_process");





	$db->insert_query("searchlog", $searcharray);

// Sender sort won't work yet

	$db->insert_query("searchlog", $searcharray);

// Sender sort won't work yet

Zeile 267Zeile 288
	else
{
$sortby = $query_sortby = "dateline";

	else
{
$sortby = $query_sortby = "dateline";

	}

if($order != "asc")
{
$order = "desc";
}

	}

if($order != "asc")
{
$order = "desc";
}


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


if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$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 285Zeile 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
{

	}
else
{

Zeile 303Zeile 333
	}

// Do Multi Pages

	}

// Do Multi Pages

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


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

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

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

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

	$messagelist = '';

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

	$messagelist = '';

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

Zeile 475Zeile 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 558Zeile 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 704Zeile 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 859Zeile 892
			if($mybb->settings['maxpmquotedepth'] != '0')
{
$message = remove_message_quotes($message, $mybb->settings['maxpmquotedepth']);

			if($mybb->settings['maxpmquotedepth'] != '0')
{
$message = remove_message_quotes($message, $mybb->settings['maxpmquotedepth']);

			}


			}


			if($mybb->input['do'] == 'forward')
{
$subject = "Fw: $subject";

			if($mybb->input['do'] == 'forward')
{
$subject = "Fw: $subject";

Zeile 924Zeile 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.
eval("\$autocompletejs = \"".$templates->get("private_send_autocomplete")."\";");

	}

// Load the auto complete javascript if it is enabled.
eval("\$autocompletejs = \"".$templates->get("private_send_autocomplete")."\";");





	$pmid = $mybb->get_input('pmid', MyBB::INPUT_INT);
$do = $mybb->get_input('do');
if($do != "forward" && $do != "reply" && $do != "replyall")

	$pmid = $mybb->get_input('pmid', MyBB::INPUT_INT);
$do = $mybb->get_input('do');
if($do != "forward" && $do != "reply" && $do != "replyall")

Zeile 1095Zeile 1128
	{
$uid_sql = $pm['toid'];
$pm['recipients']['to'] = array($pm['toid']);

	{
$uid_sql = $pm['toid'];
$pm['recipients']['to'] = array($pm['toid']);

	}

$show_bcc = 0;


	}

$show_bcc = 0;


	// If we have any BCC recipients and this user is an Administrator, add them on to the query
if(isset($pm['recipients']['bcc']) && count($pm['recipients']['bcc']) > 0 && $mybb->usergroup['cancp'] == 1)
{

	// If we have any BCC recipients and this user is an Administrator, add them on to the query
if(isset($pm['recipients']['bcc']) && count($pm['recipients']['bcc']) > 0 && $mybb->usergroup['cancp'] == 1)
{

Zeile 1131Zeile 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
{
$bcc_form_val = '';

	else
{
$bcc_form_val = '';

Zeile 1454Zeile 1487
		$fid = $folderinfo[0];
$foldername = get_pm_folder_name($fid, $foldername);


		$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")."\";");

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

Zeile 1509Zeile 1542

$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)

				if($val == get_pm_folder_name($fid) || trim($val) == '')

				{

				{

					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;

					$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 1568Zeile 1578
				$db->delete_query("privatemessages", "folder='$fid' AND uid='".$mybb->user['uid']."'");
}
}

				$db->delete_query("privatemessages", "folder='$fid' AND uid='".$mybb->user['uid']."'");
}
}

	}

	}


$sql_array = array(
"pmfolders" => $folders


$sql_array = array(
"pmfolders" => $folders

Zeile 1593Zeile 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)
{
$folderinfo = explode("**", $folders, 2);
$fid = $folderinfo[0];

	foreach($foldersexploded as $key => $folders)
{
$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")."\";");

Zeile 2079Zeile 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 2134Zeile 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 2148Zeile 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 2165Zeile 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 2188Zeile 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 2211Zeile 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 2240Zeile 2272
	}
else
{

	}
else
{

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


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

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

Zeile 2255Zeile 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
");