国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
pirms 2 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <?php
  2. /**
  3. * 文件管理器
  4. *
  5. * @version $Id: tpl.php 1 23:44 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('plus_文件管理器');
  13. $action = isset($action) ? trim($action) : '';
  14. if (empty($acdir)) $acdir = $cfg_df_style;
  15. $templetdir = $cfg_basedir.$cfg_templets_dir;
  16. $templetdird = $templetdir.'/'.$acdir;
  17. $templeturld = $cfg_templeturl.'/'.$acdir;
  18. if (empty($filename)) $filename = '';
  19. $filename = preg_replace("#[\/\\\\]#", '', $filename);
  20. if (preg_match("#\.#", $acdir)) {
  21. ShowMsg('Not Allow dir '.$acdir.'!', '-1');
  22. exit();
  23. }
  24. /*
  25. function edit_new_tpl() { }
  26. 编辑模板
  27. */
  28. if ($action == 'edit' || $action == 'newfile') {
  29. if ($filename == '' && $action == 'edit') {
  30. ShowMsg('未指定要编辑的文件', '-1');
  31. exit();
  32. }
  33. if (!file_exists($templetdird.'/'.$filename) && $action == 'edit') {
  34. $action = 'newfile';
  35. }
  36. //读取文件内容
  37. //$content = dede_htmlspecialchars(trim(file_get_contents($truePath.$filename)));
  38. if ($action == 'edit') {
  39. $fp = fopen($templetdird.'/'.$filename, 'r');
  40. $content = fread($fp, filesize($templetdird.'/'.$filename));
  41. fclose($fp);
  42. $content = preg_replace("#<textarea#i", "##textarea", $content);
  43. $content = preg_replace("#</textarea#i", "##/textarea", $content);
  44. $content = preg_replace("#<form#i", "##form", $content);
  45. $content = preg_replace("#</form#i", "##/form", $content);
  46. } else {
  47. if (empty($filename)) $filename = 'newtpl.htm';
  48. $content = '';
  49. }
  50. //获取标签帮助信息
  51. $helps = $dtags = array();
  52. $tagHelpDir = DEDEINC.'/taglib/help/';
  53. $dir = dir($tagHelpDir);
  54. while (false !== ($entry = $dir->read())) {
  55. if ($entry != '.' && $entry != '..' && !is_dir($tagHelpDir.$entry)) {
  56. $dtags[] = str_replace('.txt', '', $entry);
  57. }
  58. }
  59. $dir->close();
  60. foreach ($dtags as $tag) {
  61. //$helpContent = file_get_contents($tagHelpDir.$tag.'.txt');
  62. $fp = fopen($tagHelpDir.$tag.'.txt', 'r');
  63. $helpContent = fread($fp, filesize($tagHelpDir.$tag.'.txt'));
  64. fclose($fp);
  65. $helps[$tag] = explode('>>dede>>', $helpContent);
  66. }
  67. make_hash();
  68. include DEDEADMIN.'/templets/tpl_edit.htm';
  69. exit();
  70. }
  71. /*---------------------------
  72. function save_tpl() { }
  73. 保存编辑模板
  74. --------------------------*/
  75. else if ($action == 'saveedit') {
  76. CheckCSRF();
  77. if ($filename == '') {
  78. ShowMsg('未指定要编辑的文件或文件名不合法', '-1');
  79. exit();
  80. }
  81. if (!preg_match("#\.htm$#", $filename)) {
  82. ShowMsg('DEDE模板文件,文件名必须用.htm结尾', '-1');
  83. exit();
  84. }
  85. $content = stripslashes($content);
  86. $content = preg_replace("/##textarea/i", "<textarea", $content);
  87. $content = preg_replace("/##\/textarea/i", "</textarea", $content);
  88. $content = preg_replace("/##form/i", "<form", $content);
  89. $content = preg_replace("/##\/form/i", "</form", $content);
  90. $truefile = $templetdird.'/'.$filename;
  91. $fp = fopen($truefile, 'w');
  92. fwrite($fp, $content);
  93. fclose($fp);
  94. ShowMsg('成功修改或新建文件', 'templets_main.php?acdir='.$acdir);
  95. exit();
  96. }
  97. /*---------------------------
  98. function del_tpl() { }
  99. 删除模板
  100. --------------------------*/
  101. else if ($action == 'del') {
  102. $truefile = $templetdird.'/'.$filename;
  103. if (unlink($truefile)) {
  104. ShowMsg('删除文件成功', 'templets_main.php?acdir='.$acdir);
  105. exit();
  106. } else {
  107. ShowMsg('删除文件失败', '-1');
  108. exit();
  109. }
  110. }
  111. /*----------------------
  112. function _upload() {}
  113. 上传新模板
  114. -----------------------*/
  115. else if ($action == 'upload') {
  116. require_once(DEDEINC.'/libraries/oxwindow.class.php');
  117. $acdir = str_replace('.', '', $acdir);
  118. $win = new OxWindow();
  119. make_hash();
  120. $win->Init("tpl.php", "js/blank.js", "POST' enctype='multipart/form-data' ");
  121. $win->mainTitle = "模块管理";
  122. $wecome_info = "<a href='templets_main.php'>模板管理</a> &gt; 上传模板";
  123. $win->AddTitle('请选择要上传的文件:');
  124. $win->AddHidden("action", 'uploadok');
  125. $msg = "
  126. <table width='600' border='0' cellspacing='0' cellpadding='0'>
  127. <tr>
  128. <td width='96' height='60'>请选择文件:</td>
  129. <td width='504'>
  130. <input name='acdir' type='hidden' value='$acdir' />
  131. <input name='token' type='hidden' value='{$_SESSION['token']}' />
  132. <input name='upfile' type='file' id='upfile' style='width:380px' />
  133. </td>
  134. </tr>
  135. </table>
  136. ";
  137. $win->AddMsgItem("<div style='line-height:26px'>$msg</div>");
  138. $winform = $win->GetWindow('ok', '');
  139. $win->Display();
  140. exit();
  141. }
  142. /*----------------------
  143. function _upload() {}
  144. 上传新模板
  145. -----------------------*/
  146. else if ($action == 'uploadok') {
  147. CheckCSRF();
  148. if (!is_uploaded_file($upfile)) {
  149. ShowMsg("貌似您什么都没有上传哦", "javascript:;");
  150. exit();
  151. } else {
  152. if (!preg_match("#\.(htm|html)$#", $upfile_name)) {
  153. ShowMsg("DedeBIZ模板只能用 .htm 或 .html扩展名", "-1");
  154. exit();
  155. }
  156. if (preg_match("#[\\\\\/]#", $upfile_name)) {
  157. ShowMsg("模板文件名有非法字符,禁止上传", "-1");
  158. exit();
  159. }
  160. move_uploaded_file($upfile, $templetdird.'/'.$upfile_name);
  161. @unlink($upfile);
  162. ShowMsg("成功上传一个模板", "templets_main.php?acdir=$acdir");
  163. exit();
  164. }
  165. exit();
  166. }
  167. /*---------------------------
  168. function edittag() { }
  169. 修改标签碎片
  170. --------------------------*/
  171. else if ($action == 'edittag' || $action == 'addnewtag') {
  172. if ($action == 'addnewtag') {
  173. $democode = '<'."?php
  174. if(!defined('DEDEINC'))
  175. {
  176. exit(\"Request Error!\");
  177. }
  178. function lib_demotag(&\$ctag,&\$refObj)
  179. {
  180. global \$dsql,\$envs;
  181. //属性处理
  182. \$attlist=\"row|12,titlelen|24\";
  183. FillAttsDefault(\$ctag->CAttribute->Items,\$attlist);
  184. extract(\$ctag->CAttribute->Items, EXTR_SKIP);
  185. \$revalue = '';
  186. //您需编写的代码,不能用echo之类语法,把最终返回值传给\$revalue
  187. \$revalue = 'Hello Word!';
  188. return \$revalue;
  189. }
  190. ?".'>';
  191. $filename = "demotag.lib.php";
  192. $title = "新建标签";
  193. } else {
  194. if (!preg_match("#^[a-z0-9_-]{1,}\.lib\.php$#i", $filename)) {
  195. ShowMsg('文件不是标准的标签碎片文件,不允许在此编辑', '-1');
  196. exit();
  197. }
  198. $fp = fopen(DEDEINC.'/taglib/'.$filename, 'r');
  199. $democode = fread($fp, filesize(DEDEINC.'/taglib/'.$filename));
  200. fclose($fp);
  201. $title = "修改标签";
  202. }
  203. make_hash();
  204. include DEDEADMIN.'/templets/tpl_edit_tag.htm';
  205. exit();
  206. }
  207. /*---------------------------
  208. function savetagfile() { }
  209. 保存标签碎片修改
  210. --------------------------*/
  211. else if ($action == 'savetagfile') {
  212. CheckCSRF();
  213. if (!preg_match("#^[a-z0-9_-]{1,}\.lib\.php$#i", $filename)) {
  214. ShowMsg('文件名不合法,不允许进行操作', '-1');
  215. exit();
  216. }
  217. require_once(DEDEINC.'/libraries/oxwindow.class.php');
  218. $tagname = preg_replace("#\.lib\.php$#i", "", $filename);
  219. $content = stripslashes($content);
  220. $truefile = DEDEINC.'/taglib/'.$filename;
  221. $fp = fopen($truefile, 'w');
  222. fwrite($fp, $content);
  223. fclose($fp);
  224. $msg = "
  225. <form name='form1' action='tag_test_action.php' target='blank' method='post'>
  226. <input type='hidden' name='dopost' value='make' />
  227. 测试标签:(需要使用环境变量的不能在此测试)<br>
  228. <textarea name='partcode' cols='150' rows='6' style='width:90%;'>{dede:{$tagname} }{/dede:{$tagname}}</textarea><br>
  229. <button type='submit' name='B1' class='btn btn-success btn-sm'>确定</button>
  230. </form>
  231. ";
  232. $wintitle = "成功修改/创建文件";
  233. $wecome_info = "<a href='templets_tagsource.php'>标签源码碎片管理</a> &gt; 修改/新建标签";
  234. $win = new OxWindow();
  235. $win->AddTitle("修改/新建标签:");
  236. $win->AddMsgItem($msg);
  237. $winform = $win->GetWindow("hand", "&nbsp;", false);
  238. $win->Display();
  239. exit();
  240. }