aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-09-26 16:53:40 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-09-26 16:53:40 +0000
commitb2afdc0704e2c827e0174a113ea105a551b15039 (patch)
tree289484d37171c07a1877d38515e0bb87c96b6995
parentcb85c2c57cd7d6bfd93950f993125d4a6771e65e (diff)
downloadforums-b2afdc0704e2c827e0174a113ea105a551b15039.tar
forums-b2afdc0704e2c827e0174a113ea105a551b15039.tar.gz
forums-b2afdc0704e2c827e0174a113ea105a551b15039.tar.bz2
forums-b2afdc0704e2c827e0174a113ea105a551b15039.tar.xz
forums-b2afdc0704e2c827e0174a113ea105a551b15039.zip
#i53
git-svn-id: file:///svn/phpbb/trunk@8113 89ea8834-ac86-4346-8a33-228a782c2dd0
-rw-r--r--phpBB/includes/acp/acp_users.php21
-rw-r--r--phpBB/includes/functions_admin.php2
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php19
-rw-r--r--phpBB/styles/prosilver/template/ucp_attachments.html2
4 files changed, 41 insertions, 3 deletions
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 3748dbaaf9..a3dd9e279b 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -1541,6 +1541,23 @@ class acp_users
if ($deletemark && sizeof($marked))
{
+ $sql = 'SELECT attach_id
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE poster_id = ' . $user_id . '
+ AND is_orphan = 0
+ AND ' . $db->sql_in_set('attach_id', $marked);
+ $result = $db->sql_query($sql);
+
+ $marked = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $marked[] = $row['attach_id'];
+ }
+ $db->sql_freeresult($result);
+ }
+
+ if ($deletemark && sizeof($marked))
+ {
if (confirm_box(true))
{
$sql = 'SELECT real_filename
@@ -1603,7 +1620,8 @@ class acp_users
$sql = 'SELECT COUNT(attach_id) as num_attachments
FROM ' . ATTACHMENTS_TABLE . "
- WHERE poster_id = $user_id";
+ WHERE poster_id = $user_id
+ AND is_orphan = 0";
$result = $db->sql_query_limit($sql, 1);
$num_attachments = (int) $db->sql_fetchfield('num_attachments');
$db->sql_freeresult($result);
@@ -1615,6 +1633,7 @@ class acp_users
LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id
AND a.in_message = 1)
WHERE a.poster_id = ' . $user_id . "
+ AND a.is_orphan = 0
ORDER BY $order_by";
$result = $db->sql_query_limit($sql, $config['posts_per_page'], $start);
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 19080f580e..bfb127b270 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -790,7 +790,7 @@ function delete_attachments($mode, $ids, $resync = true)
{
global $db, $config;
- if (is_array($ids))
+ if (is_array($ids) && sizeof($ids))
{
$ids = array_unique($ids);
$ids = array_map('intval', $ids);
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index b20e4a55ed..ded838aded 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -31,6 +31,24 @@ class ucp_attachments
if ($delete && sizeof($delete_ids))
{
+ // Validate $delete_ids...
+ $sql = 'SELECT attach_id
+ FROM ' . ATTACHMENTS_TABLE . '
+ WHERE poster_id = ' . $user->data['user_id'] . '
+ AND is_orphan = 0
+ AND ' . $db->sql_in_set('attach_id', $delete_ids);
+ $result = $db->sql_query($sql);
+
+ $delete_ids = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $delete_ids[] = $row['attach_id'];
+ }
+ $db->sql_freeresult($result);
+ }
+
+ if ($delete && sizeof($delete_ids))
+ {
$s_hidden_fields = array(
'delete' => 1
);
@@ -46,6 +64,7 @@ class ucp_attachments
{
include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
}
+
delete_attachments('attach', $delete_ids);
meta_refresh(3, $this->u_action);
diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html
index 165cf86032..c2866c28e2 100644
--- a/phpBB/styles/prosilver/template/ucp_attachments.html
+++ b/phpBB/styles/prosilver/template/ucp_attachments.html
@@ -34,7 +34,7 @@
<li class="row<!-- IF attachrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->">
<dl>
<dt><a href="{attachrow.U_VIEW_ATTACHMENT}" class="topictitle">{attachrow.FILENAME}</a><br />
- {L_TOPIC}: <a href="{attachrow.U_VIEW_TOPIC}">{attachrow.TOPIC_TITLE}</a></dt>
+ <!-- IF attachrow.S_IN_MESSAGE -->{L_PM}: <!-- ELSE -->{L_TOPIC}: <!-- ENDIF --><a href="{attachrow.U_VIEW_TOPIC}">{attachrow.TOPIC_TITLE}</a></dt>
<dd class="extra">{attachrow.DOWNLOAD_COUNT}</dd>
<dd class="extra">{attachrow.SIZE}</dd>
<dd class="time"><span>{attachrow.POST_TIME}</span></dd>