Pagina 1 van 1

Who is Active in Which Forum (Index)

Geplaatst: 23 aug 2005, 01:12
door Diablo Gamer
Diablo Gamer schreef:ik heb een klein foutje in de hack ziten ik heb deze hack op een schoone forum gezet maar toch gaat het fout


Afbeelding

hier is de hele install

Code: Selecteer alles

##########################################################################################
## 
## MOD Titel:    Who is active in which forum - Index
## MOD Version:  1.2.0
## Author:       Acid
##
## Description:  You can see which user is active in which forum.. on index.
##
## Files To Edit:  3
##                 index.php
##                 language/lang_english/lang_main.php
##                 templates/xxx/index_body.tpl
## 
##########################################################################################
## 
## Note: 
## First always make a backup from the files that you're going to edit. 
##
## I´ve just used some codes from page_header.php.
## See optional part at bottom of this file.
##
##########################################################################################
##
## Versions:
## 
## v1.2.0 - rewritten (less queries)
## v1.0.3 - Junior Admins/Supermoderators will be displayed in their own color now
##	  - forgot to delete some code
## v1.0.2 - fixed a typo
## v1.0.1 - just cleaned the code and added optional part
## v1.0.0 - Release
## 
##########################################################################################
# 
#-----[ OPEN ]------------------------------------------ 
#
# index.php 
# 
#-----[ FIND ]------------------------------------------ 
#
		$forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
	}
	$db->sql_freeresult($result);

# 
#-----[ BELOW ADD ]------------------------------------------ 
#
	$sql_active = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_level, s.session_logged_in, s.session_ip, f.forum_id
		          FROM ". USERS_TABLE ." u, ". SESSIONS_TABLE ." s, ". FORUMS_TABLE ." f
		          WHERE u.user_id = s.session_user_id AND s.session_time >= ". (time() - 300) ." AND s.session_page = f.forum_id
		          ORDER BY u.username ASC, s.session_ip ASC";
	if( !($result_active = $db->sql_query($sql_active)) )
	{
		message_die(GENERAL_ERROR, 'could not obtain user/online information.', '', __LINE__, __FILE__, $sql_active);
	}

	$userlist_ary = array();
	$userlist_visible = array();
	$prev_userid = 0;
	$prev_userip = $prev_sessionip = '';
	while( $active = $db->sql_fetchrow($result_active) )
	{
		if( $active['session_logged_in'] )
		{
			if( $active['user_id'] != $prev_userid )
			{
				if( file_exists(@phpbb_realpath($phpbb_root_path .'includes/functions_color_groups.'.$phpEx)) )
				{
					include_once($phpbb_root_path .'includes/functions_color_groups.'.$phpEx);
					$active['username'] = color_group_colorize_name($active['user_id']);
				}
				else
				{

					if( file_exists(@phpbb_realpath($phpbb_root_path .'includes/functions_jr_admin.'.$phpEx)) )
					{
						include_once($phpbb_root_path .'includes/functions_jr_admin.' . $phpEx);
						$jr_admin_userdata = jr_admin_get_user_info($active['user_id']);
					}

					$style_color = '';
					if( $active['user_level'] == ADMIN )
					{
						$active['username'] = '<b>'. $active['username'] .'</b>';
						$style_color = 'style="color:#'. $theme['fontcolor3'] .'"';
					}
					else if( $active['user_id'] == $jr_admin_userdata['user_id'] || $active['user_level'] == LESS_ADMIN )
					{
						$active['username'] = '<b>'. $active['username'] .'</b>';
						$style_color = 'style="color:#FF0000"';
					}
					else if( $active['user_level'] == MOD )
					{
						$active['username'] = '<b>'. $active['username'] .'</b>';
						$style_color = 'style="color:#'. $theme['fontcolor2'] .'"';
					}
				}

				if( $active['user_allow_viewonline'] )
				{
					$onlinerow[$active['forum_id']][] = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL ."=". $active['user_id']) .'" '. $style_color .'>'. $active['username'] .'</a>';
					$logged_visible_active[$active['forum_id']][]++;
				}
				else
				{
					$onlinerow[$active['forum_id']][] = ( $active['user_allow_viewonline'] || $userdata['user_level'] == ADMIN ) ? '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL ."=". $active['user_id']) .'" '. $style_color .'><i>'. $active['username'] .'</i></a>' : '';
					$logged_hidden_active[$active['forum_id']][]++;
				}
			}
			$prev_userid = $active['user_id'];
		}
		else
		{
			if( $active['session_ip'] != $prev_sessionip )
			{
				$guestrow[$active['forum_id']][] = '';
				$guests_active[$active['forum_id']][]++;
			}
		}
		$prev_sessionip = $active['session_ip'];
	}
	$db->sql_freeresult($result_active);

# 
#-----[ FIND ]------------------------------------------ 
#
							$template->assign_block_vars('catrow.forumrow',   array( 
								'ROW_COLOR' => '#' . $row_color,

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
							if( count($onlinerow[$forum_id]) > '0' )
							{
								$users_total_guests = count($guests_active[$forum_id]);
								$l_guests_total = ( $users_total_guests != '0' ) ? (( $users_total_guests == '1' ) ? $lang['Forum_one_guest_active'] : $lang['Forum_more_guests_active']) : '';
							}
							else
							{
								$users_total_guests = '&nbsp;';
								$l_guests_total = '';
							}

							if( count($onlinerow[$forum_id]) > '0' )
							{
								$users_total = count($onlinerow[$forum_id]);
								$users_total_hidden = count($logged_hidden_active[$forum_id]);
								$users_active = implode(', ', $onlinerow[$forum_id]);

								$l_active_total = ( $users_total == '1' ) ? $lang['Forum_one_active'] : $lang['Forum_more_active'];
								$l_hidden_total = ( ($users_total_hidden != '0' ) ? ( $userdata['user_level'] == ADMIN ) ? '' : (( $users_total_hidden == '1' ) ? $lang['Forum_one_hidden_active'] : $lang['Forum_more_hidden_active']) : '');
							}
							else
							{
								$users_total = '&nbsp;';
								$users_total_hidden = '&nbsp;';
								$users_active = '&nbsp;';

								$l_active_total = $lang['Forum_no_active'];
								$l_hidden_total = '';
							}

							$template->assign_block_vars('catrow.forumrow',   array( 
								'ACTIVE' => $users_active,
								'ACTIVE_TOTAL' => sprintf($l_active_total, ($users_total+$users_total_guests)),
								'ACTIVE_INFO' => sprintf($l_hidden_total, $users_total_hidden).sprintf($l_guests_total, $users_total_guests),


# 
#-----[ OPEM ]------------------------------------------ 
#
# language/lang_english/lang_main.php 
# 
#-----[ FIND ]------------------------------------------ 
#
$lang['Moderators'] = 'Moderators';

# 
#-----[ BELOW ADD ]------------------------------------------ 
#
// if you don´t want to display "0 users" uncomment the following line
// and put the slashes before the second line
// $lang['Forum_no_active'] = '';
$lang['Forum_no_active'] = '<b>0</b> Users active'; // <-- this one
$lang['Forum_one_active'] = '<b>%d</b> User active: ';
$lang['Forum_more_active'] = '<b>%d</b> Users active: ';
$lang['Forum_one_hidden_active'] = '<b>%d</b> Hidden';
$lang['Forum_more_hidden_active'] = '<b>%d</b> Hidden';
$lang['Forum_one_guest_active'] = '<b>%d</b> Guest';
$lang['Forum_more_guests_active'] = '<b>%d</b> Guests';


# 
#-----[ OPEN ]------------------------------------------ 
#
# templates/xxx/index_body.tpl 
# 
#-----[ FIND ]------------------------------------------ 
#
  </span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# if you can´t find the mentioned line (maybe you´re using a different template) just
# search for a part of it

  </span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span><br /> 
  <span class="gensmall">{catrow.forumrow.ACTIVE_TOTAL} {catrow.forumrow.ACTIVE} {catrow.forumrow.ACTIVE_INFO}</span></td>

##########################################################################################
# 
#-----[ OPTIONAL PART ]--------------------------------------------- 
#
# if you have the "Junior Admin" or "Supermoderator" mod installed and want to
# change the displayed color
# 
#-----[ FIND (index.php) ]------------------------------------------ 
# 
# replace #FF0000 with the current color

	else if( $active['user_id'] == $jr_admin_userdata['user_id'] || $active['user_level'] == LESS_ADMIN )
	{
		$active['username'] = '<b>'. $active['username'] .'</b>';
		$style_color = 'style="color:#FF0000"';
	}

#
#------------------------------------------------------------------- 
#
# if you want to enable the activities information only for admins
# 
#-----[ FIND (index.php) ]------------------------------------------ 
# 
			if( count($onlinerow[$forum_id]) > '0' )

# 
#-----[ REPLACE WITH ]---------------------------------------------- 
# 
			if( count($onlinerow[$forum_id]) > '0' && $userdata['user_level'] == ADMIN )

#
#------------------------------------------------------------------- 
#
# if you want to enable the current activities information only 
# for the moderators of the current forums
# 
#-----[ FIND (index.php) ]------------------------------------------ 
# 
			if( count($onlinerow[$forum_id]) > '0' )

# 
#-----[ REPLACE WITH ]---------------------------------------------- 
# 
			$is_auth = array();
			$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data);
			if( count($onlinerow[$forum_id]) > '0' && $is_auth['auth_mod'] )

##########################################################################################
##########################################################################################
##########################################################################################

Geplaatst: 23 aug 2005, 16:41
door Bee
Lijkt mij een fout in index_body.tpl