SELECT
	node_id,
	TRUE AS node_permission,
    node_is_trashed,
	( page_is_published
		AND (page_start_publishing <= NOW()) || :preview || ISNULL(page_start_publishing)  
		AND ((page_end_publishing >= NOW()) || :preview || ISNULL(page_end_publishing) )
	) AS visibility,
	( SELECT
		GROUP_CONCAT(page_language_iso)
		FROM cms_pages
		WHERE page_node_id = IF(node_original_node_id=0,node_id,node_original_node_id)
		AND ( page_is_published AND (page_start_publishing <= NOW()) || :preview || ISNULL(page_start_publishing)  AND ((page_end_publishing >= NOW()) || :preview || ISNULL(page_end_publishing) ))
	) AS available_languages
FROM cms_nodes
LEFT JOIN cms_pages ON
	page_node_id = IF(node_original_node_id=0,node_id,node_original_node_id)
	AND ( page_language_iso = :lang )
LEFT JOIN usm_users ON node_user_id = user_id
WHERE
	node_id = :node_id
LIMIT 1

# :ids
# :node_parent_node_id
# :user_id	