Browse Source

修复文本框链接问题

master
sj 2 years ago
parent
commit
46437af817
  1. 56
      public/UEditor/dialogs/internal.js
  2. 4
      public/UEditor/dialogs/scrawl/scrawl.js
  3. BIN
      public/UEditor/dialogs/wordimage/fClipboard_ueditor.swf
  4. BIN
      public/UEditor/dialogs/wordimage/imageUploader.swf
  5. 481
      public/UEditor/lang/en/en.js
  6. 372
      public/UEditor/php/Uploader.class.php
  7. 44
      public/UEditor/php/action_crawler.php
  8. 92
      public/UEditor/php/action_list.php
  9. 66
      public/UEditor/php/action_upload.php
  10. 94
      public/UEditor/php/config.json
  11. 59
      public/UEditor/php/controller.php
  12. 1
      public/UEditor/themes/default/css/ueditor.css
  13. BIN
      public/UEditor/third-party/video-js/video-js.swf
  14. BIN
      public/UEditor/third-party/webuploader/Uploader.swf
  15. BIN
      public/UEditor/third-party/zeroclipboard/ZeroClipboard.swf
  16. 68
      public/UEditor/ueditor.config.js
  17. 2
      src/views/bxg/activity/combination/form.vue
  18. 2
      src/views/bxg/shop/set/aboutUs.vue
  19. 2
      src/views/bxg/tools/email/send.vue
  20. 2
      src/views/bxg/wechat/article/form.vue

56
public/UEditor/dialogs/internal.js

@ -1,25 +1,24 @@
(function () { (function () {
/* eslint-disable */ var parent = window.parent;
if (window.frameElement.id) { //dialog对象
let parent = window.parent, dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )];
//当前打开dialog的编辑器实例
editor = dialog.editor;
dialog = parent.$EDITORUI[window.frameElement.id.replace(/_iframe$/, '')], UE = parent.UE;
editor = dialog.editor, domUtils = UE.dom.domUtils;
UE = parent.UE, utils = UE.utils;
domUtils = UE.dom.domUtils, browser = UE.browser;
utils = UE.utils, ajax = UE.ajax;
browser = UE.browser,
/* eslint-disable */
ajax = UE.ajax,
$G = function ( id ) { $G = function ( id ) {
return document.getElementById( id ) return document.getElementById( id )
}, };
//focus元素
$focus = function ( node ) { $focus = function ( node ) {
setTimeout( function () { setTimeout( function () {
if ( browser.ie ) { if ( browser.ie ) {
@ -33,21 +32,22 @@
}; };
window.nowEditor = {editor: editor, dialog: dialog}; window.nowEditor = {editor: editor, dialog: dialog};
utils.loadFile(document,{ utils.loadFile(document,{
href: editor.options.themePath + editor.options.theme + '/dialogbase.css?cache=' + Math.random(), href:editor.options.themePath + editor.options.theme + "/dialogbase.css?cache="+Math.random(),
tag: 'link', tag:"link",
type: 'text/css', type:"text/css",
rel: 'stylesheet' rel:"stylesheet"
}); });
var lang = editor.getLang(dialog.className.split('-')[2]); lang = editor.getLang(dialog.className.split( "-" )[2]);
if(lang){ if(lang){
domUtils.on(window,'load',function () { domUtils.on(window,'load',function () {
var langImgPath = editor.options.langPath + editor.options.lang + '/images/';
var langImgPath = editor.options.langPath + editor.options.lang + "/images/";
//针对静态资源 //针对静态资源
for (var i in lang['static']) { for ( var i in lang["static"] ) {
var dom = $G( i ); var dom = $G( i );
if(!dom) continue; if(!dom) continue;
let tagName = dom.tagName, var tagName = dom.tagName,
content = lang['static'][i]; content = lang["static"][i];
if(content.src){ if(content.src){
//clone //clone
content = utils.extend({},content,false); content = utils.extend({},content,false);
@ -55,19 +55,19 @@
} }
if(content.style){ if(content.style){
content = utils.extend({},content,false); content = utils.extend({},content,false);
content.style = content.style.replace(/url\s*\(/g, 'url(' + langImgPath) content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath)
} }
switch ( tagName.toLowerCase() ) { switch ( tagName.toLowerCase() ) {
case 'var': case "var":
dom.parentNode.replaceChild( document.createTextNode( content ), dom ); dom.parentNode.replaceChild( document.createTextNode( content ), dom );
break; break;
case 'select': case "select":
var ops = dom.options; var ops = dom.options;
for ( var j = 0, oj; oj = ops[j]; ) { for ( var j = 0, oj; oj = ops[j]; ) {
oj.innerHTML = content.options[j++]; oj.innerHTML = content.options[j++];
} }
for ( var p in content ) { for ( var p in content ) {
p != 'options' && dom.setAttribute(p, content[p]); p != "options" && dom.setAttribute( p, content[p] );
} }
break; break;
default : default :
@ -76,5 +76,7 @@
} }
} ); } );
} }
}
})(); })();

4
public/UEditor/dialogs/scrawl/scrawl.js

@ -256,7 +256,7 @@ var scrawl = function (options) {
if (img) { if (img) {
if (!scaleCon) { if (!scaleCon) {
picBoard.style.cssText = "position:relative;z-index:1;"+picBoard.style.cssText; picBoard.style.cssText = "position:relative;z-index:999;"+picBoard.style.cssText;
img.style.cssText = "position: absolute;top:" + (canvas.height - img.height) / 2 + "px;left:" + (canvas.width - img.width) / 2 + "px;"; img.style.cssText = "position: absolute;top:" + (canvas.height - img.height) / 2 + "px;left:" + (canvas.width - img.width) / 2 + "px;";
var scale = new ScaleBoy(); var scale = new ScaleBoy();
picBoard.appendChild(scale.init()); picBoard.appendChild(scale.init());
@ -268,7 +268,7 @@ var scrawl = function (options) {
picBoard.style.zIndex = ""; picBoard.style.zIndex = "";
} else { } else {
scaleCon.style.visibility = "visible"; scaleCon.style.visibility = "visible";
picBoard.style.cssText += "position:relative;z-index:1"; picBoard.style.cssText += "position:relative;z-index:999";
} }
} }
} }

BIN
public/UEditor/dialogs/wordimage/fClipboard_ueditor.swf

Binary file not shown.

BIN
public/UEditor/dialogs/wordimage/imageUploader.swf

Binary file not shown.

481
public/UEditor/lang/en/en.js

@ -7,96 +7,25 @@
*/ */
UE.I18N['en'] = { UE.I18N['en'] = {
'labelMap':{ 'labelMap':{
'anchor': 'Anchor', 'anchor':'Anchor', 'undo':'Undo', 'redo':'Redo', 'bold':'Bold', 'indent':'Indent', 'snapscreen':'SnapScreen',
'undo': 'Undo', 'italic':'Italic', 'underline':'Underline', 'strikethrough':'Strikethrough', 'subscript':'SubScript','fontborder':'text border',
'redo': 'Redo', 'superscript':'SuperScript', 'formatmatch':'Format Match', 'source':'Source', 'blockquote':'BlockQuote',
'bold': 'Bold', 'pasteplain':'PastePlain', 'selectall':'SelectAll', 'print':'Print', 'preview':'Preview',
'indent': 'Indent', 'horizontal':'Horizontal', 'removeformat':'RemoveFormat', 'time':'Time', 'date':'Date',
'snapscreen': 'SnapScreen', 'unlink':'Unlink', 'insertrow':'InsertRow', 'insertcol':'InsertCol', 'mergeright':'MergeRight', 'mergedown':'MergeDown',
'italic': 'Italic', 'deleterow':'DeleteRow', 'deletecol':'DeleteCol', 'splittorows':'SplitToRows','insertcode':'insert code',
'underline': 'Underline', 'splittocols':'SplitToCols', 'splittocells':'SplitToCells','deletecaption':'DeleteCaption','inserttitle':'InsertTitle',
'strikethrough': 'Strikethrough', 'mergecells':'MergeCells', 'deletetable':'DeleteTable', 'cleardoc':'Clear', 'insertparagraphbeforetable':"InsertParagraphBeforeTable",
'subscript': 'SubScript', 'fontfamily':'FontFamily', 'fontsize':'FontSize', 'paragraph':'Paragraph','simpleupload':'Single Image','insertimage':'Multi Image','edittable':'Edit Table', 'edittd':'Edit Td','link':'Link',
'fontborder': 'text border', 'emotion':'Emotion', 'spechars':'Spechars', 'searchreplace':'SearchReplace', 'map':'BaiduMap', 'gmap':'GoogleMap',
'superscript': 'SuperScript', 'insertvideo':'Video', 'help':'Help', 'justifyleft':'JustifyLeft', 'justifyright':'JustifyRight', 'justifycenter':'JustifyCenter',
'formatmatch': 'Format Match', 'justifyjustify':'Justify', 'forecolor':'FontColor', 'backcolor':'BackColor', 'insertorderedlist':'OL',
'source': 'Source', 'insertunorderedlist':'UL', 'fullscreen':'FullScreen', 'directionalityltr':'EnterFromLeft', 'directionalityrtl':'EnterFromRight',
'blockquote': 'BlockQuote', 'rowspacingtop':'RowSpacingTop', 'rowspacingbottom':'RowSpacingBottom', 'pagebreak':'PageBreak', 'insertframe':'Iframe', 'imagenone':'Default',
'pasteplain': 'PastePlain', 'imageleft':'ImageLeft', 'imageright':'ImageRight', 'attachment':'Attachment', 'imagecenter':'ImageCenter', 'wordimage':'WordImage',
'selectall': 'SelectAll', 'lineheight':'LineHeight','edittip':'EditTip','customstyle':'CustomStyle', 'scrawl':'Scrawl', 'autotypeset':'AutoTypeset',
'print': 'Print', 'webapp':'WebAPP', 'touppercase':'UpperCase', 'tolowercase':'LowerCase','template':'Template','background':'Background','inserttable':'InsertTable',
'preview': 'Preview', 'music':'Music', 'charts': 'charts','drafts': 'Load from Drafts'
'horizontal': 'Horizontal',
'removeformat': 'RemoveFormat',
'time': 'Time',
'date': 'Date',
'unlink': 'Unlink',
'insertrow': 'InsertRow',
'insertcol': 'InsertCol',
'mergeright': 'MergeRight',
'mergedown': 'MergeDown',
'deleterow': 'DeleteRow',
'deletecol': 'DeleteCol',
'splittorows': 'SplitToRows',
'insertcode': 'insert code',
'splittocols': 'SplitToCols',
'splittocells': 'SplitToCells',
'deletecaption': 'DeleteCaption',
'inserttitle': 'InsertTitle',
'mergecells': 'MergeCells',
'deletetable': 'DeleteTable',
'cleardoc': 'Clear',
'insertparagraphbeforetable': 'InsertParagraphBeforeTable',
'fontfamily': 'FontFamily',
'fontsize': 'FontSize',
'paragraph': 'Paragraph',
'simpleupload': 'Single Image',
'insertimage': 'Multi Image',
'edittable': 'Edit Table',
'edittd': 'Edit Td',
'link': 'Link',
'emotion': 'Emotion',
'spechars': 'Spechars',
'searchreplace': 'SearchReplace',
'map': 'BaiduMap',
'gmap': 'GoogleMap',
'insertvideo': 'Video',
'help': 'Help',
'justifyleft': 'JustifyLeft',
'justifyright': 'JustifyRight',
'justifycenter': 'JustifyCenter',
'justifyjustify': 'Justify',
'forecolor': 'FontColor',
'backcolor': 'BackColor',
'insertorderedlist': 'OL',
'insertunorderedlist': 'UL',
'fullscreen': 'FullScreen',
'directionalityltr': 'EnterFromLeft',
'directionalityrtl': 'EnterFromRight',
'rowspacingtop': 'RowSpacingTop',
'rowspacingbottom': 'RowSpacingBottom',
'pagebreak': 'PageBreak',
'insertframe': 'Iframe',
'imagenone': 'Default',
'imageleft': 'ImageLeft',
'imageright': 'ImageRight',
'attachment': 'Attachment',
'imagecenter': 'ImageCenter',
'wordimage': 'WordImage',
'lineheight': 'LineHeight',
'edittip': 'EditTip',
'customstyle': 'CustomStyle',
'scrawl': 'Scrawl',
'autotypeset': 'AutoTypeset',
'webapp': 'WebAPP',
'touppercase': 'UpperCase',
'tolowercase': 'LowerCase',
'template': 'Template',
'background': 'Background',
'inserttable': 'InsertTable',
'music': 'Music',
'charts': 'charts',
'drafts': 'Load from Drafts'
}, },
'insertorderedlist':{ 'insertorderedlist':{
'num':'1,2,3...', 'num':'1,2,3...',
@ -142,34 +71,34 @@ UE.I18N['en'] = {
'exceedSizeError': 'File Size Exceed', 'exceedSizeError': 'File Size Exceed',
'exceedTypeError': 'File Type Not Allow', 'exceedTypeError': 'File Type Not Allow',
'jsonEncodeError': 'Server Return Format Error', 'jsonEncodeError': 'Server Return Format Error',
'loading': 'loading...', 'loading':"loading...",
'loadError': 'load error', 'loadError':"load error",
'errorLoadConfig': 'Server config not loaded, upload can not work.' 'errorLoadConfig': 'Server config not loaded, upload can not work.',
}, },
'simpleupload':{ 'simpleupload':{
'exceedSizeError': 'File Size Exceed', 'exceedSizeError': 'File Size Exceed',
'exceedTypeError': 'File Type Not Allow', 'exceedTypeError': 'File Type Not Allow',
'jsonEncodeError': 'Server Return Format Error', 'jsonEncodeError': 'Server Return Format Error',
'loading': 'loading...', 'loading':"loading...",
'loadError': 'load error', 'loadError':"load error",
'errorLoadConfig': 'Server config not loaded, upload can not work.' 'errorLoadConfig': 'Server config not loaded, upload can not work.',
}, },
'elementPathTip': 'Path', 'elementPathTip':"Path",
'wordCountTip': 'Word Count', 'wordCountTip':"Word Count",
'wordCountMsg':'{#count} characters entered,{#leave} left. ', 'wordCountMsg':'{#count} characters entered,{#leave} left. ',
'wordOverFlowMsg':'<span style="color:red;">The number of characters has exceeded allowable maximum values, the server may refuse to save!</span>', 'wordOverFlowMsg':'<span style="color:red;">The number of characters has exceeded allowable maximum values, the server may refuse to save!</span>',
'ok': 'OK', 'ok':"OK",
'cancel': 'Cancel', 'cancel':"Cancel",
'closeDialog': 'closeDialog', 'closeDialog':"closeDialog",
'tableDrag': 'You must import the file uiUtils.js before drag! ', 'tableDrag':"You must import the file uiUtils.js before drag! ",
'autofloatMsg': 'The plugin AutoFloat depends on EditorUI!', 'autofloatMsg':"The plugin AutoFloat depends on EditorUI!",
'loadconfigError': 'Get server config error.', 'loadconfigError': 'Get server config error.',
'loadconfigFormatError': 'Server config format error.', 'loadconfigFormatError': 'Server config format error.',
'loadconfigHttpError': 'Get server config http error.', 'loadconfigHttpError': 'Get server config http error.',
'snapScreen_plugin':{ 'snapScreen_plugin':{
'browserMsg': 'Only IE supported!', 'browserMsg':"Only IE supported!",
'callBackErrorMsg': 'The callback data is wrong,please check the config!', 'callBackErrorMsg':"The callback data is wrong,please check the config!",
'uploadErrorMsg': 'Upload error,please check your server environment! ' 'uploadErrorMsg':"Upload error,please check your server environment! "
}, },
'insertcode':{ 'insertcode':{
'as3':'ActionScript 3', 'as3':'ActionScript 3',
@ -197,31 +126,31 @@ UE.I18N['en'] = {
'vb':'Visual Basic', 'vb':'Visual Basic',
'xml':'XML' 'xml':'XML'
}, },
'confirmClear': 'Do you confirm to clear the Document?', 'confirmClear':"Do you confirm to clear the Document?",
'contextMenu':{ 'contextMenu':{
'delete': 'Delete', 'delete':"Delete",
'selectall': 'Select all', 'selectall':"Select all",
'deletecode': 'Delete Code', 'deletecode':"Delete Code",
'cleardoc': 'Clear Document', 'cleardoc':"Clear Document",
'confirmclear': 'Do you confirm to clear the Document?', 'confirmclear':"Do you confirm to clear the Document?",
'unlink': 'Unlink', 'unlink':"Unlink",
'paragraph': 'Paragraph', 'paragraph':"Paragraph",
'edittable': 'Table property', 'edittable':"Table property",
'aligncell':'Align cell', 'aligncell':'Align cell',
'aligntable':'Table alignment', 'aligntable':'Table alignment',
'tableleft':'Left float', 'tableleft':'Left float',
'tablecenter':'Center', 'tablecenter':'Center',
'tableright':'Right float', 'tableright':'Right float',
'aligntd':'Cell alignment', 'aligntd':'Cell alignment',
'edittd': 'Cell property', 'edittd':"Cell property",
'setbordervisible':'set table edge visible', 'setbordervisible':'set table edge visible',
'table': 'Table', 'table':"Table",
'justifyleft':'Justify Left', 'justifyleft':'Justify Left',
'justifyright':'Justify Right', 'justifyright':'Justify Right',
'justifycenter':'Justify Center', 'justifycenter':'Justify Center',
'justifyjustify':'Default', 'justifyjustify':'Default',
'deletetable': 'Delete table', 'deletetable':"Delete table",
'insertparagraphbefore': 'InsertedBeforeLine', 'insertparagraphbefore':"InsertedBeforeLine",
'insertparagraphafter':'InsertedAfterLine', 'insertparagraphafter':'InsertedAfterLine',
'inserttable':'Insert table', 'inserttable':'Insert table',
'insertcaption':'Insert caption', 'insertcaption':'Insert caption',
@ -232,19 +161,19 @@ UE.I18N['en'] = {
'deletetitlecol':'Delete Title Col', 'deletetitlecol':'Delete Title Col',
'averageDiseRow':'AverageDise Row', 'averageDiseRow':'AverageDise Row',
'averageDisCol':'AverageDis Col', 'averageDisCol':'AverageDis Col',
'deleterow': 'Delete row', 'deleterow':"Delete row",
'deletecol': 'Delete col', 'deletecol':"Delete col",
'insertrow': 'Insert row', 'insertrow':"Insert row",
'insertcol': 'Insert col', 'insertcol':"Insert col",
'insertrownext':'Insert Row Next', 'insertrownext':'Insert Row Next',
'insertcolnext':'Insert Col Next', 'insertcolnext':'Insert Col Next',
'mergeright': 'Merge right', 'mergeright':"Merge right",
'mergeleft': 'Merge left', 'mergeleft':"Merge left",
'mergedown': 'Merge down', 'mergedown':"Merge down",
'mergecells': 'Merge cells', 'mergecells':"Merge cells",
'splittocells': 'Split to cells', 'splittocells':"Split to cells",
'splittocols': 'Split to Cols', 'splittocols':"Split to Cols",
'splittorows': 'Split to Rows', 'splittorows':"Split to Rows",
'tablesort':'Table sorting', 'tablesort':'Table sorting',
'enablesort':'Sorting Enable', 'enablesort':'Sorting Enable',
'disablesort':'Sorting Disable', 'disablesort':'Sorting Disable',
@ -260,14 +189,14 @@ UE.I18N['en'] = {
'unsetbackground':'Cancel Bk interlaced', 'unsetbackground':'Cancel Bk interlaced',
'redandblue':'Blue and red', 'redandblue':'Blue and red',
'threecolorgradient':'Three-color gradient', 'threecolorgradient':'Three-color gradient',
'copy': 'Copy(Ctrl + c)', 'copy':"Copy(Ctrl + c)",
'copymsg':"Browser does not support. Please use 'Ctrl + c' instead!", 'copymsg':"Browser does not support. Please use 'Ctrl + c' instead!",
'paste': 'Paste(Ctrl + v)', 'paste':"Paste(Ctrl + v)",
'pastemsg':"Browser does not support. Please use 'Ctrl + v' instead!" 'pastemsg':"Browser does not support. Please use 'Ctrl + v' instead!"
}, },
'copymsg': "Browser does not support. Please use 'Ctrl + c' instead!", 'copymsg': "Browser does not support. Please use 'Ctrl + c' instead!",
'pastemsg': "Browser does not support. Please use 'Ctrl + v' instead!", 'pastemsg': "Browser does not support. Please use 'Ctrl + v' instead!",
'anthorMsg': 'Link', 'anthorMsg':"Link",
'clearColor':'Clear', 'clearColor':'Clear',
'standardColor':'Standard color', 'standardColor':'Standard color',
'themeColor':'Theme color', 'themeColor':'Theme color',
@ -281,27 +210,27 @@ UE.I18N['en'] = {
'clear':'Clear', 'clear':'Clear',
'anchorMsg':'Anchor', 'anchorMsg':'Anchor',
'delete':'Delete', 'delete':'Delete',
'clickToUpload': 'Click to upload', 'clickToUpload':"Click to upload",
'unset':'Language hasn\'t been set!', 'unset':'Language hasn\'t been set!',
't_row':'row', 't_row':'row',
't_col':'col', 't_col':'col',
'pasteOpt':'Paste Option', 'pasteOpt':'Paste Option',
'pasteSourceFormat': 'Keep Source Formatting', 'pasteSourceFormat':"Keep Source Formatting",
'tagFormat':'Keep tag', 'tagFormat':'Keep tag',
'pasteTextFormat':'Keep Text only', 'pasteTextFormat':'Keep Text only',
'more':'More', 'more':'More',
'autoTypeSet':{ 'autoTypeSet':{
'mergeLine': 'Merge empty line', 'mergeLine':"Merge empty line",
'delLine': 'Del empty line', 'delLine':"Del empty line",
'removeFormat': 'Remove format', 'removeFormat':"Remove format",
'indent': 'Indent', 'indent':"Indent",
'alignment': 'Alignment', 'alignment':"Alignment",
'imageFloat': 'Image float', 'imageFloat':"Image float",
'removeFontsize': 'Remove font size', 'removeFontsize':"Remove font size",
'removeFontFamily': 'Remove fontFamily', 'removeFontFamily':"Remove fontFamily",
'removeHtml': 'Remove redundant HTML code', 'removeHtml':"Remove redundant HTML code",
'pasteFilter': 'Paste filter', 'pasteFilter':"Paste filter",
'run': 'Done', 'run':"Done",
'symbol':'Symbol Conversion', 'symbol':'Symbol Conversion',
'bdc2sb':'Full-width to Half-width', 'bdc2sb':'Full-width to Half-width',
'tobdc':'Half-width to Full-width' 'tobdc':'Half-width to Full-width'
@ -318,33 +247,33 @@ UE.I18N['en'] = {
'lang_background_netimg':'Net-Image', 'lang_background_netimg':'Net-Image',
'lang_background_align':'Align Type', 'lang_background_align':'Align Type',
'lang_background_position':'Position', 'lang_background_position':'Position',
'repeatType': { 'options': ['Center', 'Repeat-x', 'Repeat-y', 'Tile', 'Custom'] } 'repeatType':{'options':["Center", "Repeat-x", "Repeat-y", "Tile","Custom"]}
}, },
'noUploadImage': 'No pictures has been uploaded!', 'noUploadImage':"No pictures has been uploaded!",
'toggleSelect':'Change the active state by click!\n Image Size: ' 'toggleSelect':'Change the active state by click!\n Image Size: '
}, },
//===============dialog i18N======================= //===============dialog i18N=======================
'insertimage':{ 'insertimage':{
'static':{ 'static':{
'lang_tab_remote': 'Insert', 'lang_tab_remote':"Insert",
'lang_tab_upload': 'Local', 'lang_tab_upload':"Local",
'lang_tab_online': 'Manager', 'lang_tab_online':"Manager",
'lang_tab_search': 'Search', 'lang_tab_search':"Search",
'lang_input_url': 'Address:', 'lang_input_url':"Address:",
'lang_input_size': 'Size:', 'lang_input_size':"Size:",
'lang_input_width': 'Width', 'lang_input_width':"Width",
'lang_input_height': 'Height', 'lang_input_height':"Height",
'lang_input_border': 'Border:', 'lang_input_border':"Border:",
'lang_input_vhspace': 'Margins:', 'lang_input_vhspace':"Margins:",
'lang_input_title': 'Title:', 'lang_input_title':"Title:",
'lang_input_align':'Image Float Style:', 'lang_input_align':'Image Float Style:',
'lang_imgLoading': 'Loading...', 'lang_imgLoading':"Loading...",
'lang_start_upload': 'Start Upload', 'lang_start_upload':"Start Upload",
'lock': { 'title': 'Lock rate' }, 'lock':{'title':"Lock rate"},
'searchType': { 'title': 'ImageType', 'options': ['News', 'Wallpaper', 'emotions', 'photo'] }, 'searchType':{'title':"ImageType", 'options':["News", "Wallpaper", "emotions", "photo"]},
'searchTxt': { 'value': 'Enter the search keyword!' }, 'searchTxt':{'value':"Enter the search keyword!"},
'searchBtn': { 'value': 'Search' }, 'searchBtn':{'value':"Search"},
'searchReset': { 'value': 'Clear' }, 'searchReset':{'value':"Clear"},
'noneAlign':{'title':'None Float'}, 'noneAlign':{'title':'None Float'},
'leftAlign':{'title':'Left Float'}, 'leftAlign':{'title':'Left Float'},
'rightAlign':{'title':'Right Float'}, 'rightAlign':{'title':'Right Float'},
@ -373,20 +302,20 @@ UE.I18N['en'] = {
'errorUploadRetry':'Upload Error, Please Retry.', 'errorUploadRetry':'Upload Error, Please Retry.',
'errorHttp':'Http Error', 'errorHttp':'Http Error',
'errorServerUpload':'Server Result Error.', 'errorServerUpload':'Server Result Error.',
'remoteLockError': 'Cannot Lock the Proportion between width and height', 'remoteLockError':"Cannot Lock the Proportion between width and height",
'numError': 'Please enter the correct Num. e.g 123,400', 'numError':"Please enter the correct Num. e.g 123,400",
'imageUrlError': 'The image format may be wrong!', 'imageUrlError':"The image format may be wrong!",
'imageLoadError': 'Error,please check the network or URL!', 'imageLoadError':"Error,please check the network or URL!",
'searchRemind': 'Enter the search keyword!', 'searchRemind':"Enter the search keyword!",
'searchLoading': 'Image is loading,please wait...', 'searchLoading':"Image is loading,please wait...",
'searchRetry':" Sorry,can't find the image,please try again!" 'searchRetry':" Sorry,can't find the image,please try again!"
}, },
'attachment':{ 'attachment':{
'static':{ 'static':{
'lang_tab_upload': 'Upload', 'lang_tab_upload': 'Upload',
'lang_tab_online': 'Online', 'lang_tab_online': 'Online',
'lang_start_upload': 'Start upload', 'lang_start_upload':"Start upload",
'lang_drop_remind': 'You can drop files here, a single maximum of 300 files' 'lang_drop_remind':"You can drop files here, a single maximum of 300 files"
}, },
'uploadSelectFile':'Select File', 'uploadSelectFile':'Select File',
'uploadAddFile':'Add File', 'uploadAddFile':'Add File',
@ -414,36 +343,36 @@ UE.I18N['en'] = {
'insertvideo':{ 'insertvideo':{
'static':{ 'static':{
'lang_tab_insertV': 'Video', 'lang_tab_insertV':"Video",
'lang_tab_searchV': 'Search', 'lang_tab_searchV':"Search",
'lang_tab_uploadV': 'Upload', 'lang_tab_uploadV':"Upload",
'lang_video_url': ' URL ', 'lang_video_url':" URL ",
'lang_video_size': 'Video Size', 'lang_video_size':"Video Size",
'lang_videoW': 'Width', 'lang_videoW':"Width",
'lang_videoH': 'Height', 'lang_videoH':"Height",
'lang_alignment': 'Alignment', 'lang_alignment':"Alignment",
'videoSearchTxt': { 'value': 'Enter the search keyword!' }, 'videoSearchTxt':{'value':"Enter the search keyword!"},
'videoType': { 'options': ['All', 'Hot', 'Entertainment', 'Funny', 'Sports', 'Science', 'variety'] }, 'videoType':{'options':["All", "Hot", "Entertainment", "Funny", "Sports", "Science", "variety"]},
'videoSearchBtn': { 'value': 'Search in Baidu' }, 'videoSearchBtn':{'value':"Search in Baidu"},
'videoSearchReset': { 'value': 'Clear result' }, 'videoSearchReset':{'value':"Clear result"},
'lang_input_fileStatus':' No file uploaded!', 'lang_input_fileStatus':' No file uploaded!',
'startUpload': { 'style': 'background:url(upload.png) no-repeat;' }, 'startUpload':{'style':"background:url(upload.png) no-repeat;"},
'lang_upload_size': 'Video Size', 'lang_upload_size':"Video Size",
'lang_upload_width': 'Width', 'lang_upload_width':"Width",
'lang_upload_height': 'Height', 'lang_upload_height':"Height",
'lang_upload_alignment': 'Alignment', 'lang_upload_alignment':"Alignment",
'lang_format_advice': 'Recommends mp4 format.' 'lang_format_advice':"Recommends mp4 format."
}, },
'numError': 'Please enter the correct Num. e.g 123,400', 'numError':"Please enter the correct Num. e.g 123,400",
'floatLeft': 'Float left', 'floatLeft':"Float left",
'floatRight': 'Float right', 'floatRight':"Float right",
'default': 'Default', 'default':"Default",
'block': 'Display in block', 'block':"Display in block",
'urlError': 'The video url format may be wrong!', 'urlError':"The video url format may be wrong!",
'loading': ' &nbsp;The video is loading, please wait…', 'loading':" &nbsp;The video is loading, please wait…",
'clickToSelect': 'Click to select', 'clickToSelect':"Click to select",
'goToSource':'Visit source video ', 'goToSource':'Visit source video ',
'noVideo':" &nbsp; &nbsp;Sorry,can't find the video,please try again!", 'noVideo':" &nbsp; &nbsp;Sorry,can't find the video,please try again!",
@ -498,10 +427,10 @@ UE.I18N['en'] = {
'errorServerUpload':'Server Result Error.' 'errorServerUpload':'Server Result Error.'
}, },
'webapp':{ 'webapp':{
'tip1': 'This function provided by Baidu APP,please apply for baidu APPKey webmaster first!', 'tip1':"This function provided by Baidu APP,please apply for baidu APPKey webmaster first!",
'tip2': 'And then open the file ueditor.config.js to set it! ', 'tip2':"And then open the file ueditor.config.js to set it! ",
'applyFor': 'APPLY FOR', 'applyFor':"APPLY FOR",
'anthorApi': 'Baidu API' 'anthorApi':"Baidu API"
}, },
'template':{ 'template':{
'static':{ 'static':{
@ -509,31 +438,31 @@ UE.I18N['en'] = {
'lang_template_clear' : 'Keep Content', 'lang_template_clear' : 'Keep Content',
'lang_template_select':'Select Template' 'lang_template_select':'Select Template'
}, },
'blank': 'Blank', 'blank':"Blank",
'blog': 'Blog', 'blog':"Blog",
'resume': 'Resume', 'resume':"Resume",
'richText': 'Rich Text', 'richText':"Rich Text",
'scrPapers': 'Scientific Papers' 'scrPapers':"Scientific Papers"
}, },
scrawl:{ scrawl:{
'static':{ 'static':{
'lang_input_previousStep': 'Previous', 'lang_input_previousStep':"Previous",
'lang_input_nextsStep': 'Next', 'lang_input_nextsStep':"Next",
'lang_input_clear':'Clear', 'lang_input_clear':'Clear',
'lang_input_addPic':'AddImage', 'lang_input_addPic':'AddImage',
'lang_input_ScalePic':'ScaleImage', 'lang_input_ScalePic':'ScaleImage',
'lang_input_removePic':'RemoveImage', 'lang_input_removePic':'RemoveImage',
'J_imgTxt':{title:'Add background image'} 'J_imgTxt':{title:'Add background image'}
}, },
'noScarwl': 'No paint, a white paper...', 'noScarwl':"No paint, a white paper...",
'scrawlUpLoading': 'Image is uploading, please wait...', 'scrawlUpLoading':"Image is uploading, please wait...",
'continueBtn': 'Try again', 'continueBtn':"Try again",
'imageError': 'Image failed to load!', 'imageError':"Image failed to load!",
'backgroundUploading':'Image is uploading,please wait...' 'backgroundUploading':'Image is uploading,please wait...'
}, },
'music':{ 'music':{
'static':{ 'static':{
'lang_input_tips': 'Input singer/song/album, search you interested in music!', 'lang_input_tips':"Input singer/song/album, search you interested in music!",
'J_searchBtn':{value:'Search songs'} 'J_searchBtn':{value:'Search songs'}
}, },
'emptyTxt':'Not search to the relevant music results, please change a keyword try.', 'emptyTxt':'Not search to the relevant music results, please change a keyword try.',
@ -585,7 +514,7 @@ UE.I18N['en'] = {
'static':{ 'static':{
'lang_input_address':'Address:', 'lang_input_address':'Address:',
'lang_input_search':'Search', 'lang_input_search':'Search',
'address': { value: 'Beijing' } 'address':{value:"Beijing"}
}, },
searchError:'Unable to locate the address!' searchError:'Unable to locate the address!'
}, },
@ -593,7 +522,7 @@ UE.I18N['en'] = {
'static':{ 'static':{
'lang_input_about':'About', 'lang_input_about':'About',
'lang_input_shortcuts':'Shortcuts', 'lang_input_shortcuts':'Shortcuts',
'lang_input_introduction': 'UEditor is developed by Baidu Co.ltd. It is lightweight, customizable , focusing on user experience and etc. , UEditor is based on open source BSD license , allowing free use and redistribution.', 'lang_input_introduction':"UEditor is developed by Baidu Co.ltd. It is lightweight, customizable , focusing on user experience and etc. , UEditor is based on open source BSD license , allowing free use and redistribution.",
'lang_Txt_shortcuts':'Shortcuts', 'lang_Txt_shortcuts':'Shortcuts',
'lang_Txt_func':'Function', 'lang_Txt_func':'Function',
'lang_Txt_bold':'Bold', 'lang_Txt_bold':'Bold',
@ -617,7 +546,7 @@ UE.I18N['en'] = {
'lang_input_isScroll':'Enable scrollbars:', 'lang_input_isScroll':'Enable scrollbars:',
'lang_input_frameborder':'Show frame border:', 'lang_input_frameborder':'Show frame border:',
'lang_input_alignMode':'Alignment:', 'lang_input_alignMode':'Alignment:',
'align': { title: 'Alignment', options: ['Default', 'Left', 'Right', 'Center'] } 'align':{title:"Alignment", options:["Default", "Left", "Right", "Center"]}
}, },
'enterAddress':'Please enter an address!' 'enterAddress':'Please enter an address!'
}, },
@ -633,56 +562,56 @@ UE.I18N['en'] = {
}, },
map:{ map:{
'static':{ 'static':{
lang_city: 'City', lang_city:"City",
lang_address: 'Address', lang_address:"Address",
city: { value: 'Beijing' }, city:{value:"Beijing"},
lang_search: 'Search', lang_search:"Search",
lang_dynamicmap: 'Dynamic map' lang_dynamicmap:"Dynamic map"
}, },
cityMsg: 'Please enter the city name!', cityMsg:"Please enter the city name!",
errorMsg:"Can't find the place!" errorMsg:"Can't find the place!"
}, },
searchreplace:{ searchreplace:{
'static':{ 'static':{
lang_tab_search: 'Search', lang_tab_search:"Search",
lang_tab_replace: 'Replace', lang_tab_replace:"Replace",
lang_search1: 'Search', lang_search1:"Search",
lang_search2: 'Search', lang_search2:"Search",
lang_replace: 'Replace', lang_replace:"Replace",
lang_searchReg:'Support regular expression ,which starts and ends with a slash ,for example "/expression/"', lang_searchReg:'Support regular expression ,which starts and ends with a slash ,for example "/expression/"',
lang_searchReg1:'Support regular expression ,which starts and ends with a slash ,for example "/expression/"', lang_searchReg1:'Support regular expression ,which starts and ends with a slash ,for example "/expression/"',
lang_case_sensitive1: 'Case sense', lang_case_sensitive1:"Case sense",
lang_case_sensitive2: 'Case sense', lang_case_sensitive2:"Case sense",
nextFindBtn: { value: 'Next' }, nextFindBtn:{value:"Next"},
preFindBtn: { value: 'Preview' }, preFindBtn:{value:"Preview"},
nextReplaceBtn: { value: 'Next' }, nextReplaceBtn:{value:"Next"},
preReplaceBtn: { value: 'Preview' }, preReplaceBtn:{value:"Preview"},
repalceBtn: { value: 'Replace' }, repalceBtn:{value:"Replace"},
repalceAllBtn: { value: 'Replace all' } repalceAllBtn:{value:"Replace all"}
}, },
getEnd: 'Has the search to the bottom!', getEnd:"Has the search to the bottom!",
getStart: 'Has the search to the top!', getStart:"Has the search to the top!",
countMsg: 'Altogether replaced {#count} character(s)!' countMsg:"Altogether replaced {#count} character(s)!"
}, },
snapscreen:{ snapscreen:{
'static':{ 'static':{
lang_showMsg: 'You should install the UEditor screenshots program first!', lang_showMsg:"You should install the UEditor screenshots program first!",
lang_download: 'Download!', lang_download:"Download!",
lang_step1: 'Step1:Download the program and then run it', lang_step1:"Step1:Download the program and then run it",
lang_step2: 'Step2:After complete install,try to click the button again' lang_step2:"Step2:After complete install,try to click the button again"
} }
}, },
spechars:{ spechars:{
'static':{}, 'static':{},
tsfh: 'Special', tsfh:"Special",
lmsz: 'Roman', lmsz:"Roman",
szfh: 'Numeral', szfh:"Numeral",
rwfh: 'Japanese', rwfh:"Japanese",
xlzm: 'The Greek', xlzm:"The Greek",
ewzm: 'Russian', ewzm:"Russian",
pyzm: 'Phonetic', pyzm:"Phonetic",
yyyb: 'English', yyyb:"English",
zyzf: 'Others' zyzf:"Others"
}, },
'edittable':{ 'edittable':{
'static':{ 'static':{
@ -692,7 +621,7 @@ UE.I18N['en'] = {
'lang_insertTitleCol':'Add table title col', 'lang_insertTitleCol':'Add table title col',
'lang_tableSize':'Automatically adjust table size', 'lang_tableSize':'Automatically adjust table size',
'lang_autoSizeContent':'Adaptive by form text', 'lang_autoSizeContent':'Adaptive by form text',
'lang_orderbycontent': 'Table of contents sortable', 'lang_orderbycontent':"Table of contents sortable",
'lang_autoSizePage':'Page width adaptive', 'lang_autoSizePage':'Page width adaptive',
'lang_example':'Example', 'lang_example':'Example',
'lang_borderStyle':'Table Border', 'lang_borderStyle':'Table Border',
@ -720,30 +649,30 @@ UE.I18N['en'] = {
}, },
wordimage:{ wordimage:{
'static':{ 'static':{
lang_resave: 'The re-save step', lang_resave:"The re-save step",
uploadBtn: { src: 'upload.png', alt: 'Upload' }, uploadBtn:{src:"upload.png", alt:"Upload"},
clipboard: { style: 'background: url(copy.png) -153px -1px no-repeat;' }, clipboard:{style:"background: url(copy.png) -153px -1px no-repeat;"},
lang_step: ' 1. Click top button to copy the url and then open the dialog to paste it. 2. Open after choose photos uploaded process.' lang_step:" 1. Click top button to copy the url and then open the dialog to paste it. 2. Open after choose photos uploaded process."
}, },
fileType: 'Image', fileType:"Image",
flashError: 'Flash initialization failed!', flashError:"Flash initialization failed!",
netError: 'Network error! Please try again!', netError:"Network error! Please try again!",
copySuccess: 'URL has been copied!', copySuccess:"URL has been copied!",
'flashI18n':{ 'flashI18n':{
lang:encodeURI( '{"UploadingState":"totalNum: ${a},uploadComplete: ${b}", "BeforeUpload":"waitingNum: ${a}", "ExceedSize":"Size exceed${a}", "ErrorInPreview":"Preview failed", "DefaultDescription":"Description", "LoadingImage":"Loading..."}' ), lang:encodeURI( '{"UploadingState":"totalNum: ${a},uploadComplete: ${b}", "BeforeUpload":"waitingNum: ${a}", "ExceedSize":"Size exceed${a}", "ErrorInPreview":"Preview failed", "DefaultDescription":"Description", "LoadingImage":"Loading..."}' ),
uploadingTF:encodeURI( '{"font":"Arial", "size":12, "color":"0x000", "bold":"true", "italic":"false", "underline":"false"}' ), uploadingTF:encodeURI( '{"font":"Arial", "size":12, "color":"0x000", "bold":"true", "italic":"false", "underline":"false"}' ),
imageTF:encodeURI( '{"font":"Arial", "size":11, "color":"red", "bold":"false", "italic":"false", "underline":"false"}' ), imageTF:encodeURI( '{"font":"Arial", "size":11, "color":"red", "bold":"false", "italic":"false", "underline":"false"}' ),
textEncoding: 'utf-8', textEncoding:"utf-8",
addImageSkinURL: 'addImage.png', addImageSkinURL:"addImage.png",
allDeleteBtnUpSkinURL: 'allDeleteBtnUpSkin.png', allDeleteBtnUpSkinURL:"allDeleteBtnUpSkin.png",
allDeleteBtnHoverSkinURL: 'allDeleteBtnHoverSkin.png', allDeleteBtnHoverSkinURL:"allDeleteBtnHoverSkin.png",
rotateLeftBtnEnableSkinURL: 'rotateLeftEnable.png', rotateLeftBtnEnableSkinURL:"rotateLeftEnable.png",
rotateLeftBtnDisableSkinURL: 'rotateLeftDisable.png', rotateLeftBtnDisableSkinURL:"rotateLeftDisable.png",
rotateRightBtnEnableSkinURL: 'rotateRightEnable.png', rotateRightBtnEnableSkinURL:"rotateRightEnable.png",
rotateRightBtnDisableSkinURL: 'rotateRightDisable.png', rotateRightBtnDisableSkinURL:"rotateRightDisable.png",
deleteBtnEnableSkinURL: 'deleteEnable.png', deleteBtnEnableSkinURL:"deleteEnable.png",
deleteBtnDisableSkinURL: 'deleteDisable.png', deleteBtnDisableSkinURL:"deleteDisable.png",
backgroundURL:'', backgroundURL:'',
listBackgroundURL:'', listBackgroundURL:'',
buttonURL:'button.png' buttonURL:'button.png'

372
public/UEditor/php/Uploader.class.php

@ -0,0 +1,372 @@
<?php
/**
* Created by JetBrains PhpStorm.
* User: taoqili
* Date: 12-7-18
* Time: 上午11: 32
* UEditor编辑器通用上传类
*/
class Uploader
{
private $fileField; //文件域名
private $file; //文件上传对象
private $base64; //文件上传对象
private $config; //配置信息
private $oriName; //原始文件名
private $fileName; //新文件名
private $fullName; //完整文件名,即从当前配置目录开始的URL
private $filePath; //完整文件名,即从当前配置目录开始的URL
private $fileSize; //文件大小
private $fileType; //文件类型
private $stateInfo; //上传状态信息,
private $stateMap = array( //上传状态映射表,国际化用户需考虑此处数据的国际化
"SUCCESS", //上传成功标记,在UEditor中内不可改变,否则flash判断会出错
"文件大小超出 upload_max_filesize 限制",
"文件大小超出 MAX_FILE_SIZE 限制",
"文件未被完整上传",
"没有文件被上传",
"上传文件为空",
"ERROR_TMP_FILE" => "临时文件错误",
"ERROR_TMP_FILE_NOT_FOUND" => "找不到临时文件",
"ERROR_SIZE_EXCEED" => "文件大小超出网站限制",
"ERROR_TYPE_NOT_ALLOWED" => "文件类型不允许",
"ERROR_CREATE_DIR" => "目录创建失败",
"ERROR_DIR_NOT_WRITEABLE" => "目录没有写权限",
"ERROR_FILE_MOVE" => "文件保存时出错",
"ERROR_FILE_NOT_FOUND" => "找不到上传文件",
"ERROR_WRITE_CONTENT" => "写入文件内容错误",
"ERROR_UNKNOWN" => "未知错误",
"ERROR_DEAD_LINK" => "链接不可用",
"ERROR_HTTP_LINK" => "链接不是http链接",
"ERROR_HTTP_CONTENTTYPE" => "链接contentType不正确",
"INVALID_URL" => "非法 URL",
"INVALID_IP" => "非法 IP"
);
/**
* 构造函数
* @param string $fileField 表单名称
* @param array $config 配置项
* @param bool $base64 是否解析base64编码,可省略。若开启,则$fileField代表的是base64编码的字符串表单名
*/
public function __construct($fileField, $config, $type = "upload")
{
$this->fileField = $fileField;
$this->config = $config;
$this->type = $type;
if ($type == "remote") {
$this->saveRemote();
} else if($type == "base64") {
$this->upBase64();
} else {
$this->upFile();
}
$this->stateMap['ERROR_TYPE_NOT_ALLOWED'] = iconv('unicode', 'utf-8', $this->stateMap['ERROR_TYPE_NOT_ALLOWED']);
}
/**
* 上传文件的主处理方法
* @return mixed
*/
private function upFile()
{
$file = $this->file = $_FILES[$this->fileField];
if (!$file) {
$this->stateInfo = $this->getStateInfo("ERROR_FILE_NOT_FOUND");
return;
}
if ($this->file['error']) {
$this->stateInfo = $this->getStateInfo($file['error']);
return;
} else if (!file_exists($file['tmp_name'])) {
$this->stateInfo = $this->getStateInfo("ERROR_TMP_FILE_NOT_FOUND");
return;
} else if (!is_uploaded_file($file['tmp_name'])) {
$this->stateInfo = $this->getStateInfo("ERROR_TMPFILE");
return;
}
$this->oriName = $file['name'];
$this->fileSize = $file['size'];
$this->fileType = $this->getFileExt();
$this->fullName = $this->getFullName();
$this->filePath = $this->getFilePath();
$this->fileName = $this->getFileName();
$dirname = dirname($this->filePath);
//检查文件大小是否超出限制
if (!$this->checkSize()) {
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
return;
}
//检查是否不允许的文件格式
if (!$this->checkType()) {
$this->stateInfo = $this->getStateInfo("ERROR_TYPE_NOT_ALLOWED");
return;
}
//创建目录失败
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
return;
} else if (!is_writeable($dirname)) {
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
return;
}
//移动文件
if (!(move_uploaded_file($file["tmp_name"], $this->filePath) && file_exists($this->filePath))) { //移动失败
$this->stateInfo = $this->getStateInfo("ERROR_FILE_MOVE");
} else { //移动成功
$this->stateInfo = $this->stateMap[0];
}
}
/**
* 处理base64编码的图片上传
* @return mixed
*/
private function upBase64()
{
$base64Data = $_POST[$this->fileField];
$img = base64_decode($base64Data);
$this->oriName = $this->config['oriName'];
$this->fileSize = strlen($img);
$this->fileType = $this->getFileExt();
$this->fullName = $this->getFullName();
$this->filePath = $this->getFilePath();
$this->fileName = $this->getFileName();
$dirname = dirname($this->filePath);
//检查文件大小是否超出限制
if (!$this->checkSize()) {
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
return;
}
//创建目录失败
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
return;
} else if (!is_writeable($dirname)) {
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
return;
}
//移动文件
if (!(file_put_contents($this->filePath, $img) && file_exists($this->filePath))) { //移动失败
$this->stateInfo = $this->getStateInfo("ERROR_WRITE_CONTENT");
} else { //移动成功
$this->stateInfo = $this->stateMap[0];
}
}
/**
* 拉取远程图片
* @return mixed
*/
private function saveRemote()
{
$imgUrl = htmlspecialchars($this->fileField);
$imgUrl = str_replace("&amp;", "&", $imgUrl);
//http开头验证
if (strpos($imgUrl, "http") !== 0) {
$this->stateInfo = $this->getStateInfo("ERROR_HTTP_LINK");
return;
}
preg_match('/(^https*:\/\/[^:\/]+)/', $imgUrl, $matches);
$host_with_protocol = count($matches) > 1 ? $matches[1] : '';
// 判断是否是合法 url
if (!filter_var($host_with_protocol, FILTER_VALIDATE_URL)) {
$this->stateInfo = $this->getStateInfo("INVALID_URL");
return;
}
preg_match('/^https*:\/\/(.+)/', $host_with_protocol, $matches);
$host_without_protocol = count($matches) > 1 ? $matches[1] : '';
// 此时提取出来的可能是 ip 也有可能是域名,先获取 ip
$ip = gethostbyname($host_without_protocol);
// 判断是否是私有 ip
if(!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
$this->stateInfo = $this->getStateInfo("INVALID_IP");
return;
}
//获取请求头并检测死链
$heads = get_headers($imgUrl, 1);
if (!(stristr($heads[0], "200") && stristr($heads[0], "OK"))) {
$this->stateInfo = $this->getStateInfo("ERROR_DEAD_LINK");
return;
}
//格式验证(扩展名验证和Content-Type验证)
$fileType = strtolower(strrchr($imgUrl, '.'));
if (!in_array($fileType, $this->config['allowFiles']) || !isset($heads['Content-Type']) || !stristr($heads['Content-Type'], "image")) {
$this->stateInfo = $this->getStateInfo("ERROR_HTTP_CONTENTTYPE");
return;
}
//打开输出缓冲区并获取远程图片
ob_start();
$context = stream_context_create(
array('http' => array(
'follow_location' => false // don't follow redirects
))
);
readfile($imgUrl, false, $context);
$img = ob_get_contents();
ob_end_clean();
preg_match("/[\/]([^\/]*)[\.]?[^\.\/]*$/", $imgUrl, $m);
$this->oriName = $m ? $m[1]:"";
$this->fileSize = strlen($img);
$this->fileType = $this->getFileExt();
$this->fullName = $this->getFullName();
$this->filePath = $this->getFilePath();
$this->fileName = $this->getFileName();
$dirname = dirname($this->filePath);
//检查文件大小是否超出限制
if (!$this->checkSize()) {
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
return;
}
//创建目录失败
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
return;
} else if (!is_writeable($dirname)) {
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
return;
}
//移动文件
if (!(file_put_contents($this->filePath, $img) && file_exists($this->filePath))) { //移动失败
$this->stateInfo = $this->getStateInfo("ERROR_WRITE_CONTENT");
} else { //移动成功
$this->stateInfo = $this->stateMap[0];
}
}
/**
* 上传错误检查
* @param $errCode
* @return string
*/
private function getStateInfo($errCode)
{
return !$this->stateMap[$errCode] ? $this->stateMap["ERROR_UNKNOWN"] : $this->stateMap[$errCode];
}
/**
* 获取文件扩展名
* @return string
*/
private function getFileExt()
{
return strtolower(strrchr($this->oriName, '.'));
}
/**
* 重命名文件
* @return string
*/
private function getFullName()
{
//替换日期事件
$t = time();
$d = explode('-', date("Y-y-m-d-H-i-s"));
$format = $this->config["pathFormat"];
$format = str_replace("{yyyy}", $d[0], $format);
$format = str_replace("{yy}", $d[1], $format);
$format = str_replace("{mm}", $d[2], $format);
$format = str_replace("{dd}", $d[3], $format);
$format = str_replace("{hh}", $d[4], $format);
$format = str_replace("{ii}", $d[5], $format);
$format = str_replace("{ss}", $d[6], $format);
$format = str_replace("{time}", $t, $format);
//过滤文件名的非法自负,并替换文件名
$oriName = substr($this->oriName, 0, strrpos($this->oriName, '.'));
$oriName = preg_replace("/[\|\?\"\<\>\/\*\\\\]+/", '', $oriName);
$format = str_replace("{filename}", $oriName, $format);
//替换随机字符串
$randNum = rand(1, 10000000000) . rand(1, 10000000000);
if (preg_match("/\{rand\:([\d]*)\}/i", $format, $matches)) {
$format = preg_replace("/\{rand\:[\d]*\}/i", substr($randNum, 0, $matches[1]), $format);
}
$ext = $this->getFileExt();
return $format . $ext;
}
/**
* 获取文件名
* @return string
*/
private function getFileName () {
return substr($this->filePath, strrpos($this->filePath, '/') + 1);
}
/**
* 获取文件完整路径
* @return string
*/
private function getFilePath()
{
$fullname = $this->fullName;
$rootPath = $_SERVER['DOCUMENT_ROOT'];
if (substr($fullname, 0, 1) != '/') {
$fullname = '/' . $fullname;
}
return $rootPath . $fullname;
}
/**
* 文件类型检测
* @return bool
*/
private function checkType()
{
return in_array($this->getFileExt(), $this->config["allowFiles"]);
}
/**
* 文件大小检测
* @return bool
*/
private function checkSize()
{
return $this->fileSize <= ($this->config["maxSize"]);
}
/**
* 获取当前上传成功文件的各项信息
* @return array
*/
public function getFileInfo()
{
return array(
"state" => $this->stateInfo,
"url" => $this->fullName,
"title" => $this->fileName,
"original" => $this->oriName,
"type" => $this->fileType,
"size" => $this->fileSize
);
}
}

44
public/UEditor/php/action_crawler.php

@ -0,0 +1,44 @@
<?php
/**
* 抓取远程图片
* User: Jinqn
* Date: 14-04-14
* Time: 下午19:18
*/
set_time_limit(0);
include("Uploader.class.php");
/* 上传配置 */
$config = array(
"pathFormat" => $CONFIG['catcherPathFormat'],
"maxSize" => $CONFIG['catcherMaxSize'],
"allowFiles" => $CONFIG['catcherAllowFiles'],
"oriName" => "remote.png"
);
$fieldName = $CONFIG['catcherFieldName'];
/* 抓取远程图片 */
$list = array();
if (isset($_POST[$fieldName])) {
$source = $_POST[$fieldName];
} else {
$source = $_GET[$fieldName];
}
foreach ($source as $imgUrl) {
$item = new Uploader($imgUrl, $config, "remote");
$info = $item->getFileInfo();
array_push($list, array(
"state" => $info["state"],
"url" => $info["url"],
"size" => $info["size"],
"title" => htmlspecialchars($info["title"]),
"original" => htmlspecialchars($info["original"]),
"source" => htmlspecialchars($imgUrl)
));
}
/* 返回抓取数据 */
return json_encode(array(
'state'=> count($list) ? 'SUCCESS':'ERROR',
'list'=> $list
));

92
public/UEditor/php/action_list.php

@ -0,0 +1,92 @@
<?php
/**
* 获取已上传的文件列表
* User: Jinqn
* Date: 14-04-09
* Time: 上午10:17
*/
include "Uploader.class.php";
/* 判断类型 */
switch ($_GET['action']) {
/* 列出文件 */
case 'listfile':
$allowFiles = $CONFIG['fileManagerAllowFiles'];
$listSize = $CONFIG['fileManagerListSize'];
$path = $CONFIG['fileManagerListPath'];
break;
/* 列出图片 */
case 'listimage':
default:
$allowFiles = $CONFIG['imageManagerAllowFiles'];
$listSize = $CONFIG['imageManagerListSize'];
$path = $CONFIG['imageManagerListPath'];
}
$allowFiles = substr(str_replace(".", "|", join("", $allowFiles)), 1);
/* 获取参数 */
$size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : $listSize;
$start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
$end = $start + $size;
/* 获取文件列表 */
$path = $_SERVER['DOCUMENT_ROOT'] . (substr($path, 0, 1) == "/" ? "":"/") . $path;
$files = getfiles($path, $allowFiles);
if (!count($files)) {
return json_encode(array(
"state" => "no match file",
"list" => array(),
"start" => $start,
"total" => count($files)
));
}
/* 获取指定范围的列表 */
$len = count($files);
for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
$list[] = $files[$i];
}
//倒序
//for ($i = $end, $list = array(); $i < $len && $i < $end; $i++){
// $list[] = $files[$i];
//}
/* 返回数据 */
$result = json_encode(array(
"state" => "SUCCESS",
"list" => $list,
"start" => $start,
"total" => count($files)
));
return $result;
/**
* 遍历获取目录下的指定类型的文件
* @param $path
* @param array $files
* @return array
*/
function getfiles($path, $allowFiles, &$files = array())
{
if (!is_dir($path)) return null;
if(substr($path, strlen($path) - 1) != '/') $path .= '/';
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
$path2 = $path . $file;
if (is_dir($path2)) {
getfiles($path2, $allowFiles, $files);
} else {
if (preg_match("/\.(".$allowFiles.")$/i", $file)) {
$files[] = array(
'url'=> substr($path2, strlen($_SERVER['DOCUMENT_ROOT'])),
'mtime'=> filemtime($path2)
);
}
}
}
}
return $files;
}

66
public/UEditor/php/action_upload.php

@ -0,0 +1,66 @@
<?php
/**
* 上传附件和上传视频
* User: Jinqn
* Date: 14-04-09
* Time: 上午10:17
*/
include "Uploader.class.php";
/* 上传配置 */
$base64 = "upload";
switch (htmlspecialchars($_GET['action'])) {
case 'uploadimage':
$config = array(
"pathFormat" => $CONFIG['imagePathFormat'],
"maxSize" => $CONFIG['imageMaxSize'],
"allowFiles" => $CONFIG['imageAllowFiles']
);
$fieldName = $CONFIG['imageFieldName'];
break;
case 'uploadscrawl':
$config = array(
"pathFormat" => $CONFIG['scrawlPathFormat'],
"maxSize" => $CONFIG['scrawlMaxSize'],
"allowFiles" => $CONFIG['scrawlAllowFiles'],
"oriName" => "scrawl.png"
);
$fieldName = $CONFIG['scrawlFieldName'];
$base64 = "base64";
break;
case 'uploadvideo':
$config = array(
"pathFormat" => $CONFIG['videoPathFormat'],
"maxSize" => $CONFIG['videoMaxSize'],
"allowFiles" => $CONFIG['videoAllowFiles']
);
$fieldName = $CONFIG['videoFieldName'];
break;
case 'uploadfile':
default:
$config = array(
"pathFormat" => $CONFIG['filePathFormat'],
"maxSize" => $CONFIG['fileMaxSize'],
"allowFiles" => $CONFIG['fileAllowFiles']
);
$fieldName = $CONFIG['fileFieldName'];
break;
}
/* 生成上传实例对象并完成上传 */
$up = new Uploader($fieldName, $config, $base64);
/**
* 得到上传文件所对应的各个参数,数组结构
* array(
* "state" => "", //上传状态,上传成功时必须返回"SUCCESS"
* "url" => "", //返回的地址
* "title" => "", //新文件名
* "original" => "", //原始文件名
* "type" => "" //文件类型
* "size" => "", //文件大小
* )
*/
/* 返回数据 */
return json_encode($up->getFileInfo());

94
public/UEditor/php/config.json

@ -0,0 +1,94 @@
/* ,使 */
{
/* */
"imageActionName": "uploadimage", /* action */
"imageFieldName": "upfile", /* */
"imageMaxSize": 2048000, /* B */
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* */
"imageCompressEnable": true, /* ,true */
"imageCompressBorder": 1600, /* */
"imageInsertAlign": "none", /* */
"imageUrlPrefix": "", /* 访 */
"imagePathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* , */
/* {filename} , */
/* {rand:6} , */
/* {time} */
/* {yyyy} */
/* {yy} */
/* {mm} */
/* {dd} */
/* {hh} */
/* {ii} */
/* {ss} */
/* \ : * ? " < > | */
/* 线: fex.baidu.com/ueditor/#use-format_upload_filename */
/* */
"scrawlActionName": "uploadscrawl", /* action */
"scrawlFieldName": "upfile", /* */
"scrawlPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* , */
"scrawlMaxSize": 2048000, /* B */
"scrawlUrlPrefix": "", /* 访 */
"scrawlInsertAlign": "none",
/* */
"snapscreenActionName": "uploadimage", /* action */
"snapscreenPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* , */
"snapscreenUrlPrefix": "", /* 访 */
"snapscreenInsertAlign": "none", /* */
/* */
"catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"],
"catcherActionName": "catchimage", /* action */
"catcherFieldName": "source", /* */
"catcherPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* , */
"catcherUrlPrefix": "", /* 访 */
"catcherMaxSize": 2048000, /* B */
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* */
/* */
"videoActionName": "uploadvideo", /* action */
"videoFieldName": "upfile", /* */
"videoPathFormat": "/ueditor/php/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}", /* , */
"videoUrlPrefix": "", /* 访 */
"videoMaxSize": 102400000, /* B100MB */
"videoAllowFiles": [
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"], /* */
/* */
"fileActionName": "uploadfile", /* controller,action */
"fileFieldName": "upfile", /* */
"filePathFormat": "/ueditor/php/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}", /* , */
"fileUrlPrefix": "", /* 访 */
"fileMaxSize": 51200000, /* B50MB */
"fileAllowFiles": [
".png", ".jpg", ".jpeg", ".gif", ".bmp",
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
], /* */
/* */
"imageManagerActionName": "listimage", /* action */
"imageManagerListPath": "/ueditor/php/upload/image/", /* */
"imageManagerListSize": 20, /* */
"imageManagerUrlPrefix": "", /* 访 */
"imageManagerInsertAlign": "none", /* */
"imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* */
/* */
"fileManagerActionName": "listfile", /* action */
"fileManagerListPath": "/ueditor/php/upload/file/", /* */
"fileManagerUrlPrefix": "", /* 访 */
"fileManagerListSize": 20, /* */
"fileManagerAllowFiles": [
".png", ".jpg", ".jpeg", ".gif", ".bmp",
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
] /* */
}

59
public/UEditor/php/controller.php

@ -0,0 +1,59 @@
<?php
//header('Access-Control-Allow-Origin: http://www.baidu.com'); //设置http://www.baidu.com允许跨域访问
//header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With'); //设置允许的跨域header
date_default_timezone_set("Asia/chongqing");
error_reporting(E_ERROR);
header("Content-Type: text/html; charset=utf-8");
$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents("config.json")), true);
$action = $_GET['action'];
switch ($action) {
case 'config':
$result = json_encode($CONFIG);
break;
/* 上传图片 */
case 'uploadimage':
/* 上传涂鸦 */
case 'uploadscrawl':
/* 上传视频 */
case 'uploadvideo':
/* 上传文件 */
case 'uploadfile':
$result = include("action_upload.php");
break;
/* 列出图片 */
case 'listimage':
$result = include("action_list.php");
break;
/* 列出文件 */
case 'listfile':
$result = include("action_list.php");
break;
/* 抓取远程文件 */
case 'catchimage':
$result = include("action_crawler.php");
break;
default:
$result = json_encode(array(
'state'=> '请求地址出错'
));
break;
}
/* 输出结果 */
if (isset($_GET["callback"])) {
if (preg_match("/^[\w_]+$/", $_GET["callback"])) {
echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
} else {
echo json_encode(array(
'state'=> 'callback参数不合法'
));
}
} else {
echo $result;
}

1
public/UEditor/themes/default/css/ueditor.css

@ -133,7 +133,6 @@ div.edui-box {
} }
/*UI工具栏、编辑区域、底部*/ /*UI工具栏、编辑区域、底部*/
.edui-default .edui-editor { .edui-default .edui-editor {
z-index: 1 !important;
border: 1px solid #d4d4d4; border: 1px solid #d4d4d4;
background-color: white; background-color: white;
position: relative; position: relative;

BIN
public/UEditor/third-party/video-js/video-js.swf vendored

Binary file not shown.

BIN
public/UEditor/third-party/webuploader/Uploader.swf vendored

Binary file not shown.

BIN
public/UEditor/third-party/zeroclipboard/ZeroClipboard.swf vendored

Binary file not shown.

68
public/UEditor/ueditor.config.js

@ -10,6 +10,7 @@
**************************提示********************************/ **************************提示********************************/
(function () { (function () {
/** /**
* 编辑器资源文件根路径它所表示的含义是以编辑器实例化页面为当前路径指向编辑器资源文件即dialog等文件夹的路径 * 编辑器资源文件根路径它所表示的含义是以编辑器实例化页面为当前路径指向编辑器资源文件即dialog等文件夹的路径
* 鉴于很多同学在使用编辑器的时候出现的种种路径问题此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置 * 鉴于很多同学在使用编辑器的时候出现的种种路径问题此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置
@ -26,20 +27,25 @@
window.UEDITOR_CONFIG = { window.UEDITOR_CONFIG = {
//为编辑器实例添加一个路径,这个不能被注释 //为编辑器实例添加一个路径,这个不能被注释
UEDITOR_HOME_URL: URL, UEDITOR_HOME_URL: URL
// 服务器统一请求接口路径 // 服务器统一请求接口路径
serverUrl: URL + 'php/controller.php', , serverUrl: URL + "php/controller.php"
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义 //工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
toolbars: [[ , toolbars: [[
'source', '|', 'undo', 'redo', '|', 'fullscreen', 'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', 'strikethrough', '|', 'superscript', 'subscript', '|', 'forecolor', 'backcolor', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
'removeformat', '|', 'insertorderedlist', 'insertunorderedlist', '|', 'selectall', 'cleardoc', 'paragraph', '|', 'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
'fontfamily', 'fontsize', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
'link', 'unlink', '|', 'emotion', '|', 'directionalityltr', 'directionalityrtl', 'indent', '|',
'|', 'horizontal', 'print', 'preview', 'fullscreen', 'drafts', 'formula' 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
]], 'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
'print', 'preview', 'searchreplace', 'drafts', 'help'
]]
//当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准 //当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
//,labelMap:{ //,labelMap:{
// 'anchor':'', 'undo':'' // 'anchor':'', 'undo':''
@ -318,6 +324,8 @@
//表格是否可以拖拽 //表格是否可以拖拽
//,tableDragable: true //,tableDragable: true
//sourceEditor //sourceEditor
//源码的查看方式,codemirror 是代码高亮,textarea是文本框,默认是codemirror //源码的查看方式,codemirror 是代码高亮,textarea是文本框,默认是codemirror
//注意默认codemirror只能在ie8+和非ie中使用 //注意默认codemirror只能在ie8+和非ie中使用
@ -348,13 +356,13 @@
//,rgb2Hex:true //默认产出的数据中的color自动从rgb格式变成16进制格式 //,rgb2Hex:true //默认产出的数据中的color自动从rgb格式变成16进制格式
// xss 过滤是否开启,inserthtml等操作 // xss 过滤是否开启,inserthtml等操作
xssFilterRules: true, ,xssFilterRules: true
//input xss过滤 //input xss过滤
inputXssFilter: true, ,inputXssFilter: true
//output xss过滤 //output xss过滤
outputXssFilter: true, ,outputXssFilter: true
// xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js // xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js
whiteList: { ,whiteList: {
a: ['target', 'href', 'title', 'class', 'style'], a: ['target', 'href', 'title', 'class', 'style'],
abbr: ['title', 'class', 'style'], abbr: ['title', 'class', 'style'],
address: ['class', 'style'], address: ['class', 'style'],
@ -422,52 +430,68 @@
}; };
function getUEBasePath(docUrl, confUrl) { function getUEBasePath(docUrl, confUrl) {
return getBasePath(docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath()); return getBasePath(docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath());
} }
function getConfigFilePath() { function getConfigFilePath() {
var configPath = document.getElementsByTagName('script'); var configPath = document.getElementsByTagName('script');
return configPath[ configPath.length - 1 ].src; return configPath[ configPath.length - 1 ].src;
} }
function getBasePath(docUrl, confUrl) { function getBasePath(docUrl, confUrl) {
var basePath = confUrl; var basePath = confUrl;
if (/^(\/|\\\\)/.test(confUrl)) { if (/^(\/|\\\\)/.test(confUrl)) {
basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/, ''); basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/, '');
} else if (!/^[a-z]+:/i.test(confUrl)) { } else if (!/^[a-z]+:/i.test(confUrl)) {
docUrl = docUrl.split('#')[0].split('?')[0].replace(/[^\\\/]+$/, '');
basePath = docUrl + '' + confUrl; docUrl = docUrl.split("#")[0].split("?")[0].replace(/[^\\\/]+$/, '');
basePath = docUrl + "" + confUrl;
} }
return optimizationPath(basePath); return optimizationPath(basePath);
} }
function optimizationPath(path) { function optimizationPath(path) {
let protocol = /^[a-z]+:\/\//.exec(path)[ 0 ],
var protocol = /^[a-z]+:\/\//.exec(path)[ 0 ],
tmp = null, tmp = null,
res = []; res = [];
path = path.replace(protocol, '').split('?')[0].split('#')[0]; path = path.replace(protocol, "").split("?")[0].split("#")[0];
path = path.replace(/\\/g, '/').split(/\//); path = path.replace(/\\/g, '/').split(/\//);
path[ path.length - 1 ] = ''; path[ path.length - 1 ] = "";
while (path.length) { while (path.length) {
if ((tmp = path.shift()) === '..') {
if (( tmp = path.shift() ) === "..") {
res.pop(); res.pop();
} else if (tmp !== '.') { } else if (tmp !== ".") {
res.push(tmp); res.push(tmp);
} }
} }
return protocol + res.join('/'); return protocol + res.join("/");
} }
window.UE = { window.UE = {
getUEBasePath: getUEBasePath getUEBasePath: getUEBasePath
}; };
})(); })();

2
src/views/bxg/activity/combination/form.vue

@ -708,7 +708,7 @@ export default {
addCustomDialog() { addCustomDialog() {
window.UE.registerUI('yshop', function (editor, uiName) { window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({ let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index', iframeUrl: '#/yshop/materia/index',
editor: editor, editor: editor,
name: uiName, name: uiName,
title: '上传图片', title: '上传图片',

2
src/views/bxg/shop/set/aboutUs.vue

@ -75,7 +75,7 @@ export default {
addCustomDialog () { addCustomDialog () {
window.UE.registerUI('yshop', function (editor, uiName) { window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({ let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index', iframeUrl: '#/yshop/materia/index',
editor: editor, editor: editor,
name: uiName, name: uiName,
title: '上传图片', title: '上传图片',

2
src/views/bxg/tools/email/send.vue

@ -90,7 +90,7 @@ export default {
addCustomDialog () { addCustomDialog () {
window.UE.registerUI('yshop', function (editor, uiName) { window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({ let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index', iframeUrl: '#/yshop/materia/index',
editor: editor, editor: editor,
name: uiName, name: uiName,
title: '上传图片', title: '上传图片',

2
src/views/bxg/wechat/article/form.vue

@ -99,7 +99,7 @@ export default {
addCustomDialog () { addCustomDialog () {
window.UE.registerUI('yshop', function (editor, uiName) { window.UE.registerUI('yshop', function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({ let dialog = new window.UE.ui.Dialog({
iframeUrl: '/yshop/materia/index', iframeUrl: '#yshop/materia/index',
editor: editor, editor: editor,
name: uiName, name: uiName,
title: '上传图片', title: '上传图片',

Loading…
Cancel
Save