Vergleich usercp.php - 1.2.1 - 1.2.2

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * $Id: usercp.php 2265 2006-09-26 14:49:36Z Tikitiki $

 * $Id: usercp.php 2458 2006-11-29 07:27:32Z chris $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 32Zeile 32

if(!$mybb->user['pmfolders'])
{


if(!$mybb->user['pmfolders'])
{

	$mybb->user['pmfolders'] = "1**Inbox$%%$2**Sent Items$%%$3**Drafts$%%$4**Trash Can";

	$mybb->user['pmfolders'] = "1**".$lang->folder_inbox."$%%$2**".$lang->folder_sent_items."$%%$3**".$lang->folder_drafts."$%%$4**".$lang->folder_trash;

	$db->update_query(TABLE_PREFIX."users", array('pmfolders' => $mybb->user['pmfolders']), "uid='".$mybb->user['uid']."'");
}


	$db->update_query(TABLE_PREFIX."users", array('pmfolders' => $mybb->user['pmfolders']), "uid='".$mybb->user['uid']."'");
}


Zeile 234Zeile 234
	{
$userhandler->update_user();


	{
$userhandler->update_user();


		$db->update_query(TABLE_PREFIX."users", $newprofile, "uid='".$mybb->user['uid']."'");

 
		$plugins->run_hooks("usercp_do_profile_end");
redirect("usercp.php", $lang->redirect_profileupdated);
}

		$plugins->run_hooks("usercp_do_profile_end");
redirect("usercp.php", $lang->redirect_profileupdated);
}

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

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

 
		$profilefield['description'] = htmlspecialchars_uni($profilefield['description']);

		$thing = explode("\n", $profilefield['type'], "2");
$type = $thing[0];
$options = $thing[1];

		$thing = explode("\n", $profilefield['type'], "2");
$type = $thing[0];
$options = $thing[1];

Zeile 573Zeile 573
		"receivepms" => $mybb->input['receivepms'],
"pmpopup" => $mybb->input['pmpopup'],
"daysprune" => $mybb->input['daysprune'],

		"receivepms" => $mybb->input['receivepms'],
"pmpopup" => $mybb->input['pmpopup'],
"daysprune" => $mybb->input['daysprune'],

		"showcodebuttons" => $mybb->input['showcodebuttons'],

		"showcodebuttons" => intval($mybb->input['showcodebuttons']),

		"pmnotify" => $mybb->input['pmnotify'],
"showredirect" => $mybb->input['showredirect']
);

		"pmnotify" => $mybb->input['pmnotify'],
"showredirect" => $mybb->input['showredirect']
);

Zeile 600Zeile 600
	else
{
$userhandler->update_user();

	else
{
$userhandler->update_user();


$db->update_query(TABLE_PREFIX."users", $updatedoptions, "uid='".$mybb->user['uid']."'");

 

// If the cookie settings are different, re-set the cookie
if($mybb->input['remember'] != $mybb->user['remember'])


// If the cookie settings are different, re-set the cookie
if($mybb->input['remember'] != $mybb->user['remember'])

Zeile 676Zeile 674
	else
{
$hideemailcheck = "";

	else
{
$hideemailcheck = "";

	}


	}


	if($user['emailnotify'] == "yes")
{
$emailnotifycheck = "checked=\"checked\"";

	if($user['emailnotify'] == "yes")
{
$emailnotifycheck = "checked=\"checked\"";

	}
else

	}
else

	{
$emailnotifycheck = "";
}

	{
$emailnotifycheck = "";
}

Zeile 690Zeile 688
	if($user['showsigs'] == "yes")
{
$showsigscheck = "checked=\"checked\"";;

	if($user['showsigs'] == "yes")
{
$showsigscheck = "checked=\"checked\"";;

	}
else
{

	}
else
{

		$showsigscheck = "";
}

if($user['showavatars'] == "yes")
{
$showavatarscheck = "checked=\"checked\"";

		$showsigscheck = "";
}

if($user['showavatars'] == "yes")
{
$showavatarscheck = "checked=\"checked\"";

	}
else
{

	}
else
{

		$showavatarscheck = "";
}

if($user['showquickreply'] == "yes")

		$showavatarscheck = "";
}

if($user['showquickreply'] == "yes")

	{

	{

		$showquickreplycheck = "checked=\"checked\"";
}
else

		$showquickreplycheck = "checked=\"checked\"";
}
else

Zeile 715Zeile 713
	}

if($user['remember'] == "yes")

	}

if($user['remember'] == "yes")

	{

	{

		$remembercheck = "checked=\"checked\"";
}
else

		$remembercheck = "checked=\"checked\"";
}
else

Zeile 730Zeile 728
	else
{
$receivepmscheck = "";

	else
{
$receivepmscheck = "";

	}

	}


if($user['pmpopup'] == "yes")
{


if($user['pmpopup'] == "yes")
{

Zeile 739Zeile 737
	else
{
$pmpopupcheck = "";

	else
{
$pmpopupcheck = "";

	}

	}


if($user['dst'] == "yes")
{


if($user['dst'] == "yes")
{

Zeile 753Zeile 751
	if($user['showcodebuttons'] == 1)
{
$showcodebuttonscheck = "checked=\"checked\"";

	if($user['showcodebuttons'] == 1)
{
$showcodebuttonscheck = "checked=\"checked\"";

	}

	}

	else
{
$showcodebuttonscheck = "";

	else
{
$showcodebuttonscheck = "";

Zeile 828Zeile 826
		if(is_array($explodedtpp))
{
foreach($explodedtpp as $key => $val)

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

			{
$val = trim($val);

			{
$val = trim($val);

				$selected = "";
if($user['tpp'] == $val)

				$selected = "";
if($user['tpp'] == $val)

				{
$selected = "selected=\"selected\"";
}

				{
$selected = "selected=\"selected\"";
}

				$tppoptions .= "<option value=\"$val\" $selected>".sprintf($lang->tpp_option, $val)."</option>\n";
}
}
eval("\$tppselect = \"".$templates->get("usercp_options_tppselect")."\";");

				$tppoptions .= "<option value=\"$val\" $selected>".sprintf($lang->tpp_option, $val)."</option>\n";
}
}
eval("\$tppselect = \"".$templates->get("usercp_options_tppselect")."\";");

	}

	}

	if($mybb->settings['userpppoptions'])
{
$explodedppp = explode(",", $mybb->settings['userpppoptions']);

	if($mybb->settings['userpppoptions'])
{
$explodedppp = explode(",", $mybb->settings['userpppoptions']);

Zeile 863Zeile 861
	$plugins->run_hooks("usercp_options_end");
output_page($editprofile);
}

	$plugins->run_hooks("usercp_options_end");
output_page($editprofile);
}





if($mybb->input['action'] == "do_email" && $mybb->request_method == "post")
{

if($mybb->input['action'] == "do_email" && $mybb->request_method == "post")
{

	$plugins->run_hooks("usercp_do_email_start");

$user = validate_password_from_uid($mybb->user['uid'], $mybb->input['password']);
if(!$user['uid'])
{
error($lang->error_invalidpassword);
}
if($mybb->input['email'] != $mybb->input['email2'])
{
error($lang->error_emailmismatch);
}

	$errors = array();















	//Email Banning Code 
if($mybb->settings['emailkeep'] != "yes")
{
$bannedemails = explode(" ", $mybb->settings['emailban']);
if(is_array($bannedemails))
{
foreach($bannedemails as $key => $bannedemail)
{
$bannedemail = trim($bannedemail);
if($bannedemail != "")
{
if(strstr($mybb->input['email'], $bannedemail) != "")
{
error($lang->error_bannedemail);
}
}
}
}
}
if(!preg_match("/^(.+)@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+$/si", $mybb->input['email']))
{
error($lang->error_invalidemail);
}
if(function_exists("emailChanged"))
{
emailChanged($mybb->user['uid'], $mybb->input['email']);
}

if($mybb->user['usergroup'] != "5")
{
$activationcode = random_str();
$now = time();
$db->delete_query(TABLE_PREFIX."awaitingactivation", "uid='".$mybb->user['uid']."'");
$newactivation = array(

	$plugins->run_hooks("usercp_do_email_start");
if(validate_password_from_uid($mybb->user['uid'], $mybb->input['password']) == false)
{
$errors[] = $lang->error_invalidpassword;
}
else
{
// Set up user handler.
require_once "inc/datahandlers/user.php";
$userhandler = new UserDataHandler("update");

$user = array(























			"uid" => $mybb->user['uid'],

			"uid" => $mybb->user['uid'],

			"dateline" => time(), 
"code" => $activationcode,
"type" => "e",
"oldgroup" => $mybb->user['usergroup'],
"misc" => $db->escape_string($mybb->input['email'])

			"email" => $mybb->input['email'],
"email2" => $mybb->input['email2']




		);

		);

 

$userhandler->set_data($user);

if(!$userhandler->validate_user())
{
$errors = $userhandler->get_friendly_errors();
}
else
{
if($mybb->user['usergroup'] != "5" && $mybb->usergroup['cancp'] != "yes")
{
$activationcode = random_str();
$now = time();
$db->delete_query(TABLE_PREFIX."awaitingactivation", "uid='".$mybb->user['uid']."'");
$newactivation = array(
"uid" => $mybb->user['uid'],
"dateline" => time(),
"code" => $activationcode,
"type" => "e",
"oldgroup" => $mybb->user['usergroup'],
"misc" => $db->escape_string($mybb->input['email'])
);
$db->insert_query(TABLE_PREFIX."awaitingactivation", $newactivation);

		

		

		$db->insert_query(TABLE_PREFIX."awaitingactivation", $newactivation); 

$username = $mybb->user['username'];
$uid = $mybb->user['uid'];
$lang->emailsubject_changeemail = sprintf($lang->emailsubject_changeemail, $mybb->settings['bbname']);
$lang->email_changeemail = sprintf($lang->email_changeemail, $mybb->user['username'], $mybb->settings['bbname'], $mybb->user['email'], $mybb->input['email'], $mybb->settings['bburl'], $activationcode, $mybb->user['username'], $mybb->user['uid']);
my_mail($mybb->input['email'], $lang->emailsubject_changeemail, $lang->email_changeemail);
$plugins->run_hooks("usercp_do_email_verify");
error($lang->redirect_changeemail_activation);
}
else
{
$db->update_query(TABLE_PREFIX."users", array('email' => $db->escape_string($mybb->input['email'])), "uid='".$mybb->user['uid']."'");
$plugins->run_hooks("usercp_do_email_changed");
redirect("usercp.php", $lang->redirect_emailupdated);
}






				$username = $mybb->user['username'];
$uid = $mybb->user['uid'];
$lang->emailsubject_changeemail = sprintf($lang->emailsubject_changeemail, $mybb->settings['bbname']);
$lang->email_changeemail = sprintf($lang->email_changeemail, $mybb->user['username'], $mybb->settings['bbname'], $mybb->user['email'], $mybb->input['email'], $mybb->settings['bburl'], $activationcode, $mybb->user['username'], $mybb->user['uid']);
my_mail($mybb->input['email'], $lang->emailsubject_changeemail, $lang->email_changeemail);
$plugins->run_hooks("usercp_do_email_verify");
error($lang->redirect_changeemail_activation);
}
else
{
$userhandler->update_user();
$plugins->run_hooks("usercp_do_email_changed");
redirect("usercp.php", $lang->redirect_emailupdated);
}
}
}
if(count($errors) > 0)
{
$mybb->input['action'] = "email";
$errors = inline_error($errors);
}

}

}





if($mybb->input['action'] == "email")
{

if($mybb->input['action'] == "email")
{

 
	// Coming back to this page after one or more errors were experienced, show fields the user previously entered (with the exception of the password)
if($errors)
{
$email = htmlspecialchars_uni($mybb->input['email']);
$email2 = htmlspecialchars_uni($mybb->input['email2']);
}
else
{
$email = $email2 = '';
}


	$plugins->run_hooks("usercp_email_start");
eval("\$changemail = \"".$templates->get("usercp_email")."\";");
$plugins->run_hooks("usercp_email_end");
output_page($changemail);

	$plugins->run_hooks("usercp_email_start");
eval("\$changemail = \"".$templates->get("usercp_email")."\";");
$plugins->run_hooks("usercp_email_end");
output_page($changemail);

}


}


if($mybb->input['action'] == "do_password" && $mybb->request_method == "post")
{

if($mybb->input['action'] == "do_password" && $mybb->request_method == "post")
{

 
	$errors = array();


	$plugins->run_hooks("usercp_do_password_start");
if(validate_password_from_uid($mybb->user['uid'], $mybb->input['oldpassword']) == false)
{

	$plugins->run_hooks("usercp_do_password_start");
if(validate_password_from_uid($mybb->user['uid'], $mybb->input['oldpassword']) == false)
{

        error($lang->error_invalidpassword); 
}
if($mybb->input['password'] == "")
{
error($lang->error_invalidnewpassword);
}
if($mybb->input['password'] != $mybb->input['password2'])
{
error($lang->error_passwordmismatch);
}
$plugins->run_hooks("usercp_do_password_process");
$logindetails = update_password($mybb->user['uid'], md5($mybb->input['password']), $mybb->user['salt']);

my_setcookie("mybbuser", $mybb->user['uid']."_".$logindetails['loginkey']);
$plugins->run_hooks("usercp_do_password_end");
redirect("usercp.php", $lang->redirect_passwordupdated);


















		$errors[] = $lang->error_invalidpassword;
}
else
{
// Set up user handler.
require_once "inc/datahandlers/user.php";
$userhandler = new UserDataHandler("update");

$user = array(
"uid" => $mybb->user['uid'],
"password" => $mybb->input['password'],
"password2" => $mybb->input['password2']
);

$userhandler->set_data($user);

if(!$userhandler->validate_user())
{
$errors = $userhandler->get_friendly_errors();
}
else
{
$userhandler->update_user();
my_setcookie("mybbuser", $mybb->user['uid']."_".$userhandler->data['loginkey']);
$plugins->run_hooks("usercp_do_password_end");
redirect("usercp.php", $lang->redirect_passwordupdated);
}
}
if(count($errors) > 0)
{
$mybb->input['action'] = "password";
$errors = inline_error($errors);
}

}

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

}

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

{

{

	$plugins->run_hooks("usercp_password_start");
eval("\$editpassword = \"".$templates->get("usercp_password")."\";");
$plugins->run_hooks("usercp_password_end");

	$plugins->run_hooks("usercp_password_start");
eval("\$editpassword = \"".$templates->get("usercp_password")."\";");
$plugins->run_hooks("usercp_password_end");

Zeile 985Zeile 1006
		error_no_permission();
}


		error_no_permission();
}


	if(!trim($mybb->input['username']) || eregi("<|>|&", $mybb->input['username'])) 
{
error($lang->error_bannedusername);
}
$query = $db->simple_select(TABLE_PREFIX."users", "username", "LOWER(username)='".strtolower($mybb->input['username'])."'");

if($db->fetch_array($query))
{
error($lang->error_usernametaken);
}
$plugins->run_hooks("usercp_do_changename_process");
$db->update_query(TABLE_PREFIX."users", array('username' => $db->escape_string($mybb->input['username'])), "uid='".$mybb->user['uid']."'");
$db->update_query(TABLE_PREFIX."forums", array('lastposter' => $db->escape_string($mybb->input['username'])), "lastposter='".$mybb->user['username']."'");
$db->update_query(TABLE_PREFIX."threads", array('lastposter' => $db->escape_string($mybb->input['username'])), "lastposter='".$mybb->user['username']."'");
$plugins->run_hooks("usercp_do_changename_end");
redirect("usercp.php", $lang->redirect_namechanged);



















	if(validate_password_from_uid($mybb->user['uid'], $mybb->input['password']) == false)
{
$errors[] = $lang->error_invalidpassword;
}
else
{
// Set up user handler.
require_once "inc/datahandlers/user.php";
$userhandler = new UserDataHandler("update");

$user = array(
"uid" => $mybb->user['uid'],
"username" => $mybb->input['username']
);

$userhandler->set_data($user);

if(!$userhandler->validate_user())
{
$errors = $userhandler->get_friendly_errors();
}
else
{
$userhandler->update_user();
$plugins->run_hooks("usercp_do_changename_end");
redirect("usercp.php", $lang->redirect_namechanged);

}
}
if(count($errors) > 0)
{
$errors = inline_error($errors);
$mybb->input['action'] = "changename";
}

}

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

}

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