Example #1
0
<?php

/*
 * Copyright (c) 2014 Alberto González
 * Distributed under Apache License 2.0
 * (see README for details)
 */
namespace Quaver\Controller;

use Quaver\Model\Project;
use Quaver\Model\ProjectComment;
$obP = new Project();
$_project = $obP->getFromSlug($this->url_var[1]);
// No project?
if (empty($_project->id)) {
    header("Location: " . $this->getUrlFromId(2) . "?ref=" . $this->getUrl());
    exit;
}
// Project not accepted?
if (!$_project->isActive() && !$_user->isAdmin()) {
    header("Location: " . $this->getUrlFromId(2) . "?ref=" . $this->getUrl());
    exit;
}
// General
$this->addTwigVars('project', $_project);
$this->addTwigVars('title', $_project->name() . " -  PH Clone");
switch (@$this->url_var[2]) {
    default:
        if (!empty($_POST) and $_user->logged && isset($_POST['comment'])) {
            $comment = new ProjectComment();
            if (!empty($_POST['reply-to']) && isset($_POST['reply-to'])) {