Example #1
0
function security_load_names()
{
    global $validargs, $repo_direcotry, $repo_suffix, $branches, $tags;
    if (isset($_GET['p'])) {
        // now load the repository into validargs
        $proj = $_GET['p'];
        $out = array();
        $branches = git_parse($proj, "branches");
        foreach (array_keys($branches) as $tg) {
            $validargs[] = $tg;
        }
        $tags = git_parse($proj, "tags");
        foreach (array_keys($tags) as $tg) {
            $validargs[] = $tg;
        }
        // add files
        unset($out);
        $head = "HEAD";
        if (isset($_GET['tr']) && is_valid($_GET['tr'])) {
            $head = $_GET['tr'];
        }
        $cmd = "GIT_DIR=" . get_repo_path($proj) . $repo_suffix . " git ls-tree -r -t " . escapeshellarg($head) . " 2>&1 | sed -e 's/\t/ /g'";
        exec($cmd, &$out);
        foreach ($out as $line) {
            $arr = explode(" ", $line);
            //$validargs[] = $arr[2]; // add the hash to valid array
            $validargs[] = basename($arr[3]);
            // add the file name to valid array
        }
    }
}
Example #2
0
function html_listheads($proj)
{
    $str = '';
    $repo = get_repo_path($proj);
    $heads = git_parse($repo, 'branches');
    $str .= "<table>\n";
    foreach ($heads as $n => $h) {
        $c = git_commit($repo, $h);
        $date = date("D n/j/y G:i", (int) $c['date']);
        $cid = $c['commit_id'];
        $pid = $c['parent'][0];
        $mess = html_ahref(array('p' => $_GET['p'], 'a' => 'commitdiff', 'c' => $cid, 'cp' => $pid), short_desc($c['message'], 110), 'shortlog');
        $str .= "<tr><td>{$date}</td><td>{$c['author']}</td><td>{$mess}</td><td>{$n}</td></tr>\n";
    }
    $str .= "</table>\n";
    return $str;
}