Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
ccf47841
ShopXO
项目概览
jcy2004x
/
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,体验更适合开发者的 AI 搜索 >>
提交
ccf47841
编写于
8月 11, 2021
作者:
D
Devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
zip操作适配php8
上级
14836891
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
317 addition
and
258 deletion
+317
-258
app/service/AppMiniService.php
app/service/AppMiniService.php
+43
-34
app/service/PaymentService.php
app/service/PaymentService.php
+45
-39
app/service/PluginsAdminService.php
app/service/PluginsAdminService.php
+110
-91
app/service/SystemUpgradeService.php
app/service/SystemUpgradeService.php
+50
-46
app/service/ThemeService.php
app/service/ThemeService.php
+65
-47
app/service/UserService.php
app/service/UserService.php
+4
-1
未找到文件。
app/service/AppMiniService.php
浏览文件 @
ccf47841
...
...
@@ -228,53 +228,62 @@ class AppMiniService
}
// 开始解压文件
$resource
=
zip_open
(
$package_file
);
while
((
$temp_resource
=
zip_read
(
$resource
))
!==
false
)
$zip
=
new
\
ZipArchive
();
$resource
=
$zip
->
open
(
$package_file
);
if
(
$resource
!=
true
)
{
if
(
zip_entry_open
(
$resource
,
$temp_resource
))
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
11
);
}
for
(
$i
=
0
;
$i
<
$zip
->
numFiles
;
$i
++
)
{
// 资源文件
$file
=
$zip
->
getNameIndex
(
$i
);
// 排除系统.开头的临时文件和目录
if
(
strpos
(
$file
,
'/.'
)
!==
false
)
{
// 资源文件
$file
=
zip_entry_name
(
$temp_resource
);
continue
;
}
// 排除系统.开头的临时文件和目录
if
(
strpos
(
$file
,
'/.'
)
!==
false
)
// 排除后缀文件
$pos
=
strripos
(
$file
,
'.'
);
if
(
$pos
!==
false
)
{
$info
=
pathinfo
(
$file
);
if
(
isset
(
$info
[
'extension'
])
&&
in_array
(
$info
[
'extension'
],
self
::
$exclude_ext
))
{
continue
;
}
}
// 排除后缀文件
$pos
=
strripos
(
$file
,
'.'
);
if
(
$pos
!==
false
)
{
$info
=
pathinfo
(
$file
);
if
(
isset
(
$info
[
'extension'
])
&&
in_array
(
$info
[
'extension'
],
self
::
$exclude_ext
))
{
continue
;
}
}
// 截取文件路径
$file_path
=
$dir
.
substr
(
$file
,
0
,
strrpos
(
$file
,
'/'
));
// 截取文件路径
$file_path
=
$dir
.
substr
(
$file
,
0
,
strrpos
(
$file
,
'/'
));
// 路径不存在则创建
if
(
!
is_dir
(
$file_path
))
{
mkdir
(
$file_path
,
0777
,
true
);
}
// 路径不存在则创建
if
(
!
is_dir
(
$file_path
))
{
mkdir
(
$file_path
,
0777
,
true
);
}
// 如果不是目录则写入文件
if
(
!
is_dir
(
$dir
.
$file
))
// 如果不是目录则写入文件
if
(
!
is_dir
(
$dir
.
$file
))
{
// 读取这个文件
$stream
=
$zip
->
getStream
(
$file
);
if
(
$stream
!==
false
)
{
// 读取这个文件
$file_size
=
zip_entry_filesize
(
$temp_resource
);
$file_content
=
zip_entry_read
(
$temp_resource
,
$file_size
);
file_put_contents
(
$dir
.
$file
,
$file_content
);
$file_content
=
stream_get_contents
(
$stream
);
if
(
$file_content
!==
false
)
{
file_put_contents
(
$dir
.
$file
,
$file_content
);
}
fclose
(
$stream
);
}
// 关闭目录项
zip_entry_close
(
$temp_resource
);
}
}
// 关闭zip
$zip
->
close
();
return
DataReturn
(
'安装成功'
);
}
...
...
app/service/PaymentService.php
浏览文件 @
ccf47841
...
...
@@ -496,65 +496,71 @@ class PaymentService
}
// 开始解压文件
$resource
=
zip_open
(
$package_file
);
if
(
!
is_resource
(
$resource
))
$zip
=
new
\
ZipArchive
();
$resource
=
$zip
->
open
(
$package_file
);
if
(
$resource
!=
true
)
{
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
1
0
);
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
1
1
);
}
$success
=
0
;
$error
=
0
;
while
((
$temp_resource
=
zip_read
(
$resource
))
!==
false
)
for
(
$i
=
0
;
$i
<
$zip
->
numFiles
;
$i
++
)
{
if
(
zip_entry_open
(
$resource
,
$temp_resource
))
{
// 当前压缩包中项目名称
$file
=
zip_entry_name
(
$temp_resource
);
// 资源文件
$file
=
$zip
->
getNameIndex
(
$i
);
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
strpos
(
$file
,
'__'
)
===
false
)
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
strpos
(
$file
,
'__'
)
===
false
)
{
// 忽略非php文件
if
(
substr
(
$file
,
-
4
)
!=
'.php'
)
{
// 忽略非php文件
if
(
substr
(
$file
,
-
4
)
!=
'.php'
)
{
$error
++
;
continue
;
}
$error
++
;
continue
;
}
// 文件名称
$payment
=
str_replace
(
array
(
'.'
,
'/'
,
'\\'
,
':'
),
''
,
substr
(
$file
,
0
,
-
4
));
// 文件名称
$payment
=
str_replace
(
array
(
'.'
,
'/'
,
'\\'
,
':'
),
''
,
substr
(
$file
,
0
,
-
4
));
// 是否已有存在插件
if
(
file_exists
(
self
::
$payment_dir
.
$payment
))
{
$error
++
;
continue
;
}
else
{
$file
=
self
::
$payment_dir
.
$payment
.
'.php'
;
}
// 是否已有存在插件
if
(
file_exists
(
self
::
$payment_dir
.
$payment
))
{
$error
++
;
continue
;
}
// 如果不是目录则写入文件
if
(
!
is_dir
(
$file
))
// 如果不是目录则写入文件
$new_file
=
self
::
$payment_dir
.
$payment
.
'.php'
;
if
(
!
is_dir
(
$new_file
))
{
// 读取这个文件
$stream
=
$zip
->
getStream
(
$file
);
if
(
$stream
!==
false
)
{
// 读取这个文件
$file_size
=
zip_entry_filesize
(
$temp_resource
);
$file_content
=
zip_entry_read
(
$temp_resource
,
$file_size
);
if
(
@
file_put_contents
(
$file
,
$file_content
)
!==
false
)
$file_content
=
stream_get_contents
(
$stream
);
if
(
$file_content
!==
false
)
{
// 文件校验
$config
=
self
::
GetPaymentConfig
(
$payment
);
if
(
$config
===
false
)
if
(
@
file_put_contents
(
$new_file
,
$file_content
)
!==
false
)
{
$error
++
;
@
unlink
(
$file
);
}
else
{
$success
++
;
// 文件校验
$config
=
self
::
GetPaymentConfig
(
$payment
);
if
(
$config
===
false
)
{
$error
++
;
@
unlink
(
$new_file
);
}
else
{
$success
++
;
}
}
}
fclose
(
$stream
);
}
}
}
}
// 关闭zip
$zip
->
close
();
if
(
$success
>
0
)
{
...
...
app/service/PluginsAdminService.php
浏览文件 @
ccf47841
...
...
@@ -1062,129 +1062,148 @@ php;
$plugins
=
''
;
// 开始解压文件
$resource
=
zip_open
(
$package_file
);
if
(
!
is_resource
(
$resource
))
$zip
=
new
\
ZipArchive
();
$resource
=
$zip
->
open
(
$package_file
);
if
(
$resource
!=
true
)
{
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
1
0
);
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
1
1
);
}
while
((
$temp_resource
=
zip_read
(
$resource
))
!==
false
)
// 文件第一个目录为当前插件名称
$entry
=
$zip
->
statIndex
(
0
);
$file
=
$entry
[
'name'
];
//根据第一个文件是目录,还是包含namespace payment,判断插件类型
if
(
str_ends_with
(
$file
,
'/'
))
{
if
(
zip_entry_open
(
$resource
,
$temp_resource
))
{
// 当前压缩包中项目名称
$file
=
zip_entry_name
(
$temp_resource
);
//获取plugins
$plugins
=
substr
(
$file
,
0
,
strpos
(
$file
,
'/'
));
// 获取包名
if
(
empty
(
$plugins
))
{
// 应用名称
$plugins
=
substr
(
$file
,
0
,
strpos
(
$file
,
'/'
));
if
(
empty
(
$plugins
))
// 业务类型处理
switch
(
$type
)
{
// 上传安装
case
0
:
// 应用不存在则添加
$ret
=
self
::
PluginsVerification
(
$plugins
);
if
(
$ret
[
'code'
]
!=
0
)
{
// 应用名称为空、则校验是否为支付插件
$file_size
=
zip_entry_filesize
(
$temp_resource
);
$file_content
=
zip_entry_read
(
$temp_resource
,
$file_size
);
if
(
stripos
(
$file_content
,
'namespace payment'
)
!==
false
)
{
return
DataReturn
(
'支付插件请到[ 网站管理->支付方式 ]模块里面去上传安装'
,
-
1
);
}
// 不是支付插件则提示插件包错误
return
DataReturn
(
'插件包有误'
,
-
30
);
return
$ret
;
}
//
业务类型处理
switch
(
$type
)
//
应用是否存在
if
(
self
::
PluginsExist
(
$plugins
)
)
{
// 上传安装
case
0
:
// 应用不存在则添加
$ret
=
self
::
PluginsVerification
(
$plugins
);
if
(
$ret
[
'code'
]
!=
0
)
{
zip_entry_close
(
$temp_resource
);
return
$ret
;
}
// 应用是否存在
if
(
self
::
PluginsExist
(
$plugins
))
{
zip_entry_close
(
$temp_resource
);
return
DataReturn
(
'应用名称已存在['
.
$plugins
.
']'
,
-
1
);
}
break
;
return
DataReturn
(
'应用名称已存在['
.
$plugins
.
']'
,
-
1
);
}
break
;
// 更新
case
1
:
// 应用是否存在
if
(
$plugins
!=
$plugins_old
)
{
zip_entry_close
(
$temp_resource
);
return
DataReturn
(
'应用标识与指定不一致['
.
$plugins
.
'<>'
.
$plugins_old
.
']'
,
-
1
);
}
break
;
// 更新
case
1
:
// 应用是否存在
if
(
$plugins
!=
$plugins_old
)
{
return
DataReturn
(
'应用标识与指定不一致['
.
$plugins
.
'<>'
.
$plugins_old
.
']'
,
-
1
);
}
break
;
}
}
else
{
// 应用名称为空、则校验是否为支付插件
$stream
=
$zip
->
getStream
(
$file
);
if
(
$stream
!==
false
)
{
$file_content
=
stream_get_contents
(
$stream
);
if
(
$file_content
!==
false
)
{
if
(
stripos
(
$file_content
,
'namespace payment'
)
!==
false
)
{
return
DataReturn
(
'支付插件请到[ 网站管理->支付方式 ]模块里面去上传安装'
,
-
1
);
}
}
fclose
(
$stream
);
}
// 不是支付插件则提示插件包错误
return
DataReturn
(
'插件包有误'
,
-
30
);
}
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
strpos
(
$file
,
'__'
)
===
false
)
// 应用文件处理
$success
=
0
;
for
(
$i
=
0
;
$i
<
$zip
->
numFiles
;
$i
++
)
{
// 资源文件
$file
=
$zip
->
getNameIndex
(
$i
);
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
strpos
(
$file
,
'__'
)
===
false
)
{
// 文件包对应系统所在目录
$is_has_find
=
false
;
foreach
(
$dir_list
as
$dir_key
=>
$dir_value
)
{
// 文件包对应系统所在目录
$is_has_find
=
false
;
foreach
(
$dir_list
as
$dir_key
=>
$dir_value
)
if
(
strpos
(
$file
,
$dir_key
)
!==
false
)
{
if
(
strpos
(
$file
,
$dir_key
)
!==
false
)
// 仅控制器模块支持php文件
if
(
$dir_key
!=
'_controller_'
)
{
// 仅控制器模块支持php文件
if
(
$dir_key
!=
'_controller_'
)
// 排除后缀文件
$pos
=
strripos
(
$file
,
'.'
);
if
(
$pos
!==
false
)
{
// 排除后缀文件
$pos
=
strripos
(
$file
,
'.'
);
if
(
$pos
!==
false
)
$info
=
pathinfo
(
$file
);
if
(
isset
(
$info
[
'extension'
])
&&
in_array
(
$info
[
'extension'
],
self
::
$exclude_ext
))
{
$info
=
pathinfo
(
$file
);
if
(
isset
(
$info
[
'extension'
])
&&
in_array
(
$info
[
'extension'
],
self
::
$exclude_ext
))
{
continue
;
}
continue
;
}
}
// 匹配成功文件路径处理、跳出循环
$file
=
str_replace
(
$plugins
.
'/'
.
$dir_key
.
'/'
,
''
,
$dir_value
.
$file
);
$is_has_find
=
true
;
break
;
}
}
// 没有匹配到则指定目录跳过
if
(
$is_has_find
==
false
)
{
continue
;
// 匹配成功文件路径处理、跳出循环
$new_file
=
str_replace
(
$plugins
.
'/'
.
$dir_key
.
'/'
,
''
,
$dir_value
.
$file
);
$is_has_find
=
true
;
break
;
}
}
// 截取文件路径
$file_path
=
substr
(
$file
,
0
,
strrpos
(
$file
,
'/'
));
// 没有匹配到则指定目录跳过
if
(
$is_has_find
==
false
)
{
continue
;
}
// 截取文件路径
$file_path
=
substr
(
$new_file
,
0
,
strrpos
(
$new_file
,
'/'
));
// 路径不存在则创建
\
base\FileUtil
::
CreateDir
(
$file_path
);
// 路径不存在则创建
\
base\FileUtil
::
CreateDir
(
$file_path
);
// 如果不是目录则写入文件
if
(
!
is_dir
(
$file
))
// 如果不是目录则写入文件
if
(
!
is_dir
(
$new_file
))
{
// 读取这个文件
$stream
=
$zip
->
getStream
(
$file
);
if
(
$stream
!==
false
)
{
// 读取这个文件
$file_size
=
zip_entry_filesize
(
$temp_resource
);
$file_content
=
zip_entry_read
(
$temp_resource
,
$file_size
);
@
file_put_contents
(
$file
,
$file_content
);
$file_content
=
stream_get_contents
(
$stream
);
if
(
$file_content
!==
false
)
{
if
(
file_put_contents
(
$new_file
,
$file_content
))
{
$success
++
;
}
}
fclose
(
$stream
);
}
// 关闭目录项
zip_entry_close
(
$temp_resource
);
}
}
}
// 关闭zip
$zip
->
close
();
// 未匹配成功一个文件则认为插件包无效
if
(
$success
<=
0
)
{
return
DataReturn
(
'无效的插件包'
,
-
1
);
}
return
DataReturn
(
'success'
,
0
,
$plugins
);
}
...
...
app/service/SystemUpgradeService.php
浏览文件 @
ccf47841
...
...
@@ -134,10 +134,11 @@ class SystemUpgradeService
public
static
function
UpgradePackageHandle
(
$package_file
)
{
// 开始解压文件
$resource
=
zip_open
(
$package_file
);
if
(
!
is_resource
(
$resource
))
$zip
=
new
\
ZipArchive
();
$resource
=
$zip
->
open
(
$package_file
);
if
(
$resource
!=
true
)
{
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
1
0
);
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
1
1
);
}
// 需要处理的文件
...
...
@@ -146,29 +147,29 @@ class SystemUpgradeService
'power.sql'
,
];
while
((
$temp_resource
=
zip_read
(
$resource
))
!==
false
)
for
(
$i
=
0
;
$i
<
$zip
->
numFiles
;
$i
++
)
{
if
(
zip_entry_open
(
$resource
,
$temp_resource
))
{
// 当前压缩包中项目名称
$file
=
zip_entry_name
(
$temp_resource
);
// 资源文件
$file
=
$zip
->
getNameIndex
(
$i
);
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
!
is_dir
(
$file
)
&&
in_array
(
$file
,
$handle_file_arr
))
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
!
is_dir
(
$file
)
&&
in_array
(
$file
,
$handle_file_arr
))
{
// 读取这个文件
$stream
=
$zip
->
getStream
(
$file
);
if
(
$stream
!==
false
)
{
// 读取这个文件
$file_size
=
zip_entry_filesize
(
$temp_resource
);
$file_content
=
zip_entry_read
(
$temp_resource
,
$file_size
);
$file_content
=
stream_get_contents
(
$stream
);
if
(
!
empty
(
$file_content
))
{
SqlConsoleService
::
Implement
([
'sql'
=>
$file_content
]);
}
// 关闭目录项
zip_entry_close
(
$temp_resource
);
fclose
(
$stream
);
}
}
}
// 关闭zip
$zip
->
close
();
return
DataReturn
(
'success'
,
0
);
}
...
...
@@ -185,48 +186,51 @@ class SystemUpgradeService
public
static
function
SystemPackageHandle
(
$package_file
)
{
// 开始解压文件
$resource
=
zip_open
(
$package_file
);
if
(
!
is_resource
(
$resource
))
$zip
=
new
\
ZipArchive
();
$resource
=
$zip
->
open
(
$package_file
);
if
(
$resource
!=
true
)
{
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
1
0
);
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
1
1
);
}
while
((
$temp_resource
=
zip_read
(
$resource
))
!==
false
)
for
(
$i
=
0
;
$i
<
$zip
->
numFiles
;
$i
++
)
{
if
(
zip_entry_open
(
$resource
,
$temp_resource
))
{
// 当前压缩包中项目名称
$file
=
zip_entry_name
(
$temp_resource
);
// 资源文件
$file
=
$zip
->
getNameIndex
(
$i
);
// 排除临时文件和临时目录
if
(
!
empty
(
$file
)
&&
strpos
(
$file
,
'/.'
)
===
false
)
{
// 文件实际位置
$file_new
=
ROOT
.
$file
;
// 排除临时文件和临时目录
if
(
!
empty
(
$file
)
&&
strpos
(
$file
,
'/.'
)
===
false
)
{
// 文件实际位置
$new_file
=
ROOT
.
$file
;
// 截取文件路径
$file_path
=
substr
(
$file_new
,
0
,
strrpos
(
$file_new
,
'/'
));
// 截取文件路径
$file_path
=
substr
(
$new_file
,
0
,
strrpos
(
$new_file
,
'/'
));
// 路径不存在则创建、根目录文件不创建目录
if
(
strpos
(
$file
,
'/'
)
!==
false
)
{
\
base\FileUtil
::
CreateDir
(
$file_path
);
}
// 路径不存在则创建、根目录文件不创建目录
if
(
strpos
(
$file
,
'/'
)
!==
false
)
{
\
base\FileUtil
::
CreateDir
(
$file_path
);
}
// 如果不是目录则写入文件
if
(
!
is_dir
(
$file_new
))
// 如果不是目录则写入文件
if
(
!
is_dir
(
$new_file
))
{
// 读取这个文件
$stream
=
$zip
->
getStream
(
$file
);
if
(
$stream
!==
false
)
{
// 读取这个文件
$file_size
=
zip_entry_filesize
(
$temp_resource
);
$file_content
=
zip_entry_read
(
$temp_resource
,
$file_size
);
@
file_put_contents
(
$file_new
,
$file_content
);
$file_content
=
stream_get_contents
(
$stream
);
if
(
$file_content
!==
false
)
{
file_put_contents
(
$new_file
,
$file_content
);
}
fclose
(
$stream
);
}
// 关闭目录项
zip_entry_close
(
$temp_resource
);
}
}
}
// 关闭zip
$zip
->
close
();
return
DataReturn
(
'success'
,
0
);
}
...
...
app/service/ThemeService.php
浏览文件 @
ccf47841
...
...
@@ -156,70 +156,88 @@ class ThemeService
];
// 开始解压文件
$resource
=
zip_open
(
$package_file
);
while
((
$temp_resource
=
zip_read
(
$resource
))
!==
false
)
$zip
=
new
\
ZipArchive
();
$resource
=
$zip
->
open
(
$package_file
);
if
(
$resource
!=
true
)
{
if
(
zip_entry_open
(
$resource
,
$temp_resource
))
{
// 当前压缩包中项目名称
$file
=
zip_entry_name
(
$temp_resource
);
return
DataReturn
(
'压缩包打开失败['
.
$resource
.
']'
,
-
11
);
}
$success
=
0
;
for
(
$i
=
0
;
$i
<
$zip
->
numFiles
;
$i
++
)
{
// 资源文件
$file
=
$zip
->
getNameIndex
(
$i
);
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
strpos
(
$file
,
'__'
)
===
false
)
// 排除临时文件和临时目录
if
(
strpos
(
$file
,
'/.'
)
===
false
&&
strpos
(
$file
,
'__'
)
===
false
)
{
// 文件包对应系统所在目录
$is_has_find
=
false
;
foreach
(
$dir_list
as
$dir_key
=>
$dir_value
)
{
// 文件包对应系统所在目录
$is_has_find
=
false
;
foreach
(
$dir_list
as
$dir_key
=>
$dir_value
)
if
(
strpos
(
$file
,
$dir_key
)
!==
false
)
{
if
(
strpos
(
$file
,
$dir_key
)
!==
false
)
{
// 匹配成功文件路径处理、跳出循环
$file
=
str_replace
(
$dir_key
.
'/'
,
''
,
$dir_value
.
$file
);
$is_has_find
=
true
;
break
;
}
// 匹配成功文件路径处理、跳出循环
$new_file
=
str_replace
(
$dir_key
.
'/'
,
''
,
$dir_value
.
$file
);
$is_has_find
=
true
;
break
;
}
}
// 没有匹配到则指定目录跳过
if
(
$is_has_find
==
false
)
{
continue
;
}
// 没有匹配到则指定目录跳过
if
(
$is_has_find
==
false
)
{
continue
;
}
// 排除后缀文件
$pos
=
strripos
(
$file
,
'.'
);
if
(
$pos
!==
false
)
// 排除后缀文件
$pos
=
strripos
(
$file
,
'.'
);
if
(
$pos
!==
false
)
{
$info
=
pathinfo
(
$file
);
if
(
isset
(
$info
[
'extension'
])
&&
in_array
(
$info
[
'extension'
],
self
::
$exclude_ext
))
{
$info
=
pathinfo
(
$file
);
if
(
isset
(
$info
[
'extension'
])
&&
in_array
(
$info
[
'extension'
],
self
::
$exclude_ext
))
{
continue
;
}
continue
;
}
}
// 截取文件路径
$file_path
=
substr
(
$file
,
0
,
strrpos
(
$
file
,
'/'
));
// 截取文件路径
$file_path
=
substr
(
$new_file
,
0
,
strrpos
(
$new_
file
,
'/'
));
// 路径不存在则创建
if
(
!
is_dir
(
$file_path
))
{
mkdir
(
$file_path
,
0777
,
true
);
}
// 路径不存在则创建
if
(
!
is_dir
(
$file_path
))
{
mkdir
(
$file_path
,
0777
,
true
);
}
// 如果不是目录则写入文件
if
(
!
is_dir
(
$file
))
// 如果不是目录则写入文件
if
(
!
is_dir
(
$new_file
))
{
// 读取这个文件
$stream
=
$zip
->
getStream
(
$file
);
if
(
$stream
!==
false
)
{
// 读取这个文件
$file_size
=
zip_entry_filesize
(
$temp_resource
);
$file_content
=
zip_entry_read
(
$temp_resource
,
$file_size
);
file_put_contents
(
$file
,
$file_content
);
$file_content
=
stream_get_contents
(
$stream
);
if
(
$file_content
!==
false
)
{
if
(
file_put_contents
(
$new_file
,
$file_content
))
{
$success
++
;
}
}
fclose
(
$stream
);
}
// 关闭目录项
zip_entry_close
(
$temp_resource
);
}
}
}
// 关闭zip
$zip
->
close
();
// 未匹配成功一个文件则认为插件包无效
if
(
$success
<=
0
)
{
return
DataReturn
(
'无效的主题包'
,
-
1
);
}
return
DataReturn
(
'安装成功'
,
0
);
}
...
...
app/service/UserService.php
浏览文件 @
ccf47841
...
...
@@ -2431,7 +2431,10 @@ class UserService
$user
=
(
!
empty
(
$data
)
&&
array_key_exists
(
$user_ids
,
$data
))
?
$data
[
$user_ids
]
:
[];
}
}
else
{
$user
=
self
::
UserHandle
(
$user
);
if
(
!
empty
(
$user
))
{
$user
=
self
::
UserHandle
(
$user
);
}
}
return
$user
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录