/** * show * * @access public * @return void */ function show() { global $proj, $page, $fs; // Get the visibility state of all columns $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns'])); list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, 0); $page = new FSTpl(); $page->assign('tasks', $tasks); $page->assign('visible', $visible); if (Get::val('type') == 'iCal') { $datecols = array('dateopened' => 'date_opened', 'lastedit' => 'max_date', 'dateclosed' => 'date_closed'); header('Content-Type: text/calendar; charset=utf-8'); header('Content-Disposition: filename="export.ics"'); $page->assign('datecols', $datecols); $page->finish('icalexport.tpl'); } else { header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: filename="export.csv"'); $page->finish('csvexport.tpl'); } }
header('Content-type: text/html; charset=utf-8'); if ($conf['general']['output_buffering'] == 'gzip' && extension_loaded('zlib')) { // Start Output Buffering and gzip encoding if setting is present. ob_start('ob_gzhandler'); } else { ob_start(); } // our own error handler, so that especially notices don't stay unnoticed if (version_compare(phpversion(), '5.0.0', '>=')) { set_error_handler(array('FlysprayDo', 'error'), ini_get('error_reporting')); } else { set_error_handler(array('FlysprayDo', 'error')); } $page = new FSTpl(); if (Get::val('opensearch')) { $page->finish('opensearch.tpl'); } if ($show_task = Get::val('show_task')) { // If someone used the 'show task' form, redirect them $task_id = Flyspray::GetTaskId($show_task); if ($task_id) { Flyspray::Redirect(CreateURL(array('details', 'task' . $task_id))); } else { Flyspray::Redirect(Createurl('index', array('string' => $show_task))); } } if ($proj->id && $user->perms('manage_project')) { // Find out if there are any PM requests wanting attention $count = $db->x->GetOne('SELECT COUNT(*) FROM {admin_requests} WHERE project_id = ? AND resolved_by = 0', null, array($proj->id)); $page->assign('pm_pendingreq_num', $count); }
function show() { global $db, $page, $fs, $proj, $do; $page = new FSTpl(); $page->setTheme($proj->prefs['theme_style']); $page->assign('do', $do); $page->pushTpl('baseheader.tpl'); $assignees = ''; if (Get::val('onlyassignees')) { $assignees = 'AND (g.show_as_assignees = 1 OR g.is_admin = 1)'; } $query = 'SELECT g.group_id, g.group_name, g.group_desc, g.group_open, count(u.user_id) AS num_users FROM {groups} g LEFT JOIN {users_in_groups} uig ON uig.group_id = g.group_id LEFT JOIN {users} u ON (uig.user_id = u.user_id ' . $assignees . ') WHERE g.project_id = ? GROUP BY g.group_id'; $page->assign('groups', $db->x->getAll($query, null, $proj->id)); $page->assign('globalgroups', $db->x->getAll($query, null, 0)); // Search conditions $where = array(); $params = array(); foreach (array('user_name', 'real_name') as $key) { if (Post::val($key)) { $where[] = ' ' . $key . ' LIKE ? '; $params[] = '%' . Post::val($key) . '%'; } } $where = count($where) ? implode(' OR ', $where) : '1=1'; // fill the table with users if (Get::val('group_id', -1) > 0) { $order_keys = array('username' => 'user_name', 'realname' => 'real_name'); $order_column = $order_keys[Filters::enum(Get::val('order', 'username'), array_keys($order_keys))]; $sortorder = sprintf('ORDER BY %s %s, u.user_id ASC', $order_column, Filters::enum(Get::val('sort', 'desc'), array('asc', 'desc'))); $users = $db->x->getAll('SELECT u.user_id, user_name, real_name, email_address FROM {users} u LEFT JOIN {users_in_groups} uig ON uig.user_id = u.user_id LEFT JOIN {groups} g ON uig.group_id = g.group_id WHERE uig.group_id = ? ' . $assignees . ' AND ( ' . $where . ' )' . $sortorder, null, array_merge(array(Get::val('group_id')), $params)); // Offset and limit $user_list = array(); $offset = max(Get::num('pagenum') - 1, 0) * 20; for ($i = $offset; $i < $offset + 20 && $i < count($users); $i++) { $user_list[] = $users[$i]; } $page->assign('users', $user_list); } else { // be tricky ^^: show most assigned users $db->setLimit(20); $users = $db->x->getAll('SELECT a.user_id, u.user_name, u.real_name, email_address, count(a.user_id) AS a_count, CASE WHEN t.project_id = ? THEN 1 ELSE 0 END AS my_project FROM {assigned} a LEFT JOIN {users} u ON a.user_id = u.user_id LEFT JOIN {tasks} t ON a.task_id = t.task_id WHERE ( ' . $where . ' )' . ' AND u.account_enabled = 1 GROUP BY a.user_id ORDER BY my_project DESC, a_count DESC', null, array_merge(array($proj->id), $params)); $page->assign('users', $users); } $page->assign('usercount', count($users)); $page->setTitle($fs->prefs['page_title'] . L('userselect')); $page->pushTpl('userselect.tpl'); $page->finish(); }
function error($errno, $errstr = '', $errfile = '', $errline = 0) { global $db, $proj, $fs; $page = new FSTpl(); $page->pushTpl('header.tpl'); $page->assign('do', 'index'); $page->setTheme(isset($proj) ? $proj->prefs['theme_style'] : $fs->prefs['global_theme']); if (is_array($errno)) { list($errno, $errstr, $url) = array_pad($errno, 3, ''); } else { // ignore E_STRICT and @ if (($errno > E_ALL || !ini_get('error_reporting')) && (isset($errstr) && strpos($errstr, 'by reference') === false)) { return; } $errno = ERROR_INTERNAL; } if (isset($db) && is_object($db) && $db->inTransaction()) { $db->rollback(); // if possible, undo database queries } switch ($errno) { case ERROR_INTERNAL: $page->assign('file', str_replace(BASEDIR . DIRECTORY_SEPARATOR, '', $errfile)); $page->assign('line', $errline); case ERROR_PERMS: case ERROR_INPUT: @ob_clean(); // make sure that previous output is erased $page->assign('type', $errno); $page->assign('message', $errstr); $page->pushTpl('error.tpl'); $page->finish('footer.tpl'); case ERROR_RECOVER: if ($errstr) { $_SESSION['ERROR'] = $errstr; } if ($url) { Flyspray::Redirect($url); } break; case SUBMIT_OK: if ($errstr) { $_SESSION['SUCCESS'] = $errstr; } if ($url) { Flyspray::Redirect($url); } break; } }