|
@@ -8,12 +8,12 @@ class dirs extends base
|
|
public function __construct()
|
|
public function __construct()
|
|
{
|
|
{
|
|
parent::__construct();
|
|
parent::__construct();
|
|
- $this->_view->assign('defaultPath', $this->defaultPath);
|
|
|
|
|
|
+ $this->view->assign('defaultPath', $this->defaultPath);
|
|
}
|
|
}
|
|
|
|
|
|
public function indexAction()
|
|
public function indexAction()
|
|
{
|
|
{
|
|
- $path = $this->_request->get('path', './');
|
|
|
|
|
|
+ $path = $this->request->get('path', './');
|
|
if (!is_dir($path)) {
|
|
if (!is_dir($path)) {
|
|
$this->showErrorPage('指定文件不存在');
|
|
$this->showErrorPage('指定文件不存在');
|
|
return;
|
|
return;
|
|
@@ -21,12 +21,12 @@ class dirs extends base
|
|
$files = \helper\tools::getFolders($path);
|
|
$files = \helper\tools::getFolders($path);
|
|
$usePath = explode('/', $path);
|
|
$usePath = explode('/', $path);
|
|
$visitPathes = \helper\tools::getVisitPath($path);
|
|
$visitPathes = \helper\tools::getVisitPath($path);
|
|
- $this->_view->assign('visitPathes', $visitPathes);
|
|
|
|
|
|
+ $this->view->assign('visitPathes', $visitPathes);
|
|
$currentPath = array_pop($usePath);
|
|
$currentPath = array_pop($usePath);
|
|
- $this->_view->assign('currentPath', $currentPath);
|
|
|
|
- $this->_view->assign('usePath', join('/', $usePath));
|
|
|
|
- $this->_view->assign('files', $files);
|
|
|
|
- $this->_view->display('manage/folder/dir.html');
|
|
|
|
|
|
+ $this->view->assign('currentPath', $currentPath);
|
|
|
|
+ $this->view->assign('usePath', join('/', $usePath));
|
|
|
|
+ $this->view->assign('files', $files);
|
|
|
|
+ $this->view->display('manage/folder/dir.html');
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -34,7 +34,7 @@ class dirs extends base
|
|
*/
|
|
*/
|
|
public function fileAction()
|
|
public function fileAction()
|
|
{
|
|
{
|
|
- $file = $this->_request->get('file');
|
|
|
|
|
|
+ $file = $this->request->get('file');
|
|
if (!is_file($file)) {
|
|
if (!is_file($file)) {
|
|
$this->showErrorPage($file . '指定文件不存在');
|
|
$this->showErrorPage($file . '指定文件不存在');
|
|
return;
|
|
return;
|
|
@@ -42,28 +42,28 @@ class dirs extends base
|
|
//如果是php、css、js、cpp、.h、java、python文件就直接显示内容,否则下载
|
|
//如果是php、css、js、cpp、.h、java、python文件就直接显示内容,否则下载
|
|
$extension = pathinfo($file, PATHINFO_EXTENSION);
|
|
$extension = pathinfo($file, PATHINFO_EXTENSION);
|
|
if (!in_array($extension, array('php', 'css', 'js', 'html', 'cpp', 'h', 'py', 'java', 'ini'))) {
|
|
if (!in_array($extension, array('php', 'css', 'js', 'html', 'cpp', 'h', 'py', 'java', 'ini'))) {
|
|
- $download = new \Library\download();
|
|
|
|
|
|
+ $download = new \Qii\Library\Download();
|
|
$download->download($file);
|
|
$download->download($file);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
$visitPathes = \helper\tools::getVisitPath(pathinfo($file, PATHINFO_DIRNAME));
|
|
$visitPathes = \helper\tools::getVisitPath(pathinfo($file, PATHINFO_DIRNAME));
|
|
- $this->_view->assign('visitPathes', $visitPathes);
|
|
|
|
- $this->_view->assign('file', pathinfo($file, PATHINFO_BASENAME));
|
|
|
|
|
|
+ $this->view->assign('visitPathes', $visitPathes);
|
|
|
|
+ $this->view->assign('file', pathinfo($file, PATHINFO_BASENAME));
|
|
$usePath = pathinfo($file, PATHINFO_DIRNAME);
|
|
$usePath = pathinfo($file, PATHINFO_DIRNAME);
|
|
- $this->_view->assign('usePath', $usePath);
|
|
|
|
|
|
+ $this->view->assign('usePath', $usePath);
|
|
$content = file_get_contents($file);
|
|
$content = file_get_contents($file);
|
|
$encode = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
|
|
$encode = mb_detect_encoding($content, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
|
|
if ($encode != 'UTF-8') {
|
|
if ($encode != 'UTF-8') {
|
|
$content = mb_convert_encoding($content, 'UTF-8', $encode);
|
|
$content = mb_convert_encoding($content, 'UTF-8', $encode);
|
|
}
|
|
}
|
|
- $this->_view->assign('code', $content);
|
|
|
|
- $this->_view->display('manage/folder/file.html');
|
|
|
|
|
|
+ $this->view->assign('code', $content);
|
|
|
|
+ $this->view->display('manage/folder/file.html');
|
|
}
|
|
}
|
|
|
|
|
|
public function removeAction()
|
|
public function removeAction()
|
|
{
|
|
{
|
|
- $file = $this->_request->get('file');
|
|
|
|
- $isAjax = $this->_request->get('isAjax', 0);
|
|
|
|
|
|
+ $file = $this->request->get('file');
|
|
|
|
+ $isAjax = $this->request->get('isAjax', 0);
|
|
if (!\helper\tools::allowRemove($file)) {
|
|
if (!\helper\tools::allowRemove($file)) {
|
|
$isAjax == 1 ? $this->echoJson(array('code' => 1, 'msg' => '此目录或文件不允许删除')) : $this->showTipsPage('此目录或文件不允许删除');
|
|
$isAjax == 1 ? $this->echoJson(array('code' => 1, 'msg' => '此目录或文件不允许删除')) : $this->showTipsPage('此目录或文件不允许删除');
|
|
return;
|
|
return;
|
|
@@ -81,12 +81,12 @@ class dirs extends base
|
|
*/
|
|
*/
|
|
public function downAction()
|
|
public function downAction()
|
|
{
|
|
{
|
|
- $file = $this->_request->get('file');
|
|
|
|
|
|
+ $file = $this->request->get('file');
|
|
if (!is_file($file)) {
|
|
if (!is_file($file)) {
|
|
$this->showErrorPage($file . '指定文件不存在');
|
|
$this->showErrorPage($file . '指定文件不存在');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- $download = new \Library\download();
|
|
|
|
|
|
+ $download = new \Qii\Library\Download();
|
|
$download->download($file);
|
|
$download->download($file);
|
|
}
|
|
}
|
|
}
|
|
}
|