示例#1
0
 private function _getUserInfo($uid)
 {
     $userInfo = array('uid' => 0, 'name' => '', 'avatar' => '');
     $user = UserUtils::getUserInfo($uid);
     if (!empty($user)) {
         $userInfo['uid'] = (int) $uid;
         $userInfo['name'] = $user['username'];
         $userInfo['avatar'] = UserUtils::getUserAvatar($uid, 'small');
     }
     return $userInfo;
 }
示例#2
0
 private function _getUserInfo($res, $uid, $puid)
 {
     loadcache('usergroups');
     $space = UserUtils::getUserInfo($puid);
     if (empty($space)) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'space_does_not_exist');
     }
     $spacePro = UserUtils::getUserProfile($puid);
     $spaceCount = DzUserInfo::getCommonMemberCount($puid);
     $space = array_merge($space, $spacePro, $spaceCount);
     $listCount = (int) DzUserInfo::getUserPhotosHomeAlbumCount($puid);
     $res['flag'] = $uid == $puid ? 1 : 0;
     $res['is_black'] = (int) UserUtils::isBlacklist($uid, $puid) ? 1 : 0;
     $res['is_follow'] = (int) UserUtils::isFollow($uid, $puid);
     $res['isFriend'] = (int) UserUtils::isFriend($uid, $puid) ? 1 : 0;
     $res['icon'] = UserUtils::getUserAvatar($puid, $spacePro);
     $res['level_url'] = '';
     $res['name'] = $space['username'];
     $res['email'] = $space['email'];
     $res['status'] = (int) UserUtils::getUserLoginStatus($puid);
     $res['gender'] = (int) UserUtils::getUserGender($puid, $spacePro);
     $res['email'] = $space['email'];
     $res['score'] = (int) $space['credits'];
     $res['credits'] = (int) $space['credits'];
     $res['gold_num'] = (int) $space['extcredits2'];
     $res['topic_num'] = (int) $this->_getHomeTopicNum($puid);
     $res['photo_num'] = (int) $listCount['nums'];
     $res['reply_posts_num'] = (int) DzUserInfo::getTopicsByUidWithPostCount($puid);
     $res['essence_num'] = (int) $space['digestposts'];
     $res['friend_num'] = (int) DzUserInfo::getFollowFriendsCount($puid);
     $res['follow_num'] = (int) DzUserInfo::getFollowedFriendsCount($puid);
     $res['level'] = (int) DzCommonUserList::getUserLevel($space['groupid']);
     $res['userTitle'] = UserUtils::getUserTitle($puid, $space);
     $repeatList = array();
     foreach (UserUtils::getRepeatList($uid) as $user) {
         $repeatList[] = array('userName' => $user);
     }
     $res['body']['repeatList'] = $repeatList;
     $res['body']['profileList'] = $this->_getPersonalDataInfo($puid, $space);
     $res['body']['creditList'] = $this->_getStatisticalInformation($uid, $space);
     $res['body']['creditShowList'] = $this->_getStatisticalInforSet($uid, $space);
     return $res;
 }
 private function _userFollowSetting($res, $followUid)
 {
     global $_G;
     require_once libfile('function/core');
     $special = intval($_GET['special']) ? intval($_GET['special']) : 0;
     $uid = $_G['uid'];
     if ($uid == $followUid) {
         $res = $this->makeErrorInfo($res, 'follow_not_follow_self');
     } else {
         $followUser = getuserbyuid($followUid);
         $mutual = 0;
         $followed = DzUserSettingInfo::getUserSettingInfo($followUid, $uid);
         if (!empty($followed)) {
             if ($followed['status'] == '-1') {
                 $res = $this->makeErrorInfo($res, 'follow_other_unfollow');
             }
             $mutual = 1;
             C::t('home_follow')->update_by_uid_followuid($followUid, $_G['uid'], array('mutual' => 1));
         }
         $followed = DzUserSettingInfo::getUserSettingInfo($uid, $followUid);
         if (empty($followed)) {
             $userInfo = UserUtils::getUserInfo($uid);
             $followInfo = array('uid' => $uid, 'username' => $_G['username'], 'followuid' => $followUid, 'fusername' => $followUser['username'], 'status' => 0, 'mutual' => $mutual, 'dateline' => TIMESTAMP);
             C::t('home_follow')->insert($followInfo, false, true);
             C::t('common_member_count')->increase($uid, array('following' => 1));
             C::t('common_member_count')->increase($followUid, array('follower' => 1, 'newfollower' => 1));
             notification_add($followUid, 'follower', 'member_follow_add', array('count' => $count, 'from_id' => $uid, 'from_idtype' => 'following'), 1);
         } elseif ($special) {
             $status = $special == 1 ? 1 : 0;
             C::t('home_follow')->update_by_uid_followuid($uid, $followUid, array('status' => $status));
             $special = $special == 1 ? 2 : 1;
         } else {
             $res = $this->makeErrorInfo($res, 'follow_followed_ta');
         }
     }
     if ($res['rs'] == 1) {
         $params['noError'] = 1;
         $res = $this->makeErrorInfo($res, 'follow_add_succeed', $params);
     }
     return $res;
 }
示例#4
0
 private function _qqInfo($res, $openId, $oauthToken, $platformId)
 {
     global $_G;
     $password = MOBCENT_HACKER_PASSWORD;
     require_once libfile('function/member');
     if (!empty($platformId) && $platformId == 20) {
         $qqUserInfo = $this->_getQQinfoByOpenId($openId);
         if (isset($qqUserInfo) && !empty($qqUserInfo)) {
             $userInfo = UserUtils::getUserInfo($qqUserInfo['uid']);
             setloginstatus($userInfo, $_GET['cookietime'] ? 2592000 : 0);
             C::t('common_member_status')->update($userInfo['uid'], array('lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP));
             $ipArray = explode('.', $_G['clientip']);
             $sid = FileUtils::getRandomFileName('', 6);
             $data = array('sid' => $sid, 'ip1' => $ipArray[0], 'ip2' => $ipArray[1], 'ip3' => $ipArray[2], 'ip4' => $ipArray[3], 'uid' => $userInfo['uid'], 'username' => $userInfo['username'], 'groupid' => $userInfo['groupid'], 'invisible' => '0', 'action' => '', 'lastactivity' => time(), 'fid' => '0', 'tid' => '0', 'lastolupdate' => '0');
             $comSess = DzCommonSession::getComSessByUid($userInfo['uid']);
             if (!empty($comSess)) {
                 DzCommonSession::delComSess($userInfo['uid']);
             }
             DzCommonSession::insertComSess($data);
             $userAccess = AppbymeUserAccess::loginProcess($userInfo['uid'], $password);
             $res['body']['register'] = 0;
             $res['body']['uid'] = (int) $userInfo['uid'];
             $res['body']['userName'] = (string) $userInfo['username'];
             $res['body']['avatar'] = (string) UserUtils::getUserAvatar($userInfo['uid']);
             $res['body']['token'] = (string) $userAccess['token'];
             $res['body']['secret'] = (string) $userAccess['secret'];
             return $res;
         } else {
             $res['body']['register'] = 1;
             $res['body']['openId'] = (string) $openId;
             $res['body']['oauthToken'] = (string) $oauthToken;
             $res['body']['platformId'] = (int) $platformId;
             return $res;
         }
     }
     // 客户端参数不正确
     return $this->makeErrorInfo($res, 'mobcent_error_params');
 }
 private function _saveInfo($res, $username, $email, $oauthToken, $openId, $gender, $platformId)
 {
     $username = WebUtils::t(rawurldecode($username));
     $email = WebUtils::t(rawurldecode($email));
     $password = MOBCENT_HACKER_PASSWORD;
     $regInfo = UserUtils::register($username, $password, $email, 'qq');
     if ($regInfo['errcode']) {
         return $this->makeErrorInfo($res, $regInfo['message']);
     }
     $uid = $regInfo['info']['uid'];
     $userInfo = UserUtils::getUserInfo($uid);
     $userAccess = AppbymeUserAccess::registerProcess($uid, $password);
     if (!empty($platformId) && $platformId == 20) {
         $qqdata = array('uid' => $uid, 'conuin' => $oauthToken, 'conuinsecret' => '', 'conopenid' => $openId, 'conisfeed' => 1, 'conispublishfeed' => 1, 'conispublisht' => 1, 'conisregister' => 1, 'conisqzoneavatar' => 1, 'conisqqshow' => 1);
         $qqbind = array('mblid' => '', 'uid' => $uid, 'uin' => $openId, 'type' => 1, 'dateline' => time());
         $this->_inserBindlog($qqbind);
         $this->_inserConnect($qqdata);
         $updateInfo = array('avatarstatus' => 1, 'conisbind' => 1);
         // 用户是否绑定QQ
         DzCommonMember::updateMember($updateInfo, array('uid' => $uid));
         $setarr['gender'] = intval($gender);
         C::t('common_member_profile')->update($uid, $setarr);
         $ipArray = explode('.', $_G['clientip']);
         $sid = FileUtils::getRandomFileName('', 6);
         $data = array('sid' => $sid, 'ip1' => $ipArray[0], 'ip2' => $ipArray[1], 'ip3' => $ipArray[2], 'ip4' => $ipArray[3], 'uid' => $userInfo['uid'], 'username' => $userInfo['username'], 'groupid' => $userInfo['groupid'], 'invisible' => '0', 'action' => '', 'lastactivity' => time(), 'fid' => '0', 'tid' => '0', 'lastolupdate' => '0');
         DzCommonSession::insertComSess($data);
         require_once libfile('cache/userstats', 'function');
         build_cache_userstats();
         $res['token'] = (string) $userAccess['token'];
         $res['secret'] = (string) $userAccess['secret'];
         $res['uid'] = (int) $regInfo['info']['uid'];
         return $res;
     }
     // 客户端参数不正确
     return $this->makeErrorInfo($res, 'mobcent_error_params');
 }
示例#6
0
 public function actionUserInfo($uid)
 {
     $user = array_merge(UserUtils::getUserInfo($uid), UserUtils::getUserProfile($uid));
     echo WebUtils::jsonEncode($user);
 }
示例#7
0
 private function _transUserList($users, $viewUid, $longitude, $latitude, $radius, $page, $pageSize, $sortType)
 {
     loadcache('usergroups');
     $list = array();
     foreach ($users as $user) {
         if ($sortType == 'range') {
             $tmpUserInfo['distance'] = (string) $user['distance'];
             $tmpUserInfo['location'] = (string) WebUtils::t($user['location']);
             $uid = $user['uid'];
         } else {
             $tmpUserInfo['distance'] = '';
             $tmpUserInfo['location'] = '';
             $uid = $user;
         }
         $tmpUserInfo['is_friend'] = UserUtils::isFollow($viewUid, $uid) ? 1 : 0;
         $tmpUserInfo['isFriend'] = UserUtils::isFriend($viewUid, $uid) ? 1 : 0;
         $tmpUserInfo['isFollow'] = UserUtils::isFollow($viewUid, $uid) ? 1 : 0;
         $tmpUserInfo['uid'] = (int) $uid;
         $tmpUserInfo['name'] = UserUtils::getUserName($uid);
         $tmpUserInfo['name'] = WebUtils::emptyHtml($tmpUserInfo['name']);
         $tmpUserInfo['status'] = (int) UserUtils::getUserLoginStatus($uid);
         $tmpUserInfo['is_black'] = UserUtils::isBlacklist($viewUid, $uid) ? 1 : 0;
         $tmpUserInfo['gender'] = (int) UserUtils::getUserGender($uid);
         $tmpUserInfo['icon'] = UserUtils::getUserAvatar($uid);
         $tmpUserInfo['level'] = (int) DzCommonUserList::getUserLevel($uid);
         $lastLogin = WebUtils::t(DzCommonUserList::getUserLastVisit($uid));
         $tmpUserInfo['lastLogin'] = $lastLogin . '000';
         if ($sortType == 'regdate') {
             $lastRegdate = DzCommonUserList::getUserLastRegdate($uid);
             $tmpUserInfo['dateline'] = $lastRegdate . '000';
         } else {
             $tmpUserInfo['dateline'] = $lastLogin . '000';
         }
         $signature = WebUtils::emptyHtml(DzCommonUserList::getUserSightml($uid));
         $tmpUserInfo['signature'] = WebUtils::t($signature);
         $userInfo = UserUtils::getUserInfo($uid);
         $tmpUserInfo['credits'] = (int) $userInfo['credits'];
         $list[] = $tmpUserInfo;
     }
     return $list;
 }
示例#8
0
 public static function transPostContentToHtml($post)
 {
     Mobcent::import(sprintf('%s/forum_viewthread_%s.php', MOBCENT_APP_ROOT . '/components/discuz/forum', MobcentDiscuz::getMobcentDiscuzVersion()));
     ForumUtils::initForum($post['fid'], $post['tid']);
     loadcache('usergroups');
     $userInfo = UserUtils::getUserInfo($post['authorid']);
     $post = array_merge($userInfo, $post);
     global $_G;
     // 处理主题价格
     $_G['forum_threadpay'] = FALSE;
     if ($post['first']) {
         if ($_G['forum_thread']['price'] > 0 && $_G['forum_thread']['special'] == 0) {
             if ($_G['setting']['maxchargespan'] && TIMESTAMP - $_G['forum_thread']['dateline'] >= $_G['setting']['maxchargespan'] * 3600) {
                 C::t('forum_thread')->update($_G['tid'], array('price' => 0), false, false, $archiveid);
                 $_G['forum_thread']['price'] = 0;
             } else {
                 $exemptvalue = $_G['forum']['ismoderator'] ? 128 : 16;
                 if (!($_G['group']['exempt'] & $exemptvalue) && $_G['forum_thread']['authorid'] != $_G['uid']) {
                     if (!C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BTC', $_G['tid'])) {
                         require_once libfile('thread/pay', 'include');
                         $_G['forum_threadpay'] = TRUE;
                     }
                 }
             }
         }
     }
     $lastvisit = $_G['member']['lastvisit'];
     $ordertype = $maxposition = 0;
     // 处理附件
     $_G['forum_attachpids'] = $_G['forum_attachtags'] = '';
     $_G['tid'] = $post['tid'];
     // 去掉干扰码
     $_G['forum']['jammer'] = 0;
     $post = viewthread_procpost($post, $lastvisit, $ordertype, $maxposition);
     $postlist[$post['pid']] = $post;
     if ($_G['forum_attachpids'] && !defined('IN_ARCHIVER')) {
         require_once libfile('function/attachment');
         if (is_array($threadsortshow) && !empty($threadsortshow['sortaids'])) {
             $skipaids = $threadsortshow['sortaids'];
         }
         parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, $skipaids);
     }
     if (empty($postlist)) {
         showmessage('post_not_found');
     } elseif (!defined('IN_MOBILE_API')) {
         foreach ($postlist as $pid => $post) {
             // 取出没有插入的附件
             if (!empty($post['imagelist'])) {
                 $postlist[$pid]['message'] .= showattach($post, 1);
             }
             if ($post['attachlist']) {
                 $postlist[$pid]['message'] .= showattach($post);
             }
             $postlist[$pid]['message'] = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $postlist[$pid]['message']);
         }
     }
     if ($post['first'] && $_G['forum_threadpay']) {
         $postlist[$pid]['message'] = $thread['freemessage'];
     }
     // 处理屏蔽
     if (!$_G['forum']['ismoderator'] && $postlist[$pid]['status'] & 1) {
         $postlist[$pid]['message'] = WebUtils::t('该帖被管理员或版主屏蔽');
     }
     return $postlist[$post['pid']];
 }
 private function _saveWxInfo($res, $username, $oauthToken, $password, $openId, $email, $gender, $act, $platformId)
 {
     if ($act == 'register') {
         $regInfo = UserUtils::register($username, $password, $email);
         if ($regInfo['errcode']) {
             return $this->makeErrorInfo($res, $regInfo['message']);
         }
         $uid = $regInfo['info']['uid'];
         $member = UserUtils::getUserInfo($uid);
         $userInfo = AppbymeUserAccess::registerProcess($regInfo['info']['uid'], $password);
         $data = array('uid' => $uid, 'openid' => $openId, 'status' => 1, 'type' => 1);
         AppbymeConnection::insertMobcentWx($data);
         $res['body']['uid'] = (int) $uid;
         $res['body']['token'] = (string) $userInfo['token'];
         $res['body']['secret'] = (string) $userInfo['secret'];
     } elseif ($act == 'bind') {
         global $_G;
         $logInfo = UserUtils::login($username, $password);
         if ($logInfo['errcode']) {
             UserUtils::delUserAccessByUsername($username);
             return $this->makeErrorInfo($res, 'mobcent_bind_error');
         }
         $isBind = AppbymeConnection::getUserBindInfo($_G['uid']);
         if ($isBind) {
             return $this->makeErrorInfo($res, 'mobcent_bind_error_repeat');
         }
         $data = array('uid' => $_G['uid'], 'openid' => $openId, 'status' => 1, 'type' => 1);
         AppbymeConnection::insertMobcentWx($data);
         $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password);
         $userAvatar = UserUtils::getUserAvatar($_G['uid']);
         $res['body']['token'] = (string) $userInfo['token'];
         $res['body']['secret'] = (string) $userInfo['secret'];
         $res['body']['uid'] = (int) $_G['uid'];
         $res['body']['avatar'] = (string) $userAvatar;
         $res['body']['userName'] = (string) $_G['username'];
     }
     return $res;
 }