private function _buildSignKey($list)
 {
     $_username = array();
     $_tids = array();
     foreach ($list as $k => $v) {
         $_tids[] = $v['lastpost_tid'];
     }
     $thread = $this->_getThread($_tids);
     foreach ($list as $k => $v) {
         $list[$k]['name'] = $this->_filterForumHtml($v['name']);
         if ($v['type'] == 'category') {
             $list[$k]['forum_url'] = WindUrlHelper::createUrl('bbs/cate/run', array('fid' => $v['fid']), '', 'pw');
         } else {
             $list[$k]['forum_url'] = WindUrlHelper::createUrl('bbs/thread/run', array('fid' => $v['fid']), '', 'pw');
         }
         $list[$k]['descrip'] = $this->_formatDes($v['descrip']);
         $list[$k]['logo'] = $v['logo'] ? Pw::getPath($v['logo']) : '';
         $lastthread = $thread[$v['lastpost_tid']];
         $list[$k]['lastpost_time'] = $this->_formatTime($lastthread['lastpost_time']);
         $list[$k]['lastpost_smallavatar'] = $lastthread['lastpost_userid'] ? Pw::getAvatar($lastthread['lastpost_userid'], 'small') : '';
         $list[$k]['lastpost_middleavatar'] = $lastthread['lastpost_userid'] ? Pw::getAvatar($lastthread['lastpost_userid'], 'middle') : '';
         $list[$k]['lastpost_userid'] = $lastthread['lastpost_userid'];
         $list[$k]['lastpost_username'] = $lastthread['lastpost_username'];
         $list[$k]['lastpost_space'] = $lastthread['lastpost_userid'] ? WindUrlHelper::createUrl('space/index/run', array('uid' => $lastthread['lastpost_userid']), '', 'pw') : '';
         $list[$k]['lastthread_space'] = $lastthread['created_userid'] ? WindUrlHelper::createUrl('space/index/run', array('uid' => $lastthread['created_userid']), '', 'pw') : '';
         $list[$k]['lastthread_smallavatar'] = $lastthread['created_userid'] ? Pw::getAvatar($lastthread['created_userid'], 'small') : '';
         $list[$k]['lastthread_middleavatar'] = $lastthread['created_userid'] ? Pw::getAvatar($lastthread['created_userid'], 'middle') : '';
         $list[$k]['lastthread_username'] = $lastthread['created_username'];
         $list[$k]['lastthread_time'] = $this->_formatTime($lastthread['created_time']);
         $list[$k]['lastthread'] = $this->_formatTitle($lastthread['subject']);
     }
     return $list;
 }
Exemplo n.º 2
0
 public function getAvatarPath($uid)
 {
     if (intval($uid) > 0) {
         return str_replace('_middle', '', Pw::getAvatar($uid));
         //获取头像 √
     } else {
         return null;
     }
 }
Exemplo n.º 3
0
 public function getLastAction()
 {
     $fromid = (int) $this->getInput('fromid', 'get');
     $typeid = (int) $this->getInput('typeid', 'get');
     $_users = array();
     $like = $this->_getLikeContentService()->getInfoByTypeidFromid($typeid, $fromid);
     !$like && $this->showError('BBS:like.fail');
     $uids = $like['users'] ? explode(',', $like['users']) : array();
     $userInfos = Wekit::load('user.PwUser')->fetchUserByUid($uids);
     foreach ($userInfos as $user) {
         if (!$user['uid']) {
             continue;
         }
         $_users[$user['uid']]['uid'] = $user['uid'];
         $_users[$user['uid']]['username'] = $user['username'];
         $_users[$user['uid']]['avatar'] = Pw::getAvatar($user['uid']);
     }
     $this->setOutput($_users, 'data');
     $this->showMessage('BBS:like.success');
 }
Exemplo n.º 4
0
 /**
  * 整理合并贴子内容 
  * 
  * @param mixed $tids 
  * @param mixed $pids 
  * @access public
  * @return void
  */
 public function gather($threadList, $attList)
 {
     if (!is_array($threadList) || !is_array($attList)) {
         return array();
     }
     foreach ($threadList as $key => $thread) {
         $pic_key = $thread['tid'] . '_0';
         $threadList[$key]['pic'] = isset($attList[$pic_key]) ? $attList[$pic_key] : array();
         //列表数据,过滤掉图片及附件url等标签
         $_shareData = Pw::formatContent($threadList[$key]['content']);
         $threadList[$key]['share'] = $_shareData['share'];
         $threadList[$key]['content'] = preg_replace('/(\\[)[^\\]]*$/i', '', mb_substr($_shareData['content'], 0, 90));
         //截字并修正表情标签
         //
         $threadList[$key]['created_user_avatar'] = Pw::getAvatar($threadList[$key]['created_userid'], '');
         //
         $threadList[$key]['lastpost_time'] = Pw::time2str($threadList[$key]['lastpost_time'], 'auto');
     }
     krsort($threadList, SORT_NUMERIC);
     return $threadList;
 }
Exemplo n.º 5
0
 /**
  * 个人设置--绑定设置--页面
  * @see PwProfileExtendsDoBase::createHtml()
  */
 public function createHtml($left, $tab)
 {
     $this->typeFilter = $this->_getCommonService()->getAccountType();
     if ($this->typeFilter === false) {
         return false;
     }
     $res = $this->_getAccountBindDs()->fetchByUidAndTypes($this->uid, $this->typeFilter);
     $bindType = array();
     foreach ($res as $v) {
         $bindType[] = $v['type'];
         $this->bindInfo[$v['type']] = array('isopen' => 1, 'iconClass' => $this->_getAccountTypeService()->getIconClassByType($v['type']));
     }
     $unbindType = array();
     $unbindType = array_diff($this->typeFilter, $bindType);
     foreach ($unbindType as $v) {
         $this->bindInfo[$v] = array('isopen' => 0, 'iconClass' => $this->_getAccountTypeService()->getIconClassByType($v));
     }
     krsort($this->bindInfo);
     $this->avatar = Pw::getAvatar($this->uid, 'small');
     PwHook::template('displayAppProfileAccount', 'EXT:account.template.profile', true, $this);
 }
 public function bulidRead($read)
 {
     $info = array();
     if (!$read['pid']) {
         $info = Wekit::load('like.PwLikeContent')->getInfoByTypeidFromid(PwLikeContent::THREAD, $read['tid']);
     }
     if ($read['pid'] == 0 && $info['users']) {
         $uids = explode(',', $info['users']);
         if (count($uids) > 10) {
             $uids = array_slice($uids, 0, 10);
         }
         $users = Wekit::load('user.PwUser')->fetchUserByUid($uids);
         foreach ($uids as $uid) {
             if (!$uid) {
                 continue;
             }
             $read['lastLikeUsers'][$uid]['uid'] = $uid;
             $read['lastLikeUsers'][$uid]['username'] = $users[$uid]['username'];
             $read['lastLikeUsers'][$uid]['avatar'] = Pw::getAvatar($uid);
         }
     }
     return $read;
 }
Exemplo n.º 7
0
 /**
 * 帖子点赞的用户
 * @access public
 * @return string
 * @example
 <pre>
 /index.php?m=native&c=read&a=likeusers&tid=21&page=1&_json=1
 cookie:usersession
 response: {err:"",data:""}  
 </pre>
 */
 public function likeUsersAction()
 {
     $tid = $this->getInput('tid');
     $page = $this->getInput('page');
     $page || ($page = 1);
     $perpage = 30;
     $start = ($page - 1) * $perpage;
     $res = Wekit::loadDao('native.dao.PwNativeLikeContentDao')->getLikeidByFromid($tid);
     $likeUsers = array();
     $count = 0;
     if (isset($res['likeid'])) {
         $count = Wekit::loadDao('native.dao.PwNativeLikeLogDao')->getLikeCount($res['likeid']);
         $uids = Wekit::loadDao('native.dao.PwNativeLikeLogDao')->fetchUidsByLikeid($res['likeid'], $start, $perpage);
         $res = Wekit::loadDao('user.dao.PwUserDao')->fetchUserByUid($uids);
         foreach ($res as $v) {
             $likeUsers[] = array('uid' => $v['uid'], 'username' => $v['username'], 'avatar' => Pw::getAvatar($v['uid'], 'small'));
         }
     }
     $data = array('likeUsers' => $likeUsers, 'pageCount' => ceil($count / $perpage) > 0 ? ceil($count / $perpage) : 1);
     $this->setOutput($data, 'data');
     $this->showMessage('success');
 }
 /**
  * 构建模板用的标签
  *
  * @param array $list
  * @return string
  */
 private function _buildSignKey($list)
 {
     $clear = array();
     /* @var $userGroupSrv PwUserGroupsService */
     $userGroupSrv = Wekit::load('usergroup.srv.PwUserGroupsService');
     /* @var $workDs PwWork */
     $workDs = Wekit::load('work.PwWork');
     /* @var $educateDs PwEducation */
     $educateDs = Wekit::load('education.PwEducation');
     $location = $hometown = $schoolids = $_areaid = array();
     foreach ($list as $_uid => $_item) {
         $_one = array();
         $_one['uid'] = $_item['uid'];
         $_one['username'] = $_item['username'];
         $_one['url'] = WindUrlHelper::createUrl('space/index/run', array('uid' => $_item['uid']), '', 'pw');
         $_one['smallavatar'] = Pw::getAvatar($_uid, 'small');
         $_one['middleavatar'] = Pw::getAvatar($_uid, 'middle');
         $_one['bigavatar'] = Pw::getAvatar($_uid, 'big');
         $_one['regdate'] = $this->_formatTime($_item['regdate']);
         $_one['lastvisit'] = $this->_formatTime($_item['lastvisit']);
         $_one['posts'] = $_item['postnum'];
         $_one['topics'] = $_item['postnum'];
         //主题数
         $_one['digests'] = $_item['digest'];
         $_one['compositePoint'] = $userGroupSrv->getCredit($_item);
         $_one['realname'] = $_item['realname'];
         $_one['sex'] = !in_array($_item['gender'], array(0, 1)) ? '未知' : ($_item['gender'] == 0 ? '男' : '女');
         $_one['birthYear'] = $_item['byear'];
         $_one['birthMonth'] = $_item['bmonth'];
         $_one['birthDay'] = $_item['bday'];
         $_one['homepage'] = $_item['homepage'];
         $_one['profile'] = $_item['profile'];
         $_one['alipay'] = $_item['alipay'];
         $_one['mobile'] = $_item['mobile'];
         $_one['telphone'] = $_item['telphone'];
         $_one['address'] = $_item['address'];
         $_one['zipcode'] = $_item['zipcode'];
         $_one['email'] = $_item['email'];
         $_one['aliww'] = $_item['aliww'];
         $_one['qq'] = $_item['qq'];
         $_one['msn'] = $_item['msn'];
         $_one['worklist'] = $this->_buildWork($workDs, $_uid);
         list($_schoolids, $_one['educationlist']) = $this->_buildEducation($educateDs, $_uid);
         $schoolids += $_schoolids;
         $_one['home_province'] = $_one['home_city'] = $_one['home_area'] = '';
         $_one['locate_province'] = $_one['locate_city'] = $_one['locate_area'] = '';
         $location[$_uid] = $_item['location'];
         $hometown[$_uid] = $_item['hometown'];
         $_areaid[] = $_item['location'];
         $_areaid[] = $_item['hometown'];
         $clear[$_uid] = $_one;
     }
     //家庭和居住地
     $areaSrv = WindidApi::api('area');
     $areaList = $areaSrv->fetchAreaInfo(array_unique($_areaid));
     //学校列表
     $schoolSrv = WindidApi::api('school');
     $schoolList = $schoolSrv->fetchSchool($schoolids);
     foreach ($clear as $_uid => $_item) {
         if ($hometown[$_uid] && isset($areaList[$hometown[$_uid]])) {
             $_temp = explode(' ', $areaList[$hometown[$_uid]], 3);
             $clear[$_uid]['home_province'] = $_temp[0];
             isset($_temp[1]) && ($clear[$_uid]['home_city'] = $_temp[1]);
             isset($_temp[2]) && ($clear[$_uid]['home_area'] = $_temp[2]);
         }
         if ($location[$_uid] && isset($areaList[$location[$_uid]])) {
             $_temp = explode(' ', $areaList[$location[$_uid]], 3);
             $clear[$_uid]['locate_province'] = $_temp[0];
             isset($_temp[1]) && ($clear[$_uid]['locate_city'] = $_temp[1]);
             isset($_temp[2]) && ($clear[$_uid]['locate_area'] = $_temp[2]);
         }
         if ($_item['educationlist']) {
             $_temp = array();
             foreach ($_item['educationlist'] as $_i) {
                 if (isset($schoolList[$_i['schoolid']])) {
                     $_i['school'] = $schoolList[$_i['schoolid']]['name'];
                     unset($_i['schoolid']);
                     $_temp[] = $_i;
                 }
             }
             $clear[$_uid]['educationlist'] = $_temp;
         }
     }
     return $clear;
 }
Exemplo n.º 9
0
 /**
  * 获取列表页展示的帖子数据
  */
 public function fetchThreadsList($tids, $uid = 0, $result_type = 'ASSOC')
 {
     if (!$tids) {
         return array();
     }
     Wind::import('SRV:like.PwLikeContent');
     $threads = Wekit::loadDao('native.dao.PwNativeThreadsDao')->fetchThreads($tids);
     $threads_place = Wekit::loadDao('native.dao.PwThreadsPlaceDao')->fetchByTids($tids);
     $threads_content = Wekit::loadDao('forum.dao.PwThreadsContentDao')->fetchThread($tids);
     $PwThreadService = Wekit::load('forum.srv.PwThreadService');
     $PwNativeThreadService = Wekit::load('native.PwNativeThread');
     $threadLikeData = Wekit::load('like.srv.reply.do.PwLikeDoReply')->getAllLikeUserids(PwLikeContent::THREAD, $tids);
     foreach ($threadLikeData as $k => $v) {
         if (!in_array($uid, $v)) {
             unset($threadLikeData[$k]);
         }
     }
     $tag_names_str = '';
     foreach ($threads as $k => $v) {
         $content = isset($threads_content[$k]['content']) ? $threads_content[$k]['content'] : '';
         $threads[$k]['tags'] = $threads[$k]['tags_origin'] = isset($threads_content[$k]['tags']) ? $threads_content[$k]['tags'] : '';
         $threads[$k]['from_type'] = isset($threads_place[$k]['from_type']) ? $threads_place[$k]['from_type'] : 0;
         $threads[$k]['created_address'] = isset($threads_place[$k]['created_address']) ? $threads_place[$k]['created_address'] : '';
         $threads[$k]['area_code'] = isset($threads_place[$k]['area_code']) ? $threads_place[$k]['area_code'] : '';
         $threads[$k]['tags'] && ($tag_names_str .= ',' . $threads[$k]['tags']);
         $threads[$k]['avatar'] = Pw::getAvatar($v['created_userid'], 'small');
         $threads[$k]['created_time'] = Pw::time2str($v['created_time'], 'auto');
         $threads[$k]['lastpost_time'] = Pw::time2str($v['lastpost_time'], 'auto');
         preg_match("/\\[mp3.*?\\].*?\\[\\/mp3\\]/i", $content, $matches);
         $threads[$k]['have_mp3'] = $matches ? true : false;
         preg_match("/\\[flash.*?\\].*?\\[\\/flash\\]/i", $content, $matches);
         $threads[$k]['have_flash'] = $matches ? true : false;
         $format_content = Pw::formatContent($content);
         //格式化移动端帖子内容去除ubb标签、分享链接内容、推广链接内容
         $threads[$k]['isliked'] = isset($threadLikeData[$k]) ? true : false;
         $imgs = array_shift($PwNativeThreadService->getThreadAttach(array($k), array(0)));
         ksort($imgs);
         $imgs = array_slice($imgs, 0, 9);
         foreach ($imgs as $imgs_k => $imgs_v) {
             $imgs[$imgs_k]['realpath'] = str_replace("/thumb/mini", "", $imgs_v['path']);
         }
         $threads[$k]['content'] = array('text' => preg_replace('/(\\[)[^\\]]*$/i', '', Pw::substrs($format_content['content'], 70, 0, false)), 'imgs' => $imgs, 'share' => $format_content['share'], 'origin_content' => $content, 'format_content' => $format_content);
     }
     $tag_names_arr = array_unique(explode(',', trim($tag_names_str, ',')));
     $tag_names = Wekit::loadDao('tag.dao.PwTagDao')->getTagsByNames($tag_names_arr);
     //        var_dump($tag_names);exit;
     foreach ($threads as $k => $v) {
         if ($v['tags']) {
             $tag_arr = explode(',', $v['tags']);
             $tag_tmp = array();
             foreach ($tag_arr as $name) {
                 array_key_exists($name, $tag_names) && ($tag_tmp[] = array('tag_id' => $tag_names[$name]['tag_id'], 'tag_name' => $name));
             }
             $threads[$k]['tags'] = $tag_tmp;
         }
     }
     $threads_tmp = array();
     $sort_num = 0;
     if ($result_type == 'ASSOC') {
         //按照tids的顺序重新排序结果集,tid作为索引
         foreach ($tids as $v) {
             if (isset($threads[$v])) {
                 $threads_tmp[$v] = $threads[$v];
                 $threads_tmp[$v]['sort'] = $sort_num++;
             }
         }
     } else {
         //tid会有重复的情况,置顶帖在列表中显示2次,数字顺序索引
         foreach ($tids as $v) {
             if (isset($threads[$v])) {
                 $threads[$v]['sort'] = $sort_num++;
                 $threads_tmp[] = $threads[$v];
             }
         }
     }
     //        print_r($threads_tmp);exit;
     return $threads_tmp;
 }
Exemplo n.º 10
0
 /**
  * 获取对话消息列表
  *
  * @param int $dialogId
  * @param int $start
  * @param int $limit
  * @return array
  */
 public function getMessageAndReply($dialogId, $offset, $limit)
 {
     list($dialogId, $offset, $limit) = array(intval($dialogId), intval($offset), intval($limit));
     if ($dialogId < 1) {
         return $this->buildResponse(MESSAGE_INVALID_PARAMS);
     }
     list($count, $dialogResult) = $this->getPwMessageService()->getDialogMessageList($dialogId, $limit, $offset);
     if ($dialogResult instanceof PwError) {
         return $this->buildResponse(-1, $dialogResult->getError());
     }
     $result = array();
     $dialogResult = array_values($dialogResult);
     foreach ($dialogResult as $k => $v) {
         $result[$k]['messageid'] = $v['message_id'];
         $result[$k]['uid'] = $v['from_uid'];
         $result[$k]['username'] = PwUserBo::getInstance($v['uid'])->username;
         $result[$k]['icon'] = Pw::getAvatar($v['from_uid']);
         $result[$k]['postdate'] = $v['created_time'];
         $result[$k]['content'] = $v['content'];
         $result[$k]['id'] = $v['id'];
         //dialog和message的关系id
         $result[$k]['dialog_id'] = $dialogId;
         $result[$k]['is_read'] = $v['is_read'];
         $result[$k]['from_username'] = $v['from_username'];
     }
     return $this->buildResponse(0, array('count' => $count, 'dialog' => $result));
 }
 /**
  * 获取用户(A)在帖子(B)中的回复
  *
  * @param int $tid
  * @param int $uid
  * @param int $limit
  * @param int $offset
  * @return array
  */
 public function getPostByTidAndUid($tid, $uid, $offset, $limit)
 {
     list($uid, $tid, $offset, $limit) = array(intval($uid), intval($tid), intval($offset), intval($limit));
     $user = PwUserBo::getInstance($uid);
     if (!$user->username) {
         return $this->buildResponse(THREAD_USER_NOT_EXIST, "用户不存在");
     }
     $postResult = $this->_getThread()->getPostByTidAndUid($tid, $uid, $limit, $offset);
     if ($postResult instanceof PwError) {
         return $this->buildResponse(-1, $postResult->getError());
     }
     $postResult = array_values($postResult);
     $count = $this->_getThread()->countPostByTidAndUid($tid, $uid);
     $result = array();
     foreach ($postResult as $k => $v) {
         $result[$k]['pid'] = $v['pid'];
         $result[$k]['tid'] = $v['tid'];
         $result[$k]['author'] = $uid;
         $result[$k]['authorid'] = $user->username;
         $result[$k]['subject'] = $v['subject'];
         $result[$k]['postdate'] = $v['created_time'];
         $result[$k]['icon'] = Pw::getAvatar($uid);
         $result[$k]['content'] = $v['content'];
         $result[$k]['attachlist'] = '';
         $result[$k]['fid'] = $v['fid'];
     }
     return $this->buildResponse(0, array('count' => $count, 'posts' => $result));
 }
Exemplo n.º 12
0
 /**
  * 我关注的人
  * @access public
  * @return void
  * @example
  * <pre>
  * /index.php?m=native&c=Space&a=follow&page=1 <br>
  * </pre>
  */
 public function followAction()
 {
     $page = intval($this->getInput('page', 'get'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $typeCounts = $this->_getAttentionTypeDs()->countUserType($this->uid);
     $follows = $this->_getPwAttentionDs()->getFollows($this->uid, $limit, $start);
     //
     $userBo = new PwUserBo($this->uid);
     $followsCount = $userBo->info['follows'];
     $uids = array_keys($follows);
     $fans = $this->_getPwAttentionDs()->fetchFans($this->uid, $uids);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN);
     if ($userList) {
         foreach ($userList as $key => $user) {
             $userList[] = array('uid' => $user['uid'], 'username' => $user['username'], 'avatar' => Pw::getAvatar($user['uid'], 'small'));
             unset($userList[$key]);
         }
     }
     $data = array('pageCount' => ceil($followsCount / $perpage), 'userList' => $userList);
     $this->setOutput($data, 'data');
     $this->showMessage('success');
 }
Exemplo n.º 13
0
 /**
  * 获得基本用户信息 
  * 
  * @param mixed $uid 
  * @access private
  * @return void
  */
 protected function _getUserInfo($laiwangOK = true)
 {
     //
     $_userInfo = $this->_getUserAllInfo(PwUser::FETCH_MAIN + PwUser::FETCH_INFO);
     //登录成功后,加密身份key
     $_idInfo = array('username' => $_userInfo['username'], 'password' => $_userInfo['password']);
     $securityKey = Pw::encrypt(serialize($_idInfo), $this->_securityKey);
     //laiwang
     $wk_setting = PwLaiWangSerivce::$wk_setting;
     $wk_setting['openid'] = $_userInfo['uid'];
     $wk_setting['secretToken'] = PwLaiWangSerivce::getSecretToken($_userInfo['uid'], $_userInfo['password']);
     // 是否已经成功同步用户到来往
     $wk_setting['laiwangOK'] = $laiwangOK;
     //返回数据
     $_data = array('securityKey' => $securityKey, 'userinfo' => array('uid' => $_userInfo['uid'], 'username' => $_userInfo['username'], 'avatar' => Pw::getAvatar($_userInfo['uid'], 'big'), 'gender' => $_userInfo['gender']), 'laiwangSetting' => $wk_setting);
     return $_data;
 }
Exemplo n.º 14
0
 /**
 * 开放帐号注册到本系统内
 *
 * @access public
 * @return void
 * @example
 <pre>
 os可以是android或者ios <br>
 post: access_token&platformname&native_name&username&email&sex
 </pre>
 */
 public function openAccountRegisterAction()
 {
     //        if($this->_getUserOpenAccountDs()->addUser(56,56,56)==false){
     //        if(true){
     //            echo "true";
     //            $this->downloadThirdPlatformAvatar(59,"http://q.qlogo.cn/qqapp/1104230675/A773C383D93AAF2986157BA34965A5CD/100");
     //        }else{
     //            echo "false";
     //        }
     //        exit;
     $accountData = $this->authThirdPlatform();
     //
     list($username, $email, $sex) = $this->getInput(array('username', 'email', 'sex'));
     //随机密码
     $password = substr(str_shuffle('abcdefghigklmnopqrstuvwxyz1234567890~!@#$%^&*()'), 0, 7);
     //
     Wind::import('SRC:service.user.dm.PwUserInfoDm');
     $userDm = new PwUserInfoDm();
     $userDm->setUsername($username);
     $userDm->setPassword($password);
     $userDm->setEmail($email);
     $userDm->setGender($sex);
     $userDm->setRegdate(Pw::getTime());
     $userDm->setLastvisit(Pw::getTime());
     $userDm->setRegip(Wind::getComponent('request')->getClientIp());
     //
     $registerService = new PwRegisterService();
     $registerService->setUserDm($userDm);
     /*[u_regsiter]:插件扩展*/
     $this->runHook('c_register', $registerService);
     if (($info = $registerService->register()) instanceof PwError) {
         $this->showError($info->getError());
     } else {
         // 这里注册成功,要把第三方帐号的头像下载下来并处理
         // 这里取了lastInsertId,但已经指定了主键的值,所以返回false表示成功
         if ($this->_getUserOpenAccountDs()->addUser($info['uid'], $accountData['uid'], $accountData['type']) == false) {
             $this->downloadThirdPlatformAvatar($info['uid'], $accountData['avatar']);
             $laiwangOK = PwLaiWangSerivce::registerUser($info['uid'], $info['username'], $info['password'], Pw::getAvatar($info['uid'], 'big'), $accountData['gender']);
             // 重置uid
             $this->uid = $info['uid'];
             $userdata = $this->_getUserInfo($laiwangOK);
             $this->setOutput($userdata, 'data');
             $this->showMessage('USER:register.success');
         }
     }
 }
 public function getLatestThreadsByFids($fids, $offset, $limit)
 {
     if (!ACloudSysCoreS::isArray($fids)) {
         return $this->buildResponse(0, array());
     }
     Wind::import('SRV:forum.vo.PwThreadSo');
     $uids = $result = array();
     $threaddb = array();
     $so = new PwThreadSo();
     $so->setFid($fids)->setDisabled(0)->orderbyCreatedTime(0);
     $threaddb = $this->_getThread()->searchThread($so, $limit, $offset);
     if (!$threaddb) {
         return $this->buildResponse(THREAD_NOT_EXIST, "帖子不存在");
     }
     $forums = $this->_getForum()->fetchForum($fids, PwForum::FETCH_MAIN);
     $result = array();
     foreach ($threaddb as $key => $value) {
         if (!$value) {
             continue;
         }
         $value['forumname'] = strip_tags($forums[$value]['name']);
         $value['icon'] = Pw::getAvatar($value['created_userid']);
         $uids[$value['tid']] = $value['created_userid'];
         $result['threads'][$value['tid']] = $value;
     }
     return $this->buildResponse(0, $result);
 }
Exemplo n.º 16
0
 private function buildInfo($data)
 {
     $data['icon'] = Pw::getAvatar($data['uid']);
     if (isset($data['password'])) {
         unset($data['password']);
     }
     return $data;
 }
 private function _buildSignKey($list, $ishighlight = null)
 {
     $content = $_tType = $_fid = $_aTid = array();
     $_tid = array_keys($list);
     $content = $this->_getContent($_tid);
     foreach ($list as $v) {
         $_fid[] = $v['fid'];
         $_tType[] = $v['topic_type'];
         if ($content[$v['tid']]['aids']) {
             $_aTid[] = $v['tid'];
         }
     }
     $forums = $this->_getForum($_fid);
     $tTypes = $this->_getTopicType($_tType);
     $attachs = $this->_getAttachs($_aTid);
     if ($ishighlight) {
         Wind::import('LIB:utility.PwHighlight');
         $highlight = new PwHighlight();
     }
     foreach ($list as $k => $v) {
         if (!$forums[$v['fid']]['isshow']) {
             $v = array();
         }
         $list[$k]['subject'] = $this->_formatTitle($v['subject']);
         if ($ishighlight) {
             $styleArr = $highlight->parseHighlight($v['highlight']);
             $list[$k]['__style'] = array($styleArr['bold'], $styleArr['underline'], $styleArr['italic'], $styleArr['color']);
         }
         $list[$k]['url'] = WindUrlHelper::createUrl('bbs/read/run', array('tid' => $v['tid'], 'fid' => $v['fid']), '', 'pw');
         $list[$k]['content'] = $this->_formatDes($content[$k]['content']);
         $list[$k]['created_time'] = $this->_formatTime($v['created_time']);
         $list[$k]['lastpost_time'] = $this->_formatTime($v['lastpost_time']);
         $list[$k]['created_space'] = WindUrlHelper::createUrl('space/index/run', array('uid' => $v['created_userid']), '', 'pw');
         $list[$k]['created_smallavatar'] = Pw::getAvatar($v['created_userid'], 'small');
         $list[$k]['created_middleavatar'] = Pw::getAvatar($v['created_userid'], 'middle');
         $list[$k]['created_bigavatar'] = Pw::getAvatar($v['created_userid'], 'big');
         $list[$k]['lastpost_smallavatar'] = Pw::getAvatar($v['lastpost_userid'], 'small');
         $list[$k]['lastpost_middleavatar'] = Pw::getAvatar($v['lastpost_userid'], 'middle');
         $list[$k]['lastpost_space'] = WindUrlHelper::createUrl('space/index/run', array('uid' => $v['lastpost_userid']), '', 'pw');
         $list[$k]['forum_name'] = $this->_filterForumHtml($forums[$v['fid']]['name']);
         $list[$k]['forum_url'] = WindUrlHelper::createUrl('bbs/thread/run', array('fid' => $v['fid']), '', 'pw');
         $list[$k]['tType'] = isset($tTypes[$v['topic_type']]['name']) ? $tTypes[$v['topic_type']]['name'] : '';
         $list[$k]['tType_url'] = isset($tTypes[$v['topic_type']]['id']) ? WindUrlHelper::createUrl('bbs/thread/run', array('fid' => $v['fid'], 'type' => $tTypes[$v['topic_type']]['id']), '', 'pw') : '';
         $list[$k]['thumb_attach'] = $attachs[$v['tid']]['path'] ? $attachs[$v['tid']]['path'] : '';
     }
     return $list;
 }
 private function buildInfo($userInfo, $loginUser, $groupName, $subjectNum)
 {
     $result = array();
     $result['uid'] = $userInfo['uid'];
     $result['username'] = $userInfo['username'];
     $result['gender'] = $userInfo['gender'];
     $result['icon'] = Pw::getAvatar($userInfo['uid']);
     $result['birthday'] = $userInfo['byear'] . '-' . $userInfo['bmonth'] . '-' . $userInfo['bday'];
     $result['honor'] = '';
     //自定义头衔
     $result['postnum'] = $userInfo['postnum'];
     $result['ltitle'] = $groupName;
     $isFollowed = $this->getAttention()->isFollowed($user->uid, $userInfo['uid']);
     $result['isfollowed'] = $isFollowed == true ? 1 : 0;
     $result['replycount'] = $userInfo['postnum'] - $subjectNum;
     $result['favorcount'] = 0;
     //个人收藏数
     $result['messages'] = $userInfo['messages'];
     $result['notices'] = $userInfo['notices'];
     $result['weibo'] = $this->getWeiboInfo($userInfo['uid'], $userInfo['fans'], $userInfo['follows']);
     return $result;
 }
Exemplo n.º 19
0
 /**
  * 获取用户的粉丝
  *
  * @param int $uid 用户id
  * @param int $limit
  * @param int $offset
  * @return array
  */
 public function getFanByUid($uid, $offset, $limit)
 {
     list($uid, $offset, $limit) = array(intval($uid), intval($offset), intval($limit));
     if ($uid < 1) {
         $this->buildResponse(Friend_INVALID_PARAMS);
     }
     $fansResult = $this->getAttention()->getFans($uid, $limit, $offset);
     if ($fansResult instanceof PwError) {
         return $this->buildResponse(-1, $fansResult->getError());
     }
     $result = array();
     $loginUid = Wekit::getLoginUser()->uid;
     foreach ($fansResult as $k => $v) {
         $result[$k]['uid'] = $v['uid'];
         $result[$k]['icon'] = Pw::getAvatar($v['uid']);
         $result[$k]['username'] = PwUserBo::getInstance($v['uid'])->username;
         $isFollowed = $this->getAttention()->isFollowed($loginUid, $v['uid']);
         $result[$k]['isfollowd'] = $isFollowed == false ? 0 : 1;
     }
     $user = PwUserBo::getInstance($uid);
     $count = $user->info['fans'];
     return $this->buildResponse(0, array('friends' => $result, 'count' => $count));
 }
Exemplo n.º 20
0
 /**
  * 用户的粉丝列表
  * 
  * @access public
  * @return void
  * * <pre>
  * /index.php?m=native&c=space&a=fans&page=1&uid=1&_json=1
  * </pre>
  */
 public function fansAction()
 {
     $spaceUid = $this->getInput('uid');
     $page = $this->getInput('page');
     $page || ($page = 1);
     $perpage = 30;
     $start = ($page - 1) * $perpage;
     $fansUsers = array();
     $count = Wekit::loadDao('native.dao.PwNativeAttentionDao')->getFansCount($spaceUid);
     $uids = Wekit::loadDao('native.dao.PwNativeAttentionDao')->fetchFansByUid($spaceUid, $start, $perpage);
     $res = $uids ? Wekit::loadDao('user.dao.PwUserDao')->fetchUserByUid($uids) : array();
     foreach ($res as $v) {
         $fansUsers[] = array('uid' => $v['uid'], 'username' => $v['username'], 'avatar' => Pw::getAvatar($v['uid'], 'small'));
     }
     $data = array('fansUsers' => $fansUsers, 'pageCount' => ceil($count / $perpage) > 0 ? ceil($count / $perpage) : 1);
     $this->setOutput($data, 'data');
     $this->showMessage('success');
 }
Exemplo n.º 21
0
 public function dataAction()
 {
     $page = (int) $this->getInput('page', 'get');
     $start = (int) $this->getInput('start', 'get');
     $start >= 100 && ($start = 100);
     $perpage = 20;
     $_data = array();
     $logLists = $this->_getBuildLikeService()->getFollowLogList($this->loginUser->uid, $start, $perpage);
     $likeLists = $this->_getBuildLikeService()->getLikeList();
     $likeInfos = $this->_getBuildLikeService()->getLikeInfo();
     $replyInfos = $this->_getBuildLikeService()->getLastReplyInfo();
     foreach ($logLists as $k => $logList) {
         if (!isset($likeInfos[$logList['likeid']])) {
             continue;
         }
         $_data[$k]['fromid'] = $likeLists[$logList['likeid']]['fromid'];
         $_data[$k]['fromtype'] = $likeLists[$logList['likeid']]['typeid'];
         $_data[$k]['url'] = $likeInfos[$logList['likeid']]['url'];
         $_data[$k]['image'] = $likeInfos[$logList['likeid']]['image'];
         $_data[$k]['subject'] = WindSecurity::escapeHTML($likeInfos[$logList['likeid']]['subject']);
         $_data[$k]['descrip'] = WindSecurity::escapeHTML(strip_tags($likeInfos[$logList['likeid']]['content']));
         $_data[$k]['uid'] = $likeInfos[$logList['likeid']]['uid'];
         $_data[$k]['username'] = $likeInfos[$logList['likeid']]['username'];
         $_data[$k]['avatar'] = Pw::getAvatar($likeInfos[$logList['likeid']]['uid'], 'small');
         $_data[$k]['space'] = WindUrlHelper::createUrl('space/index/run/?uid=' . $likeInfos[$logList['likeid']]['uid']);
         $_data[$k]['lasttime'] = Pw::time2str($likeInfos[$logList['likeid']]['lasttime'], 'auto');
         $_data[$k]['like_count'] = $likeInfos[$logList['likeid']]['like_count'];
         $_data[$k]['reply_pid'] = $replyInfos[$likeLists[$logList['likeid']]['reply_pid']];
         $_data[$k]['reply_uid'] = $replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['uid'];
         $_data[$k]['reply_avatar'] = Pw::getAvatar($replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['uid'], 'small');
         $_data[$k]['reply_space'] = WindUrlHelper::createUrl('space/index/run/?uid=' . $replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['uid']);
         $_data[$k]['reply_username'] = $replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['username'];
         $_data[$k]['reply_content'] = WindSecurity::escapeHTML($replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['content']);
         $_data[$k]['like_url'] = WindUrlHelper::createUrl('like/mylike/doLike/?typeid=' . $_data[$k]['fromtype'] . '&fromid=' . $_data[$k]['fromid']);
     }
     $this->setOutput($_data, 'data');
     $this->showMessage('operate.success');
 }
Exemplo n.º 22
0
 public function simpleUserInfoAction()
 {
     $username = $this->getInput("username", "get");
     $passwd = $this->getInput("password", "get");
     Wind::import('SRV:user.srv.PwLoginService');
     /*
     	PwLoginService()说明:只能使用5次
     	可以在:全局->注册登录->登录设置->密码尝试次数中修改
     */
     $login = new PwLoginService();
     $isSuccess = $login->login($username, $passwd, NULL);
     if ($isSuccess instanceof PwError) {
         echo json_encode("0");
         exit;
     }
     $uid = $isSuccess['uid'];
     $username = $isSuccess['username'];
     $avatarPath = Pw::getAvatar($uid);
     //获取头像 √
     $response_json['uid'] = $uid;
     $response_json['username'] = $username;
     $response_json['avatarPath'] = $avatarPath;
     echo json_encode($response_json);
     exit;
 }