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


PHP vB_Api类代码示例

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


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

示例1: construct_user_ip_table

function construct_user_ip_table($userid, $previpaddress, $depth = 2)
{
    global $vbulletin, $vbphrase;
    if (VB_AREA == 'AdminCP') {
        $userscript = 'usertools.php';
    } else {
        $userscript = 'user.php';
    }
    $depth--;
    $ips = vB_Api::instanceInternal('user')->searchIP($userid, $depth);
    $retdata = '';
    // @TODO user api currently returns only 1 IP per user.
    $result = array('ipaddress' => $ips['regip']);
    foreach ($result as $ip) {
        $retdata .= '<li>' . "<a href=\"{$userscript}?" . vB::getCurrentSession()->get('sessionurl') . "do=gethost&amp;ip={$ip['ipaddress']}\" title=\"" . $vbphrase['resolve_address'] . "\">{$ip['ipaddress']}</a> &nbsp; " . construct_link_code($vbphrase['find_more_users_with_this_ip_address'], "{$userscript}?" . vB::getCurrentSession()->get('sessionurl') . "do=doips&amp;ipaddress={$ip['ipaddress']}&amp;hash=" . CP_SESSIONHASH) . "</li>\n";
        if ($depth > 0) {
            $retdata .= construct_ip_usage_table($ip['ipaddress'], $userid, $depth);
        }
    }
    if (empty($retdata)) {
        return '';
    } else {
        return '<ul>' . $retdata . '</ul>';
    }
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:25,代码来源:adminfunctions_user.php

示例2: createChannel

 /**
  * Create a blog channel.
  *
  * @param array $input
  * @param int $channelid
  * @param int $channelConvTemplateid
  * @param int $channelPgTemplateId
  * @param int $ownerSystemGroupId
  *
  * @return int The nodeid of the new blog channel
  */
 public function createChannel($input, $channelid, $channelConvTemplateid, $channelPgTemplateId, $ownerSystemGroupId)
 {
     $input['parentid'] = $channelid;
     $input['inlist'] = 1;
     // we don't want it to be shown in channel list, but we want to move them
     $input['protected'] = 0;
     if (empty($input['userid'])) {
         $input['userid'] = vB::getCurrentSession()->get('userid');
     }
     if (!isset($input['publishdate'])) {
         $input['publishdate'] = vB::getRequest()->getTimeNow();
     }
     $input['templates']['vB5_Route_Channel'] = $channelPgTemplateId;
     $input['templates']['vB5_Route_Conversation'] = $channelConvTemplateid;
     // add channel node
     $channelLib = vB_Library::instance('content_channel');
     $input['page_parentid'] = 0;
     $result = $channelLib->add($input, array('skipFloodCheck' => true, 'skipDupCheck' => true));
     //Make the current user the channel owner.
     $userApi = vB_Api::instanceInternal('user');
     $usergroup = vB::getDbAssertor()->getRow('usergroup', array('systemgroupid' => $ownerSystemGroupId));
     if (empty($usergroup) or !empty($usergroup['errors'])) {
         //This should never happen. It would mean an invalid parameter was passed
         throw new vB_Exception_Api('invalid_request');
     }
     vB_User::setGroupInTopic($input['userid'], $result['nodeid'], $usergroup['usergroupid']);
     vB_Cache::allCacheEvent(array('nodeChg_' . $this->blogChannel, "nodeChg_{$channelid}"));
     vB::getUserContext()->rebuildGroupAccess();
     vB_Channel::rebuildChannelTypes();
     // clear follow cache
     vB_Api::instanceInternal('follow')->clearFollowCache(array($input['userid']));
     return $result['nodeid'];
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:44,代码来源:blog.php

示例3: setBreadcrumbs

 /**
  * Sets the breadcrumbs for the route
  *
  * @return	array
  */
 protected function setBreadcrumbs()
 {
     $this->breadcrumbs = array();
     $phrase = 'create_new_topic';
     if (isset($this->arguments['nodeid']) && $this->arguments['nodeid']) {
         $onlyAddTopParent = false;
         $channelInfo = vB_Api::instanceInternal('Content_Channel')->fetchChannelById(intval($this->arguments['nodeid']));
         if ($channelInfo) {
             switch ($channelInfo['channeltype']) {
                 case 'blog':
                     $phrase = 'create_new_blog_entry';
                     break;
                 case 'group':
                     $phrase = 'create_new_topic';
                     break;
                 case 'article':
                     $phrase = 'create_new_article';
                     // when creating an article, the breadcrumb should
                     // always be home > articles > create article
                     // since you can choose the category when creating the article
                     $onlyAddTopParent = true;
                     break;
                 default:
                     break;
             }
         }
         $this->addParentNodeBreadcrumbs($this->arguments['nodeid'], $onlyAddTopParent);
     }
     $this->breadcrumbs[] = array('phrase' => $phrase);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:35,代码来源:newcontent.php

示例4: getCanonicalRoute

 public function getCanonicalRoute()
 {
     if (!isset($this->canonicalRoute)) {
         if (empty($this->arguments['nodeid'])) {
             throw new vB_Exception_NodePermission();
         }
         $nodeApi = vB_Api::instanceInternal('node');
         try {
             // this method will return an error if the user does not have permission
             $node = $nodeApi->getNode($this->arguments['nodeid']);
         } catch (vB_Exception_Api $ex) {
             // throw the proper NodePermission exception to return a 403 status instead of a 500 internal error
             if ($ex->has_errors('no_permission')) {
                 throw new vB_Exception_NodePermission($this->arguments['nodeid']);
             } else {
                 // otherwise, just let the caller catch the exception
                 throw $ex;
             }
         }
         $contentApi = vB_Api_Content::getContentApi($node['contenttypeid']);
         if (!$contentApi->validate($node, vB_Api_Content::ACTION_VIEW, $node['nodeid'], array($node['nodeid'] => $node))) {
             throw new vB_Exception_NodePermission($node['nodeid']);
         }
         $parent = $nodeApi->getNode($node['starter']);
         $parent['innerPost'] = $this->arguments['nodeid'];
         $this->canonicalRoute = self::getRoute($node['routeid'], $parent, $this->queryParameters);
     }
     return $this->canonicalRoute;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:29,代码来源:node.php

示例5: buildOutputFromItems

 protected function buildOutputFromItems($items, $options)
 {
     parent::buildOutputFromItems($items, $options);
     $xml = new vB_Xml_Builder();
     $xml->add_group('rss', array('version' => '0.91'));
     $xml->add_group('channel');
     $xml->add_tag('title', $this->rssinfo['title']);
     $xml->add_tag('link', $this->rssinfo['link'] . '/', array(), false, true);
     $xml->add_tag('description', $this->rssinfo['description']);
     $xml->add_tag('language', $this->defaultLang['languagecode']);
     $xml->add_group('image');
     $xml->add_tag('url', $this->rssinfo['icon']);
     $xml->add_tag('title', $this->rssinfo['title']);
     $xml->add_tag('link', $this->rssinfo['link'] . '/', array(), false, true);
     $xml->close_group('image');
     $dateformat = vB::getDatastore()->getOption('dateformat');
     $timeformat = vB::getDatastore()->getOption('timeformat');
     // gather channel info
     $channelsInfo = $this->getItemsChannelInfo($items);
     $items = $this->formatItems($items, $options);
     foreach ($items as $id => $item) {
         $item = $item['content'];
         $xml->add_group('item');
         $xml->add_tag('title', $item['external_prefix_plain'] . vB_String::htmlSpecialCharsUni($item['external_title']));
         $xml->add_tag('link', vB_Api::instanceInternal('route')->getAbsoluteNodeUrl($item['external_nodeid']), array(), false, true);
         $xml->add_tag('description', vB_Phrase::fetchSinglePhrase('rss_91_forum_w_posted_by_x_post_time_y_at_z', array($channelsInfo[$item['channelid']]['htmltitle'], $item['authorname'], $this->callvBDate($dateformat, $item['publishdate']), $this->callvBDate($timeformat, $item['publishdate']))));
         $xml->close_group('item');
     }
     $xml->close_group('channel');
     $xml->close_group('rss');
     $output .= '<!DOCTYPE rss PUBLIC "-//RSS Advisory Board//DTD RSS 0.91//EN" "http://www.rssboard.org/rss-0.91.dtd">' . "\r\n";
     $output .= $xml->output();
     return $xml->fetch_xml_tag() . $output;
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:34,代码来源:91.php

示例6: getPageTitleByGuid

 /**
  * Returns the phrased page title based on the GUID
  *
  * @param string Page GUID
  */
 public function getPageTitleByGuid($guid)
 {
     $phraseLib = vB_Library::instance('phrase');
     $phraseVarname = 'page_' . $phraseLib->cleanGuidForPhrase($guid) . '_title';
     $phrases = vB_Api::instanceInternal('phrase')->fetch(array($phraseVarname));
     return $phrases[$phraseVarname];
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:12,代码来源:pagerestore.php

示例7: fetch

 /**
  * Fetches announcements by channel ID
  *
  * @param  int              $channelid (optional) Channel ID
  * @param  int              $announcementid (optional) Announcement ID
  *
  * @throws vB_Exception_Api no_permission if the user doesn't have permission to view the announcements
  *
  * @return array            Announcements, each element is an array containing all the fields
  *                          in the announcement table and username, avatarurl, and the individual
  *                          options from the announcementoptions bitfield-- dohtml, donl2br,
  *                          dobbcode, dobbimagecode, dosmilies.
  */
 public function fetch($channelid = 0, $announcementid = 0)
 {
     $usercontext = vB::getUserContext();
     $userapi = vB_Api::instanceInternal('user');
     $channelapi = vB_Api::instanceInternal('content_channel');
     $parentids = array();
     // Check channel permission
     if ($channelid) {
         // This is to verify $channelid
         $channelapi->fetchChannelById($channelid);
         if (!$usercontext->getChannelPermission('forumpermissions', 'canview', $channelid)) {
             throw new vB_Exception_Api('no_permission');
         }
         $parents = vB_Library::instance('node')->getParents($channelid);
         foreach ($parents as $parent) {
             if ($parent['nodeid'] != 1) {
                 $parentids[] = $parent['nodeid'];
             }
         }
     }
     $data = array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'startdate', 'value' => vB::getRequest()->getTimeNow(), 'operator' => vB_dB_Query::OPERATOR_LTE), array('field' => 'enddate', 'value' => vB::getRequest()->getTimeNow(), 'operator' => vB_dB_Query::OPERATOR_GTE)));
     if ($parentids) {
         $parentids[] = -1;
         // We should always include -1 for global announcements
         $data[vB_dB_Query::CONDITIONS_KEY][] = array('field' => 'nodeid', 'value' => $parentids);
     } elseif ($channelid) {
         $channelid = array($channelid, -1);
         // We should always include -1 for global announcements
         $data[vB_dB_Query::CONDITIONS_KEY][] = array('field' => 'nodeid', 'value' => $channelid);
     } else {
         $data[vB_dB_Query::CONDITIONS_KEY][] = array('field' => 'nodeid', 'value' => '-1');
     }
     $announcements = $this->assertor->getRows('vBForum:announcement', $data, array('field' => array('startdate', 'announcementid'), 'direction' => array(vB_dB_Query::SORT_DESC, vB_dB_Query::SORT_DESC)));
     if (!$announcements) {
         return array();
     } else {
         $results = array();
         $bf_misc_announcementoptions = vB::getDatastore()->getValue('bf_misc_announcementoptions');
         foreach ($announcements as $k => $post) {
             $userinfo = $userapi->fetchUserinfo($post['userid'], array(vB_Api_User::USERINFO_AVATAR, vB_Api_User::USERINFO_SIGNPIC));
             $announcements[$k]['username'] = $userinfo['username'];
             $announcements[$k]['avatarurl'] = $userapi->fetchAvatar($post['userid']);
             $announcements[$k]['dohtml'] = $post['announcementoptions'] & $bf_misc_announcementoptions['allowhtml'];
             if ($announcements[$k]['dohtml']) {
                 $announcements[$k]['donl2br'] = false;
             } else {
                 $announcements[$k]['donl2br'] = true;
             }
             $announcements[$k]['dobbcode'] = $post['announcementoptions'] & $bf_misc_announcementoptions['allowbbcode'];
             $announcements[$k]['dobbimagecode'] = $post['announcementoptions'] & $bf_misc_announcementoptions['allowbbcode'];
             $announcements[$k]['dosmilies'] = $post['announcementoptions'] & $bf_misc_announcementoptions['allowsmilies'];
             if ($announcements[$k]['dobbcode'] and $post['announcementoptions'] & $bf_misc_announcementoptions['parseurl']) {
                 require_once DIR . '/includes/functions_newpost.php';
                 $announcements[$k]['pagetext'] = convert_url_to_bbcode($post['pagetext']);
             }
         }
         return $announcements;
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:72,代码来源:announcement.php

示例8: loadRssInfo

 /**
  * Loads information needed for RSS output
  *
  * @param 	array 	Options to be considered for feed.
  */
 protected function loadRssInfo($options)
 {
     $description = $this->getPhraseFromGuid(vB_Page::PAGE_HOME, 'metadesc');
     $stylevars = vB_Api::instanceInternal('style')->fetchStylevars(array(vB::getDatastore()->getOption('styleid')));
     $imgdir = (!empty($stylevars['imgdir_misc']) and !empty($stylevars['imgdir_misc']['imagedir'])) ? $stylevars['imgdir_misc']['imagedir'] : '';
     $this->rssinfo = array('title' => vB::getDatastore()->getOption('bbtitle'), 'link' => vB::getDatastore()->getOption('frontendurl'), 'icon' => vB::getDatastore()->getOption('bburl') . '/' . $imgdir . '/rss.png', 'description' => $description, 'ttl' => 60);
     $this->rssinfo = $this->applyRssOptions($options, $this->rssinfo);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:13,代码来源:rss.php

示例9: setBreadcrumbs

 /**
  * Sets the breadcrumbs for the route
  */
 protected function setBreadcrumbs()
 {
     //if we are coming in for a route (instead of generating a URL) then the $this->arguments['username'] is the
     //url slug, which we don't want.  The API call is cached and will be called later anyway to generate the
     //profile page so its not a bit performance hit to load this way.
     $userInfo = vB_Api::instanceInternal('user')->fetchProfileInfo($this->arguments['userid']);
     $this->breadcrumbs = array(0 => array('title' => $userInfo['username'], 'url' => ''));
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:11,代码来源:profile.php

示例10: 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

示例11: fetchAll

 /**
  * Fetch all subscriptions that an user can join and already joined
  * It also fetches active payment APIs
  *
  * @param bool $isreg Whether to fetch subscriptions for signup page
  * @return array Paid subscriptions info for the user.
  */
 public function fetchAll($isreg = false)
 {
     try {
         $this->checkStatus();
     } catch (vB_Exception_Api $e) {
         return array();
     }
     $userinfo = vB::getCurrentSession()->fetch_userinfo();
     $usercontext = vB::getUserContext();
     $membergroupids = fetch_membergroupids_array($userinfo);
     $allow_secondary_groups = $usercontext->hasPermission('genericoptions', 'allowmembergroups');
     $subscribed = $this->fetchSubscribed();
     $vbphrase = vB_Api::instanceInternal('phrase')->fetch(array('day', 'week', 'month', 'year', 'days', 'weeks', 'months', 'years', 'length_x_units_y_recurring_z', 'recurring'));
     $lengths = array('D' => $vbphrase['day'], 'W' => $vbphrase['week'], 'M' => $vbphrase['month'], 'Y' => $vbphrase['year'], 'Ds' => $vbphrase['days'], 'Ws' => $vbphrase['weeks'], 'Ms' => $vbphrase['months'], 'Ys' => $vbphrase['years']);
     $cansubscribesubscriptions = array();
     $subscribedsubscriptions = array();
     foreach ($this->subobj->subscriptioncache as $subscription) {
         $subscriptionid =& $subscription['subscriptionid'];
         $subscription['cost'] = unserialize($subscription['cost']);
         $subscription['newoptions'] = @unserialize($subscription['newoptions']);
         foreach ($subscription['cost'] as $key => $currentsub) {
             if ($currentsub['length'] == 1) {
                 $currentsub['units'] = $lengths["{$currentsub['units']}"];
             } else {
                 $currentsub['units'] = $lengths[$currentsub['units'] . 's'];
             }
             $subscription['cost'][$key]['subscription_length'] = construct_phrase($vbphrase['length_x_units_y_recurring_z'], $currentsub['length'], $currentsub['units'], $currentsub['recurring'] ? " ({$vbphrase['recurring']})" : '');
         }
         if (isset($subscribed["{$subscription['subscriptionid']}"])) {
             // This subscription has been subscribed by the user
             $subscribedsubscriptions[$subscriptionid] = $subscription;
             $subscribedsubscriptions[$subscriptionid]['subscribed'] = $subscribed["{$subscription['subscriptionid']}"];
         }
         if ($subscription['active']) {
             if ($isreg and empty($subscription['newoptions']['regshow'])) {
                 // Display paid subscription during registration is set to false
                 continue;
             }
             // Check whether to show the subscription to the user.
             if (!empty($subscription['deniedgroups']) and ($allow_secondary_groups and !count(array_diff($membergroupids, $subscription['deniedgroups'])) or !$allow_secondary_groups and in_array($userinfo['usergroupid'], $subscription['deniedgroups']))) {
                 continue;
             }
             // List allowed payment apis
             $allowedapis = array();
             foreach ((array) $subscription['newoptions']['api'] as $api => $options) {
                 if (!empty($options['show'])) {
                     $allowedapis[] = $api;
                 }
             }
             $subscription['allowedapis'] = json_encode($allowedapis);
             $cansubscribesubscriptions[$subscriptionid] = $subscription;
         }
     }
     if (!$cansubscribesubscriptions and !$subscribedsubscriptions) {
         return array();
     }
     return array('subscribed' => $subscribedsubscriptions, 'cansubscribe' => $cansubscribesubscriptions, 'paymentapis' => $this->apicache, 'currencysymbols' => $this->subobj->_CURRENCYSYMBOLS);
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:65,代码来源:paidsubscription.php

示例12: fetch_online_status

/**
* Fetches the online states for the user, taking into account the browsing
* user's viewing permissions. Also modifies the user to include [buddymark]
* and [invisiblemark]
*
* @param	array	Array of userinfo to fetch online status for
* @param	boolean	True if you want to set $user[onlinestatus] with template results
*
* @return	integer	0 = offline, 1 = online, 2 = online but invisible (if permissions allow)
*/
function fetch_online_status(&$user)
{
    static $buddylist, $datecut;
    $session = vB::getCurrentSession();
    if (empty($session)) {
        $currentUserId = 0;
    } else {
        $currentUserId = vB::getCurrentSession()->get('userid');
    }
    // get variables used by this function
    if (!isset($buddylist) and !empty($currentUserId)) {
        $buddylist = array();
        //If we are asking for the current user's status we can skip the fetch
        if ($currentUserId == $user['userid']) {
            $currentUser =& $user;
        } else {
            $currentUser = vB_Api::instanceInternal('user')->fetchCurrentUserInfo();
        }
        if (isset($currentUser['buddylist']) and $currentUser['buddylist'] = trim($currentUser['buddylist'])) {
            $buddylist = preg_split('/\\s+/', $currentUser['buddylist'], -1, PREG_SPLIT_NO_EMPTY);
        }
    }
    if (!isset($datecut)) {
        $datecut = vB::getRequest()->getTimeNow() - vB::getDatastore()->getOption('cookietimeout');
    }
    // is the user on bbuser's buddylist?
    if (isset($buddylist) and is_array($buddylist) and in_array($user['userid'], $buddylist)) {
        $user['buddymark'] = '+';
    } else {
        $user['buddymark'] = '';
    }
    // set the invisible mark to nothing by default
    $user['invisiblemark'] = '';
    $onlinestatus = 0;
    $user['online'] = 'offline';
    // now decide if we can see the user or not
    if ($user['lastactivity'] > $datecut and $user['lastvisit'] != $user['lastactivity']) {
        $bf_misc_useroptions = vB::getDatastore()->getValue('bf_misc_useroptions');
        if ($user['options'] & $bf_misc_useroptions['invisible']) {
            if (!isset($userContext)) {
                $userContext = vB::getUserContext();
            }
            if ($currentUserId == $user['userid'] or $userContext and $userContext->hasPermission('genericpermissions', 'canseehidden')) {
                // user is online and invisible BUT bbuser can see them
                $user['invisiblemark'] = '*';
                $user['online'] = 'invisible';
                $onlinestatus = 2;
            }
        } else {
            // user is online and visible
            $onlinestatus = 1;
            $user['online'] = 'online';
        }
    }
    return $onlinestatus;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:66,代码来源:functions_bigthree.php

示例13: verify_nodeid

 /**
  * Verifies that the specified nodeid is valid
  *
  * @param	integer	Forum ID (allow -1 = all forums)
  *
  * @return	boolean
  */
 function verify_nodeid(&$forumid)
 {
     $channels = vB_Api::instanceInternal('search')->getChannels(true);
     if ($forumid == -1 or isset($channels["{$forumid}"])) {
         return true;
     } else {
         $this->error('invalid_forum_specified');
         return false;
     }
 }
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:17,代码来源:announcement.php

示例14: build_bbcode_video

function build_bbcode_video($checktable = false)
{
    if ($checktable) {
        try {
            vB::getDbAssertor()->assertQuery('bbcode_video', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT));
        } catch (Exception $e) {
            return false;
        }
    }
    require_once DIR . '/includes/class_xml.php';
    $xmlobj = new vB_XML_Parser(false, DIR . '/includes/xml/bbcode_video_vbulletin.xml');
    $data = $xmlobj->parse();
    if (is_array($data['provider'])) {
        $insert = array();
        foreach ($data['provider'] as $provider) {
            $items = array();
            $items['tagoption'] = $provider['tagoption'];
            $items['provider'] = $provider['title'];
            $items['url'] = $provider['url'];
            $items['regex_url'] = $provider['regex_url'];
            $items['regex_scrape'] = $provider['regex_scrape'];
            $items['embed'] = $provider['embed'];
            $insert[] = $items;
        }
        if (!empty($insert)) {
            vB::getDbAssertor()->assertQuery('truncateTable', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_METHOD, 'table' => 'bbcode_video'));
            vB::getDbAssertor()->assertQuery('bbcode_video', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_MULTIPLEINSERT, vB_dB_Query::FIELDS_KEY => array('tagoption', 'provider', 'url', 'regex_url', 'regex_scrape', 'embed'), vB_dB_Query::VALUES_KEY => $insert));
        }
    }
    $firsttag = '<vb:if condition="$provider == \'%1$s\'">';
    $secondtag = '<vb:elseif condition="$provider == \'%1$s\'" />';
    $template = array();
    $bbcodes = vB::getDbAssertor()->assertQuery('bbcode_video', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT), array('field' => array('priority'), 'direction' => array(vB_dB_Query::SORT_ASC)));
    foreach ($bbcodes as $bbcode) {
        if (empty($template)) {
            $template[] = sprintf($firsttag, $bbcode['tagoption']);
        } else {
            $template[] = sprintf($secondtag, $bbcode['tagoption']);
        }
        $template[] = $bbcode['embed'];
    }
    $template[] = "</vb:if>";
    $final = implode("\r\n", $template);
    $exists = vB::getDbAssertor()->getRow('template', array(vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'title', 'value' => 'bbcode_video', 'operator' => vB_dB_Query::OPERATOR_EQ), array('field' => 'product', 'value' => array('', 'vbulletin'), 'operator' => vB_dB_Query::OPERATOR_EQ), array('field' => 'styleid', 'value' => -1, 'operator' => vB_dB_Query::OPERATOR_EQ))));
    if ($exists) {
        try {
            vB_Api::instanceInternal('template')->update($exists['templateid'], 'bbcode_video', $final, 'vbulletin', false, false, '');
        } catch (Exception $e) {
            return false;
        }
    } else {
        vB_Api::instanceInternal('template')->insert(-1, 'bbcode_video', $final, 'vbulletin');
    }
    return true;
}
开发者ID:cedwards-reisys,项目名称:nexus-web,代码行数:55,代码来源:functions_databuild.php

示例15: 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


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