Пример #1
0
 public function allot()
 {
     $username = $_GET['user'];
     $user_id = $_GET['user_id'];
     $uinfo = mod_member::get_oneamdinbyuser_id($user_id);
     if ($uinfo['user_name'] != $username) {
         mod_login::message('对不起,非法操作');
     }
     if ($_POST['submit']) {
         $sright = r_serialize(forrightserialize($_POST['action_code']));
         mod_member::saverights($sright, $user_id);
         mod_login::message('权限赋予成功');
     } else {
         $rightlist = mod_menu::get_user_action();
         $haveright = mod_member::get_right($user_id);
         $role['action_list'] = forunrightserialize(r_unserialize($haveright));
         pm_tpl::assign('priv_arr', $rightlist);
         pm_tpl::assign('role', $role);
         pm_tpl::assign('uinfo', $uinfo);
         pm_tpl::assign('ur_here', '分派权限');
         $action_link = array('href' => '?c=member&a=member_list', 'text' => '管理员列表');
         pm_tpl::assign('action_link', $action_link);
         pm_tpl::display('member_allot');
     }
 }
Пример #2
0
 public static function get_user_menus($user_id, $r = false)
 {
     $right = forunrightserialize(r_unserialize(self::get_right($user_id)));
     $menu = array();
     foreach ($right as $v) {
         $nv = explode('fl111', $v);
         foreach ($nv as $nvv) {
             $menuinfo = pm_db::fetch_result("SELECT * FROM iosadm_menu WHERE actioncode='{$nvv}' AND status=1");
             if (!$menuinfo) {
                 continue;
             }
             /*if($menuinfo['parent_id']) $menu[$menuinfo['parent_id']] = 1;
             		$menu[$menuinfo['menu_id']] = 1;*/
             $menu[] = $menuinfo;
         }
     }
     return $menu;
 }