function show($area = null) { global $page, $fs, $db, $proj, $user, $conf; $perpage = '20'; if (isset($user->infos['tasks_perpage'])) { $perpage = $user->infos['tasks_perpage']; } $pagenum = max(1, Get::num('pagenum', 1)); $offset = $perpage * ($pagenum - 1); // Get the visibility state of all columns $visible = explode(' ', trim($proj->id ? $proj->prefs['visible_columns'] : $fs->prefs['visible_columns'])); if (!is_array($visible) || !count($visible) || !$visible[0]) { $visible = array('id'); } list($tasks, $id_list) = Backend::get_task_list($_GET, $visible, $offset, $perpage); $page->assign('tasks', $tasks); $page->assign('offset', $offset); $page->assign('perpage', $perpage); $page->assign('pagenum', $pagenum); $page->assign('visible', $visible); // List of task IDs for next/previous links $_SESSION['tasklist'] = $id_list; $page->assign('total', count($id_list)); // Javascript replacement if (Get::val('toggleadvanced')) { $advanced_search = intval(!Req::val('advancedsearch')); Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30); $_COOKIE['advancedsearch'] = $advanced_search; } // Update check {{{ if (Get::has('hideupdatemsg')) { unset($_SESSION['latest_version']); } else { if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) { if (!isset($_SESSION['latest_version'])) { $latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS); //if for some silly reason we get and empty response, we use the actual version $_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest; $db->x->execParam('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check')); } } } if (isset($_SESSION['latest_version']) && version_compare($fs->version, $_SESSION['latest_version'], '<')) { $page->assign('updatemsg', true); } // }}} $page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('tasklist')); $page->pushTpl('index.tpl'); }
ob_clean(); flush(); // finally send out our data printf("%s", $result); } // } }} // Javascript replacement if (Get::val('toggleadvanced')) { $advanced_search = intval(!Req::val('advancedsearch')); Flyspray::setCookie('advancedsearch', $advanced_search, time() + 60 * 60 * 24 * 30); $_COOKIE['advancedsearch'] = $advanced_search; } // Update check {{{ if (Get::has('hideupdatemsg')) { unset($_SESSION['latest_version']); } else { if ($conf['general']['update_check'] && $user->perms('is_admin') && $fs->prefs['last_update_check'] < time() - 60 * 60 * 24 * 3) { if (!isset($_SESSION['latest_version'])) { $latest = Flyspray::remote_request('http://flyspray.org/version.txt', GET_CONTENTS); //if for some silly reason we get and empty response, we use the actual version $_SESSION['latest_version'] = empty($latest) ? $fs->version : $latest; $db->Query('UPDATE {prefs} SET pref_value = ? WHERE pref_name = ?', array(time(), 'last_update_check')); } } } if (isset($_SESSION['latest_version']) && version_compare($fs->version, $_SESSION['latest_version'], '<')) { $page->assign('updatemsg', true); } // }}} $page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title'] . ': ' . L('tasklist')); $page->pushTpl('index.tpl');
/** * Starts the reminder daemon * @access public static * @return void * @version 1.0 */ function startReminderDaemon() { global $baseurl; $runfile = Flyspray::get_tmp_dir() . '/flysprayreminders.run'; $timeout = 600; if (!is_file($runfile) or filemtime($runfile) < time() - $timeout * 2) { $include = 'schedule.php'; /* "localhost" is on **purpose** not a mistake ¡¡ * almost any server accepts requests to itself in localhost ;) * firewalls will not block it. * the "Host" http header will tell the webserver where flyspray is running. */ Flyspray::remote_request($baseurl . $include, !GET_CONTENTS, $_SERVER['SERVER_PORT'], 'localhost', $_SERVER['HTTP_HOST']); } }