|
From: FlorinCB <ory...@us...> - 2008-08-27 13:43:16
|
Update of /cvsroot/mxbb/core/modules/mx_coreblocks In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26377/mx_coreblocks Modified Files: mx_online.php Log Message: some rewrites Index: mx_online.php =================================================================== RCS file: /cvsroot/mxbb/core/modules/mx_coreblocks/mx_online.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** mx_online.php 11 Feb 2008 22:49:29 -0000 1.26 --- mx_online.php 27 Aug 2008 13:43:10 -0000 1.27 *************** *** 53,57 **** break; case 'phpbb3': ! $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_type, u.user_colour, s.session_autologin, s.session_ip FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s WHERE u.user_id = s.session_user_id --- 53,57 ---- break; case 'phpbb3': ! $sql = "SELECT u.user_id, u.username, u.user_regdate, u.user_birthday, u.user_allow_viewonline, u.user_type, u.user_colour, s.session_autologin, s.session_ip FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s WHERE u.user_id = s.session_user_id *************** *** 81,90 **** { $style_color = ''; ! if (PORTAL_BACKEND == 'phpbb3') ! { ! $style_color = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : ''; ! } ! else { if ( $row['user_level'] == ADMIN ) { --- 81,90 ---- { $style_color = ''; ! ! switch (PORTAL_BACKEND) { + case 'internal': + case 'phpbb2': + if ( $row['user_level'] == ADMIN ) { *************** *** 96,116 **** $row['username'] = '<b>' . $row['username'] . '</b>'; $style_color = 'style="color:#' . $theme['fontcolor2'] . '"'; ! } ! } ! if ( $row['user_allow_viewonline'] || 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 .'>' . $row['username'] . '</a>'; ! $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>'; ! $logged_hidden_online++; } ! else if (PORTAL_BACKEND == 'phpbb3') { ! $user_online_link = ($row['user_type'] != USER_IGNORE) ? mx_get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '<span' . $style_color . '>' . $row['username'] . '</span>'; ! $logged_hidden_online++; } if ( $row['user_allow_viewonline'] || $mx_user->data['user_level'] == ADMIN ) { --- 96,131 ---- $row['username'] = '<b>' . $row['username'] . '</b>'; $style_color = 'style="color:#' . $theme['fontcolor2'] . '"'; ! } ! ! break; ! ! case 'phpbb3': ! $style_color = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : ''; ! ! break; } ! ! switch (PORTAL_BACKEND) { ! case 'internal': ! case '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>'; ! $logged_hidden_online++; ! break; ! ! case 'phpbb3': ! if ($row['user_allow_viewonline']) ! { ! $user_online_link = mx_get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); ! $logged_visible_online++; ! } ! else ! { ! $user_online_link = ($row['user_type'] != USER_IGNORE) ? mx_get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '<span' . $style_color . '>' . $row['username'] . '</span>'; ! $logged_hidden_online++; ! } ! break; } + if ( $row['user_allow_viewonline'] || $mx_user->data['user_level'] == ADMIN ) { *************** *** 118,122 **** } } - $prev_user_id = $row['user_id']; } --- 133,136 ---- *************** *** 261,284 **** $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>'); } --- 275,302 ---- $newest_uid = (PORTAL_BACKEND == 'phpbb3') ? $board_config['newest_user_id'] : $newest_userdata['user_id']; ! ! switch (PORTAL_BACKEND) { ! case 'internal': ! case 'phpbb2': ! 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>'); ! break; ! ! case '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)); ! break; } *************** *** 309,387 **** } ! 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); ! } } --- 327,422 ---- } ! switch (PORTAL_BACKEND) { ! case 'internal': ! case 'phpbb2': ! break; ! case '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); ! break; } ! ! $legend = ''; ! ! switch (PORTAL_BACKEND) { ! case 'internal': ! case 'phpbb2': ! $legend .= (($legend != '') ? ', ' : '') . '[' . sprintf($lang['Admin_online_color'], '<span style="color:#' . $theme['fontcolor3'] . '">', '</span>') . '] [' . sprintf($lang['Mod_online_color'], '<span style="color:#' . $theme['fontcolor2'] . '">', '</span>') . ']'; ! break; ! ! case '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); ! break; } // Generate birthday list if required ... $birthday_list = ''; ! ! switch (PORTAL_BACKEND) { ! case 'internal': ! case 'phpbb2': ! break; ! case '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); } ! break; } |