国内流行的内容管理系统(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.

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