Beispiel #1
0
        write_img_png($_GET['dl']);
    } elseif ($_GET['dl'] == 'dlfile') {
        write_dlfile();
    } elseif ($_GET['dl'] == 'rss2') {
        write_rss2();
    } elseif (in_array($_GET['dl'], $arrowdesc, true)) {
        draw_arrow($_GET['dl']);
    }
}
html_header();
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']);
Beispiel #2
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;
}