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