Vergleich newthread.php - 1.6.5 - 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 427Zeile 383

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


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

		{

		{

			// Visible thread
$lang->redirect_newthread .= $lang->redirect_newthread_thread;
$url = get_thread_link($tid);

			// Visible thread
$lang->redirect_newthread .= $lang->redirect_newthread_thread;
$url = get_thread_link($tid);

Zeile 499Zeile 455
			{
$query = $db->query("
SELECT p.subject, p.message, p.pid, p.tid, p.username, p.dateline, u.username AS userusername

			{
$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
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

					FROM ".TABLE_PREFIX."posts p
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)

					LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
WHERE p.pid IN ($quoted_posts) {$unviewable_forums} {$visible_where}
");

					LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
WHERE p.pid IN ($quoted_posts) {$unviewable_forums} {$visible_where}
");

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 630Zeile 598
		}
$numpolloptions = "2";
}

		}
$numpolloptions = "2";
}

	

	

	// If we're preving a post then generate the preview.
if($mybb->input['previewpost'])
{

	// If we're preving a post then generate the preview.
if($mybb->input['previewpost'])
{

Zeile 653Zeile 621
		);

if($pid != '')

		);

if($pid != '')

		{

		{

			$new_thread['pid'] = $pid;
}


			$new_thread['pid'] = $pid;
}


Zeile 668Zeile 636
		if(!$valid_thread || !$valid_subject)
{
$post_errors = $posthandler->get_friendly_errors();

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

		}

		}

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

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

Zeile 678Zeile 646
		else
{
if(!$mybb->input['username'])

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

			{

			{

				$mybb->input['username'] = $lang->guest;

				$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 721Zeile 685
			else
{
$attachwhere = "posthash='".$db->escape_string($mybb->input['posthash'])."'";

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

			}


			}


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

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

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

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

		$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'] || $mybb->input['updateattachment'] || $thread_errors)
{
$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'] || $mybb->input['updateattachment'] || $thread_errors)
{
$message = htmlspecialchars_uni($mybb->input['message']);
$subject = htmlspecialchars_uni($mybb->input['subject']);

	}


	}


	// Do we have attachment errors?
if(count($errors) > 0)

	// Do we have attachment errors?
if(count($errors) > 0)

	{

	{

		$thread_errors = inline_error($errors);

		$thread_errors = inline_error($errors);

	}

	}


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


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

	}


	}


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

// Setup a unique posthash for attachment management

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

// Setup a unique posthash for attachment management

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

			}

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 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 923Zeile 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");