-
Notifications
You must be signed in to change notification settings - Fork 0
/
adr_battle_community.php
112 lines (94 loc) · 3.61 KB
/
adr_battle_community.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/***************************************************************************
* adr_battle_community.php
* ---------------------
* Version : 1.0.0
* Authors : aUsTiN
* [ ([email protected]) (http://phpbb-amod.com) ]
* Seteo-Bloke
* [ ([email protected]) (http://www.phpbb-adr.com) ]
*
***************************************************************************************/
define('IN_PHPBB', true);
define('IN_ADR_BATTLE', true);
define('IN_ADR_CHARACTER', true);
define('IN_ADR_SHOPS', true);
$phpbb_root_path = './';
include_once($phpbb_root_path . 'extension.inc');
include_once($phpbb_root_path . 'common.'.$phpEx);
$loc = 'battle_community';
$sub_loc = 'adr_battle_community';
//
// Start session management
$userdata = session_pagestart($user_ip, PAGE_ADR);
init_userprefs($userdata);
// End session management
//
$user_id = $userdata['user_id'];
$user_points = $userdata['user_points'];
include_once($phpbb_root_path . 'adr/includes/adr_global.'.$phpEx);
include_once($phpbb_root_path . 'adr/includes/adr_functions_global_chat.'.$phpEx);
// Sorry , only logged users ...
if(!$userdata['session_logged_in']){
$redirect = "adr_battle_community.$phpEx";
$redirect .= (isset($user_id)) ? '&user_id=' . $user_id : '';
header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));
}
// Get the general config
$adr_general = adr_get_general_config();
// Grab template file etc.
adr_template_file('adr_battle_community_body.tpl');
include_once($phpbb_root_path . 'includes/page_header.'.$phpEx);
$mode = ($_POST['mode']) ? $_POST['mode'] : $_POST['mode'];
//
// Get online users [START].
//
$sql = "SELECT u.*, s.session_logged_in, s.session_ip
FROM ". ADR_CHARACTERS_TABLE ." u, ". SESSIONS_TABLE ." s
WHERE u.character_id = s.session_user_id
AND u.character_id <> '$user_id'
AND s.session_time >= ".(time() - 300)."
AND u.character_id > '1'
ORDER BY u.character_name ASC, s.session_ip ASC";
if(!($result = $db->sql_query($sql)))
message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
$userlist_ary = array();
$userlist_visible = array();
$prev_user_id = 0;
$prev_user_ip = '';
$user_count = 1;
while($row = $db->sql_fetchrow($result)){
// User is logged in and therefor not a guest
if($row['session_logged_in']){
// Skip multiple sessions for one user
if($row['character_id'] != $prev_user_id){
$style_color = '';
$user_online_link = '<span class="genmed"><a href="profile.'. $phpEx .'?mode=viewprofile&u='. $row['character_id'] .'" target="_blank">'. $row['character_name'] .'</a></span>';
$user_count = ($user_count + 1);
if($user_count > '10'){
$online_userlist .= "<br />";
$online_userlist .= $user_online_link;
}
else{
$online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;
}
}
$prev_user_id = $row['character_id'];
}
$prev_session_ip = $row['session_ip'];
}
$online_userlist = ($prev_user_id == '0') ? $lang['Adr_community_no_users_online'] : $online_userlist;
//
// Get online users [END]
//
$template->assign_vars(array(
'U_GLOBAL_CHAT' => append_sid("adr_global_chat.$phpEx"),
'U_CHAT_VIEW' => append_sid("adr_battle_community.$phpEx"),
'ONLINE_LIST' => $online_userlist,
'L_COMMUNITY' => $lang['Adr_shoutbox_community'],
'L_ONLINE_LIST' => $lang['Adr_shoubox_online_list']
));
include_once($phpbb_root_path . 'adr/includes/adr_header.'.$phpEx);
$template->pparse('body');
include_once($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>