Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
u011369184
ShopXO
提交
6cf07c22
ShopXO
项目概览
u011369184
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6cf07c22
编写于
2月 13, 2019
作者:
D
devil_gong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
应用管理
上级
de3c208c
变更
16
展开全部
隐藏空白更改
内联
并排
Showing
16 changed file
with
395 addition
and
46 deletion
+395
-46
application/admin/controller/Plugins.php
application/admin/controller/Plugins.php
+2
-2
application/admin/view/default/pluginsadmin/save_info.html
application/admin/view/default/pluginsadmin/save_info.html
+1
-1
application/index/controller/Plugins.php
application/index/controller/Plugins.php
+2
-2
application/plugins/ttttttsssstest88/Admin.php
application/plugins/ttttttsssstest88/Admin.php
+24
-0
application/plugins/ttttttsssstest88/Hook.php
application/plugins/ttttttsssstest88/Hook.php
+27
-0
application/plugins/ttttttsssstest88/Index.php
application/plugins/ttttttsssstest88/Index.php
+24
-0
application/plugins/ttttttsssstest88/config.json
application/plugins/ttttttsssstest88/config.json
+21
-0
application/plugins/usercentertopnotice/config.json
application/plugins/usercentertopnotice/config.json
+1
-1
application/plugins/view/ttttttsssstest88/admin/index.html
application/plugins/view/ttttttsssstest88/admin/index.html
+15
-0
application/plugins/view/ttttttsssstest88/index/index.html
application/plugins/view/ttttttsssstest88/index/index.html
+31
-0
application/service/PluginsAdminService.php
application/service/PluginsAdminService.php
+188
-7
application/tags.php
application/tags.php
+32
-22
config/shopxo.sql
config/shopxo.sql
+13
-11
public/static/plugins/css/ttttttsssstest88/admin.css
public/static/plugins/css/ttttttsssstest88/admin.css
+7
-0
public/static/plugins/css/ttttttsssstest88/index.css
public/static/plugins/css/ttttttsssstest88/index.css
+7
-0
public/static/upload/images/plugins_ttttttsssstest88/2019/02/13/1550050651917730.png
.../plugins_ttttttsssstest88/2019/02/13/1550050651917730.png
+0
-0
未找到文件。
application/admin/controller/Plugins.php
浏览文件 @
6cf07c22
...
...
@@ -95,7 +95,7 @@ class Plugins extends Common
$plugins
=
'\app\plugins\\'
.
$pluginsname
.
'\\'
.
ucfirst
(
$pluginscontrol
);
if
(
!
class_exists
(
$plugins
))
{
$this
->
assign
(
'msg'
,
ucfirst
(
$pluginscontrol
)
.
' 控制器未定义'
);
$this
->
assign
(
'msg'
,
ucfirst
(
$pluginscontrol
)
.
'
应用
控制器未定义'
);
return
$this
->
fetch
(
'public/error'
);
}
...
...
@@ -103,7 +103,7 @@ class Plugins extends Common
$obj
=
new
$plugins
();
if
(
!
method_exists
(
$obj
,
$pluginsaction
))
{
$this
->
assign
(
'msg'
,
ucfirst
(
$pluginsaction
)
.
' 方法未定义'
);
$this
->
assign
(
'msg'
,
ucfirst
(
$pluginsaction
)
.
'
应用
方法未定义'
);
return
$this
->
fetch
(
'public/error'
);
}
$ret
=
$obj
->
$pluginsaction
(
$params
);
...
...
application/admin/view/default/pluginsadmin/save_info.html
浏览文件 @
6cf07c22
...
...
@@ -22,7 +22,7 @@
</div>
<div
class=
"am-form-group am-form-file"
>
<label
class=
"block"
>
LOGO
<span
class=
"fs-12 fw-100 cr-999"
>
(建议1
00像数X10
0像数)
</span></label>
<label
class=
"block"
>
LOGO
<span
class=
"fs-12 fw-100 cr-999"
>
(建议1
30像数X13
0像数)
</span></label>
<ul
class=
"plug-file-upload-view plugins-logo-view"
data-form-name=
"logo"
data-max-number=
"1"
data-delete=
"0"
data-dialog-type=
"images"
>
<li>
<input
type=
"text"
name=
"logo"
value=
"{{if !empty($data['logo'])}}{{$data.logo}}{{/if}}"
data-validation-message=
"请上传图片"
required
/>
...
...
application/index/controller/Plugins.php
浏览文件 @
6cf07c22
...
...
@@ -89,7 +89,7 @@ class Plugins extends Common
$plugins
=
'\app\plugins\\'
.
$pluginsname
.
'\\'
.
ucfirst
(
$pluginscontrol
);
if
(
!
class_exists
(
$plugins
))
{
$this
->
assign
(
'msg'
,
ucfirst
(
$pluginscontrol
)
.
' 控制器未定义'
);
$this
->
assign
(
'msg'
,
ucfirst
(
$pluginscontrol
)
.
'
应用
控制器未定义'
);
return
$this
->
fetch
(
'public/error'
);
}
...
...
@@ -97,7 +97,7 @@ class Plugins extends Common
$obj
=
new
$plugins
();
if
(
!
method_exists
(
$obj
,
$pluginsaction
))
{
$this
->
assign
(
'msg'
,
ucfirst
(
$pluginsaction
)
.
' 方法未定义'
);
$this
->
assign
(
'msg'
,
ucfirst
(
$pluginsaction
)
.
'
应用
方法未定义'
);
return
$this
->
fetch
(
'public/error'
);
}
$ret
=
$obj
->
$pluginsaction
(
$params
);
...
...
application/plugins/ttttttsssstest88/Admin.php
0 → 100644
浏览文件 @
6cf07c22
<?php
namespace
app\plugins\ttttttsssstest88
;
/**
* 测试应用 - 后台管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Admin
{
// 后台管理入口
public
function
index
(
$params
=
[])
{
// 数组组装
$data
=
[
'data'
=>
[
'hello'
,
'world!'
],
'msg'
=>
'hello world! admin'
,
];
return
DataReturn
(
'处理成功'
,
0
,
$data
);
}
}
?>
\ No newline at end of file
application/plugins/ttttttsssstest88/Hook.php
0 → 100644
浏览文件 @
6cf07c22
<?php
namespace
app\plugins\ttttttsssstest88
;
/**
* 测试应用 - 钩子入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Hook
{
// 应用响应入口
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
if
(
isset
(
$params
[
'is_control'
])
&&
$params
[
'is_control'
]
===
true
)
{
return
[];
// 默认返回视图
}
else
{
return
'hello world!'
;
}
}
}
?>
\ No newline at end of file
application/plugins/ttttttsssstest88/Index.php
0 → 100644
浏览文件 @
6cf07c22
<?php
namespace
app\plugins\ttttttsssstest88
;
/**
* 测试应用 - 前端独立页面入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Index
{
// 前端页面入口
public
function
index
(
$params
=
[])
{
// 数组组装
$data
=
[
'data'
=>
[
'hello'
,
'world!'
],
'msg'
=>
'hello world! index'
,
];
return
DataReturn
(
'处理成功'
,
0
,
$data
);
}
}
?>
\ No newline at end of file
application/plugins/ttttttsssstest88/config.json
0 → 100644
浏览文件 @
6cf07c22
{
"base"
:{
"plugins"
:
"ttttttsssstest88"
,
"name"
:
"测试应用"
,
"logo"
:
"
\/
static
\/
upload
\/
images
\/
plugins_ttttttsssstest88
\/
2019
\/
02
\/
13
\/
1550050651917730.png"
,
"author"
:
"Devil"
,
"author_url"
:
"https:
\/\/
shopxo.net
\/
"
,
"version"
:
"1.0.0"
,
"desc"
:
"测试应用描述"
,
"apply_terminal"
:[
"pc"
],
"apply_version"
:[
"1.3.0"
],
"is_home"
:
true
},
"hook"
:[
]
}
\ No newline at end of file
application/plugins/usercentertopnotice/config.json
浏览文件 @
6cf07c22
...
...
@@ -11,6 +11,6 @@
"is_home"
:
false
},
"hook"
:
{
"plugins_
common
_top"
:
[
"app
\\
plugins
\\
usercentertopnotice
\\
Hook"
]
"plugins_
user_center
_top"
:
[
"app
\\
plugins
\\
usercentertopnotice
\\
Hook"
]
}
}
\ No newline at end of file
application/plugins/view/ttttttsssstest88/admin/index.html
0 → 100644
浏览文件 @
6cf07c22
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<h1>
后台管理页面
</h1>
{{:print_r($data)}}
<p
class=
"msg"
>
{{$msg}}
</p>
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/plugins/view/ttttttsssstest88/index/index.html
0 → 100644
浏览文件 @
6cf07c22
{{include file="public/header" /}}
<!-- nav start -->
{{include file="public/nav" /}}
<!-- nav end -->
<!-- header top nav -->
{{include file="public/header_top_nav" /}}
<!-- search -->
{{include file="public/nav_search" /}}
<!-- header nav -->
{{include file="public/header_nav" /}}
<!-- goods category -->
{{include file="public/goods_category" /}}
<!-- content start -->
<div
class=
"am-g my-content"
>
<div
class=
"am-u-md-6 am-u-sm-centered"
>
<h1>
前端页面
</h1>
{{:print_r($data)}}
<p
class=
"msg"
>
{{$msg}}
</p>
</div>
</div>
<!-- content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/service/PluginsAdminService.php
浏览文件 @
6cf07c22
...
...
@@ -150,11 +150,113 @@ class PluginsAdminService
// 数据更新
if
(
Db
::
name
(
'Plugins'
)
->
where
([
'id'
=>
$params
[
'id'
]])
->
update
([
'is_enable'
=>
intval
(
$params
[
'state'
]),
'upd_time'
=>
time
()]))
{
// 钩子部署
$ret
=
self
::
PluginsHookDeployment
();
if
(
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
return
DataReturn
(
'操作成功'
);
}
return
DataReturn
(
'操作失败'
,
-
100
);
}
/**
* 应用钩子部署
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-02-13
* @desc description
*/
private
static
function
PluginsHookDeployment
()
{
// 钩子配置文件
$tags_file
=
APP_PATH
.
'tags.php'
;
if
(
!
is_writable
(
$tags_file
))
{
return
DataReturn
(
'钩子配置文件没有操作权限'
.
'['
.
$tags_file
.
']'
,
-
3
);
}
// 钩子容器
$result
=
[];
// 系统自带钩子处理
if
(
file_exists
(
$tags_file
))
{
$tags
=
require
$tags_file
;
if
(
!
empty
(
$tags
)
&&
is_array
(
$tags
))
{
$system_hook_list
=
[
'app_init'
,
'app_dispatch'
,
'app_begin'
,
'module_init'
,
'action_begin'
,
'view_filter'
,
'app_end'
,
'log_write'
,
'log_level'
,
'response_send'
,
'response_end'
];
foreach
(
$system_hook_list
as
$system_hook
)
{
if
(
isset
(
$tags
[
$system_hook
]))
{
$result
[
$system_hook
]
=
$tags
[
$system_hook
];
}
}
}
}
// 处理应用钩子
$data
=
Db
::
name
(
'Plugins'
)
->
where
([
'is_enable'
=>
1
])
->
column
(
'plugins'
);
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
$plugins
)
{
if
(
file_exists
(
APP_PATH
.
'plugins'
.
DS
.
$plugins
.
DS
.
'config.json'
))
{
$config
=
json_decode
(
file_get_contents
(
APP_PATH
.
'plugins'
.
DS
.
$plugins
.
DS
.
'config.json'
),
true
);
if
(
!
empty
(
$config
[
'hook'
])
&&
is_array
(
$config
[
'hook'
]))
{
foreach
(
$config
[
'hook'
]
as
$hook_key
=>
$hook_value
)
{
if
(
isset
(
$result
[
$hook_key
]))
{
$result
[
$hook_key
]
=
array_merge
(
$result
[
$hook_key
],
$hook_value
);
}
else
{
$result
[
$hook_key
]
=
$hook_value
;
}
}
}
}
}
}
// 部署钩子到文件
$ret
=
@
file_put_contents
(
$tags_file
,
"<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
\n
return "
.
var_export
(
$result
,
true
)
.
";
\n
?>"
);
if
(
$ret
===
false
)
{
return
DataReturn
(
'应用钩子部署失败'
,
-
10
);
}
return
DataReturn
(
'处理成功'
,
0
);
}
/**
* 删除
* @author Devil
...
...
@@ -305,16 +407,16 @@ class PluginsAdminService
return
DataReturn
(
$ret
,
-
1
);
}
// 应用唯一标记
$plugins
=
trim
(
$params
[
'plugins'
]);
// 权限校验
$ret
=
self
::
PowerCheck
(
$plugins
);
$ret
=
self
::
PowerCheck
();
if
(
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
// 应用唯一标记
$plugins
=
trim
(
$params
[
'plugins'
]);
// 应用不存在则添加
$ret
=
self
::
PluginsExistInsert
(
$params
,
$plugins
);
if
(
$ret
[
'code'
]
!=
0
)
...
...
@@ -642,7 +744,7 @@ php;
$temp_plugins
=
Db
::
name
(
'Plugins'
)
->
where
([
'plugins'
=>
$plugins
])
->
value
(
'plugins'
);
if
(
empty
(
$temp_plugins
))
{
if
(
Db
::
name
(
'Plugins'
)
->
insertGetId
([
'plugins'
=>
$plugins
,
'add_time'
=>
time
()])
<=
0
)
if
(
Db
::
name
(
'Plugins'
)
->
insertGetId
([
'plugins'
=>
$plugins
,
'
is_enable'
=>
0
,
'
add_time'
=>
time
()])
<=
0
)
{
return
DataReturn
(
'应用添加失败'
,
-
1
);
}
...
...
@@ -661,9 +763,8 @@ php;
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-09-29T00:01:49+0800
* @param [string] $plugins [应用唯一标记]
*/
private
static
function
PowerCheck
(
$plugins
)
private
static
function
PowerCheck
()
{
// 应用目录
$app_dir
=
APP_PATH
.
'plugins'
;
...
...
@@ -701,5 +802,85 @@ php;
}
return
DataReturn
(
'权限正常'
,
0
);
}
/**
* 应用上传
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-12-19T00:53:45+0800
* @param [array] $params [输入参数]
*/
public
static
function
PluginsUpload
(
$params
=
[])
{
// 文件上传校验
$error
=
FileUploadError
(
'file'
);
if
(
$error
!==
true
)
{
return
DataReturn
(
$error
,
-
1
);
}
// 文件格式化校验
$type
=
array
(
'application/zip'
,
'application/octet-stream'
);
if
(
!
in_array
(
$_FILES
[
'file'
][
'type'
],
$type
))
{
return
DataReturn
(
'文件格式有误,请上传zip压缩包'
,
-
2
);
}
// 权限校验
$ret
=
self
::
PowerCheck
();
if
(
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
// 开始解压文件
$resource
=
zip_open
(
$_FILES
[
'file'
][
'tmp_name'
]);
while
((
$temp_resource
=
zip_read
(
$resource
))
!==
false
)
{
if
(
zip_entry_open
(
$resource
,
$temp_resource
))
{
// 当前压缩包中项目名称
$file
=
zip_entry_name
(
$temp_resource
);
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
strpos
(
$file
,
'__'
)
===
false
)
{
// 拼接路径
if
(
strpos
(
$file
,
'_controller'
)
!==
false
)
{
$file
=
ROOT
.
self
::
$html_path
.
$file
;
}
else
if
(
strpos
(
$file
,
'_static'
)
!==
false
)
{
$file
=
ROOT
.
self
::
$static_path
.
$file
;
}
else
{
continue
;
}
$file
=
str_replace
(
array
(
'_static/'
,
'_html/'
),
''
,
$file
);
// 截取文件路径
$file_path
=
substr
(
$file
,
0
,
strrpos
(
$file
,
'/'
));
// 路径不存在则创建
if
(
!
is_dir
(
$file_path
))
{
mkdir
(
$file_path
,
0777
,
true
);
}
// 如果不是目录则写入文件
if
(
!
is_dir
(
$file
))
{
// 读取这个文件
$file_size
=
zip_entry_filesize
(
$temp_resource
);
$file_content
=
zip_entry_read
(
$temp_resource
,
$file_size
);
file_put_contents
(
$file
,
$file_content
);
}
// 关闭目录项
zip_entry_close
(
$temp_resource
);
}
}
}
return
DataReturn
(
'操作成功'
);
}
}
?>
\ No newline at end of file
application/tags.php
浏览文件 @
6cf07c22
...
...
@@ -10,26 +10,36 @@
// +----------------------------------------------------------------------
// 应用行为扩展定义文件
return
[
// 应用初始化
'app_init'
=>
[],
// 应用开始
'app_begin'
=>
[],
// 模块初始化
'module_init'
=>
[],
// 操作开始执行
'action_begin'
=>
[],
// 视图内容过滤
'view_filter'
=>
[],
// 日志写入
'log_write'
=>
[],
// 应用结束
'app_end'
=>
[],
// 钩子测试
'plugins_common_top'
=>
[
'app\\plugins\\commontopmaxpicture\\Hook'
,
'app\\plugins\\commontopnotice\\Hook'
],
// 用户中心
'plugins_user_center_top'
=>
[
'app\\plugins\\usercentertopnotice\\Hook'
],
];
return
array
(
'app_init'
=>
array
(
),
'app_begin'
=>
array
(
),
'module_init'
=>
array
(
),
'action_begin'
=>
array
(
),
'view_filter'
=>
array
(
),
'app_end'
=>
array
(
),
'log_write'
=>
array
(
),
'plugins_common_top'
=>
array
(
0
=>
'app\\plugins\\commontopmaxpicture\\Hook'
,
1
=>
'app\\plugins\\commontopnotice\\Hook'
,
),
'plugins_user_center_top'
=>
array
(
0
=>
'app\\plugins\\usercentertopnotice\\Hook'
,
),
);
?>
\ No newline at end of file
config/shopxo.sql
浏览文件 @
6cf07c22
此差异已折叠。
点击以展开。
public/static/plugins/css/ttttttsssstest88/admin.css
0 → 100644
浏览文件 @
6cf07c22
h1
{
font-size
:
60px
;
}
.msg
{
font-size
:
38px
;
color
:
#F00
;
}
\ No newline at end of file
public/static/plugins/css/ttttttsssstest88/index.css
0 → 100644
浏览文件 @
6cf07c22
h1
{
font-size
:
60px
;
}
.msg
{
font-size
:
68px
;
color
:
#4CAF50
;
}
\ No newline at end of file
public/static/upload/images/plugins_ttttttsssstest88/2019/02/13/1550050651917730.png
0 → 100644
浏览文件 @
6cf07c22
6.9 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录