* @var array topic_data Array with topic data * @var array post_list Array with post_ids we are going to retrieve * @var int sort_days Display posts of previous x days * @var string sort_key Key the posts are sorted by * @var string sort_dir Direction the posts are sorted by * @var int start Pagination information * @var array sql_ary The SQL array to get the data of posts and posters * @since 3.1.0-a1 * @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start */ $vars = array('forum_id', 'topic_id', 'topic_data', 'post_list', 'sort_days', 'sort_key', 'sort_dir', 'start', 'sql_ary'); extract($src_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $now = $user->create_datetime(); $now = src_gmgetdate($now->getTimestamp() + $now->getOffset()); // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built while ($row = $db->sql_fetchrow($result)) { // Set max_post_time if ($row['post_time'] > $max_post_time) { $max_post_time = $row['post_time']; } $poster_id = (int) $row['poster_id']; // Does post have an attachment? If so, add it to the list if ($row['post_attachment'] && $config['allow_attachments']) { $attach_list[] = (int) $row['post_id']; if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) { $has_unapproved_attachments = true; } else { if ($row['post_visibility'] == ITEM_APPROVED) {
/** * Prepare profile data */ function src_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false, $check_can_receive_pm = true) { global $config, $auth, $user, $phpEx, $src_root_path, $src_dispatcher; $username = $data['username']; $user_id = $data['user_id']; $user_rank_data = src_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['srcrd_email_form'] && $config['email_enable'] ? append_sid("{$src_root_path}memberlist.{$phpEx}", 'mode=email&u=' . $user_id) : ($config['srcrd_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 = src_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('src_get_banned_user_ids')) { include $src_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(src_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' => src_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("{$src_root_path}search.{$phpEx}", "author_id={$user_id}&sr=posts") : '', 'U_NOTES' => $user_notes_enabled && $auth->acl_getf_global('m_') ? append_sid("{$src_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("{$src_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("{$src_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("{$src_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($src_dispatcher->trigger_event('core.memberlist_prepare_profile_data', compact($vars))); return $template_data; }