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

550 lines
21KB

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