Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
b607ca2c
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b607ca2c
编写于
8月 06, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
附件配置优化
上级
4744fbe2
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
732 addition
and
511 deletion
+732
-511
application/admin/controller/Ueditor.php
application/admin/controller/Ueditor.php
+58
-0
application/admin/view/default/article/save_info.html
application/admin/view/default/article/save_info.html
+1
-1
application/admin/view/default/customview/save_info.html
application/admin/view/default/customview/save_info.html
+1
-1
application/admin/view/default/public/footer.html
application/admin/view/default/public/footer.html
+1
-1
application/api/config/app.php
application/api/config/app.php
+0
-183
application/api/controller/Ueditor.php
application/api/controller/Ueditor.php
+13
-324
application/common.php
application/common.php
+45
-0
application/index/controller/Ueditor.php
application/index/controller/Ueditor.php
+58
-0
application/index/view/default/public/footer.html
application/index/view/default/public/footer.html
+1
-1
application/service/UeditorService.php
application/service/UeditorService.php
+352
-0
config/ueditor.php
config/ueditor.php
+202
-0
未找到文件。
application/admin/controller/Ueditor.php
0 → 100644
浏览文件 @
b607ca2c
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\admin\controller
;
use
app\service\UeditorService
;
/**
* 百度编辑器控制器入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Ueditor
extends
Common
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public
function
__construct
()
{
// 调用父类前置方法
parent
::
__construct
();
// 登录校验
$this
->
IsLogin
();
}
/**
* 运行入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-08-06
* @desc description
*/
public
function
Index
()
{
$ret
=
UeditorService
::
Run
(
input
());
if
(
$ret
[
'code'
]
==
0
)
{
return
json
(
$ret
[
'data'
]);
}
return
$ret
[
'msg'
];
}
}
?>
\ No newline at end of file
application/admin/view/default/article/save_info.html
浏览文件 @
b607ca2c
...
...
@@ -50,7 +50,7 @@
</div>
<div
class=
"am-form-group"
>
<label>
内容
</label>
<textarea
class=
"am-radius am-validate"
name=
"content"
rows=
"5"
minlength=
"10"
maxlength=
"105000"
{{
if
!
IsMobile
()}}
id=
"editor-tag"
data-url=
"{{:MyUrl('a
pi
/ueditor/index', ['path_type'=>'article'])}}"
placeholder=
"内容格式 10~105000 个字符之间"
{{
else
/}}
placeholder=
"内容格式 10~105000 个字符之间更多编辑功能请使用电脑访问"
{{/
if
}}
data-validation-message=
"内容格式 10~105000 个字符之间"
required
>
{{if !empty($data)}}{{$data.content}}{{/if}}
</textarea>
<textarea
class=
"am-radius am-validate"
name=
"content"
rows=
"5"
minlength=
"10"
maxlength=
"105000"
{{
if
!
IsMobile
()}}
id=
"editor-tag"
data-url=
"{{:MyUrl('a
dmin
/ueditor/index', ['path_type'=>'article'])}}"
placeholder=
"内容格式 10~105000 个字符之间"
{{
else
/}}
placeholder=
"内容格式 10~105000 个字符之间更多编辑功能请使用电脑访问"
{{/
if
}}
data-validation-message=
"内容格式 10~105000 个字符之间"
required
>
{{if !empty($data)}}{{$data.content}}{{/if}}
</textarea>
</div>
<!-- 插件扩展数据 start -->
...
...
application/admin/view/default/customview/save_info.html
浏览文件 @
b607ca2c
...
...
@@ -41,7 +41,7 @@
<div
class=
"am-form-group"
>
<label>
内容{{if IsMobile()}}
<span
class=
"am-form-group-label-tips"
>
更多编辑功能请使用电脑访问
</span>
{{/if}}
</label>
<textarea
class=
"am-radius am-validate"
name=
"content"
rows=
"5"
minlength=
"50"
maxlength=
"105000"
{{
if
!
IsMobile
()}}
id=
"editor-tag"
data-url=
"{{:MyUrl('a
pi
/ueditor/index', ['path_type'=>'customview'])}}"
placeholder=
"内容长度最少 50~105000 个字符"
{{
else
/}}
placeholder=
"内容长度最少 50~105000 个字符更多编辑功能请使用电脑访问"
{{/
if
}}
data-validation-message=
"内容长度最少 50~105000 个字符"
required
>
{{if !empty($data)}}{{$data.content}}{{/if}}
</textarea>
<textarea
class=
"am-radius am-validate"
name=
"content"
rows=
"5"
minlength=
"50"
maxlength=
"105000"
{{
if
!
IsMobile
()}}
id=
"editor-tag"
data-url=
"{{:MyUrl('a
dmin
/ueditor/index', ['path_type'=>'customview'])}}"
placeholder=
"内容长度最少 50~105000 个字符"
{{
else
/}}
placeholder=
"内容长度最少 50~105000 个字符更多编辑功能请使用电脑访问"
{{/
if
}}
data-validation-message=
"内容长度最少 50~105000 个字符"
required
>
{{if !empty($data)}}{{$data.content}}{{/if}}
</textarea>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<input
type=
"hidden"
name=
"id"
{{
if
!
empty
($
data
)}}
value=
"{{$data.id}}"
{{/
if
}}
/>
...
...
application/admin/view/default/public/footer.html
浏览文件 @
b607ca2c
<!-- commom html -->
<textarea
id=
"upload-editor-view"
data-url=
"{{:MyUrl('a
pi
/ueditor/index', ['path_type'=>empty($editor_path_type) ? 'common' : $editor_path_type])}}"
style=
"display: none;"
></textarea>
<textarea
id=
"upload-editor-view"
data-url=
"{{:MyUrl('a
dmin
/ueditor/index', ['path_type'=>empty($editor_path_type) ? 'common' : $editor_path_type])}}"
style=
"display: none;"
></textarea>
<!-- 公共底部钩子 -->
{{if !empty($plugins_admin_view_common_bottom_data) and is_array($plugins_admin_view_common_bottom_data) and (!isset($is_footer) or $is_footer eq 1)}}
...
...
application/api/config/app.php
浏览文件 @
b607ca2c
...
...
@@ -26,188 +26,5 @@ return [
// 默认JSONP格式返回的处理方法
'default_jsonp_handler'
=>
'jsonpReturn'
,
// 百度编辑器配置信息 ueditor
'ueditor_config'
=>
[
// 上传图片配置项
// 执行上传图片的action名称
'imageActionName'
=>
'uploadimage'
,
// 提交的图片表单名称
'imageFieldName'
=>
'upfile'
,
// 上传大小限制,单位B
'imageMaxSize'
=>
MyC
(
'home_max_limit_image'
,
2048000
,
true
),
// 上传图片格式显示
'imageAllowFiles'
=>
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
,
'.bmp'
],
// 是否压缩图片,默认是true
'imageCompressEnable'
=>
true
,
// 图片压缩最长边限制
'imageCompressBorder'
=>
1600
,
// 插入的图片浮动方式
'imageInsertAlign'
=>
'none'
,
// 图片访问路径前缀
'imageUrlPrefix'
=>
''
,
// 上传保存路径,可以自定义保存路径和文件名格式
'imagePathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
input
(
'path_type'
,
'other'
)
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 涂鸦图片上传配置项
// 执行上传涂鸦的action名称
'scrawlActionName'
=>
'uploadscrawl'
,
// 提交的图片表单名称
'scrawlFieldName'
=>
'upfile'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'scrawlPathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
input
(
'path_type'
,
'other'
)
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 上传大小限制,单位B
'scrawlMaxSize'
=>
MyC
(
'home_max_limit_image'
,
2048000
,
true
),
// 上传图片格式显示
'scrawlAllowFiles'
=>
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
,
'.bmp'
],
// 图片访问路径前缀
'scrawlUrlPrefix'
=>
''
,
// 插入的图片浮动方式
'scrawlInsertAlign'
=>
'none'
,
// 截图工具上传
// 执行上传截图的action名称
'snapscreenActionName'
=>
'uploadimage'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'snapscreenPathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
input
(
'path_type'
,
'other'
)
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 图片访问路径前缀
'snapscreenUrlPrefix'
=>
''
,
// 插入的图片浮动方式
'snapscreenInsertAlign'
=>
'none'
,
// 抓取远程图片配置
// 执行抓取远程图片的action名称
'catcherLocalDomain'
=>
[
'127.0.0.1'
,
'localhost'
,
'img.baidu.com'
],
// 执行抓取远程图片的action名称
'catcherActionName'
=>
'catchimage'
,
// 提交的图片列表表单名称
'catcherFieldName'
=>
'source'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'catcherPathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
input
(
'path_type'
,
'other'
)
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 图片访问路径前缀
'catcherUrlPrefix'
=>
''
,
// 上传大小限制,单位B
'catcherMaxSize'
=>
MyC
(
'home_max_limit_image'
,
2048000
,
true
),
// 抓取图片格式显示
'catcherAllowFiles'
=>
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
,
'.bmp'
],
// 上传视频配置
// 执行上传视频的action名称
'videoActionName'
=>
'uploadvideo'
,
// 提交的视频表单名称
'videoFieldName'
=>
'upfile'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'videoPathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/video/'
.
input
(
'path_type'
,
'other'
)
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 视频访问路径前缀
'videoUrlPrefix'
=>
''
,
// 上传大小限制,单位B,默认100MB
'videoMaxSize'
=>
MyC
(
'home_max_limit_video'
,
102400000
,
true
),
// 上传视频格式显示
'videoAllowFiles'
=>
[
'.swf'
,
'.ogg'
,
'.ogv'
,
'.mp4'
,
'.webm'
,
'.mp3'
],
// 上传文件配置
// controller里,执行上传视频的action名称
'fileActionName'
=>
'uploadfile'
,
// 提交的文件表单名称
'fileFieldName'
=>
'upfile'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'filePathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/file/'
.
input
(
'path_type'
,
'other'
)
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 文件访问路径前缀
'fileUrlPrefix'
=>
''
,
// 上传大小限制,单位B,默认50MB
'fileMaxSize'
=>
MyC
(
'home_max_limit_file'
,
51200000
,
true
),
// 上传文件格式显示
'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'
],
// 列出指定目录下的图片
// 执行图片管理的action名称
'imageManagerActionName'
=>
'listimage'
,
// 指定要列出图片的目录
'imageManagerListPath'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
input
(
'path_type'
,
'other'
)
.
'/'
,
// 每次列出文件数量
'imageManagerListSize'
=>
20
,
// 图片访问路径前缀
'imageManagerUrlPrefix'
=>
''
,
// 插入的图片浮动方式
'imageManagerInsertAlign'
=>
'none'
,
// 列出的文件类型
'imageManagerAllowFiles'
=>
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
,
'.bmp'
],
// 列出指定目录下的文件
// 执行文件管理的action名称
'fileManagerActionName'
=>
'listfile'
,
// 指定要列出文件的目录
'fileManagerListPath'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/file/'
.
input
(
'path_type'
,
'other'
)
.
'/'
,
// 文件访问路径前缀
'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'
],
// 执行视频管理的action名称
'videoManagerActionName'
=>
'listvideo'
,
// 指定要列出文件的目录
'videoManagerListPath'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/video/'
.
input
(
'path_type'
,
'other'
)
.
'/'
,
// 文件访问路径前缀
'videoManagerUrlPrefix'
=>
''
,
// 每次列出文件数量
'videoManagerListSize'
=>
20
,
// 列出的文件类型
'videoManagerAllowFiles'
=>
[
'.swf'
,
'.ogg'
,
'.ogv'
,
'.mp4'
,
'.webm'
,
'.mp3'
],
],
];
?>
\ No newline at end of file
application/api/controller/Ueditor.php
浏览文件 @
b607ca2c
...
...
@@ -10,11 +10,10 @@
// +----------------------------------------------------------------------
namespace
app\api\controller
;
use
think\facade\Hook
;
use
app\service\ResourcesService
;
use
app\service\UeditorService
;
/**
*
百度编辑器控制器入口
*
附件上传
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
...
...
@@ -22,10 +21,6 @@ use app\service\ResourcesService;
*/
class
Ueditor
extends
Common
{
private
$current_action
;
private
$current_config
;
private
$current_result
;
/**
* 构造方法
* @author Devil
...
...
@@ -37,328 +32,22 @@ class Ueditor extends Common
{
// 调用父类前置方法
parent
::
__construct
();
// 是否登录
$this
->
IsLogin
();
}
/**
* [Index 附件上传入口]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
/**
* 运行入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-08-06
* @desc description
*/
public
function
Index
()
{
// 配置信息
$this
->
current_config
=
config
(
'ueditor_config'
);
$this
->
current_action
=
input
(
'action'
);
// action
switch
(
$this
->
current_action
)
{
// 配置信息
case
'config'
:
$this
->
current_result
=
json_encode
(
$this
->
current_config
);
break
;
/* 上传图片 */
case
'uploadimage'
:
/* 上传涂鸦 */
case
'uploadscrawl'
:
/* 上传视频 */
case
'uploadvideo'
:
/* 上传文件 */
case
'uploadfile'
:
$this
->
ActionUpload
();
break
;
/* 列出图片 */
case
'listimage'
:
/* 列出文件 */
case
'listfile'
:
/* 列出视频 */
case
'listvideo'
:
$this
->
ActionList
();
break
;
/* 抓取远程文件 */
case
'catchimage'
:
$this
->
ActionCrawler
();
break
;
/* 删除文件 */
case
'deletefile'
:
$this
->
DeleteFile
();
break
;
default
:
$this
->
current_result
=
json_encode
(
array
(
'state'
=>
'请求地址出错'
));
}
// 输出结果
if
(
input
(
'callback'
))
{
if
(
preg_match
(
"/^[\w_]+$/"
,
input
(
'callback'
)))
{
echo
htmlspecialchars
(
input
(
'callback'
))
.
'('
.
$this
->
current_result
.
')'
;
}
else
{
echo
json_encode
(
array
(
'state'
=>
'callback参数不合法'
));
}
}
else
{
echo
$this
->
current_result
;
}
exit
();
}
/**
* 文件删除
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-12-10
* @desc description
*/
private
function
DeleteFile
()
{
$ret
=
ResourcesService
::
AttachmentDelete
(
input
());
if
(
$ret
[
'code'
]
==
0
)
{
$this
->
current_result
=
json_encode
(
array
(
'state'
=>
'SUCCESS'
));
}
else
{
$this
->
current_result
=
json_encode
(
array
(
'state'
=>
$ret
[
'msg'
]
));
}
}
/**
* [ActionUpload 上传配置]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-17T22:45:06+0800
*/
private
function
ActionUpload
()
{
$attachment_type
=
"file"
;
switch
(
htmlspecialchars
(
$this
->
current_action
))
{
case
'uploadimage'
:
$temp_config
=
array
(
"pathFormat"
=>
$this
->
current_config
[
'imagePathFormat'
],
"maxSize"
=>
$this
->
current_config
[
'imageMaxSize'
],
"allowFiles"
=>
$this
->
current_config
[
'imageAllowFiles'
]
);
$field_name
=
$this
->
current_config
[
'imageFieldName'
];
$attachment_type
=
"image"
;
break
;
case
'uploadscrawl'
:
$temp_config
=
array
(
"pathFormat"
=>
$this
->
current_config
[
'scrawlPathFormat'
],
"maxSize"
=>
$this
->
current_config
[
'scrawlMaxSize'
],
"allowFiles"
=>
$this
->
current_config
[
'scrawlAllowFiles'
],
"oriName"
=>
"scrawl.png"
);
$field_name
=
$this
->
current_config
[
'scrawlFieldName'
];
$attachment_type
=
"scrawl"
;
break
;
case
'uploadvideo'
:
$temp_config
=
array
(
"pathFormat"
=>
$this
->
current_config
[
'videoPathFormat'
],
"maxSize"
=>
$this
->
current_config
[
'videoMaxSize'
],
"allowFiles"
=>
$this
->
current_config
[
'videoAllowFiles'
]
);
$field_name
=
$this
->
current_config
[
'videoFieldName'
];
$attachment_type
=
"video"
;
break
;
case
'uploadfile'
:
default
:
$temp_config
=
array
(
"pathFormat"
=>
$this
->
current_config
[
'filePathFormat'
],
"maxSize"
=>
$this
->
current_config
[
'fileMaxSize'
],
"allowFiles"
=>
$this
->
current_config
[
'fileAllowFiles'
]
);
$field_name
=
$this
->
current_config
[
'fileFieldName'
];
$attachment_type
=
"file"
;
}
/* 生成上传实例对象并完成上传 */
$up
=
new
\
base\Uploader
(
$field_name
,
$temp_config
,
$attachment_type
);
/**
* 得到上传文件所对应的各个参数,数组结构
* array(
* "state" => "", //上传状态,上传成功时必须返回"SUCCESS"
* "url" => "", //返回的地址
* "path" => "", //绝对地址
* "title" => "", //新文件名
* "original" => "", //原始文件名
* "type" => "" //文件类型
* "size" => "", //文件大小
* "hash" => "", //sha256值
* )
*/
$data
=
$up
->
getFileInfo
();
if
(
isset
(
$data
[
'state'
])
&&
$data
[
'state'
]
==
'SUCCESS'
)
{
$data
[
'type'
]
=
$attachment_type
;
$data
[
'path_type'
]
=
empty
(
$this
->
data_request
[
'path_type'
])
?
'other'
:
$this
->
data_request
[
'path_type'
];
$ret
=
ResourcesService
::
AttachmentAdd
(
$data
);
if
(
$ret
[
'code'
]
==
0
)
{
$this
->
current_result
=
json_encode
(
$ret
[
'data'
]);
}
else
{
$this
->
current_result
=
json_encode
([
'state'
=>
$ret
[
'msg'
]]);
}
}
else
{
$this
->
current_result
=
json_encode
(
$data
);
}
}
/**
* [ActionList 文件列表]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-17T22:55:16+0800
*/
private
function
ActionList
()
{
/* 判断类型 */
switch
(
$this
->
current_action
)
{
/* 列出视频 */
case
'listvideo'
:
$allow_files
=
$this
->
current_config
[
'videoManagerAllowFiles'
];
$list_size
=
$this
->
current_config
[
'videoManagerListSize'
];
$path
=
$this
->
current_config
[
'videoManagerListPath'
];
break
;
/* 列出文件 */
case
'listfile'
:
$allow_files
=
$this
->
current_config
[
'fileManagerAllowFiles'
];
$list_size
=
$this
->
current_config
[
'fileManagerListSize'
];
$path
=
$this
->
current_config
[
'fileManagerListPath'
];
break
;
/* 列出图片 */
case
'listimage'
:
default
:
$allow_files
=
$this
->
current_config
[
'imageManagerAllowFiles'
];
$list_size
=
$this
->
current_config
[
'imageManagerListSize'
];
$path
=
$this
->
current_config
[
'imageManagerListPath'
];
}
$allow_files
=
substr
(
str_replace
(
"."
,
"|"
,
join
(
""
,
$allow_files
)),
1
);
/* 获取参数 */
$size
=
isset
(
$_GET
[
'size'
])
?
htmlspecialchars
(
$_GET
[
'size'
])
:
$list_size
;
$start
=
isset
(
$_GET
[
'start'
])
?
htmlspecialchars
(
$_GET
[
'start'
])
:
0
;
$end
=
$start
+
$size
;
// 参数
$params
=
[
'm'
=>
$start
,
'n'
=>
$size
,
'where'
=>
[
[
'type'
,
'='
,
substr
(
$this
->
current_action
,
4
)],
[
'path_type'
,
'='
,
empty
(
$this
->
data_request
[
'path_type'
])
?
'other'
:
$this
->
data_request
[
'path_type'
]]
],
];
// 搜索关键字
if
(
!
empty
(
$this
->
data_request
[
'keywords'
]))
{
$params
[
'where'
][]
=
[
'original'
,
'like'
,
'%'
.
$this
->
data_request
[
'keywords'
]
.
'%'
];
}
// 数据初始化
$data
=
array
(
'state'
=>
"没有相关数据"
,
'list'
=>
[],
'start'
=>
$start
,
'total'
=>
ResourcesService
::
AttachmentTotal
(
$params
[
'where'
]),
);
// 获取数据
$ret
=
ResourcesService
::
AttachmentList
(
$params
);
if
(
!
empty
(
$ret
[
'data'
]))
{
$data
[
'state'
]
=
'SUCCESS'
;
$data
[
'list'
]
=
$ret
[
'data'
];
}
$this
->
current_result
=
json_encode
(
$data
);
}
/**
* [ActionCrawler 抓取远程文件]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-17T23:08:29+0800
*/
private
function
ActionCrawler
()
{
$temp_config
=
array
(
"pathFormat"
=>
$this
->
current_config
[
'catcherPathFormat'
],
"maxSize"
=>
$this
->
current_config
[
'catcherMaxSize'
],
"allowFiles"
=>
$this
->
current_config
[
'catcherAllowFiles'
],
"oriName"
=>
"remote.png"
);
$field_name
=
$this
->
current_config
[
'catcherFieldName'
];
/* 抓取远程图片 */
$list
=
array
();
$source
=
isset
(
$_POST
[
$field_name
])
?
$_POST
[
$field_name
]
:
$_GET
[
$field_name
];
foreach
(
$source
as
$imgUrl
)
{
$item
=
new
\
base\Uploader
(
$imgUrl
,
$temp_config
,
"remote"
);
/**
* 得到上传文件所对应的各个参数,数组结构
* array(
* "state" => "", //上传状态,上传成功时必须返回"SUCCESS"
* "url" => "", //返回的地址
* "path" => "", //绝对地址
* "title" => "", //新文件名
* "original" => "", //原始文件名
* "type" => "" //文件类型
* "size" => "", //文件大小
* "hash" => "", //sha256值
* )
*/
$data
=
$up
->
getFileInfo
();
if
(
isset
(
$data
[
'state'
])
&&
$data
[
'state'
]
==
'SUCCESS'
)
{
$data
[
'type'
]
=
'remote'
;
$data
[
'path_type'
]
=
empty
(
$this
->
data_request
[
'path_type'
])
?
'other'
:
$this
->
data_request
[
'path_type'
];
$ret
=
ResourcesService
::
AttachmentAdd
(
$data
);
if
(
$ret
[
'code'
]
!=
0
)
{
$data
[
'state'
]
=
$ret
[
'msg'
];
}
}
array_push
(
$list
,
array
(
"state"
=>
$data
[
"state"
],
"url"
=>
$data
[
"url"
],
"size"
=>
$data
[
"size"
],
"title"
=>
htmlspecialchars
(
$data
[
"title"
]),
"original"
=>
htmlspecialchars
(
$data
[
"original"
]),
"source"
=>
htmlspecialchars
(
$imgUrl
)
));
}
/* 返回抓取数据 */
$this
->
current_result
=
json_encode
(
array
(
'state'
=>
count
(
$list
)
?
'SUCCESS'
:
'ERROR'
,
'list'
=>
$list
));
return
DataReturn
(
'api附件上传接口开发中'
,
0
);
}
}
?>
\ No newline at end of file
application/common.php
浏览文件 @
b607ca2c
...
...
@@ -11,6 +11,51 @@
// 应用公共文件
/**
* 路径解析指定参数
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-08-06
* @desc description
* @param [string] $path [参数字符串 格式如: a/aa/b/bb/c/cc ]
* @param [string] $key [指定key]
* @param [mixed] $default [默认值]
*/
function
PathToParams
(
$path
,
$key
=
null
,
$default
=
null
)
{
if
(
!
empty
(
$path
))
{
if
(
substr
(
$path
,
0
,
1
)
==
'/'
)
{
$path
=
mb_substr
(
$path
,
1
,
mb_strlen
(
$path
,
'utf-8'
)
-
1
,
'utf-8'
);
}
$position
=
strrpos
(
$path
,
'.'
);
if
(
$position
!==
false
)
{
$path
=
mb_substr
(
$path
,
0
,
$position
,
'utf-8'
);
}
$arr
=
explode
(
'/'
,
$path
);
$data
=
[];
$index
=
0
;
foreach
(
$arr
as
$k
=>
$v
)
{
if
(
$index
!=
$k
)
{
$data
[
$arr
[
$index
]]
=
$v
;
$index
=
$k
;
}
}
if
(
$key
!==
null
)
{
return
array_key_exists
(
$key
,
$data
)
?
$data
[
$key
]
:
$default
;
}
return
$data
;
}
return
null
;
}
/**
* 调用插件方法 - 访问为静态
* @author Devil
...
...
application/index/controller/Ueditor.php
0 → 100644
浏览文件 @
b607ca2c
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\index\controller
;
use
app\service\UeditorService
;
/**
* 百度编辑器控制器入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Ueditor
extends
Common
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-03T12:39:08+0800
*/
public
function
__construct
()
{
// 调用父类前置方法
parent
::
__construct
();
// 是否登录
$this
->
IsLogin
();
}
/**
* 运行入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-08-06
* @desc description
*/
public
function
Index
()
{
$ret
=
UeditorService
::
Run
(
input
());
if
(
$ret
[
'code'
]
==
0
)
{
return
json
(
$ret
[
'data'
]);
}
return
$ret
[
'msg'
];
}
}
?>
\ No newline at end of file
application/index/view/default/public/footer.html
浏览文件 @
b607ca2c
<!-- commom html -->
<textarea
id=
"upload-editor-view"
data-url=
"{{:MyUrl('
api
/ueditor/index', ['path_type'=>empty($editor_path_type) ? 'common' : $editor_path_type])}}"
style=
"display: none;"
></textarea>
<textarea
id=
"upload-editor-view"
data-url=
"{{:MyUrl('
index
/ueditor/index', ['path_type'=>empty($editor_path_type) ? 'common' : $editor_path_type])}}"
style=
"display: none;"
></textarea>
<!-- footer start -->
{{if !isset($is_footer) or $is_footer eq 1}}
...
...
application/service/UeditorService.php
0 → 100644
浏览文件 @
b607ca2c
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\service
;
use
app\service\ResourcesService
;
/**
* 百度编辑器附件服务层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
UeditorService
{
private
static
$current_action
;
private
static
$current_config
;
private
static
$current_result
;
private
static
$params
;
private
static
$path_type
;
/**
* 请求入口
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-08-06
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
Run
(
$params
=
[])
{
// 配置信息
self
::
$params
=
$params
;
self
::
$current_config
=
config
(
'ueditor.'
);
self
::
$current_action
=
isset
(
$params
[
'action'
])
?
$params
[
'action'
]
:
''
;
self
::
$path_type
=
isset
(
$params
[
'path_type'
])
?
$params
[
'path_type'
]
:
(
isset
(
$params
[
's'
])
?
PathToParams
(
$params
[
's'
],
'path_type'
,
'other'
)
:
''
);
// action
switch
(
self
::
$current_action
)
{
// 配置信息
case
'config'
:
self
::
$current_result
=
self
::
$current_config
;
break
;
/* 上传图片 */
case
'uploadimage'
:
/* 上传涂鸦 */
case
'uploadscrawl'
:
/* 上传视频 */
case
'uploadvideo'
:
/* 上传文件 */
case
'uploadfile'
:
self
::
ActionUpload
();
break
;
/* 列出图片 */
case
'listimage'
:
/* 列出文件 */
case
'listfile'
:
/* 列出视频 */
case
'listvideo'
:
self
::
ActionList
();
break
;
/* 抓取远程文件 */
case
'catchimage'
:
self
::
ActionCrawler
();
break
;
/* 删除文件 */
case
'deletefile'
:
self
::
DeleteFile
();
break
;
default
:
self
::
$current_result
=
[
'state'
=>
'请求地址出错'
];
}
// 输出结果
if
(
!
empty
(
$params
[
'callback'
]))
{
if
(
preg_match
(
"/^[\w_]+$/"
,
$params
[
'callback'
]))
{
return
DataReturn
(
htmlspecialchars
(
$params
[
'callback'
])
.
'('
.
self
::
$current_result
.
')'
,
-
1
);
}
else
{
return
DataReturn
(
'callback参数不合法'
,
-
1
);
}
}
return
DataReturn
(
'操作成功'
,
0
,
self
::
$current_result
);
}
/**
* 文件删除
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-12-10
* @desc description
*/
private
static
function
DeleteFile
()
{
$ret
=
ResourcesService
::
AttachmentDelete
(
input
());
if
(
$ret
[
'code'
]
==
0
)
{
self
::
$current_result
=
[
'state'
=>
'SUCCESS'
];
}
else
{
self
::
$current_result
=
[
'state'
=>
$ret
[
'msg'
]
];
}
}
/**
* [ActionUpload 上传配置]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-17T22:45:06+0800
*/
private
static
function
ActionUpload
()
{
$attachment_type
=
"file"
;
switch
(
htmlspecialchars
(
self
::
$current_action
))
{
case
'uploadimage'
:
$temp_config
=
array
(
"pathFormat"
=>
self
::
$current_config
[
'imagePathFormat'
],
"maxSize"
=>
self
::
$current_config
[
'imageMaxSize'
],
"allowFiles"
=>
self
::
$current_config
[
'imageAllowFiles'
]
);
$field_name
=
self
::
$current_config
[
'imageFieldName'
];
$attachment_type
=
"image"
;
break
;
case
'uploadscrawl'
:
$temp_config
=
array
(
"pathFormat"
=>
self
::
$current_config
[
'scrawlPathFormat'
],
"maxSize"
=>
self
::
$current_config
[
'scrawlMaxSize'
],
"allowFiles"
=>
self
::
$current_config
[
'scrawlAllowFiles'
],
"oriName"
=>
"scrawl.png"
);
$field_name
=
self
::
$current_config
[
'scrawlFieldName'
];
$attachment_type
=
"scrawl"
;
break
;
case
'uploadvideo'
:
$temp_config
=
array
(
"pathFormat"
=>
self
::
$current_config
[
'videoPathFormat'
],
"maxSize"
=>
self
::
$current_config
[
'videoMaxSize'
],
"allowFiles"
=>
self
::
$current_config
[
'videoAllowFiles'
]
);
$field_name
=
self
::
$current_config
[
'videoFieldName'
];
$attachment_type
=
"video"
;
break
;
case
'uploadfile'
:
default
:
$temp_config
=
array
(
"pathFormat"
=>
self
::
$current_config
[
'filePathFormat'
],
"maxSize"
=>
self
::
$current_config
[
'fileMaxSize'
],
"allowFiles"
=>
self
::
$current_config
[
'fileAllowFiles'
]
);
$field_name
=
self
::
$current_config
[
'fileFieldName'
];
$attachment_type
=
"file"
;
}
/* 生成上传实例对象并完成上传 */
$up
=
new
\
base\Uploader
(
$field_name
,
$temp_config
,
$attachment_type
);
/**
* 得到上传文件所对应的各个参数,数组结构
* array(
* "state" => "", //上传状态,上传成功时必须返回"SUCCESS"
* "url" => "", //返回的地址
* "path" => "", //绝对地址
* "title" => "", //新文件名
* "original" => "", //原始文件名
* "type" => "" //文件类型
* "size" => "", //文件大小
* "hash" => "", //sha256值
* )
*/
$data
=
$up
->
getFileInfo
();
if
(
isset
(
$data
[
'state'
])
&&
$data
[
'state'
]
==
'SUCCESS'
)
{
$data
[
'type'
]
=
$attachment_type
;
$data
[
'path_type'
]
=
self
::
$path_type
;
$ret
=
ResourcesService
::
AttachmentAdd
(
$data
);
if
(
$ret
[
'code'
]
==
0
)
{
self
::
$current_result
=
$ret
[
'data'
];
}
else
{
self
::
$current_result
=
[
'state'
=>
$ret
[
'msg'
]];
}
}
else
{
self
::
$current_result
=
$data
;
}
}
/**
* [ActionList 文件列表]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-17T22:55:16+0800
*/
private
static
function
ActionList
()
{
/* 判断类型 */
switch
(
self
::
$current_action
)
{
/* 列出视频 */
case
'listvideo'
:
$allow_files
=
self
::
$current_config
[
'videoManagerAllowFiles'
];
$list_size
=
self
::
$current_config
[
'videoManagerListSize'
];
$path
=
self
::
$current_config
[
'videoManagerListPath'
];
break
;
/* 列出文件 */
case
'listfile'
:
$allow_files
=
self
::
$current_config
[
'fileManagerAllowFiles'
];
$list_size
=
self
::
$current_config
[
'fileManagerListSize'
];
$path
=
self
::
$current_config
[
'fileManagerListPath'
];
break
;
/* 列出图片 */
case
'listimage'
:
default
:
$allow_files
=
self
::
$current_config
[
'imageManagerAllowFiles'
];
$list_size
=
self
::
$current_config
[
'imageManagerListSize'
];
$path
=
self
::
$current_config
[
'imageManagerListPath'
];
}
$allow_files
=
substr
(
str_replace
(
"."
,
"|"
,
join
(
""
,
$allow_files
)),
1
);
/* 获取参数 */
$size
=
isset
(
self
::
$params
[
'size'
])
?
htmlspecialchars
(
self
::
$params
[
'size'
])
:
$list_size
;
$start
=
isset
(
self
::
$params
[
'start'
])
?
htmlspecialchars
(
self
::
$params
[
'start'
])
:
0
;
$end
=
$start
+
$size
;
// 参数
$params
=
[
'm'
=>
$start
,
'n'
=>
$size
,
'where'
=>
[
[
'type'
,
'='
,
substr
(
self
::
$current_action
,
4
)],
[
'path_type'
,
'='
,
self
::
$path_type
]
],
];
// 搜索关键字
if
(
!
empty
(
self
::
$params
[
'keywords'
]))
{
$params
[
'where'
][]
=
[
'original'
,
'like'
,
'%'
.
self
::
$params
[
'keywords'
]
.
'%'
];
}
// 数据初始化
$data
=
array
(
'state'
=>
"没有相关数据"
,
'list'
=>
[],
'start'
=>
$start
,
'total'
=>
ResourcesService
::
AttachmentTotal
(
$params
[
'where'
]),
);
// 获取数据
$ret
=
ResourcesService
::
AttachmentList
(
$params
);
if
(
!
empty
(
$ret
[
'data'
]))
{
$data
[
'state'
]
=
'SUCCESS'
;
$data
[
'list'
]
=
$ret
[
'data'
];
}
self
::
$current_result
=
$data
;
}
/**
* [ActionCrawler 抓取远程文件]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-17T23:08:29+0800
*/
private
static
function
ActionCrawler
()
{
$temp_config
=
array
(
"pathFormat"
=>
self
::
$current_config
[
'catcherPathFormat'
],
"maxSize"
=>
self
::
$current_config
[
'catcherMaxSize'
],
"allowFiles"
=>
self
::
$current_config
[
'catcherAllowFiles'
],
"oriName"
=>
"remote.png"
);
$field_name
=
self
::
$current_config
[
'catcherFieldName'
];
/* 抓取远程图片 */
$list
=
array
();
$source
=
isset
(
self
::
$params
[
$field_name
])
?
self
::
$params
[
$field_name
]
:
self
::
$params
[
$field_name
];
foreach
(
$source
as
$imgUrl
)
{
$item
=
new
\
base\Uploader
(
$imgUrl
,
$temp_config
,
"remote"
);
/**
* 得到上传文件所对应的各个参数,数组结构
* array(
* "state" => "", //上传状态,上传成功时必须返回"SUCCESS"
* "url" => "", //返回的地址
* "path" => "", //绝对地址
* "title" => "", //新文件名
* "original" => "", //原始文件名
* "type" => "" //文件类型
* "size" => "", //文件大小
* "hash" => "", //sha256值
* )
*/
$data
=
$up
->
getFileInfo
();
if
(
isset
(
$data
[
'state'
])
&&
$data
[
'state'
]
==
'SUCCESS'
)
{
$data
[
'type'
]
=
'remote'
;
$data
[
'path_type'
]
=
self
::
$path_type
;
$ret
=
ResourcesService
::
AttachmentAdd
(
$data
);
if
(
$ret
[
'code'
]
!=
0
)
{
$data
[
'state'
]
=
$ret
[
'msg'
];
}
}
array_push
(
$list
,
array
(
"state"
=>
$data
[
"state"
],
"url"
=>
$data
[
"url"
],
"size"
=>
$data
[
"size"
],
"title"
=>
htmlspecialchars
(
$data
[
"title"
]),
"original"
=>
htmlspecialchars
(
$data
[
"original"
]),
"source"
=>
htmlspecialchars
(
$imgUrl
)
));
}
/* 返回抓取数据 */
self
::
$current_result
=
[
'state'
=>
count
(
$list
)
?
'SUCCESS'
:
'ERROR'
,
'list'
=>
$list
,
];
}
}
?>
\ No newline at end of file
config/ueditor.php
0 → 100644
浏览文件 @
b607ca2c
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
/**
* 百度编辑器配置信息
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
$params
=
input
();
$path_type
=
isset
(
$params
[
'path_type'
])
?
$params
[
'path_type'
]
:
(
isset
(
$params
[
's'
])
?
PathToParams
(
$params
[
's'
],
'path_type'
,
'other'
)
:
''
);
return
[
// 上传图片配置项
// 执行上传图片的action名称
'imageActionName'
=>
'uploadimage'
,
// 提交的图片表单名称
'imageFieldName'
=>
'upfile'
,
// 上传大小限制,单位B
'imageMaxSize'
=>
MyC
(
'home_max_limit_image'
,
2048000
,
true
),
// 上传图片格式显示
'imageAllowFiles'
=>
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
,
'.bmp'
],
// 是否压缩图片,默认是true
'imageCompressEnable'
=>
true
,
// 图片压缩最长边限制
'imageCompressBorder'
=>
1600
,
// 插入的图片浮动方式
'imageInsertAlign'
=>
'none'
,
// 图片访问路径前缀
'imageUrlPrefix'
=>
''
,
// 上传保存路径,可以自定义保存路径和文件名格式
'imagePathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
$path_type
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 涂鸦图片上传配置项
// 执行上传涂鸦的action名称
'scrawlActionName'
=>
'uploadscrawl'
,
// 提交的图片表单名称
'scrawlFieldName'
=>
'upfile'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'scrawlPathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
$path_type
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 上传大小限制,单位B
'scrawlMaxSize'
=>
MyC
(
'home_max_limit_image'
,
2048000
,
true
),
// 上传图片格式显示
'scrawlAllowFiles'
=>
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
,
'.bmp'
],
// 图片访问路径前缀
'scrawlUrlPrefix'
=>
''
,
// 插入的图片浮动方式
'scrawlInsertAlign'
=>
'none'
,
// 截图工具上传
// 执行上传截图的action名称
'snapscreenActionName'
=>
'uploadimage'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'snapscreenPathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
$path_type
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 图片访问路径前缀
'snapscreenUrlPrefix'
=>
''
,
// 插入的图片浮动方式
'snapscreenInsertAlign'
=>
'none'
,
// 抓取远程图片配置
// 执行抓取远程图片的action名称
'catcherLocalDomain'
=>
[
'127.0.0.1'
,
'localhost'
,
'img.baidu.com'
],
// 执行抓取远程图片的action名称
'catcherActionName'
=>
'catchimage'
,
// 提交的图片列表表单名称
'catcherFieldName'
=>
'source'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'catcherPathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
$path_type
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 图片访问路径前缀
'catcherUrlPrefix'
=>
''
,
// 上传大小限制,单位B
'catcherMaxSize'
=>
MyC
(
'home_max_limit_image'
,
2048000
,
true
),
// 抓取图片格式显示
'catcherAllowFiles'
=>
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
,
'.bmp'
],
// 上传视频配置
// 执行上传视频的action名称
'videoActionName'
=>
'uploadvideo'
,
// 提交的视频表单名称
'videoFieldName'
=>
'upfile'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'videoPathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/video/'
.
$path_type
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 视频访问路径前缀
'videoUrlPrefix'
=>
''
,
// 上传大小限制,单位B,默认100MB
'videoMaxSize'
=>
MyC
(
'home_max_limit_video'
,
102400000
,
true
),
// 上传视频格式显示
'videoAllowFiles'
=>
[
'.swf'
,
'.ogg'
,
'.ogv'
,
'.mp4'
,
'.webm'
,
'.mp3'
],
// 上传文件配置
// controller里,执行上传视频的action名称
'fileActionName'
=>
'uploadfile'
,
// 提交的文件表单名称
'fileFieldName'
=>
'upfile'
,
// 上传保存路径,可以自定义保存路径和文件名格式
'filePathFormat'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/file/'
.
$path_type
.
'/{yyyy}/{mm}/{dd}/{time}{rand:6}'
,
// 文件访问路径前缀
'fileUrlPrefix'
=>
''
,
// 上传大小限制,单位B,默认50MB
'fileMaxSize'
=>
MyC
(
'home_max_limit_file'
,
51200000
,
true
),
// 上传文件格式显示
'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'
],
// 列出指定目录下的图片
// 执行图片管理的action名称
'imageManagerActionName'
=>
'listimage'
,
// 指定要列出图片的目录
'imageManagerListPath'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/images/'
.
$path_type
.
'/'
,
// 每次列出文件数量
'imageManagerListSize'
=>
20
,
// 图片访问路径前缀
'imageManagerUrlPrefix'
=>
''
,
// 插入的图片浮动方式
'imageManagerInsertAlign'
=>
'none'
,
// 列出的文件类型
'imageManagerAllowFiles'
=>
[
'.png'
,
'.jpg'
,
'.jpeg'
,
'.gif'
,
'.bmp'
],
// 列出指定目录下的文件
// 执行文件管理的action名称
'fileManagerActionName'
=>
'listfile'
,
// 指定要列出文件的目录
'fileManagerListPath'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/file/'
.
$path_type
.
'/'
,
// 文件访问路径前缀
'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'
],
// 执行视频管理的action名称
'videoManagerActionName'
=>
'listvideo'
,
// 指定要列出文件的目录
'videoManagerListPath'
=>
__MY_ROOT_PUBLIC__
.
'static/upload/video/'
.
$path_type
.
'/'
,
// 文件访问路径前缀
'videoManagerUrlPrefix'
=>
''
,
// 每次列出文件数量
'videoManagerListSize'
=>
20
,
// 列出的文件类型
'videoManagerAllowFiles'
=>
[
'.swf'
,
'.ogg'
,
'.ogv'
,
'.mp4'
,
'.webm'
,
'.mp3'
],
];
?>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录