Vergleich xmlhttp.php - 1.8.7 - 1.8.20

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 124Zeile 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(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 a language directory for the current language exists within the theme - we use it
if(!empty($mybb->user['language']))

Zeile 222Zeile 222
if($mybb->input['action'] == "get_users")
{
$mybb->input['query'] = ltrim($mybb->get_input('query'));

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

 
	$search_type = $mybb->get_input('search_type', MyBB::INPUT_INT); // 0: contains, 1: starts with, 2: ends with


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


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

Zeile 251Zeile 252

$plugins->run_hooks("xmlhttp_get_users_start");



$plugins->run_hooks("xmlhttp_get_users_start");


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















	$likestring = $db->escape_string_like($mybb->input['query']);
if($search_type == 1)
{
$likestring .= '%';
}
elseif($search_type == 2)
{
$likestring = '%'.$likestring;
}
else
{
$likestring = '%'.$likestring.'%';
}

$query = $db->simple_select("users", "uid, username", "username LIKE '{$likestring}'", $query_options);
if($limit == 1)

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

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

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

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


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

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

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


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



	$plugins->run_hooks("xmlhttp_get_users_end");

echo json_encode($data);

	$plugins->run_hooks("xmlhttp_get_users_end");

echo json_encode($data);

Zeile 290Zeile 303
		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 303Zeile 316
	else
{
exit;

	else
{
exit;

	}

	}


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

Zeile 339Zeile 352
			xmlhttp_error($lang->edit_time_limit);
}
$ismod = false;

			xmlhttp_error($lang->edit_time_limit);
}
$ismod = false;

	}

	}

	else

	else

	{

	{

		$ismod = true;
}
$subject = $mybb->get_input('value');

		$ismod = true;
}
$subject = $mybb->get_input('value');

Zeile 350Zeile 363
		if(function_exists("iconv"))
{
$subject = iconv($charset, "UTF-8//IGNORE", $subject);

		if(function_exists("iconv"))
{
$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");
}

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

// No result, die.

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

// No result, die.

	if(!$post)

	if(!$post || $post['visible'] == -1)

	{
xmlhttp_error($lang->post_doesnt_exist);
}

	{
xmlhttp_error($lang->post_doesnt_exist);
}

Zeile 470Zeile 483
			$lang->edit_time_limit = $lang->sprintf($lang->edit_time_limit, $mybb->usergroup['edittimelimit']);
xmlhttp_error($lang->edit_time_limit);
}

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

		// User can't edit unapproved post
if($post['visible'] == 0)

		// User can't edit unapproved post unless permitted for own
if($post['visible'] == 0 && !($mybb->settings['showownunapproved'] && $post['uid'] == $mybb->user['uid']))

		{
xmlhttp_error($lang->post_moderation);
}

		{
xmlhttp_error($lang->post_moderation);
}

Zeile 577Zeile 590
			"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 591Zeile 606
		if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
{
$parser_options['allow_videocode'] = 0;

		if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)
{
$parser_options['allow_videocode'] = 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.
if($mybb->settings['enableattachments'] != 0)


// Now lets fetch all of the attachments for these posts.
if($mybb->settings['enableattachments'] != 0)

Zeile 607Zeile 622
			require_once MYBB_ROOT."inc/functions_post.php";

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

			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
// Only show if at least one of "showeditedby" or "showeditedbyadmin" is enabled
if($mybb->settings['showeditedby'] != 0 && $mybb->settings['showeditedbyadmin'] != 0)
{
$post['editdate'] = my_date('relative', TIME_NOW);
$post['editnote'] = $lang->sprintf($lang->postbit_edited, $post['editdate']);

		// Figure out if we need to show an "edited by" message
// Only show if at least one of "showeditedby" or "showeditedbyadmin" is enabled
if($mybb->settings['showeditedby'] != 0 && $mybb->settings['showeditedbyadmin'] != 0)
{
$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['editreason'] = trim($editreason);
$editreason = "";

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

Zeile 639Zeile 655
		$plugins->run_hooks("xmlhttp_update_post");

echo json_encode(array("message" => $post['message']."\n", "editedmsg" => $editedmsg_response));

		$plugins->run_hooks("xmlhttp_update_post");

echo json_encode(array("message" => $post['message']."\n", "editedmsg" => $editedmsg_response));

		exit;

		exit;

	}
}
// Fetch the list of multiquoted posts which are not in a specific thread

	}
}
// Fetch the list of multiquoted posts which are not in a specific thread

Zeile 647Zeile 663
{
// If the cookie does not exist, exit
if(!array_key_exists("multiquote", $mybb->cookies))

{
// If the cookie does not exist, exit
if(!array_key_exists("multiquote", $mybb->cookies))

	{
exit;

	{
exit;

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

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





	$plugins->run_hooks("xmlhttp_get_multiquoted_start");

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

	$plugins->run_hooks("xmlhttp_get_multiquoted_start");

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

	{

	{

		exit;

		exit;

	}


	}


	// Loop through each post ID and sanitize it before querying
foreach($multiquoted as $post)
{
$quoted_posts[$post] = (int)$post;

	// Loop through each post ID and sanitize it before querying
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 681Zeile 697
	{
$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?

	$message = '';

// Are we loading all quoted posts or only those not in the current thread?

Zeile 702Zeile 730

// 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 711Zeile 739
	");
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;





			// Allow quoting from own unapproved post
if($quoted_post['visible'] == 0 && !($mybb->settings['showownunapproved'] && $quoted_post['uid'] == $mybb->user['uid']))
{
continue;
}

		}

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

		}

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

Zeile 832Zeile 868
	header("Content-type: application/json; charset={$charset}");
$sid = $db->escape_string($mybb->get_input('question'));
$answer = $db->escape_string($mybb->get_input('answer'));

	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

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

Zeile 843Zeile 879
	if($db->num_rows($query) == 0)
{
echo json_encode($lang->answer_valid_not_exists);

	if($db->num_rows($query) == 0)
{
echo json_encode($lang->answer_valid_not_exists);

		exit;

		exit;

	}
else
{

	}
else
{

Zeile 901Zeile 937
	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);

	}


	}


	require_once MYBB_ROOT."inc/functions_user.php";
$username = $mybb->get_input('username');

	require_once MYBB_ROOT."inc/functions_user.php";
$username = $mybb->get_input('username');





	// Fix bad characters
$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);

	// Fix bad characters
$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);

Zeile 914Zeile 950
	$username = preg_replace("#\s{2,}#", " ", $username);

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

	$username = preg_replace("#\s{2,}#", " ", $username);

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





	if(empty($username))

	if(empty($username))

	{

	{

		echo json_encode($lang->banned_characters_username);

		echo json_encode($lang->banned_characters_username);

		exit;
}

		exit;
}


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


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

		exit;
}

		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 || strpos($username, ",") !== false || !validate_utf8_string($username, false, false))


// 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 || strpos($username, ",") !== false || !validate_utf8_string($username, false, false))

Zeile 950Zeile 986
	else
{
//$lang->username_available = $lang->sprintf($lang->username_available, htmlspecialchars_uni($username));

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

		echo json_encode("true");
exit;

		echo json_encode("true");
exit;

	}
}

	}
}

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

else if($mybb->input['action'] == "email_availability")

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


	require_once MYBB_ROOT."inc/functions_user.php";
$username = $mybb->get_input('value');

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

	require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler("insert");

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





	if(!trim($username))
{
echo json_encode(array("success" => 1));
exit;
}

// Check if the username actually exists
$user = get_user_by_username($username);

$plugins->run_hooks("xmlhttp_username_exists");

if($user['uid'])
{
$lang->valid_username = $lang->sprintf($lang->valid_username, htmlspecialchars_uni($username));
echo json_encode(array("success" => $lang->valid_username));
exit;
}
else






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

$user = array(
'email' => $email
);

$userhandler->set_data($user);

$errors = array();

if(!$userhandler->verify_email())
{
$errors = $userhandler->get_friendly_errors();
}

$plugins->run_hooks("xmlhttp_email_availability");

if(!empty($errors))
{
echo json_encode($errors[0]);
exit;
}
else

	{

	{

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

		echo json_encode("true");


		exit;
}
}

		exit;
}
}

Zeile 1009Zeile 1049
		$online = array();
$offline = array();
while($buddy = $db->fetch_array($query))

		$online = array();
$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 1033Zeile 1074
	{
xmlhttp_error($lang->buddylist_error);
}

	{
xmlhttp_error($lang->buddylist_error);
}

 
}
else if($mybb->input['action'] == 'get_referrals')
{
$lang->load('member');
$uid = $mybb->get_input('uid', MYBB::INPUT_INT);

if (!$uid) {
xmlhttp_error($lang->referrals_no_user_specified);
}

$referrals = get_user_referrals($uid);

if (empty($referrals)) {
eval("\$referral_rows = \"".$templates->get('member_no_referrals')."\";");
} else {
foreach($referrals as $referral)
{
// Format user name link
$username = htmlspecialchars_uni($referral['username']);
$username = format_name($username, $referral['usergroup'], $referral['displaygroup']);
$username = build_profile_link($username, $referral['uid']);

$regdate = my_date('normal', $referral['regdate']);

eval("\$referral_rows .= \"".$templates->get('member_referral_row')."\";");

$bg_color = alt_trow();
}
}

$plugins->run_hooks('xmlhttp_referrals_end');

eval("\$referrals = \"".$templates->get('member_referrals_popup', 1, 0)."\";");

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

}

/**

}

/**