Vergleich usercp.php - 1.6.0 - 1.6.6

  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 5616 2011-09-20 13:24:59Z 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 410Zeile 417
		$field = "fid{$profilefield['fid']}";
$select = '';
if($errors)

		$field = "fid{$profilefield['fid']}";
$select = '';
if($errors)

		{

		{

			$userfield = $mybb->input['profile_fields'][$field];

			$userfield = $mybb->input['profile_fields'][$field];

		}

		}

		else
{
$userfield = $user[$field];
}
if($type == "multiselect")

		else
{
$userfield = $user[$field];
}
if($type == "multiselect")

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

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

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

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

			}

			}

			if(is_array($useropts))

			if(is_array($useropts))

			{

			{

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

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

				{

				{

					$val = htmlspecialchars_uni($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($val == $seloptions[$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($val == $seloptions[$val])
{

						$sel = " selected=\"selected\"";
}
$select .= "<option value=\"$val\"$sel>$val</option>\n";
}
if(!$profilefield['length'])

						$sel = " selected=\"selected\"";
}
$select .= "<option value=\"$val\"$sel>$val</option>\n";
}
if(!$profilefield['length'])

				{

				{

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

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

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

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

					if($val == htmlspecialchars_uni($userfield))

					if($val == htmlspecialchars_uni($userfield))

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

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

Zeile 509Zeile 516
			if(is_array($useropts))
{
foreach($useropts as $key => $val)

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

				{
$seloptions[$val] = $val;

				{
$seloptions[$val] = $val;

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

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

Zeile 531Zeile 538
		{
$value = htmlspecialchars_uni($userfield);
$code = "<textarea name=\"profile_fields[$field]\" rows=\"6\" cols=\"30\" style=\"width: 95%\">$value</textarea>";

		{
$value = htmlspecialchars_uni($userfield);
$code = "<textarea name=\"profile_fields[$field]\" rows=\"6\" cols=\"30\" style=\"width: 95%\">$value</textarea>";

		}
else

		}
else

		{
$value = htmlspecialchars_uni($userfield);
$maxlength = "";

		{
$value = htmlspecialchars_uni($userfield);
$maxlength = "";

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



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

		}

		}

		// Hmm, you don't have permission to view - unsubscribe!

 
		else if($subscription['tid'])
{

		else if($subscription['tid'])
{

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

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

		}
}


		}
}


Zeile 1334Zeile 1354
			else
{
$icon = "&nbsp;";

			else
{
$icon = "&nbsp;";

			}


			}


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

if($thread['doticon'])

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

if($thread['doticon'])

			{

			{

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

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

			}


			}


			$gotounread = '';
$isnew = 0;
$donenew = 0;
$lastread = 0;

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])

			$gotounread = '';
$isnew = 0;
$donenew = 0;
$lastread = 0;

if($mybb->settings['threadreadcut'] > 0 && $mybb->user['uid'])

			{

			{

				$forum_read = $readforums[$thread['fid']];

$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;

				$forum_read = $readforums[$thread['fid']];

$read_cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;

Zeile 1360Zeile 1380
				{
$forum_read = $read_cutoff;
}

				{
$forum_read = $read_cutoff;
}

			}

			}

			else
{
$forum_read = $forumsread[$thread['fid']];

			else
{
$forum_read = $forumsread[$thread['fid']];

			}

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

			}

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

				$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;

				$cutoff = TIME_NOW-$mybb->settings['threadreadcut']*60*60*24;

			}


			}


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

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

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

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




			}

if(!$lastread)
{
$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);
if($readcookie > $forum_read)

			}

if(!$lastread)
{
$readcookie = $threadread = my_get_array_cookie("threadread", $thread['tid']);
if($readcookie > $forum_read)

				{

				{

					$lastread = $readcookie;
}
else
{
$lastread = $forum_read;
}

					$lastread = $readcookie;
}
else
{
$lastread = $forum_read;
}

			}

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 1407Zeile 1424
				$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
$unreadpost = 1;

				$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");
$unreadpost = 1;

			}

			}

			else
{
$folder_label .= $lang->icon_no_new;

			else
{
$folder_label .= $lang->icon_no_new;

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

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

			}

			}


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


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

Zeile 1427Zeile 1444
			}

$folder .= "folder";

			}

$folder .= "folder";









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


			// Build last post info

			// 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 1550Zeile 1571
				$lastposttid = $forum['lastposttid'];
$lastposter = $forum['lastposter'];
$lastpost_profilelink = build_profile_link($lastposter, $forum['lastposteruid']);

				$lastposttid = $forum['lastposttid'];
$lastposter = $forum['lastposter'];
$lastpost_profilelink = build_profile_link($lastposter, $forum['lastposteruid']);

				$lastpost_subject = $forum['lastpostsubject'];

				$lastpost_subject = htmlspecialchars_uni($forum['lastpostsubject']);

				if(my_strlen($lastpost_subject) > 25)
{
$lastpost_subject = my_substr($lastpost_subject, 0, 25) . "...";

				if(my_strlen($lastpost_subject) > 25)
{
$lastpost_subject = my_substr($lastpost_subject, 0, 25) . "...";

Zeile 1632Zeile 1653
		$template = false;
}


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

	{

	{

		$sig_parser = array(
"allow_html" => $mybb->settings['sightml'],
"allow_mycode" => $mybb->settings['sigmycode'],

		$sig_parser = array(
"allow_html" => $mybb->settings['sightml'],
"allow_mycode" => $mybb->settings['sigmycode'],

Zeile 1647Zeile 1679
			"allow_imgcode" => $mybb->settings['sigimgcode'],
"me_username" => $mybb->user['username'],
);

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





		$sigpreview = $parser->parse_message($sig, $sig_parser);
eval("\$signature = \"".$templates->get($template)."\";");
}

		$sigpreview = $parser->parse_message($sig, $sig_parser);
eval("\$signature = \"".$templates->get($template)."\";");
}

Zeile 1667Zeile 1699
		{
$sigsmilies = $lang->on;
$smilieinserter = build_clickable_smilies();

		{
$sigsmilies = $lang->on;
$smilieinserter = build_clickable_smilies();

		}

		}

		else
{
$sigsmilies = $lang->off;

		else
{
$sigsmilies = $lang->off;

Zeile 1675Zeile 1707
		if($mybb->settings['sigmycode'] == 1)
{
$sigmycode = $lang->on;

		if($mybb->settings['sigmycode'] == 1)
{
$sigmycode = $lang->on;

		}
else

		}
else

		{
$sigmycode = $lang->off;
}
if($mybb->settings['sightml'] == 1)
{
$sightml = $lang->on;

		{
$sigmycode = $lang->off;
}
if($mybb->settings['sightml'] == 1)
{
$sightml = $lang->on;

		}
else

		}
else

		{
$sightml = $lang->off;
}

		{
$sightml = $lang->off;
}

Zeile 1700Zeile 1732
		$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)

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

		{

		{

			$codebuttons = build_mycode_inserter("signature");
}


			$codebuttons = build_mycode_inserter("signature");
}


Zeile 1763Zeile 1795
					"avatartype" => "gallery"
);
$db->update_query("users", $updated_avatar, "uid='".$mybb->user['uid']."'");

					"avatartype" => "gallery"
);
$db->update_query("users", $updated_avatar, "uid='".$mybb->user['uid']."'");

			}
remove_avatars($mybb->user['uid']);
}

			}
remove_avatars($mybb->user['uid']);
}

	}
elseif($_FILES['avatarupload']['name']) // upload avatar
{

	}
elseif($_FILES['avatarupload']['name']) // upload avatar
{

Zeile 1895Zeile 1927

// Check to see if we're in a gallery or not
if($activegallery)


// Check to see if we're in a gallery or not
if($activegallery)

	{

	{

		$gallery = str_replace("..", "", $mybb->input['gallery']);
$lang->avatars_in_gallery = $lang->sprintf($lang->avatars_in_gallery, $activegallery);
// Get a listing of avatars in this gallery

		$gallery = str_replace("..", "", $mybb->input['gallery']);
$lang->avatars_in_gallery = $lang->sprintf($lang->avatars_in_gallery, $activegallery);
// Get a listing of avatars in this gallery

Zeile 2638Zeile 2670
	elseif($usergroup['candisplaygroup'] == 1)
{
$displaycode = " (<a href=\"usercp.php?action=usergroups&amp;displaygroup={$usergroup['gid']}&amp;my_post_key={$mybb->post_code}\">{$lang->set_as_display_group}</a>)";

	elseif($usergroup['candisplaygroup'] == 1)
{
$displaycode = " (<a href=\"usercp.php?action=usergroups&amp;displaygroup={$usergroup['gid']}&amp;my_post_key={$mybb->post_code}\">{$lang->set_as_display_group}</a>)";

	}

	}

	else
{
$displaycode = '';

	else
{
$displaycode = '';

Zeile 2656Zeile 2688
			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)

			elseif($usergroup['type'] != 4 && $usergroup['type'] != 3)

			{

			{

				$leavelink = "<div style=\"text-align: center;\"><span class=\"smalltext\">{$lang->usergroup_cannot_leave}</span></div>";

				$leavelink = "<div style=\"text-align: center;\"><span class=\"smalltext\">{$lang->usergroup_cannot_leave}</span></div>";

			}
else
{

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

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

			}

			}

			else
{
$description = '';
}
if(!$usergroup['usertitle'])

			else
{
$description = '';
}
if(!$usergroup['usertitle'])

			{

			{

				// fetch title here
}
$trow = alt_trow();

				// fetch title here
}
$trow = alt_trow();

Zeile 2685Zeile 2717
			elseif($usergroup['candisplaygroup'] == 1)
{
$displaycode = "(<a href=\"usercp.php?action=usergroups&amp;displaygroup={$usergroup['gid']}&amp;my_post_key={$mybb->post_code}\">{$lang->set_as_display_group}</a>)";

			elseif($usergroup['candisplaygroup'] == 1)
{
$displaycode = "(<a href=\"usercp.php?action=usergroups&amp;displaygroup={$usergroup['gid']}&amp;my_post_key={$mybb->post_code}\">{$lang->set_as_display_group}</a>)";

			}

			}

			else
{
$displaycode = '';
}
eval("\$memberoflist .= \"".$templates->get("usercp_usergroups_memberof_usergroup")."\";");

			else
{
$displaycode = '';
}
eval("\$memberoflist .= \"".$templates->get("usercp_usergroups_memberof_usergroup")."\";");

		}

		}

	}
eval("\$membergroups = \"".$templates->get("usercp_usergroups_memberof")."\";");


	}
eval("\$membergroups = \"".$templates->get("usercp_usergroups_memberof")."\";");


Zeile 2708Zeile 2740
	{
$existinggroups .= ",".$mybb->user['additionalgroups'];
}

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





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

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

Zeile 2731Zeile 2763
		else
{
$conditions = $lang->usergroup_joins_anyone;

		else
{
$conditions = $lang->usergroup_joins_anyone;

		}

		}


if($appliedjoin[$usergroup['gid']])
{


if($appliedjoin[$usergroup['gid']])
{

Zeile 2742Zeile 2774
		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 2777Zeile 2809
if($mybb->input['action'] == "attachments")
{
$plugins->run_hooks("usercp_attachments_start");

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

	require_once MYBB_ROOT."inc/functions_upload.php";


	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'];
$page = intval($mybb->input['page']);

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





	if(intval($mybb->input['page']) > 0)
{
$start = ($page-1) *$perpage;
}
else

	if(intval($mybb->input['page']) > 0)
{
$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))
{
if($attachment['dateline'] && $attachment['tid'])

	$bandwidth = $totaldownloads = 0;
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['threadsubject'] = htmlspecialchars_uni($parser->parse_badwords($attachment['threadsubject']));

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

 

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

	$bandwidth = get_friendly_size($bandwidth);

if(!$attachments)

Zeile 2872Zeile 2907
	
eval("\$manageattachments = \"".$templates->get("usercp_attachments")."\";");
output_page($manageattachments);

	
eval("\$manageattachments = \"".$templates->get("usercp_attachments")."\";");
output_page($manageattachments);

}


}


if($mybb->input['action'] == "do_attachments" && $mybb->request_method == "post")
{
// Verify incoming POST request

if($mybb->input['action'] == "do_attachments" && $mybb->request_method == "post")
{
// Verify incoming POST request

Zeile 2910Zeile 2945
{
// Get posts per day
$daysreg = (TIME_NOW - $mybb->user['regdate']) / (24*3600);

{
// 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 2920Zeile 2961
	$stats = $cache->read("stats");
$posts = $stats['numposts'];
if($posts == 0)

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

	{

	{

		$percent = "0";
}
else

		$percent = "0";
}
else

Zeile 2943Zeile 2984
		$mybb->user['avatar'] = htmlspecialchars($mybb->user['avatar']);
eval("\$avatar = \"".$templates->get("usercp_currentavatar")."\";");
$colspan = 2;

		$mybb->user['avatar'] = htmlspecialchars($mybb->user['avatar']);
eval("\$avatar = \"".$templates->get("usercp_currentavatar")."\";");
$colspan = 2;

	}

	}

	else
{
$avatar = '';
}
$regdate = my_date($mybb->settings['dateformat'].", ".$mybb->settings['timeformat'], $mybb->user['regdate']);

	else
{
$avatar = '';
}
$regdate = my_date($mybb->settings['dateformat'].", ".$mybb->settings['timeformat'], $mybb->user['regdate']);





	if($mybb->user['usergroup'] == 5 && $mybb->settings['regtype'] != "admin")
{
$usergroup .= "<br />(<a href=\"member.php?action=resendactivation\">$lang->resend_activation</a>)";

	if($mybb->user['usergroup'] == 5 && $mybb->settings['regtype'] != "admin")
{
$usergroup .= "<br />(<a href=\"member.php?action=resendactivation\">$lang->resend_activation</a>)";

Zeile 2966Zeile 3007
	{
$warning_level = round($mybb->user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
if($warning_level > 100)

	{
$warning_level = round($mybb->user['warningpoints']/$mybb->settings['maxwarningpoints']*100);
if($warning_level > 100)

		{

		{

			$warning_level = 100;
}


			$warning_level = 100;
}


Zeile 2995Zeile 3036
			{
$post_link = "";
if($warning['post_subject'])

			{
$post_link = "";
if($warning['post_subject'])

				{

				{

					$warning['post_subject'] = $parser->parse_badwords($warning['post_subject']);
$warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);
$post_link = "<br /><small>{$lang->warning_for_post} <a href=\"".get_post_link($warning['pid'])."\">{$warning['post_subject']}</a></small>";

					$warning['post_subject'] = $parser->parse_badwords($warning['post_subject']);
$warning['post_subject'] = htmlspecialchars_uni($warning['post_subject']);
$post_link = "<br /><small>{$lang->warning_for_post} <a href=\"".get_post_link($warning['pid'])."\">{$warning['post_subject']}</a></small>";

Zeile 3012Zeile 3053
				}
$warning_type = htmlspecialchars_uni($warning_type);
if($warning['points'] > 0)

				}
$warning_type = htmlspecialchars_uni($warning_type);
if($warning['points'] > 0)

				{

				{

					$warning['points'] = "+{$warning['points']}";
}
$points = $lang->sprintf($lang->warning_points, $warning['points']);

					$warning['points'] = "+{$warning['points']}";
}
$points = $lang->sprintf($lang->warning_points, $warning['points']);

Zeile 3069Zeile 3110
	$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
");

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

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

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

					}

					}

				}
}


				}
}


Zeile 3125Zeile 3172
				
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 3151Zeile 3202
						{
$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;";
}


							$icon = "&nbsp;";
}


Zeile 3165Zeile 3216
						
// Check to see which icon we display
if($thread['lastread'] && $thread['lastread'] < $thread['lastpost'])

						
// Check to see which icon we display
if($thread['lastread'] && $thread['lastread'] < $thread['lastpost'])

						{

						{

							$folder .= "new";
$folder_label .= $lang->icon_new;
$new_class = "subject_new";
$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");

							$folder .= "new";
$folder_label .= $lang->icon_new;
$new_class = "subject_new";
$thread['newpostlink'] = get_thread_link($thread['tid'], 0, "newpost");
eval("\$gotounread = \"".$templates->get("forumdisplay_thread_gotounread")."\";");

						}

						}

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

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

						}

						}

						
$folder .= "folder";

						
$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 3244
						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 3199Zeile 3255
						$thread['author'] = build_profile_link($thread['username'], $thread['uid']);

eval("\$latest_subscribed_threads .= \"".$templates->get("usercp_latest_subscribed_threads")."\";");

						$thread['author'] = build_profile_link($thread['username'], $thread['uid']);

eval("\$latest_subscribed_threads .= \"".$templates->get("usercp_latest_subscribed_threads")."\";");

					}

					}

				}
eval("\$latest_subscribed = \"".$templates->get("usercp_latest_subscribed")."\";");
}
}

				}
eval("\$latest_subscribed = \"".$templates->get("usercp_latest_subscribed")."\";");
}
}

	}

	}

	
// User's Latest Threads

// Get unviewable forums
$unviewable_forums = get_unviewable_forums();
if($unviewable_forums)

	
// User's Latest Threads

// Get unviewable forums
$unviewable_forums = get_unviewable_forums();
if($unviewable_forums)

	{

	{

		$f_perm_sql = "AND t.fid NOT IN (".$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 3386Zeile 3448
				{
$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)