本文整理汇总了PHP中phpbb_get_user_rank函数的典型用法代码示例。如果您正苦于以下问题:PHP phpbb_get_user_rank函数的具体用法?PHP phpbb_get_user_rank怎么用?PHP phpbb_get_user_rank使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phpbb_get_user_rank函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: array
}
$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'];
$user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src'];
if (!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail') || $auth->acl_get('a_email')) {
$user_cache[$poster_id]['email'] = $config['board_email_form'] && $config['email_enable'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=email&u={$poster_id}") : ($config['board_hide_emails'] && !$auth->acl_get('a_email') ? '' : 'mailto:' . $row['user_email']);
} else {
$user_cache[$poster_id]['email'] = '';
}
if ($config['allow_birthdays'] && !empty($row['user_birthday'])) {
list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday']));
if ($bday_year) {
$diff = $now['mon'] - $bday_month;
if ($diff == 0) {
$diff = $now['mday'] - $bday_day < 0 ? 1 : 0;
} else {
示例3: 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;
}
示例4: get_rank
/**
* Get rank
*
* @param int $user_id User ID of the user you want to retreive the rank 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()
* @return array Array with keys 'rank_title', 'rank_img', and 'rank_img_src'
*/
public function get_rank($user_id, $query = false)
{
if (!($user = $this->get_user($user_id, $query))) {
return '';
}
if (!function_exists('phpbb_get_user_rank')) {
include $this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext;
}
$rank = array('rank_title', 'rank_img', 'rank_img_src');
$user_rank_data = phpbb_get_user_rank($user, $user['user_id'] == ANONYMOUS ? false : $user['user_posts']);
$rank['rank_title'] = $user_rank_data['title'];
$rank['rank_img'] = $user_rank_data['img'];
$rank['rank_img_src'] = $user_rank_data['img_src'];
return $rank;
}
示例5: get_user_rank
/**
* Get user rank title and image
*
* @param int $user_rank the current stored users rank id
* @param int $user_posts the users number of posts
* @param string &$rank_title the rank title will be stored here after execution
* @param string &$rank_img the rank image as full img tag is stored here after execution
* @param string &$rank_img_src the rank image source is stored here after execution
*
* @deprecated 3.1.0-RC5 (To be removed: 3.3.0)
*
* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false
*/
function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src)
{
global $phpbb_root_path, $phpEx;
if (!function_exists('phpbb_get_user_rank')) {
include $phpbb_root_path . 'includes/functions_display.' . $phpEx;
}
$rank_data = phpbb_get_user_rank(array('user_rank' => $user_rank), $user_posts);
$rank_title = $rank_data['title'];
$rank_img = $rank_data['img'];
$rank_img_src = $rank_data['img_src'];
}
示例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: 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;
}
示例8: 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';
}
}
示例9: trigger_error
if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $group_row['user_id'] != $user->data['user_id']) {
trigger_error('NO_GROUP');
}
break;
case GROUP_SPECIAL:
$group_row['l_group_type'] = 'SPECIAL';
break;
case GROUP_FREE:
$group_row['l_group_type'] = 'FREE';
break;
}
$avatar_img = phpbb_get_group_avatar($group_row);
// ... same for group rank
$user_rank_data = array('title' => null, 'img' => null, 'img_src' => null);
if ($group_row['group_rank']) {
$user_rank_data = phpbb_get_user_rank($group_row, false);
if ($user_rank_data['img']) {
$user_rank_data['img'] .= '<br />';
}
}
// include modules for manage groups link display or not
// need to ensure the module is active
$can_manage_group = false;
if ($user->data['is_registered'] && $group_row['group_leader']) {
if (!class_exists('p_master')) {
include $phpbb_root_path . 'includes/functions_module.' . $phpEx;
}
$module = new p_master();
$module->list_modules('ucp');
if ($module->is_active('ucp_groups', 'manage')) {
$can_manage_group = true;
示例10: get_user_information
/**
* Get user information (only for message display)
*/
function get_user_information($user_id, $user_row)
{
global $db, $auth, $user, $cache;
global $phpbb_root_path, $phpEx, $config;
if (!$user_id) {
return array();
}
if (empty($user_row)) {
$sql = 'SELECT *
FROM ' . USERS_TABLE . '
WHERE user_id = ' . (int) $user_id;
$result = $db->sql_query($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
}
// Some standard values
$user_row['online'] = false;
$user_row['rank_title'] = $user_row['rank_image'] = $user_row['rank_image_src'] = $user_row['email'] = '';
// Generate online information for user
if ($config['load_onlinetrack']) {
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . "\n\t\t\tWHERE session_user_id = {$user_id}\n\t\t\tGROUP BY session_user_id";
$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$update_time = $config['load_online_time'] * 60;
if ($row) {
$user_row['online'] = time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
}
}
$user_row['avatar'] = $user->optionget('viewavatars') ? phpbb_get_user_avatar($user_row) : '';
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']);
$user_row['rank_title'] = $user_rank_data['title'];
$user_row['rank_image'] = $user_rank_data['img'];
$user_row['rank_image_src'] = $user_rank_data['img_src'];
if (!empty($user_row['user_allow_viewemail']) && $auth->acl_get('u_sendemail') || $auth->acl_get('a_email')) {
$user_row['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_email') || empty($user_row['user_email']) ? '' : 'mailto:' . $user_row['user_email']);
}
return $user_row;
}
示例11: _display_user
/**
* @param array $row
*/
private function _display_user(array $row)
{
if (sizeof($row)) {
$username = get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']);
$date_format = $this->user->lang('DATE_FORMAT');
$rank = phpbb_get_user_rank($row, $row['user_posts']);
$this->_show_profile_fields($row['user_id']);
$this->ptemplate->assign_vars(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")));
}
}
示例12: assign_details
/**
* Assign user details
*
* @param int $user_id
* @param string $prefix Prefix to assign to the user details
* @param bool $output_to_template True to output the data to the template
*/
public static function assign_details($user_id, $prefix = '', $output_to_template = false)
{
$row = self::get_user($user_id);
$user_id = $row['user_id'];
// Re-assign properly...in case it gives us the anonymous user
phpbb::_include('functions_display', 'phpbb_get_user_rank');
phpbb::$user->add_lang('memberlist');
// Get user rank
$rank = phpbb_get_user_rank($row, $row['user_posts']);
$output = array($prefix . 'USER_FULL' => self::get_user($user_id, '_full'), $prefix . 'USER_COLOUR' => self::get_user($user_id, '_colour'), $prefix . 'USERNAME' => self::get_user($user_id, '_username'), $prefix . 'RANK_TITLE' => $rank['title'], $prefix . 'RANK_IMG' => $rank['img'], $prefix . 'RANK_IMG_SRC' => $rank['img_src'], $prefix . 'USER_JOINED' => phpbb::$user->format_date($row['user_regdate']), $prefix . 'USER_POSTS' => $row['user_posts'], $prefix . 'USER_AVATAR' => self::get_user($user_id, '_avatar'), $prefix . 'USER_WARNINGS' => $row['user_warnings'], $prefix . 'USER_SIG' => self::get_user($user_id, '_signature'), $prefix . 'ONLINE_IMG' => $user_id != ANONYMOUS && isset(self::$status[$user_id]) ? self::$status[$user_id] ? phpbb::$user->img('icon_user_online', 'ONLINE') : phpbb::$user->img('icon_user_offline', 'OFFLINE') : '', $prefix . 'S_ONLINE' => $user_id != ANONYMOUS && isset(self::$status[$user_id]) ? self::$status[$user_id] : false, $prefix . 'S_FRIEND' => isset($row['friend']) ? true : false, $prefix . 'S_FOE' => isset($row['foe']) ? true : false, $prefix . 'U_USER_BOARD_PROFILE' => self::get_user($user_id, '_profile'), $prefix . 'U_SEARCH' => phpbb::$auth->acl_get('u_search') ? phpbb::append_sid('search', "author_id={$user_id}&sr=posts") : '', $prefix . 'U_PM' => self::get_user($user_id, '_u_pm'), $prefix . 'U_EMAIL' => self::get_user($user_id, '_u_email'), $prefix . 'U_JABBER' => self::get_user($user_id, '_jabber'), $prefix . 'S_JABBER_ENABLED' => phpbb::$config['jab_enable'] ? true : false, $prefix . 'SEND_EMAIL_USER' => phpbb::$user->lang('SEND_EMAIL_USER', self::get_user($user_id, '_username')));
if ($output_to_template) {
phpbb::$template->assign_vars($output);
}
return $output;
}
示例13: details
/**
* Main reputation 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)
* @param int $page Page number taken from the URL
* @return Symfony\Component\HttpFoundation\Response A Symfony Response object
* @access public
*/
public function details($uid, $sort_key, $sort_dir, $page)
{
$this->user->add_lang_ext('pico/reputation', array('reputation_system', 'reputation_rating'));
// Check user permissions - if user can not view reputation details, throw the error
if (!$this->auth->acl_get('u_rs_view')) {
$meta_info = append_sid("{$this->root_path}index.{$this->php_ext}", "");
$message = $user->lang['RS_VIEW_DISALLOWED'] . '<br /><br />' . $this->user->lang('RETURN_INDEX', '<a href="' . append_sid("{$this->root_path}index.{$this->php_ext}", "") . '">', '</a>');
meta_refresh(3, $meta_info);
trigger_error($message);
}
// User data
$sql = 'SELECT *
FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_type <> 2\n\t\t\t\tAND user_id = {$uid}";
$result = $this->db->sql_query($sql);
$user_row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
// Check if an user exists - if not, throw the error and return to the index page
if (empty($user_row)) {
$meta_info = append_sid("{$this->root_path}index.{$this->php_ext}", "");
$message = $this->user->lang['RS_NO_USER_ID'] . '<br /><br />' . $this->user->lang('RETURN_INDEX', '<a href="' . append_sid("{$this->root_path}index.{$this->php_ext}", "") . '">', '</a>');
meta_refresh(3, $meta_info);
trigger_error($message);
}
// Count reputation rows for the current user
$sql = 'SELECT COUNT(reputation_id) AS total_reps
FROM ' . $this->reputations_table . "\n\t\t\tWHERE user_id_to = {$uid}";
$result = $this->db->sql_query($sql);
$total_reps = (int) $this->db->sql_fetchfield('total_reps');
$this->db->sql_freeresult($result);
// Sort keys
$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');
// Start value - it is based on page
$start = ($page - 1) * $this->config['rs_per_page'];
$post_type_id = (int) $this->reputation_manager->get_reputation_type_id('post');
$sql_array = array('SELECT' => 'r.*, rt.reputation_type_name, u.group_id, 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' => 'r.user_id_from = u.user_id '), array('FROM' => array(POSTS_TABLE => 'p'), 'ON' => 'p.post_id = r.reputation_item_id
AND r.reputation_type_id = ' . $post_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_limit($sql, $this->config['rs_per_page'], $start);
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);
// User reputation rank
if (!function_exists('phpbb_get_user_rank')) {
include $this->root_path . 'includes/functions_display.' . $this->php_ext;
}
$user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']);
// Reputation statistics
$positive_count = $negative_count = 0;
$positive_sum = $negative_sum = 0;
$positive_week = $negative_week = 0;
$positive_month = $negative_month = 0;
$positive_6months = $negative_6months = 0;
$post_count = $user_count = 0;
$last_week = time() - 604800;
$last_month = time() - 2678400;
$last_6months = time() - 16070400;
$user_type_id = (int) $this->reputation_manager->get_reputation_type_id('user');
$sql = 'SELECT reputation_time, reputation_type_id, reputation_points
FROM ' . $this->reputations_table . "\n\t\t\tWHERE user_id_to = {$uid}";
$result = $this->db->sql_query($sql);
while ($reputation_vote = $this->db->sql_fetchrow($result)) {
if ($reputation_vote['reputation_points'] > 0) {
$positive_count++;
$positive_sum += $reputation_vote['reputation_points'];
if ($reputation_vote['reputation_time'] >= $last_week) {
$positive_week++;
}
if ($reputation_vote['reputation_time'] >= $last_month) {
$positive_month++;
}
if ($reputation_vote['reputation_time'] >= $last_6months) {
$positive_6months++;
}
} else {
if ($reputation_vote['reputation_points'] < 0) {
$negative_count++;
$negative_sum += $reputation_vote['reputation_points'];
if ($reputation_vote['reputation_time'] >= $last_week) {
$negative_week++;
}
if ($reputation_vote['reputation_time'] >= $last_month) {
$negative_month++;
}
if ($reputation_vote['reputation_time'] >= $last_6months) {
//.........这里部分代码省略.........
示例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;
}