Commit | Line | Data |
---|---|---|
8a1b4b56 S |
1 | <?php |
2 | if(isset($_GET['p'])){ | |
3 | if(file_exists("/home/git/".$_GET['p'])){ | |
4 | $hash = shell_exec("git --git-dir=/home/git/".$_GET["p"]." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"); | |
5 | $con= shell_exec('git --git-dir=/home/git/'.$_GET["p"].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); | |
6 | if(!$hash){ | |
7 | echo "<p>".$_GET["p"].": No Download available</p>"; | |
8 | }else{ | |
9 | $name=substr($_GET["p"],0,strlen($_GET["p"])-4); | |
10 | if(file_exists("/usr/share/gitweb/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz")) { | |
11 | echo "<p>".$_GET["p"].": Download <a href='http://git.nexus-irc.de/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz'>git-".substr($con, 0, -1)."-".substr($hash, 0, -1)."</a></p>"; | |
12 | } else { | |
13 | echo "<p>".$_GET["p"].": No Download available (<a href='http://git.nexus-irc.de/git_download.php?build2=".$_GET["p"]."'>Build snapshot</a>)</p>"; | |
14 | } | |
15 | } | |
16 | }else{ | |
17 | echo "unknown project"; | |
18 | } | |
19 | }elseif(isset($_GET['build'])){ | |
20 | if(file_exists("/home/git/".$_GET['build'])){ | |
21 | $name=substr($_GET['build'],0,strlen($_GET['build'])-4); | |
22 | if(file_exists("/usr/share/gitweb/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz")) { | |
23 | echo '<meta http-equiv="refresh" content="0; URL=http://git.nexus-irc.de/?a=downloads"> '; | |
24 | }else{ | |
25 | $hash = shell_exec("git --git-dir=/home/git/".$_GET['build']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"); | |
26 | $con= shell_exec('git --git-dir=/home/git/'.$_GET['build'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); | |
27 | $b = shell_exec("cd /usr/share/gitweb/dl; git clone git://git.nexus-irc.de/".$_GET['build']); | |
28 | $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz ".$name); | |
29 | $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name); | |
30 | echo '<meta http-equiv="refresh" content="0; URL=http://git.nexus-irc.de/?a=downloads"> '; | |
31 | } | |
32 | }else{ | |
33 | echo "unknown project"; | |
34 | } | |
35 | }elseif(isset($_GET['build2'])){ | |
36 | if(file_exists("/home/git/".$_GET['build2'])){ | |
37 | $name=substr($_GET['build2'],0,strlen($_GET['build2'])-4); | |
38 | if(file_exists("/usr/share/gitweb/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz")) { | |
39 | echo '<meta http-equiv="refresh" content="0; URL=http://git.nexus-irc.de/?p='.$_GET['build2'].';a=download"> '; | |
40 | }else{ | |
41 | $hash = shell_exec("git --git-dir=/home/git/".$_GET['build2']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"); | |
42 | $con= shell_exec('git --git-dir=/home/git/'.$_GET['build2'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); | |
43 | $b = shell_exec("cd /usr/share/gitweb/dl/; git clone git://git.nexus-irc.de/".$_GET['build2']); | |
44 | $c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz ".$name); | |
45 | $d = shell_exec("rm -r /usr/share/gitweb/dl/".$name); | |
46 | echo '<meta http-equiv="refresh" content="0; URL=http://git.nexus-irc.de/?p='.$_GET['build2'].';a=download"> '; | |
47 | } | |
48 | }else{ | |
49 | echo "unknown project"; | |
50 | } | |
51 | }else{ | |
52 | $a = file_get_contents("http://git.nexus-irc.de/index.cgi?a=project_index2"); | |
53 | $b = explode("\n",$a); | |
54 | foreach($b as $id => $v) { | |
55 | if($v == ""){ }else{ | |
56 | $hash = shell_exec("git --git-dir=/home/git/".$v." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"); | |
57 | $con= shell_exec('git --git-dir=/home/git/'.$v.' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"'); | |
58 | if(!$hash){ | |
59 | echo "<p>".$v.": No Download available</p>"; | |
60 | }else{ | |
61 | $name=substr($v,0,strlen($v)-4); | |
62 | if(file_exists("/usr/share/gitweb/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz")) { | |
63 | echo "<p>".$v.": Download <a href='http://git.nexus-irc.de/dl/".$name."-git-".substr($con, 0, -1)."-".substr($hash, 0, -1).".tar.gz'>git-".substr($con, 0, -1)."-".substr($hash, 0, -1)."</a></p>"; | |
64 | } else { | |
65 | echo "<p>".$v.": No Download available (<a href='http://git.nexus-irc.de/git_download.php?build=".$v."'>Build snapshot</a>)</p>"; | |
66 | } | |
67 | } | |
68 | } | |
69 | } | |
70 | } | |
71 | ?> |