Vergleich xmlhttp.php - 1.8.0 - 1.8.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 28Zeile 28
// Load MyBB core files
require_once dirname(__FILE__)."/inc/init.php";


// Load MyBB core files
require_once dirname(__FILE__)."/inc/init.php";


$shutdown_queries = array();

$shutdown_queries = $shutdown_functions = array();


// Load some of the stock caches we'll be using.
$groupscache = $cache->read("usergroups");


// Load some of the stock caches we'll be using.
$groupscache = $cache->read("usergroups");

Zeile 70Zeile 70
// 1. Check cookies
if(!$mybb->user['uid'] && !empty($mybb->cookies['mybbtheme']))
{

// 1. Check cookies
if(!$mybb->user['uid'] && !empty($mybb->cookies['mybbtheme']))
{

	$mybb->user['style'] = $mybb->cookies['mybbtheme'];

	$mybb->user['style'] = (int)$mybb->cookies['mybbtheme'];

}

// 2. Load style

}

// 2. Load style

Zeile 84Zeile 84
}

// Load basic theme information that we could be needing.

}

// Load basic theme information that we could be needing.

 
if($loadstyle != "def='1'")
{
$query = $db->simple_select('themes', 'name, tid, properties, allowedgroups', $loadstyle, array('limit' => 1));
$theme = $db->fetch_array($query);

if(isset($theme['tid']) && !is_member($theme['allowedgroups']) && $theme['allowedgroups'] != 'all')
{
if(isset($mybb->cookies['mybbtheme']))
{
my_unsetcookie('mybbtheme');
}

$loadstyle = "def='1'";
}
}


if($loadstyle == "def='1'")
{
if(!$cache->read('default_theme'))
{
$cache->update_default_theme();
}

if($loadstyle == "def='1'")
{
if(!$cache->read('default_theme'))
{
$cache->update_default_theme();
}

 


	$theme = $cache->read('default_theme');
}

	$theme = $cache->read('default_theme');
}

else
{
$query = $db->simple_select("themes", "name, tid, properties", $loadstyle);
$theme = $db->fetch_array($query);
}









// No theme was found - we attempt to load the master or any other theme
if(!isset($theme['tid']) || isset($theme['tid']) && !$theme['tid'])
{
// Missing theme was from a user, run a query to set any users using the theme to the default

// No theme was found - we attempt to load the master or any other theme
if(!isset($theme['tid']) || isset($theme['tid']) && !$theme['tid'])
{
// Missing theme was from a user, run a query to set any users using the theme to the default

	$db->update_query('users', array('style' => 0), "style = '{$mybb->user['style']}'");


	$db->update_query('users', array('style' => 0), "style = '{$mybb->user['style']}'");


	// Attempt to load the master or any other theme if the master is not available
$query = $db->simple_select('themes', 'name, tid, properties, stylesheets', '', array('order_by' => 'tid', 'limit' => 1));
$theme = $db->fetch_array($query);

	// Attempt to load the master or any other theme if the master is not available
$query = $db->simple_select('themes', 'name, tid, properties, stylesheets', '', array('order_by' => 'tid', 'limit' => 1));
$theme = $db->fetch_array($query);

Zeile 112Zeile 124

// Set the appropriate image language directory for this theme.
// Are we linking to a remote theme server?


// Set the appropriate image language directory for this theme.
// Are we linking to a remote theme server?

if(my_substr($theme['imgdir'], 0, 7) == 'http://' || my_substr($theme['imgdir'], 0, 8) == 'https://')
{
// If a language directory for the current language exists within the theme - we use it

if(my_validate_url($theme['imgdir']))
{
// If a language directory for the current language exists within the theme - we use it

	if(!empty($mybb->user['language']))

	if(!empty($mybb->user['language']))

	{

	{

		$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else
{
// Check if a custom language directory exists for this theme
if(!empty($mybb->settings['bblanguage']))

		$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else
{
// Check if a custom language directory exists for this theme
if(!empty($mybb->settings['bblanguage']))

		{

		{

			$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
}
// Otherwise, the image language directory is the same as the language directory for the theme

			$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
}
// Otherwise, the image language directory is the same as the language directory for the theme

Zeile 162Zeile 174
		// Otherwise, the image language directory is the same as the language directory for the theme
else
{

		// Otherwise, the image language directory is the same as the language directory for the theme
else
{

		$theme['imglangdir'] = $theme['imgdir'];

			$theme['imglangdir'] = $theme['imgdir'];

		}
}


		}
}


Zeile 170Zeile 182
	$theme['imglangdir'] = $mybb->get_asset_url($theme['imglangdir']);
}


	$theme['imglangdir'] = $mybb->get_asset_url($theme['imglangdir']);
}


$templatelist = "postbit_editedby,xmlhttp_inline_post_editor,xmlhttp_buddyselect_online,xmlhttp_buddyselect_offline,xmlhttp_buddyselect";

$templatelist = "postbit_editedby,xmlhttp_buddyselect_online,xmlhttp_buddyselect_offline,xmlhttp_buddyselect";

$templates->cache($db->escape_string($templatelist));

if($lang->settings['charset'])

$templates->cache($db->escape_string($templatelist));

if($lang->settings['charset'])

Zeile 186Zeile 198
$lang->load("global");
$lang->load("xmlhttp");


$lang->load("global");
$lang->load("xmlhttp");


$plugins->run_hooks("xmlhttp");

$mybb->input['action'] = $mybb->get_input('action');

















$closed_bypass = array("refresh_captcha", "validate_captcha");

$mybb->input['action'] = $mybb->get_input('action');

$plugins->run_hooks("xmlhttp");

// If the board is closed, the user is not an administrator and they're not trying to login, show the board closed message
if($mybb->settings['boardclosed'] == 1 && $mybb->usergroup['canviewboardclosed'] != 1 && !in_array($mybb->input['action'], $closed_bypass))
{
// Show error
if(!$mybb->settings['boardclosed_reason'])
{
$mybb->settings['boardclosed_reason'] = $lang->boardclosed_reason;
}

$lang->error_boardclosed .= "<br /><em>{$mybb->settings['boardclosed_reason']}</em>";

xmlhttp_error($lang->error_boardclosed);
}


// Fetch a list of usernames beginning with a certain string (used for auto completion)
if($mybb->input['action'] == "get_users")


// Fetch a list of usernames beginning with a certain string (used for auto completion)
if($mybb->input['action'] == "get_users")

{
$mybb->input['query'] = ltrim($mybb->get_input('query'));







{
$mybb->input['query'] = ltrim($mybb->get_input('query'));

// If the string is less than 2 characters, quit.
if(my_strlen($mybb->input['query']) < 2)
{
exit;
}





	// If the string is less than 3 characters, quit.
if(my_strlen($mybb->input['query']) < 3)
{
exit;
}

if($mybb->get_input('getone', 1) == 1)
{
$limit = 1;
}
else

	if($mybb->get_input('getone', MyBB::INPUT_INT) == 1)
{
$limit = 1;
}
else







	{
$limit = 15;
}

	{
$limit = 15;
}

Zeile 227Zeile 255
	if($limit == 1)
{
$user = $db->fetch_array($query);

	if($limit == 1)
{
$user = $db->fetch_array($query);

		$user['username'] = htmlspecialchars_uni($user['username']);

 
		$data = array('id' => $user['username'], 'text' => $user['username']);
}
else

		$data = array('id' => $user['username'], 'text' => $user['username']);
}
else

Zeile 235Zeile 262
		$data = array();
while($user = $db->fetch_array($query))
{

		$data = array();
while($user = $db->fetch_array($query))
{

			$user['username'] = htmlspecialchars_uni($user['username']);

 
			$data[] = array('id' => $user['username'], 'text' => $user['username']);
}
}

			$data[] = array('id' => $user['username'], 'text' => $user['username']);
}
}

Zeile 252Zeile 278
	if(!verify_post_check($mybb->get_input('my_post_key'), true))
{
xmlhttp_error($lang->invalid_post_code);

	if(!verify_post_check($mybb->get_input('my_post_key'), true))
{
xmlhttp_error($lang->invalid_post_code);

	}

// Editing a post subject.
if($mybb->get_input('pid', 1))
{
// Fetch the post from the database.
$post = get_post($mybb->get_input('pid', 1));

// No result, die.
if(!$post)
{
xmlhttp_error($lang->post_doesnt_exist);
}

// Fetch the thread associated with this post.
$thread = get_thread($post['tid']);
if(!$thread)
{
xmlhttp_error($lang->thread_doesnt_exist);
}
}

	}





















	// We're editing a thread subject.

	// We're editing a thread subject.

	else if($mybb->get_input('tid', 1))

	if($mybb->get_input('tid', MyBB::INPUT_INT))

	{
// Fetch the thread.

	{
// Fetch the thread.

		$thread = get_thread($mybb->get_input('tid', 1));

		$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));

		if(!$thread)
{
xmlhttp_error($lang->thread_doesnt_exist);

		if(!$thread)
{
xmlhttp_error($lang->thread_doesnt_exist);

		}


		}


		// Fetch some of the information from the first post of this thread.
$query_options = array(
"order_by" => "dateline",

		// Fetch some of the information from the first post of this thread.
$query_options = array(
"order_by" => "dateline",

Zeile 290Zeile 297
		);
$query = $db->simple_select("posts", "pid,uid,dateline", "tid='".$thread['tid']."'", $query_options);
$post = $db->fetch_array($query);

		);
$query = $db->simple_select("posts", "pid,uid,dateline", "tid='".$thread['tid']."'", $query_options);
$post = $db->fetch_array($query);

	}
else

	}
else

	{
exit;
}

	{
exit;
}





	// Fetch the specific forum this thread/post is in.
$forum = get_forum($thread['fid']);

// Missing thread, invalid forum? Error.
if(!$forum || $forum['type'] != "f")

	// Fetch the specific forum this thread/post is in.
$forum = get_forum($thread['fid']);

// Missing thread, invalid forum? Error.
if(!$forum || $forum['type'] != "f")

	{

	{

		xmlhttp_error($lang->thread_doesnt_exist);
}


		xmlhttp_error($lang->thread_doesnt_exist);
}


Zeile 320Zeile 327
		}
// Forum is not open, user doesn't have permission to edit, or author doesn't match this user - don't allow editing.
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0)

		}
// Forum is not open, user doesn't have permission to edit, or author doesn't match this user - don't allow editing.
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0)

		{

		{

			xmlhttp_error($lang->no_permission_edit_subject);
}
// If we're past the edit time limit - don't allow editing.

			xmlhttp_error($lang->no_permission_edit_subject);
}
// If we're past the edit time limit - don't allow editing.

Zeile 339Zeile 346
	if(my_strtolower($charset) != "utf-8")
{
if(function_exists("iconv"))

	if(my_strtolower($charset) != "utf-8")
{
if(function_exists("iconv"))

		{

		{

			$subject = iconv($charset, "UTF-8//IGNORE", $subject);

			$subject = iconv($charset, "UTF-8//IGNORE", $subject);

		}

		}

		else if(function_exists("mb_convert_encoding"))

		else if(function_exists("mb_convert_encoding"))

		{

		{

			$subject = @mb_convert_encoding($subject, $charset, "UTF-8");

			$subject = @mb_convert_encoding($subject, $charset, "UTF-8");

		}

		}

		else if(my_strtolower($charset) == "iso-8859-1")

		else if(my_strtolower($charset) == "iso-8859-1")

		{

		{

			$subject = utf8_decode($subject);
}
}


			$subject = utf8_decode($subject);
}
}


	// Set up posthandler.
require_once MYBB_ROOT."inc/datahandlers/post.php";
$posthandler = new PostDataHandler("update");
$posthandler->action = "post";

// Set the post data that came from the input to the $post array.
$updatepost = array(
"pid" => $post['pid'],
"tid" => $thread['tid'],
"subject" => $subject,
"edit_uid" => $mybb->user['uid']
);
$posthandler->set_data($updatepost);

// Now let the post handler do all the hard work.
if(!$posthandler->validate_post())
{
$post_errors = $posthandler->get_friendly_errors();
xmlhttp_error($post_errors);
}
// No errors were found, we can call the update method.
else
{
$posthandler->update_post();
if($ismod == true)
{
$modlogdata = array(
"tid" => $thread['tid'],
"fid" => $forum['fid']
);
log_moderator_action($modlogdata, $lang->edited_post);
}
}







	// Only edit subject if subject has actually been changed
if($thread['subject'] != $subject)
{
// Set up posthandler.
require_once MYBB_ROOT."inc/datahandlers/post.php";
$posthandler = new PostDataHandler("update");
$posthandler->action = "post";

// Set the post data that came from the input to the $post array.
$updatepost = array(
"pid" => $post['pid'],
"tid" => $thread['tid'],
"prefix" => $thread['prefix'],
"subject" => $subject,
"edit_uid" => $mybb->user['uid']
);
$posthandler->set_data($updatepost);

// Now let the post handler do all the hard work.
if(!$posthandler->validate_post())
{
$post_errors = $posthandler->get_friendly_errors();
xmlhttp_error($post_errors);
}
// No errors were found, we can call the update method.
else
{
$posthandler->update_post();
if($ismod == true)
{
$modlogdata = array(
"tid" => $thread['tid'],
"fid" => $forum['fid']
);
log_moderator_action($modlogdata, $lang->edited_post);
}
}
}


	require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

	require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;





	// Send our headers.
header("Content-type: application/json; charset={$charset}");

$plugins->run_hooks("xmlhttp_edit_subject_end");

$mybb->input['value'] = $parser->parse_badwords($mybb->get_input('value'));

	// Send our headers.
header("Content-type: application/json; charset={$charset}");

$plugins->run_hooks("xmlhttp_edit_subject_end");

$mybb->input['value'] = $parser->parse_badwords($mybb->get_input('value'));





	// Spit the subject back to the browser.
$subject = substr($mybb->input['value'], 0, 120); // 120 is the varchar length for the subject column

	// Spit the subject back to the browser.
$subject = substr($mybb->input['value'], 0, 120); // 120 is the varchar length for the subject column

	echo json_encode(array("subject" => htmlspecialchars_uni($subject)));

	echo json_encode(array("subject" => '<a href="'.get_thread_link($thread['tid']).'">'.htmlspecialchars_uni($subject).'</a>'));


// Close the connection.
exit;


// Close the connection.
exit;

Zeile 406Zeile 418
else if($mybb->input['action'] == "edit_post")
{
// Fetch the post from the database.

else if($mybb->input['action'] == "edit_post")
{
// Fetch the post from the database.

	$post = get_post($mybb->get_input('pid', 1));


	$post = get_post($mybb->get_input('pid', MyBB::INPUT_INT));


	// No result, die.
if(!$post)
{

	// No result, die.
if(!$post)
{

Zeile 416Zeile 428

// Fetch the thread associated with this post.
$thread = get_thread($post['tid']);


// Fetch the thread associated with this post.
$thread = get_thread($post['tid']);





	// Fetch the specific forum this thread/post is in.
$forum = get_forum($thread['fid']);

	// Fetch the specific forum this thread/post is in.
$forum = get_forum($thread['fid']);





	// Missing thread, invalid forum? Error.
if(!$thread || !$forum || $forum['type'] != "f")

	// Missing thread, invalid forum? Error.
if(!$thread || !$forum || $forum['type'] != "f")

	{

	{

		xmlhttp_error($lang->thread_doesnt_exist);

		xmlhttp_error($lang->thread_doesnt_exist);

 
	}

// Check if this forum is password protected and we have a valid password
if(check_forum_password($forum['fid'], 0, true))
{
xmlhttp_error($lang->wrong_forum_password);

	}

// Fetch forum permissions.

	}

// Fetch forum permissions.

Zeile 436Zeile 454
	{
// Thread is closed - no editing allowed.
if($thread['closed'] == 1)

	{
// Thread is closed - no editing allowed.
if($thread['closed'] == 1)

		{

		{

			xmlhttp_error($lang->thread_closed_edit_message);

			xmlhttp_error($lang->thread_closed_edit_message);

		}

		}

		// Forum is not open, user doesn't have permission to edit, or author doesn't match this user - don't allow editing.
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0 || $mybb->user['suspendposting'] == 1)
{
xmlhttp_error($lang->no_permission_edit_post);
}
// If we're past the edit time limit - don't allow editing.

		// Forum is not open, user doesn't have permission to edit, or author doesn't match this user - don't allow editing.
else if($forum['open'] == 0 || $forumpermissions['caneditposts'] == 0 || $mybb->user['uid'] != $post['uid'] || $mybb->user['uid'] == 0 || $mybb->user['suspendposting'] == 1)
{
xmlhttp_error($lang->no_permission_edit_post);
}
// If we're past the edit time limit - don't allow editing.

		else if($mybb->settings['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->settings['edittimelimit']*60)))
{
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);

		else if($mybb->usergroup['edittimelimit'] != 0 && $post['dateline'] < (TIME_NOW-($mybb->usergroup['edittimelimit']*60)))
{
$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']);

			xmlhttp_error($lang->edit_time_limit);

			xmlhttp_error($lang->edit_time_limit);

		}

		}

		// User can't edit unapproved post
if($post['visible'] == 0)
{
xmlhttp_error($lang->post_moderation);

		// User can't edit unapproved post
if($post['visible'] == 0)
{
xmlhttp_error($lang->post_moderation);

		}

// Forum is closed - no editing allowed
if($forum['open'] == 0)
{
xmlhttp_error($lang->no_permission_edit_post);

 
		}
}

		}
}





	$plugins->run_hooks("xmlhttp_edit_post_end");

	$plugins->run_hooks("xmlhttp_edit_post_end");





	if($mybb->get_input('do') == "get_post")
{
// Send our headers.

	if($mybb->get_input('do') == "get_post")
{
// Send our headers.

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

//$post['message'] = htmlspecialchars_uni($post['message']);

		header("Content-type: application/json; charset={$charset}");





// Send the contents of the post.


// Send the contents of the post.

		/*eval("\$inline_editor = \"".$templates->get("xmlhttp_inline_post_editor")."\";");
echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?".">";
echo "<form>".$inline_editor."</form>";*/
echo $post['message'];

		echo json_encode($post['message']);




		exit;
}
else if($mybb->get_input('do') == "update_post")

		exit;
}
else if($mybb->get_input('do') == "update_post")

Zeile 521Zeile 527
			"editreason" => $editreason,
"edit_uid" => $mybb->user['uid']
);

			"editreason" => $editreason,
"edit_uid" => $mybb->user['uid']
);

 

// If this is the first post set the prefix. If a forum requires a prefix the quick edit would throw an error otherwise
if($post['pid'] == $thread['firstpost'])
{
$updatepost['prefix'] = $thread['prefix'];
}


		$posthandler->set_data($updatepost);

// Now let the post handler do all the hard work.

		$posthandler->set_data($updatepost);

// Now let the post handler do all the hard work.

Zeile 540Zeile 553
				if($thread['firstpost'] == $post['pid'])
{
echo json_encode(array("moderation_thread" => $lang->thread_moderation, 'url' => $mybb->settings['bburl'].'/'.get_forum_link($thread['fid']), "message" => $post['message']));

				if($thread['firstpost'] == $post['pid'])
{
echo json_encode(array("moderation_thread" => $lang->thread_moderation, 'url' => $mybb->settings['bburl'].'/'.get_forum_link($thread['fid']), "message" => $post['message']));

					exit;
}

					exit;
}

				else
{
echo json_encode(array("moderation_post" => $lang->post_moderation, 'url' => $mybb->settings['bburl'].'/'.get_thread_link($thread['tid']), "message" => $post['message']));

				else
{
echo json_encode(array("moderation_post" => $lang->post_moderation, 'url' => $mybb->settings['bburl'].'/'.get_thread_link($thread['tid']), "message" => $post['message']));

Zeile 562Zeile 575
			"me_username" => $post['username'],
"filter_badwords" => 1
);

			"me_username" => $post['username'],
"filter_badwords" => 1
);

 

$post['username'] = htmlspecialchars_uni($post['username']);


if($post['smilieoff'] == 1)
{


if($post['smilieoff'] == 1)
{

Zeile 600Zeile 615
		{
$post['editdate'] = my_date('relative', TIME_NOW);
$post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate']);

		{
$post['editdate'] = my_date('relative', TIME_NOW);
$post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate']);

 
			$mybb->user['username'] = htmlspecialchars_uni($mybb->user['username']);

			$post['editedprofilelink'] = build_profile_link($mybb->user['username'], $mybb->user['uid']);

			$post['editedprofilelink'] = build_profile_link($mybb->user['username'], $mybb->user['uid']);

			$post['editreason'] = $editreason;

			$post['editreason'] = trim($editreason);

			$editreason = "";
if($post['editreason'] != "")
{

			$editreason = "";
if($post['editreason'] != "")
{

Zeile 650Zeile 666
	foreach($multiquoted as $post)
{
$quoted_posts[$post] = (int)$post;

	foreach($multiquoted as $post)
{
$quoted_posts[$post] = (int)$post;

	}


	}


	// Join the post IDs back together
$quoted_posts = implode(",", $quoted_posts);


	// Join the post IDs back together
$quoted_posts = implode(",", $quoted_posts);


Zeile 666Zeile 682
	{
$inactiveforums = "AND t.fid NOT IN ({$inactiveforums})";
}

	{
$inactiveforums = "AND t.fid NOT IN ({$inactiveforums})";
}

 

// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();
$onlyusfids = array();
foreach($group_permissions as $gpfid => $forum_permissions)
{
if(isset($forum_permissions['canonlyviewownthreads']) && $forum_permissions['canonlyviewownthreads'] == 1)
{
$onlyusfids[] = $gpfid;
}
}


	$message = '';

// Are we loading all quoted posts or only those not in the current thread?
if(empty($mybb->input['load_all']))
{

	$message = '';

// Are we loading all quoted posts or only those not in the current thread?
if(empty($mybb->input['load_all']))
{

		$from_tid = "p.tid != '".$mybb->get_input('tid', 1)."' AND ";

		$from_tid = "p.tid != '".$mybb->get_input('tid', MyBB::INPUT_INT)."' AND ";

	}
else

	}
else

	{

	{

		$from_tid = '';
}

		$from_tid = '';
}





	require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

require_once MYBB_ROOT."inc/functions_posting.php";

$plugins->run_hooks("xmlhttp_get_multiquoted_intermediate");

	require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

require_once MYBB_ROOT."inc/functions_posting.php";

$plugins->run_hooks("xmlhttp_get_multiquoted_intermediate");





	// Query for any posts in the list which are not within the specified thread
$query = $db->query("

	// Query for any posts in the list which are not within the specified thread
$query = $db->query("

		SELECT p.subject, p.message, p.pid, p.tid, p.username, p.dateline, t.fid, p.visible, u.username AS userusername

		SELECT p.subject, p.message, p.pid, p.tid, p.username, p.dateline, t.fid, t.uid AS thread_uid, p.visible, u.username AS userusername

		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)

		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)

Zeile 696Zeile 724
	");
while($quoted_post = $db->fetch_array($query))
{

	");
while($quoted_post = $db->fetch_array($query))
{

		if(!is_moderator($quoted_post['fid'], "canviewunapprove") && $quoted_post['visible'] == 0)





		if(
(!is_moderator($quoted_post['fid'], "canviewunapprove") && $quoted_post['visible'] == 0) ||
(!is_moderator($quoted_post['fid'], "canviewdeleted") && $quoted_post['visible'] == -1) ||
(in_array($quoted_post['fid'], $onlyusfids) && (!$mybb->user['uid'] || $quoted_post['thread_uid'] != $mybb->user['uid']))
)

		{
continue;
}

		{
continue;
}

Zeile 739Zeile 771
	header("Content-type: application/json; charset={$charset}");
echo json_encode(array("imagehash" => $imagehash));
exit;

	header("Content-type: application/json; charset={$charset}");
echo json_encode(array("imagehash" => $imagehash));
exit;

}

}

else if($mybb->input['action'] == "validate_captcha")
{
header("Content-type: application/json; charset={$charset}");

else if($mybb->input['action'] == "validate_captcha")
{
header("Content-type: application/json; charset={$charset}");

Zeile 747Zeile 779
	$query = $db->simple_select("captcha", "imagestring", "imagehash='$imagehash'");
if($db->num_rows($query) == 0)
{

	$query = $db->simple_select("captcha", "imagestring", "imagehash='$imagehash'");
if($db->num_rows($query) == 0)
{

		echo $lang->captcha_valid_not_exists;

		echo json_encode($lang->captcha_valid_not_exists);

		exit;
}
$imagestring = $db->fetch_field($query, 'imagestring');

		exit;
}
$imagestring = $db->fetch_field($query, 'imagestring');





	$plugins->run_hooks("xmlhttp_validate_captcha");

if(my_strtolower($imagestring) == my_strtolower($mybb->get_input('imagestring')))

	$plugins->run_hooks("xmlhttp_validate_captcha");

if(my_strtolower($imagestring) == my_strtolower($mybb->get_input('imagestring')))

Zeile 769Zeile 801
else if($mybb->input['action'] == "refresh_question" && $mybb->settings['securityquestion'])
{
header("Content-type: application/json; charset={$charset}");

else if($mybb->input['action'] == "refresh_question" && $mybb->settings['securityquestion'])
{
header("Content-type: application/json; charset={$charset}");

	



	$sid = $db->escape_string($mybb->get_input('question_id'));

	$sid = $db->escape_string($mybb->get_input('question_id'));

	$query = $db->query("
SELECT q.*, s.sid
FROM ".TABLE_PREFIX."questionsessions s

	$query = $db->query("
SELECT q.qid, s.sid
FROM ".TABLE_PREFIX."questionsessions s

		LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid)
WHERE q.active='1' AND s.sid='{$sid}'
");

		LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid)
WHERE q.active='1' AND s.sid='{$sid}'
");

 


	if($db->num_rows($query) == 0)
{
xmlhttp_error($lang->answer_valid_not_exists);
}

	if($db->num_rows($query) == 0)
{
xmlhttp_error($lang->answer_valid_not_exists);
}

	



	$qsession = $db->fetch_array($query);

	$qsession = $db->fetch_array($query);

	



	// Delete previous question session
$db->delete_query("questionsessions", "sid='$sid'");

	// Delete previous question session
$db->delete_query("questionsessions", "sid='$sid'");

	



	require_once MYBB_ROOT."inc/functions_user.php";

	require_once MYBB_ROOT."inc/functions_user.php";

	
$sid = generate_question();


$sid = generate_question($qsession['qid']);

	$query = $db->query("
SELECT q.question, s.sid
FROM ".TABLE_PREFIX."questionsessions s
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid)
WHERE q.active='1' AND s.sid='{$sid}' AND q.qid!='{$qsession['qid']}'
");

	$query = $db->query("
SELECT q.question, s.sid
FROM ".TABLE_PREFIX."questionsessions s
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid)
WHERE q.active='1' AND s.sid='{$sid}' AND q.qid!='{$qsession['qid']}'
");

 

$plugins->run_hooks("xmlhttp_refresh_question");


	if($db->num_rows($query) > 0)
{
$question = $db->fetch_array($query);

	if($db->num_rows($query) > 0)
{
$question = $db->fetch_array($query);

 

echo json_encode(array("question" => htmlspecialchars_uni($question['question']), 'sid' => htmlspecialchars_uni($question['sid'])));
exit;
}
else
{
xmlhttp_error($lang->answer_valid_not_exists);

	}

	}

	
$plugins->run_hooks("xmlhttp_refresh_question");

echo json_encode(array("question" => htmlspecialchars_uni($question['question']), 'sid' => htmlspecialchars_uni($question['sid'])));
exit;

 
}
elseif($mybb->input['action'] == "validate_question" && $mybb->settings['securityquestion'])
{
header("Content-type: application/json; charset={$charset}");
$sid = $db->escape_string($mybb->get_input('question'));
$answer = $db->escape_string($mybb->get_input('answer'));

}
elseif($mybb->input['action'] == "validate_question" && $mybb->settings['securityquestion'])
{
header("Content-type: application/json; charset={$charset}");
$sid = $db->escape_string($mybb->get_input('question'));
$answer = $db->escape_string($mybb->get_input('answer'));

	



	$query = $db->query("
SELECT q.*, s.sid
FROM ".TABLE_PREFIX."questionsessions s
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid)
WHERE q.active='1' AND s.sid='{$sid}'
");

	$query = $db->query("
SELECT q.*, s.sid
FROM ".TABLE_PREFIX."questionsessions s
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid)
WHERE q.active='1' AND s.sid='{$sid}'
");

 


	if($db->num_rows($query) == 0)
{

	if($db->num_rows($query) == 0)
{

		echo $lang->answer_valid_not_exists;

		echo json_encode($lang->answer_valid_not_exists);

		exit;
}
else

		exit;
}
else

Zeile 836Zeile 875
				$validated = 1;
}
}

				$validated = 1;
}
}

		



		$plugins->run_hooks("xmlhttp_validate_question");

if($validated != 1)

		$plugins->run_hooks("xmlhttp_validate_question");

if($validated != 1)

Zeile 885Zeile 924
	$username = $mybb->get_input('username');

// Fix bad characters

	$username = $mybb->get_input('username');

// Fix bad characters

	$username = trim($username);

	$username = trim_blank_chrs($username);

	$username = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);

// Remove multiple spaces from the username

	$username = str_replace(array(unichr(160), unichr(173), unichr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $username);

// Remove multiple spaces from the username

Zeile 895Zeile 934

if(empty($username))
{


if(empty($username))
{

		echo $lang->banned_characters_username;

		echo json_encode($lang->banned_characters_username);

		exit;
}


		exit;
}


Zeile 903Zeile 942
	$banned_username = is_banned_username($username, true);
if($banned_username)
{

	$banned_username = is_banned_username($username, true);
if($banned_username)
{

		echo $lang->banned_username;

		echo json_encode($lang->banned_username);

		exit;
}

// Check for certain characters in username (<, >, &, and slashes)

		exit;
}

// Check for certain characters in username (<, >, &, and slashes)

	if(strpos($username, "<") !== false || strpos($username, ">") !== false || strpos($username, "&") !== false || my_strpos($username, "\\") !== false || strpos($username, ";") !== false || !validate_utf8_string($username, false, false))

	if(strpos($username, "<") !== false || strpos($username, ">") !== false || strpos($username, "&") !== false || my_strpos($username, "\\") !== false || strpos($username, ";") !== false || strpos($username, ",") !== false || !validate_utf8_string($username, false, false))

	{

	{

		echo $lang->banned_characters_username;

		echo json_encode($lang->banned_characters_username);

		exit;
}


		exit;
}


Zeile 963Zeile 1002
	}
else
{

	}
else
{

		$lang->invalid_username = htmlspecialchars_uni($lang->sprintf($lang->invalid_username, htmlspecialchars_uni($username)));
echo $lang->invalid_username;

		$lang->invalid_username = $lang->sprintf($lang->invalid_username, htmlspecialchars_uni($username));
echo json_encode($lang->invalid_username);

		exit;
}
}

		exit;
}
}

Zeile 988Zeile 1027
		$offline = array();
while($buddy = $db->fetch_array($query))
{

		$offline = array();
while($buddy = $db->fetch_array($query))
{

 
			$buddy['username'] = htmlspecialchars_uni($buddy['username']);

			$buddy_name = format_name($buddy['username'], $buddy['usergroup'], $buddy['displaygroup']);
$profile_link = build_profile_link($buddy_name, $buddy['uid'], '_blank');
if($buddy['lastactive'] > $timecut && ($buddy['invisible'] == 0 || $mybb->user['usergroup'] == 4) && $buddy['lastvisit'] != $buddy['lastactive'])

			$buddy_name = format_name($buddy['username'], $buddy['usergroup'], $buddy['displaygroup']);
$profile_link = build_profile_link($buddy_name, $buddy['uid'], '_blank');
if($buddy['lastactive'] > $timecut && ($buddy['invisible'] == 0 || $mybb->user['usergroup'] == 4) && $buddy['lastvisit'] != $buddy['lastactive'])

Zeile 1016Zeile 1056
/**
* Spits an XML Http based error message back to the browser
*

/**
* Spits an XML Http based error message back to the browser
*

 * @param string The message to send back.

 * @param string $message The message to send back.

 */
function xmlhttp_error($message)
{

 */
function xmlhttp_error($message)
{