本文整理汇总了PHP中phpbb_get_avatar函数的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_get_avatar函数的具体用法?PHP phpbb_get_avatar怎么用?PHP phpbb_get_avatar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phpbb_get_avatar函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_avatar
/**
* Get avatar
*
* @param int $user_id User ID of the user you want to retrieve the avatar for
* @param bool $query Should we query the database if this user has not yet been loaded?
* Typically this should be left as false and you should make sure
* you load users ahead of time with load_users()
* @param bool @lazy If true, will be lazy loaded (requires JS)
* @return string
*/
public function get_avatar($user_id, $query = false, $lazy = false)
{
if (!($user = $this->get_user($user_id, $query))) {
return '';
}
$row = array('avatar' => $user['user_avatar'], 'avatar_type' => $user['user_avatar_type'], 'avatar_width' => $user['user_avatar_width'], 'avatar_height' => $user['user_avatar_height']);
return phpbb_get_avatar($row, 'USER_AVATAR', false, $lazy);
}
示例2: phpbb_get_group_avatar
/**
* Get group avatar
*
* @param array $group_row Row from the groups table
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
* @param bool $lazy If true, will be lazy loaded (requires JS)
*
* @return string Avatar html
*/
function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false, $lazy = false)
{
$row = \phpbb\avatar\manager::clean_row($user_row, 'group');
return phpbb_get_avatar($row, $alt, $ignore_config, $lazy);
}
示例3: get_user_avatar
/**
* Get user avatar
*
* @deprecated 3.1.0-a1 (To be removed: 3.3.0)
*
* @param string $avatar Users assigned avatar name
* @param int $avatar_type Type of avatar
* @param string $avatar_width Width of users avatar
* @param string $avatar_height Height of users avatar
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
*
* @return string Avatar image
*/
function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false)
{
// map arguments to new function phpbb_get_avatar()
$row = array('avatar' => $avatar, 'avatar_type' => $avatar_type, 'avatar_width' => $avatar_width, 'avatar_height' => $avatar_height);
return phpbb_get_avatar($row, $alt, $ignore_config);
}
示例4: process_block_modules
//.........这里部分代码省略.........
}
}
$block_id = $row['id'];
$block_ndx = $row['ndx'];
$block_title = $row['title'];
$block_active = $row['active'];
$block_type = $row['type'];
$block_view_groups = $row['view_groups'];
$block_view_all = $row['view_all'];
$block_scroll = $row['scroll'];
$block_height = $row['block_height'];
$html_file_name = $row['html_file_name'];
$img_file_name = $row['img_file_name'];
$view_pages = $row['view_pages'];
$arr = explode(',', $view_pages);
$grps = explode(",", $block_view_groups);
$process_block = false;
$block_title = get_menu_lang_name($row['title']);
// process blocks for different groups //
if (isset($memberships)) {
foreach ($memberships as $member) {
// First we check to see if the view_all over-ride is set (saves having to enter all groups) //
if ($block_view_all) {
$process_block = true;
} else {
for ($j = 0; $j < ($jcount = count($grps)); $j++) {
if ($grps[$j] == $member['group_id']) {
$process_block = true;
}
}
}
}
//unset($memberships);
}
if ($process_block && in_array($page_id, $arr)) {
switch ($block_position) {
case 'L':
$left_block_ary[$L] = $html_file_name;
$left_block_id[$L] = $block_id;
$left_block_ndx[$L] = $block_ndx;
$left_block_title[$L] = $block_title;
$left_block_img[$L] = $img_file_name;
$left_block_scroll[$L] = $block_scroll;
$left_block_height[$L] = $block_height;
$L++;
$show_left = true;
//show_blocks($this_page_name, $block_position);
break;
case 'C':
$center_block_ary[$C] = $html_file_name;
$center_block_id[$C] = $block_id;
$center_block_ndx[$C] = $block_ndx;
$center_block_title[$C] = $block_title;
$center_block_img[$C] = $img_file_name;
$center_block_scroll[$C] = $block_scroll;
$center_block_height[$C] = $block_height;
$C++;
$show_center = true;
//show_blocks($this_page_name, $block_position);
break;
case 'R':
$right_block_ary[$R] = $html_file_name;
$right_block_id[$R] = $block_id;
$right_block_ndx[$R] = $block_ndx;
$right_block_title[$R] = $block_title;
$right_block_img[$R] = $img_file_name;
$right_block_scroll[$R] = $block_scroll;
$right_block_height[$R] = $block_height;
$R++;
$show_right = true;
//show_blocks($this_page_name, $block_position);
break;
default:
}
///var_dump($html_file_name);
}
}
}
//unset($active_blocks);
if (isset($left_block_ary) && $show_left) {
foreach ($left_block_ary as $block => $value) {
$template->assign_block_vars('left_block_files', array('LEFT_BLOCKS' => $this->build_block_modules($value), 'LEFT_BLOCK_ID' => 'L_' . $left_block_id[$block], 'LEFT_BLOCK_TITLE' => $left_block_title[$block], 'LEFT_BLOCK_SCROLL' => $left_block_scroll[$block], 'LEFT_BLOCK_HEIGHT' => $left_block_height[$block], 'LEFT_BLOCK_IMG' => $left_block_img[$block] ? $block_image_path . $left_block_img[$block] : $block_image_path . 'none.gif', 'LEFT_BLOCK_IMG_2' => file_exists($big_image_path . $left_block_img[$block]) ? $big_image_path . $left_block_img[$block] : $big_image_path . 'none.png', 'S_CONTENT_FLOW_BEGIN' => $user->lang['DIRECTION'] == 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $user->lang['DIRECTION'] == 'ltr' ? 'right' : 'left'));
}
}
//unset($left_block_ary);
if (isset($right_block_ary) && $show_right) {
foreach ($right_block_ary as $block => $value) {
$template->assign_block_vars('right_block_files', array('RIGHT_BLOCKS' => $this->build_block_modules($value), 'RIGHT_BLOCK_ID' => 'R_' . $right_block_id[$block], 'RIGHT_BLOCK_TITLE' => $right_block_title[$block], 'RIGHT_BLOCK_SCROLL' => $right_block_scroll[$block], 'RIGHT_BLOCK_HEIGHT' => $right_block_height[$block], 'RIGHT_BLOCK_IMG' => $right_block_img[$block] ? $block_image_path . $right_block_img[$block] : $block_image_path . 'none.gif', 'RIGHT_BLOCK_IMG_2' => file_exists($big_image_path . $right_block_img[$block]) ? $big_image_path . $right_block_img[$block] : $big_image_path . 'none.png', 'S_CONTENT_FLOW_BEGIN' => $user->lang['DIRECTION'] == 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $user->lang['DIRECTION'] == 'ltr' ? 'right' : 'left'));
}
}
//unset($right_block_ary);
if (isset($center_block_ary) && $show_center) {
foreach ($center_block_ary as $block => $value) {
$template->assign_block_vars('center_block_files', array('CENTER_BLOCKS' => $this->build_block_modules($value), 'CENTER_BLOCK_ID' => 'C_' . $center_block_id[$block], 'CENTER_BLOCK_TITLE' => $center_block_title[$block], 'CENTER_BLOCK_SCROLL' => $center_block_scroll[$block], 'CENTER_BLOCK_HEIGHT' => $center_block_height[$block], 'CENTER_BLOCK_IMG' => $center_block_img[$block] ? $block_image_path . $center_block_img[$block] : $block_image_path . 'none.gif', 'CENTER_BLOCK_IMG_2' => file_exists($big_image_path . $center_block_img[$block]) ? $big_image_path . $center_block_img[$block] : $big_image_path . 'none.png', 'S_CONTENT_FLOW_BEGIN' => $user->lang['DIRECTION'] == 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $user->lang['DIRECTION'] == 'ltr' ? 'right' : 'left'));
}
}
//unset($center_block_ary);
$avatar_data = array('avatar' => $user->data['user_avatar'], 'avatar_width' => $user->data['user_avatar_width'], 'avatar_height' => $user->data['user_avatar_height'], 'avatar_type' => $user->data['user_avatar_type']);
$template->assign_vars(array('ASSETS_PATH' => $phpbb_root_path . 'ext/phpbbireland/portal/styles/' . rawurlencode($user->style['style_path']) . '/template/assets/', 'AVATAR' => phpbb_get_avatar($avatar_data, $user->lang['USER_AVATAR'], false), 'BLOCK_WIDTH' => $blocks_width . 'px', 'PORTAL_ACTIVE' => $config['portal_enabled'], 'PORTAL_BUILD' => $config['portal_build'], 'PORTAL_VERSION' => $config['portal_version'], 'READ_ARTICLE_IMG' => $user->img('btn_read_article', 'READ_ARTICLE'), 'POST_COMMENTS_IMG' => $user->img('btn_post_comments', 'POST_COMMENTS'), 'VIEW_COMMENTS_IMG' => $user->img('btn_view_comments', 'VIEW_COMMENTS'), 'SITE_NAME' => $config['sitename'], 'S_USER_LOGGED_IN' => $user->data['user_id'] != ANONYMOUS ? true : false, 'S_SHOW_LEFT_BLOCKS' => $show_left, 'S_SHOW_RIGHT_BLOCKS' => $show_right, 'S_BLOCKS_ENABLED' => $blocks_enabled, 'S_K_FOOTER_IMAGES_ALLOW' => $k_config['k_footer_images_allow'] ? true : false, 'S_CONTENT_FLOW_BEGIN' => $user->lang['DIRECTION'] == 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $user->lang['DIRECTION'] == 'ltr' ? 'right' : 'left', 'USER_NAME' => $user->data['username'], 'USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'U_INDEX' => append_sid("{$phpbb_root_path}index.{$this->php_ext}"), 'U_PORTAL' => append_sid("{$phpbb_root_path}portal"), 'U_STAFF' => append_sid("{$phpbb_root_path}memberlist.{$this->php_ext}", 'mode=leaders'), 'U_SEARCH_BOOKMARKS' => append_sid("{$phpbb_root_path}ucp.{$this->php_ext}", 'i=main&mode=bookmarks'), 'PORTAL_HEADER_BLOCKS' => false, 'PORTAL_FOOTER_BLOCKS' => false, 'U_PORTAL_ARRANGE' => append_sid("{$phpbb_root_path}portal.{$this->php_ext}", "arrange=1"), 'S_ARRANGE' => false, 'HIDE_IMG' => '<img src="ext/phpbbireland/portal/images/hide.png" alt="' . $user->lang['SHOWHIDE'] . '" title="' . $user->lang['SHOWHIDE'] . '" height="16" width="14" />', 'MOVE_IMG' => '<img src="ext/phpbbireland/portal/images/move.png" alt="' . $user->lang['MOVE'] . '" title="' . $user->lang['MOVE'] . '" height="16" width="14" />', 'SHOW_IMG' => '<img src="ext/phpbbireland/portal/images/show.png" alt="' . $user->lang['SHOW'] . '" title="' . $user->lang['SHOW'] . '" height="16" width="14" />'));
}
示例5: get_template_side
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
if (!function_exists('phpbb_get_user_rank')) {
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
}
if ($this->user->data['is_registered']) {
//
// + new posts since last visit & you post number
//
$ex_fid_ary = array_unique(array_merge(array_keys($this->auth->acl_getf('!f_read', true)), array_keys($this->auth->acl_getf('!f_search', true))));
if ($this->auth->acl_get('m_approve')) {
$m_approve_fid_sql = '';
} else {
if ($this->auth->acl_getf_global('m_approve')) {
$m_approve_fid_ary = array_diff(array_keys($this->auth->acl_getf('!m_approve', true)), $ex_fid_ary);
$m_approve_fid_sql = ' AND (p.post_visibility = 1' . (sizeof($m_approve_fid_ary) ? ' OR ' . $this->db->sql_in_set('p.forum_id', $m_approve_fid_ary, true) : '') . ')';
} else {
$m_approve_fid_sql = ' AND p.post_visibility = 1';
}
}
$sql = 'SELECT COUNT(DISTINCT t.topic_id) as total
FROM ' . TOPICS_TABLE . ' t
WHERE t.topic_last_post_time > ' . (int) $this->user->data['user_lastvisit'] . '
AND t.topic_moved_id = 0
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
' . (sizeof($ex_fid_ary) ? 'AND ' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
$result = $this->db->sql_query($sql, 600);
$new_posts_count = (int) $this->db->sql_fetchfield('total');
$this->db->sql_freeresult($result);
// unread posts
$sql_where = 'AND t.topic_moved_id = 0
' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . '
' . (sizeof($ex_fid_ary) ? 'AND ' . $this->db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '');
$unread_list = get_unread_topics($this->user->data['user_id'], $sql_where, 'ORDER BY t.topic_id DESC');
$unread_posts_count = sizeof($unread_list);
// Get user avatar and rank
$user_id = $this->user->data['user_id'];
$username = $this->user->data['username'];
$colour = $this->user->data['user_colour'];
$avatar_img = phpbb_get_avatar(\phpbb\avatar\manager::clean_row($this->user->data, 'user'), 'USER_AVATAR');
$rank_data = phpbb_get_user_rank($this->user->data, $this->user->data['user_posts']);
// Assign specific vars
$this->template->assign_vars(array('L_NEW_POSTS' => $this->user->lang['SEARCH_NEW'] . ' (' . $new_posts_count . ')', 'L_SELF_POSTS' => $this->user->lang['SEARCH_SELF'] . ' (' . $this->user->data['user_posts'] . ')', 'L_UNREAD_POSTS' => $this->user->lang['SEARCH_UNREAD'] . ' (' . $unread_posts_count . ')', 'B3P_AVATAR_IMG' => $avatar_img, 'B3P_RANK_TITLE' => $rank_data['title'], 'B3P_RANK_IMG' => $rank_data['img'], 'RANK_IMG_SRC' => $rank_data['img_src'], 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour), 'U_NEW_POSTS' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'search_id=newposts'), 'U_SELF_POSTS' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'search_id=egosearch'), 'U_UNREAD_POSTS' => append_sid("{$this->phpbb_root_path}search.{$this->php_ext}", 'search_id=unreadposts'), 'U_UM_BOOKMARKS' => $this->config['allow_bookmarks'] ? append_sid("{$this->phpbb_root_path}ucp.{$this->php_ext}", 'i=main&mode=bookmarks') : '', 'U_UM_MAIN_SUBSCRIBED' => append_sid("{$this->phpbb_root_path}ucp.{$this->php_ext}", 'i=main&mode=subscribed'), 'U_UM_MCP' => $this->auth->acl_get('m_') || $this->auth->acl_getf_global('m_') ? append_sid("{$this->phpbb_root_path}mcp.{$this->php_ext}", 'i=main&mode=front', true, $this->user->session_id) : '', 'S_DISPLAY_SUBSCRIPTIONS' => $this->config['allow_topic_notify'] || $this->config['allow_forum_notify'] ? true : false));
return 'user_menu_side.html';
} else {
/*
* Assign specific vars
* Need to remove web root path as ucp.php will do the
* redirect
*/
$this->template->assign_vars(array('U_PORTAL_REDIRECT' => $this->path_helper->remove_web_root_path($this->controller_helper->route('board3_portal_controller')), 'S_DISPLAY_FULL_LOGIN' => true, 'S_AUTOLOGIN_ENABLED' => $this->config['allow_autologin'] ? true : false, 'S_LOGIN_ACTION' => append_sid("{$this->phpbb_root_path}ucp.{$this->php_ext}", 'mode=login'), 'S_SHOW_REGISTER' => $this->config['board3_user_menu_register_' . $module_id] ? true : false));
return 'login_box_side.html';
}
}
示例6: get_template_side
/**
* {@inheritdoc}
*/
public function get_template_side($module_id)
{
switch ($this->db->get_sql_layer()) {
case 'postgres':
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_type <> ' . USER_INACTIVE . '
ORDER BY RANDOM()';
break;
case 'mssql':
case 'mssql_odbc':
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_type <> ' . USER_INACTIVE . '
ORDER BY NEWID()';
break;
default:
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_type <> ' . USER_IGNORE . '
AND user_type <> ' . USER_INACTIVE . '
ORDER BY RAND()';
break;
}
$result = $this->db->sql_query_limit($sql, 1);
$row = $this->db->sql_fetchrow($result);
$avatar_img = phpbb_get_avatar(\phpbb\avatar\manager::clean_row($row, 'user'), 'USER_AVATAR');
$rank_data = phpbb_get_user_rank($row, $row['user_posts']);
$username = $row['username'];
$user_id = (int) $row['user_id'];
$colour = $row['user_colour'];
$this->template->assign_block_vars('random_member', array('USERNAME_FULL' => get_username_string('full', $user_id, $username, $colour), 'USERNAME' => get_username_string('username', $user_id, $username, $colour), 'USER_COLOR' => get_username_string('colour', $user_id, $username, $colour), 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $colour), 'RANK_TITLE' => $rank_data['title'], 'RANK_IMG' => $rank_data['img'], 'RANK_IMG_SRC' => $rank_data['img_src'], 'USER_POSTS' => (int) $row['user_posts'], 'AVATAR_IMG' => $avatar_img, 'JOINED' => $this->user->format_date($row['user_regdate'])));
$this->db->sql_freeresult($result);
return 'random_member_side.html';
}
示例7: readAction
/**
* Refresher Read action
*
* @return bool
*/
private function readAction()
{
$sql = 'SELECT c.*, p.post_visibility, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height
FROM ' . CHAT_TABLE . ' as c
LEFT JOIN ' . USERS_TABLE . ' as u ON c.user_id = u.user_id
LEFT JOIN ' . POSTS_TABLE . ' as p ON c.post_id = p.post_id
WHERE c.message_id > ' . $this->last_id . '
ORDER BY c.message_id DESC';
$result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']);
$rows = $this->db->sql_fetchrowset($result);
if (!sizeof($rows) && time() - 60 < $this->last_time) {
return;
}
foreach ($rows as $row) {
if ($row['forum_id'] && !$row['post_visibility'] == ITEM_APPROVED && !$this->auth->acl_get('m_approve', $row['forum_id'])) {
continue;
}
if ($row['forum_id'] && !$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
$avatar = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => $row['user_avatar_height'], 'avatar_width' => $row['user_avatar_width']];
$avatar_thumb = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => '', 'avatar_width' => 35];
$row['avatar'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar, '') : '';
$row['avatar_thumb'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar_thumb, '') : '';
if ($this->count++ === 0) {
if ($row['message_id'] !== null) {
$this->last_id = $row['message_id'];
} else {
$this->last_id = 0;
}
$this->template->assign_vars(['SOUND_ENABLED' => true, 'SOUND_FILE' => 'sound']);
}
if ($this->config['ajax_chat_time_setting']) {
$time = $this->config['ajax_chat_time_setting'];
} else {
$time = $this->user->data['user_dateformat'];
}
$this->template->assign_block_vars('chatrow', ['MESSAGE_ID' => $row['message_id'], 'USERNAME_FULL' => $this->clean_username(get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST'])), 'USERNAME_A' => $row['username'], 'USER_COLOR' => $row['user_colour'], 'MESSAGE' => generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']), 'TIME' => $this->user->format_date($row['time'], $time), 'CLASS' => $row['message_id'] % 2 ? 1 : 2, 'USER_AVATAR' => $row['avatar'], 'USER_AVATAR_THUMB' => $row['avatar_thumb']]);
}
$this->db->sql_freeresult($result);
if (time() - 60 > $this->last_time) {
$sql_ary = ['username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'user_lastupdate' => time()];
$sql = 'UPDATE ' . CHAT_SESSIONS_TABLE . '
SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . "\n WHERE user_id = {$this->user->data['user_id']}";
$result = $this->db->sql_query($sql);
}
$this->get = true;
return;
}
示例8: get_avatar
/**
* Get avatar
*
* @param int $user_id User ID of the user you want to retreive the avatar for
* @param bool $query Should we query the database if this user has not yet been loaded?
* Typically this should be left as false and you should make sure
* you load users ahead of time with load_users()
* @param bool @lazy If true, will be lazy loaded (requires JS)
* @return string
*/
public function get_avatar($user_id, $query = false, $lazy = false)
{
if (!($user = $this->get_user($user_id, $query))) {
return '';
}
return phpbb_get_avatar(\phpbb\avatar\manager::clean_row($user, 'user'), 'USER_AVATAR', false, $lazy);
}
示例9: index
/**
* Modifies the forum index to add the chat
*/
public function index()
{
if ($this->config['prune_ajax_chat'] === true) {
$this->prune();
}
if (!defined('PHPBB_USE_BOARD_URL_PATH')) {
define('PHPBB_USE_BOARD_URL_PATH', true);
}
$this->user->add_lang('posting');
$this->user->add_lang_ext('spaceace/ajaxchat', 'ajax_chat');
if (!defined('CHAT_TABLE')) {
$chat_table = $this->table_prefix . 'ajax_chat';
define('CHAT_TABLE', $chat_table);
}
if (!defined('CHAT_SESSIONS_TABLE')) {
$chat_session_table = $this->table_prefix . 'ajax_chat_sessions';
define('CHAT_SESSIONS_TABLE', $chat_session_table);
}
include_once $this->root_path . 'includes/functions_posting.' . $this->php_ext;
include_once $this->root_path . 'includes/functions_display.' . $this->php_ext;
$this->mode = $this->request->variable('mode', 'default');
$this->last_id = $this->request->variable('last_id', 0);
$this->last_time = $this->request->variable('last_time', 0);
$this->post_time = $this->request->variable('last_post', 0);
$this->times = ['online' => $this->config['status_online_chat'], 'idle' => $this->config['status_idle_chat'], 'offline' => $this->config['status_offline_chat']];
$sql = 'SELECT c.*, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height
FROM ' . CHAT_TABLE . ' as c
LEFT JOIN ' . USERS_TABLE . ' as u
ON c.user_id = u.user_id
ORDER BY message_id DESC';
$result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_index_amount']);
$rows = $this->db->sql_fetchrowset($result);
if (!sizeof($rows) && time() - 60 < $this->last_time) {
return;
}
foreach ($rows as $row) {
if ($row['forum_id'] && !$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
$avatar = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => $row['user_avatar_height'], 'avatar_width' => $row['user_avatar_width']];
$avatar_thumb = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => '', 'avatar_width' => 35];
$row['avatar'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar, '') : '';
$row['avatar_thumb'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar_thumb, '') : '';
if ($this->count++ == 0) {
$this->last_id = $row['message_id'];
}
if ($this->config['ajax_chat_time_setting']) {
$time = $this->config['ajax_chat_time_setting'];
} else {
$time = $this->user->data['user_dateformat'];
}
$this->template->assign_block_vars('chatrow', ['MESSAGE_ID' => $row['message_id'], 'USERNAME_FULL' => $this->clean_username(get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST'])), 'USERNAME_A' => $row['username'], 'USER_COLOR' => $row['user_colour'], 'MESSAGE' => make_clickable(generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options'])), 'TIME' => $this->user->format_date($row['time'], $time), 'CLASS' => $row['message_id'] % 2 ? 1 : 2, 'USER_AVATAR' => $row['avatar'], 'USER_AVATAR_THUMB' => $row['avatar_thumb']]);
}
$this->db->sql_freeresult($result);
if ($this->user->data['user_type'] == USER_FOUNDER || $this->user->data['user_type'] == USER_NORMAL) {
$sql = 'SELECT * FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_id = {$this->user->data['user_id']}";
$result1 = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result1);
$this->db->sql_freeresult($result1);
if ($row['user_id'] != $this->user->data['user_id']) {
$sql_ary = ['user_id' => $this->user->data['user_id'], 'username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'user_login' => time(), 'user_lastupdate' => time()];
$sql = 'INSERT INTO ' . CHAT_SESSIONS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
$this->db->sql_query($sql);
} else {
$sql_ary = ['username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'user_login' => time(), 'user_lastupdate' => time()];
$sql = 'UPDATE ' . CHAT_SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$this->user->data['user_id']}";
$this->db->sql_query($sql);
}
}
$bbcode_status = $this->config['allow_bbcode'] && $this->config['auth_bbcode_pm'] && $this->auth->acl_get('u_ajaxchat_bbcode') ? true : false;
$smilies_status = $this->config['allow_smilies'] && $this->config['auth_smilies_pm'] && $this->auth->acl_get('u_pm_smilies') ? true : false;
$img_status = $this->config['auth_img_pm'] && $this->auth->acl_get('u_pm_img') ? true : false;
$flash_status = $this->config['auth_flash_pm'] && $this->auth->acl_get('u_pm_flash') ? true : false;
$url_status = $this->config['allow_post_links'] ? true : false;
$this->mode = strtoupper($this->mode);
$sql = 'SELECT `user_lastpost` FROM ' . CHAT_SESSIONS_TABLE . " WHERE user_id = {$this->user->data['user_id']}";
$result1 = $this->db->sql_query($sql);
$row = $this->db->sql_fetchrow($result1);
$this->db->sql_freeresult($result1);
if ($this->get_status($row['user_lastpost']) === 'online') {
$refresh = $this->config['refresh_online_chat'];
} else {
if ($this->get_status($row['user_lastpost']) === 'idle') {
$refresh = $this->config['refresh_idle_chat'];
} else {
if ($this->user->data['user_id'] === ANONYMOUS || $this->get_status($row['user_lastpost']) === 'offline') {
$refresh = $this->config['refresh_offline_chat'];
} else {
$refresh = $this->config['refresh_offline_chat'];
}
}
}
if ($this->user->data['user_id'] === ANONYMOUS || $row['user_lastpost'] === null) {
$last_post = 0;
} else {
$last_post = $row['user_lastpost'];
}
//.........这里部分代码省略.........
示例10: addAction
/**
* Add & read action
*
* @return bool
*/
private function addAction()
{
if (!$this->user->data['is_registered'] || $this->user->data['user_type'] == USER_INACTIVE || $this->user->data['user_type'] == USER_IGNORE) {
redirect(append_sid("{$this->root_path}ucp.{$this->php_ext}", 'mode=login'));
}
$this->get = true;
$message = utf8_normalize_nfc($this->request->variable('message', '', true));
if (!$message) {
return;
}
$this->clean_message($message);
$uid = $bitfield = $options = '';
$allow_bbcode = $this->auth->acl_get('u_ajaxchat_bbcode');
$allow_urls = $allow_smilies = true;
generate_text_for_storage($message, $uid, $bitfield, $options, $allow_bbcode, $allow_urls, $allow_smilies);
$sql_ary = ['chat_id' => 1, 'user_id' => $this->user->data['user_id'], 'username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'message' => $message, 'bbcode_bitfield' => $bitfield, 'bbcode_uid' => $uid, 'bbcode_options' => $options, 'time' => time()];
$sql = 'INSERT INTO ' . CHAT_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary);
$this->db->sql_query($sql);
$sql_ary2 = ['username' => $this->user->data['username'], 'user_colour' => $this->user->data['user_colour'], 'user_lastpost' => time(), 'user_lastupdate' => time()];
$sql = 'UPDATE ' . CHAT_SESSIONS_TABLE . ' SET ' . $this->db->sql_build_array('UPDATE', $sql_ary2) . " WHERE user_id = {$this->user->data['user_id']}";
$result = $this->db->sql_query($sql);
$sql = 'SELECT c.*, u.user_avatar, u.user_avatar_type, u.user_avatar_width, u.user_avatar_height
FROM ' . CHAT_TABLE . ' as c
LEFT JOIN ' . USERS_TABLE . ' as u
ON c.user_id = u.user_id
WHERE c.message_id > ' . $this->last_id . '
ORDER BY message_id DESC';
$result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']);
$rows = $this->db->sql_fetchrowset($result);
if (!sizeof($rows) && time() - 60 < $this->last_time) {
exit;
}
foreach ($rows as $row) {
if ($row['forum_id'] && !$this->auth->acl_get('f_read', $row['forum_id'])) {
continue;
}
$avatar = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => $row['user_avatar_height'], 'avatar_width' => $row['user_avatar_width']];
$avatar_thumb = ['avatar' => $row['user_avatar'], 'avatar_type' => $row['user_avatar_type'], 'avatar_height' => '', 'avatar_width' => 35];
$row['avatar'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar, '') : '';
$row['avatar_thumb'] = $this->user->optionget('viewavatars') ? phpbb_get_avatar($avatar_thumb, '') : '';
if ($this->count++ == 0) {
$this->last_id = $row['message_id'];
$this->template->assign_vars(['SOUND_ENABLED' => true, 'SOUND_FILE' => 'soundout']);
}
if ($this->config['ajax_chat_time_setting']) {
$time = $this->config['ajax_chat_time_setting'];
} else {
$time = $this->user->data['user_dateformat'];
}
$this->template->assign_block_vars('chatrow', ['MESSAGE_ID' => $row['message_id'], 'USERNAME_FULL' => $this->clean_username(get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], $this->user->lang['GUEST'])), 'USERNAME_A' => $row['username'], 'USER_COLOR' => $row['user_colour'], 'MESSAGE' => make_clickable(generate_text_for_display($row['message'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options'])), 'TIME' => $this->user->format_date($row['time'], $time), 'CLASS' => $row['message_id'] % 2 ? 1 : 2, 'USER_AVATAR' => $row['avatar'], 'USER_AVATAR_THUMB' => $row['avatar_thumb']]);
}
$this->db->sql_freeresult($result);
return;
}
示例11: str_replace
//$my_file_wide = str_replace('.html', '_wide.html', $my_file_wide);
$my_file_wide = $style_path_ext = '';
if (file_exists($my_file_wide)) {
$value = str_replace('.html', '_wide.html', $value);
} else {
$my_file_wide = "{$style_path_ext}common/template/blocks/" . $value;
$my_file_wide = str_replace('.html', '_wide.html', $my_file_wide);
if (file_exists($my_file_wide)) {
$value = str_replace('.html', '_wide.html', $value);
}
}
$template->assign_block_vars('center_block_files', array('CENTER_BLOCKS' => portal_block_template($value), 'CENTER_BLOCK_ID' => 'C_' . $center_block_id[$block], 'CENTER_BLOCK_TITLE' => $center_block_title[$block], 'CENTER_BLOCK_SCROLL' => $center_block_scroll[$block], 'CENTER_BLOCK_HEIGHT' => $center_block_height[$block], 'CENTER_BLOCK_IMG' => $center_block_img[$block] ? $block_image_path . $center_block_img[$block] : $block_image_path . 'none.gif', 'CENTER_BLOCK_IMG_2' => file_exists($big_image_path . $center_block_img[$block]) ? $big_image_path . $center_block_img[$block] : $big_image_path . 'none.png', 'S_CONTENT_FLOW_BEGIN' => $user->lang['DIRECTION'] == 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $user->lang['DIRECTION'] == 'ltr' ? 'right' : 'left'));
}
}
$avatar_data = array('avatar' => $row['user_avatar'], 'avatar_width' => $row['user_avatar_width'], 'avatar_height' => $row['user_avatar_height'], 'avatar_type' => $row['user_avatar_type']);
$ava = phpbb_get_avatar($avatar_data, $user->lang['USER_AVATAR'], false);
//var_dump($phpbb_root_path . 'ext/phpbbireland/portal/style/' . rawurlencode($user->style['style_path']) . '/theme/images/');
$template->assign_vars(array('T_THEME_PATH' => $phpbb_root_path . 'ext/phpbbireland/portal/style/' . rawurlencode($user->style['style_path']) . '/theme/images/', 'AVATAR' => $ava, 'BLOCK_WIDTH' => $blocks_width . 'px', 'PORTAL_ACTIVE' => $config['portal_enabled'], 'PORTAL_BUILD' => $config['portal_build'], 'PORTAL_VERSION' => $config['portal_version'], 'READ_ARTICLE_IMG' => $user->img('btn_read_article', 'READ_ARTICLE'), 'POST_COMMENTS_IMG' => $user->img('btn_post_comments', 'POST_COMMENTS'), 'VIEW_COMMENTS_IMG' => $user->img('btn_view_comments', 'VIEW_COMMENTS'), 'SITE_NAME' => $config['sitename'], 'S_USER_LOGGED_IN' => $user->data['user_id'] != ANONYMOUS ? true : false, 'S_SHOW_LEFT_BLOCKS' => $show_left, 'S_SHOW_RIGHT_BLOCKS' => $show_right, 'S_BLOCKS_ENABLED' => $blocks_enabled, 'S_K_FOOTER_IMAGES_ALLOW' => $k_config['k_footer_images_allow'] ? true : false, 'S_CONTENT_FLOW_BEGIN' => $user->lang['DIRECTION'] == 'ltr' ? 'left' : 'right', 'S_CONTENT_FLOW_END' => $user->lang['DIRECTION'] == 'ltr' ? 'right' : 'left', 'USER_NAME' => $user->data['username'], 'USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), 'U_INDEX' => append_sid("{$phpbb_root_path}index.{$phpEx}"), 'U_STAFF' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=leaders'), 'U_SEARCH_BOOKMARKS' => append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=main&mode=bookmarks')));
/***
// process common data here //
if ($this_page[0] == 'viewtopic')
{
global $phpEx, $phpbb_root_path;
global $config, $user, $template, $k_quick_posting_mode, $forum_id, $post_data, $topic_id, $topic_data, $k_config;
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
if (!function_exists('get_user_avatar'))
{
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
}