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

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

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

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

 *

 *

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

 * $Id: post.php 3006 2007-04-11 06:14:56Z Tikitiki $

 */

 */

 

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}


/*
EXAMPLE USE:


/*
EXAMPLE USE:

Zeile 287Zeile 293
				else
{
$this->set_error("post_flooding", array($time_to_wait));

				else
{
$this->set_error("post_flooding", array($time_to_wait));

				}
return false;
}
}

				}
return false;
}
}

		// All is well that ends well - return true.
return true;
}

		// All is well that ends well - return true.
return true;
}

Zeile 308Zeile 314

// Get the permissions of the user who is making this post or thread
$permissions = user_permissions($post['uid']);


// Get the permissions of the user who is making this post or thread
$permissions = user_permissions($post['uid']);





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

		// Fetch the forum this post is being made in
$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'] != "yes")
{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

		// Check if this post contains more images than the forum allows
if($post['savedraft'] != 1 && $mybb->settings['maxpostimages'] != 0 && $permissions['cancp'] != "yes")
{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;





			// Parse the message.
$parser_options = array(
"allow_html" => $forum['allowhtml'],

			// Parse the message.
$parser_options = array(
"allow_html" => $forum['allowhtml'],

Zeile 326Zeile 332
			);

if($post['options']['disablesmilies'] != "yes")

			);

if($post['options']['disablesmilies'] != "yes")

			{

			{

				$parser_options['allow_smilies'] = $forum['allowsmilies'];
}
else
{
$parser_options['allow_smilies'] = "no";
}

				$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_check = $parser->parse_message($post['message'], $parser_options);

// And count the number of image tags in the message.

Zeile 343Zeile 349
				// 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;

				// 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 430Zeile 436
	 * @return boolean True when valid, false when invalid.
*/
function validate_post()

	 * @return boolean True when valid, false when invalid.
*/
function validate_post()

	{
global $mybb, $db, $plugins;

	{
global $mybb, $db, $plugins;


$post = &$this->data;
$time = time();


$post = &$this->data;
$time = time();





		// Verify all post assets.

		// Verify all post assets.

 
		
if($this->method != "update" && !$post['savedraft'])
{
$this->verify_post_flooding();
}


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


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

		{

		{

			$this->verify_author();
}

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

			$this->verify_author();
}

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

		}

		}


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


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

Zeile 457Zeile 468
		if($this->method == "insert" || array_key_exists('dateline', $post))
{
$this->verify_dateline();

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

		}

if($this->method != "update" && !$post['savedraft'])
{
$this->verify_post_flooding();

 
		}

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

		}

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

Zeile 606Zeile 612
				$visible = 1;
}
}

				$visible = 1;
}
}

 
		
if($visible != -2)
{
$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']}'");
}



$post['pid'] = intval($post['pid']);
$post['uid'] = intval($post['uid']);


$post['pid'] = intval($post['pid']);
$post['uid'] = intval($post['uid']);

Zeile 748Zeile 769
			{
$cache->updatemailqueue();
}

			{
$cache->updatemailqueue();
}

 
			$thread_update = array("replies" => "+1"); 

$query = $db->simple_select(TABLE_PREFIX."attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");

$thread_update['attachmentcount'] = "+{$attachmentcount}";


// Update forum count


// Update forum count

			update_thread_count($post['tid']);
update_forum_count($post['fid']);
$cache->updatestats();
}

			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)

		{

		{

			// Update the unapproved posts count for the current thread and current forum

			// Update the unapproved posts count for the current thread and current forum

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

if($visible != -2)
{
$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']}'");

			update_thread_counters($post['tid'], array("unapprovedposts" => "+1")); 
update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));















		}

// 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 789Zeile 801
	 * @return boolean True when valid, false when invalid.
*/
function validate_thread()

	 * @return boolean True when valid, false when invalid.
*/
function validate_thread()

	{

	{

		global $mybb, $db, $plugins;

		global $mybb, $db, $plugins;





		$thread = &$this->data;

// Validate all thread assets.

		$thread = &$this->data;

// Validate all thread assets.

 
		
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 807Zeile 824
		}

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

		}

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

		{

		{

			$this->verify_message();
$this->verify_image_count();
}

			$this->verify_message();
$this->verify_image_count();
}

Zeile 825Zeile 842
		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'])
{
$this->verify_post_flooding();

 
		}

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

		}

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

Zeile 859Zeile 871
		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 1140Zeile 1152
			$db->update_query(TABLE_PREFIX."attachments", $attachmentassign, "posthash='{$thread['posthash']}'");
}


			$db->update_query(TABLE_PREFIX."attachments", $attachmentassign, "posthash='{$thread['posthash']}'");
}


		// Thread is public - update the forum counts.
if($visible == 1 || $visible == 0)
{
$cache->updatestats();
update_thread_count($this->tid);
update_forum_count($thread['fid']);












		$query = $db->simple_select(TABLE_PREFIX."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}"));
}

if($visible == 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"));

		}

// 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 1286Zeile 1309
		{
$db->delete_query(TABLE_PREFIX."favorites", "type='s' AND uid='{$post['uid']}' AND tid='{$post['tid']}'");
}

		{
$db->delete_query(TABLE_PREFIX."favorites", "type='s' AND uid='{$post['uid']}' AND tid='{$post['tid']}'");
}

		update_thread_attachment_count($post['tid']);

 




		update_forum_count($post['fid']);

		update_forum_lastpost($post['fid']);

	}
}
?>

	}
}
?>