本文整理汇总了PHP中phpbb\user类的典型用法代码示例。如果您正苦于以下问题:PHP user类的具体用法?PHP user怎么用?PHP user使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了user类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* {@inheritdoc}
*/
public function run()
{
$this->user->session_begin();
$this->user->setup('common');
if ($this->config['email_enable']) {
include $this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext;
// functions_messenger.php uses config to determine language paths
// Remove when able
global $config;
$config = $this->config;
$messenger = new \messenger(false);
$messenger->template('installed', $this->install_config->get('user_language', 'en'));
$messenger->to($this->config['board_email'], $this->install_config->get('admin_name'));
$messenger->anti_abuse_headers($this->config, $this->user);
$messenger->assign_vars(array('USERNAME' => htmlspecialchars_decode($this->install_config->get('admin_name')), 'PASSWORD' => htmlspecialchars_decode($this->install_config->get('admin_passwd'))));
$messenger->send(NOTIFY_EMAIL);
}
// Login admin
// Ugly but works
$this->auth->login($this->install_config->get('admin_name'), $this->install_config->get('admin_passwd'), false, true, true);
$this->iohandler->set_cookie($this->config['cookie_name'] . '_sid', $this->user->session_id);
$this->iohandler->set_cookie($this->config['cookie_name'] . '_u', $this->user->cookie_data['u']);
$this->iohandler->set_cookie($this->config['cookie_name'] . '_k', $this->user->cookie_data['k']);
// Create log
$this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_INSTALL_INSTALLED', false, array($this->config['version']));
// Remove install_lock
@unlink($this->phpbb_root_path . 'cache/install_lock');
}
示例2: add_page_viewonline
/**
*
*/
public function add_page_viewonline($event)
{
if (strrpos($event['row']['session_page'], 'app.' . $this->php_ext . '/mchat') === 0) {
$event['location'] = $this->user->lang('MCHAT_TITLE');
$event['location_url'] = $this->helper->route('dmzx_mchat_controller');
}
}
示例3: main
public function main($id, $mode)
{
global $phpbb_container, $table_prefix;
if (!defined('CHAT_TABLE')) {
$chat_table = $table_prefix . 'ajax_chat';
define('CHAT_TABLE', $chat_table);
}
$this->id = $id;
$this->mode = $mode;
// Initialization
$this->auth = $phpbb_container->get('auth');
$this->config = $phpbb_container->get('config');
$this->db = $phpbb_container->get('dbal.conn');
$this->user = $phpbb_container->get('user');
$this->template = $phpbb_container->get('template');
$this->request = $phpbb_container->get('request');
$this->u_action = $this->request->variable('action', '', true);
$submit = $this->request->is_set_post('submit') ? true : false;
$this->form_key = 'acp_ajax_chat';
add_form_key($this->form_key);
$display_vars = ['title' => 'ACP_AJAX_CHAT_TITLE', 'vars' => ['legend1' => 'AJAX_CHAT_SETTINGS', 'display_ajax_chat' => ['lang' => 'DISPLAY_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'index_display_ajax_chat' => ['lang' => 'INDEX_DISPLAY_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'whois_chatting' => ['lang' => 'WHOIS_CHATTING', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'rule_ajax_chat' => ['lang' => 'RULE_AJAX_CHAT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true], 'ajax_chat_archive_amount' => ['lang' => 'ARCHIVE_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:500', 'explain' => true], 'ajax_chat_popup_amount' => ['lang' => 'POPUP_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_index_amount' => ['lang' => 'INDEX_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_chat_amount' => ['lang' => 'CHAT_AMOUNT_AJAX_CHAT', 'validate' => 'int', 'type' => 'number:5:150', 'explain' => true], 'ajax_chat_time_setting' => ['lang' => 'TIME_SETTING_AJAX_CHAT', 'validate' => 'string', 'type' => 'text:10:20', 'explain' => true], 'refresh_online_chat' => ['lang' => 'REFRESH_ONLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'refresh_idle_chat' => ['lang' => 'REFRESH_IDLE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'refresh_offline_chat' => ['lang' => 'REFRESH_OFFLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_online_chat' => ['lang' => 'STATUS_ONLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_idle_chat' => ['lang' => 'STATUS_IDLE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'status_offline_chat' => ['lang' => 'STATUS_OFFLINE_CHAT', 'validate' => 'int', 'type' => 'number:0:9999', 'explain' => true], 'legend2' => 'AJAX_CHAT_LOCATION', 'location_ajax_chat_override' => ['lang' => 'LOCATION_AJAX_CHAT_OVERRIDE', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'location_ajax_chat' => ['lang' => 'LOCATION_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true], 'legend3' => 'AJAX_CHAT_POSTS', 'ajax_chat_forum_posts' => ['lang' => 'FORUM_POSTS_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_topic' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_reply' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_REPLY', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_edit' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_EDIT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'ajax_chat_forum_quote' => ['lang' => 'FORUM_POSTS_AJAX_CHAT_QUOTE', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => false], 'legend4' => 'AJAX_CHAT_PRUNE', 'prune_ajax_chat' => ['lang' => 'PRUNE_AJAX_CHAT', 'validate' => 'bool', 'type' => 'radio:enabled_enabled', 'explain' => true], 'prune_keep_ajax_chat' => ['lang' => 'PRUNE_KEEP_AJAX_CHAT', 'validate' => 'int', 'type' => 'number', 'explain' => false], 'prune_now' => ['lang' => 'PRUNE_NOW', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'prune_chat'], 'truncate_now' => ['lang' => 'TRUNCATE_NOW', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'truncate_chat'], 'ajax_chat_counter' => ['lang' => 'CHAT_COUNTER', 'validate' => 'bool', 'type' => 'custom', 'explain' => false, 'method' => 'chat_counter'], 'legend5' => 'ACP_SUBMIT_CHANGES']];
#region Submit
if ($submit) {
$submit = $this->do_submit_stuff($display_vars);
// If the submit was valid, so still submitted
if ($submit) {
trigger_error($this->user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action), E_USER_NOTICE);
}
}
#endregion
$this->generate_stuff_for_cfg_template($display_vars);
// Output page template file
$this->tpl_name = 'ajax_chat';
$this->page_title = $this->user->lang($display_vars['title']);
}
示例4: modify_memberlist
public function modify_memberlist($event)
{
$poster_data = $event['data'];
$b = $event['template_data'];
$b['JOINED'] = $this->user->format_date($poster_data['user_regdate'], $this->date_format);
$event['template_data'] = $b;
}
示例5: display
/**
* Display the user ranks page
*
* @return \Symfony\Component\HttpFoundation\Response A Symfony Response object
* @access public
*/
public function display($name)
{
// Get the rank details
$sql = 'SELECT *
FROM ' . RANKS_TABLE . '
ORDER BY rank_special DESC, rank_min ASC, rank_title ASC';
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
if ($this->config['userranks_special'] || $this->config['userranks_special_admin'] && $this->auth->acl_get('a_') || !$this->config['userranks_special'] && !$row['rank_special']) {
$rank_row = array('S_RANK_IMAGE' => $row['rank_image'] ? true : false, 'S_SPECIAL_RANK' => $row['rank_special'] ? true : false, 'RANK_IMAGE' => $this->path_helper->get_web_root_path() . $this->config['ranks_path'] . '/' . $row['rank_image'], 'RANK_TITLE' => $row['rank_title'], 'MIN_POSTS' => $row['rank_min']);
$this->template->assign_block_vars('ranks', $rank_row);
// Are we displaying members?
if ($this->config['userranks_members'] || $this->config['userranks_members_admin'] && $this->auth->acl_get('a_')) {
$rank_users = $this->get_user_rank_data($row['rank_id']);
if (sizeof($rank_users) > 0) {
foreach ($rank_users as $row_rank) {
$this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => get_username_string('full', $row_rank['user_id'], $row_rank['username'], $row_rank['user_colour'])));
}
} else {
$this->template->assign_block_vars('ranks.rank_member', array('MEMBERS' => $this->user->lang('NO_MEMBERS')));
}
}
}
}
$this->db->sql_freeresult($result);
// Assign breadcrumb template vars for the user ranks page
$this->template->assign_block_vars('navlinks', array('U_VIEW_FORUM' => $this->helper->route('david63_userranks_main_controller', array('name' => 'ranks')), 'FORUM_NAME' => $this->user->lang('USER_RANKS')));
// Send all data to the template file
return $this->helper->render('user_ranks.html', $name);
}
示例6: setup
/**
* Setup Smart Subjects
*
* @param \phpbb\event\data $event The event object
* @return void
*/
public function setup($event)
{
$this->user->add_lang_ext('vse/smartsubjects', 'smartsubjects');
$page_data = $event['page_data'];
$page_data['S_SMART_SUBJECTS_MOD'] = $this->forum_auth($event['forum_id']) && $this->auth->acl_get('m_', $event['forum_id']);
$event['page_data'] = $page_data;
}
示例7: main
public function main($event)
{
// add lang file
$this->user->add_lang_ext('v12mike/postoftheday', 'postoftheday');
$this->functions->topposts();
$this->template->assign_vars(array('S_POSTOFTHEDAY' => 1, 'S_POSTOFTHEDAY_LOCATION' => $this->config['post_of_the_day_location']));
}
示例8: acp_ranks_list_modify_rank_row
public function acp_ranks_list_modify_rank_row($event)
{
$this->user->add_lang_ext('paybas/rankpoststyling', 'rankpoststyling');
$rank_row = $event['rank_row'];
$rank_row['RANK_STYLE'] = isset($event['row']['rank_style']) ? $event['row']['rank_style'] : '';
$event['rank_row'] = $rank_row;
}
示例9: memberlist_view_profile
/**
* Display zodiac on viewing user profile
*
* @param object $event The event object
* @return null
* @access public
*/
public function memberlist_view_profile($event)
{
$user_id = $event['member']['user_id'];
$reg_date = $event['member']['user_regdate'];
$this->user->add_lang_ext('rmcgirr83/searchusertopics', 'common');
// get all topics started by the user and make sure they are visible
$sql = 'SELECT t.*, p.post_visibility
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
WHERE t.topic_poster = ' . $user_id . '
ORDER BY t.topic_time ASC';
$result = $this->db->sql_query($sql);
$topics_num = 0;
while ($row = $this->db->sql_fetchrow($result)) {
if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
continue;
}
++$topics_num;
}
$this->db->sql_freeresult($result);
if ($topics_num) {
// Do the relevant calculations
$users_days = max(1, round((time() - $reg_date) / 86400));
$topics_per_day = $topics_num / $users_days;
$topics_percent = $this->config['num_topics'] ? min(100, $topics_num / $this->config['num_topics'] * 100) : 0;
$this->template->assign_vars(array('TOPICS' => $topics_num, 'L_TOTAL_TOPICS' => $this->user->lang('TOTAL_TOPICS', $topics_num), 'TOPICS_PER_DAY' => $this->user->lang('TOPICS_PER_DAY', $topics_per_day), 'TOPICS_PERCENT' => $this->user->lang('TOPICS_PERCENT', $topics_percent), 'U_SEARCH_TOPICS' => $this->auth->acl_get('u_search') ? append_sid("{$this->root_path}search.{$this->php_ext}", "author_id={$user_id}&sr=topics&sf=firstpost") : ''));
}
}
示例10: handle_downloadlog
public function handle_downloadlog()
{
if (!$this->auth->acl_get('a_')) {
trigger_error('Access Denied');
} else {
$this->user->add_lang_ext('dmzx/downloadlog', 'common');
$fileid = $this->request->variable('file', 0);
$start = $this->request->variable('start', 0);
// Pagination number from ACP
$dll = $this->config['downloadlog_value'];
// Generate pagination
$sql = 'SELECT COUNT(downloadslog_id) AS total_downloadlogs
FROM ' . $this->userdownloadslog_table . '
WHERE user_id = user_id
AND file_id = ' . $fileid;
$result = $this->db->sql_query($sql);
$total_downloadlogs = (int) $this->db->sql_fetchfield('total_downloadlogs');
$sql = 'SELECT d.user_id, d.down_date, u.user_id, u.username, u.user_colour
FROM ' . $this->userdownloadslog_table . ' d, ' . USERS_TABLE . ' u
WHERE u.user_id = d.user_id
AND file_id = ' . $fileid . '
ORDER BY d.down_date DESC';
$top_result = $this->db->sql_query_limit($sql, $dll, $start);
while ($row = $this->db->sql_fetchrow($top_result)) {
$this->template->assign_block_vars('downloaders', array('D_USERNAME' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'D_TIME' => $this->user->format_date($row['down_date'])));
}
}
$pagination_url = $this->helper->route('dmzx_downloadlog_controller', array('file' => $fileid));
//Start pagination
$this->pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_downloadlogs, $dll, $start);
$this->template->assign_vars(array('DOWNLOADERS_USERS' => $total_downloadlogs == 1 ? $this->user->lang['DOWNLOADERS_COUNT'] : sprintf($this->user->lang['DOWNLOADERS_COUNTS'], $total_downloadlogs), 'DOWNLOADERS_VERSION' => $this->config['downloadlog_version']));
page_header('Downloaders Log', false);
$this->template->set_filenames(array('body' => 'DownloadLog.html'));
page_footer();
}
示例11: memberlist_view_profile
/**
* Display zodiac on viewing user profile
*
* @param object $event The event object
* @return null
* @access public
*/
public function memberlist_view_profile($event)
{
$user_id = $event['member']['user_id'];
$this->user->add_lang_ext('rmcgirr83/topicsbyuser', 'common');
// get all topics started by the user and make sure they are visible
$sql = 'SELECT t.*, p.post_visibility
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . POSTS_TABLE . ' p ON t.topic_first_post_id = p.post_id
WHERE t.topic_poster = ' . $user_id . '
ORDER BY t.topic_time ASC';
$result = $this->db->sql_query($sql);
$count = 0;
$topic_options = '<option value="">' . $this->user->lang['CHOOSE_A_TOPIC'] . '</option>';
while ($row = $this->db->sql_fetchrow($result)) {
if (!$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
if ($row['post_visibility'] != ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
continue;
}
++$count;
$topic_color = $row['post_visibility'] != ITEM_APPROVED ? 'class="error"' : '';
$topic_options .= '<option value="' . append_sid("{$this->root_path}viewtopic.{$this->php_ext}", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']) . '" ' . $topic_color . '> ' . truncate_string($row['topic_title'], 30, 255, false, $this->user->lang['ELLIPSIS']) . '</option>';
}
$this->db->sql_freeresult($result);
if (!empty($count)) {
$this->template->assign_vars(array('HAS_TOPICS' => true, 'S_TOPIC_OPTIONS' => $topic_options));
}
}
示例12: format_time_delta
/**
* Format the delta between two timestamps.
*
* @param \phpbb\user $user
* @param int $start_time Lower time limit. If only $start_time is provided, then its value is used as the delta.
* @param int $end_time Upper time limit.
*
* @return string Returns a translated string containing the appropriate label (up to days) for the time delta. Eg. Less than a minute, 2 Minutes, 1 Hour, 10 Days
*/
public static function format_time_delta(\phpbb\user $user, $start_time, $end_time = 0)
{
if ($end_time) {
$delta = abs($end_time - $start_time);
} else {
$delta = $start_time;
}
if ($delta < 60) {
$delta = '';
$delta_label = 'LESS_THAN_A_MINUTE';
} else {
if ($delta < 3600) {
$delta = floor($delta / 60);
$delta_label = 'MINUTE';
} else {
if ($delta < 86400) {
$delta = floor($delta / 3600);
$delta_label = 'HOUR';
} else {
$delta = floor($delta / 86400);
$delta_label = 'DAY';
}
}
$delta_label .= $delta != 1 ? 'S' : '';
}
return $delta . ' ' . $user->lang($delta_label);
}
示例13: display_list
public function display_list()
{
$this->user->add_lang_ext('phpbb/titania', 'faq', false, true);
/**
* From phpBB faq.php
*/
// Pull the array data from the lang pack
$switch_column = $found_switch = false;
$help_blocks = array();
foreach ($this->user->help as $help_ary) {
if ($help_ary[0] == '--') {
if ($help_ary[1] == '--') {
$switch_column = true;
$found_switch = true;
continue;
}
$this->template->assign_block_vars('faq_block', array('BLOCK_TITLE' => $help_ary[1], 'SWITCH_COLUMN' => $switch_column));
if ($switch_column) {
$switch_column = false;
}
continue;
}
$this->template->assign_block_vars('faq_block.faq_row', array('FAQ_QUESTION' => $help_ary[0], 'FAQ_ANSWER' => $help_ary[1]));
}
// Lets build a page ...
$this->template->assign_vars(array('L_FAQ_TITLE' => $this->user->lang['FAQ_EXPLAIN'], 'L_BACK_TO_TOP' => $this->user->lang['BACK_TO_TOP'], 'SWITCH_COLUMN_MANUALLY' => !$found_switch));
$this->display->assign_global_vars();
return $this->helper->render('faq_body.html', 'FAQ_EXPLAIN');
}
示例14: manage_list
/**
* @param string $list_name whitelist or blacklist
* @param string $u_action phpbb acp-u_action
*/
private function manage_list($u_action, $list_name)
{
$list_name_upper = strtoupper($list_name);
// Define the name of the form for use as a form key
$form_name = 'topictags';
add_form_key($form_name);
$errors = array();
if ($this->request->is_set_post('submit')) {
if (!check_form_key($form_name)) {
trigger_error('FORM_INVALID');
}
$this->config->set(prefixes::CONFIG . '_' . $list_name . '_enabled', $this->request->variable(prefixes::CONFIG . '_' . $list_name . '_enabled', 0));
$list = rawurldecode(base64_decode($this->request->variable(prefixes::CONFIG . '_' . $list_name, '')));
if (!empty($list)) {
$list = json_decode($list, true);
$tags = array();
for ($i = 0, $size = sizeof($list); $i < $size; $i++) {
$tags[] = $list[$i]['text'];
}
$list = json_encode($tags);
}
// store the list
$this->config_text->set(prefixes::CONFIG . '_' . $list_name, $list);
trigger_error($this->user->lang('TOPICTAGS_' . $list_name_upper . '_SAVED') . adm_back_link($u_action));
}
// display
$list = $this->config_text->get(prefixes::CONFIG . '_' . $list_name);
$list = base64_encode(rawurlencode($list));
$this->template->assign_vars(array('TOPICTAGS_VERSION' => $this->user->lang('TOPICTAGS_INSTALLED', $this->config[prefixes::CONFIG . '_version']), 'TOPICTAGS_' . $list_name_upper . '_ENABLED' => $this->config[prefixes::CONFIG . '_' . $list_name . '_enabled'], 'TOPICTAGS_' . $list_name_upper => $list, 'S_RH_TOPICTAGS_INCLUDE_NG_TAGS_INPUT' => true, 'S_RH_TOPICTAGS_INCLUDE_CSS' => true, 'TOPICTAGS_CONVERT_SPACE_TO_MINUS' => $this->config[prefixes::CONFIG . '_convert_space_to_minus'] ? 'true' : 'false', 'S_ERROR' => sizeof($errors) ? true : false, 'ERROR_MSG' => implode('<br />', $errors), 'U_ACTION' => $u_action));
}
示例15: article
/**
* Display an article
*
* @param string $article URL of the article
* @return object
*/
public function article($article)
{
$this->user->add_lang_ext('tas2580/wiki', 'common');
if (!$this->auth->acl_get('u_wiki_view')) {
trigger_error('NOT_AUTHORISED');
}
$this->template->assign_block_vars('navlinks', array('FORUM_NAME' => $this->user->lang['WIKI'], 'U_VIEW_FORUM' => $this->helper->route('tas2580_wiki_index', array())));
$this->template->assign_vars(array('WIKI_FOOTER' => $this->user->lang('WIKI_FOOTER', base64_decode('aHR0cHM6Ly90YXMyNTgwLm5ldA=='), base64_decode('dGFzMjU4MA=='))));
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
include $this->phpbb_root_path . 'includes/functions_posting.' . $this->php_ext;
$action = $this->request->variable('action', '');
$id = $this->request->variable('id', 0);
switch ($action) {
case 'edit':
return $this->edit->edit_article($article);
case 'versions':
return $this->compare->view_versions($article);
case 'compare':
$from = $this->request->variable('from', 0);
$to = $this->request->variable('to', 0);
return $this->compare->compare_versions($article, $from, $to);
case 'delete':
return $this->delete->version($id);
case 'detele_article':
return $this->delete->article($article);
case 'active':
return $this->edit->active($id);
case 'deactivate':
return $this->edit->deactivate($article);
default:
return $this->view->view_article($article, $id);
}
}