Vergleich xmlhttp.php - 1.6.10 - 1.6.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
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 28Zeile 28

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


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


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

 

$shutdown_queries = array();



$shutdown_queries = array();


Zeile 101Zeile 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'])
{

Zeile 125Zeile 125
	{
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']);


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

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

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

	while($user = $db->fetch_array($query))
{
$user['username'] = htmlspecialchars_uni($user['username']);

Zeile 157Zeile 154
	{
exit;
}

	{
exit;
}

	



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

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

	// 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 usergroups.
$query_options = array(
"order_by" => "title",

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

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

	$query = $db->simple_select("usergroups", "gid, title", "title LIKE '".$db->escape_string($mybb->input['query'])."%'", $query_options);
while($group = $db->fetch_array($query))
{

Zeile 190Zeile 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 229Zeile 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 273Zeile 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 310Zeile 307
			log_moderator_action($modlogdata, $lang->edited_post);
}
}

			log_moderator_action($modlogdata, $lang->edited_post);
}
}

	



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

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

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

// 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']);


Zeile 347Zeile 344
	{
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 375Zeile 372
		{
xmlhttp_error($lang->post_moderation);
}

		{
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 420Zeile 416
				$message = utf8_decode($message);
}
}

				$message = utf8_decode($message);
}
}

		



		// 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 457Zeile 453

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 467Zeile 463
			"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);

// Figure out if we need to show an "edited by" message

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

// Figure out if we need to show an "edited by" message

Zeile 496Zeile 492
			$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}");
echo $post['message']."\n";

		// Send our headers.
header("Content-type: text/plain; charset={$charset}");
echo $post['message']."\n";

Zeile 516Zeile 512
	}
// 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)
{

Zeile 531Zeile 527

// 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 539Zeile 535
		$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 570Zeile 566
		{
continue;
}

		{
continue;
}

		



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

		$message .= parse_quoted_message($quoted_post, false);
}
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 663Zeile 659

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



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


	if(empty($username))

	if(empty($username) || utf8_handle_4byte_string($username, false) == false)

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

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

	



	// Check if the username belongs to the list of banned usernames.
$banned_username = is_banned_username($username, true);
if($banned_username)

	// Check if the username belongs to the list of banned usernames.
$banned_username = is_banned_username($username, true);
if($banned_username)

Zeile 692Zeile 688
	{
$lang->username_taken = $lang->sprintf($lang->username_taken, htmlspecialchars_uni($username));
echo "<fail>{$lang->username_taken}</fail>";

	{
$lang->username_taken = $lang->sprintf($lang->username_taken, htmlspecialchars_uni($username));
echo "<fail>{$lang->username_taken}</fail>";

		exit;		

		exit;

	}
else
{

	}
else
{

Zeile 747Zeile 743
			"order_by" => "username",
"order_dir" => "asc"
);

			"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 783Zeile 779
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;
}