diff --git a/common.php b/common.php index 289e031..fe6940e 100644 --- a/common.php +++ b/common.php @@ -902,10 +902,11 @@ function message($message, $title = 'Message', $statusCode = 200) function needUpdate() { - $current_ver = file_get_contents(__DIR__ . '/version'); - $current_ver = substr($current_ver, strpos($current_ver, '.')+1); + $current_version = file_get_contents(__DIR__ . '/version'); + $current_ver = substr($current_version, strpos($current_version, '.')+1); $current_ver = explode(urldecode('%0A'),$current_ver)[0]; $current_ver = explode(urldecode('%0D'),$current_ver)[0]; + $split = splitfirst($current_version, '.' . $current_ver)[0] . '.' . $current_ver; //$github_version = file_get_contents('https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version'); $tmp = curl_request('https://raw.githubusercontent.com/qkqpttgf/OneManager-php/master/version'); if ($tmp['stat']==0) return 0; @@ -914,7 +915,9 @@ function needUpdate() $github_ver = explode(urldecode('%0A'),$github_ver)[0]; $github_ver = explode(urldecode('%0D'),$github_ver)[0]; if ($current_ver != $github_ver) { - $_SERVER['github_version'] = $github_version; + //$_SERVER['github_version'] = $github_version; + $_SERVER['github_ver_new'] = splitfirst($github_version, $split)[0]; + $_SERVER['github_ver_old'] = splitfirst($github_version, $_SERVER['github_ver_new'])[1]; return 1; } return 0; @@ -1924,8 +1927,12 @@ function EnvOpt($needUpdate = 0) '; } if ($needUpdate) { - $html .= '
- ' . str_replace("\r", '
',$_SERVER['github_version']) . ' + $html .= '
+ ' . str_replace("\r", '
', $_SERVER['github_ver_new']) . ' +
+ +'; }/* else { $html .= getconstStr('NotNeedUpdate');