本文整理汇总了PHP中vB_Types类的典型用法代码示例。如果您正苦于以下问题:PHP vB_Types类的具体用法?PHP vB_Types怎么用?PHP vB_Types使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vB_Types类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _init_index_map
protected static function _init_index_map()
{
// init index map
$vb_types = vB_Types::instance();
self::$_sphinx_index_map = array($vb_types->getContentTypeId('vBForum_Post') => array('ThreadPostMain', 'ThreadPostDelta'), $vb_types->getContentTypeId('vBForum_SocialGroupMessage') => array('DiscussionMessageMain', 'DiscussionMessageDelta'), $vb_types->getContentTypeId('vBForum_SocialGroup') => array('SocialGroupMain', 'SocialGroupDelta'), $vb_types->getContentTypeId('vBBlog_BlogEntry') => array('BlogEntryMain', 'BlogEntryDelta'), $vb_types->getContentTypeId('vBBlog_BlogComment') => array('BlogCommentMain', 'BlogCommentDelta'), $vb_types->getContentTypeId('vBCms_Article') => array('CMSArticlesMain', 'CMSArticlesDelta'), $vb_types->getContentTypeId('vBForum_VisitorMessage') => array('VisitorMessageMain', 'VisitorMessageDelta'));
return true;
}
示例2: output
public function output()
{
global $vbulletin;
if (!isset($vbulletin->userinfo['permissions']['cms'])) {
vBCMS_Permissions::getUserPerms();
}
$publishlist = implode(', ', vB::$vbulletin->userinfo['permissions']['cms']['canpublish']);
$viewlist = implode(', ', vB::$vbulletin->userinfo['permissions']['cms']['allview']);
$rst = vB::$vbulletin->db->query_read_slave("SELECT node.nodeid, node.parentnode, node.url, node.permissionsfrom,\n\t\t\tnode.setpublish, node.publishdate, node.noderight, info.title FROM " . TABLE_PREFIX . "cms_node AS node INNER JOIN " . TABLE_PREFIX . "cms_nodeinfo AS info ON info.nodeid = node.nodeid\n\t\t\t WHERE node.contenttypeid = " . vB_Types::instance()->getContentTypeID("vBCms_Section") . " AND\n\t\t((node.permissionsfrom IN ({$viewlist}) AND node.hidden = 0 ) OR (node.permissionsfrom IN ({$publishlist})))\n\t\t\t ORDER BY node.nodeleft");
$nodes = array();
$noderight = 0;
while ($record = vB::$vbulletin->db->fetch_array($rst)) {
if (!in_array($record['permissionsfrom'], vB::$vbulletin->userinfo['permissions']['cms']['canedit']) and !(in_array($record['permissionsfrom'], vB::$vbulletin->userinfo['permissions']['cms']['canview']) and $record['setpublish'] == '1' and $record['publishdate'] < TIMENOW) or $record['noderight'] < $noderight) {
//We need to skip this record and all its children
$noderight = $record['permissionsfrom'];
continue;
}
$nodes[] = $record;
}
if (count($nodes)) {
reset($nodes);
$nodes = $this->setNavArray($nodes);
return $nodes;
}
}
示例3: getNewRouteInfo
protected function getNewRouteInfo()
{
$arguments =& $this->arguments;
$param =& $this->queryParameters;
$keys = array_keys($param);
$idkey = array('t', 'threadid');
if (empty($param['do'])) {
$param['do'] = 'showsmilies';
}
switch ($param['do']) {
case 'bbcode':
$this->anchor = 'bbcode_reference/bbcode_why';
return 'help';
case 'showrules':
$this->anchor = 'community_overview/general_tos';
return 'help';
case 'showsmilies':
$this->anchor = 'bbcode_reference/bbcode_smilies';
return 'help';
case 'whoposted':
if ($set = array_intersect($keys, $idkey) and $pid = intval($param[reset($set)])) {
$oldid = $pid;
$oldcontenttypeid = vB_Types::instance()->getContentTypeID(array('package' => 'vBForum', 'class' => 'Thread'));
$node = vB::getDbAssertor()->getRow('vBForum:node', array('oldid' => $oldid, 'oldcontenttypeid' => $oldcontenttypeid));
if (!empty($node)) {
$arguments['nodeid'] = $node['nodeid'];
return $node['routeid'];
}
}
default:
throw new vB_Exception_404('invalid_page');
}
}
示例4: fetchChannelNodes
protected function fetchChannelNodes($parent, $page, $perpage, $depth = 3, $contentype = 0, $options = false)
{
$api = Api_InterfaceAbstract::instance();
$optionsArray = array();
if (!$contentype) {
$contentype = vB_Types::instance()->getContentTypeID('vBForum_Channel');
}
$params = array('parentid' => $parent, 'page' => $page, 'perpage' => $perpage, 'depth' => $depth, 'contenttypeid' => $contentype, 'options' => $options);
return $api->callApi('node', 'listNodeFullContent', $params);
}
示例5: output
public function output()
{
global $vbulletin, $db, $show, $VB_API_REQUESTS;
if (!$VB_API_REQUESTS['api_c']) {
// The client doesn't have an ID yet. So we need to generate a new one.
$vbulletin->input->clean_array_gpc('r', array('clientname' => TYPE_STR, 'clientversion' => TYPE_STR, 'platformname' => TYPE_STR, 'platformversion' => TYPE_STR, 'uniqueid' => TYPE_STR));
// All params are required.
// uniqueid is the best to be a permanent unique id such as hardware ID (CPU ID,
// Harddisk ID or Mobile IMIE). Some client can not get a such a uniqueid,
// so it needs to generate an unique ID and save it in its local storage. If it
// requires the client ID and Secret again, pass the same unique ID.
if (!$vbulletin->GPC['clientname'] or !$vbulletin->GPC['clientversion'] or !$vbulletin->GPC['platformname'] or !$vbulletin->GPC['platformversion'] or !$vbulletin->GPC['uniqueid']) {
return $this->error('apiclientinfomissing', 'Miss required client information');
}
// Gererate clienthash.
$clienthash = md5($vbulletin->GPC['clientname'] . $vbulletin->GPC['platformname'] . $vbulletin->GPC['uniqueid']);
// Generate a new secret
$secret = fetch_random_password(32);
// If the same clienthash exists, return secret back to the client.
$client = $db->query_first_slave("SELECT *\n\t\t\t\tFROM " . TABLE_PREFIX . "apiclient\n\t\t\t\tWHERE clienthash = '" . $db->escape_string($clienthash) . "'\n\t\t\t\tLIMIT 1\n\t\t\t");
$apiclientid = $client['apiclientid'];
if ($apiclientid) {
// Update secret
// Also remove userid so it will logout previous loggedin and remembered user. (VBM-553)
$db->query_write("UPDATE " . TABLE_PREFIX . "apiclient SET\n\t\t\t\t\tsecret = '" . $db->escape_string($secret) . "',\n\t\t\t\t\tapiaccesstoken = '" . $db->escape_string($vbulletin->session->vars['apiaccesstoken']) . "',\n\t\t\t\t\tlastactivity = " . TIMENOW . ",\n\t\t\t\t\tclientversion = '" . $db->escape_string($vbulletin->GPC['clientversion']) . "',\n\t\t\t\t\tplatformversion = '" . $db->escape_string($vbulletin->GPC['platformversion']) . "',\n\t\t\t\t\tuserid = 0\n\t\t\t\t\tWHERE apiclientid = {$apiclientid}");
} else {
// Create a new client
$db->query_write("\n\t\t\t\t\tINSERT INTO " . TABLE_PREFIX . "apiclient (\n\t\t\t\t\t\tsecret, clienthash, clientname, clientversion, platformname,\n\t\t\t\t\t\tplatformversion, uniqueid, initialipaddress, apiaccesstoken,\n\t\t\t\t\t\tdateline, lastactivity\n\t\t\t\t\t)\n\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . $db->escape_string($secret) . "', " . "'" . $db->escape_string($clienthash) . "', " . "'" . $db->escape_string($vbulletin->GPC['clientname']) . "', " . "'" . $db->escape_string($vbulletin->GPC['clientversion']) . "', " . "'" . $db->escape_string($vbulletin->GPC['platformname']) . "', " . "'" . $db->escape_string($vbulletin->GPC['platformversion']) . "', " . "'" . $db->escape_string($vbulletin->GPC['uniqueid']) . "', " . "'" . $db->escape_string($vbulletin->alt_ip) . "', " . "'" . $db->escape_string($vbulletin->session->vars['apiaccesstoken']) . "', " . TIMENOW . ", " . TIMENOW . "\n\t\t\t\t\t)\n\t\t\t\t");
$apiclientid = $db->insert_id();
}
// Set session client ID
$vbulletin->session->set('apiclientid', $apiclientid);
} else {
// api_c and api_sig are verified in init.php so we don't need to verify here again.
$apiclientid = intval($VB_API_REQUESTS['api_c']);
// Update lastactivity
$db->query_write("UPDATE " . TABLE_PREFIX . "apiclient SET\n\t\t\t\tlastactivity = " . TIMENOW . "\n\t\t\t\tWHERE apiclientid = {$apiclientid}");
}
$contenttypescache = vB_Types::instance()->getContentTypes();
foreach ($contenttypescache as $contenttype) {
$contenttypes[$contenttype['class']] = $contenttype['id'];
}
// Check the status of CMS and Blog
$blogenabled = $vbulletin->products['vbblog'] == '1';
$cmsenabled = $vbulletin->products['vbcms'] == '1';
$data = array('apiversion' => VB_API_VERSION, 'apiaccesstoken' => $vbulletin->session->vars['apiaccesstoken'], 'bbtitle' => $vbulletin->options['bbtitle'], 'bburl' => $vbulletin->options['bburl'], 'bbactive' => $vbulletin->options['bbactive'], 'forumhome' => $vbulletin->options['forumhome'], 'vbulletinversion' => $vbulletin->options['templateversion'], 'contenttypes' => $contenttypes, 'features' => array('blogenabled' => $blogenabled, 'cmsenabled' => $cmsenabled, 'pmsenabled' => (bool) $vbulletin->options['enablepms'], 'searchesenabled' => (bool) $vbulletin->options['enablesearches'], 'groupsenabled' => (bool) ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups']), 'albumsenabled' => (bool) ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums']), 'friendsenabled' => (bool) ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_friends']), 'visitor_trackingenabled' => (bool) ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_visitor_tracking']), 'visitor_messagingenabled' => (bool) ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_visitor_messaging']), 'multitypesearch' => true, 'taggingenabled' => (bool) $vbulletin->options['threadtagging'], 'paidsubs' => $this->paidSubs()), 'permissions' => $vbulletin->userinfo['permissions'], 'show' => $show);
if (!$vbulletin->options['bbactive']) {
$data['bbclosedreason'] = $vbulletin->options['bbclosedreason'];
}
$data['apiclientid'] = $apiclientid;
if (!$VB_API_REQUESTS['api_c']) {
$data['secret'] = $secret;
}
return $data;
}
示例6: populate
public function populate()
{
$typeid = vB::$vbulletin->activitystream['socialgroup_photocomment']['typeid'];
$this->delete($typeid);
if (!vB::$vbulletin->activitystream['socialgroup_photocomment']['enabled']) {
return;
}
$contenttypeid = vB_Types::instance()->getContentTypeID('vBForum_SocialGroup');
$timespan = TIMENOW - vB::$vbulletin->options['as_expire'] * 60 * 60 * 24;
vB::$db->query_write("\n\t\t\tINSERT INTO " . TABLE_PREFIX . "activitystream\n\t\t\t\t(userid, dateline, contentid, typeid, action)\n\t\t\t\t(SELECT\n\t\t\t\t\tpostuserid, dateline, commentid, '{$typeid}', 'create'\n\t\t\t\tFROM " . TABLE_PREFIX . "picturecomment\n\t\t\t\tWHERE\n\t\t\t\t\tdateline >= {$timespan}\n\t\t\t\t\t\tAND\n\t\t\t\t\tsourcecontenttypeid = {$contenttypeid}\n\t\t\t\t)\n\t\t");
}
示例7: getNewRouteInfo
protected function getNewRouteInfo()
{
$oldid = $this->captureOldId();
$node = vB::getDbAssertor()->getRow('vBForum:fetchLegacyPostIds', array('oldids' => $oldid, 'postContentTypeId' => vB_Types::instance()->getContentTypeID('vBForum_Post')));
if (empty($node)) {
throw new vB_Exception_404('invalid_page');
}
$this->arguments['nodeid'] = $node['starter'];
$this->arguments['innerPost'] = $node['nodeid'];
return $node['routeid'];
}
示例8: deleteExpiredRedirects
/**
* Deletes all expired redirects
*
*/
public function deleteExpiredRedirects()
{
$timenow = vB::getRequest()->getTimeNow();
$contenttypeid = vB_Types::instance()->getContentTypeId($this->contenttype);
$assertor = vB::getDbAssertor();
$expiredRedirects = $assertor->getRows('vBForum:node', array(vB_dB_Query::CONDITIONS_KEY => array(array('field' => 'contenttypeid', 'value' => $contenttypeid, vB_Db_Query::OPERATOR_KEY => vB_Db_Query::OPERATOR_EQ), array('field' => 'unpublishdate', 'value' => $timenow, vB_Db_Query::OPERATOR_KEY => vB_Db_Query::OPERATOR_LTE))));
$redirectids = array();
foreach ($expiredRedirects as $redirect) {
$redirectids[] = $redirect['nodeid'];
}
$assertor->delete('vBForum:redirect', array(array('field' => 'nodeid', 'value' => $redirectids, vB_Db_Query::OPERATOR_KEY => vB_Db_Query::OPERATOR_EQ)));
$assertor->delete('vBForum:node', array(array('field' => 'nodeid', 'value' => $redirectids, vB_Db_Query::OPERATOR_KEY => vB_Db_Query::OPERATOR_EQ)));
}
示例9: populate
public function populate()
{
if (!vB::$vbulletin->products['vbcms']) {
return;
}
$typeid = vB::$vbulletin->activitystream['cms_article']['typeid'];
$this->delete($typeid);
if (!vB::$vbulletin->activitystream['cms_article']['enabled']) {
return;
}
$contenttypeid = vB_Types::instance()->getContentTypeID('vBCms_Article');
$timespan = TIMENOW - vB::$vbulletin->options['as_expire'] * 60 * 60 * 24;
vB::$db->query_write("\n\t\t\tINSERT INTO " . TABLE_PREFIX . "activitystream\n\t\t\t\t(userid, dateline, contentid, typeid, action)\n\t\t\t\t(SELECT\n\t\t\t\t\tuserid, publishdate, nodeid, '{$typeid}', 'create'\n\t\t\t\tFROM " . TABLE_PREFIX . "cms_node AS cms_node\n\t\t\t\tWHERE\n\t\t\t\t\tpublishdate >= {$timespan}\n\t\t\t\t\t\tAND\n\t\t\t\t\tcontenttypeid = {$contenttypeid}\n\t\t\t\t)\n\t\t");
}
示例10: getNewRouteInfo
protected function getNewRouteInfo()
{
$param =& $this->queryParameters;
if (isset($param['p']) and $oldid = intval($param['p']) or isset($param['postid']) and $oldid = intval($param['postid'])) {
$node = vB::getDbAssertor()->getRow('vBForum:fetchLegacyPostIds', array('oldids' => $oldid, 'postContentTypeId' => vB_Types::instance()->getContentTypeID('vBForum_Post')));
if (empty($node)) {
throw new vB_Exception_404('invalid_page');
}
$this->arguments['nodeid'] = $node['starter'];
$this->arguments['innerPost'] = $node['nodeid'];
return $node['routeid'];
}
$this->oldcontenttypeid = vB_Types::instance()->getContentTypeID(array('package' => 'vBForum', 'class' => 'Thread'));
return parent::getNewRouteInfo();
}
示例11: validateAndCleanNotificationData
protected function validateAndCleanNotificationData($notificationData)
{
// Very similar to the vB_Notification_Content, but has to skip the "channel" check since
// VM's go to their own channel. Instead, there's a isVisitorMessage() check.
$newData = parent::validateAndCleanNotificationData($notificationData);
unset($notificationData);
if (!isset($newData['sentbynodeid'])) {
throw new Exception("Missing Notification Data: sentbynodeid");
}
$nodeid = $newData['sentbynodeid'];
$node = vB_Library::instance('node')->getNode($nodeid, false, true);
// we need to get the full content, to ensure 'channeltype' is there.
if (!isset($node['nodeid'])) {
throw new Exception("Invalid Notification Data: sentbynodeid");
}
if (!isset($node['setfor'])) {
throw new Exception("Invalid Node Data: setfor");
}
// only explictly specified content types are allowed to send notifications
$topLevelContentTypes = array('Gallery' => 1, 'Link' => 1, 'Poll' => 1, 'Text' => 1, 'Video' => 1);
$contenttypeclass = vB_Types::instance()->getContentTypeClass($node['contenttypeid']);
if (!isset($topLevelContentTypes[$contenttypeclass])) {
throw new Exception("Cannot send this notification for the node's content type.");
}
// Only allow visitor messages.
/*
// node lib's fetchClosureParent() does not seem functional for the 2nd param that content lib's isVisitorMessage()
// relies on, VBV-14367. Let's just check the closure table directly for now.
$contentLib = vB_Library::instance('Content_' . vB_Types::instance()->getContentTypeClass($node['contenttypeid']));
if (!$contentLib->isVisitorMessage($nodeid))
{
throw new Exception("Not a visitor message.");
}
*/
$vmChannel = vB_Library::instance('node')->fetchVMChannel();
$closureCheck = vB::getDbAssertor()->getRows('vBForum:closure', array('child' => $nodeid, 'parent' => $vmChannel));
if (empty($closureCheck)) {
throw new Exception("Not a visitor message.");
}
// We're good if we got to this point.
$newData['sentbynodeid'] = (int) $node['nodeid'];
if (!isset($node['userid'])) {
throw new Exception("Invalid Notification Data: sentbynodeid");
}
$newData['sender'] = (int) $node['userid'];
return $newData;
}
示例12: verify_attachment
/**
* Verify permissions of a single attachment
*
* @return bool
*/
public function verify_attachment()
{
if (!$this->verify_attachment_specific('vBCms_Article'))
{
return false;
}
//Now we need to get a content id. It could come from several places
if (!isset($this->contentid))
{
vB::$vbulletin->input->clean_array_gpc('r', array(
'f' => vB_Input::TYPE_UINT,
'attachmentid' => vB_Input::TYPE_UINT
));
}
if (vB::$vbulletin->GPC_exists['values'] and isset(vB::$vbulletin->GPC['values']['f']))
{
$this->contentid = vB::$vbulletin->GPC['values']['f'];
}
else if (vB::$vbulletin->GPC_exists['attachmentid'] AND $this->vbulletininfo['contentid'])
{
$this->contentid = $this->vbulletininfo['contentid'];
}
else if (vB::$vbulletin->GPC_exists['attachmentid'] AND intval(vB::$vbulletin->GPC['attachmentid']))
{
if ($record = vB::$db->query_first("SELECT contentid, contenttypeid FROM " . TABLE_PREFIX . "attachment
where attachmentid = " . vB::$vbulletin->GPC['attachmentid']))
{
if ($record['contenttypeid'] == vB_Types::instance()->getContentTypeID("vBCms_Article"))
{
$this->contentid = $record['contentid'];
}
}
}
//If we have a contentid, we can check the permissions
if (isset($this->contentid))
{
return vBCMS_Permissions::canDownload($this->contentid);
}
return false;
}
示例13: getNewRouteInfo
protected function getNewRouteInfo()
{
// go to home page if path is exactly like prefix
if (count($this->matches) == 1 and empty($this->queryParameters)) {
$forumHomeChannel = vB_Library::instance('content_channel')->getForumHomeChannel();
return $forumHomeChannel['routeid'];
}
// capture old id
$argument =& $this->arguments;
$oldid = $argument['oldid'];
// calculate old contenttypeid
$oldtype = array('t' => 'Thread', 'f' => 'Forum');
$oldcontenttypeid = vB_Types::instance()->getContentTypeID(array('package' => 'vBForum', 'class' => $oldtype[$this->matches['nodetype']]));
$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'];
}
示例14: 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'];
}
示例15: getNewRouteInfo
protected function getNewRouteInfo()
{
$param =& $this->queryParameters;
$search = array();
// pull the parameter that still compatible with vb5 and discard others
if (isset($param['userid'])) {
$user = vB_User::fetchUserinfo($param['userid']);
if ($user !== false) {
$search['author'] = $user['username'];
}
}
if (isset($param['starteronly'])) {
$search['starter_only'] = $param['starteronly'];
}
if (isset($param['forumchoice'])) {
$oldcontenttypeid = vB_Types::instance()->getContentTypeID(array('package' => 'vBForum', 'class' => 'Forum'));
foreach ($param['forumchoice'] as $oldid) {
$node = vB::getDbAssertor()->getRow('vBForum:node', array('oldid' => $oldid, 'oldcontenttypeid' => $oldcontenttypeid));
$search['channel'][] = $node['nodeid'];
}
}
if (isset($param['do'])) {
switch ($param['do']) {
case 'finduser':
if (!empty($search)) {
$searchJSON = json_encode($search);
}
break;
case 'getdaily':
case 'getnew':
$searchJSON = '{"date":"lastVisit","view":"topic","unread_only":1,"sort":{"lastcontent":"desc"},"exclude_type":["vBForum_PrivateMessage"]}';
break;
default:
}
}
$param = array();
if (!empty($searchJSON)) {
$param['searchJSON'] = $searchJSON;
}
return 'search';
}