aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp/ucp_attachments.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2004-05-26 20:16:20 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2004-05-26 20:16:20 +0000
commit53779df72098cef0322ea3ecef077523655fcad6 (patch)
treef93579c11a13ea6df52d24defd2fecfbb5a7c211 /phpBB/includes/ucp/ucp_attachments.php
parent97e5c0f4bdf5b7437ff0de5b6a4369a129d052b3 (diff)
downloadforums-53779df72098cef0322ea3ecef077523655fcad6.tar
forums-53779df72098cef0322ea3ecef077523655fcad6.tar.gz
forums-53779df72098cef0322ea3ecef077523655fcad6.tar.bz2
forums-53779df72098cef0322ea3ecef077523655fcad6.tar.xz
forums-53779df72098cef0322ea3ecef077523655fcad6.zip
ucp updates
git-svn-id: file:///svn/phpbb/trunk@4895 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/ucp/ucp_attachments.php')
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php89
1 files changed, 46 insertions, 43 deletions
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index b708d209bf..16b3dc3d77 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -26,36 +26,28 @@ class ucp_attachments extends module
$confirm = (isset($_POST['confirm'])) ? true : false;
$delete_ids = isset($_REQUEST['attachment']) ? array_keys(array_map('intval', $_REQUEST['attachment'])) : array();
- if ($delete && $confirm && sizeof($delete_ids))
- {
- include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
- delete_attachments('attach', $delete_ids);
-
- meta_refresh(3, "ucp.$phpEx$SID&amp;i=$id");
- $message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], "<a href=\"ucp.$phpEx$SID&amp;i=$id\">", '</a>');
- trigger_error($message);
- }
- else if ($delete && sizeof($delete_ids))
+ if ($delete && sizeof($delete_ids))
{
$s_hidden_fields = '<input type="hidden" name="delete" value="1" />';
foreach ($delete_ids as $attachment_id)
{
$s_hidden_fields .= '<input type="hidden" name="attachment[' . $attachment_id . ']" value="1" />';
}
-
- // Confirm Attachment Deletion
- $template->assign_vars(array(
- 'S_CONFIRM_DELETE' => true,
- 'S_HIDDEN_FIELDS' => $s_hidden_fields,
- 'L_TITLE' => $user->lang['UCP_ATTACH'],
-
- 'MESSAGE_TITLE' => $user->lang['CONFIRM'],
- 'MESSAGE_TEXT' => (sizeof($delete_ids) == 1) ? $user->lang['CONFIRM_DELETE_ATTACHMENT'] : $user->lang['CONFIRM_DELETE_ATTACHMENTS'],
- 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id")
- );
-
- $this->display($user->lang['UCP_ATTACHMENTS'], 'ucp_attachments.html');
- exit;
+
+ if (confirm_box(true))
+ {
+ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
+ delete_attachments('attach', $delete_ids);
+
+ $refresh_url = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id";
+ meta_refresh(3, $refresh_url);
+ $message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $refresh_url . '">', '</a>');
+ trigger_error($message);
+ }
+ else
+ {
+ confirm_box(false, (sizeof($delete_ids) == 1) ? 'DELETE_ATTACHMENT' : 'DELETE_ATTACHMENTS', $s_hidden_fields);
+ }
}
$sort_key = request_var('sk', 'a');
@@ -89,11 +81,14 @@ class ucp_attachments extends module
$result = $db->sql_query_limit($sql, 1);
$num_attachments = $db->sql_fetchfield('num_attachments', 0, $result);
$db->sql_freeresult($result);
-
- $sql = 'SELECT a.*, t.topic_title
- FROM ' . ATTACHMENTS_TABLE . ' a, ' . TOPICS_TABLE . ' t
- WHERE a.topic_id = t.topic_id
- AND a.poster_id = ' . $user->data['user_id'] . "
+
+ $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title
+ FROM ' . ATTACHMENTS_TABLE . ' a
+ 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'] . "
ORDER BY $order_by";
$result = $db->sql_query_limit($sql, $config['posts_per_page'], $start);
@@ -104,23 +99,31 @@ class ucp_attachments extends module
do
{
- $view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;t=" . $row['topic_id'] . '&amp;p=' . $row['post_id'] . '#' . $row['post_id'];
+ if ($row['in_message'])
+ {
+ $view_topic = "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=pm&amp;p={$row['post_msg_id']}";
+ }
+ else
+ {
+ $view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&amp;t=" . $row['topic_id'] . '&amp;p=' . $row['post_msg_id'] . '#' . $row['post_msg_id'];
+ }
$template->assign_block_vars('attachrow', array(
'ROW_NUMBER' => $row_count + ($start + 1),
'FILENAME' => $row['real_filename'],
'COMMENT' => str_replace("\n", '<br />', $row['comment']),
'EXTENSION' => $row['extension'],
- 'SIZE' => ($row['filesize'] >= 1048576) ? (round($row['filesize'] / 1048576 * 100) / 100) . ' ' . $user->lang['MB'] : (($row['filesize'] >= 1024) ? (round($row['filesize'] / 1024 * 100) / 100) . ' ' . $user->lang['KB'] : $row['filesize'] . ' ' . $user->lang['BYTES']),
+ 'SIZE' => ($row['filesize'] >= 1048576) ? ($row['filesize'] >> 20) . ' ' . $user->lang['MB'] : (($row['filesize'] >= 1024) ? ($row['filesize'] >> 10) . ' ' . $user->lang['KB'] : $row['filesize'] . ' ' . $user->lang['BYTES']),
'DOWNLOAD_COUNT' => $row['download_count'],
'POST_TIME' => $user->format_date($row['filetime'], $user->lang['DATE_FORMAT']),
- 'TOPIC_TITLE' => $row['topic_title'],
+ 'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'],
'ATTACH_ID' => $row['attach_id'],
- 'POST_ID' => $row['post_id'],
+ 'POST_ID' => $row['post_msg_id'],
'TOPIC_ID' => $row['topic_id'],
'S_ROW_COUNT' => $row_count++,
+ 'S_IN_MESSAGE' => $row['in_message'],
'U_VIEW_ATTACHMENT' => $phpbb_root_path . 'download.' . $phpEx . $SID . '&amp;id=' . $row['attach_id'],
'U_VIEW_TOPIC' => $view_topic)
@@ -132,21 +135,21 @@ class ucp_attachments extends module
$template->assign_vars(array(
'PAGE_NUMBER' => on_page($num_attachments, $config['posts_per_page'], $start),
- 'PAGINATION' => generate_pagination("ucp.$phpEx$SID&amp;i=$id&amp;sk=$sort_key&amp;sd=$sort_dir", $num_attachments, $config['posts_per_page'], $start),
+ 'PAGINATION' => generate_pagination("{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;sk=$sort_key&amp;sd=$sort_dir", $num_attachments, $config['posts_per_page'], $start),
- 'L_TITLE' => $user->lang['UCP_ATTACH'],
+ 'L_TITLE' => $user->lang['UCP_ATTACHMENTS'],
- 'U_SORT_FILENAME' => "ucp.$phpEx$SID&amp;i=$id&amp;sk=a&amp;sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_FILE_COMMENT' => "ucp.$phpEx$SID&amp;i=$id&amp;sk=b&amp;sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_EXTENSION' => "ucp.$phpEx$SID&amp;i=$id&amp;sk=c&amp;sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_FILESIZE' => "ucp.$phpEx$SID&amp;i=$id&amp;sk=d&amp;sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_DOWNLOADS' => "ucp.$phpEx$SID&amp;i=$id&amp;sk=e&amp;sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_POST_TIME' => "ucp.$phpEx$SID&amp;i=$id&amp;sk=f&amp;sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
- 'U_SORT_TOPIC_TITLE' => "ucp.$phpEx$SID&amp;i=$id&amp;sk=g&amp;sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_FILENAME' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;sk=a&amp;sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_FILE_COMMENT' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;sk=b&amp;sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_EXTENSION' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;sk=c&amp;sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_FILESIZE' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;sk=d&amp;sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_DOWNLOADS' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;sk=e&amp;sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_POST_TIME' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;sk=f&amp;sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
+ 'U_SORT_TOPIC_TITLE' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id&amp;sk=g&amp;sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'),
'S_DISPLAY_MARK_ALL' => ($num_attachments) ? true : false,
'S_DISPLAY_PAGINATION' => ($num_attachments) ? true : false,
- 'S_UCP_ACTION' => "ucp.$phpEx$SID&amp;i=$id",
+ 'S_UCP_ACTION' => "{$phpbb_root_path}ucp.$phpEx$SID&amp;i=$id",
'S_SORT_OPTIONS' => $s_sort_key,
'S_ORDER_SELECT' => $s_sort_dir)
);