Vergleich newthread.php - 1.4.0 - 1.4.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/about/license
*

 * $Id: newthread.php 3992 2008-07-06 17:27:56Z Tikitiki $

 * $Id: newthread.php 4352 2009-04-18 22:25:55Z Tikitiki $

 */

define("IN_MYBB", 1);

 */

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 = "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";

Zeile 97Zeile 98
{
if(!$mybb->input['previewpost'] && $mybb->input['action'] != "do_newthread")
{

{
if(!$mybb->input['previewpost'] && $mybb->input['action'] != "do_newthread")
{

		$username = $lang->guest;

		$username = '';

	}
else
{

	}
else
{

Zeile 126Zeile 127
// Handle attachments if we've got any.
if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || ($mybb->input['action'] == "do_newthread" && $mybb->input['submit'] && $_FILES['attachment'])))
{

// Handle attachments if we've got any.
if(!$mybb->input['attachmentaid'] && ($mybb->input['newattachment'] || ($mybb->input['action'] == "do_newthread" && $mybb->input['submit'] && $_FILES['attachment'])))
{

	// If there's an attachment, check it and upload it
if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0)












	if($mybb->input['action'] == "editdraft" || ($mybb->input['tid'] && $mybb->input['pid']))
{
$attachwhere = "pid='{$pid}'";
}
else
{
$attachwhere = "posthash='".$db->escape_string($mybb->input['posthash'])."'";
}
$query = $db->simple_select("attachments", "COUNT(aid) as numattachs", $attachwhere);
$attachcount = $db->fetch_field($query, "numattachs");

// If there's an attachment, check it and upload it
if($_FILES['attachment']['size'] > 0 && $forumpermissions['canpostattachments'] != 0 && ($mybb->settings['maxattachments'] == 0 || $attachcount < $mybb->settings['maxattachments']))

	{
require_once MYBB_ROOT."inc/functions_upload.php";
$attachedfile = upload_attachment($_FILES['attachment']);

	{
require_once MYBB_ROOT."inc/functions_upload.php";
$attachedfile = upload_attachment($_FILES['attachment']);

Zeile 137Zeile 149
	if($attachedfile['error'])
{
eval("\$attacherror = \"".$templates->get("error_attacherror")."\";");

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

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

		$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 we were dealing with an attachment but didn't click 'Post Thread', force the new thread page again.
if(!$mybb->input['submit'])

Zeile 173Zeile 185
		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")
{

Zeile 205Zeile 217
			if(!$mybb->user['uid'])
{
my_setcookie('loginattempts', $logins + 1);

			if(!$mybb->user['uid'])
{
my_setcookie('loginattempts', $logins + 1);

				$db->write_query("UPDATE ".TABLE_PREFIX."sessions SET loginattempts=loginattempts+1 WHERE sid = '{$session->sid}'");

				$db->write_query("UPDATE ".TABLE_PREFIX."users SET loginattempts=loginattempts+1 WHERE username = '".$db->escape_string($mybb->input['username'])."'");

				if($mybb->settings['failedlogintext'] == 1)
{
$login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);

				if($mybb->settings['failedlogintext'] == 1)
{
$login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);

Zeile 221Zeile 233
			// Update the session to contain their user ID
$updated_session = array(
"uid" => $mybb->user['uid'],

			// Update the session to contain their user ID
$updated_session = array(
"uid" => $mybb->user['uid'],

				"loginattempts" => 0
);

			);


			$db->update_query("sessions", $updated_session, "sid='{$session->sid}'");

			$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'];

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

Zeile 232Zeile 245
			// Check if this user is allowed to post here
$mybb->usergroup = &$groupscache[$mybb->user['usergroup']];
$forumpermissions = forum_permissions($fid);

			// Check if this user is allowed to post here
$mybb->usergroup = &$groupscache[$mybb->user['usergroup']];
$forumpermissions = forum_permissions($fid);

			if($forumpermissions['canview'] == 0 || $forumpermissions['canpostreplys'] == 0 || $mybb->user['suspendposting'] == 1)

			if($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $mybb->user['suspendposting'] == 1)

			{
error_no_permission();

			{
error_no_permission();

			}

			}

		}
// This username does not exist.
else

		}
// This username does not exist.
else

Zeile 258Zeile 271
	{
$username = $mybb->user['username'];
$uid = $mybb->user['uid'];

	{
$username = $mybb->user['username'];
$uid = $mybb->user['uid'];

	}

	}

	
// Attempt to see if this post is a duplicate or not
if($uid > 0)
{
$user_check = "p.uid='{$uid}'";

	
// Attempt to see if this post is a duplicate or not
if($uid > 0)
{
$user_check = "p.uid='{$uid}'";

	}

	}

	else
{
$user_check = "p.ipaddress='".$db->escape_string($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("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 305Zeile 318
	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(
"signature" => $mybb->input['postoptions']['signature'],

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

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

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

 
		$posticons = get_post_icons();

	}

// Otherwise, this is our initial visit to this page.

	}

// Otherwise, this is our initial visit to this page.

Zeile 872Zeile 886

$plugins->run_hooks("newthread_end");



$plugins->run_hooks("newthread_end");


 
	$forum['name'] = strip_tags($forum['name']);

	$lang->newthread_in = $lang->sprintf($lang->newthread_in, $forum['name']);


	$lang->newthread_in = $lang->sprintf($lang->newthread_in, $forum['name']);


	$forum['name'] = strip_tags($forum['name']);


 
	eval("\$newthread = \"".$templates->get("newthread")."\";");
output_page($newthread);


	eval("\$newthread = \"".$templates->get("newthread")."\";");
output_page($newthread);