diff --git a/common.php b/common.php index f6c3a62..3d0030e 100644 --- a/common.php +++ b/common.php @@ -632,6 +632,27 @@ function filecache($disktag) return $cache; } +function findIndexPath($rootpath, $path = '') +{// find the path of the first 'index.php' that not in rootpath. + global $slash; + if (substr($rootpath,-1)==$slash) $rootpath = substr($rootpath, 0, -1); + if (substr($path,0,1)==$slash) $path = substr($path, 1); + $handler=opendir(path_format($rootpath.$slash.$path)); //打开当前文件夹 + while($filename=readdir($handler)){ + if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作 + $nowname = path_format($rootpath.$slash.$path.$slash.$filename); + if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归 + $res = findIndexPath($rootpath, $path.$slash.$filename); + if ($res!=='') return $res; + }else{ + if ($filename==='index.php') if ($path!='') return $rootpath.$slash.$path; + } + } + } + @closedir($handler); + return ''; +} + function sortConfig(&$arr) { ksort($arr); @@ -952,7 +973,8 @@ function needUpdate() $current_ver = explode(urldecode('%0D'),$current_ver)[0]; $split = splitfirst($current_version, '.' . $current_ver)[0] . '.' . $current_ver; if (!($github_version = getcache('github_version'))) { - $tmp = curl('GET', 'https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version'); + //$tmp = curl('GET', 'https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version'); + $tmp = curl('GET', 'https://git.hit.edu.cn/ysun/OneManager-php/-/raw/master/version'); if ($tmp['stat']==0) return 0; $github_version = $tmp['body']; savecache('github_version', $github_version); @@ -1256,7 +1278,7 @@ function EnvOpt($needUpdate = 0) $html = '