[Mod] Change Style & language 1.1
Tarih: 18.11.2005, 16:56
- Kod: Tümünü seç
########################################################
## Mod Title: Change Style & language on Index & Smartor's ezPortal
## Mod Version: 1.1
## Author: GFF_Grant(godbless) < godbless@gff.mac.to > - http://gff.mac.to
##
## Lots of credits to: Cees-Jan Kiewiet < webmaster@iceblow.zzn.com > - change guest template mod
## Tom Cioffe Jr < gwyd@cioffe.com > - change style on index / counts users mod
## Smartor < smartor_xp@hotmail.com > - http://smartor.is-root.com - ezPortal & Change Style for Smartor's ezPortal
## yuan - http://www.timer.idv.tw/ - select default language mod for Smartor's ezPortal
## Niels Chr. R鷣 Denmark < ncr@db9.dk > - select default language mod
##
## This mod is based on Cess-Jan Kiewiet's change guest template mod . If a user is logged in,
## their choice of template is stored in a cookie for 6 hours. Otherwise,
## the logged in user's choice in inputted directly into the database.
##
##
## This mod is for phpBB2 Plus 1.x
##
## Installation rated: easy-medium
## Installation time: aprox 5-10 min (for editing templates)
##
## Files to edit: 3 or 5
## common.php
## index.php
## templates/Your Templates/index_body.tpl
## portal.php
## templates/Your Templates/portal_body.tpl
##
## History:
## ------------
## 1.0 Confirmed for phpBB2 Plus 1.x
##
## 1.1 Confirmed for phpBB2 Plus 1.x & phpBB 2.0.x
##
#################################################################
## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites
#################################################################
##
## Installation Notes:
##
## The most important thing to keep in mind is, take your time, make
## sure you are finding the correct lines to modify, then take care to paste the new code.
## Please also keep in mind, if you are using more than one language file or theme at your
## site, you will need to edit the corrosponding files for each occurrence. Good Luck!
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################
#
#-----[ OPEN ]------------------------------------------
#
common.php
#
#-----[FIND]------------------------------------------
#
$board_config[$row['config_name']] = $row['config_value'];
}
#
#-----[AFTER, ADD]------------------------------------------
#
if ($language)
{
$board_config['default_lang'] = $language;
setcookie('default_lang',$language , (time()+21600), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
} else if (isset($HTTP_COOKIE_VARS['default_lang']) )
$board_config['default_lang']=$HTTP_COOKIE_VARS['default_lang'];
if ($template)
{
$board_config['default_style'] = $template;
setcookie('default_style',$template , (time()+21600), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
} else if (isset($HTTP_COOKIE_VARS['default_style']) )
$board_config['default_style']=$HTTP_COOKIE_VARS['default_style'];
#
#-----[ OPEN ]------------------------------------------
#
index.php
#
#-----[FIND]------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#-----[ADD AFTER]------------------------------------------
#
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx); // Change Style & Language
#
#-----[ FIND ]------------------------------------------
#
//
// Handle marking posts
//
#
#-----[ADD BEFORE]------------------------------------------
#
// Change Style
$fpage_style = $userdata['user_style'];
if(isset($HTTP_POST_VARS['fpage_theme']))
{
$fpage_theme = intval($HTTP_POST_VARS['fpage_theme']);
$fpuser_id = $userdata['user_id'];
$fp_sql = "UPDATE " . USERS_TABLE . " SET user_style = '$fpage_theme' WHERE user_id = $fpuser_id";
if ( !($fp_result = $db->sql_query($fp_sql)) )
{
message_die(GENERAL_ERROR, 'Could not update users table ' . "$user_id $fpage_theme", '', __LINE__, __FILE__, $sql);
}
else
{
$fp_message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $fp_message);
}
}
#
#-----[FIND]------------------------------------------
#
'FORUM_LOCKED_IMG' => $images['forum_locked'],
#
#-----[AFTER, ADD]------------------------------------------
#
// Change Style & Language
'LANGUAGE_SELECT' => language_select($board_config['default_lang'], 'language'),
'L_SELECT_LANG' => $lang['Board_lang'],
'TEMPLATE_SELECT' => style_select($board_config['default_style'], 'template'),
'L_SELECT_STYLE' => $lang['Board_style'],
'FPAGE_STYLE' => style_select($fpage_style, 'fpage_theme'),
'L_CHANGE_NOW' => $lang['Go'],
# (only for phpBB 2.0.x )
#-----[ OPEN ]------------------------------------------
#
# (remember to change this in every template dir)
templates/Your Templates/index_body.tpl
#
#-----[FIND]------------------------------------------
#
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
</span> </td>
</tr>
</table>
</form>
<!-- END switch_user_logged_out -->
#
#-----[REPLACE WITH]------------------------------------------
#
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
</span> </td>
</tr>
</form>
<tr>
<td class="catHead" height="28"><a name="login"></a><span class="cattitle">{L_SELECT_LANG}</span></td>
</tr>
<tr>
<td class="row1" align="center" valign="middle" height="28"><span class="gensmall">
<form method="post" action=""{U_INDEX}">
{LANGUAGE_SELECT}&&& <input type="submit" class="mainoption" name="cangenow" value="{L_CHANGE_NOW}" />
</span></td>
</tr> </form>
</form>
<tr>
<td class="catHead" height="28"><a name="login"></a><span class="cattitle">{L_SELECT_STYLE}</span></td>
</tr>
<tr>
<td class="row1" align="center" valign="middle" height="28"><span class="gensmall">
<form method="post" action=""{U_INDEX}">
{TEMPLATE_SELECT}&&& <input type="submit" class="mainoption" name="cangenow" value="{L_CHANGE_NOW}" />
</span></td>
</tr> </form>
</table>
<!-- END switch_user_logged_out -->
# (only for phpBB Plus 1.x )
#-----[ OPEN ]------------------------------------------
#
# (remember to change this in every template dir)
templates/Your Templates/index_body.tpl
#
#-----[FIND]------------------------------------------
#
<!-- END switch_user_logged_out -->
<tr>
<td class="row1"><span class="gensmall">
#
#-----[BEFORE ADD]------------------------------------------
#
</form>
<tr>
<th colspan="2" class="thCornerL" height="25" nowrap="nowrap">
{L_SELECT_LANG}
</span></td>
<tr>
<td class="row1" align="center" valign="middle" height="28"><span class="gensmall">
<form method="post" action=""{U_INDEX}">{LANGUAGE_SELECT}
<input type="submit" class="mainoption" name="cangenow" value="{L_CHANGE_NOW}" />
</span></td>
</tr><td class="row1">
<hr>
</td>
</tr>
</form>
<tr>
<th colspan="2" class="thCornerL" height="25" nowrap="nowrap">
{L_SELECT_STYLE}
</span></td>
<tr>
<td class="row1" align="center" valign="middle" height="28"><span class="gensmall">
<form method="post" action=""{U_INDEX}">
{TEMPLATE_SELECT} <input type="submit" class="mainoption" name="fpcangenow" value="{L_CHANGE_NOW}" />
</span></td>
</tr><td class="row1">
<hr>
</td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
portal.php
#
#-----[FIND]------------------------------------------
#
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'fetchposts.'.$phpEx);
#
#-----[AFTER, ADD]------------------------------------------
#
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx); // Change Style & Language
#
#-----[ FIND ]----------------------------------------
#
$template->assign_vars(array(
'WELCOME_TEXT' => $CFG['welcome_text'],
'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts),
'TOTAL_USERS' => sprintf($l_total_user_s, $total_users),
#
#-----[ BEFORE ADD ]-----------------------------------
#
// Change Style
$fpage_style = $userdata['user_style'];
if(isset($HTTP_POST_VARS['fpage_theme']))
{
$fpage_theme = intval($HTTP_POST_VARS['fpage_theme']);
$fpuser_id = $userdata['user_id'];
$fp_sql = "UPDATE " . USERS_TABLE . " SET user_style = '$fpage_theme' WHERE user_id = $fpuser_id";
if ( !($fp_result = $db->sql_query($fp_sql)) )
{
message_die(GENERAL_ERROR, 'Could not update users table ' . "$user_id $fpage_theme", '', __LINE__, __FILE__, $sql);
}
else
{
$fp_message = $lang['Profile_updated'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>');
message_die(GENERAL_MESSAGE, $fp_message);
}
}
#
#-----[ FIND ]----------------------------------------
#
'L_VOTE_BUTTON' => $lang['Vote'],
#
#-----[ AFTER ADD ]-----------------------------------
#
// Change Style & Language
'LANGUAGE_SELECT' => language_select($board_config['default_lang'], 'language'),
'L_SELECT_LANG' => $lang['Board_lang'],
'TEMPLATE_SELECT' => style_select($board_config['default_style'], 'template'),
'L_SELECT_STYLE' => $lang['Board_style'],
'FPAGE_STYLE' => style_select($fpage_style, 'fpage_theme'),
'L_CHANGE_NOW' => $lang['Go'],
#
#-----[ OPEN ]---------------------------------------------
#
templates/Your Templates/portal_body.tpl
#
#-----[ FIND ]----------------------------------------
#
<!-- BEGIN switch_user_logged_in -->
<center><br />{AVATAR_IMG}</center>
<br />{LAST_VISIT_DATE}<br />
<!-- END switch_user_logged_in -->
<br />{CURRENT_TIME}<br /><br />{S_TIMEZONE}
#
#-----[ AFTER ADD ]-----------------------------------
#
<br /><br /><form method="post" action="{U_PORTAL}"><span style="filter: glow(color=blue,strength=3); height:10px; color:white; padding:1px; font-size : 11px">{L_SELECT_STYLE}:<br /></span><br />
<!-- BEGIN switch_user_logged_out -->
{TEMPLATE_SELECT} <input type="submit" class="mainoption" name="cangenow" value="{L_CHANGE_NOW}" />
<!-- END switch_user_logged_out -->
<!-- BEGIN switch_user_logged_in -->
{FPAGE_STYLE} <input type="submit" class="mainoption" name="fpcangenow" value="{L_CHANGE_NOW}" />
<!-- END switch_user_logged_in -->
</form>
#
#-----[FIND]------------------------------------------
#
</table>
</form>
<!-- END switch_user_logged_out -->
#
#-----[BEFORE ADD]------------------------------------------
#
</form><th colspan="2" class="thCornerL" height="25" nowrap="nowrap">
{L_SELECT_LANG}
</span></td>
<tr>
<td class="row1" align="center" valign="middle" height="28"><span class="gensmall">
<form method="post" action=""{U_INDEX}">{LANGUAGE_SELECT}<input type="submit" class="mainoption" name="cangenow" value="{L_CHANGE_NOW}" />
</span></td>
</tr></form>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
#EoM