Ejemplo n.º 1
0
 public static function getMenuShortCuts()
 {
     $user_info = UserSession::getSessionInfo();
     //功能菜单
     $data = array();
     $data = Module::getAllModule();
     $user_info = UserSession::getSessionInfo();
     //用户的权限
     $access = MenuUrl::getMenuByRole($user_info['user_role']);
     foreach ($data as $k => $module) {
         $list = MenuUrl::getlistByModuleId('shortcut', $module['module_id']);
         if (!$list) {
             unset($data[$k]);
             continue;
         }
         //去除无权限访问的
         foreach ($list as $key => $value) {
             if (!in_array($value['menu_url'], $access)) {
                 unset($list[$key]);
             }
         }
         $data[$k]['menu_list'] = $list;
     }
     return $data;
 }
Ejemplo n.º 2
0
 public static function getProvince($format = false)
 {
     $db = new Medoo(OSA_DB_ID);
     $r = $db->select('province', '*', array('ORDER' => 'pinyin'));
     $tmp = array();
     foreach ($r as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $r = $tmp;
     if ($format) {
         $user_info = UserSession::getSessionInfo();
         $html = '<select name="province" id="DropDownTimezone"><option value="0" id="DropDownTimezone-0">全部</option>';
         if ($user_info && $user_info['province_id'] > 0) {
             $html .= '<option value="' . $user_info['province_id'] . '" id="DropDownTimezone-0">' . $r[$user_info['province_id']]['name'] . '</option>';
         } else {
             foreach ($r as $key => $value) {
                 $html .= '<option value="' . $value['id'] . '" id="DropDownTimezone-0">' . $value['name'] . '</option>';
             }
         }
         $html .= '</select>';
         $r = $html;
     }
     return $r;
 }
Ejemplo n.º 3
0
<?php

header("Content-Type:text/html;charset=utf-8");
require '../include/init.inc.php';
$arr = array('start_date', 'end_date', 'province_id', 'buss_name', 'sp_name', 'sp_corp_code', 'complaint_type', 'question_type', 'complaint_level', 'buss_type', 'sp_code', 'case_id', 'dispute_phone');
$start_date = $end_date = $page_no = $province_id = $buss_name = $sp_name = $sp_corp_code = $complaint_type = $question_type = $complaint_level = $buss_type = $sp_code = $start_date = $end_date = $case_id = $dispute_phone = "";
extract($_GET, EXTR_IF_EXISTS);
$user_info = UserSession::getSessionInfo();
$province_id = $user_info['province_id'] ? $user_info['province_id'] : $province_id;
$menus = MenuUrl::getMenuByIds($user_info['shortcuts']);
foreach ($arr as $key => $value) {
    if (${$value}) {
        $param[$value] = ${$value};
    }
}
$start_date = $param['start_date'] = $_GET['start_date'] = $_GET['start_date'] ? $_GET['start_date'] : date('Y-m');
// if (Common::isPost ()) {
// if($start_date != '' && $end_date !=''){
$page_size = PAGE_SIZE;
$page_no = $page_no < 1 ? 1 : $page_no;
$start = ($page_no - 1) * $page_size;
if ($_GET['download'] == 1) {
    $data['result'] = Complaint::complaintsAnalayze($param, $start, 0);
} else {
    $data['result'] = Complaint::complaintsAnalayze($param, $start, $page_size);
    foreach ($data['result'] as $key => $value) {
        $total['num'] += $value['num'];
        $total['cos'] += $value['cos'];
        $total['wan'] += $value['wan'];
        $total['month'] = date('Y-m', $value['month']);
    }
Ejemplo n.º 4
0
 public static function checkActionAccess()
 {
     $action_url = Common::getActionUrl();
     $user_info = UserSession::getSessionInfo();
     $role_menu_url = MenuUrl::getMenuByRole($user_info['user_role']);
     $search_result = in_array($action_url, $role_menu_url);
     if (!$search_result) {
         Common::exitWithMessage('您当前没有权限访问该功能,如需访问请联系管理员开通权限', 'index.php');
         return true;
     }
 }
Ejemplo n.º 5
0
if (Common::isPost()) {
    if ($real_name == "" || $mobile == "" || $email == "" || $user_id != 1 && $user_group <= 0) {
        OSAdmin::alert("error", ErrorMessage::NEED_PARAM);
    } else {
        $update_data = array('real_name' => $real_name, 'mobile' => $mobile, 'email' => $email, 'user_desc' => $user_desc);
        if ($user_id > 1) {
            $update_data["user_group"] = $user_group;
        }
        if (!empty($password)) {
            if (!preg_match("/^(([a-z]+[0-9]+)|([0-9]+[a-z]+))[a-z0-9]*\$/i", $password)) {
                Common::exitWithError('密码必须由数字和字母的组合而成', '');
            }
            $update_data = array_merge($update_data, array('password' => md5($password)));
        }
        $result = User::updateUser($user_id, $update_data);
        if ($result >= 0) {
            $current_user = UserSession::getSessionInfo();
            $ip = Common::getIp();
            $update_data['ip'] = $ip;
            SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'User', $user_id, json_encode($update_data));
            Common::exitWithSuccess('更新完成', 'complaint/user.php');
        } else {
            OSAdmin::alert("error");
        }
    }
}
$group_options = UserGroup::getGroupForOptions();
unset($group_options[1]);
Template::assign('user', $user);
Template::assign('group_options', $group_options);
Template::display('panel/user_modify.tpl');
Ejemplo n.º 6
0
            } else {
                $user_data['password'] = md5($new);
                User::updateUser($current_user_id, $user_data);
                SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'User', $current_user_id);
                Common::exitWithSuccess(ErrorMessage::PWD_UPDATE_SUCCESS, '/index.php');
            }
        } else {
            OSAdmin::alert("error", ErrorMessage::OLD_PWD_WRONG);
        }
    } else {
        $user_data['real_name'] = $real_name;
        $user_data['mobile'] = $mobile;
        $user_data['email'] = $email;
        $user_data['user_desc'] = $user_desc;
        $user_data['show_quicknote'] = $show_quicknote;
        User::updateUser($current_user_id, $user_data);
        UserSession::reload();
        SysLog::addLog(UserSession::getUserName(), 'MODIFY', 'User', $current_user_id, json_encode($user_data));
        Common::exitWithSuccess('资料修改成功', '/index.php');
    }
}
$quicknoteOptions = array("1" => "显示", "0" => "不显示");
//更新Session里的用户信息
Template::assign("change_password", $change_password);
Template::assign("user_info", UserSession::getSessionInfo());
Template::assign("quicknoteOptions", $quicknoteOptions);
Template::display('panel/profile.tpl');
?>


Ejemplo n.º 7
0
    //for login.php logout.php etc....
} else {
    //else之后 需要验证登录信息
    if (empty($_SESSION[UserSession::SESSION_NAME])) {
        $user_id = User::getCookieRemember();
        if ($user_id > 0) {
            User::loginDoSomething($user_id);
        }
    }
    User::checkLogin();
    User::checkActionAccess();
    $current_user_info = UserSession::getSessionInfo();
    //如果非ajax请求
    if (stripos($_SERVER['SCRIPT_NAME'], "/ajax") === false) {
        //显示菜单、导航条、模板
        $sidebar = SideBar::getTree();
        //是否显示quick note
        if ($current_user_info['show_quicknote']) {
            OSAdmin::showQuickNote();
        }
        $menu = MenuUrl::getMenuByUrl(Common::getActionUrl());
        Template::assign('page_title', $menu['menu_name']);
        Template::assign('content_header', $menu);
        Template::assign('sidebar', $sidebar);
        Template::assign('current_module_id', $menu['module_id']);
        Template::assign('user_info', UserSession::getSessionInfo());
    }
}
Template::assign('osa_templates', $OSA_TEMPLATES);
$sidebarStatus = $_COOKIE['sidebarStatus'] == null ? "yes" : $_COOKIE['sidebarStatus'];
Template::assign('sidebarStatus', $sidebarStatus);