修复菜单无法通过命令行删除的BUG

修复语言标识可能导致的XSS的BUG
修复路由未对admin模块失效的BUG
pull/16/head
Karson 2017-08-29 19:10:38 +08:00
parent 332e786a83
commit fb6c6bffe2
4 changed files with 4 additions and 5 deletions

View File

@ -31,7 +31,6 @@ class Menu extends Command
{ {
$this->model = new AuthRule(); $this->model = new AuthRule();
$adminPath = dirname(__DIR__) . DS; $adminPath = dirname(__DIR__) . DS;
$moduleName = 'admin';
//控制器名 //控制器名
$controller = $input->getOption('controller') ?: ''; $controller = $input->getOption('controller') ?: '';
if (!$controller) if (!$controller)
@ -47,7 +46,7 @@ class Menu extends Command
throw new Exception("could not delete all menu"); throw new Exception("could not delete all menu");
} }
$ids = []; $ids = [];
$list = $this->model->where('name', 'like', "/{$moduleName}/" . strtolower($controller) . "%")->select(); $list = $this->model->where('name', 'like', strtolower($controller) . "%")->select();
foreach ($list as $k => $v) foreach ($list as $k => $v)
{ {
$output->warning($v->name); $output->warning($v->name);

View File

@ -135,7 +135,7 @@ class Backend extends Controller
} }
// 语言检测 // 语言检测
$lang = Lang::detect(); $lang = strip_tags(Lang::detect());
$site = Config::get("site"); $site = Config::get("site");

View File

@ -30,7 +30,7 @@ class Frontend extends Controller
} }
// 语言检测 // 语言检测
$lang = Lang::detect(); $lang = strip_tags(Lang::detect());
$site = Config::get("site"); $site = Config::get("site");

View File

@ -11,7 +11,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
//如果有定义绑定后台模块则禁用路由规则 //如果有定义绑定后台模块则禁用路由规则
if (defined('BIND_MODULE') && BIND_MODULE == 'admin') if (\think\Route::getBind('module') == 'admin')
return []; return [];
return [ return [