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) {
Beispiel #2
0
<?php

include 'Curl.php';
$curl = new Curl("https://api.github.com/", "e4e777a90dec520e6d9bc42edbb05e88dfbf2733");
if (isset($_REQUEST['repository'])) {
    getCommits($curl, $_REQUEST['repository']);
} else {
    getRepos($curl);
}
function getRepos($curl)
{
    $info = $curl->send("user/repos", "GET");
    echo '<img class="profile" src="' . $info[0]->owner->avatar_url . '"></img>';
    //https://avatars.githubusercontent.com/u/14833438?v=3"
    echo '<a href="' . $info[0]->owner->html_url . '"><h2>' . $info[0]->owner->login . '\'s Repositories</h2></a>';
    echo '<ul class="list-group">';
    foreach ($info as $value) {
        $created = str_replace("T", " ", $value->created_at);
        $created = str_replace("Z", "", $created);
        $updated = str_replace("T", " ", $value->updated_at);
        $updated = str_replace("Z", "", $updated);
        echo '<a href="' . $_SERVER['PHP_SELF'] . '?repository=' . $value->name . '">';
        echo '<li class="list-group-item row">';
        echo '<h3 class="title col-sm-4">' . $value->name . '<i class="icon-' . strtolower($value->language) . '"></i></h3>';
        echo '<h4 class="col-sm-4"> data de creacio : ' . $created . '</h4>';
        echo '<h4 class="col-sm-4"> ultima actualitzacio : ' . $updated . '</h4>';
        echo '</li></a>';
    }
    echo '</ul>';
}
function getCommits($curl, $repo)
Beispiel #3
0
    $iteration = $options['i'];
}
if (isset($options['c']) && $options['c'] !== false && is_numeric($options['c'])) {
    $nbCommits = $options['c'];
}
if (isset($options['no-merged-branch'])) {
    $displayNoMergedBranches = false;
}
if (isset($options['no-stat'])) {
    $displayStats = false;
}
//--------
// Compute
//--------
$currentBranch = getCurrentBranch($gitDir);
$commits = getCommits($iteration, $gitDir);
$lastDaysInfos = getBackwardInfos($commits, 'd/m', 'Y-m-d', 'days', $iteration);
$lastHoursInfos = getBackwardInfos($commits, 'H\\h', 'Y-m-d H:', 'hours', $iteration);
$lastMinutesInfos = getBackwardInfos($commits, 'H\\hi', 'Y-m-d H:i:', 'minutes', $iteration);
$noMergedBranchesInfos = $displayNoMergedBranches ? getNoMergedBranchesInfos($gitDir) : array();
$stats = $displayStats ? getStats($commits) : array();
//--------
// Display
//--------
passthru("tput clear");
// Display project infos
printf("Project: %s\n", $gitDir);
printf("Current branch: %s\n", $currentBranch);
printf("Current date: %s\n", date('d/m/Y H:i:s'));
printf("\n");
// Display time-report