Vergleich usercp.php - 1.2.0 - 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 2173 2006-08-30 18:07:30Z Kilroy $

 * $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 572Zeile 572
		"remember" => $mybb->input['remember'],
"receivepms" => $mybb->input['receivepms'],
"pmpopup" => $mybb->input['pmpopup'],

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

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

		"daysprune" => $mybb->input['daysprune'],
"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 612Zeile 610
			// Set the new one
if($mybb->input['remember'] == "yes")
{

			// Set the new one
if($mybb->input['remember'] == "yes")
{

				my_setcookie("mybbuser", $mybb->user['uid']."_".$mybb->user['loginkey']);

				my_setcookie("mybbuser", $mybb->user['uid']."_".$mybb->user['loginkey'], null, true);

			}
else
{

			}
else
{

				my_setcookie("mybbuser", $mybb->user['uid']."_".$mybb->user['loginkey'], -1);

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

			}
}


			}
}


Zeile 846Zeile 844
		$pppoptions = '';
if(is_array($explodedppp))
{

		$pppoptions = '';
if(is_array($explodedppp))
{

			foreach($explodedtpp as $key => $val)

			foreach($explodedppp as $key => $val)

			{
$val = trim($val);
$selected = "";

			{
$val = trim($val);
$selected = "";

Zeile 862Zeile 860
	eval("\$editprofile = \"".$templates->get("usercp_options")."\";");
$plugins->run_hooks("usercp_options_end");
output_page($editprofile);

	eval("\$editprofile = \"".$templates->get("usercp_options")."\";");
$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")
{

 
	$errors = array();


	$plugins->run_hooks("usercp_do_email_start");

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

//Email Banning Code
if($mybb->settings['emailkeep'] != "yes")
{
$bannedemails = explode(" ", $mybb->settings['emailban']);
if(is_array($bannedemails))









	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'],
"email" => $mybb->input['email'],
"email2" => $mybb->input['email2']
);

$userhandler->set_data($user);

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

		{

		{

			foreach($bannedemails as $key => $bannedemail)

			if($mybb->user['usergroup'] != "5" && $mybb->usergroup['cancp'] != "yes")

			{

			{

				$bannedemail = trim($bannedemail);
if($bannedemail != "")
{
if(strstr($mybb->input['email'], $bannedemail) != "")
{
error($lang->error_bannedemail);
}
}



















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

$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(!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(
"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);

$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

		}
}
if(count($errors) > 0)

































	{

	{

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

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

		$errors[] = $lang->error_invalidpassword;

	}

	}

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



























	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)

	{

	{

		error($lang->error_invalidnewpassword);


			$mybb->input['action'] = "password";
$errors = inline_error($errors);

	}

	}

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

 
}

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

}

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

Zeile 982Zeile 1005
	{
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))






























	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)

	{

	{

		error($lang->error_usernametaken);


		$errors = inline_error($errors);
$mybb->input['action'] = "changename";

	}

	}

	$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($mybb->input['action'] == "changename")

}

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

Zeile 1074Zeile 1116
			if($favorite['icon'] > 0 && $icon_cache[$favorite['icon']])
{
$icon = $icon_cache[$favorite['icon']];

			if($favorite['icon'] > 0 && $icon_cache[$favorite['icon']])
{
$icon = $icon_cache[$favorite['icon']];

				$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else

				$icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />";
}
else

			{
$icon = "&nbsp;";
}

			{
$icon = "&nbsp;";
}

Zeile 1295Zeile 1337
	{
$update_signature = array(
"includesig" => "yes"

	{
$update_signature = array(
"includesig" => "yes"

		);

		);

		$db->update_query(TABLE_PREFIX."posts", $update_signature, "uid='".$mybb->user['uid']."'");
}
elseif($mybb->input['updateposts'] == "disable")

		$db->update_query(TABLE_PREFIX."posts", $update_signature, "uid='".$mybb->user['uid']."'");
}
elseif($mybb->input['updateposts'] == "disable")

Zeile 1323Zeile 1365
		$sig = $mybb->input['signature'];
$template = "usercp_editsig_preview";
}

		$sig = $mybb->input['signature'];
$template = "usercp_editsig_preview";
}

	elseif(!$error)

	else if(!$error)

	{
$sig = $mybb->user['signature'];
$template = "usercp_editsig_current";
}

	{
$sig = $mybb->user['signature'];
$template = "usercp_editsig_current";
}

 
	

	if($sig)
{
$sig_parser = array(

	if($sig)
{
$sig_parser = array(

Zeile 1360Zeile 1403
	if($mybb->settings['sightml'] == "yes")
{
$sightml = $lang->on;

	if($mybb->settings['sightml'] == "yes")
{
$sightml = $lang->on;

	}
else
{

	}
else
{

		$sightml = $lang->off;
}
if($mybb->settings['sigimgcode'] == "yes")

		$sightml = $lang->off;
}
if($mybb->settings['sigimgcode'] == "yes")

Zeile 1379Zeile 1422
	$plugins->run_hooks("usercp_endsig_end");
output_page($editsig);
}

	$plugins->run_hooks("usercp_endsig_end");
output_page($editsig);
}

 

if($mybb->input['action'] == "do_avatar" && $mybb->request_method == "post")
{
$plugins->run_hooks("usercp_do_avatar_start");
require_once MYBB_ROOT."inc/functions_upload.php";
if($mybb->input['remove']) // remove avatar
{
$updated_avatar = array(
"avatar" => "",
"avatardimensions" => "",
"avatartype" => ""
);
$db->update_query(TABLE_PREFIX."users", $updated_avatar, "uid='".$mybb->user['uid']."'");
remove_avatars($mybb->user['uid']);
}
elseif($mybb->input['gallery']) // Gallery avatar
{
if($mybb->input['gallery'] == "default")
{
$avatarpath = $db->escape_string($mybb->settings['avatardir']."/".$mybb->input['avatar']);
}
else
{
$avatarpath = $db->escape_string($mybb->settings['avatardir']."/".$mybb->input['gallery']."/".$mybb->input['avatar']);
}
if(file_exists($avatarpath))
{
$updated_avatar = array(
"avatar" => $avatarpath,
"avatardimensions" => "",
"avatartype" => "gallery"
);
$db->update_query(TABLE_PREFIX."users", $updated_avatar, "uid='".$mybb->user['uid']."'");
}
remove_avatars($mybb->user['uid']);
}
elseif($_FILES['avatarupload']['name']) // upload avatar
{
if($mybb->usergroup['canuploadavatars'] == "no")
{
error_no_permission();
}
$avatar = upload_avatar();
if($avatar['error'])
{
error($avatar['error']);
}
if($avatar['width'] > 0 && $avatar['height'] > 0)
{
$avatar_dimensions = $avatar['width']."|".$avatar['height'];
}
$updated_avatar = array(
"avatar" => $avatar['avatar'],
"avatardimensions" => $avatar_dimensions,
"avatartype" => "upload"
);
$db->update_query(TABLE_PREFIX."users", $updated_avatar, "uid='".$mybb->user['uid']."'");
}
else // remote avatar
{
$mybb->input['avatarurl'] = preg_replace("#script:#i", "", $mybb->input['avatarurl']);
$mybb->input['avatarurl'] = htmlspecialchars($mybb->input['avatarurl']);
$ext = get_extension($mybb->input['avatarurl']);
list($width, $height, $type) = @getimagesize($mybb->input['avatarurl']);

if(!$type)
{
error($lang->error_invalidavatarurl);
}

if($width && $height && $mybb->settings['maxavatardims'] != "")
{
list($maxwidth, $maxheight) = explode("x", $mybb->settings['maxavatardims']);
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight))
{
$lang->error_avatartoobig = sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
error($lang->error_avatartoobig);
}
}
if($width > 0 && $height > 0)
{
$avatar_dimensions = intval($width)."|".intval($height);
}
$updated_avatar = array(
"avatar" => $db->escape_string($mybb->input['avatarurl']),
"avatardimensions" => $avatar_dimensions,
"avatartype" => "remote"
);
$db->update_query(TABLE_PREFIX."users", $updated_avatar, "uid='".$mybb->user['uid']."'");
remove_avatars($mybb->user['uid']);
}
$plugins->run_hooks("usercp_do_avatar_end");
redirect("usercp.php", $lang->redirect_avatarupdated);
}


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


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

Zeile 1389Zeile 1526
	while($dir = @readdir($avatardir))
{
if(is_dir($mybb->settings['avatardir']."/$dir") && substr($dir, 0, 1) != ".")

	while($dir = @readdir($avatardir))
{
if(is_dir($mybb->settings['avatardir']."/$dir") && substr($dir, 0, 1) != ".")

		{

		{

			$gallerylist[$dir] = str_replace("_", " ", $dir);

			$gallerylist[$dir] = str_replace("_", " ", $dir);

		}

		}

	}
@closedir($avatardir);
natcasesort($gallerylist);

	}
@closedir($avatardir);
natcasesort($gallerylist);

Zeile 1403Zeile 1540
		{
$activegallery = $friendlyname;
$selected = "selected=\"selected\"";

		{
$activegallery = $friendlyname;
$selected = "selected=\"selected\"";

		}

		}

		$galleries .= "<option value=\"$dir\" $selected>$friendlyname</option>\n";
$selected = "";
}

		$galleries .= "<option value=\"$dir\" $selected>$friendlyname</option>\n";
$selected = "";
}

Zeile 1431Zeile 1568
		@closedir($opendir);

if(is_array($avatars))

		@closedir($opendir);

if(is_array($avatars))

		{

		{

			natcasesort($avatars);
reset($avatars);
$count = 0;

			natcasesort($avatars);
reset($avatars);
$count = 0;

Zeile 1444Zeile 1581
				if($mybb->user['avatar'] == $avatarpath)
{
$checked = "checked=\"checked\"";

				if($mybb->user['avatar'] == $avatarpath)
{
$checked = "checked=\"checked\"";

				}

				}

				if($count == 5)
{
$avatarlist .= "</tr>\n<tr>\n";

				if($count == 5)
{
$avatarlist .= "</tr>\n<tr>\n";

Zeile 1499Zeile 1636
		else
{
$colspan = 2;

		else
{
$colspan = 2;

		}

		}

		if($mybb->settings['maxavatardims'] != "")

		if($mybb->settings['maxavatardims'] != "")

		{

		{

			list($maxwidth, $maxheight) = explode("x", $mybb->settings['maxavatardims']);
$lang->avatar_note .= "<br />".sprintf($lang->avatar_note_dimensions, $maxwidth, $maxheight);

			list($maxwidth, $maxheight) = explode("x", $mybb->settings['maxavatardims']);
$lang->avatar_note .= "<br />".sprintf($lang->avatar_note_dimensions, $maxwidth, $maxheight);

		}

		}

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

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

		{

		{

			$maxsize = get_friendly_size($mybb->settings['avatarsize']*1024);
$lang->avatar_note .= "<br />".sprintf($lang->avatar_note_size, $maxsize);

			$maxsize = get_friendly_size($mybb->settings['avatarsize']*1024);
$lang->avatar_note .= "<br />".sprintf($lang->avatar_note_size, $maxsize);

		}

		}

		eval("\$avatar = \"".$templates->get("usercp_avatar")."\";");
$plugins->run_hooks("usercp_avatar_end");
output_page($avatar);
}

		eval("\$avatar = \"".$templates->get("usercp_avatar")."\";");
$plugins->run_hooks("usercp_avatar_end");
output_page($avatar);
}

}
if($mybb->input['action'] == "do_avatar" && $mybb->request_method == "post")
{
$plugins->run_hooks("usercp_do_avatar_start");
require_once MYBB_ROOT."inc/functions_upload.php";
if($mybb->input['remove']) // remove avatar
{
$updated_avatar = array(
"avatar" => "",
"avatardimensions" => "",
"avatartype" => ""
);
$db->update_query(TABLE_PREFIX."users", $updated_avatar, "uid='".$mybb->user['uid']."'");
remove_avatars($mybb->user['uid']);
}
elseif($mybb->input['gallery']) // Gallery avatar
{
if($mybb->input['gallery'] == "default")
{
$avatarpath = $db->escape_string($mybb->settings['avatardir']."/".$mybb->input['avatar']);
}
else
{
$avatarpath = $db->escape_string($mybb->settings['avatardir']."/".$mybb->input['gallery']."/".$mybb->input['avatar']);
}
if(file_exists($avatarpath))
{
$updated_avatar = array(
"avatar" => $avatarpath,
"avatardimensions" => "",
"avatartype" => "gallery"
);
$db->update_query(TABLE_PREFIX."users", $updated_avatar, "uid='".$mybb->user['uid']."'");
}
remove_avatars($mybb->user['uid']);
}
elseif($_FILES['avatarupload']['name']) // upload avatar
{
if($mybb->usergroup['canuploadavatars'] == "no")
{
error_no_permission();
}
$avatar = upload_avatar();
if($avatar['error'])
{
error($avatar['error']);
}
if($avatar['width'] > 0 && $avatar['height'] > 0)
{
$avatar_dimensions = $avatar['width']."|".$avatar['height'];
}
$updated_avatar = array(
"avatar" => $avatar['avatar'],
"avatardimensions" => $avatar_dimensions,
"avatartype" => "upload"
);
$db->update_query(TABLE_PREFIX."users", $updated_avatar, "uid='".$mybb->user['uid']."'");
}
else // remote avatar
{
$mybb->input['avatarurl'] = preg_replace("#script:#i", "", $mybb->input['avatarurl']);
$mybb->input['avatarurl'] = htmlspecialchars($mybb->input['avatarurl']);
$ext = get_extension($mybb->input['avatarurl']);
list($width, $height, $type) = @getimagesize($mybb->input['avatarurl']);

if(!$type)
{
error($lang->error_invalidavatarurl);
}

if($width && $height && $mybb->settings['maxavatardims'] != "")
{
list($maxwidth, $maxheight) = explode("x", $mybb->settings['maxavatardims']);
if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight))
{
$lang->error_avatartoobig = sprintf($lang->error_avatartoobig, $maxwidth, $maxheight);
error($lang->error_avatartoobig);
}
}
if($width > 0 && $height > 0)
{
$avatar_dimensions = intval($width)."|".intval($height);
}
$updated_avatar = array(
"avatar" => $db->escape_string($mybb->input['avatarurl']),
"avatardimensions" => $avatar_dimensions,
"avatartype" => "remote"
);
$db->update_query(TABLE_PREFIX."users", $updated_avatar, "uid='".$mybb->user['uid']."'");
remove_avatars($mybb->user['uid']);
}
$plugins->run_hooks("usercp_do_avatar_end");
redirect("usercp.php", $lang->redirect_avatarupdated);

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

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