|
|
|
@ -49,9 +49,11 @@ Class ApiController extends Controller {
@@ -49,9 +49,11 @@ Class ApiController extends Controller {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function getParentDir($realpath) { |
|
|
|
|
if ($realpath == '/') {return $realpath;} |
|
|
|
|
|
|
|
|
|
$realpath = preg_replace('/\/$/', '', $realpath); |
|
|
|
|
$arr = explode('/', $realpath); |
|
|
|
|
if (count($arr) < 2) {return $realpath;} |
|
|
|
|
if (count($arr) < 2) {return '/';} |
|
|
|
|
|
|
|
|
|
array_pop($arr); |
|
|
|
|
return implode('/', $arr); |
|
|
|
@ -61,6 +63,8 @@ Class ApiController extends Controller {
@@ -61,6 +63,8 @@ Class ApiController extends Controller {
|
|
|
|
|
protected function isParentDirectoryValid($parentDir) { |
|
|
|
|
if (empty($parentDir) || strpos($parentDir, '../') !== false) { |
|
|
|
|
return false; |
|
|
|
|
}else if ($realpath == '/') { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$valid = true; |
|
|
|
@ -288,7 +292,17 @@ Class ApiController extends Controller {
@@ -288,7 +292,17 @@ Class ApiController extends Controller {
|
|
|
|
|
|
|
|
|
|
$target = __DIR__ . '/../www/' . FSC::$app['config']['content_directory']; |
|
|
|
|
try { |
|
|
|
|
//兼容已经存在的目录,则移动进去,而不是重命名 |
|
|
|
|
if ($toDir == '/') { |
|
|
|
|
$basename = $this->basename($fromDir); |
|
|
|
|
$res = rename("{$target}/{$fromDir}", "{$target}/{$basename}"); |
|
|
|
|
}else if (!realpath("{$target}/{$toDir}")) { |
|
|
|
|
$res = rename("{$target}/{$fromDir}", "{$target}/{$toDir}"); |
|
|
|
|
}else { |
|
|
|
|
$basename = $this->basename($fromDir); |
|
|
|
|
$res = rename("{$target}/{$fromDir}", "{$target}/{$toDir}/{$basename}"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($res) { |
|
|
|
|
$code = 1; |
|
|
|
|
$msg = '目录/文件移动完成'; |
|
|
|
@ -340,9 +354,9 @@ Class ApiController extends Controller {
@@ -340,9 +354,9 @@ Class ApiController extends Controller {
|
|
|
|
|
$res = rename("{$target}/{$fromDir}", "{$target}/{$toDir}"); |
|
|
|
|
if ($res) { |
|
|
|
|
$code = 1; |
|
|
|
|
$msg = '目录移动完成'; |
|
|
|
|
$msg = '重命名完成'; |
|
|
|
|
}else { |
|
|
|
|
$err = '目录移动失败,请确认被移动目录存在及目标目录权限配置正确!'; |
|
|
|
|
$err = '重命名失败,请确认被重命名目录/文件存在及目标目录权限配置正确!'; |
|
|
|
|
} |
|
|
|
|
}catch(Exception $e) { |
|
|
|
|
$err = $e->getMessage(); |
|
|
|
@ -409,7 +423,8 @@ Class ApiController extends Controller {
@@ -409,7 +423,8 @@ Class ApiController extends Controller {
|
|
|
|
|
$refresh = (int)$this->post('refresh', 0); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
$builder = new CaptchaBuilder; |
|
|
|
|
$randNumber = rand(10000, 99999); |
|
|
|
|
$builder = new CaptchaBuilder("{$randNumber}"); |
|
|
|
|
$builder->build(); |
|
|
|
|
$captcha_jpg = $builder->get(); |
|
|
|
|
$captcha_code = $builder->getPhrase(); |
|
|
|
@ -724,6 +739,21 @@ Class ApiController extends Controller {
@@ -724,6 +739,21 @@ Class ApiController extends Controller {
|
|
|
|
|
|
|
|
|
|
if (!empty($contentDirectory)) { |
|
|
|
|
$jsonData['content_directory'] = $contentDirectory; |
|
|
|
|
}else { |
|
|
|
|
switch($themeName) { |
|
|
|
|
case 'manual': |
|
|
|
|
$jsonData['content_directory'] = 'content'; |
|
|
|
|
break; |
|
|
|
|
case 'webdirectory': |
|
|
|
|
$jsonData['content_directory'] = 'navs'; |
|
|
|
|
break; |
|
|
|
|
case 'googleimage': |
|
|
|
|
$jsonData['content_directory'] = 'girls'; |
|
|
|
|
break; |
|
|
|
|
case 'videoblog': |
|
|
|
|
$jsonData['content_directory'] = 'videos'; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (file_exists($customConfigFile)) { |
|
|
|
|