Vergleich editpost.php - 1.6.8 - 1.6.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: editpost.php 5746 2012-02-03 10:03:25Z Tomm $

 * $Id$

 */

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


 */

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


$templatelist = "editpost,previewpost,redirect_postedited,loginbox,posticons,changeuserbox,attachment,posticons,codebuttons,smilieinsert,post_attachments_attachment_postinsert,post_attachments_attachment_mod_approve,post_attachments_attachment_unapproved,post_attachments_attachment_mod_unapprove,post_attachments_attachment,post_attachments_new,post_attachments,newthread_postpoll,editpost_disablesmilies,post_subscription_method,post_attachments_attachment_remove";

$templatelist = "editpost,previewpost,loginbox,posticons,changeuserbox,codebuttons,smilieinsert,smilieinsert_getmore,post_attachments_attachment_postinsert,post_attachments_attachment_mod_approve,post_attachments_attachment_unapproved,post_attachments_attachment_mod_unapprove,post_attachments_attachment,post_attachments_new,post_attachments,newthread_postpoll,editpost_disablesmilies,post_subscription_method,post_attachments_attachment_remove,post_attachments_update,postbit_author_guest,error_attacherror,forumdisplay_password_wrongpass,forumdisplay_password";


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


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

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

			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();
}

		{
error_no_permission();
}

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

Zeile 141Zeile 146
		{
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
error($lang->edit_time_limit);

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

		}






		}
// User can't edit unapproved post
if($post['visible'] == 0)
{
error_no_permission();
}

	}
}

	}
}





// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);

if((empty($_POST) && empty($_FILES)) && $mybb->input['processed'] == '1')

// Check if this forum is password protected and we have a valid password
check_forum_password($forum['fid']);

if((empty($_POST) && empty($_FILES)) && $mybb->input['processed'] == '1')

{

{

	error($lang->error_cannot_upload_php_post);
}

	error($lang->error_cannot_upload_php_post);
}





if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || $mybb->input['updateattachment'] || ($mybb->input['action'] == "do_editpost" && $mybb->input['submit'] && $_FILES['attachment'])))
{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || $mybb->input['updateattachment'] || ($mybb->input['action'] == "do_editpost" && $mybb->input['submit'] && $_FILES['attachment'])))
{
// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

	
if($mybb->input['posthash'])
{
$posthash_query = "posthash='".$db->escape_string($mybb->input['posthash'])."' OR ";
}
else
{
$posthash_query = "";
}
$query = $db->simple_select("attachments", "COUNT(aid) as numattachs", "{$posthash_query}pid='{$pid}'");


$query = $db->simple_select("attachments", "COUNT(aid) as numattachs", "pid='{$pid}'");









	$attachcount = $db->fetch_field($query, "numattachs");

	$attachcount = $db->fetch_field($query, "numattachs");

	



	// If there's an attachment, check it and upload it
if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0 && ($mybb->settings['maxattachments'] == 0 || $attachcount < $mybb->settings['maxattachments']))
{

	// If there's an attachment, check it and upload it
if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0 && ($mybb->settings['maxattachments'] == 0 || $attachcount < $mybb->settings['maxattachments']))
{

Zeile 182Zeile 184
	if($attachedfile['error'])
{
eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");

	if($attachedfile['error'])
{
eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");

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

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

}

}





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

if($mybb->input['attachmentaid'] && 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->input['my_post_key']);

	// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

	



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

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

Zeile 206Zeile 208
		$db->update_query("attachments", $update_sql, "aid='{$mybb->input['attachmentaid']}'");
}
elseif($mybb->input['attachmentact'] == "unapprove" && is_moderator($fid, 'caneditposts'))

		$db->update_query("attachments", $update_sql, "aid='{$mybb->input['attachmentaid']}'");
}
elseif($mybb->input['attachmentact'] == "unapprove" && is_moderator($fid, 'caneditposts'))

	{

	{

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

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

Zeile 222Zeile 224
	verify_post_check($mybb->input['my_post_key']);

$plugins->run_hooks("editpost_deletepost");

	verify_post_check($mybb->input['my_post_key']);

$plugins->run_hooks("editpost_deletepost");





	if($mybb->input['delete'] == 1)
{
$query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));

	if($mybb->input['delete'] == 1)
{
$query = $db->simple_select("posts", "pid", "tid='{$tid}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "asc"));

Zeile 230Zeile 232
		if($firstcheck['pid'] == $pid)
{
$firstpost = 1;

		if($firstcheck['pid'] == $pid)
{
$firstpost = 1;

		}

		}

		else
{
$firstpost = 0;
}

		else
{
$firstpost = 0;
}

		



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

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

		{

		{

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

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

Zeile 255Zeile 257
		else
{
if($forumpermissions['candeleteposts'] == 1 || is_moderator($fid, "candeleteposts"))

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

			{

			{

				// Select the first post before this
delete_post($pid, $tid);
mark_reports($pid, "post");

				// Select the first post before this
delete_post($pid, $tid);
mark_reports($pid, "post");

Zeile 263Zeile 265
				$query = $db->simple_select("posts", "pid", "tid='{$tid}' AND dateline <= '{$post['dateline']}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "desc"));
$next_post = $db->fetch_array($query);
if($next_post['pid'])

				$query = $db->simple_select("posts", "pid", "tid='{$tid}' AND dateline <= '{$post['dateline']}'", array("limit" => 1, "order_by" => "dateline", "order_dir" => "desc"));
$next_post = $db->fetch_array($query);
if($next_post['pid'])

				{

				{

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

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

				}

				}

				else
{
$redirect = get_thread_link($tid);
}
redirect($redirect, $lang->redirect_postdeleted);

				else
{
$redirect = get_thread_link($tid);
}
redirect($redirect, $lang->redirect_postdeleted);

			}

			}

			else
{
error_no_permission();

			else
{
error_no_permission();

Zeile 295Zeile 297
	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 319Zeile 321

// Now let the post handler do all the hard work.
if(!$posthandler->validate_post())


// Now let the post handler do all the hard work.
if(!$posthandler->validate_post())

	{

	{

		$post_errors = $posthandler->get_friendly_errors();
$post_errors = inline_error($post_errors);
$mybb->input['action'] = "editpost";

		$post_errors = $posthandler->get_friendly_errors();
$post_errors = inline_error($post_errors);
$mybb->input['action'] = "editpost";

Zeile 336Zeile 338

// Did the user choose to post a poll? Redirect them to the poll posting page.
if($mybb->input['postpoll'] && $forumpermissions['canpostpolls'])


// Did the user choose to post a poll? Redirect them to the poll posting page.
if($mybb->input['postpoll'] && $forumpermissions['canpostpolls'])

		{

		{

			$url = "polls.php?action=newpoll&tid=$tid&polloptions=".intval($mybb->input['numpolloptions']);
$lang->redirect_postedited = $lang->redirect_postedited_poll;
}

			$url = "polls.php?action=newpoll&tid=$tid&polloptions=".intval($mybb->input['numpolloptions']);
$lang->redirect_postedited = $lang->redirect_postedited_poll;
}

Zeile 360Zeile 362
		$plugins->run_hooks("editpost_do_editpost_end");

redirect($url, $lang->redirect_postedited);

		$plugins->run_hooks("editpost_do_editpost_end");

redirect($url, $lang->redirect_postedited);

	}

	}

}

}





if(!$mybb->input['action'] || $mybb->input['action'] == "editpost")
{
$plugins->run_hooks("editpost_action_start");

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

if(!$mybb->input['action'] || $mybb->input['action'] == "editpost")
{
$plugins->run_hooks("editpost_action_start");

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

	{

	{

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


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


Zeile 384Zeile 386
	else
{
eval("\$loginbox = \"".$templates->get("loginbox")."\";");

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

	}

// Setup a unique posthash for attachment management
$posthash = htmlspecialchars_uni($post['posthash']);

	}





$bgcolor = "trow1";
if($forumpermissions['canpostattachments'] != 0)
{ // Get a listing of the current attachments, if there are any
$attachcount = 0;


$bgcolor = "trow1";
if($forumpermissions['canpostattachments'] != 0)
{ // Get a listing of the current attachments, if there are any
$attachcount = 0;

		if($posthash)
{
$posthash_query = "posthash='{$posthash}' OR ";
}
else
{
$posthash_query = "";
}
$query = $db->simple_select("attachments", "*", "{$posthash_query}pid='{$pid}'");

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









		$attachments = '';
while($attachment = $db->fetch_array($query))
{

		$attachments = '';
while($attachment = $db->fetch_array($query))
{

Zeile 484Zeile 475
		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 501Zeile 492
			$post['uid'] = $mybb->user['uid'];
$post['username'] = $mybb->user['username'];
}

			$post['uid'] = $mybb->user['uid'];
$post['username'] = $mybb->user['username'];
}

	



		// Set up the post options from the input.
$post['options'] = array(
"signature" => $mybb->input['postoptions']['signature'],
"emailnotify" => $mybb->input['postoptions']['emailnotify'],
"disablesmilies" => $mybb->input['postoptions']['disablesmilies']
);

		// Set up the post options from the input.
$post['options'] = array(
"signature" => $mybb->input['postoptions']['signature'],
"emailnotify" => $mybb->input['postoptions']['emailnotify'],
"disablesmilies" => $mybb->input['postoptions']['disablesmilies']
);

	



		$posthandler->set_data($post);

		$posthandler->set_data($post);

	



		// Now let the post handler do all the hard work.
if(!$posthandler->validate_post())
{

		// Now let the post handler do all the hard work.
if(!$posthandler->validate_post())
{

Zeile 588Zeile 579
		$subject = htmlspecialchars_uni($subject);

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

		$subject = htmlspecialchars_uni($subject);

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

		{

		{

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

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

		}


		}


		if($post['smilieoff'] == 1)
{
$postoptionschecked['disablesmilies'] = " checked=\"checked\"";

		if($post['smilieoff'] == 1)
{
$postoptionschecked['disablesmilies'] = " checked=\"checked\"";

		}


		}


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

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

Zeile 616Zeile 607
			}
}
}

			}
}
}

	



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

Zeile 624Zeile 615
		{
$mybb->input['threadprefix'] = $thread['prefix'];
}

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

		



		$prefixselect = build_prefix_select($forum['fid'], $mybb->input['threadprefix']);
}
else
{
$prefixselect = "";

		$prefixselect = build_prefix_select($forum['fid'], $mybb->input['threadprefix']);
}
else
{
$prefixselect = "";

	}


	}


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

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

Zeile 645Zeile 636
		$numpolloptions = "2";
eval("\$pollbox = \"".$templates->get("newthread_postpoll")."\";");
}

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

	



	// Can we disable smilies or are they disabled already?
if($forum['allowsmilies'] != 0)

	// Can we disable smilies or are they disabled already?
if($forum['allowsmilies'] != 0)

	{

	{

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

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

	}

	}

	else
{
$disablesmilies = "<input type=\"hidden\" name=\"postoptions[disablesmilies]\" value=\"no\" />";
}

	else
{
$disablesmilies = "<input type=\"hidden\" name=\"postoptions[disablesmilies]\" value=\"no\" />";
}





	$plugins->run_hooks("editpost_end");

	$plugins->run_hooks("editpost_end");

	



	$forum['name'] = strip_tags($forum['name']);

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

	$forum['name'] = strip_tags($forum['name']);

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