本文整理汇总了PHP中vBulletinHook::fetch_hook方法的典型用法代码示例。如果您正苦于以下问题:PHP vBulletinHook::fetch_hook方法的具体用法?PHP vBulletinHook::fetch_hook怎么用?PHP vBulletinHook::fetch_hook使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vBulletinHook
的用法示例。
在下文中一共展示了vBulletinHook::fetch_hook方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch_validated_list
public function fetch_validated_list($user, $ids, $gids)
{
//null items are never valid
$retval = array_fill_keys($ids, false);
($hook = vBulletinHook::fetch_hook('search_validated_list')) ? eval($hook) : false;
return $retval;
}
示例2: getNavigation
/**
* Renders the navigation tabs & links.
*/
protected function getNavigation()
{
global $vbulletin;
$root = '';
$root_tab = $roots['vbtab_forum'];
$tabs = build_navigation_menudata();
$roots = get_navigation_roots(build_navigation_list());
$request_tab = intval($_REQUEST['tabid']);
$script_tab = get_navigation_tab_script();
$hook_tabid = $tabid = 0;
($hook = vBulletinHook::fetch_hook('set_navigation_tab_vbview')) ? eval($hook) : false;
if ($root) {
$tabid = $roots[$root];
}
/* Tab setting logic, using above choices. Preference order
is (low > high) root > script > hookroot > hookid > request */
$current_tab = $script_tab ? $script_tab : $root_tab;
$current_tab = $tabid ? $tabid : $current_tab;
$current_tab = $hook_tabid ? $hook_tabid : $current_tab;
$current_tab = $request_tab ? $request_tab : $current_tab;
$tabid = set_navigation_tab($current_tab, $tabs);
$view = new vB_View('navbar_tabs');
$view->tabs = $tabs;
$view->selected = $tabid;
return $view->render();
}
示例3: prepare_render
public function prepare_render($user, $results)
{
global $show;
$this->mod_rights['movethread'] = false;
$this->mod_rights['deletethread'] = false;
$this->mod_rights['approvethread'] = false;
$this->mod_rights['openthread'] = false;
$ids = array();
foreach ($results as $result) {
$forumid = $result->get_thread()->get_field('forumid');
$this->mod_rights['movethread'] = ($this->mod_rights['movethread'] or $user->canModerateForum($forumid, 'canmanagethreads'));
$this->mod_rights['deletethread'] = ($this->mod_rights['deletethread'] or ($user->canModerateForum($forumid, 'candeleteposts') or $user->canModerateForum($forumid, 'canremoveposts')));
$this->mod_rights['approvethread'] = ($this->mod_rights['approvethread'] or $user->canModerateForum($forumid, 'canmoderateposts'));
$this->mod_rights['openthread'] = ($this->mod_rights['openthread'] or $user->canModerateForum($forumid, 'canopenclose'));
//we need to know if any particular thread allows icons before we render any of them
$thread = $result->get_thread();
if ($thread->has_icon()) {
$show['threadicons'] = true;
}
$ids[] = $thread->get_field('threadid');
}
//this is used by process_thread_array in functions_forumdisplay.php
//which is called from vBForum_Search_Result_Thread::render
global $dotthreads;
$dotthreads = fetch_dot_threads_array(implode(',', $ids));
($hook = vBulletinHook::fetch_hook('search_prepare_render')) ? eval($hook) : false;
}
示例4: getLoadQuery
/**
* Fetches the SQL for loading.
* $required_query is used to identify which query to build for classes that
* have multiple queries for fetching info.
*
* This can safely be based on $this->required_info as long as a consitent
* flag is used for identifying the query.
*
* @param int $required_query - The required query
* @param bool $force_rebuild - Whether to rebuild the string
*
* @return string
*/
protected function getLoadQuery($required_query = self::QUERY_BASIC, $force_rebuild = false)
{
// Hooks should check the required query before populating the hook vars
$hook_query_fields = $hook_query_join = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook($this->query_hook)) ? eval($hook) : false;
if (self::QUERY_BASIC == $required_query)
{
return $query = "
SELECT
groupmessage.gmid as itemid,
groupmessage.discussionid,
groupmessage.postuserid,
groupmessage.postusername,
groupmessage.dateline,
groupmessage.state,
groupmessage.title,
groupmessage.pagetext,
groupmessage.ipaddress,
groupmessage.allowsmilie,
groupmessage.reportthreadid " .
$hook_query_fields . "
FROM " . TABLE_PREFIX . "groupmessage AS groupmessage " .
$hook_query_join . "
WHERE groupmessage.gmid IN (" . implode(',', $this->itemid) . ")
$hook_query_where";
}
throw (new vB_Exception_Model('Invalid query id \'' . htmlspecialchars($required_query) .
'\'specified for social group message collection: ' . htmlspecialchars($query)));
}
示例5: process
public function process($config)
{
global $show;
$activitybits = '';
$show['as_blog'] = vB::$vbulletin->products['vbblog'];
$show['as_cms'] = vB::$vbulletin->products['vbcms'];
$show['as_socialgroup'] = (vB::$vbulletin->options['socnet'] & vB::$vbulletin->bf_misc_socnet['enable_groups'] and vB::$vbulletin->userinfo['permissions']['socialgrouppermissions'] & vB::$vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']);
switch ($config['activitystream_sort']) {
case '1':
$this->orderby = 'score DESC, dateline DESC';
$sort = 'popular';
break;
default:
// recent
$this->getnew = false;
$this->orderby = 'dateline DESC';
$sort = 'recent';
}
switch ($config['activitystream_filter']) {
case '1':
$this->setWhereFilter('type', 'photo');
break;
case '2':
$this->setWhereFilter('section', 'forum');
break;
case '3':
if ($show['as_cms']) {
$this->setWhereFilter('section', 'cms');
}
break;
case '4':
if ($show['as_blog']) {
$this->setWhereFilter('section', 'blog');
}
break;
case '5':
$this->setWhereFilter('section', 'socialgroup');
break;
default:
// all
}
switch ($config['activitystream_date']) {
case '0':
$this->setWhereFilter('maxdateline', TIMENOW - 24 * 60 * 60);
break;
case '1':
$this->setWhereFilter('maxdateline', TIMENOW - 7 * 24 * 60 * 60);
break;
case '2':
$this->setWhereFilter('maxdateline', TIMENOW - 30 * 24 * 60 * 60);
break;
default:
// 3 - anytime
}
($hook = vBulletinHook::fetch_hook($this->hook_beforefetch)) ? eval($hook) : false;
$this->setPage(1, $config['activitystream_limit']);
$result = $this->fetchStream($sort, true);
$cleaned = array_filter($result['bits']);
return $cleaned;
}
示例6: getLoadQuery
/**
* Fetches the SQL for loading.
* $required_query is used to identify which query to build for classes that
* have multiple queries for fetching info.
*
* This can safely be based on $this->required_info as long as a consitent
* flag is used for identifying the query.
*
* @param int $required_query - The required query
* @param bool $force_rebuild - Whether to rebuild the string
*
* @return string
*/
protected function getLoadQuery($required_query = self::QUERY_BASIC, $force_rebuild = false)
{
// Hooks should check the required query before populating the hook vars
$hook_query_fields = $hook_query_join = $hook_query_where = '';
($hook = vBulletinHook::fetch_hook($this->query_hook)) ? eval($hook) : false;
if (self::QUERY_BASIC == $required_query)
{
$ids = array_map('intval', $this->itemid);
return $query = "
SELECT
discussion.discussionid as itemid,
discussion.*,
firstpost.postuserid,
firstpost.postusername,
firstpost.dateline,
firstpost.state,
firstpost.title,
firstpost.pagetext,
firstpost.ipaddress,
firstpost.allowsmilie,
firstpost.reportthreadid " .
$hook_query_fields . "
FROM " . TABLE_PREFIX . "discussion AS discussion JOIN " .
TABLE_PREFIX . "groupmessage AS firstpost ON discussion.firstpostid = firstpost.gmid
INNER JOIN " . TABLE_PREFIX . "socialgroup AS socialgroup ON socialgroup.groupid = discussion.groupid " .
$hook_query_join . "
WHERE discussion.discussionid IN (" . implode(',', $ids) . ")
$hook_query_where";
}
throw (new vB_Exception_Model('Invalid query id \'' . htmlspecialchars($required_query) .
'\'specified for social group message collection: ' . htmlspecialchars($query)));
}
示例7: get_similar_threads
/**
* Get similar threads to a given thread title
*
* A hack to support similar thread functionality -- this used the search system
* previous and, in particular, the fulltext indexes on the thread table that
* we are trying to get rid of. This allows us to move to the new search
* tables in the db search implementation and for other search implementations
* to make use of whatever index they have to produce the results.
*
* Ideally this would work with the normal search interface or at least
* generalize to all content types, but the problem was noticed at the
* last moment and some thought needs to be put into a more general implementation
* (and there is no immediate requirement for one).
*
* Specialty search controllers can ignore this, it won't be used.
* A default implementation is provided that accesses the override hook.
* Any custom implementation by a search package should respect the hook override.
*
* @param string $threadtitle -- The title to match
* @param int $threadid -- If provided this thread will be excluded from
* similar matches
*/
public function get_similar_threads($threadtitle, $threadid = 0)
{
$similarthreads = null;
($hook = vBulletinHook::fetch_hook('search_similarthreads_fulltext')) ? eval($hook) : false;
if ($similarthreads !== null) {
return $similarthreads;
} else {
return array();
}
}
示例8: parse_video_bbcode
function parse_video_bbcode($pagetext)
{
global $vbulletin;
($hook = vBulletinHook::fetch_hook('data_parse_bbcode_video')) ? eval($hook) : false;
if (stripos($pagetext, '[video]') !== false) {
require_once DIR . '/includes/class_bbcode_alt.php';
$parser = new vB_BbCodeParser_Video_PreParse($vbulletin, array());
$pagetext = $parser->parse($pagetext);
}
return $pagetext;
}
示例9: build_history_bit
/**
* Builds the history bit for a selected history point
*
* @param array Array of information for this histoy point
* @param object BB code parser
*
* @return string History bit HTML
*/
function build_history_bit($history, &$bbcode)
{
global $vbulletin, $vbphrase, $show, $stylevar;
$history['editdate'] = vbdate($vbulletin->options['dateformat'], $history['dateline'], true);
$history['edittime'] = vbdate($vbulletin->options['timeformat'], $history['dateline']);
$history['message'] = $bbcode->parse($history['pagetext'], 'pt');
if ($history['reason'] === '') {
$history['reason'] = $vbphrase['n_a'];
}
($hook = vBulletinHook::fetch_hook('project_historybit')) ? eval($hook) : false;
eval('$edit_history = "' . fetch_template('pt_historybit') . '";');
return $edit_history;
}
示例10: IF
/**
* Contructs a Post Tree
*
* @param string The template Name to use
* @param integer The Thread ID
* @param integer The "Root" post for which to work from
* @param integer The current "Depth" within the tree
*
* @return string The Generated Tree
*
*/
function &construct_post_tree($templatename, $threadid, $parentid = 0, $depth = 1)
{
global $vbulletin, $stylevar, $parentassoc, $show, $vbphrase, $threadedmode;
static $postcache;
if (!$threadedmode and $vbulletin->userinfo['postorder']) {
$postorder = 'DESC';
}
$depthnext = $depth + 2;
if (!$postcache) {
$posts = $vbulletin->db->query_read_slave("\n\t\t\tSELECT post.parentid, post.postid, post.userid, post.pagetext, post.dateline, IF(visible = 2, 1, 0) AS isdeleted,\n\t\t\t\tIF(user.username <> '', user.username, post.username) AS username\n\t\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON user.userid = post.userid\n\t\t\tWHERE post.threadid = {$threadid}\n\t\t\tORDER BY dateline {$postorder}\n\t\t");
while ($post = $vbulletin->db->fetch_array($posts)) {
if (!$threadedmode) {
$post['parentid'] = 0;
}
$postcache[$post['parentid']][$post['postid']] = $post;
}
ksort($postcache);
}
$counter = 0;
$postbits = '';
if (is_array($postcache["{$parentid}"])) {
foreach ($postcache["{$parentid}"] as $post) {
$parentassoc[$post['postid']] = $post['parentid'];
if (($depth + 1) % 4 == 0) {
// alternate colors when switching depths; depth gets incremented by 2 each time
$post['backcolor'] = '{firstaltcolor}';
$post['bgclass'] = 'alt1';
} else {
$post['backcolor'] = '{secondaltcolor}';
$post['bgclass'] = 'alt2';
}
$post['postdate'] = vbdate($vbulletin->options['dateformat'], $post['dateline'], true);
$post['posttime'] = vbdate($vbulletin->options['timeformat'], $post['dateline']);
// cut page text short if too long
if (vbstrlen($post['pagetext']) > 100) {
$spacepos = strpos($post['pagetext'], ' ', 100);
if ($spacepos != 0) {
$post['pagetext'] = substr($post['pagetext'], 0, $spacepos) . '...';
}
}
$post['pagetext'] = nl2br(htmlspecialchars_uni($post['pagetext']));
($hook = vBulletinHook::fetch_hook('threadmanage_construct_post_tree')) ? eval($hook) : false;
eval('$postbits .= "' . fetch_template($templatename) . '";');
$ret =& construct_post_tree($templatename, $threadid, $post['postid'], $depthnext);
$postbits .= $ret;
}
}
return $postbits;
}
示例11: fetch_prefix_array
/**
* Fetches an array of prefixes for the specified forum. Returned in format:
* [prefixsetid][] = prefixid
*
* @param integer Forum ID to fetch prefixes from
*
* @return array
*/
function fetch_prefix_array($forumid)
{
global $vbulletin;
if (isset($vbulletin->prefixcache)) {
return is_array($vbulletin->prefixcache["{$forumid}"]) ? $vbulletin->prefixcache["{$forumid}"] : array();
} else {
$prefixsets = array();
$prefix_sql = $vbulletin->db->query_read("\n\t\t\tSELECT prefix.*\n\t\t\tFROM " . TABLE_PREFIX . "forumprefixset AS forumprefixset\n\t\t\tINNER JOIN " . TABLE_PREFIX . "prefixset AS prefixset ON (prefixset.prefixsetid = forumprefixset.prefixsetid)\n\t\t\tINNER JOIN " . TABLE_PREFIX . "prefix AS prefix ON (prefix.prefixsetid = prefixset.prefixsetid)\n\t\t\tWHERE forumprefixset.forumid = " . intval($forumid) . "\n\t\t\tORDER BY prefixset.displayorder, prefix.displayorder\n\t\t");
while ($prefix = $vbulletin->db->fetch_array($prefix_sql)) {
$prefixsets["{$prefix['prefixsetid']}"][] = $prefix['prefixid'];
}
($hook = vBulletinHook::fetch_hook('prefix_fetch_array')) ? eval($hook) : false;
return $prefixsets;
}
}
示例12: prepare
/**
* Prepares a Profile Field
*
* @param string The name of a field to be prepared
*/
function prepare($field, $info = null)
{
if (isset($this->prepared["{$field}"])) {
return;
}
$handled = false;
($hook = vBulletinHook::fetch_hook('userprofile_prepare')) ? eval($hook) : false;
if (!$handled) {
if (isset($this->prepare_methods["{$field}"])) {
$method = $this->prepare_methods["{$field}"];
$this->{$method}($info);
} else {
$this->prepared["{$field}"] = $this->userinfo["{$field}"];
}
}
}
示例13: fetch_prefix_array
/**
* Fetches an array of prefixes for the specified forum. Returned in format:
* [prefixsetid][] = prefixid
*
* @param integer Forum ID to fetch prefixes from
*
* @return array
*/
function fetch_prefix_array($forumid)
{
global $vbulletin;
if (isset($vbulletin->prefixcache))
{
return (is_array($vbulletin->prefixcache["$forumid"]) ? $vbulletin->prefixcache["$forumid"] : array());
}
else
{
$prefixsets = array();
$prefix_sql = $vbulletin->db->query_read("
SELECT prefix.*, prefixpermission.usergroupid AS restriction
FROM " . TABLE_PREFIX . "forumprefixset AS forumprefixset
INNER JOIN " . TABLE_PREFIX . "prefixset AS prefixset ON (prefixset.prefixsetid = forumprefixset.prefixsetid)
INNER JOIN " . TABLE_PREFIX . "prefix AS prefix ON (prefix.prefixsetid = prefixset.prefixsetid)
LEFT JOIN " . TABLE_PREFIX . "prefixpermission AS prefixpermission ON (prefix.prefixid = prefixpermission.prefixid)
WHERE forumprefixset.forumid = " . intval($forumid) . "
ORDER BY prefixset.displayorder, prefix.displayorder
");
while ($prefix = $vbulletin->db->fetch_array($prefix_sql))
{
if (empty($prefixsets["$prefix[prefixsetid]"]["$prefix[prefixid]"]))
{
$prefixsets["$prefix[prefixsetid]"]["$prefix[prefixid]"] = array(
'prefixid' => $prefix['prefixid'],
'restrictions' => array()
);
}
if ($prefix['restriction'])
{
$prefixsets["$prefix[prefixsetid]"]["$prefix[prefixid]"]['restrictions'][] = $prefix['restriction'];
}
}
($hook = vBulletinHook::fetch_hook('prefix_fetch_array')) ? eval($hook) : false;
return $prefixsets;
}
}
示例14: verify_authentication2
function verify_authentication2($username)
{
global $vbulletin;
$username = strip_blank_ascii($username, ' ');
if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'")) {
if ($vbulletin->GPC[COOKIE_PREFIX . 'userid'] and $vbulletin->GPC[COOKIE_PREFIX . 'userid'] != $vbulletin->userinfo['userid']) {
// we have a cookie from a user and we're logging in as
// a different user and we're not going to store a new cookie,
// so let's unset the old one
vbsetcookie('userid', '', true, true, true);
vbsetcookie('password', '', true, true, true);
}
vbsetcookie('userid', $vbulletin->userinfo['userid'], true, true, true);
vbsetcookie('password', md5($vbulletin->userinfo['password'] . COOKIE_SALT), true, true, true);
$return_value = true;
($hook = vBulletinHook::fetch_hook('login_verify_success')) ? eval($hook) : false;
return $return_value;
}
$return_value = false;
($hook = vBulletinHook::fetch_hook('login_verify_failure_username')) ? eval($hook) : false;
return $return_value;
}
示例15: fetch_entry_tagbits
/**
* Fetches the tagbits for display in an entry
*
* @param array Blog info
*
* @return string Tag bits
*/
function fetch_entry_tagbits($bloginfo, &$userinfo)
{
global $vbulletin, $vbphrase, $show, $template_hook;
if ($bloginfo['taglist'])
{
$tag_array = explode(',', $bloginfo['taglist']);
$tag_list = array();
foreach ($tag_array AS $tag)
{
$tag = trim($tag);
if ($tag === '')
{
continue;
}
$tag_url = urlencode(unhtmlspecialchars($tag));
$tag = fetch_word_wrapped_string($tag);
($hook = vBulletinHook::fetch_hook('blog_tag_fetchbit')) ? eval($hook) : false;
$templater = vB_Template::create('blog_tagbit');
$templater->register('tag', $tag);
$templater->register('tag_url', $tag_url);
$templater->register('userinfo', $userinfo);
$templater->register('pageinfo', array('tag' => $tag_url));
$tag_list[] = trim($templater->render());
}
}
else
{
$tag_list = array();
}
($hook = vBulletinHook::fetch_hook('blog_tag_fetchbit_complete')) ? eval($hook) : false;
return implode(", ", $tag_list);
}