$baseurl = dirname(dirname($baseurl)) . '/'; // Initialise user if (Cookie::has('flyspray_userid') && Cookie::has('flyspray_passhash')) { $user = new User(Cookie::val('flyspray_userid')); $user->check_account_ok(); } else { $user = new User(0, $proj); } // Check permissions if (!$user->perms('view_history')) { die; } // Load translations load_translations(); if ($details = Get::num('details')) { $details = " AND h.history_id = {$details}"; } else { $details = null; } $sql = get_events(Get::num('task_id'), $details); $histories = $db->fetchAllArray($sql); $page = new FSTpl(); $page->setTheme($proj->prefs['theme_style']); $page->uses('histories', 'details'); if ($details) { event_description($histories[0]); // modifies global variables $page->assign('details_previous', $GLOBALS['details_previous']); $page->assign('details_new', $GLOBALS['details_new']); } $page->display('details.tabs.history.callback.tpl');
} $filename = md5(sprintf('%s-%s-%d-%d', $feed_type, $orderby, $proj->id, $max_items) . $conf['general']['cookiesalt']); $cachefile = sprintf('%s/%s', FS_CACHE_DIR, $filename); // Get the time when a task has been changed last $db->setLimit($max_items); $sql = $db->query("SELECT t.date_opened, t.date_closed, t.last_edited_time\n FROM {tasks} t\n WHERE {$closed} AND {$sql_project}\n ORDER BY {$orderby} DESC"); $most_recent = 0; while ($row = $sql->fetchRow()) { $most_recent = max($most_recent, $row['date_opened'], $row['date_closed'], $row['last_edited_time']); } $content = $db->x->GetOne("SELECT content\n FROM {cache} t\n WHERE type = ? AND topic = ? AND {$sql_project}\n AND max_items = ? AND last_updated >= ?", null, array($feed_type, $topic . $user->id, $max_items, $most_recent)); if ($content) { echo $content; exit; } /* build a new feed if cache didn't work */ $db->setLimit($max_items); $task_details = $db->x->getAll("SELECT t.task_id, t.item_summary, t.detailed_desc, t.date_opened, t.date_closed,\n t.last_edited_time, t.opened_by, u.real_name, u.email_address, u.show_contact, t.*, p.project_prefix\n FROM {tasks} t\n INNER JOIN {users} u ON t.opened_by = u.user_id\n INNER JOIN {projects} p ON t.project_id = p.project_id\n WHERE {$closed} AND {$sql_project}\n ORDER BY {$orderby} DESC"); $task_details = array_filter($task_details, array($user, 'can_view_task')); $feed_description = $proj->prefs['feed_description'] ? $proj->prefs['feed_description'] : $fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . $title; $feed_image = false; if ($proj->prefs['feed_img_url'] && !strncmp($proj->prefs['feed_img_url'], 'http://', 7)) { $feed_image = $proj->prefs['feed_img_url']; } $page->uses('most_recent', 'feed_description', 'feed_image', 'task_details'); $content = $page->fetch('feed.' . $feed_type . '.tpl'); // cache feed $fields = array('content' => array('value' => $content), 'type' => array('value' => $feed_type, 'key' => true), 'topic' => array('value' => $topic . $user->id, 'key' => true), 'project_id' => array('value' => $proj->id, 'key' => true), 'max_items' => array('value' => $max_items, 'key' => true), 'last_updated' => array('value' => time())); $db->Replace('{cache}', $fields); header('Content-Type: application/xml; charset=utf-8'); echo $content;
foreach ($all_tasks as $task) { if ($task['is_closed']) { $percent_complete += 100; } else { $percent_complete += $task['percent_complete']; } } $percent_complete = round($percent_complete / max(count($all_tasks), 1)); $tasks = $db->Query('SELECT task_id, item_summary, detailed_desc, item_status, task_severity, task_priority, task_type, mark_private, opened_by, content, task_token, t.project_id,estimated_effort FROM {tasks} t LEFT JOIN {cache} ca ON (t.task_id = ca.topic AND ca.type = \'rota\' AND t.last_edited_time <= ca.last_updated) WHERE closedby_version = ? AND t.project_id = ? AND is_closed = 0', array($row['version_id'], $proj->id)); $tasks = $db->fetchAllArray($tasks); $count = count($tasks); for ($i = 0; $i < $count; $i++) { if (!$user->can_view_task($tasks[$i])) { unset($tasks[$i]); } } $data[] = array('id' => $row['version_id'], 'open_tasks' => $tasks, 'percent_complete' => $percent_complete, 'all_tasks' => $all_tasks, 'name' => $row['version_name']); } if (Get::val('txt')) { $page = new FSTpl(); header('Content-Type: text/plain; charset=UTF-8'); $page->uses('data', 'page'); $page->display('roadmap.text.tpl'); exit; } else { $page->uses('data', 'page'); $page->pushTpl('roadmap.tpl'); }