Vergleich editpost.php - 1.6.7 - 1.6.17

  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 62Zeile 62
// Get forum info
$fid = $post['fid'];
$forum = get_forum($fid);

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

 

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

if(!$forum || $forum['type'] != "f")
{
error($lang->error_closedinvalidforum);
}

if(!$forum || $forum['type'] != "f")
{
error($lang->error_closedinvalidforum);
}

if($forum['open'] == 0 || $mybb->user['suspendposting'] == 1)

if(($forum['open'] == 0 && !is_moderator($fid, "caneditposts")) || $mybb->user['suspendposting'] == 1)

{
error_no_permission();
}

{
error_no_permission();
}

Zeile 97Zeile 102
}

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

}

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

{

{

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

if($mybb->input['action'] == "deletepost" && $mybb->request_method == "post")
{
if(!is_moderator($fid, "candeleteposts"))

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

if($mybb->input['action'] == "deletepost" && $mybb->request_method == "post")
{
if(!is_moderator($fid, "candeleteposts"))

	{
if($thread['closed'] == 1)
{

	{
if($thread['closed'] == 1)
{

			error($lang->redirect_threadclosed);

			error($lang->redirect_threadclosed);

		}

		}

		if($forumpermissions['candeleteposts'] == 0)

		if($forumpermissions['candeleteposts'] == 0)

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






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

		}
}
}

		}
}
}

Zeile 124Zeile 134
	if(!is_moderator($fid, "caneditposts"))
{
if($thread['closed'] == 1)

	if(!is_moderator($fid, "caneditposts"))
{
if($thread['closed'] == 1)

		{

		{

			error($lang->redirect_threadclosed);

			error($lang->redirect_threadclosed);

		}

		}

		if($forumpermissions['caneditposts'] == 0)
{
error_no_permission();
}
if($mybb->user['uid'] != $post['uid'])

		if($forumpermissions['caneditposts'] == 0)
{
error_no_permission();
}
if($mybb->user['uid'] != $post['uid'])

		{

		{

			error_no_permission();
}
// Edit time limit

			error_no_permission();
}
// Edit time limit

Zeile 141Zeile 151
		{
$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();
}

	}
}


	}
}


Zeile 154Zeile 169
}

if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || $mybb->input['updateattachment'] || ($mybb->input['action'] == "do_editpost" && $mybb->input['submit'] && $_FILES['attachment'])))

}

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}'");
$attachcount = $db->fetch_field($query, "numattachs");


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













	// If there's an attachment, check it and upload it

	// 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($_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");


		$update_attachment = false;

		$update_attachment = false;

		if($mybb->input['updateattachment'] && ($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']))

		if($updateattach > 0 && $mybb->input['updateattachment'] && ($mybb->usergroup['caneditattachments'] || $forumpermissions['caneditattachments']))

		{
$update_attachment = true;
}

		{
$update_attachment = true;
}

Zeile 184Zeile 191
		eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");
$mybb->input['action'] = "editpost";
}

		eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");
$mybb->input['action'] = "editpost";
}

	if(!$mybb->input['submit'])
{
$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 203Zeile 210
	elseif($mybb->input['attachmentact'] == "approve" && is_moderator($fid, 'caneditposts'))
{
$update_sql = array("visible" => 1);

	elseif($mybb->input['attachmentact'] == "approve" && is_moderator($fid, 'caneditposts'))
{
$update_sql = array("visible" => 1);

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


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

	elseif($mybb->input['attachmentact'] == "unapprove" && is_moderator($fid, 'caneditposts'))
{
$update_sql = array("visible" => 0);
$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_thread_counters($post['tid'], array('attachmentcount' => "-1"));

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

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

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

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

	}
}


	}
}


Zeile 230Zeile 239
		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)

Zeile 246Zeile 255
				mark_reports($tid, "thread");
log_moderator_action($modlogdata, $lang->thread_deleted);
redirect(get_forum_link($fid), $lang->redirect_threaddeleted);

				mark_reports($tid, "thread");
log_moderator_action($modlogdata, $lang->thread_deleted);
redirect(get_forum_link($fid), $lang->redirect_threaddeleted);

			}
else
{

			}
else
{

				error_no_permission();
}
}

				error_no_permission();
}
}

Zeile 281Zeile 290
	else
{
error($lang->redirect_nodelete);

	else
{
error($lang->redirect_nodelete);

	}
}


	}
}


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

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

Zeile 352Zeile 361
			$url = get_thread_link($tid);
}
// Otherwise, send them back to their post

			$url = get_thread_link($tid);
}
// Otherwise, send them back to their post

		else

		else

		{
$lang->redirect_postedited .= $lang->redirect_postedited_redirect;
$url = get_post_link($pid, $tid)."#pid{$pid}";

		{
$lang->redirect_postedited .= $lang->redirect_postedited_redirect;
$url = get_post_link($pid, $tid)."#pid{$pid}";

		}

		}

		$plugins->run_hooks("editpost_do_editpost_end");

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

		$plugins->run_hooks("editpost_do_editpost_end");

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

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

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





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

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

	}


	}


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

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

	}


	}


	if($mybb->user['uid'] != 0)
{
eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");

	if($mybb->user['uid'] != 0)
{
eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");

Zeile 385Zeile 394
	{
eval("\$loginbox = \"".$templates->get("loginbox")."\";");
}

	{
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 458Zeile 456
		$lang->attach_quota = $lang->sprintf($lang->attach_quota, $friendlyusage, $friendlyquota);
if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount < $mybb->settings['maxattachments']) && !$noshowattach)
{

		$lang->attach_quota = $lang->sprintf($lang->attach_quota, $friendlyusage, $friendlyquota);
if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount < $mybb->settings['maxattachments']) && !$noshowattach)
{

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




			eval("\$attach_add_options = \"".$templates->get("post_attachments_add")."\";");
}

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





 
		if($attach_add_options || $attach_update_options)
{

			eval("\$newattach = \"".$templates->get("post_attachments_new")."\";");
}

			eval("\$newattach = \"".$templates->get("post_attachments_new")."\";");
}

 


		eval("\$attachbox = \"".$templates->get("post_attachments")."\";");
}
if(!$mybb->input['attachmentaid'] && !$mybb->input['newattachment'] && !$mybb->input['updateattachment'] && !$mybb->input['previewpost'] && !$maximageserror)

		eval("\$attachbox = \"".$templates->get("post_attachments")."\";");
}
if(!$mybb->input['attachmentaid'] && !$mybb->input['newattachment'] && !$mybb->input['updateattachment'] && !$mybb->input['previewpost'] && !$maximageserror)

Zeile 484Zeile 488
		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 500Zeile 504
		{
$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 529Zeile 533
			$postoptions = $mybb->input['postoptions'];

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

			$postoptions = $mybb->input['postoptions'];

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

			{

			{

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

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

			}

			}


if($postoptions['subscriptionmethod'] == "none")
{
$postoptions_subscriptionmethod_none = "checked=\"checked\"";
}
else if($postoptions['subscriptionmethod'] == "instant")


if($postoptions['subscriptionmethod'] == "none")
{
$postoptions_subscriptionmethod_none = "checked=\"checked\"";
}
else if($postoptions['subscriptionmethod'] == "instant")

			{

			{

				$postoptions_subscriptionmethod_instant = "checked=\"checked\"";
}
else

				$postoptions_subscriptionmethod_instant = "checked=\"checked\"";
}
else

Zeile 555Zeile 559

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


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

		// Figure out the poster's other information.
$query = $db->query("
SELECT u.*, f.*, p.dateline
FROM ".TABLE_PREFIX."users u
LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.uid=u.uid)
WHERE u.uid='{$post['uid']}' AND p.pid='{$pid}'
LIMIT 1
");
$postinfo = $db->fetch_array($query);











		if(!$post['uid'])
{
$query = $db->simple_select('posts', 'username', "pid='{$pid}'");
$postinfo['username'] = $db->fetch_field($query, 'username');
}
else
{
// Figure out the poster's other information.
$query = $db->query("
SELECT u.*, f.*, p.dateline
FROM ".TABLE_PREFIX."users u
LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)
LEFT JOIN ".TABLE_PREFIX."posts p ON (p.uid=u.uid)
WHERE u.uid='{$post['uid']}' AND p.pid='{$pid}'
LIMIT 1
");
$postinfo = $db->fetch_array($query);
$postinfo['userusername'] = $postinfo['username'];
}


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

Zeile 573Zeile 586
		}

// Set the values of the post info array.

		}

// Set the values of the post info array.

		$postinfo['userusername'] = $postinfo['username'];

 
		$postinfo['message'] = $previewmessage;
$postinfo['subject'] = $previewsubject;
$postinfo['icon'] = $icon;

		$postinfo['message'] = $previewmessage;
$postinfo['subject'] = $previewsubject;
$postinfo['icon'] = $icon;

Zeile 583Zeile 595
		eval("\$preview = \"".$templates->get("previewpost")."\";");
}
else if(!$post_errors)

		eval("\$preview = \"".$templates->get("previewpost")."\";");
}
else if(!$post_errors)

	{

	{

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


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


Zeile 601Zeile 613
		if($db->num_rows($query) > 0)
{
$notification = $db->fetch_field($query, 'notification');

		if($db->num_rows($query) > 0)
{
$notification = $db->fetch_field($query, 'notification');





			if($notification ==  0)

			if($notification ==  0)

			{

			{

				$postoptions_subscriptionmethod_none = "checked=\"checked\"";
}
else if($notification == 1)
{
$postoptions_subscriptionmethod_instant = "checked=\"checked\"";

				$postoptions_subscriptionmethod_none = "checked=\"checked\"";
}
else if($notification == 1)
{
$postoptions_subscriptionmethod_instant = "checked=\"checked\"";

			}

			}

			else
{
$postoptions_subscriptionmethod_dont = "checked=\"checked\"";
}
}
}

			else
{
$postoptions_subscriptionmethod_dont = "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(!intval($mybb->input['threadprefix']))
{
$mybb->input['threadprefix'] = $thread['prefix'];
}

		if(!intval($mybb->input['threadprefix']))
{
$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 657
		$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")."\";");