|
From: OryNider <ory...@us...> - 2008-01-31 05:47:55
|
Update of /cvsroot/mxbb/core/modules/mx_coreblocks In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12150 Modified Files: mx_online.php Log Message: mx_online changes for phpBB2 backend, pls don't drop this again... Index: mx_online.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_coreblocks/mx_online.php,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mx_online.php 9 Jan 2008 01:49:27 -0000 1.23 --- mx_online.php 31 Jan 2008 05:47:47 -0000 1.24 *************** *** 15,18 **** --- 15,23 ---- } + if (PORTAL_BACKEND == 'phpbb3') + { + $mx_user->setup(); + } + // ================================================================================ // The following code is backported from includes/page_header.php (phpBB 2.0.13) *************** *** 98,102 **** $logged_visible_online++; } ! else if (PORTAL_BACKEND == 'internal') { $user_online_link = '<a href="' . mx_append_sid(PHPBB_URL."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>'; --- 103,107 ---- $logged_visible_online++; } ! else if (PORTAL_BACKEND == 'phpbb2') { $user_online_link = '<a href="' . mx_append_sid(PHPBB_URL."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>'; *************** *** 253,258 **** $total_users = phpBB2::get_db_stat('usercount'); $newest_userdata = phpBB2::get_db_stat('newestuser'); ! $newest_user = $newest_userdata['username']; ! $newest_uid = $newest_userdata['user_id']; if( $total_posts == 0 ) --- 258,285 ---- $total_users = phpBB2::get_db_stat('usercount'); $newest_userdata = phpBB2::get_db_stat('newestuser'); ! $newest_username = (PORTAL_BACKEND == 'phpbb3') ? $board_config['newest_username'] : $newest_userdata['username']; ! $newest_uid = (PORTAL_BACKEND == 'phpbb3') ? $board_config['newest_user_id'] : $newest_userdata['user_id']; ! ! if (PORTAL_BACKEND == 'phpbb3') ! { ! $newest_color = $board_config['newest_user_colour']; ! $newest_style_color = ($newest_color) ? ' style="color:#' . $newest_color . '" class="username-coloured"' : ''; ! $newest_user = sprintf($mx_user->lang['NEWEST_USER'], mx_get_username_string('full', $newest_uid, $newest_username, $newest_color)); ! } ! else ! { ! if ( $newest_userdata['user_level'] == ADMIN ) ! { ! $newest_color = $theme['fontcolor3']; ! $newest_username = '<b>' . $newest_username . '</b>'; ! } ! else if ( $newest_userdata['user_level'] == MOD ) ! { ! $newest_color = $theme['fontcolor2']; ! $newest_username = '<b>' . $newest_username . '</b>'; ! } ! $newest_style_color = 'style="color:#' . $newest_color . '"'; ! $newest_user = sprintf($lang['Newest_user'], '<a href="' . mx_append_sid(PHPBB_URL."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '"' . $style_color .'>', $newest_username, '</a>'); ! } if( $total_posts == 0 ) *************** *** 282,285 **** --- 309,389 ---- } + if (PORTAL_BACKEND == 'phpbb3') + { + // Grab group details for legend display + if ($phpbb_auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql = 'SELECT group_id, group_name, group_colour, group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_legend = 1 + ORDER BY group_name ASC'; + } + else + { + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $mx_user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE g.group_legend = 1 + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $mx_user->data['user_id'] . ') + ORDER BY g.group_name ASC'; + } + $result = $db->sql_query($sql); + } + + $legend = ''; + + if (PORTAL_BACKEND == 'phpbb3') + { + while ($row = $db->sql_fetchrow($result)) + { + $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; + + if ($row['group_name'] == 'BOTS') + { + $legend .= (($legend != '') ? ', ' : '') . '<span' . $colour_text . '>' . $mx_user->lang['G_BOTS'] . '</span>'; + } + else + { + $legend .= (($legend != '') ? ', ' : '') . '<a' . $colour_text . ' href="' . mx3_append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $mx_user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>'; + } + } + $db->sql_freeresult($result); + } + else + { + $legend .= (($legend != '') ? ', ' : '') . '[' . sprintf($lang['Admin_online_color'], '<span style="color:#' . $theme['fontcolor3'] . '">', '</span>') . '] [' . sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>') . ']'; + } + + // Generate birthday list if required ... + $birthday_list = ''; + if (PORTAL_BACKEND == 'phpbb3') + { + if ($board_config['load_birthdays'] && $board_config['allow_birthdays']) + { + $now = getdate(time() + $mx_user->timezone + $mx_user->dst - date('Z')); + $sql = 'SELECT user_id, username, user_colour, user_birthday + FROM ' . USERS_TABLE . " + WHERE user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' + AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $birthday_list .= (($birthday_list != '') ? ', ' : '') . mx_get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + + if ($age = (int) substr($row['user_birthday'], -4)) + { + $birthday_list .= ' (' . ($now['year'] - $age) . ')'; + } + } + $db->sql_freeresult($result); + } + } + // ================================================================================ // Send our Who's Online block to the browser *************** *** 302,309 **** 'LOGGED_IN_USER_LIST' => $online_userlist, 'RECORD_USERS' => sprintf($lang['Record_online_users'], $board_config['record_online_users'], phpBB2::create_date($board_config['default_dateformat'], $board_config['record_online_date'], $board_config['board_timezone'])), - 'L_WHO_IS_ONLINE' => $lang['Who_is_Online'], ! 'L_WHOSONLINE_ADMIN' => sprintf($lang['Admin_online_color'], '<span style="color:#' . $theme['fontcolor3'] . '">', '</span>'), ! 'L_WHOSONLINE_MOD' => sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>'), 'L_ONLINE_EXPLAIN' => $lang['Online_explain'], --- 406,413 ---- 'LOGGED_IN_USER_LIST' => $online_userlist, 'RECORD_USERS' => sprintf($lang['Record_online_users'], $board_config['record_online_users'], phpBB2::create_date($board_config['default_dateformat'], $board_config['record_online_date'], $board_config['board_timezone'])), 'L_WHO_IS_ONLINE' => $lang['Who_is_Online'], ! 'ONLINE_LEGEND' => $legend, ! 'L_ONLINE_LEGEND' => !empty($mx_user->lang['LEGEND']) ? $mx_user->lang['LEGEND'] : 'Legend', ! 'ONLINE_BIRTHDAY_LIST' => $birthday_list, 'L_ONLINE_EXPLAIN' => $lang['Online_explain'], *************** *** 316,320 **** 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), ! 'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . mx_append_sid(PHPBB_URL."profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'), )); --- 420,424 ---- 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), ! 'NEWEST_USER' => $newest_user, )); |