public function run($longitude, $latitude, $poi = 'user', $page = 1, $pageSize = 10, $radius = 100000) { $res = WebUtils::initWebApiArray(); $res = array_merge(array('rs' => 1, 'errcode' => 0), $res); $uid = $this->getController()->uid; $SurroundingType = $poi; // get infos with type $infos = array(); switch ($SurroundingType) { case 'user': $infos = $this->_getUserInfos($uid, $longitude, $latitude, $radius, $page, $pageSize); break; case 'topic': $infos = $this->_getTopicInfos($uid, $longitude, $latitude, $radius, $page, $pageSize); break; default: break; } $list = $infos['list']; $count = $infos['count']; $res['pois'] = $list; $res = array_merge($res, WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $count)); echo WebUtils::outputWebApi($res, '', false); }
public static function initWebApiArray_oldVersion() { $res = WebUtils::initWebApiArray(); $res = array_merge(array('rs' => 1, 'errcode' => ''), $res); return $res; }
protected function getResult($params = array()) { extract($params); $res = WebUtils::initWebApiArray(); $res = array_merge(array('rs' => 1, 'errcode' => ''), $res); $topic = ForumUtils::getTopicInfo($tid); if (empty($topic)) { return $this->_makeErrorInfo($res, 'thread_nonexistence'); } // 该主题是由别的版块移动过来的 if ($topic['closed'] > 1) { $tid = $topic['closed']; $topic['tid'] = $tid; } $app = Yii::app()->getController()->mobcentDiscuzApp; $app->loadForum($topic['fid'], $topic['tid']); // 检查权限 global $_G; if (empty($_G['forum']['allowview'])) { if (!$_G['forum']['viewperm'] && !$_G['group']['readaccess']) { return $this->_makeErrorInfo($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle'])); } elseif ($_G['forum']['viewperm'] && !forumperm($_G['forum']['viewperm'])) { $msg = mobcent_showmessagenoperm('viewperm', $_G['fid']); return $this->_makeErrorInfo($res, $msg['message'], $msg['params']); } } elseif ($_G['forum']['allowview'] == -1) { return $this->_makeErrorInfo($res, 'forum_access_view_disallow'); } if ($_G['forum']['formulaperm']) { $msg = mobcent_formulaperm($_G['forum']['formulaperm']); if ($msg['message'] != '') { return $this->_makeErrorInfo($res, $msg['message'], $msg['params']); } } // if($_G['forum']['password'] && $_G['forum']['password'] != $_G['cookie']['fidpw'.$_G['fid']]) { // dheader("Location: $_G[siteurl]forum.php?mod=forumdisplay&fid=$_G[fid]"); // } if ($_G['forum']['password']) { 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) { // dheader("Location: $_G[siteurl]forum.php?mod=forumdisplay&fid=$_G[fid]"); } } if ($_G['forum_thread']['readperm'] && $_G['forum_thread']['readperm'] > $_G['group']['readaccess'] && !$_G['forum']['ismoderator'] && $_G['forum_thread']['authorid'] != $_G['uid']) { return $this->_makeErrorInfo($res, 'thread_nopermission', array('{readperm}' => $_G['forum_thread']['readperm'])); } // 编辑权限相关 start if ($_G['forum']['alloweditpost'] && $_G['uid']) { $alloweditpost_status = getstatus($_G['setting']['alloweditpost'], $_G['forum_thread']['special'] + 1); if (!$alloweditpost_status) { $edittimelimit = $_G['group']['edittimelimit'] * 60; } } $editPerm = array(); $editPerm['alloweditpost_status'] = $alloweditpost_status; $editPerm['edittimelimit'] = $edittimelimit; // edit end $params = array('editPerm' => $editPerm); if ($page <= 1 && ($authorId == 0 || $authorId == $topic['authorid'])) { $res['topic'] = $this->_getTopicInfo($topic, $params); if (empty($res['topic'])) { return $this->_makeErrorInfo($res, 'post_not_found'); } } $res = $this->_getPostInfos($res, $topic, $page, $pageSize, $order, $authorId, $params); $res['forumName'] = WebUtils::emptyHtml($_G['forum']['name']); $res['forumTopicUrl'] = Yii::app()->getController()->dzRootUrl . "/forum.php?mod=viewthread&tid=" . $tid; $res['img_url'] = ''; $res['icon_url'] = ''; Mobcent::import(sprintf('%s/forum_viewthread_%s.php', MOBCENT_APP_ROOT . '/components/discuz/forum', MobcentDiscuz::getMobcentDiscuzVersion())); viewthread_updateviews($_G['forum_thread']['threadtableid']); // print_r($res);die; return $res; }