Vergleich newthread.php - 1.6.4 - 1.6.9

  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: newthread.php 5371 2011-02-17 12:18:05Z MattR $

 * $Id$

 */

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

$templatelist = "newthread,previewpost,error_invalidforum,redirect_newthread,loginbox,changeuserbox,newthread_postpoll,posticons,attachment,newthread_postpoll,codebuttons,smilieinsert,error_nosubject";

 */

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

$templatelist = "newthread,previewpost,error_invalidforum,redirect_newthread,loginbox,changeuserbox,newthread_postpoll,posticons,attachment,newthread_postpoll,codebuttons,smilieinsert,error_nosubject";

$templatelist .= "posticons,newthread_disablesmilies,newreply_modoptions,post_attachments_new,post_attachments,post_savedraftbutton,post_subscription_method";


$templatelist .= "posticons,newthread_disablesmilies,newreply_modoptions,post_attachments_new,post_attachments,post_savedraftbutton,post_subscription_method,post_attachments_attachment_remove,";
$templatelist .= "forumdisplay_rules,forumdisplay_rules_link";


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 215Zeile 216
		// Check if username exists.
if(username_exists($mybb->input['username']))
{

		// Check if username exists.
if(username_exists($mybb->input['username']))
{

			// If it does and no password is given throw back "username is taken"
if(!$mybb->input['password'])
{
error($lang->error_usernametaken);
}

// 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'])
{
my_setcookie('loginattempts', $logins + 1);
$db->update_query("users", array('loginattempts' => 'loginattempts+1'), "LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'", 1, true);
if($mybb->settings['failedlogintext'] == 1)
{
$login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
}
error($lang->error_invalidpassword.$login_text);
}
// Otherwise they've logged in successfully.

$mybb->input['username'] = $username = $mybb->user['username'];
my_setcookie("mybbuser", $mybb->user['uid']."_".$mybb->user['loginkey'], null, true);
my_setcookie('loginattempts', 1);

// Update the session to contain their user ID
$updated_session = array(
"uid" => $mybb->user['uid'],
);
$db->update_query("sessions", $updated_session, "sid='{$session->sid}'");

$db->update_query("users", array("loginattempts" => 1), "uid='{$mybb->user['uid']}'");

// Set uid and username
$uid = $mybb->user['uid'];
$username = $mybb->user['username'];

// Check if this user is allowed to post here
$mybb->usergroup = &$groupscache[$mybb->user['usergroup']];
$forumpermissions = forum_permissions($fid);
if($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $mybb->user['suspendposting'] == 1)
{
error_no_permission();
}

			// If it does throw back "username is taken"
error($lang->error_usernametaken);














































		}
// This username does not exist.
else

		}
// This username does not exist.
else

Zeile 277Zeile 233
				$username = htmlspecialchars($mybb->input['username']);
}
$uid = 0;

				$username = htmlspecialchars($mybb->input['username']);
}
$uid = 0;

		}
}

		}
}

	// This user is logged in.
else
{
$username = $mybb->user['username'];
$uid = $mybb->user['uid'];

	// This user is logged in.
else
{
$username = $mybb->user['username'];
$uid = $mybb->user['uid'];

	}


	}


	// Attempt to see if this post is a duplicate or not
if($uid > 0)
{

	// Attempt to see if this post is a duplicate or not
if($uid > 0)
{

Zeile 309Zeile 265
	require_once MYBB_ROOT."inc/datahandlers/post.php";
$posthandler = new PostDataHandler("insert");
$posthandler->action = "thread";

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





	// Set the thread data that came from the input to the $thread array.
$new_thread = array(
"fid" => $forum['fid'],

	// Set the thread data that came from the input to the $thread array.
$new_thread = array(
"fid" => $forum['fid'],

Zeile 326Zeile 282
	if($pid != '')
{
$new_thread['pid'] = $pid;

	if($pid != '')
{
$new_thread['pid'] = $pid;

	}


	}


	// Are we saving a draft thread?
if($mybb->input['savedraft'] && $mybb->user['uid'])

	// Are we saving a draft thread?
if($mybb->input['savedraft'] && $mybb->user['uid'])

	{

	{

		$new_thread['savedraft'] = 1;
}
else
{
$new_thread['savedraft'] = 0;

		$new_thread['savedraft'] = 1;
}
else
{
$new_thread['savedraft'] = 0;

	}


	}


	// Is this thread already a draft and we're updating it?
if(isset($thread['tid']) && $thread['visible'] == -2)
{

	// Is this thread already a draft and we're updating it?
if(isset($thread['tid']) && $thread['visible'] == -2)
{

Zeile 367Zeile 323
	}

// Check captcha image

	}

// Check captcha image

	if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid'])
{
$imagehash = $db->escape_string($mybb->input['imagehash']);
$imagestring = $db->escape_string($mybb->input['imagestring']);
$query = $db->simple_select("captcha", "*", "imagehash='$imagehash'");
$imgcheck = $db->fetch_array($query);
if(my_strtolower($imgcheck['imagestring']) != my_strtolower($imagestring) || !$imgcheck['imagehash'])
{
$post_errors[] = $lang->invalid_captcha;
}




	if($mybb->settings['captchaimage'] && !$mybb->user['uid'])
{
require_once MYBB_ROOT.'inc/class_captcha.php';
$post_captcha = new captcha;

if($post_captcha->validate_captcha() == false)
{
// CAPTCHA validation failed
foreach($post_captcha->get_errors() as $error)
{
$post_errors[] = $error;
}
}

		else
{

		else
{

			$db->delete_query("captcha", "imagehash='$imagehash'");

 
			$hide_captcha = true;
}
}


			$hide_captcha = true;
}
}


	

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

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

Zeile 414Zeile 371
		{
$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;

		}


		}


		// This thread is stuck in the moderation queue, send them back to the forum.
else if(!$visible)
{

		// This thread is stuck in the moderation queue, send them back to the forum.
else if(!$visible)
{

Zeile 455Zeile 412

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


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





	$plugins->run_hooks("newthread_start");

$quote_ids = '';

	$plugins->run_hooks("newthread_start");

$quote_ids = '';

Zeile 495Zeile 452
			}

if(intval($mybb->input['load_all_quotes']) == 1)

			}

if(intval($mybb->input['load_all_quotes']) == 1)

			{

			{

				$query = $db->query("
SELECT p.subject, p.message, p.pid, p.tid, p.username, p.dateline, u.username AS userusername
FROM ".TABLE_PREFIX."posts p

				$query = $db->query("
SELECT p.subject, p.message, p.pid, p.tid, p.username, p.dateline, u.username AS userusername
FROM ".TABLE_PREFIX."posts p

Zeile 544Zeile 501
					eval("\$multiquote_external = \"".$templates->get("newthread_multiquote_external")."\";");
}
}

					eval("\$multiquote_external = \"".$templates->get("newthread_multiquote_external")."\";");
}
}

		}
}

		}
}


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


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

Zeile 562Zeile 519
	{
$postoptions = $mybb->input['postoptions'];
if($postoptions['signature'] == 1)

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

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

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

		}
if($postoptions['disablesmilies'] == 1)

		}
if($postoptions['disablesmilies'] == 1)

		{

		{

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

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

		}

		}

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


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


Zeile 594Zeile 551
		$message = htmlspecialchars_uni($post['message']);
$subject = htmlspecialchars_uni($post['subject']);
if($post['includesig'] != 0)

		$message = htmlspecialchars_uni($post['message']);
$subject = htmlspecialchars_uni($post['subject']);
if($post['includesig'] != 0)

		{

		{

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

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

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

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

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

		}
}


		}
}


Zeile 614Zeile 583
		if($mybb->user['signature'] != '')
{
$postoptionschecked['signature'] = " checked=\"checked\"";

		if($mybb->user['signature'] != '')
{
$postoptionschecked['signature'] = " checked=\"checked\"";

		}

		}

		if($mybb->user['subscriptionmethod'] ==  1)

		if($mybb->user['subscriptionmethod'] ==  1)

		{

		{

			$postoptions_subscriptionmethod_none = "checked=\"checked\"";

			$postoptions_subscriptionmethod_none = "checked=\"checked\"";

		}

		}

		else if($mybb->user['subscriptionmethod'] == 2)
{
$postoptions_subscriptionmethod_instant = "checked=\"checked\"";
}
else

		else if($mybb->user['subscriptionmethod'] == 2)
{
$postoptions_subscriptionmethod_instant = "checked=\"checked\"";
}
else

		{

		{

			$postoptions_subscriptionmethod_dont = "checked=\"checked\"";
}
$numpolloptions = "2";

			$postoptions_subscriptionmethod_dont = "checked=\"checked\"";
}
$numpolloptions = "2";

Zeile 654Zeile 623
		if($pid != '')
{
$new_thread['pid'] = $pid;

		if($pid != '')
{
$new_thread['pid'] = $pid;

		}

		}

		
$posthandler->set_data($new_thread);


		
$posthandler->set_data($new_thread);


Zeile 679Zeile 648
			if(!$mybb->input['username'])
{
$mybb->input['username'] = $lang->guest;

			if(!$mybb->input['username'])
{
$mybb->input['username'] = $lang->guest;

			}
if($mybb->input['username'] && !$mybb->user['uid'])
{
$mybb->user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);

 
			}
$query = $db->query("
SELECT u.*, f.*

			}
$query = $db->query("
SELECT u.*, f.*

Zeile 832Zeile 797
		{
$attachment['size'] = get_friendly_size($attachment['filesize']);
$attachment['icon'] = get_attachment_icon(get_extension($attachment['filename']));

		{
$attachment['size'] = get_friendly_size($attachment['filesize']);
$attachment['icon'] = get_attachment_icon(get_extension($attachment['filename']));

 
			$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);


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

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

 

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


			$attach_mod_options = '';
if($attachment['visible'] != 1)
{

			$attach_mod_options = '';
if($attachment['visible'] != 1)
{

Zeile 870Zeile 840
		eval("\$attachbox = \"".$templates->get("post_attachments")."\";");

$bgcolor = alt_trow();

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

$bgcolor = alt_trow();

	}


	}


	if($mybb->user['uid'])
{
eval("\$savedraftbutton = \"".$templates->get("post_savedraftbutton", 1, 0)."\";");
}

// Show captcha image for guests if enabled

	if($mybb->user['uid'])
{
eval("\$savedraftbutton = \"".$templates->get("post_savedraftbutton", 1, 0)."\";");
}

// Show captcha image for guests if enabled

	if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && !$mybb->user['uid'])

	if($mybb->settings['captchaimage'] && !$mybb->user['uid'])

	{
$correct = false;

	{
$correct = false;

		// If previewing a post - check their current captcha input - if correct, hide the captcha input area
if($mybb->input['previewpost'] || $hide_captcha == true)
















		require_once MYBB_ROOT.'inc/class_captcha.php';
$post_captcha = new captcha(false, "post_captcha");

if($mybb->input['previewpost'] || $hide_captcha == true && $post_captcha->type == 1)
{
// If previewing a post - check their current captcha input - if correct, hide the captcha input area
// ... but only if it's a default one, reCAPTCHAs must be filled in every time due to draconian limits
if($post_captcha->validate_captcha() == true)
{
$correct = true;

// Generate a hidden list of items for our captcha
$captcha = $post_captcha->build_hidden_captcha();
}
}

if(!$correct)

		{

		{

			$imagehash = $db->escape_string($mybb->input['imagehash']);
$imagestring = $db->escape_string($mybb->input['imagestring']);
$query = $db->simple_select("captcha", "*", "imagehash='$imagehash' AND imagestring='$imagestring'");
$imgcheck = $db->fetch_array($query);
if($imgcheck['dateline'] > 0)

			if($post_captcha->type == 1)





			{

			{

				eval("\$captcha = \"".$templates->get("post_captcha_hidden")."\";");			
$correct = true;









				$post_captcha->build_captcha();
}
else if($post_captcha->type == 2)
{
$post_captcha->build_recaptcha();
}

if($post_captcha->html)
{
$captcha = $post_captcha->html;

			}

			}

			else
{
$db->delete_query("captcha", "imagehash='$imagehash'");
}
}
if(!$correct)
{
$randomstr = random_str(5);
$imagehash = md5(random_str(12));
$imagearray = array(
"imagehash" => $imagehash,
"imagestring" => $randomstr,
"dateline" => TIME_NOW
);
$db->insert_query("captcha", $imagearray);
eval("\$captcha = \"".$templates->get("post_captcha")."\";");
}
}

		}
}

















	
if($forumpermissions['canpostpolls'] != 0)

	
if($forumpermissions['canpostpolls'] != 0)

	{

	{

		$lang->max_options = $lang->sprintf($lang->max_options, $mybb->settings['maxpolloptions']);
eval("\$pollbox = \"".$templates->get("newthread_postpoll")."\";");

		$lang->max_options = $lang->sprintf($lang->max_options, $mybb->settings['maxpolloptions']);
eval("\$pollbox = \"".$templates->get("newthread_postpoll")."\";");

 
	}

// Do we have any forum rules to show for this forum?
$forumrules = '';
if($forum['rulestype'] >= 2 && $forum['rules'])
{
if(!$forum['rulestitle'])
{
$forum['rulestitle'] = $lang->sprintf($lang->forum_rules, $forum['name']);
}

if(!$parser)
{
require_once MYBB_ROOT.'inc/class_parser.php';
$parser = new postParser;
}

$rules_parser = array(
"allow_html" => 1,
"allow_mycode" => 1,
"allow_smilies" => 1,
"allow_imgcode" => 1
);

$forum['rules'] = $parser->parse_message($forum['rules'], $rules_parser);
$foruminfo = $forum;

if($forum['rulestype'] == 3)
{
eval("\$forumrules = \"".$templates->get("forumdisplay_rules")."\";");
}
else if($forum['rulestype'] == 2)
{
eval("\$forumrules = \"".$templates->get("forumdisplay_rules_link")."\";");
}

	}

$plugins->run_hooks("newthread_end");

	}

$plugins->run_hooks("newthread_end");