-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsaveproject.php
More file actions
21 lines (18 loc) · 788 Bytes
/
Copy pathsaveproject.php
File metadata and controls
21 lines (18 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
require_once 'config/app.config.php';
require_once 'config/zend.config.php';
require_once 'src/models/Project.php';
require_once 'src/ErrorCodes.php';
$projectModel = new Project();
$data = array();
if(isset($_POST['repositoryURL'])) $data['repository_url'] = $_POST['repositoryURL'];
if(isset($_POST['projectName'])) $data['name'] = $_POST['projectName'];
if(isset($_POST['startingVersion'])) $data['starting_version'] = $_POST['startingVersion'];
if(isset($_POST['isPublic'])) $data['is_public'] = $_POST['isPublic'];
try {
if($result = $projectModel->save($data)) send_response('OK');
else throw new Exception('Project has not been saved. Reason unknown');
} catch(Exception $e) {
send_response('', PROJECT_SAVE_ERROR, $e->getMessage());
}
?>