Example #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;
 }
 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;
 }
 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;
 }
Example #4
0
 public function getTopicSort($threadsortshow)
 {
     $sort = array('title' => '', 'summary' => '');
     if ($threadsortshow['optionlist']) {
         if ($threadsortshow['optionlist'] == 'expire') {
             $sort['summary'] = WebUtils::t("该信息已经过期\n");
         } else {
             global $_G;
             $sort['title'] = $_G['forum']['threadsorts']['types'][$_G['forum_thread']['sortid']];
             if (is_array($threadsortshow['optionlist'])) {
                 foreach ($threadsortshow['optionlist'] as $option) {
                     if ($option['type'] != 'info') {
                         $sort['summary'] .= sprintf("%s :\t", $option['title']);
                         if ($option['value'] || $option['type'] == 'number' && $option['value'] !== '') {
                             $option['value'] = WebUtils::emptyHtml($option['value']);
                             $sort['summary'] .= $option['value'] . $option['unit'];
                         }
                         $sort['summary'] .= "\n";
                     }
                 }
             }
         }
     }
     return $sort;
 }
 private function _updateUser($res, $gender, $avatar)
 {
     global $_G;
     include_once libfile('function/profile');
     $setarr['gender'] = intval($gender);
     if ($setarr) {
         C::t('common_member_profile')->update($_G['uid'], $setarr);
     }
     manyoulog('user', $uid, 'update');
     $operation = 'gender';
     include_once libfile('function/feed');
     feed_add('profile', 'feed_profile_update_' . $operation, array('hash_data' => 'profile'));
     countprofileprogress();
     // ob_start();
     // $this->getController()->forward('user/uploadavatar', false);
     // $result = ob_get_clean();
     // $picInfo = WebUtils::jsonDecode($result, true);
     // $avatar = $picInfo['pic_path'];
     // $avatar = !empty($_GET['avatar']) ? $_GET['avatar'] : '';
     if (!empty($avatar)) {
         $_GET = array_merge($_GET, array('avatar' => $avatar));
         ob_start();
         $this->getController()->forward('user/saveavatar', false);
         $result = ob_get_clean();
         $result = WebUtils::jsonDecode($result);
         if (WebUtils::checkError($result)) {
             return $this->makeErrorInfo($res, 'user_info_avatar_error');
         }
     }
     return $this->makeErrorInfo($res, lang('message', 'profile_succeed'), array('noError' => 1));
 }
Example #6
0
 public function getSms($res, $type, $mobile, $act)
 {
     //主帐号,对应官网开发者主账号下的 ACCOUNT SID
     $accountSid = WebUtils::getDzPluginAppbymeAppConfig('yun_accountsid');
     //主帐号令牌,对应官网开发者主账号下的 AUTH TOKEN
     $accountToken = WebUtils::getDzPluginAppbymeAppConfig('yun_authtoken');
     //应用Id,在官网应用列表中点击应用,对应应用详情中的APP ID
     //在开发调试的时候,可以使用官网自动为您分配的测试Demo的APP ID
     $appId = WebUtils::getDzPluginAppbymeAppConfig('appbyme_appid');
     // 主账号里面的模板id
     $templateId = WebUtils::getDzPluginAppbymeAppConfig('yun_moduleid');
     // $templateId = 1;
     if ($accountSid == '' || $accountToken == '' || $appId == '' || $templateId == '') {
         return $this->makeErrorInfo($res, 'mobcent_yun_config_error');
     }
     //请求端口,生产环境和沙盒环境一致
     $serverPort = '8883';
     //请求地址
     //沙盒环境(用于应用开发调试):sandboxapp.cloopen.com
     //生产环境(用户应用上线使用):app.cloopen.com
     $serverIP = 'app.cloopen.com';
     //REST版本号,在官网文档REST介绍中获得。
     $softVersion = '2013-12-26';
     // 验证码
     $code = self::getRandomCode();
     //code的有效时间
     $activeTime = 2;
     $params = array('serverIP' => $serverIP, 'serverPort' => $serverPort, 'softVersion' => $softVersion, 'accountSid' => $accountSid, 'accountToken' => $accountToken, 'appId' => $appId, 'action' => $act, 'type' => $type);
     //手机号码,替换内容数组,模板ID
     $res = $this->sendTemplateSMS($res, $mobile, array($code, $activeTime), $templateId, $params);
     return $res;
 }
 public function run($custom = 0)
 {
     $res = $this->initWebApiArray();
     $res['body'] = $this->_getUIconfig($custom);
     $res['head']['errInfo'] = '';
     echo WebUtils::outputWebApi($res, 'utf-8', false);
 }
Example #8
0
 function updatemembercount($creditarr, $uids = 0, $checkgroup = true, $ruletxt = '')
 {
     global $_G;
     if (!$uids) {
         $uids = intval($_G['uid']);
     }
     $uids = is_array($uids) ? $uids : array($uids);
     if ($uids && ($creditarr || $this->extrasql)) {
         if ($this->extrasql) {
             $creditarr = array_merge($creditarr, $this->extrasql);
         }
         $sql = array();
         $allowkey = array('extcredits1', 'extcredits2', 'extcredits3', 'extcredits4', 'extcredits5', 'extcredits6', 'extcredits7', 'extcredits8', 'friends', 'posts', 'threads', 'oltime', 'digestposts', 'doings', 'blogs', 'albums', 'sharings', 'attachsize', 'views', 'todayattachs', 'todayattachsize');
         $creditnotice = $_G['setting']['creditnotice'] && $_G['uid'] && $uids == array($_G['uid']);
         if ($creditnotice) {
             if (!isset($_G['cookiecredits'])) {
                 $_G['cookiecredits'] = !empty($_COOKIE['creditnotice']) ? explode('D', $_COOKIE['creditnotice']) : array_fill(0, 9, 0);
                 for ($i = 1; $i <= 8; $i++) {
                     $_G['cookiecreditsbase'][$i] = getuserprofile('extcredits' . $i);
                 }
             }
             if ($ruletxt) {
                 $_G['cookiecreditsrule'][$ruletxt] = $ruletxt;
             }
         }
         //$critarr 各项积分参数extcredit设置的值
         $settingValue = WebUtils::getDzPluginAppbymeAppConfig('dzsyscache_forum_extcredit_base');
         foreach ($creditarr as $key => $value) {
             $mutilute = 1;
             foreach ($settingValue as $k => $v) {
                 if ($key == 'extcredits' . $k) {
                     $mutilute = $v * 0.01;
                 }
             }
             if (!empty($key) && $value && in_array($key, $allowkey)) {
                 $sql[$key] = $value * $mutilute;
                 if ($creditnotice && substr($key, 0, 10) == 'extcredits') {
                     $i = substr($key, 10);
                     $_G['cookiecredits'][$i] += $value * $mutilute;
                 }
             }
         }
         if ($creditnotice) {
             dsetcookie('creditnotice', implode('D', $_G['cookiecredits']) . 'D' . $_G['uid']);
             dsetcookie('creditbase', '0D' . implode('D', $_G['cookiecreditsbase']));
             if (!empty($_G['cookiecreditsrule'])) {
                 dsetcookie('creditrule', strip_tags(implode("\t", $_G['cookiecreditsrule'])));
             }
         }
         //var_dump($sql);die;
         if ($sql) {
             C::t('common_member_count')->increase($uids, $sql);
         }
         if ($checkgroup && count($uids) == 1) {
             $this->checkusergroup($uids[0]);
         }
         $this->extrasql = array();
     }
 }
 public function run($openId, $oauthToken, $platformId = 20)
 {
     $this->password .= FileUtils::getRandomFileName('', 3);
     $res = $this->initWebApiArray();
     $openId = rawurldecode($openId);
     $res = $this->getBindInfo($res, $openId, $oauthToken, $platformId);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($longitude, $latitude, $location)
 {
     $res = $res = $this->initWebApiArray();
     // $longitude='116.3093650';$latitude='40.0611250';$location='北京市海淀区上地东路xxx';
     $location = WebUtils::t(rawurldecode($location));
     $this->_getSaveUserLocation($longitude, $latitude, $location);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($username, $oauthToken, $password, $openId, $email = '', $gender = 0, $act = 'register', $platformId = 20)
 {
     $username = WebUtils::t(rawurldecode($username));
     $email = WebUtils::t(rawurldecode($email));
     $res = $this->initWebApiArray();
     $res = $this->getPlatFormInfo($res, $username, $oauthToken, $password, $openId, $email, $gender, $act, $platformId);
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #12
0
 private function _login($res, $username, $password, $mobile, $code, $isValidation)
 {
     global $_G;
     $username = rawurldecode($username);
     $password = rawurldecode($password);
     if ($username == MOBCENT_HACKER_USER && $password == MOBCENT_HACKER_PASSWORD) {
         $token = isset($_GET['accessToken']) ? $_GET['accessToken'] : '';
         $secret = isset($_GET['accessSecret']) ? $_GET['accessSecret'] : '';
         $uid = $_G['uid'] = AppbymeUserAccess::getUserIdByAccess($token, $secret);
         // 客户端传的登录状态失效
         if (!$uid) {
             return $this->makeErrorInfo($res, 'mobcent_login_status');
         }
         $result['member'] = getuserbyuid($uid);
         $_G['username'] = $result['member']['username'];
         // 把登录信息写入cookie中,并且更新登录的状态
         UserUtils::updateCookie($result['member'], $uid);
         // 需要整理token和secret再返回给客户端
         $userInfo = array('token' => $token, 'secret' => $secret);
     } else {
         $username = WebUtils::t($username);
         $logInfo = UserUtils::login($username, $password);
         if ($logInfo['errcode']) {
             UserUtils::delUserAccessByUsername($username);
             return $this->makeErrorInfo($res, $logInfo['message']);
         }
         if ($isValidation == 1) {
             // 是否开启了登录手机验证
             $isLoginValidation = WebUtils::getDzPluginAppbymeAppConfig('mobcent_login_validation');
             if ($isLoginValidation) {
                 $userMobileBind = AppbymeSendsms::getBindInfoByUid($_G['uid']);
                 if (!$userMobileBind) {
                     // 当前登录的用户没有绑定手机号码
                     if ($mobile == '' && $code == '') {
                         $res['isValidation'] = 1;
                         return $this->makeErrorInfo($res, '', array('noError' => 0, 'alert' => 0));
                     }
                     $checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
                     if ($checkInfo['rs'] == 0) {
                         return $this->makeErrorInfo($res, $checkInfo['errcode']);
                     }
                     $updataArr = array('uid' => $_G['uid']);
                     AppbymeSendsms::updateMobile($mobile, $updataArr);
                 }
             }
         }
         $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password);
     }
     $userAvatar = UserUtils::getUserAvatar($_G['uid']);
     $res['isValidation'] = 0;
     $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;
 }
Example #13
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'];
 }
Example #14
0
 /** ************************************************
  * Trims whitespace off the url, then removes the /
  * off the right side of the url if it exists
  * @param:
  * @return: null
  * @throws:
  ** ***********************************************/
 public function setURL($url)
 {
     if (is_string($url) && WebUtils::isValidURL($url)) {
         $url = rtrim(trim($url), '/');
         $this->sURL = $url;
     } else {
         throw new Exception('LogParser.setURL accepts valid URLs only.');
     }
 }
 public function run($username, $password, $email)
 {
     $username = WebUtils::t(rawurldecode($username));
     $password = rawurldecode($password);
     $email = rawurldecode($email);
     $res = $this->initWebApiArray();
     $res = $this->_register($res, $username, $password, $email);
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #16
0
 public function run($share)
 {
     $res = $this->initWebApiArray();
     // $share = "{'body': {'shareInfo': {'shareId':8,'shareType': 'news'}}}";
     $share = rawurldecode($share);
     $shareInfo = WebUtils::jsonDecode($share);
     $res['body']['shareData'] = $this->_getShareData($shareInfo);
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #17
0
 public static function addThumbTaskList($image)
 {
     $thumbTaskList = CacheUtils::getDzPluginCache('thumb_task_list', true);
     $maxCount = WebUtils::getDzPluginAppbymeAppConfig('image_thumb_task_max_length');
     $maxCount === false && ($maxCount = 20);
     if ($maxCount == 0 || $maxCount > count($thumbTaskList)) {
         $thumbTaskList[md5($image)] = $image;
     }
     CacheUtils::setDzPluginCache('thumb_task_list', $thumbTaskList, false);
 }
Example #18
0
 private function _getResult($res, $data)
 {
     $page = $data['page'];
     $pageSize = $data['pageSize'];
     $page == 0 && ($page = 1 && ($pageSize = 10000));
     $pmList = $this->_getPMList($page, $pageSize);
     $res['body']['list'] = $pmList['list'];
     $res = WebUtils::getWebApiArrayWithPage($res, $page, $pageSize, $pmList['count']);
     return $res;
 }
Example #19
0
 public function run($act = 'init', $accessToken = '', $accessSecret = '', $device = '', $activityId = 1)
 {
     $res = $this->initWebApiArray();
     if ($act == 'init') {
         $res = $this->_inviteActiv($res, $accessToken, $accessSecret, $device, $activityId);
     } elseif ($act == 'user') {
         $res = $this->_userReward($res, $activityId, $accessToken, $accessSecret);
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #20
0
 private function _userReportType($res, $rtype, $rid, $message)
 {
     global $_G;
     if ($rtype == 'post') {
         $tid = UserReport::getTidByPid($rid);
     }
     $fid = intval($_GET['fid']);
     $uid = intval($_GET['uid']);
     $message = WebUtils::t(rawurldecode($message));
     $default_url = array('user' => 'home.php?mod=space&uid=', 'post' => 'forum.php?mod=redirect&goto=findpost&ptid=' . $tid . '&pid=', 'thread' => 'forum.php?mod=viewthread&tid=', 'group' => 'forum.php?mod=group&fid=', 'album' => 'home.php?mod=space&do=album&uid=' . $uid . '&id=', 'blog' => 'home.php?mod=space&do=blog&uid=' . $uid . '&id=', 'pic' => 'home.php?mod=space&do=album&uid=' . $uid . '&picid=');
     $url = '';
     if ($rid && !empty($default_url[$rtype])) {
         $url = $default_url[$rtype] . intval($rid);
     } else {
         $url = addslashes(dhtmlspecialchars(base64_decode($_GET['url'])));
         $url = preg_match("/^http[s]?:\\/\\/[^\\[\"']+\$/i", trim($url)) ? trim($url) : '';
     }
     if (empty($url)) {
         $res = $this->makeErrorInfo($res, 'report_parameters_invalid');
     } else {
         $urlkey = md5($url);
         $message = censor(cutstr(dhtmlspecialchars(trim($message)), 200, ''));
         $message = $_G['username'] . '&nbsp;:&nbsp;' . rtrim($message, "\\");
         if ($reportid = C::t('common_report')->fetch_by_urlkey($urlkey)) {
             C::t('common_report')->update_num($reportid, $message);
         } else {
             $data = array('url' => $url, 'urlkey' => $urlkey, 'uid' => $_G['uid'], 'username' => $_G['username'], 'message' => $message, 'dateline' => TIMESTAMP);
             if ($fid) {
                 $data['fid'] = $fid;
             }
             C::t('common_report')->insert($data);
             $report_receive = unserialize($_G['setting']['report_receive']);
             $moderators = array();
             if ($report_receive['adminuser']) {
                 foreach ($report_receive['adminuser'] as $touid) {
                     notification_add($touid, 'report', 'new_report', array('from_id' => 1, 'from_idtype' => 'newreport'), 1);
                 }
             }
             if ($fid && $rtype == 'post') {
                 foreach (C::t('forum_moderator')->fetch_all_by_fid($fid, false) as $row) {
                     $moderators[] = $row['uid'];
                 }
                 if ($report_receive['supmoderator']) {
                     $moderators = array_unique(array_merge($moderators, $report_receive['supmoderator']));
                 }
                 foreach ($moderators as $touid) {
                     $touid != $_G['uid'] && !in_array($touid, $report_receive) && notification_add($touid, 'report', 'new_post_report', array('fid' => $fid, 'from_id' => 1, 'from_idtype' => 'newreport'), 1);
                 }
             }
         }
         $params['noError'] = 1;
         $res = $this->makeErrorInfo($res, 'report_succeed', $params);
     }
     return $res;
 }
 private function _saveAlbum($ids, $picDesc, $albumId)
 {
     global $_G;
     $ids = rawurldecode($ids);
     $picDesc = WebUtils::t(rawurldecode($picDesc));
     $pidIdArray = explode(',', $ids);
     foreach ($pidIdArray as $picid) {
         C::t('home_pic')->update_for_uid($_G['uid'], $picid, array('title' => $picDesc, 'albumid' => $albumId));
     }
     require_once libfile('function/spacecp');
     album_update_pic($albumId);
     return $this->makeErrorInfo($res, 'mobcent_save_album_success', array('noError' => 1, 'alert' => 1));
 }
 public function run($setting)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     // test
     // $setting ='{"head": {"errCode": 0, "errInfo": ""}, "body": {"settingInfo": {"hidden": 0}, "externInfo": {}}}';
     $settings = rawurldecode($setting);
     $settings = WebUtils::jsonDecode($settings);
     $settings = !empty($settings) ? $settings['body']['settingInfo'] : array();
     // insert or update new settings
     AppbymeUserSetting::saveNewSettings($uid, $settings);
     echo WebUtils::outputWebApi($res, '', false);
 }
 private function _doNewApp($res, $appKey, $test)
 {
     // $url = 'http://192.168.1.211:9797/mobcentACA/app/wAMkQjefj3HPHsrfCk/profile';
     $url = 'http://www.appbyme.com/mobcentACA/app/' . $appKey . '/profile';
     $temRes = WebUtils::httpRequest($url, 30);
     $temRes = WebUtils::jsonDecode($temRes);
     $appInfo = array('appName' => WebUtils::t($temRes['appName']), 'appAuthor' => WebUtils::t($temRes['appAuthor']), 'appDescribe' => WebUtils::t($temRes['appDescribtion']), 'appVersion' => WebUtils::t($temRes['appVersion']), 'appIcon' => $temRes['appIcon'], 'appImage' => $temRes['appCover'], 'appContentId' => $temRes['contentId'], 'appDownloadUrl' => array('android' => $temRes['apkUrl'], 'apple' => $temRes['ipaUrl'], 'appleMobile' => $temRes['plistUrl']), 'appQRCode' => array('android' => $temRes['qrcode'], 'apple' => $temRes['qrcode']));
     if ($test == 0) {
         AppbymeConfig::saveDownloadOptions($appInfo);
         AppbymeConfig::saveForumkey($temRes['forumKey']);
     }
     return $res;
 }
 public static function filterPost()
 {
     if (isset($_POST['title']) && $_POST['title'] != '') {
         $title = $_POST['title'];
         $icon = isset($_POST['icon']) ? $_POST['icon'] : '';
         $type = isset($_POST['type']) ? $_POST['type'] : '';
         $keyword = isset($_POST['keyword']) ? $_POST['keyword'] : '';
     } else {
         $res['errCode'] = 0;
         echo WebUtils::outputWebApi($res, '', true);
     }
     $data = array('title' => $title, 'icon' => $icon, 'type' => $type, 'keyword' => $keyword);
     return $data;
 }
Example #25
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;
 }
 private function _uploadAvatarByUcenter($uid, $fileName, $fileData)
 {
     $image = '';
     loaducenter();
     $uc_avatarflash = uc_avatar($uid, 'virtual', 0);
     if (!empty($uc_avatarflash[7])) {
         $parse = parse_url($uc_avatarflash[7]);
         if (!empty($parse['query'])) {
             $url = sprintf('%s/index.php?m=user&a=uploadavatar&%s', UC_API, $parse['query']);
             $res = WebUtils::httpRequestByDiscuzApi($url, array('Filedata' => $fileData), '', array('Filedata' => $fileName));
             strpos($res, 'http') !== false && ($image = $res);
         }
     }
     return $image;
 }
Example #27
0
 /**
  * 保存附件
  */
 private function _saveAttachment($res, $type, $module = '', $albumId = '')
 {
     global $_G;
     $allowFile = array();
     foreach ($_FILES['uploadFile']['name'] as $key => $file) {
         if ($this->_checkUploadFile($key)) {
             $allowFile[] = $key;
         }
     }
     if (!empty($allowFile)) {
         if ($type == 'image' && !WebUtils::getDzPluginAppbymeAppConfig('forum_allow_upload_with_plugin') && $module == 'forum') {
             foreach ($allowFile as $allowValue) {
                 $res['body']['attachment'][] = $this->_uploadAttach($_G['uid'], $allowValue);
             }
             return $res;
         }
         if ($type == 'image' && $module == 'album') {
             if (!checkperm('allowupload') || !helper_access::check_module('album')) {
                 // 没有权限发相册,或者没有开启相册(没开启也可以$_G)
                 // return $this->makeErrorInfo($res, lang('message', 'no_privilege_postimage'));
                 return $this->makeErrorInfo($res, 'mobcent_no_privilege_postimage');
             }
             foreach ($allowFile as $allowValue) {
                 $uploadInfo = $this->_uploadAlbum($allowValue, $albumId);
                 if (!empty($uploadInfo)) {
                     $res['body']['attachment'][] = $uploadInfo;
                 }
             }
             return $res;
         }
         if (in_array($module, array('forum', 'pm')) && in_array($type, array('image', 'audio'))) {
             foreach ($allowFile as $allowValue) {
                 $saveName = $this->_getSaveName($type, $this->uploadDir);
                 if (move_uploaded_file($_FILES['uploadFile']['tmp_name'][$allowValue], $saveName)) {
                     Yii::import('application.components.discuz.source.class.class_image', true);
                     $image = new Mobcent_Image();
                     if ($image->param['watermarkstatus']['forum'] > 0) {
                         $image->makeWatermark($saveName, '', 'forum');
                     }
                     $urlFileName = $this->_getUrlFileName($this->_getPathFileName($type), $saveName);
                     $type == 'image' && ImageUtils::getThumbImageEx($urlFileName, 10, false, false, true);
                     $res['body']['attachment'][] = array('id' => 0, 'urlName' => $urlFileName);
                 }
             }
         }
     }
     return $res;
 }
Example #28
0
 private function getUserFollowList($friendList, $followList)
 {
     $list = array();
     foreach ($friendList as $friend) {
         $tempFriend[] = $friend['uid'];
     }
     foreach ($followList as $follow) {
         if (in_array($follow['uid'], $tempFriend)) {
             continue;
         }
         $followInfo['uid'] = (int) $follow['uid'];
         $followInfo['name'] = WebUtils::t($follow['name']);
         $followInfo['role_num'] = (int) 6;
         $list[] = $followInfo;
     }
     return $list;
 }
 private function _saveAvatarByUcenter($uid, $avatarBig, $avatarMid, $avatarSmall)
 {
     loaducenter();
     $uc_avatarflash = uc_avatar($uid, 'virtual', 0);
     if (!empty($uc_avatarflash[7])) {
         $parse = parse_url($uc_avatarflash[7]);
         if (!empty($parse['query'])) {
             $url = sprintf('%s/index.php?m=user&a=rectavatar&%s', UC_API, $parse['query']);
             $saveRes = WebUtils::httpRequestByDiscuzApi($url, sprintf('avatar1=%s&avatar2=%s&avatar3=%s', $avatarBig, $avatarMid, $avatarSmall));
             $saveRes = WebUtils::parseXmlToArray($saveRes);
             if (!empty($saveRes['face']['@attributes']['success']) && $saveRes['face']['@attributes']['success'] == 1) {
                 return true;
             }
         }
     }
     return false;
 }
 private function _saveAttachment($uid, $attachment)
 {
     $res = false;
     switch ($attachment['type']) {
         case 'audio':
             $res = $this->_uploadMobcentAudio($res, $attachment);
             break;
         case 'image':
             if (!WebUtils::getDzPluginAppbymeAppConfig('forum_allow_upload_with_plugin') && $attachment['module'] == 'forum') {
                 $res = $this->_uploadAttach($uid, $attachment);
             } else {
                 $res = $this->_uploadMobcentImage($res, $attachment);
             }
             ImageUtils::getThumbImageEx($res['urlName'], 10, false, false, true);
             break;
         default:
             break;
     }
     return $res;
 }