本文整理汇总了PHP中custom_profile::generate_profile_fields_template方法的典型用法代码示例。如果您正苦于以下问题:PHP custom_profile::generate_profile_fields_template方法的具体用法?PHP custom_profile::generate_profile_fields_template怎么用?PHP custom_profile::generate_profile_fields_template使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类custom_profile
的用法示例。
在下文中一共展示了custom_profile::generate_profile_fields_template方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_cp_fields
public static function load_cp_fields($user_ids)
{
// Only get the rows for those we have not gotten already
$user_ids = array_diff($user_ids, array_keys(self::$cp_fields));
if (!sizeof($user_ids)) {
return;
}
// Load custom profile fields
if (phpbb::$config['load_cpf_viewtopic']) {
phpbb::_include('functions_profile_fields', false, 'custom_profile');
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_tmp = $cp->generate_profile_fields_template('grab', $user_ids);
// filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs.
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) {
self::$cp_fields[$profile_user_id] = array();
foreach ($profile_fields as $used_ident => $profile_field) {
if ($profile_field['data']['field_show_on_vt']) {
self::$cp_fields[$profile_user_id][$used_ident] = $profile_field;
}
}
}
unset($profile_fields_tmp);
}
}
示例2: array
WHERE ' . $db->sql_in_set('user_id', $user_list);
}
$result = $db->sql_query($sql);
$id_cache = array();
while ($row = $db->sql_fetchrow($result)) {
$row['session_time'] = !empty($session_times[$row['user_id']]) ? $session_times[$row['user_id']] : 0;
$row['last_visit'] = !empty($row['session_time']) ? $row['session_time'] : $row['user_lastvisit'];
$id_cache[$row['user_id']] = $row;
}
$db->sql_freeresult($result);
// Load custom profile fields
if ($config['load_cpf_memberlist']) {
include_once $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $user_list);
}
// If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date...
if ($sort_key == 'l') {
// uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));"));
usort($user_list, '_sort_last_active');
}
for ($i = 0, $end = sizeof($user_list); $i < $end; ++$i) {
$user_id = $user_list[$i];
$row =& $id_cache[$user_id];
$is_leader = isset($row['group_leader']) && $row['group_leader'] ? true : false;
$leaders_set = $leaders_set || $is_leader;
$cp_row = array();
if ($config['load_cpf_memberlist']) {
$cp_row = isset($profile_fields_cache[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$user_id]) : array();
}
示例3: array
//.........这里部分代码省略.........
}
if (!empty($row['user_icq'])) {
$user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq'];
$user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />';
} else {
$user_cache[$poster_id]['icq_status_img'] = '';
$user_cache[$poster_id]['icq'] = '';
}
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 {
$diff = $diff < 0 ? 1 : 0;
}
$user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff);
}
}
}
$user_cache[$poster_id]['post_author_full'] = get_username_string($display_user_link_key, $poster_id, $row['username'], $row['user_colour'], $row['post_username']);
$user_cache[$poster_id]['post_author_colour'] = get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']);
$user_cache[$poster_id]['post_author'] = get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']);
$user_cache[$poster_id]['u_post_author'] = $display_user_link ? get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']) : '';
}
}
$db->sql_freeresult($result);
// Load custom profile fields
if ($display_user_info && $config['load_cpf_viewtopic']) {
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $id_cache);
}
// Generate online information for user
if (@$master->call['display_online'] && sizeof($id_cache)) {
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
$update_time = $config['load_online_time'] * 60;
while ($row = $db->sql_fetchrow($result)) {
$user_cache[$row['session_user_id']]['online'] = time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
}
$db->sql_freeresult($result);
}
unset($id_cache);
// Instantiate BBCode
if (empty($bbcode)) {
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
} else {
$bbcode->bbcode(base64_encode($bbcode_bitfield));
}
$prev_post_id = '';
// Parse messages
foreach ($forum_ids as $topic_id => $forum_id) {
if (!isset($post_datas[$forum_id][$topic_id])) {
continue;
}
$row =& $post_datas[$forum_id][$topic_id];
$topic_data =& $topic_datas[$forum_id][$topic_id];
$poster_id = (int) $row['user_id'];
$l_edited_by = $l_bumped_by = '';
$s_first_unread = false;
示例4: array
}
}
}
$db->sql_freeresult($result);
// Load custom profile fields
if ($config['load_cpf_viewtopic'])
{
if (!class_exists('custom_profile'))
{
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
}
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache);
// filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs.
$profile_fields_cache = array();
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields)
{
$profile_fields_cache[$profile_user_id] = array();
foreach ($profile_fields as $used_ident => $profile_field)
{
if ($profile_field['data']['field_show_on_vt'])
{
$profile_fields_cache[$profile_user_id][$used_ident] = $profile_field;
}
}
}
unset($profile_fields_tmp);
示例5: array
}
$member['user_sig'] = smiley_text($member['user_sig']);
}
$poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
$template->assign_vars($karmamod->show_profile($member));
// Custom Profile Fields
$profile_fields = array();
if ($config['load_cpf_viewprofile'])
{
include_once($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
$cp = new custom_profile();
$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
$profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
}
$template->assign_vars(array(
'POSTS_DAY' => sprintf($user->lang['POST_DAY'], $posts_per_day),
'POSTS_PCT' => sprintf($user->lang['POST_PCT'], $percentage),
'OCCUPATION' => (!empty($member['user_occ'])) ? censor_text($member['user_occ']) : '',
'INTERESTS' => (!empty($member['user_interests'])) ? censor_text($member['user_interests']) : '',
'SIGNATURE' => $member['user_sig'],
'AVATAR_IMG' => $poster_avatar,
'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']),
'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']),
'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']),
示例6: get_user_data
/**
* Get user data
*
* grabs the data on the user and places it in the self::$user array
*
* @param int|bool $id The user_id (or multiple user_ids if given an array) of the user we want to grab the data for
* @param bool $user_queue If user_queue is true then we just grab the user_ids from the user_queue, otherwise we select data from $id.
*/
public function get_user_data($id, $user_queue = false, $username = false)
{
global $user, $db, $phpbb_root_path, $phpEx, $config, $auth, $cp;
// if we are using the user_queue, set $user_id as that for consistency
if ($user_queue) {
$id = self::$user_queue;
}
blog_plugins::plugin_do('user_data_start');
// this holds the user_id's we will query
$users_to_query = array();
// if the $user_id isn't an array, make it one for consistency
if (!is_array($id)) {
$id = array(intval($id));
}
if ($username) {
$sql = 'SELECT user_id FROM ' . USERS_TABLE . ' WHERE username_clean = \'' . $db->sql_escape(utf8_clean_string($username)) . '\'';
$result = $db->sql_query($sql);
$id[] = $db->sql_fetchfield('user_id', $result);
$db->sql_freeresult($result);
}
if (!sizeof($id)) {
return;
}
$id[] = 1;
foreach ($id as $i) {
if ($i && !isset(self::$user[$i]) && !in_array($i, $users_to_query)) {
$users_to_query[] = (int) $i;
}
}
if (!sizeof($users_to_query)) {
return;
}
// Grab all profile fields from users in id cache for later use - similar to the poster cache
if ($config['user_blog_custom_profile_enable']) {
if (!class_exists('custom_profile')) {
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
}
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $users_to_query);
}
// Grab user status information
$status_data = array();
$sql = 'SELECT session_user_id, MAX(session_time) AS online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
WHERE ' . $db->sql_in_set('session_user_id', $users_to_query) . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$status_data[$row['session_user_id']] = $row;
}
$db->sql_freeresult($result);
$update_time = $config['load_online_time'] * 60;
// Get the rest of the data on the users and parse everything we need
$sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('user_id', $users_to_query);
blog_plugins::plugin_do_ref('user_data_sql', $sql);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$user_id = $row['user_id'];
blog_plugins::plugin_do_ref('user_data_while', $row);
// view profile link
$row['view_profile'] = append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=viewprofile&u=" . $user_id);
// Full username, with colour
$row['username_full'] = get_username_string('full', $user_id, $row['username'], $row['user_colour']);
// format the color correctly
$row['user_colour'] = get_username_string('colour', $user_id, $row['username'], $row['user_colour']);
// Avatar
$row['avatar'] = get_user_avatar($row['user_avatar'], $row['user_avatar_type'], $row['user_avatar_width'], $row['user_avatar_height']);
// Rank
get_user_rank($row['user_rank'], $row['user_posts'], $row['rank_title'], $row['rank_img'], $row['rank_img_src']);
if ($row['user_type'] != USER_IGNORE && $row['user_id'] != ANONYMOUS) {
// Online/Offline Status
$row['status'] = isset($status_data[$user_id]) && time() - $update_time < $status_data[$user_id]['online_time'] && ($status_data[$user_id]['viewonline'] && $row['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
// IM Links
$row['aim_url'] = $row['user_aim'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=aim&u={$user_id}") : '';
$row['icq_url'] = $row['user_icq'] ? 'http://www.icq.com/people/webmsg.php?to=' . $row['user_icq'] : '';
$row['jabber_url'] = $row['user_jabber'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=jabber&u={$user_id}") : '';
$row['msn_url'] = $row['user_msnm'] ? append_sid("{$phpbb_root_path}memberlist.{$phpEx}", "mode=contact&action=msnm&u={$user_id}") : '';
$row['yim_url'] = $row['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg' : '';
// PM and email links
$row['email_url'] = $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') ? '' : 'mailto:' . $row['user_email']);
$row['pm_url'] = $row['user_id'] != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", "i=pm&mode=compose&u={$user_id}") : '';
// get the custom profile fields if the admin wants them
if ($config['user_blog_custom_profile_enable']) {
$row['cp_row'] = isset($profile_fields_cache[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$user_id]) : array();
}
} else {
$row = array_merge($row, array('status' => false, 'aim_url' => '', 'icq_url' => '', 'jabber_url' => '', 'msn_url' => '', 'yim_url' => '', 'email_url' => '', 'pm_url' => ''));
}
// now lets put everything in the user array
self::$user[$user_id] = $row;
}
$db->sql_freeresult($result);
//.........这里部分代码省略.........
示例7: get_user_info_func
//.........这里部分代码省略.........
$member['user_sig'] = censor_text($member['user_sig']);
if ($member['user_sig_bbcode_bitfield']) {
include_once $phpbb_root_path . 'includes/bbcode.' . $phpEx;
$bbcode = new bbcode();
$bbcode->bbcode_second_pass($member['user_sig'], $member['user_sig_bbcode_uid'], $member['user_sig_bbcode_bitfield']);
}
$member['user_sig'] = bbcode_nl2br($member['user_sig']);
$member['user_sig'] = smiley_text($member['user_sig']);
}
$poster_avatar = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
// We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links
$zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false;
// Only check if the user is logged in
if ($user->data['is_registered']) {
if (!class_exists('p_master')) {
include $phpbb_root_path . 'includes/functions_module.' . $phpEx;
}
$module = new p_master();
$module->list_modules('ucp');
$module->list_modules('mcp');
$user_notes_enabled = $module->loaded('notes', 'user_notes') ? true : false;
$warn_user_enabled = $module->loaded('warn', 'warn_user') ? true : false;
$zebra_enabled = $module->loaded('zebra') ? true : false;
$friends_enabled = $module->loaded('zebra', 'friends') ? true : false;
$foes_enabled = $module->loaded('zebra', 'foes') ? true : false;
unset($module);
}
$template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled));
// Custom Profile Fields
$profile_fields = array();
if ($config['load_cpf_viewprofile']) {
include_once $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
$cp = new custom_profile();
$profile_fields = $cp->generate_profile_fields_template('grab', $user_id);
$profile_fields = isset($profile_fields[$user_id]) ? $cp->generate_profile_fields_template('show', false, $profile_fields[$user_id]) : array();
}
// If the user has m_approve permission or a_user permission, then list then display unapproved posts
if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) {
$sql = 'SELECT COUNT(post_id) as posts_in_queue
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $user_id . '
AND post_approved = 0';
$result = $db->sql_query($sql);
$member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue');
$db->sql_freeresult($result);
} else {
$member['posts_in_queue'] = 0;
}
$template->assign_vars(array('OCCUPATION' => !empty($member['user_occ']) ? censor_text($member['user_occ']) : '', 'INTERESTS' => !empty($member['user_interests']) ? censor_text($member['user_interests']) : '', 'SIGNATURE' => $member['user_sig'], 'POSTS_IN_QUEUE' => $member['posts_in_queue'], 'AVATAR_IMG' => $poster_avatar, 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), 'WWW_IMG' => $user->img('icon_contact_www', $user->lang['WWW']), 'ICQ_IMG' => $user->img('icon_contact_icq', $user->lang['ICQ']), 'AIM_IMG' => $user->img('icon_contact_aim', $user->lang['AIM']), 'MSN_IMG' => $user->img('icon_contact_msnm', $user->lang['MSNM']), 'YIM_IMG' => $user->img('icon_contact_yahoo', $user->lang['YIM']), 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), 'S_PROFILE_ACTION' => append_sid("{$phpbb_root_path}memberlist.{$phpEx}", 'mode=group'), 'S_GROUP_OPTIONS' => $group_options, 'S_CUSTOM_FIELDS' => isset($profile_fields['row']) && sizeof($profile_fields['row']) ? true : false, 'U_USER_ADMIN' => $auth->acl_get('a_user') ? append_sid("{$phpbb_root_path}adm/index.{$phpEx}", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', 'U_USER_BAN' => $auth->acl_get('m_ban') && $user_id != $user->data['user_id'] ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '', 'U_MCP_QUEUE' => $auth->acl_getf_global('m_approve') ? append_sid("{$phpbb_root_path}mcp.{$phpEx}", 'i=queue', true, $user->session_id) : '', 'S_USER_NOTES' => $user_notes_enabled ? true : false, 'S_WARN_USER' => $warn_user_enabled ? true : false, 'S_ZEBRA' => $user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled ? true : false, 'U_ADD_FRIEND' => !$friend && !$foe && $friends_enabled ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', 'U_ADD_FOE' => !$friend && !$foe && $foes_enabled ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', 'U_REMOVE_FRIEND' => $friend && $friends_enabled ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=zebra&remove=1&usernames[]=' . $user_id) : '', 'U_REMOVE_FOE' => $foe && $foes_enabled ? append_sid("{$phpbb_root_path}ucp.{$phpEx}", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : ''));
if (!empty($profile_fields['row'])) {
$template->assign_vars($profile_fields['row']);
}
if (!empty($profile_fields['blockrow'])) {
foreach ($profile_fields['blockrow'] as $field_data) {
$template->assign_block_vars('custom_fields', $field_data);
}
}
// Inactive reason/account?
if ($member['user_type'] == USER_INACTIVE) {
$user->add_lang('acp/common');
$inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN'];
switch ($member['user_inactive_reason']) {
case INACTIVE_REGISTER:
$inactive_reason = $user->lang['INACTIVE_REASON_REGISTER'];
break;
case INACTIVE_PROFILE:
示例8: array
AND c.ad_id = ' . $ad_id;
$result = $db->sql_query_limit($sql, 1);
$report = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$template->assign_vars(array('REPORTER' => get_username_string('full', $report['user_id'], $report['username'], $report['user_colour']), 'REPORT_TEXT' => $report['report_text']));
}
$allow_bbcode = $allow_urls = $allow_smilies = true;
$row['bbcode_options'] = ($allow_bbcode ? OPTION_FLAG_BBCODE : 0) + ($allow_smilies ? OPTION_FLAG_SMILIES : 0) + ($allow_urls ? OPTION_FLAG_LINKS : 0);
$description = generate_text_for_display($row['ad_description'], $row['bbcode_uid'], $row['bbcode_bitfield'], $row['bbcode_options']);
// Load custom profile fields
if (!class_exists('custom_profile')) {
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
}
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use
$profile_fields_tmp = $cp->generate_profile_fields_template('grab', $row['ad_poster_id']);
// filter out fields not to be displayed on classifieds
$profile_fields_cache = array();
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) {
$profile_fields_cache[$profile_user_id] = array();
foreach ($profile_fields as $used_ident => $profile_field) {
if ($profile_field['data']['field_show_on_cl']) {
$profile_fields_cache[$profile_user_id][$used_ident] = $profile_field;
}
}
}
unset($profile_fields_tmp);
$cp_row = array();
$cp_row = isset($profile_fields_cache[$row['ad_poster_id']]) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$row['ad_poster_id']]) : array();
if ($row['ad_status'] == 0) {
$ad_status = $row['ad_expire'] > time() ? false : $user->lang['CL_EXPIRED'];
示例9: display_topic
/**
* Display topic section for support/tracker/etc
*
* @param object $topic The topic object
* @param titania_sort $sort The sort object (includes/tools/sort.php)
*/
public static function display_topic($topic, $sort = false)
{
if ($sort === false) {
// Setup the sort tool
$sort = self::build_sort();
}
$sort->request();
$sql_ary = array('SELECT' => 'p.*', 'FROM' => array(TITANIA_POSTS_TABLE => 'p'), 'WHERE' => 'p.topic_id = ' . (int) $topic->topic_id . self::sql_permissions('p.'), 'ORDER_BY' => $sort->get_order_by());
// Main SQL Query
$sql = phpbb::$db->sql_build_query('SELECT', $sql_ary);
// Handle pagination
if (!$sort->sql_count($sql_ary, 'p.post_id')) {
// No results...no need to query more...
return;
}
$sort->build_pagination($topic->get_url());
// Get the data
$post_ids = $user_ids = array();
$last_post_time = 0;
// tracking
$result = phpbb::$db->sql_query_limit($sql, $sort->limit, $sort->start);
while ($row = phpbb::$db->sql_fetchrow($result)) {
self::$posts[$row['post_id']] = $row;
self::$posts[$row['post_id']]['attachments'] = array();
$post_ids[] = $row['post_id'];
$user_ids[] = $row['post_user_id'];
$user_ids[] = $row['post_edit_user'];
$user_ids[] = $row['post_delete_user'];
$last_post_time = $row['post_time'];
// to set tracking
}
phpbb::$db->sql_freeresult($result);
// Grab the tracking data
$last_mark_time = titania_tracking::get_track(TITANIA_TOPIC, $topic->topic_id);
// Store tracking data
titania_tracking::track(TITANIA_TOPIC, $topic->topic_id, $last_post_time);
// load the user data
users_overlord::load($user_ids);
phpbb::_include('functions_profile_fields', false, 'custom_profile');
$cp = new custom_profile();
$post = new titania_post($topic->topic_type, $topic);
$attachments = new titania_attachment($topic->topic_type, false);
// Grab all attachments
$attachments_set = $attachments->load_attachments_set($post_ids);
// Loop de loop
$prev_post_time = 0;
foreach ($post_ids as $post_id) {
$post->__set_array(self::$posts[$post_id]);
$attachments->clear_attachments();
if (isset($attachments_set[$post_id])) {
$attachments->store_attachments($attachments_set[$post_id]);
}
// Parse attachments before outputting the message
$message = $post->generate_text_for_display();
$parsed_attachments = $attachments->parse_attachments($message);
// Prepare message text for use in javascript
$message_decoded = censor_text($post->post_text);
titania_decode_message($message_decoded, $post->post_text_uid);
$message_decoded = bbcode_nl2br($message_decoded);
// Build CP Fields
$cp_row = array();
if (isset(users_overlord::$cp_fields[$post->post_user_id])) {
$cp_row = $cp->generate_profile_fields_template('show', false, users_overlord::$cp_fields[$post->post_user_id]);
}
$cp_row['row'] = isset($cp_row['row']) && sizeof($cp_row['row']) ? $cp_row['row'] : array();
// Display edit info
$display_username = get_username_string('full', $post->post_user_id, users_overlord::get_user($post->post_user_id, 'username'), users_overlord::get_user($post->post_user_id, 'user_colour'), false, phpbb::append_sid('memberlist', 'mode=viewprofile'));
$l_edited_by = $post->post_edit_time ? sprintf(phpbb::$user->lang['EDITED_MESSAGE'], $display_username, phpbb::$user->format_date($post->post_edit_time)) : '';
phpbb::$template->assign_block_vars('posts', array_merge($post->assign_details(false), users_overlord::assign_details($post->post_user_id), $cp_row['row'], array('POST_TEXT' => $message, 'POST_TEXT_DECODED' => $message_decoded, 'EDITED_MESSAGE' => $l_edited_by, 'U_MINI_POST' => titania_url::append_url($topic->get_url(), array('p' => $post_id, '#p' => $post_id)), 'MINI_POST_IMG' => $post->post_time > $last_mark_time ? phpbb::$user->img('icon_post_target_unread', 'NEW_POST') : phpbb::$user->img('icon_post_target', 'POST'), 'S_FIRST_UNREAD' => $post->post_time > $last_mark_time && $prev_post_time <= $last_mark_time ? true : false)));
// Output CP Fields
if (!empty($cp_row['blockrow'])) {
foreach ($cp_row['blockrow'] as $field_data) {
phpbb::$template->assign_block_vars('posts.custom_fields', $field_data);
}
}
//S_IGNORE_POST
//POST_ICON_IMG
//MINI_POST_IMG
foreach ($parsed_attachments as $attachment) {
phpbb::$template->assign_block_vars('posts.attachment', array('DISPLAY_ATTACHMENT' => $attachment));
}
$prev_post_time = $post->post_time;
}
unset($post, $attachments);
// Increment the topic view count
$sql = 'UPDATE ' . TITANIA_TOPICS_TABLE . '
SET topic_views = topic_views + 1
WHERE topic_id = ' . (int) $topic->topic_id;
phpbb::$db->sql_query($sql);
}
示例10: main
//.........这里部分代码省略.........
{
$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']);
}
if ($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
{
$diff = ($diff < 0) ? 1 : 0;
}
$user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff);
}
}
}
$db->sql_freeresult($result);
// Load custom profile fields
if ($config['load_cpf_viewtopic'])
{
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_cache = $cp->generate_profile_fields_template('grab', $id_cache);
}
// Generate online information for user
if ($config['load_onlinetrack'] && sizeof($id_cache))
{
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
$update_time = $config['load_online_time'] * 60;
while ($row = $db->sql_fetchrow($result))
{
$user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false;
}
$db->sql_freeresult($result);
}
unset($id_cache);
$cp_row = array();
foreach ($message_cache as $post_id => $row)
{
$poster_id = $row['user_id'];
//
if ($config['load_cpf_viewtopic'])
{
$cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template('show', false, $profile_fields_cache[$poster_id]) : array();
}
示例11: display
//.........这里部分代码省略.........
} else {
$user_cache[$poster_id]['email'] = '';
}
if (!empty($row['user_icq'])) {
$user_cache[$poster_id]['icq'] = 'http://www.icq.com/people/' . $row['user_icq'] . '/';
$user_cache[$poster_id]['icq_status_img'] = '<img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" alt="" />';
} else {
$user_cache[$poster_id]['icq_status_img'] = '';
$user_cache[$poster_id]['icq'] = '';
}
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 {
$diff = $diff < 0 ? 1 : 0;
}
$user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff);
}
}
}
}
}
$db->sql_freeresult($result);
// Load custom profile fields
if ($config['load_cpf_viewtopic']) {
if (!class_exists('custom_profile')) {
include $phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx;
}
$cp = new custom_profile();
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache);
// filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs.
$profile_fields_cache = array();
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) {
$profile_fields_cache[$profile_user_id] = array();
foreach ($profile_fields as $used_ident => $profile_field) {
if ($profile_field['data']['field_show_on_vt']) {
$profile_fields_cache[$profile_user_id][$used_ident] = $profile_field;
}
}
}
unset($profile_fields_tmp);
}
// Generate online information for user
if ($config['load_onlinetrack'] && sizeof($id_cache)) {
$sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline
FROM ' . SESSIONS_TABLE . '
WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . '
GROUP BY session_user_id';
$result = $db->sql_query($sql);
$update_time = $config['load_online_time'] * 60;
while ($row = $db->sql_fetchrow($result)) {
$user_cache[$row['session_user_id']]['online'] = time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline')) ? true : false;
}
$db->sql_freeresult($result);
}
unset($id_cache);
// Instantiate BBCode if need be
if ($bbcode_bitfield !== '') {
if (!class_exists('bbcode')) {
include "{$phpbb_root_path}includes/bbcode.{$phpEx}";
}
$bbcode = new bbcode(base64_encode($bbcode_bitfield));