Vergleich private.php - 1.4.1 - 1.4.15

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 1Zeile 1
<?php
/**
* MyBB 1.4

<?php
/**
* MyBB 1.4

 * Copyright � 2008 MyBB Group, All Rights Reserved

 * Copyright © 2008 MyBB Group, All Rights Reserved

 *
* Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 *
* Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: private.php 4117 2008-08-15 15:38:41Z Tikitiki $

 * $Id: private.php 5379 2011-02-21 11:06:42Z Tomm $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 47Zeile 47
}

// On a random occassion, recount the users pm's just to make sure everything is in sync.

}

// On a random occassion, recount the users pm's just to make sure everything is in sync.

$rand = rand(0, 9);

$rand = my_rand(0, 9);

if($rand == 5)
{
update_pm_count();

if($rand == 5)
{
update_pm_count();

Zeile 347Zeile 347
			// Get list of recipients
$recipients = unserialize($pm['recipients']);
$comma = '';

			// Get list of recipients
$recipients = unserialize($pm['recipients']);
$comma = '';

			$recipientids = $pm['fromid'];

 
			if(isset($recipients['to']) && is_array($recipients['to']))
{
foreach($recipients['to'] as $recipient)

			if(isset($recipients['to']) && is_array($recipients['to']))
{
foreach($recipients['to'] as $recipient)

Zeile 357Zeile 356
					$comma = ',';
}
}

					$comma = ',';
}
}



			

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

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

			{

			{

				foreach($recipients['bcc'] as $recipient)

				foreach($recipients['bcc'] as $recipient)

				{

				{

					$recipient_list['bcc'][] = $recipient;
$recipientids .= $comma.$recipient;
$comma = ',';
}

					$recipient_list['bcc'][] = $recipient;
$recipientids .= $comma.$recipient;
$comma = ',';
}

			}

			}

			

			

			$query = $db->simple_select("users", "uid, username", "uid IN ({$recipientids})");
while($user = $db->fetch_array($query))
{
if(isset($recipients['bcc']) && is_array($recipients['bcc']) && in_array($user['uid'], $recipient_list['bcc']))
{
$bcc .= htmlspecialchars_uni($user['username']).', ';
}
else
{
$to .= htmlspecialchars_uni($user['username']).', ';
}
}
}




			if(!empty($recipientids))
{
$query = $db->simple_select("users", "uid, username", "uid IN ({$recipientids})");
while($user = $db->fetch_array($query))
{
if(isset($recipients['bcc']) && is_array($recipients['bcc']) && in_array($user['uid'], $recipient_list['bcc']))
{
$bcc .= htmlspecialchars_uni($user['username']).', ';
}
else
{
$to .= htmlspecialchars_uni($user['username']).', ';
}
}
}
}

		else
{ // forward/reply
$subject = preg_replace("#(FW|RE):( *)#is", '', $subject);
$postdate = my_date($mybb->settings['dateformat'], $pm['dateline']);
$posttime = my_date($mybb->settings['timeformat'], $pm['dateline']);
$message = "[quote={$pm['quotename']}]\n$message\n[/quote]";

		else
{ // forward/reply
$subject = preg_replace("#(FW|RE):( *)#is", '', $subject);
$postdate = my_date($mybb->settings['dateformat'], $pm['dateline']);
$posttime = my_date($mybb->settings['timeformat'], $pm['dateline']);
$message = "[quote={$pm['quotename']}]\n$message\n[/quote]";

			$pm['message'] = preg_replace('#^/me (.*)$#im', "* ".$pm['quotename']." \\1", $pm['message']);

			$message = preg_replace('#^/me (.*)$#im', "* ".$pm['quotename']." \\1", $message);


if($mybb->input['do'] == 'forward')
{


if($mybb->input['do'] == 'forward')
{

Zeile 435Zeile 437
				}
}
}

				}
}
}

	}


	}


	// New PM with recipient preset
if($mybb->input['uid'] && !$mybb->input['preview'])

	// New PM with recipient preset
if($mybb->input['uid'] && !$mybb->input['preview'])

	{

	{

		$query = $db->simple_select('users', 'username', "uid='".$db->escape_string($mybb->input['uid'])."'");
$to = htmlspecialchars_uni($db->fetch_field($query, 'username')).', ';

		$query = $db->simple_select('users', 'username', "uid='".$db->escape_string($mybb->input['uid'])."'");
$to = htmlspecialchars_uni($db->fetch_field($query, 'username')).', ';

	}


	}


	$max_recipients = '';
if($mybb->usergroup['maxpmrecipients'] > 0)
{

	$max_recipients = '';
if($mybb->usergroup['maxpmrecipients'] > 0)
{

Zeile 454Zeile 456
	{
$to = htmlspecialchars_uni($mybb->input['to']);
$bcc = htmlspecialchars_uni($mybb->input['bcc']);

	{
$to = htmlspecialchars_uni($mybb->input['to']);
$bcc = htmlspecialchars_uni($mybb->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->input['pmid'];
$do = $mybb->input['do'];

	$pmid = $mybb->input['pmid'];
$do = $mybb->input['do'];

	if($do != "forward" && $do != "reply")

	if($do != "forward" && $do != "reply" && $do != "replyall")

	{
$do = '';
}

	{
$do = '';
}

Zeile 473Zeile 475
		eval("\$buddy_select_to = \"".$templates->get("private_send_buddyselect")."\";");
$buddy_select = 'bcc';
eval("\$buddy_select_bcc = \"".$templates->get("private_send_buddyselect")."\";");

		eval("\$buddy_select_to = \"".$templates->get("private_send_buddyselect")."\";");
$buddy_select = 'bcc';
eval("\$buddy_select_bcc = \"".$templates->get("private_send_buddyselect")."\";");

	}


	}


	eval("\$send = \"".$templates->get("private_send")."\";");
$plugins->run_hooks("private_send_end");
output_page($send);

	eval("\$send = \"".$templates->get("private_send")."\";");
$plugins->run_hooks("private_send_end");
output_page($send);

Zeile 510Zeile 512
	if($pm['receipt'] == 1)
{
if($mybb->usergroup['cantrackpms'] == 1 && $mybb->usergroup['candenypmreceipts'] == 1 && $mybb->input['denyreceipt'] == 1)

	if($pm['receipt'] == 1)
{
if($mybb->usergroup['cantrackpms'] == 1 && $mybb->usergroup['candenypmreceipts'] == 1 && $mybb->input['denyreceipt'] == 1)

		{

		{

			$receiptadd = 0;
}
else

			$receiptadd = 0;
}
else

Zeile 528Zeile 530
		);

if(isset($receiptadd))

		);

if(isset($receiptadd))

		{

		{

			$updatearray['receipt'] = $receiptadd;
}


			$updatearray['receipt'] = $receiptadd;
}


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

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

	}


	}


	$show_bcc = 0;

// If we have any BCC recipients and this user is an Administrator, add them on to the query

	$show_bcc = 0;

// If we have any BCC recipients and this user is an Administrator, add them on to the query

Zeile 656Zeile 658
	eval("\$read = \"".$templates->get("private_read")."\";");
$plugins->run_hooks("private_read_end");
output_page($read);

	eval("\$read = \"".$templates->get("private_read")."\";");
$plugins->run_hooks("private_read_end");
output_page($read);

}


}


if($mybb->input['action'] == "tracking")
{
$plugins->run_hooks("private_tracking_start");

if($mybb->input['action'] == "tracking")
{
$plugins->run_hooks("private_tracking_start");

Zeile 764Zeile 766
				$pmuids[$pm['uid']] = $pm['uid'];
}


				$pmuids[$pm['uid']] = $pm['uid'];
}


			$db->delete_query("privatemessages", "pmid IN ($pmids) AND fromid='".$mybb->user['uid']."'");

			$db->delete_query("privatemessages", "pmid IN ($pmids) AND receipt='1' AND status='0' AND fromid='".$mybb->user['uid']."'");

			foreach($pmuids as $uid)
{
// Message is canceled, update PM count for this user

			foreach($pmuids as $uid)
{
// Message is canceled, update PM count for this user

				update_pm_count($pm['uid']);

				update_pm_count($uid);

			}
}
$plugins->run_hooks("private_do_tracking_end");

			}
}
$plugins->run_hooks("private_do_tracking_end");

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

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

			{

			{

				$key = intval($key);
if($emptyq)
{

				$key = intval($key);
if($emptyq)
{

Zeile 968Zeile 970
			if($mybb->input['keepunread'] == 1)
{
$keepunreadq = " AND status!='0'";

			if($mybb->input['keepunread'] == 1)
{
$keepunreadq = " AND status!='0'";

			}

			}

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

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

Zeile 981Zeile 983
}

if($mybb->input['action'] == "do_stuff" && $mybb->request_method == "post")

}

if($mybb->input['action'] == "do_stuff" && $mybb->request_method == "post")

{
// Verify incoming POST request

{
// Verify incoming POST request

	verify_post_check($mybb->input['my_post_key']);

$plugins->run_hooks("private_do_stuff");

	verify_post_check($mybb->input['my_post_key']);

$plugins->run_hooks("private_do_stuff");

Zeile 1011Zeile 1013
			redirect("private.php?fid=".intval($mybb->input['fromfid']), $lang->redirect_pmsmoved);
}
else

			redirect("private.php?fid=".intval($mybb->input['fromfid']), $lang->redirect_pmsmoved);
}
else

		{

		{

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

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

Zeile 1025Zeile 1027
				if($pmssql)
{
$pmssql .= ",";

				if($pmssql)
{
$pmssql .= ",";

				}

				}

				$pmssql .= "'".intval($key)."'";

				$pmssql .= "'".intval($key)."'";

			}

			}

			
$query = $db->simple_select("privatemessages", "pmid, folder", "pmid IN ($pmssql) AND uid='".$mybb->user['uid']."' AND folder='4'", array('order_by' => 'pmid'));
while($delpm = $db->fetch_array($query))

			
$query = $db->simple_select("privatemessages", "pmid, folder", "pmid IN ($pmssql) AND uid='".$mybb->user['uid']."' AND folder='4'", array('order_by' => 'pmid'));
while($delpm = $db->fetch_array($query))

			{

			{

				$deletepms[$delpm['pmid']] = 1;
}


				$deletepms[$delpm['pmid']] = 1;
}


Zeile 1040Zeile 1042
			{
$key = intval($key);
if($deletepms[$key])

			{
$key = intval($key);
if($deletepms[$key])

				{

				{

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

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

Zeile 1067Zeile 1069

$plugins->run_hooks("private_delete_start");



$plugins->run_hooks("private_delete_start");


	$sql_array = array(
"folder" => 4,
"deletetime" => TIME_NOW
);
$db->update_query("privatemessages", $sql_array, "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user['uid']."'");









	$query = $db->simple_select("privatemessages", "*", "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user['uid']."' AND folder='4'", array('order_by' => 'pmid'));
if($db->num_rows($query) == 1)
{
$db->delete_query("privatemessages", "pmid='".intval($mybb->input['pmid'])."'");
}
else
{
$sql_array = array(
"folder" => 4,
"deletetime" => TIME_NOW
);
$db->update_query("privatemessages", $sql_array, "pmid='".intval($mybb->input['pmid'])."' AND uid='".$mybb->user['uid']."'");
}


// Update PM count
update_pm_count();


// Update PM count
update_pm_count();

Zeile 1134Zeile 1144
			{
$wsql .= "<=";
}

			{
$wsql .= "<=";
}

			elseif($mybb->input['dayway'] == "newer")

			else

			{
$wsql .= ">=";
}

			{
$wsql .= ">=";
}

Zeile 1275Zeile 1285
			);

$message['message'] = $parser->parse_message($message['message'], $parser_options);

			);

$message['message'] = $parser->parse_message($message['message'], $parser_options);

 
			$message['subject'] = htmlspecialchars_uni($message['subject']);

		}

if($mybb->input['exporttype'] == "txt" || $mybb->input['exporttype'] == "csv")

		}

if($mybb->input['exporttype'] == "txt" || $mybb->input['exporttype'] == "csv")

Zeile 1303Zeile 1314
					$foldername = $folderinfo[1];
if($mybb->input['exporttype'] != "csv")
{

					$foldername = $folderinfo[1];
if($mybb->input['exporttype'] != "csv")
{

 
						if($mybb->input['exporttype'] != "html")
{
$mybb->input['exporttype'] == "txt";
}

						eval("\$pmsdownload .= \"".$templates->get("private_archive_".$mybb->input['exporttype']."_folderhead", 1, 0)."\";");
}
else

						eval("\$pmsdownload .= \"".$templates->get("private_archive_".$mybb->input['exporttype']."_folderhead", 1, 0)."\";");
}
else

Zeile 1324Zeile 1339
	eval("\$archived = \"".$templates->get("private_archive_".$mybb->input['exporttype'], 1, 0)."\";");
if($mybb->input['deletepms'] == 1)
{ // delete the archived pms

	eval("\$archived = \"".$templates->get("private_archive_".$mybb->input['exporttype'], 1, 0)."\";");
if($mybb->input['deletepms'] == 1)
{ // delete the archived pms

		$db->delete_query("privatemessages", "pmid IN (''$ids)");

		$db->delete_query("privatemessages", "pmid IN ('0'$ids)");

		// Update PM count
update_pm_count();

		// Update PM count
update_pm_count();

	}


	}


	if($mybb->input['exporttype'] == "html")
{
$filename = "pm-archive.html";

	if($mybb->input['exporttype'] == "html")
{
$filename = "pm-archive.html";

Zeile 1369Zeile 1384
	{
$mybb->input['fid'] = 1;
}

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




	
$folder = '';

	$foldersexploded = explode("$%%$", $mybb->user['pmfolders']);
foreach($foldersexploded as $key => $folders)
{

	$foldersexploded = explode("$%%$", $mybb->user['pmfolders']);
foreach($foldersexploded as $key => $folders)
{

Zeile 1431Zeile 1447
	{		
// Get all recipients into an array
$cached_users = $get_users = array();

	{		
// Get all recipients into an array
$cached_users = $get_users = array();

		$users_query = $db->simple_select("privatemessages", "recipients", "folder='$folder' AND uid='{$mybb->user['uid']}'", array('limit_start' => $start, 'limit' => $perpage));

		$users_query = $db->simple_select("privatemessages", "recipients", "folder='$folder' AND uid='{$mybb->user['uid']}'", array('limit_start' => $start, 'limit' => $perpage, 'order_by' => 'dateline', 'order_dir' => 'DESC'));

		while($row = $db->fetch_array($users_query))
{
$recipients = unserialize($row['recipients']);

		while($row = $db->fetch_array($users_query))
{
$recipients = unserialize($row['recipients']);

Zeile 1545Zeile 1561
				}
}


				}
}


			if($tofromuid != 0)
{
$tofromusername = build_profile_link($tofromusername, $tofromuid);
}

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




			
if($mybb->usergroup['cantrackpms'] == 1 && $mybb->usergroup['candenypmreceipts'] == 1 && $message['receipt'] == '1' && $message['folder'] != '3' && $message['folder'] != 2)
{

			
if($mybb->usergroup['cantrackpms'] == 1 && $mybb->usergroup['candenypmreceipts'] == 1 && $message['receipt'] == '1' && $message['folder'] != '3' && $message['folder'] != 2)
{

Zeile 1562Zeile 1575
			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']];

				$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" valign=\"middle\" align=\"center\" />&nbsp;";

				$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" align=\"center\" valign=\"middle\" />";

			}
else
{

			}
else
{

				$icon = '';

				$icon = '&nbsp;';

			}

if(!trim($message['subject']))

			}

if(!trim($message['subject']))