Vergleich newthread.php - 1.6.2 - 1.6.8

  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 5087 2010-07-11 11:46:40Z Huji $

 * $Id: newthread.php 5775 2012-04-19 11:03:38Z Tomm $

 */

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 58Zeile 59

$forumpermissions = forum_permissions($fid);



$forumpermissions = forum_permissions($fid);


if($forum['open'] == 0 || $forum['type'] != "f")

if($forum['open'] == 0 || $forum['type'] != "f" || $forum['linkto'] != "")

{
error($lang->error_closedinvalidforum);
}

{
error($lang->error_closedinvalidforum);
}

Zeile 367Zeile 368
	}

// Check captcha image

	}

// Check captcha image

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

	if($mybb->settings['captchaimage'] && !$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;
}
else
{
$db->delete_query("captcha", "imagehash='$imagehash'");
$hide_captcha = true;
}



		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
{
$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 416
		{
$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 422Zeile 424
			// Moderated thread
$lang->redirect_newthread .= $lang->redirect_newthread_moderation;
$url = get_forum_link($fid);

			// Moderated thread
$lang->redirect_newthread .= $lang->redirect_newthread_moderation;
$url = get_forum_link($fid);

		}

		}


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


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

Zeile 430Zeile 432
			// 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);

		}

		}

		
// Mark any quoted posts so they're no longer selected - attempts to maintain those which weren't selected
if($mybb->input['quoted_ids'] && $mybb->cookies['multiquote'] && $mybb->settings['multiquote'] != 0)

		
// Mark any quoted posts so they're no longer selected - attempts to maintain those which weren't selected
if($mybb->input['quoted_ids'] && $mybb->cookies['multiquote'] && $mybb->settings['multiquote'] != 0)

Zeile 439Zeile 441
			if($mybb->input['quoted_ids'] == "all")
{
my_unsetcookie("multiquote");

			if($mybb->input['quoted_ids'] == "all")
{
my_unsetcookie("multiquote");

			}
}


			}
}


		$plugins->run_hooks("newthread_do_newthread_end");

// Hop to it! Send them to the next page.

		$plugins->run_hooks("newthread_do_newthread_end");

// Hop to it! Send them to the next page.

Zeile 466Zeile 468
		$quoted_posts = array();
// Handle multiquote
if($mybb->cookies['multiquote'] && $mybb->settings['multiquote'] != 0)

		$quoted_posts = array();
// Handle multiquote
if($mybb->cookies['multiquote'] && $mybb->settings['multiquote'] != 0)

		{

		{

			$multiquoted = explode("|", $mybb->cookies['multiquote']);
foreach($multiquoted as $post)
{

			$multiquoted = explode("|", $mybb->cookies['multiquote']);
foreach($multiquoted as $post)
{

Zeile 490Zeile 492
				$visible_where = "AND p.visible != 2";
}
else

				$visible_where = "AND p.visible != 2";
}
else

			{

			{

				$visible_where = "AND p.visible > 0";
}


				$visible_where = "AND p.visible > 0";
}


Zeile 506Zeile 508
				while($quoted_post = $db->fetch_array($query))
{
if($quoted_post['userusername'])

				while($quoted_post = $db->fetch_array($query))
{
if($quoted_post['userusername'])

					{

					{

						$quoted_post['username'] = $quoted_post['userusername'];
}
$quoted_post['message'] = preg_replace('#(^|\r|\n)/me ([^\r\n<]*)#i', "\\1* {$quoted_post['username']} \\2", $quoted_post['message']);

						$quoted_post['username'] = $quoted_post['userusername'];
}
$quoted_post['message'] = preg_replace('#(^|\r|\n)/me ([^\r\n<]*)#i', "\\1* {$quoted_post['username']} \\2", $quoted_post['message']);

Zeile 526Zeile 528
					WHERE p.pid IN ($quoted_posts) {$unviewable_forums} {$visible_where}
");
$external_quotes = $db->fetch_field($query, 'quotes');

					WHERE p.pid IN ($quoted_posts) {$unviewable_forums} {$visible_where}
");
$external_quotes = $db->fetch_field($query, 'quotes');





				if($external_quotes > 0)
{
if($external_quotes == 1)

				if($external_quotes > 0)
{
if($external_quotes == 1)

Zeile 562Zeile 564
	{
$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\"";
}
if($postoptions['disablesmilies'] == 1)
{
$postoptionschecked['disablesmilies'] = " 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)
{
$postoptionschecked['disablesmilies'] = " checked=\"checked\"";
}

		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 596Zeile 598
		if($post['includesig'] != 0)
{
$postoptionschecked['signature'] = " checked=\"checked\"";

		if($post['includesig'] != 0)
{
$postoptionschecked['signature'] = " checked=\"checked\"";

		}

		}

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

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

		}

		}

		$icon = $post['icon'];
if($forum['allowpicons'] != 0)

		$icon = $post['icon'];
if($forum['allowpicons'] != 0)

		{

		{

			$posticons = get_post_icons();

			$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 765Zeile 779
	{
// Drafts have posthashes, too...
$posthash = $post['posthash'];

	{
// Drafts have posthashes, too...
$posthash = $post['posthash'];

	}
else

	}
else

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

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

Zeile 832Zeile 846
		{
$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))

			if($mybb->settings['bbcodeinserter'] != 0 && $forum['allowmycode'] != 0 && (!$mybb->user['uid'] || $mybb->user['showcodebuttons'] != 0))

			{

			{

				eval("\$postinsert = \"".$templates->get("post_attachments_attachment_postinsert")."\";");
}

				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)
{
eval("\$attachments .= \"".$templates->get("post_attachments_attachment_unapproved")."\";");

			$attach_mod_options = '';
if($attachment['visible'] != 1)
{
eval("\$attachments .= \"".$templates->get("post_attachments_attachment_unapproved")."\";");

			}

			}

			else
{
eval("\$attachments .= \"".$templates->get("post_attachments_attachment")."\";");

			else
{
eval("\$attachments .= \"".$templates->get("post_attachments_attachment")."\";");

Zeile 856Zeile 875
		if($mybb->usergroup['attachquota'] == 0)
{
$friendlyquota = $lang->unlimited;

		if($mybb->usergroup['attachquota'] == 0)
{
$friendlyquota = $lang->unlimited;

		}

		}

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

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

Zeile 864Zeile 883
		$friendlyusage = get_friendly_size($usage['ausage']);
$lang->attach_quota = $lang->sprintf($lang->attach_quota, $friendlyusage, $friendlyquota);
if($mybb->settings['maxattachments'] == 0 || ($mybb->settings['maxattachments'] != 0 && $attachcount < $mybb->settings['maxattachments']) && !$noshowattach)

		$friendlyusage = get_friendly_size($usage['ausage']);
$lang->attach_quota = $lang->sprintf($lang->attach_quota, $friendlyusage, $friendlyquota);
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("\$newattach = \"".$templates->get("post_attachments_new")."\";");
}
eval("\$attachbox = \"".$templates->get("post_attachments")."\";");

Zeile 878Zeile 897
	}

// Show captcha image for guests if enabled

	}

// 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)
{
$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)
{
eval("\$captcha = \"".$templates->get("post_captcha_hidden")."\";");

		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;

				$correct = true;

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


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


		}

		}

 


		if(!$correct)

		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($post_captcha->type == 1)
{
$post_captcha->build_captcha();
}
else if($post_captcha->type == 2)
{
$post_captcha->build_recaptcha();
}

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

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