Vergleich newreply.php - 1.6.2 - 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: newreply.php 5125 2010-07-27 07:28:03Z RyanGordon $

 * $Id$

 */

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


 */

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


$templatelist = "newreply,previewpost,error_invalidforum,error_invalidthread,redirect_threadposted,loginbox,changeuserbox,posticons,newreply_threadreview,forumrules,attachments,newreply_threadreview_post";
$templatelist .= ",smilieinsert,codebuttons,post_attachments_new,post_attachments,post_savedraftbutton,newreply_modoptions,newreply_threadreview_more,newreply_disablesmilies,postbit_online,postbit_find,postbit_pm,postbit_www,postbit_email,postbit_reputation,postbit_warninglevel,postbit_author_user,postbit_edit,postbit_quickdelete,postbit_inlinecheck,postbit_posturl,postbit_quote,postbit_multiquote,postbit_report,postbit_ignored,postbit,post_subscription_method";

$templatelist = "newreply,previewpost,error_invalidforum,error_invalidthread,redirect_threadposted,loginbox,changeuserbox,posticons,newreply_threadreview,forumrules,attachments,newreply_threadreview_post,forumdisplay_rules,forumdisplay_rules_link";
$templatelist .= ",smilieinsert,smilieinsert_getmore,codebuttons,post_attachments_new,post_attachments,post_savedraftbutton,newreply_modoptions,newreply_threadreview_more,newreply_disablesmilies,postbit_online,postbit_find,postbit_pm,postbit_www,postbit_email,postbit_reputation,postbit_warninglevel,postbit_author_user,postbit_edit,postbit_quickdelete,postbit_inlinecheck,postbit_posturl,postbit_quote,postbit_multiquote,postbit_report,postbit_ignored,postbit,post_subscription_method";


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 107Zeile 107
	error_no_permission();
}


	error_no_permission();
}


if($forumpermissions['canonlyviewthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])

if($forumpermissions['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])

{
error_no_permission();
}

{
error_no_permission();
}

Zeile 285Zeile 285
		// 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['canpostreplys'] == 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 354Zeile 309
	{
$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)


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

Zeile 422Zeile 377

// Now let the post handler do all the hard work.
$valid_post = $posthandler->validate_post();


// Now let the post handler do all the hard work.
$valid_post = $posthandler->validate_post();





	$post_errors = array();
// Fetch friendly error messages if this is an invalid post
if(!$valid_post)

	$post_errors = array();
// Fetch friendly error messages if this is an invalid post
if(!$valid_post)

	{

	{

		$post_errors = $posthandler->get_friendly_errors();
}


		$post_errors = $posthandler->get_friendly_errors();
}


Zeile 435Zeile 390
	mark_thread_read($tid, $fid);

// Check captcha image

	mark_thread_read($tid, $fid);

// 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;
}
else
{
$db->delete_query("captcha", "imagehash='$imagehash'");
$hide_captcha = true;
}

// if we're using AJAX, and we have a captcha, regenerate a new one
if($mybb->input['ajax'])

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

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













		{

		{

			$randomstr = random_str(5);
$imagehash = md5(random_str(12));
$imagearray = array(
"imagehash" => $imagehash,
"imagestring" => $randomstr,
"dateline" => TIME_NOW
);
$db->insert_query("captcha", $imagearray);
header("Content-type: text/html; charset={$lang->settings['charset']}");
echo "<captcha>$imagehash";
if($hide_captcha)

			// CAPTCHA validation failed
foreach($post_captcha->get_errors() as $error)










			{

			{

				echo "|$randomstr";

				$post_errors[] = $error;

			}

			}

			echo "</captcha>";

 
		}

		}

	}





































		else
{
$hide_captcha = true;
}

if($mybb->input['ajax'])
{
if($post_captcha->type == 1)
{
$randomstr = random_str(5);
$imagehash = md5(random_str(12));

$imagearray = array(
"imagehash" => $imagehash,
"imagestring" => $randomstr,
"dateline" => TIME_NOW
);

$db->insert_query("captcha", $imagearray);

header("Content-type: text/html; charset={$lang->settings['charset']}");
echo "<captcha>$imagehash";

if($hide_captcha)
{
echo "|$randomstr";
}

echo "</captcha>";
}
else if($post_captcha->type == 2)
{
header("Content-type: text/html; charset={$lang->settings['charset']}");
echo "<captcha>reload</captcha>";
}
}
}


// 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)

	{

	{

		$reply_errors = inline_error($post_errors);
$mybb->input['action'] = "newreply";
}

		$reply_errors = inline_error($post_errors);
$mybb->input['action'] = "newreply";
}

Zeile 483Zeile 452
		$postinfo = $posthandler->insert_post();
$pid = $postinfo['pid'];
$visible = $postinfo['visible'];

		$postinfo = $posthandler->insert_post();
$pid = $postinfo['pid'];
$visible = $postinfo['visible'];





		// Deciding the fate
if($visible == -2)
{

		// Deciding the fate
if($visible == -2)
{

Zeile 496Zeile 465
			// Visible post
$lang->redirect_newreply .= $lang->redirect_newreply_post;
$url = get_post_link($pid, $tid)."#pid{$pid}";

			// Visible post
$lang->redirect_newreply .= $lang->redirect_newreply_post;
$url = get_post_link($pid, $tid)."#pid{$pid}";

		}

		}

		else
{
// Moderated post

		else
{
// Moderated post

Zeile 549Zeile 518
		{
// Visible post
if($visible == 1)

		{
// Visible post
if($visible == 1)

			{

			{

				// Set post counter
if($ismod == true)

				// Set post counter
if($ismod == true)

				{

				{

					$postcounter = $thread['replies'] + $thread['unapprovedposts'] + 1;
}
else
{
$postcounter = $thread['replies'] + 1;

					$postcounter = $thread['replies'] + $thread['unapprovedposts'] + 1;
}
else
{
$postcounter = $thread['replies'] + 1;

				}

				}


// Was there a new post since we hit the quick reply button?
if($mybb->input['lastpid'])


// Was there a new post since we hit the quick reply button?
if($mybb->input['lastpid'])

Zeile 610Zeile 579
				if(($postcounter - $mybb->settings['postsperpage']) % 2 != 0)
{
$altbg = "trow1";

				if(($postcounter - $mybb->settings['postsperpage']) % 2 != 0)
{
$altbg = "trow1";

				}

				}

				else

				else

				{

				{

					$altbg = "trow2";
}

					$altbg = "trow2";
}










$charset = "UTF-8";
if($lang->settings['charset'])
{
$charset = $lang->settings['charset'];
}


				require_once MYBB_ROOT."inc/functions_post.php";
$pid = $post['pid'];
$post = build_postbit($post);

				require_once MYBB_ROOT."inc/functions_post.php";
$pid = $post['pid'];
$post = build_postbit($post);

 

header("Content-type: text/plain; charset={$charset}");

				echo $post;

// Build a new posthash incase the user wishes to quick reply again

				echo $post;

// Build a new posthash incase the user wishes to quick reply again

Zeile 638Zeile 615
		}
else
{

		}
else
{

			$lang->redirect_newreply .= $lang->sprintf($lang->redirect_return_forum, get_forum_link($fid)); 

			$lang->redirect_newreply .= $lang->sprintf($lang->redirect_return_thread, get_forum_link($fid)); 

			redirect($url, $lang->redirect_newreply); 
exit;
}

			redirect($url, $lang->redirect_newreply); 
exit;
}

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

		if($post['smilieoff'] == 1)
{
$postoptionschecked['disablesmilies'] = " 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\"";

		}
$mybb->input['icon'] = $post['icon'];
}

		}
$mybb->input['icon'] = $post['icon'];
}

Zeile 882Zeile 871
			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']);

 
			}
$mybb->input['icon'] = intval($mybb->input['icon']);
$query = $db->query("

			}
$mybb->input['icon'] = intval($mybb->input['icon']);
$query = $db->query("

Zeile 981Zeile 966
		{
$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))
{

Zeile 1027Zeile 1013
	}

// 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


		require_once MYBB_ROOT.'inc/class_captcha.php';


		if($mybb->input['previewpost'] || $hide_captcha == true)

		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)

		{
// If previewing a post - check their current captcha input - if correct, hide the captcha input area
$post_captcha = new captcha;

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


			{

			{

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

 
				$correct = true;

				$correct = true;

 

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

			}

			}

			else







		}

if(!$correct)
{
$post_captcha = new captcha(true, "post_captcha");

if($post_captcha->html)

			{

			{

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

				$captcha = $post_captcha->html;

			}

			}

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

 
		}
}


		}
}


Zeile 1066Zeile 1048
		if(!$mybb->settings['postsperpage'])
{
$mybb->settings['postperpage'] = 20;

		if(!$mybb->settings['postsperpage'])
{
$mybb->settings['postperpage'] = 20;

		}

		}

		
if(is_moderator($fid))
{

		
if(is_moderator($fid))
{

Zeile 1099Zeile 1081
		while($attachment = $db->fetch_array($query))
{
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;

		while($attachment = $db->fetch_array($query))
{
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;

		}

		}

		$query = $db->query("
SELECT p.*, u.username AS userusername
FROM ".TABLE_PREFIX."posts p

		$query = $db->query("
SELECT p.*, u.username AS userusername
FROM ".TABLE_PREFIX."posts p

Zeile 1113Zeile 1095
		while($post = $db->fetch_array($query))
{
if($post['userusername'])

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

			{

			{

				$post['username'] = $post['userusername'];
}
$reviewpostdate = my_date($mybb->settings['dateformat'], $post['dateline']);

				$post['username'] = $post['userusername'];
}
$reviewpostdate = my_date($mybb->settings['dateformat'], $post['dateline']);

Zeile 1178Zeile 1160
		if($closed)
{
$closecheck = ' checked="checked"';

		if($closed)
{
$closecheck = ' checked="checked"';

		}
else

		}
else

		{
$closecheck = '';
}

		{
$closecheck = '';
}

Zeile 1191Zeile 1173
		else
{
$stickycheck = '';

		else
{
$stickycheck = '';

		}


		}


		eval("\$modoptions = \"".$templates->get("newreply_modoptions")."\";");
$bgcolor = "trow1";
}
else

		eval("\$modoptions = \"".$templates->get("newreply_modoptions")."\";");
$bgcolor = "trow1";
}
else

	{

	{

		$bgcolor = "trow2";

		$bgcolor = "trow2";

	}

	}

	
// Fetch subscription select box
eval("\$subscriptionmethod = \"".$templates->get("post_subscription_method")."\";");

$lang->post_reply_to = $lang->sprintf($lang->post_reply_to, $thread['subject']);
$lang->reply_to = $lang->sprintf($lang->reply_to, $thread['subject']);

	
// Fetch subscription select box
eval("\$subscriptionmethod = \"".$templates->get("post_subscription_method")."\";");

$lang->post_reply_to = $lang->sprintf($lang->post_reply_to, $thread['subject']);
$lang->reply_to = $lang->sprintf($lang->reply_to, $thread['subject']);

 

// 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("newreply_end");



$plugins->run_hooks("newreply_end");