Vergleich usercp.php - 1.6.0 - 1.6.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: usercp.php 5142 2010-07-29 23:36:56Z RyanGordon $

 * $Id: usercp.php 5765 2012-03-27 09:52:45Z Tomm $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

Zeile 402Zeile 402
	$query = $db->simple_select("profilefields", "*", "editable=1", array('order_by' => 'disporder'));
while($profilefield = $db->fetch_array($query))
{

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

 
		// Does this field have a minimum post count?
if($profilefield['postnum'] && $profilefield['postnum'] > $user['postnum'])
{
continue;
}


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

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

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

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

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

Zeile 493Zeile 500
						$checked = " checked=\"checked\"";
}
$code .= "<input type=\"radio\" class=\"radio\" name=\"profile_fields[$field]\" value=\"$val\"$checked /> <span class=\"smalltext\">$val</span><br />";

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

				}
}

				}
}

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

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

Zeile 576Zeile 583
		{
$defaulttitle = $mybb->usergroup['usertitle'];
}

		{
$defaulttitle = $mybb->usergroup['usertitle'];
}

		if(empty($user['usertitle']))



if(trim($user['usertitle']) == '')

		{
$lang->current_custom_usertitle = '';
}

		{
$lang->current_custom_usertitle = '';
}

Zeile 587Zeile 595
				$newtitle = htmlspecialchars_uni($user['usertitle']);
$user['usertitle'] = $mybb->user['usertitle'];
}

				$newtitle = htmlspecialchars_uni($user['usertitle']);
$user['usertitle'] = $mybb->user['usertitle'];
}

		}

		}

		eval("\$customtitle = \"".$templates->get("usercp_profile_customtitle")."\";");
}
else

		eval("\$customtitle = \"".$templates->get("usercp_profile_customtitle")."\";");
}
else

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

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

	}
else
{

	}
else
{

		$user = $mybb->user;
}
$languages = $lang->get_languages();
$langoptions = '';
foreach($languages as $lname => $language)

		$user = $mybb->user;
}
$languages = $lang->get_languages();
$langoptions = '';
foreach($languages as $lname => $language)

	{

	{

		$sel = "";
if($user['language'] == $lname)
{

		$sel = "";
if($user['language'] == $lname)
{

Zeile 702Zeile 710
	else
{
$allownoticescheck = "";

	else
{
$allownoticescheck = "";

	}

	}


if($user['invisible'] == 1)
{
$invisiblecheck = "checked=\"checked\"";


if($user['invisible'] == 1)
{
$invisiblecheck = "checked=\"checked\"";

	}
else

	}
else

	{
$invisiblecheck = "";
}

if($user['hideemail'] == 1)

	{
$invisiblecheck = "";
}

if($user['hideemail'] == 1)

	{

	{

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

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

Zeile 725Zeile 733
	if($user['subscriptionmethod'] == 1)
{
$no_email_subscribe_selected = "selected=\"selected\"";

	if($user['subscriptionmethod'] == 1)
{
$no_email_subscribe_selected = "selected=\"selected\"";

	}

	}

	else if($user['subscriptionmethod'] == 2)
{
$instant_email_subscribe_selected = "selected=\"selected\"";

	else if($user['subscriptionmethod'] == 2)
{
$instant_email_subscribe_selected = "selected=\"selected\"";

	}
else

	}
else


{
$no_subscribe_selected = "selected=\"selected\"";


{
$no_subscribe_selected = "selected=\"selected\"";

Zeile 739Zeile 747
	if($user['showsigs'] == 1)
{
$showsigscheck = "checked=\"checked\"";

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

	}
else
{

	}
else
{

		$showsigscheck = "";
}


		$showsigscheck = "";
}


Zeile 752Zeile 760
	else
{
$showavatarscheck = "";

	else
{
$showavatarscheck = "";

	}


	}


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

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

	}
else

	}
else

	{
$showquickreplycheck = "";
}

if($user['receivepms'] == 1)

	{
$showquickreplycheck = "";
}

if($user['receivepms'] == 1)

	{

	{

		$receivepmscheck = "checked=\"checked\"";

		$receivepmscheck = "checked=\"checked\"";

	}

	}

	else
{
$receivepmscheck = "";

	else
{
$receivepmscheck = "";

	}


	}


	if($user['receivefrombuddy'] == 1)
{
$receivefrombuddycheck = "checked=\"checked\"";

	if($user['receivefrombuddy'] == 1)
{
$receivefrombuddycheck = "checked=\"checked\"";

Zeile 1176Zeile 1184
if($mybb->input['action'] == "subscriptions")
{
$plugins->run_hooks("usercp_subscriptions_start");

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

 

// Thread visiblity
$visible = "AND t.visible != 0";
if(is_moderator() == true)
{
$visible = '';
}


// Do Multi Pages


// Do Multi Pages

	$query = $db->simple_select("threadsubscriptions", "COUNT(tid) AS threads", "uid='".$mybb->user['uid']."'");






	$query = $db->query("
SELECT COUNT(ts.tid) as threads
FROM ".TABLE_PREFIX."threadsubscriptions ts
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid = ts.tid)
WHERE ts.uid = '".$mybb->user['uid']."' {$visible}
");

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

if(!$mybb->settings['threadsperpage'])

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

if(!$mybb->settings['threadsperpage'])

Zeile 1214Zeile 1234
		LEFT JOIN ".TABLE_PREFIX."threads t ON (s.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid=t.prefix)

		LEFT JOIN ".TABLE_PREFIX."threads t ON (s.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid=t.prefix)

		WHERE s.uid='".$mybb->user['uid']."'

		WHERE s.uid='".$mybb->user['uid']."' {$visible}

		ORDER BY t.lastpost DESC
LIMIT $start, $perpage
");
while($subscription = $db->fetch_array($query))
{
$forumpermissions = $fpermissions[$subscription['fid']];

		ORDER BY t.lastpost DESC
LIMIT $start, $perpage
");
while($subscription = $db->fetch_array($query))
{
$forumpermissions = $fpermissions[$subscription['fid']];

		// Only keep if we're allowed to view them
if($forumpermissions['canview'] != 0 || $forumpermissions['canviewthreads'] != 0)
{
$subscriptions[$subscription['tid']] = $subscription;
}
// Hmm, you don't have permission to view - unsubscribe!
else if($subscription['tid'])
{


if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{
// Hmm, you don't have permission to view this thread - unsubscribe!





			$del_subscriptions[] = $subscription['tid'];

			$del_subscriptions[] = $subscription['tid'];

 
		}
else if($subscription['tid'])
{
$subscriptions[$subscription['tid']] = $subscription;

		}
}

		}
}





	if(is_array($del_subscriptions))
{
$tids = implode(',', $del_subscriptions);

	if(is_array($del_subscriptions))
{
$tids = implode(',', $del_subscriptions);

 


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

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

 
		}

$threadcount = $threadcount - count($del_subscriptions);

if($threadcount < 0)
{
$threadcount = 0;

		}
}


		}
}


Zeile 1256Zeile 1284
				ORDER BY pid, disporder
");


				ORDER BY pid, disporder
");


			$forumsread = unserialize($mybb->cookies['mybb']['forumread']);

			$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);

		}
else
{

		}
else
{

Zeile 1269Zeile 1297
				ORDER BY pid, disporder
");
}

				ORDER BY pid, disporder
");
}

 


		while($forum = $db->fetch_array($query))
{
if($mybb->user['uid'] == 0)

		while($forum = $db->fetch_array($query))
{
if($mybb->user['uid'] == 0)

Zeile 1373Zeile 1402

if($thread['lastpost'] > $cutoff)
{


if($thread['lastpost'] > $cutoff)
{

				if($thread['lastpost'] > $cutoff)

				if($thread['lastread'])

				{

				{

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

					$lastread = $thread['lastread'];
}
else
{
$lastread = 1;




				}
}


				}
}


Zeile 1399Zeile 1425
				}
}


				}
}


			if($thread['lastpost'] > $lastread && $lastread)

			if($lastread && $lastread < $thread['lastpost'])

			{
$folder .= "new";
$folder_label .= $lang->icon_new;

			{
$folder .= "new";
$folder_label .= $lang->icon_new;

Zeile 1428Zeile 1454

$folder .= "folder";



$folder .= "folder";


			// Build last post info




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





 
			// Build last post info

			$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
$lastposter = $thread['lastposter'];

			$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
$lastposter = $thread['lastposter'];

Zeile 1474Zeile 1504
	eval("\$subscriptions = \"".$templates->get("usercp_subscriptions")."\";");
output_page($subscriptions);
}

	eval("\$subscriptions = \"".$templates->get("usercp_subscriptions")."\";");
output_page($subscriptions);
}

 


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

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

	$query = $db->simple_select("forumpermissions", "*", "gid='".$db->escape_string($mybb->user['usergroup'])."'");
while($permissions = $db->fetch_array($query))
{
$permissioncache[$permissions['gid']][$permissions['fid']] = $permissions;
}

 
	
if($mybb->user['uid'] == 0)

	
if($mybb->user['uid'] == 0)

	{
// Build a forum cache.
$query = $db->query("

	{
// Build a forum cache.
$query = $db->query("

			SELECT fid
FROM ".TABLE_PREFIX."forums
WHERE active != 0

			SELECT fid
FROM ".TABLE_PREFIX."forums
WHERE active != 0

			ORDER BY pid, disporder

			ORDER BY pid, disporder

		");


		");


		$forumsread = unserialize($mybb->cookies['mybb']['forumread']);

		$forumsread = my_unserialize($mybb->cookies['mybb']['forumread']);

	}
else
{

	}
else
{

Zeile 1506Zeile 1532
			ORDER BY pid, disporder
");
}

			ORDER BY pid, disporder
");
}

 


	while($forum = $db->fetch_array($query))
{
if($mybb->user['uid'] == 0)

	while($forum = $db->fetch_array($query))
{
if($mybb->user['uid'] == 0)

Zeile 1516Zeile 1543
			}
}
$readforums[$forum['fid']] = $forum['lastread'];

			}
}
$readforums[$forum['fid']] = $forum['lastread'];

	}

require_once MYBB_ROOT."inc/functions_forumlist.php";

$fpermissions = forum_permissions();

	}

$fpermissions = forum_permissions();
require_once MYBB_ROOT."inc/functions_forumlist.php";


	$query = $db->query("
SELECT fs.*, f.*, t.subject AS lastpostsubject, fr.dateline AS lastread
FROM ".TABLE_PREFIX."forumsubscriptions fs

	$query = $db->query("
SELECT fs.*, f.*, t.subject AS lastpostsubject, fr.dateline AS lastread
FROM ".TABLE_PREFIX."forumsubscriptions fs

Zeile 1530Zeile 1557
		WHERE f.type='f' AND fs.uid='".$mybb->user['uid']."'
ORDER BY f.name ASC
");

		WHERE f.type='f' AND fs.uid='".$mybb->user['uid']."'
ORDER BY f.name ASC
");

 


	$forums = '';
while($forum = $db->fetch_array($query))
{
$forum_url = get_forum_link($forum['fid']);
$forumpermissions = $fpermissions[$forum['fid']];

	$forums = '';
while($forum = $db->fetch_array($query))
{
$forum_url = get_forum_link($forum['fid']);
$forumpermissions = $fpermissions[$forum['fid']];

		if($forumpermissions['canview'] != 0)















if($forumpermissions['canview'] == 0)
{
continue;
}

$lightbulb = get_forum_lightbulb(array('open' => $forum['open'], 'lastread' => $forum['lastread']), array('lastpost' => $forum['lastpost']));
$folder = $lightbulb['folder'];

if($forum['lastpost'] == 0 || $forum['lastposter'] == "")
{
$lastpost = "<div align=\"center\">$lang->never</div>";
}
else

		{

		{

			$lightbulb = get_forum_lightbulb(array('open' => $forum['open'], 'lastread' => $forum['lastread']), array('lastpost' => $forum['lastpost']));
$folder = $lightbulb['folder'];
if($forum['lastpost'] == 0 || $forum['lastposter'] == "")





			$lastpost_date = my_date($mybb->settings['dateformat'], $forum['lastpost']);
$lastpost_time = my_date($mybb->settings['timeformat'], $forum['lastpost']);
$lastposttid = $forum['lastposttid'];
$lastposter = $forum['lastposter'];
$lastpost_profilelink = build_profile_link($lastposter, $forum['lastposteruid']);
$lastpost_subject = htmlspecialchars_uni($forum['lastpostsubject']);
if(my_strlen($lastpost_subject) > 25)

			{

			{

				$lastpost = "<div align=\"center\">$lang->never</div>";
}
else
{
$lastpost_date = my_date($mybb->settings['dateformat'], $forum['lastpost']);
$lastpost_time = my_date($mybb->settings['timeformat'], $forum['lastpost']);
$lastposttid = $forum['lastposttid'];
$lastposter = $forum['lastposter'];
$lastpost_profilelink = build_profile_link($lastposter, $forum['lastposteruid']);
$lastpost_subject = $forum['lastpostsubject'];
if(my_strlen($lastpost_subject) > 25)
{
$lastpost_subject = my_substr($lastpost_subject, 0, 25) . "...";
}
$lastpost_link = get_thread_link($forum['lastposttid'], 0, "lastpost");
eval("\$lastpost = \"".$templates->get("forumbit_depth2_forum_lastpost")."\";");

				$lastpost_subject = my_substr($lastpost_subject, 0, 25) . "...";
















			}

			}

 
			$lastpost_link = get_thread_link($forum['lastposttid'], 0, "lastpost");
eval("\$lastpost = \"".$templates->get("forumbit_depth2_forum_lastpost")."\";");

		}

		}

 


		$posts = my_number_format($forum['posts']);
$threads = my_number_format($forum['threads']);

		$posts = my_number_format($forum['posts']);
$threads = my_number_format($forum['threads']);

 


		if($mybb->settings['showdescriptions'] == 0)
{
$forum['description'] = "";
}

		if($mybb->settings['showdescriptions'] == 0)
{
$forum['description'] = "";
}

 


		eval("\$forums .= \"".$templates->get("usercp_forumsubscriptions_forum")."\";");

		eval("\$forums .= \"".$templates->get("usercp_forumsubscriptions_forum")."\";");

	}


	}


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

 


	eval("\$forumsubscriptions = \"".$templates->get("usercp_forumsubscriptions")."\";");
output_page($forumsubscriptions);
}

	eval("\$forumsubscriptions = \"".$templates->get("usercp_forumsubscriptions")."\";");
output_page($forumsubscriptions);
}

Zeile 1585Zeile 1623

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


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

	{

	{

		error_no_permission();

		error_no_permission();

	}

	}


if($mybb->input['updateposts'] == "enable")
{


if($mybb->input['updateposts'] == "enable")
{

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

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

	{

	{

		$update_signature = array(
"includesig" => 0
);

		$update_signature = array(
"includesig" => 0
);

Zeile 1610Zeile 1648
	$db->update_query("users", $new_signature, "uid='".$mybb->user['uid']."'");
$plugins->run_hooks("usercp_do_editsig_end");
redirect("usercp.php?action=editsig", $lang->redirect_sigupdated);

	$db->update_query("users", $new_signature, "uid='".$mybb->user['uid']."'");
$plugins->run_hooks("usercp_do_editsig_end");
redirect("usercp.php?action=editsig", $lang->redirect_sigupdated);





}

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

}

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

Zeile 1622Zeile 1660
		$template = "usercp_editsig_preview";
}
elseif(!$error)

		$template = "usercp_editsig_preview";
}
elseif(!$error)

	{

	{

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

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

	}

	}

	else if($error)

	else if($error)

	{

	{

		$sig = $mybb->input['signature'];
$template = false;

		$sig = $mybb->input['signature'];
$template = false;

	}

if(!$mybb->user['signature'] && ($mybb->user['suspendsignature'] && $mybb->user['suspendsigtime'] > TIME_NOW))

	}

if($mybb->user['suspendsignature'] && ($mybb->user['suspendsigtime'] == 0 || $mybb->user['suspendsigtime'] > 0 && $mybb->user['suspendsigtime'] > TIME_NOW))

	{
// User currently has no signature and they're suspended

	{
// User currently has no signature and they're suspended

 
		error($lang->sig_suspended);
}

if($mybb->usergroup['canusesig'] != 1)
{
// Usergroup has no permission to use this facility

		error_no_permission();

		error_no_permission();

 
	}
else if($mybb->usergroup['canusesig'] == 1 && $mybb->usergroup['canusesigxposts'] > 0 && $mybb->user['postnum'] < $mybb->usergroup['canusesigxposts'])
{
// Usergroup can use this facility, but only after x posts
error($lang->sprintf($lang->sig_suspended_posts, $mybb->usergroup['canusesigxposts']));

	}

if($sig && $template)

	}

if($sig && $template)

Zeile 1646Zeile 1695
			"allow_smilies" => $mybb->settings['sigsmilies'],
"allow_imgcode" => $mybb->settings['sigimgcode'],
"me_username" => $mybb->user['username'],

			"allow_smilies" => $mybb->settings['sigsmilies'],
"allow_imgcode" => $mybb->settings['sigimgcode'],
"me_username" => $mybb->user['username'],

 
			"filter_badwords" => 1

		);

$sigpreview = $parser->parse_message($sig, $sig_parser);

		);

$sigpreview = $parser->parse_message($sig, $sig_parser);

Zeile 2274Zeile 2324
	// Fetch out buddies
$buddy_count = 0;
if($mybb->user['buddylist'])

	// Fetch out buddies
$buddy_count = 0;
if($mybb->user['buddylist'])

	{

	{

		$type = "buddy";
$query = $db->simple_select("users", "*", "uid IN ({$mybb->user['buddylist']})", array("order_by" => "username"));

		$type = "buddy";
$query = $db->simple_select("users", "*", "uid IN ({$mybb->user['buddylist']})", array("order_by" => "username"));

		while($user = $db->fetch_array($query))
{
$profile_link = build_profile_link(format_name($user['username'], $user['usergroup'], $user['displaygroup']), $user['uid']);
if($user['lastactive'] > $timecut && ($user['invisible'] == 0 || $mybb->usergroup['canviewwolinvis'] == 1) && $user['lastvisit'] != $user['lastactive'])
{
$status = "online";
}
else
{

		while($user = $db->fetch_array($query))
{
$profile_link = build_profile_link(format_name($user['username'], $user['usergroup'], $user['displaygroup']), $user['uid']);
if($user['lastactive'] > $timecut && ($user['invisible'] == 0 || $mybb->usergroup['canviewwolinvis'] == 1) && $user['lastvisit'] != $user['lastactive'])
{
$status = "online";
}
else
{

				$status = "offline";
}
eval("\$buddy_list .= \"".$templates->get("usercp_editlists_user")."\";");
++$buddy_count;

				$status = "offline";
}
eval("\$buddy_list .= \"".$templates->get("usercp_editlists_user")."\";");
++$buddy_count;

		}
}

		}
}


$lang->current_buddies = $lang->sprintf($lang->current_buddies, $buddy_count);
if(!$buddy_list)


$lang->current_buddies = $lang->sprintf($lang->current_buddies, $buddy_count);
if(!$buddy_list)

	{
$buddy_list = "<li>{$lang->buddy_list_empty}</li>";

	{
$buddy_list = "<li>{$lang->buddy_list_empty}</li>";

	}

// Fetch out ignore list users

	}

// Fetch out ignore list users

Zeile 2318Zeile 2368
			}
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);
if(!$ignore_list)


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

Zeile 2457Zeile 2507

// Changing our display group
if($mybb->input['displaygroup'])


// Changing our display group
if($mybb->input['displaygroup'])

	{

	{

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(my_strpos($ingroups, ",".$mybb->input['displaygroup'].",") === false)

		// Verify incoming POST request
verify_post_check($mybb->input['my_post_key']);

if(my_strpos($ingroups, ",".$mybb->input['displaygroup'].",") === false)

		{

		{

			error($lang->not_member_of_group);
}
$query = $db->simple_select("usergroups", "*", "gid='".intval($mybb->input['displaygroup'])."'");
$dispgroup = $db->fetch_array($query);
if($dispgroup['candisplaygroup'] != 1)

			error($lang->not_member_of_group);
}
$query = $db->simple_select("usergroups", "*", "gid='".intval($mybb->input['displaygroup'])."'");
$dispgroup = $db->fetch_array($query);
if($dispgroup['candisplaygroup'] != 1)

		{

		{

			error($lang->cannot_set_displaygroup);
}
$db->update_query("users", array('displaygroup' => intval($mybb->input['displaygroup'])), "uid='".$mybb->user['uid']."'");

			error($lang->cannot_set_displaygroup);
}
$db->update_query("users", array('displaygroup' => intval($mybb->input['displaygroup'])), "uid='".$mybb->user['uid']."'");

Zeile 2485Zeile 2535
		verify_post_check($mybb->input['my_post_key']);

if(my_strpos($ingroups, ",".$mybb->input['leavegroup'].",") === false)

		verify_post_check($mybb->input['my_post_key']);

if(my_strpos($ingroups, ",".$mybb->input['leavegroup'].",") === false)

		{

		{

			error($lang->not_member_of_group);
}
if($mybb->user['usergroup'] == $mybb->input['leavegroup'])

			error($lang->not_member_of_group);
}
if($mybb->user['usergroup'] == $mybb->input['leavegroup'])

Zeile 2502Zeile 2552
		$plugins->run_hooks("usercp_usergroups_leave_group");
redirect("usercp.php?action=usergroups", $lang->left_group);
exit;

		$plugins->run_hooks("usercp_usergroups_leave_group");
redirect("usercp.php?action=usergroups", $lang->left_group);
exit;

	}


	}


	// Joining a group
if($mybb->input['joingroup'])
{

	// Joining a group
if($mybb->input['joingroup'])
{

Zeile 2642Zeile 2692
	else
{
$displaycode = '';

	else
{
$displaycode = '';

	}


	}


	eval("\$memberoflist = \"".$templates->get("usercp_usergroups_memberof_usergroup")."\";");
$showmemberof = false;
if($mybb->user['additionalgroups'])

	eval("\$memberoflist = \"".$templates->get("usercp_usergroups_memberof_usergroup")."\";");
$showmemberof = false;
if($mybb->user['additionalgroups'])

Zeile 2656Zeile 2706
			if($groupleader[$usergroup['gid']])
{
$leavelink = "<div style=\"text-align: center;\"><span class=\"smalltext\">$lang->usergroup_leave_leader</span></div>";

			if($groupleader[$usergroup['gid']])
{
$leavelink = "<div style=\"text-align: center;\"><span class=\"smalltext\">$lang->usergroup_leave_leader</span></div>";

			}

			}

			elseif($usergroup['type'] != 4 && $usergroup['type'] != 3)
{
$leavelink = "<div style=\"text-align: center;\"><span class=\"smalltext\">{$lang->usergroup_cannot_leave}</span></div>";

			elseif($usergroup['type'] != 4 && $usergroup['type'] != 3)
{
$leavelink = "<div style=\"text-align: center;\"><span class=\"smalltext\">{$lang->usergroup_cannot_leave}</span></div>";

			}

			}

			else
{
$leavelink = "<div style=\"text-align: center;\"><a href=\"usercp.php?action=usergroups&amp;leavegroup=".$usergroup['gid']."&amp;my_post_key={$mybb->post_code}\">".$lang->usergroup_leave."</a></div>";

			else
{
$leavelink = "<div style=\"text-align: center;\"><a href=\"usercp.php?action=usergroups&amp;leavegroup=".$usergroup['gid']."&amp;my_post_key={$mybb->post_code}\">".$lang->usergroup_leave."</a></div>";

			}

			}

			if($usergroup['description'])
{
$description = "<br /><span class=\"smalltext\">".$usergroup['description']."</span>";

			if($usergroup['description'])
{
$description = "<br /><span class=\"smalltext\">".$usergroup['description']."</span>";

			}

			}

			else
{
$description = '';

			else
{
$description = '';

Zeile 2676Zeile 2726
			if(!$usergroup['usertitle'])
{
// fetch title here

			if(!$usergroup['usertitle'])
{
// fetch title here

			}

			}

			$trow = alt_trow();
if($usergroup['candisplaygroup'] == 1 && $usergroup['gid'] == $mybb->user['displaygroup'])
{

			$trow = alt_trow();
if($usergroup['candisplaygroup'] == 1 && $usergroup['gid'] == $mybb->user['displaygroup'])
{

Zeile 2742Zeile 2792
		else
{
$joinlink = "<a href=\"usercp.php?action=usergroups&amp;joingroup={$usergroup['gid']}&amp;my_post_key={$mybb->post_code}\">{$lang->join_group}</a>";

		else
{
$joinlink = "<a href=\"usercp.php?action=usergroups&amp;joingroup={$usergroup['gid']}&amp;my_post_key={$mybb->post_code}\">{$lang->join_group}</a>";

		}

		}


$usergroupleaders = '';
if($groupleaders[$usergroup['gid']])


$usergroupleaders = '';
if($groupleaders[$usergroup['gid']])

Zeile 2763Zeile 2813
			// User is already a leader of the group, so don't show as a "Join Group"
eval("\$joinablegrouplist .= \"".$templates->get("usercp_usergroups_joinable_usergroup")."\";");
}

			// User is already a leader of the group, so don't show as a "Join Group"
eval("\$joinablegrouplist .= \"".$templates->get("usercp_usergroups_joinable_usergroup")."\";");
}

	}

	}

	if($joinablegrouplist)
{
eval("\$joinablegroups = \"".$templates->get("usercp_usergroups_joinable")."\";");

	if($joinablegrouplist)
{
eval("\$joinablegroups = \"".$templates->get("usercp_usergroups_joinable")."\";");

Zeile 2775Zeile 2825
	output_page($groupmemberships);
}
if($mybb->input['action'] == "attachments")

	output_page($groupmemberships);
}
if($mybb->input['action'] == "attachments")

{

{

	$plugins->run_hooks("usercp_attachments_start");
require_once MYBB_ROOT."inc/functions_upload.php";

	$plugins->run_hooks("usercp_attachments_start");
require_once MYBB_ROOT."inc/functions_upload.php";





	$attachments = '';

	$attachments = '';


$query = $db->simple_select("attachments", "SUM(filesize) AS ausage, COUNT(aid) AS acount", "uid='".$mybb->user['uid']."'");
$usage = $db->fetch_array($query);
$totalusage = $usage['ausage'];
$totalattachments = $usage['acount'];
$friendlyusage = get_friendly_size($totalusage);
if($mybb->usergroup['attachquota'])
{
$percent = round(($totalusage/($mybb->usergroup['attachquota']*1024))*100)."%";
$attachquota = get_friendly_size($mybb->usergroup['attachquota']*1024);
$usagenote = $lang->sprintf($lang->attachments_usage_quota, $friendlyusage, $attachquota, $percent, $totalattachments);
}
else
{
$percent = $lang->unlimited;
$attachquota = $lang->unlimited;
$usagenote = $lang->sprintf($lang->attachments_usage, $friendlyusage, $totalattachments);
}

 

// Pagination
if(!$mybb->settings['threadsperpage'])


// Pagination
if(!$mybb->settings['threadsperpage'])

	{

	{

		$mybb->settings['threadsperpage'] = 20;
}

		$mybb->settings['threadsperpage'] = 20;
}

 


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

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

	$page = intval($mybb->input['page']);

if(intval($mybb->input['page']) > 0)
{

	$page = intval($mybb->input['page']);

if(intval($mybb->input['page']) > 0)
{

		$start = ($page-1) *$perpage;
}
else

		$start = ($page-1) *$perpage;
}
else

	{

	{

		$start = 0;
$page = 1;
}

		$start = 0;
$page = 1;
}





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

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


if($end > $totalattachments)
{
$upper = $totalattachments;
}
$multipage = multipage($totalattachments, $perpage, $page, "usercp.php?action=attachments");

 

$query = $db->query("
SELECT a.*, p.subject, p.dateline, t.tid, t.subject AS threadsubject
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)


$query = $db->query("
SELECT a.*, p.subject, p.dateline, t.tid, t.subject AS threadsubject
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']."' AND a.pid!='0'

		WHERE a.uid='".$mybb->user['uid']."'

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

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

 


	$bandwidth = $totaldownloads = 0;
while($attachment = $db->fetch_array($query))
{

	$bandwidth = $totaldownloads = 0;
while($attachment = $db->fetch_array($query))
{

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

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

 


			$size = get_friendly_size($attachment['filesize']);
$icon = get_attachment_icon(get_extension($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($mybb->settings['dateformat'], $attachment['dateline']);
$attachtime = my_date($mybb->settings['timeformat'], $attachment['dateline']);
$altbg = alt_trow();

			$sizedownloads = $lang->sprintf($lang->attachment_size_downloads, $size, $attachment['downloads']);
$attachdate = my_date($mybb->settings['dateformat'], $attachment['dateline']);
$attachtime = my_date($mybb->settings['timeformat'], $attachment['dateline']);
$altbg = alt_trow();

 


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

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

		}

		}

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

	$bandwidth = get_friendly_size($bandwidth);






















$query = $db->simple_select("attachments", "SUM(filesize) AS ausage, COUNT(aid) AS acount", "uid='".$mybb->user['uid']."'");
$usage = $db->fetch_array($query);
$totalusage = $usage['ausage'];
$totalattachments = $usage['acount'];
$friendlyusage = get_friendly_size($totalusage);
if($mybb->usergroup['attachquota'])
{
$percent = round(($totalusage/($mybb->usergroup['attachquota']*1024))*100)."%";
$attachquota = get_friendly_size($mybb->usergroup['attachquota']*1024);
$usagenote = $lang->sprintf($lang->attachments_usage_quota, $friendlyusage, $attachquota, $percent, $totalattachments);
}
else
{
$percent = $lang->unlimited;
$attachquota = $lang->unlimited;
$usagenote = $lang->sprintf($lang->attachments_usage, $friendlyusage, $totalattachments);
}

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


if(!$attachments)
{


if(!$attachments)
{

Zeile 2875Zeile 2928
}

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

}

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

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

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


$plugins->run_hooks("usercp_do_attachments_start");
require_once MYBB_ROOT."inc/functions_upload.php";


$plugins->run_hooks("usercp_do_attachments_start");
require_once MYBB_ROOT."inc/functions_upload.php";

Zeile 2893Zeile 2946
	}
$plugins->run_hooks("usercp_do_attachments_end");
redirect("usercp.php?action=attachments", $lang->attachments_deleted);

	}
$plugins->run_hooks("usercp_do_attachments_end");
redirect("usercp.php?action=attachments", $lang->attachments_deleted);

}

}


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


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

Zeile 2905Zeile 2958
	$plugins->run_hooks("usercp_do_notepad_end");
redirect("usercp.php", $lang->redirect_notepadupdated);
}

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





if(!$mybb->input['action'])
{
// Get posts per day
$daysreg = (TIME_NOW - $mybb->user['regdate']) / (24*3600);

if(!$mybb->input['action'])
{
// Get posts per day
$daysreg = (TIME_NOW - $mybb->user['regdate']) / (24*3600);

 

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


	$perday = $mybb->user['postnum'] / $daysreg;
$perday = round($perday, 2);
if($perday > $mybb->user['postnum'])

	$perday = $mybb->user['postnum'] / $daysreg;
$perday = round($perday, 2);
if($perday > $mybb->user['postnum'])

Zeile 3069Zeile 3128
	$query = $db->simple_select("threadsubscriptions", "sid", "uid = '".$mybb->user['uid']."'", array("limit" => 1));
if($db->num_rows($query))
{

	$query = $db->simple_select("threadsubscriptions", "sid", "uid = '".$mybb->user['uid']."'", array("limit" => 1));
if($db->num_rows($query))
{

 
		$visible = "AND t.visible != 0";
if(is_moderator() == true)
{
$visible = '';
}


		$query = $db->query("
SELECT s.*, t.*, t.username AS threadusername, u.username
FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."threads t ON (s.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)

		$query = $db->query("
SELECT s.*, t.*, t.username AS threadusername, u.username
FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."threads t ON (s.tid=t.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)

			WHERE s.uid='".$mybb->user['uid']."'

			WHERE s.uid='".$mybb->user['uid']."' {$visible}

			ORDER BY t.lastpost DESC
LIMIT 0, 10
");

$fpermissions = forum_permissions();
while($subscription = $db->fetch_array($query))

			ORDER BY t.lastpost DESC
LIMIT 0, 10
");

$fpermissions = forum_permissions();
while($subscription = $db->fetch_array($query))

		{

		{

			$forumpermissions = $fpermissions[$subscription['fid']];
if($forumpermissions['canview'] != 0 || $forumpermissions['canviewthreads'] != 0)
{
$subscriptions[$subscription['tid']] = $subscription;

			$forumpermissions = $fpermissions[$subscription['fid']];
if($forumpermissions['canview'] != 0 || $forumpermissions['canviewthreads'] != 0)
{
$subscriptions[$subscription['tid']] = $subscription;

			}

			}

		}

if(is_array($subscriptions))

		}

if(is_array($subscriptions))

Zeile 3106Zeile 3171
					else
{
$subscriptions[$readthread['tid']]['lastread'] = $readthread['dateline'];

					else
{
$subscriptions[$readthread['tid']]['lastread'] = $readthread['dateline'];

					}
}
}


					}
}
}


			if($subscriptions)
{
if($mybb->settings['dotfolders'] != 0)

			if($subscriptions)
{
if($mybb->settings['dotfolders'] != 0)

Zeile 3125Zeile 3190
				
foreach($subscriptions as $thread)
{

				
foreach($subscriptions as $thread)
{

 
					$folder = '';
$folder_label = '';
$gotounread = '';


					if($thread['tid'])
{
$bgcolor = alt_trow();

					if($thread['tid'])
{
$bgcolor = alt_trow();

Zeile 3148Zeile 3217

// Icons
if($thread['icon'] > 0 && $icon_cache[$thread['icon']])


// Icons
if($thread['icon'] > 0 && $icon_cache[$thread['icon']])

						{

						{

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

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

						}
else
{

						}
else
{

							$icon = "&nbsp;";
}

if($thread['doticon'])

							$icon = "&nbsp;";
}

if($thread['doticon'])

						{

						{

							$folder = "dot_";
$folder_label .= $lang->icon_dot;
}

							$folder = "dot_";
$folder_label .= $lang->icon_dot;
}

Zeile 3173Zeile 3242
							eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
}
else

							eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
}
else

						{

						{

							$folder_label .= $lang->icon_no_new;
$new_class = "subject_old";
}

$folder .= "folder";

							$folder_label .= $lang->icon_no_new;
$new_class = "subject_old";
}

$folder .= "folder";

 

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

		
$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);

		
$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);

Zeile 3188Zeile 3262
						if($lastposteruid == 0)
{
$lastposterlink = $lastposter;

						if($lastposteruid == 0)
{
$lastposterlink = $lastposter;

						}

						}

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

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

Zeile 3213Zeile 3287
	if($unviewable_forums)
{
$f_perm_sql = "AND t.fid NOT IN (".$unviewable_forums.")";

	if($unviewable_forums)
{
$f_perm_sql = "AND t.fid NOT IN (".$unviewable_forums.")";

 
	}

$visible = " AND t.visible != 0";
if(is_moderator() == true)
{
$visible = '';

	}

$query = $db->query("
SELECT t.*, t.username AS threadusername, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)

	}

$query = $db->query("
SELECT t.*, t.username AS threadusername, u.username
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)

		WHERE t.uid='".$mybb->user['uid']."' {$f_perm_sql}

		WHERE t.uid='".$mybb->user['uid']."' AND t.firstpost != 0 AND t.visible != '-2' {$visible} {$f_perm_sql}

		ORDER BY t.lastpost DESC
LIMIT 0, 5
");

		ORDER BY t.lastpost DESC
LIMIT 0, 5
");

Zeile 3228Zeile 3308
	$threadcache = array();
$fpermissions = forum_permissions();
while($thread = $db->fetch_array($query))

	$threadcache = array();
$fpermissions = forum_permissions();
while($thread = $db->fetch_array($query))

	{

	{

		// Moderated, and not moderator?
if($thread['visible'] == 0 && is_moderator($thread['fid']) === false)
{

		// Moderated, and not moderator?
if($thread['visible'] == 0 && is_moderator($thread['fid']) === false)
{

Zeile 3237Zeile 3317

$forumpermissions = $fpermissions[$thread['fid']];
if($forumpermissions['canview'] != 0 || $forumpermissions['canviewthreads'] != 0)


$forumpermissions = $fpermissions[$thread['fid']];
if($forumpermissions['canview'] != 0 || $forumpermissions['canviewthreads'] != 0)

		{

		{

			$threadcache[$thread['tid']] = $thread;
}
}

			$threadcache[$thread['tid']] = $thread;
}
}

Zeile 3266Zeile 3346
			while($readthread = $db->fetch_array($query))
{
$threadcache[$readthread['tid']]['lastread'] = $readthread['dateline'];

			while($readthread = $db->fetch_array($query))
{
$threadcache[$readthread['tid']]['lastread'] = $readthread['dateline'];

			}
}

			}
}


// Icon Stuff
if($mybb->settings['dotfolders'] != 0)


// Icon Stuff
if($mybb->settings['dotfolders'] != 0)

Zeile 3297Zeile 3377
				
// If this thread has a prefix...
if($thread['prefix'] != 0)

				
// If this thread has a prefix...
if($thread['prefix'] != 0)

				{

				{

					$query = $db->simple_select('threadprefixes', 'prefix, displaystyle', "pid='{$thread['prefix']}'");
$threadprefix = $db->fetch_array($query);


					$query = $db->simple_select('threadprefixes', 'prefix, displaystyle', "pid='{$thread['prefix']}'");
$threadprefix = $db->fetch_array($query);


Zeile 3306Zeile 3386
				else
{
$thread['displayprefix'] = '';

				else
{
$thread['displayprefix'] = '';

				}


				}


				$thread['subject'] = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['threadlink'] = get_thread_link($thread['tid']);

				$thread['subject'] = $parser->parse_badwords($thread['subject']);
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['threadlink'] = get_thread_link($thread['tid']);

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

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

 
				}

// Is our thread visible?
if($thread['visible'] == 0)
{
$bgcolor = 'trow_shaded';

				}

if($thread['closed'] == 1)

				}

if($thread['closed'] == 1)