aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/download
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2012-08-10 03:06:14 +0200
committerAndreas Fischer <bantu@phpbb.com>2012-08-10 03:07:38 +0200
commit7bd81cd0cd088ba13648f293fb738060f221a8de (patch)
tree1326710a6e546cf7d722b47e41610cf6f040dd56 /phpBB/download
parent9b7b794beb8d5acc71f1b6d3f60ba5e22c70c17f (diff)
downloadforums-7bd81cd0cd088ba13648f293fb738060f221a8de.tar
forums-7bd81cd0cd088ba13648f293fb738060f221a8de.tar.gz
forums-7bd81cd0cd088ba13648f293fb738060f221a8de.tar.bz2
forums-7bd81cd0cd088ba13648f293fb738060f221a8de.tar.xz
forums-7bd81cd0cd088ba13648f293fb738060f221a8de.zip
[feature/attach-dl] Move logic for passworded forums to a function.
PHPBB3-11042
Diffstat (limited to 'phpBB/download')
-rw-r--r--phpBB/download/file.php49
1 files changed, 2 insertions, 47 deletions
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index 5db57c3f9c..db71052707 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -230,29 +230,7 @@ else if ($download_id)
{
if (!$attachment['in_message'])
{
- $sql = 'SELECT p.forum_id, f.forum_password, f.parent_id
- FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f
- WHERE p.post_id = ' . $attachment['post_msg_id'] . '
- AND p.forum_id = f.forum_id';
- $result = $db->sql_query_limit($sql, 1);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $f_download = $auth->acl_get('f_download', $row['forum_id']);
-
- if ($auth->acl_get('u_download') && $f_download)
- {
- if ($row && $row['forum_password'])
- {
- // Do something else ... ?
- login_forum_box($row);
- }
- }
- else
- {
- send_status_line(403, 'Forbidden');
- trigger_error('SORRY_AUTH_VIEW_ATTACH');
- }
+ phpbb_download_handle_passworded_forum($db, $auth, $attachment['topic_id']);
}
else
{
@@ -350,30 +328,7 @@ else
{
// sizeof($attachments) >= 1
- $sql = 'SELECT t.forum_id, f.forum_password, f.parent_id
- FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
- WHERE t.topic_id = " . (int) $attachment['topic_id'] . "
- AND t.forum_id = f.forum_id";
- $result = $db->sql_query_limit($sql, 1);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- $f_download = $auth->acl_get('f_download', $row['forum_id']);
-
- if ($auth->acl_get('u_download') && $f_download)
- {
- if ($row && $row['forum_password'])
- {
- // Do something else ... ?
- login_forum_box($row);
- }
- }
- else
- {
- send_status_line(403, 'Forbidden');
- trigger_error('SORRY_AUTH_VIEW_ATTACH');
- }
-
+ phpbb_download_handle_passworded_forum($db, $auth, $attachment['topic_id']);
phpbb_increment_downloads($db, $attachment_ids);
if (!class_exists('compress'))