Browse Source

Update module_main.php

tags/6.1.0^2
xushubieli 3 years ago
parent
commit
f585e6b47f
1 changed files with 308 additions and 308 deletions
  1. +308
    -308
      src/admin/module_main.php

+ 308
- 308
src/admin/module_main.php View File

@@ -18,141 +18,141 @@ $mdir = DEDEDATA.'/module';
$mdurl = ""; $mdurl = "";
function TestWriteAble($d) function TestWriteAble($d)
{ {
$tfile = '_dedet.txt';
$d = preg_replace("#\/$#", '', $d);
$fp = @fopen($d.'/'.$tfile, 'w');
if (!$fp) return FALSE;
else {
fclose($fp);
$rs = @unlink($d.'/'.$tfile);
if ($rs) return TRUE;
else return FALSE;
}
$tfile = '_dedet.txt';
$d = preg_replace("#\/$#", '', $d);
$fp = @fopen($d.'/'.$tfile, 'w');
if (!$fp) return FALSE;
else {
fclose($fp);
$rs = @unlink($d.'/'.$tfile);
if ($rs) return TRUE;
else return FALSE;
}
} }
function ReWriteConfigAuto() function ReWriteConfigAuto()
{ {
global $dsql;
$configfile = DEDEDATA.'/config.cache.inc.php';
if (!is_writeable($configfile)) {
echo "配置文件 {$configfile} 不支持写入,无法修改系统配置参数";
exit();
}
$fp = fopen($configfile, 'w');
flock($fp, 3);
fwrite($fp, "<"."?php\r\n");
$dsql->SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC ");
$dsql->Execute();
while ($row = $dsql->GetArray()) {
if ($row['type'] == 'number') fwrite($fp, "\${$row['varname']} = ".$row['value'].";\r\n");
else fwrite($fp, "\${$row['varname']} = '".str_replace("'", '', $row['value'])."';\r\n");
}
fwrite($fp, "?".">");
fclose($fp);
global $dsql;
$configfile = DEDEDATA.'/config.cache.inc.php';
if (!is_writeable($configfile)) {
echo "配置文件 {$configfile} 不支持写入,无法修改系统配置参数";
exit();
}
$fp = fopen($configfile, 'w');
flock($fp, 3);
fwrite($fp, "<"."?php\r\n");
$dsql->SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC ");
$dsql->Execute();
while ($row = $dsql->GetArray()) {
if ($row['type'] == 'number') fwrite($fp, "\${$row['varname']} = ".$row['value'].";\r\n");
else fwrite($fp, "\${$row['varname']} = '".str_replace("'", '', $row['value'])."';\r\n");
}
fwrite($fp, "?".">");
fclose($fp);
} }
/*-------------- /*--------------
function ShowAll(); function ShowAll();
--------------*/ --------------*/
if ($action == '') { if ($action == '') {
$types = array('soft' => '模块', 'templets' => '模板', 'plus' => '小插件', 'patch' => '补丁');
$dm = new DedeModule($mdir);
if (empty($moduletype)) $moduletype = '';
$modules_remote = $dm->GetModuleUrlList($moduletype, $mdurl);
$modules = array();
$modules = $dm->GetModuleList($moduletype);
is_array($modules) || $modules = array();
if (is_array($modules_remote) && count($modules_remote) > 0) {
$modules = array_merge($modules, $modules_remote);
}
require_once(dirname(__FILE__)."/templets/module_main.htm");
$dm->Clear();
exit();
$types = array('soft' => '模块', 'templets' => '模板', 'plus' => '小插件', 'patch' => '补丁');
$dm = new DedeModule($mdir);
if (empty($moduletype)) $moduletype = '';
$modules_remote = $dm->GetModuleUrlList($moduletype, $mdurl);
$modules = array();
$modules = $dm->GetModuleList($moduletype);
is_array($modules) || $modules = array();
if (is_array($modules_remote) && count($modules_remote) > 0) {
$modules = array_merge($modules, $modules_remote);
}
require_once(dirname(__FILE__)."/templets/module_main.htm");
$dm->Clear();
exit();
} }
/*-------------- /*--------------
function ViewDevelopoer(); function ViewDevelopoer();
--------------*/ --------------*/
else if ($action == 'view_developoer') { else if ($action == 'view_developoer') {
//检验开发者信息
$dm = new DedeModule($mdir);
$info = $dm->GetModuleInfo($hash);
if ($info == null) {
ShowMsg("获取模块信息错误,模块文件可能被篡改", -1);
//检验开发者信息
$dm = new DedeModule($mdir);
$info = $dm->GetModuleInfo($hash);
if ($info == null) {
ShowMsg("获取模块信息错误,模块文件可能被篡改", -1);
exit;
}
$dev_id = $info['dev_id'];
$devURL = DEDECDNURL."/developers/$dev_id.json";
$dhd = new DedeHttpDown();
$dhd->OpenUrl($devURL);
$devContent = $dhd->GetHtml();
$devInfo = (array)json_decode($devContent);
$offUrl = "";
if ($devInfo['dev_type'] == 1) {
$offUrl = "<p>官方网址:<code>{$devInfo['offurl']}</code><small>(复制在浏览器中打开)</small></p>";
}
$authAt = date("Y-m-d", $devInfo['auth_at']);
if (!isset($info['dev_id'])) {
$devInfo['dev_name'] = $info['team']."<span style='display:inline-block;margin-left:10px;padding:.25rem .5rem;line-height:1.5;font-size:12px;color:#fff;background:#dc3545;border-color:#dc3545;border-radius:.2rem'>未认证</span>";
$authAt = "0000-00-00";
}
ShowMsg("<p>开发者名称:{$devInfo['dev_name']}</p><p>开发者ID:{$devInfo['dev_id']}</p><span>认证于:{$authAt}</span>", "-1");
exit; exit;
}
$dev_id = $info['dev_id'];
$devURL = DEDECDNURL."/developers/$dev_id.json";
$dhd = new DedeHttpDown();
$dhd->OpenUrl($devURL);
$devContent = $dhd->GetHtml();
$devInfo = (array)json_decode($devContent);
$offUrl = "";
if ($devInfo['dev_type'] == 1) {
$offUrl = "<p>官方网址:<code>{$devInfo['offurl']}</code><small>(复制在浏览器中打开)</small></p>";
}
$authAt = date("Y-m-d", $devInfo['auth_at']);
if (!isset($info['dev_id'])) {
$devInfo['dev_name'] = $info['team']."<span style='display:inline-block;margin-left:10px;padding:.25rem .5rem;line-height:1.5;color:#fff;background:#dc3545;border-color:#dc3545;border-radius:.2rem'>未认证</span>";
$authAt = "0000-00-00";
}
ShowMsg("<p>开发者名称:{$devInfo['dev_name']}</p><p>开发者ID:{$devInfo['dev_id']}</p><span>认证于:{$authAt}</span>", "-1");
exit;
} }
/*-------------- /*--------------
function Setup(); function Setup();
--------------*/ --------------*/
else if ($action == 'setup') { else if ($action == 'setup') {
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
if ($infos == null) {
ShowMsg("获取模块信息错误,模块文件可能被篡改", -1);
exit;
}
$alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br>(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
$filelists = $dm->GetFileLists($hash);
$filelist = '';
$prvdirs = array();
$incdir = array();
foreach ($filelists as $v) {
if (empty($v['name'])) continue;
if ($v['type'] == 'dir') {
$v['type'] = '目录';
$incdir[] = $v['name'];
} else {
$v['type'] = '文件';
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
if ($infos == null) {
ShowMsg("获取模块信息错误,模块文件可能被篡改", -1);
exit;
} }
$filelist .= "{$v['type']}|{$v['name']}\r\n";
}
//检测需要的目录权限
foreach ($filelists as $v) {
$prvdir = preg_replace("#\/([^\/]*)$#", '/', $v['name']);
if (!preg_match("#^\.#", $prvdir)) $prvdir = './';
$n = TRUE;
foreach ($incdir as $k => $v) {
if (preg_match("#^".$v."#i", $prvdir)) {
$n = FALSE;
break;
}
$alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br>(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
$filelists = $dm->GetFileLists($hash);
$filelist = '';
$prvdirs = array();
$incdir = array();
foreach ($filelists as $v) {
if (empty($v['name'])) continue;
if ($v['type'] == 'dir') {
$v['type'] = '目录';
$incdir[] = $v['name'];
} else {
$v['type'] = '文件';
}
$filelist .= "{$v['type']}|{$v['name']}\r\n";
}
//检测需要的目录权限
foreach ($filelists as $v) {
$prvdir = preg_replace("#\/([^\/]*)$#", '/', $v['name']);
if (!preg_match("#^\.#", $prvdir)) $prvdir = './';
$n = TRUE;
foreach ($incdir as $k => $v) {
if (preg_match("#^".$v."#i", $prvdir)) {
$n = FALSE;
break;
}
}
if (!isset($prvdirs[$prvdir]) && $n && is_dir($prvdir)) {
$prvdirs[$prvdir][0] = 1;
$prvdirs[$prvdir][1] = TestWriteAble($prvdir);
}
} }
if (!isset($prvdirs[$prvdir]) && $n && is_dir($prvdir)) {
$prvdirs[$prvdir][0] = 1;
$prvdirs[$prvdir][1] = TestWriteAble($prvdir);
$prvdir = "<table cellpadding='1' cellspacing='1' width='350' bgcolor='#cfcfcf' style='margin-top:10px'>\r\n";
$prvdir .= "<tr style='background:#FBFCE2'><th width='270'>目录</td><th align='center'>可写</td></tr>\r\n";
foreach ($prvdirs as $k => $v) {
if ($v) $cw = '√';
else $cw = '<span style="color:#dc3545">×</span>';
$prvdir .= "<tr bgcolor='#ffffff'><td>$k</td>";
$prvdir .= "<td align='center'>$cw</td></tr>\r\n";
} }
}
$prvdir = "<table cellpadding='1' cellspacing='1' width='350' bgcolor='#cfcfcf' style='margin-top:10px'>\r\n";
$prvdir .= "<tr style='background:#FBFCE2'><th width='270'>目录</td><th align='center'>可写</td></tr>\r\n";
foreach ($prvdirs as $k => $v) {
if ($v) $cw = '√';
else $cw = '<span style="color:#dc3545">×</span>';
$prvdir .= "<tr bgcolor='#ffffff'><td>$k</td>";
$prvdir .= "<td align='center'>$cw</td></tr>\r\n";
}
$prvdir .= "</table>";
$win = new OxWindow();
$win->Init("module_main.php", "js/blank.js", "post");
$wecome_info = "模块管理";
$win->AddTitle("&nbsp;<a href='module_main.php'>模块管理</a> &gt;&gt; 安装模块:{$infos['name']}");
$win->AddHidden("hash", $hash);
$win->AddHidden("action", 'setupstart');
$msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
$prvdir .= "</table>";
$win = new OxWindow();
$win->Init("module_main.php", "js/blank.js", "post");
$wecome_info = "模块管理";
$win->AddTitle("&nbsp;<a href='module_main.php'>模块管理</a> &gt;&gt; 安装模块:{$infos['name']}");
$win->AddHidden("hash", $hash);
$win->AddHidden("action", 'setupstart');
$msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
<table width='98%' border='0' cellspacing='0' cellpadding='0' class='table'> <table width='98%' border='0' cellspacing='0' cellpadding='0' class='table'>
<tr> <tr>
<td width='20%' height='26' class='dtb'>模块名称:</td> <td width='20%' height='26' class='dtb'>模块名称:</td>
@@ -205,89 +205,89 @@ else if ($action == 'setup') {
</td> </td>
</tr> </tr>
</table>"; </table>";
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("ok", "");
$win->Display();
$dm->Clear();
exit();
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("ok", "");
$win->Display();
$dm->Clear();
exit();
} }
/*--------------- /*---------------
function SetupRun() function SetupRun()
--------------*/ --------------*/
else if ($action == 'setupstart') { else if ($action == 'setupstart') {
if (!is_writeable($mdir)) {
ShowMsg("目录 {$mdir} 不支持写入,这将导致安装程序没法正常创建", "-1");
exit();
}
$dm = new DedeModule($mdir);
$minfos = $dm->GetModuleInfo($hash);
extract($minfos, EXTR_SKIP);
$menustring = addslashes($dm->GetSystemFile($hash, 'menustring'));
$indexurl = str_replace('**', '=', $indexurl);
$query = "INSERT INTO `#@__sys_module`(`hashcode` , `modname` , `indexname` , `indexurl` , `ismember` , `menustring` )
VALUES ('$hash' , '$name' , '$indexname' , '$indexurl' , '$ismember' , '$menustring' ) ";
$rs = $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' ");
$rs = $dsql->ExecuteNoneQuery($query);
if (!$rs) {
ShowMsg('保存数据库信息失败,无法完成安装'.$dsql->GetError(), 'javascript:;');
exit();
}
$dm->WriteFiles($hash, $isreplace);
$filename = '';
if (!isset($autosetup) || $autosetup == 0) $filename = $dm->WriteSystemFile($hash, 'setup');
if (!isset($autodel) || $autodel == 0) $dm->WriteSystemFile($hash, 'uninstall');
$dm->WriteSystemFile($hash, 'readme');
$dm->Clear();
//用模块的安装程序安装
if (!isset($autosetup) || $autosetup == 0) {
include(DEDEDATA.'/module/'.$filename);
exit();
}
//系统自动安装
else {
$mysql_version = $dsql->GetVersion(TRUE);
//默认使用MySQL 4.1 以下版本的SQL语句,对大于4.1版本采用替换处理 TYPE=MyISAM ==> ENGINE=MyISAM DEFAULT CHARSET=#~lang~#
$setupsql = $dm->GetSystemFile($hash, 'setupsql40');
$setupsql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $setupsql);
$sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET='.$cfg_db_language;
if ($mysql_version >= 4.1) {
$setupsql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $setupsql);
if (!is_writeable($mdir)) {
ShowMsg("目录 {$mdir} 不支持写入,这将导致安装程序没法正常创建", "-1");
exit();
} }
//_ROOTURL_
if ($cfg_cmspath == '/') $cfg_cmspath = '';
$rooturl = $cfg_basehost.$cfg_cmspath;
$setupsql = preg_replace("#_ROOTURL_#i", $rooturl, $setupsql);
$setupsql = preg_replace("#[\r\n]{1,}#", "\n", $setupsql);
$sqls = @split(";[ \t]{0,}\n", $setupsql);
foreach ($sqls as $sql) {
if (trim($sql) != '') $dsql->ExecuteNoneQuery($sql);
$dm = new DedeModule($mdir);
$minfos = $dm->GetModuleInfo($hash);
extract($minfos, EXTR_SKIP);
$menustring = addslashes($dm->GetSystemFile($hash, 'menustring'));
$indexurl = str_replace('**', '=', $indexurl);
$query = "INSERT INTO `#@__sys_module`(`hashcode` , `modname` , `indexname` , `indexurl` , `ismember` , `menustring` )
VALUES ('$hash' , '$name' , '$indexname' , '$indexurl' , '$ismember' , '$menustring' ) ";
$rs = $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' ");
$rs = $dsql->ExecuteNoneQuery($query);
if (!$rs) {
ShowMsg('保存数据库信息失败,无法完成安装'.$dsql->GetError(), 'javascript:;');
exit();
}
$dm->WriteFiles($hash, $isreplace);
$filename = '';
if (!isset($autosetup) || $autosetup == 0) $filename = $dm->WriteSystemFile($hash, 'setup');
if (!isset($autodel) || $autodel == 0) $dm->WriteSystemFile($hash, 'uninstall');
$dm->WriteSystemFile($hash, 'readme');
$dm->Clear();
//用模块的安装程序安装
if (!isset($autosetup) || $autosetup == 0) {
include(DEDEDATA.'/module/'.$filename);
exit();
}
//系统自动安装
else {
$mysql_version = $dsql->GetVersion(TRUE);
//默认使用MySQL 4.1 以下版本的SQL语句,对大于4.1版本采用替换处理 TYPE=MyISAM ==> ENGINE=MyISAM DEFAULT CHARSET=#~lang~#
$setupsql = $dm->GetSystemFile($hash, 'setupsql40');
$setupsql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $setupsql);
$sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET='.$cfg_db_language;
if ($mysql_version >= 4.1) {
$setupsql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $setupsql);
}
//_ROOTURL_
if ($cfg_cmspath == '/') $cfg_cmspath = '';
$rooturl = $cfg_basehost.$cfg_cmspath;
$setupsql = preg_replace("#_ROOTURL_#i", $rooturl, $setupsql);
$setupsql = preg_replace("#[\r\n]{1,}#", "\n", $setupsql);
$sqls = @split(";[ \t]{0,}\n", $setupsql);
foreach ($sqls as $sql) {
if (trim($sql) != '') $dsql->ExecuteNoneQuery($sql);
}
ReWriteConfigAuto();
$rflwft = "<script language='javascript' type='text/javascript'>\r\n";
$rflwft .= "if(window.navigator.userAgent.indexOf('MSIE')>=1) top.document.frames.menu.location = 'index_menu_module.php';\r\n";
$rflwft .= "else top.document.getElementById('menufra').src = 'index_menu_module.php';\r\n";
$rflwft .= "</script>";
echo $rflwft;
UpDateCatCache();
ShowMsg('模块安装完成', 'module_main.php');
exit();
} }
ReWriteConfigAuto();
$rflwft = "<script language='javascript' type='text/javascript'>\r\n";
$rflwft .= "if(window.navigator.userAgent.indexOf('MSIE')>=1) top.document.frames.menu.location = 'index_menu_module.php';\r\n";
$rflwft .= "else top.document.getElementById('menufra').src = 'index_menu_module.php';\r\n";
$rflwft .= "</script>";
echo $rflwft;
UpDateCatCache();
ShowMsg('模块安装完成', 'module_main.php');
exit();
}
} }
/*-------------- /*--------------
function DelModule(); function DelModule();
--------------*/ --------------*/
else if ($action == 'del') { else if ($action == 'del') {
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
$alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br>(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
$dev_id = empty($infos['dev_id'])? "<a href='{$cfg_biz_dedebizUrl}/developer' target='_blank' class='btn btn-success btn-sm'>未认证</a>" : "{$infos['dev_id']} <a href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}' target='_blank' class='btn btn-success btn-sm'>未认证</a>";
$win = new OxWindow();
$win->Init("module_main.php", "js/blank.js", "post");
$wecome_info = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 删除模块:{$infos['name']}");
$win->AddHidden('hash', $hash);
$win->AddHidden('action', 'delok');
$msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
$alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br>(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
$dev_id = empty($infos['dev_id'])? "<a href='{$cfg_biz_dedebizUrl}/developer' target='_blank' class='btn btn-success btn-sm'>未认证</a>" : "{$infos['dev_id']} <a href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}' target='_blank' class='btn btn-success btn-sm'>未认证</a>";
$win = new OxWindow();
$win->Init("module_main.php", "js/blank.js", "post");
$wecome_info = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 删除模块:{$infos['name']}");
$win->AddHidden('hash', $hash);
$win->AddHidden('action', 'delok');
$msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
<table width='750' border='0' cellspacing='0' cellpadding='0'> <table width='750' border='0' cellspacing='0' cellpadding='0'>
<tr> <tr>
<td width='20%' height='26' class='dtb'>模块名称:</td> <td width='20%' height='26' class='dtb'>模块名称:</td>
@@ -317,42 +317,42 @@ else if ($action == 'del') {
<td height='26' colspan='2'>删除模块仅删除这个模块的安装包文件,如果您已经安装,请执行<a href='module_main.php?hash={$hash}&action=uninstall'>卸载程序</a>来删除</td> <td height='26' colspan='2'>删除模块仅删除这个模块的安装包文件,如果您已经安装,请执行<a href='module_main.php?hash={$hash}&action=uninstall'>卸载程序</a>来删除</td>
</tr> </tr>
</table>"; </table>";
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("ok", "");
$win->Display();
$dm->Clear();
exit();
} else if ($action == 'delok') {
$dm = new DedeModule($mdir);
$modfile = $mdir."/".$dm->GetHashFile($hash);
unlink($modfile) or die("删除文件 {$modfile} 失败");
ShowMsg("成功删除一个模块文件", "module_main.php");
exit();
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("ok", "");
$win->Display();
$dm->Clear();
exit();
} else if ($action == 'delok') {
$dm = new DedeModule($mdir);
$modfile = $mdir."/".$dm->GetHashFile($hash);
unlink($modfile) or die("删除文件 {$modfile} 失败");
ShowMsg("成功删除一个模块文件", "module_main.php");
exit();
} }
/*-------------- /*--------------
function UnInstall(); function UnInstall();
--------------*/ --------------*/
else if ($action == 'uninstall') { else if ($action == 'uninstall') {
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
if ($infos['url'] == '') $infos['url'] = '&nbsp;';
$alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br>(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
$filelists = $dm->GetFileLists($hash);
$filelist = '';
foreach ($filelists as $v) {
if (empty($v['name'])) continue;
if ($v['type'] == 'dir') $v['type'] = '目录';
else $v['type'] = '文件';
$filelist .= "{$v['type']}|{$v['name']}\r\n";
}
$dev_id = empty($infos['dev_id'])? "<a href='{$cfg_biz_dedebizUrl}/developer' target='_blank' class='btn btn-success btn-sm'>未认证</a>" : "{$infos['dev_id']} <a href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}' target='_blank' class='btn btn-success btn-sm'>未认证</a>";
$win = new OxWindow();
$win->Init("module_main.php", "js/blank.js", "post");
$wecome_info = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 卸载模块:{$infos['name']}");
$win->AddHidden("hash", $hash);
$win->AddHidden("action", 'uninstallok');
$msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
if ($infos['url'] == '') $infos['url'] = '&nbsp;';
$alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br>(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
$filelists = $dm->GetFileLists($hash);
$filelist = '';
foreach ($filelists as $v) {
if (empty($v['name'])) continue;
if ($v['type'] == 'dir') $v['type'] = '目录';
else $v['type'] = '文件';
$filelist .= "{$v['type']}|{$v['name']}\r\n";
}
$dev_id = empty($infos['dev_id'])? "<a href='{$cfg_biz_dedebizUrl}/developer' target='_blank' class='btn btn-success btn-sm'>未认证</a>" : "{$infos['dev_id']} <a href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}' target='_blank' class='btn btn-success btn-sm'>未认证</a>";
$win = new OxWindow();
$win->Init("module_main.php", "js/blank.js", "post");
$wecome_info = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 卸载模块:{$infos['name']}");
$win->AddHidden("hash", $hash);
$win->AddHidden("action", 'uninstallok');
$msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
<table width='750' border='0' cellspacing='0' cellpadding='0'> <table width='750' border='0' cellspacing='0' cellpadding='0'>
<tr> <tr>
<td width='200' height='26' class='dtb'>模块名称:</td> <td width='200' height='26' class='dtb'>模块名称:</td>
@@ -394,95 +394,95 @@ else if ($action == 'uninstall') {
</td> </td>
</tr> </tr>
</table>"; </table>";
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("ok", "");
$win->Display();
$dm->Clear();
exit();
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("ok", "");
$win->Display();
$dm->Clear();
exit();
} }
/*-------------- /*--------------
function UnInstallRun(); function UnInstallRun();
--------------*/ --------------*/
else if ($action == 'uninstallok') { else if ($action == 'uninstallok') {
$dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' ");
$dm = new DedeModule($mdir);
$minfos = $dm->GetModuleInfo($hash);
extract($minfos, EXTR_SKIP);
if (!isset($moduletype) || $moduletype != 'patch') {
$dm->DeleteFiles($hash, $isreplace);
}
@$dm->DelSystemFile($hash, 'readme');
@$dm->DelSystemFile($hash, 'setup');
$dm->Clear();
if (!isset($autodel) || $autodel == 0) {
include(DEDEDATA."/module/{$hash}-uninstall.php");
@unlink(DEDEDATA."/module/{$hash}-uninstall.php");
exit();
} else {
@$dm->DelSystemFile($hash, 'uninstall');
$delsql = $dm->GetSystemFile($hash, 'delsql');
if (trim($delsql) != '') {
$sqls = explode(';', $delsql);
foreach ($sqls as $sql) {
if (trim($sql) != '') $dsql->ExecuteNoneQuery($sql);
}
$dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' ");
$dm = new DedeModule($mdir);
$minfos = $dm->GetModuleInfo($hash);
extract($minfos, EXTR_SKIP);
if (!isset($moduletype) || $moduletype != 'patch') {
$dm->DeleteFiles($hash, $isreplace);
}
@$dm->DelSystemFile($hash, 'readme');
@$dm->DelSystemFile($hash, 'setup');
$dm->Clear();
if (!isset($autodel) || $autodel == 0) {
include(DEDEDATA."/module/{$hash}-uninstall.php");
@unlink(DEDEDATA."/module/{$hash}-uninstall.php");
exit();
} else {
@$dm->DelSystemFile($hash, 'uninstall');
$delsql = $dm->GetSystemFile($hash, 'delsql');
if (trim($delsql) != '') {
$sqls = explode(';', $delsql);
foreach ($sqls as $sql) {
if (trim($sql) != '') $dsql->ExecuteNoneQuery($sql);
}
}
ReWriteConfigAuto();
$rflwft = "<script language='javascript' type='text/javascript'>\r\n";
$rflwft .= "if(window.navigator.userAgent.indexOf('MSIE')>=1) top.document.frames.menu.location = 'index_menu_module.php';\r\n";
$rflwft .= "else top.document.getElementById('menufra').src = 'index_menu_module.php';\r\n";
$rflwft .= "</script>";
echo $rflwft;
ShowMsg('模块卸载完成', 'module_main.php');
exit();
} }
ReWriteConfigAuto();
$rflwft = "<script language='javascript' type='text/javascript'>\r\n";
$rflwft .= "if(window.navigator.userAgent.indexOf('MSIE')>=1) top.document.frames.menu.location = 'index_menu_module.php';\r\n";
$rflwft .= "else top.document.getElementById('menufra').src = 'index_menu_module.php';\r\n";
$rflwft .= "</script>";
echo $rflwft;
ShowMsg('模块卸载完成', 'module_main.php');
exit();
}
} }
/*-------------- /*--------------
function ShowReadme(); function ShowReadme();
--------------*/ --------------*/
else if ($action == 'showreadme') { else if ($action == 'showreadme') {
$dm = new DedeModule($mdir);
$msg = $dm->GetSystemFile($hash, 'readme');
$msg = preg_replace("/(.*)<body/isU", "", $msg);
$msg = preg_replace("/<\/body>(.*)/isU", "", $msg);
$dm->Clear();
$win = new OxWindow();
$win->Init("module_main.php", "js/blank.js", "post");
$wecome_info = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 使用说明:");
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("hand");
$win->Display();
exit();
$dm = new DedeModule($mdir);
$msg = $dm->GetSystemFile($hash, 'readme');
$msg = preg_replace("/(.*)<body/isU", "", $msg);
$msg = preg_replace("/<\/body>(.*)/isU", "", $msg);
$dm->Clear();
$win = new OxWindow();
$win->Init("module_main.php", "js/blank.js", "post");
$wecome_info = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 使用说明:");
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow("hand");
$win->Display();
exit();
} }
/*-------------- /*--------------
function ViewOne(); function ViewOne();
--------------*/ --------------*/
else if ($action == 'view') { else if ($action == 'view') {
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
if ($infos['url'] == '') $infos['url'] = '&nbsp;';
$alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br>(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
$filelists = $dm->GetFileLists($hash);
$filelist = '';
$setupinfo = '';
foreach ($filelists as $v) {
if (empty($v['name'])) continue;
if ($v['type'] == 'dir') $v['type'] = '目录';
else $v['type'] = '文件';
$filelist .= "{$v['type']}|{$v['name']}\r\n";
}
if (file_exists(DEDEDATA."/module/{$hash}-readme.php")) {
$setupinfo = "已安装 <a href='module_main.php?action=uninstall&hash={$hash}'>卸载</a>";
} else {
$setupinfo = "未安装 <a href='module_main.php?action=setup&hash={$hash}'>安装</a>";
}
$dev_id = empty($infos['dev_id'])? "<a href='module_main.php?action=setup&hash={$hash}' class='btn btn-success btn-sm'>安装</a><a href='{$cfg_biz_dedebizUrl}/developer' target='_blank' class='btn btn-success btn-sm' style='margin-left:6px'>未认证</a>" : "{$infos['dev_id']} <a href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}' target='_blank' class='btn btn-success btn-sm'>未认证</a>";
$win = new OxWindow();
$win->Init("", "js/blank.js", "");
$wecome_info = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 模块详情:{$infos['name']}");
$msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
$dm = new DedeModule($mdir);
$infos = $dm->GetModuleInfo($hash);
if ($infos['url'] == '') $infos['url'] = '&nbsp;';
$alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br>(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
$filelists = $dm->GetFileLists($hash);
$filelist = '';
$setupinfo = '';
foreach ($filelists as $v) {
if (empty($v['name'])) continue;
if ($v['type'] == 'dir') $v['type'] = '目录';
else $v['type'] = '文件';
$filelist .= "{$v['type']}|{$v['name']}\r\n";
}
if (file_exists(DEDEDATA."/module/{$hash}-readme.php")) {
$setupinfo = "已安装 <a href='module_main.php?action=uninstall&hash={$hash}'>卸载</a>";
} else {
$setupinfo = "未安装 <a href='module_main.php?action=setup&hash={$hash}'>安装</a>";
}
$dev_id = empty($infos['dev_id'])? "<a href='module_main.php?action=setup&hash={$hash}' class='btn btn-success btn-sm'>安装</a><a href='{$cfg_biz_dedebizUrl}/developer' target='_blank' class='btn btn-success btn-sm' style='margin-left:6px'>未认证</a>" : "{$infos['dev_id']} <a href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}' target='_blank' class='btn btn-success btn-sm'>未认证</a>";
$win = new OxWindow();
$win->Init("", "js/blank.js", "");
$wecome_info = "模块管理";
$win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 模块详情:{$infos['name']}");
$msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
<table width='98%' border='0' cellspacing='0' cellpadding='0'> <table width='98%' border='0' cellspacing='0' cellpadding='0'>
<tr> <tr>
<td width='20%' height='26' class='dtb'>模块名称:</td> <td width='20%' height='26' class='dtb'>模块名称:</td>
@@ -517,34 +517,34 @@ else if ($action == 'view') {
</td> </td>
</tr> </tr>
</table>"; </table>";
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow('hand', '');
$win->Display();
$dm->Clear();
exit();
$win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
$winform = $win->GetWindow('hand', '');
$win->Display();
$dm->Clear();
exit();
} }
/*-------------- /*--------------
function Edit(); function Edit();
--------------*/ --------------*/
else if ($action == 'edit') { else if ($action == 'edit') {
$dm = new DedeModule($mdir);
$minfos = $dm->GetModuleInfo($hash);
extract($minfos, EXTR_SKIP);
if (!isset($lang)) $lang = 'gb2312';
if (!isset($moduletype)) $moduletype = 'soft';
$menustring = $dm->GetSystemFile($hash, 'menustring');
$setupsql40 = dede_htmlspecialchars($dm->GetSystemFile($hash, 'setupsql40'));
$readmetxt = $dm->GetSystemFile($hash, 'readme');
$delsql = $dm->GetSystemFile($hash, 'delsql');
$filelist = $dm->GetSystemFile($hash, 'oldfilelist', false);
$indexurl = str_replace('**', '=', $indexurl);
$dm->Clear();
require_once(dirname(__FILE__).'/templets/module_edit.htm');
exit();
$dm = new DedeModule($mdir);
$minfos = $dm->GetModuleInfo($hash);
extract($minfos, EXTR_SKIP);
if (!isset($lang)) $lang = 'gb2312';
if (!isset($moduletype)) $moduletype = 'soft';
$menustring = $dm->GetSystemFile($hash, 'menustring');
$setupsql40 = dede_htmlspecialchars($dm->GetSystemFile($hash, 'setupsql40'));
$readmetxt = $dm->GetSystemFile($hash, 'readme');
$delsql = $dm->GetSystemFile($hash, 'delsql');
$filelist = $dm->GetSystemFile($hash, 'oldfilelist', false);
$indexurl = str_replace('**', '=', $indexurl);
$dm->Clear();
require_once(dirname(__FILE__).'/templets/module_edit.htm');
exit();
} }
/*-------------- /*--------------
function Download(); function Download();
--------------*/ --------------*/
else if ($action == 'download') { else if ($action == 'download') {
ShowMsg("暂不支持模块下载功能", "javascript:;");
ShowMsg("暂不支持模块下载功能", "javascript:;");
} }

Loading…
Cancel
Save