$arg = explode("=", $arg, 2);
$_GET[$arg[0]] = $arg[1];
}
+
+function scandir_replace($folder,$arg){
+ $out = array();
+ if($content = opendir($folder)){
+ while(false !== ($file = readdir($content))){
+ if(is_dir("$folder/$file") && $file != "." && $file != ".." && $file != ".git"){
+ scandir_replace("$folder/$file",$arg);
+ } elseif($file != "." && $file != ".." && $file != ".git"){
+ $out[] = "$folder/$file";
+ }
+ }
+ closedir($content);
+ }
+ foreach($out as $id => $v) {
+ chmod($v,0777);
+ $maincode=file_get_contents($v);
+ $maincode = str_replace('$__GIT__', '"'.$arg.'"', $maincode); // replace $__GIT__ with the git version
+ $fp = fopen($v, 'w');
+ fwrite($fp, $maincode);
+ fclose($fp);
+ }
+}
+
if(isset($_GET['p'])){
if(file_exists("/home/git/".$_GET['p'])){
$hash = shell_exec("git --git-dir=/home/git/".$_GET["p"]." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'");
echo '<meta http-equiv="refresh" content="0; URL='.$_SERVER['HTTP_REFERER'].'"> ';
}else{
$b = shell_exec("cd /usr/share/gitweb/dl; git clone git://git.nexus-irc.de/".$_GET['build']);
+ scandir_replace("/usr/share/gitweb/dl/".$name,"git-".substr($con, 0, -1)."-".substr($hash, 0, -1));
$c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-".substr($hash, 0, -1).".tar.gz ".$name);
$d = shell_exec("rm -r /usr/share/gitweb/dl/".$name);
echo '<meta http-equiv="refresh" content="0; URL='.$_SERVER['HTTP_REFERER'].'"> ';
if(file_exists("/home/git/".$_GET['build2'])){
$name=substr($_GET['build2'],0,strlen($_GET['build2'])-4);
if(strtolower($_GET['h']) == "head") {
- $hash = shell_exec("git --git-dir=/home/git/".$_GET['p']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'");
+ $hash = substr(shell_exec("git --git-dir=/home/git/".$_GET['build2']." rev-list -n 1 --pretty='format:%h' --header master | grep '^[0-9a-f]*$'"), 0, -1);
}else{
$hash = substr($_GET['h'], 0, 7);
}
}else{
$b = shell_exec("cd /usr/share/gitweb/dl/; git clone git://git.nexus-irc.de/".$_GET['build2']);
$c = shell_exec("cd /usr/share/gitweb/dl/".$name."/; git reset ".$_GET['h']);
+ $con= shell_exec('git --git-dir=/home/git/'.$_GET['build2'].' rev-list --oneline --header master | wc -l | sed "s/[ \t]//g"');
+ scandir_replace("/usr/share/gitweb/dl/".$name,"git-".substr($con, 0, -1)."-".$hash);
$c = shell_exec("cd /usr/share/gitweb/dl; tar czfv ".$name."-".$hash.".tar.gz ".$name);
$d = shell_exec("rm -r /usr/share/gitweb/dl/".$name);
header("Content-Type: application/x-gzip");