Vergleich inc/datahandlers/post.php - 1.2.2 - 1.2.3

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * $Id: post.php 2394 2006-11-10 04:55:06Z Tikitiki $

 * $Id: post.php 2729 2007-02-07 23:02:29Z Tikitiki $

 */

/*

 */

/*

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

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

			if($post['options']['disablesmilies'] == "yes")
{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

// Parse the message.
$parser_options = array(
"allow_html" => $forum['allowhtml'],
"allow_mycode" => $forum['allowmycode'],
"allow_smilies" => $forum['allowmilies'],
"allow_imgcode" => $forum['allowimgcode']
);

			require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;















				$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");
if($image_count > $mybb->settings['maxpostimages'])
{
// Throw back a message if over the count with the number of images as well as the maximum number of images per post.
$this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));
return false;
}








			// Parse the message.
$parser_options = array(
"allow_html" => $forum['allowhtml'],
"allow_mycode" => $forum['allowmycode'],
"allow_imgcode" => $forum['allowimgcode']
);

if($post['options']['disablesmilies'] != "yes")
{
$parser_options['allow_smilies'] = $forum['allowsmilies'];
}
else
{
$parser_options['allow_smilies'] = "no";
}

$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");
if($image_count > $mybb->settings['maxpostimages'])
{
// Throw back a message if over the count with the number of images as well as the maximum number of images per post.
$this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));
return false;

			}
}
}

			}
}
}

Zeile 618Zeile 622
				"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']),
"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']),
"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 698Zeile 702
					$uselang = $subscribedmember['language'];
}
elseif($mybb->settings['bblanguage'])

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

				{

				{

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

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

Zeile 721Zeile 725
						$userlang->load("messages");
$langcache[$uselang]['emailsubject_subscription'] = $userlang->emailsubject_subscription;
$langcache[$uselang]['email_subscription'] = $userlang->email_subscription;

						$userlang->load("messages");
$langcache[$uselang]['emailsubject_subscription'] = $userlang->emailsubject_subscription;
$langcache[$uselang]['email_subscription'] = $userlang->email_subscription;

						unset($userlang);
}

						unset($userlang);
}

					$emailsubject = $langcache[$uselang]['emailsubject_subscription'];
$emailmessage = $langcache[$uselang]['email_subscription'];
}

					$emailsubject = $langcache[$uselang]['emailsubject_subscription'];
$emailmessage = $langcache[$uselang]['email_subscription'];
}

Zeile 732Zeile 736
					"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',
"subject" => $db->escape_string($emailsubject),

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

					"message" => $db->escape_string($emailmessage)


					"message" => $db->escape_string($emailmessage),
"headers" => ''

				);
$db->insert_query(TABLE_PREFIX."mailqueue", $new_email);
unset($userlang);

				);
$db->insert_query(TABLE_PREFIX."mailqueue", $new_email);
unset($userlang);

Zeile 745Zeile 750
			}

// Update forum count

			}

// Update forum count

			update_thread_count($post['tid']);
update_forum_count($post['fid']);

			update_thread_count($post['tid']);
update_forum_count($post['fid']);

			$cache->updatestats();

			$cache->updatestats();

		}

		}

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

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

Zeile 758Zeile 763
		}

if($visible != -2)

		}

if($visible != -2)

		{

		{

			$now = time();
if($forum['usepostcounts'] != "no")
{
$queryadd = ",postnum=postnum+1";

			$now = time();
if($forum['usepostcounts'] != "no")
{
$queryadd = ",postnum=postnum+1";

			}

			}

			else
{
$queryadd = '';
}
$db->query("UPDATE ".TABLE_PREFIX."users SET lastpost='{$now}' {$queryadd} WHERE uid='{$post['uid']}'");

			else
{
$queryadd = '';
}
$db->query("UPDATE ".TABLE_PREFIX."users SET lastpost='{$now}' {$queryadd} WHERE uid='{$post['uid']}'");

		}


		}


		// Return the post's pid and whether or not it is visible.
return array(
"pid" => $this->pid,

		// Return the post's pid and whether or not it is visible.
return array(
"pid" => $this->pid,

Zeile 794Zeile 799
		if($this->method == "insert" || array_key_exists('uid', $thread))
{
$this->verify_author();

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

		}


		}


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

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

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

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

		}

if(!$thread['savedraft'])

		}

if(!$thread['savedraft'])

		{
$this->verify_post_flooding();
}

		{
$this->verify_post_flooding();
}





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

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

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

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

		if(count($this->get_errors()) > 0)

		if(count($this->get_errors()) > 0)

		{
return false;
}

		{
return false;
}

Zeile 854Zeile 859
		if(!$this->get_validated())
{
die("The thread needs to be validated before inserting it into the DB.");

		if(!$this->get_validated())
{
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.");

		if(count($this->get_errors()) > 0)
{
die("The thread is not valid.");

Zeile 877Zeile 882

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


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

			{

			{

				$visible = 0;

				$visible = 0;

			}

			}

			else
{
$visible = 1;

			else
{
$visible = 1;

Zeile 888Zeile 893

// Have a post ID but not a thread ID - fetch thread ID
if($thread['pid'] && !$thread['tid'])


// Have a post ID but not a thread ID - fetch thread ID
if($thread['pid'] && !$thread['tid'])

		{

		{

			$query = $db->simple_select(TABLE_PREFIX."posts", "tid", "pid='{$thread['pid']}");
$thread['tid'] = $db->fetch_field($query, "tid");
}

			$query = $db->simple_select(TABLE_PREFIX."posts", "tid", "pid='{$thread['pid']}");
$thread['tid'] = $db->fetch_field($query, "tid");
}

Zeile 900Zeile 905
		if($draft_check)
{
$this->thread_insert_data = array(

		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']),

				"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
);

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

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

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





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

			$db->update_query(TABLE_PREFIX."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()),
"includesig" => $thread['options']['signature'],
"smilieoff" => $thread['options']['disablesmilies'],


$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,
"posthash" => $db->escape_string($thread['posthash'])
);
$plugins->run_hooks_by_ref("datahandler_post_insert_thread_post", $this);

				"visible" => $visible,
"posthash" => $db->escape_string($thread['posthash'])
);
$plugins->run_hooks_by_ref("datahandler_post_insert_thread_post", $this);





			$db->update_query(TABLE_PREFIX."posts", $this->post_insert_data, "pid='{$thread['pid']}'");
$this->tid = $thread['tid'];
$this->pid = $thread['pid'];

			$db->update_query(TABLE_PREFIX."posts", $this->post_insert_data, "pid='{$thread['pid']}'");
$this->tid = $thread['tid'];
$this->pid = $thread['pid'];

Zeile 934Zeile 939

// Inserting a new thread into the database.
else


// Inserting a new thread into the database.
else

		{

		{

			$this->thread_insert_data = array(
"fid" => $thread['fid'],
"subject" => $db->escape_string($thread['subject']),

			$this->thread_insert_data = array(
"fid" => $thread['fid'],
"subject" => $db->escape_string($thread['subject']),

Zeile 946Zeile 951
				"lastposter" => $db->escape_string($thread['username']),
"views" => 0,
"replies" => 0,

				"lastposter" => $db->escape_string($thread['username']),
"views" => 0,
"replies" => 0,

				"visible" => $visible,

				"visible" => $visible,

				"notes" => ''
);


				"notes" => ''
);


Zeile 971Zeile 976
				"posthash" => $db->escape_string($thread['posthash'])
);
$plugins->run_hooks_by_ref("datahandler_post_insert_thread_post", $this);

				"posthash" => $db->escape_string($thread['posthash'])
);
$plugins->run_hooks_by_ref("datahandler_post_insert_thread_post", $this);





			$db->insert_query(TABLE_PREFIX."posts", $this->post_insert_data);
$this->pid = $db->insert_id();


			$db->insert_query(TABLE_PREFIX."posts", $this->post_insert_data);
$this->pid = $db->insert_id();


Zeile 979Zeile 984
			$firstpostup = array("firstpost" => $pid);
$db->update_query(TABLE_PREFIX."threads", $firstpostup, "tid='{$tid}'");
}

			$firstpostup = array("firstpost" => $pid);
$db->update_query(TABLE_PREFIX."threads", $firstpostup, "tid='{$tid}'");
}





		// If we're not saving a draft there are some things we need to check now
if(!$thread['savedraft'])
{

		// If we're not saving a draft there are some things we need to check now
if(!$thread['savedraft'])
{


// Automatic subscription to the thread


// Automatically subscribe the user to this thread if they've chosen to.

			if($thread['options']['emailnotify'] != "no" && $thread['uid'] > 0)
{

			if($thread['options']['emailnotify'] != "no" && $thread['uid'] > 0)
{

				$favoriteadd = array(
"uid" => intval($thread['uid']),
"tid" => intval($this->tid),
"type" => "s"

				$insert_favorite = array(
'uid' => intval($thread['uid']),
'tid' => $this->tid,
'type' => 's'

				);

				);

				$db->insert_query(TABLE_PREFIX."favorites", $favoriteadd);

				$db->insert_query(TABLE_PREFIX.'favorites', $insert_favorite);

			}

// Perform any selected moderation tools.

			}

// Perform any selected moderation tools.

Zeile 1007Zeile 1012
				{
$newclosed = "closed='yes'";
log_moderator_action($modlogdata, "Thread closed");

				{
$newclosed = "closed='yes'";
log_moderator_action($modlogdata, "Thread closed");

				}


				}


				// Stick the thread.
if($modoptions['stickthread'] == "yes")

				// Stick the thread.
if($modoptions['stickthread'] == "yes")

				{

				{

					$newstick = "sticky='1'";
log_moderator_action($modlogdata, "Thread stuck");
}

					$newstick = "sticky='1'";
log_moderator_action($modlogdata, "Thread stuck");
}

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

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

				}

				}

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

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

Zeile 1044Zeile 1049
				if($forum['usepostcounts'] != "no")
{
$update_query[] = "postnum=postnum+1";

				if($forum['usepostcounts'] != "no")
{
$update_query[] = "postnum=postnum+1";

				}


				}


				// Only update the table if we need to.

				// Only update the table if we need to.

				if(is_array($update_query))

				if(!empty($update_query))

				{
$update_query = implode(", ", $update_query);
$db->query("UPDATE ".TABLE_PREFIX."users SET $update_query WHERE uid='".$thread['uid']."'");

				{
$update_query = implode(", ", $update_query);
$db->query("UPDATE ".TABLE_PREFIX."users SET $update_query WHERE uid='".$thread['uid']."'");

Zeile 1083Zeile 1088
				else
{
$uselang = "english";

				else
{
$uselang = "english";

				}

				}


if($uselang == $mybb->settings['bblanguage'])
{


if($uselang == $mybb->settings['bblanguage'])
{

Zeile 1111Zeile 1116
					"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',
"subject" => $db->escape_string($emailsubject),

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

					"message" => $db->escape_string($emailmessage)


					"message" => $db->escape_string($emailmessage),
"headers" => ''

				);
$db->insert_query(TABLE_PREFIX."mailqueue", $new_email);
unset($userlang);

				);
$db->insert_query(TABLE_PREFIX."mailqueue", $new_email);
unset($userlang);

Zeile 1121Zeile 1127
			if($queued_email == 1)
{
$cache->updatemailqueue();

			if($queued_email == 1)
{
$cache->updatemailqueue();

			}
// Automatically subscribe the user to this thread if they've chosen to.
if($thread['options']['emailnotify'] != "no" && $thread['uid'] > 0)
{
$insert_favorite = array(
'uid' => intval($thread['uid']),
'tid' => $this->tid,
'type' => 's'
);
$db->insert_query(TABLE_PREFIX.'favorites', $insert_favorite);

 
			}
}


			}
}