Example #1
0
html_style();
html_breadcrumbs();
html_pages();
if (isset($_GET['p'])) {
    html_spacer();
    html_summary($_GET['p']);
    html_spacer();
    if ($_GET['a'] == "commitdiff") {
        html_title("diff --git {$_GET['p']} {$_GET['h']}");
        html_diff($_GET['p'], $_GET['h']);
    } elseif (isset($_GET['tr'])) {
        html_title("Files");
        html_browse($_GET['p']);
    }
} else {
    html_spacer();
    html_home();
}
html_title("Help");
if (isset($_GET['p'])) {
    html_help($_GET['p']);
} else {
    html_help("projectname.git ");
}
html_footer();
die;
// ******************************************************
function html_summary($proj)
{
    global $nr_of_shortlog_lines;
    $repopath = get_repo_path($proj);
Example #2
0
function check_verify_bundle()
{
    $success = true;
    $repo = $_GET['p'];
    $what = $_FILES['bundle_file']['tmp_name'];
    $out1 = array();
    if ($success) {
        $success = $success && check_new_head_in_bundle($what, $out1);
    }
    if ($success) {
        $success = $success && save_bundle();
    }
    html_spacer();
    if ($success) {
        html_title("REGISTERED");
    } else {
        html_title("!!! ERROR !!!");
    }
    html_spacer();
    echo "<table>\n";
    foreach ($out1 as $out) {
        echo "<tr><td>{$out}</td></tr>\n";
    }
    echo "</table>\n";
    return $status;
}
Example #3
0
function git_render_page()
{
    global $git_embed, $repos;
    $git_embed = true;
    /* Add the default css */
    $git_css = true;
    /* Add the git logo in the footer */
    $git_logo = true;
    $title = "git";
    $repo_index = "index.aux";
    $repo_directory = '/home/david/git/';
    $geshi_directory = '/home/david/src/mediawiki/extensions/SyntaxHighlight_GeSHi/geshi';
    //if git is not installed into standard path, we need to set the path
    $mypath = getenv("PATH");
    $addpath = "/usr/lib/git-core";
    if (isset($mypath)) {
        $mypath .= ":{$addpath}";
    } else {
        $mypath = $addpath;
    }
    putenv("PATH={$mypath}");
    //repos could be made by an embeder script
    if (!is_array($repos)) {
        $repos = array();
    }
    if (file_exists($repo_index)) {
        $r = file($repo_index);
        foreach ($r as $repo) {
            $repos[] = trim($repo);
        }
    } else {
        if (file_exists($repo_directory) && is_dir($repo_directory)) {
            if ($handle = opendir($repo_directory)) {
                while (false !== ($file = readdir($handle))) {
                    if ($file != "." && $file != "..") {
                        /* TODO: Check for valid git repos */
                        $repos[] = trim($repo_directory . $file);
                    }
                }
                closedir($handle);
            }
        }
    }
    sort($repos);
    if ($geshi_directory != '') {
        require "{$geshi_directory}/geshi.php";
    }
    if (!isset($git_embed) && $git_embed != true) {
        $git_embed = false;
    }
    foreach ($_GET as $var => $val) {
        $_GET[$var] = str_replace(";", "", $_GET[$var]);
    }
    $str = '';
    if (isset($_GET['dl'])) {
        if ($_GET['dl'] == 'targz') {
            write_targz(get_repo_path($_GET['p']));
        } else {
            if ($_GET['dl'] == 'zip') {
                write_zip(get_repo_path($_GET['p']));
            } else {
                if ($_GET['dl'] == 'git_logo') {
                    write_git_logo();
                } else {
                    if ($_GET['dl'] == 'plain') {
                        write_plain();
                    } else {
                        if ($_GET['dl'] == 'rss2') {
                            write_rss2();
                        }
                    }
                }
            }
        }
    }
    $str .= html_header($title);
    $str .= html_style($git_css);
    $str .= html_breadcrumbs();
    if (isset($_GET['p'])) {
        $str .= html_spacer();
        $str .= html_desc($_GET['p']);
        $str .= html_spacer();
        $str .= html_summary($_GET['p']);
        $str .= html_spacer();
        if ($_GET['a'] == "commitdiff") {
            $str .= html_diff($_GET['p'], $_GET['c'], $_GET['cp']);
        } else {
            $str .= html_browse($_GET['p']);
        }
    } else {
        $str .= html_spacer();
        $str .= html_home($repos);
    }
    $str .= html_footer($git_logo);
    return $str;
}
Example #4
0
function html_pages()
{
    global $git_bundle_active;
    if (isset($_GET['p'])) {
        html_spacer();
        $now = floor(time() / 15 / 60);
        // one hour
        echo "<center>";
        echo "<a href=\"git.php?p=" . $_GET['p'] . "&tm={$now}\">browse</a>";
        if ($git_bundle_active) {
            echo " | <a href=\"commit.php?p={$_GET['p']}\">commit</a>";
        }
        echo "</center>";
    }
}