1<?php
2/*
3 * DokuWiki ActiveCollab Ticket Plugin
4 * Copyright (C) 2011  Tobias Sarnowski
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../');
22define('NOSESSION',true);
23require_once(DOKU_INC.'inc/init.php');
24
25require_once('acclient.php');
26
27if (!isset($_REQUEST['tickets'])) {
28	die('missing parameter tickets');
29}
30
31$actickets_plugin = plugin_load('syntax', 'actickets');
32
33$acclient = new actickets_acclient(
34	$actickets_plugin->getConf('actickets.url'),
35	$actickets_plugin->getConf('actickets.token')
36);
37
38$tickets = array();
39foreach ($_REQUEST['tickets'] as $ticket) {
40	$tickets[] = $acclient->get('/projects/'.$ticket['projectId'].'/tickets/'.$ticket['ticketId']);
41}
42
43$json = new JSON();
44die($json->encode($tickets));
45