Vergleich editpost.php - 1.8.3 - 1.8.23

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 11Zeile 11
define("IN_MYBB", 1);
define('THIS_SCRIPT', 'editpost.php');


define("IN_MYBB", 1);
define('THIS_SCRIPT', 'editpost.php');


$templatelist = "editpost,previewpost,changeuserbox,codebuttons,smilieinsert,smilieinsert_getmore,smilieinsert_smilie,smilieinsert_smilie_empty,post_attachments_attachment_postinsert,post_attachments_attachment_mod_unapprove";
$templatelist .= ",editpost_delete,error_attacherror,forumdisplay_password_wrongpass,forumdisplay_password,editpost_reason,post_attachments_attachment_remove,post_attachments_update,postbit_author_guest,post_subscription_method";
$templatelist .= ",posticons_icon,post_prefixselect_prefix,post_prefixselect_single,newthread_postpoll,editpost_disablesmilies,post_attachments_attachment_mod_approve,post_attachments_attachment_unapproved,post_attachments_new";
$templatelist .= ",postbit_warninglevel_formatted,postbit_reputation_formatted_link,editpost_disablesmilies_hidden,attachment_icon,post_attachments_attachment,post_attachments_add,post_attachments,posticons,global_moderation_notice";




$templatelist = "editpost,previewpost,changeuserbox,codebuttons,post_attachments_attachment_postinsert,post_attachments_attachment_mod_unapprove,postbit_attachments_thumbnails,postbit_profilefield_multiselect_value";
$templatelist .= ",editpost_delete,forumdisplay_password_wrongpass,forumdisplay_password,editpost_reason,post_attachments_attachment_remove,post_attachments_update,post_subscription_method,postbit_profilefield_multiselect";
$templatelist .= ",postbit_avatar,postbit_find,postbit_pm,postbit_rep_button,postbit_www,postbit_email,postbit_reputation,postbit_warn,postbit_warninglevel,postbit_author_user,posticons";
$templatelist .= ",postbit_signature,postbit_classic,postbit,postbit_attachments_thumbnails_thumbnail,postbit_attachments_images_image,postbit_attachments_attachment,postbit_attachments_attachment_unapproved";
$templatelist .= ",posticons_icon,post_prefixselect_prefix,post_prefixselect_single,newthread_postpoll,editpost_disablesmilies,post_attachments_attachment_mod_approve,post_attachments_attachment_unapproved";
$templatelist .= ",postbit_warninglevel_formatted,postbit_reputation_formatted_link,editpost_signature,attachment_icon,post_attachments_attachment,post_attachments_add,post_attachments,editpost_postoptions,post_attachments_viewlink";
$templatelist .= ",postbit_attachments_images,global_moderation_notice,post_attachments_new,postbit_attachments,postbit_online,postbit_away,postbit_offline,postbit_gotopost,postbit_userstar,postbit_icon";


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_upload.php";


require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_upload.php";

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


// Load global language phrases
$lang->load("editpost");


// Load global language phrases
$lang->load("editpost");

Zeile 32Zeile 37
}

// Get post info

}

// Get post info

$pid = $mybb->get_input('pid', 1);

$pid = $mybb->get_input('pid', MyBB::INPUT_INT);


// if we already have the post information...
if(isset($style) && $style['pid'] == $pid && $style['type'] != 'f')


// if we already have the post information...
if(isset($style) && $style['pid'] == $pid && $style['type'] != 'f')

Zeile 44Zeile 49
	$post = get_post($pid);
}


	$post = get_post($pid);
}


if(!$post)

if(!$post || ($post['visible'] == -1 && $mybb->input['action'] != "restorepost"))

{
error($lang->error_invalidpost);
}

{
error($lang->error_invalidpost);
}

Zeile 58Zeile 63
	error($lang->error_invalidthread);
}


	error($lang->error_invalidthread);
}


$thread['subject'] = htmlspecialchars_uni($thread['subject']);

$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));


// Get forum info
$fid = $post['fid'];


// Get forum info
$fid = $post['fid'];

Zeile 66Zeile 71

if($thread['visible'] == 0 && !is_moderator($fid, "canviewunapprove") || $thread['visible'] == -1 && !is_moderator($fid, "canviewdeleted") || ($thread['visible'] < -1 && $thread['uid'] != $mybb->user['uid']))
{


if($thread['visible'] == 0 && !is_moderator($fid, "canviewunapprove") || $thread['visible'] == -1 && !is_moderator($fid, "canviewdeleted") || ($thread['visible'] < -1 && $thread['uid'] != $mybb->user['uid']))
{

	error($lang->error_invalidthread);




	if($thread['visible'] == 0 && !($mybb->settings['showownunapproved'] && $thread['uid'] == $mybb->user['uid']))
{
error($lang->error_invalidthread);
}

}
if(!$forum || $forum['type'] != "f")
{

}
if(!$forum || $forum['type'] != "f")
{

Zeile 111Zeile 119
}

if($mybb->input['action'] == "deletepost" && $mybb->request_method == "post")

}

if($mybb->input['action'] == "deletepost" && $mybb->request_method == "post")

{
if(!is_moderator($fid, "candeleteposts"))
{
if($thread['closed'] == 1)
{
error($lang->redirect_threadclosed);
}
if($forumpermissions['candeleteposts'] == 0)
{
error_no_permission();
}
if($mybb->user['uid'] != $post['uid'])
{
error_no_permission();
}
// User can't delete unapproved post
if($post['visible'] == 0)
{
error_no_permission();

{
if(!is_moderator($fid, "candeleteposts") && !is_moderator($fid, "cansoftdeleteposts") && $pid != $thread['firstpost'] || !is_moderator($fid, "candeletethreads") && !is_moderator($fid, "cansoftdeletethreads") && $pid == $thread['firstpost'])
{
if($thread['closed'] == 1)
{
error($lang->redirect_threadclosed);
}
if($forumpermissions['candeleteposts'] == 0 && $pid != $thread['firstpost'] || $forumpermissions['candeletethreads'] == 0 && $pid == $thread['firstpost'])
{
error_no_permission();
}
if($mybb->user['uid'] != $post['uid'])
{
error_no_permission();
}
// User can't delete unapproved post unless allowed for own
if($post['visible'] == 0 && !($mybb->settings['showownunapproved'] && $post['uid'] == $mybb->user['uid']))
{
error_no_permission();

		}
}
if($post['visible'] == -1 && $mybb->settings['soft_delete'] == 1)

		}
}
if($post['visible'] == -1 && $mybb->settings['soft_delete'] == 1)

Zeile 139Zeile 147
}
elseif($mybb->input['action'] == "restorepost" && $mybb->request_method == "post")
{

}
elseif($mybb->input['action'] == "restorepost" && $mybb->request_method == "post")
{

	if(!is_moderator($fid) || $post['visible'] != -1 || $mybb->settings['soft_delete'] == 0)

	if(!is_moderator($fid, "canrestoreposts") && $pid != $thread['firstpost'] || !is_moderator($fid, "canrestorethreads") && $pid == $thread['firstpost'] || $post['visible'] != -1)

	{
error_no_permission();
}

	{
error_no_permission();
}

Zeile 153Zeile 161
			error($lang->redirect_threadclosed);
}
if($forumpermissions['caneditposts'] == 0)

			error($lang->redirect_threadclosed);
}
if($forumpermissions['caneditposts'] == 0)

		{
error_no_permission();

		{
error_no_permission();

		}
if($mybb->user['uid'] != $post['uid'])

		}
if($mybb->user['uid'] != $post['uid'])

		{

		{

			error_no_permission();
}
// Edit time limit

			error_no_permission();
}
// Edit time limit

Zeile 166Zeile 174
		{
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']);
error($lang->edit_time_limit);

		{
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']);
error($lang->edit_time_limit);

		}

		}

		// User can't edit unapproved post

		// User can't edit unapproved post

		if($post['visible'] == 0 || $post['visible'] == -1)

		if(($post['visible'] == 0 && !($mybb->settings['showownunapproved'] && $post['uid'] == $mybb->user['uid'])) || $post['visible'] == -1)

		{
error_no_permission();
}
}

		{
error_no_permission();
}
}

}


}


// Check if this forum is password protected and we have a valid password

// Check if this forum is password protected and we have a valid password

check_forum_password($forum['fid']);

if((empty($_POST) && empty($_FILES)) && $mybb->get_input('processed', 1) == '1')
{
error($lang->error_cannot_upload_php_post);
}

$attacherror = '';
if($mybb->settings['enableattachments'] == 1 && !$mybb->get_input('attachmentaid', 1) && ($mybb->get_input('newattachment') || $mybb->get_input('updateattachment') || ($mybb->input['action'] == "do_editpost" && isset($mybb->input['submit']) && $_FILES['attachment'])))

check_forum_password($forum['fid']);

if((empty($_POST) && empty($_FILES)) && $mybb->get_input('processed', MyBB::INPUT_INT) == '1')







{

{

	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

// If there's an attachment, check it and upload it
if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0)
{
$query = $db->simple_select("attachments", "aid", "filename='".$db->escape_string($_FILES['attachment']['name'])."' AND pid='{$pid}'");
$updateattach = $db->fetch_field($query, "aid");

	error($lang->error_empty_post_input);
}











		$update_attachment = false;
if($updateattach > 0 && $mybb->get_input('updateattachment') && ($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']))
{
$update_attachment = true;
}
$attachedfile = upload_attachment($_FILES['attachment'], $update_attachment);
}
if(!empty($attachedfile['error']))
{
eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");
$mybb->input['action'] = "editpost";
}
if(!isset($mybb->input['submit']))


















$attacherror = '';
if($mybb->settings['enableattachments'] == 1 && ($mybb->get_input('newattachment') || $mybb->get_input('updateattachment') || ((($mybb->input['action'] == "do_editpost" && isset($mybb->input['submitbutton'])) || ($mybb->input['action'] == "editpost" && isset($mybb->input['previewpost']))) && $_FILES['attachments'])))
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

if($pid)
{
$attachwhere = "pid='{$pid}'";
}
else
{
$attachwhere = "posthash='".$db->escape_string($mybb->get_input('posthash'))."'";
}

$ret = add_attachments($pid, $forumpermissions, $attachwhere, "editpost");

if(!empty($ret['errors']))
{
$errors = $ret['errors'];
}

// Do we have attachment errors?
if(!empty($errors))
{
$attacherror = inline_error($errors);
}

// If we were dealing with an attachment but didn't click 'Update Post', force the post edit page again.
if(!isset($mybb->input['submitbutton']))

	{
$mybb->input['action'] = "editpost";
}
}


	{
$mybb->input['action'] = "editpost";
}
}


if($mybb->settings['enableattachments'] == 1 && $mybb->get_input('attachmentaid', 1) && isset($mybb->input['attachmentact']) && $mybb->input['action'] == "do_editpost" && $mybb->request_method == "post") // Lets remove/approve/unapprove the attachment



detect_attachmentact();

if($mybb->settings['enableattachments'] == 1 && $mybb->get_input('attachmentaid', MyBB::INPUT_INT) && isset($mybb->input['attachmentact']) && $mybb->input['action'] == "do_editpost" && $mybb->request_method == "post") // Lets remove/approve/unapprove the attachment

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


	$mybb->input['attachmentaid'] = $mybb->get_input('attachmentaid', 1);

	$mybb->input['attachmentaid'] = $mybb->get_input('attachmentaid', MyBB::INPUT_INT);

	if($mybb->input['attachmentact'] == "remove")
{
remove_attachment($pid, "", $mybb->input['attachmentaid']);

	if($mybb->input['attachmentact'] == "remove")
{
remove_attachment($pid, "", $mybb->input['attachmentaid']);

Zeile 235Zeile 250
		$db->update_query("attachments", $update_sql, "aid='{$mybb->input['attachmentaid']}'");
update_thread_counters($post['tid'], array('attachmentcount' => "-1"));
}

		$db->update_query("attachments", $update_sql, "aid='{$mybb->input['attachmentaid']}'");
update_thread_counters($post['tid'], array('attachmentcount' => "-1"));
}

	if(!isset($mybb->input['submit']))










if($mybb->get_input('ajax', MyBB::INPUT_INT) == 1)
{
header("Content-type: application/json; charset={$lang->settings['charset']}");
echo json_encode(array("success" => true));
exit();
}

if(!isset($mybb->input['submitbutton']))

	{
$mybb->input['action'] = "editpost";
}

	{
$mybb->input['action'] = "editpost";
}

Zeile 248Zeile 271

$plugins->run_hooks("editpost_deletepost");



$plugins->run_hooks("editpost_deletepost");


	if($mybb->get_input('delete', 1) == 1)

	if($mybb->get_input('delete', MyBB::INPUT_INT) == 1)

	{
$query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
$firstcheck = $db->fetch_array($query);

	{
$query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
$firstcheck = $db->fetch_array($query);

Zeile 257Zeile 280
			$firstpost = 1;
}
else

			$firstpost = 1;
}
else

		{

		{

			$firstpost = 0;
}


			$firstpost = 0;
}


Zeile 265Zeile 288
		$modlogdata['tid'] = $tid;
if($firstpost)
{

		$modlogdata['tid'] = $tid;
if($firstpost)
{

			if($forumpermissions['candeletethreads'] == 1 || is_moderator($fid, "candeletethreads"))

			if($forumpermissions['candeletethreads'] == 1 || is_moderator($fid, "candeletethreads") || is_moderator($fid, "cansoftdeletethreads"))

			{
require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;

			{
require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;


if($mybb->settings['soft_delete'] == 1)
{


if($mybb->settings['soft_delete'] == 1 || is_moderator($fid, "cansoftdeletethreads"))
{

					$modlogdata['pid'] = $pid;

$moderation->soft_delete_threads(array($tid));

					$modlogdata['pid'] = $pid;

$moderation->soft_delete_threads(array($tid));

Zeile 282Zeile 305
					$moderation->delete_thread($tid);
mark_reports($tid, "thread");
log_moderator_action($modlogdata, $lang->thread_deleted);

					$moderation->delete_thread($tid);
mark_reports($tid, "thread");
log_moderator_action($modlogdata, $lang->thread_deleted);

				}


				}


				if($mybb->input['ajax'] == 1)

				if($mybb->input['ajax'] == 1)

				{

				{

					header("Content-type: application/json; charset={$lang->settings['charset']}");

					header("Content-type: application/json; charset={$lang->settings['charset']}");

					if($mybb->settings['soft_delete'] == 1 && is_moderator($fid))
{
echo json_encode(array("data" => '1'));
}

					if(is_moderator($fid, "canviewdeleted"))
{
echo json_encode(array("data" => '1', "first" => '1'));
}

					else
{
echo json_encode(array("data" => '3', "url" => get_forum_link($fid)));

					else
{
echo json_encode(array("data" => '3', "url" => get_forum_link($fid)));

					}
}
else
{

					}
}
else
{

					redirect(get_forum_link($fid), $lang->redirect_threaddeleted);
}
}

					redirect(get_forum_link($fid), $lang->redirect_threaddeleted);
}
}

Zeile 308Zeile 331
		}
else
{

		}
else
{

			if($forumpermissions['candeleteposts'] == 1 || is_moderator($fid, "candeleteposts"))

			if($forumpermissions['candeleteposts'] == 1 || is_moderator($fid, "candeleteposts") || is_moderator($fid, "cansoftdeleteposts"))

			{
// Select the first post before this
require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;


			{
// Select the first post before this
require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;


				if($mybb->settings['soft_delete'] == 1)

				if($mybb->settings['soft_delete'] == 1 || is_moderator($fid, "cansoftdeleteposts"))

				{
$modlogdata['pid'] = $pid;


				{
$modlogdata['pid'] = $pid;


Zeile 333Zeile 356
				if($next_post['pid'])
{
$redirect = get_post_link($next_post['pid'], $tid)."#pid{$next_post['pid']}";

				if($next_post['pid'])
{
$redirect = get_post_link($next_post['pid'], $tid)."#pid{$next_post['pid']}";

				}
else
{

				}
else
{

					$redirect = get_thread_link($tid);
}

					$redirect = get_thread_link($tid);
}

				



				if($mybb->input['ajax'] == 1)
{
header("Content-type: application/json; charset={$lang->settings['charset']}");

				if($mybb->input['ajax'] == 1)
{
header("Content-type: application/json; charset={$lang->settings['charset']}");

					if($mybb->settings['soft_delete'] == 1 && is_moderator($fid))
{
echo json_encode(array("data" => '1'));

					if(is_moderator($fid, "canviewdeleted"))
{
echo json_encode(array("data" => '1', "first" => '0'));

					}
else
{
echo json_encode(array("data" => '2'));
}

					}
else
{
echo json_encode(array("data" => '2'));
}

				}

				}

				else
{
redirect($redirect, $lang->redirect_postdeleted);

				else
{
redirect($redirect, $lang->redirect_postdeleted);

Zeile 375Zeile 398

$plugins->run_hooks("editpost_restorepost");



$plugins->run_hooks("editpost_restorepost");


	if($mybb->get_input('restore', 1) == 1)

	if($mybb->get_input('restore', MyBB::INPUT_INT) == 1)

	{
$query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
$firstcheck = $db->fetch_array($query);

	{
$query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
$firstcheck = $db->fetch_array($query);

Zeile 386Zeile 409
		else
{
$firstpost = 0;

		else
{
$firstpost = 0;

		}


		}


		$modlogdata['fid'] = $fid;
$modlogdata['tid'] = $tid;
$modlogdata['pid'] = $pid;
if($firstpost)

		$modlogdata['fid'] = $fid;
$modlogdata['tid'] = $tid;
$modlogdata['pid'] = $pid;
if($firstpost)

		{
if(is_moderator($fid))
{

		{
if(is_moderator($fid, "canrestorethreads"))
{

				require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;
$moderation->restore_threads(array($tid));

				require_once MYBB_ROOT."inc/class_moderation.php";
$moderation = new Moderation;
$moderation->restore_threads(array($tid));

Zeile 402Zeile 425
				if($mybb->input['ajax'] == 1)
{
header("Content-type: application/json; charset={$lang->settings['charset']}");

				if($mybb->input['ajax'] == 1)
{
header("Content-type: application/json; charset={$lang->settings['charset']}");

					echo json_encode(array("data" => '1'));

					echo json_encode(array("data" => '1', "first" => '1'));

				}
else
{

				}
else
{

Zeile 416Zeile 439
		}
else
{

		}
else
{

			if(is_moderator($fid))

			if(is_moderator($fid, "canrestoreposts"))

			{
// Select the first post before this
require_once MYBB_ROOT."inc/class_moderation.php";

			{
// Select the first post before this
require_once MYBB_ROOT."inc/class_moderation.php";

Zeile 428Zeile 451
				if($mybb->input['ajax'] == 1)
{
header("Content-type: application/json; charset={$lang->settings['charset']}");

				if($mybb->input['ajax'] == 1)
{
header("Content-type: application/json; charset={$lang->settings['charset']}");

					echo json_encode(array("data" => '1'));

					echo json_encode(array("data" => '1', "first" => '0'));

				}
else
{

				}
else
{

Zeile 462Zeile 485
	// Set the post data that came from the input to the $post array.
$post = array(
"pid" => $mybb->input['pid'],

	// Set the post data that came from the input to the $post array.
$post = array(
"pid" => $mybb->input['pid'],

		"prefix" => $mybb->get_input('threadprefix', 1),

		"prefix" => $mybb->get_input('threadprefix', MyBB::INPUT_INT),

		"subject" => $mybb->get_input('subject'),

		"subject" => $mybb->get_input('subject'),

		"icon" => $mybb->get_input('icon', 1),

		"icon" => $mybb->get_input('icon', MyBB::INPUT_INT),

		"uid" => $post['uid'],
"username" => $post['username'],
"edit_uid" => $mybb->user['uid'],

		"uid" => $post['uid'],
"username" => $post['username'],
"edit_uid" => $mybb->user['uid'],

Zeile 472Zeile 495
		"editreason" => $mybb->get_input('editreason'),
);


		"editreason" => $mybb->get_input('editreason'),
);


	$postoptions = $mybb->get_input('postoptions', 2);

	$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);

	if(!isset($postoptions['signature']))
{
$postoptions['signature'] = 0;

	if(!isset($postoptions['signature']))
{
$postoptions['signature'] = 0;

Zeile 513Zeile 536
		$db->delete_query("attachments", "filename='' OR filesize<1");

// Did the user choose to post a poll? Redirect them to the poll posting page.

		$db->delete_query("attachments", "filename='' OR filesize<1");

// Did the user choose to post a poll? Redirect them to the poll posting page.

		if($mybb->get_input('postpoll', 1) && $forumpermissions['canpostpolls'])

		if($mybb->get_input('postpoll', MyBB::INPUT_INT) && $forumpermissions['canpostpolls'])

		{

		{

			$url = "polls.php?action=newpoll&tid=$tid&polloptions=".$mybb->get_input('numpolloptions', 1);

			$url = "polls.php?action=newpoll&tid=$tid&polloptions=".$mybb->get_input('numpolloptions', MyBB::INPUT_INT);

			$lang->redirect_postedited = $lang->redirect_postedited_poll;
}
else if($visible == 0 && $first_post && !is_moderator($fid, "canviewunapprove", $mybb->user['uid']))

			$lang->redirect_postedited = $lang->redirect_postedited_poll;
}
else if($visible == 0 && $first_post && !is_moderator($fid, "canviewunapprove", $mybb->user['uid']))

Zeile 555Zeile 578
		$posticons = get_post_icons();
}


		$posticons = get_post_icons();
}


 
	$mybb->user['username'] = htmlspecialchars_uni($mybb->user['username']);

	eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");

$deletebox = '';

	eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");

$deletebox = '';

	// Can we delete posts?
if($post['visible'] != -1 && (is_moderator($fid, "candeleteposts") || $forumpermissions['candeleteposts'] == 1 && $mybb->user['uid'] == $post['uid']))

	if($post['visible'] != -1 && (($thread['firstpost'] == $pid && (is_moderator($fid, "candeletethreads") || $forumpermissions['candeletethreads'] == 1 && $mybb->user['uid'] == $post['uid'])) || ($thread['firstpost'] != $pid && (is_moderator($fid, "candeleteposts") || $forumpermissions['candeleteposts'] == 1 && $mybb->user['uid'] == $post['uid']))))


	{
eval("\$deletebox = \"".$templates->get("editpost_delete")."\";");
}

	{
eval("\$deletebox = \"".$templates->get("editpost_delete")."\";");
}

Zeile 625Zeile 648
		{
$friendlyquota = get_friendly_size($mybb->usergroup['attachquota']*1024);
}

		{
$friendlyquota = get_friendly_size($mybb->usergroup['attachquota']*1024);
}

		$friendlyusage = get_friendly_size($usage['ausage']);
$lang->attach_quota = $lang->sprintf($lang->attach_quota, $friendlyusage, $friendlyquota);














$lang->attach_quota = $lang->sprintf($lang->attach_quota, $friendlyquota);

if($usage['ausage'] !== NULL)
{
$friendlyusage = get_friendly_size($usage['ausage']);
$lang->attach_usage = $lang->sprintf($lang->attach_usage, $friendlyusage);
eval("\$link_viewattachments = \"".$templates->get("post_attachments_viewlink")."\";");
}
else
{
$lang->attach_usage = "";
}


		if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount < $mybb->settings['maxattachments']) && !$noshowattach)
{
eval("\$attach_add_options = \"".$templates->get("post_attachments_add")."\";");

		if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount < $mybb->settings['maxattachments']) && !$noshowattach)
{
eval("\$attach_add_options = \"".$templates->get("post_attachments_add")."\";");

Zeile 643Zeile 678
		}
eval("\$attachbox = \"".$templates->get("post_attachments")."\";");
}

		}
eval("\$attachbox = \"".$templates->get("post_attachments")."\";");
}

	if(!$mybb->get_input('attachmentaid', 1) && !$mybb->get_input('newattachment') && !$mybb->get_input('updateattachment') && !isset($mybb->input['previewpost']))

	if(!$mybb->get_input('attachmentaid', MyBB::INPUT_INT) && !$mybb->get_input('newattachment') && !$mybb->get_input('updateattachment') && !isset($mybb->input['previewpost']))

	{
$message = $post['message'];
$subject = $post['subject'];

	{
$message = $post['message'];
$subject = $post['subject'];

Zeile 655Zeile 690
		$subject = $mybb->get_input('subject');
$reason = htmlspecialchars_uni($mybb->get_input('editreason'));
}

		$subject = $mybb->get_input('subject');
$reason = htmlspecialchars_uni($mybb->get_input('editreason'));
}

 

$previewmessage = $message;
$previewsubject = $subject;
$message = htmlspecialchars_uni($message);
$subject = htmlspecialchars_uni($subject);


if(!isset($post_errors))
{
$post_errors = '';
}



if(!isset($post_errors))
{
$post_errors = '';
}


	$postoptions_subscriptionmethod_dont = $postoptions_subscriptionmethod_none = $postoptions_subscriptionmethod_email = $postoptions_subscriptionmethod_pm = '';

	$subscribe = $nonesubscribe = $emailsubscribe = $pmsubscribe = '';

	$postoptionschecked = array('signature' => '', 'disablesmilies' => '');


	$postoptionschecked = array('signature' => '', 'disablesmilies' => '');


	if(isset($mybb->input['previewpost']) || $post_errors)

	if(!empty($mybb->input['previewpost']) || $post_errors)

	{
// Set up posthandler.
require_once MYBB_ROOT."inc/datahandlers/post.php";

	{
// Set up posthandler.
require_once MYBB_ROOT."inc/datahandlers/post.php";

Zeile 674Zeile 714
		// Set the post data that came from the input to the $post array.
$post = array(
"pid" => $mybb->input['pid'],

		// Set the post data that came from the input to the $post array.
$post = array(
"pid" => $mybb->input['pid'],

			"prefix" => $mybb->get_input('threadprefix', 1),

			"prefix" => $mybb->get_input('threadprefix', MyBB::INPUT_INT),

			"subject" => $mybb->get_input('subject'),

			"subject" => $mybb->get_input('subject'),

			"icon" => $mybb->get_input('icon', 1),

			"icon" => $mybb->get_input('icon', MyBB::INPUT_INT),

			"uid" => $post['uid'],

			"uid" => $post['uid'],

 
			"username" => $post['username'],

			"edit_uid" => $mybb->user['uid'],
"message" => $mybb->get_input('message'),
);


			"edit_uid" => $mybb->user['uid'],
"message" => $mybb->get_input('message'),
);


		$postoptions = $mybb->get_input('postoptions', 2);

		$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);

		if(!isset($postoptions['signature']))
{
$postoptions['signature'] = 0;

		if(!isset($postoptions['signature']))
{
$postoptions['signature'] = 0;

Zeile 690Zeile 731
		if(!isset($postoptions['emailnotify']))
{
$postoptions['emailnotify'] = 0;

		if(!isset($postoptions['emailnotify']))
{
$postoptions['emailnotify'] = 0;

		}

		}

		if(!isset($postoptions['disablesmilies']))
{
$postoptions['disablesmilies'] = 0;

		if(!isset($postoptions['disablesmilies']))
{
$postoptions['disablesmilies'] = 0;

Zeile 715Zeile 756
		}
else
{

		}
else
{

			$previewmessage = $message;
$previewsubject = $subject;
$message = htmlspecialchars_uni($message);
$subject = htmlspecialchars_uni($subject);

 




			$postoptions = $mybb->get_input('postoptions', 2);

			$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);


if(isset($postoptions['signature']) && $postoptions['signature'] == 1)
{
$postoptionschecked['signature'] = " checked=\"checked\"";


if(isset($postoptions['signature']) && $postoptions['signature'] == 1)
{
$postoptionschecked['signature'] = " checked=\"checked\"";

			}

if(isset($postoptions['subscriptionmethod']) && $postoptions['subscriptionmethod'] == "none")
{
$postoptions_subscriptionmethod_none = "checked=\"checked\"";
}
else if(isset($postoptions['subscriptionmethod']) && $postoptions['subscriptionmethod'] == "email")
{
$postoptions_subscriptionmethod_email = "checked=\"checked\"";
}
else if(isset($postoptions['subscriptionmethod']) && $postoptions['subscriptionmethod'] == "pm")
{
$postoptions_subscriptionmethod_pm = "checked=\"checked\"";
}
else
{
$postoptions_subscriptionmethod_dont = "checked=\"checked\"";
}

			}



















if(isset($postoptions['disablesmilies']) && $postoptions['disablesmilies'] == 1)
{
$postoptionschecked['disablesmilies'] = " checked=\"checked\"";
}


if(isset($postoptions['disablesmilies']) && $postoptions['disablesmilies'] == 1)
{
$postoptionschecked['disablesmilies'] = " checked=\"checked\"";
}

 
			
$subscription_method = get_subscription_method($tid, $postoptions);
${$subscription_method.'subscribe'} = "checked=\"checked\" ";

		}
}


		}
}


	if(isset($mybb->input['previewpost']))

	if(!empty($mybb->input['previewpost']))

	{
if(!$post['uid'])
{

	{
if(!$post['uid'])
{

Zeile 795Zeile 818
	}
else if(!$post_errors)
{

	}
else if(!$post_errors)
{

		$message = htmlspecialchars_uni($message);
$subject = htmlspecialchars_uni($subject);


 
		$preview = '';

if($post['includesig'] != 0)

		$preview = '';

if($post['includesig'] != 0)

Zeile 810Zeile 830
			$postoptionschecked['disablesmilies'] = " checked=\"checked\"";
}


			$postoptionschecked['disablesmilies'] = " checked=\"checked\"";
}


		$query = $db->simple_select("threadsubscriptions", "notification", "tid='{$tid}' AND uid='{$mybb->user['uid']}'");
if($db->num_rows($query) > 0)
{
$notification = $db->fetch_field($query, 'notification');

if($notification == 0)
{
$postoptions_subscriptionmethod_none = "checked=\"checked\"";
}
else if($notification == 1)
{
$postoptions_subscriptionmethod_email = "checked=\"checked\"";
}
else if($notification == 2)
{
$postoptions_subscriptionmethod_pm = "checked=\"checked\"";
}
else
{
$postoptions_subscriptionmethod_dont = "checked=\"checked\"";
}
}
}


		$subscription_method = get_subscription_method($tid, $postoptions);
${$subscription_method.'subscribe'} = "checked=\"checked\" ";
}






















	// Generate thread prefix selector if this is the first post of the thread
if($thread['firstpost'] == $pid)
{

	// Generate thread prefix selector if this is the first post of the thread
if($thread['firstpost'] == $pid)
{

		if(!$mybb->get_input('threadprefix', 1))

		if(!$mybb->get_input('threadprefix', MyBB::INPUT_INT))

		{
$mybb->input['threadprefix'] = $thread['prefix'];

		{
$mybb->input['threadprefix'] = $thread['prefix'];

		}

$prefixselect = build_prefix_select($forum['fid'], $mybb->get_input('threadprefix', 1));
}

		}

$prefixselect = build_prefix_select($forum['fid'], $mybb->get_input('threadprefix', MyBB::INPUT_INT), 0, $thread['prefix']);
}

	else
{
$prefixselect = "";

	else
{
$prefixselect = "";

Zeile 864Zeile 864

// Fetch subscription select box
eval("\$subscriptionmethod = \"".$templates->get("post_subscription_method")."\";");


// Fetch subscription select box
eval("\$subscriptionmethod = \"".$templates->get("post_subscription_method")."\";");





	$query = $db->simple_select("posts", "*", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
$firstcheck = $db->fetch_array($query);


	$query = $db->simple_select("posts", "*", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));
$firstcheck = $db->fetch_array($query);


Zeile 872Zeile 872
	if($firstcheck['pid'] == $pid && $forumpermissions['canpostpolls'] != 0 && $thread['poll'] < 1 && (is_moderator($fid, "canmanagepolls") || $thread['dateline'] > ($time-($mybb->settings['polltimelimit']*60*60)) || $mybb->settings['polltimelimit'] == 0))
{
$lang->max_options = $lang->sprintf($lang->max_options, $mybb->settings['maxpolloptions']);

	if($firstcheck['pid'] == $pid && $forumpermissions['canpostpolls'] != 0 && $thread['poll'] < 1 && (is_moderator($fid, "canmanagepolls") || $thread['dateline'] > ($time-($mybb->settings['polltimelimit']*60*60)) || $mybb->settings['polltimelimit'] == 0))
{
$lang->max_options = $lang->sprintf($lang->max_options, $mybb->settings['maxpolloptions']);

		$numpolloptions = "2";

		$numpolloptions = $mybb->get_input('numpolloptions', MyBB::INPUT_INT);

		$postpollchecked = '';

		$postpollchecked = '';

 
		
if($numpolloptions < 1)
{
$numpolloptions = 2;
}

if($mybb->get_input('postpoll', MyBB::INPUT_INT) == 1)
{
$postpollchecked = 'checked="checked"';
}


		eval("\$pollbox = \"".$templates->get("newthread_postpoll")."\";");

		eval("\$pollbox = \"".$templates->get("newthread_postpoll")."\";");

	}
else

	}
else

	{
$pollbox = '';

	{
$pollbox = '';

 
	}

// Hide signature option if no permission
$signature = '';
if($mybb->usergroup['canusesig'] == 1 && !$mybb->user['suspendsignature'])
{
eval("\$signature = \"".$templates->get('editpost_signature')."\";");

	}

// Can we disable smilies or are they disabled already?

	}

// Can we disable smilies or are they disabled already?

Zeile 886Zeile 904
	if($forum['allowsmilies'] != 0)
{
eval("\$disablesmilies = \"".$templates->get("editpost_disablesmilies")."\";");

	if($forum['allowsmilies'] != 0)
{
eval("\$disablesmilies = \"".$templates->get("editpost_disablesmilies")."\";");

	}
else



	}

$postoptions = '';
if(!empty($signature) || !empty($disablesmilies))

	{

	{

		eval("\$disablesmilies = \"".$templates->get("editpost_disablesmilies_hidden")."\";");

		eval("\$postoptions = \"".$templates->get("editpost_postoptions")."\";");

	}

$moderation_notice = '';

	}

$moderation_notice = '';

Zeile 898Zeile 918
		if($forumpermissions['modattachments'] == 1  && $forumpermissions['canpostattachments'] != 0)
{
$moderation_text = $lang->moderation_forum_attachments;

		if($forumpermissions['modattachments'] == 1  && $forumpermissions['canpostattachments'] != 0)
{
$moderation_text = $lang->moderation_forum_attachments;

			eval('$moderation_notice = "'.$templates->get('global_moderation_notice').'";');
}
}


			eval('$moderation_notice = "'.$templates->get('global_moderation_notice').'";');
}
}


	if(!is_moderator($forum['fid'], "canapproveunapproveposts"))

	if(!is_moderator($forum['fid'], "canapproveunapproveposts"))

	{

	{

		if($forumpermissions['mod_edit_posts'] == 1)
{
$moderation_text = $lang->moderation_forum_edits;
eval('$moderation_notice = "'.$templates->get('global_moderation_notice').'";');
}
}

		if($forumpermissions['mod_edit_posts'] == 1)
{
$moderation_text = $lang->moderation_forum_edits;
eval('$moderation_notice = "'.$templates->get('global_moderation_notice').'";');
}
}

 

$php_max_upload_filesize = return_bytes(ini_get('max_upload_filesize'));
$php_post_max_size = return_bytes(ini_get('post_max_size'));

if ($php_max_upload_filesize != 0 && $php_post_max_size != 0)
{
$php_max_upload_size = min($php_max_upload_filesize, $php_post_max_size);
}
else
{
$php_max_upload_size = max($php_max_upload_filesize, $php_post_max_size);
}

$php_max_file_uploads = (int)ini_get('max_file_uploads');
eval("\$post_javascript = \"".$templates->get("post_javascript")."\";");


$plugins->run_hooks("editpost_end");



$plugins->run_hooks("editpost_end");