Пример #1
0
 private function _register($res, $username, $password, $email, $mobile, $code, $isValidation)
 {
     if ($isValidation) {
         // 是否开启注册手机验证
         $isRegisterValidation = WebUtils::getDzPluginAppbymeAppConfig('mobcent_register_validation');
         if ($isRegisterValidation) {
             $checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
             if ($checkInfo['rs'] == 0) {
                 return $this->makeErrorInfo($res, $checkInfo['errcode']);
             }
         }
     }
     $regInfo = UserUtils::register($username, $password, $email);
     if ($regInfo['errcode']) {
         return $this->makeErrorInfo($res, $regInfo['message']);
     }
     if ($isValidation) {
         if ($isRegisterValidation) {
             // 注册完毕之后更新手机验证信息
             $updataArr = array('uid' => $regInfo['info']['uid']);
             AppbymeSendsms::updateMobile($mobile, $updataArr);
         }
     }
     $userInfo = AppbymeUserAccess::registerProcess($regInfo['info']['uid'], $password);
     $res['token'] = (string) $userInfo['token'];
     $res['secret'] = (string) $userInfo['secret'];
     $res['uid'] = (int) $regInfo['info']['uid'];
     return $res;
 }
Пример #2
0
 private function _getUserInfos($uid, $longitude, $latitude, $radius, $page, $pageSize)
 {
     $userInfos = array('count' => 0, 'list' => array());
     $count = SurroundingInfo::getUserCountByUid($uid, $longitude, $latitude, $radius);
     $surroundUsers = SurroundingInfo::getAllUsersByUid($uid, $longitude, $latitude, $radius, $page, $pageSize);
     $list = array();
     foreach ($surroundUsers as $user) {
         $userInfo = array();
         $tmpUid = (int) $user['object_id'];
         $userInfo['uid'] = $tmpUid;
         $userInfo['distance'] = $user['distance'];
         $userInfo['location'] = $user['location'];
         $userInfo['nickname'] = UserUtils::getUserName($tmpUid);
         $userInfo['gender'] = UserUtils::getUserGender($tmpUid);
         $userInfo['status'] = UserUtils::getUserLoginStatus($tmpUid) == UserUtils::STATUS_ONLINE ? 1 : 0;
         $userInfo['icon'] = UserUtils::getUserAvatar($tmpUid);
         // $userInfo['is_friend'] = UserUtils::isFriend($uid, $tmpUid) ? 1 : 0;
         $userInfo['is_friend'] = UserUtils::isFollow($uid, $tmpUid) ? 1 : 0;
         $userInfo['is_black'] = UserUtils::isBlacklist($uid, $tmpUid) ? 1 : 0;
         $list[] = $userInfo;
     }
     $userInfos['count'] = $count;
     $userInfos['list'] = $list;
     return $userInfos;
 }
 private function _getAnnouncementInfo($res, $id)
 {
     global $_G;
     require_once libfile('function/discuzcode');
     $announce = DzForumAnnouncement::getAnnouncementByUid($id);
     if (!count($announce)) {
         $res = $this->makeErrorInfo($res, 'announcement_nonexistence');
     } else {
         $tempAnnounce = array();
         $tempAnnounce['author'] = $announce['author'];
         $tmp = explode('.', dgmdate($announce['starttime'], 'Y.m'));
         $months[$tmp[0] . $tmp[1]] = $tmp;
         if (!empty($_GET['m']) && $_GET['m'] != dgmdate($announce['starttime'], 'Ym')) {
             continue;
         }
         $tempAnnounce['starttime'] = dgmdate($announce['starttime'], 'd');
         $tempAnnounce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '';
         $tempAnnounce['title'] = WebUtils::emptyHtml($announce['subject']);
         $uid = DzCommonMember::getUidByUsername($announce['author']);
         $tempAnnounce['icon'] = UserUtils::getUserAvatar($uid);
         $announceMessage = $announce['type'] == 1 ? "{$announce[message]}" : $announceMessage;
         $announceMessage = nl2br(discuzcode($announce['message'], 0, 0, 1, 1, 1, 1, 1));
         $announceType = array();
         $announceType['infor'] = WebUtils::emptyHtml($announceMessage);
         $announce['type'] == 1 ? $announceType['type'] = 'url' : ($announceType['type'] = 'text');
         $tempAnnounce['content'] = $announceType;
         $res['body']['list'] = $tempAnnounce;
     }
     return $res;
 }
 private function _getImageInfoByTids($page, $pageSize)
 {
     $imageList = $this->_getImageTidsByFids($page, $pageSize);
     $list = array();
     global $_G;
     $forum = $_G['forum'];
     foreach ($imageList as $image) {
         $tmpImageInfo = ForumUtils::getTopicInfo($image);
         $imageSummary = ForumUtils::getTopicCover((int) $image);
         $imageInfo['board_id'] = (int) $tmpImageInfo['fid'];
         $imageInfo['board_name'] = $fid != 0 ? $forum['name'] : ForumUtils::getForumName($tmpImageInfo['fid']);
         $imageInfo['board_name'] = WebUtils::emptyHtml($imageInfo['board_name']);
         $imageInfo['topic_id'] = (int) $image;
         $imageInfo['title'] = WebUtils::emptyHtml($tmpImageInfo['subject']);
         $imageInfo['user_id'] = (int) $tmpImageInfo['authorid'];
         $imageInfo['last_reply_date'] = $tmpImageInfo['lastpost'] . "000";
         $imageInfo['user_nick_name'] = $tmpImageInfo['author'];
         $imageInfo['hits'] = (int) $tmpImageInfo['views'];
         $imageInfo['replies'] = (int) $tmpImageInfo['replies'];
         $imageInfo['top'] = (int) ForumUtils::isTopTopic($image) ? 1 : 0;
         $imageInfo['status'] = (int) $tmpImageInfo['status'];
         $imageInfo['essence'] = (int) $tmpImageInfo['digest'] ? 1 : 0;
         $imageInfo['hot'] = (int) $tmpImageInfo['highlight'] ? 1 : 0;
         $tempImageInfo = ImageUtils::getThumbImageEx($imageSummary, 15, true, false);
         $imageInfo['pic_path'] = $tempImageInfo['image'];
         $imageInfo['ratio'] = $tempImageInfo['ratio'];
         $imageInfo['userAvatar'] = UserUtils::getUserAvatar($tmpImageInfo['authorid']);
         $imageInfo['recommendAdd'] = (int) ForumUtils::getRecommendAdd($image);
         $imageInfo['isHasRecommendAdd'] = (int) ForumUtils::isHasRecommendAdd($image);
         $imageInfo['imageList'] = array();
         $imageInfo['sourceWebUrl'] = (string) ForumUtils::getSourceWebUrl($image, 'topic');
         $list[] = $imageInfo;
     }
     return $list;
 }
Пример #5
0
 public function beforeControllerAction($controller, $action)
 {
     if (!($controller->id == 'index' && $action->id == 'login') && !UserUtils::isInAppbymeAdminGroup()) {
         $controller->redirect(Yii::app()->createAbsoluteUrl('admin/index/login'));
     }
     return true;
 }
Пример #6
0
 private function _getImageInfoList($res, $landUid, $uid, $page, $pageSize, $albumId)
 {
     $list = array();
     $imageList = UserPhotoInfo::getImageListByAlbumId($albumId, $uid, $page, $pageSize);
     foreach ($imageList as $image) {
         $tempimageInfo = PhotoUtils::getPhotoInfo($image);
         // $imageInfo['board_id'] = (Int)$albumId;
         $imageInfo['pic_id'] = (int) $image;
         $imageInfo['title'] = $tempimageInfo['title'] == "" ? $tempimageInfo['filename'] : $tempimageInfo['title'];
         $imageInfo['title'] = WebUtils::emptyHtml($imageInfo['title']);
         $imageInfo['user_id'] = (int) $uid;
         $imageInfo['release_date'] = $tempimageInfo['dateline'] . "000";
         $lastReplyDate = PhotoUtils::getReplyDate($image);
         $imageInfo['last_update_date'] = $lastReplyDate['last_reply_date'] . "000";
         $imageInfo['user_nick_name'] = $tempimageInfo['username'];
         $imageInfo['hot'] = (int) $tempimageInfo['hot'];
         $imageInfo['replies'] = (int) PhotoUtils::getReplyCount($image);
         $imageInfo['thumb_pic'] = PhotoUtils::getImageCover($image);
         $imageInfo['origin_pic'] = PhotoUtils::getPhotosoRiginCover($tempimageInfo);
         $list[] = $imageInfo;
     }
     global $_G;
     if ($_G['adminid'] != 1) {
         $albumInfo = UserPhotoInfo::getAlbumInfo($uid, $albumId);
         switch ($albumInfo['friend']) {
             case 0:
                 $list;
                 break;
             case 1:
                 UserUtils::isFriend($uid, $landUid) || $landUid == $uid ? $list : ($list = 1);
                 break;
             case 2:
                 $list = PhotoUtils::judgeDesignatedFriends($albumInfo, $landUid, $uid, $list);
                 break;
             case 3:
                 $uid == $landUid ? $list : ($list = 3);
                 break;
             case 4:
                 $landUid == $uid ? $list : ($list = 4);
                 break;
         }
     }
     $res['list'] = $list;
     if ($albumId == 0) {
         $count = UserPhotoInfo::getImageListCountByAlbumId($uid);
     } else {
         $count = UserPhotoInfo::getImageListCount($albumId, $uid);
     }
     $res = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $count, $res);
     if (empty($res['list'])) {
         if ($albumId == 0) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'to_view_the_defaultAlbum_does_not_exist');
         }
         return WebUtils::makeErrorInfo_oldVersion($res, 'to_view_the_photo_does_not_exist');
     } elseif ($res['list'] == 1 || $res['list'] == 2 || $res['list'] == 3 || $res['list'] == 4) {
         $res['list'] = array();
         return WebUtils::makeErrorInfo_oldVersion($res, 'to_view_the_photo_set_privacy', array('{username}' => $albumInfo['username']));
     }
     return $res;
 }
Пример #7
0
 private function _checkMobileCode($res, $mobile, $code)
 {
     $checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
     if ($checkInfo['rs'] == 0) {
         return $this->makeErrorInfo($res, $checkInfo['errcode']);
     }
     return $res;
 }
Пример #8
0
 protected function checkUserAccess($checkLogin = true)
 {
     if (!UserUtils::checkAccess() && $checkLogin) {
         WebUtils::endAppWithErrorInfo(array('rs' => 0, 'errcode' => 50000000), 'to_login');
         // WebUtils::endAppWithErrorInfo(array(), 'to_login');
     }
     global $_G;
     $this->uid = $_G['uid'];
 }
Пример #9
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;
 }
Пример #10
0
 private function _register($res, $username, $password, $email)
 {
     $regInfo = UserUtils::register($username, $password, $email);
     if ($regInfo['errcode']) {
         return $this->makeErrorInfo($res, $regInfo['message']);
     }
     $userInfo = AppbymeUserAccess::registerProcess($regInfo['info']['uid'], $password);
     $res['token'] = (string) $userInfo['token'];
     $res['secret'] = (string) $userInfo['secret'];
     $res['uid'] = (int) $regInfo['info']['uid'];
     return $res;
 }
Пример #11
0
function adduser($course, $tmp_roles, $new_username, $mysqli)
{
    $new_password = trim($_POST['new_password']);
    $new_surname = StringUtils::my_ucwords(trim($_POST['new_surname']));
    $new_title = $_POST['new_users_title'];
    $new_email = trim($_POST['new_email']);
    $new_first_names = StringUtils::my_ucwords(trim($_POST['new_first_names']));
    $new_year = $_POST['new_year'];
    $new_gender = $_POST['new_gender'];
    $userid = UserUtils::create_user($new_username, $new_password, $new_title, $new_first_names, $new_surname, $new_email, $course, $new_gender, $new_year, $tmp_roles, '', $mysqli);
    return $userid;
}
Пример #12
0
 private function _switchVest($res, $username)
 {
     global $_G;
     $username = WebUtils::t(rawurldecode($username));
     $_GET['username'] = $username;
     $myrepeatsusergroups = (array) dunserialize($_G['cache']['plugin']['myrepeats']['usergroups']);
     if (!in_array($_G['groupid'], $myrepeatsusergroups)) {
         $users = C::t('#myrepeats#myrepeats')->fetch_all_by_username($_G['username']);
         if (!$users) {
             return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'usergroup_disabled'));
         } else {
             $permusers = array();
             foreach ($users as $user) {
                 $permusers[] = $user['uid'];
             }
             $member = C::t('common_member')->fetch_by_username($_GET['username']);
             if (!$member || !in_array($member['uid'], $permusers)) {
                 return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'usergroup_disabled'));
             }
         }
     }
     $user = C::t('#myrepeats#myrepeats')->fetch_all_by_uid_username($_G['uid'], $_GET['username']);
     $user = current($user);
     $olddiscuz_uid = $_G['uid'];
     $olddiscuz_user = $_G['username'];
     $olddiscuz_userss = $_G['member']['username'];
     if (!$user) {
         $newuid = C::t('common_member')->fetch_uid_by_username($_GET['username']);
         if (C::t('#myrepeats#myrepeats')->count_by_uid_username($newuid, $olddiscuz_userss)) {
             // 第一次登录,需要输入密码
         }
         //return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'user_nonexistence'));
     } elseif ($user['locked']) {
         return $this->makeErrorInfo($res, lang('plugin/myrepeats', 'user_locked', array('user' => $_GET['username'])));
     }
     list($password, $questionid, $answer) = explode("\t", authcode($user['logindata'], 'DECODE', $_G['config']['security']['authkey']));
     $logInfo = UserUtils::login($username, $password);
     if ($logInfo['errcode']) {
         return $this->makeErrorInfo($res, $logInfo['message']);
     }
     $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password);
     $userAvatar = UserUtils::getUserAvatar($_G['uid']);
     $res['token'] = (string) $userInfo['token'];
     $res['secret'] = (string) $userInfo['secret'];
     $res['uid'] = (int) $_G['uid'];
     $res['avatar'] = (string) $userAvatar;
     $res['userName'] = (string) $_G['username'];
     return $res;
 }
Пример #13
0
 private function _getPMList($page, $pageSize)
 {
     $pmList = array('list' => array(), 'count' => 0);
     global $_G;
     // 在DISCUZ_ROOT/source/include/space/space_pm.php基础上二次开发
     loaducenter();
     $filter = 'privatepm';
     $perpage = $pageSize;
     $count = 0;
     $list = array();
     if ($filter == 'privatepm' || $filter == 'newpm') {
         $result = uc_pm_list($_G['uid'], $page, $perpage, 'inbox', $filter, 200);
         $count = $result['count'];
         $list = $result['data'];
     }
     if ($_G['member']['newpm']) {
         if ($newpm && $_G['setting']['cloud_status']) {
             $msgService = Cloud::loadClass('Cloud_Service_Client_Message');
             $msgService->setMsgFlag($_G['uid'], $_G['timestamp']);
         }
         C::t('common_member')->update($_G['uid'], array('newpm' => 0));
         uc_pm_ignore($_G['uid']);
     }
     $tempPMList = array();
     foreach ($list as $pm) {
         // 目前只要两人对话的列表
         if ($pm['members'] > 2 || $pm['pmtype'] != 1) {
             $count--;
             continue;
         }
         $tempPm = array();
         $tempPm['plid'] = (int) $pm['plid'];
         $tempPm['pmid'] = (int) $pm['pmid'];
         $tempPm['lastUserId'] = (int) $pm['lastauthorid'];
         $tempPm['lastUserName'] = (string) $pm['lastauthor'];
         $tempPm['lastSummary'] = (string) $pm['lastsummary'];
         $tempPm['lastDateline'] = $pm['lastdateline'] . '000';
         $tempPm['toUserId'] = (int) $pm['touid'];
         $tempPm['toUserAvatar'] = UserUtils::getUserAvatar($pm['touid']);
         $tempPm['toUserName'] = (string) $pm['tousername'];
         $tempPm['toUserIsBlack'] = UserUtils::isBlacklist($_G['uid'], $pm['touid']) ? 1 : 0;
         $tempPm['isNew'] = $pm['new'] ? 1 : 0;
         $tempPMList[] = $tempPm;
     }
     $pmList['list'] = $tempPMList;
     $pmList['count'] = $count;
     return $pmList;
 }
Пример #14
0
 protected function getCommentList($data)
 {
     $res = array('list' => array(), 'count' => 0);
     $list = array();
     $comments = DzPortalComment::getComments($data['id'], $data['idType'], $data['page'], $data['pageSize']);
     foreach ($comments as $comment) {
         $tmpComment = array();
         $tmpComment['managePanel'] = array(array('type' => 'quote', 'action' => '', 'title' => WebUtils::t('引用')));
         $tmpComment['id'] = (int) $comment['cid'];
         $tmpComment['uid'] = (int) $comment['uid'];
         $tmpComment['username'] = $comment['username'];
         $tmpComment['avatar'] = UserUtils::getUserAvatar($comment['uid']);
         $tmpComment['time'] = date('Y-m-d H:i', $comment['dateline']);
         $tmpComment['content'] = $this->transCommentMessage($comment['message']);
         $list[] = $tmpComment;
     }
     $res['list'] = $list;
     $res['count'] = DzPortalComment::getCount($data['id'], $data['idType']);
     return $res;
 }
Пример #15
0
 public function __construct(array $data)
 {
     $fields = UserUtils::getTableFields();
     foreach ($fields as $f => $default) {
         if (!isset($data[$f])) {
             Core::throwError("User data is incomplete. Field {$f} is missing.");
             $data[$f] = $default;
         }
     }
     // Special case: Birthday -> Parse it into chunks
     if (strpos($data['birth'], '-') === false) {
         $data['birth'] = '0000-00-00';
     }
     $bday = explode('-', $data['birth']);
     $data['birthday'] = intval($bday[2]);
     $data['birthmonth'] = intval($bday[1]);
     $data['birthyear'] = intval($bday[0]);
     $this->data = $data;
     $this->acl = null;
 }
Пример #16
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');
 }
Пример #17
0
 private function _transTopicList($topicList, $type)
 {
     $list = array();
     global $_G;
     $forum = $_G['forum'];
     foreach ($topicList as $topic) {
         $tmpTopicInfo = ForumUtils::getTopicInfo((int) $topic);
         $topicSummary = ForumUtils::getTopicSummary((int) $topic);
         $topicInfo['board_id'] = (int) $tmpTopicInfo['fid'];
         $topicInfo['board_name'] = $fid != 0 ? $forum['name'] : ForumUtils::getForumName($tmpTopicInfo['fid']);
         $topicInfo['board_name'] = WebUtils::emptyHtml($topicInfo['board_name']);
         $topicInfo['topic_id'] = (int) $topic;
         $topicInfo['type_id'] = (int) $tmpTopicInfo['typeid'];
         $topicInfo['sort_id'] = (int) $tmpTopicInfo['sortid'];
         $topicInfo['title'] = WebUtils::emptyHtml($tmpTopicInfo['subject']);
         $topicSummary['msg'] = WebUtils::emptyReturnLine($topicSummary['msg'], ' ');
         $topicInfo['subject'] = $topicSummary['msg'];
         $topicInfo['user_id'] = (int) $tmpTopicInfo['authorid'];
         if ($type = 'favorite' && empty($tmpTopicInfo['author'])) {
             $dateline = UserTopicInfo::getUserfavorite($_G['uid'], $topic);
             $topicInfo['last_reply_date'] = $dateline . '000';
             $topicInfo['user_nick_name'] = UserUtils::getUserName($dateline['uid']);
         } else {
             $topicInfo['last_reply_date'] = $tmpTopicInfo['dateline'] . '000';
             $topicInfo['user_nick_name'] = (string) $tmpTopicInfo['author'];
         }
         $topicInfo['hits'] = (int) $tmpTopicInfo['views'];
         $topicInfo['replies'] = (int) $tmpTopicInfo['replies'];
         $topicInfo['top'] = (int) ForumUtils::isTopTopic($topic) ? 1 : 0;
         $topicInfo['status'] = (int) $tmpTopicInfo['status'];
         $topicInfo['essence'] = (int) $tmpTopicInfo['digest'] ? 1 : 0;
         $topicInfo['hot'] = (int) $tmpTopicInfo['highlight'] ? 1 : 0;
         $topicInfo['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']);
         $list[] = $topicInfo;
     }
     return $list;
 }
Пример #18
0
 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');
 }
Пример #19
0
 protected function _initUser()
 {
     if ($this->init_user) {
         $discuz_uid = isset($_GET['hacker_uid']) && MOBCENT_HACKER_UID ? $_GET['hacker_uid'] : UserUtils::getUserIdByAccess();
         if ($discuz_uid) {
             $user = getuserbyuid($discuz_uid, 1);
         }
         if (!empty($user)) {
             $this->var['member'] = $user;
         } else {
             $user = array();
             $this->_initGuest();
         }
         if ($user && $user['groupexpiry'] > 0 && $user['groupexpiry'] < TIMESTAMP && getgpc('mod') != 'spacecp' && getgpc('do') != 'expiry' && CURSCRIPT != 'home') {
             dheader('location: home.php?mod=spacecp&ac=usergroup&do=expiry');
         }
         $this->cachelist[] = 'usergroup_' . $this->var['member']['groupid'];
         if ($user && $user['adminid'] > 0 && $user['groupid'] != $user['adminid']) {
             $this->cachelist[] = 'admingroup_' . $this->var['member']['adminid'];
         }
     } else {
         $this->_initGuest();
     }
     if (empty($this->var['cookie']['lastvisit'])) {
         $this->var['member']['lastvisit'] = TIMESTAMP - 3600;
         dsetcookie('lastvisit', TIMESTAMP - 3600, 86400 * 30);
     } else {
         $this->var['member']['lastvisit'] = $this->var['cookie']['lastvisit'];
     }
     setglobal('uid', getglobal('uid', 'member'));
     setglobal('username', addslashes(getglobal('username', 'member')));
     setglobal('adminid', getglobal('adminid', 'member'));
     setglobal('groupid', getglobal('groupid', 'member'));
 }
Пример #20
0
require_once '../include/errors.inc';
require_once '../classes/userutils.class.php';
$userID = check_var('id', 'POST', true, false, true);
// Check that all the past user IDs actually exist.
$id_list = explode(',', $userID);
foreach ($id_list as $id) {
    if ($id != '') {
        if (!UserUtils::userid_exists($id, $mysqli)) {
            $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
            $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
        }
    }
}
foreach ($id_list as $single_id) {
    if ($single_id != '') {
        UserUtils::delete_userID($single_id, $mysqli);
    }
}
$mysqli->close();
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta http-equiv="content-type" content="text/html;charset=<?php 
echo $configObject->get('cfg_page_charset');
?>
" />
  
  <title>User Deleted</title>
  
Пример #21
0
 private function _userBlackSetting($res, $blackUid)
 {
     global $_G;
     $uid = $_G['uid'];
     $blackName = UserUtils::getUserName($blackUid);
     require_once libfile('function/friend');
     if (!($blackName = C::t('common_member')->fetch_by_username($blackName))) {
         $res = $this->makeErrorInfo($res, 'space_does_not_exist');
     } elseif ($blackUid == $uid) {
         $res = $this->makeErrorInfo($res, 'unable_to_manage_self');
     } else {
         friend_delete($blackUid);
         C::t('home_blacklist')->insert(array('uid' => $uid, 'buid' => $blackUid, 'dateline' => $_G['timestamp']), false, false, true);
         $params['noError'] = 1;
         $res = $this->makeErrorInfo($res, 'do_success', $params);
     }
     return $res;
 }
Пример #22
0
                    UserNotices::display_notice($string['NotAddedToModuleTitle'], $string['NotAddedToModule'] . $v[1], '../artwork/exclamation_64.png', '#C00000');
                    echo "\n</body>\n</html>\n";
                    exit;
                }
            }
            $module_store = $lti_i::module_code_translated_store($data);
            if ($problem === false) {
                $lti->add_lti_context($module_store);
            }
            $returned2 = $lti->lookup_lti_context();
        }
        $mod = $returned2[0];
        $data = $lti_i::module_code_translate($mod);
        foreach ($data as $v) {
            if (!$userObject->is_staff_user_on_module($v[1]) and $lti_i::allow_staff_module_register($v) and $userObject->has_role(array('Staff', 'Admin', 'SysAdmin')) and module_utils::is_allowed_add_team_members_by_name($v[1], $mysqli)) {
                UserUtils::add_staff_to_module_by_modulecode($userObject->get_user_ID(), $v[1], $mysqli);
            } elseif (!$userObject->is_staff_user_on_module($v[1]) and !$lti_i::allow_staff_module_register($v)) {
                UserNotices::display_notice($string['NotAddedToModuleTitle'], $string['NotAddedToModule'] . $v[1], '../artwork/exclamation_64.png', '#C00000');
                echo "\n</body>\n</html>\n";
                exit;
            }
        }
        list($c_internal_id, $upd) = $returned2;
        $moduleid = $c_internal_id;
        echo <<<END
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta http-equiv="content-type" content="text/html;charset={$configObject->get('cfg_page_charset')}" />
Пример #23
0
 /**
  * complete the user with the api json
  *
  * @param User $pUser
  * @param Object $pObject
  */
 public function completeUser(&$pUser, $lProfileArray)
 {
     $pUser->setUsername(UserUtils::getUniqueUsername(StringUtils::normalizeUsername($lProfileArray['first-name'] . $lProfileArray['last-name'])));
     if (isset($lProfileArray['summary'])) {
         $pUser->setDescription(strip_tags($lProfileArray['summary']));
     }
     $pUser->setActive(true);
     $pUser->setAgb(true);
     $pUser->setFirstname($lProfileArray['first-name']);
     $pUser->setLastname($lProfileArray['last-name']);
     if (isset($lProfileArray['location']['country']['code'])) {
         $pUser->setCulture($lProfileArray['location']['country']['code']);
     }
     $pUser->save();
 }
Пример #24
0
    $gender = $_POST['gender'];
    if ($gender == '') {
        $gender = NULL;
    }
    $result = $mysqli->prepare("UPDATE users SET roles = ?, title = ?, initials = ?, surname = ?, grade = ?, yearofstudy = ?, username = ?, email = ?, first_names = ?, gender = ? WHERE id = ?");
    $result->bind_param('sssssissssi', $tmp_roles, $_POST['title'], $initials, $_POST['surname'], $_POST['grade'], $_POST['year'], $_POST['username'], $_POST['email'], $_POST['first_names'], $gender, $userID);
    $result->execute();
    $result->close();
    // Remove from teams if 'left'.
    if (strtolower($tmp_roles) == 'left') {
        UserUtils::clear_staff_modules_by_userID($userID, $mysqli);
    }
    // Remove from admin access if role changed from Admin
    if ($userObject->has_role('SysAdmin')) {
        if ($tmp_roles != $_POST['prev_roles'] and $_POST['prev_roles'] == 'Staff,Admin') {
            UserUtils::clear_admin_access($userID, $mysqli);
        }
    }
    // Update 'sid' table;
    $result = $mysqli->prepare("DELETE FROM sid WHERE userID = ?");
    $result->bind_param('i', $userID);
    $result->execute();
    $result->close();
    if (isset($_POST['sid']) and $_POST['sid'] != '' and $_POST['sid'] != $string['unknown']) {
        $result = $mysqli->prepare("INSERT INTO sid VALUES (?, ?)");
        $result->bind_param('si', $_POST['sid'], $userID);
        $result->execute();
        $result->close();
    }
    ?>
<!DOCTYPE html>
Пример #25
0
                 $attempt = trim($fields[3]);
             } else {
                 $attempt = 1;
             }
             if (isset($module_list[$module])) {
                 $require_insert = true;
                 if (isset($students[$sid]['modules'][$module])) {
                     foreach ($students[$sid]['modules'][$module] as $individual_attempt) {
                         if ($individual_attempt == $attempt) {
                             $require_insert = false;
                         }
                     }
                 }
                 if ($require_insert) {
                     if (isset($students[$sid]['dbID'])) {
                         $success = UserUtils::add_student_to_module($students[$sid]['dbID'], $module_list[$module], $attempt, $session, $mysqli);
                         if ($success) {
                             $modulesAdded++;
                         }
                     } else {
                         $missing_users[$sid]['module'][] = $module;
                     }
                 }
             } else {
                 $unknow_ModuleID[] = $module;
             }
         }
     }
 }
 unlink($configObject->get('cfg_tmpdir') . $userObject->get_user_ID() . "_cohort_update.csv");
 echo "<table>\n";
Пример #26
0
 /**
  * add current user to module as staff
  *
  * @param $idMod
  */
 public function add_staff_to_module($idMod)
 {
     $return = UserUtils::add_staff_to_module($this->get_user_ID(), $idMod, $this->db);
     $this->load_staff_modules();
     return $return;
 }
Пример #27
0
 public function actionUserInfo($uid)
 {
     $user = array_merge(UserUtils::getUserInfo($uid), UserUtils::getUserProfile($uid));
     echo WebUtils::jsonEncode($user);
 }
Пример #28
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;
 }
Пример #29
0
 /**
  * complete the user with the api json
  *
  * @author Matthias Pfefferle
  * @param User $pUser
  * @param Object $pObject
  */
 public function completeUser(&$pUser, $pObject)
 {
     $pUser->setUsername(UserUtils::getUniqueUsername(StringUtils::normalizeUsername($pObject->username)));
     $pUser->setActive(true);
     $pUser->setAgb(true);
     $pUser->setFirstname($pObject->firstname);
     $pUser->setEmail($pObject->email);
     $pUser->setLastname($pObject->lastname);
     $pUser->save();
 }
Пример #30
0
$metadataID = check_var('metadataID', 'GET', true, false, true);
$userID = check_var('userID', 'GET', true, false, true);
$paperID = check_var('paperID', 'GET', true, false, true);
$properties = PaperProperties::get_paper_properties_by_id($paperID, $mysqli, $string);
if ($properties->get_paper_type() != '1') {
    // Only allow timer reset of Progress Test papers.
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$log_metadata = new LogMetadata($userID, $paperID, $mysqli);
if ($log_metadata->get_record($metadataID) === false) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$dateObj = $log_metadata->get_start_datetime();
$user_details = UserUtils::get_user_details($userID, $mysqli);
if ($user_details === false) {
    $msg = sprintf($string['furtherassistance'], $configObject->get('support_email'), $configObject->get('support_email'));
    $notice->display_notice_and_exit($mysqli, $string['pagenotfound'], $msg, $string['pagenotfound'], '../artwork/page_not_found.png', '#C00000', true, true);
}
$name = $user_details['title'] . ' ' . $user_details['surname'] . ', ' . $user_details['first_names'] . ' (' . $user_details['student_id'] . ')';
$display_format = $configObject->get('cfg_long_date_php') . ' ' . $configObject->get('cfg_short_time_php');
$started = $dateObj->format($display_format);
?>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta http-equiv="content-type" content="text/html;charset=<?php 
echo $configObject->get('cfg_page_charset');
?>