Location: PHPKode > projects > GForge Community Edition > gforge-ce-571-src/wwwlib/register/ProjectAdd.php
<?php
/**
 * Copyright (c) 2005-2008 GForge, LLC
 *
 * @version   $Id$
 * @author Tim Perdue hide@address.com
 * @date 2006-02-27
 *
 * This file is part of GForge.
 *
 * See LICENSE for details. This file is part of GForge AS and may not be
 * redistributed without written permission of GForge, LLC
 */

//
// This code shows a form for Project
//
require_once('core/ProjectPeer.php');
require_once('core/Project.php');
require_once('plugin/ActionManager.php');
require_once('html/HTMLWidget.php');
require_once('html/TroveRenderer.php');
require_once('exceptions/NotLoggedInException.php');

$session = Session::getSession();
$Lang = $session->getLanguage();

require_once('html/SiteTemplate.php');
$theme = new SiteTemplate();

$params = array(
	//	'project' => $Project,
		'feedback' => isset($feedback) ? $feedback : '',
		'selectedtoptab' => 'projects',
		'selectedbottomtab' => 'core',
		'pagename'	=> $Lang->getText('Project.AddNewPageName'),
		'title' => $Lang->getText('Project.AddNewPageTitle')
		);

$project_name = (isset($_POST['project_name']) ? htmlspecialchars($_POST['project_name']) : '');
$register_purpose = (isset($_POST['register_purpose']) ? htmlspecialchars($_POST['register_purpose']) : '');
$register_license_other = (isset($_POST['register_license_other']) ? htmlspecialchars($_POST['register_license_other']) : '');
$description = (isset($_POST['description']) ? htmlspecialchars($_POST['description']) : '');
$unix_name = (isset($_POST['unix_name']) ? htmlspecialchars($_POST['unix_name']) : '');
$homepage_url = (isset($_POST['homepage_url']) ? htmlspecialchars($_POST['homepage_url']) : '');
// By default, choose the "Default project with SVN support" (avoid choosing the empty project)
$template_project_id = (isset($_POST['template_project_id']) ? $_POST['template_project_id'] : 3);

$trove_renderer = new TroveRenderer();

$session = Session::getSession();

if (!$session->isLoggedIn()) {
	throw new NotLoggedInException();
}

$allowed = true;
if (GFConf::get('system.projectRegRestricted')) {
	// Only site admins can register
	if (!$session->isSiteAdmin()) {
		$params['feedback'] = Language::getSessText('Project.RegRestricted');
		$theme->header($params);
		$theme->footer();
		$allowed = false;
	}
}

if ($allowed) {
	$templates = ProjectPeer::getTemplateProjects();
	if (count($templates) == 0) {
		$params['feedback'] = Language::getSessText('Project.TemplateProjectMissing');
		$theme->header($params);
		$theme->footer();
	} else {
		include("forms/ProjectAdd-tpl.php");
	}
}
?>
Return current item: GForge Community Edition