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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
<?php
/***************************************************************************
* page_header.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id$
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
***************************************************************************/
define(HEADER_INC, TRUE);
//
// Parse and show the overall header.
//
$template->set_filenames(array(
"overall_header" => "overall_header.tpl",
"overall_footer" => "overall_footer.tpl"));
//
// Generate logged in/logged out status
//
if($userdata['session_logged_in'])
{
$logged_in_status = $lang['You_are_logged_in'] . " <b>".$userdata["username"]."</b>.";
$logged_in_status .= " [<a href=\"".append_sid("login.$phpEx?submit=logout")."\">".$lang['Logout']."</a>]";
$u_login_logout = "login.$phpEx?submit=logout";
$l_login_logout = $lang['Logout']." : ".$userdata["username"]."";
}
else
{
$logged_in_status = $lang['You_are_not_logged_in'];
$u_login_logout = "login.$phpEx";
$l_login_logout = $lang['Login'];
}
$l_last_visit = $lang['You_last_visit'];
$s_last_visit = create_date($board_config['default_dateformat'], $userdata['session_last_visit'], $board_config['default_timezone']);
//
// Do timezone text output
//
if($board_config['default_timezone'] < 0)
{
$s_timezone = $lang['All_times'] . " " .$lang['GMT'] ." - ".(-$board_config['default_timezone']) . " " . $lang['Hours'];
}
else if($board_config['default_timezone'] == 0)
{
$s_timezone = $lang['All_times'] . " " .$lang['GMT'];
}
else
{
$s_timezone = $lang['All_times'] . " " .$lang['GMT'] ." + ".$board_config['default_timezone'] . " " . $lang['Hours'];
}
//
// Get basic (usernames + totals) online
// situation
//
$sql = "SELECT u.username, u.user_id, s.session_logged_in
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".(time() - 300);
$result = $db->sql_query($sql);
if(!$result)
{
error_die(SQL_QUERY, "Couldn't obtain user/online information.", __LINE__, __FILE__);
}
$logged_online = 0;
$guests_online = 0;
while($row = $db->sql_fetchrow($result))
{
if($row['session_logged_in'])
{
$userlist_ary[] = "<a href=\"".append_sid("profile." . $phpEx . "?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . "\">" . $row['username'] . "</a>";
$logged_online++;
}
else
{
$guests_online++;
}
}
$userlist = "";
for($i = 0; $i < $logged_online; $i++)
{
$userlist .= ($i == $logged_online - 1 && $logged_online > 1) ? " and " : "";
$userlist .= $userlist_ary[$i];
$userlist .= ($i < $logged_online - 2) ? ", " : "";
}
$l_r_user_s = ($logged_online == 1) ? $lang['User'] : $lang['Users'];
$l_g_user_s = ($guests_online == 1) ? $lang['User'] : $lang['Users'];
$l_is_are = ($logged_online == 1) ? $lang['is'] : $lang['are'];
$userlist = ($logged_online > 0) ? $lang['Registered'] ." $l_r_user_s: " . $userlist : $lang['Registered'] . " $l_r_user_s: ".$lang['None'];
//
// Obtain number of new private messages
// if user is logged in
//
if($userdata['session_logged_in'])
{
$sql = "SELECT COUNT(pm.privmsgs_type) AS new_messages
FROM " . PRIVMSGS_TABLE . " pm, " . USER_GROUP_TABLE . " ug
WHERE pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
AND ug.group_id = pm.privmsgs_to_groupid
AND ug.user_id = " . $userdata['user_id'];
$result_pm = $db->sql_query($sql);
if(!$result_pm)
{
error_die(SQL_QUERY, "Couldn't obtain user/online information.", __LINE__, __FILE__);
}
if($pm_result = $db->sql_fetchrow($result_pm))
{
$new_messages = $pm_result['new_messages'];
$l_message_new = ($new_messages == 1) ? "message" : "messages";
$l_privmsgs_text = "You have $new_messages new $l_message_new";
}
else
{
$l_privmsgs_text = "You have no new messages";
}
}
else
{
$l_privmsgs_text = "To check your private messages you must login";
}
//
// The following assigns all _common_
// variables that may be used at any point
// in a template. Note that all URL's should
// be wrapped in append_sid, as should all
// S_x_ACTIONS for forms.
//
$template->assign_vars(array(
"SITENAME" => $board_config['sitename'],
"PAGE_TITLE" => $page_title,
"LOGIN_STATUS" => $logged_in_status,
"META_INFO" => $meta_tags,
"TOTAL_USERS_ONLINE" => "$l_There $l_is_are $logged_online $l_Registered $l_r_user_s $l_and $guests_online $l_guest $l_g_user_s $l_online",
"LOGGED_IN_USER_LIST" => $userlist,
"L_USERNAME" => $lang['Username'],
"L_PASSWORD" => $lang['Password'],
"L_LOGIN" => $lang['Login'],
"L_LOG_ME_IN" => $lang['Log_me_in'],
"L_WELCOMETO" => $lang['Welcome_to'],
"L_INDEX" => $lang['Forum_Index'],
"L_REGISTER" => $lang['Register'],
"L_PROFILE" => $lang['Profile'],
"L_SEARCH" => $lang['Search'],
"L_PRIVATEMSGS" => $lang['Private_msgs'],
"L_MEMBERLIST" => $lang['Memberlist'],
"L_FAQ" => $lang['FAQ'],
"L_USERGROUPS" => $lang['Usergroups'],
"L_FORUM" => $lang['Forum'],
"L_TOPICS" => $lang['Topics'],
"L_REPLIES" => $lang['Replies'],
"L_VIEWS" => $lang['Views'],
"L_POSTS" => $lang['Posts'],
"L_LASTPOST" => $lang['Last_Post'],
"L_MODERATOR" => $lang['Moderator'],
"L_MESSAGES" => $lang['Messages'],
"L_POSTEDTOTAL" => $lang['Posted_Total'],
"L_WEHAVE" => $lang['We_have'],
"L_REGUSERS" => $lang['Regedusers'],
"L_NEWESTUSER" => $lang['newestuser'],
"L_BROWSING" => $lang['browsing'],
"L_ARECURRENTLY" => $lang['arecurrently'],
"L_THEFORUMS" => $lang['theforums'],
"L_NONEWPOSTS" => $lang['No_new_posts'],
"L_NEWPOSTS" => $lang['New_posts'],
"L_POSTED" => $lang['Posted'],
"L_JOINED" => $lang['Joined'],
"L_AUTO_LOGIN" => $lang['Log_me_in'],
"L_AUTHOR" => $lang['Author'],
"L_MESSAGE" => $lang['Message'],
"L_BY" => $lang['by'],
"L_LOGIN_LOGOUT" => $l_login_logout,
"L_PRIVATE_MESSAGE_INFO" => $l_privmsgs_text,
"L_LAST_VISIT" => $l_last_visit,
"U_INDEX" => append_sid("index.".$phpEx),
"U_REGISTER" => append_sid("profile.".$phpEx."?mode=register"),
"U_PROFILE" => append_sid("profile.".$phpEx."?mode=editprofile"),
"U_PRIVATEMSGS" => append_sid("privmsg.".$phpEx."?mode=inbox"),
"U_SEARCH" => append_sid("search.".$phpEx),
"U_MEMBERLIST" => append_sid("memberlist.".$phpEx),
"U_FAQ" => append_sid("faq.".$phpEx),
"U_VIEWONLINE" => append_sid("viewonline.$phpEx"),
"U_LOGIN_LOGOUT" => append_sid($u_login_logout),
"U_MEMBERSLIST" => append_sid("memberlist.".$phpEx),
"U_GROUP_ADMIN" => append_sid("groupadmin.".$phpEx),
"S_TIMEZONE" => $s_timezone,
"S_LOGIN_ACTION" => append_sid("login.$phpEx"),
"S_JUMPBOX_ACTION" => append_sid("viewforum.$phpEx"),
"S_LAST_VISIT_DATE" => $s_last_visit,
"T_HEAD_STYLESHEET" => $theme['head_stylesheet'],
"T_BODY_BACKGROUND" => $theme['body_background'],
"T_BODY_BGCOLOR" => "#".$theme['body_bgcolor'],
"T_BODY_TEXT" => "#".$theme['body_text'],
"T_BODY_LINK" => "#".$theme['body_link'],
"T_BODY_VLINK" => "#".$theme['body_vlink'],
"T_BODY_ALINK" => "#".$theme['body_alink'],
"T_BODY_HLINK" => "#".$theme['body_hlink'],
"T_TR_COLOR1" => "#".$theme['tr_color1'],
"T_TR_COLOR2" => "#".$theme['tr_color2'],
"T_TR_COLOR3" => "#".$theme['tr_color3'],
"T_TH_COLOR1" => "#".$theme['th_color1'],
"T_TH_COLOR2" => "#".$theme['th_color2'],
"T_TH_COLOR3" => "#".$theme['th_color3'],
"T_TD_COLOR1" => "#".$theme['td_color1'],
"T_TD_COLOR2" => "#".$theme['td_color2'],
"T_TD_COLOR3" => "#".$theme['td_color3'],
"T_FONTFACE1" => $theme['fontface1'],
"T_FONTFACE2" => $theme['fontface2'],
"T_FONTFACE3" => $theme['fontface3'],
"T_FONTSIZE1" => $theme['fontsize1'],
"T_FONTSIZE2" => $theme['fontsize2'],
"T_FONTSIZE3" => $theme['fontsize3'],
"T_FONTCOLOR1" => "#".$theme['fontcolor1'],
"T_FONTCOLOR2" => "#".$theme['fontcolor2'],
"T_FONTCOLOR3" => "#".$theme['fontcolor3'],
"T_IMG1" => $theme['img1'],
"T_IMG2" => $theme['img2'],
"T_IMG3" => $theme['img3'],
"T_IMG4" => $theme['img4'])
);
//
// Login box?
//
if(!$userdata['session_logged_in'])
{
$template->set_filenames(array(
"loginbox" => "loginbox.tpl")
);
$template->assign_var_from_handle("S_LOGINBOX", "loginbox");
}
header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$template->pparse("overall_header");
?>
|