|
|
|
@ -20,6 +20,7 @@ class AdminController extends Controller {
|
|
|
|
|
* 后台控制器初始化
|
|
|
|
|
*/
|
|
|
|
|
protected function _initialize(){
|
|
|
|
|
|
|
|
|
|
// 获取当前用户ID
|
|
|
|
|
if(defined('UID')) return ;
|
|
|
|
|
define('UID',is_login());
|
|
|
|
@ -90,12 +91,11 @@ class AdminController extends Controller {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$map2['uid'] = session("user_auth.uid");
|
|
|
|
|
$res = M('auth_group_access','sys_')->field('uid,group_id')->where($map2)->find();
|
|
|
|
|
$res = SM('auth_group_access','sys_')->field('uid,group_id')->where($map2)->find();
|
|
|
|
|
$map1['id'] = $res['group_id'];
|
|
|
|
|
$res1 = M('auth_group','sys_')->field('title')->where($map1)->find();
|
|
|
|
|
$res1 = SM('auth_group','sys_')->field('title')->where($map1)->find();
|
|
|
|
|
$this->assign('res',$res);
|
|
|
|
|
$this->assign('res1',$res1);
|
|
|
|
|
|
|
|
|
|
$this->assign('__MENU__', $this->getMenus());
|
|
|
|
|
$this->assign('is_admin', IS_ROOT);
|
|
|
|
|
}
|
|
|
|
@ -106,7 +106,7 @@ class AdminController extends Controller {
|
|
|
|
|
{
|
|
|
|
|
$flag =false;
|
|
|
|
|
$id= 0;
|
|
|
|
|
$ruleres = M("auth_rule")->field("id,type")->where("name LIKE '%{$rule}%'")->select();
|
|
|
|
|
$ruleres = SM("auth_rule","sys_")->field("id,type")->where("name LIKE '%{$rule}%'")->select();
|
|
|
|
|
foreach ($ruleres as $k => $v) {
|
|
|
|
|
$checkRule = $this->checkRule($rule,array('eq',$v['type']));
|
|
|
|
|
if(!$checkRule){
|
|
|
|
@ -123,10 +123,10 @@ class AdminController extends Controller {
|
|
|
|
|
$where['pid'] = 0;
|
|
|
|
|
$where['hide'] = 0;
|
|
|
|
|
$where['url'] = array("like",$rulearr[1]."/".$rulearr[2]);
|
|
|
|
|
$second_id = M('Menu')->where($where)->field('id')->find()['id'];
|
|
|
|
|
$second_id = SM('Menu',"sys_")->where($where)->field('id')->find()['id'];
|
|
|
|
|
$where2['pid'] = $second_id;
|
|
|
|
|
$where2['hide'] = 0;
|
|
|
|
|
$menu = M('Menu')->where($where2)->field('id,url')->order('sort asc')->select();
|
|
|
|
|
$menu = SM('Menu',"sys_")->where($where2)->field('id,url')->order('sort asc')->select();
|
|
|
|
|
foreach ($menu as $k=>$v) {
|
|
|
|
|
$to_check_url = $v['url'];
|
|
|
|
|
if( stripos($to_check_url,MODULE_NAME)!==0 ){
|
|
|
|
@ -324,7 +324,7 @@ class AdminController extends Controller {
|
|
|
|
|
if(!C('DEVELOP_MODE')){ // 是否开发者模式
|
|
|
|
|
$where['is_dev'] = 0;
|
|
|
|
|
}
|
|
|
|
|
$menus['main'] = M('Menu')->where($where)->order('sort asc')->field('id,title,url')->select();
|
|
|
|
|
$menus['main'] = SM('Menu','sys_')->where($where)->order('sort asc')->field('id,title,url')->select();
|
|
|
|
|
$menus['child'] = array(); //设置子节点
|
|
|
|
|
foreach ($menus['main'] as $key => $item) {
|
|
|
|
|
|
|
|
|
@ -340,16 +340,16 @@ class AdminController extends Controller {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 查找当前子菜单
|
|
|
|
|
$pid = M('Menu')->where("pid !=0 AND url like '%{$controller}/".ACTION_NAME."%'")->getField('pid');
|
|
|
|
|
$pid = SM('Menu','sys_')->where("pid !=0 AND url like '%{$controller}/".ACTION_NAME."%'")->getField('pid');
|
|
|
|
|
if($pid){
|
|
|
|
|
|
|
|
|
|
// 查找当前主菜单
|
|
|
|
|
$nav = M('Menu')->find($pid);
|
|
|
|
|
$nav = SM('Menu','sys_')->find($pid);
|
|
|
|
|
// if($nav['pid']){
|
|
|
|
|
// $nav = M('Menu')->find($nav['pid']);
|
|
|
|
|
// }
|
|
|
|
|
while ($nav['pid'] != 0) {
|
|
|
|
|
$nav = M('Menu')->find($nav['pid']);
|
|
|
|
|
$nav = SM('Menu','sys_')->find($nav['pid']);
|
|
|
|
|
}
|
|
|
|
|
//var_dump($nav);exit;
|
|
|
|
|
foreach ($menus['main'] as $key => $item) {
|
|
|
|
@ -358,7 +358,7 @@ class AdminController extends Controller {
|
|
|
|
|
if($item['id'] == $nav['id']){
|
|
|
|
|
$menus['main'][$key]['class']='current';
|
|
|
|
|
//生成child树
|
|
|
|
|
$groups = M('Menu')->where(array('group'=>array('neq',''),'pid' =>$item['id']))->order('sort asc')->distinct(true)->getField("group",true);
|
|
|
|
|
$groups = SM('Menu','sys_')->where(array('group'=>array('neq',''),'pid' =>$item['id']))->order('sort asc')->distinct(true)->getField("group",true);
|
|
|
|
|
//获取二级分类的合法url
|
|
|
|
|
$where = array();
|
|
|
|
|
$where['pid'] = $item['id'];
|
|
|
|
@ -366,7 +366,7 @@ class AdminController extends Controller {
|
|
|
|
|
if(!C('DEVELOP_MODE')){ // 是否开发者模式
|
|
|
|
|
$where['is_dev'] = 0;
|
|
|
|
|
}
|
|
|
|
|
$second_urls = M('Menu')->where($where)->getField('id,url');
|
|
|
|
|
$second_urls = SM('Menu','sys_')->where($where)->getField('id,url');
|
|
|
|
|
|
|
|
|
|
if(!IS_ROOT){
|
|
|
|
|
// 检测菜单权限
|
|
|
|
@ -397,7 +397,7 @@ class AdminController extends Controller {
|
|
|
|
|
if(!C('DEVELOP_MODE')){ // 是否开发者模式
|
|
|
|
|
$map['is_dev'] = 0;
|
|
|
|
|
}
|
|
|
|
|
$menuList = M('Menu')->where($map)->field('id,pid,title,url,tip')->order('sort asc')->select();
|
|
|
|
|
$menuList = SM('Menu','sys_')->where($map)->field('id,pid,title,url,tip')->order('sort asc')->select();
|
|
|
|
|
|
|
|
|
|
$menus['child'][$g] = list_to_tree($menuList, 'id', 'pid', 'operater', $item['id']);
|
|
|
|
|
}
|
|
|
|
@ -425,7 +425,7 @@ class AdminController extends Controller {
|
|
|
|
|
return $tree_nodes[$tree];
|
|
|
|
|
}
|
|
|
|
|
if((int)$tree){
|
|
|
|
|
$list = M('Menu')->field('id,pid,title,url,tip,hide')->where('hide = 0')->order('sort asc')->select();
|
|
|
|
|
$list = SM('Menu',"sys_")->field('id,pid,title,url,tip,hide')->where('hide = 0')->order('sort asc')->select();
|
|
|
|
|
foreach ($list as $key => $value) {
|
|
|
|
|
if( stripos($value['url'],MODULE_NAME)!==0 ){
|
|
|
|
|
$list[$key]['url'] = MODULE_NAME.'/'.$value['url'];
|
|
|
|
@ -439,7 +439,7 @@ class AdminController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$nodes = M('Menu')->field('title,url,tip,pid')->order('sort asc')->select();
|
|
|
|
|
$nodes = SM('Menu',"sys_")->field('title,url,tip,pid')->order('sort asc')->select();
|
|
|
|
|
foreach ($nodes as $key => $value) {
|
|
|
|
|
if( stripos($value['url'],MODULE_NAME)!==0 ){
|
|
|
|
|
$nodes[$key]['url'] = MODULE_NAME.'/'.$value['url'];
|
|
|
|
|