Vergleich newthread.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: newthread.php 2260 2006-09-26 07:42:12Z chris $

 * $Id: newthread.php 4005 2008-07-10 17:53:25Z Tikitiki $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 66Zeile 66
{
error_no_permission();
}

{
error_no_permission();
}

// Check if this forum is password protected and if we've got the right password to access it.
check_forum_password($fid, $forum['password']);



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


// If MyCode is on for this forum and the MyCode editor is enabled inthe Admin CP, draw the code buttons and smilie inserter.
if($mybb->settings['bbcodeinserter'] != "off" && $forum['allowmycode'] != "no" && (!$mybb->user['uid'] || $mybb->user['showcodebuttons'] != 0))


// If MyCode is on for this forum and the MyCode editor is enabled inthe Admin CP, draw the code buttons and smilie inserter.
if($mybb->settings['bbcodeinserter'] != "off" && $forum['allowmycode'] != "no" && (!$mybb->user['uid'] || $mybb->user['showcodebuttons'] != 0))

Zeile 76Zeile 77
	if($forum['allowsmilies'] != "no")
{
$smilieinserter = build_clickable_smilies();

	if($forum['allowsmilies'] != "no")
{
$smilieinserter = build_clickable_smilies();

	}

	}

}

// Does this forum allow post icons? If so, fetch the post icons.
if($forum['allowpicons'] != "no")
{
$posticons = get_post_icons();

}

// Does this forum allow post icons? If so, fetch the post icons.
if($forum['allowpicons'] != "no")
{
$posticons = get_post_icons();

}

}


// If we have a currently logged in user then fetch the change user box.
if($mybb->user['uid'] != 0)


// If we have a currently logged in user then fetch the change user box.
if($mybb->user['uid'] != 0)

Zeile 113Zeile 114

// Previewing a post, overwrite the action to the new thread action.
if($mybb->input['previewpost'])


// Previewing a post, overwrite the action to the new thread action.
if($mybb->input['previewpost'])

{

{

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


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


Zeile 129Zeile 130
	
// Error with attachments - should use new inline errors?
if($attachedfile['error'])

	
// Error with attachments - should use new inline errors?
if($attachedfile['error'])

	{

	{

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

// If we were dealing with an attachment but didn't click 'Post Thread', force the new thread page again.

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

// If we were dealing with an attachment but didn't click 'Post Thread', force the new thread page again.

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

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

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

// Are we removing an attachment from the thread?

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

// Are we removing an attachment from the thread?

if($mybb->input['attachmentaid'])

if($mybb->input['attachmentaid'] && $mybb->input['posthash'])

{
require_once MYBB_ROOT."inc/functions_upload.php";
remove_attachment(0, $mybb->input['posthash'], $mybb->input['attachmentaid']);

{
require_once MYBB_ROOT."inc/functions_upload.php";
remove_attachment(0, $mybb->input['posthash'], $mybb->input['attachmentaid']);

Zeile 167Zeile 168
		error($lang->error_maxposts);
}
}

		error($lang->error_maxposts);
}
}





// Performing the posting of a new thread.
if($mybb->input['action'] == "do_newthread" && $mybb->request_method == "post")
{

// Performing the posting of a new thread.
if($mybb->input['action'] == "do_newthread" && $mybb->request_method == "post")
{

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


	$plugins->run_hooks("newthread_do_newthread_start");

// If this isn't a logged in user, then we need to do some special validation.

	$plugins->run_hooks("newthread_do_newthread_start");

// If this isn't a logged in user, then we need to do some special validation.

Zeile 190Zeile 194
			//Checks to make sure the user can login; they haven't had too many tries at logging in.
//Is a fatal call if user has had too many tries
$logins = login_attempt_check();

			//Checks to make sure the user can login; they haven't had too many tries at logging in.
//Is a fatal call if user has had too many tries
$logins = login_attempt_check();





			// If the user specified a password but it is wrong, throw back invalid password.
$mybb->user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
if(!$mybb->user['uid'])

			// If the user specified a password but it is wrong, throw back invalid password.
$mybb->user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
if(!$mybb->user['uid'])

Zeile 225Zeile 229
		{
// If they didn't specify a username then give them "Guest"
if(!$mybb->input['username'])

		{
// If they didn't specify a username then give them "Guest"
if(!$mybb->input['username'])

			{

			{

				$username = $lang->guest;
}
// Otherwise use the name they specified.

				$username = $lang->guest;
}
// Otherwise use the name they specified.

Zeile 247Zeile 251
	if($uid > 0)
{
$user_check = "p.uid='{$uid}'";

	if($uid > 0)
{
$user_check = "p.uid='{$uid}'";

	}
else
{
$user_check = "p.ipaddress='{$session->ipaddress}'";
}
if(!$mybb->input['savedraft'] && !$pid)

	}
else
{
$user_check = "p.ipaddress='".$db->escape_string($session->ipaddress)."'";
}
if(!$mybb->input['savedraft'] && !$pid)

	{
$query = $db->simple_select(TABLE_PREFIX."posts p", "p.pid", "$user_check AND p.fid='{$forum['fid']}' AND p.subject='".$db->escape_string($mybb->input['subject'])."' AND p.message='".$db->escape_string($mybb->input['message'])."' AND p.posthash='".$db->escape_string($mybb->input['posthash'])."'");
$duplicate_check = $db->fetch_field($query, "pid");

	{
$query = $db->simple_select(TABLE_PREFIX."posts p", "p.pid", "$user_check AND p.fid='{$forum['fid']}' AND p.subject='".$db->escape_string($mybb->input['subject'])."' AND p.message='".$db->escape_string($mybb->input['message'])."' AND p.posthash='".$db->escape_string($mybb->input['posthash'])."'");
$duplicate_check = $db->fetch_field($query, "pid");

Zeile 320Zeile 324
	if(!$valid_thread)
{
$post_errors = $posthandler->get_friendly_errors();

	if(!$valid_thread)
{
$post_errors = $posthandler->get_friendly_errors();

	}


	}	


	
// Check captcha image
if($mybb->settings['captchaimage'] == "on" && function_exists("imagepng") && !$mybb->user['uid'])

	
// Check captcha image
if($mybb->settings['captchaimage'] == "on" && function_exists("imagepng") && !$mybb->user['uid'])

Zeile 335Zeile 338
			$post_errors[] = $lang->invalid_captcha;
}
else

			$post_errors[] = $lang->invalid_captcha;
}
else

		{

		{

			$db->delete_query(TABLE_PREFIX."captcha", "imagehash='$imagehash'");
$hide_captcha = true;
}
}

			$db->delete_query(TABLE_PREFIX."captcha", "imagehash='$imagehash'");
$hide_captcha = true;
}
}



 
	
// One or more erors returned, fetch error list and throw to newthread page
if(count($post_errors) > 0)

	
// One or more erors returned, fetch error list and throw to newthread page
if(count($post_errors) > 0)

Zeile 357Zeile 359
		
// We were updating a draft thread, send them back to the draft listing.
if($new_thread['savedraft'] == 1)

		
// We were updating a draft thread, send them back to the draft listing.
if($new_thread['savedraft'] == 1)

		{

		{

			$lang->redirect_newthread = $lang->draft_saved;
$url = "usercp.php?action=drafts";
}

// A poll was being posted with this thread, throw them to poll posting page.
else if($mybb->input['postpoll'] && $forumpermissions['canpostpolls'])

			$lang->redirect_newthread = $lang->draft_saved;
$url = "usercp.php?action=drafts";
}

// A poll was being posted with this thread, throw them to poll posting page.
else if($mybb->input['postpoll'] && $forumpermissions['canpostpolls'])

		{

		{

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

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

Zeile 378Zeile 380
		}

// This is just a normal thread - send them to it.

		}

// This is just a normal thread - send them to it.

		else

		else

		{
// Visible thread
$lang->redirect_newthread .= $lang->redirect_newthread_thread;

		{
// Visible thread
$lang->redirect_newthread .= $lang->redirect_newthread_thread;

Zeile 393Zeile 395
			$lang->redirect_newthread .= sprintf($lang->redirect_return_forum, $fid);
}
redirect($url, $lang->redirect_newthread);

			$lang->redirect_newthread .= sprintf($lang->redirect_return_forum, $fid);
}
redirect($url, $lang->redirect_newthread);

	}

	}

}

if($mybb->input['action'] == "newthread" || $mybb->input['action'] == "editdraft")

}

if($mybb->input['action'] == "newthread" || $mybb->input['action'] == "editdraft")

Zeile 408Zeile 410
	// d -> have errors from posting

if($mybb->input['previewpost'] || $mybb->input['attachmentaid'] || $mybb->input['newattachment'] || $thread_errors)

	// d -> have errors from posting

if($mybb->input['previewpost'] || $mybb->input['attachmentaid'] || $mybb->input['newattachment'] || $thread_errors)

	{

	{

		$postoptions = $mybb->input['postoptions'];
if($postoptions['signature'] == "yes")
{

		$postoptions = $mybb->input['postoptions'];
if($postoptions['signature'] == "yes")
{

Zeile 423Zeile 425
			$postoptionschecked['disablesmilies'] = "checked=\"checked\"";
}
if($mybb->input['postpoll'] == "yes")

			$postoptionschecked['disablesmilies'] = "checked=\"checked\"";
}
if($mybb->input['postpoll'] == "yes")

		{

		{

			$postpollchecked = "checked=\"checked\"";
}
$numpolloptions = intval($mybb->input['numpolloptions']);

			$postpollchecked = "checked=\"checked\"";
}
$numpolloptions = intval($mybb->input['numpolloptions']);

Zeile 439Zeile 441
			$postoptionschecked['signature'] = "checked=\"checked\"";
}
if($post['smilieoff'] == "yes")

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

		{

		{

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

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

Zeile 539Zeile 541
			{
$post['includesig'] = "no";
}

			{
$post['includesig'] = "no";
}

	





			// Fetch attachments assigned to this post
if($mybb->input['pid'])
{

			// Fetch attachments assigned to this post
if($mybb->input['pid'])
{

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

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

			}
else
{
$attachwhere = "posthash='".$db->escape_string($mybb->input['posthash'])."'";

			}
else
{
$attachwhere = "posthash='".$db->escape_string($mybb->input['posthash'])."'";

			}

			}

	
$query = $db->simple_select(TABLE_PREFIX."attachments", "*", $attachwhere);
while($attachment = $db->fetch_array($query))

	
$query = $db->simple_select(TABLE_PREFIX."attachments", "*", $attachwhere);
while($attachment = $db->fetch_array($query))

Zeile 563Zeile 564
		$message = htmlspecialchars_uni($mybb->input['message']);
$subject = htmlspecialchars_uni($mybb->input['subject']);
}

		$message = htmlspecialchars_uni($mybb->input['message']);
$subject = htmlspecialchars_uni($mybb->input['subject']);
}

	



	// Removing an attachment or adding a new one, or showting thread errors.
else if($mybb->input['attachmentaid'] || $mybb->input['newattachment'] || $thread_errors)
{

	// Removing an attachment or adding a new one, or showting thread errors.
else if($mybb->input['attachmentaid'] || $mybb->input['newattachment'] || $thread_errors)
{

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

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

		if($mybb->input['action'] == "editdraft")

		if($mybb->input['action'] == "editdraft" || ($mybb->input['tid'] && $mybb->input['pid']))

		{
$attachwhere = "pid='$pid'";
}

		{
$attachwhere = "pid='$pid'";
}

Zeile 656Zeile 657
		}
$query = $db->simple_select(TABLE_PREFIX."attachments", "SUM(filesize) AS ausage", "uid='".$mybb->user['uid']."'");
$usage = $db->fetch_array($query);

		}
$query = $db->simple_select(TABLE_PREFIX."attachments", "SUM(filesize) AS ausage", "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;
}

Zeile 666Zeile 667
		}
else
{

		}
else
{

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

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

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

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