Skip to content

Commit fa0f736

Browse files
committed
fix: corrected issue if unauthorized user try to access FAQs via solution ID
1 parent 0bc6b81 commit fa0f736

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

phpmyfaq/src/phpMyFAQ/Faq.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,11 +1237,14 @@ public function getRecordBySolutionId(int $solutionId): void
12371237
{
12381238
$query = sprintf(
12391239
'SELECT
1240-
*
1240+
fd.*, COALESCE(fdg.group_id, -1) AS group_id, fdu.user_id
12411241
FROM
12421242
%sfaqdata fd
1243-
LEFT JOIN
1244-
%sfaqdata_group fdg
1243+
LEFT JOIN (
1244+
SELECT record_id, group_id FROM %sfaqdata_group fdg WHERE fdg.group_id <> -1
1245+
UNION ALL
1246+
SELECT fd.id AS record_id, -1 AS group_id FROM %sfaqdata fd WHERE fd.solution_id = %d
1247+
) AS fdg
12451248
ON
12461249
fd.id = fdg.record_id
12471250
LEFT JOIN
@@ -1255,6 +1258,8 @@ public function getRecordBySolutionId(int $solutionId): void
12551258
Database::getTablePrefix(),
12561259
Database::getTablePrefix(),
12571260
$solutionId,
1261+
Database::getTablePrefix(),
1262+
$solutionId,
12581263
$this->queryPermission($this->groupSupport)
12591264
);
12601265

0 commit comments

Comments
 (0)