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

493 lines
19KB

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