2001-02-21 07:38:38 +00:00
|
|
|
<?php
|
2001-04-18 06:26:01 +00:00
|
|
|
/***************************************************************************
|
2001-02-21 07:38:38 +00:00
|
|
|
* page_header.php
|
2001-04-18 06:26:01 +00:00
|
|
|
* -------------------
|
|
|
|
* begin : Saturday, Feb 13, 2001
|
|
|
|
* copyright : (C) 2001 The phpBB Group
|
|
|
|
* email : support@phpbb.com
|
|
|
|
*
|
2001-02-21 07:38:38 +00:00
|
|
|
* $Id$
|
2001-04-18 06:26:01 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
2001-02-21 07:38:38 +00:00
|
|
|
|
2001-08-30 22:20:23 +00:00
|
|
|
/***************************************************************************
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
***************************************************************************/
|
|
|
|
|
2001-04-18 06:26:01 +00:00
|
|
|
define(HEADER_INC, TRUE);
|
2001-03-19 01:35:04 +00:00
|
|
|
|
2001-06-30 21:04:37 +00:00
|
|
|
//
|
|
|
|
// gzip_compression
|
|
|
|
//
|
2001-06-30 23:36:10 +00:00
|
|
|
$do_gzip_compress = FALSE;
|
2001-06-30 21:04:37 +00:00
|
|
|
if($board_config['gzip_compress'])
|
|
|
|
{
|
|
|
|
$phpver = phpversion();
|
|
|
|
|
|
|
|
if($phpver >= "4.0.4pl1")
|
|
|
|
{
|
|
|
|
if(extension_loaded("zlib"))
|
|
|
|
{
|
|
|
|
ob_start("ob_gzhandler");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if($phpver > "4.0")
|
|
|
|
{
|
2001-06-30 23:36:10 +00:00
|
|
|
if(strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip'))
|
2001-08-30 22:20:23 +00:00
|
|
|
{
|
2001-08-09 23:26:03 +00:00
|
|
|
if(extension_loaded("zlib"))
|
|
|
|
{
|
|
|
|
$do_gzip_compress = TRUE;
|
|
|
|
ob_start();
|
2001-08-30 22:20:23 +00:00
|
|
|
ob_implicit_flush(0);
|
2001-08-09 23:26:03 +00:00
|
|
|
|
2001-08-30 22:20:23 +00:00
|
|
|
header("Content-Encoding: gzip");
|
2001-08-09 23:26:03 +00:00
|
|
|
}
|
2001-06-30 23:36:10 +00:00
|
|
|
}
|
2001-06-30 21:04:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-19 22:24:13 +00:00
|
|
|
//
|
2001-04-18 06:26:01 +00:00
|
|
|
// Parse and show the overall header.
|
2001-04-19 22:24:13 +00:00
|
|
|
//
|
|
|
|
$template->set_filenames(array(
|
2001-07-04 22:44:15 +00:00
|
|
|
"overall_header" => "overall_header.tpl")
|
|
|
|
);
|
2001-02-25 04:02:12 +00:00
|
|
|
|
2001-04-19 21:07:47 +00:00
|
|
|
//
|
|
|
|
// Generate logged in/logged out status
|
|
|
|
//
|
2001-03-21 23:25:03 +00:00
|
|
|
if($userdata['session_logged_in'])
|
2001-02-25 04:02:12 +00:00
|
|
|
{
|
2001-04-30 15:21:31 +00:00
|
|
|
$u_login_logout = "login.$phpEx?submit=logout";
|
2001-07-01 15:22:51 +00:00
|
|
|
$l_login_logout = $lang['Logout'] . " : " . $userdata["username"] . "";
|
2001-02-25 04:02:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-04-30 15:21:31 +00:00
|
|
|
$u_login_logout = "login.$phpEx";
|
2001-05-27 20:05:06 +00:00
|
|
|
$l_login_logout = $lang['Login'];
|
2001-02-25 04:02:12 +00:00
|
|
|
}
|
2001-02-27 18:50:36 +00:00
|
|
|
|
2001-06-11 00:11:13 +00:00
|
|
|
$s_last_visit = create_date($board_config['default_dateformat'], $userdata['session_last_visit'], $board_config['default_timezone']);
|
|
|
|
|
2001-04-28 20:14:05 +00:00
|
|
|
//
|
|
|
|
// Get basic (usernames + totals) online
|
|
|
|
// situation
|
|
|
|
//
|
2001-08-30 22:20:23 +00:00
|
|
|
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, s.session_logged_in, s.session_ip
|
2001-06-13 07:35:41 +00:00
|
|
|
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
|
2001-04-28 20:14:05 +00:00
|
|
|
WHERE u.user_id = s.session_user_id
|
2001-07-22 20:42:34 +00:00
|
|
|
AND s.session_time >= ".( time() - 300 );
|
2001-04-28 20:14:05 +00:00
|
|
|
$result = $db->sql_query($sql);
|
|
|
|
if(!$result)
|
|
|
|
{
|
2001-07-04 22:44:15 +00:00
|
|
|
message_die(GENERAL_ERROR, "Couldn't obtain user/online information.", "", __LINE__, __FILE__, $sql);
|
2001-04-28 20:14:05 +00:00
|
|
|
}
|
|
|
|
|
2001-08-09 23:26:03 +00:00
|
|
|
$userlist_ary = array();
|
|
|
|
$userlist_visible = array();
|
2001-07-01 15:22:51 +00:00
|
|
|
$logged_visible_online = 0;
|
|
|
|
$logged_hidden_online = 0;
|
2001-04-28 20:14:05 +00:00
|
|
|
$guests_online = 0;
|
2001-08-09 23:26:03 +00:00
|
|
|
|
2001-06-30 21:04:37 +00:00
|
|
|
while($row = $db->sql_fetchrow($result))
|
2001-04-28 20:14:05 +00:00
|
|
|
{
|
2001-06-30 21:04:37 +00:00
|
|
|
if($row['session_logged_in'])
|
2001-04-28 20:14:05 +00:00
|
|
|
{
|
2001-08-09 23:26:03 +00:00
|
|
|
if($row['user_allow_viewonline'])
|
2001-07-01 15:22:51 +00:00
|
|
|
{
|
2001-08-09 23:26:03 +00:00
|
|
|
$userlist_ary[] = "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . "\">" . $row['username'] . "</a>";
|
|
|
|
$userlist_visible[] = 1;
|
2001-07-01 15:22:51 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-08-09 23:26:03 +00:00
|
|
|
$userlist_ary[] = "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . "\">" . $row['username'] . "</a>";
|
|
|
|
$userlist_visible[] = 0;
|
2001-07-01 15:22:51 +00:00
|
|
|
}
|
2001-04-28 20:14:05 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$guests_online++;
|
|
|
|
}
|
2001-04-28 22:46:00 +00:00
|
|
|
}
|
2001-07-22 20:42:34 +00:00
|
|
|
|
2001-08-09 23:26:03 +00:00
|
|
|
$online_userlist = "";
|
2001-07-22 20:42:34 +00:00
|
|
|
for($i = 0; $i < count($userlist_ary); $i++)
|
2001-04-28 22:46:00 +00:00
|
|
|
{
|
2001-08-10 00:38:59 +00:00
|
|
|
if( !strstr($online_userlist, $userlist_ary[$i]) )
|
2001-07-22 20:42:34 +00:00
|
|
|
{
|
2001-08-09 23:26:03 +00:00
|
|
|
if( $userlist_visible[$i] || $userdata['user_level'] == ADMIN )
|
|
|
|
{
|
|
|
|
$online_userlist .= ($online_userlist != "") ? ", " . $userlist_ary[$i] : $userlist_ary[$i];
|
|
|
|
$logged_visible_online++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$logged_hidden_online++;
|
|
|
|
}
|
2001-07-22 20:42:34 +00:00
|
|
|
}
|
2001-04-28 20:14:05 +00:00
|
|
|
}
|
2001-08-09 23:26:03 +00:00
|
|
|
|
2001-05-28 20:23:16 +00:00
|
|
|
$l_g_user_s = ($guests_online == 1) ? $lang['User'] : $lang['Users'];
|
2001-07-01 15:22:51 +00:00
|
|
|
$l_h_user_s = ($logged_hidden_online == 1) ? $lang['User'] : $lang['Users'];
|
|
|
|
$l_r_user_s = ($logged_visible_online == 1) ? $lang['User'] : $lang['Users'];
|
|
|
|
$l_is_are = ($logged_visible_online == 1) ? $lang['is'] : $lang['are'];
|
2001-08-09 23:26:03 +00:00
|
|
|
$online_userlist = ($logged_visible_online > 0) ? $lang['Registered'] . " $l_r_user_s: " . $online_userlist : $lang['Registered'] . " $l_r_user_s: " . $lang['None'];
|
2001-04-28 20:14:05 +00:00
|
|
|
|
2001-06-11 00:11:13 +00:00
|
|
|
//
|
|
|
|
// Obtain number of new private messages
|
|
|
|
// if user is logged in
|
|
|
|
//
|
|
|
|
if($userdata['session_logged_in'])
|
|
|
|
{
|
2001-08-30 22:20:23 +00:00
|
|
|
$sql = "SELECT COUNT(privmsgs_type) AS new_messages
|
|
|
|
FROM " . PRIVMSGS_TABLE . "
|
|
|
|
WHERE privmsgs_type = " . PRIVMSGS_NEW_MAIL . "
|
2001-06-13 19:42:05 +00:00
|
|
|
AND privmsgs_to_userid = " . $userdata['user_id'];
|
2001-06-11 00:11:13 +00:00
|
|
|
$result_pm = $db->sql_query($sql);
|
|
|
|
if(!$result_pm)
|
|
|
|
{
|
2001-07-04 22:44:15 +00:00
|
|
|
message_die(GENERAL_MESSAGE, "Couldn't obtain user/online information.", "", __LINE__, __FILE__, $sql);
|
2001-06-11 00:11:13 +00:00
|
|
|
}
|
|
|
|
if($pm_result = $db->sql_fetchrow($result_pm))
|
|
|
|
{
|
|
|
|
$new_messages = $pm_result['new_messages'];
|
|
|
|
|
2001-07-20 15:16:03 +00:00
|
|
|
$l_message_new = ($new_messages == 1) ? $lang['message'] : $lang['messages'];
|
|
|
|
$l_privmsgs_text = $lang['You_have'] . " $new_messages " . $lang['new'] . " $l_message_new";
|
2001-06-11 00:11:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-20 15:16:03 +00:00
|
|
|
$l_privmsgs_text = $lang['No_new_pm'];
|
2001-06-11 00:11:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-20 15:16:03 +00:00
|
|
|
$l_privmsgs_text = $lang['Login_check_pm'];
|
2001-06-11 00:11:13 +00:00
|
|
|
}
|
|
|
|
|
2001-05-17 14:48:39 +00:00
|
|
|
//
|
2001-07-17 14:30:08 +00:00
|
|
|
// 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.
|
2001-06-13 07:35:41 +00:00
|
|
|
//
|
2001-04-19 21:07:47 +00:00
|
|
|
$template->assign_vars(array(
|
2001-05-03 22:10:23 +00:00
|
|
|
"SITENAME" => $board_config['sitename'],
|
2001-05-17 14:48:39 +00:00
|
|
|
"PAGE_TITLE" => $page_title,
|
|
|
|
"META_INFO" => $meta_tags,
|
2001-07-20 15:16:03 +00:00
|
|
|
"TOTAL_USERS_ONLINE" => $lang['There'] . " $l_is_are $logged_visible_online " . $lang['Registered'] . " $l_r_user_s, $logged_hidden_online " . $lang['Hidden'] . " $l_h_user_s ". $lang['and'] . " $guests_online " . $lang['Guest'] . " $l_g_user_s " . $lang['online'],
|
2001-08-09 23:26:03 +00:00
|
|
|
"LOGGED_IN_USER_LIST" => $online_userlist,
|
2001-07-31 14:06:06 +00:00
|
|
|
"PRIVATE_MESSAGE_INFO" => $l_privmsgs_text,
|
|
|
|
"LAST_VISIT_DATE" => $s_last_visit,
|
2001-04-19 22:24:13 +00:00
|
|
|
|
2001-05-28 20:23:16 +00:00
|
|
|
"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'],
|
2001-08-30 22:20:23 +00:00
|
|
|
"L_WHO_IS_ONLINE" => $lang['Who_is_Online'],
|
2001-05-28 20:23:16 +00:00
|
|
|
"L_MEMBERLIST" => $lang['Memberlist'],
|
2001-06-13 07:35:41 +00:00
|
|
|
"L_FAQ" => $lang['FAQ'],
|
|
|
|
"L_USERGROUPS" => $lang['Usergroups'],
|
2001-05-28 20:23:16 +00:00
|
|
|
"L_FORUM" => $lang['Forum'],
|
2001-06-13 07:35:41 +00:00
|
|
|
"L_TOPICS" => $lang['Topics'],
|
2001-05-28 20:23:16 +00:00
|
|
|
"L_REPLIES" => $lang['Replies'],
|
|
|
|
"L_VIEWS" => $lang['Views'],
|
|
|
|
"L_POSTS" => $lang['Posts'],
|
|
|
|
"L_LASTPOST" => $lang['Last_Post'],
|
|
|
|
"L_MODERATOR" => $lang['Moderator'],
|
|
|
|
"L_NONEWPOSTS" => $lang['No_new_posts'],
|
|
|
|
"L_NEWPOSTS" => $lang['New_posts'],
|
2001-08-23 13:17:07 +00:00
|
|
|
"L_NONEWPOSTS_HOT" => $lang['No_new_posts_hot'],
|
|
|
|
"L_NEWPOSTS_HOT" => $lang['New_posts_hot'],
|
2001-08-30 22:20:23 +00:00
|
|
|
"L_TOPIC_IS_LOCKED" => $lang['Topic_is_locked'],
|
2001-05-28 20:23:16 +00:00
|
|
|
"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'],
|
2001-06-13 07:35:41 +00:00
|
|
|
"L_LOGIN_LOGOUT" => $l_login_logout,
|
2001-07-31 14:06:06 +00:00
|
|
|
"L_LAST_VISIT" => $lang['You_last_visit'],
|
2001-04-30 15:21:31 +00:00
|
|
|
|
2001-05-06 16:16:22 +00:00
|
|
|
"U_INDEX" => append_sid("index.".$phpEx),
|
|
|
|
"U_REGISTER" => append_sid("profile.".$phpEx."?mode=register"),
|
|
|
|
"U_PROFILE" => append_sid("profile.".$phpEx."?mode=editprofile"),
|
2001-06-13 19:42:05 +00:00
|
|
|
"U_PRIVATEMSGS" => append_sid("privmsg.".$phpEx."?folder=inbox"),
|
2001-05-06 16:16:22 +00:00
|
|
|
"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),
|
2001-06-13 07:35:41 +00:00
|
|
|
"U_MEMBERSLIST" => append_sid("memberlist.".$phpEx),
|
2001-07-08 20:31:13 +00:00
|
|
|
"U_GROUP_CP" => append_sid("groupcp.".$phpEx),
|
2001-04-19 22:24:13 +00:00
|
|
|
|
2001-07-17 14:30:08 +00:00
|
|
|
"S_TIMEZONE" => $lang['All_times'] . " " . $lang[$board_config['default_timezone']],
|
2001-05-06 16:16:22 +00:00
|
|
|
"S_LOGIN_ACTION" => append_sid("login.$phpEx"),
|
|
|
|
"S_JUMPBOX_ACTION" => append_sid("viewforum.$phpEx"),
|
2001-06-13 08:32:32 +00:00
|
|
|
"S_CURRENT_TIME" => create_date($board_config['default_dateformat'], time(), $board_config['default_timezone']),
|
2001-04-19 22:24:13 +00:00
|
|
|
|
2001-04-28 17:54:22 +00:00
|
|
|
"T_HEAD_STYLESHEET" => $theme['head_stylesheet'],
|
2001-04-24 22:32:57 +00:00
|
|
|
"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'],
|
2001-08-30 22:20:23 +00:00
|
|
|
"T_TR_CLASS1" => $theme['tr_class1'],
|
|
|
|
"T_TR_CLASS2" => $theme['tr_class2'],
|
|
|
|
"T_TR_CLASS3" => $theme['tr_class3'],
|
2001-04-24 22:32:57 +00:00
|
|
|
"T_TH_COLOR1" => "#".$theme['th_color1'],
|
|
|
|
"T_TH_COLOR2" => "#".$theme['th_color2'],
|
|
|
|
"T_TH_COLOR3" => "#".$theme['th_color3'],
|
2001-08-30 22:20:23 +00:00
|
|
|
"T_TH_CLASS1" => $theme['th_class1'],
|
|
|
|
"T_TH_CLASS2" => $theme['th_class2'],
|
|
|
|
"T_TH_CLASS3" => $theme['th_class3'],
|
2001-04-24 22:32:57 +00:00
|
|
|
"T_TD_COLOR1" => "#".$theme['td_color1'],
|
|
|
|
"T_TD_COLOR2" => "#".$theme['td_color2'],
|
|
|
|
"T_TD_COLOR3" => "#".$theme['td_color3'],
|
2001-08-30 22:20:23 +00:00
|
|
|
"T_TD_CLASS1" => $theme['td_class1'],
|
|
|
|
"T_TD_CLASS2" => $theme['td_class2'],
|
|
|
|
"T_TD_CLASS3" => $theme['td_class3'],
|
2001-04-24 22:32:57 +00:00
|
|
|
"T_FONTFACE1" => $theme['fontface1'],
|
2001-04-28 17:54:22 +00:00
|
|
|
"T_FONTFACE2" => $theme['fontface2'],
|
|
|
|
"T_FONTFACE3" => $theme['fontface3'],
|
2001-04-24 22:32:57 +00:00
|
|
|
"T_FONTSIZE1" => $theme['fontsize1'],
|
|
|
|
"T_FONTSIZE2" => $theme['fontsize2'],
|
|
|
|
"T_FONTSIZE3" => $theme['fontsize3'],
|
|
|
|
"T_FONTCOLOR1" => "#".$theme['fontcolor1'],
|
|
|
|
"T_FONTCOLOR2" => "#".$theme['fontcolor2'],
|
|
|
|
"T_FONTCOLOR3" => "#".$theme['fontcolor3'],
|
2001-08-30 22:20:23 +00:00
|
|
|
"T_SPAN_CLASS1" => $theme['span_class1'],
|
|
|
|
"T_SPAN_CLASS2" => $theme['span_class2'],
|
2001-07-31 14:06:06 +00:00
|
|
|
"T_SPAN_CLASS3" => $theme['span_class3'])
|
2001-05-31 11:49:42 +00:00
|
|
|
);
|
2001-03-02 05:46:32 +00:00
|
|
|
|
2001-06-11 00:11:13 +00:00
|
|
|
//
|
|
|
|
// Login box?
|
|
|
|
//
|
|
|
|
if(!$userdata['session_logged_in'])
|
|
|
|
{
|
2001-07-21 13:45:18 +00:00
|
|
|
$template->assign_block_vars("loginbox", array());
|
2001-06-11 00:11:13 +00:00
|
|
|
}
|
|
|
|
|
2001-06-13 07:35:41 +00:00
|
|
|
header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
|
2001-05-27 20:05:06 +00:00
|
|
|
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
|
|
2001-03-17 00:46:26 +00:00
|
|
|
$template->pparse("overall_header");
|
2001-02-21 07:38:38 +00:00
|
|
|
|
2001-05-03 22:10:23 +00:00
|
|
|
?>
|