index.php?language=nl
index.php?language=en
index.php?language=de
thnx

Code: Selecteer alles
File isn't writeble!
Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/esaclan.com/subdomains/mods/httpdocs/index.php:80) in /home/httpd/vhosts/esaclan.com/subdomains/mods/httpdocs/index.php on line 95
Code: Selecteer alles
###############################################
## With this hack you can show a language by url. If your url is index.php?lang=english the english language will be picked.
###############################################
#
#-----[ SQL ]------------------------------------------
# Please change phpbb_ with your table prefix
#
ALTER TABLE phpbb_sessions ADD session_lang VARCHAR(255) ;
#
#-----[ OPEN ]------------------------------------------
#
includes/funtions.php
#
#-----[ FIND ]------------------------------------------
#
global $nav_links;
#
#-----[ ADD, AFTER ]------------------------------------------
#
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID, $db, $user_ip;
#
#-----[ FIND ]------------------------------------------
#
if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx)) )
{
$board_config['default_lang'] = 'english';
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
$language = '';
$session_id = $userdata['session_id'];
if ( !empty($HTTP_GET_VARS['lang']) )
{
$language = $HTTP_GET_VARS['lang'];
if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $language . '/lang_main.'.$phpEx)) )
{
$language = $board_config['default_lang'];
}
$sql = "UPDATE " . SESSIONS_TABLE . "
SET session_lang = '$language'
WHERE session_id = '" . $session_id . "'
AND session_ip = '$user_ip'";
if ( !$db->sql_query($sql) )
{
message_die(CRITICAL_ERROR, 'Error updating session_lang', '', __LINE__, __FILE__, $sql);
}
}
else
{
$sql = "SELECT session_lang
FROM " . SESSIONS_TABLE . "
WHERE session_id = '" . $session_id . "'
AND session_ip = '" . $user_ip . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not query language info');
}
if ( $row = $db->sql_fetchrow($result) )
{
$language = $row['session_lang'];
}
}
if ( $language == "" )
{
$language = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_lang']) ) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_lang'] : $board_config['default_lang'];
}
else
{
setcookie($board_config['cookie_name'] . '_lang', $language, time()+3600);
}
if ( !file_exists(@phpbb_realpath($phpbb_root_path . 'language/lang_' . $language . '/lang_main.'.$phpEx)) )
{
$language = 'english';
}
$board_config['default_lang'] = $language;
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
# Eom
#
Code: Selecteer alles
##############################################################
## MOD Title: Select default language
## MOD Author: Niels < ncr@db9.dk > (Niels Chr. Rød) http://mods.db9.dk
## MOD Description: This mod will try change default lang to
## what ever the users browser is set to. If it
## can't, the user (guest only) can temporary
## change the default language selection.
## MOD Version: 1.3.4
## MOD Compatibility: 2.0.4->2.0.6 (prior release not tested)
##
## Installation Level: Easy
## Installation Time: 2 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit: 4
## common.php
## index.php
## language/lang_english/lang_main.php
## templates/subSilver/index_body.tpl
##
## Included Files: 0
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## 1. Full MOD description
## -----------
## This mod will try change default lang to what ever the users
## browser is set to. If it can't, the user (guest only) can
## temporary change the default language selection with a drop
## down from index, only for the current browsing user any page
## can be called with the language parmeter, and the change will
## only happen to that specific computer who have made the request.
## The default language can be changed by the user at any time
## on the main index.
##
## The default language will stay on the selected language for
## 6 hours, until then it can bee changed either by a external
## link, or by the provided "language selection" on the index
## page. After the peroid of 6 hours it goes back to the boards
## default language this is done to insure proper function on
## shared computers.
##
## Note that only installed languages should be parsed, and if
## a user are logged in, he/she will overide this mod and have
## their own language.
## Here is a example on how to use the "external URL":
## mods.db9.dk?language=danish
## Any page can be called with the language extenision, e.g.
## the registration page:
## mods.db9.dk/register.php?agreed=TRUE&language=german
##
## 2. EasyMOD
## -----------
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## However, on alpha releases of EM and meanwhile beta or
## final release some actions are NOT performed.
## You'll have to do them manually !
##
## 2.1 Translation are not managed
## -----------
## EM can not already manage actions for any other
## language than English (but language intructions are proceed
## to all installed languages in order to prevent errors).
## So the translations provided with this MOD must be installed
## manually if you need them.
##
## 3. Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://mods.db9.dk/viewtopic.php?t=9
##
##############################################################
## MOD History:
##
## 2004-08-01 - Version 1.3.4
## - changed a while loop in common.php
##
## 2003-12-21 - Version 1.3.3
## - phpBB template & EasyMOD compliance enhancement
##
## 2003-08-28 - Version 1.3.2
## - corrected common.php, gave error in admin panel
##
## 2003-08-28 - Version 1.3.1
## - now try to change to browsers language, if posible
##
## 2003-08-09 - Version 1.3.0
## - Fix a potential issue with Translate posts MOD
## - Add french, german, italian & spanish translations
## - How-to rewrite to be EasyMOD compatible
## - Same as 1.3.0a except the template design
##
## 2003-08-03 - Version 1.2.1
## - changed the $language
##
## ????-??-?? - Version 1.2.0
## - confirmed for 2.0.4, no change needed
##
## ????-??-?? - Version 1.2.0
## - Confirmed for phpBB2 version 2.0.2.
##
## ????-??-?? - Version 0.9.5
## - changed the way the how-to look, to make it compatible
## with auto installer (not testet)
##
## ????-??-?? - Version 0.9.4
## - History started, added URL explanation to the "how-to" header
##
## ????-??-?? - Version 0.9.1
## - initial Release
##
## ????-??-?? - Version 0.9.0
## - initail BETA release
##
##############################################################
## 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']] =
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - Select default language MOD
if( !isset($board_config['real_default_lang']) )
{
$board_config['real_default_lang'] = $board_config['default_lang'];
}
$language = ( isset($HTTP_POST_VARS['language']) ) ? $HTTP_POST_VARS['language'] : $HTTP_GET_VARS['language'];
if ($language)
{
$language=trim(strip_tags($language));
$board_config['default_lang'] = $language;
setcookie($board_config['cookie_name'].'_default_lang',$language , (time()+21600), $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']);
} else
{
if (isset($HTTP_COOKIE_VARS[$board_config['cookie_name'].'_default_lang']) )
{
$board_config['default_lang']=$HTTP_COOKIE_VARS[$board_config['cookie_name'].'_default_lang'];
} else
{
$dir = opendir($phpbb_root_path.'language');
$lang_d = array();
while (false !== ($file = readdir($dir)))
{
if ( ereg("^lang_", $file) && !is_file($dirname . "/" . $file) && !is_link($dirname . "/" . $file) )
{
$filename = trim(str_replace("lang_", "", $file));
$displayname = preg_replace("/^(.*?)_(.*)$/", "\\1 [ \\2 ]", $filename);
$displayname = preg_replace("/\[(.*?)_(.*)\]/", "[ \\1 - \\2 ]", $displayname);
$lang_d[$displayname] = '1';
}
}
closedir($dir);
@asort($lang_d);
@reset($lang_d);
while ( list($displayname, $filename) = @each($lang_d) )
{
if (strpos($displayname,$_SERVER['HTTP_ACCEPT_LANGUAGE'])===0)
{
$language = $displayname;
$board_config['default_lang'] = $language;
break;
}
}
}
}
// End add - Select default language MOD
#
#-----[ OPEN ]------------------------------------------------
#
index.php
#
#-----[ FIND ]------------------------------------------------
#
include($phpbb_root_path . 'common.'.$phpEx);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - Select default language MOD
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
// End add - Select default language MOD
#
#-----[ FIND ]------------------------------------------------
#
$template->assign_vars(array(
'TOTAL_POSTS' =>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// Start add - Select default language MOD
if ( $board_config['real_default_lang'] == 'english' )
{
$Word_language = 'Language';
} else
{
include($phpbb_root_path . 'language/lang_' . $board_config['real_default_lang']. '/lang_main.'.$phpEx);
$Word_language = 'Language' . ' / ' . $lang['Word_language'] . ' ';
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang']. '/lang_main.'.$phpEx);
}
// End add - Select default language MOD
#
#-----[ FIND ]------------------------------------------------
#
'FORUM_LOCKED_IMG' =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - Select default language MOD
'LANGUAGE_SELECT' => language_select($board_config['default_lang'], 'language'),
'L_SELECT_LANG' => $Word_language,
'L_CHANGE_NOW' => 'OK',
// End add - Select default language MOD
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// Start add - Select default language MOD
$lang['Word_language'] = 'Language';
// End add - Select default language MOD
#
#-----[ OPEN ]------------------------------------------------
#
templates/subSilver/index_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
<!-- Start add - Select default language MOD -->
<!-- BEGIN switch_user_logged_out -->
<form method="post" action="{U_INDEX}"><span class="forumlink" style="margin-left: 2px; font-size: 11px">{L_SELECT_LANG}: </span>{LANGUAGE_SELECT}
<input type="submit" class="mainoption" name="cangenow" value="{L_CHANGE_NOW}" />
</form>
<!-- END switch_user_logged_out -->
<!-- End add - Select default language MOD -->
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM