function FlysprayDo() { // check minimum permissions list($access, $msg) = array_pad((array) $this->is_accessible(), 2, ''); if (!$access) { $this->result = array(ERROR_PERMS, $msg); } else { // check if data has been submitted and respond $this->result = (array) $this->_onsubmit(); } FlysprayDo::error($this->result); }
function show() { global $page, $db, $fs, $proj, $user; $page->setTitle($fs->prefs['page_title'] . L('svnlog')); // check for last repo update $db->setLimit(30); $logdb = $db->x->getAll('SELECT content, last_updated, topic FROM {cache} WHERE type = ? AND project_id = ? ORDER BY last_updated DESC', null, array('svn', $proj->id)); $logsvn = array(); // check if nothing is cached yet oder older than 1 day if (!count($logdb) || $logdb[0]['last_updated'] < time() - 60 * 60 * 24) { $svninfo = new SVNinfo(); $svninfo->setRepository($proj->prefs['svn_url'], $proj->prefs['svn_user'], $proj->prefs['svn_password']); $currentRevision = $svninfo->getCurrentRevision(); if (!$currentRevision) { FlysprayDo::error(ERROR_INPUT, L('svnnoconnection')); } // Get last 30 log entries $logsvn = $svninfo->getLog(count($logdb) ? $logdb[0]['topic'] : $currentRevision - 30, $currentRevision); $stmt = $db->x->autoPrepare('{cache}', array('type', 'content', 'topic', 'project_id', 'last_updated')); foreach ($logsvn as $log) { $stmt->execute(array('svn', serialize($log), $log['version-name'], $proj->id, strtotime($log['date']))); } $stmt->free(); // server sends oldest entry first $logsvn = array_reverse($logsvn); } for ($i = 0; $i < count($logdb); ++$i) { $logdb[$i] = unserialize($logdb[$i]['content']); } $svnlog = array_merge($logsvn, $logdb); foreach ($svnlog as $key => $log) { // Make first line of summary bold $svnlog[$key]['comment'] = $page->text->render(trim($svnlog[$key]['comment']), true); $svnlog[$key]['comment'] = explode("\n", $svnlog[$key]['comment']); $svnlog[$key]['comment'][0] = '<strong>' . $svnlog[$key]['comment'][0] . '</strong>'; $svnlog[$key]['comment'] = implode("\n", $svnlog[$key]['comment']); } $page->assign('svnlog', $svnlog); $page->pushTpl('svnlog.tpl'); }
function area_user() { global $proj; FlysprayDo::error(array(ERROR_INPUT, L('error17'), CreateUrl(array('pm', 'proj' . $proj->id)))); }
if ($user->isAnon() && !$fs->prefs['user_notify']) { $amails = $db->x->getCol('SELECT email_address FROM {users} u LEFT JOIN {users_in_groups} g ON u.user_id = g.user_id WHERE g.group_id = 1'); $amails = array_map(create_function('$x', 'return str_replace("@", "#", $x);'), $amails); $page->assign('admin_emails', $amails); } // default title $page->setTitle($fs->prefs['page_title'] . $proj->prefs['project_title']); $page->setTheme($proj->prefs['theme_style']); $page->assign('do', $do); $page->pushTpl('header.tpl'); if (Flyspray::requestDuplicated()) { // Check that this page isn't being submitted twice FlysprayDo::error(array(ERROR_INPUT, L('error3'))); } /* XXX: * there is something fishy in the new design, users actions * should never require the admin specific class. */ $class = 'FlysprayDo' . $do; $mode = new $class(); $mode->show(Req::val('area')); if (isset($_SESSION)) { // remove dupe data on error, since no submission happened if (isset($_SESSION['ERROR']) && isset($_SESSION['requests_hash'])) { $currentrequest = md5(serialize($_POST)); unset($_SESSION['requests_hash'][$currentrequest]); } }
} $project_id = Req::val('project', Req::val('project_id', $project_id)); } $proj = new Project($project_id); // reset do for default project level entry page if (!in_array($do, $modes)) { $do = $do ? Req::enum('do', $modes, $proj->prefs['default_entry']) : $proj->prefs['default_entry']; } $proj->setCookie(); $user = new User($uid = 0); // verify and initiate user $auth = new FlysprayAuth(); if (Post::val('user_name') && Post::has('password')) { $uid = $auth->checkLogin(Post::val('user_name'), Post::val('password')); if (is_array($uid)) { FlysprayDo::error($uid); } } else { if (Cookie::val('flyspray_userid') && $auth->checkCookie(Cookie::val('flyspray_userid'), Cookie::val('flyspray_passhash'))) { $uid = Cookie::val('flyspray_userid'); } } $user = new User($uid); // Load translations load_translations(); function debuglog($str) { $file = fopen("debug.log", "a+"); fwrite($file, $str . "\n"); fflush($file); fclose($file);
/** * area_list * * @access public * @return void */ function area_list() { global $fs, $db, $proj, $user, $page; if (!Req::val('list_id')) { FlysprayDo::error(array(ERROR_INPUT)); return; } $row = $db->x->getRow('SELECT list_type, list_name FROM {lists} WHERE list_id = ?', null, Req::val('list_id')); if ($row['list_type'] != LIST_CATEGORY) { $page->assign('rows', $proj->get_edit_list(Req::val('list_id'))); } $page->assign('list_type', $row['list_type']); $page->assign('list_name', $row['list_name']); }
function show() { global $page, $db, $user, $fs; $page->setTitle($fs->prefs['page_title'] . L('registernewuser')); if (Get::val('regdone')) { $page->pushTpl('register.ok.tpl'); } else { if ($user->can_register()) { // 32 is the length of the magic_url if (Req::has('magic_url')) { // If the user came here from their notification link $sql = $db->x->GetOne('SELECT reg_id FROM {registrations} WHERE magic_url = ?', null, Req::val('magic_url')); if (!$sql) { FlysprayDo::error(array(ERROR_INPUT, L('error18'))); } $page->pushTpl('register.magic.tpl'); } else { $page->pushTpl('register.no-magic.tpl'); } } else { $page->pushTpl('common.newuser.tpl'); } } }