@@ -1,7 +1,5 @@ | |||||
<?php | <?php | ||||
/** | /** | ||||
* 更新服务器,如果有变动,请到 http://bbs.dedecms.com 查询 | |||||
* | |||||
* @version $Id: config_update.php 1 11:36 2011-2-21 tianya $ | * @version $Id: config_update.php 1 11:36 2011-2-21 tianya $ | ||||
* @package DedeCMS.Administrator | * @package DedeCMS.Administrator | ||||
* @copyright Copyright (c) 2020, DedeBIZ.COM | * @copyright Copyright (c) 2020, DedeBIZ.COM | ||||
@@ -10,6 +8,3 @@ | |||||
*/ | */ | ||||
//更新服务器,如果有变动,请到 https://www.dedebiz.com 查询 | //更新服务器,如果有变动,请到 https://www.dedebiz.com 查询 | ||||
define('UPDATEHOST', 'http://updatenew.dedecms.com/base-v57/'); | |||||
define('LINKHOST', 'http://flink.dedecms.com/server_url.php'); |
@@ -14,22 +14,6 @@ function ListAll(){ | |||||
myajax.SendGet('index_body.php?dopost=editshow'); | myajax.SendGet('index_body.php?dopost=editshow'); | ||||
} | } | ||||
function LoadUpdateInfos(){ | |||||
$DE('updateinfos').innerHTML = "<div style=\"height:90px;\"><img src='images/loadinglit.gif' /> 正在处理中...</div>"; | |||||
var myajax = new DedeAjax($DE('updateinfos')); | |||||
myajax.SendGet('update_guide.php?dopost=test'); | |||||
} | |||||
function SkipReload(nnum){ | |||||
if( window.confirm("忽略后以后都不会再提示这个日期前的升级信息,你确定要忽略这些更新吗?") ) | |||||
{ | |||||
DedeXHTTP = null; | |||||
$DE('updateinfos').innerHTML = "<img src='images/loadinglit.gif' /> 正在处理中..."; | |||||
var myajax = new DedeAjax($DE('updateinfos')); | |||||
myajax.SendGet('update_guide.php?dopost=skip&vtime='+nnum); | |||||
} | |||||
} | |||||
function ShowWaitDiv(){ | function ShowWaitDiv(){ | ||||
$DE('loaddiv').style.display = 'block'; | $DE('loaddiv').style.display = 'block'; | ||||
return true; | return true; | ||||
@@ -42,12 +42,6 @@ if( is_dir(dirname(__FILE__).'/../install') ) | |||||
//更新服务器 | //更新服务器 | ||||
require_once (DEDEDATA.'/admin/config_update.php'); | require_once (DEDEDATA.'/admin/config_update.php'); | ||||
if ($dopost=='showad') | |||||
{ | |||||
include('templets/login_ad.htm'); | |||||
exit; | |||||
} | |||||
//检测后台目录是否更名 | //检测后台目录是否更名 | ||||
$cururl = GetCurUrl(); | $cururl = GetCurUrl(); | ||||
if(preg_match('/dede\/login/i',$cururl)) | if(preg_match('/dede\/login/i',$cururl)) | ||||
@@ -15,7 +15,7 @@ require_once(dirname(__FILE__)."/../include/oxwindow.class.php"); | |||||
if(empty($action)) $action = ''; | if(empty($action)) $action = ''; | ||||
require_once(DEDEDATA."/admin/config_update.php"); | require_once(DEDEDATA."/admin/config_update.php"); | ||||
$mdir = DEDEDATA.'/module'; | $mdir = DEDEDATA.'/module'; | ||||
$mdurl = UPDATEHOST.'dedecms/module_'.$cfg_soft_lang.'/modulelist.txt'; | |||||
$mdurl = ""; | |||||
function TestWriteAble($d) | function TestWriteAble($d) | ||||
{ | { | ||||
@@ -358,7 +358,6 @@ else if($action=='del') | |||||
$dm = new DedeModule($mdir); | $dm = new DedeModule($mdir); | ||||
$infos = $dm->GetModuleInfo($hash); | $infos = $dm->GetModuleInfo($hash); | ||||
if($infos['url']=='') $infos['url'] = ' '; | |||||
$alertMsg = ($infos['lang']==$cfg_soft_lang ? '' : '<br /><font color="red">(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)</font>'); | $alertMsg = ($infos['lang']==$cfg_soft_lang ? '' : '<br /><font color="red">(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)</font>'); | ||||
$win = new OxWindow(); | $win = new OxWindow(); | ||||
@@ -369,43 +368,35 @@ else if($action=='del') | |||||
$win->AddHidden('action', 'delok'); | $win->AddHidden('action', 'delok'); | ||||
$msg = "<style>.dtb{border-bottom:1px dotted #cccccc}</style> | $msg = "<style>.dtb{border-bottom:1px dotted #cccccc}</style> | ||||
<table width='750' border='0' cellspacing='0' cellpadding='0'> | <table width='750' border='0' cellspacing='0' cellpadding='0'> | ||||
<tr> | |||||
<td width='200' height='28' class='dtb'>模块名称:</td> | |||||
<td width='550' class='dtb'>{$infos['name']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>语言:</td> | |||||
<td class='dtb'>{$infos['lang']} {$alertMsg}</td> | |||||
</tr> | |||||
<tr> | |||||
<td width='200' height='28' class='dtb'>文件大小:</td> | |||||
<td width='550' class='dtb'>{$infos['filesize']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>团队名称:</td> | |||||
<td class='dtb'>{$infos['team']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>发布时间:</td> | |||||
<td class='dtb'>{$infos['time']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>电子邮箱:</td> | |||||
<td class='dtb'>{$infos['email']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>官方网址:</td> | |||||
<td class='dtb'>{$infos['url']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>使用协议:</td> | |||||
<td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' colspan='2'> | |||||
删除模块仅删除这个模块的安装包文件,如果你已经安装,请执行<a href='module_main.php?hash={$hash}&action=uninstall'><u>卸载程序</u></a>来删除! | |||||
</td> | |||||
</tr> | |||||
<tr> | |||||
<td width='20%' height='28' class='dtb'>模块名称:</td> | |||||
<td width='80%' class='dtb'>{$infos['name']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>语言:</td> | |||||
<td class='dtb'>{$infos['lang']} {$alertMsg}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>文件大小:</td> | |||||
<td class='dtb'>{$infos['filesize']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>开发者ID:</td> | |||||
<td class='dtb'>{$infos['dev_id']} <a class='btn btn-secondary btn-sm' target='_blank' href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}'>查看详情</a></td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>发布时间:</td> | |||||
<td class='dtb'>{$infos['time']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>使用协议:</td> | |||||
<td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' colspan='2'> | |||||
删除模块仅删除这个模块的安装包文件,如果你已经安装,请执行<a href='module_main.php?hash={$hash}&action=uninstall'><u>卸载程序</u></a>来删除! | |||||
</td> | |||||
</tr> | |||||
</table> | </table> | ||||
"; | "; | ||||
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>"); | $win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>"); | ||||
@@ -459,25 +450,17 @@ else if($action=='uninstall') | |||||
<td class='dtb'>{$infos['lang']} {$alertMsg}</td> | <td class='dtb'>{$infos['lang']} {$alertMsg}</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td width='200' height='28' class='dtb'>文件大小:</td> | |||||
<td width='550' class='dtb'>{$infos['filesize']}</td> | |||||
<td height='28' class='dtb'>文件大小:</td> | |||||
<td class='dtb'>{$infos['filesize']}</td> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td height='28' class='dtb'>团队名称:</td> | |||||
<td class='dtb'>{$infos['team']}</td> | |||||
<td height='28' class='dtb'>开发者ID:</td> | |||||
<td class='dtb'>{$infos['dev_id']} <a class='btn btn-secondary btn-sm' target='_blank' href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}'>查看详情</a></td> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td height='28' class='dtb'>发布时间:</td> | <td height='28' class='dtb'>发布时间:</td> | ||||
<td class='dtb'>{$infos['time']}</td> | <td class='dtb'>{$infos['time']}</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td height='28' class='dtb'>电子邮箱:</td> | |||||
<td class='dtb'>{$infos['email']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>官方网址:</td> | |||||
<td class='dtb'>{$infos['url']}</td> | |||||
</tr> | |||||
<tr> | <tr> | ||||
<td height='28' class='dtb'>使用协议:</td> | <td height='28' class='dtb'>使用协议:</td> | ||||
<td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td> | <td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td> | ||||
@@ -621,25 +604,13 @@ else if($action=='view') | |||||
<td class='dtb'>{$infos['filesize']}</td> | <td class='dtb'>{$infos['filesize']}</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td height='28' class='dtb'>是否已安装:</td> | |||||
<td class='dtb'>{$setupinfo}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>团队名称:</td> | |||||
<td class='dtb'>{$infos['team']}</td> | |||||
<td height='28' class='dtb'>开发者ID:</td> | |||||
<td class='dtb'>{$infos['dev_id']} <a class='btn btn-secondary btn-sm' target='_blank' href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}'>查看详情</a></td> | |||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td height='28' class='dtb'>发布时间:</td> | <td height='28' class='dtb'>发布时间:</td> | ||||
<td class='dtb'>{$infos['time']}</td> | <td class='dtb'>{$infos['time']}</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td height='28' class='dtb'>电子邮箱:</td> | |||||
<td class='dtb'>{$infos['email']}</td> | |||||
</tr> | |||||
<tr> | |||||
<td height='28' class='dtb'>官方网址:</td> | |||||
<td class='dtb'>{$infos['url']}</td> | |||||
</tr> | |||||
<tr> | <tr> | ||||
<td height='28' class='dtb'>使用协议:</td> | <td height='28' class='dtb'>使用协议:</td> | ||||
<td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td> | <td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank'>点击浏览...</a></td> | ||||
@@ -689,8 +660,5 @@ function Download(); | |||||
--------------*/ | --------------*/ | ||||
else if($action=='download') | else if($action=='download') | ||||
{ | { | ||||
$model_remote_url = UPDATEHOST.'dedecms/module_'.$cfg_soft_lang.'/'.$hash.'.xml'; | |||||
$model_remote = file_get_contents($model_remote_url); | |||||
file_put_contents($mdir.'/'.$hash.'.xml',$model_remote); | |||||
echo "未安装 <a href='module_main.php?action=setup&hash={$hash}'><u>安装</u></a>"; | |||||
ShowMsg("暂不支持模块下载功能", "javascript:;"); | |||||
} | } |
@@ -72,7 +72,7 @@ | |||||
<?php | <?php | ||||
echo "<div class='updatedvt py-3'>"; | echo "<div class='updatedvt py-3'>"; | ||||
echo "安全操作:<a href='sys_data.php' class='btn btn-secondary btn-sm'>数据库备份/还原</a> <a href='sys_safetest.php' class='btn btn-secondary btn-sm'>病毒扫描</a> <a href='sys_repair.php' class='btn btn-secondary btn-sm'>系统错误修复</a></div>\r\n"; | echo "安全操作:<a href='sys_data.php' class='btn btn-secondary btn-sm'>数据库备份/还原</a> <a href='sys_safetest.php' class='btn btn-secondary btn-sm'>病毒扫描</a> <a href='sys_repair.php' class='btn btn-secondary btn-sm'>系统错误修复</a></div>\r\n"; | ||||
echo "<iframe name='stafrm' src='{$offUrl}&uptime={$oktime}' frameborder='0' id='stafrm' width='98%' height='150'></iframe>"; | |||||
echo "<iframe name='stafrm' src='{$offUrl}&uptime={$oktime}' frameborder='0' id='stafrm' width='98%' height='100'></iframe>"; | |||||
?> | ?> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
@@ -10,6 +10,7 @@ | |||||
<style> | <style> | ||||
body { | body { | ||||
background-color: #F5F5F5; | background-color: #F5F5F5; | ||||
font-size: 13px; | |||||
} | } | ||||
header { | header { | ||||
@@ -1,17 +0,0 @@ | |||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |||||
<html xmlns="http://www.w3.org/1999/xhtml"> | |||||
<head> | |||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>"> | |||||
<title>广告联系</title> | |||||
<link href="css/base.css" rel="stylesheet" type="text/css"> | |||||
<link href="css/login.css" rel="stylesheet" type="text/css"> | |||||
</head> | |||||
<body> | |||||
<!--<script type="text/javascript" src="<?php echo UPDATEHOST;?>/dedecms/loginad.<?php echo $cfg_soft_lang; ?>.js"></script>--> | |||||
<div class="dede-ad"> | |||||
<ul> | |||||
<script type="text/javascript"src="http://ad.dedecms.com/adsview/?action=single&key=admcploginad&charset=gbk"></script> | |||||
</ul> | |||||
</div> | |||||
</body> | |||||
</html> |
@@ -1,435 +0,0 @@ | |||||
<?php | |||||
/** | |||||
* 本文件用于从镜像服务器获取升级信息与文件 | |||||
* 并由用户自行控制升级 | |||||
* | |||||
* @version $Id: update_guide.php 1 23:54 2010年7月20日Z tianya $ | |||||
* @package DedeCMS.Administrator | |||||
* @copyright Copyright (c) 2020, DedeBIZ.COM | |||||
* @license https://www.dedebiz.com/license | |||||
* @link https://www.dedebiz.com | |||||
*/ | |||||
require(dirname(__FILE__).'/config.php'); | |||||
CheckPurview('sys_Edit'); | |||||
@set_time_limit(0); | |||||
require(DEDEINC.'/inc/inc_fun_funAdmin.php'); | |||||
require(DEDEINC.'/dedehttpdown.class.php'); | |||||
function TestWriteAble($d) | |||||
{ | |||||
$tfile = '_dedet.txt'; | |||||
$fp = @fopen($d.$tfile,'w'); | |||||
if(!$fp) { | |||||
return false; | |||||
} | |||||
else { | |||||
fclose($fp); | |||||
$rs = @unlink($d.'/'.$tfile); | |||||
return true; | |||||
} | |||||
} | |||||
function GetDirName($filename) | |||||
{ | |||||
$dirname = '../'.preg_replace("#[\\\\\/]{1,}#", '/', $filename); | |||||
$dirname = preg_replace("#([^\/]*)$#", '', $dirname); | |||||
return $dirname; | |||||
} | |||||
function TestIsFileDir($dirname) | |||||
{ | |||||
$dirs = array('name'=>'', 'isdir'=>FALSE, 'writeable'=>FALSE); | |||||
$dirs['name'] = $dirname; | |||||
if(is_dir($dirname)) | |||||
{ | |||||
$dirs['isdir'] = TRUE; | |||||
$dirs['writeable'] = TestWriteAble($dirname); | |||||
} | |||||
return $dirs; | |||||
} | |||||
function MkTmpDir($tmpdir,$filename) | |||||
{ | |||||
$basedir = DEDEDATA.'/'.$tmpdir; | |||||
$dirname = trim(preg_replace("#[\\\\\/]{1,}#", '/', $filename)); | |||||
$dirname = preg_replace("#([^\/]*)$#","",$dirname); | |||||
if(!is_dir($basedir)) | |||||
{ | |||||
mkdir($basedir,0777); | |||||
} | |||||
if($dirname=='') | |||||
{ | |||||
return TRUE; | |||||
} | |||||
$dirs = explode('/', $dirname); | |||||
$curdir = $basedir; | |||||
foreach($dirs as $d) | |||||
{ | |||||
$d = trim($d); | |||||
if(empty($d)) continue; | |||||
$curdir = $curdir.'/'.$d; | |||||
if(!is_dir($curdir)) | |||||
{ | |||||
mkdir($curdir, 0777) or die($curdir); | |||||
} | |||||
} | |||||
return TRUE; | |||||
} | |||||
if(empty($dopost)) $dopost = 'test'; | |||||
//当前软件版本锁定文件 | |||||
$verLockFile = DEDEDATA.'/admin/ver.txt'; | |||||
$fp = fopen($verLockFile,'r'); | |||||
$upTime = trim(fread($fp,64)); | |||||
fclose($fp); | |||||
$oktime = substr($upTime,0,4).'-'.substr($upTime,4,2).'-'.substr($upTime,6,2); | |||||
/** | |||||
用AJAX获取最新版本信息 | |||||
function _Test() { } | |||||
*/ | |||||
if($dopost=='test') | |||||
{ | |||||
AjaxHead(); | |||||
//下载远程数据 | |||||
$dhd = new DedeHttpDown(); | |||||
$dhd->OpenUrl(DEDECDNURL.'/release/latest.txt'); | |||||
$verlatest = trim($dhd->GetHtml()); | |||||
$dhd->Close(); | |||||
//echo "<xmp>"; | |||||
//判断是否需要更新,并返回适合的结果 | |||||
if(version_compare($verlatest, $cfg_version_detail,"<=")) | |||||
{ | |||||
$offUrl = SpGetNewInfo(); | |||||
echo "<div class='updatedvt'><b>你系统版本最后更新时间为:{$oktime},当前没有可用的更新</b></div>\r\n"; | |||||
echo "<iframe name='stafrm' src='{$offUrl}&uptime={$oktime}' frameborder='0' id='stafrm' width='100%' height='50'></iframe>"; | |||||
} | |||||
else | |||||
{ | |||||
echo "<div style='width:98%'><form name='fup' action='update_guide.php' method='post' onsubmit='ShowWaitDiv()'>\r\n"; | |||||
echo "<input type='hidden' name='dopost' value='getlist' />\r\n"; | |||||
echo "<div class='upinfotitle'>当前有可用的更新,可以通过<a href='$cfg_biz_gitUrl' target='_blank'>代码托管</a>查看更新记录:</div>\r\n"; | |||||
echo "<div style='line-height:32px'><button type='submit' name='sb1' class='btn btn-success btn-sm' style='cursor:pointer'>获取并安装</button>\r\n"; | |||||
echo " </div>\r\n"; | |||||
echo "</form></div>"; | |||||
} | |||||
//echo "</xmp>"; | |||||
exit(); | |||||
} | |||||
/** | |||||
忽略某个日期前的升级 | |||||
function _Skip() { } | |||||
*/ | |||||
else if($dopost=='skip') | |||||
{ | |||||
AjaxHead(); | |||||
$fp = fopen($verLockFile, 'w'); | |||||
fwrite($fp, $vtime); | |||||
fclose($fp); | |||||
$offUrl = SpGetNewInfo(); | |||||
echo "<div class='updatedvt'><b>你系统版本最后更新时间为:{$oktime},当前没有可用的更新。</b></div>\r\n"; | |||||
echo "<iframe name='stafrm' src='{$offUrl}&uptime={$oktime}' frameborder='0' id='stafrm' width='100%' height='60'></iframe>"; | |||||
exit(); | |||||
} | |||||
else if($dopost=='skipback') | |||||
{ | |||||
$fp = fopen($verLockFile, 'w'); | |||||
fwrite($fp, $vtime); | |||||
fclose($fp); | |||||
ShowMsg("成功跳过这些更新!", "index_body.php"); | |||||
exit(); | |||||
} | |||||
/** | |||||
获取升级文件列表 | |||||
function _GetList() { } | |||||
*/ | |||||
else if($dopost=='getlist') | |||||
{ | |||||
$upitemsArr = explode(',', $upitems); | |||||
rsort($upitemsArr); | |||||
$tmpdir = substr(md5($cfg_cookie_encode), 0, 16); | |||||
$dhd = new DedeHttpDown(); | |||||
$fileArr = array(); | |||||
$f = 0; | |||||
foreach($upitemsArr as $upitem) | |||||
{ | |||||
$durl = UPDATEHOST.$cfg_soft_lang.'/'.$upitem.'.file.txt'; | |||||
$dhd->OpenUrl($durl); | |||||
$filelist = $dhd->GetHtml(); | |||||
$filelist = trim( preg_replace("#[\r\n]{1,}#", "\n", $filelist) ); | |||||
if(!empty($filelist)) | |||||
{ | |||||
$filelists = explode("\n", $filelist); | |||||
foreach($filelists as $filelist) | |||||
{ | |||||
$filelist = trim($filelist); | |||||
if(empty($filelist)) continue; | |||||
$fs = explode(',', $filelist); | |||||
if( empty($fs[1]) ) | |||||
{ | |||||
$fs[1] = $upitem." 常规功能更新文件"; | |||||
} | |||||
if(!isset($fileArr[$fs[0]])) | |||||
{ | |||||
$fileArr[$fs[0]] = $upitem." ".trim($fs[1]); | |||||
$f++; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
$dhd->Close(); | |||||
$allFileList = ''; | |||||
if($f==0) | |||||
{ | |||||
$allFileList = "<font color='green'><b>没发现可用的文件列表信息,可能是官方服务器存在问题,请稍后再尝试!</b></font>"; | |||||
} | |||||
else | |||||
{ | |||||
$allFileList .= "<div style='width:98%'><form name='fup' action='update_guide.php' method='post'>\r\n"; | |||||
$allFileList .= "<input type='hidden' name='vtime' value='$vtime' />\r\n"; | |||||
$allFileList .= "<input type='hidden' name='dopost' value='getfiles' />\r\n"; | |||||
$allFileList .= "<input type='hidden' name='upitems' value='$upitems' />\r\n"; | |||||
$allFileList .= "<div class='upinfotitle'>以下是需要下载的更新文件(路径相对于DedeCMS的根目录):</div>\r\n"; | |||||
$filelists = explode("\n",$filelist); | |||||
foreach($fileArr as $k=>$v) | |||||
{ | |||||
$allFileList .= "<div class='verline'><input type='checkbox' name='files[]' value='{$k}' checked='checked' /> $k({$v})</div>\r\n"; | |||||
} | |||||
$allFileList .= "<div class='verline'>"; | |||||
$allFileList .= "文件临时存放目录:../data/<input type='text' name='tmpdir' style='width:200px' value='$tmpdir' /><br />\r\n"; | |||||
$allFileList .= "<input type='checkbox' name='skipnodir' value='1' checked='checked' /> 跳过系统中没有的文件夹(通常是可选模块的补丁)</div>\r\n"; | |||||
$allFileList .= "<div style='line-height:36px;background:#F8FEDA'> \r\n"; | |||||
$allFileList .= "<input type='submit' name='sb1' value=' 下载并应用这些补丁 ' class='np coolbg' style='cursor:pointer' />\r\n"; | |||||
$allFileList .="</form></div>"; | |||||
} | |||||
include DedeInclude('templets/update_guide_getlist.htm'); | |||||
exit(); | |||||
} | |||||
/** | |||||
下载文件(保存需下载内容列表) | |||||
function _GetFiles() { } | |||||
*/ | |||||
else if($dopost=='getfilesstart') | |||||
{ | |||||
//update_guide.php?dopost=down&curfile=0 | |||||
$msg = "如果检测时发现你没安装模块的文件夹有错误,可不必理会<br />"; | |||||
$msg .= "<a href=update_guide.php?dopost=down&curfile=0>确认目录状态都正常后,请点击开始下载文件>></a><br />"; | |||||
ShowMsg($msg,"javascript:;"); | |||||
exit(); | |||||
} | |||||
else if($dopost=='getfiles') | |||||
{ | |||||
$cacheFiles = DEDEDATA.'/cache/updatetmp.inc'; | |||||
$skipnodir = (isset($skipnodir) ? 1 : 0); | |||||
$adminDir = preg_replace("#(.*)[\/\\\\]#", "", dirname(__FILE__)); | |||||
if(!isset($files)) | |||||
{ | |||||
$doneStr = "<p align='center' style='color:red'><br />你没有指定任何需要下载更新的文件,是否跳过这些更新?<br /><br />"; | |||||
$doneStr .= "<a href='update_guide.php?dopost=skipback&vtime=$vtime' class='np coolbg'>[跳过这些更新]</a> "; | |||||
$doneStr .= "<a href='index_body.php' class='np coolbg'>[保留提示以后再进行操作]</a></p>"; | |||||
} | |||||
else | |||||
{ | |||||
$fp = fopen($cacheFiles, 'w'); | |||||
fwrite($fp, '<'.'?php'."\r\n"); | |||||
fwrite($fp, '$tmpdir = "'.$tmpdir.'";'."\r\n"); | |||||
fwrite($fp, '$vtime = '.$vtime.';'."\r\n"); | |||||
$dirs = array(); | |||||
$i = -1; | |||||
foreach($files as $filename) | |||||
{ | |||||
$tfilename = $filename; | |||||
if( preg_match("#^dede\/#i", $filename) ) | |||||
{ | |||||
$tfilename = preg_replace("#^dede\/#", $adminDir.'/', $filename); | |||||
} | |||||
$curdir = GetDirName($tfilename); | |||||
if( !isset($dirs[$curdir]) ) | |||||
{ | |||||
$dirs[$curdir] = TestIsFileDir($curdir); | |||||
} | |||||
if($skipnodir==1 && $dirs[$curdir]['isdir'] == FALSE) | |||||
{ | |||||
continue; | |||||
} | |||||
else { | |||||
@mkdir($curdir, 0777); | |||||
$dirs[$curdir] = TestIsFileDir($curdir); | |||||
} | |||||
$i++; | |||||
fwrite($fp, '$files['.$i.'] = "'.$filename.'";'."\r\n"); | |||||
} | |||||
fwrite($fp, '$fileConut = '.$i.';'."\r\n"); | |||||
$items = explode(',', $upitems); | |||||
foreach($items as $sqlfile) | |||||
{ | |||||
fwrite($fp,'$sqls[] = "'.$sqlfile.'.sql";'."\r\n"); | |||||
} | |||||
fwrite($fp, '?'.'>'); | |||||
fclose($fp); | |||||
$dirinfos = ''; | |||||
if($i > -1) | |||||
{ | |||||
$dirinfos = '<tr bgcolor="#ffffff"><td colspan="2">'; | |||||
$dirinfos .= "本次升级需要在下面文件夹写入更新文件,请注意文件夹是否有写入权限:<br />\r\n"; | |||||
foreach($dirs as $curdir) | |||||
{ | |||||
$dirinfos .= $curdir['name']." 状态:".($curdir['writeable'] ? "[√正常]" : "<font color='red'>[×不可写]</font>")."<br />\r\n"; | |||||
} | |||||
$dirinfos .= "</td></tr>\r\n"; | |||||
} | |||||
$doneStr = "<iframe name='stafrm' src='update_guide.php?dopost=getfilesstart' frameborder='0' id='stafrm' width='100%' height='100%'></iframe>\r\n"; | |||||
} | |||||
include DedeInclude('templets/update_guide_getfiles.htm'); | |||||
exit(); | |||||
} | |||||
/** | |||||
下载文件,具体操作步骤 | |||||
function _Down() { } | |||||
*/ | |||||
else if($dopost=='down') | |||||
{ | |||||
$cacheFiles = DEDEDATA.'/cache/updatetmp.inc'; | |||||
require_once($cacheFiles); | |||||
if(empty($startup)) | |||||
{ | |||||
if($fileConut==-1 || $curfile > $fileConut) | |||||
{ | |||||
ShowMsg("已下载所有文件,开始下载数据库升级文件...","update_guide.php?dopost=down&startup=1"); | |||||
exit(); | |||||
} | |||||
//检查临时文件保存目录是否可用 | |||||
MkTmpDir($tmpdir, $files[$curfile]); | |||||
$downfile = UPDATEHOST.$cfg_soft_lang.'/source/'.$files[$curfile]; | |||||
$dhd = new DedeHttpDown(); | |||||
$dhd->OpenUrl($downfile); | |||||
$dhd->SaveToBin(DEDEDATA.'/'.$tmpdir.'/'.$files[$curfile]); | |||||
$dhd->Close(); | |||||
ShowMsg("成功下载并保存文件:{$files[$curfile]}; 继续下载下一个文件。","update_guide.php?dopost=down&curfile=".($curfile+1)); | |||||
exit(); | |||||
} | |||||
else | |||||
{ | |||||
MkTmpDir($tmpdir, 'sql.txt'); | |||||
$dhd = new DedeHttpDown(); | |||||
$ct = ''; | |||||
foreach($sqls as $sql) | |||||
{ | |||||
$downfile = UPDATEHOST.$cfg_soft_lang.'/'.$sql; | |||||
$dhd->OpenUrl($downfile); | |||||
$ct .= $dhd->GetHtml(); | |||||
} | |||||
$dhd->Close(); | |||||
$truefile = DEDEDATA.'/'.$tmpdir.'/sql.txt'; | |||||
$fp = fopen($truefile, 'w'); | |||||
fwrite($fp, $ct); | |||||
fclose($fp); | |||||
ShowMsg("完成所有远程文件获取操作:<a href='update_guide.php?dopost=apply'><<点击此开始直接升级>></a><br />你也可以直接使用[../data/{$tmpdir}]目录的文件手动升级。","javascript:;"); | |||||
exit(); | |||||
} | |||||
exit(); | |||||
} | |||||
/** | |||||
应用升级 | |||||
function _ApplyUpdate() { } | |||||
*/ | |||||
else if($dopost=='apply') | |||||
{ | |||||
$cacheFiles = DEDEDATA.'/cache/updatetmp.inc'; | |||||
require_once($cacheFiles); | |||||
if(empty($step)) | |||||
{ | |||||
$truefile = DEDEDATA.'/'.$tmpdir.'/sql.txt'; | |||||
$fp = fopen($truefile, 'r'); | |||||
$sql = @fread($fp, filesize($truefile)); | |||||
fclose($fp); | |||||
if(!empty($sql)) | |||||
{ | |||||
$mysql_version = $dsql->GetVersion(true); | |||||
$sql = preg_replace('#ENGINE=MyISAM#i', 'TYPE=MyISAM', $sql); | |||||
$sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET='.$cfg_db_language; | |||||
if($mysql_version >= 4.1) | |||||
{ | |||||
$sql = preg_replace('#TYPE=MyISAM#i', $sql41tmp, $sql); | |||||
} | |||||
$sqls = explode(";\r\n", $sql); | |||||
foreach($sqls as $sql) | |||||
{ | |||||
if(trim($sql)!='') | |||||
{ | |||||
$dsql->ExecuteNoneQuery(trim($sql)); | |||||
} | |||||
} | |||||
} | |||||
ShowMsg("完成数据库更新,现在开始复制文件。","update_guide.php?dopost=apply&step=1"); | |||||
exit(); | |||||
} | |||||
else | |||||
{ | |||||
$sDir = DEDEDATA."/$tmpdir"; | |||||
$tDir = DEDEROOT; | |||||
$badcp = 0; | |||||
$adminDir = preg_replace("#(.*)[\/\\\\]#", "", dirname(__FILE__)); | |||||
if(isset($files) && is_array($files)) | |||||
{ | |||||
foreach($files as $f) | |||||
{ | |||||
if(preg_match('#^dede#', $f)) | |||||
{ | |||||
$tf = preg_replace('#^dede#', $adminDir, $f); | |||||
} | |||||
else { | |||||
$tf = $f; | |||||
} | |||||
if(file_exists($sDir.'/'.$f)) | |||||
{ | |||||
$rs = @copy($sDir.'/'.$f, $tDir.'/'.$tf); | |||||
if($rs) { | |||||
unlink($sDir.'/'.$f); | |||||
} | |||||
else { | |||||
$badcp++; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
$fp = fopen($verLockFile,'w'); | |||||
fwrite($fp,$vtime); | |||||
fclose($fp); | |||||
$badmsg = '!'; | |||||
if($badcp > 0) | |||||
{ | |||||
$badmsg = ",其中失败 {$badcp} 个文件,<br />请从临时目录[../data/{$tmpdir}]中取出这几个文件手动升级。"; | |||||
} | |||||
ShowMsg("成功完成升级{$badmsg}","javascript:;"); | |||||
exit(); | |||||
} | |||||
} |