Example #1
0
    // only list those projects that are allowing anonymous reporting of new issues
    $projects = Project::getAnonymousList();
    if (empty($projects)) {
        $tpl->assign('no_projects', '1');
    } else {
        if (!in_array($_GET['project'], array_keys($projects))) {
            $tpl->assign('no_projects', '1');
        } else {
            // get list of custom fields for the selected project
            $options = Project::getAnonymousPostOptions($_GET['project']);
            if (@$options['show_custom_fields'] == 'yes') {
                $tpl->assign('custom_fields', Custom_Field::getListByProject($_GET['project'], 'anonymous_form'));
            }
            $tpl->assign('project_name', Project::getName($_GET['project']));
        }
    }
} else {
    // only list those projects that are allowing anonymous reporting of new issues
    $projects = Project::getAnonymousList();
    if (empty($projects)) {
        $tpl->assign('no_projects', '1');
    } else {
        if (count($projects) == 1) {
            $project_ids = array_keys($projects);
            Auth::redirect('post.php?post_form=yes&project=' . $project_ids[0]);
        } else {
            $tpl->assign('projects', $projects);
        }
    }
}
$tpl->displayTemplate();