Another change to the way {LANG} is handled for images ... last one, ... hopefully :)

git-svn-id: file:///svn/phpbb/trunk@2054 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-02-04 18:31:22 +00:00
parent cc5e68b05d
commit 92a27156d8
2 changed files with 66 additions and 85 deletions

View file

@ -242,26 +242,6 @@ function init_userprefs($userdata)
global $board_config, $theme, $images;
global $template, $lang, $phpEx, $phpbb_root_path;
if( !$board_config['override_user_style'] )
{
if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) )
{
$theme = setup_style($userdata['user_style']);
if( !$theme )
{
$theme = setup_style($board_config['default_style']);
}
}
else
{
$theme = setup_style($board_config['default_style']);
}
}
else
{
$theme = setup_style($board_config['default_style']);
}
if( $userdata['user_id'] != ANONYMOUS )
{
if( !empty($userdata['user_lang']))
@ -297,15 +277,28 @@ function init_userprefs($userdata)
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_admin.' . $phpEx);
}
while( list($key, $value) = @each($images) )
//
// Set up style
//
if( !$board_config['override_user_style'] )
{
if( strstr($value, "{LANG}") )
if( $userdata['user_id'] != ANONYMOUS && isset($userdata['user_style']) )
{
$new_value = str_replace("{LANG}", $board_config['default_lang'], $value);
$images[$key] = ( file_exists($new_value) ) ? $new_value : str_replace("{LANG}", "english", $value);
$theme = setup_style($userdata['user_style']);
if( !$theme )
{
$theme = setup_style($board_config['default_style']);
}
}
else
{
$theme = setup_style($board_config['default_style']);
}
}
else
{
$theme = setup_style($board_config['default_style']);
}
return;
}
@ -317,12 +310,12 @@ function setup_style($style)
$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id = $style";
if(!$result = $db->sql_query($sql))
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, "Couldn't query database for theme info.");
}
if( !$row = $db->sql_fetchrow($result) )
if( !($row = $db->sql_fetchrow($result)) )
{
message_die(CRITICAL_ERROR, "Couldn't get theme data for themes_id=$style.");
}
@ -342,9 +335,16 @@ function setup_style($style)
message_die(CRITICAL_ERROR, "Couldn't open $template_name template config file");
}
if( file_exists($current_template_path . '/images/lang_' . $board_config['default_lang']) )
{
while( list($key, $value) = @each($images) )
{
$images[$key] = str_replace("{LANG}", 'lang_' . $board_config['default_lang'], $value);
}
}
}
return($row);
return $row;
}
function generate_activation_key()

View file

@ -1,14 +1,6 @@
<?php
//
// Do not alter this line!
//
define(TEMPLATE_CONFIG, TRUE);
//
// Configuration file for subSilver template
//
// $Id$
// ** Configuration file for subSilver template **
//
// ** copyright (C) 2001 The phpBB Group **
// ** Created by subBlue design **
@ -16,35 +8,36 @@ define(TEMPLATE_CONFIG, TRUE);
//
// ** subSilver dev. forum: www.subSky.com/phpBB2/ **
//
// This contains (at present) an array, images which
// points to the location of individiual images used
// by the template
// $Id$
//
// Please note that to enable support of different languages
// the {LANG} place holder is available. This will be replaced
// with the users selected language, eg. english, german, polish. The
// suggested method is to keep all button related images (eg. post,
// reply, quote, etc.) in subfolders; lang_english, lang_german, etc.
// which requires lang_{LANG} to be part of the path name as below
// with xxx where xxx is the users selected language. If
// that language isn't available it will default to english.
// Therefore you MUST ensure you have at least a english
// directory if you choose to localise your template
//
//
// Do not alter this line!
//
define(TEMPLATE_CONFIG, TRUE);
$current_template_images = $current_template_path . "/images";
$smilies_url = "images/smiles";
$images['icon_quote'] = "$current_template_images/lang_{LANG}/icon_quote.gif";
$images['icon_edit'] = "$current_template_images/lang_{LANG}/icon_edit.gif";
$images['icon_search'] = "$current_template_images/lang_{LANG}/icon_search.gif";
$images['icon_profile'] = "$current_template_images/lang_{LANG}/icon_profile.gif";
$images['icon_pm'] = "$current_template_images/lang_{LANG}/icon_pm.gif";
$images['icon_email'] = "$current_template_images/lang_{LANG}/icon_email.gif";
$images['icon_quote'] = "$current_template_images/{LANG}/icon_quote.gif";
$images['icon_edit'] = "$current_template_images/{LANG}/icon_edit.gif";
$images['icon_search'] = "$current_template_images/{LANG}/icon_search.gif";
$images['icon_profile'] = "$current_template_images/{LANG}/icon_profile.gif";
$images['icon_pm'] = "$current_template_images/{LANG}/icon_pm.gif";
$images['icon_email'] = "$current_template_images/{LANG}/icon_email.gif";
$images['icon_delpost'] = "$current_template_images/icon_delete.gif";
$images['icon_ip'] = "$current_template_images/lang_{LANG}/icon_ip.gif";
$images['icon_www'] = "$current_template_images/lang_{LANG}/icon_www.gif";
$images['icon_icq'] = "$current_template_images/lang_{LANG}/icon_icq_add.gif";
$images['icon_aim'] = "$current_template_images/lang_{LANG}/icon_aim.gif";
$images['icon_yim'] = "$current_template_images/lang_{LANG}/icon_yim.gif";
$images['icon_msnm'] = "$current_template_images/lang_{LANG}/icon_msnm.gif";
$images['icon_ip'] = "$current_template_images/{LANG}/icon_ip.gif";
$images['icon_www'] = "$current_template_images/{LANG}/icon_www.gif";
$images['icon_icq'] = "$current_template_images/{LANG}/icon_icq_add.gif";
$images['icon_aim'] = "$current_template_images/{LANG}/icon_aim.gif";
$images['icon_yim'] = "$current_template_images/{LANG}/icon_yim.gif";
$images['icon_msnm'] = "$current_template_images/{LANG}/icon_msnm.gif";
$images['icon_minipost'] = "$current_template_images/icon_minipost.gif";
$images['icon_gotopost'] = "$current_template_images/icon_minipost.gif";
$images['icon_minipost_new'] = "$current_template_images/icon_minipost_new.gif";
@ -66,10 +59,10 @@ $images['folder_sticky_new'] = "$current_template_images/folder_sticky_new.gif";
$images['folder_announce'] = "$current_template_images/folder_announce.gif";
$images['folder_announce_new'] = "$current_template_images/folder_announce_new.gif";
$images['post_new'] = "$current_template_images/lang_{LANG}/post.gif";
$images['post_locked'] = "$current_template_images/lang_{LANG}/reply-locked.gif";
$images['reply_new'] = "$current_template_images/lang_{LANG}/reply.gif";
$images['reply_locked'] = "$current_template_images/lang_{LANG}/reply-locked.gif";
$images['post_new'] = "$current_template_images/{LANG}/post.gif";
$images['post_locked'] = "$current_template_images/{LANG}/reply-locked.gif";
$images['reply_new'] = "$current_template_images/{LANG}/reply.gif";
$images['reply_locked'] = "$current_template_images/{LANG}/reply-locked.gif";
$images['pm_inbox'] = "$current_template_images/msg_inbox.gif";
$images['pm_outbox'] = "$current_template_images/msg_outbox.gif";
@ -77,10 +70,10 @@ $images['pm_savebox'] = "$current_template_images/msg_savebox.gif";
$images['pm_sentbox'] = "$current_template_images/msg_sentbox.gif";
$images['pm_readmsg'] = "$current_template_images/folder.gif";
$images['pm_unreadmsg'] = "$current_template_images/folder_new.gif";
$images['pm_replymsg'] = "$current_template_images/lang_{LANG}/reply.gif";
$images['pm_postmsg'] = "$current_template_images/lang_{LANG}/msg_newpost.gif";
$images['pm_quotemsg'] = "$current_template_images/lang_{LANG}/icon_quote.gif";
$images['pm_editmsg'] = "$current_template_images/lang_{LANG}/icon_edit.gif";
$images['pm_replymsg'] = "$current_template_images/{LANG}/reply.gif";
$images['pm_postmsg'] = "$current_template_images/{LANG}/msg_newpost.gif";
$images['pm_quotemsg'] = "$current_template_images/{LANG}/icon_quote.gif";
$images['pm_editmsg'] = "$current_template_images/{LANG}/icon_edit.gif";
$images['pm_new_msg'] = "";
$images['pm_no_new_msg'] = "";
@ -98,18 +91,6 @@ $images['voting_graphic'][2] = "$current_template_images/voting_bar.gif";
$images['voting_graphic'][3] = "$current_template_images/voting_bar.gif";
$images['voting_graphic'][4] = "$current_template_images/voting_bar.gif";
$images['auth_can_read'] = "";
$images['auth_cannot_read'] = "";
$images['auth_can_post'] = "";
$images['auth_cannot_post'] = "";
$images['auth_can_reply'] = "";
$images['auth_cannot_reply'] = "";
$images['auth_can_edit'] = "";
$images['auth_cannot_edit'] = "";
$images['auth_can_delete'] = "";
$images['auth_cannot_delete'] = "";
$images['auth_mod'] = "";
//
// Vote graphic length defines the maximum length of a vote result
// graphic, ie. 100% = this length