当前位置: 首页>>代码示例>>PHP>>正文


PHP vB_Api::instance方法代码示例

本文整理汇总了PHP中vB_Api::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP vB_Api::instance方法的具体用法?PHP vB_Api::instance怎么用?PHP vB_Api::instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vB_Api的用法示例。


在下文中一共展示了vB_Api::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: call

 public function call($forumid, $perpage = 20, $pagenumber = 1)
 {
     $contenttype = vB_Api::instance('contenttype')->fetchContentTypeIdFromClass('Channel');
     $forum = vB_Api::instance('node')->getNodeFullContent($forumid);
     if (empty($forum) or isset($forum['errors'])) {
         return array("response" => array("errormessage" => array("invalidid")));
     }
     $forum = $forum[$forumid];
     $modPerms = vB::getUserContext()->getModeratorPerms($forum);
     $foruminfo = array('forumid' => $forum['nodeid'], 'title' => vB_String::unHtmlSpecialChars($forum['title']), 'description' => $forum['description'], 'title_clean' => $forum['htmltitle'], 'description_clean' => strip_tags($forum['description']), 'prefixrequired' => 0);
     $nodes = vB_Api::instance('node')->fetchChannelNodeTree($forumid, 3);
     $channels = array();
     if (!empty($nodes) and empty($nodes['errors']) and isset($nodes['channels']) and !empty($nodes['channels'])) {
         foreach ($nodes['channels'] as $node) {
             $channels[] = vB_Library::instance('vb4_functions')->parseForum($node);
         }
     }
     $forumbits = $channels;
     $topics = array();
     $topics_sticky = array();
     $page_nav = vB_Library::instance('vb4_functions')->pageNav(1, $perpage, 1);
     $search = array("channel" => $forumid);
     $search['view'] = vB_Api_Search::FILTER_VIEW_TOPIC;
     $search['depth'] = 1;
     $search['include_sticky'] = true;
     $search['sort']['lastcontent'] = 'desc';
     $search['nolimit'] = 1;
     $topic_search = vB_Api::instanceInternal('search')->getInitialResults($search, $perpage, $pagenumber, true);
     if (!isset($topic_search['errors']) and !empty($topic_search['results'])) {
         $topic_search['results'] = vB_Api::instance('node')->mergeNodeviewsForTopics($topic_search['results']);
         foreach ($topic_search['results'] as $key => $node) {
             if ($node['content']['contenttypeclass'] == 'Channel' or $node['content']['starter'] != $node['content']['nodeid']) {
                 unset($topic_search['results'][$key]);
             } else {
                 $topic = vB_Library::instance('vb4_functions')->parseThread($node);
                 if ($topic['thread']['sticky']) {
                     $topics_sticky[] = $topic;
                 } else {
                     $topics[] = $topic;
                 }
             }
         }
         $page_nav = vB_Library::instance('vb4_functions')->pageNav($topic_search['pagenumber'], $perpage, $topic_search['totalRecords']);
     }
     $inlinemod = $forum['canmoderate'] ? 1 : 0;
     $subscribed = vB_Api::instance('follow')->isFollowingContent($forum['nodeid']);
     $subscribed = $subscribed ? 1 : 0;
     $forumsearch = vB::getUserContext()->hasPermission('forumpermissions', 'cansearch');
     $response = array();
     $response['response']['forumbits'] = $forumbits;
     $response['response']['foruminfo'] = $foruminfo;
     $response['response']['threadbits'] = $topics;
     $response['response']['threadbits_sticky'] = $topics_sticky;
     $response['response']['pagenav'] = $page_nav;
     $response['response']['pagenumber'] = intval($pagenumber);
     $response['show'] = array('subscribed_to_forum' => $subscribed, 'inlinemod' => $inlinemod, 'spamctrls' => $modPerms['candeleteposts'] > 0 ? 1 : 0, 'openthread' => $modPerms['canopenclose'] > 0 ? 1 : 0, 'approvethread' => $modPerms['canmoderateposts'] > 0 ? 1 : 0, 'movethread' => $modPerms['canmassmove'] > 0 ? 1 : 0, 'forumsearch' => $forumsearch, 'stickies' => count($topics_sticky) > 0 ? 1 : 0);
     return $response;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:58,代码来源:forumdisplay.php

示例2: appendAttachments

 function appendAttachments($nodeid, $posthash)
 {
     if (!empty($posthash) and !empty($nodeid)) {
         $filedataids = vB_Library::instance('vb4_posthash')->getFiledataids($posthash);
         foreach ($filedataids as $filedataid) {
             $result = vB_Api::instance('node')->addAttachment($nodeid, array('filedataid' => $filedataid['filedataid']));
             if (empty($result) || !empty($result['errors'])) {
                 // Ignore attachment errors
             }
         }
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:12,代码来源:posthash.php

示例3: getNewRouteInfo

 protected function getNewRouteInfo()
 {
     // go to home page if path is exactly like prefix
     if (count($this->matches) == 1 and empty($this->queryParameters)) {
         $blogHomeChannelId = vB_Api::instance('blog')->getBlogChannel();
         $blogHomeChannel = vB_Library::instance('content_channel')->getBareContent($blogHomeChannelId);
         $blogHomeChannel = $blogHomeChannel[$blogHomeChannelId];
         return $blogHomeChannel['routeid'];
     }
     $this->oldcontenttypeid = vB_Api_ContentType::OLDTYPE_BLOGCHANNEL;
     return parent::getNewRouteInfo();
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:12,代码来源:blog.php

示例4: buddylist

 public function buddylist()
 {
     $followers = vB_Api::instance('follow')->getFollowers($userid, array('page' => $pagenumber, 'perpage' => $perpage));
     if ($followers === null || isset($followers['errors'])) {
         return vB_Library::instance('vb4_functions')->getErrorResponse($followers);
     }
     $friends = array();
     foreach ($followers['results'] as $friend) {
         $friends[] = array('buddy' => array('userid' => $friend['userid'], 'username' => $friend['username']));
     }
     return array('response' => array('offlineusers' => $friends));
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:12,代码来源:misc.php

示例5: do_upload_avatar

function do_upload_avatar()
{
    $cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('upload' => vB_Cleaner::TYPE_FILE));
    if (empty($cleaned['upload'])) {
        return json_error(ERR_NO_PERMISSION);
    }
    $upload_result = vB_Api::instance('profile')->upload($cleaned['upload']);
    if (!empty($upload_result['errors'])) {
        return json_error(ERR_NO_PERMISSION);
    }
    return true;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:12,代码来源:profile.php

示例6: editpost

 public function editpost($postid)
 {
     $cleaner = vB::getCleaner();
     $postid = $cleaner->clean($postid, vB_Cleaner::TYPE_UINT);
     $post = vB_Api::instance('node')->getFullContentforNodes(array($postid));
     if (empty($post)) {
         return array("response" => array("errormessage" => array("invalidid")));
     }
     $post = $post[0];
     $prefixes = vB_Library::instance('vb4_functions')->getPrefixes($postid);
     $options = vB::getDatastore()->getValue('options');
     $out = array('show' => array('tag_option' => 1), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars']), 'response' => array('prefix_options' => $prefixes, 'poststarttime' => 0, 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash()));
     return $out;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:14,代码来源:editpost.php

示例7: facebook

 /**
  * Login with fabecook logged user
  *
  * @param  [string] $signed_request [fb info]
  * @return [array]                  [response -> errormessage and session params]
  */
 public function facebook($signed_request)
 {
     $cleaner = vB::getCleaner();
     $signed_request = $cleaner->clean($signed_request, vB_Cleaner::TYPE_STR);
     $user_api = vB_Api::instance('user');
     $loginInfo = $user_api->loginExternal('facebook', array('signedrequest' => $signed_request));
     if (empty($loginInfo) || isset($loginInfo['errors'])) {
         //the api doesn't allow us to be that specific about our errors here.
         //and the app gets very cranky if the login returns an unexpected error code
         return array('response' => array('errormessage' => array('badlogin_facebook')));
     }
     $result = array('session' => array('dbsessionhash' => $loginInfo['login']['sessionhash'], 'userid' => $loginInfo['login']['userid']), 'response' => array('errormessage' => array('redirect_login')));
     return $result;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:20,代码来源:login.php

示例8: docopythread

 public function docopythread($threadid, $destforumid)
 {
     $cleaner = vB::getCleaner();
     $threadid = $cleaner->clean($threadid, vB_Cleaner::TYPE_UINT);
     $destforumid = $cleaner->clean($destforumid, vB_Cleaner::TYPE_UINT);
     if (empty($threadid) || empty($destforumid)) {
         return array('response' => array('errormessage' => 'invalidid'));
     }
     $result = vB_Api::instance('node')->cloneNodes(array($threadid), $destforumid);
     if ($result === null || isset($result['errors'])) {
         return vB_Library::instance('vb4_functions')->getErrorResponse($result);
     } else {
         return array('response' => array('errormessage' => array('redirect_movethread')));
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:15,代码来源:postings.php

示例9: do_subscribe_thread

function do_subscribe_thread()
{
    $userinfo = vB_Api::instance('user')->fetchUserInfo();
    if ($userinfo['userid'] < 1) {
        return json_error(ERR_NO_PERMISSION);
    }
    $cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('threadid' => vB_Cleaner::TYPE_UINT));
    if (empty($cleaned['threadid'])) {
        return json_error(ERR_INVALID_SUB);
    }
    $result = vB_Api::instance('follow')->add($cleaned['threadid'], vB_Api_Follow::FOLLOWTYPE_CONTENT);
    if (empty($result) || !empty($result['errors'])) {
        return json_error(ERR_INVALID_SUB);
    }
    return true;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:16,代码来源:subscriptions.php

示例10: do_get_announcement

function do_get_announcement()
{
    $cleaned = vB::getCleaner()->cleanArray($_REQUEST, array('forumid' => vB_Cleaner::TYPE_UINT));
    if (!isset($cleaned['forumid']) || $cleaned['forumid'] < 1) {
        return json_error(ERR_NO_PERMISSION);
    }
    $result = vB_Api::instance('announcement')->fetch($cleaned['forumid']);
    if ($result === null || isset($result['errors'])) {
        return json_error(ERR_NO_PERMISSION);
    }
    $posts = array();
    foreach ($result as $ann) {
        $posts[] = fr_parse_post($ann);
    }
    return array('posts' => $posts, 'total_posts' => count($posts));
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:16,代码来源:announcement.php

示例11: newthread

 public function newthread($forumid)
 {
     $cleaner = vB::getCleaner();
     $forumid = $cleaner->clean($forumid, vB_Cleaner::TYPE_UINT);
     $forum = vB_Api::instance('node')->getFullContentforNodes(array($forumid));
     if (empty($forum)) {
         return array("response" => array("errormessage" => array("invalidid")));
     }
     $forum = $forum[0];
     $foruminfo = vB_Library::instance('vb4_functions')->parseForumInfo($forum);
     $prefixes = vB_Library::instance('vb4_functions')->getPrefixes($forumid);
     $options = vB::getDatastore()->getValue('options');
     $postattachment = $forum['content']['createpermissions']['vbforum_attach'];
     $postattachment = empty($postattachment) ? 0 : intval($postattachment);
     $usercontext = vB::getUserContext($this->currentUserId);
     $maxtags = $usercontext->getChannelLimits($forumid, 'maxstartertags');
     $out = array('show' => array('tag_option' => 1), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars'], 'maxtags' => $maxtags), 'response' => array('forumrules' => array('can' => array('postattachment' => $postattachment)), 'prefix_options' => $prefixes, 'foruminfo' => $foruminfo, 'poststarttime' => vB::getRequest()->getTimeNow(), 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash()));
     return $out;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:19,代码来源:newthread.php

示例12: isViglinkEnabled

 public function isViglinkEnabled($prev, $feature = self::VIGLINK_FEATURE_ALL)
 {
     $utils = new Viglink_Utils();
     $is_enabled = (bool) vB::getDatastore()->getOption('viglink_enabled');
     $has_key = (bool) vB_Api::instance('site')->getViglinkKey();
     $args = func_get_args();
     $enabled = $is_enabled && $has_key;
     switch ($feature) {
         case self::VIGLINK_FEATURE_ALL:
             return $enabled;
         case self::VIGLINK_FEATURE_LII:
             // disabled for one of this user's groups?
             $disabled_group_ids = json_decode($utils->getOption('lii_excluded_usergroups', '[]'));
             $user_disabled_group_ids = array_intersect($disabled_group_ids, vB::getUserContext()->fetchUserGroups());
             $lii_enabled_for_groups = empty($user_disabled_group_ids);
             $lii_enabled = $lii_enabled_for_groups;
             return $enabled && $lii_enabled;
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:19,代码来源:site.php

示例13: sendemail

 public function sendemail($postid, $reason)
 {
     $cleaner = vB::getCleaner();
     $postid = $cleaner->clean($postid, vB_Cleaner::TYPE_UINT);
     $reason = $cleaner->clean($reason, vB_Cleaner::TYPE_STR);
     if (empty($postid)) {
         return array('response' => array('errormessage' => array('invalidid')));
     }
     if (empty($reason)) {
         return array('response' => array('errormessage' => array('invalidid')));
     }
     $userinfo = vB_Api::instance('user')->fetchUserinfo();
     $data = array('reportnodeid' => $postid, 'rawtext' => $reason, 'created' => vB::getRequest()->getTimeNow(), 'userid' => $userinfo['userid'], 'authorname' => $userinfo['username']);
     $result = vB_Api::instance('content_report')->add($data, array('wysiwyg' => false));
     if ($result === null || isset($result['errors'])) {
         return vB_Library::instance('vb4_functions')->getErrorResponse($result);
     }
     return array('response' => array('errormessage' => array('redirect_reportthanks')));
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:19,代码来源:report.php

示例14: newreply

 public function newreply($threadid, $disablesmilies = false)
 {
     $cleaner = vB::getCleaner();
     $threadid = $cleaner->clean($threadid, vB_Cleaner::TYPE_UINT);
     $thread = vB_Api::instance('node')->getFullContentforNodes(array($threadid));
     if (empty($thread)) {
         return array("response" => array("errormessage" => array("invalidid")));
     }
     $thread = $thread[0];
     $prefixes = vB_Library::instance('vb4_functions')->getPrefixes($threadid);
     $options = vB::getDatastore()->getValue('options');
     $postattachment = $thread['content']['createpermissions']['vbforum_attach'];
     $postattachment = empty($postattachment) ? 0 : intval($postattachment);
     /*
     			additional options' checked checkboxes array...
     */
     $checked = array('parseurl' => 1, 'signature' => "", "subscribe" => $thread['content']['subscribed']);
     // 	SIGNATURE
     $userContext = vB::getUserContext();
     $currentUserId = $userContext->fetchUserId();
     $signature = vB_Api::instanceInternal('user')->fetchSignature($currentUserId);
     if (!empty($signature)) {
         $checked['signature'] = 1;
     }
     // 	DISABLESMILIES
     // getDataForParse converts channel.options into bbcodeoptions, and this is used by the
     // frontend nodetext / bbcode parsers
     $textDataArray = vB_Api::instanceInternal('content_text')->getDataForParse(array($threadid));
     $channelAllowsSmilies = $textDataArray[$threadid]['bbcodeoptions']['allowsmilies'];
     if ($channelAllowsSmilies) {
         if (!empty($disablesmilies)) {
             $checked['disablesmilies'] = 1;
         } else {
             $checked['disablesmilies'] = "";
         }
         $show['smiliebox'] = 1;
     } else {
         $show['smiliebox'] = 0;
     }
     $out = array('show' => array('tag_option' => 1, 'smiliebox' => $show['smiliebox']), 'vboptions' => array('postminchars' => $options['postminchars'], 'titlemaxchars' => $options['titlemaxchars']), 'response' => array('title' => '', 'forumrules' => array('can' => array('postattachment' => $postattachment)), 'prefix_options' => $prefixes, 'poststarttime' => 0, 'posthash' => vB_Library::instance('vb4_posthash')->getNewPosthash()), 'checked' => $checked);
     return $out;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:42,代码来源:newreply.php

示例15: getNewRouteInfo

 protected function getNewRouteInfo()
 {
     $oldtype = array('cat' => 9988, 'groupid' => vB_Types::instance()->getContentTypeID('vBForum_SocialGroup'), 'discussionid' => vB_Types::instance()->getContentTypeID('vBForum_SocialGroupDiscussion'));
     $argument =& $this->arguments;
     $param =& $this->queryParameters;
     foreach ($oldtype as $key => $oldcontenttypeid) {
         if (!empty($param[$key]) and $oldid = intval($param[$key])) {
             $node = vB::getDbAssertor()->getRow('vBForum:node', array('oldid' => $oldid, 'oldcontenttypeid' => $oldcontenttypeid));
             if (empty($node)) {
                 throw new vB_Exception_404('invalid_page');
             }
             $argument['nodeid'] = $node['nodeid'];
             return $node['routeid'];
         }
     }
     $sgChannelId = vB_Api::instance('socialgroup')->getSGChannel();
     $sgChannel = vB::getDbAssertor()->getRow('vBForum:node', array('nodeid' => $sgChannelId));
     $argument['nodeid'] = $sgChannel['nodeid'];
     return $sgChannel['routeid'];
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:20,代码来源:group.php


注:本文中的vB_Api::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。