diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index ab7c6dfeff..e2becf7275 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -12,7 +12,7 @@
// -------------------------------------------------------------
//
-// * Use this for ucp integration - changeable user id
+// * Use this for ACP integration - changeable user id
//
class ucp_attachments extends module
@@ -66,7 +66,7 @@ class ucp_attachments extends module
$sort_key_sql = array('a' => 'a.real_filename', 'b' => 'a.comment', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title');
$sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']);
-
+
$s_sort_key = '';
foreach ($sort_key_text as $key => $value)
{
@@ -93,32 +93,40 @@ class ucp_attachments extends module
$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'] . '
- ORDER BY ' . $order_by;
+ AND a.poster_id = ' . $user->data['user_id'] . "
+ ORDER BY $order_by";
$result = $db->sql_query_limit($sql, $config['posts_per_page'], $start);
- $i = 0;
- while ($row = $db->sql_fetchrow($result))
+ $row_count = 0;
+ if ($row = $db->sql_fetchrow($result))
{
- $view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . '#' . $row['post_id'];
+ $template->assign_var('S_ATTACHMENT_ROWS', true);
- $template->assign_block_vars('attachrow', array(
- 'ROW_NUMBER' => $i + ($start + 1),
- 'ATTACH_ID' => $row['attach_id'],
- 'FILENAME' => $row['real_filename'],
- 'COMMENT' => str_replace("\n", '
', $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']),
- 'DOWNLOAD_COUNT' => $row['download_count'],
- 'POST_TIME' => $user->format_date($row['filetime'], $user->lang['DATE_FORMAT']),
- 'TOPIC_TITLE' => $row['topic_title'],
+ do
+ {
+ $view_topic = "{$phpbb_root_path}viewtopic.$phpEx$SID&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . '#' . $row['post_id'];
- 'S_ROW_COUNT' => $i,
+ $template->assign_block_vars('attachrow', array(
+ 'ROW_NUMBER' => $i + ($start + 1),
+ 'FILENAME' => $row['real_filename'],
+ 'COMMENT' => str_replace("\n", '
', $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']),
+ 'DOWNLOAD_COUNT' => $row['download_count'],
+ 'POST_TIME' => $user->format_date($row['filetime'], $user->lang['DATE_FORMAT']),
+ 'TOPIC_TITLE' => $row['topic_title'],
- 'U_VIEW_ATTACHMENT' => $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $row['attach_id'],
- 'U_VIEW_TOPIC' => $view_topic)
- );
- $i++;
+ 'ATTACH_ID' => $row['attach_id'],
+ 'POST_ID' => $row['post_id'],
+ 'TOPIC_ID' => $row['topic_id'],
+
+ 'S_ROW_COUNT' => $row_count++,
+
+ 'U_VIEW_ATTACHMENT' => $phpbb_root_path . 'download.' . $phpEx . $SID . '&id=' . $row['attach_id'],
+ 'U_VIEW_TOPIC' => $view_topic)
+ );
+ }
+ while ($row = $db->sql_fetchrow($result));
}
$db->sql_freeresult($result);
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index e5a566e9d0..2522b6eb7e 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -512,7 +512,7 @@ class ucp_main extends module
{
$drafts = (isset($_POST['d'])) ? implode(', ', array_map('intval', array_keys($_POST['d']))) : '';
- if (!empty($drafts))
+ if ($drafts)
{
$sql = 'DELETE FROM ' . DRAFTS_TABLE . "
WHERE draft_id IN ($drafts)
@@ -532,7 +532,7 @@ class ucp_main extends module
$draft_message = (isset($_POST['message'])) ? htmlspecialchars(trim(str_replace(array('\\\'', '\\"', '\\0', '\\\\'), array('\'', '"', '\0', '\\'), $_POST['message']))) : '';
$draft_message = preg_replace('#&(\#[0-9]+;)#', '&\1', $draft_message);
- if ($draft_message != '' && $draft_subject != '')
+ if ($draft_message && $draft_subject)
{
$draft_row = array(
'draft_subject' => $draft_subject,
@@ -590,63 +590,58 @@ class ucp_main extends module
$db->sql_freeresult($result);
}
unset($topic_ids);
+
+ $template->assign_var('S_EDIT_DRAFT', $edit);
- if (sizeof($draftrows))
+ $row_count = 0;
+ foreach ($draftrows as $draft)
{
- $template->assign_vars(array(
- 'S_DRAFT_ROWS' => true,
- 'S_EDIT_DRAFT' => $edit)
- );
-
- $row_count = 0;
- foreach ($draftrows as $draft)
+ $link_topic = $link_forum = 0;
+ $insert_url = $view_url = $title = '';
+
+ if (isset($topic_rows[$draft['topic_id']]) && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id']))
{
- $link_topic = $link_forum = 0;
- $insert_url = $view_url = $title = '';
+ $link_topic = true;
+ $view_url = "viewtopic.$phpEx$SID&f=" . $topic_rows[$draft['topic_id']]['forum_id'] . "&t=" . $draft['topic_id'];
+ $title = $topic_rows[$draft['topic_id']]['topic_title'];
- if (isset($topic_rows[$draft['topic_id']]) && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id']))
- {
- $link_topic = true;
- $view_url = "viewtopic.$phpEx$SID&f=" . $topic_rows[$draft['topic_id']]['forum_id'] . "&t=" . $draft['topic_id'];
- $title = $topic_rows[$draft['topic_id']]['topic_title'];
-
- $insert_url = "posting.$phpEx$SID&f=" . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id'];
- }
- else if ($auth->acl_get('f_read', $draft['forum_id']))
- {
- $link_forum = true;
- $view_url = "viewforum.$phpEx$SID&f=" . $draft['forum_id'];
- $title = $draft['forum_name'];
-
- $insert_url = "posting.$phpEx$SID&f=" . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id'];
- }
-
- $template_row = array(
- 'DRAFT_ID' => $draft['draft_id'],
- 'DATE' => $user->format_date($draft['save_time']),
- 'DRAFT_MESSAGE' => ($submit) ? $draft_message : $draft['draft_message'],
- 'DRAFT_SUBJECT' => ($submit) ? $draft_subject : $draft['draft_subject'],
-
- 'TITLE' => $title,
- 'U_VIEW' => $view_url,
- 'U_VIEW_EDIT' => "ucp.$phpEx$SID&i=$id&mode=$mode&edit=" . $draft['draft_id'],
- 'U_INSERT' => $insert_url,
-
- 'S_ROW_COUNT' => $row_count++,
- 'S_HIDDEN_FIELDS' => $s_hidden_fields,
- 'S_LINK_TOPIC' => $link_topic,
- 'S_LINK_FORUM' => $link_forum
- );
-
- if ($edit)
- {
- $template->assign_vars($template_row);
- }
- else
- {
- $template->assign_block_vars('draftrow', $template_row);
- }
+ $insert_url = "posting.$phpEx$SID&f=" . $topic_rows[$draft['topic_id']]['forum_id'] . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id'];
}
+ else if ($auth->acl_get('f_read', $draft['forum_id']))
+ {
+ $link_forum = true;
+ $view_url = "viewforum.$phpEx$SID&f=" . $draft['forum_id'];
+ $title = $draft['forum_name'];
+
+ $insert_url = "posting.$phpEx$SID&f=" . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id'];
+ }
+
+ $template_row = array(
+ 'DATE' => $user->format_date($draft['save_time']),
+ 'DRAFT_MESSAGE' => ($submit) ? $draft_message : $draft['draft_message'],
+ 'DRAFT_SUBJECT' => ($submit) ? $draft_subject : $draft['draft_subject'],
+ 'TITLE' => $title,
+
+ 'DRAFT_ID' => $draft['draft_id'],
+ 'FORUM_ID' => $draft['forum_id'],
+ 'TOPIC_ID' => $draft['topic_id'],
+
+ 'U_VIEW' => $view_url,
+ 'U_VIEW_EDIT' => "ucp.$phpEx$SID&i=$id&mode=$mode&edit=" . $draft['draft_id'],
+ 'U_INSERT' => $insert_url,
+
+ 'S_ROW_COUNT' => $row_count++,
+ 'S_LINK_TOPIC' => $link_topic,
+ 'S_LINK_FORUM' => $link_forum,
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields
+ );
+
+ ($edit) ? $template->assign_vars($template_row) : $template->assign_block_vars('draftrow', $template_row);
+ }
+
+ if (!$edit)
+ {
+ $template->assign_vars('S_DRAFT_ROWS', $row_count);
}
break;
diff --git a/phpBB/styles/subSilver/template/ucp_attachments.html b/phpBB/styles/subSilver/template/ucp_attachments.html
index 4f42a2795c..ab98fba832 100644
--- a/phpBB/styles/subSilver/template/ucp_attachments.html
+++ b/phpBB/styles/subSilver/template/ucp_attachments.html
@@ -13,7 +13,7 @@
-
+
{attachrow.ROW_NUMBER} | {attachrow.FILENAME} {L_TOPIC}: {attachrow.TOPIC_TITLE} |
@@ -60,7 +56,10 @@
{L_UCP_NO_ATTACHMENTS} | +{L_UCP} | +
---|---|
{L_UCP_NO_ATTACHMENTS} |