|
@@ -286,6 +286,66 @@ ALTER TABLE {$db_prefix}boards
|
|
|
ADD COLUMN deny_member_groups varchar(255) NOT NULL DEFAULT '';
|
|
|
---#
|
|
|
|
|
|
+/******************************************************************************/
|
|
|
+--- Updating board access rules
|
|
|
+/******************************************************************************/
|
|
|
+---# Updating board access rules
|
|
|
+---{
|
|
|
+$member_groups = array(
|
|
|
+ 'allowed' => array(),
|
|
|
+ 'denied' => array(),
|
|
|
+);
|
|
|
+
|
|
|
+$request = $smcFunc['db_query']('', '
|
|
|
+ SELECT id_group, add_deny
|
|
|
+ FROM {db_prefix}permissions
|
|
|
+ WHERE permission = {string:permission}',
|
|
|
+ array(
|
|
|
+ 'permission' => 'manage_boards',
|
|
|
+ )
|
|
|
+);
|
|
|
+while ($row = $smcFunc['db_fetch_assoc']($request))
|
|
|
+ $member_groups[$row['add_deny'] === '1' ? 'allowed' : 'denied'][] = $row['id_group'];
|
|
|
+$smcFunc['db_free_result']($request);
|
|
|
+
|
|
|
+$member_groups = array_diff($member_groups['allowed'], $member_groups['denied']);
|
|
|
+
|
|
|
+if (!empty($member_groups))
|
|
|
+{
|
|
|
+ $count = count($member_groups);
|
|
|
+ $changes = array();
|
|
|
+
|
|
|
+ $request = $smcFunc['db_query']('', '
|
|
|
+ SELECT id_board, member_groups
|
|
|
+ FROM {db_prefix}boards');
|
|
|
+ while ($row = $smcFunc['db_fetch_assoc']($request))
|
|
|
+ {
|
|
|
+ $current_groups = explode(',', $row['member_groups']);
|
|
|
+ if (count(array_intersect($current_groups, $member_groups)) != $count)
|
|
|
+ {
|
|
|
+ $new_groups = array_unique(array_merge($current_groups, $member_groups));
|
|
|
+ $changes[$row['id_board']] = implode(',', $new_groups);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $smcFunc['db_free_result']($request);
|
|
|
+
|
|
|
+ if (!empty($changes))
|
|
|
+ {
|
|
|
+ foreach ($changes as $id_board => $member_groups)
|
|
|
+ $smcFunc['db_query']('', '
|
|
|
+ UPDATE {db_prefix}boards
|
|
|
+ SET member_groups = {string:member_groups}
|
|
|
+ WHERE id_board = {int:id_board}',
|
|
|
+ array(
|
|
|
+ 'member_groups' => $member_groups,
|
|
|
+ 'id_board' => $id_board,
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+---}
|
|
|
+---#
|
|
|
+
|
|
|
/******************************************************************************/
|
|
|
--- Adding support for category descriptions
|
|
|
/******************************************************************************/
|