国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

552 lines
22KB

  1. <?php
  2. /**
  3. * 模块管理
  4. *
  5. * @version $Id: module_main.php 1 14:17 2010年7月20日Z tianya $
  6. * @package DedeBIZ.Administrator
  7. * @copyright Copyright (c) 2021, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('sys_module');
  13. require_once(dirname(__FILE__)."/../include/dedemodule.class.php");
  14. require_once(dirname(__FILE__)."/../include/oxwindow.class.php");
  15. if (empty($action)) $action = '';
  16. require_once(DEDEDATA."/admin/config_update.php");
  17. $mdir = DEDEDATA.'/module';
  18. $mdurl = "";
  19. function TestWriteAble($d)
  20. {
  21. $tfile = '_dedet.txt';
  22. $d = preg_replace("#\/$#", '', $d);
  23. $fp = @fopen($d.'/'.$tfile, 'w');
  24. if (!$fp) return FALSE;
  25. else {
  26. fclose($fp);
  27. $rs = @unlink($d.'/'.$tfile);
  28. if ($rs) return TRUE;
  29. else return FALSE;
  30. }
  31. }
  32. function ReWriteConfigAuto()
  33. {
  34. global $dsql;
  35. $configfile = DEDEDATA.'/config.cache.inc.php';
  36. if (!is_writeable($configfile)) {
  37. echo "配置文件'{$configfile}'不支持写入,无法修改系统配置参数";
  38. //ClearAllLink();
  39. exit();
  40. }
  41. $fp = fopen($configfile, 'w');
  42. flock($fp, 3);
  43. fwrite($fp, "<"."?php\r\n");
  44. $dsql->SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC ");
  45. $dsql->Execute();
  46. while ($row = $dsql->GetArray()) {
  47. if ($row['type'] == 'number') fwrite($fp, "\${$row['varname']} = ".$row['value'].";\r\n");
  48. else fwrite($fp, "\${$row['varname']} = '".str_replace("'", '', $row['value'])."';\r\n");
  49. }
  50. fwrite($fp, "?".">");
  51. fclose($fp);
  52. }
  53. /*--------------
  54. function ShowAll();
  55. --------------*/
  56. if ($action == '') {
  57. $types = array('soft' => '模块', 'templets' => '模板', 'plus' => '小插件', 'patch' => '补丁');
  58. $dm = new DedeModule($mdir);
  59. if (empty($moduletype)) $moduletype = '';
  60. $modules_remote = $dm->GetModuleUrlList($moduletype, $mdurl);
  61. $modules = array();
  62. $modules = $dm->GetModuleList($moduletype);
  63. is_array($modules) || $modules = array();
  64. if (is_array($modules_remote) && count($modules_remote) > 0) {
  65. $modules = array_merge($modules, $modules_remote);
  66. }
  67. require_once(dirname(__FILE__)."/templets/module_main.htm");
  68. $dm->Clear();
  69. exit();
  70. }
  71. /*--------------
  72. function ViewDevelopoer();
  73. --------------*/
  74. else if ($action == 'view_developoer') {
  75. //检验开发者信息
  76. $dm = new DedeModule($mdir);
  77. $info = $dm->GetModuleInfo($hash);
  78. if ($info == null) {
  79. ShowMsg("获取模块信息错误,模块文件可能被篡改", -1);
  80. exit;
  81. }
  82. $dev_id = $info['dev_id'];
  83. $devURL = DEDECDNURL."/developers/$dev_id.json";
  84. $dhd = new DedeHttpDown();
  85. $dhd->OpenUrl($devURL);
  86. $devContent = $dhd->GetHtml();
  87. $devInfo = (array)json_decode($devContent);
  88. $offUrl = "";
  89. if ($devInfo['dev_type'] == 1) {
  90. $offUrl = "<p>官方网址:<code>{$devInfo['offurl']}</code> <small>(复制在浏览器中打开)</small></p>";
  91. }
  92. $authAt = date("Y-m-d", $devInfo['auth_at']);
  93. if (!isset($info['dev_id'])) {
  94. $devInfo['realname'] = $devInfo['dev_name'] = $info['team']." <font color='red'>未认证</font>";
  95. $authAt = "0000-00-00";
  96. }
  97. ShowMsg("<div class='text-left'><p>开发者名称:{$devInfo['dev_name']}</p><p>开发者全称:{$devInfo['realname']}</p><p>开发者ID:{$devInfo['dev_id']} <a target='_blank' href='{$cfg_biz_dedebizUrl}/developer?dev_id={$devInfo['dev_id']}' class='btn btn-success btn-sm'>未认证</a></p>$offUrl<p>认证于:{$authAt}</p></a>", "javascript:;");
  98. exit;
  99. }
  100. /*--------------
  101. function Setup();
  102. --------------*/
  103. else if ($action == 'setup') {
  104. $dm = new DedeModule($mdir);
  105. $infos = $dm->GetModuleInfo($hash);
  106. if ($infos == null) {
  107. ShowMsg("获取模块信息错误,模块文件可能被篡改", -1);
  108. exit;
  109. }
  110. $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br />(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
  111. $filelists = $dm->GetFileLists($hash);
  112. $filelist = '';
  113. $prvdirs = array();
  114. $incdir = array();
  115. foreach ($filelists as $v) {
  116. if (empty($v['name'])) continue;
  117. if ($v['type'] == 'dir') {
  118. $v['type'] = '目录';
  119. $incdir[] = $v['name'];
  120. } else {
  121. $v['type'] = '文件';
  122. }
  123. $filelist .= "{$v['type']}|{$v['name']}\r\n";
  124. }
  125. //检测需要的目录权限
  126. foreach ($filelists as $v) {
  127. $prvdir = preg_replace("#\/([^\/]*)$#", '/', $v['name']);
  128. if (!preg_match("#^\.#", $prvdir)) $prvdir = './';
  129. $n = TRUE;
  130. foreach ($incdir as $k => $v) {
  131. if (preg_match("#^".$v."#i", $prvdir)) {
  132. $n = FALSE;
  133. break;
  134. }
  135. }
  136. if (!isset($prvdirs[$prvdir]) && $n && is_dir($prvdir)) {
  137. $prvdirs[$prvdir][0] = 1;
  138. $prvdirs[$prvdir][1] = TestWriteAble($prvdir);
  139. }
  140. }
  141. $prvdir = "<table cellpadding='1' cellspacing='1' width='350' bgcolor='#cfcfcf' style='margin-top:10px'>\r\n";
  142. $prvdir .= "<tr style='background:#FBFCE2'><th width='270'>目录</td><th align='center'>可写</td></tr>\r\n";
  143. foreach ($prvdirs as $k => $v) {
  144. if ($v) $cw = '√';
  145. else $cw = '<font color="red">×</font>';
  146. $prvdir .= "<tr bgcolor='#ffffff'><td>$k</td>";
  147. $prvdir .= "<td align='center'>$cw</td></tr>\r\n";
  148. }
  149. $prvdir .= "</table>";
  150. $win = new OxWindow();
  151. $win->Init("module_main.php", "js/blank.js", "post");
  152. $wecome_info = "模块管理";
  153. $win->AddTitle("&nbsp;<a href='module_main.php'>模块管理</a> &gt;&gt; 安装模块: {$infos['name']}");
  154. $win->AddHidden("hash", $hash);
  155. $win->AddHidden("action", 'setupstart');
  156. $msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
  157. <table width='98%' border='0' cellspacing='0' cellpadding='0' class='table'>
  158. <tr>
  159. <td width='20%' height='26' class='dtb'>模块名称:</td>
  160. <td width='80%' class='dtb'>{$infos['name']}</td>
  161. </tr>
  162. <tr>
  163. <td height='26' class='dtb'>语言:</td>
  164. <td class='dtb'>{$infos['lang']} {$alertMsg}</td>
  165. </tr>
  166. <tr>
  167. <td height='26' class='dtb'>文件大小:</td>
  168. <td class='dtb'>{$infos['filesize']}</td>
  169. </tr>
  170. <tr>
  171. <td height='26' class='dtb'>开发者ID:</td>
  172. <td class='dtb'>{$infos['dev_id']} <a href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}' target='_blank' class='btn btn-success btn-sm'>未认证</a></td>
  173. </tr>
  174. <tr>
  175. <td height='26' class='dtb'>发布时间:</td>
  176. <td class='dtb'>{$infos['time']}</td>
  177. </tr>
  178. <tr>
  179. <td height='26' class='dtb'>使用协议:</td>
  180. <td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank' class='btn btn-success btn-sm'>浏览</a></td>
  181. </tr>
  182. <tr>
  183. <td height='30' class='dtb' colspan='2'>
  184. <div class='alert alert-danger'><b>注意事项:</b>安装时请确保文件列表中涉及的目录前可写入权限,此外“后台管理目录”、“后台管理目录/templets”目录也必须暂时设置可写入权限。</div>
  185. </td>
  186. </tr>
  187. <tr>
  188. <td height='30'><b>目录权限检测:</b><br /> ../ 为根目录 <br /> ./ 表示当前目录</td>
  189. <td>$prvdir</td>
  190. </tr>
  191. <tr>
  192. <td height='30'>模块包含的所有文件列表:</td>
  193. <td></td>
  194. </tr>
  195. <tr>
  196. <td height='160' colspan='2'>
  197. <textarea name='filelists' id='filelists' style='width:90%;height:200px'>{$filelist}</textarea>
  198. </td>
  199. </tr>
  200. <tr>
  201. <td height='26'>对于已存在文件处理方法:</td>
  202. <td>
  203. <label><input name='isreplace' type='radio' value='1' checked='checked'>覆盖</label>
  204. <label><input name='isreplace' type='radio' value='3'>覆盖,保留副本</label>
  205. <label><input type='radio' name='isreplace' value='0'>保留旧文件</label>
  206. </td>
  207. </tr>
  208. </table>";
  209. $win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
  210. $winform = $win->GetWindow("ok", "");
  211. $win->Display();
  212. $dm->Clear();
  213. exit();
  214. }
  215. /*---------------
  216. function SetupRun()
  217. --------------*/
  218. else if ($action == 'setupstart') {
  219. if (!is_writeable($mdir)) {
  220. ShowMsg("目录 {$mdir} 不支持写入,这将导致安装程序没法正常创建", "-1");
  221. exit();
  222. }
  223. $dm = new DedeModule($mdir);
  224. $minfos = $dm->GetModuleInfo($hash);
  225. extract($minfos, EXTR_SKIP);
  226. $menustring = addslashes($dm->GetSystemFile($hash, 'menustring'));
  227. $indexurl = str_replace('**', '=', $indexurl);
  228. $query = "INSERT INTO `#@__sys_module`(`hashcode` , `modname` , `indexname` , `indexurl` , `ismember` , `menustring` )
  229. VALUES ('$hash' , '$name' , '$indexname' , '$indexurl' , '$ismember' , '$menustring' ) ";
  230. $rs = $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' ");
  231. $rs = $dsql->ExecuteNoneQuery($query);
  232. if (!$rs) {
  233. ShowMsg('保存数据库信息失败,无法完成安装'.$dsql->GetError(), 'javascript:;');
  234. exit();
  235. }
  236. $dm->WriteFiles($hash, $isreplace);
  237. $filename = '';
  238. if (!isset($autosetup) || $autosetup == 0) $filename = $dm->WriteSystemFile($hash, 'setup');
  239. if (!isset($autodel) || $autodel == 0) $dm->WriteSystemFile($hash, 'uninstall');
  240. $dm->WriteSystemFile($hash, 'readme');
  241. $dm->Clear();
  242. //用模块的安装程序安装
  243. if (!isset($autosetup) || $autosetup == 0) {
  244. include(DEDEDATA.'/module/'.$filename);
  245. exit();
  246. }
  247. //系统自动安装
  248. else {
  249. $mysql_version = $dsql->GetVersion(TRUE);
  250. //默认使用MySQL 4.1 以下版本的SQL语句,对大于4.1版本采用替换处理 TYPE=MyISAM ==> ENGINE=MyISAM DEFAULT CHARSET=#~lang~#
  251. $setupsql = $dm->GetSystemFile($hash, 'setupsql40');
  252. $setupsql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $setupsql);
  253. $sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET='.$cfg_db_language;
  254. if ($mysql_version >= 4.1) {
  255. $setupsql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $setupsql);
  256. }
  257. //_ROOTURL_
  258. if ($cfg_cmspath == '/') $cfg_cmspath = '';
  259. $rooturl = $cfg_basehost.$cfg_cmspath;
  260. $setupsql = preg_replace("#_ROOTURL_#i", $rooturl, $setupsql);
  261. $setupsql = preg_replace("#[\r\n]{1,}#", "\n", $setupsql);
  262. $sqls = @split(";[ \t]{0,}\n", $setupsql);
  263. foreach ($sqls as $sql) {
  264. if (trim($sql) != '') $dsql->ExecuteNoneQuery($sql);
  265. }
  266. ReWriteConfigAuto();
  267. $rflwft = "<script language='javascript' type='text/javascript'>\r\n";
  268. $rflwft .= "if(window.navigator.userAgent.indexOf('MSIE')>=1) top.document.frames.menu.location = 'index_menu_module.php';\r\n";
  269. $rflwft .= "else top.document.getElementById('menufra').src = 'index_menu_module.php';\r\n";
  270. $rflwft .= "</script>";
  271. echo $rflwft;
  272. UpDateCatCache();
  273. ShowMsg('模块安装完成...', 'module_main.php');
  274. exit();
  275. }
  276. }
  277. /*--------------
  278. function DelModule();
  279. --------------*/
  280. else if ($action == 'del') {
  281. $dm = new DedeModule($mdir);
  282. $infos = $dm->GetModuleInfo($hash);
  283. $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br />(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
  284. $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>";
  285. $win = new OxWindow();
  286. $win->Init("module_main.php", "js/blank.js", "post");
  287. $wecome_info = "模块管理";
  288. $win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 删除模块: {$infos['name']}");
  289. $win->AddHidden('hash', $hash);
  290. $win->AddHidden('action', 'delok');
  291. $msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
  292. <table width='750' border='0' cellspacing='0' cellpadding='0'>
  293. <tr>
  294. <td width='20%' height='26' class='dtb'>模块名称:</td>
  295. <td width='80%' class='dtb'>{$infos['name']}</td>
  296. </tr>
  297. <tr>
  298. <td height='26' class='dtb'>语言:</td>
  299. <td class='dtb'>{$infos['lang']} {$alertMsg}</td>
  300. </tr>
  301. <tr>
  302. <td height='26' class='dtb'>文件大小:</td>
  303. <td class='dtb'>{$infos['filesize']}</td>
  304. </tr>
  305. <tr>
  306. <td height='26' class='dtb'>开发者ID:</td>
  307. <td class='dtb'>{$dev_id}</td>
  308. </tr>
  309. <tr>
  310. <td height='26' class='dtb'>发布时间:</td>
  311. <td class='dtb'>{$infos['time']}</td>
  312. </tr>
  313. <tr>
  314. <td height='26' class='dtb'>使用协议:</td>
  315. <td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank' class='btn btn-success btn-sm'>浏览</a></td>
  316. </tr>
  317. <tr>
  318. <td height='26' colspan='2'>删除模块仅删除这个模块的安装包文件,如果您已经安装,请执行<a href='module_main.php?hash={$hash}&action=uninstall'>卸载程序</a>来删除</td>
  319. </tr>
  320. </table>";
  321. $win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
  322. $winform = $win->GetWindow("ok", "");
  323. $win->Display();
  324. $dm->Clear();
  325. exit();
  326. } else if ($action == 'delok') {
  327. $dm = new DedeModule($mdir);
  328. $modfile = $mdir."/".$dm->GetHashFile($hash);
  329. unlink($modfile) or die("删除文件 {$modfile} 失败");
  330. ShowMsg("成功删除一个模块文件", "module_main.php");
  331. exit();
  332. }
  333. /*--------------
  334. function UnInstall();
  335. --------------*/
  336. else if ($action == 'uninstall') {
  337. $dm = new DedeModule($mdir);
  338. $infos = $dm->GetModuleInfo($hash);
  339. if ($infos['url'] == '') $infos['url'] = '&nbsp;';
  340. $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br />(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
  341. $filelists = $dm->GetFileLists($hash);
  342. $filelist = '';
  343. foreach ($filelists as $v) {
  344. if (empty($v['name'])) continue;
  345. if ($v['type'] == 'dir') $v['type'] = '目录';
  346. else $v['type'] = '文件';
  347. $filelist .= "{$v['type']}|{$v['name']}\r\n";
  348. }
  349. $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>";
  350. $win = new OxWindow();
  351. $win->Init("module_main.php", "js/blank.js", "post");
  352. $wecome_info = "模块管理";
  353. $win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 卸载模块: {$infos['name']}");
  354. $win->AddHidden("hash", $hash);
  355. $win->AddHidden("action", 'uninstallok');
  356. $msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
  357. <table width='750' border='0' cellspacing='0' cellpadding='0'>
  358. <tr>
  359. <td width='200' height='26' class='dtb'>模块名称:</td>
  360. <td width='550' class='dtb'>{$infos['name']}</td>
  361. </tr>
  362. <tr>
  363. <td height='26' class='dtb'>语言:</td>
  364. <td class='dtb'>{$infos['lang']} {$alertMsg}</td>
  365. </tr>
  366. <tr>
  367. <td height='26' class='dtb'>文件大小:</td>
  368. <td class='dtb'>{$infos['filesize']}</td>
  369. </tr>
  370. <tr>
  371. <td height='26' class='dtb'>开发者ID:</td>
  372. <td class='dtb'>{$dev_id}</td>
  373. </tr>
  374. <tr>
  375. <td height='26' class='dtb'>发布时间:</td>
  376. <td class='dtb'>{$infos['time']}</td>
  377. </tr>
  378. <tr>
  379. <td height='26' class='dtb'>使用协议:</td>
  380. <td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank' class='btn btn-success btn-sm'>浏览</a></td>
  381. </tr>
  382. <tr>
  383. <td height='26'>模块包含的文件:<br />(文件路径相对于当前目录)</td><td>&nbsp;</td>
  384. </tr>
  385. <tr>
  386. <td height='160' colspan='2'>
  387. <textarea name='filelists' id='filelists' style='width:90%;height:200px'>{$filelist}</textarea>
  388. </td>
  389. </tr>
  390. <tr>
  391. <td height='26'>对于模块的文件处理方法:</td>
  392. <td>
  393. <label><input type='radio' name='isreplace' value='0' checked='checked'>手工删除文件,仅运行卸载程序</label>
  394. <label><input name='isreplace' type='radio' value='2'>删除模块的所有文件</label>
  395. </td>
  396. </tr>
  397. </table>";
  398. $win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
  399. $winform = $win->GetWindow("ok", "");
  400. $win->Display();
  401. $dm->Clear();
  402. exit();
  403. }
  404. /*--------------
  405. function UnInstallRun();
  406. --------------*/
  407. else if ($action == 'uninstallok') {
  408. $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' ");
  409. $dm = new DedeModule($mdir);
  410. $minfos = $dm->GetModuleInfo($hash);
  411. extract($minfos, EXTR_SKIP);
  412. if (!isset($moduletype) || $moduletype != 'patch') {
  413. $dm->DeleteFiles($hash, $isreplace);
  414. }
  415. @$dm->DelSystemFile($hash, 'readme');
  416. @$dm->DelSystemFile($hash, 'setup');
  417. $dm->Clear();
  418. if (!isset($autodel) || $autodel == 0) {
  419. include(DEDEDATA."/module/{$hash}-uninstall.php");
  420. @unlink(DEDEDATA."/module/{$hash}-uninstall.php");
  421. exit();
  422. } else {
  423. @$dm->DelSystemFile($hash, 'uninstall');
  424. $delsql = $dm->GetSystemFile($hash, 'delsql');
  425. if (trim($delsql) != '') {
  426. $sqls = explode(';', $delsql);
  427. foreach ($sqls as $sql) {
  428. if (trim($sql) != '') $dsql->ExecuteNoneQuery($sql);
  429. }
  430. }
  431. ReWriteConfigAuto();
  432. $rflwft = "<script language='javascript' type='text/javascript'>\r\n";
  433. $rflwft .= "if(window.navigator.userAgent.indexOf('MSIE')>=1) top.document.frames.menu.location = 'index_menu_module.php';\r\n";
  434. $rflwft .= "else top.document.getElementById('menufra').src = 'index_menu_module.php';\r\n";
  435. $rflwft .= "</script>";
  436. echo $rflwft;
  437. ShowMsg('模块卸载完成...', 'module_main.php');
  438. exit();
  439. }
  440. }
  441. /*--------------
  442. function ShowReadme();
  443. --------------*/
  444. else if ($action == 'showreadme') {
  445. $dm = new DedeModule($mdir);
  446. $msg = $dm->GetSystemFile($hash, 'readme');
  447. $msg = preg_replace("/(.*)<body/isU", "", $msg);
  448. $msg = preg_replace("/<\/body>(.*)/isU", "", $msg);
  449. $dm->Clear();
  450. $win = new OxWindow();
  451. $win->Init("module_main.php", "js/blank.js", "post");
  452. $wecome_info = "模块管理";
  453. $win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 使用说明:");
  454. $win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
  455. $winform = $win->GetWindow("hand");
  456. $win->Display();
  457. exit();
  458. }
  459. /*--------------
  460. function ViewOne();
  461. --------------*/
  462. else if ($action == 'view') {
  463. $dm = new DedeModule($mdir);
  464. $infos = $dm->GetModuleInfo($hash);
  465. if ($infos['url'] == '') $infos['url'] = '&nbsp;';
  466. $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '<br />(这个模块的语言编码与您系统的编码不一致,请向开发者确认它的兼容性)');
  467. $filelists = $dm->GetFileLists($hash);
  468. $filelist = '';
  469. $setupinfo = '';
  470. foreach ($filelists as $v) {
  471. if (empty($v['name'])) continue;
  472. if ($v['type'] == 'dir') $v['type'] = '目录';
  473. else $v['type'] = '文件';
  474. $filelist .= "{$v['type']}|{$v['name']}\r\n";
  475. }
  476. if (file_exists(DEDEDATA."/module/{$hash}-readme.php")) {
  477. $setupinfo = "已安装 <a href='module_main.php?action=uninstall&hash={$hash}'>卸载</a>";
  478. } else {
  479. $setupinfo = "未安装 <a href='module_main.php?action=setup&hash={$hash}'>安装</a>";
  480. }
  481. $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'>未认证</a>" : "{$infos['dev_id']} <a href='{$cfg_biz_dedebizUrl}/developer?dev_id={$infos['dev_id']}' target='_blank' class='btn btn-success btn-sm'>未认证</a>";
  482. $win = new OxWindow();
  483. $win->Init("", "js/blank.js", "");
  484. $wecome_info = "模块管理";
  485. $win->AddTitle("<a href='module_main.php'>模块管理</a> &gt;&gt; 模块详情: {$infos['name']}");
  486. $msg = "<style>.dtb{border-bottom:1px dotted #ccc}</style>
  487. <table width='98%' border='0' cellspacing='0' cellpadding='0'>
  488. <tr>
  489. <td width='20%' height='26' class='dtb'>模块名称:</td>
  490. <td width='80%' class='dtb'>{$infos['name']}</td>
  491. </tr>
  492. <tr>
  493. <td height='26' class='dtb'>语言:</td>
  494. <td class='dtb'>{$infos['lang']} {$alertMsg}</td>
  495. </tr>
  496. <tr>
  497. <td height='26' class='dtb'>文件大小:</td>
  498. <td class='dtb'>{$infos['filesize']}</td>
  499. </tr>
  500. <tr>
  501. <td height='26' class='dtb'>开发者ID:</td>
  502. <td class='dtb'>{$dev_id}</td>
  503. </tr>
  504. <tr>
  505. <td height='26' class='dtb'>发布时间:</td>
  506. <td class='dtb'>{$infos['time']}</td>
  507. </tr>
  508. <tr>
  509. <td height='26' class='dtb'>使用协议:</td>
  510. <td class='dtb'><a href='module_main.php?action=showreadme&hash={$hash}' target='_blank' class='btn btn-success btn-sm'>浏览</a></td>
  511. </tr>
  512. <tr>
  513. <td height='26'>模块包含的文件:<br />(文件路径相对于当前目录)</td><td>&nbsp;</td>
  514. </tr>
  515. <tr>
  516. <td height='160' colspan='2'>
  517. <textarea name='filelists' id='filelists' style='width:90%;height:200px'>{$filelist}</textarea>
  518. </td>
  519. </tr>
  520. </table>";
  521. $win->AddMsgItem("<div style='padding-left:10px;line-height:150%'>$msg</div>");
  522. $winform = $win->GetWindow('hand', '');
  523. $win->Display();
  524. $dm->Clear();
  525. exit();
  526. }
  527. /*--------------
  528. function Edit();
  529. --------------*/
  530. else if ($action == 'edit') {
  531. $dm = new DedeModule($mdir);
  532. $minfos = $dm->GetModuleInfo($hash);
  533. extract($minfos, EXTR_SKIP);
  534. if (!isset($lang)) $lang = 'gb2312';
  535. if (!isset($moduletype)) $moduletype = 'soft';
  536. $menustring = $dm->GetSystemFile($hash, 'menustring');
  537. $setupsql40 = dede_htmlspecialchars($dm->GetSystemFile($hash, 'setupsql40'));
  538. $readmetxt = $dm->GetSystemFile($hash, 'readme');
  539. $delsql = $dm->GetSystemFile($hash, 'delsql');
  540. $filelist = $dm->GetSystemFile($hash, 'oldfilelist', false);
  541. $indexurl = str_replace('**', '=', $indexurl);
  542. $dm->Clear();
  543. require_once(dirname(__FILE__).'/templets/module_edit.htm');
  544. exit();
  545. }
  546. /*--------------
  547. function Download();
  548. --------------*/
  549. else if ($action == 'download') {
  550. ShowMsg("暂不支持模块下载功能", "javascript:;");
  551. }