mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-24 19:08:53 +00:00
[feature/attach-dl] Optimised an sql query
PHPBB3-11042
This commit is contained in:
parent
5827250a94
commit
227ae48255
1 changed files with 2 additions and 2 deletions
|
@ -687,7 +687,7 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id)
|
||||||
function phpbb_download_check_pm_auth($db, $user_id, $msg_id)
|
function phpbb_download_check_pm_auth($db, $user_id, $msg_id)
|
||||||
{
|
{
|
||||||
// Check if the attachment is within the users scope...
|
// Check if the attachment is within the users scope...
|
||||||
$sql = 'SELECT user_id, author_id
|
$sql = 'SELECT msg_id
|
||||||
FROM ' . PRIVMSGS_TO_TABLE . '
|
FROM ' . PRIVMSGS_TO_TABLE . '
|
||||||
WHERE msg_id = ' . (int) $msg_id . '
|
WHERE msg_id = ' . (int) $msg_id . '
|
||||||
AND (
|
AND (
|
||||||
|
@ -695,7 +695,7 @@ function phpbb_download_check_pm_auth($db, $user_id, $msg_id)
|
||||||
OR author_id = ' . (int) $user_id . '
|
OR author_id = ' . (int) $user_id . '
|
||||||
)';
|
)';
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
$allowed = $db->sql_fetchrow($result);
|
$allowed = (bool) $db->sql_fetchfield('msg_id');
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
return $allowed;
|
return $allowed;
|
||||||
|
|
Loading…
Add table
Reference in a new issue