Vergleich editpost.php - 1.2.2 - 1.2.14

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *

 *

 * $Id: editpost.php 2385 2006-11-06 23:40:55Z Tikitiki $

 * $Id: editpost.php 3951 2008-06-25 21:10:59Z Tikitiki $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 83Zeile 83
}

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

}

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

{

{	

	if(is_moderator($fid, "candeleteposts") != "yes")

	if(is_moderator($fid, "candeleteposts") != "yes")

	{
if($thread['closed'] == "yes")
{
error($lang->redirect_threadclosed);
}

	{
if($thread['closed'] == "yes")
{
error($lang->redirect_threadclosed);
}

		if($forumpermissions['candeleteposts'] == "no")

		if($forumpermissions['candeleteposts'] == "no")

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

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

			error_no_permission();
}
}
}
else

			error_no_permission();
}
}
}
else

{

{	

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

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

Zeile 127Zeile 127
}

// Password protected forums

}

// Password protected forums

check_forum_password($fid, $forum['password']);

check_forum_password($forum['parentlist']);


if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || ($mybb->input['action'] == "do_editpost" && $mybb->input['submit'] && $_FILES['attachment'])))
{
// If there's an attachment, check it and upload it
if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != "no")


if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || ($mybb->input['action'] == "do_editpost" && $mybb->input['submit'] && $_FILES['attachment'])))
{
// If there's an attachment, check it and upload it
if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != "no")

	{

	{

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

		$attachedfile = upload_attachment($_FILES['attachment']);
}
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'])) // 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

{ 
$mybb->input['attachmentaid'] = intval($mybb->input['attachmentaid']);

{ 
$mybb->input['attachmentaid'] = intval($mybb->input['attachmentaid']);

	if($mybb->input['attachmentact'] == "remove")

	if($mybb->input['attachmentact'] == "remove" && $mybb->input['posthash'])

	{
remove_attachment($pid, $mybb->input['posthash'], $mybb->input['attachmentaid']);
}

	{
remove_attachment($pid, $mybb->input['posthash'], $mybb->input['attachmentaid']);
}

	elseif($mybb->input['attachmentact'] == "approve")

	elseif($mybb->input['attachmentact'] == "approve" && is_moderator($fid, 'caneditposts') == 'yes')

	{
$update_sql = array("visible" => 1);

	{
$update_sql = array("visible" => 1);

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

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

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

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

Zeile 172Zeile 172

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


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

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


	$plugins->run_hooks("editpost_deletepost");

if($mybb->input['delete'] == "yes")

	$plugins->run_hooks("editpost_deletepost");

if($mybb->input['delete'] == "yes")

Zeile 185Zeile 188
		else
{
$firstpost = 0;

		else
{
$firstpost = 0;

		}

		}

		$modlogdata['fid'] = $fid;
$modlogdata['tid'] = $tid;
if($firstpost)
{
if($forumpermissions['candeletethreads'] == "yes")

		$modlogdata['fid'] = $fid;
$modlogdata['tid'] = $tid;
if($firstpost)
{
if($forumpermissions['candeletethreads'] == "yes")

			{

			{

				delete_thread($tid);

				delete_thread($tid);

				update_forum_count($fid);

 
				mark_reports($tid, "thread");

				mark_reports($tid, "thread");

				if(is_moderator($fid, "candeleteposts") != "yes")
{
log_moderator_action($modlogdata, "Deleted Thread");
}

				log_moderator_action($modlogdata, "Deleted Thread");




				redirect("forumdisplay.php?fid=$fid", $lang->redirect_threaddeleted);

				redirect("forumdisplay.php?fid=$fid", $lang->redirect_threaddeleted);

			}
else
{

			}
else
{

				error_no_permission();
}
}

				error_no_permission();
}
}

Zeile 212Zeile 211
			{
// Select the first post before this
delete_post($pid, $tid);

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

				update_thread_count($tid);
update_forum_count($fid);

 
				mark_reports($pid, "post");

				mark_reports($pid, "post");

				if(is_moderator($fid, "candeleteposts") != "yes")
{
log_moderator_action($modlogdata, "Deleted Post");
}

				log_moderator_action($modlogdata, "Deleted Post");




				$query = $db->simple_select(TABLE_PREFIX."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(TABLE_PREFIX."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'])

Zeile 244Zeile 238
}

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

}

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

{




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


	$plugins->run_hooks("editpost_do_editpost_start");

// Set up posthandler.

	$plugins->run_hooks("editpost_do_editpost_start");

// Set up posthandler.

Zeile 262Zeile 258
		"username" => $mybb->user['username'],
"edit_uid" => $mybb->user['uid'],
"message" => $mybb->input['message'],

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

	);


	);


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

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

Zeile 275Zeile 271

// 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 293Zeile 289
		{
$url = "polls.php?action=newpoll&tid=$tid&polloptions=".$mybb->input['numpolloptions'];
$redirect = $lang->redirect_postedited_poll;

		{
$url = "polls.php?action=newpoll&tid=$tid&polloptions=".$mybb->input['numpolloptions'];
$redirect = $lang->redirect_postedited_poll;

		}

		}

		// Otherwise, send them back to their post
else
{

		// Otherwise, send them back to their post
else
{

Zeile 316Zeile 312
	}

if($forum['allowpicons'] != "no")

	}

if($forum['allowpicons'] != "no")

	{

	{

		$posticons = get_post_icons();
}


		$posticons = get_post_icons();
}


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

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





	// Setup a unique posthash for attachment management
$query = $db->simple_select(TABLE_PREFIX."posts", "posthash", "pid='{$pid}'");
$posthash = $db->fetch_field($query, "posthash");

	// Setup a unique posthash for attachment management
$query = $db->simple_select(TABLE_PREFIX."posts", "posthash", "pid='{$pid}'");
$posthash = $db->fetch_field($query, "posthash");

Zeile 340Zeile 336
		if($posthash)
{
$posthash_query = "posthash='{$posthash}' OR ";

		if($posthash)
{
$posthash_query = "posthash='{$posthash}' OR ";

		}
else

		}
else

		{
$posthash_query = "";
}

		{
$posthash_query = "";
}

Zeile 362Zeile 358
				if($attachment['visible'] == 1)
{
eval("\$attach_mod_options = \"".$templates->get("post_attachments_attachment_mod_unapprove")."\";");

				if($attachment['visible'] == 1)
{
eval("\$attach_mod_options = \"".$templates->get("post_attachments_attachment_mod_unapprove")."\";");

				}

				}

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

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

Zeile 380Zeile 376
		}
$query = $db->query("SELECT SUM(filesize) AS ausage FROM ".TABLE_PREFIX."attachments WHERE uid='".$mybb->user['uid']."'");
$usage = $db->fetch_array($query);

		}
$query = $db->query("SELECT SUM(filesize) AS ausage FROM ".TABLE_PREFIX."attachments WHERE uid='".$mybb->user['uid']."'");
$usage = $db->fetch_array($query);

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

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

			$noshowattach = 1;

			$noshowattach = 1;

		}

		}

		if($mybb->usergroup['attachquota'] == 0)

		if($mybb->usergroup['attachquota'] == 0)

		{

		{

			$friendlyquota = $lang->unlimited;

			$friendlyquota = $lang->unlimited;

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

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

		$friendlyusage = get_friendly_size($usage['ausage']);
$lang->attach_quota = sprintf($lang->attach_quota, $friendlyusage, $friendlyquota);
if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount <= $mybb->settings['maxattachments']) && !$noshowattach)
{
eval("\$newattach = \"".$templates->get("post_attachments_new")."\";");

		$friendlyusage = get_friendly_size($usage['ausage']);
$lang->attach_quota = sprintf($lang->attach_quota, $friendlyusage, $friendlyquota);
if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount <= $mybb->settings['maxattachments']) && !$noshowattach)
{
eval("\$newattach = \"".$templates->get("post_attachments_new")."\";");

		}

		}

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

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

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

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


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


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

	{

	{

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

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

if($postoptions['signature'] == "yes")
{
$postoptionschecked['signature'] = "checked=\"checked\"";
}
if($postoptions['emailnotify'] == "yes")
{
$postoptionschecked['emailnotify'] = "checked=\"checked\"";

























		// Set up posthandler.
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'],
"subject" => $mybb->input['subject'],
"icon" => $mybb->input['icon'],
"uid" => $post['uid'],
"edit_uid" => $mybb->user['uid'],
"message" => $mybb->input['message'],
);

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

$posthandler->set_data($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";
$mybb->input['previewpost'] = 0;

		}

		}

		if($postoptions['disablesmilies'] == "yes")

		else

		{

		{

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




















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

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

if($postoptions['signature'] == "yes")
{
$postoptionschecked['signature'] = "checked=\"checked\"";
}
if($postoptions['emailnotify'] == "yes")
{
$postoptionschecked['emailnotify'] = "checked=\"checked\"";
}
if($postoptions['disablesmilies'] == "yes")
{
$postoptionschecked['disablesmilies'] = "checked=\"checked\"";
}

$pid = intval($mybb->input['pid']);

		}

		}


$pid = intval($mybb->input['pid']);

 
	}

if($mybb->input['previewpost'])
{
// Figure out the poster's other information.
$query = $db->query("

	}

if($mybb->input['previewpost'])
{
// Figure out the poster's other information.
$query = $db->query("

			SELECT u.*, f.*

			SELECT u.*, f.*, p.dateline

			FROM ".TABLE_PREFIX."users u
LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)

			FROM ".TABLE_PREFIX."users u
LEFT JOIN ".TABLE_PREFIX."userfields f ON (f.ufid=u.uid)

			WHERE u.uid='".$post['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);

			LIMIT 1
");
$postinfo = $db->fetch_array($query);

Zeile 463Zeile 501
		}

// Set the values of the post info array.

		}

// Set the values of the post info array.

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

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

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

		$postinfo['uid'] = $postinfo['uid'];

 
		$postinfo['message'] = $previewmessage;
$postinfo['subject'] = $subject;
$postinfo['icon'] = $icon;
$postinfo['smilieoff'] = $postoptions['disablesmilies'];

		$postinfo['message'] = $previewmessage;
$postinfo['subject'] = $subject;
$postinfo['icon'] = $icon;
$postinfo['smilieoff'] = $postoptions['disablesmilies'];

		$postinfo['dateline'] = time();

 

$postbit = build_postbit($postinfo, 1);
eval("\$preview = \"".$templates->get("previewpost")."\";");
}


$postbit = build_postbit($postinfo, 1);
eval("\$preview = \"".$templates->get("previewpost")."\";");
}

	elseif(!$post_errors)

	else if(!$post_errors)

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

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

Zeile 487Zeile 522
		if($post['smilieoff'] == "yes")
{
$postoptionschecked['disablesmilies'] = "checked=\"checked\"";

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

		}
// Can we disable smilies or are they disabled already?
if($forum['allowsmilies'] != "no")
{
eval("\$disablesmilies = \"".$templates->get("editpost_disablesmilies")."\";");
}
else
{
$disablesmilies = "<input type=\"hidden\" name=\"postoptions[disablesmilies]\" value=\"no\" />";

 
		}
$query = $db->simple_select(TABLE_PREFIX."favorites", "*", "type='s' AND tid='{$tid}' AND uid='{$mybb->user['uid']}'");
$subcheck = $db->fetch_array($query);

		}
$query = $db->simple_select(TABLE_PREFIX."favorites", "*", "type='s' AND tid='{$tid}' AND uid='{$mybb->user['uid']}'");
$subcheck = $db->fetch_array($query);

Zeile 503Zeile 529
		{
$postoptionschecked['emailnotify'] = "checked=\"checked\"";
}

		{
$postoptionschecked['emailnotify'] = "checked=\"checked\"";
}

 
	}

// Can we disable smilies or are they disabled already?
if($forum['allowsmilies'] != "no")
{
eval("\$disablesmilies = \"".$templates->get("editpost_disablesmilies")."\";");
}
else
{
$disablesmilies = "<input type=\"hidden\" name=\"postoptions[disablesmilies]\" value=\"no\" />";

	}

$plugins->run_hooks("editpost_end");

	}

$plugins->run_hooks("editpost_end");