本文整理汇总了PHP中titania::access_level方法的典型用法代码示例。如果您正苦于以下问题:PHP titania::access_level方法的具体用法?PHP titania::access_level怎么用?PHP titania::access_level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类titania
的用法示例。
在下文中一共展示了titania::access_level方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_contrib
/**
* Load contribution
*
* Call this AFTER you have loaded the main object (like the FAQ item if requested for example)
*
* @param mixed $contrib contrib_id (always send if you have loaded an item for this contrib!)
*/
function load_contrib($contrib_id = false)
{
$contrib = request_var('id', 0) ? request_var('id', 0) : utf8_normalize_nfc(request_var('c', '', true));
$type = request_var('type', '');
// Load the contribution
titania::$contrib = new titania_contribution();
if (!titania::$contrib->load($contrib)) {
trigger_error('CONTRIB_NOT_FOUND');
}
// Make sure the contrib requested is the same as the contrib loaded
if ($contrib_id !== false && $contrib_id != titania::$contrib->contrib_id || $type != titania_types::$types[titania::$contrib->contrib_type]->url) {
// Mismatch, redirect
redirect(titania::$contrib->get_url(basename(request_var('page', 'details'))));
}
// Put the author in titania::$author
titania::$author = titania::$contrib->author;
// Check to see if the currently accessing user is an author
if (titania::$access_level == TITANIA_ACCESS_PUBLIC && phpbb::$user->data['is_registered'] && !phpbb::$user->data['is_bot']) {
if (titania::$contrib->is_author || titania::$contrib->is_active_coauthor) {
titania::$access_level = TITANIA_ACCESS_AUTHORS;
}
}
// Count the number of FAQ items to display
$flags = titania_count::get_flags(titania::$access_level);
$faq_count = titania_count::from_db(titania::$contrib->contrib_faq_count, $flags);
/**
* Menu Array
*
* 'filename' => array(
* 'title' => 'nav menu title',
* 'url' => $page_url,
* 'auth' => ($can_see_page) ? true : false, // Not required, always true if missing
* ),
*/
$nav_ary = array('details' => array('title' => 'CONTRIB_DETAILS', 'url' => titania::$contrib->get_url()), 'faq' => array('title' => 'CONTRIB_FAQ', 'url' => titania::$contrib->get_url('faq'), 'auth' => titania::$access_level != TITANIA_ACCESS_PUBLIC || $faq_count ? true : false, 'count' => $faq_count), 'support' => array('title' => 'CONTRIB_SUPPORT', 'url' => titania::$contrib->get_url('support'), 'auth' => titania::$config->support_in_titania || titania::$access_level < TITANIA_ACCESS_PUBLIC ? true : false), 'manage' => array('title' => 'CONTRIB_MANAGE', 'url' => titania::$contrib->get_url('manage'), 'auth' => (titania::$contrib->is_author || titania::$contrib->is_active_coauthor) && phpbb::$auth->acl_get('u_titania_post_edit_own') && !in_array(titania::$contrib->contrib_status, array(TITANIA_CONTRIB_CLEANED, TITANIA_CONTRIB_DISABLED)) || phpbb::$auth->acl_get('u_titania_mod_contrib_mod') || titania_types::$types[titania::$contrib->contrib_type]->acl_get('moderate')));
// Display nav menu
$page = request_var('page', '');
titania::generate_nav($nav_ary, $page, 'details');
// Search for a category with the same name as the contrib type. This is a bit ugly, but there really isn't any better option
$categories_ary = titania::$cache->get_categories();
foreach ($categories_ary as $category_id => $category_row) {
$category_row['category_name'] = isset(phpbb::$user->lang[$category_row['category_name']]) ? phpbb::$user->lang[$category_row['category_name']] : $category_row['category_name'];
if ($category_row['category_name'] == titania_types::$types[titania::$contrib->contrib_type]->lang || $category_row['category_name'] == titania_types::$types[titania::$contrib->contrib_type]->langs) {
$category_object = new titania_category();
$category_object->__set_array($categories_ary[$category_id]);
// Generate the main breadcrumbs
titania::generate_breadcrumbs(array($category_object->category_name => titania_url::build_url($category_object->get_url())));
break;
}
}
titania::generate_breadcrumbs(array(titania::$contrib->contrib_name => titania::$contrib->get_url()));
if ($page) {
titania::generate_breadcrumbs(array($nav_ary[$page]['title'] => $nav_ary[$page]['url']));
}
}
示例2: initialise
/**
* Initialise titania:
* Session management, Cache, Language ...
*
* @return void
*/
public static function initialise()
{
global $starttime;
self::$time = (int) $starttime;
self::$cache = phpbb::$container->get('phpbb.titania.cache');
// Setup the Access Level
self::$access_level = phpbb::$container->get('phpbb.titania.access')->get_level();
// Add common titania language file
phpbb::$user->add_lang_ext('phpbb/titania', 'common');
// Load hooks
self::load_hooks();
}
示例3: header
phpbb::$db->sql_freeresult($result);
break;
}
if ($contrib !== false) {
if ($contrib['contrib_user_id'] == phpbb::$user->data['user_id']) {
// Main author
titania::$access_level = TITANIA_ACCESS_AUTHORS;
} else {
// Coauthor
$sql = 'SELECT user_id FROM ' . TITANIA_CONTRIB_COAUTHORS_TABLE . '
WHERE contrib_id = ' . $contrib['contrib_id'] . '
AND user_id = ' . phpbb::$user->data['user_id'] . '
AND active = 1';
$result = phpbb::$db->sql_query($sql);
if (phpbb::$db->sql_fetchrow($result)) {
titania::$access_level = TITANIA_ACCESS_AUTHORS;
}
phpbb::$db->sql_freeresult($result);
}
}
// Still not authorised?
if ($attachment['attachment_access'] < titania::$access_level) {
header('HTTP/1.0 403 Forbidden');
trigger_error('SORRY_AUTH_VIEW_ATTACH');
}
}
}
}
}
/*
* Can not currently be done with the way extensions are setup... @todo?
示例4: initialise
/**
* Initialise titania:
* Session management, Cache, Language ...
*
* @return void
*/
public static function initialise()
{
global $starttime;
self::$page = htmlspecialchars(phpbb::$user->page['script_path'] . phpbb::$user->page['page_name']);
self::$time = (int) $starttime;
// Instantiate cache
if (!class_exists('titania_cache')) {
include TITANIA_ROOT . 'includes/core/cache.' . PHP_EXT;
}
self::$cache = new titania_cache();
// Set the absolute titania/board path
self::$absolute_path = generate_board_url(true) . '/' . self::$config->titania_script_path;
self::$absolute_board = generate_board_url(true) . '/' . self::$config->phpbb_script_path;
// Set the style path, template path, and template name
if (!defined('IN_TITANIA_INSTALL') && !defined('USE_PHPBB_TEMPLATE')) {
self::$images_path = self::$absolute_path . 'images/';
self::$style_path = self::$absolute_path . 'styles/' . self::$config->style . '/';
self::$template_path = self::$style_path . 'template';
self::$theme_path = self::$style_path . 'theme';
// Set the paths for phpBB
self::set_custom_template();
}
// Setup the Access Level
self::$access_level = TITANIA_ACCESS_PUBLIC;
// The user might be in a group with team access even if it's not his default group.
$group_ids = implode(', ', self::$config->team_groups);
$sql = 'SELECT group_id, user_id, user_pending FROM ' . USER_GROUP_TABLE . '
WHERE user_id = ' . phpbb::$user->data['user_id'] . '
AND user_pending = 0
AND group_id IN (' . $group_ids . ')';
$result = phpbb::$db->sql_query_limit($sql, 1);
if ($group_id = phpbb::$db->sql_fetchfield('group_id')) {
self::$access_level = TITANIA_ACCESS_TEAMS;
}
phpbb::$db->sql_freeresult($result);
// Add common titania language file
self::add_lang('common');
// Load the contrib types
self::_include('types/base');
titania_types::load_types();
// Initialise the URL class
titania_url::$root_url = self::$absolute_path;
titania_url::decode_url(self::$config->titania_script_path);
// Generate the root breadcrumb that displays on every page
self::generate_breadcrumbs(array('CUSTOMISATION_DATABASE' => titania_url::build_url('')));
// Load hooks
self::load_hooks();
}