Zhu Jinhui 7 роки тому
батько
коміт
efd8ab6f42

+ 57 - 0
demo/private/configure/filetype.config.php

@@ -0,0 +1,57 @@
+<?php
+return array(
+	0 => '7z',
+	1 => 'asp',
+	2 => 'aspx',
+	3 => 'bat',
+	4 => 'bmp',
+	5 => 'chm',
+	6 => 'css',
+	7 => 'db',
+	8 => 'dll',
+	9 => 'doc',
+	10 => 'exe',
+	11 => 'file',
+	12 => 'fla',
+	13 => 'folder',
+	14 => 'gif',
+	15 => 'htm',
+	16 => 'html',
+	17 => 'images',
+	18 => 'index',
+	19 => 'ini',
+	20 => 'jpeg',
+	21 => 'jpg',
+	22 => 'js',
+	23 => 'jsp',
+	24 => 'lnk',
+	25 => 'mdb',
+	26 => 'mov',
+	27 => 'mp3',
+	28 => 'pdf',
+	29 => 'php',
+	30 => 'png',
+	31 => 'ppt',
+	32 => 'psd',
+	33 => 'qt',
+	34 => 'quicktime',
+	35 => 'rar',
+	36 => 'reg',
+	37 => 'rm',
+	38 => 'rmvb',
+	39 => 'shtml',
+	40 => 'swf',
+	41 => 'tif',
+	42 => 'torrent',
+	43 => 'txt',
+	44 => 'vbs',
+	45 => 'video',
+	46 => 'video2',
+	47 => 'video3',
+	48 => 'vsd',
+	49 => 'wmv',
+	50 => 'xls',
+	51 => 'xml',
+	52 => 'xsl',
+	53 => 'zip',
+);

+ 1 - 0
demo/private/configure/router.config.php

@@ -1,5 +1,6 @@
 <?php
 return [
+    //'index:index' => 'dirs:index',
     'home:index' => 'index:index',
     'manage:*' => 'manage\{1}:*'
 ];

+ 12 - 0
demo/private/controller/base.php

@@ -0,0 +1,12 @@
+<?php
+namespace controller;
+
+class base extends \Qii\Base\Controller
+{
+    public $enableDB = true;
+    public $enableView = true;
+    public function indexAction()
+    {
+        parent::__construct();
+    }
+}

+ 18 - 18
demo/private/controller/dirs.php

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

+ 14 - 1
demo/private/controller/index.php

@@ -7,7 +7,16 @@ class index extends \Qii\Base\Controller
     public $enableView = true;
     public function indexAction()
     {
-        return $this->setResponse(new \Qii\Base\Response(array('format' => 'html', 'body' => 'This is html')));
+        $html = [];
+        $html[] = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>示例程序</title><style>ul{list-style:none;}</style></head><body>';
+        $html[] = '<ul>示例程序';
+        $html[] = '<li>><a href="'. _link('dirs.html') .'">文件管理</a></li>';
+        $html[] = '<li>><a href="'. _link('index/dispatch.html') .'">Dispatch</a></li>';
+        $html[] = '<li>><a href="'. _link('index/forward.html') .'">Forward</a></li>';
+        $html[] = '<li>><a href="'. _link('index/display.html') .'">使用指定目录中的模板</a></li>';
+        $html[] = '</ul>';
+        $html[] = '</body></html>';
+        return $this->setResponse(new \Qii\Base\Response(array('format' => 'html', 'body' => join("\n", $html))));
         return;
         $data = array();
         $data['lists'][] = $this->db->getRow('SELECT * FROM ipAddress ORDER BY id DESC LIMIT 1');
@@ -19,12 +28,16 @@ class index extends \Qii\Base\Controller
     
     public function dispatchAction()
     {
+        echo "<p>Dispatch start ". __CLASS__ ."</p>";
         $this->dispatch('test', 'index');
+        echo "<p>Dispatch end ". __CLASS__ ."</p>";
     }
     
     public function forwardAction()
     {
+        echo "<p>This is start section " . __CLASS__ . " Forward</p>";
         $this->setForward('test', 'index');
+        echo "<p>This is end section " . __CLASS__ . " Forward</p>";
     }
 
     public function displayAction()

+ 13 - 0
demo/private/helper/func.php

@@ -0,0 +1,13 @@
+<?php
+function getRequest()
+{
+    return \Qii\Autoloader\Psr4::getInstance()->loadClass('\Qii\Request\Http');
+}
+/**
+ * 生成link
+ * @param string $url
+ */
+function _link($url)
+{
+	return getRequest()->url::getAbsluteUrl($url);
+}

+ 197 - 0
demo/private/helper/tools.php

@@ -0,0 +1,197 @@
+<?php
+namespace helper;
+class tools
+{
+	/**
+	 * 将数组生成树结构
+	 * @param Array $items
+	 * @param String $id
+	 * @param String $pid
+	 * @param String $son
+	 * @return Array
+	 */
+	public static function tree($items, $id = 'cid', $pid = 'pid', $son = 'children')
+	{
+		$tree = array(); //格式化的树
+		$tmpMap = array();  //临时扁平数据
+		foreach ($items as $item) {
+			$tmpMap[$item[$id]] = $item;
+		}
+		foreach ($items as $item) {
+			if ($item[$id] != $item[$pid] && isset($tmpMap[$item[$pid]])) {
+				$tmpMap[$item[$pid]][$son][$item[$id]] = &$tmpMap[$item[$id]];
+			} else {
+				$tree[$item[$id]] = &$tmpMap[$item[$id]];
+			}
+		}
+		return $tree;
+	}
+
+	/**
+	 * 格式化文件大小
+	 */
+	public static function formatSize($bytes, $unit = "", $decimals = 2, $showUnit = true)
+	{
+		$units = array('B' => 0, 'KB' => 1, 'MB' => 2, 'GB' => 3, 'TB' => 4, 'PB' => 5, 'EB' => 6, 'ZB' => 7, 'YB' => 8);
+		$bytes = (int)$bytes;
+		$value = 0;
+		if ($bytes > 0) {
+			if (!array_key_exists($unit, $units)) {
+				$pow = floor(log($bytes) / log(1024));
+				$unit = array_search($pow, $units);
+			}
+			$value = (intval($bytes) / pow(1024, floor($units[$unit])));
+		}
+		if (!is_numeric($decimals) || $decimals < 0) {
+			$decimals = 2;
+		}
+		if ($unit == 'KB' && $value < 0.1) {
+			$decimals = 0;
+		}
+		if ($showUnit) {
+			return sprintf('%.' . $decimals . 'f' . $unit, $value);
+		} else {
+			return sprintf('%.' . $decimals . 'f ', $value);
+		}
+	}
+
+	/**
+	 * 获取用户访问目录路径
+	 * @param string $path 目录
+	 */
+	public static function getVisitPath($path)
+	{
+		$usePath = explode('/', $path);
+		$dirPathes = array();
+		$lastDir = $usePath[0];
+		foreach ($usePath AS $key => $path) {
+			if (!$path) continue;
+			$array = array();
+			$array['name'] = $path;
+			if ($key > 0) {
+				$lastDir = $lastDir . '/' . $path;
+			}
+			$array['path'] = $lastDir;
+			$array['url'] = _link('/dirs?path=' . urlencode($lastDir));
+			$dirPathes[] = $array;
+		}
+		return $dirPathes;
+	}
+
+	public static function fileType($fullPath)
+	{
+		if (is_dir($fullPath)) return 'folder';
+		return pathinfo($fullPath, PATHINFO_EXTENSION);
+	}
+
+	/**
+	 * 是否是图片文件
+	 * @param string $fullPath 文件路径
+	 * @return bool
+	 */
+	public static function isImage($fullPath)
+	{
+		$fileType = self::fileType($fullPath);
+		if (in_array($fileType, array('gif', 'jpg', 'jpeg', 'webp', 'png', 'bmp'))) {
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * 获取目录中文件及目录
+	 * @param string $path 目录
+	 * @return array
+	 */
+	public static function getFolders($path, $filter = '*')
+	{
+		$dir = dir($path);
+		$filetype = _include('../private/configure/filetype.config.php');
+		$files = array();
+		while (($file = $dir->read()) !== false) {
+			if ($file == '.' || $file == '..') continue;
+			$fullPath = str_replace('//', '/', $path . '/' . $file);
+			$isDir = is_dir($fullPath);
+			if ($filter != '*' && !$isDir && !preg_match('/' . $filter . '$/', $file)) continue;
+			$array = array();
+			$type = self::fileType($fullPath);
+			$array['name'] = $file;
+			if (!in_array($type, $filetype)) {
+				$array['icon'] = _link('filetype/unknow.png');
+			} else {
+				$array['icon'] = _link('filetype/' . $type . '.gif');
+			}
+			$array['type'] = is_dir($fullPath) ? 'folder' : 'file';
+			$array['url'] = $array['type'] == 'folder' ? '/dirs?path=' . urlencode($fullPath) : '/dirs/file?file=' . urlencode($fullPath);
+			$array['remove'] = _link('/dirs/remove?file=' . $fullPath . '&isAjax=1');
+			$array['path'] = _link($fullPath);
+			$size = $array['type'] == 'folder' ? '' : filesize($fullPath);
+			$array['size'] = $array['type'] == 'folder' ? '' : \helper\tools::formatSize($size, 'KB');
+			$array['isImage'] = self::isImage($fullPath);
+			//如果文件超过200k就不让直接查看,让下载后查看
+			if ($size > 1024 * 200) {
+				$array['url'] = '/dirs/down?file=' . urlencode($fullPath);
+			}
+			$array['url'] = _link($array['url']);
+			$array['extension'] = $type;
+			$array['createAt'] = filectime($fullPath);
+			$array['updateAt'] = fileatime($fullPath);
+			$files[] = $array;
+
+		}
+		$dir->close();
+		return $files;
+	}
+
+	/**
+	 * 不在指定目录的文件不让删除
+	 *
+	 * @param $file
+	 * @return bool
+	 */
+	public static function allowRemove($file)
+	{
+		$allowFolder = array('tmp', 'tmp/compile');
+		$file = ltrim($file, './');
+
+		foreach ($allowFolder AS $allow) {
+			if (stristr($file, $allow)) return true;
+		}
+		return false;
+	}
+
+	/**
+	 * 删除指定文件夹或文件
+	 * @param $dir
+	 * @return bool
+	 */
+	public static function removeFile($dir)
+	{
+		//只让删除指定文件夹的文件,其他文件夹中的不让删除
+		if (!self::allowRemove($dir)) {
+			return false;
+		}
+
+		if (is_file($dir)) return unlink($dir);
+		$dh = opendir($dir);
+
+		while ($file = readdir($dh)) {
+			if ($file != "." && $file != "..") {
+				$fullpath = $dir . "/" . $file;
+				if (!is_dir($fullpath)) {
+					unlink($fullpath);
+				} else {
+					self::removeFile($fullpath);
+				}
+			}
+		}
+
+		closedir($dh);
+		//删除当前文件夹:
+		if (rmdir($dir)) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+}

Різницю між файлами не показано, бо вона завелика
+ 0 - 1
demo/private/tmp/2017-06-28.loger.log


Різницю між файлами не показано, бо вона завелика
+ 0 - 1
demo/private/tmp/2017-07-03.loger.log


+ 0 - 26
demo/private/tmp/compile/b541b7081a689b2c42974c2e59535e792944d246_0.file.index.tpl.php

@@ -1,26 +0,0 @@
-<?php
-/* Smarty version 3.1.30, created on 2017-06-28 15:56:16
-  from "E:\WebRoot\Qii\private\Controller\view\index.tpl" */
-
-/* @var Smarty_Internal_Template $_smarty_tpl */
-if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
-  'version' => '3.1.30',
-  'unifunc' => 'content_59536120543292_82164805',
-  'has_nocache_code' => false,
-  'file_dependency' => 
-  array (
-    'b541b7081a689b2c42974c2e59535e792944d246' => 
-    array (
-      0 => 'E:\\WebRoot\\Qii\\private\\Controller\\view\\index.tpl',
-      1 => 1498636237,
-      2 => 'file',
-    ),
-  ),
-  'includes' => 
-  array (
-  ),
-),false)) {
-function content_59536120543292_82164805 (Smarty_Internal_Template $_smarty_tpl) {
-?>
-This is tpl from controller dir<?php }
-}

+ 0 - 108
demo/private/tmp/product.app.ini.php

@@ -1,108 +0,0 @@
-<?php 
- return array (
-  'namespace' => 
-  array (
-    'use' => '1',
-    'list' => 
-    array (
-      'controller' => '1',
-      'model' => '1',
-      'library' => '1',
-      'action' => '1',
-    ),
-  ),
-  'rewriteMethod' => 'Short',
-  'rewriteRules' => 'Normal',
-  'admin' => 
-  array (
-    'user' => 'admin',
-    'password' => '119328118',
-  ),
-  'debug' => '1',
-  'errorPage' => 'Error:Index',
-  'timezone' => 'Asia/Shanghai',
-  'contentType' => 'text/html',
-  'charset' => 'UTF-8',
-  'view' => 
-  array (
-    'engine' => 'smarty',
-    'path' => 'view',
-    'smarty' => 
-    array (
-      'view' => 'view',
-      'path' => 'view',
-      'ldelimiter' => '{#',
-      'rdelimiter' => '#}',
-      'compile' => 'tmp/compile',
-      'cache' => 'tmp/cache',
-      'lifetime' => '300',
-    ),
-  ),
-  'cache' => 'memcache',
-  'security' => 
-  array (
-    'enable' => '1',
-    'name' => 'security_sid',
-    'expired' => '3600',
-    'key' => '4cd780a986d5c30e03bdcb67d16c8320',
-  ),
-  'memcache' => 
-  array (
-    'servers' => '127.0.0.1',
-    'ports' => '11211',
-  ),
-  'xpath' => 
-  array (
-    0 => 'controller',
-    1 => 'model',
-    2 => 'class',
-    3 => 'plugin',
-  ),
-  'query' => 
-  array (
-    0 => 'controller',
-    1 => 'action',
-    2 => 'param',
-  ),
-  'controller' => 
-  array (
-    'name' => 'controller',
-    'prefix' => 'controller',
-    'default' => 'index',
-  ),
-  'action' => 
-  array (
-    'name' => 'action',
-    'suffix' => 'Action',
-    'default' => 'index',
-  ),
-  'password' => '119328118',
-  'uri' => 
-  array (
-    'mode' => 'short',
-    'controllerName' => 'controller',
-    'actionName' => 'action',
-    'normal' => 
-    array (
-      'mode' => 'normal',
-      'trim' => '0',
-      'symbol' => '&',
-      'extenstion' => '.html',
-    ),
-    'middle' => 
-    array (
-      'mode' => 'middle',
-      'trim' => '1',
-      'symbol' => '/',
-      'extenstion' => '.html',
-    ),
-    'short' => 
-    array (
-      'mode' => 'short',
-      'trim' => '1',
-      'symbol' => '/',
-      'extenstion' => '.html',
-    ),
-  ),
-)
-?>

+ 0 - 32
demo/private/tmp/product.db.ini.php

@@ -1,32 +0,0 @@
-<?php 
- return array (
-  'readOrWriteSeparation' => '0',
-  'driver' => 'pdo',
-  'debug' => '1',
-  'use_db_driver' => 'mysql',
-  'master' => 
-  array (
-    'db' => 'wecv',
-    'host' => '127.0.0.1',
-    'user' => 'root',
-    'password' => 'A119328118a',
-  ),
-  'slave' => 
-  array (
-    0 => 
-    array (
-      'db' => 'istudy',
-      'host' => '127.0.0.1',
-      'user' => 'wecv',
-      'password' => 'A119328118a',
-    ),
-    1 => 
-    array (
-      'db' => 'istudy',
-      'host' => '127.0.0.1',
-      'user' => 'wecv',
-      'password' => 'A119328118a',
-    ),
-  ),
-)
-?>

+ 12 - 12
demo/private/view/manage/folder/dir.html

@@ -3,24 +3,24 @@
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>文件管理</title>
-    <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("jquery.multiSelect")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.bgiframe.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.multiSelect")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("tips")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getSourceFullUrl("static/layer/layer.js")#}"></script>
+    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/static/layer/layer.js")#}"></script>
 </head>
  <body>
   <div class="place"> 
    <span>位置:</span> 
    <ul class="placeul"> 
     <li><a href="{#$pathes.index#}">首页</a></li> 
-    <li><a href="{#\helper\globals::getFullUrl('/dirs')#}?path={#$defaultPath#}">文件管理</a></li> 
+    <li><a href="{#_link('/dirs')#}?path={#$defaultPath#}">文件管理</a></li> 
     {#foreach item=item from=$visitPathes#}
     <li><a href="{#$item.url#}">{#$item.name#}</a></li>
     {#/foreach#}

+ 13 - 13
demo/private/view/manage/folder/file.html

@@ -3,18 +3,18 @@
 <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     <title>文件管理</title>
-    <link href="{#helper\globals::getCss("style")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("select")#}" rel="stylesheet" type="text/css" />
-    <link href="{#helper\globals::getCss("jquery.multiSelect")#}" rel="stylesheet" type="text/css" />
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.idTabs.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("select-ui.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.bgiframe.min")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("jquery.multiSelect")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("tips")#}"></script>
-    <script type="text/javascript" src="{#helper\globals::getJs("notify-custom.min")#}"></script>
-    <link href="{#\helper\globals::getFullUrl('static/js/google-code-prettify/prettify', '.css')#}" type="text/css" rel="stylesheet" />
-    <script type="text/javascript" src="{#\helper\globals::getFullUrl('static/js/google-code-prettify/prettify', '.js')#}"></script>
+    <link href="{#_link("static/css/style.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/select.css")#}" rel="stylesheet" type="text/css" />
+    <link href="{#_link("static/css/jquery.multiSelect.css")#}" rel="stylesheet" type="text/css" />
+    <script type="text/javascript" src="{#_link("static/js/jquery.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.idTabs.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/select-ui.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.bgiframe.min.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/jquery.multiSelect.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/tips.js")#}"></script>
+    <script type="text/javascript" src="{#_link("static/js/notify-custom.min.js")#}"></script>
+    <link href="{#_link('static/js/google-code-prettify/prettify.css')#}" type="text/css" rel="stylesheet" />
+    <script type="text/javascript" src="{#_link('static/js/google-code-prettify/prettify.js')#}"></script>
     <style>
     pre span{display:inline;font-size:14px;}
     pre.prettyprint{border:0px;}
@@ -25,7 +25,7 @@
    <span>位置:</span> 
    <ul class="placeul"> 
     <li><a href="{#$pathes.index#}">首页</a></li> 
-    <li><a href="{#\helper\globals::getFullUrl('/dirs')#}?path={#$defaultPath#}">文件管理</a></li> 
+    <li><a href="{#_link('/dirs')#}?path={#$defaultPath#}">文件管理</a></li> 
     {#foreach item=item from=$visitPathes#}
     <li><a href="{#$item.url#}">{#$item.name#}</a></li>
     {#/foreach#}

+ 1 - 1
src/Response/Cli.php

@@ -23,7 +23,7 @@ class Cli extends \Qii\Base\Response
      */
     public function stdout($string)
     {
-        $string = iconv('utf-8', 'gbk', $string);
+        if(strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') $string = iconv('utf-8', 'gbk', $string);
         fwrite(\STDOUT, $string);
     }
 }

+ 3 - 3
src/Response/Http.php

@@ -10,7 +10,7 @@ class Http extends \Qii\Base\Response
      * Set HTTP response code to use with headers
      *
      * @param int $code
-     * @return Yaf_Response_Http
+     * @return Qii_Response_Http
      */
     public function setResponseCode($code)
     {
@@ -39,7 +39,7 @@ class Http extends \Qii\Base\Response
      * If an {@link setResponseCode() HTTP response code}
      * has been specified, it is sent with the first header.
      *
-     * @return Yaf_Response_Http
+     * @return Qii_Response_Http
      */
     protected function sendHeaders()
     {
@@ -68,7 +68,7 @@ class Http extends \Qii\Base\Response
      * Sets Location header. Forces replacement of any prior redirects.
      *
      * @param string $url
-     * @return Yaf_Response_Abstract
+     * @return Qii_Response_Abstract
      */
     public function setRedirect($url)
     {

+ 15 - 0
src/Router/Parse/Normal.php

@@ -48,6 +48,7 @@ class Normal
         if (!$this->config) {
             return array('controller' => $controller, 'action' => $action);
         }
+        if($url == '') $url = 'index/index.html';
         $url = ltrim($url, '/');
         $dirName = pathinfo($url, PATHINFO_DIRNAME);
         $dirInfo = explode('/', $dirName);
@@ -56,6 +57,12 @@ class Normal
             $dirInfo = array();
         }
         $dirInfo[] = $fileName;
+        //补全路径
+        if(count($dirInfo) == 1)
+        {
+        	$dirInfo[] = 'index';
+        }
+
         $dir = [];
         $match = ['key' => '', 'val' => '', 'url' => $url];
         if(isset($this->config['*:*'])) {
@@ -67,6 +74,14 @@ class Normal
         }
         foreach ($dirInfo AS $path) {
             $dir[] = $path;
+            $notAll = join($dir, ':');
+            if (isset($this->config[$notAll])) {
+                $config = $this->config[$notAll];
+                //匹配最长的规则
+                if (strlen($config) > strlen($match['val'])) {
+                    $match = array_merge($match, ['key' => $notAll, 'val' => $config]);
+                }
+            }
             $joinPath = join($dir, ':') . ":*";
             if (isset($this->config[$joinPath])) {
                 $config = $this->config[$joinPath];

Деякі файли не було показано, через те що забагато файлів було змінено