* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
\OCP\User::checkLoggedIn();
\OCP\App::checkAppEnabled('collaboration');
OCP\App::setActiveNavigationEntry('collaboration');
OCP\Util::addScript('collaboration', 'comment');
OCP\Util::addStyle('collaboration', 'tabs');
OCP\Util::addStyle('collaboration', 'content_header');
OCP\Util::addStyle('collaboration', 'comment');
$tpl = new OCP\Template("collaboration", "comment", "user");
if (isset($_GET['post'])) {
    $details = OC_Collaboration_Post::getPostDetails($_GET['post']);
    if (count($details) == 0 || !OC_Collaboration_Post::isPostAccessibleToMember($_GET['post'], OC_User::getUser())) {
        goToDashboard();
    } else {
        $tpl->assign('details', $details);
        $tpl->assign('comments', OC_Collaboration_Comment::readComments($_GET['post']));
    }
} else {
    goToDashboard();
}
function goToDashboard()
{
    header('Location: ' . \OCP\Util::linkToRoute('collaboration_route', 'dashboard'));
    exit;
}
$tpl->printPage();