コメントで私の答えに続いて..
$counter = 0;
$cat_count = 1;
$alpha_count = 'abcdefghijklmnopqrstuvwxyz';
$rule_id = null;
$public_cats = array();
while ($row = $db->sql_fetchrow($result))
{
if ($rule_id != $row['rule_id'])
{
$group_ids = array_map('intval', explode(' ', $row['groups']));
$is_grouped = false;
// Check if user can see a specific category if he is not an admin or moderator
if (!$auth->acl_get('a_') && !$auth->acl_get('m_'))
{
$is_grouped = (group_memberships($group_ids, $user->data['user_id'], true)) ? true : false;
}
else
{
$is_grouped = true;
}
// Fill $public_cats with boolean values
if ($is_grouped !== false)
{
$public_cats[] = $is_grouped;
}
$rule_id = $row['rule_id'];
$template->assign_block_vars('rules', array(
'RULE_CATEGORY' => $row['rule_title'],
'ROW_COUNT' => $cat_count,
'CAN_SEE_CAT' => $is_grouped
));
$cat_count++;
$counter = 0;
}
$uid = $bitfield = $options = '';
generate_text_for_storage($row['rule_desc'], $uid, $bitfield, $options, $row['bbcode'], $row['links'], $row['smilies']);
$template->assign_block_vars('rules.rule', array(
'RULE_DESC' => generate_text_for_display($row['rule_desc'], $uid, $bitfield, $options),
'ALPHA_COUNT' => $alpha_count{$counter}
));
$counter++;
}