コード例 #1
0
 private function doCreate()
 {
     $data = $this->creation_request->getProjectValues();
     require_once 'www/project/create_project.php';
     $group_id = create_project($data);
     return $this->project_manager->getProject($group_id);
 }
コード例 #2
0
 function generate() {
     global $Language;
     $request =& HTTPRequest::instance();
     if ($data = $request->get('data')) {
         if (isset($data['users']['generate']) && $data['users']['generate']) {
             $um = UserManager::instance();
             $nb_wanted = isset($data['users']['nb']) ? (int)$data['users']['nb'] : 1;
             $users = $this->_getUsersData();
             reset($users);
             $nb_done = 0;
             while((list(,$user) = each($users)) && ($nb_wanted > $nb_done)) {
                 if (!$um->getUserByUserName($user['name'])) {
                     require_once('account.php');
                     account_create($user['name']
                           ,'codendi'
                           ,''
                           ,$user['realname']
                           ,''
                           ,'379fbec92fb84a72d6026a422@mailinator.com'
                           ,'A'
                           ,''
                           ,0
                           ,0
                           ,'Europe/Paris'
                           ,'en_US'
                           ,'A');
                     $nb_done++;
                 }
             }
         }
         if (isset($data['projects']['generate']) && $data['projects']['generate']) {
             $nb_wanted = isset($data['projects']['nb']) ? (int)$data['projects']['nb'] : 1;
             $projects = $this->_getProjectsData();
             reset($projects);
             $nb_done = 0;
             while((list(,$project) = each($projects)) && ($nb_wanted > $nb_done)) {
                 if (!group_get_object_by_name($project['name'])) {
                     require_once('www/project/create_project.php');
                     create_project(array('project' => array(
                         'form_unix_name'            => $project['name'],
                         'form_full_name'            => $project['name'],
                         'form_license'              => '',
                         'form_license_other'        => '',
                         'form_short_description'    => $project['description'],
                         'form_purpose'              => $project['description'],
                         'form_required_sw'          => '',
                         'form_patents'              => '',
                         'form_comments'             => '',
                         'built_from_template'       => 100,
                         'is_test'                   => false,
                         'is_public'                 => true,
                         'trove'                     => array(),
                     )),
                     $do_not_exit = true);/**/
                     $nb_done++;
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: project.php プロジェクト: kitware/cdash
function rest_post()
{
    $response = array();
    // If we should create a new project.
    if (isset($_REQUEST['Submit'])) {
        if (!valid_user($reponse)) {
            return;
        }
        create_project($response);
        echo json_encode($response);
        return;
    }
    $Project = get_project($response);
    if (!$Project) {
        echo json_encode($response);
        return;
    }
    // If we should update an existing project.
    if (isset($_REQUEST['Update']) || isset($_REQUEST['AddRepository'])) {
        update_project($response, $Project);
        echo json_encode($response);
        return;
    }
    // If we should block a spammer's build.
    if (isset($_REQUEST['AddBlockedBuild']) && !empty($_REQUEST['AddBlockedBuild'])) {
        $response['blockedid'] = add_blocked_build($Project, $_REQUEST['AddBlockedBuild']);
        echo json_encode($response);
        return;
    }
    // If we should remove a build from the blocked list.
    if (isset($_REQUEST['RemoveBlockedBuild']) && !empty($_REQUEST['RemoveBlockedBuild'])) {
        return remove_blocked_build($Project, $_REQUEST['RemoveBlockedBuild']);
    }
    // If we should set the logo.
    if (isset($_FILES['logo']) && strlen($_FILES['logo']['tmp_name']) > 0) {
        return set_logo($Project);
    }
}
コード例 #4
0
$title = "Creating New Project";
include_once '../Template/Header.php';
?>
		<div id="body" class="section">
			<div class="content-box">
			<h2>
				<?php 
echo $title;
?>
...
			</h2>

			<?php 
if (isset($_POST['project_name'])) {
    if (!empty($_POST['project_name'])) {
        $p_name = $_POST['project_name'];
    } else {
        $p_name = "new_project";
    }
    $result = create_project($p_name);
    echo "<p>" . $result["return_message"] . "</p>";
    echo "<a href=\"../Assignments/" . $result["file_name"] . ".php\"><span class=\"div_button\">Go to Project</span></a>";
} else {
    echo "<p> ERROR <br> You did not pass any parameters to create a new project </p>";
}
?>
			</div>
		</div>
		
		<?php 
include_once '../Template/Footer.php';
コード例 #5
0
    }
    if (!empty($errors)) {
        echo output_errors($errors);
    } else {
        $user_id = $_SESSION['user_id'];
        $project_name = $_POST['project_name'];
        $project_data = array();
        $i = 1;
        foreach ($_POST['faction'] as $faction) {
            if (!empty($faction)) {
                $project_data['faction'][$i++] = $faction;
            }
        }
        $faction_qty = count($project_data['faction']);
        // Check to make sure there isn't already a project named this
        $project_id = create_project($project_data, $project_name, $user_id, $faction_qty);
        //creates the project
        create_rand_data($project_id);
        $_SESSION['new-project'] = true;
        header("Location: edit_project.php");
        exit;
    }
}
?>
<!DOCTYPE html>
<html>
<head>
	<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
	<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
	<link rel="stylesheet" href="css/bootstrap-tour.min.css">
	<link rel="stylesheet" href="css/primary.css">
コード例 #6
0
ファイル: register.php プロジェクト: nterray/tuleap
}
if ($request->exist('next') && $steps[$current_step]->onLeave($request, $data) && (!isset($steps[$current_step + 1]) || $steps[$current_step + 1]->onEnter($request, $data))) {
    $current_step++;
    if ($current_step == count($steps)) {
        //We finish wizard, do a final validation
        $is_valid = true;
        reset($steps);
        while ($is_valid && (list($key, ) = each($steps))) {
            $is_valid = $steps[$key]->validate($data);
        }
        if (!$is_valid) {
            $current_step--;
        } else {
            $csrf->check();
            require_once 'create_project.php';
            create_project($data);
        }
    }
}
if ($request->exist('previous')) {
    $current_step--;
}
//Display current step
$HTML->header(array('title' => $Language->getText('register_index', 'project_registration') . ' - ' . $steps[$current_step]->name));
echo '<style>
.current_step {
    font-weight:bold;
}
.next_step {
    color:#999;
}
コード例 #7
0
<?php 
create_nav_bar();
?>

<div class="container" style="max-width: 750px">
    
<h1>Create a new project</h1>



<?php 
if (isset($_POST['clear'])) {
    print_success_message('Values cleared!');
} elseif (isset($_POST['save'])) {
    create_project();
}
//$transport->close();
?>



<form action="<?php 
echo $_SERVER['PHP_SELF'];
?>
" method="post" role="form">
    <div class="form-group">
        <label for="project-name">Project Name</label>
        <input type="text" class="form-control" name="project-name" id="project-name" placeholder="Enter project name" autofocus required>
    </div>
コード例 #8
0
 protected function create_project($data)
 {
     include 'www/project/create_project.php';
     return create_project($data, true);
 }
コード例 #9
0
ファイル: project.php プロジェクト: thejerrytan/crowdsourcer
    $category = htmlspecialchars($_POST['category']);
    $target_funds = htmlspecialchars($_POST['target_funds']);
    $start_date = htmlspecialchars($_POST['start_date']);
    $end_date = htmlspecialchars($_POST['end_date']);
    $orignal_img_name = htmlspecialchars($_FILES['fileToUpload']['name']);
    $tmp_img_name = $_FILES['fileToUpload']['tmp_name'];
    $is_image = is_image('fileToUpload');
    $r_tier = $_POST['tiers'];
    $r_minfund = $_POST['values'];
    $r_benefits = $_POST['descriptions'];
    if ($is_image) {
        $ext = get_ext('../img/' . basename($_FILES['fileToUpload']['name']));
        $img_url = rename_img_path($title, $user, $ext);
        $moved = move_uploaded_file($tmp_img_name, $img_url);
        if ($moved) {
            $project = create_project($user, $title, $description, $category, $target_funds, $start_date, $end_date, $img_url);
            $reward = create_reward_for_project($user, $title, $r_tier, $r_minfund, $r_benefits);
            if ($project) {
                $success = "Successfully created new project!";
            } else {
                $error = "There were some errors processing your request.";
            }
        } else {
            $error = "There were some errors processing your request. Please try again.";
        }
    } else {
        $error = "Error! Please upload an image file.";
    }
} else {
    if (isset($_POST['submit']) && $_POST['submit'] == "Save Changes") {
        $user = $_SESSION['user'];
コード例 #10
0
        } else {
            if (strlen($name) > 32) {
                error_log("do-edit-project: project name '{$name}' too long");
                relative_redirect('error-text.php?error=' . urlencode("Project Name '{$name}' is too long - use at most 32 characters."));
            } else {
                if (!is_valid_project_name($name)) {
                    error_log("do-edit-project: project name '{$name}' invalid");
                    relative_redirect('error-text.php?error=' . urlencode("Project Name '{$name}' is invalid: Use at most 32 alphanumeric characters or hyphen or underscore. No leading hyphen or underscore. "));
                }
            }
        }
    }
    // Re-check authorization?
    // Auto?
    // Ensure project name is unique?!
    $project_id = create_project($sa_url, $user, $name, $lead_id, $purpose, $expiration);
    if ($project_id == "-1" || !uuid_is_valid($project_id)) {
        error_log("do-edit-project create_project got project_id {$project_id}");
        $result = "Error";
    } else {
        $result = "New";
    }
    //  print "Created project, got ID: $project_id<.br/>\n";
    // Return on error?
} else {
    //  error_log("about to update project");
    if (!$user->isAllowed(PA_ACTION::UPDATE_PROJECT, CS_CONTEXT_TYPE::PROJECT, $project_id)) {
        error_log("Non privileged user " . $user->urn . " tried to update project " . $project_id);
        relative_redirect('home.php');
    }
    // FIXME: Diff new vals from old?