Vergleich inc/datahandlers/post.php - 1.4.1 - 1.4.4

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * 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: post.php 4092 2008-08-10 03:03:04Z Tikitiki $

 * $Id: post.php 4276 2008-11-23 03:01:33Z Tikitiki $

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 309Zeile 309
		global $mybb, $db, $session;

$post = &$this->data;

		global $mybb, $db, $session;

$post = &$this->data;

 
		
// Are we starting a new thread?
if(!$post['tid'])
{
return true;
}

		
// Are we even turned on?
if(empty($mybb->settings['postmergemins']))

		
// Are we even turned on?
if(empty($mybb->settings['postmergemins']))

		{

		{

			return true;

			return true;

		}

		}

		
// Assign a default separator if none is specified
if(trim($mybb->settings['postmergesep']) == "")

		
// Assign a default separator if none is specified
if(trim($mybb->settings['postmergesep']) == "")

		{

		{

			$mybb->settings['postmergesep'] = "[hr]";
}


			$mybb->settings['postmergesep'] = "[hr]";
}


Zeile 326Zeile 332
		if(trim($mybb->settings['postmergeuignore']) != "")
{
$gids = explode(',', $mybb->settings['postmergeuignore']);

		if(trim($mybb->settings['postmergeuignore']) != "")
{
$gids = explode(',', $mybb->settings['postmergeuignore']);

			array_walk($gids, 'intval');


			$gids = array_map('intval', $gids);


			
$user_usergroups = explode(',', $mybb->user['usergroup'].",".$mybb->user['additionalgroups']);
if(count(array_intersect($user_usergroups, $gids)) > 0)

			
$user_usergroups = explode(',', $mybb->user['usergroup'].",".$mybb->user['additionalgroups']);
if(count(array_intersect($user_usergroups, $gids)) > 0)

Zeile 342Zeile 348
		
// Check to see if the same author has posted within the merge post time limit
if((intval($mybb->settings['postmergemins']) != 0 && trim($mybb->settings['postmergemins']) != "") && (TIME_NOW-$thread['lastpost']) > (intval($mybb->settings['postmergemins'])*60))

		
// Check to see if the same author has posted within the merge post time limit
if((intval($mybb->settings['postmergemins']) != 0 && trim($mybb->settings['postmergemins']) != "") && (TIME_NOW-$thread['lastpost']) > (intval($mybb->settings['postmergemins'])*60))

		{
return true;

		{
return true;

		}

if(strstr($mybb->settings['postmergefignore'], ','))

		}

if(strstr($mybb->settings['postmergefignore'], ','))

Zeile 352Zeile 358
			foreach($fids as $key => $forumid)
{
$fid[] = intval($forumid);

			foreach($fids as $key => $forumid)
{
$fid[] = intval($forumid);

			}


			}


			if(in_array($thread['fid'], $fid))
{
return true;
}


			if(in_array($thread['fid'], $fid))
{
return true;
}


		}

		}

		else if(trim($mybb->settings['postmergefignore']) != "" && $thread['fid'] == intval($mybb->settings['postmergefignore']))

		else if(trim($mybb->settings['postmergefignore']) != "" && $thread['fid'] == intval($mybb->settings['postmergefignore']))

		{

		{

			return true;

			return true;

		}

		}

		
if($simple_mode == true)
{

		
if($simple_mode == true)
{

Zeile 375Zeile 381
			$user_check = "uid='".$post['uid']."'";
}
else

			$user_check = "uid='".$post['uid']."'";
}
else

		{

		{

			$user_check = "ipaddress='".$db->escape_string($session->ipaddress)."'";
}


			$user_check = "ipaddress='".$db->escape_string($session->ipaddress)."'";
}


Zeile 391Zeile 397
	function verify_image_count()
{
global $mybb, $db;

	function verify_image_count()
{
global $mybb, $db;





		$post = &$this->data;

// Get the permissions of the user who is making this post or thread

		$post = &$this->data;

// Get the permissions of the user who is making this post or thread

Zeile 421Zeile 427
			else
{
$parser_options['allow_smilies'] = 0;

			else
{
$parser_options['allow_smilies'] = 0;

			}

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

			}

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


// And count the number of image tags in the message.
$image_count = substr_count($image_check, "<img");


// And count the number of image tags in the message.
$image_count = substr_count($image_check, "<img");

Zeile 438Zeile 444

/**
* Verify the reply-to post.


/**
* Verify the reply-to post.

	*
* @return boolean True when valid, false when not valid.

	*
* @return boolean True when valid, false when not valid.

	*/
function verify_reply_to()
{

	*/
function verify_reply_to()
{

Zeile 449Zeile 455
		// Check if the post being replied to actually exists in this thread.
if($post['replyto'])
{

		// Check if the post being replied to actually exists in this thread.
if($post['replyto'])
{

			$query = $db->simple_select("posts", "pid", "pid='{$post['replyto']}'");

			$query = $db->simple_select("posts", "pid", "pid='".intval($post['replyto'])."'");

			$valid_post = $db->fetch_array($query);
if(!$valid_post['pid'])
{
$post['replyto'] = 0;

			$valid_post = $db->fetch_array($query);
if(!$valid_post['pid'])
{
$post['replyto'] = 0;

			}

			}

			else
{
return true;

			else
{
return true;

Zeile 486Zeile 492
	function verify_post_icon()
{
global $cache;

	function verify_post_icon()
{
global $cache;





		$post = &$this->data;

// If we don't assign it as 0.

		$post = &$this->data;

// If we don't assign it as 0.

Zeile 566Zeile 572
		}

if($this->method == "insert" || array_key_exists('options', $post))

		}

if($this->method == "insert" || array_key_exists('options', $post))

		{
$this->verify_options();
}


		{
$this->verify_options();
}


		$plugins->run_hooks_by_ref("datahandler_post_validate_post", $this);

// We are done validating, return.
$this->set_validated(true);
if(count($this->get_errors()) > 0)

		$plugins->run_hooks_by_ref("datahandler_post_validate_post", $this);

// We are done validating, return.
$this->set_validated(true);
if(count($this->get_errors()) > 0)

		{

		{

			return false;
}
else
{
return true;

			return false;
}
else
{
return true;

		}

		}

	}



	}



Zeile 659Zeile 665

// Stick the thread.
if($modoptions['stickthread'] == 1 && $thread['sticky'] != 1)


// Stick the thread.
if($modoptions['stickthread'] == 1 && $thread['sticky'] != 1)

				{

				{

					$newstick = "sticky='1'";
log_moderator_action($modlogdata, $lang->thread_stuck);

					$newstick = "sticky='1'";
log_moderator_action($modlogdata, $lang->thread_stuck);

				}

				}


// Unstick the thread.
if($modoptions['stickthread'] != 1 && $thread['sticky'])


// Unstick the thread.
if($modoptions['stickthread'] != 1 && $thread['sticky'])

				{

				{

					$newstick = "sticky='0'";					
log_moderator_action($modlogdata, $lang->thread_unstuck);
}

					$newstick = "sticky='0'";					
log_moderator_action($modlogdata, $lang->thread_unstuck);
}

Zeile 675Zeile 681
				if($newstick && $newclosed)
{
$sep = ",";

				if($newstick && $newclosed)
{
$sep = ",";

				}

				}

				if($newstick || $newclosed)
{
$db->write_query("

				if($newstick || $newclosed)
{
$db->write_query("

Zeile 684Zeile 690
						WHERE tid='{$thread['tid']}'
");
}

						WHERE tid='{$thread['tid']}'
");
}

			}


			}


			// Fetch the forum this post is being made in
$forum = get_forum($post['fid']);

// Decide on the visibility of this post.
if($forum['modposts'] == 1 && !is_moderator($thread['fid'], "", $post['uid']))

			// Fetch the forum this post is being made in
$forum = get_forum($post['fid']);

// Decide on the visibility of this post.
if($forum['modposts'] == 1 && !is_moderator($thread['fid'], "", $post['uid']))

			{
$visible = 0;
}
else
{
$visible = 1;
}


			{
$visible = 0;
}
else
{
$visible = 1;
}


			// Are posts from this user being moderated? Change visibility
if($mybb->user['uid'] == $post['uid'] && $mybb->user['moderateposts'] == 1)
{

			// Are posts from this user being moderated? Change visibility
if($mybb->user['uid'] == $post['uid'] && $mybb->user['moderateposts'] == 1)
{

Zeile 788Zeile 794
				"uid" => $post['uid'],
"username" => $db->escape_string($post['username']),
"dateline" => intval($post['dateline']),

				"uid" => $post['uid'],
"username" => $db->escape_string($post['username']),
"dateline" => intval($post['dateline']),

				"message" => $db->escape_string($post['message']),
"ipaddress" => $db->escape_string($post['ipaddress']),
"longipaddress" => intval(ip2long($post['ipaddress'])),
"includesig" => $post['options']['signature'],
"smilieoff" => $post['options']['disablesmilies'],
"visible" => $visible,
"posthash" => $db->escape_string($post['posthash'])

				"message" => $db->escape_string($post['message']),
"ipaddress" => $db->escape_string($post['ipaddress']),
"longipaddress" => intval(ip2long($post['ipaddress'])),
"includesig" => $post['options']['signature'],
"smilieoff" => $post['options']['disablesmilies'],
"visible" => $visible,
"posthash" => $db->escape_string($post['posthash'])

			);

$plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);

			);

$plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);

Zeile 824Zeile 830
			);

$plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);

			);

$plugins->run_hooks_by_ref("datahandler_post_insert_post", $this);


$this->pid = $db->insert_query("posts", $this->post_insert_data);
}


$this->pid = $db->insert_query("posts", $this->post_insert_data);
}

		

// Assign any uploaded attachments with the specific posthash to the newly created post.

		

// Assign any uploaded attachments with the specific posthash to the newly created post.

Zeile 874Zeile 880
				elseif($mybb->settings['orig_bblanguage'])
{
$uselang = $mybb->settings['orig_bblanguage'];

				elseif($mybb->settings['orig_bblanguage'])
{
$uselang = $mybb->settings['orig_bblanguage'];

				}
else

				}
else

				{
$uselang = "english";
}

				{
$uselang = "english";
}

Zeile 923Zeile 929
			// Update forum count
update_thread_counters($post['tid'], $thread_update);
update_forum_counters($post['fid'], array("posts" => "+1"));

			// Update forum count
update_thread_counters($post['tid'], $thread_update);
update_forum_counters($post['fid'], array("posts" => "+1"));

		}

		}

		// Post is stuck in moderation queue
else if($visible == 0)
{

		// Post is stuck in moderation queue
else if($visible == 0)
{

Zeile 955Zeile 961
		if(!$thread['savedraft'])
{
$this->verify_post_flooding();

		if(!$thread['savedraft'])
{
$this->verify_post_flooding();

		}

		}


if($this->method == "insert" || array_key_exists('uid', $thread))
{


if($this->method == "insert" || array_key_exists('uid', $thread))
{

Zeile 986Zeile 992
		if($this->method == "insert" || array_key_exists('options', $thread))
{
$this->verify_options();

		if($this->method == "insert" || array_key_exists('options', $thread))
{
$this->verify_options();

		}

		}


$plugins->run_hooks_by_ref("datahandler_post_validate_thread", $this);



$plugins->run_hooks_by_ref("datahandler_post_validate_thread", $this);


Zeile 1017Zeile 1023
			die("The thread needs to be validated before inserting it into the DB.");
}
if(count($this->get_errors()) > 0)

			die("The thread needs to be validated before inserting it into the DB.");
}
if(count($this->get_errors()) > 0)

		{

		{

			die("The thread is not valid.");

			die("The thread is not valid.");

		}

$thread = &$this->data;


		}

$thread = &$this->data;


		// Fetch the forum this thread is being made in
$forum = get_forum($thread['fid']);


		// Fetch the forum this thread is being made in
$forum = get_forum($thread['fid']);


Zeile 1033Zeile 1039
		}

// Thread is being made now and we have a bit to do.

		}

// Thread is being made now and we have a bit to do.

		else

		else

		{

// Decide on the visibility of this post.

		{

// Decide on the visibility of this post.

Zeile 1081Zeile 1087
				"lastpost" => intval($thread['dateline']),
"lastposter" => $db->escape_string($thread['username']),
"visible" => $visible

				"lastpost" => intval($thread['dateline']),
"lastposter" => $db->escape_string($thread['username']),
"visible" => $visible

			);

$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);


			);

$plugins->run_hooks_by_ref("datahandler_post_insert_thread", $this);


			$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");

$this->post_insert_data = array(

			$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");

$this->post_insert_data = array(

Zeile 1331Zeile 1337
		
if($visible == 1)
{

		
if($visible == 1)
{

			$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");
if($attachmentcount > 0)
{
update_thread_counters($this->tid, array("attachmentcount" => "+{$attachmentcount}"));
}


 
			update_thread_data($this->tid);
update_forum_counters($thread['fid'], array("threads" => "+1", "posts" => "+1"));

			update_thread_data($this->tid);
update_forum_counters($thread['fid'], array("threads" => "+1", "posts" => "+1"));

		}

		}

		else if($visible == 0)
{
update_thread_data($this->tid);
update_thread_counters($thread['tid'], array("replies" => 0, "unapprovedposts" => 1));
update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));

		else if($visible == 0)
{
update_thread_data($this->tid);
update_thread_counters($thread['tid'], array("replies" => 0, "unapprovedposts" => 1));
update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));

 
		}

$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");
if($attachmentcount > 0)
{
update_thread_counters($this->tid, array("attachmentcount" => "+{$attachmentcount}"));

		}

// Return the post's pid and whether or not it is visible.

		}

// Return the post's pid and whether or not it is visible.

Zeile 1526Zeile 1532
		}
else
{

		}
else
{

			$db->delete_query("threadsubscriptions", "uid='{$post['uid']}' AND tid='{$post['tid']}'");

			$db->delete_query("threadsubscriptions", "uid='".intval($post['uid'])."' AND tid='".intval($post['tid'])."'");

		}

update_forum_lastpost($post['fid']);

		}

update_forum_lastpost($post['fid']);