Vergleich inc/functions_post.php - 1.6.4 - 1.6.17

  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 50Zeile 59
	{
case 1: // Message preview
global $forum;

	{
case 1: // Message preview
global $forum;

			$parser_options['allow_html'] = $forum['allowhtml'];

			$parser_options['allow_html'] = $forum['allowhtml'];

			$parser_options['allow_mycode'] = $forum['allowmycode'];
$parser_options['allow_smilies'] = $forum['allowsmilies'];
$parser_options['allow_imgcode'] = $forum['allowimgcode'];

			$parser_options['allow_mycode'] = $forum['allowmycode'];
$parser_options['allow_smilies'] = $forum['allowsmilies'];
$parser_options['allow_imgcode'] = $forum['allowimgcode'];

Zeile 58Zeile 67
			$parser_options['me_username'] = $post['username'];
$parser_options['filter_badwords'] = 1;
$id = 0;

			$parser_options['me_username'] = $post['username'];
$parser_options['filter_badwords'] = 1;
$id = 0;

			break;

			break;

		case 2: // Private message
global $message, $pmid;
$parser_options['allow_html'] = $mybb->settings['pmsallowhtml'];

		case 2: // Private message
global $message, $pmid;
$parser_options['allow_html'] = $mybb->settings['pmsallowhtml'];

Zeile 66Zeile 75
			$parser_options['allow_smilies'] = $mybb->settings['pmsallowsmilies'];
$parser_options['allow_imgcode'] = $mybb->settings['pmsallowimgcode'];
$parser_options['allow_videocode'] = $mybb->settings['pmsallowvideocode'];

			$parser_options['allow_smilies'] = $mybb->settings['pmsallowsmilies'];
$parser_options['allow_imgcode'] = $mybb->settings['pmsallowimgcode'];
$parser_options['allow_videocode'] = $mybb->settings['pmsallowvideocode'];

			$parser_options['me_username'] = $post['username'];
$parser_options['filter_badwords'] = 1;

			$parser_options['me_username'] = $post['username'];
$parser_options['filter_badwords'] = 1;

			$id = $pmid;
break;
case 3: // Announcement

			$id = $pmid;
break;
case 3: // Announcement

Zeile 92Zeile 101
			$parser_options['filter_badwords'] = 1;

if(!$post['username'])

			$parser_options['filter_badwords'] = 1;

if(!$post['username'])

			{

			{

				$post['username'] = $lang->guest;
}


				$post['username'] = $lang->guest;
}


Zeile 121Zeile 130
	{ // Used to show the # of the post
if($page > 1)
{

	{ // Used to show the # of the post
if($page > 1)
{

			if(!$mybb->settings['postsperpage'])

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

			{

			{

				$mybb->settings['postperpage'] = 20;

				$mybb->settings['postsperpage'] = 20;

			}

$postcounter = $mybb->settings['postsperpage']*($page-1);

			}

$postcounter = $mybb->settings['postsperpage']*($page-1);

Zeile 202Zeile 211
	}

// 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 />";
}
}





	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 232Zeile 241
		if(trim($post['usertitle']) != "")
{
$hascustomtitle = 1;

		if(trim($post['usertitle']) != "")
{
$hascustomtitle = 1;

		}

		}

		
if($usergroup['usertitle'] != "" && !$hascustomtitle)
{

		
if($usergroup['usertitle'] != "" && !$hascustomtitle)
{

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


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


		if(!$post['starimage'])

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

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

if($post['starimage'] && $post['stars'])

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

if($post['starimage'] && $post['stars'])

		{

		{

			// 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=\"*\" />";

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

			}


			}


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

			$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

Zeile 292Zeile 303
			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 317Zeile 328
				{
$avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";
}

				{
$avatar_width_height = "width=\"{$avatar_dimensions[0]}\" height=\"{$avatar_dimensions[1]}\"";
}

			}

			}

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

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


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


		
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($post_type != 3 && $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'])
{

		{
if(!$post['pid'])
{

Zeile 345Zeile 357
		}

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

		}

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

		{

		{

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

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

		}

		}

		else
{
$post['button_www'] = "";

		else
{
$post['button_www'] = "";

		}


		}


		if($post['hideemail'] != 1 && $mybb->usergroup['cansendemail'] == 1)
{
eval("\$post['button_email'] = \"".$templates->get("postbit_email")."\";");

		if($post['hideemail'] != 1 && $mybb->usergroup['cansendemail'] == 1)
{
eval("\$post['button_email'] = \"".$templates->get("postbit_email")."\";");

Zeile 370Zeile 382
		{
$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 399Zeile 411
	}
else
{ // Message was posted by a guest or an unknown user

	}
else
{ // Message was posted by a guest or an unknown user

		$post['username'] = $post['username'];

 
		$post['profilelink'] = format_name($post['username'], 1);

if($usergroup['usertitle'])

		$post['profilelink'] = format_name($post['username'], 1);

if($usergroup['usertitle'])

Zeile 450Zeile 461
	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

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


		$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']);
$post['edittime'] = my_date($mybb->settings['timeformat'], $post['edittime']);

		{
$post['editdate'] = my_date($mybb->settings['dateformat'], $post['edittime']);
$post['edittime'] = my_date($mybb->settings['timeformat'], $post['edittime']);

Zeile 486Zeile 498
		// 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 573
	}

// 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 583

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 626
	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 674

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