Merge pull request #30 from hiagohubert/master
Check if b374k is in a git repository
This commit is contained in:
commit
dfabccb364
|
@ -24,6 +24,7 @@
|
|||
#tobottom{-webkit-transform:scaleY(-1);-moz-transform:scaleY(-1);-o-transform:scaleY(-1);transform:scaleY(-1);filter:FlipV;-ms-filter:"FlipV";}
|
||||
#showinfo{float:right;display:none;}
|
||||
#logout{float:right;}
|
||||
.git_alert{font-weight: bold; color:#ef793e; font-size: 16px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -64,6 +65,11 @@
|
|||
foreach(get_server_info() as $k=>$v){
|
||||
echo "<div>".$v."</div>";
|
||||
}
|
||||
|
||||
if(is_git_repo(getcwd())){
|
||||
echo "<p class=\"git_alert\">Warning: b374k is running under a git repository!</p>
|
||||
<a href=\"#\"> Click here to hide b374k from git </a>";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<!--server info end-->
|
||||
|
|
|
@ -985,4 +985,24 @@ if(!function_exists('output')){
|
|||
die();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!function_exists('is_git_repo')){
|
||||
function is_git_repo(){
|
||||
return boolval( find_git_repo(getcwd().DIRECTORY_SEPARATOR.".git") );
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('find_git_repo')){
|
||||
function find_git_repo($path){
|
||||
if(dirname($path) == DIRECTORY_SEPARATOR){
|
||||
return false;
|
||||
}else if(is_dir(dirname($path).DIRECTORY_SEPARATOR.".git")){
|
||||
return dirname($path).DIRECTORY_SEPARATOR.".git";
|
||||
}else{
|
||||
return find_git_repo(dirname($path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue