3 * Task UUID implementation for FusionForge
6 * Thorsten “mirabilos” Glaser <t.glaser@tarent.de>
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the License, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * Locate task information by UUID (project_task_id) and return as JSON.
27 require_once('../env.inc.php');
28 require_once $gfwww.'include/pre.php';
29 require_once $gfcommon.'pm/ProjectTaskSqlQueries.php';
31 $tid = getIntFromRequest('tid');
33 $tid = util_path_info_last_numeric_component();
35 header("HTTP/1.0 404 Not Found");
36 echo "You forgot to pass the tid.\n";
40 $tinfo = getGroupProjectIdGroupId($tid);
43 header("HTTP/1.0 404 Not Found");
44 echo "There is no task with id ".$tid."!\n";
48 $asuser = getStringFromRequest('asuser');
50 if (getIntFromRequest('text'))
51 $asformat = "text/plain; charset=\"UTF-8\"";
53 $asformat = "application/json; charset=\"UTF-8\"";
55 $islogin = session_loggedin();
56 $isadmin = session_checkperm(array('group'=>'1','admin_flags'=>'A'));
57 $ishttps = session_issecure();
58 $ispublic = isProjectTaskInfoPublic($tid);
67 } else if ($islogin) {
68 if (!$isadmin || !$asuser) {
69 /* operate as ourselves */
70 $asuser = session_get_user()->getUnixName();
73 if (isUserAndTaskinSameGroup($tid, $asuser))
82 $tinfo = getAllFromProjectTask($tid);
85 $tinfo['public'] = $ispublic;
86 $tinfo['forge_base'] = forge_get_config ('web_host') ;
87 $tinfo['forge_name'] = forge_get_config ('forge_name') ;
89 header("Content-type: " . $asformat);
90 setup_gettext_from_langname ('English') ;
91 echo json_encode($tinfo) . "\n";