|
@@ -6,8 +6,7 @@ class Save
|
|
|
private $cate_id;
|
|
|
private $group_id;
|
|
|
private $user_id;
|
|
|
- private $ext = array
|
|
|
- (
|
|
|
+ private $ext = [
|
|
|
1 => 'jpg,png,gif,webp,jpeg',
|
|
|
2 => 'mp3,m4a' ,
|
|
|
3 => 'video,flv,mp4,webm,mov',
|
|
@@ -16,7 +15,7 @@ class Save
|
|
|
6 => 'rar,zip',
|
|
|
7 => 'cer,pfx,pem',
|
|
|
8 => 'exe,msi',
|
|
|
- );
|
|
|
+ ];
|
|
|
private $type = 1;
|
|
|
public function init($id, $cate_id = 1, $group_id = false, $user_id = false)
|
|
|
{
|
|
@@ -37,13 +36,13 @@ class Save
|
|
|
public function get($id)
|
|
|
{
|
|
|
$this->init($id);
|
|
|
- $result = array();
|
|
|
+ $result = [];
|
|
|
$result['id'] = $id;
|
|
|
$result['chunkSize'] = $this->config['chunk'];
|
|
|
$result['path'] = $id;
|
|
|
$result['size'] = $this->config['size'];
|
|
|
$result['accept'] = '';
|
|
|
- $result['mine'] = array();
|
|
|
+ $result['mine'] = [];
|
|
|
$mine = $this->getExtByMine(false, true);
|
|
|
$type = explode(',', $this->config['type']);
|
|
|
foreach ($type as $v) {
|
|
@@ -75,7 +74,7 @@ class Save
|
|
|
$size = 0;
|
|
|
$method = '';
|
|
|
$source_name = '';
|
|
|
- $chunk = array();
|
|
|
+ $chunk = [];
|
|
|
if (is_array($source) && isset($source['tmp_name'])) {
|
|
|
# 文件上传
|
|
|
$type = 1;
|
|
@@ -164,7 +163,7 @@ class Save
|
|
|
$name = $dest_name;
|
|
|
}
|
|
|
$dest = $this->config['id'] . '/' . $this->getDest($name, $ext, $uid);
|
|
|
- $system = Dever::call("manage/common.system", array(false, true, "upload/manage.getFileField"));
|
|
|
+ $system = Dever::call("manage/common.system", [false, true, "upload/manage.getFileField"]);
|
|
|
if ($system && isset($system['database'])) {
|
|
|
$dest = $system['database'] . '/' . $dest;
|
|
|
}
|
|
@@ -223,7 +222,7 @@ class Save
|
|
|
|
|
|
public function after()
|
|
|
{
|
|
|
- $data = Dever::db('rule_after', 'upload')->select(array('rule_id' => $this->config['id']));
|
|
|
+ $data = Dever::db('rule_after', 'upload')->select(['rule_id' => $this->config['id']]);
|
|
|
if ($data) {
|
|
|
foreach ($data as $k => $v) {
|
|
|
$table = '';
|
|
@@ -343,8 +342,7 @@ class Save
|
|
|
if (!$mine) {
|
|
|
return '';
|
|
|
}
|
|
|
- $config = array
|
|
|
- (
|
|
|
+ $config = [
|
|
|
'application/envoy' => 'evy',
|
|
|
'application/fractals' => 'fif',
|
|
|
'application/futuresplash' => 'spl',
|
|
@@ -495,7 +493,7 @@ class Save
|
|
|
'video/webm' => 'webm',
|
|
|
'audio/x-m4a' => 'm4a',
|
|
|
'image/webp' => 'webp',
|
|
|
- );
|
|
|
+ ];
|
|
|
|
|
|
if ($flip) {
|
|
|
$config = array_flip($config);
|