1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 00:07:44 +02:00

Moved config, images vars to arrays and various other fixes

git-svn-id: file:///svn/phpbb/trunk@237 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen
2001-05-03 22:10:23 +00:00
parent df716e1e83
commit aa8a051a98
16 changed files with 437 additions and 362 deletions

View File

@@ -144,11 +144,9 @@ function make_jumpbox()
// Initialise user settings on page load
function init_userprefs($userdata)
{
global $override_user_theme, $template, $sys_template;
global $default_lang, $default_theme, $date_format, $sys_timezone;
global $theme;
global $board_config, $theme, $template, $lang, $phpEx;
if(!$override_user_themes)
if(!$board_config['override_user_themes'])
{
if(($userdata['user_id'] != ANONYMOUS || $userdata['user_id'] != DELETED) && $userdata['user_theme'])
{
@@ -156,24 +154,24 @@ function init_userprefs($userdata)
}
else
{
$theme = setuptheme($default_theme);
$theme = setuptheme($board_config['default_theme']);
}
}
else
{
$theme = setuptheme($override_user_theme);
$theme = setuptheme($board_config['override_user_themes']);
}
if($userdata['user_lang'] != '')
{
$default_lang = $userdata['user_lang'];
$board_config['default_lang'] = $userdata['user_lang'];
}
if($userdata['user_dateformat'] != '')
{
$date_format = $userdata['user_dateformat'];
$board_config['default_dateformat'] = $userdata['user_dateformat'];
}
if(isset($userdata['user_timezone']))
{
$sys_timezone = $userdata['user_timezone'];
$board_config['default_timezone'] = $userdata['user_timezone'];
}
// Setup user's Template
if($userdata['user_template'] != '')
@@ -182,35 +180,35 @@ function init_userprefs($userdata)
}
else
{
$template = new Template("templates/".$sys_template);
$template = new Template("templates/".$board_config['default_template']);
}
// Include the appropriate language file ... if it exists.
if(!strstr($PHP_SELF, "admin"))
//
// This is currently worthless since all the individual
// language variables will only be locally defined in this
// function and not accessible to the board code globally.
// This will be fixed by moving all $l_xxxx vars into a single
// $lang[''] array
//
if( file_exists("language/lang_".$board_config['default_lang'].".".$phpEx) )
{
if(file_exists('language/lang_'.$default_lang.'.'.$phpEx))
{
include('language/lang_'.$default_lang.'.'.$phpEx);
}
include('language/lang_'.$board_config['default_lang'].'.'.$phpEx);
}
else
{
if(strstr($PHP_SELF, "topicadmin"))
{
include('language/lang_'.$default_lang.'.'.$phpEx);
}
else
{
include('../language/lang_'.$default_lang.'.'.$phpEx);
}
include('language/lang_english'.$phpEx);
}
return;
}
function setuptheme($theme)
{
global $db;
$sql = "SELECT * FROM ".THEMES_TABLE." WHERE themes_id = '$theme'";
$sql = "SELECT *
FROM ".THEMES_TABLE."
WHERE themes_id = '$theme'";
if(!$result = $db->sql_query($sql))
{

View File

@@ -53,17 +53,17 @@ else
//
// Do timezone text output
//
if($sys_timezone < 0)
if($board_config['default_timezone'] < 0)
{
$s_timezone = "$l_all_times GMT - ".(-$sys_timezone)." $l_hours";
$s_timezone = "$l_all_times GMT - ".(-$board_config['default_timezone'])." $l_hours";
}
else if($sys_timezone == 0)
else if($board_config['default_timezone'] == 0)
{
$s_timezone = "$l_all_times GMT";
}
else
{
$s_timezone = "$l_all_times GMT + $sys_timezone $l_hours";
$s_timezone = "$l_all_times GMT + ".$board_config['default_timezone']." $l_hours";
}
//
@@ -73,8 +73,7 @@ else
$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)."'
";
AND s.session_time >= '".(time() - 300)."'";
$result = $db->sql_query($sql);
if(!$result)
{
@@ -109,7 +108,7 @@ $l_is_are = ($logged_online == 1) ? $l_is : $l_are;
$userlist = ($logged_online > 0) ? "$l_Registered $l_r_user_s: " . $userlist : "$l_Registered $l_r_user_s: $l_None";
$template->assign_vars(array(
"SITENAME" => $sitename,
"SITENAME" => $board_config['sitename'],
"PHPEX" => $phpEx,
"PHPSELF" => $PHP_SELF,
@@ -147,9 +146,11 @@ $template->assign_vars(array(
"L_AUTO_LOGIN" => $l_autologin,
"L_AUTHOR" => $l_author,
"L_MESSAGE" => $l_message,
"L_BY" => $l_by,
"L_LOGIN_LOGOUT" => $l_login_logout,
"U_INDEX" => "index.".$phpEx,
"U_REGISTER" => "profile.".$phpEx."?mode=register",
"U_PROFILE" => "profile.".$phpEx."?mode=editprofile",
"U_PRIVATEMSGS" => "priv_msgs.".$phpEx."?mode=read",
@@ -241,7 +242,8 @@ switch($pagetype)
$template->assign_vars(array(
"FORUM_ID" => $forum_id,
"FORUM_NAME" => $forum_name,
"MODERATORS" => $forum_moderators));
"MODERATORS" => $forum_moderators,
"USERS_BROWSING" => $users_browsing));
$template->pparse("header");
break;
@@ -262,7 +264,8 @@ switch($pagetype)
"FORUM_NAME" => $forum_name,
"TOPIC_ID" => $topic_id,
"TOPIC_TITLE" => $topic_title,
"POST_FORUM_URL" => POST_FORUM_URL));
"POST_FORUM_URL" => POST_FORUM_URL,
"USERS_BROWSING" => $users_browsing));
$template->pparse("header");
break;
@@ -306,12 +309,10 @@ switch($pagetype)
break;
case 'register':
if(!isset($agreed))
if(!isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']))
{
if(!isset($coppa))
{
$coppa = FALSE;
}
$coppa = (!isset($HTTP_POST_VARS['coppa'])) ? FALSE : TRUE;
$template->set_filenames(array(
"body" => "agreement.tpl"));
$template->assign_vars(array(
@@ -330,4 +331,4 @@ switch($pagetype)
break;
}
?>
?>

View File

@@ -50,12 +50,13 @@ switch($pagetype)
//
if($userdata['session_logged_in'])
{
$admin_link = "<a href=\"admin/index.php\">Administration Panel</a>";
$admin_link = "<a href=\"admin/index.$phpEx\">Administration Panel</a>";
}
$current_time = time();
$template->assign_vars(array("PHPBB_VERSION" => "2.0-alpha",
"CURRENT_TIME" => create_date($date_format, $current_time, $sys_timezone),
"ADMIN_LINK" => $admin_link));
$template->assign_vars(array(
"PHPBB_VERSION" => "2.0-alpha",
"CURRENT_TIME" => create_date($board_config['default_dateformat'], $current_time, $board_config['default_timezone']),
"ADMIN_LINK" => $admin_link));
$template->pparse("overall_footer");