/var/www/traq/bugs/vendor/traq/controllers/tickets.php
$this->apiResponse([
'page' => (int) ($pagination->total_pages > 0 ? $pagination->page : 1),
'total_pages' => (int) $pagination->total_pages,
'tickets' => $tickets,
]);
}
/**
* Handles the view ticket page.
*
* @param integer $ticket_id
*/
public function action_view($ticket_id)
{
// Fetch the ticket from the database and send it to the view.
$ticket = Ticket::select()->where("ticket_id", $ticket_id)->where("project_id", $this->project->id)->exec()->fetch();
// If the ticket is private, only allow admins, projects members and the creator to view the ticket.
if ($ticket->is_private) {
if (
$this->user->id !== $ticket->user_id
&& !$this->user->group->is_admin
&& !$this->project->is_member($this->user)
) {
return $this->show_no_permission();
}
}
// Ticket history
$ticket_history = $ticket->history;
switch (settings('ticket_history_sorting')) {
case 'oldest_first':
$ticket_history->order_by('created_at', 'ASC');
break;
case 'newest_first':
$ticket_history->order_by('created_at', 'DESC');
break;
/var/www/traq/bugs/vendor/traq/controllers/tickets.php
$this->apiResponse([
'page' => (int) ($pagination->total_pages > 0 ? $pagination->page : 1),
'total_pages' => (int) $pagination->total_pages,
'tickets' => $tickets,
]);
}
/**
* Handles the view ticket page.
*
* @param integer $ticket_id
*/
public function action_view($ticket_id)
{
// Fetch the ticket from the database and send it to the view.
$ticket = Ticket::select()->where("ticket_id", $ticket_id)->where("project_id", $this->project->id)->exec()->fetch();
// If the ticket is private, only allow admins, projects members and the creator to view the ticket.
if ($ticket->is_private) {
if (
$this->user->id !== $ticket->user_id
&& !$this->user->group->is_admin
&& !$this->project->is_member($this->user)
) {
return $this->show_no_permission();
}
}
// Ticket history
$ticket_history = $ticket->history;
switch (settings('ticket_history_sorting')) {
case 'oldest_first':
$ticket_history->order_by('created_at', 'ASC');
break;
case 'newest_first':
$ticket_history->order_by('created_at', 'DESC');
break;
/var/www/traq/bugs/vendor/avalon/core/kernel.php
public static function run()
{
// Start the app
static::$app = new Router::$controller;
// Before filters
$filters = array_merge(
isset(static::$app->before['*']) ? static::$app->before['*'] : array(),
isset(static::$app->before[Router::$method]) ? static::$app->before[Router::$method] : array()
);
foreach ($filters as $filter) {
static::$app->{$filter}(Router::$method);
}
unset($filters, $filter);
// Call the method
$output = null;
if (static::$app->render['action']) {
if (Router::$legacyRoute) {
$output = call_user_func_array(array(static::$app, 'action_' . Router::$method), Router::$vars);
} else {
$output = [static::$app, Router::$method](...Router::$params);
}
}
// After filters
$filters = array_merge(
isset(static::$app->after['*']) ? static::$app->after['*'] : array(),
isset(static::$app->after[Router::$method]) ? static::$app->after[Router::$method] : array()
);
foreach ($filters as $filter) {
static::$app->{$filter}(Router::$method);
}
unset($filters, $filter);
if ($output instanceof Response) {
$output->send();
} elseif (is_array($output)) {
Body::clear();
header('Content-Type: application/json; charset=utf-8');
/var/www/traq/bugs/vendor/avalon/core/kernel.php
public static function run()
{
// Start the app
static::$app = new Router::$controller;
// Before filters
$filters = array_merge(
isset(static::$app->before['*']) ? static::$app->before['*'] : array(),
isset(static::$app->before[Router::$method]) ? static::$app->before[Router::$method] : array()
);
foreach ($filters as $filter) {
static::$app->{$filter}(Router::$method);
}
unset($filters, $filter);
// Call the method
$output = null;
if (static::$app->render['action']) {
if (Router::$legacyRoute) {
$output = call_user_func_array(array(static::$app, 'action_' . Router::$method), Router::$vars);
} else {
$output = [static::$app, Router::$method](...Router::$params);
}
}
// After filters
$filters = array_merge(
isset(static::$app->after['*']) ? static::$app->after['*'] : array(),
isset(static::$app->after[Router::$method]) ? static::$app->after[Router::$method] : array()
);
foreach ($filters as $filter) {
static::$app->{$filter}(Router::$method);
}
unset($filters, $filter);
if ($output instanceof Response) {
$output->send();
} elseif (is_array($output)) {
Body::clear();
header('Content-Type: application/json; charset=utf-8');
/var/www/traq/bugs/index.php
* along with Traq. If not, see <http://www.gnu.org/licenses/>.
*/
require __DIR__ . '/vendor/autoload.php';
if (class_exists('\Whoops\Run')) {
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
}
define('START_TIME', microtime(true));
define('START_MEM', memory_get_usage());
require dirname(__FILE__) . '/vendor/bootstrap.php';
use avalon\core\Kernel as Avalon;
Avalon::init();
Avalon::run();