Vergleich member.php - 1.6.4 - 1.6.13

  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: member.php 5465 2011-05-16 20:11:06Z jammerx2 $

 * $Id$

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 14Zeile 14
define("ALLOWABLE_PAGE", "register,do_register,login,do_login,logout,lostpw,do_lostpw,activate,resendactivation,do_resendactivation,resetpassword");

$nosession['avatar'] = 1;

define("ALLOWABLE_PAGE", "register,do_register,login,do_login,logout,lostpw,do_lostpw,activate,resendactivation,do_resendactivation,resetpassword");

$nosession['avatar'] = 1;

$templatelist = "member_register,error_nousername,error_nopassword,error_passwordmismatch,error_invalidemail,error_usernametaken,error_emailmismatch,error_noemail,redirect_registered";
$templatelist .= ",redirect_loggedout,login,redirect_loggedin,error_invalidusername,error_invalidpassword,member_profile_email,member_profile_offline,member_profile_reputation,member_profile_warn,member_profile_warninglevel,member_profile_customfields_field,member_profile_customfields,member_profile_adminoptions,member_profile,member_login,member_profile_online,member_profile_modoptions,member_profile_signature,member_profile_groupimage,member_profile_referrals";


$templatelist = "member_register,member_register_hiddencaptcha,member_coppa_form,member_register_coppa,member_register_agreement_coppa,member_register_agreement,usercp_options_tppselect,usercp_options_pppselect,member_register_referrer,member_register_customfield,member_register_requiredfields,member_register_password,member_activate,member_resendactivation,member_lostpw";
$templatelist .= ",member_resetpassword,member_loggedin_notice,member_profile_away,member_emailuser,member_register_regimage,member_register_regimage_recaptcha,post_captcha_hidden,post_captcha,post_captcha_recaptcha";
$templatelist .= ",member_profile_email,member_profile_offline,member_profile_reputation,member_profile_warn,member_profile_warninglevel,member_profile_customfields_field,member_profile_customfields,member_profile_adminoptions,member_profile,member_login,member_profile_online,member_profile_modoptions,member_profile_signature,member_profile_groupimage,member_profile_referrals";

require_once "./global.php";

require_once MYBB_ROOT."inc/functions_post.php";

require_once "./global.php";

require_once MYBB_ROOT."inc/functions_post.php";

Zeile 80Zeile 81
if($mybb->input['action'] == "do_register" && $mybb->request_method == "post")
{
$plugins->run_hooks("member_do_register_start");

if($mybb->input['action'] == "do_register" && $mybb->request_method == "post")
{
$plugins->run_hooks("member_do_register_start");

 

// If we have hidden CATPCHA enabled and it's filled, deny registration
if($mybb->settings['hiddencaptchaimage'])
{
$string = $mybb->settings['hiddencaptchaimagefield'];

if($mybb->input[$string] != '')
{
error($lang->error_spam_deny);
}
}


if($mybb->settings['regtype'] == "randompass")
{


if($mybb->settings['regtype'] == "randompass")
{

Zeile 115Zeile 127
		"regip" => $session->ipaddress,
"longregip" => my_ip2long($session->ipaddress),
"coppa_user" => intval($mybb->cookies['coppauser']),

		"regip" => $session->ipaddress,
"longregip" => my_ip2long($session->ipaddress),
"coppa_user" => intval($mybb->cookies['coppauser']),

 
		"regcheck1" => $mybb->input['regcheck1'],
"regcheck2" => $mybb->input['regcheck2']

	);

	);

	
if(isset($mybb->input['regcheck1']) && isset($mybb->input['regcheck2']))
{
$user['regcheck1'] = $mybb->input['regcheck1'];
$user['regcheck2'] = $mybb->input['regcheck2'];
}

 

// Do we have a saved COPPA DOB?
if($mybb->cookies['coppadob'])


// Do we have a saved COPPA DOB?
if($mybb->cookies['coppadob'])

Zeile 154Zeile 162
		$errors = $userhandler->get_friendly_errors();
}


		$errors = $userhandler->get_friendly_errors();
}


	if($mybb->settings['captchaimage'] == 1 && function_exists("imagecreatefrompng"))

	if($mybb->settings['captchaimage'])

	{

	{

		$imagehash = $db->escape_string($mybb->input['imagehash']);
$imagestring = $db->escape_string(my_strtolower($mybb->input['imagestring']));
$query = $db->simple_select("captcha", "*", "imagehash='$imagehash' AND LOWER(imagestring)='$imagestring'");
$imgcheck = $db->fetch_array($query);
if(!$imgcheck['dateline'])

		require_once MYBB_ROOT.'inc/class_captcha.php';
$captcha = new captcha;

if($captcha->validate_captcha() == false)


		{

		{

			$errors[]  = $lang->error_regimageinvalid;





			// CAPTCHA validation failed
foreach($captcha->get_errors() as $error)
{
$errors[] = $error;
}

		}

		}

		$db->delete_query("captcha", "imagehash='$imagehash'");

 
	}

if(is_array($errors))

	}

if(is_array($errors))

Zeile 200Zeile 210
		if($mybb->input['receivepms'] == 1)
{
$receivepmscheck = "checked=\"checked\"";

		if($mybb->input['receivepms'] == 1)
{
$receivepmscheck = "checked=\"checked\"";

		}


		}


		if($mybb->input['pmnotice'] == 1)
{
$pmnoticecheck = " checked=\"checked\"";

		if($mybb->input['pmnotice'] == 1)
{
$pmnoticecheck = " checked=\"checked\"";

		}

		}


if($mybb->input['emailpmnotify'] == 1)


if($mybb->input['emailpmnotify'] == 1)

		{

		{

			$emailpmnotifycheck = "checked=\"checked\"";
}

if($mybb->input['invisible'] == 1)
{
$invisiblecheck = "checked=\"checked\"";

			$emailpmnotifycheck = "checked=\"checked\"";
}

if($mybb->input['invisible'] == 1)
{
$invisiblecheck = "checked=\"checked\"";

		}

		}


if($mybb->input['dstcorrection'] == 2)


if($mybb->input['dstcorrection'] == 2)

		{

		{

			$dst_auto_selected = "selected=\"selected\"";
}
else if($mybb->input['dstcorrection'] == 1)

			$dst_auto_selected = "selected=\"selected\"";
}
else if($mybb->input['dstcorrection'] == 1)

		{

		{

			$dst_enabled_selected = "selected=\"selected\"";
}
else
{
$dst_disabled_selected = "selected=\"selected\"";

			$dst_enabled_selected = "selected=\"selected\"";
}
else
{
$dst_disabled_selected = "selected=\"selected\"";

		}


		}


		$regerrors = inline_error($errors);
$mybb->input['action'] = "register";
$fromreg = 1;

		$regerrors = inline_error($errors);
$mybb->input['action'] = "register";
$fromreg = 1;

Zeile 237Zeile 247
	else
{
$user_info = $userhandler->insert_user();

	else
{
$user_info = $userhandler->insert_user();

 

// Invalidate solved captcha
if($mybb->settings['captchaimage'])
{
$captcha->invalidate_captcha();
}


if($mybb->settings['regtype'] != "randompass" && !$mybb->cookies['coppauser'])
{


if($mybb->settings['regtype'] != "randompass" && !$mybb->cookies['coppauser'])
{

Zeile 264Zeile 280
			);
$db->insert_query("awaitingactivation", $activationarray);
$emailsubject = $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']);

			);
$db->insert_query("awaitingactivation", $activationarray);
$emailsubject = $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']);

			$emailmessage = $lang->sprintf($lang->email_activateaccount, $user_info['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user_info['uid'], $activationcode);















			switch($mybb->settings['username_method'])
{
case 0:
$emailmessage = $lang->sprintf($lang->email_activateaccount, $user_info['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user_info['uid'], $activationcode);
break;
case 1:
$emailmessage = $lang->sprintf($lang->email_activateaccount1, $user_info['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user_info['uid'], $activationcode);
break;
case 2:
$emailmessage = $lang->sprintf($lang->email_activateaccount2, $user_info['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user_info['uid'], $activationcode);
break;
default:
$emailmessage = $lang->sprintf($lang->email_activateaccount, $user_info['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user_info['uid'], $activationcode);
break;
}

			my_mail($user_info['email'], $emailsubject, $emailmessage);

$lang->redirect_registered_activation = $lang->sprintf($lang->redirect_registered_activation, $mybb->settings['bbname'], $user_info['username']);

			my_mail($user_info['email'], $emailsubject, $emailmessage);

$lang->redirect_registered_activation = $lang->sprintf($lang->redirect_registered_activation, $mybb->settings['bbname'], $user_info['username']);

Zeile 276Zeile 306
		else if($mybb->settings['regtype'] == "randompass")
{
$emailsubject = $lang->sprintf($lang->emailsubject_randompassword, $mybb->settings['bbname']);

		else if($mybb->settings['regtype'] == "randompass")
{
$emailsubject = $lang->sprintf($lang->emailsubject_randompassword, $mybb->settings['bbname']);

			$emailmessage = $lang->sprintf($lang->email_randompassword, $user['username'], $mybb->settings['bbname'], $user_info['username'], $user_info['password']);















			switch($mybb->settings['username_method'])
{
case 0:
$emailmessage = $lang->sprintf($lang->email_randompassword, $user['username'], $mybb->settings['bbname'], $user_info['username'], $user_info['password']);
break;
case 1:
$emailmessage = $lang->sprintf($lang->email_randompassword1, $user['username'], $mybb->settings['bbname'], $user_info['username'], $user_info['password']);
break;
case 2:
$emailmessage = $lang->sprintf($lang->email_randompassword2, $user['username'], $mybb->settings['bbname'], $user_info['username'], $user_info['password']);
break;
default:
$emailmessage = $lang->sprintf($lang->email_randompassword, $user['username'], $mybb->settings['bbname'], $user_info['username'], $user_info['password']);
break;
}

			my_mail($user_info['email'], $emailsubject, $emailmessage);

$plugins->run_hooks("member_do_register_end");

			my_mail($user_info['email'], $emailsubject, $emailmessage);

$plugins->run_hooks("member_do_register_end");

Zeile 311Zeile 355
	
eval("\$coppa_form = \"".$templates->get("member_coppa_form")."\";");
output_page($coppa_form);

	
eval("\$coppa_form = \"".$templates->get("member_coppa_form")."\";");
output_page($coppa_form);

}


}


if($mybb->input['action'] == "register")
{
$bdaysel = '';

if($mybb->input['action'] == "register")
{
$bdaysel = '';

Zeile 344Zeile 388
		if($mybb->input['bday1'] && $mybb->input['bday2'] && $mybb->input['bday3'])
{
my_unsetcookie("coppauser");

		if($mybb->input['bday1'] && $mybb->input['bday2'] && $mybb->input['bday3'])
{
my_unsetcookie("coppauser");

 
			
$mybb->input['bday1'] = intval($mybb->input['bday1']);
$mybb->input['bday2'] = intval($mybb->input['bday2']);
$mybb->input['bday3'] = intval($mybb->input['bday3']);
$months = get_bdays($mybb->input['bday3']);
if($mybb->input['bday2'] < 1 || $mybb->input['bday2'] > 12 || $mybb->input['bday3'] < (date("Y")-100) || $mybb->input['bday3'] > date("Y") || $mybb->input['bday1'] > $months[$mybb->input['bday2']-1])
{
error($lang->error_invalid_birthday);
}

			
$bdaytime = @mktime(0, 0, 0, $mybb->input['bday2'], $mybb->input['bday1'], $mybb->input['bday3']);


			
$bdaytime = @mktime(0, 0, 0, $mybb->input['bday2'], $mybb->input['bday1'], $mybb->input['bday3']);


Zeile 394Zeile 447
		$plugins->run_hooks("member_register_start");

$validator_extra = '';

		$plugins->run_hooks("member_register_start");

$validator_extra = '';





		if(isset($mybb->input['timezoneoffset']))
{
$timezoneoffset = $mybb->input['timezoneoffset'];

		if(isset($mybb->input['timezoneoffset']))
{
$timezoneoffset = $mybb->input['timezoneoffset'];

Zeile 477Zeile 530
		}
// Custom profile fields baby!
$altbg = "trow1";

		}
// Custom profile fields baby!
$altbg = "trow1";

		$query = $db->simple_select("profilefields", "*", "editable=1", array('order_by' => 'disporder'));

		$query = $db->simple_select("profilefields", "*", "required='1' AND editable='1'", array('order_by' => 'disporder'));

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

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

Zeile 531Zeile 584
						$profilefield['length'] = 3;
}
$code = "<select name=\"profile_fields[$field][]\" id=\"{$field}\" size=\"{$profilefield['length']}\" multiple=\"multiple\">$select</select>";

						$profilefield['length'] = 3;
}
$code = "<select name=\"profile_fields[$field][]\" id=\"{$field}\" size=\"{$profilefield['length']}\" multiple=\"multiple\">$select</select>";

				}

				}

			}
elseif($type == "select")
{

			}
elseif($type == "select")
{

Zeile 539Zeile 592
				if(is_array($expoptions))
{
foreach($expoptions as $key => $val)

				if(is_array($expoptions))
{
foreach($expoptions as $key => $val)

					{

					{

						$val = trim($val);
$val = str_replace("\n", "\\n", $val);
$sel = "";

						$val = trim($val);
$val = str_replace("\n", "\\n", $val);
$sel = "";

Zeile 548Zeile 601
							$sel = "selected=\"selected\"";
}
$select .= "<option value=\"$val\" $sel>$val</option>";

							$sel = "selected=\"selected\"";
}
$select .= "<option value=\"$val\" $sel>$val</option>";

					}

					}

					if(!$profilefield['length'])
{
$profilefield['length'] = 1;
}
$code = "<select name=\"profile_fields[$field]\" id=\"{$field}\" size=\"{$profilefield['length']}\">$select</select>";

					if(!$profilefield['length'])
{
$profilefield['length'] = 1;
}
$code = "<select name=\"profile_fields[$field]\" id=\"{$field}\" size=\"{$profilefield['length']}\">$select</select>";

				}
}

				}
}

			elseif($type == "radio")
{
$expoptions = explode("\n", $options);

			elseif($type == "radio")
{
$expoptions = explode("\n", $options);

Zeile 577Zeile 630
				if($errors)
{
$useropts = $userfield;

				if($errors)
{
$useropts = $userfield;

				}
else
{

				}
else
{

					$useropts = explode("\n", $userfield);
}
if(is_array($useropts))
{
foreach($useropts as $key => $val)

					$useropts = explode("\n", $userfield);
}
if(is_array($useropts))
{
foreach($useropts as $key => $val)

					{

					{

						$seloptions[$val] = $val;
}
}

						$seloptions[$val] = $val;
}
}

Zeile 601Zeile 654
						}
$code .= "<input type=\"checkbox\" class=\"checkbox\" name=\"profile_fields[$field][]\" id=\"{$field}{$key}\" value=\"$val\" $checked /> <span class=\"smalltext\">$val</span><br />";
}

						}
$code .= "<input type=\"checkbox\" class=\"checkbox\" name=\"profile_fields[$field][]\" id=\"{$field}{$key}\" value=\"$val\" $checked /> <span class=\"smalltext\">$val</span><br />";
}

				}
}

				}
}

			elseif($type == "textarea")

			elseif($type == "textarea")

			{
$value = htmlspecialchars_uni($userfield);

			{
$value = htmlspecialchars_uni($userfield);

				$code = "<textarea name=\"profile_fields[$field]\" id=\"{$field}\" rows=\"6\" cols=\"30\" style=\"width: 95%\">$value</textarea>";
}
else

				$code = "<textarea name=\"profile_fields[$field]\" id=\"{$field}\" rows=\"6\" cols=\"30\" style=\"width: 95%\">$value</textarea>";
}
else

Zeile 626Zeile 679
					$id = "{$field}0";
}
else

					$id = "{$field}0";
}
else

				{

				{

					$id = "fid{$profilefield['fid']}";
}
$validator_extra .= "\tregValidator.register('{$id}', 'notEmpty', {failure_message:'{$lang->js_validator_not_empty}'});\n";

					$id = "fid{$profilefield['fid']}";
}
$validator_extra .= "\tregValidator.register('{$id}', 'notEmpty', {failure_message:'{$lang->js_validator_not_empty}'});\n";

Zeile 661Zeile 714
			
}
// Spambot registration image thingy

			
}
// Spambot registration image thingy

		if($mybb->settings['captchaimage'] == 1 && function_exists("imagecreatefrompng"))

		if($mybb->settings['captchaimage'])

		{

		{

			$randomstr = random_str(5);
$imagehash = md5(random_str(12));
$regimagearray = array(
"imagehash" => $imagehash,
"imagestring" => $randomstr,
"dateline" => TIME_NOW
);
$db->insert_query("captcha", $regimagearray);
eval("\$regimage = \"".$templates->get("member_register_regimage")."\";");

			require_once MYBB_ROOT.'inc/class_captcha.php';
$captcha = new captcha(true, "member_register_regimage");












			// JS validator extra
$validator_extra .= "\tregValidator.register('imagestring', 'ajax', {url:'xmlhttp.php?action=validate_captcha', extra_body: 'imagehash', loading_message:'{$lang->js_validator_captcha_valid}', failure_message:'{$lang->js_validator_no_image_text}'});\n";
















			if($captcha->html)
{
$regimage = $captcha->html;

if($mybb->settings['captchaimage'] == 1)
{
// JS validator extra for our default CAPTCHA
$validator_extra .= "\tregValidator.register('imagestring', 'ajax', { url: 'xmlhttp.php?action=validate_captcha', extra_body: 'imagehash', loading_message: '{$lang->js_validator_captcha_valid}', failure_message: '{$lang->js_validator_no_image_text}'} );\n";
}
}
}
// Hidden CAPTCHA for Spambots
if($mybb->settings['hiddencaptchaimage'])
{
$captcha_field = $mybb->settings['hiddencaptchaimagefield'];

eval("\$hiddencaptcha = \"".$templates->get("member_register_hiddencaptcha")."\";");

		}
if($mybb->settings['regtype'] != "randompass")
{

		}
if($mybb->settings['regtype'] != "randompass")
{

Zeile 728Zeile 789

if($mybb->input['username'])
{


if($mybb->input['username'])
{

		$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));















		switch($mybb->settings['username'])
{
case 0:
$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));
break;
case 1:
$query = $db->simple_select("users", "*", "LOWER(email)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));
break;
case 2:
$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."' OR LOWER(email)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));
break;
default:
$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));
break;
}

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

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

			error($lang->error_invalidpworusername);















			switch($mybb->settings['username_method'])
{
case 0:
error($lang->error_invalidpworusername);
break;
case 1:
error($lang->error_invalidpworusername1);
break;
case 2:
error($lang->error_invalidpworusername2);
break;
default:
error($lang->error_invalidpworusername);
break;
}

		}
$uid = $user['uid'];
}

		}
$uid = $user['uid'];
}

Zeile 845Zeile 934
				$email = $user['email'];
$activationcode = $user['code'];
$emailsubject = $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']);

				$email = $user['email'];
$activationcode = $user['code'];
$emailsubject = $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']);

				$emailmessage = $lang->sprintf($lang->email_activateaccount, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user['uid'], $activationcode);















				switch($mybb->settings['username_method'])
{
case 0:
$emailmessage = $lang->sprintf($lang->email_activateaccount, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user['uid'], $activationcode);
break;
case 1:
$emailmessage = $lang->sprintf($lang->email_activateaccount1, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user['uid'], $activationcode);
break;
case 2:
$emailmessage = $lang->sprintf($lang->email_activateaccount2, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user['uid'], $activationcode);
break;
default:
$emailmessage = $lang->sprintf($lang->email_activateaccount, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $user['uid'], $activationcode);
break;
}

				my_mail($email, $emailsubject, $emailmessage);
}
}
$plugins->run_hooks("member_do_resendactivation_end");

				my_mail($email, $emailsubject, $emailmessage);
}
}
$plugins->run_hooks("member_do_resendactivation_end");





		redirect("index.php", $lang->redirect_activationresent);
}
}

		redirect("index.php", $lang->redirect_activationresent);
}
}





if($mybb->input['action'] == "lostpw")
{
$plugins->run_hooks("member_lostpw");

eval("\$lostpw = \"".$templates->get("member_lostpw")."\";");
output_page($lostpw);

if($mybb->input['action'] == "lostpw")
{
$plugins->run_hooks("member_lostpw");

eval("\$lostpw = \"".$templates->get("member_lostpw")."\";");
output_page($lostpw);

}


}


if($mybb->input['action'] == "do_lostpw" && $mybb->request_method == "post")
{
$plugins->run_hooks("member_do_lostpw_start");

if($mybb->input['action'] == "do_lostpw" && $mybb->request_method == "post")
{
$plugins->run_hooks("member_do_lostpw_start");

Zeile 893Zeile 996
			$email = $user['email'];
$activationcode = $user['activationcode'];
$emailsubject = $lang->sprintf($lang->emailsubject_lostpw, $mybb->settings['bbname']);

			$email = $user['email'];
$activationcode = $user['activationcode'];
$emailsubject = $lang->sprintf($lang->emailsubject_lostpw, $mybb->settings['bbname']);

			$emailmessage = $lang->sprintf($lang->email_lostpw, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);















			switch($mybb->settings['username_method'])
{
case 0:
$emailmessage = $lang->sprintf($lang->email_lostpw, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);
break;
case 1:
$emailmessage = $lang->sprintf($lang->email_lostpw1, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);
break;
case 2:
$emailmessage = $lang->sprintf($lang->email_lostpw2, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);
break;
default:
$emailmessage = $lang->sprintf($lang->email_lostpw, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);
break;
}

			my_mail($email, $emailsubject, $emailmessage);
}
}

			my_mail($email, $emailsubject, $emailmessage);
}
}

Zeile 908Zeile 1025

if($mybb->input['username'])
{


if($mybb->input['username'])
{

		$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."'");
$user = $db->fetch_array($query);
if(!$user['uid'])

		switch($mybb->settings['username_method'])



		{

		{

			error($lang->error_invalidpworusername);












			case 0:
$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."'");
break;
case 1:
$query = $db->simple_select("users", "*", "LOWER(email)='".$db->escape_string(my_strtolower($mybb->input['username']))."'");
break;
case 2:
$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."' OR LOWER(email)='".$db->escape_string(my_strtolower($mybb->input['username']))."'");
break;
default:
$query = $db->simple_select("users", "*", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."'");
break;

		}

		}

	}
else
{




















		$user = $db->fetch_array($query);
if(!$user['uid'])
{
switch($mybb->settings['username_method'])
{
case 0:
error($lang->error_invalidpworusername);
break;
case 1:
error($lang->error_invalidpworusername1);
break;
case 2:
error($lang->error_invalidpworusername2);
break;
default:
error($lang->error_invalidpworusername);
break;
}
}
}
else
{

		$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");
$user = $db->fetch_array($query);
}

		$query = $db->simple_select("users", "*", "uid='".intval($mybb->input['uid'])."'");
$user = $db->fetch_array($query);
}

Zeile 926Zeile 1071
		$activation = $db->fetch_array($query);
$now = TIME_NOW;
if($activation['code'] != $mybb->input['code'])

		$activation = $db->fetch_array($query);
$now = TIME_NOW;
if($activation['code'] != $mybb->input['code'])

		{

		{

			error($lang->error_badlostpwcode);

			error($lang->error_badlostpwcode);

		}

		}

		$db->delete_query("awaitingactivation", "uid='".$user['uid']."' AND type='p'");
$username = $user['username'];

// Generate a new password, then update it

		$db->delete_query("awaitingactivation", "uid='".$user['uid']."' AND type='p'");
$username = $user['username'];

// Generate a new password, then update it

		$password = random_str();








		$password_length = intval($mybb->settings['minpasswordlength']);

if($password_length < 8)
{
$password_length = 8;
}

$password = random_str($password_length);

		$logindetails = update_password($user['uid'], md5($password), $user['salt']);

$email = $user['email'];

		$logindetails = update_password($user['uid'], md5($password), $user['salt']);

$email = $user['email'];

Zeile 951Zeile 1103
	else
{
$plugins->run_hooks("member_resetpassword_form");

	else
{
$plugins->run_hooks("member_resetpassword_form");



















		
switch($mybb->settings['username_method'])
{
case 0:
$lang_username = $lang->username;
break;
case 1:
$lang_username = $lang->username1;
break;
case 2:
$lang_username = $lang->username2;
break;
default:
$lang_username = $lang->username;
break;
}


		eval("\$activate = \"".$templates->get("member_resetpassword")."\";");
output_page($activate);
}
}

		eval("\$activate = \"".$templates->get("member_resetpassword")."\";");
output_page($activate);
}
}


$do_captcha = $correct = false;
$inline_errors = "";


$correct = false;
$inline_errors = '';

if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")
{
$plugins->run_hooks("member_do_login_start");

if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")
{
$plugins->run_hooks("member_do_login_start");

	



	// Checks to make sure the user can login; they haven't had too many tries at logging in.
// Is a fatal call if user has had too many tries
$logins = login_attempt_check();
$login_text = '';

	// Checks to make sure the user can login; they haven't had too many tries at logging in.
// Is a fatal call if user has had too many tries
$logins = login_attempt_check();
$login_text = '';

	



	// Did we come from the quick login form
if($mybb->input['quick_login'] == "1" && $mybb->input['quick_password'] && $mybb->input['quick_username'])

	// Did we come from the quick login form
if($mybb->input['quick_login'] == "1" && $mybb->input['quick_password'] && $mybb->input['quick_username'])

	{

	{

		$mybb->input['password'] = $mybb->input['quick_password'];
$mybb->input['username'] = $mybb->input['quick_username'];
$mybb->input['remember'] = $mybb->input['quick_remember'];

		$mybb->input['password'] = $mybb->input['quick_password'];
$mybb->input['username'] = $mybb->input['quick_username'];
$mybb->input['remember'] = $mybb->input['quick_remember'];

	}

	}


if(!username_exists($mybb->input['username']))
{
my_setcookie('loginattempts', $logins + 1);


if(!username_exists($mybb->input['username']))
{
my_setcookie('loginattempts', $logins + 1);

		error($lang->error_invalidpworusername.$login_text);















		switch($mybb->settings['username_method'])
{
case 0:
error($lang->error_invalidpworusername.$login_text);
break;
case 1:
error($lang->error_invalidpworusername1.$login_text);
break;
case 2:
error($lang->error_invalidpworusername2.$login_text);
break;
default:
error($lang->error_invalidpworusername.$login_text);
break;
}

	}

	}

	
$query = $db->simple_select("users", "loginattempts", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));


$query = $db->simple_select("users", "loginattempts", "LOWER(username)='".$db->escape_string(my_strtolower($mybb->input['username']))."' OR LOWER(email)='".$db->escape_string(my_strtolower($mybb->input['username']))."'", array('limit' => 1));

	$loginattempts = $db->fetch_field($query, "loginattempts");

	$loginattempts = $db->fetch_field($query, "loginattempts");

	



	$errors = array();

	$errors = array();

	
$user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
if(!$user['uid'])
{
my_setcookie('loginattempts', $logins + 1);
$db->update_query("users", array('loginattempts' => 'loginattempts+1'), "LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'", 1, true);

$mybb->input['action'] = "login";
$mybb->input['request_method'] = "get";

if($mybb->settings['failedlogincount'] != 0 && $mybb->settings['failedlogintext'] == 1)
{
$login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
}

$errors[] = $lang->error_invalidpworusername.$login_text;
}
else


$login_captcha = false;
if($mybb->settings['failedcaptchalogincount'] > 0 && ($loginattempts > $mybb->settings['failedcaptchalogincount'] || intval($mybb->cookies['loginattempts']) > $mybb->settings['failedcaptchalogincount']))
















	{

	{

		$correct = true;
}

if($mybb->settings['failedcaptchalogincount'] > 0 && ($loginattempts > $mybb->settings['failedcaptchalogincount'] || intval($mybb->cookies['loginattempts']) > $mybb->settings['failedcaptchalogincount']))
{

 
		// Show captcha image if enabled

		// Show captcha image if enabled

		if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng"))

		if($mybb->settings['captchaimage'])

		{

		{

 
			$do_captcha = false;


			// Check their current captcha input - if correct, hide the captcha input area

			// Check their current captcha input - if correct, hide the captcha input area

			if($mybb->input['imagestring'])
{
$imagehash = $db->escape_string($mybb->input['imagehash']);
$imagestring = $db->escape_string($mybb->input['imagestring']);
$query = $db->simple_select("captcha", "*", "imagehash='{$imagehash}' AND imagestring='{$imagestring}'");
$imgcheck = $db->fetch_array($query);
if($imgcheck['dateline'] > 0)
{
$correct = true;
}
else

			require_once MYBB_ROOT.'inc/class_captcha.php';
$login_captcha = new captcha;

if($login_captcha->validate_captcha() == false)
{
$correct = true;
$do_captcha = true;

// CAPTCHA validation failed
foreach($login_captcha->get_errors() as $error)


				{

				{

					$db->delete_query("captcha", "imagehash='{$imagehash}'");
$errors[] = $lang->error_regimageinvalid;

					$errors[] = $error;


				}

				}

			}
else if($mybb->input['quick_login'] == 1 && $mybb->input['quick_password'] && $mybb->input['quick_username'])
{
$errors[] = $lang->error_regimagerequired;
}
else
{
$errors[] = $lang->error_regimagerequired;

 
			}
}

			}
}

		
$do_captcha = true;
}







































	}

// Don't check password when captcha isn't solved
if(empty($errors))
{
$user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
if(!$user['uid'])
{
my_setcookie('loginattempts', $logins + 1);
$db->update_query("users", array('loginattempts' => 'loginattempts+1'), "LOWER(username) = '".$db->escape_string(my_strtolower($mybb->input['username']))."'", 1, true);

$mybb->input['action'] = "login";
$mybb->input['request_method'] = "get";

if($mybb->settings['failedlogincount'] != 0 && $mybb->settings['failedlogintext'] == 1)
{
$login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
}

switch($mybb->settings['username_method'])
{
case 0:
$errors[] = $lang->error_invalidpworusername.$login_text;
break;
case 1:
$errors[] = $lang->error_invalidpworusername1.$login_text;
break;
case 2:
$errors[] = $lang->error_invalidpworusername2.$login_text;
break;
default:
$errors[] = $lang->error_invalidpworusername.$login_text;
break;
}
}
else
{
$correct = true;
}
}


	if(!empty($errors))
{
$mybb->input['action'] = "login";

	if(!empty($errors))
{
$mybb->input['action'] = "login";

Zeile 1056Zeile 1247
		{
error($lang->error_awaitingcoppa);
}

		{
error($lang->error_awaitingcoppa);
}

		








// Invalidate captcha
if($login_captcha !== false)
{
$login_captcha->invalidate_captcha();
}


		my_setcookie('loginattempts', 1);
$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
$newsession = array(

		my_setcookie('loginattempts', 1);
$db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
$newsession = array(

Zeile 1076Zeile 1273
		}
my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], $remember, true);
my_setcookie("sid", $session->sid, -1, true);

		}
my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], $remember, true);
my_setcookie("sid", $session->sid, -1, true);

		



		$plugins->run_hooks("member_do_login_end");

		$plugins->run_hooks("member_do_login_end");

		



		if($mybb->input['url'] != "" && my_strpos(basename($mybb->input['url']), 'member.php') === false)
{
if((my_strpos(basename($mybb->input['url']), 'newthread.php') !== false || my_strpos(basename($mybb->input['url']), 'newreply.php') !== false) && my_strpos($mybb->input['url'], '&processed=1') !== false)

		if($mybb->input['url'] != "" && my_strpos(basename($mybb->input['url']), 'member.php') === false)
{
if((my_strpos(basename($mybb->input['url']), 'newthread.php') !== false || my_strpos(basename($mybb->input['url']), 'newreply.php') !== false) && my_strpos($mybb->input['url'], '&processed=1') !== false)

Zeile 1101Zeile 1298
		$mybb->input['action'] = "login";
$mybb->input['request_method'] = "get";
}

		$mybb->input['action'] = "login";
$mybb->input['request_method'] = "get";
}

	



	$plugins->run_hooks("member_do_login_end");
}

	$plugins->run_hooks("member_do_login_end");
}





if($mybb->input['action'] == "login")
{
$plugins->run_hooks("member_login");

if($mybb->input['action'] == "login")
{
$plugins->run_hooks("member_login");

	



	$member_loggedin_notice = "";
if($mybb->user['uid'] != 0)
{

	$member_loggedin_notice = "";
if($mybb->user['uid'] != 0)
{

Zeile 1121Zeile 1318
	login_attempt_check();

// Redirect to the page where the user came from, but not if that was the login page.

	login_attempt_check();

// Redirect to the page where the user came from, but not if that was the login page.

 
	$redirect_url = '';

	if($_SERVER['HTTP_REFERER'] && strpos($_SERVER['HTTP_REFERER'], "action=login") === false)
{
$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);

	if($_SERVER['HTTP_REFERER'] && strpos($_SERVER['HTTP_REFERER'], "action=login") === false)
{
$redirect_url = htmlentities($_SERVER['HTTP_REFERER']);

	}
else
{
$redirect_url = '';

 
	}


	}


	$captcha = "";
// Show captcha image for guests if enabled
if($mybb->settings['captchaimage'] == 1 && function_exists("imagepng") && $do_captcha == true)

	$captcha = '';
// Show captcha image for guests if enabled and only if we have to do
if($mybb->settings['captchaimage'] && isset($do_captcha))

	{

	{

		$randomstr = random_str(5);
$imagehash = md5(random_str(12));
$imagearray = array(
"imagehash" => $imagehash,
"imagestring" => $randomstr,
"dateline" => TIME_NOW
);
$db->insert_query("captcha", $imagearray);
eval("\$captcha = \"".$templates->get("post_captcha")."\";");
}































		$correct = false;
require_once MYBB_ROOT.'inc/class_captcha.php';
$login_captcha = new captcha(false, "post_captcha");

if($do_captcha == false && $login_captcha->type == 1)
{
if($login_captcha->validate_captcha() == true)
{
$correct = true;
$captcha = $login_captcha->build_hidden_captcha();
}
}

if(!$correct)
{
if($login_captcha->type == 1)
{
$login_captcha->build_captcha();
}
elseif($login_captcha->type == 2)
{
$login_captcha->build_recaptcha();
}

if($login_captcha->html)
{
$captcha = $login_captcha->html;
}
}
elseif($correct && $login_captcha->type == 2)
{
$login_captcha->build_recaptcha();

if($login_captcha->html)
{
$captcha = $login_captcha->html;
}
}
}


	$username = "";
$password = "";
if($mybb->input['username'] && $mybb->request_method == "post")
{
$username = htmlspecialchars_uni($mybb->input['username']);

	$username = "";
$password = "";
if($mybb->input['username'] && $mybb->request_method == "post")
{
$username = htmlspecialchars_uni($mybb->input['username']);

	}


	}


	if($mybb->input['password'] && $mybb->request_method == "post")
{
$password = htmlspecialchars_uni($mybb->input['password']);
}

	if($mybb->input['password'] && $mybb->request_method == "post")
{
$password = htmlspecialchars_uni($mybb->input['password']);
}














	
switch($mybb->settings['username_method'])
{
case 1:
$lang->username = $lang->username1;
break;
case 2:
$lang->username = $lang->username2;
break;
default:
break;
}

	eval("\$login = \"".$templates->get("member_login")."\";");
output_page($login);
}

	eval("\$login = \"".$templates->get("member_login")."\";");
output_page($login);
}

Zeile 1186Zeile 1420
	if($mybb->user['uid'])
{
$time = TIME_NOW;

	if($mybb->user['uid'])
{
$time = TIME_NOW;

		$lastvisit = array(
"lastactive" => $time-900,
"lastvisit" => $time,
);
$db->update_query("users", $lastvisit, "uid='".$mybb->user['uid']."'");

		// Run this after the shutdown query from session system
$db->shutdown_query("UPDATE ".TABLE_PREFIX."users SET lastvisit='{$time}', lastactive='{$time}' WHERE uid='{$mybb->user['uid']}'");




		$db->delete_query("sessions", "sid='".$session->sid."'");
}
$plugins->run_hooks("member_logout_end");

		$db->delete_query("sessions", "sid='".$session->sid."'");
}
$plugins->run_hooks("member_logout_end");

Zeile 1240Zeile 1471
			$query = $db->simple_select("posts", "uid", "tid='$tid' AND visible = 1", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '1'));
$post = $db->fetch_array($query);
$uid = $post['uid'];

			$query = $db->simple_select("posts", "uid", "tid='$tid' AND visible = 1", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => '1'));
$post = $db->fetch_array($query);
$uid = $post['uid'];

		}
}
else
{

		}
}
else
{

		if($mybb->input['uid'])
{
$uid = intval($mybb->input['uid']);

		if($mybb->input['uid'])
{
$uid = intval($mybb->input['uid']);

Zeile 1279Zeile 1510
	$lang->users_forum_info = $lang->sprintf($lang->users_forum_info, $memprofile['username']);
$lang->users_contact_details = $lang->sprintf($lang->users_contact_details, $memprofile['username']);


	$lang->users_forum_info = $lang->sprintf($lang->users_forum_info, $memprofile['username']);
$lang->users_contact_details = $lang->sprintf($lang->users_contact_details, $memprofile['username']);


	if($mybb->settings['enablepms'] != 0 && $memprofile['receivepms'] != 0 && $memperms['canusepms'] != 0 && my_strpos(",".$memprofile['ignorelist'].",", ",".$mybb->user['uid'].",") === false)

	if($mybb->settings['enablepms'] != 0 && (($memprofile['receivepms'] != 0 && $memperms['canusepms'] != 0 && my_strpos(",".$memprofile['ignorelist'].",", ",".$mybb->user['uid'].",") === false) || $mybb->usergroup['canoverridepm'] == 1))

	{
$lang->send_pm = $lang->sprintf($lang->send_pm, $memprofile['username']);
}

	{
$lang->send_pm = $lang->sprintf($lang->send_pm, $memprofile['username']);
}

Zeile 1307Zeile 1538
		$avatar = '';
}


		$avatar = '';
}


	if($memprofile['hideemail'] != 1)

	if($memprofile['hideemail'] != 1 && (my_strpos(",".$memprofile['ignorelist'].",", ",".$mybb->user['uid'].",") === false || $mybb->usergroup['cansendemailoverride'] != 0))

	{
eval("\$sendemail = \"".$templates->get("member_profile_email")."\";");

	{
eval("\$sendemail = \"".$templates->get("member_profile_email")."\";");

	}
else

	}
else

	{
$alttrow = "trow1"; // To properly sort the contact details below
$sendemail = '';

	{
$alttrow = "trow1"; // To properly sort the contact details below
$sendemail = '';

Zeile 1325Zeile 1556
		"yahoo",
"msn",
);

		"yahoo",
"msn",
);





	$bgcolors = array();
foreach($cat_array as $cat)
{
$bgcolors[$cat] = alt_trow();
}


	$bgcolors = array();
foreach($cat_array as $cat)
{
$bgcolors[$cat] = alt_trow();
}


 
	$website = '';

	if($memprofile['website'])

	if($memprofile['website'])

	{

	{

		$memprofile['website'] = htmlspecialchars_uni($memprofile['website']);
$website = "<a href=\"{$memprofile['website']}\" target=\"_blank\">{$memprofile['website']}</a>";

		$memprofile['website'] = htmlspecialchars_uni($memprofile['website']);
$website = "<a href=\"{$memprofile['website']}\" target=\"_blank\">{$memprofile['website']}</a>";

	}
else
{
$website = '';
}


	}

$signature = '';




	if($memprofile['signature'] && ($memprofile['suspendsignature'] == 0 || $memprofile['suspendsigtime'] < TIME_NOW))
{
$sig_parser = array(

	if($memprofile['signature'] && ($memprofile['suspendsignature'] == 0 || $memprofile['suspendsigtime'] < TIME_NOW))
{
$sig_parser = array(

Zeile 1349Zeile 1578
			"allow_mycode" => $mybb->settings['sigmycode'],
"allow_smilies" => $mybb->settings['sigsmilies'],
"allow_imgcode" => $mybb->settings['sigimgcode'],

			"allow_mycode" => $mybb->settings['sigmycode'],
"allow_smilies" => $mybb->settings['sigsmilies'],
"allow_imgcode" => $mybb->settings['sigimgcode'],

			"me_username" => $memprofile['username']


			"me_username" => $memprofile['username'],
"filter_badwords" => 1

		);

		);









if($memperms['signofollow'])
{
$sig_parser['nofollow_on'] = 1;
}


		$memprofile['signature'] = $parser->parse_message($memprofile['signature'], $sig_parser);
eval("\$signature = \"".$templates->get("member_profile_signature")."\";");

		$memprofile['signature'] = $parser->parse_message($memprofile['signature'], $sig_parser);
eval("\$signature = \"".$templates->get("member_profile_signature")."\";");

	}

$daysreg = (TIME_NOW - $memprofile['regdate']) / (24*3600);


	}

$daysreg = (TIME_NOW - $memprofile['regdate']) / (24*3600);


	if($daysreg < 1)
{
$daysreg = 1;

	if($daysreg < 1)
{
$daysreg = 1;

Zeile 1366Zeile 1601
	$ppd = $memprofile['postnum'] / $daysreg;
$ppd = round($ppd, 2);
if($ppd > $memprofile['postnum'])

	$ppd = $memprofile['postnum'] / $daysreg;
$ppd = round($ppd, 2);
if($ppd > $memprofile['postnum'])

	{

	{

		$ppd = $memprofile['postnum'];

		$ppd = $memprofile['postnum'];

	}

	}

	$stats = $cache->read("stats");
$numposts = $stats['numposts'];
if($numposts == 0)

	$stats = $cache->read("stats");
$numposts = $stats['numposts'];
if($numposts == 0)

Zeile 1379Zeile 1614
	{
$percent = $memprofile['postnum']*100/$numposts;
$percent = round($percent, 2);

	{
$percent = $memprofile['postnum']*100/$numposts;
$percent = round($percent, 2);

	}

	}

	
if($percent > 100)
{
$percent = 100;

	
if($percent > 100)
{
$percent = 100;

	}

	}


if(!empty($memprofile['icq']))
{
$memprofile['icq'] = intval($memprofile['icq']);


if(!empty($memprofile['icq']))
{
$memprofile['icq'] = intval($memprofile['icq']);

	}

	}

	else
{
$memprofile['icq'] = '';
}


	else
{
$memprofile['icq'] = '';
}


 
	$awaybit = '';

	if($memprofile['away'] == 1 && $mybb->settings['allowaway'] != 0)
{
$lang->away_note = $lang->sprintf($lang->away_note, $memprofile['username']);
$awaydate = my_date($mybb->settings['dateformat'], $memprofile['awaydate']);
if(!empty($memprofile['awayreason']))

	if($memprofile['away'] == 1 && $mybb->settings['allowaway'] != 0)
{
$lang->away_note = $lang->sprintf($lang->away_note, $memprofile['username']);
$awaydate = my_date($mybb->settings['dateformat'], $memprofile['awaydate']);
if(!empty($memprofile['awayreason']))

		{
$awayreason = htmlspecialchars_uni($memprofile['awayreason']);
}


		{
$reason = $parser->parse_badwords($memprofile['awayreason']);
$awayreason = htmlspecialchars_uni($reason);
}

		else
{
$awayreason = $lang->away_no_reason;
}
if($memprofile['returndate'] == '')

		else
{
$awayreason = $lang->away_no_reason;
}
if($memprofile['returndate'] == '')

		{

		{

			$returndate = "$lang->unknown";
}
else
{
$returnhome = explode("-", $memprofile['returndate']);

			$returndate = "$lang->unknown";
}
else
{
$returnhome = explode("-", $memprofile['returndate']);

 
			
// PHP native date functions use integers so timestamps for years after 2038 will not work
// Thus we use adodb_mktime

			if($returnhome[2] >= 2038)
{
require_once MYBB_ROOT."inc/functions_time.php";
$returnmkdate = adodb_mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate, "", 1, true);

			if($returnhome[2] >= 2038)
{
require_once MYBB_ROOT."inc/functions_time.php";
$returnmkdate = adodb_mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate, "", 1, true);

			}

			}

			else
{
$returnmkdate = mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate);
}

			else
{
$returnmkdate = mktime(0, 0, 0, $returnhome[1], $returnhome[0], $returnhome[2]);
$returndate = my_date($mybb->settings['dateformat'], $returnmkdate);
}

 
			
// If our away time has expired already, we should be back, right?
if($returnmkdate < TIME_NOW)
{
$db->update_query('users', array('away' => '0', 'awaydate' => '0', 'returndate' => '', 'awayreason' => ''), 'uid=\''.intval($memprofile['uid']).'\'');

// Update our status to "not away"
$memprofile['away'] = 0;
}
}

// Check if our away status is set to 1, it may have been updated already (see a few lines above)
if($memprofile['away'] == 1)
{
eval("\$awaybit = \"".$templates->get("member_profile_away")."\";");

		}

		}

		eval("\$awaybit = \"".$templates->get("member_profile_away")."\";");

 
	}
if($memprofile['dst'] == 1)
{

	}
if($memprofile['dst'] == 1)
{

Zeile 1527Zeile 1781
	// Get the user title for this user
unset($usertitle);
unset($stars);

	// Get the user title for this user
unset($usertitle);
unset($stars);

 
	$starimage = '';

	if(trim($memprofile['usertitle']) != '')
{
// User has custom user title

	if(trim($memprofile['usertitle']) != '')
{
// User has custom user title

Zeile 1540Zeile 1795
	else
{
// No usergroup title so get a default one

	else
{
// No usergroup title so get a default one

		$query = $db->simple_select("usertitles", "*", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
while($title = $db->fetch_array($query))


		$usertitles = $cache->read('usertitles');

if(is_array($usertitles))

		{

		{

			if($memprofile['postnum'] >= $title['posts'])

			foreach($usertitles as $title)

			{

			{

				$usertitle = $title['title'];
$stars = $title['stars'];
$starimage = $title['starimage'];
break;





				if($memprofile['postnum'] >= $title['posts'])
{
$usertitle = $title['title'];
$stars = $title['stars'];
$starimage = $title['starimage'];

break;
}

			}

			}

		}

		}

	}

if($displaygroup['stars'] || $displaygroup['usertitle'])

	}

if($displaygroup['stars'] || $displaygroup['usertitle'])

	{

	{

		// Set the number of stars if display group has constant number of stars
$stars = $displaygroup['stars'];
}
elseif(!$stars)
{

		// Set the number of stars if display group has constant number of stars
$stars = $displaygroup['stars'];
}
elseif(!$stars)
{

		// This is for cases where the user has a title, but the group has no defined number of stars (use number of stars as per default usergroups)
$query = $db->simple_select("usertitles", "*", "", array('order_by' => 'posts', 'order_dir' => 'DESC'));
while($title = $db->fetch_array($query))

		if(!is_array($usertitles))



		{

		{

			if($memprofile['postnum'] >= $title['posts'])
{
$stars = $title['stars'];
$starimage = $title['starimage'];
break;










			$usertitles = $cache->read('usertitles');
}

// This is for cases where the user has a title, but the group has no defined number of stars (use number of stars as per default usergroups)
if(is_array($usertitles))
{
foreach($usertitles as $title)
{
if($memprofile['postnum'] >= $title['posts'])
{
$stars = $title['stars'];
$starimage = $title['starimage'];
break;
}

			}
}
}


			}
}
}


 
	$groupimage = '';

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

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

Zeile 1586Zeile 1854
		$displaygroup['image'] = str_replace("{lang}", $language, $displaygroup['image']);
$displaygroup['image'] = str_replace("{theme}", $theme['imgdir'], $displaygroup['image']);
eval("\$groupimage = \"".$templates->get("member_profile_groupimage")."\";");

		$displaygroup['image'] = str_replace("{lang}", $language, $displaygroup['image']);
$displaygroup['image'] = str_replace("{theme}", $theme['imgdir'], $displaygroup['image']);
eval("\$groupimage = \"".$templates->get("member_profile_groupimage")."\";");

	}

	}





	if(!$starimage)

	if(empty($starimage))

	{
$starimage = $displaygroup['starimage'];
}


	{
$starimage = $displaygroup['starimage'];
}


	if($starimage)

	if(!empty($starimage))

	{
// Only display stars if we have an image to use...
$starimage = str_replace("{theme}", $theme['imgdir'], $starimage);

	{
// Only display stars if we have an image to use...
$starimage = str_replace("{theme}", $theme['imgdir'], $starimage);

Zeile 1624Zeile 1892
	else
{
eval("\$online_status = \"".$templates->get("member_profile_offline")."\";");

	else
{
eval("\$online_status = \"".$templates->get("member_profile_offline")."\";");

	}

	}


// Build Referral
if($mybb->settings['usereferrals'] == 1)
{
// Reset the background colours to keep it inline
$bg_color = alt_trow(true);


// Build Referral
if($mybb->settings['usereferrals'] == 1)
{
// Reset the background colours to keep it inline
$bg_color = alt_trow(true);





		eval("\$referrals = \"".$templates->get("member_profile_referrals")."\";");

		eval("\$referrals = \"".$templates->get("member_profile_referrals")."\";");

	}

	}

	else
{
// Manually set to override colours...

	else
{
// Manually set to override colours...

Zeile 1642Zeile 1910

// Fetch the reputation for this user
if($memperms['usereputationsystem'] == 1 && $displaygroup['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1)


// Fetch the reputation for this user
if($memperms['usereputationsystem'] == 1 && $displaygroup['usereputationsystem'] == 1 && $mybb->settings['enablereputation'] == 1)

	{

	{

		$bg_color = alt_trow();
$reputation = get_reputation($memprofile['reputation']);

// If this user has permission to give reputations show the vote link

		$bg_color = alt_trow();
$reputation = get_reputation($memprofile['reputation']);

// If this user has permission to give reputations show the vote link

		if($mybb->usergroup['cangivereputations'] == 1 && $memprofile['uid'] != $mybb->user['uid'])


		$vote_link = '';
if($mybb->usergroup['cangivereputations'] == 1 && $memprofile['uid'] != $mybb->user['uid'] && ($mybb->settings['posrep'] || $mybb->settings['neurep'] || $mybb->settings['negrep']))

		{
$vote_link = "[<a href=\"javascript:MyBB.reputation({$memprofile['uid']});\">{$lang->reputation_vote}</a>]";
}

		{
$vote_link = "[<a href=\"javascript:MyBB.reputation({$memprofile['uid']});\">{$lang->reputation_vote}</a>]";
}

Zeile 1671Zeile 1940
		}
else
{

		}
else
{

			$warning_link = "usercp.php";


			$warn_user = '';
$warning_link = 'usercp.php';

		}
eval("\$warning_level = \"".$templates->get("member_profile_warninglevel")."\";");
}

		}
eval("\$warning_level = \"".$templates->get("member_profile_warninglevel")."\";");
}

Zeile 1696Zeile 1966
		$thing = explode("\n", $customfield['type'], "2");
$type = trim($thing[0]);


		$thing = explode("\n", $customfield['type'], "2");
$type = trim($thing[0]);


 
		$customfieldval = '';

		$field = "fid{$customfield['fid']}";

		$field = "fid{$customfield['fid']}";

		$useropts = explode("\n", $userfields[$field]);
$customfieldval = $comma = '';
if(is_array($useropts) && ($type == "multiselect" || $type == "checkbox"))


if(isset($userfields[$field]))


		{

		{

			foreach($useropts as $val)



			$useropts = explode("\n", $userfields[$field]);
$customfieldval = $comma = '';
if(is_array($useropts) && ($type == "multiselect" || $type == "checkbox"))

			{

			{

				if($val != '')





















				foreach($useropts as $val)
{
if($val != '')
{
$customfieldval .= "<li style=\"margin-left: 0;\">{$val}</li>";
}
}
if($customfieldval != '')
{
$customfieldval = "<ul style=\"margin: 0; padding-left: 15px;\">{$customfieldval}</ul>";
}
}
else
{
$userfields[$field] = $parser->parse_badwords($userfields[$field]);

if($customfield['type'] == "textarea")
{
$customfieldval = nl2br(htmlspecialchars_uni($userfields[$field]));
}
else

				{

				{

					$customfieldval .= "<li style=\"margin-left: 0;\">{$val}</li>";

					$customfieldval = htmlspecialchars_uni($userfields[$field]);

				}

				}

			}
if($customfieldval != '')
{
$customfieldval = "<ul style=\"margin: 0; padding-left: 15px;\">{$customfieldval}</ul>";
}
}
else
{
if($customfield['type'] == "textarea")
{
$customfieldval = nl2br(htmlspecialchars_uni($userfields[$field]));
}
else
{
$customfieldval = htmlspecialchars_uni($userfields[$field]);

 
			}
}


			}
}


Zeile 1732Zeile 2009
	if($customfields)
{
eval("\$profilefields = \"".$templates->get("member_profile_customfields")."\";");

	if($customfields)
{
eval("\$profilefields = \"".$templates->get("member_profile_customfields")."\";");

	}

	}

	$memprofile['postnum'] = my_number_format($memprofile['postnum']);
$lang->ppd_percent_total = $lang->sprintf($lang->ppd_percent_total, my_number_format($ppd), $percent);
$formattedname = format_name($memprofile['username'], $memprofile['usergroup'], $memprofile['displaygroup']);
if($memprofile['timeonline'] > 0)
{
$timeonline = nice_time($memprofile['timeonline']);

	$memprofile['postnum'] = my_number_format($memprofile['postnum']);
$lang->ppd_percent_total = $lang->sprintf($lang->ppd_percent_total, my_number_format($ppd), $percent);
$formattedname = format_name($memprofile['username'], $memprofile['usergroup'], $memprofile['displaygroup']);
if($memprofile['timeonline'] > 0)
{
$timeonline = nice_time($memprofile['timeonline']);

	}

	}

	else
{
$timeonline = $lang->none_registered;
}

	else
{
$timeonline = $lang->none_registered;
}

	



$adminoptions = '';

	if($mybb->usergroup['cancp'] == 1 && $mybb->config['hide_admin_links'] != 1)
{
eval("\$adminoptions = \"".$templates->get("member_profile_adminoptions")."\";");

	if($mybb->usergroup['cancp'] == 1 && $mybb->config['hide_admin_links'] != 1)
{
eval("\$adminoptions = \"".$templates->get("member_profile_adminoptions")."\";");

	}
else
{
$adminoptions = '';
}

if($mybb->usergroup['canmodcp'] == 1)

	}

$modoptions = '';
if($mybb->usergroup['canmodcp'] == 1)




	{
$memprofile['usernotes'] = nl2br(htmlspecialchars_uni($memprofile['usernotes']));


	{
$memprofile['usernotes'] = nl2br(htmlspecialchars_uni($memprofile['usernotes']));


Zeile 1772Zeile 2047
		
eval("\$modoptions = \"".$templates->get("member_profile_modoptions")."\";");
}

		
eval("\$modoptions = \"".$templates->get("member_profile_modoptions")."\";");
}

	else
{
$modoptions = '';
}








	$buddy_options = '';

	$buddy_options = '';

	

 
	if($mybb->user['uid'] != $memprofile['uid'] && $mybb->user['uid'] != 0)
{
$buddy_list = explode(',', $mybb->user['buddylist']);

	if($mybb->user['uid'] != $memprofile['uid'] && $mybb->user['uid'] != 0)
{
$buddy_list = explode(',', $mybb->user['buddylist']);

Zeile 1803Zeile 2073
	}

$plugins->run_hooks("member_profile_end");

	}

$plugins->run_hooks("member_profile_end");

	



	eval("\$profile = \"".$templates->get("member_profile")."\";");
output_page($profile);
}

	eval("\$profile = \"".$templates->get("member_profile")."\";");
output_page($profile);
}

Zeile 1827Zeile 2097
		$query = $db->simple_select("maillogs", "COUNT(*) AS sent_count", "fromuid='{$mybb->user['uid']}' AND dateline >= '".(TIME_NOW - (60*60*24))."'");
$sent_count = $db->fetch_field($query, "sent_count");
if($sent_count >= $mybb->usergroup['maxemails'])

		$query = $db->simple_select("maillogs", "COUNT(*) AS sent_count", "fromuid='{$mybb->user['uid']}' AND dateline >= '".(TIME_NOW - (60*60*24))."'");
$sent_count = $db->fetch_field($query, "sent_count");
if($sent_count >= $mybb->usergroup['maxemails'])

		{
$lang->error_max_emails_day = $lang->sprintf($lang->error_max_emails_day, $mybb->usergroup['maxemails']);
error($lang->error_max_emails_day);
}
}

$query = $db->simple_select("users", "uid, username, email, hideemail", "uid='".intval($mybb->input['uid'])."'");

		{
$lang->error_max_emails_day = $lang->sprintf($lang->error_max_emails_day, $mybb->usergroup['maxemails']);
error($lang->error_max_emails_day);
}
}

$query = $db->simple_select("users", "uid, username, email, hideemail", "uid='".intval($mybb->input['uid'])."'");

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

if(!$to_user['username'])
{
error($lang->error_invalidusername);

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

if(!$to_user['username'])
{
error($lang->error_invalidusername);

	}

	}

	
if($to_user['hideemail'] != 0)

	
if($to_user['hideemail'] != 0)

	{

	{

		error($lang->error_hideemail);

		error($lang->error_hideemail);

	}


	}


	if(empty($mybb->input['subject']))
{
$errors[] = $lang->error_no_email_subject;
}

if(empty($mybb->input['message']))

	if(empty($mybb->input['subject']))
{
$errors[] = $lang->error_no_email_subject;
}

if(empty($mybb->input['message']))

	{
$errors[] = $lang->error_no_email_message;
}

if(count($errors) == 0)
{
if($mybb->settings['mail_handler'] == 'smtp')

	{
$errors[] = $lang->error_no_email_message;
}

if(count($errors) == 0)
{
if($mybb->settings['mail_handler'] == 'smtp')

		{
$from = $mybb->user['email'];
}

		{
$from = $mybb->user['email'];
}

Zeile 1909Zeile 2179
	
// Check group limits
if($mybb->usergroup['maxemails'] > 0)

	
// Check group limits
if($mybb->usergroup['maxemails'] > 0)

	{

	{

		$query = $db->simple_select("maillogs", "COUNT(*) AS sent_count", "fromuid='{$mybb->user['uid']}' AND dateline >= '".(TIME_NOW - (60*60*24))."'");
$sent_count = $db->fetch_field($query, "sent_count");
if($sent_count > $mybb->usergroup['maxemails'])

		$query = $db->simple_select("maillogs", "COUNT(*) AS sent_count", "fromuid='{$mybb->user['uid']}' AND dateline >= '".(TIME_NOW - (60*60*24))."'");
$sent_count = $db->fetch_field($query, "sent_count");
if($sent_count > $mybb->usergroup['maxemails'])

Zeile 1919Zeile 2189
		}
}


		}
}


	$query = $db->simple_select("users", "uid, username, email, hideemail", "uid='".intval($mybb->input['uid'])."'");

	$query = $db->simple_select("users", "uid, username, email, hideemail, ignorelist", "uid='".intval($mybb->input['uid'])."'");

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

$lang->email_user = $lang->sprintf($lang->email_user, $to_user['username']);

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

$lang->email_user = $lang->sprintf($lang->email_user, $to_user['username']);

	

	

	if(!$to_user['uid'])
{
error($lang->error_invaliduser);

	if(!$to_user['uid'])
{
error($lang->error_invaliduser);

Zeile 1932Zeile 2202
	if($to_user['hideemail'] != 0)
{
error($lang->error_hideemail);

	if($to_user['hideemail'] != 0)
{
error($lang->error_hideemail);

 
	}

if($to_user['ignorelist'] && (my_strpos(",".$to_user['ignorelist'].",", ",".$mybb->user['uid'].",") !== false && $mybb->usergroup['cansendemailoverride'] != 1))
{
error_no_permission();

	}

if(count($errors) > 0)

	}

if(count($errors) > 0)