Vergleich usercp.php - 1.8.20 - 1.8.26

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 42Zeile 42
if($mybb->user['uid'] == 0 || $mybb->usergroup['canusercp'] == 0)
{
error_no_permission();

if($mybb->user['uid'] == 0 || $mybb->usergroup['canusercp'] == 0)
{
error_no_permission();

}

if(!$mybb->user['pmfolders'])
{
$mybb->user['pmfolders'] = '1**$%%$2**$%%$3**$%%$4**';
$db->update_query('users', array('pmfolders' => $mybb->user['pmfolders']), "uid = {$mybb->user['uid']}");

 
}

$errors = '';


}

$errors = '';


$mybb->input['action'] = $mybb->get_input('action');


$mybb->input['action'] = $mybb->get_input('action');


usercp_menu();

usercp_menu();





$server_http_referer = htmlentities($_SERVER['HTTP_REFERER']);

$server_http_referer = htmlentities($_SERVER['HTTP_REFERER']);

 

if(my_strpos($server_http_referer, $mybb->settings['bburl'].'/') !== 0)
{
if(my_strpos($server_http_referer, '/') === 0)
{
$server_http_referer = my_substr($server_http_referer, 1);
}
$url_segments = explode('/', $server_http_referer);
$server_http_referer = $mybb->settings['bburl'].'/'.end($url_segments);
}


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


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

Zeile 144Zeile 148
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

 

$user = array();


$plugins->run_hooks("usercp_do_profile_start");



$plugins->run_hooks("usercp_do_profile_start");


Zeile 207Zeile 213
	require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler("update");


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


	$user = array(

	$user = array_merge($user, array(

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

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

Zeile 216Zeile 222
		"birthdayprivacy" => $mybb->get_input('birthdayprivacy'),
"away" => $away,
"profile_fields" => $mybb->get_input('profile_fields', MyBB::INPUT_ARRAY)

		"birthdayprivacy" => $mybb->get_input('birthdayprivacy'),
"away" => $away,
"profile_fields" => $mybb->get_input('profile_fields', MyBB::INPUT_ARRAY)

	);
foreach(array('icq', 'yahoo', 'skype', 'google') as $cfield)
{
$csetting = 'allow'.$cfield.'field';
if($mybb->settings[$csetting] == '')
{
continue;
}

if(!is_member($mybb->settings[$csetting]))
{
continue;
}


	));
foreach(array('icq', 'skype', 'google') as $cfield)
{
$csetting = 'allow'.$cfield.'field';
if($mybb->settings[$csetting] == '')
{
continue;
}

if(!is_member($mybb->settings[$csetting]))
{
continue;
}


		if($cfield == 'icq')

		if($cfield == 'icq')

		{

		{

			$user[$cfield] = $mybb->get_input($cfield, 1);

			$user[$cfield] = $mybb->get_input($cfield, 1);

 

if(my_strlen($user[$cfield]) > 10)
{
error($lang->contact_field_icqerror);
}

		}
else
{
$user[$cfield] = $mybb->get_input($cfield);

		}
else
{
$user[$cfield] = $mybb->get_input($cfield);

 

if(my_strlen($user[$cfield]) > 75)
{
error($lang->contact_field_error);
}

		}
}


		}
}


Zeile 366Zeile 382
	{
$user['skype'] = htmlspecialchars_uni($user['skype']);
$user['google'] = htmlspecialchars_uni($user['google']);

	{
$user['skype'] = htmlspecialchars_uni($user['skype']);
$user['google'] = htmlspecialchars_uni($user['google']);

		$user['yahoo'] = htmlspecialchars_uni($user['yahoo']);

 
	}

$contact_fields = array();
$contactfields = '';
$cfieldsshow = false;


	}

$contact_fields = array();
$contactfields = '';
$cfieldsshow = false;


	foreach(array('icq', 'yahoo', 'skype', 'google') as $cfield)

	foreach(array('icq', 'skype', 'google') as $cfield)

	{
$contact_fields[$cfield] = '';
$csetting = 'allow'.$cfield.'field';

	{
$contact_fields[$cfield] = '';
$csetting = 'allow'.$cfield.'field';

Zeile 407Zeile 422
		if($errors)
{
if($user['away'] == 1)

		if($errors)
{
if($user['away'] == 1)

			{
$awaycheck[1] = "checked=\"checked\"";
}
else
{

			{
$awaycheck[1] = "checked=\"checked\"";
}
else
{

				$awaycheck[0] = "checked=\"checked\"";
}
$returndate = array();

				$awaycheck[0] = "checked=\"checked\"";
}
$returndate = array();

Zeile 528Zeile 543
					foreach($useropts as $key => $val)
{
$val = htmlspecialchars_uni($val);

					foreach($useropts as $key => $val)
{
$val = htmlspecialchars_uni($val);

						$seloptions[$val] = $val;
}
}
$expoptions = explode("\n", $options);
if(is_array($expoptions))
{
foreach($expoptions as $key => $val)
{
$val = trim($val);
$val = str_replace("\n", "\\n", $val);

$sel = "";
if(isset($seloptions[$val]) && $val == $seloptions[$val])
{
$sel = " selected=\"selected\"";
}

eval("\$select .= \"".$templates->get("usercp_profile_profilefields_select_option")."\";");

						$seloptions[$val] = $val;
}
}
$expoptions = explode("\n", $options);
if(is_array($expoptions))
{
foreach($expoptions as $key => $val)
{
$val = trim($val);
$val = str_replace("\n", "\\n", $val);

$sel = "";
if(isset($seloptions[$val]) && $val == $seloptions[$val])
{
$sel = " selected=\"selected\"";
}

eval("\$select .= \"".$templates->get("usercp_profile_profilefields_select_option")."\";");

					}
if(!$profilefield['length'])
{

					}
if(!$profilefield['length'])
{

Zeile 553Zeile 568
					}

eval("\$code = \"".$templates->get("usercp_profile_profilefields_multiselect")."\";");

					}

eval("\$code = \"".$templates->get("usercp_profile_profilefields_multiselect")."\";");

				}
}

				}
}

			elseif($type == "select")

			elseif($type == "select")

			{
$expoptions = explode("\n", $options);
if(is_array($expoptions))
{
foreach($expoptions as $key => $val)
{

			{
$expoptions = explode("\n", $options);
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 569Zeile 584
						{
$sel = " selected=\"selected\"";
}

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





						eval("\$select .= \"".$templates->get("usercp_profile_profilefields_select_option")."\";");
}
if(!$profilefield['length'])

						eval("\$select .= \"".$templates->get("usercp_profile_profilefields_select_option")."\";");
}
if(!$profilefield['length'])

Zeile 590Zeile 605
					{
$checked = "";
if($val == $userfield)

					{
$checked = "";
if($val == $userfield)

						{
$checked = " checked=\"checked\"";

						{
$checked = " checked=\"checked\"";

						}

eval("\$code .= \"".$templates->get("usercp_profile_profilefields_radio")."\";");

						}

eval("\$code .= \"".$templates->get("usercp_profile_profilefields_radio")."\";");

Zeile 599Zeile 614
				}
}
elseif($type == "checkbox")

				}
}
elseif($type == "checkbox")

			{

			{

				$userfield = htmlspecialchars_uni($userfield);
if($errors)
{
$useropts = $userfield;
}
else

				$userfield = htmlspecialchars_uni($userfield);
if($errors)
{
$useropts = $userfield;
}
else

				{

				{

					$useropts = explode("\n", $userfield);
}
if(is_array($useropts))

					$useropts = explode("\n", $userfield);
}
if(is_array($useropts))

Zeile 614Zeile 629
					foreach($useropts as $key => $val)
{
$seloptions[$val] = $val;

					foreach($useropts as $key => $val)
{
$seloptions[$val] = $val;

					}

					}

				}
$expoptions = explode("\n", $options);
if(is_array($expoptions))

				}
$expoptions = explode("\n", $options);
if(is_array($expoptions))

Zeile 629Zeile 644

eval("\$code .= \"".$templates->get("usercp_profile_profilefields_checkbox")."\";");
}


eval("\$code .= \"".$templates->get("usercp_profile_profilefields_checkbox")."\";");
}

				}

				}

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

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

Zeile 644Zeile 659
				{
$maxlength = " maxlength=\"{$profilefield['maxlength']}\"";
}

				{
$maxlength = " maxlength=\"{$profilefield['maxlength']}\"";
}





				eval("\$code = \"".$templates->get("usercp_profile_profilefields_text")."\";");
}

if($profilefield['required'] == 1)
{
eval("\$requiredfields .= \"".$templates->get("usercp_profile_customfield")."\";");

				eval("\$code = \"".$templates->get("usercp_profile_profilefields_text")."\";");
}

if($profilefield['required'] == 1)
{
eval("\$requiredfields .= \"".$templates->get("usercp_profile_customfield")."\";");

			}

			}

			else
{
eval("\$customfields .= \"".$templates->get("usercp_profile_customfield")."\";");

			else
{
eval("\$customfields .= \"".$templates->get("usercp_profile_customfield")."\";");

Zeile 742Zeile 757
	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


	$plugins->run_hooks("usercp_do_options_start");



	$user = array();

$plugins->run_hooks("usercp_do_options_start");


// Set up user handler.
require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler("update");



// Set up user handler.
require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler("update");


	$user = array(

	$user = array_merge($user, array(

		"uid" => $mybb->user['uid'],
"style" => $mybb->get_input('style', MyBB::INPUT_INT),
"dateformat" => $mybb->get_input('dateformat', MyBB::INPUT_INT),

		"uid" => $mybb->user['uid'],
"style" => $mybb->get_input('style', MyBB::INPUT_INT),
"dateformat" => $mybb->get_input('dateformat', MyBB::INPUT_INT),

Zeile 757Zeile 774
		"language" => $mybb->get_input('language'),
'usergroup' => $mybb->user['usergroup'],
'additionalgroups' => $mybb->user['additionalgroups']

		"language" => $mybb->get_input('language'),
'usergroup' => $mybb->user['usergroup'],
'additionalgroups' => $mybb->user['additionalgroups']

	);

	));


$user['options'] = array(
"allownotices" => $mybb->get_input('allownotices', MyBB::INPUT_INT),


$user['options'] = array(
"allownotices" => $mybb->get_input('allownotices', MyBB::INPUT_INT),

Zeile 814Zeile 831

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


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

	$plugins->run_hooks("usercp_options_start");


 
	if($errors != '')
{
$user = $mybb->input;

	if($errors != '')
{
$user = $mybb->input;

Zeile 824Zeile 839
	{
$user = $mybb->user;
}

	{
$user = $mybb->user;
}

 

$plugins->run_hooks("usercp_options_start");


$languages = $lang->get_languages();
$board_language = $langoptions = '';


$languages = $lang->get_languages();
$board_language = $langoptions = '';

Zeile 832Zeile 849
		foreach($languages as $name => $language)
{
$language = htmlspecialchars_uni($language);

		foreach($languages as $name => $language)
{
$language = htmlspecialchars_uni($language);





			$sel = '';
if(isset($user['language']) && $user['language'] == $name)
{

			$sel = '';
if(isset($user['language']) && $user['language'] == $name)
{

Zeile 853Zeile 870
	else
{
$allownoticescheck = "";

	else
{
$allownoticescheck = "";

	}

	}


if(isset($user['invisible']) && $user['invisible'] == 1)


if(isset($user['invisible']) && $user['invisible'] == 1)

	{

	{

		$invisiblecheck = "checked=\"checked\"";

		$invisiblecheck = "checked=\"checked\"";

	}
else
{

	}
else
{

		$invisiblecheck = "";
}

if(isset($user['hideemail']) && $user['hideemail'] == 1)
{
$hideemailcheck = "checked=\"checked\"";

		$invisiblecheck = "";
}

if(isset($user['hideemail']) && $user['hideemail'] == 1)
{
$hideemailcheck = "checked=\"checked\"";

	}

	}

	else
{
$hideemailcheck = "";

	else
{
$hideemailcheck = "";

Zeile 881Zeile 898
	elseif(isset($user['subscriptionmethod']) && $user['subscriptionmethod'] == 2)
{
$instant_email_subscribe_selected = "selected=\"selected\"";

	elseif(isset($user['subscriptionmethod']) && $user['subscriptionmethod'] == 2)
{
$instant_email_subscribe_selected = "selected=\"selected\"";

	}

	}

	elseif(isset($user['subscriptionmethod']) && $user['subscriptionmethod'] == 3)

	elseif(isset($user['subscriptionmethod']) && $user['subscriptionmethod'] == 3)

	{

	{

		$instant_pm_subscribe_selected = "selected=\"selected\"";

		$instant_pm_subscribe_selected = "selected=\"selected\"";

	}

	}

	else

	else

	{

	{

		$no_auto_subscribe_selected = "selected=\"selected\"";

		$no_auto_subscribe_selected = "selected=\"selected\"";

	}

if(isset($user['showimages']) && $user['showimages'] == 1)
{

	}

if(isset($user['showimages']) && $user['showimages'] == 1)
{

		$showimagescheck = "checked=\"checked\"";
}
else
{
$showimagescheck = "";

		$showimagescheck = "checked=\"checked\"";
}
else
{
$showimagescheck = "";

	}

if(isset($user['showvideos']) && $user['showvideos'] == 1)
{

	}

if(isset($user['showvideos']) && $user['showvideos'] == 1)
{

		$showvideoscheck = "checked=\"checked\"";
}
else
{
$showvideoscheck = "";

		$showvideoscheck = "checked=\"checked\"";
}
else
{
$showvideoscheck = "";

	}

	}


if(isset($user['showsigs']) && $user['showsigs'] == 1)
{


if(isset($user['showsigs']) && $user['showsigs'] == 1)
{

Zeile 921Zeile 938
	if(isset($user['showavatars']) && $user['showavatars'] == 1)
{
$showavatarscheck = "checked=\"checked\"";

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

	}
else
{

	}
else
{

		$showavatarscheck = "";
}

if(isset($user['showquickreply']) && $user['showquickreply'] == 1)
{
$showquickreplycheck = "checked=\"checked\"";

		$showavatarscheck = "";
}

if(isset($user['showquickreply']) && $user['showquickreply'] == 1)
{
$showquickreplycheck = "checked=\"checked\"";

	}

	}

	else

	else

	{

	{

		$showquickreplycheck = "";

		$showquickreplycheck = "";

	}

if(isset($user['receivepms']) && $user['receivepms'] == 1)
{

	}

if(isset($user['receivepms']) && $user['receivepms'] == 1)
{

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

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

Zeile 952Zeile 969
	else
{
$receivefrombuddycheck = "";

	else
{
$receivefrombuddycheck = "";

	}

	}


if(isset($user['pmnotice']) && $user['pmnotice'] >= 1)


if(isset($user['pmnotice']) && $user['pmnotice'] >= 1)

	{

	{

		$pmnoticecheck = " checked=\"checked\"";

		$pmnoticecheck = " checked=\"checked\"";

	}
else
{

	}
else
{

		$pmnoticecheck = "";
}


		$pmnoticecheck = "";
}


Zeile 980Zeile 997
	if(isset($user['showcodebuttons']) && $user['showcodebuttons'] == 1)
{
$showcodebuttonscheck = "checked=\"checked\"";

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

	}
else

	}
else

	{
$showcodebuttonscheck = "";
}

	{
$showcodebuttonscheck = "";
}

Zeile 996Zeile 1013
	}

if(isset($user['showredirect']) && $user['showredirect'] != 0)

	}

if(isset($user['showredirect']) && $user['showredirect'] != 0)

	{

	{

		$showredirectcheck = "checked=\"checked\"";

		$showredirectcheck = "checked=\"checked\"";

	}

	}

	else
{
$showredirectcheck = "";

	else
{
$showredirectcheck = "";

	}


	}


	if(isset($user['pmnotify']) && $user['pmnotify'] != 0)

	if(isset($user['pmnotify']) && $user['pmnotify'] != 0)

	{

	{

		$pmnotifycheck = "checked=\"checked\"";

		$pmnotifycheck = "checked=\"checked\"";

	}

	}

	else
{
$pmnotifycheck = '';

	else
{
$pmnotifycheck = '';

	}


	}


	if(isset($user['buddyrequestspm']) && $user['buddyrequestspm'] != 0)

	if(isset($user['buddyrequestspm']) && $user['buddyrequestspm'] != 0)

	{

	{

		$buddyrequestspmcheck = "checked=\"checked\"";

		$buddyrequestspmcheck = "checked=\"checked\"";

	}
else
{

	}
else
{

		$buddyrequestspmcheck = '';
}

if(isset($user['buddyrequestsauto']) && $user['buddyrequestsauto'] != 0)
{
$buddyrequestsautocheck = "checked=\"checked\"";

		$buddyrequestspmcheck = '';
}

if(isset($user['buddyrequestsauto']) && $user['buddyrequestsauto'] != 0)
{
$buddyrequestsautocheck = "checked=\"checked\"";

	}

	}

	else

	else

	{

	{

		$buddyrequestsautocheck = '';
}

if(!isset($user['threadmode']) || ($user['threadmode'] != "threaded" && $user['threadmode'] != "linear"))

		$buddyrequestsautocheck = '';
}

if(!isset($user['threadmode']) || ($user['threadmode'] != "threaded" && $user['threadmode'] != "linear"))

	{

	{

		$user['threadmode'] = ''; // Leave blank to show default

		$user['threadmode'] = ''; // Leave blank to show default

	}

	}


if(isset($user['classicpostbit']) && $user['classicpostbit'] != 0)
{
$classicpostbitcheck = "checked=\"checked\"";


if(isset($user['classicpostbit']) && $user['classicpostbit'] != 0)
{
$classicpostbitcheck = "checked=\"checked\"";

	}

	}

	else

	else

	{

	{

		$classicpostbitcheck = '';
}

$date_format_options = $dateformat = '';
foreach($date_formats as $key => $format)

		$classicpostbitcheck = '';
}

$date_format_options = $dateformat = '';
foreach($date_formats as $key => $format)

	{

	{

		$selected = '';
if(isset($user['dateformat']) && $user['dateformat'] == $key)
{

		$selected = '';
if(isset($user['dateformat']) && $user['dateformat'] == $key)
{

Zeile 1069Zeile 1086

$timeformat = my_date($format, TIME_NOW, "", 0);
eval("\$time_format_options .= \"".$templates->get("usercp_options_time_format")."\";");


$timeformat = my_date($format, TIME_NOW, "", 0);
eval("\$time_format_options .= \"".$templates->get("usercp_options_time_format")."\";");

	}

$tzselect = build_timezone_select("timezoneoffset", $mybb->user['timezone'], true);


	}

$tzselect = build_timezone_select("timezoneoffset", $mybb->user['timezone'], true);


	$pms_from_buddys = '';
if($mybb->settings['allowbuddyonly'] == 1)
{

	$pms_from_buddys = '';
if($mybb->settings['allowbuddyonly'] == 1)
{

Zeile 1087Zeile 1104

$quick_reply = '';
if($mybb->settings['quickreply'] == 1)


$quick_reply = '';
if($mybb->settings['quickreply'] == 1)

	{

	{

		eval("\$quick_reply = \"".$templates->get("usercp_options_quick_reply")."\";");
}


		eval("\$quick_reply = \"".$templates->get("usercp_options_quick_reply")."\";");
}


Zeile 1095Zeile 1112
	if(isset($user['threadmode']) && is_scalar($user['threadmode']))
{
$threadview[$user['threadmode']] = 'selected="selected"';

	if(isset($user['threadmode']) && is_scalar($user['threadmode']))
{
$threadview[$user['threadmode']] = 'selected="selected"';

	}

	}

	$daysprunesel = array(1 => '', 5 => '', 10 => '', 20 => '', 50 => '', 75 => '', 100 => '', 365 => '', 9999 => '');
if(isset($user['daysprune']) && is_numeric($user['daysprune']))
{
$daysprunesel[$user['daysprune']] = 'selected="selected"';
}
if(!isset($user['style']))

	$daysprunesel = array(1 => '', 5 => '', 10 => '', 20 => '', 50 => '', 75 => '', 100 => '', 365 => '', 9999 => '');
if(isset($user['daysprune']) && is_numeric($user['daysprune']))
{
$daysprunesel[$user['daysprune']] = 'selected="selected"';
}
if(!isset($user['style']))

	{

	{

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

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





	$board_style = $stylelist = '';
$stylelist = build_theme_select("style", $user['style']);

if(!empty($stylelist))

	$board_style = $stylelist = '';
$stylelist = build_theme_select("style", $user['style']);

if(!empty($stylelist))

	{

	{

		eval('$board_style = "'.$templates->get('usercp_options_style').'";');
}


		eval('$board_style = "'.$templates->get('usercp_options_style').'";');
}


Zeile 1132Zeile 1149

$tpp_option = $lang->sprintf($lang->tpp_option, $val);
eval("\$tppoptions .= \"".$templates->get("usercp_options_tppselect_option")."\";");


$tpp_option = $lang->sprintf($lang->tpp_option, $val);
eval("\$tppoptions .= \"".$templates->get("usercp_options_tppselect_option")."\";");

			}

			}

		}
eval("\$tppselect = \"".$templates->get("usercp_options_tppselect")."\";");
}

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

		}
eval("\$tppselect = \"".$templates->get("usercp_options_tppselect")."\";");
}

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

	{

	{

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

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

Zeile 1157Zeile 1174
			}
}
eval("\$pppselect = \"".$templates->get("usercp_options_pppselect")."\";");

			}
}
eval("\$pppselect = \"".$templates->get("usercp_options_pppselect")."\";");

	}

$plugins->run_hooks("usercp_options_end");

	}

$plugins->run_hooks("usercp_options_end");


eval("\$editprofile = \"".$templates->get("usercp_options")."\";");
output_page($editprofile);


eval("\$editprofile = \"".$templates->get("usercp_options")."\";");
output_page($editprofile);

Zeile 1188Zeile 1205
			"email" => $mybb->get_input('email'),
"email2" => $mybb->get_input('email2')
);

			"email" => $mybb->get_input('email'),
"email2" => $mybb->get_input('email2')
);


$userhandler->set_data($user);

if(!$userhandler->validate_user())
{


$userhandler->set_data($user);

if(!$userhandler->validate_user())
{

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

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

Zeile 1309Zeile 1326
	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


 
	$user = array();

	$errors = array();

$plugins->run_hooks("usercp_do_password_start");

	$errors = array();

$plugins->run_hooks("usercp_do_password_start");

Zeile 1322Zeile 1340
		require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler("update");


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


		$user = array(

		$user = array_merge($user, array(

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

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

		);

		));


$userhandler->set_data($user);



$userhandler->set_data($user);


Zeile 1347Zeile 1365
			$plugins->run_hooks("usercp_do_password_end");
redirect("usercp.php?action=password", $lang->redirect_passwordupdated);
}

			$plugins->run_hooks("usercp_do_password_end");
redirect("usercp.php?action=password", $lang->redirect_passwordupdated);
}

	}

	}

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

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

	}
}

	}
}


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


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

Zeile 1368Zeile 1386
	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


	$plugins->run_hooks("usercp_do_changename_start");


	$errors = array();


	if($mybb->usergroup['canchangename'] != 1)
{
error_no_permission();
}

	if($mybb->usergroup['canchangename'] != 1)
{
error_no_permission();
}

 

$user = array();

$plugins->run_hooks("usercp_do_changename_start");


if(validate_password_from_uid($mybb->user['uid'], $mybb->get_input('password')) == false)
{


if(validate_password_from_uid($mybb->user['uid'], $mybb->get_input('password')) == false)
{

Zeile 1384Zeile 1407
		require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler("update");


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


		$user = array(

		$user = array_merge($user, array(

			"uid" => $mybb->user['uid'],
"username" => $mybb->get_input('username')

			"uid" => $mybb->user['uid'],
"username" => $mybb->get_input('username')

		);


		));


		$userhandler->set_data($user);

		$userhandler->set_data($user);





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

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

Zeile 1400Zeile 1423
			$userhandler->update_user();
$plugins->run_hooks("usercp_do_changename_end");
redirect("usercp.php?action=changename", $lang->redirect_namechanged);

			$userhandler->update_user();
$plugins->run_hooks("usercp_do_changename_end");
redirect("usercp.php?action=changename", $lang->redirect_namechanged);



 
		}

		}

	}

	}

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

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

	}
}

	}
}


if($mybb->input['action'] == "changename")
{
$plugins->run_hooks("usercp_changename_start");
if($mybb->usergroup['canchangename'] != 1)


if($mybb->input['action'] == "changename")
{
$plugins->run_hooks("usercp_changename_start");
if($mybb->usergroup['canchangename'] != 1)

	{

	{

		error_no_permission();

		error_no_permission();

 
	}

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

	}

$plugins->run_hooks("usercp_changename_end");

	}

$plugins->run_hooks("usercp_changename_end");

Zeile 1428Zeile 1460
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


$plugins->run_hooks("usercp_do_subscriptions_start");

 

if(!isset($mybb->input['check']) || !is_array($mybb->input['check']))


if(!isset($mybb->input['check']) || !is_array($mybb->input['check']))

	{

	{

		error($lang->no_subscriptions_selected);
}

		error($lang->no_subscriptions_selected);
}

 

$plugins->run_hooks("usercp_do_subscriptions_start");


// Clean input - only accept integers thanks!
$mybb->input['check'] = array_map('intval', $mybb->get_input('check', MyBB::INPUT_ARRAY));


// Clean input - only accept integers thanks!
$mybb->input['check'] = array_map('intval', $mybb->get_input('check', MyBB::INPUT_ARRAY));

Zeile 1444Zeile 1476
	if($mybb->get_input('do') == "delete")
{
$db->delete_query("threadsubscriptions", "tid IN ($tids) AND uid='{$mybb->user['uid']}'");

	if($mybb->get_input('do') == "delete")
{
$db->delete_query("threadsubscriptions", "tid IN ($tids) AND uid='{$mybb->user['uid']}'");

	}

	}

	// Changing subscription type
else
{

	// Changing subscription type
else
{

Zeile 1489Zeile 1521
		WHERE ts.uid = '".$mybb->user['uid']."' AND t.visible >= 0 {$visible}
");
$threadcount = $db->fetch_field($query, "threads");

		WHERE ts.uid = '".$mybb->user['uid']."' AND t.visible >= 0 {$visible}
");
$threadcount = $db->fetch_field($query, "threads");


if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$mybb->settings['threadsperpage'] = 20;


if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$mybb->settings['threadsperpage'] = 20;

	}

$perpage = $mybb->settings['threadsperpage'];

	}

$perpage = $mybb->settings['threadsperpage'];

Zeile 1506Zeile 1538
		{
$start = 0;
$page = 1;

		{
$start = 0;
$page = 1;

		}

		}

	}
else
{
$start = 0;
$page = 1;

	}
else
{
$start = 0;
$page = 1;

	}

	}

	$end = $start + $perpage;
$lower = $start+1;
$upper = $end;
if($upper > $threadcount)
{
$upper = $threadcount;

	$end = $start + $perpage;
$lower = $start+1;
$upper = $end;
if($upper > $threadcount)
{
$upper = $threadcount;

	}

	}

	$multipage = multipage($threadcount, $perpage, $page, "usercp.php?action=subscriptions");
$fpermissions = forum_permissions();
$del_subscriptions = $subscriptions = array();

	$multipage = multipage($threadcount, $perpage, $page, "usercp.php?action=subscriptions");
$fpermissions = forum_permissions();
$del_subscriptions = $subscriptions = array();

Zeile 1539Zeile 1571
		$forumpermissions = $fpermissions[$subscription['fid']];

if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || (isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] != 0 && $subscription['uid'] != $mybb->user['uid']))

		$forumpermissions = $fpermissions[$subscription['fid']];

if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || (isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] != 0 && $subscription['uid'] != $mybb->user['uid']))

		{

		{

			// Hmm, you don't have permission to view this thread - unsubscribe!
$del_subscriptions[] = $subscription['sid'];

			// Hmm, you don't have permission to view this thread - unsubscribe!
$del_subscriptions[] = $subscription['sid'];

		}

		}

		elseif($subscription['tid'])
{
$subscriptions[$subscription['tid']] = $subscription;

		elseif($subscription['tid'])
{
$subscriptions[$subscription['tid']] = $subscription;

		}
}

		}
}


if(!empty($del_subscriptions))
{


if(!empty($del_subscriptions))
{

Zeile 1570Zeile 1602
	{
$tids = implode(",", array_keys($subscriptions));
$readforums = array();

	{
$tids = implode(",", array_keys($subscriptions));
$readforums = array();





		// Build a forum cache.
$query = $db->query("
SELECT f.fid, fr.dateline AS lastread

		// Build a forum cache.
$query = $db->query("
SELECT f.fid, fr.dateline AS lastread

Zeile 1583Zeile 1615
		while($forum = $db->fetch_array($query))
{
$readforums[$forum['fid']] = $forum['lastread'];

		while($forum = $db->fetch_array($query))
{
$readforums[$forum['fid']] = $forum['lastread'];

		}


		}


		// Check participation by the current user in any of these threads - for 'dot' folder icons
if($mybb->settings['dotfolders'] != 0)
{

		// Check participation by the current user in any of these threads - for 'dot' folder icons
if($mybb->settings['dotfolders'] != 0)
{

Zeile 1592Zeile 1624
			while($post = $db->fetch_array($query))
{
$subscriptions[$post['tid']]['doticon'] = 1;

			while($post = $db->fetch_array($query))
{
$subscriptions[$post['tid']]['doticon'] = 1;

			}

			}

		}

// Read threads

		}

// Read threads

Zeile 1606Zeile 1638
		}

$icon_cache = $cache->read("posticons");

		}

$icon_cache = $cache->read("posticons");

		$threadprefixes = build_prefixes();

		$threadprefixes = build_prefixes();


$threads = '';



$threads = '';


Zeile 1628Zeile 1660
			// Sanitize
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);

			// Sanitize
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);





			// Build our links
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");

// Fetch the thread icon if we have one
if($thread['icon'] > 0 && $icon_cache[$thread['icon']])

			// Build our links
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");

// Fetch the thread icon if we have one
if($thread['icon'] > 0 && $icon_cache[$thread['icon']])

			{

			{

				$icon = $icon_cache[$thread['icon']];
$icon['path'] = str_replace("{theme}", $theme['imgdir'], $icon['path']);
$icon['path'] = htmlspecialchars_uni($icon['path']);

				$icon = $icon_cache[$thread['icon']];
$icon['path'] = str_replace("{theme}", $theme['imgdir'], $icon['path']);
$icon['path'] = htmlspecialchars_uni($icon['path']);

Zeile 1650Zeile 1682
			// Determine the folder
$folder = '';
$folder_label = '';

			// Determine the folder
$folder = '';
$folder_label = '';





			if(isset($thread['doticon']))
{
$folder = "dot_";

			if(isset($thread['doticon']))
{
$folder = "dot_";

Zeile 1665Zeile 1697
			if($mybb->settings['threadreadcut'] > 0)
{
$forum_read = $readforums[$thread['fid']];

			if($mybb->settings['threadreadcut'] > 0)
{
$forum_read = $readforums[$thread['fid']];





				$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($forum_read == 0 || $forum_read < $read_cutoff)
{
$forum_read = $read_cutoff;

				$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;
if($forum_read == 0 || $forum_read < $read_cutoff)
{
$forum_read = $read_cutoff;

				}
}


				}
}


			$cutoff = 0;
if($mybb->settings['threadreadcut'] > 0 && $thread['lastpost'] > $forum_read)
{

			$cutoff = 0;
if($mybb->settings['threadreadcut'] > 0 && $thread['lastpost'] > $forum_read)
{

Zeile 1684Zeile 1716
				if($thread['lastread'])
{
$lastread = $thread['lastread'];

				if($thread['lastread'])
{
$lastread = $thread['lastread'];

				}
else
{

				}
else
{

					$lastread = 1;
}
}

					$lastread = 1;
}
}

Zeile 1723Zeile 1755
			{
$folder .= "hot";
$folder_label .= $lang->icon_hot;

			{
$folder .= "hot";
$folder_label .= $lang->icon_hot;

			}


			}


			if($thread['closed'] == 1)
{
$folder .= "close";
$folder_label .= $lang->icon_close;

			if($thread['closed'] == 1)
{
$folder .= "close";
$folder_label .= $lang->icon_close;

			}


			}


			$folder .= "folder";

if($thread['visible'] == 0)
{
$bgcolor = "trow_shaded";

			$folder .= "folder";

if($thread['visible'] == 0)
{
$bgcolor = "trow_shaded";

			}


			}


			// Build last post info
$lastpostdate = my_date('relative', $thread['lastpost']);
if(!$lastposteruid && !$thread['lastposter'])
{
$lastposter = htmlspecialchars_uni($lang->guest);

			// Build last post info
$lastpostdate = my_date('relative', $thread['lastpost']);
if(!$lastposteruid && !$thread['lastposter'])
{
$lastposter = htmlspecialchars_uni($lang->guest);

			}
else

			}
else

			{
$lastposter = htmlspecialchars_uni($thread['lastposter']);
}

			{
$lastposter = htmlspecialchars_uni($thread['lastposter']);
}

Zeile 1758Zeile 1790
			else
{
$lastposterlink = build_profile_link($lastposter, $lastposteruid);

			else
{
$lastposterlink = build_profile_link($lastposter, $lastposteruid);

			}


			}


			$thread['replies'] = my_number_format($thread['replies']);
$thread['views'] = my_number_format($thread['views']);


			$thread['replies'] = my_number_format($thread['replies']);
$thread['views'] = my_number_format($thread['views']);


Zeile 1781Zeile 1813

// Provide remove options
eval("\$remove_options = \"".$templates->get("usercp_subscriptions_remove")."\";");


// Provide remove options
eval("\$remove_options = \"".$templates->get("usercp_subscriptions_remove")."\";");

	}
else

	}
else

	{
$remove_options = '';
eval("\$threads = \"".$templates->get("usercp_subscriptions_none")."\";");

	{
$remove_options = '';
eval("\$threads = \"".$templates->get("usercp_subscriptions_none")."\";");

Zeile 1900Zeile 1932
	if(!$forums)
{
eval("\$forums = \"".$templates->get("usercp_forumsubscriptions_none")."\";");

	if(!$forums)
{
eval("\$forums = \"".$templates->get("usercp_forumsubscriptions_none")."\";");

	}

	}


$plugins->run_hooks("usercp_forumsubscriptions_end");



$plugins->run_hooks("usercp_forumsubscriptions_end");


Zeile 1915Zeile 1947

$thread = get_thread($mybb->get_input('tid'));
if(!$thread || $thread['visible'] == -1)


$thread = get_thread($mybb->get_input('tid'));
if(!$thread || $thread['visible'] == -1)

	{

	{

		error($lang->error_invalidthread);
}


		error($lang->error_invalidthread);
}


Zeile 1943Zeile 1975
	add_subscribed_thread($thread['tid'], $mybb->get_input('notification', MyBB::INPUT_INT));

if($mybb->get_input('referrer'))

	add_subscribed_thread($thread['tid'], $mybb->get_input('notification', MyBB::INPUT_INT));

if($mybb->get_input('referrer'))

	{
$url = htmlspecialchars_uni($mybb->get_input('referrer'));













	{
$mybb->input['referrer'] = $mybb->get_input('referrer');

if(my_strpos($mybb->input['referrer'], $mybb->settings['bburl'].'/') !== 0)
{
if(my_strpos($mybb->input['referrer'], '/') === 0)
{
$mybb->input['referrer'] = my_substr($mybb->input['url'], 1);
}
$url_segments = explode('/', $mybb->input['referrer']);
$mybb->input['referrer'] = $mybb->settings['bburl'].'/'.end($url_segments);
}

$url = htmlspecialchars_uni($mybb->input['referrer']);

	}
else
{

	}
else
{

Zeile 1954Zeile 1998
}

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

}

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

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

if($mybb->get_input('type') == "forum")
{
$forum = get_forum($mybb->get_input('fid', MyBB::INPUT_INT));
if(!$forum)
{
error($lang->error_invalidforum);
}
$forumpermissions = forum_permissions($forum['fid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{
error_no_permission();
}

// check if the forum requires a password to view. If so, we need to show a form to the user
check_forum_password($forum['fid']);


{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

if($mybb->get_input('type') == "forum")
{
$forum = get_forum($mybb->get_input('fid', MyBB::INPUT_INT));
if(!$forum)
{
error($lang->error_invalidforum);
}
$forumpermissions = forum_permissions($forum['fid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{
error_no_permission();
}

// check if the forum requires a password to view. If so, we need to show a form to the user
check_forum_password($forum['fid']);


		// Naming of the hook retained for backward compatibility while dropping usercp2.php
$plugins->run_hooks("usercp2_addsubscription_forum");


		// Naming of the hook retained for backward compatibility while dropping usercp2.php
$plugins->run_hooks("usercp2_addsubscription_forum");


Zeile 2052Zeile 2096
	}
}


	}
}


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

if($mybb->input['action'] == "removesubscription" && ($mybb->request_method == "post" || verify_post_check($mybb->get_input('my_post_key'), true)))

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));





































































if($mybb->get_input('type') == "forum")
{
$forum = get_forum($mybb->get_input('fid', MyBB::INPUT_INT));
if(!$forum)
{
error($lang->error_invalidforum);
}

// check if the forum requires a password to view. If so, we need to show a form to the user
check_forum_password($forum['fid']);

// Naming of the hook retained for backward compatibility while dropping usercp2.php
$plugins->run_hooks("usercp2_removesubscription_forum");

remove_subscribed_forum($forum['fid']);
if($server_http_referer && $mybb->request_method != 'post')
{
$url = $server_http_referer;
}
else
{
$url = "usercp.php?action=forumsubscriptions";
}
redirect($url, $lang->redirect_forumsubscriptionremoved);
}
else
{
$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));
if(!$thread)
{
error($lang->error_invalidthread);
}

// Is the currently logged in user a moderator of this forum?
$ismod = is_moderator($thread['fid']);

// Make sure we are looking at a real thread here.
if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);
}

// check if the forum requires a password to view. If so, we need to show a form to the user
check_forum_password($thread['fid']);

// Naming of the hook retained for backward compatibility while dropping usercp2.php
$plugins->run_hooks("usercp2_removesubscription_thread");

remove_subscribed_thread($thread['tid']);
if($server_http_referer && $mybb->request_method != 'post')
{
$url = $server_http_referer;
}
else
{
$url = "usercp.php?action=subscriptions";
}
redirect($url, $lang->redirect_subscriptionremoved);
}
}

// Show remove subscription form when GET method and without valid my_post_key
if($mybb->input['action'] == "removesubscription")
{
$referrer = '';

	if($mybb->get_input('type') == "forum")
{
$forum = get_forum($mybb->get_input('fid', MyBB::INPUT_INT));
if(!$forum)
{
error($lang->error_invalidforum);

	if($mybb->get_input('type') == "forum")
{
$forum = get_forum($mybb->get_input('fid', MyBB::INPUT_INT));
if(!$forum)
{
error($lang->error_invalidforum);

 
		}

add_breadcrumb($lang->nav_forumsubscriptions, "usercp.php?action=forumsubscriptions");
add_breadcrumb($lang->nav_removesubscription);

$forumpermissions = forum_permissions($forum['fid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{
error_no_permission();

		}

// check if the forum requires a password to view. If so, we need to show a form to the user
check_forum_password($forum['fid']);

		}

// check if the forum requires a password to view. If so, we need to show a form to the user
check_forum_password($forum['fid']);

 

$lang->unsubscribe_from_forum = $lang->sprintf($lang->unsubscribe_from_forum, $forum['name']);


// Naming of the hook retained for backward compatibility while dropping usercp2.php


// Naming of the hook retained for backward compatibility while dropping usercp2.php

		$plugins->run_hooks("usercp2_removesubscription_forum");

		$plugins->run_hooks("usercp2_removesubscription_display_forum");





		remove_subscribed_forum($forum['fid']);
if($server_http_referer && $mybb->request_method != 'post')
{
$url = $server_http_referer;
}
else
{
$url = "usercp.php?action=forumsubscriptions";
}
redirect($url, $lang->redirect_forumsubscriptionremoved);

		eval("\$remove_forum_subscription = \"".$templates->get("usercp_removesubscription_forum")."\";");
output_page($remove_forum_subscription);
exit;








	}
else
{

	}
else
{

		$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));
if(!$thread)

		$thread  = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));
if(!$thread || $thread['visible'] == -1)

		{
error($lang->error_invalidthread);
}

		{
error($lang->error_invalidthread);
}

Zeile 2097Zeile 2210
		if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);

		if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);

 
		}

add_breadcrumb($lang->nav_subthreads, "usercp.php?action=subscriptions");
add_breadcrumb($lang->nav_removesubscription);

$forumpermissions = forum_permissions($thread['fid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0 || (isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']))
{
error_no_permission();

		}

// check if the forum requires a password to view. If so, we need to show a form to the user
check_forum_password($thread['fid']);

		}

// check if the forum requires a password to view. If so, we need to show a form to the user
check_forum_password($thread['fid']);


// Naming of the hook retained for backward compatibility while dropping usercp2.php
$plugins->run_hooks("usercp2_removesubscription_thread");

remove_subscribed_thread($thread['tid']);
if($server_http_referer && $mybb->request_method != 'post')
{
$url = $server_http_referer;
}
else
{
$url = "usercp.php?action=subscriptions";
}
redirect($url, $lang->redirect_subscriptionremoved);


require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
$thread['subject'] = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$lang->unsubscribe_from_thread = $lang->sprintf($lang->unsubscribe_from_thread, $thread['subject']);

// Naming of the hook retained for backward compatibility while dropping usercp2.php
$plugins->run_hooks("usercp2_removesubscription_display_thread");

eval("\$remove_thread_subscription = \"".$templates->get("usercp_removesubscription_thread")."\";");
output_page($remove_thread_subscription);
exit;


	}
}


	}
}


Zeile 2124Zeile 2245
	verify_post_check($mybb->get_input('my_post_key'));

if($mybb->get_input('type') == "forum")

	verify_post_check($mybb->get_input('my_post_key'));

if($mybb->get_input('type') == "forum")

	{

	{

		// Naming of the hook retained for backward compatibility while dropping usercp2.php
$plugins->run_hooks("usercp2_removesubscriptions_forum");

$db->delete_query("forumsubscriptions", "uid='".$mybb->user['uid']."'");

		// Naming of the hook retained for backward compatibility while dropping usercp2.php
$plugins->run_hooks("usercp2_removesubscriptions_forum");

$db->delete_query("forumsubscriptions", "uid='".$mybb->user['uid']."'");

		if($server_http_referer)
{

		if($server_http_referer)
{

			$url = $server_http_referer;
}
else

			$url = $server_http_referer;
}
else

Zeile 2148Zeile 2269
		if($server_http_referer)
{
$url = $server_http_referer;

		if($server_http_referer)
{
$url = $server_http_referer;

		}
else

		}
else

		{
$url = "usercp.php?action=subscriptions";
}
redirect($url, $lang->redirect_subscriptionsremoved);

		{
$url = "usercp.php?action=subscriptions";
}
redirect($url, $lang->redirect_subscriptionsremoved);

	}
}


	}
}


if($mybb->input['action'] == "do_editsig" && $mybb->request_method == "post")
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

if($mybb->input['action'] == "do_editsig" && $mybb->request_method == "post")
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


$plugins->run_hooks("usercp_do_editsig_start");

 

// User currently has a suspended signature
if($mybb->user['suspendsignature'] == 1 && $mybb->user['suspendsigtime'] > TIME_NOW)
{
error_no_permission();
}


// User currently has a suspended signature
if($mybb->user['suspendsignature'] == 1 && $mybb->user['suspendsigtime'] > TIME_NOW)
{
error_no_permission();
}

 

$plugins->run_hooks("usercp_do_editsig_start");


if($mybb->get_input('updateposts') == "enable")
{
$update_signature = array(
"includesig" => 1


if($mybb->get_input('updateposts') == "enable")
{
$update_signature = array(
"includesig" => 1

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

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

	elseif($mybb->get_input('updateposts') == "disable")
{
$update_signature = array(
"includesig" => 0
);
$db->update_query("posts", $update_signature, "uid='".$mybb->user['uid']."'");

	elseif($mybb->get_input('updateposts') == "disable")
{
$update_signature = array(
"includesig" => 0
);
$db->update_query("posts", $update_signature, "uid='".$mybb->user['uid']."'");

	}

	}

	$new_signature = array(
"signature" => $db->escape_string($mybb->get_input('signature'))
);

	$new_signature = array(
"signature" => $db->escape_string($mybb->get_input('signature'))
);

Zeile 2197Zeile 2318
{
$plugins->run_hooks("usercp_editsig_start");
if(!empty($mybb->input['preview']) && empty($error))

{
$plugins->run_hooks("usercp_editsig_start");
if(!empty($mybb->input['preview']) && empty($error))

	{

	{

		$sig = $mybb->get_input('signature');
$template = "usercp_editsig_preview";

		$sig = $mybb->get_input('signature');
$template = "usercp_editsig_preview";

	}

	}

	elseif(empty($error))

	elseif(empty($error))

	{

	{

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

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

	}
else
{

	}
else
{

		$sig = $mybb->get_input('signature');
$template = false;
}

		$sig = $mybb->get_input('signature');
$template = false;
}

Zeile 2302Zeile 2423
		$sig = htmlspecialchars_uni($sig);
$lang->edit_sig_note2 = $lang->sprintf($lang->edit_sig_note2, $sigsmilies, $sigmycode, $sigimgcode, $sightml, $mybb->settings['siglength']);


		$sig = htmlspecialchars_uni($sig);
$lang->edit_sig_note2 = $lang->sprintf($lang->edit_sig_note2, $sigsmilies, $sigmycode, $sigimgcode, $sightml, $mybb->settings['siglength']);


		if($mybb->settings['bbcodeinserter'] != 0 || $mybb->user['showcodebuttons'] != 0)

		if($mybb->settings['sigmycode'] != 0 && $mybb->settings['bbcodeinserter'] != 0 && $mybb->user['showcodebuttons'] != 0)

		{
$codebuttons = build_mycode_inserter("signature");
}

		{
$codebuttons = build_mycode_inserter("signature");
}

Zeile 2384Zeile 2505
			// Rating?
$types = array('g', 'pg', 'r', 'x');
$rating = $mybb->settings['useravatarrating'];

			// Rating?
$types = array('g', 'pg', 'r', 'x');
$rating = $mybb->settings['useravatarrating'];





			if(!in_array($rating, $types))
{
$rating = 'g';

			if(!in_array($rating, $types))
{
$rating = 'g';

Zeile 2428Zeile 2549
					if(!$type)
{
$avatar_error = $lang->error_invalidavatarurl;

					if(!$type)
{
$avatar_error = $lang->error_invalidavatarurl;

					}

					}

				}
}


				}
}


Zeile 2443Zeile 2564
						$avatar_error = $lang->error_avatartoobig;
}
}

						$avatar_error = $lang->error_avatartoobig;
}
}

 
			}

// Limiting URL string to stay within database limit
if(strlen($mybb->input['avatarurl']) > 200)
{
$avatar_error = $lang->error_avatarurltoolong;

			}

if(empty($avatar_error))

			}

if(empty($avatar_error))

Zeile 2934Zeile 3061
			else
{
$error_message = $lang->cant_add_self_to_buddy_list;

			else
{
$error_message = $lang->cant_add_self_to_buddy_list;

			}

			}

		}

		}





		if(count($existing_users) == 0)
{
$message = "";

		if(count($existing_users) == 0)
{
$message = "";





			if($sent === true)
{
$message = $lang->buddyrequests_sent_success;

			if($sent === true)
{
$message = $lang->buddyrequests_sent_success;

Zeile 2986Zeile 3113
				if(my_substr($new_list, -1) == ",")
{
$new_list = my_substr($new_list, 0, my_strlen($new_list)-2);

				if(my_substr($new_list, -1) == ",")
{
$new_list = my_substr($new_list, 0, my_strlen($new_list)-2);

				}

$user['buddylist'] = $db->escape_string($new_list);


				}

$user['buddylist'] = $db->escape_string($new_list);


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


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


Zeile 3069Zeile 3196
			if($new_list == "")
{
echo "\$(\"#".$mybb->get_input('manage')."_count\").html(\"0\");\n";

			if($new_list == "")
{
echo "\$(\"#".$mybb->get_input('manage')."_count\").html(\"0\");\n";

 
				echo "\$(\"#buddylink\").remove();\n";


				if($mybb->get_input('manage') == "ignored")
{
echo "\$(\"#ignore_list\").html(\"<li>{$lang->ignore_list_empty}</li>\");\n";

				if($mybb->get_input('manage') == "ignored")
{
echo "\$(\"#ignore_list\").html(\"<li>{$lang->ignore_list_empty}</li>\");\n";

Zeile 3154Zeile 3283
			}
eval("\$ignore_list .= \"".$templates->get("usercp_editlists_user")."\";");
++$ignore_count;

			}
eval("\$ignore_list .= \"".$templates->get("usercp_editlists_user")."\";");
++$ignore_count;

		}

		}

	}

$lang->current_ignored_users = $lang->sprintf($lang->current_ignored_users, $ignore_count);

	}

$lang->current_ignored_users = $lang->sprintf($lang->current_ignored_users, $ignore_count);

Zeile 3319Zeile 3448

eval("\$draftlist = \"".$templates->get("usercp_drafts")."\";");
output_page($draftlist);


eval("\$draftlist = \"".$templates->get("usercp_drafts")."\";");
output_page($draftlist);

}


}


if($mybb->input['action'] == "do_drafts" && $mybb->request_method == "post")
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

if($mybb->input['action'] == "do_drafts" && $mybb->request_method == "post")
{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


$plugins->run_hooks("usercp_do_drafts_start");




	$mybb->input['deletedraft'] = $mybb->get_input('deletedraft', MyBB::INPUT_ARRAY);
if(empty($mybb->input['deletedraft']))
{
error($lang->no_drafts_selected);
}

	$mybb->input['deletedraft'] = $mybb->get_input('deletedraft', MyBB::INPUT_ARRAY);
if(empty($mybb->input['deletedraft']))
{
error($lang->no_drafts_selected);
}

 

$plugins->run_hooks("usercp_do_drafts_start");


	$pidin = array();
$tidin = array();

	$pidin = array();
$tidin = array();

 


	foreach($mybb->input['deletedraft'] as $id => $val)
{
if($val == "post")

	foreach($mybb->input['deletedraft'] as $id => $val)
{
if($val == "post")

Zeile 3368Zeile 3500
	$plugins->run_hooks("usercp_do_drafts_end");
redirect("usercp.php?action=drafts", $lang->selected_drafts_deleted);
}

	$plugins->run_hooks("usercp_do_drafts_end");
redirect("usercp.php?action=drafts", $lang->selected_drafts_deleted);
}





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

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

	$plugins->run_hooks("usercp_usergroups_start");

 
	$ingroups = ",".$mybb->user['usergroup'].",".$mybb->user['additionalgroups'].",".$mybb->user['displaygroup'].",";

	$ingroups = ",".$mybb->user['usergroup'].",".$mybb->user['additionalgroups'].",".$mybb->user['displaygroup'].",";





	$usergroups = $mybb->cache->read('usergroups');

	$usergroups = $mybb->cache->read('usergroups');

 

$plugins->run_hooks("usercp_usergroups_start");


// Changing our display group
if($mybb->get_input('displaygroup', MyBB::INPUT_INT))


// Changing our display group
if($mybb->get_input('displaygroup', MyBB::INPUT_INT))

Zeile 3632Zeile 3765
	$showmemberof = false;
if($mybb->user['additionalgroups'])
{

	$showmemberof = false;
if($mybb->user['additionalgroups'])
{

		$query = $db->simple_select("usergroups", "*", "gid IN (".$mybb->user['additionalgroups'].") AND gid !='".$mybb->user['usergroup']."'", array('order_by' => 'title'));








		$additionalgroups = implode(
',',
array_map(
'intval',
explode(',', $mybb->user['additionalgroups'])
)
);
$query = $db->simple_select("usergroups", "*", "gid IN (".$additionalgroups.") AND gid !='".$mybb->user['usergroup']."'", array('order_by' => 'title'));

		while($usergroup = $db->fetch_array($query))
{
$showmemberof = true;

		while($usergroup = $db->fetch_array($query))
{
$showmemberof = true;

Zeile 3687Zeile 3827
	$existinggroups = $mybb->user['usergroup'];
if($mybb->user['additionalgroups'])
{

	$existinggroups = $mybb->user['usergroup'];
if($mybb->user['additionalgroups'])
{

		$existinggroups .= ",".$mybb->user['additionalgroups'];








		$additionalgroups = implode(
',',
array_map(
'intval',
explode(',', $mybb->user['additionalgroups'])
)
);
$existinggroups .= ",".$additionalgroups;

	}

	}





	$joinablegroups = $joinablegrouplist = '';
$query = $db->simple_select("usergroups", "*", "(type='3' OR type='4' OR type='5') AND gid NOT IN ($existinggroups)", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))

	$joinablegroups = $joinablegrouplist = '';
$query = $db->simple_select("usergroups", "*", "(type='3' OR type='4' OR type='5') AND gid NOT IN ($existinggroups)", array('order_by' => 'title'));
while($usergroup = $db->fetch_array($query))

Zeile 3699Zeile 3846
		$description = '';
$usergroup['title'] = htmlspecialchars_uni($usergroup['title']);
if($usergroup['description'])

		$description = '';
$usergroup['title'] = htmlspecialchars_uni($usergroup['title']);
if($usergroup['description'])

		{

		{

			$usergroup['description'] = htmlspecialchars_uni($usergroup['description']);
eval("\$description = \"".$templates->get("usercp_usergroups_joinable_usergroup_description")."\";");

			$usergroup['description'] = htmlspecialchars_uni($usergroup['description']);
eval("\$description = \"".$templates->get("usercp_usergroups_joinable_usergroup_description")."\";");

		}

		}


// Moderating join requests?
if($usergroup['type'] == 4)


// Moderating join requests?
if($usergroup['type'] == 4)

		{

		{

			$conditions = $lang->usergroup_joins_moderated;
}

			$conditions = $lang->usergroup_joins_moderated;
}

		elseif($usergroup['type'] == 5)
{
$conditions = $lang->usergroup_joins_invite;
}
else

		elseif($usergroup['type'] == 5)
{
$conditions = $lang->usergroup_joins_invite;
}
else

		{
$conditions = $lang->usergroup_joins_anyone;
}

		{
$conditions = $lang->usergroup_joins_anyone;
}

Zeile 3722Zeile 3869
		{
$applydate = my_date('relative', $appliedjoin[$usergroup['gid']]);
$joinlink = $lang->sprintf($lang->join_group_applied, $applydate);

		{
$applydate = my_date('relative', $appliedjoin[$usergroup['gid']]);
$joinlink = $lang->sprintf($lang->join_group_applied, $applydate);

		}

		}

		elseif(isset($appliedjoin[$usergroup['gid']]) && $usergroup['type'] == 5)
{
$joinlink = $lang->sprintf($lang->pending_invitation, $usergroup['gid'], $mybb->post_code);

		elseif(isset($appliedjoin[$usergroup['gid']]) && $usergroup['type'] == 5)
{
$joinlink = $lang->sprintf($lang->pending_invitation, $usergroup['gid'], $mybb->post_code);

		}

		}

		elseif($usergroup['type'] == 5)

		elseif($usergroup['type'] == 5)

		{

		{

			$joinlink = "--";

			$joinlink = "--";

		}
else
{

		}
else
{

			eval("\$joinlink = \"".$templates->get("usercp_usergroups_joinable_usergroup_join")."\";");
}


			eval("\$joinlink = \"".$templates->get("usercp_usergroups_joinable_usergroup_join")."\";");
}


Zeile 3748Zeile 3895
				$comma = $lang->comma;
}
$usergroupleaders = $lang->usergroup_leaders." ".$usergroupleaders;

				$comma = $lang->comma;
}
$usergroupleaders = $lang->usergroup_leaders." ".$usergroupleaders;

		}


		}


		if(my_strpos($usergroupleaders, $mybb->user['username']) === false)
{
// User is already a leader of the group, so don't show as a "Join Group"

		if(my_strpos($usergroupleaders, $mybb->user['username']) === false)
{
// User is already a leader of the group, so don't show as a "Join Group"

Zeile 3765Zeile 3912

eval("\$groupmemberships = \"".$templates->get("usercp_usergroups")."\";");
output_page($groupmemberships);


eval("\$groupmemberships = \"".$templates->get("usercp_usergroups")."\";");
output_page($groupmemberships);

}

}


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


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

	$plugins->run_hooks("usercp_attachments_start");

 
	require_once MYBB_ROOT."inc/functions_upload.php";

if($mybb->settings['enableattachments'] == 0)

	require_once MYBB_ROOT."inc/functions_upload.php";

if($mybb->settings['enableattachments'] == 0)

	{

	{

		error($lang->attachments_disabled);

		error($lang->attachments_disabled);

	}



	}

$plugins->run_hooks("usercp_attachments_start");


// Get unviewable forums
$f_perm_sql = '';


// Get unviewable forums
$f_perm_sql = '';

Zeile 3791Zeile 3939
	}

$attachments = '';

	}

$attachments = '';


$query = $db->simple_select("attachments", "SUM(filesize) AS ausage, COUNT(aid) AS acount", "uid='".$mybb->user['uid']."'");
$usage = $db->fetch_array($query);
$totalattachments = $usage['acount'];

 

// Pagination
if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$mybb->settings['threadsperpage'] = 20;


// Pagination
if(!$mybb->settings['threadsperpage'] || (int)$mybb->settings['threadsperpage'] < 1)
{
$mybb->settings['threadsperpage'] = 20;

	}


	}


	$perpage = $mybb->settings['threadsperpage'];
$page = $mybb->get_input('page', MyBB::INPUT_INT);

if($page > 0)
{
$start = ($page-1) * $perpage;

	$perpage = $mybb->settings['threadsperpage'];
$page = $mybb->get_input('page', MyBB::INPUT_INT);

if($page > 0)
{
$start = ($page-1) * $perpage;

		$pages = ceil($totalattachments / $perpage);
if($page > $pages)
{
$start = 0;
$page = 1;
}

 
	}
else
{
$start = 0;
$page = 1;
}

	}
else
{
$start = 0;
$page = 1;
}





	$end = $start + $perpage;
$lower = $start+1;


	$end = $start + $perpage;
$lower = $start+1;


Zeile 3833Zeile 3971
		ORDER BY p.dateline DESC LIMIT {$start}, {$perpage}
");


		ORDER BY p.dateline DESC LIMIT {$start}, {$perpage}
");


	$bandwidth = $totaldownloads = 0;

	$bandwidth = $totaldownloads = $totalusage = $totalattachments = $processedattachments = 0;

	while($attachment = $db->fetch_array($query))
{
if($attachment['dateline'] && $attachment['tid'])

	while($attachment = $db->fetch_array($query))
{
if($attachment['dateline'] && $attachment['tid'])

		{

		{

			$attachment['subject'] = htmlspecialchars_uni($parser->parse_badwords($attachment['subject']));
$attachment['postlink'] = get_post_link($attachment['pid'], $attachment['tid']);
$attachment['threadlink'] = get_thread_link($attachment['tid']);

			$attachment['subject'] = htmlspecialchars_uni($parser->parse_badwords($attachment['subject']));
$attachment['postlink'] = get_post_link($attachment['pid'], $attachment['tid']);
$attachment['threadlink'] = get_thread_link($attachment['tid']);

Zeile 3846Zeile 3984
			$size = get_friendly_size($attachment['filesize']);
$icon = get_attachment_icon(get_extension($attachment['filename']));
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);

			$size = get_friendly_size($attachment['filesize']);
$icon = get_attachment_icon(get_extension($attachment['filename']));
$attachment['filename'] = htmlspecialchars_uni($attachment['filename']);





			$sizedownloads = $lang->sprintf($lang->attachment_size_downloads, $size, $attachment['downloads']);
$attachdate = my_date('relative', $attachment['dateline']);
$altbg = alt_trow();

eval("\$attachments .= \"".$templates->get("usercp_attachments_attachment")."\";");

			$sizedownloads = $lang->sprintf($lang->attachment_size_downloads, $size, $attachment['downloads']);
$attachdate = my_date('relative', $attachment['dateline']);
$altbg = alt_trow();

eval("\$attachments .= \"".$templates->get("usercp_attachments_attachment")."\";");





			// Add to bandwidth total
$bandwidth += ($attachment['filesize'] * $attachment['downloads']);
$totaldownloads += $attachment['downloads'];

			// Add to bandwidth total
$bandwidth += ($attachment['filesize'] * $attachment['downloads']);
$totaldownloads += $attachment['downloads'];

 
			$totalusage += $attachment['filesize'];
++$totalattachments;

		}
else
{
// This little thing delets attachments without a thread/post
remove_attachment($attachment['pid'], $attachment['posthash'], $attachment['aid']);
}

		}
else
{
// This little thing delets attachments without a thread/post
remove_attachment($attachment['pid'], $attachment['posthash'], $attachment['aid']);
}

 
		++$processedattachments;
}

if($processedattachments >= $perpage || $page > 1)
{
$query = $db->query("
SELECT SUM(a.filesize) AS ausage, COUNT(a.aid) AS acount
FROM ".TABLE_PREFIX."attachments a
LEFT JOIN ".TABLE_PREFIX."posts p ON (a.pid=p.pid)
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
WHERE a.uid='".$mybb->user['uid']."' {$f_perm_sql}
");
$usage = $db->fetch_array($query);
$totalusage = $usage['ausage'];
$totalattachments = $usage['acount'];

$multipage = multipage($totalattachments, $perpage, $page, "usercp.php?action=attachments");

	}


	}


	$totalusage = $usage['ausage'];

 
	$friendlyusage = get_friendly_size((int)$totalusage);
if($mybb->usergroup['attachquota'])
{

	$friendlyusage = get_friendly_size((int)$totalusage);
if($mybb->usergroup['attachquota'])
{

Zeile 3879Zeile 4035
		$usagenote = $lang->sprintf($lang->attachments_usage, $friendlyusage, $totalattachments);
}


		$usagenote = $lang->sprintf($lang->attachments_usage, $friendlyusage, $totalattachments);
}


	$multipage = multipage($totalattachments, $perpage, $page, "usercp.php?action=attachments");

 
	$bandwidth = get_friendly_size($bandwidth);

if(!$attachments)

	$bandwidth = get_friendly_size($bandwidth);

if(!$attachments)

Zeile 3899Zeile 4054
	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


	// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


	$plugins->run_hooks("usercp_do_attachments_start");

 
	require_once MYBB_ROOT."inc/functions_upload.php";
if(!isset($mybb->input['attachments']) || !is_array($mybb->input['attachments']))
{
error($lang->no_attachments_selected);
}

	require_once MYBB_ROOT."inc/functions_upload.php";
if(!isset($mybb->input['attachments']) || !is_array($mybb->input['attachments']))
{
error($lang->no_attachments_selected);
}

 

$plugins->run_hooks("usercp_do_attachments_start");


// Get unviewable forums
$f_perm_sql = '';


// Get unviewable forums
$f_perm_sql = '';