public function run($keyword, $page = 1, $pageSize = 10, $searchid = 0)
 {
     $keyword = rawurldecode($keyword);
     $res = WebUtils::initWebApiArray_oldVersion();
     $res = $this->_getForumData($res, $keyword, $page, $pageSize, $searchid);
     echo WebUtils::outputWebApi($res, '', false);
 }
Beispiel #2
0
 public function run($type = 'follow', $page = 1, $pageSize = 10, $orderBy = 'dateline', $longitude = '', $latitude = '', $radius = 100000)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     switch ($orderBy) {
         case 'register':
             $sortType = 'regdate';
             break;
         case 'login':
             $sortType = 'lastvisit';
             break;
         case 'followed':
             $sortType = 'follower';
             break;
         case 'distance':
             $sortType = 'range';
             break;
         case 'dateline':
             $sortType = 'default';
             break;
         case 'at':
             $sortType = 'at';
             break;
         default:
             break;
     }
     global $_G;
     $uid = $_G['uid'];
     $viewUid = isset($_GET['uid']) ? $_GET['uid'] : $uid;
     $res = $this->_getUserInfoList($res, $type, $uid, $viewUid, $page, $pageSize, $sortType, $longitude, $latitude, $radius);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($tid, $act = 'apply')
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // $_REQUEST['json'] = "{'payment':1,'payvalue':100, 'realname': '请求参数11', 'qq': '8', 'message': '请求参数'}";
     $json = isset($_REQUEST['json']) ? $_REQUEST['json'] : '';
     $json = rawurldecode($json);
     $data = WebUtils::jsonDecode($json);
     if (!empty($data)) {
         foreach ($data as $key => $value) {
             if (is_string($value)) {
                 $data[$key] = WebUtils::t($value);
             }
         }
         switch ($act) {
             case 'apply':
                 $res = $this->_applyActivityTopic($res, $tid, $uid, $data);
                 break;
             case 'cancel':
                 $res = $this->_cancelActivityTopic($res, $tid, $uid, $data);
                 break;
             default:
                 $res = $this->_makeErrorInfo($res, 'activity_apply_params_error');
                 break;
         }
     } else {
         $res = $this->_makeErrorInfo($res, 'activity_apply_params_error');
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Beispiel #4
0
 public static function endAppWithErrorInfo($res, $message, $params = array())
 {
     $tmpRes = WebUtils::initWebApiArray_oldVersion();
     $tmpRes = WebUtils::makeErrorInfo_oldVersion($tmpRes, $message, $params);
     $tmpRes = array_merge($tmpRes, $res);
     WebUtils::outputWebApi($tmpRes);
 }
 public function run($uid, $albumId, $page = 1, $pageSize = 10)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $landUid = $this->getController()->uid;
     $res = $this->_getImageInfoList($res, $landUid, $uid, $page, $pageSize, $albumId);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($attachment)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // $attachment ="{'head': {'errCode': 0, 'errInfo': ''}, 'body': {'attachment': {'name': 'test', 'isPost': 1, 'data': 'ss', 'type': 'image', 'module':'forum'}, 'externInfo': {}}}";
     $attachment = rawurldecode($attachment);
     $attachment = WebUtils::jsonDecode($attachment);
     $attachment = isset($attachment['body']['attachment']) ? $attachment['body']['attachment'] : array();
     !isset($attachment['module']) && ($attachment['module'] = 'forum');
     $resAttachment = false;
     if (!empty($attachment)) {
         if ($attachment['isPost'] == 1) {
             if (($data = file_get_contents('php://input')) === false) {
                 $attachment['data'] = $GLOBALS['HTTP_RAW_POST_DATA'];
             } else {
                 $attachment['data'] = $data;
             }
         }
         // $attachment['data'] = WebUtils::httpRequest('http://bbs.appbyme.com/static/image/common/logo.png');// test
         $resAttachment = $this->_saveAttachment($uid, $attachment);
     }
     if ($resAttachment === false) {
         $attachmentTypes = array('audio' => WebUtils::t('语音'), 'image' => WebUtils::t('图片'));
         $res = WebUtils::makeErrorInfo_oldVersion($res, 'UPLOAD_ATTACHMENT_ERROR', array('{attachment}' => $attachmentTypes[$attachment['type']]));
     } else {
         $res['body']['attachment'] = $resAttachment;
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Beispiel #7
0
 public function run()
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     global $_G;
     $uid = $_G['uid'];
     $puid = isset($_GET['userId']) ? $_GET['userId'] : $uid;
     $res = $this->_getUserInfo($res, $uid, $puid);
     $res['info'] = array();
     echo WebUtils::outputWebApi($res, '', false);
 }
Beispiel #8
0
 public function run($page = 1, $pageSize = 10)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     $params = array('type' => 'friend', 'orderBy' => 'at', 'page' => 0, 'uid' => $uid);
     $friend = $this->_getForWardInfo($params);
     $params = array('type' => 'follow', 'orderBy' => 'dateline', 'page ' => 0, 'uid' => $uid);
     $follow = $this->_getForWardInfo($params);
     $res = $this->_getUserPostFriendPagingListInfo($res, $friend, $follow, $page, $pageSize);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run()
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $_GET['uid'];
     $page = $_GET['page'] ? $_GET['page'] : 1;
     $pageSize = $_GET['pageSize'] ? $_GET['pageSize'] : 10;
     $type = $_GET['type'];
     $idType = $_GET['idType'] ? $_GET['idType'] : 'tid';
     $res = $this->_getTopicList($res, $type, $idType, $uid, $page, $pageSize, $idtype);
     echo WebUtils::outputWebApi($res, '', false);
 }
Beispiel #10
0
 public function run($json)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     // $json = "{'id': 1, 'idType': 'aid', 'page': 1, 'pageSize': 10, }";
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     $res = $this->_checkComment($res, $json);
     if (!WebUtils::checkError($res)) {
         $comments = $this->getCommentList($json);
         $res['body']['list'] = $comments['list'];
         $res = array_merge($res, WebUtils::getWebApiArrayWithPage($res, $json['page'], $json['pageSize'], $comments['count']));
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($json)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     // $json = "{'action': 'reply', 'idType': 'aid', 'id': 1, 'content': [{'type': 0, 'infor': '呵呵\r\nhaha%25E5%2591%25B5%25E5%2591%25B5%25E2%2580%259C%25E2%2580%259D%2522%2522',}], 'quoteCommentId': 12, }";
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['action']) && ($json['action'] = 'reply');
     !isset($json['idType']) && ($json['idType'] = 'aid');
     switch ($json['action']) {
         case 'reply':
             $res = $this->_commentReply($res, $json);
             break;
         default:
             $res = WebUtils::makeErrorInfo_oldVersion($res, 'mobcent_error_params');
             break;
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Beispiel #12
0
 public function run()
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // get reply info
     $res['body']['replyInfo'] = $this->_getNotifyInfo($uid, 'post');
     // get @me info
     $res['body']['atMeInfo'] = $this->_getNotifyInfo($uid, 'at');
     // 获取好友通知
     $res['body']['friendInfo'] = $this->_getNotifyInfo($uid, 'friend');
     // get private message that client unreceived
     $res['body']['pmInfos'] = $this->_getPmInfos($uid);
     if (($heartPeriod = WebUtils::getDzPluginAppbymeAppConfig('message_period')) <= 0) {
         $heartPeriod = MINUTE_SECONDS * 2;
     }
     if (($pmPeriod = WebUtils::getDzPluginAppbymeAppConfig('message_pm_period')) <= 0) {
         $pmPeriod = 20;
     }
     $res['body']['externInfo']['heartPeriod'] = $heartPeriod . '000';
     $res['body']['externInfo']['pmPeriod'] = $pmPeriod . '000';
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($type = 'post', $page = 1, $pageSize = 20)
 {
     require_once libfile('function/friend');
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     $notifyInfo = $this->_getNotifyInfo($uid, $type, $page, $pageSize);
     $list = $notifyInfo['list'];
     $count = $notifyInfo['count'];
     $res = array_merge($res, WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $count));
     $res['list'] = $list;
     $res['body']['data'] = $notifyInfo['data'];
     // $transaction = Yii::app()->dbDz->beginTransaction();
     // try {
     echo WebUtils::outputWebApi($res, '', false);
     $this->_updateReadStatus($uid, $type);
     //  $transaction->commit();
     // } catch(Exception $e) {
     //  var_dump($e);
     //     $transaction->rollback();
     // }
     Yii::app()->end();
 }
Beispiel #14
0
 public function run()
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $res = $this->_startSign($res);
     echo WebUtils::outputWebApi($res, '', false);
 }
Beispiel #15
0
 public function run()
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $res['list'] = $this->_getModuleList();
     echo WebUtils::outputWebApi($res, '', false);
 }
 protected function getResult($params = array())
 {
     extract($params);
     $res = WebUtils::initWebApiArray_oldVersion();
     if ($fid != 0) {
         ForumUtils::initForum($fid);
         // check permisson
         global $_G;
         if (empty($_G['forum']['fid'])) {
             return $this->_makeErrorInfo($res, 'forum_nonexistence');
         }
         if ($_G['forum']['viewperm'] && !forumperm($_G['forum']['viewperm']) && !$_G['forum']['allowview']) {
             $msg = mobcent_showmessagenoperm('viewperm', $_G['fid'], $_G['forum']['formulaperm']);
             return $this->_makeErrorInfo($res, $msg['message'], $msg['params']);
         } elseif ($_G['forum']['formulaperm']) {
             $msg = mobcent_formulaperm($_G['forum']['formulaperm']);
             if ($msg['message'] != '') {
                 return $this->_makeErrorInfo($res, $msg['message'], $msg['params']);
             }
         }
         if ($_G['forum']['password']) {
             if ($_GET['action'] == 'pwverify') {
                 if ($_GET['pw'] != $_G['forum']['password']) {
                     showmessage('forum_passwd_incorrect', NULL);
                 } else {
                     dsetcookie('fidpw' . $_G['fid'], $_GET['pw']);
                     showmessage('forum_passwd_correct', "forum.php?mod=forumdisplay&fid={$_G['fid']}");
                 }
                 // } elseif($_G['forum']['password'] != $_G['cookie']['fidpw'.$_G['fid']]) {
             } else {
                 // include template('forum/forumdisplay_passwd');
                 // exit();
                 return $this->_makeErrorInfo($res, 'mobcent_forum_passwd');
             }
         }
         if ($_G['forum']['price'] && !$_G['forum']['ismoderator']) {
             $membercredits = C::t('common_member_forum_buylog')->get_credits($_G['uid'], $_G['fid']);
             $paycredits = $_G['forum']['price'] - $membercredits;
             if ($paycredits > 0) {
                 // if($_GET['action'] == 'paysubmit') {
                 //     updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][1] => -$paycredits), 1, 'FCP', $_G['fid']);
                 //     C::t('common_member_forum_buylog')->update_credits($_G['uid'], $_G['fid'], $_G['forum']['price']);
                 //     showmessage('forum_pay_correct', "forum.php?mod=forumdisplay&fid=$_G[fid]");
                 // } else {
                 if (getuserprofile('extcredits' . $_G['setting']['creditstransextra'][1]) < $paycredits) {
                     return $this->makeErrorInfo($res, lang('message', 'forum_pay_incorrect', array('paycredits' => $paycredits, 'credits' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['unit'] . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['title'], 'title' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['title'])));
                 } else {
                     return $this->makeErrorInfo($res, 'forum_pay_incorrect_paying', array('{paycredits}' => $paycredits, '{credits}' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['unit'] . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['title'], 'title' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['title']));
                     // include template('forum/forumdisplay_pay');
                     // exit();
                 }
                 // }
             }
         }
     }
     $res['newTopicPanel'] = $this->_getNewTopicPanel();
     $topicClassfications = $this->_getTopicClassificationInfos($fid);
     $res['classificationTop_list'] = $topicClassfications['sorts'];
     $res['classificationType_list'] = $topicClassfications['types'];
     $res['isOnlyTopicType'] = $topicClassfications['requireTypes'] ? 1 : 0;
     // 获取公告列表
     $hasAnnouncements = $fid != 0 && $page == 1;
     $res['anno_list'] = !$hasAnnouncements ? array() : $this->_getAnnouncementList($sort);
     $topicInfos = $this->_getTopicInfos($fid, $page, $pageSize, $sort, $filterType, $filterId, $isImageList, $topOrder);
     $list = $topicInfos['list'];
     $topTopicList = $topicInfos['topTopicList'];
     $count = $topicInfos['count'];
     $res['forumInfo'] = $this->_getForumInfo($fid);
     $res['topTopicList'] = $topTopicList;
     $res['list'] = $list;
     $res = array_merge($res, WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $count));
     return $res;
 }
 protected function initWebApiArray()
 {
     return WebUtils::initWebApiArray_oldVersion();
 }
 public function run($page = 1, $pageSize = 10)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $res = $this->_getImageList($res, $page, $pageSize);
     echo WebUtils::outputWebApi($res, '', false);
 }