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

664 lines
23KB

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