2021年4月3日
文件 jiuhecai.php 替换
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.2.6/ext-language_tools.js" type="text/javascript" charset="utf-8"></script>
为
<script src="//cdn.staticfile.org/ace/1.2.6/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="//cdn.staticfile.org/ace/1.2.6/ext-language_tools.js" type="text/javascript" charset="utf-8"></script>
2022年3月8日
//增加了.md文件的浏览功能。重点修改代码备忘: <?php $file=$_GET['fn']; $kzm= substr($file, strrpos($file, '.')+1); if(strtolower($kzm)!='md'){ exit(); } define('EmpireCMSAdmin', '1'); define('InEmpireCMS', '1'); require($_SERVER['DOCUMENT_ROOT']."/e/class/connect.php"); require($_SERVER['DOCUMENT_ROOT']."/e/class/db_sql.php"); require('jhcfun.php'); require($_SERVER['DOCUMENT_ROOT']."/e/class/functions.php"); // require('../../data/dbcache/class.php'); $link = db_connect(); $empire = new mysqlquery(); //$editor = 1;//验证用户 $lur = is_login(); $logininid = $lur['userid']; $loginin = $lur['username']; $file=trim($file,'/'); $file=ECMS_PATH.$file; if(!file_exists($file)){ db_close(); $empire=null; exit(); } $md=file_get_contents($file); require_once "Parsedown.php"; $Parsedown = new Parsedown(); $html= $Parsedown->text($md); ?> <!DOCTYPE html> <html><head><meta charset="UTF-8"> <title>ACE代码编辑器</title> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> </head> <body> <?=$html?> </body></html>
对应的js调整
//浏览操作 function preview(obj, path) { if ( !obj || !path ) { return false; } var fileExtension = path.split('.').pop().toLowerCase(); if(fileExtension=='md'){ path='e/extend/erkaihelper/viewmd.php{$whehref}&fn='+path; } path=window.location.host+'/'+path; path=path.replace('//','/'); path=window.location.protocol+"//"+path; window.open(path, '_blank'); }