本文整理汇总了PHP中p_master类的典型用法代码示例。如果您正苦于以下问题:PHP p_master类的具体用法?PHP p_master怎么用?PHP p_master使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了p_master类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_modules_auth
/**
* @dataProvider module_auth_test_data
*/
public function test_modules_auth($module_auth, $expected)
{
global $phpbb_extension_manager, $phpbb_dispatcher;
$phpbb_extension_manager = $this->extension_manager = new phpbb_mock_extension_manager(dirname(__FILE__) . '/', array('vendor2/foo' => array('ext_name' => 'vendor2/foo', 'ext_active' => '1', 'ext_path' => 'ext/vendor2/foo/'), 'vendor3/bar' => array('ext_name' => 'vendor3/bar', 'ext_active' => '0', 'ext_path' => 'ext/vendor3/bar/')));
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$this->assertEquals($expected, p_master::module_auth($module_auth, 0));
}
示例2: main
/**
* Main module handler.
*
* @param string $short_name Module short name
* @param string $mode Module mode
* @return null
*/
public function main($short_name, $mode)
{
try {
$this->controller->base($mode, $this->u_action);
} catch (\Exception $e) {
$message = $e->getMessage() . '<br /><br />' . $this->user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>');
meta_refresh(3, $this->u_action);
trigger_error($message);
}
$style_path = $this->ext_root . 'styles/' . rawurlencode($this->user->style['style_path']) . '/';
$u_ucp = append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext);
$this->template->assign_vars(array('S_ACTION' => $this->u_action, 'TITANIA_THEME_PATH' => $style_path . 'theme/'));
$this->p_master->assign_tpl_vars($u_ucp);
$this->template->set_filenames(array('body' => '@phpbb_titania/ucp/subscriptions.html'));
page_header($this->user->lang['SUBSCRIPTION_TITANIA']);
page_footer();
}
示例3: request_var
require $phpbb_root_path . 'common.' . $phpEx;
require $phpbb_root_path . 'includes/functions_user.' . $phpEx;
require $phpbb_root_path . 'includes/functions_module.' . $phpEx;
// Basic parameter data
$id = request_var('i', '');
$mode = request_var('mode', '');
if ($mode == 'login' || $mode == 'logout' || $mode == 'confirm') {
define('IN_LOGIN', true);
}
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
// Setting a variable to let the style designer know where he is...
$template->assign_var('S_IN_UCP', true);
$module = new p_master();
$default = false;
// Basic "global" modes
switch ($mode) {
case 'activate':
$module->load('ucp', 'activate');
$module->display($user->lang['UCP_ACTIVATE']);
redirect(append_sid("{$phpbb_root_path}index.{$phpEx}"));
break;
case 'resend_act':
$module->load('ucp', 'resend');
$module->display($user->lang['UCP_RESEND']);
break;
case 'sendpassword':
$module->load('ucp', 'remind');
$module->display($user->lang['UCP_REMIND']);
示例4: get_user_avatar
}
$poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
$template->assign_vars(show_profile($member));
// Custom Profile Fields
$profile_fields = array();
if ($config['load_cpf_viewprofile']) {
include_once $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
$profile_fields = isset($profile_fields[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
}
// We need to check if the module 'zebra' is accessible
$zebra_enabled = false;
if ($user->data['user_id'] != $user_id && $user->data['is_registered']) {
include_once $phpbb_root_path . 'includes/functions_module.' . $phpEx;
$module = new p_master();
$module->list_modules('ucp');
$module->set_active('zebra');
$zebra_enabled = $module->active_module === false ? false : true;
unset($module);
}
// If the user has m_approve permission or a_user permission, then list then display unapproved posts
if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) {
$sql = 'SELECT COUNT(post_id) as posts_in_queue
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $user_id . '
AND post_approved = 0';
$result = $db->sql_query($sql);
$member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
$db->sql_freeresult($result);
} else {
示例5: define
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
$phpbb_root_path = defined('PHPBB_ROOT_PATH') ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include $phpbb_root_path . 'common.' . $phpEx;
include $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
require $phpbb_root_path . 'includes/functions_module.' . $phpEx;
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('mcp');
$module = new p_master();
// Setting a variable to let the style designer know where he is...
$template->assign_var('S_IN_MCP', true);
// Basic parameter data
$id = request_var('i', '');
if (isset($_REQUEST['mode']) && is_array($_REQUEST['mode'])) {
$mode = request_var('mode', array(''));
list($mode, ) = each($mode);
} else {
$mode = request_var('mode', '');
}
// Only Moderators can go beyond this point
if (!$user->data['is_registered']) {
if ($user->data['is_bot']) {
redirect(append_sid("{$phpbb_root_path}index.{$phpEx}"));
}
示例6: view_folder
/**
* View message folder
* Called from ucp_pm with mode == 'view' && action == 'view_folder'
*/
function view_folder($id, $mode, $folder_id, $folder)
{
global $user, $template, $auth, $db, $cache;
global $phpbb_root_path, $config, $phpEx;
$submit_export = (isset($_POST['submit_export'])) ? true : false;
$folder_info = get_pm_from($folder_id, $folder, $user->data['user_id']);
if (!$submit_export)
{
$user->add_lang('viewforum');
// Grab icons
$icons = $cache->obtain_icons();
$color_rows = array('marked', 'replied');
// only show the friend/foe color rows if the module is enabled
$zebra_enabled = false;
$_module = new p_master();
$_module->list_modules('ucp');
$_module->set_active('zebra');
$zebra_enabled = ($_module->active_module === false) ? false : true;
unset($_module);
if ($zebra_enabled)
{
$color_rows = array_merge($color_rows, array('friend', 'foe'));
}
foreach ($color_rows as $var)
{
$template->assign_block_vars('pm_colour_info', array(
'IMG' => $user->img("pm_{$var}", ''),
'CLASS' => "pm_{$var}_colour",
'LANG' => $user->lang[strtoupper($var) . '_MESSAGE'])
);
}
$mark_options = array('mark_important', 'delete_marked');
$s_mark_options = '';
foreach ($mark_options as $mark_option)
{
$s_mark_options .= '<option value="' . $mark_option . '">' . $user->lang[strtoupper($mark_option)] . '</option>';
}
// We do the folder moving options here too, for template authors to use...
$s_folder_move_options = '';
if ($folder_id != PRIVMSGS_NO_BOX && $folder_id != PRIVMSGS_OUTBOX)
{
foreach ($folder as $f_id => $folder_ary)
{
if ($f_id == PRIVMSGS_OUTBOX || $f_id == PRIVMSGS_SENTBOX || $f_id == $folder_id)
{
continue;
}
$s_folder_move_options .= '<option' . (($f_id != PRIVMSGS_INBOX) ? ' class="sep"' : '') . ' value="' . $f_id . '">';
$s_folder_move_options .= sprintf($user->lang['MOVE_MARKED_TO_FOLDER'], $folder_ary['folder_name']);
$s_folder_move_options .= (($folder_ary['unread_messages']) ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . '</option>';
}
}
$friend = $foe = array();
// Get friends and foes
$sql = 'SELECT *
FROM ' . ZEBRA_TABLE . '
WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$friend[$row['zebra_id']] = $row['friend'];
$foe[$row['zebra_id']] = $row['foe'];
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'S_MARK_OPTIONS' => $s_mark_options,
'S_MOVE_MARKED_OPTIONS' => $s_folder_move_options)
);
// Okay, lets dump out the page ...
if (sizeof($folder_info['pm_list']))
{
$address_list = array();
// Build Recipient List if in outbox/sentbox - max two additional queries
if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX)
{
$recipient_list = $address = array();
//.........这里部分代码省略.........
示例7: bbcode
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode();
$bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']);
}
$member['user_sig'] = bbcode_nl2br($member['user_sig']);
$member['user_sig'] = smiley_text($member['user_sig']);
}
$poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
// We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links
$zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false;
// Only check if the user is logged in
if ($user->data['is_registered']) {
if (!class_exists('p_master')) {
include $phpbb_root_path . 'includes/functions_module.' . $phpEx;
}
$module = new p_master();
$module->list_modules('ucp');
$module->list_modules('mcp');
$user_notes_enabled = $module->loaded('notes', 'user_notes') ? true : false;
$warn_user_enabled = $module->loaded('warn', 'warn_user') ? true : false;
$zebra_enabled = $module->loaded('zebra') ? true : false;
$friends_enabled = $module->loaded('zebra', 'friends') ? true : false;
$foes_enabled = $module->loaded('zebra', 'foes') ? true : false;
unset($module);
}
$template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled));
// Custom Profile Fields
$profile_fields = array();
if ($config['load_cpf_viewprofile']) {
include_once $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
示例8: define
}
// We define the admin variables now, because the user is now able to use the admin related features...
define('IN_ADMIN', true);
$phpbb_admin_path = defined('PHPBB_ADMIN_PATH') ? PHPBB_ADMIN_PATH : './';
// Some oft used variables
$safe_mode = @ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) === 'on' ? true : false;
$file_uploads = @ini_get('file_uploads') == '1' || strtolower(@ini_get('file_uploads')) === 'on' ? true : false;
$module_id = request_var('i', '');
$mode = request_var('mode', '');
// Set custom template for admin area
$template->set_custom_template($phpbb_admin_path . 'style', 'admin');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
// the acp template is never stored in the database
$user->theme['template_storedb'] = false;
// Instantiate new module
$module = new p_master();
// Instantiate module system and generate list of available modules
$module->list_modules('acp');
// Select the active module
$module->set_active($module_id, $mode);
// Assign data to the template engine for the list of modules
// We do this before loading the active module for correct menu display in trigger_error
$module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.{$phpEx}"));
// Load and execute the relevant module
$module->load_active();
// Generate the page
adm_page_header($module->get_page_title());
$template->set_filenames(array('body' => $module->get_tpl_name()));
adm_page_footer();
/**
* Header for acp pages
示例9: array
// ... same for group rank
$user_rank_data = array('title' => null, 'img' => null, 'img_src' => null);
if ($group_row['group_rank']) {
$user_rank_data = phpbb_get_user_rank($group_row, false);
if ($user_rank_data['img']) {
$user_rank_data['img'] .= '<br />';
}
}
// include modules for manage groups link display or not
// need to ensure the module is active
$can_manage_group = false;
if ($user->data['is_registered'] && $group_row['group_leader']) {
if (!class_exists('p_master')) {
include $phpbb_root_path . 'includes/functions_module.' . $phpEx;
}
$module = new p_master();
$module->list_modules('ucp');
if ($module->is_active('ucp_groups', 'manage')) {
$can_manage_group = true;
}
unset($module);
}
$template->assign_vars(array('GROUP_DESC' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), 'GROUP_NAME' => $group_row['group_type'] == GROUP_SPECIAL ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], 'GROUP_COLOR' => $group_row['group_colour'], 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']], 'GROUP_RANK' => $user_rank_data['title'], 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $user_rank_data['img'], 'RANK_IMG_SRC' => $user_rank_data['img_src'], 'U_PM' => $auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm'] ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&mode=compose&g=' . $group_id) : '', 'U_MANAGE' => $can_manage_group ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=ucp_groups&mode=manage') : false));
$sql_select = ', ug.group_leader';
$sql_from = ', ' . USER_GROUP_TABLE . ' ug ';
$order_by = 'ug.group_leader DESC, ';
$sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = {$group_id}";
$sql_where_data = " AND u.user_id = ug.user_id AND ug.group_id = {$group_id}";
}
// Sorting and order
if (!isset($sort_key_sql[$sort_key])) {
示例10: make_module_select
/**
* Simple version of jumpbox, just lists modules
*/
function make_module_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $ignore_noncat = false)
{
global $db, $user, $auth, $config;
$sql = 'SELECT module_id, module_enabled, module_basename, parent_id, module_langname, left_id, right_id, module_auth
FROM ' . MODULES_TABLE . "\n\t\t\tWHERE module_class = '" . $db->sql_escape($this->module_class) . "'\n\t\t\tORDER BY left_id ASC";
$result = $db->sql_query($sql);
$right = $iteration = 0;
$padding_store = array('0' => '');
$module_list = $padding = '';
while ($row = $db->sql_fetchrow($result)) {
if ($row['left_id'] < $right) {
$padding .= ' ';
$padding_store[$row['parent_id']] = $padding;
} else {
if ($row['left_id'] > $right + 1) {
$padding = isset($padding_store[$row['parent_id']]) ? $padding_store[$row['parent_id']] : '';
}
}
$right = $row['right_id'];
if (!$ignore_acl && $row['module_auth']) {
// We use zero as the forum id to check - global setting.
if (!p_master::module_auth($row['module_auth'], 0)) {
continue;
}
}
// ignore this module?
if (is_array($ignore_id) && in_array($row['module_id'], $ignore_id) || $row['module_id'] == $ignore_id) {
continue;
}
// empty category
if (!$row['module_basename'] && $row['left_id'] + 1 == $row['right_id'] && $ignore_emptycat) {
continue;
}
// ignore non-category?
if ($row['module_basename'] && $ignore_noncat) {
continue;
}
$selected = is_array($select_id) ? in_array($row['module_id'], $select_id) ? ' selected="selected"' : '' : ($row['module_id'] == $select_id ? ' selected="selected"' : '');
$langname = $this->lang_name($row['module_langname']);
$module_list .= '<option value="' . $row['module_id'] . '"' . $selected . (!$row['module_enabled'] ? ' class="disabled"' : '') . '>' . $padding . $langname . '</option>';
$iteration++;
}
$db->sql_freeresult($result);
unset($padding_store);
return $module_list;
}
示例11: p_master
// Start session management
$user->session_begin();
$auth->acl($user->data);
//
$sql = 'SELECT style_id
FROM ' . STYLES_TABLE . "
WHERE style_name = 'prosilver'";
$result = $db->sql_query($sql, 3600);
$style = $db->sql_fetchfield('style_id');
$db->sql_freeresult($result);
$user->setup('mods/gallery', ((!$style) ? 1 : $style));
$module = new p_master();
// Setting a variable to let the style designer know where he is...
$template->assign_var('S_IN_GALLERY', true);
// Basic parameter data
$id = request_var('i', '');
$mode = request_var('mode', '');
// Instantiate module system and generate list of available modules
$module->list_modules('gallery');
// Select the active module
$module->set_active($id, $mode);
// Load and execute the relevant module
示例12: get_user_info_func
//.........这里部分代码省略.........
FROM ' . SESSIONS_TABLE . "\r\r\n WHERE session_user_id = {$user_id}\r\r\n GROUP BY session_page, session_forum_id\r\r\n ORDER BY session_time DESC";
}
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$member['session_time'] = isset($row['session_time']) ? $row['session_time'] : 0;
$member['session_viewonline'] = isset($row['session_viewonline']) ? $row['session_viewonline'] : 0;
$member['session_page'] = isset($row['session_page']) ? $row['session_page'] : 0;
$member['session_forum_id'] = isset($row['session_forum_id']) ? $row['session_forum_id'] : 0;
unset($row);
}
if ($config['load_user_activity']) {
display_user_activity($member);
}
// Do the relevant calculations
$memberdays = max(1, round((time() - $member['user_regdate']) / 86400));
$posts_per_day = $member['user_posts'] / $memberdays;
$percentage = $config['num_posts'] ? min(100, $member['user_posts'] / $config['num_posts'] * 100) : 0;
if ($member['user_sig']) {
$member['user_sig'] = censor_text($member['user_sig']);
if ($member['user_sig_bbcode_bitfield']) {
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode();
$bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']);
}
$member['user_sig'] = bbcode_nl2br($member['user_sig']);
$member['user_sig'] = smiley_text($member['user_sig']);
}
$poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
// We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links
$zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false;
// Only check if the user is logged in
if ($user->data['is_registered']) {
if (!class_exists('p_master')) {
include $phpbb_root_path . 'includes/functions_module.' . $phpEx;
}
$module = new p_master();
$module->list_modules('ucp');
$module->list_modules('mcp');
$user_notes_enabled = $module->loaded('notes', 'user_notes') ? true : false;
$warn_user_enabled = $module->loaded('warn', 'warn_user') ? true : false;
$zebra_enabled = $module->loaded('zebra') ? true : false;
$friends_enabled = $module->loaded('zebra', 'friends') ? true : false;
$foes_enabled = $module->loaded('zebra', 'foes') ? true : false;
unset($module);
}
$template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled));
// Custom Profile Fields
$profile_fields = array();
if ($config['load_cpf_viewprofile']) {
include_once $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
$profile_fields = isset($profile_fields[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
}
// If the user has m_approve permission or a_user permission, then list then display unapproved posts
if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) {
$sql = 'SELECT COUNT(post_id) as posts_in_queue
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $user_id . '
AND post_approved = 0';
$result = $db->sql_query($sql);
$member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
$db->sql_freeresult($result);
} else {
$member['posts_in_queue'] = 0;
示例13: request_var
require $phpbb_root_path . 'common.' . $phpEx;
require $phpbb_root_path . 'includes/functions_user.' . $phpEx;
require $phpbb_root_path . 'includes/functions_module.' . $phpEx;
// Basic parameter data
$id = request_var('i', '');
$mode = request_var('mode', '');
if (in_array($mode, array('login', 'logout', 'confirm', 'sendpassword', 'activate'))) {
define('IN_LOGIN', true);
}
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('ucp');
// Setting a variable to let the style designer know where he is...
$template->assign_var('S_IN_UCP', true);
$module = new p_master();
$default = false;
// Basic "global" modes
switch ($mode) {
case 'activate':
/*$module->load('ucp', 'activate');
$module->display($user->lang['UCP_ACTIVATE']);
redirect(append_sid("{$phpbb_root_path}index.$phpEx"));*/
$default = true;
break;
case 'resend_act':
/*$module->load('ucp', 'resend');
$module->display($user->lang['UCP_RESEND']);*/
$default = true;
break;
示例14: defined
<?php
/**
*
* @copyright (c) 2009, 2010, 2011 Quoord Systems Limited
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License (GPLv2)
*
*/
defined('IN_MOBIQUO') or exit;
include_once $phpbb_root_path . 'includes/functions_admin.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions_module.' . $phpEx;
require_once $phpbb_root_path . 'includes/functions_posting.' . $phpEx;
$user->setup('mcp');
$module = new p_master();
// Basic parameter data
$id = request_var('i', '');
if (isset($_REQUEST['mode']) && is_array($_REQUEST['mode'])) {
$mode = request_var('mode', array(''));
list($mode, ) = each($mode);
} else {
$mode = request_var('mode', '');
}
// Only Moderators can go beyond this point
if (!$user->data['is_registered']) {
trigger_error('LOGIN_EXPLAIN_MCP');
}
$quickmod = isset($_REQUEST['quickmod']) ? true : false;
$action = request_var('action', '');
$action_ary = request_var('action', array('' => 0));
$forum_action = request_var('forum_action', '');
if ($forum_action !== '' && !empty($_POST['sort'])) {