-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewRepositories.php
85 lines (62 loc) · 2.29 KB
/
viewRepositories.php
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/*
Copyright 2009, All Rights Reserved.
This file is part of Repository-Aggregator.
Repository-Aggregator is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Repository-Aggregator is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Repository-Aggregator. If not, see <http://www.gnu.org/licenses/>.
*/
require_once( 'lib/functions.lib.php' );
$framework = frameworkDir();
require_once( 'config/Config.class.php' );
require_once( $framework.'/lib/authentication.php' );
authorize(); /* Are you allowed here? */
// Library File
require_once( $framework.'/lib/library.php' );
$title = 'View Repositories';
$subtitle = Config::get( 'siteName' );
$content = '';
if( isset( $_GET['action'] ) ){
switch( $_GET['action'] ){
case 'added':
$content .= '<h3 class="indent">Repository Added Successfully</h3>';
break;
case 'watched':
$content .= '<h3 class="indent">Now Watching the New Repository</h3>';
break;
}
}
$content .= '<div id="repositories">'."\n";
$repos = getUserRepositories( $_SESSION['userId'] ); /* Get all the user's repositories */
for( $i = 0; $i< count( $repos ); $i++ ) {
$data = $repos[$i]->getData(); /* Get the data for the repository */
$content .= <<<EOT
<div id="repo{$i}" class="repository">
<h3 class="indent"><a href="viewCommits.php?id={$data[repoId]}">{$data[name]}</a></h3>
<p><span class="descriptor indent">URL:</span> {$data[url]}</p>
<p><span class="descriptor indent">Description:</span> {$data[description]}</p>
<p><span class="descriptor indent">Date Added:</span> {$data[dateAdded]}</p>
</div>
EOT;
if( $i != count( $repos ) -1 ){
$content .= "\n<br/>\n<br/>\n";
}
else {
$content .= "\n</div>\n";
}
}
/*
** P U T V A R S
** O N P A G E
*/
head($title,$style,$scripts);
body($header,$subtitle,$content,$navigation);
foot($footer,$dbc);
?>