getver($conf['version']) && !empty($update['version']) ) {
echo ' ';
echo '
当前版本:'.$conf['version'].',发现新版本:'.$update['version'].'
查看发行版
'.$update['update_log'].'
';
} else if(!empty($update['version'])) {
echo '
- 当前版本:'.$conf['version'].'
- 最新版本:'.$update['version'].'
';
} else {
echo '检查更新失败!
open($src)===true) {
$zip->extractTo($dest);
$zip->close();
return true;
}
return false;
}
function deldir($dir) {
if(!is_dir($dir))return false;
$dh=opendir($dir);
while ($file=readdir($dh)) {
if($file!="." && $file!="..") {
$fullpath=$dir."/".$file;
if(!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
closedir($dh);
if(rmdir($dir)) {
return true;
} else {
return false;
}
}
$scriptpath=str_replace('\\','/',$_SERVER['SCRIPT_NAME']);
$scriptpath = substr($scriptpath, 0, strrpos($scriptpath, '/'));
$admin_path = substr($scriptpath, strrpos($scriptpath, '/')+1);
$RemoteFile = $update['file'];
$ZipFile = "lylme_spage_update.zip";
copy($RemoteFile,$ZipFile) or die("无法下载更新包文件!".'返回上级');
if (zipExtract($ZipFile,ROOT)) {
if($admin_path!='admin' && is_dir(ROOT.'admin')) {
//修改后台地址
deldir(ROOT.$admin_path);
rename(ROOT.'admin',ROOT.$admin_path);
}
if(function_exists("opcache_reset"))@opcache_reset();
$upsql=true;
unlink($ZipFile);
} else {
unlink($ZipFile);
echo('');
}
}
if($set=='updatesql' || $upsql==true) {
$vn=explode('.',str_replace('v','',$conf['version']));
$vernum = $vn[0].sprintf("%02d",$vn[1]).sprintf("%02d",$vn[2]);
if($vernum < 10100) {
exit("");
}
if($vernum < 10101) {
$sql = file_get_contents(ROOT.'install/update.sql');
$version = 'v1.1.1';
}
if($vernum < 10103) {
@unlink(ROOT.'include/head.php');
@unlink(ROOT.'include/home.php');
@unlink(ROOT.'include/apply.php');
@unlink(ROOT.'include/footer.php');
$sql = $sql.file_get_contents(ROOT.'install/update1.sql');
$version = 'v1.1.3';
}
if($vernum < 10104) {
$version = 'v1.1.4';
}else {
exit("");
}
saveSetting('version',$version);
$sql=explode(';',$sql);
$t=0;
$e=0;
$error='';
for ($i=0;$iquery($sql[$i])) {
++$t;
} else {
++$e;
$error.=$DB->error().'\n';
}
}
echo('');
}
include './footer.php';
?>