Vergleich xmlhttp.php - 1.6.0 - 1.6.15

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

 * $Id$

 */

/**

 */

/**

Zeile 18Zeile 18
 * This is done to make response times when using XML HTTP Requests faster and
* less intense on the server.
*/

 * This is done to make response times when using XML HTTP Requests faster and
* less intense on the server.
*/

 



define("IN_MYBB", 1);

// We don't want visits here showing up on the Who's Online

define("IN_MYBB", 1);

// We don't want visits here showing up on the Who's Online

Zeile 71Zeile 71
if(isset($mybb->user['style']) && intval($mybb->user['style']) != 0)
{
$loadstyle = "tid='".$mybb->user['style']."'";

if(isset($mybb->user['style']) && intval($mybb->user['style']) != 0)
{
$loadstyle = "tid='".$mybb->user['style']."'";

}
else
{

}
else
{

	$loadstyle = "def=1";
}

	$loadstyle = "def=1";
}





// Load basic theme information that we could be needing.
$query = $db->simple_select("themes", "name, tid, properties", $loadstyle);
$theme = $db->fetch_array($query);

// Load basic theme information that we could be needing.
$query = $db->simple_select("themes", "name, tid, properties", $loadstyle);
$theme = $db->fetch_array($query);

Zeile 84Zeile 84

// Set the appropriate image language directory for this theme.
if(!empty($mybb->user['language']) && is_dir($theme['imgdir'].'/'.$mybb->user['language']))


// Set the appropriate image language directory for this theme.
if(!empty($mybb->user['language']) && is_dir($theme['imgdir'].'/'.$mybb->user['language']))

{

{

	$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else

	$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else

Zeile 98Zeile 98
		$theme['imglangdir'] = $theme['imgdir'];
}
}

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

 

$templatelist = "postbit_editedby,xmlhttp_inline_post_editor,xmlhttp_buddyselect_online,xmlhttp_buddyselect_offline,xmlhttp_buddyselect";
$templates->cache($db->escape_string($templatelist));


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


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

{

{

	$charset = $lang->settings['charset'];
}
// If not, revert to UTF-8

	$charset = $lang->settings['charset'];
}
// If not, revert to UTF-8

else
{

else
{

	$charset = "UTF-8";
}

	$charset = "UTF-8";
}





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

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





$plugins->run_hooks("xmlhttp");

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

$plugins->run_hooks("xmlhttp");

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

{

{

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

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

	



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


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


	// Sanitize the input.
$mybb->input['query'] = str_replace(array("%", "_"), array("\\%", "\\_"), $mybb->input['query']);


 
	// Query for any matching users.
$query_options = array(
"order_by" => "username",

	// Query for any matching users.
$query_options = array(
"order_by" => "username",

Zeile 136Zeile 136
		"limit_start" => 0,
"limit" => 15
);

		"limit_start" => 0,
"limit" => 15
);

	
$query = $db->simple_select("users", "uid, username", "username LIKE '".$db->escape_string($mybb->input['query'])."%'", $query_options);


$query = $db->simple_select("users", "uid, username", "username LIKE '".$db->escape_string_like($mybb->input['query'])."%'", $query_options);

	while($user = $db->fetch_array($query))
{
$user['username'] = htmlspecialchars_uni($user['username']);
// Send the result to the browser for this user.

	while($user = $db->fetch_array($query))
{
$user['username'] = htmlspecialchars_uni($user['username']);
// Send the result to the browser for this user.

		echo "<div>\n";

		echo "<div>\n";

		echo "<span class=\"username\">{$user['username']}</span>\n";
echo "</div>\n";
}

		echo "<span class=\"username\">{$user['username']}</span>\n";
echo "</div>\n";
}

Zeile 154Zeile 154
	{
exit;
}

	{
exit;
}

	



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

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





	// Sanitize the input.
$mybb->input['query'] = str_replace(array("%", "_"), array("\\%", "\\_"), $mybb->input['query']);

	// Sanitize the input.
$mybb->input['query'] = str_replace(array("%", "_"), array("\\%", "\\_"), $mybb->input['query']);

	



	// Query for any matching usergroups.
$query_options = array(
"order_by" => "title",

	// Query for any matching usergroups.
$query_options = array(
"order_by" => "title",

Zeile 168Zeile 168
		"limit_start" => 0,
"limit" => 15
);

		"limit_start" => 0,
"limit" => 15
);

	



	$query = $db->simple_select("usergroups", "gid, title", "title LIKE '".$db->escape_string($mybb->input['query'])."%'", $query_options);
while($group = $db->fetch_array($query))
{
$group['title'] = htmlspecialchars_uni($group['title']);
// Send the result to the browser for this usergroup.
echo "<div>\n";

	$query = $db->simple_select("usergroups", "gid, title", "title LIKE '".$db->escape_string($mybb->input['query'])."%'", $query_options);
while($group = $db->fetch_array($query))
{
$group['title'] = htmlspecialchars_uni($group['title']);
// Send the result to the browser for this usergroup.
echo "<div>\n";

		echo "<span class=\"usergroup\">{$group['title']}</span>\n";

		echo "<span class=\"usergroup\">{$group['title']} ({$lang->usergroup} {$group['gid']})</span>\n";

		echo "</div>\n";
}
}

		echo "</div>\n";
}
}

Zeile 187Zeile 187
	{
xmlhttp_error($lang->invalid_post_code);
}

	{
xmlhttp_error($lang->invalid_post_code);
}

	



	// Editing a post subject.
if($mybb->input['pid'])
{
// Fetch the post from the database.
$post = get_post($mybb->input['pid']);

	// Editing a post subject.
if($mybb->input['pid'])
{
// Fetch the post from the database.
$post = get_post($mybb->input['pid']);

		



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

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

		



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

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

	}


	}


	// We're editing a thread subject.
else if($mybb->input['tid'])
{
// Fetch the thread.
$thread = get_thread($mybb->input['tid']);

	// We're editing a thread subject.
else if($mybb->input['tid'])
{
// Fetch the thread.
$thread = get_thread($mybb->input['tid']);

		



		// 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 226Zeile 226
	{
xmlhttp_error($lang->thread_doesnt_exist);
}

	{
xmlhttp_error($lang->thread_doesnt_exist);
}

	



	// Fetch forum permissions.
$forumpermissions = forum_permissions($forum['fid']);

	// Fetch forum permissions.
$forumpermissions = forum_permissions($forum['fid']);

	



	// If this user is not a moderator with "caneditposts" permissions.
if(!is_moderator($forum['fid'], "caneditposts"))
{

	// If this user is not a moderator with "caneditposts" permissions.
if(!is_moderator($forum['fid'], "caneditposts"))
{

Zeile 270Zeile 270
		{
$subject = utf8_decode($subject);
}

		{
$subject = utf8_decode($subject);
}

	}	


	}


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

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

Zeile 294Zeile 294
		xmlhttp_error($errors);
}
// No errors were found, we can call the update method.

		xmlhttp_error($errors);
}
// No errors were found, we can call the update method.

	else

	else

	{
$posthandler->update_post();
if($ismod == true)
{
$modlogdata = array(
"tid" => $thread['tid'],

	{
$posthandler->update_post();
if($ismod == true)
{
$modlogdata = array(
"tid" => $thread['tid'],

				"pid" => $post['pid'],

 
				"fid" => $forum['fid']
);
log_moderator_action($modlogdata, $lang->edited_post);

				"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: text/plain; charset={$charset}");

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

	



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

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

	



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

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

	



	// Close the connection.
exit;
}
else if($mybb->input['action'] == "edit_post")

	// Close the connection.
exit;
}
else if($mybb->input['action'] == "edit_post")

{	

{

	// Fetch the post from the database.
$post = get_post($mybb->input['pid']);

	// Fetch the post from the database.
$post = get_post($mybb->input['pid']);

		



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

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

	



	// 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['tid'] || !$forum['fid'] || $forum['type'] != "f")
{
xmlhttp_error($lang->thread_doesnt_exist);
}

	// Missing thread, invalid forum? Error.
if(!$thread['tid'] || !$forum['fid'] || $forum['type'] != "f")
{
xmlhttp_error($lang->thread_doesnt_exist);
}

	



	// Fetch forum permissions.
$forumpermissions = forum_permissions($forum['fid']);

	// Fetch forum permissions.
$forumpermissions = forum_permissions($forum['fid']);

	



	// If this user is not a moderator with "caneditposts" permissions.
if(!is_moderator($forum['fid'], "caneditposts"))
{

	// If this user is not a moderator with "caneditposts" permissions.
if(!is_moderator($forum['fid'], "caneditposts"))
{

Zeile 358Zeile 357
		}
// 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)

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

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

		// 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']);
xmlhttp_error($lang->edit_time_limit);

			$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->settings['edittimelimit']);
xmlhttp_error($lang->edit_time_limit);

		}
}





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





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


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

	}

	}



 
	if($mybb->input['do'] == "get_post")
{
// Send our headers.
header("Content-type: text/xml; charset={$charset}");

	if($mybb->input['do'] == "get_post")
{
// Send our headers.
header("Content-type: text/xml; charset={$charset}");

		



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

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

		



		// Send the contents of the post.
eval("\$inline_editor = \"".$templates->get("xmlhttp_inline_post_editor")."\";");
echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?".">";

		// Send the contents of the post.
eval("\$inline_editor = \"".$templates->get("xmlhttp_inline_post_editor")."\";");
echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?".">";

Zeile 394Zeile 397
		if(!verify_post_check($mybb->input['my_post_key'], true))
{
xmlhttp_error($lang->invalid_post_code);

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

		}


		}


		$message = (string)$mybb->input['value'];
if(my_strtolower($charset) != "utf-8")
{
if(function_exists("iconv"))

		$message = (string)$mybb->input['value'];
if(my_strtolower($charset) != "utf-8")
{
if(function_exists("iconv"))

			{

			{

				$message = iconv($charset, "UTF-8//IGNORE", $message);
}
else if(function_exists("mb_convert_encoding"))
{
$message = @mb_convert_encoding($message, $charset, "UTF-8");

				$message = iconv($charset, "UTF-8//IGNORE", $message);
}
else if(function_exists("mb_convert_encoding"))
{
$message = @mb_convert_encoding($message, $charset, "UTF-8");

			}

			}

			else if(my_strtolower($charset) == "iso-8859-1")
{
$message = utf8_decode($message);
}
}

			else if(my_strtolower($charset) == "iso-8859-1")
{
$message = utf8_decode($message);
}
}

		



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

		// 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" => $mybb->input['pid'],

		// Set the post data that came from the input to the $post array.
$updatepost = array(
"pid" => $mybb->input['pid'],

Zeile 428Zeile 431

// Now let the post handler do all the hard work.
if(!$posthandler->validate_post())


// Now let the post handler do all the hard work.
if(!$posthandler->validate_post())

		{

		{

			$post_errors = $posthandler->get_friendly_errors();
$errors = implode("\n\n", $post_errors);
xmlhttp_error($errors);

			$post_errors = $posthandler->get_friendly_errors();
$errors = implode("\n\n", $post_errors);
xmlhttp_error($errors);

Zeile 438Zeile 441
		{
$postinfo = $posthandler->update_post();
$visible = $postinfo['visible'];

		{
$postinfo = $posthandler->update_post();
$visible = $postinfo['visible'];

			if($visible == 0 && !is_moderator())

			if($visible == 0 && !is_moderator($post['fid']))

			{
echo "<p>\n";
echo $lang->post_moderation;

			{
echo "<p>\n";
echo $lang->post_moderation;

Zeile 449Zeile 452

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


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

		



		$parser_options = array(
"allow_html" => $forum['allowhtml'],
"allow_mycode" => $forum['allowmycode'],

		$parser_options = array(
"allow_html" => $forum['allowhtml'],
"allow_mycode" => $forum['allowmycode'],

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

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

		



		if($post['smilieoff'] == 1)
{
$parser_options['allow_smilies'] = 0;
}

		if($post['smilieoff'] == 1)
{
$parser_options['allow_smilies'] = 0;
}

	



		$post['message'] = $parser->parse_message($message, $parser_options);

		$post['message'] = $parser->parse_message($message, $parser_options);

		



		// Now lets fetch all of the attachments for these posts.
$query = $db->simple_select("attachments", "*", "pid='{$post['pid']}'");
while($attachment = $db->fetch_array($query))
{
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}

		// Now lets fetch all of the attachments for these posts.
$query = $db->simple_select("attachments", "*", "pid='{$post['pid']}'");
while($attachment = $db->fetch_array($query))
{
$attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}

		



		require_once MYBB_ROOT."inc/functions_post.php";

		require_once MYBB_ROOT."inc/functions_post.php";

		
get_post_attachments($post['pid'], $post);


get_post_attachments($post['pid'], $post);


// Figure out if we need to show an "edited by" message
// Only show if at least one of "showeditedby" or "showeditedbyadmin" is enabled


// Figure out if we need to show an "edited by" message
// Only show if at least one of "showeditedby" or "showeditedbyadmin" is enabled

Zeile 488Zeile 491
			$post['editedprofilelink'] = build_profile_link($mybb->user['username'], $mybb->user['uid']);
eval("\$editedmsg = \"".$templates->get("postbit_editedby")."\";");
}

			$post['editedprofilelink'] = build_profile_link($mybb->user['username'], $mybb->user['uid']);
eval("\$editedmsg = \"".$templates->get("postbit_editedby")."\";");
}

		



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

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

		echo "<p>\n";
echo $post['message'];
echo "</p>\n";

		echo $post['message']."\n";



		if($editedmsg)
{
echo str_replace(array("\r", "\n"), "", "<editedmsg>{$editedmsg}</editedmsg>");

		if($editedmsg)
{
echo str_replace(array("\r", "\n"), "", "<editedmsg>{$editedmsg}</editedmsg>");

Zeile 510Zeile 511
	}
// Divide up the cookie using our delimeter
$multiquoted = explode("|", $mybb->cookies['multiquote']);

	}
// Divide up the cookie using our delimeter
$multiquoted = explode("|", $mybb->cookies['multiquote']);

	



	// No values - exit
if(!is_array($multiquoted))
{
exit;
}

	// No values - exit
if(!is_array($multiquoted))
{
exit;
}

	



	// Loop through each post ID and sanitize it before querying
foreach($multiquoted as $post)

	// Loop through each post ID and sanitize it before querying
foreach($multiquoted as $post)

	{

	{

		$quoted_posts[$post] = intval($post);
}

		$quoted_posts[$post] = intval($post);
}





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

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

	



	// Fetch unviewable forums
$unviewable_forums = get_unviewable_forums();
if($unviewable_forums)

	// Fetch unviewable forums
$unviewable_forums = get_unviewable_forums();
if($unviewable_forums)

Zeile 533Zeile 534
		$unviewable_forums = "AND t.fid NOT IN ({$unviewable_forums})";
}
$message = '';

		$unviewable_forums = "AND t.fid NOT IN ({$unviewable_forums})";
}
$message = '';

	



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

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

Zeile 542Zeile 543
	else
{
$from_tid = '';

	else
{
$from_tid = '';

	}

	}


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


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

Zeile 556Zeile 557
		LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
WHERE {$from_tid}p.pid IN ($quoted_posts) {$unviewable_forums}

		LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid)
WHERE {$from_tid}p.pid IN ($quoted_posts) {$unviewable_forums}

 
		ORDER BY p.dateline

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

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

Zeile 563Zeile 565
		{
continue;
}

		{
continue;
}

		



		$message .= parse_quoted_message($quoted_post, false);

		$message .= parse_quoted_message($quoted_post, false);

	}

	}

	if($mybb->settings['maxquotedepth'] != '0')
{
$message = remove_message_quotes($message);
}

	if($mybb->settings['maxquotedepth'] != '0')
{
$message = remove_message_quotes($message);
}

	



	// Send our headers.
header("Content-type: text/plain; charset={$charset}");
echo $message;

	// Send our headers.
header("Content-type: text/plain; charset={$charset}");
echo $message;

	exit;	

	exit;

}
else if($mybb->input['action'] == "refresh_captcha")
{

}
else if($mybb->input['action'] == "refresh_captcha")
{

Zeile 622Zeile 624
else if($mybb->input['action'] == "complex_password")
{
$password = trim($mybb->input['value']);

else if($mybb->input['action'] == "complex_password")
{
$password = trim($mybb->input['value']);

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

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


header("Content-type: text/xml; charset={$charset}");
if(!preg_match("/^.*(?=.{".$mybb->settings['minpasswordlength'].",})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password))


header("Content-type: text/xml; charset={$charset}");
if(!preg_match("/^.*(?=.{".$mybb->settings['minpasswordlength'].",})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/", $password))

Zeile 639Zeile 641
}
else if($mybb->input['action'] == "username_availability")
{

}
else if($mybb->input['action'] == "username_availability")
{

 
	if(!verify_post_check($mybb->input['my_post_key'], true))
{
xmlhttp_error($lang->invalid_post_code);
}


	require_once MYBB_ROOT."inc/functions_user.php";
$username = $mybb->input['value'];

// Fix bad characters
$username = trim($username);

	require_once MYBB_ROOT."inc/functions_user.php";
$username = $mybb->input['value'];

// Fix bad characters
$username = trim($username);

	$username = str_replace(array(unicode_chr(160), unicode_chr(173), unicode_chr(0xCA), dec_to_utf8(8238), dec_to_utf8(8237), dec_to_utf8(8203)), array(" ", "-", "", "", "", ""), $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 = preg_replace("#\s{2,}#", " ", $username);


// Remove multiple spaces from the username
$username = preg_replace("#\s{2,}#", " ", $username);





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

if(empty($username))

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

if(empty($username))

	{
echo "<fail>{$lang->banned_characters_username}</fail>";

	{
echo "<fail>{$lang->banned_characters_username}</fail>";

		exit;
}

		exit;
}

	



	// Check if the username belongs to the list of banned usernames.
$banned_username = is_banned_username($username, true);
if($banned_username)
{
echo "<fail>{$lang->banned_username}</fail>";

	// Check if the username belongs to the list of banned usernames.
$banned_username = is_banned_username($username, true);
if($banned_username)
{
echo "<fail>{$lang->banned_username}</fail>";

		exit;
}

		exit;
}


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


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

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

	{
echo "<fail>{$lang->banned_characters_username}</fail>";
exit;
}

// Check if the username is actually already in use

	{
echo "<fail>{$lang->banned_characters_username}</fail>";
exit;
}

// Check if the username is actually already in use

	$query = $db->simple_select("users", "uid", "LOWER(username)='".$db->escape_string(my_strtolower($username))."'");
$user = $db->fetch_array($query);

if($user['uid'])
{
$lang->username_taken = $lang->sprintf($lang->username_taken, $username);

	$query = $db->simple_select("users", "uid", "LOWER(username)='".$db->escape_string(my_strtolower($username))."'");
$user = $db->fetch_array($query);

if($user['uid'])
{
$lang->username_taken = $lang->sprintf($lang->username_taken, htmlspecialchars_uni($username));

		echo "<fail>{$lang->username_taken}</fail>";

		echo "<fail>{$lang->username_taken}</fail>";

		exit;		
}

		exit;
}

	else

	else

	{
$lang->username_available = $lang->sprintf($lang->username_available, $username);

	{
$lang->username_available = $lang->sprintf($lang->username_available, htmlspecialchars_uni($username));

		echo "<success>{$lang->username_available}</success>";
exit;

		echo "<success>{$lang->username_available}</success>";
exit;

	}

	}

}
else if($mybb->input['action'] == "username_exists")
{

}
else if($mybb->input['action'] == "username_exists")
{

 
	if(!verify_post_check($mybb->input['my_post_key'], true))
{
xmlhttp_error($lang->invalid_post_code);
}


	require_once MYBB_ROOT."inc/functions_user.php";
$username = $mybb->input['value'];


	require_once MYBB_ROOT."inc/functions_user.php";
$username = $mybb->input['value'];


Zeile 708Zeile 720

if($user['uid'])
{


if($user['uid'])
{

		$lang->valid_username = $lang->sprintf($lang->valid_username, $username);

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

		echo "<success>{$lang->valid_username}</success>";
exit;
}
else
{

		echo "<success>{$lang->valid_username}</success>";
exit;
}
else
{

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

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

		echo "<fail>{$lang->invalid_username}</fail>";
exit;
}

		echo "<fail>{$lang->invalid_username}</fail>";
exit;
}

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

if($mybb->user['buddylist'] != "")

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

if($mybb->user['buddylist'] != "")

	{

	{

		$query_options = array(
"order_by" => "username",
"order_dir" => "asc"
);

		$query_options = array(
"order_by" => "username",
"order_dir" => "asc"
);

		$timecut = TIME_NOW - $mybb->settings['wolcutoff'];		

		$timecut = TIME_NOW - $mybb->settings['wolcutoff'];

		$query = $db->simple_select("users", "uid, username, usergroup, displaygroup, lastactive, lastvisit, invisible", "uid IN ({$mybb->user['buddylist']})", $query_options);
$online = array();
$offline = array();

		$query = $db->simple_select("users", "uid, username, usergroup, displaygroup, lastactive, lastvisit, invisible", "uid IN ({$mybb->user['buddylist']})", $query_options);
$online = array();
$offline = array();

Zeile 766Zeile 778
function xmlhttp_error($message)
{
global $charset;

function xmlhttp_error($message)
{
global $charset;

	



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

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

	



	// Send the error message.
echo "<error>".$message."</error>";

	// Send the error message.
echo "<error>".$message."</error>";

	



	// Exit
exit;
}

	// Exit
exit;
}