From c44f6ca080c944b57dc912de8708e5239c1543a2 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Mon, 30 Oct 2006 16:20:11 +0000 Subject: some fixes git-svn-id: file:///svn/phpbb/trunk@6538 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/ucp/ucp_attachments.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/ucp/ucp_attachments.php') diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php index 549e3a11b2..2312d1f30d 100644 --- a/phpBB/includes/ucp/ucp_attachments.php +++ b/phpBB/includes/ucp/ucp_attachments.php @@ -78,11 +78,17 @@ class ucp_attachments $s_sort_dir .= ''; } + if (!isset($sort_key_sql[$sort_key])) + { + $sort_key = 'a'; + } + $order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); $sql = 'SELECT COUNT(attach_id) as num_attachments FROM ' . ATTACHMENTS_TABLE . ' - WHERE poster_id = ' . $user->data['user_id']; + WHERE poster_id = ' . $user->data['user_id'] . ' + AND is_orphan = 0'; $result = $db->sql_query($sql); $num_attachments = $db->sql_fetchfield('num_attachments'); $db->sql_freeresult($result); @@ -92,6 +98,7 @@ class ucp_attachments LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id AND a.in_message = 0) LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id AND a.in_message = 1) WHERE a.poster_id = ' . $user->data['user_id'] . " + AND a.is_orphan = 0 ORDER BY $order_by"; $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); -- cgit v1.2.1