Removed small mode from forum_get_children.
This commit is contained in:
parent
643ea59ee8
commit
3548c61b55
2 changed files with 22 additions and 28 deletions
|
@ -35,8 +35,7 @@ switch ($indexMode) {
|
|||
= forum_get_children(
|
||||
$sub['forum_id'],
|
||||
user_session_current('user_id', 0),
|
||||
perms_check($sub['forum_permissions'], MSZ_FORUM_PERM_DELETE_ANY_POST),
|
||||
true
|
||||
perms_check($sub['forum_permissions'], MSZ_FORUM_PERM_DELETE_ANY_POST)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -360,22 +360,6 @@ function forum_latest_post(int $forumId, int $userId): array
|
|||
return $memoized[$memoId] = $currentLast;
|
||||
}
|
||||
|
||||
define(
|
||||
'MSZ_FORUM_GET_CHILDREN_QUERY_SMALL',
|
||||
'
|
||||
SELECT
|
||||
:user_id AS `target_user_id`,
|
||||
f.`forum_id`, f.`forum_name`,
|
||||
(%3$s) AS `forum_permissions`
|
||||
FROM `msz_forum_categories` AS f
|
||||
WHERE `forum_parent` = :parent_id
|
||||
AND `forum_hidden` = false
|
||||
GROUP BY f.`forum_id`
|
||||
HAVING (`forum_permissions` & %4$d) > 0
|
||||
ORDER BY f.`forum_order`
|
||||
'
|
||||
);
|
||||
|
||||
define(
|
||||
'MSZ_FORUM_GET_CHILDREN_QUERY_STANDARD',
|
||||
'
|
||||
|
@ -398,24 +382,35 @@ define(
|
|||
'
|
||||
);
|
||||
|
||||
function forum_get_children_query(bool $showDeleted = false, bool $small = false): string
|
||||
function forum_get_children(int $parentId, int $userId, bool $showDeleted = false): array
|
||||
{
|
||||
return sprintf(
|
||||
$small
|
||||
? MSZ_FORUM_GET_CHILDREN_QUERY_SMALL
|
||||
: MSZ_FORUM_GET_CHILDREN_QUERY_STANDARD,
|
||||
$getListing = db_prepare(sprintf(
|
||||
'
|
||||
SELECT
|
||||
:user_id AS `target_user_id`,
|
||||
f.`forum_id`, f.`forum_name`, f.`forum_description`, f.`forum_type`,
|
||||
f.`forum_link`, f.`forum_link_clicks`, f.`forum_archived`, f.`forum_colour`,
|
||||
f.`forum_count_topics`, f.`forum_count_posts`,
|
||||
(%3$s) AS `forum_permissions`
|
||||
FROM `msz_forum_categories` AS f
|
||||
WHERE f.`forum_parent` = :parent_id
|
||||
AND f.`forum_hidden` = 0
|
||||
AND (
|
||||
(f.`forum_parent` = %1$d AND f.`forum_type` != %2$d)
|
||||
OR f.`forum_parent` != %1$d
|
||||
)
|
||||
GROUP BY f.`forum_id`
|
||||
HAVING (`forum_permissions` & %4$d) > 0
|
||||
ORDER BY f.`forum_order`
|
||||
',
|
||||
MSZ_FORUM_ROOT,
|
||||
MSZ_FORUM_TYPE_CATEGORY,
|
||||
forum_perms_get_user_sql(MSZ_FORUM_PERMS_GENERAL, 'f.`forum_id`'),
|
||||
MSZ_FORUM_PERM_SET_READ,
|
||||
$showDeleted ? '' : 'AND `topic_deleted` IS NULL',
|
||||
$showDeleted ? '' : 'AND `post_deleted` IS NULL'
|
||||
);
|
||||
}
|
||||
));
|
||||
|
||||
function forum_get_children(int $parentId, int $userId, bool $showDeleted = false, bool $small = false): array
|
||||
{
|
||||
$getListing = db_prepare(forum_get_children_query($showDeleted, $small));
|
||||
$getListing->bindValue('user_id', $userId);
|
||||
$getListing->bindValue('perm_user_id_user', $userId);
|
||||
$getListing->bindValue('perm_user_id_role', $userId);
|
||||
|
|
Loading…
Add table
Reference in a new issue