Vergleich inc/datahandlers/post.php - 1.6.11 - 1.6.18

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 121Zeile 121
		{
$user = get_user($post['uid']);
$post['username'] = $user['username'];

		{
$user = get_user($post['uid']);
$post['username'] = $user['username'];

 
		}
// if the uid is 0 verify the username
else if($post['uid'] == 0 && $post['username'] != $lang->guest)
{
// Set up user handler
require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler();

$data_array = array('username' => $post['username']);
$userhandler->set_data($data_array);

if(!$userhandler->verify_username())
{
// invalid username
$this->errors = array_merge($this->errors, $userhandler->get_errors());
return false;
}

		}

// After all of this, if we still don't have a username, force the username as "Guest" (Note, this is not translatable as it is always a fallback)

		}

// After all of this, if we still don't have a username, force the username as "Guest" (Note, this is not translatable as it is always a fallback)

Zeile 146Zeile 163
		$post = &$this->data;
$subject = &$post['subject'];
$subject = trim_blank_chrs($subject);

		$post = &$this->data;
$subject = &$post['subject'];
$subject = trim_blank_chrs($subject);

		$subject = utf8_handle_4byte_string($subject);

 

// Are we editing an existing thread or post?
if($this->method == "update" && $post['pid'])


// Are we editing an existing thread or post?
if($this->method == "update" && $post['pid'])

Zeile 240Zeile 256

$post = &$this->data;
$post['message'] = trim_blank_chrs($post['message']);


$post = &$this->data;
$post['message'] = trim_blank_chrs($post['message']);

		$post['message'] = utf8_handle_4byte_string($post['message']);

 

// Do we even have a message at all?
if(my_strlen($post['message']) == 0)


// Do we even have a message at all?
if(my_strlen($post['message']) == 0)

Zeile 414Zeile 429
	* @return boolean True when valid, false when not valid.
*/
function verify_image_count()

	* @return boolean True when valid, false when not valid.
*/
function verify_image_count()

	{
global $mybb, $db;


	{
global $mybb, $db;


		$post = &$this->data;

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

		$post = &$this->data;

// 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
if(!$post['fid'])

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

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

Zeile 435Zeile 450
		{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

		{
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 452Zeile 467
			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 469Zeile 484

/**
* Verifies the video count.


/**
* Verifies the video count.

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

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

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

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

Zeile 543Zeile 558
	* @return boolean True when valid, false when not valid.
*/
function verify_post_icon()

	* @return boolean True when valid, false when not valid.
*/
function verify_post_icon()

	{
global $cache;

	{
global $cache;


$post = &$this->data;


$post = &$this->data;


// If we don't assign it as 0.
if(!$post['icon'] || $post['icon'] < 0)




$posticons_cache = $cache->read("posticons");

// If we don't have a post icon assign it as 0.
if(empty($post['icon']) || !isset($posticons_cache[$post['icon']]))

		{
$post['icon'] = 0;
}

		{
$post['icon'] = 0;
}

Zeile 564Zeile 581
	function verify_dateline()
{
$dateline = &$this->data['dateline'];

	function verify_dateline()
{
$dateline = &$this->data['dateline'];





		// The date has to be numeric and > 0.
if($dateline < 0 || is_numeric($dateline) == false)
{

		// The date has to be numeric and > 0.
if($dateline < 0 || is_numeric($dateline) == false)
{

Zeile 582Zeile 599
		$prefix = &$this->data['prefix'];

// If a valid prefix isn't supplied, don't assign one.

		$prefix = &$this->data['prefix'];

// If a valid prefix isn't supplied, don't assign one.

		if(!$prefix || $prefix < 1)

		if(empty($prefix))

		{
$prefix = 0;

		{
$prefix = 0;

 
		}
else
{
$verification = build_prefixes($prefix);
if(!$verification)
{
$this->set_error('invalid_prefix');
return false;
}
if($verification['groups'] != "-1")
{
if(!empty($this->data['edit_uid']))
{
// Post is being edited
$user = get_user($this->data['edit_uid']);
}
else
{
$user = get_user($this->data['uid']);
}
$groups = array($user['usergroup']);
if(!empty($user['additionalgroups']))
{
$groups = array_merge($groups, explode(',', $user['additionalgroups']));
}
$prefix_groups = explode(",", $verification['groups']);

$valid_group = false;
foreach($groups as $group)
{
if(in_array($group, $prefix_groups))
{
$valid_group = true;
break;
}
}
if(!$valid_group)
{
$this->set_error('invalid_prefix');
return false;
}
}
if($verification['forums'] != "-1")
{
// Decide whether this prefix can be used in our forum
$forums = explode(",", $verification['forums']);

if(!in_array($this->data['fid'], $forums))
{
$this->set_error('invalid_prefix');
return false;
}
}

		}

return true;

		}

return true;

Zeile 602Zeile 672
		$post = &$this->data;
$time = TIME_NOW;


		$post = &$this->data;
$time = TIME_NOW;


		$this->action = "post";


		$this->action = "post";


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

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

		}


		}


		// Verify all post assets.

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

		// Verify all post assets.

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))
{
$this->verify_message();

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

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

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

		}
else
{

		}
else
{

			return true;
}
}

			return true;
}
}

Zeile 710Zeile 780

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

			}


			}


			// Perform any selected moderation tools.
if(is_moderator($post['fid'], "", $post['uid']))
{
$lang->load($this->language_file, true);

			// Perform any selected moderation tools.
if(is_moderator($post['fid'], "", $post['uid']))
{
$lang->load($this->language_file, true);





				$modoptions = $post['modoptions'];
$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $thread['tid'];

				$modoptions = $post['modoptions'];
$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $thread['tid'];

Zeile 730Zeile 800

// Open the thread.
if($modoptions['closethread'] != 1 && $thread['closed'] == 1)


// Open the thread.
if($modoptions['closethread'] != 1 && $thread['closed'] == 1)

				{

				{

					$newclosed = "closed=0";
log_moderator_action($modlogdata, $lang->thread_opened);

					$newclosed = "closed=0";
log_moderator_action($modlogdata, $lang->thread_opened);

				}


				}


				// Stick the thread.
if($modoptions['stickthread'] == 1 && $thread['sticky'] != 1)
{
$newstick = "sticky='1'";
log_moderator_action($modlogdata, $lang->thread_stuck);

				// Stick the thread.
if($modoptions['stickthread'] == 1 && $thread['sticky'] != 1)
{
$newstick = "sticky='1'";
log_moderator_action($modlogdata, $lang->thread_stuck);

				}

				}


// Unstick the thread.
if($modoptions['stickthread'] != 1 && $thread['sticky'])
{
$newstick = "sticky='0'";
log_moderator_action($modlogdata, $lang->thread_unstuck);


// Unstick the thread.
if($modoptions['stickthread'] != 1 && $thread['sticky'])
{
$newstick = "sticky='0'";
log_moderator_action($modlogdata, $lang->thread_unstuck);

				}


				}


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

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

				{

				{

					$sep = ",";

					$sep = ",";

				}

				}

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

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

Zeile 765Zeile 835
			}

// Fetch the forum this post is being made in

			}

// Fetch the forum this post is being made in

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


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


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

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

Zeile 839Zeile 909
					);
$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'");
}

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





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

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

Zeile 857Zeile 927
				'lastpost' => "'{$now}'"
);
if($forum['usepostcounts'] != 0)

				'lastpost' => "'{$now}'"
);
if($forum['usepostcounts'] != 0)

			{

			{

				$update_array['postnum'] = 'postnum+1';
}


				$update_array['postnum'] = 'postnum+1';
}


Zeile 1148Zeile 1218
		if($thread['savedraft'])
{
$visible = -2;

		if($thread['savedraft'])
{
$visible = -2;

		}


		}


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

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

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

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

			{
$visible = 0;

			{
$visible = 0;

			}
else
{

			}
else
{

Zeile 1168Zeile 1238
			if($mybb->user['uid'] == $thread['uid'] && $mybb->user['moderateposts'] == 1)
{
$visible = 0;

			if($mybb->user['uid'] == $thread['uid'] && $mybb->user['moderateposts'] == 1)
{
$visible = 0;

			}

			}

		}

// 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("posts", "tid", "pid='{$thread['pid']}");
$thread['tid'] = $db->fetch_field($query, "tid");
}

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

Zeile 1186Zeile 1256
		else
{
$draft_check = false;

		else
{
$draft_check = false;

		}

		}


// 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)

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

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





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

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

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

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

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

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

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

		}


		}


		// Inserting a new thread into the database.
else
{

		// Inserting a new thread into the database.
else
{

Zeile 1240Zeile 1310
				"replies" => 0,
"visible" => $visible,
"notes" => ''

				"replies" => 0,
"visible" => $visible,
"notes" => ''

			);

			);


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



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


Zeile 1294Zeile 1364
				$lang->load($this->language_file, true);

$modoptions = $thread['modoptions'];

				$lang->load($this->language_file, true);

$modoptions = $thread['modoptions'];

				$modlogdata['fid'] = $this->tid;
$modlogdata['tid'] = $thread['tid'];

				$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $this->tid;


// Close the thread.
if($modoptions['closethread'] == 1)


// Close the thread.
if($modoptions['closethread'] == 1)