本文整理汇总了PHP中get_Cache函数的典型用法代码示例。如果您正苦于以下问题:PHP get_Cache函数的具体用法?PHP get_Cache怎么用?PHP get_Cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_Cache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: CommentList2
/**
* Constructor
*
* @param Blog This may be NULL only when must select comments from all Blog. Use NULL carefully, because it may generate very long queries!
* @param integer|NULL Limit
* @param string name of cache to be used
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param string Name to be used when saving the filterset (leave empty to use default for collection)
*/
function CommentList2($Blog, $limit = 1000, $cache_name = 'CommentCache', $param_prefix = '', $filterset_name = '')
{
global $Settings;
// Call parent constructor:
parent::DataObjectList2(get_Cache($cache_name), $limit, $param_prefix, NULL);
// Set Blog. Note: It can be NULL on ?disp=usercomments
$this->Blog = $Blog;
// The SQL Query object:
$this->CommentQuery = new CommentQuery();
$this->CommentQuery->Blog = $this->Blog;
// The Item filter SQL Query object:
$this->ItemQuery = new ItemQuery('T_items__item', 'post_', 'post_ID');
// Blog can be NULL on ?disp=usercomments, in this case ItemQuery blog must be set to 0, which means all blog
$this->ItemQuery->blog = empty($this->Blog) ? 0 : $this->Blog->ID;
if (!empty($filterset_name)) {
// Set the filterset_name with the filterset_name param
$this->filterset_name = 'CommentList_filters_' . $filterset_name;
} else {
// Set a generic filterset_name
$this->filterset_name = 'CommentList_filters_coll' . (!is_null($this->Blog) ? $this->Blog->ID : '0');
}
$this->page_param = $param_prefix . 'paged';
// Initialize the default filter set:
$this->set_default_filters(array('filter_preset' => NULL, 'author_IDs' => NULL, 'author' => NULL, 'author_email' => NULL, 'author_url' => NULL, 'url_match' => '=', 'include_emptyurl' => NULL, 'author_IP' => NULL, 'post_ID' => NULL, 'comment_ID' => NULL, 'comment_ID_list' => NULL, 'rating_toshow' => NULL, 'rating_turn' => 'above', 'rating_limit' => 1, 'keywords' => NULL, 'phrase' => 'AND', 'exact' => 0, 'statuses' => NULL, 'expiry_statuses' => array('active'), 'types' => array('comment', 'trackback', 'pingback'), 'orderby' => 'date', 'order' => !is_null($this->Blog) ? $this->Blog->get_setting('comments_orderdir') : 'DESC', 'comments' => $this->limit, 'page' => 1, 'featured' => NULL, 'timestamp_min' => NULL, 'timestamp_max' => NULL, 'threaded_comments' => false, 'user_perm' => NULL));
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:34,代码来源:_commentlist.class.php
示例2: get_available_FileRoots
/**
* Get an array of ALL available Fileroots (not just the cached ones).
*
* @todo fp> it would probably make sense to refactor this as the constructor for the file roots
* and initialize the whole cache at construction time
*
* @static
*
* @return array of FileRoots (key being the FileRoot's ID)
*/
function get_available_FileRoots()
{
global $current_User;
$r = array();
// The user's blog (if available) is the default/first one:
$user_FileRoot =& $this->get_by_type_and_ID('user', $current_User->ID, true);
if ($user_FileRoot) {
// We got a user media dir:
$r[$user_FileRoot->ID] =& $user_FileRoot;
}
// blog/collection media dirs:
$BlogCache =& get_Cache('BlogCache');
$bloglist = $BlogCache->load_user_blogs('blog_media_browse', $current_User->ID);
foreach ($bloglist as $blog_ID) {
if ($Root =& $this->get_by_type_and_ID('collection', $blog_ID, true)) {
$r[$Root->ID] =& $Root;
}
}
// skins root:
$skins_FileRoot =& $this->get_by_type_and_ID('skins', 0, false);
if ($skins_FileRoot) {
// We got a skins dir:
$r[$skins_FileRoot->ID] =& $skins_FileRoot;
}
return $r;
}
开发者ID:LFSF,项目名称:oras,代码行数:36,代码来源:_filerootcache.class.php
示例3: stats_format_req_URI
/**
* Helper function for "Requested URI" column
* @param integer Blog ID
* @param string Requested URI
* @return string
*/
function stats_format_req_URI($hit_blog_ID, $hit_uri, $max_len = 40)
{
if (!empty($hit_blog_ID)) {
$BlogCache =& get_Cache('BlogCache');
$tmp_Blog =& $BlogCache->get_by_ID($hit_blog_ID);
$full_url = $tmp_Blog->get('baseurlroot') . $hit_uri;
} else {
$full_url = $hit_uri;
}
if (strlen($hit_uri) > $max_len) {
$hit_uri = '...' . substr($hit_uri, -$max_len);
}
return '<a href="' . $full_url . '">' . $hit_uri . '</a>';
}
开发者ID:LFSF,项目名称:oras,代码行数:20,代码来源:_stats_view.funcs.php
示例4: UserList
/**
* Constructor
*
* @param integer|NULL Limit
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param string Name to be used when saving the filterset (leave empty to use default)
* @param array Query params:
* 'join_group' => true,
* 'join_session' => false,
* 'join_country' => true,
* 'join_city' => true,
* 'keywords_fields' - Fields of users table to search by keywords
* 'where_status_closed' - FALSE - to don't display closed users
* 'where_org_ID' - ID of organization
*/
function UserList($filterset_name = '', $limit = 20, $param_prefix = 'users_', $query_params = array())
{
// Call parent constructor:
parent::DataObjectList2(get_Cache('UserCache'), $limit, $param_prefix, NULL);
// Init query params, @see $this->query_init()
$this->query_params = $query_params;
if (!empty($filterset_name)) {
// Set the filterset_name with the filterset_name param
$this->filterset_name = 'UserList_filters_' . $filterset_name;
} else {
// Set a generic filterset_name
$this->filterset_name = 'UserList_filters';
}
$this->order_param = 'results_' . $param_prefix . 'order';
$this->page_param = $param_prefix . 'paged';
// Initialize the default filter set:
$this->set_default_filters(array('filter_preset' => NULL, 'country' => NULL, 'region' => NULL, 'subregion' => NULL, 'city' => NULL, 'membersonly' => false, 'keywords' => NULL, 'gender' => NULL, 'status_activated' => NULL, 'account_status' => NULL, 'reported' => NULL, 'custom_sender_email' => NULL, 'custom_sender_name' => NULL, 'group' => -1, 'age_min' => NULL, 'age_max' => NULL, 'userfields' => array(), 'order' => '-D', 'users' => array(), 'level_min' => NULL, 'level_max' => NULL, 'org' => NULL));
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:33,代码来源:_userlist.class.php
示例5: Link
/**
* Constructor
*
* @param table Database row
*/
function Link($db_row = NULL)
{
// Call parent constructor:
parent::DataObject('T_links', 'link_', 'link_ID', 'datecreated', 'datemodified', 'creator_user_ID', 'lastedit_user_ID');
if ($db_row != NULL) {
$this->ID = $db_row->link_ID;
$this->ltype_ID = $db_row->link_ltype_ID;
// source of link:
$ItemCache =& get_Cache('ItemCache');
$this->Item =& $ItemCache->get_by_ID($db_row->link_itm_ID);
$FileCache =& get_Cache('FileCache');
// fp> do not halt on error. For some reason (ahem bug) a file can disappear and if we fail here then we won't be
// able to delete the link
$this->File =& $FileCache->get_by_ID($db_row->link_file_ID, false, false);
} else {
// New object:
}
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:23,代码来源:_link.class.php
示例6: ItemListLight
/**
* Constructor
*
* @todo add param for saved session filter set
*
* @param Blog
* @param mixed Default filter set: Do not show posts before this timestamp, can be 'now'
* @param mixed Default filter set: Do not show posts after this timestamp, can be 'now'
* @param integer|NULL Limit
* @param string name of cache to be used (for table prefix info)
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param array restrictions for itemlist (position, contact, firm, ...) key: restriction name, value: ID of the restriction
*/
function ItemListLight(&$Blog, $timestamp_min = NULL, $timestamp_max = NULL, $limit = 20, $cache_name = 'ItemCacheLight', $param_prefix = '', $filterset_name = '')
{
global $Settings, $posttypes_specialtypes;
// Call parent constructor:
parent::DataObjectList2(get_Cache($cache_name), $limit, $param_prefix, NULL);
// asimo> The ItemQuery init was moved into the query_init() method
// The SQL Query object:
// $this->ItemQuery = new ItemQuery( $this->Cache->dbtablename, $this->Cache->dbprefix, $this->Cache->dbIDname );
$this->Blog =& $Blog;
if (!empty($filterset_name)) {
// Set the filterset_name with the filterset_name param
$this->filterset_name = 'ItemList_filters_' . $filterset_name;
} else {
// Set a generic filterset_name
$this->filterset_name = 'ItemList_filters_coll' . (!is_null($this->Blog) ? $this->Blog->ID : '0');
}
$this->page_param = $param_prefix . 'paged';
// Initialize the default filter set:
$this->set_default_filters(array('filter_preset' => NULL, 'ts_min' => $timestamp_min, 'ts_max' => $timestamp_max, 'ts_created_max' => NULL, 'coll_IDs' => NULL, 'cat_array' => array(), 'cat_modifier' => NULL, 'cat_focus' => 'wide', 'tags' => NULL, 'authors' => NULL, 'authors_login' => NULL, 'assignees' => NULL, 'assignees_login' => NULL, 'author_assignee' => NULL, 'lc' => 'all', 'keywords' => NULL, 'keyword_scope' => 'title,content', 'phrase' => 'AND', 'exact' => 0, 'post_ID' => NULL, 'post_ID_list' => NULL, 'post_title' => NULL, 'ymdhms' => NULL, 'week' => NULL, 'ymdhms_min' => NULL, 'ymdhms_max' => NULL, 'statuses' => NULL, 'types' => '-' . implode(',', $posttypes_specialtypes), 'visibility_array' => get_inskin_statuses(is_null($this->Blog) ? NULL : $this->Blog->ID, 'post'), 'orderby' => !is_null($this->Blog) ? $this->Blog->get_setting('orderby') : 'datestart', 'order' => !is_null($this->Blog) ? $this->Blog->get_setting('orderdir') : 'DESC', 'unit' => !is_null($this->Blog) ? $this->Blog->get_setting('what_to_show') : 'posts', 'posts' => $this->limit, 'page' => 1, 'featured' => NULL));
}
开发者ID:Ariflaw,项目名称:b2evolution,代码行数:33,代码来源:_itemlistlight.class.php
示例7: unset
$login = $_POST['login'];
$pass = $_POST['pwd'];
unset($_POST['pwd']);
// password will be hashed below
} elseif (isset($_GET['login'])) {
// Trying to log in with a GET; we might only provide a user here.
$login = $_GET['login'];
$pass = isset($_GET['pwd']) ? $_GET['pwd'] : '';
unset($_GET['pwd']);
// password will be hashed below
}
$Debuglog->add('login: ' . var_export($login, true), 'login');
$Debuglog->add('pass: ' . (empty($pass) ? '' : 'not') . ' empty', 'login');
// either 'login' (normal) or 'redirect_to_backoffice' may be set here. This also helps to display the login form again, if either login or pass were empty.
$login_action = param_arrayindex('login_action');
$UserCache =& get_Cache('UserCache');
if (!empty($login_action) || !empty($login) && !empty($pass)) {
// User is trying to login right now
$Debuglog->add('User is trying to log in.', 'login');
header_nocache();
// Note: login and password cannot include '<' !
$login = strtolower(strip_tags(remove_magic_quotes($login)));
$pass = strip_tags(remove_magic_quotes($pass));
$pass_md5 = md5($pass);
/*
* Handle javascript-hashed password:
* If possible, the login form will hash the entered password with a salt that changes everytime.
*/
param('pwd_salt', 'string', '');
// just for comparison with the one from Session
$pwd_salt_sess = $Session->get('core.pwd_salt');
开发者ID:LFSF,项目名称:oras,代码行数:31,代码来源:_main.inc.php
示例8: item_ink_by_urltitle
/**
* Template tag: Link to an item identified by its url title / slug / name
*
* Note: this will query the database. Thus, in most situations it will make more sense
* to use a hardcoded link. This tag can be useful for prototyping location independant
* sites.
*/
function item_ink_by_urltitle($params = array())
{
// Make sure we are not missing any param:
$params = array_merge(array('urltitle' => NULL, 'before' => ' ', 'after' => ' ', 'text' => '#'), $params);
/**
* @var ItemCache
*/
$ItemCache =& get_Cache('ItemCache');
/**
* @var Item
*/
$Item =& $ItemCache->get_by_urltitle($params['urltitle'], false);
if (empty($Item)) {
return false;
}
$Item->permanent_link($params);
}
开发者ID:LFSF,项目名称:oras,代码行数:24,代码来源:_item.funcs.php
示例9: trackback_response
}
if (!empty($_GET['__mode'])) {
// some MT extension (AFAIK), that we do not support
return;
}
if (empty($tb_id)) {
trackback_response(1, 'No trackback post ID given.');
// exits
}
if (empty($url)) {
trackback_response(1, 'No url to your permanent entry given.');
// exits
}
@header('Content-Type: text/xml');
$comment_post_ID = $tb_id;
$ItemCache =& get_Cache('ItemCache');
$commented_Item =& $ItemCache->get_by_ID($comment_post_ID);
if (!($Blog =& $commented_Item->get_Blog())) {
trackback_response(1, 'Sorry, could not get the post\'s weblog.');
// exits
}
if (!$Blog->get('allowtrackbacks')) {
trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.');
// exits
}
// Commented out again, because it's comment specific: if( ! $commented_Item->can_comment( NULL ) )
// "BeforeTrackbackInsert" should be hooked instead!
if ($commented_Item->comment_status != 'open') {
trackback_response(1, 'Sorry, this item does not accept trackbacks.');
// exits
}
开发者ID:LFSF,项目名称:oras,代码行数:31,代码来源:trackback.php
示例10: FileRoot
/**
* Constructor
*
* Will fail if non existent User or Blog is requested.
* But specific access permissions on (threfore existence of) this User or Blog should have been tested before anyway.
*
* @param string Root type: 'user', 'group' or 'collection'
* @param integer ID of the user, the group or the collection the file belongs to...
* @param boolean Create the directory, if it does not exist yet?
*/
function FileRoot($root_type, $root_in_type_ID, $create = true)
{
// Store type:
$this->type = $root_type;
// Store ID in type:
$this->in_type_ID = $root_in_type_ID;
// Generate unique ID:
$this->ID = FileRoot::gen_ID($root_type, $root_in_type_ID);
switch ($root_type) {
case 'user':
$UserCache =& get_Cache('UserCache');
$User =& $UserCache->get_by_ID($root_in_type_ID);
$this->name = $User->get('preferredname');
//.' ('. /* TRANS: short for "user" */ T_('u').')';
$this->ads_path = $User->get_media_dir($create);
$this->ads_url = $User->get_media_url();
return;
case 'collection':
$BlogCache =& get_Cache('BlogCache');
/**
* @var Blog
*/
$Blog =& $BlogCache->get_by_ID($root_in_type_ID);
$this->name = $Blog->get('shortname');
//.' ('. /* TRANS: short for "blog" */ T_('b').')';
$this->ads_path = $Blog->get_media_dir($create);
$this->ads_url = $Blog->get_media_url();
return;
case 'skins':
// fp> some stuff here should go out of here... but I don't know where to put it yet. I'll see after the Skin refactoring.
global $Settings, $Debuglog;
/**
* @var User
*/
global $current_User;
if (!$Settings->get('fm_enable_roots_skins')) {
// Skins root is disabled:
$Debuglog->add('Attempt to access skins dir, but this feature is globally disabled', 'files');
} elseif (!$current_User->check_perm('templates')) {
// No perm to access templates:
$Debuglog->add('Attempt to access skins dir, but no permission', 'files');
} else {
global $skins_path, $skins_url;
$this->name = T_('Skins');
$this->ads_path = $skins_path;
$this->ads_url = $skins_url;
}
return;
}
debug_die("Root_type={$root_type} not supported");
}
开发者ID:LFSF,项目名称:oras,代码行数:61,代码来源:_fileroot.class.php
示例11: die
* @todo Currently if you change the name of a blog it gets not reflected in the blog list buttons!
*
* @version $Id: coll_settings.ctrl.php,v 1.11 2008/01/21 09:35:26 fplanque Exp $
*/
if (!defined('EVO_MAIN_INIT')) {
die('Please, do not access this page directly.');
}
param_action('edit');
param('tab', 'string', 'general', true);
// Check permissions on requested blog and autoselect an appropriate blog if necessary.
// This will prevent a fat error when switching tabs and you have restricted perms on blog properties.
if ($selected = autoselect_blog('blog_properties', 'edit')) {
// We have a blog to work on:
if (set_working_blog($selected)) {
// Selected a new blog:
$BlogCache =& get_Cache('BlogCache');
$Blog =& $BlogCache->get_by_ID($blog);
}
/**
* @var Blog
*/
$edited_Blog =& $Blog;
} else {
// We could not find a blog we have edit perms on...
// Note: we may still have permission to edit categories!!
// redirect to blog list:
header_redirect('?ctrl=collections');
// EXITED:
$Messages->add(T_('Sorry, you have no permission to edit blog properties.'), 'error');
$action = 'nil';
$tab = '';
开发者ID:LFSF,项目名称:oras,代码行数:31,代码来源:coll_settings.ctrl.php
示例12: autoselect_blog
/**
* Check permissions on a given blog (by ID) and autoselect an appropriate blog
* if necessary.
*
* For use in admin
*
* NOTE: we no longer try to set $Blog inside of the function because later global use cannot be safely guaranteed in PHP4.
*
* @param string Permission name that must be given to the {@link $current_User} object.
* @param string Permission level that must be given to the {@link $current_User} object.
* @return integer new selected blog
*/
function autoselect_blog($permname, $permlevel = 'any')
{
global $blog;
/**
* @var User
*/
global $current_User;
$autoselected_blog = $blog;
if ($autoselected_blog) {
// a blog is already selected
if (!$current_User->check_perm($permname, $permlevel, false, $autoselected_blog)) {
// invalid blog
// echo 'current blog was invalid';
$autoselected_blog = 0;
}
}
if (!$autoselected_blog) {
// No blog is selected so far (or selection was invalid)...
// Let's try to find another one:
/**
* @var BlogCache
*/
$BlogCache =& get_Cache('BlogCache');
// Get first suitable blog
$blog_array = $BlogCache->load_user_blogs($permname, $permlevel, $current_User->ID, 'ID', 1);
if (!empty($blog_array)) {
$autoselected_blog = $blog_array[0];
}
}
return $autoselected_blog;
}
开发者ID:LFSF,项目名称:oras,代码行数:43,代码来源:_blog.funcs.php
示例13: ItemListLight
/**
* Constructor
*
* @todo add param for saved session filter set
*
* @param Blog
* @param mixed Default filter set: Do not show posts before this timestamp, can be 'now'
* @param mixed Default filter set: Do not show posts after this timestamp, can be 'now'
* @param integer|NULL Limit
* @param string name of cache to be used (for table prefix info)
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param array restrictions for itemlist (position, contact, firm, ...) key: restriction name, value: ID of the restriction
*/
function ItemListLight(&$Blog, $timestamp_min = NULL, $timestamp_max = NULL, $limit = 20, $cache_name = 'ItemCacheLight', $param_prefix = '', $filterset_name = '', $restrict_to = array())
{
global $Settings;
// Call parent constructor:
parent::DataObjectList2(get_Cache($cache_name), $limit, $param_prefix, NULL);
// The SQL Query object:
$this->ItemQuery =& new ItemQuery($this->Cache->dbtablename, $this->Cache->dbprefix, $this->Cache->dbIDname);
$this->Blog =& $Blog;
if (!empty($filterset_name)) {
// Set the filterset_name with the filterset_name param
$this->filterset_name = 'ItemList_filters_' . $filterset_name;
} else {
// Set a generic filterset_name
$this->filterset_name = 'ItemList_filters_coll' . $this->Blog->ID;
}
$this->page_param = $param_prefix . 'paged';
$this->restrict_to = $restrict_to;
// Initialize the default filter set:
$this->set_default_filters(array('filter_preset' => NULL, 'ts_min' => $timestamp_min, 'ts_max' => $timestamp_max, 'ts_created_max' => NULL, 'cat_array' => array(), 'cat_modifier' => NULL, 'cat_focus' => 'wide', 'tags' => NULL, 'authors' => NULL, 'assignees' => NULL, 'author_assignee' => NULL, 'lc' => 'all', 'keywords' => NULL, 'phrase' => 'AND', 'exact' => 0, 'post_ID' => NULL, 'post_ID_list' => NULL, 'post_title' => NULL, 'ymdhms' => NULL, 'week' => NULL, 'ymdhms_min' => NULL, 'ymdhms_max' => NULL, 'statuses' => NULL, 'types' => '-1000', 'visibility_array' => array('published', 'protected', 'private'), 'orderby' => $this->Blog->get_setting('orderby'), 'order' => $this->Blog->get_setting('orderdir'), 'unit' => $this->Blog->get_setting('what_to_show'), 'posts' => $this->limit, 'page' => 1));
}
开发者ID:LFSF,项目名称:oras,代码行数:33,代码来源:_itemlistlight.class.php
示例14: get_oauth_info
function get_oauth_info($params = array())
{
$params = array_merge(array('type' => '', 'ID' => '', 'blog_ID' => '', 'user_ID' => ''), $params);
if ($params['type'] == 'blog') {
// Get from CollSettings
$blog_ID = $params['ID'];
$try_user = false;
} elseif ($params['type'] == 'user') {
// Get from UserSettings
$user_ID = $params['ID'];
$try_user = true;
} else {
// Get from any
$blog_ID = $params['blog_ID'];
$user_ID = $params['user_ID'];
$try_user = true;
}
$r = array();
if (!empty($blog_ID)) {
// CollSettings
$BlogCache =& get_Cache('BlogCache');
$Blog =& $BlogCache->get_by_ID($blog_ID, false, false);
if (!empty($Blog)) {
$r['token'] = $this->get_coll_setting('twitter_token', $Blog);
if (!empty($r['token'])) {
// There is already a linked twitter user in this Blog, get token secret
$r['token_secret'] = $this->get_coll_setting('twitter_secret', $Blog);
$r['contact'] = $this->get_coll_setting('twitter_contact', $Blog);
$r['msg_format'] = $this->get_coll_setting('twitter_msg_format', $Blog);
$try_user = false;
// Do not overwrite
}
}
}
if ($try_user && !empty($user_ID)) {
// UserSettings
$r['token'] = $this->UserSettings->get('twitter_token', $user_ID);
if (!empty($r['token'])) {
// There is already a linked twitter user in this User, get token secret
$r['token_secret'] = $this->UserSettings->get('twitter_secret', $user_ID);
$r['contact'] = $this->UserSettings->get('twitter_contact', $user_ID);
$r['msg_format'] = $this->UserSettings->get('twitter_msg_format', $user_ID);
}
}
return $r;
}
开发者ID:ldanielz,项目名称:uesp.blog,代码行数:46,代码来源:_twitter.plugin.php
示例15: init
/**
* Get an array of registered users and guests.
*
* @return array containing number of registered users and guests ('registered' and 'guests')
*/
function init()
{
if ($this->_initialized) {
return true;
}
global $DB, $localtimenow, $timeout_online_user;
$this->_count_guests = 0;
$this->_registered_Users = array();
$timeout_YMD = date('Y-m-d H:i:s', $localtimenow - $timeout_online_user);
$UserCache =& get_Cache('UserCache');
// We get all sessions that have been seen in $timeout_YMD and that have a session key.
// NOTE: we do not use DISTINCT here, because guest users are all "NULL".
foreach ($DB->get_results("\r\n\t\t\tSELECT sess_user_ID\r\n\t\t\t FROM T_sessions\r\n\t\t\t WHERE sess_lastseen > '" . $timeout_YMD . "'\r\n\t\t\t AND sess_key IS NOT NULL", OBJECT, 'Sessions: get list of relevant users.') as $row) {
if (!empty($row->sess_user_ID) && ($User =& $UserCache->get_by_ID($row->sess_user_ID))) {
// assign by ID so that each user is only counted once (he could use multiple user agents at the same time)
$this->_registered_Users[$User->ID] =& $User;
if (!$User->showonline) {
$this->_count_guests++;
}
} else {
$this->_count_guests++;
}
}
$this->_initialized = true;
}
开发者ID:LFSF,项目名称:oras,代码行数:30,代码来源:_whosonline.plugin.php
示例16: skin_init
/**
* Template tag. Initializes internal states for the most common skin displays.
*
* For more specific skins, this function should not be called and
* equivalent code should be customized within the skin.
*
* @param string What are we going to display. Most of the time the global $disp should be passed.
*/
function skin_init($disp)
{
/**
* @var Blog
*/
global $Blog;
global $robots_index;
global $seo_page_type;
global $redir, $ReqHost, $ReqURI;
global $Chapter;
global $Debuglog;
/**
* @var ItemList2
*/
global $MainList;
/**
* This will give more detail when $disp == 'posts'; otherwise it will have the same content as $disp
* @var string
*/
global $disp_detail;
$disp_detail = $disp;
$Debuglog->add('skin_init: ' . $disp, 'skin');
// This is the main template; it may be used to display very different things.
// Do inits depending on current $disp:
switch ($disp) {
case 'posts':
case 'single':
case 'page':
case 'feedback-popup':
// We need to load posts for this display:
// Note: even if we request the same post as $Item above, the following will do more restrictions (dates, etc.)
// Init the MainList object:
init_MainList($Blog->get_setting('posts_per_page'));
break;
}
// SEO stuff:
$seo_page_type = NULL;
switch ($disp) {
// CONTENT PAGES:
case 'single':
$seo_page_type = 'Single post page';
break;
case 'page':
$seo_page_type = '"Page" page';
break;
case 'posts':
// Get list of active filters:
$active_filters = $MainList->get_active_filters();
if (!empty($active_filters)) {
// The current page is being filtered...
if (array_diff($active_filters, array('page')) == array()) {
// This is just a follow "paged" page
$disp_detail = 'posts-next';
$seo_page_type = 'Next page';
if ($Blog->get_setting('paged_noindex')) {
// We prefer robots not to index category pages:
$robots_index = false;
}
} elseif (array_diff($active_filters, array('cat_array', 'cat_modifier', 'cat_focus', 'posts', 'page')) == array()) {
// This is a category page
$disp_detail = 'posts-cat';
$seo_page_type = 'Category page';
if ($Blog->get_setting('chapter_noindex')) {
// We prefer robots not to index category pages:
$robots_index = false;
}
global $cat, $catsel;
if (empty($catsel) && preg_match('¤[0-9]+¤', $cat)) {
// We are on a single cat page:
// NOTE: we must have selected EXACTLY ONE CATEGORY through the cat parameter
// BUT: - this can resolved to including children
// - selecting exactly one cat through catsel[] is NOT OK since not equivalent (will exclude children)
// echo 'SINGLE CAT PAGE';
if ($Blog->get_setting('canonical_cat_urls') && $redir == 'yes') {
// Check if the URL was canonical:
if (!isset($Chapter)) {
$ChapterCache =& get_Cache('ChapterCache');
/**
* @var Chapter
*/
$Chapter =& $ChapterCache->get_by_ID($MainList->filters['cat_array'][0], false);
}
$canoncical_url = $Chapter->get_permanent_url(NULL, NULL, $MainList->get_active_filter('page'), NULL, '&');
if ($ReqHost . $ReqURI != $canoncical_url) {
// REDIRECT TO THE CANONICAL URL:
// fp> TODO: we're going to lose the additional params, it would be better to keep them...
// fp> what additional params actually?
header_redirect($canoncical_url, true);
}
}
}
} elseif (array_diff($active_filters, array('tags', 'posts', 'page')) == array()) {
//.........这里部分代码省略.........
开发者ID:LFSF,项目名称:oras,代码行数:101,代码来源:_skin.funcs.php
示例17: user_preferredname
/**
* Template tag: Display the user's preferred name
*
* Used in result lists.
*
* @param integer user ID
*/
function user_preferredname($user_ID)
{
$UserCache =& get_Cache('UserCache');
if (!empty($user_ID) && ($User =& $UserCache->get_by_ID($user_ID))) {
$User->disp('preferredname');
}
}
开发者ID:LFSF,项目名称:oras,代码行数:14,代码来源:_user.funcs.php
示例18: get_Cache
/**
* Resolve user ID of owner
*
* @return User
*/
function &get_owner_User()
{
if (!isset($this->owner_User)) {
$UserCache =& get_Cache('UserCache');
$this->owner_User =& $UserCache->get_by_ID($this->owner_user_ID);
}
return $this->owner_User;
}
开发者ID:LFSF,项目名称:oras,代码行数:13,代码来源:_blog.class.php
示例19: trackback
/**
* Send Trackback to single URL
*
* trackback(-)
*
* @todo add autodiscovery
*/
function trackback($trackback_url, $title, $excerpt, $ID)
{
global $app_name, $app_version, $Blog, $Messages;
$trackback_message = T_('Sending trackback to:') . ' ' . htmlspecialchars($trackback_url) . ' ';
$title = rawurlencode($title);
$excerpt = rawurlencode($excerpt);
$blog_name = rawurlencode($Blog->get('name'));
$ItemCache =& get_Cache('ItemCache');
$Item =& $ItemCache->get_by_ID($ID);
$url = rawurlencode($Item->get_permanent_url('', '', '&'));
// dis is the trackback stuff to be sent:
$query_string = "title={$title}&url={$url}&blog_name={$blog_name}&excerpt={$excerpt}";
// echo "url:$trackback_url<br>$sending:$query_string<br />";
$result = '';
if (strstr($trackback_url, '?')) {
$Messages->add($trackback_message . '[get]', 'note');
$trackback_url .= "&" . $query_string;
flush();
if ($fp = fopen($trackback_url, 'r')) {
// blueyed>> why do we here just read the first 4kb, but in the POSTed response everything?
// fp>> this is dirty code... I've never really reviewed it entirely. Feel free to refactor as much as needed.
$result = fread($fp, 4096);
fclose($fp);
/* debug code
$debug_file = 'trackback.log';
$fp = fopen($debug_file, 'a');
fwrite($fp, "\n*****\nTrackback URL query:\n\n$trackback_url\n\nResponse:\n\n");
fwrite($fp, $result);
fwrite($fp, "\n\n");
fclose($fp);
*/
}
} else {
$Messages->add($trackback_message . '[post]', 'note');
$trackback_url = parse_url($trackback_url);
if (!empty($trackback_url['host']) && !empty($trackback_url['path'])) {
// Only try trackback if we have host and path:
$port = isset($trackback_url['port']) ? $trackback_url['port'] : 80;
$http_request = 'POST ' . $trackback_url['path'] . " HTTP/1.0\r\n";
$http_request .= 'Host: ' . $trackback_url['host'] . "\r\n";
$http_request .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
$http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
$http_request .= "User-Agent: {$app_name}/{$app_version}\r\n";
$http_request .= "\r\n";
$http_request .= $query_string;
flush();
if ($fs = @fsockopen($trackback_url['host'], $port, $errno, $errst, 20)) {
// Set timeout for data:
if (function_exists('stream_set_timeout')) {
stream_set_timeout($fs, 20);
// PHP 4.3.0
} else {
socket_set_timeout($fs, 20);
// PHP 4
}
fputs($fs, $http_request);
$result = '';
while (!feof($fs)) {
$result .= fgets($fs, 4096);
}
/* debug code
$debug_file = 'trackback.log';
$fp = fopen($debug_file, 'a');
fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n$result");
while(!@feof($fs)) {
fwrite($fp, @fgets($fs, 4096));
}
fwrite($fp, "\n\n");
fclose($fp);
*/
fclose($fs);
}
}
}
// extract the error code and message, then make the error code readable
if (preg_match("/<error>[\r\n\t ]*(\\d+)[\r\n\t ]*<\\/error>/", $result, $error)) {
preg_match("/<message>(.*?)<\\/message>/", $result, $error_message);
$message = isset($error_message[1]) ? $error_message[1] : '';
switch ($error[1]) {
case '0':
$result_message = '[' . T_('Succeeded') . '] ' . $message;
break;
case '1':
$result_message = '[' . T_('Failed') . '] ' . $message;
break;
default:
$result_message = '[' . T_('Unknown error') . ' (' . $error[1] . ')] ' . $message;
break;
}
} else {
$result_message = T_('No valid trackback response. Maybe the given url is not a Trackback url.') . ' "' . $result . '"';
}
$Messages->add(T_('Response:') . ' ' . strip_tags($result_message), 'note');
//.........这里部分代码省略.........
开发者ID:LFSF,项目名称:oras,代码行数:101,代码来源:_trackback.funcs.php
示例20: display_footer_container
function display_footer_container()
{
global $Blog, $app_version;
if (version_compare($app_version, '4.0') < 0) {
// b2evo 3
$WidgetCache =& get_Cache('WidgetCache');
} else {
// b2evo 4 and up
$WidgetCache =& get_WidgetCache();
}
$fwcount = 0;
if ($Widget_array = $WidgetCache->get_by_coll_container($Blog->ID, 'Footer')) {
foreach ($Widget_array as $ComponentWidget) {
if ($ComponentWidget->enabled) {
$fwcount++;
}
}
}
if ($fwcount < 1) {
$fwcount = 1;
}
echo '<ul class="blocks widgetcount-' . $fwcount . '">';
// "Footer" CONTAINER EMBEDDED HERE
skin_container(NT_('Footer'), array('block_start' => '<li class="block"><div class="block-content clearfix">', 'block_end' => '</div></li>', 'block_title_start' => '<h4 class="title">', 'block_title_end' => '</h4>', 'list_start' => '<ul>', 'list_end' => '</ul>', 'item_start' => '<li class="page_item">', 'item_end' => '</li>', 'group_start' => '<ul>', 'group_end' => '</ul>', 'notes_start' => '<div class="notes">', 'notes_end' => '</div>'));
echo '</ul>';
}
开发者ID:b2evolution,项目名称:mystique_skin,代码 |
请发表评论