[外掛]改變版面語言及風格 1.0

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
頭像
godbless
竹貓忠實會員
竹貓忠實會員
文章: 647
註冊時間: 2002-05-17 06:02
來自: 台北市南京東路4段
聯繫:

[外掛]改變版面語言及風格 1.0

文章 godbless »

1.0版僅適用於Plus 1.x上面\r
裡面僅有可以裝在phpbb Plus 1.x 上的設定
並且修改了一些原模組的BUG

參考使用的MODS的連結如下:
1.Cees-Jan Kiewiet < webmaster@iceblow.zzn.com > - change guest template mod (找不到連結) ★⊙。~~~。⊙★
2.Tom Cioffe Jr < gwyd@cioffe.com > - change style on index / counts users mod
3.Smartor < smartor_xp@hotmail.com > - http://smartor.is-root.com - ezPortal & Change Style for Smartor's ezPortal
4.yuan - http://www.timer.idv.tw/ - select default language mod for Smartor's ezPortal
5.Niels Chr. R鷣 Denmark < ncr@db9.dk > - select default language mod

這個版本主要就只是讓使用者在未登入前可以有機會的改變它所看到的版面風格和語言設定,讓未註冊及未登入的會員能夠更快的了解論壇~


[php]<?php
########################################################
## Mod Title: Change Style & language on Index & Smartor's ezPortal
## Mod Version: 1.0
## 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
##
##
#################################################################
## 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'],

#
#-----[ OPEN ]------------------------------------------
#
#
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}">\r
{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
?>[/php]
外掛問題區發問格式就在這裡,請務必一定照著格式來~!
你不照著規則來,就算是也搞不清楚你的問題在哪裡!
新手問問題不是罪惡
罪惡的是自己沒有先做好本分和功課,說話的口氣也不好,再加上態度有好像我們這群人欠你多少似的~~!!
竹貓星球發問規則:
http://phpbb-tw.net/phpbb/viewtopic.php?t=16149
發問比率最高的句子翻譯:
Please ensure both the install/ and contrib/ directories are deleted
請確認install和contrib資料夾已被刪除(奇怪,翻一下英漢字典有這麼困難嗎)
主題已鎖定

回到「非官方認證外掛」