Vergleich inc/datahandlers/post.php - 1.2.1 - 1.2.5

  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 2280 2006-09-27 12:21:17Z chris $

 * $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,

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


				"posthash" => $db->escape_string($post['posthash'])
);


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

Zeile 831Zeile 836

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


// 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 874Zeile 879
		// Thread is being made now and we have a bit to do.
else
{

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


// Fetch the permissions for this user
$user_permisions = user_permissions($thread['uid']);

 

// Decide on the visibility of this post.


// Decide on the visibility of this post.

			if($forum['modposts'] == "yes" && is_moderator($thread['fid'], "", $thread['uid']) != "yes")

			if(($forum['modthreads'] == "yes" || $forum['modposts'] == "yes") && is_moderator($thread['fid'], "", $thread['uid']) != "yes")

			{
$visible = 0;
}

			{
$visible = 0;
}

Zeile 892Zeile 894
		// 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'])
{

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

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

			$thread['tid'] = $db->fetch_field($query, "tid");
}


			$thread['tid'] = $db->fetch_field($query, "tid");
}


Zeile 903Zeile 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'],


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

				"smilieoff" => $thread['options']['disablesmilies'],
"visible" => $visible,
"posthash" => $db->escape_string($thread['posthash'])

Zeile 949Zeile 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" => ''

			);

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

			);

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

Zeile 973Zeile 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 981Zeile 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 1009Zeile 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 1022Zeile 1025
				if($newstick && $newclosed)
{
$sep = ",";

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

				}

				}

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

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

Zeile 1046Zeile 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 1085Zeile 1088
				else
{
$uselang = "english";

				else
{
$uselang = "english";

				}

				}


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


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

Zeile 1113Zeile 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 1123Zeile 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);

 
			}
}


			}
}