Added online gamers
authorindvdum (gotoindvdum[at]gmail[dot]com)
Sat, 10 Mar 2012 00:18:56 +0400
changeset 158804e4d3de74
parent 14 88d35b740f20
child 16 d6012dd9347f
Added online gamers
config.php
includes/constants.php
includes/functions.php
language/en/common.php
language/ru/common.php
styles/prosilver/template/index_body.html
     1.1 --- a/config.php	Sat Mar 10 00:11:31 2012 +0400
     1.2 +++ b/config.php	Sat Mar 10 00:18:56 2012 +0400
     1.3 @@ -8,10 +8,13 @@
     1.4  $dbuser = 'phpbb3';
     1.5  $dbpasswd = 'kbyerc4you';
     1.6  $table_prefix = 'phpbb_';
     1.7 +$cubometry_civil_database_scheme = 'cubometry_civil';
     1.8 +$cubometry_wild_database_scheme = 'cubometry_wild';
     1.9 +$cubometry_test_database_scheme = 'cubometry_test';
    1.10  $acm_type = 'file';
    1.11  $load_extensions = '';
    1.12  
    1.13  @define('PHPBB_INSTALLED', true);
    1.14  // @define('DEBUG', true);
    1.15  // @define('DEBUG_EXTRA', true);
    1.16 -?>
    1.17 \ No newline at end of file
    1.18 +?>
     2.1 --- a/includes/constants.php	Sat Mar 10 00:11:31 2012 +0400
     2.2 +++ b/includes/constants.php	Sat Mar 10 00:18:56 2012 +0400
     2.3 @@ -278,5 +278,8 @@
     2.4  
     2.5  // Additional tables
     2.6  
     2.7 +define('CUBOMETRY_CIVIL_USERS_ONLINE',				$cubometry_civil_database_scheme . '.cubometry_users_online');
     2.8 +define('CUBOMETRY_WILD_USERS_ONLINE',				$cubometry_wild_database_scheme . '.cubometry_users_online');
     2.9 +define('CUBOMETRY_TEST_USERS_ONLINE',				$cubometry_test_database_scheme . '.cubometry_users_online');
    2.10  
    2.11  ?>
     3.1 --- a/includes/functions.php	Sat Mar 10 00:11:31 2012 +0400
     3.2 +++ b/includes/functions.php	Sat Mar 10 00:18:56 2012 +0400
     3.3 @@ -4126,6 +4126,62 @@
     3.4  	return $online_users;
     3.5  }
     3.6  
     3.7 +function obtain_civil_server_users_online_string()
     3.8 +{
     3.9 +	return obtain_game_server_users_online_string('CIVIL', CUBOMETRY_CIVIL_USERS_ONLINE);
    3.10 +}
    3.11 +
    3.12 +function obtain_wild_server_users_online_string()
    3.13 +{
    3.14 +	return obtain_game_server_users_online_string('WILD', CUBOMETRY_WILD_USERS_ONLINE);
    3.15 +}
    3.16 +
    3.17 +function obtain_test_server_users_online_string()
    3.18 +{
    3.19 +	return obtain_game_server_users_online_string('TEST', CUBOMETRY_TEST_USERS_ONLINE);
    3.20 +}
    3.21 +
    3.22 +function obtain_game_server_users_online_string($lang_server_type, $cubometry_users_online_table)
    3.23 +{
    3.24 +	global $db, $user, $auth;
    3.25 +	
    3.26 +	$online_game_users = $user->lang['GAME_' . $lang_server_type . '_SERVER'] . ': <strong>';
    3.27 +	$cnt = 0;
    3.28 +		
    3.29 +	$sql = 'select count(*) as cnt from ' . $cubometry_users_online_table;
    3.30 +	$result = $db->sql_query($sql);
    3.31 +
    3.32 +	while ($row = $db->sql_fetchrow($result))
    3.33 +	{
    3.34 +		$cnt = $row['cnt'];
    3.35 +	}
    3.36 +	
    3.37 +	$online_game_users .= $cnt . '</strong>';
    3.38 +	if($cnt != 0)
    3.39 +	{
    3.40 +		$online_game_users .= ' (';
    3.41 +		
    3.42 +		$sql = 'select pu.* from ' . $cubometry_users_online_table . ' uo inner join ' . USERS_TABLE . ' pu on pu.user_id = uo.user_id order by username_clean asc';
    3.43 +		$result = $db->sql_query($sql);
    3.44 +		$isFirst = true;
    3.45 +	
    3.46 +		while ($row = $db->sql_fetchrow($result))
    3.47 +		{
    3.48 +			if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline'))
    3.49 +			{
    3.50 +				if(!$isFirst)
    3.51 +					$online_game_users .= ', ';
    3.52 +				$user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);
    3.53 +				$online_game_users .= $user_online_link;
    3.54 +				$isFirst = false;
    3.55 +			}
    3.56 +		}
    3.57 +		$online_game_users .= ')';
    3.58 +	}
    3.59 +	
    3.60 +	return $online_game_users;
    3.61 +}
    3.62 +
    3.63  /**
    3.64  * Uses the result of obtain_users_online to generate a localized, readable representation.
    3.65  * @param mixed $online_users result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics
    3.66 @@ -4431,6 +4487,9 @@
    3.67  
    3.68  	// Get users online list ... if required
    3.69  	$l_online_users = $online_userlist = $l_online_record = $l_online_time = '';
    3.70 +	$online_civil_server = '';
    3.71 +	$online_wild_server = '';
    3.72 +	$online_test_server = '';
    3.73  
    3.74  	if ($config['load_online'] && $config['load_online_time'] && $display_online_list)
    3.75  	{
    3.76 @@ -4457,6 +4516,10 @@
    3.77  
    3.78  		$l_online_time = ($config['load_online_time'] == 1) ? 'VIEW_ONLINE_TIME' : 'VIEW_ONLINE_TIMES';
    3.79  		$l_online_time = sprintf($user->lang[$l_online_time], $config['load_online_time']);
    3.80 +		
    3.81 +		$online_civil_server = obtain_civil_server_users_online_string(); 
    3.82 +		$online_wild_server = obtain_wild_server_users_online_string(); 
    3.83 +		$online_test_server = obtain_test_server_users_online_string(); 
    3.84  	}
    3.85  
    3.86  	$l_privmsgs_text = $l_privmsgs_text_unread = '';
    3.87 @@ -4556,6 +4619,9 @@
    3.88  		'TOTAL_USERS_ONLINE'			=> $l_online_users,
    3.89  		'LOGGED_IN_USER_LIST'			=> $online_userlist,
    3.90  		'RECORD_USERS'					=> $l_online_record,
    3.91 +		'LOGGED_IN_CIVIL_SERVER'		=> $online_civil_server,
    3.92 +		'LOGGED_IN_WILD_SERVER'			=> $online_wild_server,
    3.93 +		'LOGGED_IN_TEST_SERVER'			=> $online_test_server,
    3.94  		'PRIVATE_MESSAGE_INFO'			=> $l_privmsgs_text,
    3.95  		'PRIVATE_MESSAGE_INFO_UNREAD'	=> $l_privmsgs_text_unread,
    3.96  
     4.1 --- a/language/en/common.php	Sat Mar 10 00:11:31 2012 +0400
     4.2 +++ b/language/en/common.php	Sat Mar 10 00:18:56 2012 +0400
     4.3 @@ -229,6 +229,10 @@
     4.4  	'FTP_USERNAME'				=> 'FTP username',
     4.5  	'FTP_USERNAME_EXPLAIN'		=> 'Username used to connect to your server.',
     4.6  
     4.7 +	'GAME_WHO_IS_ONLINE'		=> 'Who is game online',
     4.8 +	'GAME_CIVIL_SERVER'			=> 'Standard server',
     4.9 +	'GAME_WILD_SERVER'			=> 'Wild server',
    4.10 +	'GAME_TEST_SERVER'			=> 'Test server',
    4.11  	'GENERAL_ERROR'				=> 'General Error',
    4.12  	'GB'						=> 'GB',
    4.13  	'GIB'						=> 'GiB',
     5.1 --- a/language/ru/common.php	Sat Mar 10 00:11:31 2012 +0400
     5.2 +++ b/language/ru/common.php	Sat Mar 10 00:18:56 2012 +0400
     5.3 @@ -229,6 +229,10 @@
     5.4  	'FTP_USERNAME'				=> 'Имя пользователя FTP',
     5.5  	'FTP_USERNAME_EXPLAIN'		=> 'Имя пользователя для соединения с FTP-сервером.',
     5.6  
     5.7 +	'GAME_WHO_IS_ONLINE'		=> 'Кто сейчас в игре',
     5.8 +	'GAME_CIVIL_SERVER'			=> 'Стандартный сервер',
     5.9 +	'GAME_WILD_SERVER'			=> 'Дикий сервер',
    5.10 +	'GAME_TEST_SERVER'			=> 'Тестовый сервер',
    5.11  	'GENERAL_ERROR'				=> 'Общая ошибка',
    5.12  	'GB'						=> 'ГБ',
    5.13  	'GIB'						=> 'ГБ',
     6.1 --- a/styles/prosilver/template/index_body.html	Sat Mar 10 00:11:31 2012 +0400
     6.2 +++ b/styles/prosilver/template/index_body.html	Sat Mar 10 00:18:56 2012 +0400
     6.3 @@ -30,6 +30,11 @@
     6.4  <!-- ENDIF -->
     6.5  
     6.6  <!-- IF S_DISPLAY_ONLINE_LIST -->
     6.7 +	<h3>{L_GAME_WHO_IS_ONLINE}</h3>
     6.8 +	<p>{LOGGED_IN_CIVIL_SERVER}</p>
     6.9 +	<p>{LOGGED_IN_WILD_SERVER}</p>
    6.10 +	<p>{LOGGED_IN_TEST_SERVER}</p>
    6.11 +	
    6.12  	<!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF -->
    6.13  	<p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST}
    6.14  	<!-- IF LEGEND --><br /><em>{L_LEGEND}: {LEGEND}</em><!-- ENDIF --></p>