Vergleich inc/functions_post.php - 1.6.4 - 1.6.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: functions_post.php 5459 2011-05-10 10:47:56Z Tomm $

 * $Id$

 */

/**

 */

/**

Zeile 24Zeile 24
	global $plugins, $parser, $cache, $ignored_users, $hascustomtitle;

$hascustomtitle = 0;

	global $plugins, $parser, $cache, $ignored_users, $hascustomtitle;

$hascustomtitle = 0;

 

// Set default values for any fields not provided here
foreach(array('subject_extra', 'attachments', 'button_rep', 'button_warn', 'button_reply_pm', 'button_replyall_pm', 'button_forward_pm', 'button_delete_pm') as $post_field)
{
if(empty($post[$post_field]))
{
$post[$post_field] = '';
}
}


// Set up the message parser if it doesn't already exist.
if(!$parser)


// Set up the message parser if it doesn't already exist.
if(!$parser)

Zeile 160Zeile 169
	if($post_type != 2)
{
$post['subject'] = htmlspecialchars_uni($post['subject']);

	if($post_type != 2)
{
$post['subject'] = htmlspecialchars_uni($post['subject']);

	}


	}


	if(empty($post['subject']))
{
$post['subject'] = ' ';

	if(empty($post['subject']))
{
$post['subject'] = ' ';

Zeile 184Zeile 193
	}

if(!is_array($titlescache))

	}

if(!is_array($titlescache))

	{

	{

		$cached_titles = $cache->read("usertitles");
if(!empty($cached_titles))
{

		$cached_titles = $cache->read("usertitles");
if(!empty($cached_titles))
{

Zeile 199Zeile 208
			krsort($titlescache);
}
unset($usertitle, $cached_titles);

			krsort($titlescache);
}
unset($usertitle, $cached_titles);

	}

	}


// Work out the usergroup/title stuff


// Work out the usergroup/title stuff

 
	$post['groupimage'] = '';

	if(!empty($usergroup['image']))
{

	if(!empty($usergroup['image']))
{

 
		$language = $mybb->settings['bblanguage'];

		if(!empty($mybb->user['language']))
{
$language = $mybb->user['language'];
}

		if(!empty($mybb->user['language']))
{
$language = $mybb->user['language'];
}

		else
{
$language = $mybb->settings['bblanguage'];
}






		$usergroup['image'] = str_replace("{lang}", $language, $usergroup['image']);
$usergroup['image'] = str_replace("{theme}", $theme['imgdir'], $usergroup['image']);
eval("\$post['groupimage'] = \"".$templates->get("postbit_groupimage")."\";");

		$usergroup['image'] = str_replace("{lang}", $language, $usergroup['image']);
$usergroup['image'] = str_replace("{theme}", $theme['imgdir'], $usergroup['image']);
eval("\$post['groupimage'] = \"".$templates->get("postbit_groupimage")."\";");

 


		if($mybb->settings['postlayout'] == "classic")
{
$post['groupimage'] .= "<br />";

		if($mybb->settings['postlayout'] == "classic")
{
$post['groupimage'] .= "<br />";

Zeile 222Zeile 231
	}

if($post['userusername'])

	}

if($post['userusername'])

	{ // This post was made by a registered user


	{
// This post was made by a registered user

		$post['username'] = $post['userusername'];
$post['profilelink_plain'] = get_profile_link($post['uid']);
$post['username_formatted'] = format_name($post['username'], $post['usergroup'], $post['displaygroup']);

		$post['username'] = $post['userusername'];
$post['profilelink_plain'] = get_profile_link($post['uid']);
$post['username_formatted'] = format_name($post['username'], $post['usergroup'], $post['displaygroup']);

Zeile 261Zeile 270
			$post['stars'] = $usergroup['stars'];
}


			$post['stars'] = $usergroup['stars'];
}


		if(!$post['starimage'])

		if(empty($post['starimage']))

		{
$post['starimage'] = $usergroup['starimage'];
}

		{
$post['starimage'] = $usergroup['starimage'];
}

Zeile 270Zeile 279
		{
// Only display stars if we have an image to use...
$post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']);

		{
// Only display stars if we have an image to use...
$post['starimage'] = str_replace("{theme}", $theme['imgdir'], $post['starimage']);

		



$post['userstars'] = '';

			for($i = 0; $i < $post['stars']; ++$i)
{
$post['userstars'] .= "<img src=\"".$post['starimage']."\" border=\"0\" alt=\"*\" />";
}

$post['userstars'] .= "<br />";

			for($i = 0; $i < $post['stars']; ++$i)
{
$post['userstars'] .= "<img src=\"".$post['starimage']."\" border=\"0\" alt=\"*\" />";
}

$post['userstars'] .= "<br />";

		}

		}





 
		$postnum = $post['postnum'];

		$post['postnum'] = my_number_format($post['postnum']);

// Determine the status to show for the user (Online/Offline/Away)
$timecut = TIME_NOW - $mybb->settings['wolcutoff'];
if($post['lastactive'] > $timecut && ($post['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1) && $post['lastvisit'] != $post['lastactive'])

		$post['postnum'] = my_number_format($post['postnum']);

// Determine the status to show for the user (Online/Offline/Away)
$timecut = TIME_NOW - $mybb->settings['wolcutoff'];
if($post['lastactive'] > $timecut && ($post['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1) && $post['lastvisit'] != $post['lastactive'])

		{

		{

			eval("\$post['onlinestatus'] = \"".$templates->get("postbit_online")."\";");
}
else

			eval("\$post['onlinestatus'] = \"".$templates->get("postbit_online")."\";");
}
else

		{

		{

			if($post['away'] == 1 && $mybb->settings['allowaway'] != 0)
{
eval("\$post['onlinestatus'] = \"".$templates->get("postbit_away")."\";");

			if($post['away'] == 1 && $mybb->settings['allowaway'] != 0)
{
eval("\$post['onlinestatus'] = \"".$templates->get("postbit_away")."\";");

			}

			}

			else
{
eval("\$post['onlinestatus'] = \"".$templates->get("postbit_offline")."\";");

			else
{
eval("\$post['onlinestatus'] = \"".$templates->get("postbit_offline")."\";");

Zeile 300Zeile 311
		}

if($post['avatar'] != "" && ($mybb->user['showavatars'] != 0 || !$mybb->user['uid']))

		}

if($post['avatar'] != "" && ($mybb->user['showavatars'] != 0 || !$mybb->user['uid']))

		{

		{

			$post['avatar'] = htmlspecialchars_uni($post['avatar']);
$avatar_dimensions = explode("|", $post['avatardimensions']);


			$post['avatar'] = htmlspecialchars_uni($post['avatar']);
$avatar_dimensions = explode("|", $post['avatardimensions']);


Zeile 308Zeile 319
			{
list($max_width, $max_height) = explode("x", my_strtolower($mybb->settings['postmaxavatarsize']));
if($avatar_dimensions[0] > $max_width || $avatar_dimensions[1] > $max_height)

			{
list($max_width, $max_height) = explode("x", my_strtolower($mybb->settings['postmaxavatarsize']));
if($avatar_dimensions[0] > $max_width || $avatar_dimensions[1] > $max_height)

				{

				{

					require_once MYBB_ROOT."inc/functions_image.php";
$scaled_dimensions = scale_image($avatar_dimensions[0], $avatar_dimensions[1], $max_width, $max_height);
$avatar_width_height = "width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\"";

					require_once MYBB_ROOT."inc/functions_image.php";
$scaled_dimensions = scale_image($avatar_dimensions[0], $avatar_dimensions[1], $max_width, $max_height);
$avatar_width_height = "width=\"{$scaled_dimensions['width']}\" height=\"{$scaled_dimensions['height']}\"";

Zeile 321Zeile 332
			
eval("\$post['useravatar'] = \"".$templates->get("postbit_avatar")."\";");
$post['avatar_padding'] = "padding-right: 10px;";

			
eval("\$post['useravatar'] = \"".$templates->get("postbit_avatar")."\";");
$post['avatar_padding'] = "padding-right: 10px;";

		}
else
{
$post['useravatar'] = "";
}



		}
else
{
$post['useravatar'] = '';
$post['avatar_padding'] = '';
}


		eval("\$post['button_find'] = \"".$templates->get("postbit_find")."\";");

if($mybb->settings['enablepms'] == 1 && $post['receivepms'] != 0 && $mybb->usergroup['cansendpms'] == 1 && my_strpos(",".$post['ignorelist'].",", ",".$mybb->user['uid'].",") === false)
{
eval("\$post['button_pm'] = \"".$templates->get("postbit_pm")."\";");

		eval("\$post['button_find'] = \"".$templates->get("postbit_find")."\";");

if($mybb->settings['enablepms'] == 1 && $post['receivepms'] != 0 && $mybb->usergroup['cansendpms'] == 1 && my_strpos(",".$post['ignorelist'].",", ",".$mybb->user['uid'].",") === false)
{
eval("\$post['button_pm'] = \"".$templates->get("postbit_pm")."\";");

		}

if($mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1)
{

		}

if($mybb->settings['enablereputation'] == 1 && $mybb->settings['postrep'] == 1 && $mybb->usergroup['cangivereputations'] == 1 && $usergroup['usereputationsystem'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']) && $post['uid'] != $mybb->user['uid'])
{

			if(!$post['pid'])
{
$post['pid'] = 0;
}

eval("\$post['button_rep'] = \"".$templates->get("postbit_rep_button")."\";");

			if(!$post['pid'])
{
$post['pid'] = 0;
}

eval("\$post['button_rep'] = \"".$templates->get("postbit_rep_button")."\";");

		}


		}


		if($post['website'] != "")

		if($post['website'] != "")

		{

		{

			$post['website'] = htmlspecialchars_uni($post['website']);
eval("\$post['button_www'] = \"".$templates->get("postbit_www")."\";");
}
else
{
$post['button_www'] = "";

			$post['website'] = htmlspecialchars_uni($post['website']);
eval("\$post['button_www'] = \"".$templates->get("postbit_www")."\";");
}
else
{
$post['button_www'] = "";

		}

		}

		
if($post['hideemail'] != 1 && $mybb->usergroup['cansendemail'] == 1)
{

		
if($post['hideemail'] != 1 && $mybb->usergroup['cansendemail'] == 1)
{

Zeile 366Zeile 378
		$post['userregdate'] = my_date($mybb->settings['regdateformat'], $post['regdate']);

// Work out the reputation this user has (only show if not announcement)

		$post['userregdate'] = my_date($mybb->settings['regdateformat'], $post['regdate']);

// Work out the reputation this user has (only show if not announcement)

		if($post_type != 3 && $usergroup['usereputationsystem'] != 0 && $mybb->settings['enablereputation'] == 1)

		if($post_type != 3 && $usergroup['usereputationsystem'] != 0 && $mybb->settings['enablereputation'] == 1 && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']))

		{
$post['userreputation'] = get_reputation($post['reputation'], $post['uid']);
eval("\$post['replink'] = \"".$templates->get("postbit_reputation")."\";");

		{
$post['userreputation'] = get_reputation($post['reputation'], $post['uid']);
eval("\$post['replink'] = \"".$templates->get("postbit_reputation")."\";");

		}


		}


		// Showing the warning level? (only show if not announcement)
if($post_type != 3 && $mybb->settings['enablewarningsystem'] != 0 && $usergroup['canreceivewarnings'] != 0 && ($mybb->usergroup['canwarnusers'] != 0 || ($mybb->user['uid'] == $post['uid'] && $mybb->settings['canviewownwarning'] != 0)))
{

		// Showing the warning level? (only show if not announcement)
if($post_type != 3 && $mybb->settings['enablewarningsystem'] != 0 && $usergroup['canreceivewarnings'] != 0 && ($mybb->usergroup['canwarnusers'] != 0 || ($mybb->user['uid'] == $post['uid'] && $mybb->settings['canviewownwarning'] != 0)))
{

Zeile 450Zeile 462
	if(!$post_type)
{
// Figure out if we need to show an "edited by" message

	if(!$post_type)
{
// Figure out if we need to show an "edited by" message

 
		$post['editedmsg'] = '';

		if($post['edituid'] != 0 && $post['edittime'] != 0 && $post['editusername'] != "" && ($mybb->settings['showeditedby'] != 0 && $usergroup['cancp'] == 0 || $mybb->settings['showeditedbyadmin'] != 0 && $usergroup['cancp'] == 1))
{
$post['editdate'] = my_date($mybb->settings['dateformat'], $post['edittime']);

		if($post['edituid'] != 0 && $post['edittime'] != 0 && $post['editusername'] != "" && ($mybb->settings['showeditedby'] != 0 && $usergroup['cancp'] == 0 || $mybb->settings['showeditedbyadmin'] != 0 && $usergroup['cancp'] == 1))
{
$post['editdate'] = my_date($mybb->settings['dateformat'], $post['edittime']);

Zeile 486Zeile 499
		// Inline moderation stuff
if($ismod)
{

		// Inline moderation stuff
if($ismod)
{

			if(my_strpos($mybb->cookies[$inlinecookie], "|".$post['pid']."|"))

			if(isset($mybb->cookies[$inlinecookie]) && my_strpos($mybb->cookies[$inlinecookie], "|".$post['pid']."|"))

			{
$inlinecheck = "checked=\"checked\"";
$inlinecount++;

			{
$inlinecheck = "checked=\"checked\"";
$inlinecount++;

Zeile 561Zeile 574
	}

// If we have incoming search terms to highlight - get it done.

	}

// If we have incoming search terms to highlight - get it done.

	if($mybb->input['highlight'])

	if(!empty($mybb->input['highlight']))

	{
$parser_options['highlight'] = $mybb->input['highlight'];
$post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']);

	{
$parser_options['highlight'] = $mybb->input['highlight'];
$post['subject'] = $parser->highlight_message($post['subject'], $parser_options['highlight']);

Zeile 571Zeile 584

get_post_attachments($id, $post);



get_post_attachments($id, $post);


	if($post['includesig'] != 0 && $post['username'] && $post['signature'] != "" && ($mybb->user['uid'] == 0 || $mybb->user['showsigs'] != 0) && ($post['suspendsignature'] == 0 || $post['suspendsignature'] == 1 && $post['suspendsigtime'] != 0 && $post['suspendsigtime'] < TIME_NOW))

	if($post['includesig'] != 0 && $post['username'] && $post['signature'] != "" && ($mybb->user['uid'] == 0 || $mybb->user['showsigs'] != 0) && ($post['suspendsignature'] == 0 || $post['suspendsignature'] == 1 && $post['suspendsigtime'] != 0 && $post['suspendsigtime'] < TIME_NOW) && $usergroup['canusesig'] == 1 && ($usergroup['canusesigxposts'] == 0 || $usergroup['canusesigxposts'] > 0 && $postnum > $usergroup['canusesigxposts']))

	{
$sig_parser = array(
"allow_html" => $mybb->settings['sightml'],
"allow_mycode" => $mybb->settings['sigmycode'],
"allow_smilies" => $mybb->settings['sigsmilies'],
"allow_imgcode" => $mybb->settings['sigimgcode'],

	{
$sig_parser = array(
"allow_html" => $mybb->settings['sightml'],
"allow_mycode" => $mybb->settings['sigmycode'],
"allow_smilies" => $mybb->settings['sigsmilies'],
"allow_imgcode" => $mybb->settings['sigimgcode'],

			"me_username" => $post['username']


			"me_username" => $post['username'],
"filter_badwords" => 1

		);

		);

 

if($usergroup['signofollow'])
{
$sig_parser['nofollow_on'] = 1;
}


$post['signature'] = $parser->parse_message($post['signature'], $sig_parser);
eval("\$post['signature'] = \"".$templates->get("postbit_signature")."\";");


$post['signature'] = $parser->parse_message($post['signature'], $sig_parser);
eval("\$post['signature'] = \"".$templates->get("postbit_signature")."\";");

Zeile 608Zeile 627
	switch($post_type)
{
case 1: // Message preview

	switch($post_type)
{
case 1: // Message preview

			$plugins->run_hooks_by_ref("postbit_prev", $post);

			$post = $plugins->run_hooks("postbit_prev", $post);

			break;
case 2: // Private message

			break;
case 2: // Private message

			$plugins->run_hooks_by_ref("postbit_pm", $post);

			$post = $plugins->run_hooks("postbit_pm", $post);

			break;
case 3: // Announcement

			break;
case 3: // Announcement

			$plugins->run_hooks_by_ref("postbit_announcement", $post);

			$post = $plugins->run_hooks("postbit_announcement", $post);

			break;
default: // Regular post

			break;
default: // Regular post

			$plugins->run_hooks_by_ref("postbit", $post);

			$post = $plugins->run_hooks("postbit", $post);


// Is this author on the ignore list of the current user? Hide this post


// Is this author on the ignore list of the current user? Hide this post

			if(is_array($ignored_users) && $post['uid'] != 0 && $ignored_users[$post['uid']] == 1)


			$ignore_bit = '';
if(is_array($ignored_users) && $post['uid'] != 0 && isset($ignored_users[$post['uid']]) && $ignored_users[$post['uid']] == 1)

			{
$ignored_message = $lang->sprintf($lang->postbit_currently_ignoring_user, $post['username']);
eval("\$ignore_bit = \"".$templates->get("postbit_ignored")."\";");

			{
$ignored_message = $lang->sprintf($lang->postbit_currently_ignoring_user, $post['username']);
eval("\$ignore_bit = \"".$templates->get("postbit_ignored")."\";");

Zeile 655Zeile 675

$validationcount = 0;
$tcount = 0;


$validationcount = 0;
$tcount = 0;

	if(is_array($attachcache[$id]))

	if(isset($attachcache[$id]) && is_array($attachcache[$id]))

	{ // This post has 1 or more attachments
foreach($attachcache[$id] as $aid => $attachment)
{

	{ // This post has 1 or more attachments
foreach($attachcache[$id] as $aid => $attachment)
{