/
viewCommits.php
82 lines (58 loc) · 2.33 KB
/
viewCommits.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
<?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 Commits';
$subtitle = Config::get( 'siteName' );
$content = '<div id="commits"></div>'."\n";
$content .= '<div id="pagination" class="pagination"></div><br/>';
$commits = getCommits( $_GET['id'] ); /* Get commits */
$js = 'var commits = new Array(';
for( $i = 0; $i < count( $commits ); $i++ ) {
$js .= ' { "commitMessage": "'. addslashes( $commits[$i]['commitMessage'] ).'",
"commitVal": "'. $commits[$i]['commitVal'] .'",
"commitDateTime": "'. $commits[$i]['commitDateTime'] .'",
"commitAuthor": "'. $commits[$i]['commitAuthor'] .'",
"commitId": "'. $commits[$i]['commitId'] .'",
"repoId": "'. $_GET['id'] .'",
"filechanges": new Array( ';
for( $j = 0; $j < count( $commits[$i]['fileChanges'] ); $j++ ) {
$js .= '{ "file": "'. $commits[$i]['fileChanges'][$j]['file'] .'",
"insertions": "'. $commits[$i]['fileChanges'][$j]['insertions'] .'",
"deletions": "'. $commits[$i]['fileChanges'][$j]['deletions'] .'" }';
if( $j != count( $commits[$i]['fileChanges'] ) - 1 ){
$js .= ",\n";
}
}
$js .= ') }';
if( $i != count( $commits ) - 1 ){
$js .= ",\n";
}
}
$js .= ");";
/*
** P U T V A R S
** O N P A G E
*/
head($title,$style,$scripts,$js);
body($header,$subtitle,$content,$navigation);
foot($footer,$dbc);
?>