Vergleich editpost.php - 1.8.10 - 1.8.19

  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,post_attachments_attachment_postinsert,post_attachments_attachment_mod_unapprove,postbit_attachments_thumbnails,posticons";
$templatelist .= ",editpost_delete,forumdisplay_password_wrongpass,forumdisplay_password,editpost_reason,post_attachments_attachment_remove,post_attachments_update,post_subscription_method";
$templatelist .= ",postbit_avatar,postbit_find,postbit_pm,postbit_rep_button,postbit_www,postbit_email,postbit_reputation,postbit_warn,postbit_warninglevel,postbit_author_user,error_attacherror";

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

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

Zeile 49Zeile 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 185Zeile 185

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


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

	error($lang->error_cannot_upload_php_post);

	error($lang->error_empty_post_input);

}

$attacherror = '';

}

$attacherror = '';

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


	// If there's an attachment, check it and upload it
if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0)

	if($pid)


	{

	{

		$query = $db->simple_select("attachments", "aid", "filename='".$db->escape_string($_FILES['attachment']['name'])."' AND pid='{$pid}'");
$updateattach = $db->fetch_field($query, "aid");

$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']))
{
$mybb->input['action'] = "editpost";
}
}







		$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['submit']))
{
$mybb->input['action'] = "editpost";
}
}


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
{


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
{

Zeile 225Zeile 230

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


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

	{

	{

		remove_attachment($pid, "", $mybb->input['attachmentaid']);

		remove_attachment($pid, "", $mybb->input['attachmentaid']);

	}

	}

	elseif($mybb->get_input('attachmentact') == "approve" && is_moderator($fid, 'canapproveunapproveattachs'))
{
$update_sql = array("visible" => 1);

	elseif($mybb->get_input('attachmentact') == "approve" && is_moderator($fid, 'canapproveunapproveattachs'))
{
$update_sql = array("visible" => 1);

Zeile 235Zeile 240
		update_thread_counters($post['tid'], array('attachmentcount' => "+1"));
}
elseif($mybb->get_input('attachmentact') == "unapprove" && is_moderator($fid, 'canapproveunapproveattachs'))

		update_thread_counters($post['tid'], array('attachmentcount' => "+1"));
}
elseif($mybb->get_input('attachmentact') == "unapprove" && is_moderator($fid, 'canapproveunapproveattachs'))

	{

	{

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

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

	}

	}

	if(!isset($mybb->input['submit']))
{
$mybb->input['action'] = "editpost";
}
}

	if(!isset($mybb->input['submit']))
{
$mybb->input['action'] = "editpost";
}
}





if($mybb->input['action'] == "deletepost" && $mybb->request_method == "post")
{
// Verify incoming POST request

if($mybb->input['action'] == "deletepost" && $mybb->request_method == "post")
{
// Verify incoming POST request

Zeile 276Zeile 281
				$moderation = new Moderation;

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

				$moderation = new Moderation;

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

				{

				{

					$modlogdata['pid'] = $pid;

$moderation->soft_delete_threads(array($tid));
log_moderator_action($modlogdata, $lang->thread_soft_deleted);

					$modlogdata['pid'] = $pid;

$moderation->soft_delete_threads(array($tid));
log_moderator_action($modlogdata, $lang->thread_soft_deleted);

				}

				}

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

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

				}

				}


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


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

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

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

					}
else
{

					}
else
{

Zeile 304Zeile 309
				else
{
redirect(get_forum_link($fid), $lang->redirect_threaddeleted);

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

				}
}
else
{
error_no_permission();
}

				}
}
else
{
error_no_permission();
}

		}
else
{

		}
else
{

Zeile 349Zeile 354
					header("Content-type: application/json; charset={$lang->settings['charset']}");
if(is_moderator($fid, "canviewdeleted"))
{

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

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

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

					}
else
{

					}
else
{

Zeile 374Zeile 379
}

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

}

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

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


	$plugins->run_hooks("editpost_restorepost");

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

	$plugins->run_hooks("editpost_restorepost");

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

Zeile 407Zeile 412
				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 433Zeile 438
				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 553Zeile 558
	if(!isset($mybb->input['previewpost']))
{
$icon = $post['icon'];

	if(!isset($mybb->input['previewpost']))
{
$icon = $post['icon'];

	}


	}


	if($forum['allowpicons'] != 0)
{
$posticons = get_post_icons();

	if($forum['allowpicons'] != 0)
{
$posticons = get_post_icons();

Zeile 585Zeile 590
			if($mybb->settings['bbcodeinserter'] != 0 && $forum['allowmycode'] != 0 && $mybb->user['showcodebuttons'] != 0)
{
eval("\$postinsert = \"".$templates->get("post_attachments_attachment_postinsert")."\";");

			if($mybb->settings['bbcodeinserter'] != 0 && $forum['allowmycode'] != 0 && $mybb->user['showcodebuttons'] != 0)
{
eval("\$postinsert = \"".$templates->get("post_attachments_attachment_postinsert")."\";");

			}

			}

			// Moderating options
$attach_mod_options = '';
if(is_moderator($fid))

			// Moderating options
$attach_mod_options = '';
if(is_moderator($fid))

Zeile 618Zeile 623
		if($usage['ausage'] > ($mybb->usergroup['attachquota']*1024) && $mybb->usergroup['attachquota'] != 0)
{
$noshowattach = 1;

		if($usage['ausage'] > ($mybb->usergroup['attachquota']*1024) && $mybb->usergroup['attachquota'] != 0)
{
$noshowattach = 1;

		}

		}

		else
{
$noshowattach = 0;

		else
{
$noshowattach = 0;

Zeile 641Zeile 646
		if(($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']) && $attachcount > 0)
{
eval("\$attach_update_options = \"".$templates->get("post_attachments_update")."\";");

		if(($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']) && $attachcount > 0)
{
eval("\$attach_update_options = \"".$templates->get("post_attachments_update")."\";");

		}


		}


		if($attach_add_options || $attach_update_options)
{
eval("\$newattach = \"".$templates->get("post_attachments_new")."\";");

		if($attach_add_options || $attach_update_options)
{
eval("\$newattach = \"".$templates->get("post_attachments_new")."\";");

Zeile 667Zeile 672
		$post_errors = '';
}


		$post_errors = '';
}


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

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

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

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

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

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

Zeile 676Zeile 681
		require_once MYBB_ROOT."inc/datahandlers/post.php";
$posthandler = new PostDataHandler("update");
$posthandler->action = "post";

		require_once MYBB_ROOT."inc/datahandlers/post.php";
$posthandler = new PostDataHandler("update");
$posthandler->action = "post";





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

Zeile 687Zeile 692
			"username" => $post['username'],
"edit_uid" => $mybb->user['uid'],
"message" => $mybb->get_input('message'),

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

		);

		);


$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(!isset($postoptions['signature']))


$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(!isset($postoptions['signature']))

Zeile 709Zeile 714
			"emailnotify" => $postoptions['emailnotify'],
"disablesmilies" => $postoptions['disablesmilies']
);

			"emailnotify" => $postoptions['emailnotify'],
"disablesmilies" => $postoptions['disablesmilies']
);





		$posthandler->set_data($post);

// Now let the post handler do all the hard work.

		$posthandler->set_data($post);

// Now let the post handler do all the hard work.

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

if(isset($postoptions['signature']) && $postoptions['signature'] == 1)

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

if(isset($postoptions['signature']) && $postoptions['signature'] == 1)

			{

			{

				$postoptionschecked['signature'] = " checked=\"checked\"";

				$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(!empty($mybb->input['previewpost']))
{


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

Zeile 782Zeile 773

$query = $db->simple_select("attachments", "*", "pid='{$pid}'");
while($attachment = $db->fetch_array($query))


$query = $db->simple_select("attachments", "*", "pid='{$pid}'");
while($attachment = $db->fetch_array($query))

		{

		{

			$attachcache[0][$attachment['aid']] = $attachment;
}


			$attachcache[0][$attachment['aid']] = $attachment;
}


Zeile 808Zeile 799
		$preview = '';

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

		$preview = '';

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

		{

		{

			$postoptionschecked['signature'] = " checked=\"checked\"";

			$postoptionschecked['signature'] = " checked=\"checked\"";

		}


		}


		if($post['smilieoff'] == 1)

		if($post['smilieoff'] == 1)

		{

		{

			$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

	}

// Generate thread prefix selector if this is the first post of the thread

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

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