-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetscmprojects.php
More file actions
46 lines (43 loc) · 1.55 KB
/
Copy pathgetscmprojects.php
File metadata and controls
46 lines (43 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
require_once 'config/app.config.php';
require_once 'src/SvnWrapper.php';
require_once 'src/ErrorCodes.php';
require_once 'config/zend.config.php';
require_once 'src/models/Project.php';
$projectModel = new Project();
//$actions = SvnWrapper::singleton()->getScmProjects();
$projects = array();
$project_urls = json_decode($_COOKIE['repositoryURLAutoComplete']);
$db_projects = $projectModel->getPublicProjects();
if(is_array($project_urls)) {
foreach($project_urls as $url) {
foreach($db_projects as $project) {
$url = urldecode($url);
// print_r(array('db_url' => $project['repository_url'], 'cookies_url' => $url));
if($project['repository_url'] == $url) {
$project['password'] = '';
$projects[] = $project;
} else {
$projects[] = array(
'name' => '-',
'repository_url' => $url,
'starting_version' => '0.x.x',
'is_public' => false,
'username' => '',
'password' => '',
);
}
}
}
}
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Content-type: application/json');
echo json_encode(array('ResultSet' => array(
'Result' => $projects,
"totalResultsAvailable" => count($projects),
'totalResultsReturned' => count($projects),
'firstResultPosition' => 1,
'ResultSetMapUrl' => '',
)));
?>