|
|
@ -23,12 +23,15 @@ Class ApiController extends Controller { |
|
|
|
$params = array( |
|
|
|
$params = array( |
|
|
|
'version' => $this->version, |
|
|
|
'version' => $this->version, |
|
|
|
'list' => array( |
|
|
|
'list' => array( |
|
|
|
'列表' => '/api/ls/', |
|
|
|
'验证码图片' => '/api/captcha/', |
|
|
|
|
|
|
|
'登陆' => '/api/login/', |
|
|
|
|
|
|
|
'目录/文件列表' => '/api/ls/', |
|
|
|
|
|
|
|
|
|
|
|
//文件操作 |
|
|
|
//文件操作 |
|
|
|
'重命名' => '/api/rename/', |
|
|
|
'重命名' => '/api/rename/', |
|
|
|
'删除文件' => '/api/delete/', |
|
|
|
'删除文件' => '/api/delete/', |
|
|
|
'移动' => '/api/move/', |
|
|
|
'移动目录/文件' => '/api/move/', |
|
|
|
|
|
|
|
'base64文件上传' => '/api/uploadbase64/', |
|
|
|
|
|
|
|
|
|
|
|
//目录操作 |
|
|
|
//目录操作 |
|
|
|
'创建目录' => '/api/mkdir/', |
|
|
|
'创建目录' => '/api/mkdir/', |
|
|
@ -96,13 +99,12 @@ Class ApiController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$cateId = $this->get('id', $menus[0]['id']); |
|
|
|
$cateId = $this->get('id', $menus[0]['id']); |
|
|
|
$data['menus'] = $menus; |
|
|
|
if (empty($scanResults[$cateId])) { |
|
|
|
|
|
|
|
$err = "目录ID {$cateId} 不存在!"; |
|
|
|
//替换realpath,改为相对路径返回 |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data'), $this->httpStatus['notFound']); |
|
|
|
$basePath = realpath($target); |
|
|
|
|
|
|
|
if (!preg_match('/\/$/', $basePath)) { |
|
|
|
|
|
|
|
$basePath .= '/'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data['menus'] = $menus; |
|
|
|
$data['dirTree'] = $scanResults[$cateId]; |
|
|
|
$data['dirTree'] = $scanResults[$cateId]; |
|
|
|
|
|
|
|
|
|
|
|
$code = 1; |
|
|
|
$code = 1; |
|
|
@ -432,10 +434,10 @@ Class ApiController extends Controller { |
|
|
|
//get captcha code |
|
|
|
//get captcha code |
|
|
|
$userData = $this->getAdmUserData(); |
|
|
|
$userData = $this->getAdmUserData(); |
|
|
|
$captcha_code = !empty($userData['captcha_code']) ? $userData['captcha_code'] : ''; |
|
|
|
$captcha_code = !empty($userData['captcha_code']) ? $userData['captcha_code'] : ''; |
|
|
|
if ($admConfig['captcha'] && empty($captcha_code)) { |
|
|
|
if (!empty($admConfig['captcha']) && empty($captcha_code)) { |
|
|
|
$err = "请刷新网页,如果验证码图片无法显示请联系管理员!"; |
|
|
|
$err = "请刷新网页,如果验证码图片无法显示请联系管理员!"; |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
}else if ($admConfig['captcha'] && !empty($captcha_code) && $captcha != $captcha_code) { |
|
|
|
}else if (!empty($admConfig['captcha']) && !empty($captcha_code) && $captcha != $captcha_code) { |
|
|
|
$err = "验证码不正确,请注意字母大小写!"; |
|
|
|
$err = "验证码不正确,请注意字母大小写!"; |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
|
|
} |
|
|
|
} |
|
|
|