Vergleich xmlhttp.php - 1.8.12 - 1.8.30

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
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: starts with, 1: ends with, 2: contains


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















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

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

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

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

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

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

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

		}
}


		}
}


Zeile 278Zeile 293
	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);

	}

	}


// We're editing a thread subject.
if($mybb->get_input('tid', MyBB::INPUT_INT))


// We're editing a thread subject.
if($mybb->get_input('tid', MyBB::INPUT_INT))

Zeile 292Zeile 307

// Fetch some of the information from the first post of this thread.
$query_options = array(


// Fetch some of the information from the first post of this thread.
$query_options = array(

			"order_by" => "dateline",
"order_dir" => "asc",

			"order_by" => "dateline, pid",


		);
$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);

Zeile 348Zeile 362
		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"))
{
$subject = @mb_convert_encoding($subject, $charset, "UTF-8");
}

		}
else if(function_exists("mb_convert_encoding"))
{
$subject = @mb_convert_encoding($subject, $charset, "UTF-8");
}

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

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

Zeile 371Zeile 385
		$updatepost = array(
"pid" => $post['pid'],
"tid" => $thread['tid'],

		$updatepost = array(
"pid" => $post['pid'],
"tid" => $thread['tid'],

 
			"fid" => $forum['fid'],

			"prefix" => $thread['prefix'],
"subject" => $subject,
"edit_uid" => $mybb->user['uid']

			"prefix" => $thread['prefix'],
"subject" => $subject,
"edit_uid" => $mybb->user['uid']

Zeile 421Zeile 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 468Zeile 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 583Zeile 598
			$parser_options['allow_smilies'] = 0;
}


			$parser_options['allow_smilies'] = 0;
}


		if($mybb->user['showimages'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)

		if($mybb->user['uid'] != 0 && $mybb->user['showimages'] != 1 || $mybb->settings['guestimages'] != 1 && $mybb->user['uid'] == 0)

		{
$parser_options['allow_imgcode'] = 0;
}


		{
$parser_options['allow_imgcode'] = 0;
}


		if($mybb->user['showvideos'] != 1 && $mybb->user['uid'] != 0 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)

		if($mybb->user['uid'] != 0 && $mybb->user['showvideos'] != 1 || $mybb->settings['guestvideos'] != 1 && $mybb->user['uid'] == 0)

		{
$parser_options['allow_videocode'] = 0;
}

		{
$parser_options['allow_videocode'] = 0;
}

Zeile 648Zeile 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))
{
exit;

	$plugins->run_hooks("xmlhttp_get_multiquoted_start");

// 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 720Zeile 735
		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} {$inactiveforums}

		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} {$inactiveforums}

		ORDER BY p.dateline

		ORDER BY p.dateline, p.pid

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

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

Zeile 730Zeile 745
			(in_array($quoted_post['fid'], $onlyusfids) && (!$mybb->user['uid'] || $quoted_post['thread_uid'] != $mybb->user['uid']))
)
{

			(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 746Zeile 765
	$plugins->run_hooks("xmlhttp_get_multiquoted_end");

echo json_encode(array("message" => $message));

	$plugins->run_hooks("xmlhttp_get_multiquoted_end");

echo json_encode(array("message" => $message));

	exit;
}

	exit;
}

else if($mybb->input['action'] == "refresh_captcha")
{
$imagehash = $db->escape_string($mybb->get_input('imagehash'));

else if($mybb->input['action'] == "refresh_captcha")
{
$imagehash = $db->escape_string($mybb->get_input('imagehash'));

Zeile 795Zeile 814
	else
{
echo json_encode($lang->captcha_does_not_match);

	else
{
echo json_encode($lang->captcha_does_not_match);

		exit;
}

		exit;
}

}
else if($mybb->input['action'] == "refresh_question" && $mybb->settings['securityquestion'])
{

}
else if($mybb->input['action'] == "refresh_question" && $mybb->settings['securityquestion'])
{

Zeile 808Zeile 827
		FROM ".TABLE_PREFIX."questionsessions s
LEFT JOIN ".TABLE_PREFIX."questions q ON (q.qid=s.qid)
WHERE q.active='1' AND s.sid='{$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)
{

Zeile 831Zeile 850
	");

$plugins->run_hooks("xmlhttp_refresh_question");

	");

$plugins->run_hooks("xmlhttp_refresh_question");

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

$parser_options = array(
"allow_html" => 0,
"allow_mycode" => 1,
"allow_smilies" => 1,
"allow_imgcode" => 1,
"allow_videocode" => 1,
"filter_badwords" => 1,
"me_username" => 0,
"shorten_urls" => 0,
"highlight" => 0,
);


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

		echo json_encode(array("question" => $parser->parse_message($question['question'], $parser_options), 'sid' => htmlspecialchars_uni($question['sid'])));

		exit;
}
else

		exit;
}
else

Zeile 845Zeile 879
	}
}
elseif($mybb->input['action'] == "validate_question" && $mybb->settings['securityquestion'])

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

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

Zeile 958Zeile 992

$plugins->run_hooks("xmlhttp_username_availability");



$plugins->run_hooks("xmlhttp_username_availability");


	if($user['uid'])

	if(!empty($user['uid']))

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

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

Zeile 971Zeile 1005
		exit;
}
}

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




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

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


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


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


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





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

	{

	{

		$lang->valid_username = $lang->sprintf($lang->valid_username, htmlspecialchars_uni($username));
echo json_encode(array("success" => $lang->valid_username));

		echo json_encode($errors[0]);


		exit;

		exit;

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

	}
else
{
echo json_encode("true");


		exit;
}
}
else if($mybb->input['action'] == "get_buddyselect")
{
// Send our headers.

		exit;
}
}
else if($mybb->input['action'] == "get_buddyselect")
{
// Send our headers.

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


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


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

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

Zeile 1043Zeile 1081
		$offline = implode("", $offline);

$plugins->run_hooks("xmlhttp_get_buddyselect_end");

		$offline = implode("", $offline);

$plugins->run_hooks("xmlhttp_get_buddyselect_end");





		eval("\$buddy_select = \"".$templates->get("xmlhttp_buddyselect")."\";");
echo $buddy_select;

		eval("\$buddy_select = \"".$templates->get("xmlhttp_buddyselect")."\";");
echo $buddy_select;

	}

	}

	else
{
xmlhttp_error($lang->buddylist_error);
}

	else
{
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)
{
$bg_color = alt_trow();
// 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')."\";");
}
}

$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;

}

/**

}

/**