Vergleich newthread.php - 1.6.6 - 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 5605 2011-09-19 11:17:26Z Tomm $

 * $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,post_attachments_attachment_remove";


$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 270Zeile 226
			if(!$mybb->input['username'])
{
$username = $lang->guest;

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

			}

			}

			// Otherwise use the name they specified.
else
{

			// Otherwise use the name they specified.
else
{

Zeile 288Zeile 244
	
// 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)

	{

	{

		$user_check = "p.uid='{$uid}'";

		$user_check = "p.uid='{$uid}'";

	}

	}

	else

	else

	{

	{

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

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

	{

	{

		$query = $db->simple_select("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");
if($duplicate_check)

		$query = $db->simple_select("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");
if($duplicate_check)

Zeile 332Zeile 288
	if($mybb->input['savedraft'] && $mybb->user['uid'])
{
$new_thread['savedraft'] = 1;

	if($mybb->input['savedraft'] && $mybb->user['uid'])
{
$new_thread['savedraft'] = 1;

	}

	}

	else

	else

	{

	{

		$new_thread['savedraft'] = 0;

		$new_thread['savedraft'] = 0;

	}

	}

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

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

	}

	}


// Set up the thread options from the input.
$new_thread['options'] = array(


// Set up the thread options from the input.
$new_thread['options'] = array(

Zeile 373Zeile 329
		$post_captcha = new captcha;

if($post_captcha->validate_captcha() == false)

		$post_captcha = new captcha;

if($post_captcha->validate_captcha() == false)

		{

		{

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

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

		}

		}

		else
{
$hide_captcha = true;

		else
{
$hide_captcha = true;

		}

		}

	}

// One or more errors returned, fetch error list and throw to newthread page

	}

// One or more errors returned, fetch error list and throw to newthread page

Zeile 415Zeile 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 585Zeile 541
		if($mybb->input['postpoll'] == 1)
{
$postpollchecked = "checked=\"checked\"";

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

		}

		}

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


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


Zeile 595Zeile 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 606Zeile 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 680Zeile 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 693Zeile 657
			");
$post = $db->fetch_array($query);
if(!$mybb->user['uid'] || !$post['username'])

			");
$post = $db->fetch_array($query);
if(!$mybb->user['uid'] || !$post['username'])

			{

			{

				$post['username'] = htmlspecialchars_uni($mybb->input['username']);
}
else

				$post['username'] = htmlspecialchars_uni($mybb->input['username']);
}
else

Zeile 711Zeile 675
			if($post['includesig'] != 1)
{
$post['includesig'] = 0;

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

			}

			}

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

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

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

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

	{

	{

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

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

	}

	}


// Do we have attachment errors?
if(count($errors) > 0)
{
$thread_errors = inline_error($errors);


// Do we have attachment errors?
if(count($errors) > 0)
{
$thread_errors = inline_error($errors);

	}


	}


	// Generate thread prefix selector
if(!intval($mybb->input['threadprefix']))
{

	// Generate thread prefix selector
if(!intval($mybb->input['threadprefix']))
{

Zeile 756Zeile 720
	}

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

	}

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





	// Setup a unique posthash for attachment management
if(!$mybb->input['posthash'] && $mybb->input['action'] != "editdraft")

	// Setup a unique posthash for attachment management
if(!$mybb->input['posthash'] && $mybb->input['action'] != "editdraft")

	{

	{

	    $posthash = md5($mybb->user['uid'].random_str());

	    $posthash = md5($mybb->user['uid'].random_str());

	}

	}

	elseif($mybb->input['action'] == "editdraft")
{
// Drafts have posthashes, too...
$posthash = $post['posthash'];

	elseif($mybb->input['action'] == "editdraft")
{
// Drafts have posthashes, too...
$posthash = $post['posthash'];

	}

	}

	else

	else

	{

	{

		$posthash = htmlspecialchars_uni($mybb->input['posthash']);

		$posthash = htmlspecialchars_uni($mybb->input['posthash']);

	}

	}


// Can we disable smilies or are they disabled already?
if($forum['allowsmilies'] != 0)
{
eval("\$disablesmilies = \"".$templates->get("newthread_disablesmilies")."\";");


// Can we disable smilies or are they disabled already?
if($forum['allowsmilies'] != 0)
{
eval("\$disablesmilies = \"".$templates->get("newthread_disablesmilies")."\";");

	}

	}

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

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

Zeile 838Zeile 802
			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")."\";");

			}

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 872Zeile 836
		if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount < $mybb->settings['maxattachments']) && !$noshowattach)
{
eval("\$newattach = \"".$templates->get("post_attachments_new")."\";");

		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")."\";");

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





		$bgcolor = alt_trow();

		$bgcolor = alt_trow();

	}

	}


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


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

	}


	}


	// Show captcha image for guests if enabled
if($mybb->settings['captchaimage'] && !$mybb->user['uid'])
{

	// Show captcha image for guests if enabled
if($mybb->settings['captchaimage'] && !$mybb->user['uid'])
{

Zeile 925Zeile 889
	{
$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");