Your requirement is a bit complicated so the expression will be quite complicated, like this:
Code:
$visitor['user_id'] != 0
AND
in_array($contentTemplate, array('forum_view', 'category_view'))
AND
preg_match('/^node(205|206|207)($|\s)/', $bodyClasses)
The reason is $category variable is not available in the PAGE_CONTAINER template (where the hook ad_above_content is used) so you can't use that variable. Fortunately XenForo make uses of $bodyClasses so we need to use it here. Put your node ids (both forums and categories) in the preg_match pattern.