Changes to include location + some other misc stuff

git-svn-id: file:///svn/phpbb/trunk@646 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-07-13 16:14:37 +00:00
parent 79d57c449f
commit ea98341099
21 changed files with 350 additions and 309 deletions

View file

@ -23,9 +23,8 @@
***************************************************************************/ ***************************************************************************/
// //
// Define some basic configuration arrays // Define some basic configuration arrays this also prevents
// this also prevents malicious rewriting // malicious rewriting of language array values via URI params
// of language array values via URI params
// //
$board_config = Array(); $board_config = Array();
$userdata = Array(); $userdata = Array();
@ -33,38 +32,45 @@ $theme = Array();
$images = Array(); $images = Array();
$lang = Array(); $lang = Array();
include('config.'.$phpEx); if(empty($phpbb_root_path))
include('includes/constants.'.$phpEx); {
$phpbb_root_path = "./";
}
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/template.inc');
include($phpbb_root_path . 'includes/error.'.$phpEx);
include($phpbb_root_path . 'includes/message.'.$phpEx);
include($phpbb_root_path . 'includes/sessions.'.$phpEx);
include($phpbb_root_path . 'includes/auth.'.$phpEx);
include($phpbb_root_path . 'includes/functions.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);
//
// This would probably be best moved to a template
// specific file, eg "images.tpl"
//
$url_images = "images"; $url_images = "images";
$images['quote'] = "$url_images/icon_quote.gif"; $images['quote'] = "$url_images/icon_quote.gif";
$images['edit'] = "$url_images/icon_edit.gif"; $images['edit'] = "$url_images/icon_edit.gif";
$images['search_icon'] = "$url_images/search_icon.gif"; $images['search_icon'] = "$url_images/icon_search.gif";
$images['profile'] = "$url_images/icon_profile.gif"; $images['profile'] = "$url_images/icon_profile.gif";
$images['privmsg'] = "$url_images/icon_pm.gif"; $images['privmsg'] = "$url_images/icon_pm.gif";
$images['email'] = "$url_images/icon_email.gif"; $images['email'] = "$url_images/icon_email.gif";
$images['delpost'] = "$url_images/edit.gif"; $images['delpost'] = "$url_images/icon_delete.gif";
$images['ip'] = "$url_images/icon_ip.gif"; $images['ip'] = "$url_images/icon_ip.gif";
$images['www'] = "$url_images/icon_www.gif"; $images['www'] = "$url_images/icon_www.gif";
$images['icq'] = "$url_images/icon_icq_add.gif"; $images['icq'] = "$url_images/icon_icq_add.gif";
$images['aim'] = "$url_images/icon_aim.gif"; $images['aim'] = "$url_images/icon_aim.gif";
$images['yim'] = "$url_images/icon_yim.gif"; $images['yim'] = "$url_images/icon_yim.gif";
$images['msnm'] = "$url_images/icon_msnm.gif"; $images['msnm'] = "$url_images/icon_msnm.gif";
$images['posticon'] = "$url_images/posticon.gif"; $images['posticon'] = "$url_images/icon_minipost.gif";
$images['folder'] = "$url_images/folder.gif"; $images['folder'] = "$url_images/folder.gif";
$images['new_folder'] = "$url_images/red_folder.gif"; $images['new_folder'] = "$url_images/folder_new.gif";
$images['latest_reply'] = "$url_images/latest_reply.gif"; $images['latest_reply'] = "$url_images/icon_latest_reply.gif";
$images['locked_folder'] = "$url_images/folder_lock.gif"; $images['locked_folder'] = "$url_images/folder_lock.gif";
include('includes/template.inc');
include('includes/error.'.$phpEx);
include('includes/message.'.$phpEx);
include('includes/sessions.'.$phpEx);
include('includes/auth.'.$phpEx);
include('includes/functions.'.$phpEx);
include('includes/db.'.$phpEx);
// //
// Obtain and encode users IP // Obtain and encode users IP
// //
@ -140,7 +146,13 @@ else
$board_config['smtp_host'] = $config['smtp_host']; $board_config['smtp_host'] = $config['smtp_host'];
} }
include('language/lang_' . $board_config['default_lang'] . '.'.$phpEx); //
// This doesn't need to be here, it's only neccesary
// for the following if loop because a language file
// will be loaded post-session initialisation (or the default
// English one will load if a CRITICAL_ERROR occurs)
//
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '.'.$phpEx);
if($board_config['board_disable']) if($board_config['board_disable'])
{ {

View file

@ -22,8 +22,9 @@
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
// //
// Start session management // Start session management
@ -34,8 +35,8 @@ init_userprefs($userdata);
// End session management // End session management
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -22,8 +22,9 @@
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
// //
// Start session management // Start session management
@ -34,8 +35,8 @@ init_userprefs($userdata);
// End session management // End session management
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -24,19 +24,23 @@
switch($dbms) switch($dbms)
{ {
case 'mysql': case 'mysql':
include('db/mysql.'.$phpEx); include($phpbb_root_path . 'db/mysql.'.$phpEx);
break; break;
case 'postgres': case 'postgres':
include('db/postgres7.'.$phpEx); include($phpbb_root_path . 'db/postgres7.'.$phpEx);
break; break;
case 'mssql': case 'mssql':
include('db/mssql.'.$phpEx); include($phpbb_root_path . 'db/mssql.'.$phpEx);
break; break;
case 'odbc': case 'odbc':
include('db/odbc.'.$phpEx); include($phpbb_root_path . 'db/odbc.'.$phpEx);
break; break;
case 'oracle': case 'oracle':
include('db/oracle.'.$phpEx); include($phpbb_root_path . 'db/oracle.'.$phpEx);
break; break;
} }

View file

@ -24,27 +24,27 @@
function error_die($error_code, $error_msg = "", $line = "", $file = "") function error_die($error_code, $error_msg = "", $line = "", $file = "")
{ {
global $db, $template, $phpEx, $default_lang, $theme; global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path;
if(!defined("HEADER_INC")) if(!defined("HEADER_INC"))
{ {
if(!empty($default_lang)) if(!empty($board_config['default_lang']))
{ {
include('language/lang_'.$default_lang.'.'.$phpEx); include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '.'.$phpEx);
} }
else else
{ {
include('language/lang_english.'.$phpEx); include($phpbb_root_path . 'language/lang_english.'.$phpEx);
} }
if(!$template) if(!$template)
{ {
$template = new Template("templates/Default"); $template = new Template($phpbb_root_path . "templates/Default");
} }
if(!$theme) if(!$theme)
{ {
$theme = setuptheme(1); $theme = setuptheme(1);
} }
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
} }
if(!$error_msg) if(!$error_msg)
{ {
@ -55,13 +55,19 @@ function error_die($error_code, $error_msg = "", $line = "", $file = "")
{ {
$error_msg = "An Error Occured"; $error_msg = "An Error Occured";
} }
if(!$message_title)
{
$message_title = "General Error";
}
break; break;
case SQL_CONNECT: case SQL_CONNECT:
$message_title = "General Error";
$error_msg = "Couldn't connect to database!"; $error_msg = "Couldn't connect to database!";
break; break;
case BANNED: case BANNED:
$message_title = $lang['Information'];
$error_msg = "You have been banned from this forum."; $error_msg = "You have been banned from this forum.";
break; break;
@ -69,15 +75,18 @@ function error_die($error_code, $error_msg = "", $line = "", $file = "")
break; break;
case SESSION_CREATE: case SESSION_CREATE:
$error_msg = "Error creating session. Could not log you in. Please go back and try again."; $message_title = "General Error";
$error_msg = "Error creating session<br>Could not log you in, please go back and try again.";
break; break;
case NO_POSTS: case NO_POSTS:
$error_msg = "There are no posts in this forum. Click on the <b>Post New Topic</b> link on this page to post one."; $message_title = $lang['Information'];
$error_msg = "There are no posts in this forum<br>Click on the <b>Post New Topic</b> link on this page to post one.";
break; break;
case LOGIN_FAILED: case LOGIN_FAILED:
$error_msg = "Login Failed. You have specified an incorrect/inactive username or invalid password, please go back and try again."; $message_title = $lang['Information'];
$error_msg = "Login Failed<br>You have specified an incorrect/inactive username or invalid password, please go back and try again.";
break; break;
} }
} }
@ -88,12 +97,14 @@ function error_die($error_code, $error_msg = "", $line = "", $file = "")
} }
$template->set_filenames(array( $template->set_filenames(array(
"error_body" => "error_body.tpl")); "message_body" => "error_body.tpl")
);
$template->assign_vars(array( $template->assign_vars(array(
"ERROR_MESSAGE" => $error_msg)); "ERROR_MESSAGE" => $error_msg)
$template->pparse("error_body"); );
$template->pparse("message_body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
exit(); exit();
} }

View file

@ -225,7 +225,7 @@ function make_forum_box($box_name, $default_forum = -1)
// Initialise user settings on page load // Initialise user settings on page load
function init_userprefs($userdata) function init_userprefs($userdata)
{ {
global $board_config, $theme, $template, $lang, $phpEx; global $board_config, $theme, $template, $lang, $phpEx, $phpbb_root_path;
if(!$board_config['override_user_themes']) if(!$board_config['override_user_themes'])
{ {
@ -270,15 +270,15 @@ function init_userprefs($userdata)
} }
} }
$template = new Template("templates/" . $board_config['default_template']); $template = new Template($phpbb_root_path . "templates/" . $board_config['default_template']);
if(file_exists("language/lang_".$board_config['default_lang'].".".$phpEx) ) if(file_exists("language/lang_".$board_config['default_lang'].".".$phpEx) )
{ {
include('language/lang_'.$board_config['default_lang'].'.'.$phpEx); include($phpbb_root_path . 'language/lang_'.$board_config['default_lang'].'.'.$phpEx);
} }
else else
{ {
include('language/lang_english.'.$phpEx); include($phpbb_root_path . 'language/lang_english.'.$phpEx);
} }
return; return;

View file

@ -47,7 +47,7 @@
// //
function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "", $err_file = "", $sql = "") function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "", $err_file = "", $sql = "")
{ {
global $db, $template, $board_config, $theme, $lang, $phpEx; global $db, $template, $board_config, $theme, $lang, $phpEx, $phpbb_root_path;
global $userdata, $user_ip, $session_length; global $userdata, $user_ip, $session_length;
global $starttime; global $starttime;
@ -64,16 +64,16 @@ function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "",
{ {
if( !empty($board_config['default_lang']) ) if( !empty($board_config['default_lang']) )
{ {
include('language/lang_' . $board_config['default_lang'] . '.'.$phpEx); include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '.'.$phpEx);
} }
else else
{ {
include('language/lang_english.'.$phpEx); include($phpbb_root_path . 'language/lang_english.'.$phpEx);
} }
if( empty($template) ) if( empty($template) )
{ {
$template = new Template("templates/Default"); $template = new Template($phpbb_root_path . "templates/Default");
} }
if( empty($theme) ) if( empty($theme) )
@ -84,7 +84,7 @@ function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "",
// //
// Load the Page Header // Load the Page Header
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
} }
switch($msg_code) switch($msg_code)
@ -119,7 +119,7 @@ function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "",
// Critical errors mean we cannot rely on _ANY_ DB information being // Critical errors mean we cannot rely on _ANY_ DB information being
// available so we're going to dump out a simple echo'd statement // available so we're going to dump out a simple echo'd statement
// //
include('language/lang_english.'.$phpEx); include($phpbb_root_path . 'language/lang_english.'.$phpEx);
if($msg_text == "") if($msg_text == "")
{ {
@ -176,7 +176,7 @@ function message_die($msg_code, $msg_text = "", $msg_title = "", $err_line = "",
); );
$template->pparse("message_body"); $template->pparse("message_body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else else
{ {

View file

@ -21,8 +21,9 @@
* *
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$pagetype = "index"; $pagetype = "index";
$page_title = "Forum Index"; $page_title = "Forum Index";
@ -36,83 +37,23 @@ init_userprefs($userdata);
// End session management // End session management
// //
$viewcat = (!empty($HTTP_GET_VARS['viewcat'])) ? $HTTP_GET_VARS['viewcat'] : -1;
//
// If you don't use these stats on your index
// you may want to consider removing them since
// it will reduce the number of queries speeding
// up page generation a little
//
$total_posts = get_db_stat('postcount'); $total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount'); $total_users = get_db_stat('usercount');
$total_topics = get_db_stat('topiccount'); $total_topics = get_db_stat('topiccount');
$newest_userdata = get_db_stat('newestuser'); $newest_userdata = get_db_stat('newestuser');
$newest_user = $newest_userdata["username"]; $newest_user = $newest_userdata['username'];
$newest_uid = $newest_userdata["user_id"]; $newest_uid = $newest_userdata['user_id'];
$viewcat = (!empty($HTTP_GET_VARS['viewcat'])) ? $HTTP_GET_VARS['viewcat'] : -1;
/*
//
// This code allows for individual topic read tracking, on small, low volume sites
// it'll probably work very well. However, for busy sites the use of a text field in
// the DB combined with the additional UPDATE's required in viewtopic may be
// unacceptable. So, by default this code is off, however you may want to play
// ... remember that the users table needs a 'user_topics_unvisited' field of type
// TEXT ( or equiv) and you need to remove the commented out code above the folder_img
// code in the loop below (this applies to viewforum too).
//
// psoTFX
//
if($userdata['user_id'] != ANONYMOUS)
{
$unread_topic_list = unserialize($userdata['user_topics_unvisited']);
$last_update_time = (isset($unread_topic_list['lastupdate'])) ? $unread_topic_list['lastupdate'] : $userdata['session_last_visit'];
$sql = "SELECT forum_id, topic_id
FROM " . TOPICS_TABLE . "
WHERE topic_time > $last_update_time";
if(!$s_topic_times = $db->sql_query($sql))
{
message_die(SQL_QUERY, "Could not query topic times.", __LINE__, __FILE__);
}
if($db->sql_numrows($s_topic_times))
{
while($new_topics_ary = $db->sql_fetchrow($s_topic_times))
{
$unread_topic_list[$new_topics_ary['forum_id']][$new_topics_ary['topic_id']] = 1;
}
$unread_topic_list['lastupdate'] = time();
$sql = "UPDATE " . USERS_TABLE . "
SET user_topics_unvisited = '" . serialize($unread_topic_list) . "'
WHERE user_id = " . $userdata['user_id'];
if(!$s_topic_times = $db->sql_query($sql))
{
message_die(SQL_QUERY, "Could not update user topics list.", __LINE__, __FILE__);
}
}
}
*/
// //
// Output page header and // Start page proper
// open the index body template
//
include('includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "index_body.tpl"));
$template->assign_vars(array(
"TOTAL_POSTS" => $total_posts,
"TOTAL_USERS" => $total_users,
"TOTAL_TOPICS" => $total_topics,
"NEWEST_USER" => $newest_user,
"NEWEST_UID" => $newest_uid,
"USERS_BROWSING" => $users_browsing,
"U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid"))
);
//
// Start main
// //
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order $sql = "SELECT c.cat_id, c.cat_title, c.cat_order
FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f
@ -124,13 +65,12 @@ if(!$q_categories = $db->sql_query($sql))
message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not query categories list", "", __LINE__, __FILE__, $sql);
} }
$total_categories = $db->sql_numrows(); if($total_categories = $db->sql_numrows($q_categories))
if($total_categories)
{ {
$category_rows = $db->sql_fetchrowset($q_categories); $category_rows = $db->sql_fetchrowset($q_categories);
$limit_forums = ""; $limit_forums = "";
// //
// Define appropriate SQL // Define appropriate SQL
// //
@ -138,6 +78,7 @@ if($total_categories)
{ {
case 'postgresql': case 'postgresql':
$limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : ""; $limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : "";
$sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, p.post_username $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, p.post_username
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p, " . USERS_TABLE . " u FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p, " . USERS_TABLE . " u
WHERE f.forum_last_post_id = p.post_id WHERE f.forum_last_post_id = p.post_id
@ -153,12 +94,12 @@ if($total_categories)
WHERE f.forum_last_post_id = p.post_id WHERE f.forum_last_post_id = p.post_id
) )
$limit_forums $limit_forums
) )";
ORDER BY f.cat_id, f.forum_order";
break; break;
case 'oracle': case 'oracle':
$limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : ""; $limit_forums = ($viewcat != -1) ? "AND f.cat_id = $viewcat " : "";
$sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, p.post_username $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time, p.post_username
FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . USERS_TABLE . " u
WHERE f.forum_last_post_id = p.post_id(+) WHERE f.forum_last_post_id = p.post_id(+)
@ -169,7 +110,6 @@ if($total_categories)
break; break;
default: default:
// This works on: MySQL, MSSQL and ODBC (Access)
$limit_forums = ($viewcat != -1) ? "WHERE f.cat_id = $viewcat " : ""; $limit_forums = ($viewcat != -1) ? "WHERE f.cat_id = $viewcat " : "";
$sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time $sql = "SELECT f.*, t.topic_id, t.topic_replies, t.topic_last_post_id, u.username, u.user_id, p.post_time
@ -186,12 +126,14 @@ if($total_categories)
{ {
message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Could not query forums information", "", __LINE__, __FILE__, $sql);
} }
$total_forums = $db->sql_numrows($q_forums); if( !$total_forums = $db->sql_numrows($q_forums) )
{
message_die(GENERAL_MESSAGE, $lang['No_forums']);
}
$forum_rows = $db->sql_fetchrowset($q_forums); $forum_rows = $db->sql_fetchrowset($q_forums);
// //
// Obtain list of moderators of each // Obtain list of moderators of each forum
// forum
// //
$sql = "SELECT f.forum_id, u.username, u.user_id $sql = "SELECT f.forum_id, u.username, u.user_id
FROM " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa FROM " . FORUMS_TABLE . " f, " . USERS_TABLE . " u, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
@ -210,14 +152,64 @@ if($total_categories)
{ {
$forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['username']; $forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['username'];
$forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id']; $forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id'];
$forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = 1;
} }
/*
$sql = "SELECT f.forum_id, g.group_name, g.group_id, g.group_single_user, ug.user_id
FROM " . FORUMS_TABLE . " f, " . GROUPS_TABLE . " g, " . USER_GROUP_TABLE . " ug, " . AUTH_ACCESS_TABLE . " aa
WHERE aa.forum_id = f.forum_id
AND aa.auth_mod = " . TRUE . "
AND g.group_id = aa.group_id
AND ug.group_id = g.group_id
ORDER BY f.forum_id, g.group_id";
if(!$q_forum_mods = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Could not query forum moderator information", "", __LINE__, __FILE__, $sql);
}
$forum_mods_list = $db->sql_fetchrowset($q_forum_mods);
for($i = 0; $i < count($forum_mods_list); $i++)
{
$forum_mods_name[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_name'];
$forum_mods_single_user[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_single_user'];
if($forum_mods_list[$i]['group_single_user'])
{
$forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['user_id'];
}
else
{
$forum_mods_id[$forum_mods_list[$i]['forum_id']][] = $forum_mods_list[$i]['group_id'];
}
}*/
// //
// Find which forums are visible for // Find which forums are visible for this user
// this user
// //
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_rows); $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_rows);
//
// Output page header and open the index body template
//
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
"body" => "index_body.tpl")
);
$template->assign_vars(array(
"TOTAL_POSTS" => $total_posts,
"TOTAL_USERS" => $total_users,
"TOTAL_TOPICS" => $total_topics,
"NEWEST_USER" => $newest_user,
"NEWEST_UID" => $newest_uid,
"USERS_BROWSING" => $users_browsing,
"U_NEWEST_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid"))
);
// //
// Okay, let's build the index // Okay, let's build the index
// //
@ -243,21 +235,14 @@ if($total_categories)
$gen_cat[$cat_id] = 1; $gen_cat[$cat_id] = 1;
} }
// if($userdata['user_id'] != ANONYMOUS) if($userdata['session_start'] >= $userdata['session_time'] - 300)
// {
// $folder_image = (count($unread_topic_list[$forum_rows[$j]['forum_id']])) ? "<img src=\"".$images['new_folder']."\">" : "<img src=\"".$images['folder']."\">";
// }
// else
// {
if($userdata['session_start'] == $userdata['session_time'])
{ {
$folder_image = ($forum_rows[$j]['post_time'] > $userdata['session_last_visit']) ? "<img src=\"" . $images['new_folder'] . "\">" : "<img src=\"" . $images['folder'] . "\">"; $folder_image = ($forum_rows[$j]['post_time'] > $userdata['session_last_visit']) ? "<img src=\"" . $images['new_folder'] . "\">" : "<img src=\"" . $images['folder'] . "\">";
} }
else else
{ {
$folder_image = ($forum_rows[$j]['post_time'] > $userdata['session_time'] - 300) ? "<img src=\"" . $images['new_folder'] . "\">" : "<img src=\"" . $images['folder'] . "\">"; $folder_image = ($forum_rows[$j]['post_time'] >= $userdata['session_time'] - 300) ? "<img src=\"" . $images['new_folder'] . "\">" : "<img src=\"" . $images['folder'] . "\">";
} }
// }
$posts = $forum_rows[$j]['forum_posts']; $posts = $forum_rows[$j]['forum_posts'];
$topics = $forum_rows[$j]['forum_topics']; $topics = $forum_rows[$j]['forum_topics'];
@ -277,7 +262,7 @@ if($total_categories)
$last_post = $last_post_time . "<br />by "; $last_post = $last_post_time . "<br />by ";
$last_post .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $forum_rows[$j]['user_id']) . "\">" . $last_poster . "</a>&nbsp;"; $last_post .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $forum_rows[$j]['user_id']) . "\">" . $last_poster . "</a>&nbsp;";
$last_post .= "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $forum_rows[$j]['topic_last_post_id']) . "#" . $forum_rows[$j]['topic_last_post_id'] . "\"><img src=\"" . $images['latest_reply'] . "\" width=\"20\" height=\"11\" border=\"0\" alt=\"View Latest Post\"></a>"; $last_post .= "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $forum_rows[$j]['topic_last_post_id']) . "#" . $forum_rows[$j]['topic_last_post_id'] . "\"><img src=\"" . $images['latest_reply'] . "\" width=\"20\" height=\"11\" border=\"0\" alt=\"" . $lang['View_latest_post'] . "\"></a>";
} }
else else
{ {
@ -285,20 +270,38 @@ if($total_categories)
$forum_rows[$j]['forum_name'] = stripslashes($forum_rows[$j]['forum_name']); $forum_rows[$j]['forum_name'] = stripslashes($forum_rows[$j]['forum_name']);
} }
$mod_count = 0;
unset($moderators_links); unset($moderators_links);
for($mods = 0; $mods < count($forum_mods_name[$forum_id]); $mods++) for($mods = 0; $mods < count($forum_mods_name[$forum_id]); $mods++)
{
if( !strstr($moderators_links, $forum_mods_name[$forum_id][$mods]) )
{ {
if(isset($moderators_links)) if(isset($moderators_links))
{ {
$moderators_links .= ", "; $moderators_links .= ", ";
} }
if(!($mods % 2) && $mods != 0)
if(!($mod_count % 2) && $mod_count != 0)
{ {
$moderators_links .= "<br />"; $moderators_links .= "<br />";
} }
if( $forum_mods_single_user[$forum_id][$mods])
{
$moderators_links .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>"; $moderators_links .= "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>";
} }
else
{
$moderators_links .= "<a href=\"" . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $forum_mods_id[$forum_id][$mods]) . "\">" . $forum_mods_name[$forum_id][$mods] . "</a>";
}
$mod_count++;
}
}
//
// This should end up in the template using IF...ELSE...ENDIF
//
if($row_color == "#DDDDDD") if($row_color == "#DDDDDD")
{ {
$row_color = "#CCCCCC"; $row_color = "#CCCCCC";
@ -341,8 +344,12 @@ else
{ {
message_die(GENERAL_MESSAGE, "There are no Categories or Forums on this board", "", __LINE__, __FILE__, $sql); message_die(GENERAL_MESSAGE, "There are no Categories or Forums on this board", "", __LINE__, __FILE__, $sql);
} }
//
// Generate the page
//
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -6,11 +6,7 @@
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * email : support@phpbb.com
* *
<<<<<<< login.php
* $Id$ * $Id$
=======
* $Id$
>>>>>>> 1.21
* *
* *
***************************************************************************/ ***************************************************************************/
@ -25,8 +21,9 @@
* *
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
// //
// Set page ID for session management // Set page ID for session management
@ -44,13 +41,14 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
$username = $HTTP_POST_VARS['username']; $username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS['password']; $password = $HTTP_POST_VARS['password'];
$sql = "SELECT user_id, username, user_password, user_active $sql = "SELECT user_id, username, user_password, user_active
FROM ".USERS_TABLE." FROM ".USERS_TABLE."
WHERE username = '$username'"; WHERE username = '$username'";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if(!$result) if(!$result)
{ {
error_die(SQL_QUERY, "Error in obtaining userdata : login", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Error in obtaining userdata : login", __LINE__, __FILE__, $sql);
} }
$rowresult = $db->sql_fetchrow($result); $rowresult = $db->sql_fetchrow($result);
@ -75,17 +73,17 @@ if(isset($HTTP_POST_VARS['submit']) || isset($HTTP_GET_VARS['submit']))
} }
else else
{ {
error_die(GENERAL_ERROR, "Couldn't start session : login", __LINE__, __FILE__); message_die(CRITICAL_ERROR, "Couldn't start session : login", __LINE__, __FILE__);
} }
} }
else else
{ {
error_die(LOGIN_FAILED); message_die(GENERAL_MESSAGE, $lang['Error_login']);
} }
} }
else else
{ {
error_die(LOGIN_FAILED); message_die(GENERAL_MESSAGE, $lang['Error_login']);
} }
} }
else if($HTTP_GET_VARS['submit'] == "logout" && $userdata['session_logged_in']) else if($HTTP_GET_VARS['submit'] == "logout" && $userdata['session_logged_in'])
@ -124,7 +122,8 @@ else
if(!$userdata['session_logged_in']) if(!$userdata['session_logged_in'])
{ {
$page_title = "Log In"; $page_title = "Log In";
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "login_body.tpl") "body" => "login_body.tpl")
); );
@ -152,8 +151,16 @@ else
} }
} }
} }
else
{
$forward_page = $forward_match[0];
} }
} }
}
else
{
$forward_page = "";
}
$username = ($userdata['user_id'] != ANONYMOUS) ? $userdata['username'] : ""; $username = ($userdata['user_id'] != ANONYMOUS) ? $userdata['username'] : "";
@ -169,7 +176,7 @@ else
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else else
{ {

View file

@ -18,8 +18,10 @@
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
***************************************************************************/ ***************************************************************************/
include('extension.inc');
include('common.'.$phpEx); $phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$pagetype = "memberlist"; $pagetype = "memberlist";
$page_title = $lang['Memberlist']; $page_title = $lang['Memberlist'];
@ -33,7 +35,7 @@ init_userprefs($userdata);
// End session management // End session management
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if(!isset($HTTP_GET_VARS['start'])) if(!isset($HTTP_GET_VARS['start']))
{ {
@ -293,6 +295,6 @@ if(($selected_members = $db->sql_numrows($result)) > 0)
$template->pparse("body"); $template->pparse("body");
} }
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -31,9 +31,10 @@
* topics via the moderator operations buttons on all of the viewtopic pages. * topics via the moderator operations buttons on all of the viewtopic pages.
*/ */
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include('includes/bbcode.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$pagetype = "modcp"; $pagetype = "modcp";
$page_title = "Modertator Control Panel"; $page_title = "Modertator Control Panel";
@ -109,7 +110,7 @@ if($HTTP_POST_VARS['not_confirm'])
header("Location: index.$phpEx"); header("Location: index.$phpEx");
} }
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// Set template files // Set template files
$template->set_filenames(array("body" => "modcp_body.tpl", "confirm" => "confirm_body.tpl", "split_body" => "split_body.tpl")); $template->set_filenames(array("body" => "modcp_body.tpl", "confirm" => "confirm_body.tpl", "split_body" => "split_body.tpl"));
@ -273,14 +274,14 @@ switch($mode)
"S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"), "S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"),
"S_HIDDEN_FIELDS" => $hidden_fields)); "S_HIDDEN_FIELDS" => $hidden_fields));
$template->pparse("confirm"); $template->pparse("confirm");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
exit();
} }
break; break;
case 'move': case 'move':
echo 'Move'; echo 'Move';
break; break;
case 'lock': case 'lock':
if($confirm) if($confirm)
{ {
@ -346,8 +347,7 @@ switch($mode)
"S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"), "S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"),
"S_HIDDEN_FIELDS" => $hidden_fields)); "S_HIDDEN_FIELDS" => $hidden_fields));
$template->pparse("confirm"); $template->pparse("confirm");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
exit();
} }
break; break;
@ -417,8 +417,7 @@ switch($mode)
"S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"), "S_CONFIRM_ACTION" => append_sid("modcp.$phpEx"),
"S_HIDDEN_FIELDS" => $hidden_fields)); "S_HIDDEN_FIELDS" => $hidden_fields));
$template->pparse("confirm"); $template->pparse("confirm");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
exit();
} }
break; break;
@ -654,6 +653,7 @@ switch($mode)
} }
$pagination = generate_pagination("modcp.$phpEx?".POST_FORUM_URL."=$forum_id", $forum_topics, $board_config['topics_per_page'], $start); $pagination = generate_pagination("modcp.$phpEx?".POST_FORUM_URL."=$forum_id", $forum_topics, $board_config['topics_per_page'], $start);
$template->assign_vars(array("PAGINATION" => $pagination, $template->assign_vars(array("PAGINATION" => $pagination,
"FORUM_ID" => $forum_id, "FORUM_ID" => $forum_id,
"POST_FORUM_URL" => POST_FORUM_URL, "POST_FORUM_URL" => POST_FORUM_URL,
@ -661,11 +661,14 @@ switch($mode)
"TOTAL_PAGES" => ceil($forum_topics/$board_config['topics_per_page']), "TOTAL_PAGES" => ceil($forum_topics/$board_config['topics_per_page']),
"L_OF" => $lang['of'], "L_OF" => $lang['of'],
"L_PAGE" => $lang['Page'], "L_PAGE" => $lang['Page'],
"L_GOTO_PAGE" => $lang['Goto_page'])); "L_GOTO_PAGE" => $lang['Goto_page'])
);
$template->pparse("body"); $template->pparse("body");
break; break;
} }
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -20,10 +20,11 @@
* *
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include('includes/post.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
include('includes/bbcode.'.$phpEx); include($phpbb_root_path . 'includes/post.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
// //
// Start session management // Start session management
@ -594,7 +595,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
// //
// Output confirmation page // Output confirmation page
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"confirm_body" => "confirm_body.tpl") "confirm_body" => "confirm_body.tpl")
@ -611,7 +612,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
); );
$template->pparse("confirm_body"); $template->pparse("confirm_body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else if( isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) || else if( isset($HTTP_GET_VARS['confirm']) || isset($HTTP_POST_VARS['confirm']) ||
@ -915,7 +916,7 @@ else if( $mode == "editpost" && $topic_status == TOPIC_UNLOCKED )
// //
// Output page // Output page
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// //
// Start: Error handling // Start: Error handling
@ -1194,6 +1195,6 @@ $template->assign_vars(array(
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -21,10 +21,11 @@
* *
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include('includes/post.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
include('includes/bbcode.'.$phpEx); include($phpbb_root_path . 'includes/post.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$pagetype = "privmsgs"; $pagetype = "privmsgs";
$page_title = "Private Messageing"; $page_title = "Private Messageing";
@ -178,7 +179,7 @@ if($mode == "read")
$s_hidden_fields = "<input type=\"hidden\" name=\"mark[]\" value=\"$privmsgs_id\">"; $s_hidden_fields = "<input type=\"hidden\" name=\"mark[]\" value=\"$privmsgs_id\">";
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// //
// Load templates // Load templates
@ -300,7 +301,7 @@ if($mode == "read")
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else if($mode == "post" || $mode == "reply" || $mode == "edit") else if($mode == "post" || $mode == "reply" || $mode == "edit")
@ -702,7 +703,7 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
} }
} }
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
if($preview && !$error) if($preview && !$error)
{ {
@ -866,7 +867,7 @@ else if($mode == "post" || $mode == "reply" || $mode == "edit")
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else if( ( isset($HTTP_POST_VARS['delete']) && !empty($HTTP_POST_VARS['mark']) ) || !empty($HTTP_POST_VARS['deleteall']) ) else if( ( isset($HTTP_POST_VARS['delete']) && !empty($HTTP_POST_VARS['mark']) ) || !empty($HTTP_POST_VARS['deleteall']) )
@ -1030,7 +1031,7 @@ if(!$userdata['session_logged_in'])
header("Location: " . append_sid("login.$phpEx?forward_page=privmsg.$phpEx&folder=inbox")); header("Location: " . append_sid("login.$phpEx?forward_page=privmsg.$phpEx&folder=inbox"));
} }
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// //
// Load templates // Load templates
@ -1244,6 +1245,6 @@ $template->assign_vars(array(
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -21,9 +21,9 @@
* *
* *
***************************************************************************/ ***************************************************************************/
$phpbb_root_path = "./";
include('extension.inc'); include($phpbb_root_path . 'extension.inc');
include('common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
// //
// Start session management // Start session management
@ -202,7 +202,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
// Output page header and // Output page header and
// profile_view template // profile_view template
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "profile_view_body.tpl", "body" => "profile_view_body.tpl",
@ -316,7 +316,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else if($mode == "editprofile" || $mode == "register") else if($mode == "editprofile" || $mode == "register")
@ -330,7 +330,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$pagetype = ($mode == "edit") ? "editprofile" : "register"; $pagetype = ($mode == "edit") ? "editprofile" : "register";
$page_title = ($mode == "edit") ? $lang['Edit_profile'] : $lang['Register']; $page_title = ($mode == "edit") ? $lang['Edit_profile'] : $lang['Register'];
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
// //
// Start processing for output // Start processing for output
@ -361,7 +361,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
); );
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
} }
else if(isset($HTTP_POST_VARS['submit']) || $mode == "register") else if(isset($HTTP_POST_VARS['submit']) || $mode == "register")
@ -384,8 +384,8 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags($HTTP_POST_VARS['website'])) : ""; $website = (!empty($HTTP_POST_VARS['website'])) ? trim(strip_tags($HTTP_POST_VARS['website'])) : "";
$location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags($HTTP_POST_VARS['location'])) : ""; $location = (!empty($HTTP_POST_VARS['location'])) ? trim(strip_tags($HTTP_POST_VARS['location'])) : "";
$occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags($HTTP_POST_VARS['occupation'])) : ""; $occupation = (!empty($HTTP_POST_VARS['occupation'])) ? trim(strip_tags($HTTP_POST_VARS['occupation'])) : "";
$interests = (!empty($HTTP_POST_VARS['interests'])) ? trim($HTTP_POST_VARS['interests']) : ""; $interests = (!empty($HTTP_POST_VARS['interests'])) ? trim(strip_tags($HTTP_POST_VARS['interests'])) : "";
$signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(str_replace("<br />", "\n", $HTTP_POST_VARS['signature'])) : ""; $signature = (!empty($HTTP_POST_VARS['signature'])) ? trim(strip_tags(str_replace("<br />", "\n", $HTTP_POST_VARS['signature']))) : "";
$viewemail = (isset($HTTP_POST_VARS['viewemail'])) ? $HTTP_POST_VARS['viewemail'] : 0; $viewemail = (isset($HTTP_POST_VARS['viewemail'])) ? $HTTP_POST_VARS['viewemail'] : 0;
$allowviewonline = (isset($HTTP_POST_VARS['hideonline'])) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : 1 ) : 1; $allowviewonline = (isset($HTTP_POST_VARS['hideonline'])) ? ( ($HTTP_POST_VARS['hideonline']) ? 0 : 1 ) : 1;
@ -840,7 +840,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
if($board_config['smtp_delivery'] && $board_config['smtp_host'] != "") if($board_config['smtp_delivery'] && $board_config['smtp_host'] != "")
{ {
include('includes/smtp.'.$phpEx); include($phpbb_root_path . 'includes/smtp.'.$phpEx);
smtpmail($email, $lang['Welcome_subject'], $email_msg, $email_headers); smtpmail($email, $lang['Welcome_subject'], $email_msg, $email_headers);
} }
else else
@ -1037,7 +1037,7 @@ if(isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']))
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
else if($mode == "activate") else if($mode == "activate")
{ {

View file

@ -27,9 +27,9 @@
// //
// PSO : 2001 // PSO : 2001
// //
$phpbb_root_path = "./";
include('extension.inc'); include($phpbb_root_path . 'extension.inc');
include('common.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
$pagetype = "search"; $pagetype = "search";
$page_title = "Search Forums"; $page_title = "Search Forums";
@ -380,7 +380,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
// //
// Output header // Output header
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "search_results_body.tpl", "body" => "search_results_body.tpl",
@ -473,7 +473,7 @@ if((isset($HTTP_POST_VARS['dosearch']) || isset($HTTP_GET_VARS['dosearch'])) &&
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
} }
} }
} }
@ -520,7 +520,7 @@ for($i = 0; $i < count($sortby_types); $i++)
$s_sortby .= "<option value=\"$i\">".$sortby_types[$i]."</option>"; $s_sortby .= "<option value=\"$i\">".$sortby_types[$i]."</option>";
} }
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "search_body.tpl", "body" => "search_body.tpl",
@ -553,6 +553,6 @@ $template->assign_vars(array(
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -50,7 +50,7 @@
<div align="center"><table align="center" border="0" width="98%"> <div align="center"><table align="center" border="0" width="98%">
<tr> <tr>
<td width="30" align="center"><img src="images/red_folder.gif"></td> <td width="30" align="center"><img src="images/folder_new.gif"></td>
<td><span class="gensmall">{L_NEWPOSTS}</span></td> <td><span class="gensmall">{L_NEWPOSTS}</span></td>
<td align="right" valign="top"><span class="gensmall"><b>{S_TIMEZONE}</b></span></td> <td align="right" valign="top"><span class="gensmall"><b>{S_TIMEZONE}</b></span></td>
</tr> </tr>

View file

@ -1,7 +1,7 @@
<div align="center"><table width="98%" cellspacing="0" cellpadding="4" border="0"> <div align="center"><table width="98%" cellspacing="0" cellpadding="4" border="0">
<tr><form method="post" action="{S_POST_DAYS_ACTION}"> <tr><form method="post" action="{S_POST_DAYS_ACTION}">
<td align="left" valign="bottom" nowrap><span class="gensmall"><a href="{U_INDEX}">{SITENAME}&nbsp;{L_INDEX}</a> -> {FORUM_NAME}</span></td> <td align="left" valign="bottom" nowrap><span class="gensmall"><a href="{U_INDEX}">{SITENAME}&nbsp;{L_INDEX}</a> -> {FORUM_NAME}</span></td>
<td align="right" valign="bottom" nowrap><span class="gensmall">Display Topics from previous :&nbsp;{S_SELECT_POST_DAYS}&nbsp;<input type="submit" value="Go"></span></td> <td align="right" valign="bottom" nowrap><span class="gensmall">{L_DISPLAY_TOPICS}:&nbsp;{S_SELECT_POST_DAYS}&nbsp;<input type="submit" value="Go"></span></td>
</form></tr> </form></tr>
</table></div> </table></div>
@ -54,11 +54,11 @@
<td rowspan="6" align="right" valign="top" nowrap>{JUMPBOX}<br><span class="gensmall">{S_AUTH_LIST}</span></td> <td rowspan="6" align="right" valign="top" nowrap>{JUMPBOX}<br><span class="gensmall">{S_AUTH_LIST}</span></td>
</tr> </tr>
<tr> <tr>
<td><img src="images/red_folder.gif"></td> <td><img src="images/folder_new.gif"></td>
<td><span class="gensmall">{L_NEWPOSTS}</td> <td><span class="gensmall">{L_NEWPOSTS}</td>
</tr> </tr>
<tr> <tr>
<td><img src="images/hot_red_folder.gif"></td> <td><img src="images/folder_new_hot.gif"></td>
<td><span class="gensmall">{L_NEWPOSTS} [ > {L_HOT_THRESHOLD} ]</span></td> <td><span class="gensmall">{L_NEWPOSTS} [ > {L_HOT_THRESHOLD} ]</span></td>
</tr> </tr>
<tr> <tr>
@ -66,11 +66,11 @@
<td><span class="gensmall">{L_NONEWPOSTS}</span></td> <td><span class="gensmall">{L_NONEWPOSTS}</span></td>
</tr> </tr>
<tr> <tr>
<td><img src="images/hot_folder.gif"></td> <td><img src="images/folder_hot.gif"></td>
<td><span class="gensmall">{L_NONEWPOSTS} [ > {L_HOT_THRESHOLD} ]</span></td> <td><span class="gensmall">{L_NONEWPOSTS} [ > {L_HOT_THRESHOLD} ]</span></td>
</tr> </tr>
<tr> <tr>
<td><img src="images/lock.gif"></td> <td><img src="images/folder_lock.gif"></td>
<td><span class="gensmall">{L_TOPIC_IS_LOCKED}</span></td> <td><span class="gensmall">{L_TOPIC_IS_LOCKED}</span></td>
</tr> </tr>
</table></div> </table></div>

View file

@ -34,7 +34,7 @@
<tr> <tr>
<td><table width="100%" cellspacing="0" cellpadding="0" border="0"> <td><table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr> <tr>
<td valign="middle"><img src="images/posticon.gif" alt="Post image icon"><span class="gensmall">{L_POSTED}: {postrow.POST_DATE}&nbsp;&nbsp;&nbsp;&nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td> <td valign="middle"><img src="images/icon_minipost.gif" alt="Post image icon"><span class="gensmall">{L_POSTED}: {postrow.POST_DATE}&nbsp;&nbsp;&nbsp;&nbsp;{L_POST_SUBJECT}: {postrow.POST_SUBJECT}</span></td>
<td align="right" valign="middle" nowrap>&nbsp; {postrow.EDIT_IMG} {postrow.QUOTE_IMG}&nbsp;</td> <td align="right" valign="middle" nowrap>&nbsp; {postrow.EDIT_IMG} {postrow.QUOTE_IMG}&nbsp;</td>
</tr> </tr>
<tr> <tr>

View file

@ -21,8 +21,9 @@
* *
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$pagetype = "viewforum"; $pagetype = "viewforum";
$page_title = "View Forum - $forum_name"; $page_title = "View Forum - $forum_name";
@ -109,7 +110,7 @@ if( ( $is_auth['auth_mod'] || $is_auth['auth_admin'] ) && $board_config['prune_e
{ {
if( $forum_row['prune_next'] < time() && $forum_row['prune_enable'] ) if( $forum_row['prune_next'] < time() && $forum_row['prune_enable'] )
{ {
include('includes/prune.php'); include($phpbb_root_path . 'includes/prune.php');
auto_prune($forum_id); auto_prune($forum_id);
} }
} }
@ -174,7 +175,7 @@ if(!empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']))
{ {
message_die(GENERAL_ERROR, "Couldn't obtain limited topics count information", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Couldn't obtain limited topics count information", "", __LINE__, __FILE__, $sql);
} }
$topics_count = $db->sql_fetchfield("forum_topics", -1, $result); list($topics_count) = $db->sql_fetchrow($result);
$limit_posts_time = "AND ( p.post_time > $min_post_time OR t.topic_type = " . POST_ANNOUNCE . " ) "; $limit_posts_time = "AND ( p.post_time > $min_post_time OR t.topic_type = " . POST_ANNOUNCE . " ) ";
@ -235,7 +236,7 @@ $template->assign_vars(array(
// //
// Dump out the page header and load viewforum template // Dump out the page header and load viewforum template
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "viewforum_body.tpl", "body" => "viewforum_body.tpl",
@ -423,6 +424,6 @@ else
message_die(GENERAL_MESSAGE, $lang['No_topics_post_one']); message_die(GENERAL_MESSAGE, $lang['No_topics_post_one']);
} }
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -21,8 +21,9 @@
* *
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$pagetype = "viewonline"; $pagetype = "viewonline";
$page_title = "Who's Online"; $page_title = "Who's Online";
@ -40,12 +41,13 @@ init_userprefs($userdata);
// Output page header and load // Output page header and load
// viewonline template // viewonline template
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "viewonline_body.tpl", "body" => "viewonline_body.tpl",
"jumpbox" => "jumpbox.tpl") "jumpbox" => "jumpbox.tpl")
); );
$jumpbox = make_jumpbox(); $jumpbox = make_jumpbox();
$template->assign_vars(array( $template->assign_vars(array(
"JUMPBOX_LIST" => $jumpbox, "JUMPBOX_LIST" => $jumpbox,
@ -61,30 +63,24 @@ $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, s.session_page, s
WHERE u.user_id = s.session_user_id WHERE u.user_id = s.session_user_id
AND s.session_time >= " . (time()-300) . " AND s.session_time >= " . (time()-300) . "
ORDER BY s.session_time DESC"; ORDER BY s.session_time DESC";
$result = $db->sql_query($sql); if(!$result = $db->sql_query($sql))
if(!$result)
{ {
error_die(SQL_QUERY, "Couldn't obtain user/online information.", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Couldn't obtain user/online information.", "", __LINE__, __FILE__, $sql);
} }
$onlinerow = $db->sql_fetchrowset($result); $onlinerow = $db->sql_fetchrowset($result);
$sql = "SELECT forum_name, forum_id $sql = "SELECT forum_name, forum_id
FROM ".FORUMS_TABLE; FROM ".FORUMS_TABLE;
$forums_result = $db->sql_query($sql); if($forums_result = $db->sql_query($sql))
if(!$forums_result)
{
error_die(SQL_QUERY, "Couldn't obtain user/online forums information.", __LINE__, __FILE__);
}
else
{ {
while($forumsrow = $db->sql_fetchrow($forums_result)) while($forumsrow = $db->sql_fetchrow($forums_result))
{ {
$forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name']; $forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name'];
} }
} }
else
if(!$onlinerow || !$forum_data)
{ {
error_die(SQL_QUERY, "Couldn't fetchrow.", __LINE__, __FILE__); message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql);
} }
$template->assign_vars(array( $template->assign_vars(array(
@ -165,6 +161,10 @@ if($online_count)
$location = $lang['Forum_index']; $location = $lang['Forum_index'];
$location_url = "index.$phpEx"; $location_url = "index.$phpEx";
break; break;
case PAGE_POSTING:
$location = "";
$location_url = "";
break;
case PAGE_LOGIN: case PAGE_LOGIN:
$location = $lang['Loggin_on']; $location = $lang['Loggin_on'];
$location_url = "index.$phpEx"; $location_url = "index.$phpEx";
@ -204,45 +204,34 @@ if($online_count)
$location = $forum_data[$onlinerow[$i]['session_page']]; $location = $forum_data[$onlinerow[$i]['session_page']];
} }
//
// What would be nice here is to let
// the template designer decide whether
// to display all users, registered users
// or just logged in users ... but we need
// if... constructs in the templating system
// for that ...
//
if( $logged_on && ( !$hidden || $userdata['user_level'] == ADMIN ) ) if( $logged_on && ( !$hidden || $userdata['user_level'] == ADMIN ) )
{ {
$template->assign_block_vars("userrow", $template->assign_block_vars("userrow", array(
array(
"ROW_COLOR" => $row_color, "ROW_COLOR" => $row_color,
"USERNAME" => $username, "USERNAME" => $username,
"LOGGED_ON" => $logged_on, "LOGGED_ON" => $logged_on,
"LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow[$i]['session_time'], $board_config['default__timezone']), "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow[$i]['session_time'], $board_config['default__timezone']),
"LOCATION" => $location, "LOCATION" => $location,
"U_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $onlinerow[$i]['user_id']), "U_USER_PROFILE" => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $onlinerow[$i]['user_id']),
"U_FORUM_LOCATION" => append_sid($location_url) "U_FORUM_LOCATION" => append_sid($location_url))
)
); );
} }
} }
$template->assign_vars(array( $template->assign_vars(array(
"ACTIVE_USERS" => $active_users, "ACTIVE_USERS" => $active_users,
"HIDDEN_USERS" => $hidden_users, "HIDDEN_USERS" => $hidden_users,
"GUEST_USERS" => $guest_users "GUEST_USERS" => $guest_users)
)
); );
$template->pparse("body"); $template->pparse("body");
} }
else else
{ {
error_die(GENERAL_ERROR, "There are no users currently browsing this forum"); message_die(GENERAL_MESSAGE, "There are no users currently browsing this forum");
} }
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>

View file

@ -20,9 +20,10 @@
* *
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); $phpbb_root_path = "./";
include('common.'.$phpEx); include($phpbb_root_path . 'extension.inc');
include('includes/bbcode.'.$phpEx); include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
$page_title = $lang['View_topic'] ." - $topic_title"; $page_title = $lang['View_topic'] ." - $topic_title";
$pagetype = "viewtopic"; $pagetype = "viewtopic";
@ -195,7 +196,7 @@ $ranksrow = $db->sql_fetchrowset($ranksresult);
// //
// Dump out the page header and oad viewtopic body template // Dump out the page header and oad viewtopic body template
// //
include('includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(
"body" => "viewtopic_body.tpl", "body" => "viewtopic_body.tpl",
@ -496,6 +497,6 @@ $template->assign_vars(array(
$template->pparse("body"); $template->pparse("body");
include('includes/page_tail.'.$phpEx); include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?> ?>