本文整理汇总了PHP中phpbb_get_user_avatar函数的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_get_user_avatar函数的具体用法?PHP phpbb_get_user_avatar怎么用?PHP phpbb_get_user_avatar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phpbb_get_user_avatar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_avatar
/**
* Return the user avatar for WordPress from phpBB
*/
static function get_avatar($ua = "", $tp = null)
{
global $config, $user, $phpbb_container;
$forum_url = get_option('wppphpbbu_url');
$ret = phpbb_get_user_avatar($user->data);
return $ret;
}
示例2: display
/**
* {@inheritdoc}
*/
public function display(array $bdata, $edit_mode = false)
{
$content = '';
if ($this->user->data['is_registered']) {
$this->ptemplate->assign_vars(array('USER_AVATAR' => phpbb_get_user_avatar($this->user->data), 'USERNAME' => get_username_string('no_profile', $this->user->data['user_id'], $this->user->data['username'], $this->user->data['user_colour']), 'USERNAME_FULL' => get_username_string('full', $this->user->data['user_id'], $this->user->data['username'], $this->user->data['user_colour']), 'U_PROFILE' => append_sid($this->phpbb_root_path . 'memberlist.' . $this->php_ext, 'mode=viewprofile&u=' . $this->user->data['user_id']), 'U_SEARCH_NEW' => append_sid($this->phpbb_root_path . 'search.' . $this->php_ext, 'search_id=newposts'), 'U_SEARCH_SELF' => append_sid($this->phpbb_root_path . 'search.' . $this->php_ext, 'search_id=egosearch'), 'U_PRIVATE_MSG' => append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext, 'i=pm&folder=inbox'), 'U_LOGOUT' => append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext, 'mode=logout', true, $this->user->session_id), 'U_MCP' => $this->auth->acl_get('m_') ? append_sid($this->phpbb_root_path . 'mcp.' . $this->php_ext, false, true, $this->user->session_id) : '', 'U_ACP' => $this->auth->acl_get('a_') ? append_sid($this->phpbb_root_path . 'adm/index.' . $this->php_ext, 'i=-blitze-sitemaker-acp-menu_module', true, $this->user->session_id) : ''));
$content = $this->ptemplate->render_view('blitze/sitemaker', 'blocks/member_menu.html', 'member_menu_block');
}
return array('title' => 'WELCOME', 'content' => $content);
}
示例3: info
public function info($user_id)
{
if (!$this->auth->acl_gets('u_viewprofile')) {
trigger_error('NOT_AUTHORISED');
}
$sql_ary = array('SELECT' => 'u.username, u.user_colour, u.user_regdate, u.user_posts, u.user_lastvisit, u.user_rank, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'u.user_id = ' . (int) $user_id);
/**
* Modify SQL query in tas2580 AJAX userinfo extension
*
* @event tas2580.userinfo_modify_sql
* @var string sql_ary The SQL query
* @var int user_id The ID of the user
* @since 0.2.3
*/
$vars = array('sql_ary', 'user_id');
extract($this->phpbb_dispatcher->trigger_event('tas2580.userinfo_modify_sql', compact($vars)));
$result = $this->db->sql_query_limit($this->db->sql_build_query('SELECT', $sql_ary), 1);
$this->data = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (!function_exists('phpbb_get_user_rank')) {
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
}
$user_rank_data = phpbb_get_user_rank($this->data, $this->data['user_posts']);
// Get the avatar
// Wen need to use the full URL here because we don't know the path where userinfo is called
define('PHPBB_USE_BOARD_URL_PATH', true);
$avatar = phpbb_get_user_avatar($this->data);
$avatar = empty($avatar) ? '<img src="' . generate_board_url() . '/styles/' . $this->user->style['style_name'] . '/theme/images/no_avatar.gif" width="100" height="100" alt="' . $this->user->lang('USER_AVATAR') . '">' : $avatar;
$memberdays = max(1, round((time() - $this->data['user_regdate']) / 86400));
$posts_per_day = $this->data['user_posts'] / $memberdays;
$percentage = $this->config['num_posts'] ? min(100, $this->data['user_posts'] / $this->config['num_posts'] * 100) : 0;
$result = array('userinfo_header' => sprintf($this->user->lang['VIEWING_PROFILE'], $this->data['username']), 'username' => get_username_string('no_profile', $user_id, $this->data['username'], $this->data['user_colour']), 'regdate' => $this->user->format_date($this->data['user_regdate']), 'posts' => $this->data['user_posts'], 'lastvisit' => $this->user->format_date($this->data['user_lastvisit']), 'avatar' => $avatar, 'rank' => empty($user_rank_data['title']) ? $this->user->lang('NA') : $user_rank_data['title'], 'postsperday' => $this->user->lang('POST_DAY', $posts_per_day), 'percentage' => $this->user->lang('POST_PCT', $percentage));
/**
* Modify return data in tas2580 AJAX userinfo extension
*
* @event tas2580.userinfo_modify_result
* @var array result The result array
* @var int user_id The ID of the user
* @since 0.2.3
*/
$vars = array('result', 'user_id');
extract($this->phpbb_dispatcher->trigger_event('tas2580.userinfo_modify_result', compact($vars)));
return new JsonResponse($result);
}
示例4: get_userlist
/**
* Get a list of all users on the board that can be mentioned. Keys are the usernames utf8_cleaned.
* Data is cached after the first call.
*
* @param string|bool $query_string False, if all users should be retrieved. Otherwise a string wich should be searched for.
* @return array Array containing data of all users
*/
public function get_userlist($query_string = false)
{
// If we need the complete list and it is cached, we can return it.
if ($query_string == false && self::$user_list) {
return self::$user_list;
}
$cache_time = 300;
$sql_ary = array('SELECT' => '*', 'FROM' => array(USERS_TABLE => 'u'), 'WHERE' => 'user_posts >= ' . $this->config['wolfsblvt.mentions.min_posts_suggest'] . '
AND user_type <> ' . USER_IGNORE, 'ORDER_BY' => 'username');
if ($query_string) {
$escaped_query_string_clean = $this->db->sql_escape(utf8_clean_string($query_string));
$query_string['WHERE'] .= ' username_clean ' . $this->db->sql_like_expression($escaped_query_string_clean . $this->db->get_any_char());
}
$sql = $this->db->sql_build_query('SELECT', $sql_ary);
$result = $this->db->sql_query($sql, $cache_time);
$user_list = array();
while ($row = $this->db->sql_fetchrow($result)) {
$user_data = array('name' => $row['username'], 'user_id' => $row['user_id'], 'posts' => $row['user_posts'], 'colour' => $row['user_colour'], 'avatar' => phpbb_get_user_avatar($row), 'username_full' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), 'username_no_profile' => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']));
if ($user_data['avatar'] == '') {
$default_avatar_url = $this->path_helper->get_web_root_path() . $this->ext_root_path . '/styles/' . $this->user->style['style_path'] . '/theme' . '/images/no_avatar.gif';
// Check if file exists, otherwise take from "/all" folder. The administrator hasn't chosen a specific no_avatar avatar for this style then
if (!file_exists($default_avatar_url)) {
$default_avatar_url = $this->path_helper->get_web_root_path() . $this->ext_root_path . '/styles/all/theme' . '/images/no_avatar.gif';
}
$user_data['avatar'] = '<img src="' . $default_avatar_url . '" width="100" height="100" alt="' . $this->user->lang['USER_AVATAR'] . '">';
}
$user_list[$row['username_clean']] = $user_data;
}
$this->db->sql_freeresult($result);
// If we have the complete list, we can cache it.
if ($query_string == false) {
self::$user_list = $user_list;
}
return $user_list;
}
示例5: array
*/
$vars = array('user_cache_data', 'poster_id', 'row');
extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_guest_data', compact($vars)));
$user_cache[$poster_id] = $user_cache_data;
$user_rank_data = phpbb_get_user_rank($row, false);
$user_cache[$poster_id]['rank_title'] = $user_rank_data['title'];
$user_cache[$poster_id]['rank_image'] = $user_rank_data['img'];
$user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src'];
} else {
$user_sig = '';
// We add the signature to every posters entry because enable_sig is post dependent
if ($row['user_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) {
$user_sig = $row['user_sig'];
}
$id_cache[] = $poster_id;
$user_cache_data = array('user_type' => $row['user_type'], 'user_inactive_reason' => $row['user_inactive_reason'], 'joined' => $user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => isset($row['user_warnings']) ? $row['user_warnings'] : 0, 'sig' => $user_sig, 'sig_bbcode_uid' => !empty($row['user_sig_bbcode_uid']) ? $row['user_sig_bbcode_uid'] : '', 'sig_bbcode_bitfield' => !empty($row['user_sig_bbcode_bitfield']) ? $row['user_sig_bbcode_bitfield'] : '', 'viewonline' => $row['user_allow_viewonline'], 'allow_pm' => $row['user_allow_pm'], 'avatar' => $user->optionget('viewavatars') ? phpbb_get_user_avatar($row) : '', 'age' => '', 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', 'username' => $row['username'], 'user_colour' => $row['user_colour'], 'contact_user' => $user->lang('CONTACT_USER', get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['username'])), 'online' => false, 'jabber' => $config['jab_enable'] && $row['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=jabber&u={$poster_id}") : '', 'search' => $config['load_search'] && $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", "author_id={$poster_id}&sr=posts") : '', 'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']), 'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']), 'author_username' => get_username_string('username', $poster_id, $row['username'], $row['user_colour']), 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']));
/**
* Modify the users' data displayed with their posts
*
* @event core.viewtopic_cache_user_data
* @var array user_cache_data Array with the user's data
* @var int poster_id Poster's user id
* @var array row Array with original user and post data
* @since 3.1.0-a1
*/
$vars = array('user_cache_data', 'poster_id', 'row');
extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_user_data', compact($vars)));
$user_cache[$poster_id] = $user_cache_data;
$user_rank_data = phpbb_get_user_rank($row, $row['user_posts']);
$user_cache[$poster_id]['rank_title'] = $user_rank_data['title'];
$user_cache[$poster_id]['rank_image'] = $user_rank_data['img'];
示例6: advanced_profile_system
public function advanced_profile_system($event)
{
$member = $event['member'];
$user_id = (int) $member['user_id'];
// Get user_id of user we are viewing
$username = $member['username'];
$user_extra_rank_data = array('title' => null, 'img' => null, 'img_src' => null);
$ranks_sql = 'SELECT *
FROM ' . RANKS_TABLE . '
WHERE rank_special != 1';
$normal_ranks = $this->db->sql_query($ranks_sql);
$spec_sql = 'SELECT rank_special
FROM ' . RANKS_TABLE . '
WHERE rank_id = ' . $member['user_rank'];
$special = $this->db->sql_query($spec_sql);
if ($special !== 1) {
if ($member['user_posts'] !== false) {
if (!empty($normal_ranks)) {
foreach ($normal_ranks as $rank) {
if ($member['user_posts'] >= $rank['rank_min']) {
$user_extra_rank_data['title'] = $rank['rank_title'];
$user_extra_rank_data['img_src'] = !empty($rank['rank_image']) ? $this->phpbb_root_path . $this->config['ranks_path'] . '/' . $rank['rank_image'] : '';
$user_extra_rank_data['img'] = !empty($rank['rank_image']) ? '<img src="' . $user_extra_rank_data['img_src'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : '';
break;
}
}
}
}
}
$this->template->assign_vars(array('EXTRA_RANK_TITLE' => $user_extra_rank_data['title'], 'EXTRA_RANK_IMG' => $user_extra_rank_data['img']));
/****************
* PROFILE VIEWS *
****************/
// Make sure we have a session Make sure user is not a bot. Do not increase view count if viewing own profile.
if (isset($this->user->data['session_page']) && !$this->user->data['is_bot'] && $this->user->data['user_id'] != $user_id) {
$incr_profile_views = 'UPDATE ' . USERS_TABLE . '
SET user_profile_views = user_profile_views + 1
WHERE user_id = ' . $user_id;
$this->db->sql_query($incr_profile_views);
}
/****************
* ACTIVITY FEED *
****************/
$activity_feed_ary = array('SELECT' => 'p.*, t.*, u.username, u.user_colour', 'FROM' => array(POSTS_TABLE => 'p'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = p.poster_id'), array('FROM' => array(TOPICS_TABLE => 't'), 'ON' => 'p.topic_id = t.topic_id')), 'WHERE' => $this->db->sql_in_set('t.forum_id', array_keys($this->auth->acl_getf('f_read', true))) . '
AND t.topic_status <> ' . ITEM_MOVED . '
AND t.topic_visibility = 1
AND p.poster_id = ' . $user_id, 'ORDER_BY' => 'p.post_time DESC');
$activity_feed = $this->db->sql_build_query('SELECT', $activity_feed_ary);
$activity_feed_result = $this->db->sql_query_limit($activity_feed, 5);
// Only get last five posts
while ($af_row = $this->db->sql_fetchrow($activity_feed_result)) {
$topic_id = $af_row['topic_id'];
$post_id = $af_row['post_id'];
$post_date = $this->user->format_date($af_row['post_time']);
$post_url = append_sid("{$this->phpbb_root_path}viewtopic.{$this->phpEx}", 't=' . $topic_id . '&p=' . $post_id) . '#p' . $post_id;
// Parse the posts
$af_row['bbcode_options'] = ($af_row['enable_bbcode'] ? OPTION_FLAG_BBCODE : 0) + ($af_row['enable_smilies'] ? OPTION_FLAG_SMILIES : 0) + ($af_row['enable_magic_url'] ? OPTION_FLAG_LINKS : 0);
$text = generate_text_for_display($af_row['post_text'], $af_row['bbcode_uid'], $af_row['bbcode_bitfield'], $af_row['bbcode_options']);
// Set a max length for the post to display
$cutoff = ' …';
$text = strlen($text) > 200 ? mb_substr($text, 0, 200) . $cutoff : $text;
// See if user is able to view posts..
$this->template->assign_block_vars('af', array('SUBJECT' => $af_row['post_subject'], 'TEXT' => $text, 'TIME' => $post_date, 'URL' => $post_url));
}
$this->db->sql_freeresult($activity_feed_result);
// Master gave Dobby a sock, now Dobby is free!
/***************
* TOTAL TOPICS *
***************/
$tt = 'SELECT COUNT(topic_poster) AS topic_author_count
FROM ' . TOPICS_TABLE . '
WHERE topic_poster = ' . $user_id;
$total_topics_result = $this->db->sql_query($tt);
$total_topics = (int) $this->db->sql_fetchfield('topic_author_count');
$this->db->sql_freeresult($total_topics_result);
// Master gave Dobby a sock, now Dobby is free!
/***************
* FRIENDS LIST *
***************/
$sql_friend = array('SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline', 'FROM' => array(USERS_TABLE => 'u', ZEBRA_TABLE => 'z'), 'LEFT_JOIN' => array(array('FROM' => array(SESSIONS_TABLE => 's'), 'ON' => 's.session_user_id = z.zebra_id')), 'WHERE' => 'z.user_id = ' . $user_id . '
AND z.friend = 1
AND u.user_id = z.zebra_id', 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username', 'ORDER_BY' => 'u.username_clean ASC');
$sql_friend_list = $this->db->sql_build_query('SELECT_DISTINCT', $sql_friend);
$friend_result = $this->db->sql_query($sql_friend_list);
while ($friend_row = $this->db->sql_fetchrow($friend_result)) {
$img = phpbb_get_user_avatar($friend_row);
// Use phpBB's Built in Avatar creator, for all types
$has_avatar = false;
if ($img == '') {
$has_avatar = false;
// This friend has no avatar..
} else {
$has_avatar = true;
// This friend has an avatar
$offset = 25;
//Start off the img src
$end = strpos($img, '"', $offset);
// Find end of img src
$length = $end - $offset;
// Determine src length
//.........这里部分代码省略.........
示例7: mcp_warn_user_view
/**
* Handles warning the user
*/
function mcp_warn_user_view($action)
{
global $phpEx, $phpbb_root_path, $config, $request;
global $template, $db, $user, $phpbb_dispatcher;
$user_id = $request->variable('u', 0);
$username = $request->variable('username', '', true);
$notify = isset($_REQUEST['notify_user']) ? true : false;
$warning = $request->variable('warning', '', true);
$sql_where = $user_id ? "user_id = {$user_id}" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE ' . $sql_where;
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if (!$user_row) {
trigger_error('NO_USER');
}
// Prevent someone from warning themselves
if ($user_row['user_id'] == $user->data['user_id']) {
trigger_error('CANNOT_WARN_SELF');
}
$user_id = $user_row['user_id'];
if (strpos($this->u_action, "&u={$user_id}") === false) {
$this->p_master->adjust_url('&u=' . $user_id);
$this->u_action .= "&u={$user_id}";
}
// Check if can send a notification
if ($config['allow_privmsg']) {
$auth2 = new \phpbb\auth\auth();
$auth2->acl($user_row);
$s_can_notify = $auth2->acl_get('u_readpm') ? true : false;
unset($auth2);
} else {
$s_can_notify = false;
}
// Prevent against clever people
if ($notify && !$s_can_notify) {
$notify = false;
}
if ($warning && $action == 'add_warning') {
if (check_form_key('mcp_warn')) {
$s_mcp_warn_user = true;
/**
* Event for before warning a user from MCP.
*
* @event core.mcp_warn_user_before
* @var array user_row The entire user row
* @var string warning The warning message
* @var bool notify If true, we notify the user for the warning
* @var bool s_mcp_warn_user If true, we add the warning else we omit it
* @since 3.1.0-b4
*/
$vars = array('user_row', 'warning', 'notify', 's_mcp_warn_user');
extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_before', compact($vars)));
if ($s_mcp_warn_user) {
add_warning($user_row, $warning, $notify);
$message = $user->lang['USER_WARNING_ADDED'];
/**
* Event for after warning a user from MCP.
*
* @event core.mcp_warn_user_after
* @var array user_row The entire user row
* @var string warning The warning message
* @var bool notify If true, the user was notified for the warning
* @var string message Message displayed to the moderator
* @since 3.1.0-b4
*/
$vars = array('user_row', 'warning', 'notify', 'message');
extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_after', compact($vars)));
}
} else {
$message = $user->lang['FORM_INVALID'];
}
if (!empty($message)) {
$redirect = append_sid("{$phpbb_root_path}mcp.{$phpEx}", "i=notes&mode=user_notes&u={$user_id}");
meta_refresh(2, $redirect);
trigger_error($message . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a>'));
}
}
// Generate the appropriate user information for the user we are looking at
if (!function_exists('phpbb_get_user_rank')) {
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
}
$user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']);
$avatar_img = phpbb_get_user_avatar($user_row);
// OK, they didn't submit a warning so lets build the page for them to do so
$template->assign_vars(array('U_POST_ACTION' => $this->u_action, 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => $user_row['user_posts'] ? $user_row['user_posts'] : 0, 'WARNINGS' => $user_row['user_warnings'] ? $user_row['user_warnings'] : 0, 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'AVATAR_IMG' => $avatar_img, 'RANK_IMG' => $user_rank_data['img'], 'S_CAN_NOTIFY' => $s_can_notify));
return $user_id;
}
示例8: main
//.........这里部分代码省略.........
case 'avatar':
add_form_key('ucp_avatar');
$avatars_enabled = false;
if ($config['allow_avatar'] && $auth->acl_get('u_chgavatar')) {
/* @var $phpbb_avatar_manager \phpbb\avatar\manager */
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
// This is normalised data, without the user_ prefix
$avatar_data = \phpbb\avatar\manager::clean_row($user->data, 'user');
if ($submit) {
if (check_form_key('ucp_avatar')) {
$driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', ''));
if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) {
$driver = $phpbb_avatar_manager->get_driver($driver_name);
$result = $driver->process_form($request, $template, $user, $avatar_data, $error);
if ($result && empty($error)) {
// Success! Lets save the result in the database
$result = array('user_avatar_type' => $driver_name, 'user_avatar' => $result['avatar'], 'user_avatar_width' => $result['avatar_width'], 'user_avatar_height' => $result['avatar_height']);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $result) . '
WHERE user_id = ' . (int) $user->data['user_id'];
$db->sql_query($sql);
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
}
} else {
$error[] = 'FORM_INVALID';
}
}
// Handle deletion of avatars
if ($request->is_set_post('avatar_delete')) {
if (!confirm_box(true)) {
confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array('avatar_delete' => true, 'i' => $id, 'mode' => $mode)));
} else {
$phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_');
meta_refresh(3, $this->u_action);
$message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
}
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user->data['user_avatar_type']));
foreach ($avatar_drivers as $current_driver) {
$driver = $phpbb_avatar_manager->get_driver($current_driver);
$avatars_enabled = true;
$template->set_filenames(array('avatar' => $driver->get_template_name()));
if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) {
$driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver);
$driver_upper = strtoupper($driver_name);
$template->assign_block_vars('avatar_drivers', array('L_TITLE' => $user->lang($driver_upper . '_TITLE'), 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), 'DRIVER' => $driver_name, 'SELECTED' => $current_driver == $selected_driver, 'OUTPUT' => $template->assign_display('avatar')));
}
}
// Replace "error" strings with their real, localised form
$error = $phpbb_avatar_manager->localize_errors($user, $error);
}
$avatar = phpbb_get_user_avatar($user->data, 'USER_AVATAR', true);
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'AVATAR' => $avatar, 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), 'S_AVATARS_ENABLED' => $config['allow_avatar'] && $avatars_enabled));
break;
case 'autologin_keys':
add_form_key('ucp_autologin_keys');
if ($submit) {
$keys = $request->variable('keys', array(''));
if (!check_form_key('ucp_autologin_keys')) {
$error[] = 'FORM_INVALID';
}
if (!sizeof($error)) {
if (!empty($keys)) {
foreach ($keys as $key => $id) {
$keys[$key] = $db->sql_like_expression($id . $db->get_any_char());
}
$sql_where = '(key_id ' . implode(' OR key_id ', $keys) . ')';
$sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . '
WHERE user_id = ' . (int) $user->data['user_id'] . '
AND ' . $sql_where;
$db->sql_query($sql);
meta_refresh(3, $this->u_action);
$message = $user->lang['AUTOLOGIN_SESSION_KEYS_DELETED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);
}
}
// Replace "error" strings with their real, localised form
$error = array_map(array($user, 'lang'), $error);
}
$sql = 'SELECT key_id, last_ip, last_login
FROM ' . SESSIONS_KEYS_TABLE . '
WHERE user_id = ' . (int) $user->data['user_id'] . '
ORDER BY last_login ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$template->assign_block_vars('sessions', array('KEY' => substr($row['key_id'], 0, 8), 'IP' => $row['last_ip'], 'LOGIN_TIME' => $user->format_date($row['last_login'])));
}
$db->sql_freeresult($result);
break;
}
$template->assign_vars(array('ERROR' => sizeof($error) ? implode('<br />', $error) : '', 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], 'S_HIDDEN_FIELDS' => $s_hidden_fields, 'S_UCP_ACTION' => $this->u_action));
// Set desired template
$this->tpl_name = 'ucp_profile_' . $mode;
$this->page_title = 'UCP_PROFILE_' . strtoupper($mode);
}
示例9: phpbb_show_profile
/**
* Prepare profile data
*/
function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false, $check_can_receive_pm = true)
{
global $config, $auth, $user, $phpEx, $phpbb_root_path, $phpbb_dispatcher;
$username = $data['username'];
$user_id = $data['user_id'];
$user_rank_data = phpbb_get_user_rank($data, $user_id == ANONYMOUS ? false : $data['user_posts']);
if (!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail') || $auth->acl_get('a_user')) {
$email = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=email&u=' . $user_id) : ($config['board_hide_emails'] && !$auth->acl_get('a_user') ? '' : 'mailto:' . $data['user_email']);
} else {
$email = '';
}
if ($config['load_onlinetrack']) {
$update_time = $config['load_online_time'] * 60;
$online = time() - $update_time < $data['session_time'] && (isset($data['session_viewonline']) && $data['session_viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
} else {
$online = false;
}
if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) {
$last_active = !empty($data['session_time']) ? $data['session_time'] : $data['user_lastvisit'];
} else {
$last_active = '';
}
$age = '';
if ($config['allow_birthdays'] && $data['user_birthday']) {
list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday']));
if ($bday_year) {
$now = $user->create_datetime();
$now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset());
$diff = $now['mon'] - $bday_month;
if ($diff == 0) {
$diff = $now['mday'] - $bday_day < 0 ? 1 : 0;
} else {
$diff = $diff < 0 ? 1 : 0;
}
$age = max(0, (int) ($now['year'] - $bday_year - $diff));
}
}
if (!function_exists('phpbb_get_banned_user_ids')) {
include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
}
// Can this user receive a Private Message?
$can_receive_pm = $check_can_receive_pm && ($data['user_type'] != USER_IGNORE && ($data['user_type'] != USER_INACTIVE || $data['user_inactive_reason'] != INACTIVE_MANUAL) && sizeof($auth->acl_get_list($user_id, 'u_readpm')) && !sizeof(phpbb_get_banned_user_ids($user_id, false)) && ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_') || $data['user_allow_pm']));
// Dump it out to the template
$template_data = array('AGE' => $age, 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($data['user_regdate']), 'LAST_ACTIVE' => empty($last_active) ? ' - ' : $user->format_date($last_active), 'POSTS' => $data['user_posts'] ? $data['user_posts'] : 0, 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']), 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']), 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']), 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), 'AVATAR_IMG' => phpbb_get_user_avatar($data), 'ONLINE_IMG' => !$config['load_onlinetrack'] ? '' : ($online ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => $config['load_onlinetrack'] && $online ? true : false, 'RANK_IMG' => $user_rank_data['img'], 'RANK_IMG_SRC' => $user_rank_data['img_src'], 'S_JABBER_ENABLED' => $config['jab_enable'] ? true : false, 'S_WARNINGS' => $auth->acl_getf_global('m_') || $auth->acl_get('m_warn') ? true : false, 'U_SEARCH_USER' => $auth->acl_get('u_search') ? append_sid("{$phpbb_root_path}search.{$phpEx}", "author_id={$user_id}&sr=posts") : '', 'U_NOTES' => $user_notes_enabled && $auth->acl_getf_global('m_') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', 'U_WARN' => $warn_user_enabled && $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', 'U_PM' => $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_JABBER' => $data['user_jabber'] && $auth->acl_get('u_sendim') ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=contact&action=jabber&u=' . $user_id) : '', 'USER_JABBER' => $config['jab_enable'] ? $data['user_jabber'] : '', 'USER_JABBER_IMG' => $config['jab_enable'] && $data['user_jabber'] ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', 'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $username), 'L_CONTACT_USER' => $user->lang('CONTACT_USER', $username), 'L_VIEWING_PROFILE' => $user->lang('VIEWING_PROFILE', $username));
/**
* Preparing a user's data before displaying it in profile and memberlist
*
* @event core.memberlist_prepare_profile_data
* @var array data Array with user's data
* @var array template_data Template array with user's data
* @since 3.1.0-a1
*/
$vars = array('data', 'template_data');
extract($phpbb_dispatcher->trigger_event('core.memberlist_prepare_profile_data', compact($vars)));
return $template_data;
}
示例10: get_user_avatar_helper
/**
* Get user avatar helper function
*
* @param array $row User row data
* @param string $poster Type of poster, fp or lp
* @return string Avatar image
* @access protected
*/
protected function get_user_avatar_helper($row, $poster)
{
if (!$this->avatars_enabled()) {
return '';
}
// If user has no avatar, lets use a fallback
if (empty($row[$poster . '_avatar'])) {
$row[$poster . '_avatar'] = $this->root_path . 'styles/' . rawurlencode($this->user->style['style_path']) . '/theme/images/no_avatar.gif';
$row[$poster . '_avatar_type'] = 'avatar.driver.remote';
$row[$poster . '_avatar_width'] = self::AVATAR_SIZE;
$row[$poster . '_avatar_height'] = self::AVATAR_SIZE;
}
// map arguments to new function phpbb_get_avatar()
$map = array('avatar' => $row[$poster . '_avatar'], 'avatar_type' => $row[$poster . '_avatar_type'], 'avatar_width' => $row[$poster . '_avatar_width'], 'avatar_height' => $row[$poster . '_avatar_height']);
return phpbb_get_user_avatar($map);
}
示例11: foreach
/**
* @ignore
*/
if (!defined('IN_PHPBB')) {
exit;
}
global $k_config, $k_blocks, $user, $phpEx;
$this->template = $template;
foreach ($k_blocks as $blk) {
if ($blk['html_file_name'] == 'block_top_posters.html') {
$block_cache_time = $blk['block_cache_time'];
break;
}
}
$block_cache_time = isset($block_cache_time) ? $block_cache_time : $k_config['k_block_cache_time_default'];
include_once $phpbb_root_path . 'ext/phpbbireland/portal/includes/sgp_functions.' . $phpEx;
$k_top_posters_to_display = !empty($k_config['k_top_posters_to_display']) ? $k_config['k_top_posters_to_display'] : '5';
$sql = 'SELECT user_id, username, user_posts, user_colour, user_type, group_id, user_avatar, user_avatar_type, user_avatar_width , user_avatar_height
FROM ' . USERS_TABLE . '
WHERE user_posts <> 0
AND user_type <> ' . USER_IGNORE . '
AND user_type <> ' . USER_INACTIVE . '
ORDER BY user_posts DESC';
$result = $db->sql_query_limit($sql, $k_top_posters_to_display, 0, $block_cache_time);
while ($row = $db->sql_fetchrow($result)) {
if (!$row['username']) {
continue;
}
$this->template->assign_block_vars('top_posters', array('S_SEARCH_ACTION' => append_sid("{$this->phpbb_root_path}search.{$phpEx}", 'author_id=' . $row['user_id'] . '&sr=posts'), 'USERNAME_FULL' => @get_username_string('full', $row['user_id'], sgp_checksize($row['username'], 15), $row['user_colour']), 'POSTER_POSTS' => $row['user_posts'], 'USER_AVATAR_IMG' => phpbb_get_user_avatar($row, $user->lang['USER_AVATAR'], false)));
}
$db->sql_freeresult($result);
示例12: foreach
*
*/
if (!defined('IN_PHPBB')) {
exit;
}
global $k_config, $k_blocks, $template, $user;
$this->template = $template;
$this->user = $user;
$total_queries = $queries = $cached_queries = 0;
$rank_title = $rank_img = $rank_img_src = '';
if (!function_exists('get_user_rank')) {
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
}
foreach ($k_blocks as $blk) {
if ($blk['html_file_name'] == 'block_user_information.html') {
$block_cache_time = $blk['block_cache_time'];
break;
}
}
$block_cache_time = isset($block_cache_time) ? $block_cache_time : $k_config['k_block_cache_time_default'];
get_user_rank($this->user->data['user_rank'], $this->user->data['user_id'] == ANONYMOUS ? false : $this->user->data['user_posts'], $rank_title, $rank_img, $rank_img_src);
// Generate logged in/logged out status
if ($this->user->data['user_id'] != ANONYMOUS) {
$u_login_logout = append_sid("{$this->phpbb_root_path}ucp.{$phpEx}", 'mode=logout', true, $this->user->session_id);
$l_login_logout = sprintf($this->user->lang['LOGOUT_USER'], $this->user->data['username']);
} else {
$u_login_logout = append_sid("{$this->phpbb_root_path}ucp.{$phpEx}", 'mode=login');
$l_login_logout = $this->user->lang['LOGIN'];
}
$this->template->assign_vars(array('AVATAR' => phpbb_get_user_avatar($this->user->data, $user->lang['USER_AVATAR'], false), 'WELCOME_SITE' => sprintf($this->user->lang['WELCOME_SITE'], $this->config['sitename']), 'USR_RANK_TITLE' => $rank_title, 'USR_RANK_IMG' => $rank_img, 'U_LOGIN_LOGOUT' => $u_login_logout, 'L_LOGIN_LOGOUT' => $l_login_logout, 'S_LOGIN_ACTION' => append_sid("{$this->phpbb_root_path}ucp.{$phpEx}", 'mode=login')));
示例13: userdetails
/**
* User details controller
*
* @param int $uid User ID taken from the URL
* @param string $sort_key Sort key: id|username|time|point|action (default: id)
* @param string $sort_dir Sort direction: dsc|asc (descending|ascending) (default: dsc)
* @return Symfony\Component\HttpFoundation\Response A Symfony Response object
* @access public
*/
public function userdetails($uid, $sort_key, $sort_dir)
{
$this->user->add_lang_ext('pico/reputation', array('reputation_system', 'reputation_rating'));
$is_ajax = $this->request->is_ajax();
$referer = $this->symfony_request->get('_referer');
if (empty($this->config['rs_enable'])) {
if ($is_ajax) {
$json_response = new \phpbb\json_response();
$json_data = array('error_msg' => $this->user->lang('RS_DISABLED'));
$json_response->send($json_data);
}
redirect(append_sid("{$this->root_path}index.{$this->php_ext}"));
}
$sql = 'SELECT user_id, username, user_colour
FROM ' . USERS_TABLE . '
WHERE user_type <> 2
AND user_id =' . (int) $uid;
$result = $this->db->sql_query($sql);
$user_row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
if (empty($user_row)) {
$message = $this->user->lang('RS_NO_USER_ID');
$json_data = array('error_msg' => $message);
$redirect = append_sid("{$this->root_path}index.{$this->php_ext}");
$redirect_text = 'RETURN_INDEX';
$this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
}
if (!$this->auth->acl_get('u_rs_view')) {
$message = $this->user->lang('RS_VIEW_DISALLOWED');
$json_data = array('error_msg' => $message);
$redirect = append_sid("memberlist.{$this->php_ext}", 'mode=viewprofile&u=' . $uid);
$redirect_text = 'RETURN_PAGE';
$this->reputation_manager->response($message, $json_data, $redirect, $redirect_text, $is_ajax);
}
$sort_key_sql = array('username' => 'u.username_clean', 'time' => 'r.reputation_time', 'point' => 'r.reputation_points', 'action' => 'rt.reputation_type_name', 'id' => 'r.reputation_id');
// Sql order depends on sort key
$order_by = $sort_key_sql[$sort_key] . ' ' . ($sort_dir == 'dsc' ? 'DESC' : 'ASC');
$reputation_type_id = (int) $this->reputation_manager->get_reputation_type_id('post');
$sql_array = array('SELECT' => 'r.*, rt.reputation_type_name, u.username, u.user_colour, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height, p.post_id, p.forum_id, p.post_subject', 'FROM' => array($this->reputations_table => 'r', $this->reputation_types_table => 'rt'), 'LEFT_JOIN' => array(array('FROM' => array(USERS_TABLE => 'u'), 'ON' => 'u.user_id = r.user_id_from'), array('FROM' => array(POSTS_TABLE => 'p'), 'ON' => 'p.post_id = r.reputation_item_id
AND r.reputation_type_id = ' . $reputation_type_id)), 'WHERE' => 'r.user_id_to = ' . $uid . '
AND r.reputation_type_id = rt.reputation_type_id', 'ORDER_BY' => $order_by);
$sql = $this->db->sql_build_query('SELECT', $sql_array);
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
$this->template->assign_block_vars('reputation', array('ID' => $row['reputation_id'], 'USERNAME' => get_username_string('full', $row['user_id_from'], $row['username'], $row['user_colour']), 'ACTION' => $this->user->lang('RS_' . strtoupper($row['reputation_type_name']) . '_RATING'), 'AVATAR' => phpbb_get_user_avatar($row), 'TIME' => $this->user->format_date($row['reputation_time']), 'COMMENT' => $row['reputation_comment'], 'POINTS' => $row['reputation_points'], 'POINTS_CLASS' => $this->reputation_helper->reputation_class($row['reputation_points']), 'POINTS_TITLE' => $this->user->lang('RS_POINTS_TITLE', $row['reputation_points']), 'U_DELETE' => $this->helper->route('reputation_delete_controller', array('rid' => $row['reputation_id'])), 'S_COMMENT' => !empty($row['reputation_comment']), 'S_DELETE' => $this->auth->acl_get('m_rs_moderate') || $row['user_id_from'] == $this->user->data['user_id'] && $this->auth->acl_get('u_rs_delete') ? true : false));
// Generate post url
$this->reputation_manager->generate_post_link($row);
}
$this->db->sql_freeresult($result);
$this->template->assign_vars(array('USER_ID' => $uid, 'U_USER_DETAILS' => $this->helper->route('reputation_details_controller', array('uid' => $uid)), 'U_SORT_USERNAME' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'username', 'sort_dir' => $sort_key == 'username' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_TIME' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'time', 'sort_dir' => $sort_key == 'time' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_POINT' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'point', 'sort_dir' => $sort_key == 'point' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_SORT_ACTION' => $this->helper->route('reputation_user_details_controller', array('uid' => $uid, 'sort_key' => 'action', 'sort_dir' => $sort_key == 'action' && $sort_dir == 'asc' ? 'dsc' : 'asc')), 'U_CLEAR' => $this->helper->route('reputation_clear_user_controller', array('uid' => $uid)), 'U_REPUTATION_REFERER' => $referer, 'L_RS_USER_REPUTATION' => $this->user->lang('RS_USER_REPUTATION', get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour'])), 'S_RS_AVATAR' => $this->config['rs_display_avatar'] ? true : false, 'S_RS_COMMENT' => $this->config['rs_enable_comment'] ? true : false, 'S_RS_POINTS_IMG' => $this->config['rs_point_type'] ? true : false, 'S_CLEAR' => $this->auth->acl_gets('m_rs_moderate') ? true : false, 'S_IS_AJAX' => $is_ajax ? true : false));
return $this->helper->render('userdetails.html');
}
示例14: _get_template_data
/**
* @param array $row
* @return array
*/
private function _get_template_data(array $row)
{
$date_format = $this->user->lang('DATE_FORMAT');
$username = get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']);
$rank = phpbb_get_user_rank($row, $row['user_posts']);
$tpl_data = $this->profilefields->get_template_data($row['user_id'], $this->settings['show_cpf']);
$tpl_data['row'] = array_merge($tpl_data['row'], array('USERNAME' => $username, 'AVATAR_IMG' => phpbb_get_user_avatar($row), 'POSTS_PCT' => sprintf($this->user->lang('POST_PCT'), $this->_calculate_percent_posts($row['user_posts'])), 'L_VIEW_PROFILE' => sprintf($this->user->lang('VIEW_USER_PROFILE'), $username), 'JOINED' => $this->user->format_date($row['user_regdate'], "|{$date_format}|"), 'VISITED' => $this->_get_last_visit_date($row['user_lastvisit'], $date_format), 'POSTS' => $row['user_posts'], 'RANK_TITLE' => $rank['title'], 'RANK_IMG' => $rank['img'], 'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), 'U_SEARCH_USER' => append_sid($this->phpbb_root_path . 'search.' . $this->php_ext, "author_id={$row['user_id']}&sr=posts")));
return $tpl_data;
}
示例15: rewrite_zebra
public function rewrite_zebra($event)
{
$context = $this->phpbb_container->get('template_context');
$tpldata =& $context->get_data_ref();
// Friends offline
if (isset($tpldata['friends_offline'])) {
foreach ($tpldata['friends_offline'] as $index => &$postrow) {
$user_id = $postrow['USER_ID'];
$sql = 'SELECT user_avatar, user_avatar_type, user_avatar_width, user_avatar_height FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id;
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$postrow['AVATAR'] = phpbb_get_user_avatar($row);
}
}
// Friends online
if (isset($tpldata['friends_online'])) {
foreach ($tpldata['friends_online'] as $index => &$postrow) {
$user_id = $postrow['USER_ID'];
$sql = 'SELECT user_avatar, user_avatar_type, user_avatar_width, user_avatar_height FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id;
$result = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result);
$postrow['AVATAR'] = phpbb_get_user_avatar($row);
}
}
}