本文整理汇总了PHP中WebUtils::initWebApiArray方法的典型用法代码示例。如果您正苦于以下问题:PHP WebUtils::initWebApiArray方法的具体用法?PHP WebUtils::initWebApiArray怎么用?PHP WebUtils::initWebApiArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebUtils
的用法示例。
在下文中一共展示了WebUtils::initWebApiArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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);
}
示例2: initWebApiArray_oldVersion
public static function initWebApiArray_oldVersion()
{
$res = WebUtils::initWebApiArray();
$res = array_merge(array('rs' => 1, 'errcode' => ''), $res);
return $res;
}
示例3: getResult
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;
}