} else { echo '<a href="index.php?mod=update&act=do" class="btn btn-primary btn-block">立即更新到最新版本</a>'; } echo '<hr/><div class="well">' . $res['uplog'] . '</div>'; } break; case 'do': if (isset($_GET['test'])) { $checkurl = 'http://cron.aliapp.com/api/check.php?test=true&ver=' . VERSION; } $res = get_curl($checkurl); $res = json_decode($res, true); $RemoteFile = $res['file']; $ZipFile = "Archive.zip"; copy($RemoteFile, $ZipFile) or die("无法下载更新包文件!" . '<a href="index.php?mod=update">返回上级</a>'); if (zipExtract($ZipFile, ROOT)) { echo "程序更新成功!<br>"; echo '<a href="./">返回首页</a>'; unlink($ZipFile); } else { echo "无法解压文件!<br>"; echo '<a href="index.php?mod=update">返回上级</a>'; if (file_exists($ZipFile)) { unlink($ZipFile); } } break; } echo '</div></div>'; } else { showmsg('后台管理登录失败。请以管理员身份 <a href="index.php?mod=login">重新登录</a>!', 3);
switch ($act) { default: $newv = newversion($url); $newlink = newlink($url); $newcontent = newcontent($url); if ($v === $newv) { echo '程序是最新版本!'; } else { echo '发现新版本!<br>版本号:' . $newv . '<br>'; echo '更新内容:<br>' . $newcontent . '<br>'; echo '<a href="?act=update&url=' . $newlink . '">点击更新</a>'; } break; case 'update': $RemoteFile = rawurldecode($_GET["url"]); $ZipFile = "Archive.zip"; $Dir = "./"; copy($RemoteFile, $ZipFile) or die("无法下载更新包文件!" . '<a href="' . $xxdz . '">返回上级</a>'); if (zipExtract($ZipFile, $Dir)) { echo "程序更新成功!<br>"; echo '<a href="' . $xxdz . '">返回上级</a>'; unlink($ZipFile); } else { echo "无法解压文件!<br>"; echo '<a href="' . $xxdz . '">返回上级</a>'; if (file_exists($ZipFile)) { unlink($ZipFile); } } break; }