Vergleich inc/datahandlers/post.php - 1.4.5 - 1.4.15

  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 4328 2009-03-09 21:58:37Z Tikitiki $

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

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 404Zeile 404
		$permissions = user_permissions($post['uid']);

// Fetch the forum this post is being made in

		$permissions = user_permissions($post['uid']);

// Fetch the forum this post is being made in

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

		$forum = get_forum($post['fid']);

		$forum = get_forum($post['fid']);





		// Check if this post contains more images than the forum allows
if($post['savedraft'] != 1 && $mybb->settings['maxpostimages'] != 0 && $permissions['cancp'] != 1)
{

		// Check if this post contains more images than the forum allows
if($post['savedraft'] != 1 && $mybb->settings['maxpostimages'] != 0 && $permissions['cancp'] != 1)
{

Zeile 418Zeile 423
				"allow_mycode" => $forum['allowmycode'],
"allow_imgcode" => $forum['allowimgcode'],
"filter_badwords" => 1

				"allow_mycode" => $forum['allowmycode'],
"allow_imgcode" => $forum['allowimgcode'],
"filter_badwords" => 1

			);

			);


if($post['options']['disablesmilies'] != 1)
{


if($post['options']['disablesmilies'] != 1)
{

Zeile 444Zeile 449

/**
* 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()
{
global $db;

	function verify_reply_to()
{
global $db;

Zeile 460Zeile 465
			if(!$valid_post['pid'])
{
$post['replyto'] = 0;

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

			}

			}

			else
{
return true;

			else
{
return true;

Zeile 516Zeile 521
		if($dateline < 0 || is_numeric($dateline) == false)
{
$dateline = TIME_NOW;

		if($dateline < 0 || is_numeric($dateline) == false)
{
$dateline = TIME_NOW;

		}
}

		}
}


/**
* Validate a post.


/**
* Validate a post.

Zeile 543Zeile 548
		if($this->method == "insert" || array_key_exists('uid', $post))
{
$this->verify_author();

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

		}

		}


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


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

Zeile 569Zeile 574
		if($this->method == "insert" || array_key_exists('icon', $post))
{
$this->verify_post_icon();

		if($this->method == "insert" || array_key_exists('icon', $post))
{
$this->verify_post_icon();

		}


		}


		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.

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

// We are done validating, return.

Zeile 583Zeile 588
		if(count($this->get_errors()) > 0)
{
return false;

		if(count($this->get_errors()) > 0)
{
return false;

		}
else

		}
else

		{
return true;
}

		{
return true;
}

Zeile 625Zeile 630
			if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)
{
switch($post['options']['subscriptionmethod'])

			if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)
{
switch($post['options']['subscriptionmethod'])

				{
case "instant":
$notification = 1;
break;
default:
$notification = 0;
}

				{
case "instant":
$notification = 1;
break;
default:
$notification = 0;
}


require_once MYBB_ROOT."inc/functions_user.php";
add_subscribed_thread($post['tid'], $notification, $post['uid']);


require_once MYBB_ROOT."inc/functions_user.php";
add_subscribed_thread($post['tid'], $notification, $post['uid']);

Zeile 703Zeile 708
			else
{
$visible = 1;

			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 716Zeile 721
		{
$double_post = $this->verify_post_merge();


		{
$double_post = $this->verify_post_merge();


 
			// Only combine if they are both invisible (mod queue'd forum) or both visible

			if($double_post !== true && $double_post['visible'] == $visible)
{

			if($double_post !== true && $double_post['visible'] == $visible)
{

				// Only combine if they are both invisible (mod queue'd forum) or both visible
$double_post['message'] .= $mybb->settings['postmergesep']."\n".$post['message'];


				$this->pid = $double_post['pid'];

$post['message'] = $double_post['message'] .= $mybb->settings['postmergesep']."\n".$post['message'];

				$update_query = array(
"message" => $db->escape_string($double_post['message'])
);

				$update_query = array(
"message" => $db->escape_string($double_post['message'])
);

Zeile 747Zeile 754
						"posthash" => $double_post['posthash'],
);
$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}'");

						"posthash" => $double_post['posthash'],
);
$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}'");

				}



				
$post['posthash'] = $double_post['posthash'];
}

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

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

Zeile 859Zeile 868

// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices
$query = $db->query("


// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices
$query = $db->query("

				SELECT u.username, u.email, u.uid, u.language, s.subscriptionkey

				SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.subscriptionkey

				FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
WHERE s.notification='1' AND s.tid='{$post['tid']}'

				FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
WHERE s.notification='1' AND s.tid='{$post['tid']}'

Zeile 914Zeile 923
					$emailmessage = $langcache[$uselang]['email_subscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $subject);

					$emailmessage = $langcache[$uselang]['email_subscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $subject);

				$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&amp;", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey']);



				
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&amp;", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code);

				$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',

				$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',

Zeile 1085Zeile 1096

// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
if($draft_check)


// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
if($draft_check)

		{
$this->thread_insert_data = array(
"subject" => $db->escape_string($thread['subject']),
"icon" => intval($thread['icon']),
"username" => $db->escape_string($thread['username']),
"dateline" => intval($thread['dateline']),
"lastpost" => intval($thread['dateline']),

		{
$this->thread_insert_data = array(
"subject" => $db->escape_string($thread['subject']),
"icon" => intval($thread['icon']),
"username" => $db->escape_string($thread['username']),
"dateline" => intval($thread['dateline']),
"lastpost" => intval($thread['dateline']),

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

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

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


$this->post_insert_data = array(
"subject" => $db->escape_string($thread['subject']),
"icon" => intval($thread['icon']),
"username" => $db->escape_string($thread['username']),
"dateline" => intval($thread['dateline']),
"message" => $db->escape_string($thread['message']),
"ipaddress" => $db->escape_string(get_ip()),


$this->post_insert_data = array(
"subject" => $db->escape_string($thread['subject']),
"icon" => intval($thread['icon']),
"username" => $db->escape_string($thread['username']),
"dateline" => intval($thread['dateline']),
"message" => $db->escape_string($thread['message']),
"ipaddress" => $db->escape_string(get_ip()),

				"includesig" => $thread['options']['signature'],
"smilieoff" => $thread['options']['disablesmilies'],
"visible" => $visible,

				"includesig" => $thread['options']['signature'],
"smilieoff" => $thread['options']['disablesmilies'],
"visible" => $visible,

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

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

				}

				}


// Execute moderation options.
if($newstick && $newclosed)


// Execute moderation options.
if($newstick && $newclosed)

Zeile 1248Zeile 1259
				}

if(!$forum['lastpost'])

				}

if(!$forum['lastpost'])

				{

				{

					$forum['lastpost'] = 0;
}


					$forum['lastpost'] = 0;
}


Zeile 1263Zeile 1274
				$excerpt = $parser->parse_badwords($excerpt);

$query = $db->query("

				$excerpt = $parser->parse_badwords($excerpt);

$query = $db->query("

					SELECT u.username, u.email, u.uid, u.language

					SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate

					FROM ".TABLE_PREFIX."forumsubscriptions fs
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=fs.uid)
LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)

					FROM ".TABLE_PREFIX."forumsubscriptions fs
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=fs.uid)
LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)

Zeile 1292Zeile 1303
						$uselang = $subscribedmember['language'];
}
else if($mybb->settings['bblanguage'])

						$uselang = $subscribedmember['language'];
}
else if($mybb->settings['bblanguage'])

					{

					{

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

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

Zeile 1321Zeile 1332
						$emailmessage = $langcache[$uselang]['email_forumsubscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $forum['name']);

						$emailmessage = $langcache[$uselang]['email_forumsubscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $forum['name']);

					$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], get_thread_link($this->tid), $thread['fid']);



					
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], get_thread_link($this->tid), $thread['fid'], $post_code);

					$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',

					$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',

Zeile 1359Zeile 1372
		else if($visible == 0)
{
update_thread_data($this->tid);

		else if($visible == 0)
{
update_thread_data($this->tid);

			update_thread_counters($thread['tid'], array("replies" => 0, "unapprovedposts" => 1));

			update_thread_counters($this->tid, array("replies" => 0, "unapprovedposts" => 1));

			update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));
}


			update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));
}