function git_project_info($projectroot, $project)
{
    $projinfo = array();
    $projinfo["project"] = $project;
    $projinfo["descr"] = git_project_descr($projectroot, $project, TRUE);
    $projinfo["owner"] = git_project_owner($projectroot, $project);
    $head = git_read_head($projectroot . $project);
    $commit = git_read_commit($projectroot . $project, $head);
    $projinfo["age"] = $commit['age'];
    $projinfo["age_string"] = $commit['age_string'];
    return $projinfo;
}
function git_project_info($projectroot, $project)
{
    $git = new Git($projectroot . $project);
    $projinfo = array();
    $projinfo["project"] = $project;
    $projinfo["descr"] = git_project_descr($projectroot, $project, TRUE);
    $projinfo["owner"] = git_project_owner($projectroot, $project);
    try {
        $head = git_read_head($git, $project);
        $commit = git_read_commit($git, $head);
    } catch (Exception $e) {
        $head = '';
        $commit = array('age' => false, 'age_string' => false, 'age_class' => 'noage');
    }
    $projinfo['age_class'] = $commit['age_class'];
    $projinfo["age"] = $commit['age'];
    $projinfo["age_string"] = $commit['age_string'];
    return $projinfo;
}
Esempio n. 3
0
        require_once 'include/cache.cache_expire.php';
        cache_expire($gitphp_conf['projectroot'], $project, isset($git_projects) ? $git_projects : null);
    }
}
/*
 * Setup global assigns used everywhere (such as header/footer)
 */
$tpl->assign("stylesheet", $gitphp_conf['stylesheet']);
$tpl->assign("version", $gitphp_version);
$tpl->assign("pagetitle", $gitphp_conf['title']);
$tpl->assign("maintitle", $gitphp_conf['maintitle']);
if ($project) {
    $tpl->assign("validproject", TRUE);
    $tpl->assign("project", $project);
    require_once 'include/gitutil.git_project_descr.php';
    $tpl->assign("projectdescription", git_project_descr($gitphp_conf['projectroot'], $project));
    if (isset($_GET['a'])) {
        $tpl->assign("action", $_GET['a']);
        $tpl->assign("validaction", TRUE);
    }
}
if (isset($_GET['st'])) {
    $tpl->assign("currentsearchtype", $_GET['st']);
} else {
    $tpl->assign("currentsearchtype", "commit");
}
if (isset($_GET['s'])) {
    $tpl->assign("currentsearch", $_GET['s']);
}
if (isset($_GET['hb'])) {
    $tpl->assign("currentsearchhash", $_GET['hb']);
Esempio n. 4
0
function git_summary($projectroot, $project)
{
    global $tpl, $gitphp_conf;
    $cachekey = sha1($project);
    if (!$tpl->is_cached('project.tpl', $cachekey)) {
        $descr = git_project_descr($projectroot, $project);
        $head = git_read_head($projectroot . $project);
        $commit = git_read_commit($projectroot . $project, $head);
        $commitdate = date_str($commit['committer_epoch'], $commit['committer_tz']);
        $owner = git_project_owner($projectroot, $project);
        $refs = read_info_ref($projectroot . $project);
        $tpl->assign("head", $head);
        $tpl->assign("description", $descr);
        $tpl->assign("owner", $owner);
        $tpl->assign("lastchange", $commitdate['rfc2822']);
        if (isset($gitphp_conf['cloneurl'])) {
            $tpl->assign('cloneurl', $gitphp_conf['cloneurl'] . $project);
        }
        if (isset($gitphp_conf['pushurl'])) {
            $tpl->assign('pushurl', $gitphp_conf['pushurl'] . $project);
        }
        $revlist = git_read_revlist($projectroot . $project, $head, 17);
        foreach ($revlist as $i => $rev) {
            $revdata = array();
            $revco = git_read_commit($projectroot . $project, $rev);
            $authordate = date_str($revco['author_epoch']);
            $revdata["commit"] = $rev;
            if (isset($refs[$rev])) {
                $revdata["commitref"] = $refs[$rev];
            }
            $revdata["commitage"] = $revco['age_string'];
            $revdata["commitauthor"] = $revco['author_name'];
            if (strlen($revco['title_short']) < strlen($revco['title'])) {
                $revdata["title"] = $revco['title'];
                $revdata["title_short"] = $revco['title_short'];
            } else {
                $revdata["title_short"] = $revco['title'];
            }
            $revlist[$i] = $revdata;
        }
        $tpl->assign("revlist", $revlist);
        $taglist = git_read_refs($projectroot, $project, "refs/tags");
        if (isset($taglist) && count($taglist) > 0) {
            foreach ($taglist as $i => $tag) {
                if (isset($tag['comment'])) {
                    $com = trim($tag['comment'][0]);
                    if (strlen($com) > GITPHP_TRIM_LENGTH) {
                        $com = substr($trimmed, 0, GITPHP_TRIM_LENGTH) . "...";
                    }
                    $taglist[$i]['comment'] = $com;
                }
            }
            $tpl->assign("taglist", $taglist);
        }
        $headlist = git_read_refs($projectroot, $project, "refs/heads");
        if (isset($headlist) && count($headlist) > 0) {
            $tpl->assign("headlist", $headlist);
        }
    }
    $tpl->display('project.tpl', $cachekey);
}