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


PHP vBulletinHook类代码示例

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


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

示例1: 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)));
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:47,代码来源:socialgroupdiscussion.php

示例2: 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;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:27,代码来源:thread.php

示例3: 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;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:7,代码来源:null.php

示例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)));
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:44,代码来源:socialgroupmessage.php

示例5: 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();
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:29,代码来源:navbar.php

示例6: 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;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:60,代码来源:block.php

示例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();
     }
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:32,代码来源:searchcontroller.php

示例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;
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:11,代码来源:functions_video.php

示例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;
}
开发者ID:holandacz,项目名称:nb4,代码行数:21,代码来源:functions_pt_notehistory.php

示例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;
}
开发者ID:benyamin20,项目名称:vbregistration,代码行数:60,代码来源:functions_threadmanage.php

示例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;
    }
}
开发者ID:holandacz,项目名称:nb4,代码行数:23,代码来源:functions_prefix.php

示例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}"];
         }
     }
 }
开发者ID:holandacz,项目名称:nb4,代码行数:21,代码来源:class_userprofile.php

示例13: step_1

 /**
  * Step #1 - Import Settings XML
  *
  */
 function step_1()
 {
     build_forum_permissions();
     vBulletinHook::build_datastore($this->db);
     build_product_datastore();
     build_activitystream_datastore();
     if (VB_AREA == 'Upgrade') {
         $this->show_message($this->phrase['final']['import_latest_options']);
         require_once DIR . '/includes/adminfunctions_options.php';
         if (!($xml = file_read(DIR . '/install/vbulletin-settings.xml'))) {
             $this->add_error(sprintf($this->phrase['vbphrase']['file_not_found'], 'vbulletin-settings.xml'), self::PHP_TRIGGER_ERROR, true);
             return;
         }
         $this->show_message(sprintf($this->phrase['vbphrase']['importing_file'], 'vbulletin-settings.xml'));
         xml_import_settings($xml);
         $this->show_message($this->phrase['core']['import_done']);
     } else {
         $this->skip_message();
     }
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:24,代码来源:class_upgrade_final.php

示例14: 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;
	}
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:49,代码来源:functions_prefix.php

示例15: 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;
 }
开发者ID:xijbx,项目名称:loginshell,代码行数:22,代码来源:loginshell.php


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