コード例 #1
0
ファイル: UserApi.class.php プロジェクト: admpub/OpenCenter
 /**
  * 根据用户ID获取用户名
  * @param  integer $uid 用户ID
  * @return string       用户名
  */
 public static function get_username($uid = 0)
 {
     static $list;
     if (!($uid && is_numeric($uid))) {
         //获取当前登录用户名
         return session('user_auth.username');
     }
     /* 获取缓存数据 */
     if (empty($list)) {
         $list = S('sys_active_user_list');
     }
     /* 查找用户信息 */
     $key = "u{$uid}";
     if (isset($list[$key])) {
         //已缓存,直接使用
         $name = $list[$key];
     } else {
         //调用接口获取用户信息
         $User = new User\Api\UserApi();
         $info = $User->info($uid);
         if ($info && isset($info[1])) {
             $name = $list[$key] = $info[1];
             /* 缓存用户 */
             $count = count($list);
             $max = C('USER_MAX_CACHE');
             while ($count-- > $max) {
                 array_shift($list);
             }
             S('sys_active_user_list', $list);
         } else {
             $name = '';
         }
     }
     return $name;
 }
コード例 #2
0
 public function classlist($classid)
 {
     $auto_login = new \User\Api\UserApi();
     if ($auto_login->AutoLogin()) {
         $isLogin = true;
         if (session('user_role') != 3 && session('user_role') != 4) {
             echo '你没有权限查看班级成员列表';
             return;
         }
     } else {
         $isLogin = false;
     }
     $class = new \Home\Model\ClassModel();
     $classlist = $class->GetMember($classid);
     $this->assign('isLogin', $isLogin);
     $this->assign('classlist', $classlist);
     $this->display();
 }
コード例 #3
0
 public function _initialize()
 {
     $auto_login = new \User\Api\UserApi();
     if ($auto_login->AutoLogin()) {
         // session _ACCESS_LIST
         // print_r($_SESSION);
         if (session('user_role') == 3 || session('user_role') == 4) {
             $this->redirect('/User/Page/intro');
             return;
         }
         $access = \Org\Util\Rbac::AccessDecision();
         if (!$access) {
             $this->error('对不起,您没有访问权限');
         }
     } else {
         $this->redirect('/User/Page/intro');
     }
 }
コード例 #4
0
ファイル: WxuserApi.class.php プロジェクト: bg6aer/amango
 /**
  * 更新微信用户的信息
  * @param  integer $id    用户ID
  * @param  string  $data  要更新的数据
  * @return array          分类信息
  */
 public static function update_info($id = null, $data = null)
 {
     if (empty($id)) {
         return false;
     }
     if (empty($data)) {
         return true;
     }
     $oldpass = self::get_info($id, 'ucpassword,ucmember');
     if (strlen(strtolower($data['ucpassword'])) >= 9 && $oldpass['ucpassword'] != $data['ucpassword']) {
         //同步更改Uenter的密码
         $User = new \User\Api\UserApi();
         $return = $User->updateInfo($id, $oldpass['ucpassword'], array('ucpassword' => $data['ucpassword']));
         if ($return['status'] === false) {
             return false;
         }
     } else {
         unset($data['ucpassword']);
     }
     M('Weixinmember')->where(array('id' => $id))->save($data);
     return true;
 }
コード例 #5
0
 public function logout()
 {
     $user_api = new \User\Api\UserApi();
     $user_api->logout();
     echo 1;
 }
コード例 #6
0
ファイル: tool.php プロジェクト: Luckyseal/amango
/**
* 注册用户信息
* param : $fromusername
* @return echo  id 
*/
function register_weixin($is_auto = false, $fromusername, $username, $password, $email)
{
    $nowtime = time();
    //默认密码
    $password = empty($password) ? rand_simplekeys(9) : $password;
    //默认用户名
    if ($is_auto) {
        $username = rand_simplekeys(9);
        //默认邮箱
        $email = empty($email) ? $username . '@qq.com' : $email;
    } else {
        //默认邮箱
        $email = empty($email) ? rand_simplekeys(9) . '@qq.com' : $email;
    }
    //同步注册Uenter
    $User = new \User\Api\UserApi();
    $uid = $User->register($username, $password, $email);
    if (0 < $uid) {
        //注册成功
        //以后 发送注册成功邮件
        $userdata = array('fromusername' => $fromusername, 'group' => 'general', 'follow' => 1, 'status' => 1, 'sex' => 1, 'lasttime' => $nowtime, 'regtime' => $nowtime, 'ucmember' => $uid, 'ucusername' => $username, 'ucpassword' => $password);
        // //写入 微信用户关注表
        M('Weixinmember')->add($userdata);
        $userinfo = D('WeixinmemberView')->where(array('ucmember' => $uid))->find();
        return $userinfo;
    } else {
        //注册失败,显示错误信息
        switch ($code) {
            case -1:
                $error = '用户名长度必须在16个字符以内!';
                break;
            case -2:
                $error = '用户名被禁止注册!';
                break;
            case -3:
                $error = '用户名被占用!';
                break;
            case -4:
                $error = '密码长度必须在6-30个字符之间!';
                break;
            case -5:
                $error = '邮箱格式不正确!';
                break;
            case -6:
                $error = '邮箱长度必须在1-32个字符之间!';
                break;
            case -7:
                $error = '邮箱被禁止注册!';
                break;
            case -8:
                $error = '邮箱被占用!';
                break;
            case -9:
                $error = '手机格式不正确!';
                break;
            case -10:
                $error = '手机被禁止注册!';
                break;
            case -11:
                $error = '手机号被占用!';
                break;
            default:
                $error = '未知错误';
        }
        wx_error($error);
    }
}
コード例 #7
0
<?php

if (!defined('THINK_PATH')) {
    exit;
}
?>
<!DOCTYPE HTML>
<?php 
$auto_login = new \User\Api\UserApi();
$auto_login->autologin();
if (!IsAdmin()) {
    exit('Permission error');
}
?>
<html class="no-js">
<head>
	<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?php 
echo C('SITE_TITLE');
?>
 Admin Center</title>
  <meta name="description" content="这是一个 index 页面">
  <meta name="keywords" content="index">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="assets/i/favicon.png">
コード例 #8
0
ファイル: function.php プロジェクト: WineShop/wine
function get_email($uid = 0)
{
    if ($uid != 0) {
        $email = M('ucenter_member')->where("id='{$uid}'")->getField("email");
        return $email;
    } else {
        $user = new \User\Api\UserApi();
        $userCache = $user->getUserCache();
        return $userCache['email'];
    }
}