1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[feature/attach-dl] Move logic for passworded forums to a function.

PHPBB3-11042
This commit is contained in:
Andreas Fischer
2012-08-10 03:06:14 +02:00
parent 9b7b794beb
commit 7bd81cd0cd
2 changed files with 27 additions and 47 deletions

View File

@@ -613,3 +613,28 @@ function phpbb_increment_downloads($db, $ids)
WHERE ' . $db->sql_in_set('attach_id', $ids);
$db->sql_query($sql);
}
function phpbb_download_handle_passworded_forum($db, $auth, $topic_id)
{
$sql = 'SELECT t.forum_id, f.forum_password, f.parent_id
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE t.topic_id = " . (int) $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);
if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']))
{
if ($row && $row['forum_password'])
{
// Do something else ... ?
login_forum_box($row);
}
}
else
{
send_status_line(403, 'Forbidden');
trigger_error('SORRY_AUTH_VIEW_ATTACH');
}
}